@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
|
@@ -14,55 +14,46 @@ OF ANY KIND, either express or implied. See the License for the specific languag
|
|
|
14
14
|
governing permissions and limitations under the License.
|
|
15
15
|
*/
|
|
16
16
|
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
17
|
+
const DECLINED_CONSENT = exports.DECLINED_CONSENT = "The user declined consent.";
|
|
18
|
+
const DECLINED_CONSENT_ERROR_CODE = exports.DECLINED_CONSENT_ERROR_CODE = "declinedConsent";
|
|
19
|
+
const CONSENT_SOURCE_DEFAULT = exports.CONSENT_SOURCE_DEFAULT = "default";
|
|
20
|
+
const CONSENT_SOURCE_INITIAL = exports.CONSENT_SOURCE_INITIAL = "initial";
|
|
21
|
+
const CONSENT_SOURCE_NEW = exports.CONSENT_SOURCE_NEW = "new";
|
|
22
|
+
const createDeclinedConsentError = errorMessage => {
|
|
23
|
+
const error = new Error(errorMessage);
|
|
24
24
|
error.code = DECLINED_CONSENT_ERROR_CODE;
|
|
25
25
|
error.message = errorMessage;
|
|
26
26
|
return error;
|
|
27
27
|
};
|
|
28
|
-
var _default =
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
28
|
+
var _default = ({
|
|
29
|
+
logger
|
|
30
|
+
}) => {
|
|
31
|
+
const deferreds = [];
|
|
32
|
+
const runAll = () => {
|
|
32
33
|
while (deferreds.length) {
|
|
33
34
|
deferreds.shift().resolve();
|
|
34
35
|
}
|
|
35
36
|
};
|
|
36
|
-
|
|
37
|
+
const discardAll = () => {
|
|
37
38
|
while (deferreds.length) {
|
|
38
39
|
deferreds.shift().reject(createDeclinedConsentError("The user declined consent."));
|
|
39
40
|
}
|
|
40
41
|
};
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
var awaitIn = function awaitIn() {
|
|
48
|
-
return Promise.resolve();
|
|
49
|
-
};
|
|
50
|
-
var awaitOutDefault = function awaitOutDefault() {
|
|
51
|
-
return Promise.reject(createDeclinedConsentError("No consent preferences have been set."));
|
|
52
|
-
};
|
|
53
|
-
var awaitOut = function awaitOut() {
|
|
54
|
-
return Promise.reject(createDeclinedConsentError("The user declined consent."));
|
|
55
|
-
};
|
|
56
|
-
var awaitPending = function awaitPending(returnImmediately) {
|
|
42
|
+
const awaitInitial = () => Promise.reject(new Error("Consent has not been initialized."));
|
|
43
|
+
const awaitInDefault = () => Promise.resolve();
|
|
44
|
+
const awaitIn = () => Promise.resolve();
|
|
45
|
+
const awaitOutDefault = () => Promise.reject(createDeclinedConsentError("No consent preferences have been set."));
|
|
46
|
+
const awaitOut = () => Promise.reject(createDeclinedConsentError("The user declined consent."));
|
|
47
|
+
const awaitPending = returnImmediately => {
|
|
57
48
|
if (returnImmediately) {
|
|
58
49
|
return Promise.reject(new Error("Consent is pending."));
|
|
59
50
|
}
|
|
60
|
-
|
|
51
|
+
const deferred = (0, _index.defer)();
|
|
61
52
|
deferreds.push(deferred);
|
|
62
53
|
return deferred.promise;
|
|
63
54
|
};
|
|
64
55
|
return {
|
|
65
|
-
in
|
|
56
|
+
in(source) {
|
|
66
57
|
if (source === CONSENT_SOURCE_DEFAULT) {
|
|
67
58
|
this.awaitConsent = awaitInDefault;
|
|
68
59
|
} else {
|
|
@@ -75,7 +66,7 @@ var _default = exports.default = function _default(_ref) {
|
|
|
75
66
|
this.awaitConsent = awaitIn;
|
|
76
67
|
}
|
|
77
68
|
},
|
|
78
|
-
out
|
|
69
|
+
out(source) {
|
|
79
70
|
if (source === CONSENT_SOURCE_DEFAULT) {
|
|
80
71
|
logger.warn("User consent preferences not found. Default consent of out will be used.");
|
|
81
72
|
this.awaitConsent = awaitOutDefault;
|
|
@@ -89,17 +80,17 @@ var _default = exports.default = function _default(_ref) {
|
|
|
89
80
|
this.awaitConsent = awaitOut;
|
|
90
81
|
}
|
|
91
82
|
},
|
|
92
|
-
pending
|
|
83
|
+
pending(source) {
|
|
93
84
|
if (source === CONSENT_SOURCE_DEFAULT) {
|
|
94
85
|
logger.info("User consent preferences not found. Default consent of pending will be used. Some commands may be delayed.");
|
|
95
86
|
}
|
|
96
87
|
this.awaitConsent = awaitPending;
|
|
97
88
|
},
|
|
98
89
|
awaitConsent: awaitInitial,
|
|
99
|
-
withConsent
|
|
90
|
+
withConsent() {
|
|
100
91
|
return this.awaitConsent(true);
|
|
101
92
|
},
|
|
102
|
-
current
|
|
93
|
+
current() {
|
|
103
94
|
switch (this.awaitConsent) {
|
|
104
95
|
case awaitInDefault:
|
|
105
96
|
return {
|
|
@@ -134,4 +125,5 @@ var _default = exports.default = function _default(_ref) {
|
|
|
134
125
|
}
|
|
135
126
|
}
|
|
136
127
|
};
|
|
137
|
-
};
|
|
128
|
+
};
|
|
129
|
+
exports.default = _default;
|
|
@@ -14,21 +14,21 @@ OF ANY KIND, either express or implied. See the License for the specific languag
|
|
|
14
14
|
governing permissions and limitations under the License.
|
|
15
15
|
*/
|
|
16
16
|
|
|
17
|
-
|
|
18
|
-
return
|
|
19
|
-
|
|
17
|
+
const wrapForErrorHandling = (fn, stackMessage) => {
|
|
18
|
+
return (...args) => {
|
|
19
|
+
let result;
|
|
20
20
|
try {
|
|
21
|
-
result = fn
|
|
21
|
+
result = fn(...args);
|
|
22
22
|
} catch (error) {
|
|
23
23
|
throw (0, _index.stackError)({
|
|
24
|
-
error
|
|
24
|
+
error,
|
|
25
25
|
message: stackMessage
|
|
26
26
|
});
|
|
27
27
|
}
|
|
28
28
|
if (result instanceof Promise) {
|
|
29
|
-
result = result.catch(
|
|
29
|
+
result = result.catch(error => {
|
|
30
30
|
throw (0, _index.stackError)({
|
|
31
|
-
error
|
|
31
|
+
error,
|
|
32
32
|
message: stackMessage
|
|
33
33
|
});
|
|
34
34
|
});
|
|
@@ -38,49 +38,50 @@ var wrapForErrorHandling = function wrapForErrorHandling(fn, stackMessage) {
|
|
|
38
38
|
};
|
|
39
39
|
|
|
40
40
|
// TO-DOCUMENT: All public commands and their signatures.
|
|
41
|
-
var _default =
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
var conflictingCommandNames = (0, _index.intersection)(Object.keys(commandsByName), Object.keys(componentCommandsByName));
|
|
41
|
+
var _default = () => {
|
|
42
|
+
const componentsByNamespace = {};
|
|
43
|
+
const commandsByName = {};
|
|
44
|
+
const lifecycleCallbacksByName = {};
|
|
45
|
+
const registerComponentCommands = (namespace, componentCommandsByName = {}) => {
|
|
46
|
+
const conflictingCommandNames = (0, _index.intersection)(Object.keys(commandsByName), Object.keys(componentCommandsByName));
|
|
48
47
|
if (conflictingCommandNames.length) {
|
|
49
48
|
throw new Error("[ComponentRegistry] Could not register " + namespace + " " + ("because it has existing command(s): " + conflictingCommandNames.join(",")));
|
|
50
49
|
}
|
|
51
|
-
Object.keys(componentCommandsByName).forEach(
|
|
52
|
-
|
|
50
|
+
Object.keys(componentCommandsByName).forEach(commandName => {
|
|
51
|
+
const command = componentCommandsByName[commandName];
|
|
53
52
|
command.commandName = commandName;
|
|
54
53
|
command.run = wrapForErrorHandling(command.run, "[" + namespace + "] An error occurred while executing the " + commandName + " command.");
|
|
55
54
|
commandsByName[commandName] = command;
|
|
56
55
|
});
|
|
57
56
|
};
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
Object.keys(componentLifecycleCallbacksByName).forEach(function (hookName) {
|
|
57
|
+
const registerLifecycleCallbacks = (namespace, componentLifecycleCallbacksByName = {}) => {
|
|
58
|
+
Object.keys(componentLifecycleCallbacksByName).forEach(hookName => {
|
|
61
59
|
lifecycleCallbacksByName[hookName] = lifecycleCallbacksByName[hookName] || [];
|
|
62
60
|
lifecycleCallbacksByName[hookName].push(wrapForErrorHandling(componentLifecycleCallbacksByName[hookName], "[" + namespace + "] An error occurred while executing the " + hookName + " lifecycle hook."));
|
|
63
61
|
});
|
|
64
62
|
};
|
|
65
63
|
return {
|
|
66
|
-
register
|
|
67
|
-
|
|
68
|
-
|
|
64
|
+
register(namespace, component) {
|
|
65
|
+
const {
|
|
66
|
+
commands,
|
|
67
|
+
lifecycle
|
|
68
|
+
} = component;
|
|
69
69
|
registerComponentCommands(namespace, commands);
|
|
70
70
|
registerLifecycleCallbacks(namespace, lifecycle);
|
|
71
71
|
componentsByNamespace[namespace] = component;
|
|
72
72
|
},
|
|
73
|
-
getCommand
|
|
73
|
+
getCommand(commandName) {
|
|
74
74
|
return commandsByName[commandName];
|
|
75
75
|
},
|
|
76
|
-
getCommandNames
|
|
76
|
+
getCommandNames() {
|
|
77
77
|
return Object.keys(commandsByName);
|
|
78
78
|
},
|
|
79
|
-
getLifecycleCallbacks
|
|
79
|
+
getLifecycleCallbacks(hookName) {
|
|
80
80
|
return lifecycleCallbacksByName[hookName] || [];
|
|
81
81
|
},
|
|
82
|
-
getComponentNames
|
|
82
|
+
getComponentNames() {
|
|
83
83
|
return Object.keys(componentsByNamespace);
|
|
84
84
|
}
|
|
85
85
|
};
|
|
86
|
-
};
|
|
86
|
+
};
|
|
87
|
+
exports.default = _default;
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
exports.default = void 0;
|
|
4
|
-
var _index = require("../utils/index.js");
|
|
5
4
|
/*
|
|
6
5
|
Copyright 2019 Adobe. All rights reserved.
|
|
7
6
|
This file is licensed to you under the Apache License, Version 2.0 (the "License");
|
|
@@ -13,22 +12,22 @@ the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTA
|
|
|
13
12
|
OF ANY KIND, either express or implied. See the License for the specific language
|
|
14
13
|
governing permissions and limitations under the License.
|
|
15
14
|
*/
|
|
16
|
-
|
|
17
|
-
var
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
15
|
+
const STATE_STORE_HANDLE_TYPE = "state:store";
|
|
16
|
+
var _default = ({
|
|
17
|
+
cookieJar,
|
|
18
|
+
shouldTransferCookie,
|
|
19
|
+
apexDomain,
|
|
20
|
+
dateProvider
|
|
21
|
+
}) => {
|
|
23
22
|
return {
|
|
24
23
|
/**
|
|
25
24
|
* When sending to a third-party endpoint, the endpoint won't be able to
|
|
26
25
|
* access first-party cookies, therefore we transfer cookies into
|
|
27
26
|
* the request body so they can be read by the server.
|
|
28
27
|
*/
|
|
29
|
-
cookiesToPayload
|
|
30
|
-
|
|
31
|
-
|
|
28
|
+
cookiesToPayload(payload, endpointDomain) {
|
|
29
|
+
const isEndpointFirstParty = endpointDomain.endsWith(apexDomain);
|
|
30
|
+
const state = {
|
|
32
31
|
domain: apexDomain,
|
|
33
32
|
cookiesEnabled: true
|
|
34
33
|
};
|
|
@@ -37,8 +36,8 @@ var _default = exports.default = function _default(_ref) {
|
|
|
37
36
|
// to the payload since they'll be automatically passed through cookie
|
|
38
37
|
// headers.
|
|
39
38
|
if (!isEndpointFirstParty) {
|
|
40
|
-
|
|
41
|
-
|
|
39
|
+
const cookies = cookieJar.get();
|
|
40
|
+
const entries = Object.keys(cookies).filter(shouldTransferCookie).map(qualifyingCookieName => {
|
|
42
41
|
return {
|
|
43
42
|
key: qualifyingCookieName,
|
|
44
43
|
value: cookies[qualifyingCookieName]
|
|
@@ -55,12 +54,12 @@ var _default = exports.default = function _default(_ref) {
|
|
|
55
54
|
* write first-party cookies, therefore we write first-party cookies
|
|
56
55
|
* as directed in the response body.
|
|
57
56
|
*/
|
|
58
|
-
responseToCookies
|
|
59
|
-
response.getPayloadsByType(STATE_STORE_HANDLE_TYPE).forEach(
|
|
60
|
-
|
|
57
|
+
responseToCookies(response) {
|
|
58
|
+
response.getPayloadsByType(STATE_STORE_HANDLE_TYPE).forEach(stateItem => {
|
|
59
|
+
const options = {
|
|
61
60
|
domain: apexDomain
|
|
62
61
|
};
|
|
63
|
-
|
|
62
|
+
const sameSite = stateItem.attrs && stateItem.attrs.SameSite && stateItem.attrs.SameSite.toLowerCase();
|
|
64
63
|
if (stateItem.maxAge !== undefined) {
|
|
65
64
|
// cookieJar expects "expires" as a date object
|
|
66
65
|
options.expires = new Date(dateProvider().getTime() + stateItem.maxAge * 1000);
|
|
@@ -77,4 +76,5 @@ var _default = exports.default = function _default(_ref) {
|
|
|
77
76
|
});
|
|
78
77
|
}
|
|
79
78
|
};
|
|
80
|
-
};
|
|
79
|
+
};
|
|
80
|
+
exports.default = _default;
|
|
@@ -2,12 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
exports.default = void 0;
|
|
4
4
|
var _index = require("../utils/index.js");
|
|
5
|
-
|
|
6
|
-
function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
7
|
-
function _unsupportedIterableToArray(r, a) { if (r) { if ("string" == typeof r) return _arrayLikeToArray(r, a); var t = {}.toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0; } }
|
|
8
|
-
function _iterableToArray(r) { if ("undefined" != typeof Symbol && null != r[Symbol.iterator] || null != r["@@iterator"]) return Array.from(r); }
|
|
9
|
-
function _arrayWithoutHoles(r) { if (Array.isArray(r)) return _arrayLikeToArray(r); }
|
|
10
|
-
function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; } /*
|
|
5
|
+
/*
|
|
11
6
|
Copyright 2019 Adobe. All rights reserved.
|
|
12
7
|
This file is licensed to you under the Apache License, Version 2.0 (the "License");
|
|
13
8
|
you may not use this file except in compliance with the License. You may obtain a copy
|
|
@@ -18,7 +13,8 @@ the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTA
|
|
|
18
13
|
OF ANY KIND, either express or implied. See the License for the specific language
|
|
19
14
|
governing permissions and limitations under the License.
|
|
20
15
|
*/
|
|
21
|
-
|
|
16
|
+
|
|
17
|
+
const getXdmPropositions = xdm => {
|
|
22
18
|
return xdm &&
|
|
23
19
|
// eslint-disable-next-line no-underscore-dangle
|
|
24
20
|
xdm._experience &&
|
|
@@ -29,24 +25,24 @@ var getXdmPropositions = function getXdmPropositions(xdm) {
|
|
|
29
25
|
// eslint-disable-next-line no-underscore-dangle
|
|
30
26
|
xdm._experience.decisioning.propositions : [];
|
|
31
27
|
};
|
|
32
|
-
var _default =
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
28
|
+
var _default = () => {
|
|
29
|
+
const content = {};
|
|
30
|
+
let userXdm;
|
|
31
|
+
let userData;
|
|
32
|
+
let documentMayUnload = false;
|
|
33
|
+
let isFinalized = false;
|
|
34
|
+
let shouldSendEvent = true;
|
|
35
|
+
const throwIfEventFinalized = methodName => {
|
|
40
36
|
if (isFinalized) {
|
|
41
37
|
throw new Error(methodName + " cannot be called after event is finalized.");
|
|
42
38
|
}
|
|
43
39
|
};
|
|
44
|
-
|
|
45
|
-
hasQuery
|
|
40
|
+
const event = {
|
|
41
|
+
hasQuery() {
|
|
46
42
|
return Object.prototype.hasOwnProperty.call(this.getContent(), "query");
|
|
47
43
|
},
|
|
48
|
-
getContent
|
|
49
|
-
|
|
44
|
+
getContent() {
|
|
45
|
+
const currentContent = JSON.parse(JSON.stringify(content));
|
|
50
46
|
if (userXdm) {
|
|
51
47
|
(0, _index.deepAssign)(currentContent, {
|
|
52
48
|
xdm: userXdm
|
|
@@ -59,56 +55,54 @@ var _default = exports.default = function _default() {
|
|
|
59
55
|
}
|
|
60
56
|
return currentContent;
|
|
61
57
|
},
|
|
62
|
-
setUserXdm
|
|
58
|
+
setUserXdm(value) {
|
|
63
59
|
throwIfEventFinalized("setUserXdm");
|
|
64
60
|
userXdm = value;
|
|
65
61
|
},
|
|
66
|
-
setUserData
|
|
62
|
+
setUserData(value) {
|
|
67
63
|
throwIfEventFinalized("setUserData");
|
|
68
64
|
userData = value;
|
|
69
65
|
},
|
|
70
|
-
mergeXdm
|
|
66
|
+
mergeXdm(xdm) {
|
|
71
67
|
throwIfEventFinalized("mergeXdm");
|
|
72
68
|
if (xdm) {
|
|
73
69
|
(0, _index.deepAssign)(content, {
|
|
74
|
-
xdm
|
|
70
|
+
xdm
|
|
75
71
|
});
|
|
76
72
|
}
|
|
77
73
|
},
|
|
78
|
-
mergeData
|
|
74
|
+
mergeData(data) {
|
|
79
75
|
throwIfEventFinalized("mergeData");
|
|
80
76
|
if (data) {
|
|
81
77
|
(0, _index.deepAssign)(content, {
|
|
82
|
-
data
|
|
78
|
+
data
|
|
83
79
|
});
|
|
84
80
|
}
|
|
85
81
|
},
|
|
86
|
-
mergeMeta
|
|
82
|
+
mergeMeta(meta) {
|
|
87
83
|
throwIfEventFinalized("mergeMeta");
|
|
88
84
|
if (meta) {
|
|
89
85
|
(0, _index.deepAssign)(content, {
|
|
90
|
-
meta
|
|
86
|
+
meta
|
|
91
87
|
});
|
|
92
88
|
}
|
|
93
89
|
},
|
|
94
|
-
mergeQuery
|
|
90
|
+
mergeQuery(query) {
|
|
95
91
|
throwIfEventFinalized("mergeQuery");
|
|
96
92
|
if (query) {
|
|
97
93
|
(0, _index.deepAssign)(content, {
|
|
98
|
-
query
|
|
94
|
+
query
|
|
99
95
|
});
|
|
100
96
|
}
|
|
101
97
|
},
|
|
102
|
-
documentMayUnload
|
|
103
|
-
|
|
98
|
+
documentMayUnload() {
|
|
99
|
+
documentMayUnload = true;
|
|
104
100
|
},
|
|
105
|
-
finalize
|
|
101
|
+
finalize(onBeforeEventSend) {
|
|
106
102
|
if (isFinalized) {
|
|
107
103
|
return;
|
|
108
104
|
}
|
|
109
|
-
|
|
110
|
-
return a === b || a.id && b.id && a.id === b.id && a.scope && b.scope && a.scope === b.scope;
|
|
111
|
-
});
|
|
105
|
+
const newPropositions = (0, _index.deduplicateArray)([...getXdmPropositions(userXdm), ...getXdmPropositions(content.xdm)], (a, b) => a === b || a.id && b.id && a.id === b.id && a.scope && b.scope && a.scope === b.scope);
|
|
112
106
|
if (userXdm) {
|
|
113
107
|
this.mergeXdm(userXdm);
|
|
114
108
|
}
|
|
@@ -128,11 +122,11 @@ var _default = exports.default = function _default() {
|
|
|
128
122
|
|
|
129
123
|
// this allows the user to replace the xdm and data properties
|
|
130
124
|
// on the object passed to the callback
|
|
131
|
-
|
|
125
|
+
const tempContent = {
|
|
132
126
|
xdm: content.xdm || {},
|
|
133
127
|
data: content.data || {}
|
|
134
128
|
};
|
|
135
|
-
|
|
129
|
+
const result = onBeforeEventSend(tempContent);
|
|
136
130
|
shouldSendEvent = result !== false;
|
|
137
131
|
content.xdm = tempContent.xdm || {};
|
|
138
132
|
content.data = tempContent.data || {};
|
|
@@ -144,22 +138,22 @@ var _default = exports.default = function _default() {
|
|
|
144
138
|
}
|
|
145
139
|
}
|
|
146
140
|
},
|
|
147
|
-
getDocumentMayUnload
|
|
148
|
-
return
|
|
141
|
+
getDocumentMayUnload() {
|
|
142
|
+
return documentMayUnload;
|
|
149
143
|
},
|
|
150
|
-
isEmpty
|
|
144
|
+
isEmpty() {
|
|
151
145
|
return (0, _index.isEmptyObject)(content) && (!userXdm || (0, _index.isEmptyObject)(userXdm)) && (!userData || (0, _index.isEmptyObject)(userData));
|
|
152
146
|
},
|
|
153
|
-
shouldSend
|
|
147
|
+
shouldSend() {
|
|
154
148
|
return shouldSendEvent;
|
|
155
149
|
},
|
|
156
|
-
getViewName
|
|
150
|
+
getViewName() {
|
|
157
151
|
if (!userXdm || !userXdm.web || !userXdm.web.webPageDetails) {
|
|
158
152
|
return undefined;
|
|
159
153
|
}
|
|
160
154
|
return userXdm.web.webPageDetails.viewName;
|
|
161
155
|
},
|
|
162
|
-
toJSON
|
|
156
|
+
toJSON() {
|
|
163
157
|
if (!isFinalized) {
|
|
164
158
|
throw new Error("toJSON called before finalize");
|
|
165
159
|
}
|
|
@@ -167,4 +161,5 @@ var _default = exports.default = function _default() {
|
|
|
167
161
|
}
|
|
168
162
|
};
|
|
169
163
|
return event;
|
|
170
|
-
};
|
|
164
|
+
};
|
|
165
|
+
exports.default = _default;
|