@adobe/alloy 2.18.0 → 2.19.0-beta.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/libEs5/baseCode/index.js +2 -12
- package/libEs5/components/ActivityCollector/attachClickActivityCollector.js +9 -12
- package/libEs5/components/ActivityCollector/configValidators.js +1 -4
- package/libEs5/components/ActivityCollector/createGetLinkDetails.js +7 -17
- package/libEs5/components/ActivityCollector/createLinkClick.js +3 -8
- package/libEs5/components/ActivityCollector/getLinkName.js +8 -26
- package/libEs5/components/ActivityCollector/getLinkRegion.js +2 -16
- package/libEs5/components/ActivityCollector/index.js +8 -18
- package/libEs5/components/ActivityCollector/utils.js +3 -40
- package/libEs5/components/Audiences/index.js +2 -8
- package/libEs5/components/Audiences/injectProcessDestinations.js +20 -19
- package/libEs5/components/Audiences/injectProcessResponse.js +0 -5
- package/libEs5/components/Context/createComponent.js +0 -4
- package/libEs5/components/Context/implementationDetails.js +0 -5
- package/libEs5/components/Context/index.js +12 -19
- package/libEs5/components/Context/injectDevice.js +3 -20
- package/libEs5/components/Context/injectEnvironment.js +1 -8
- package/libEs5/components/Context/injectHighEntropyUserAgentHints.js +14 -21
- package/libEs5/components/Context/injectPlaceContext.js +2 -8
- package/libEs5/components/Context/injectTimestamp.js +0 -3
- package/libEs5/components/Context/injectWeb.js +0 -3
- package/libEs5/components/DataCollector/index.js +25 -35
- package/libEs5/components/DataCollector/validateApplyResponse.js +6 -4
- package/libEs5/components/DataCollector/validateUserEventOptions.js +5 -6
- package/libEs5/components/EventMerge/createComponent.js +0 -2
- package/libEs5/components/EventMerge/createEventMergeId.js +0 -3
- package/libEs5/components/EventMerge/index.js +1 -4
- package/libEs5/components/Identity/addEcidQueryToPayload.js +0 -3
- package/libEs5/components/Identity/addEcidToPayload.js +0 -3
- package/libEs5/components/Identity/appendIdentityToUrl/appendIdentityToUrlOptionsValidator.js +0 -5
- package/libEs5/components/Identity/appendIdentityToUrl/injectAppendIdentityToUrl.js +5 -19
- package/libEs5/components/Identity/configValidators.js +1 -2
- package/libEs5/components/Identity/constants/authState.js +1 -1
- package/libEs5/components/Identity/constants/defaultIdSyncTtlMinutes.js +0 -2
- package/libEs5/components/Identity/createComponent.js +16 -22
- package/libEs5/components/Identity/createLegacyIdentity.js +5 -19
- package/libEs5/components/Identity/getEcidFromResponse.js +0 -4
- package/libEs5/components/Identity/getIdentity/createGetIdentity.js +5 -9
- package/libEs5/components/Identity/getIdentity/createIdentityRequest.js +1 -4
- package/libEs5/components/Identity/getIdentity/createIdentityRequestPayload.js +0 -3
- package/libEs5/components/Identity/getIdentity/getIdentityOptionsValidator.js +0 -5
- package/libEs5/components/Identity/index.js +8 -29
- package/libEs5/components/Identity/injectAddLegacyEcidToPayload.js +1 -5
- package/libEs5/components/Identity/injectAddQueryStringIdentityToPayload.js +22 -28
- package/libEs5/components/Identity/injectAwaitIdentityCookie.js +7 -8
- package/libEs5/components/Identity/injectEnsureSingleIdentity.js +17 -20
- package/libEs5/components/Identity/injectHandleResponseForIdSyncs.js +0 -2
- package/libEs5/components/Identity/injectProcessIdSyncs.js +2 -7
- package/libEs5/components/Identity/injectSetDomainForInitialIdentityPayload.js +1 -4
- package/libEs5/components/Identity/visitorService/awaitVisitorOptIn.js +0 -3
- package/libEs5/components/Identity/visitorService/getVisitor.js +0 -3
- package/libEs5/components/Identity/visitorService/injectGetEcidFromVisitor.js +2 -7
- package/libEs5/components/LibraryInfo/index.js +13 -21
- package/libEs5/components/MachineLearning/index.js +1 -3
- package/libEs5/components/MachineLearning/processResponse.js +0 -2
- package/libEs5/components/Personalization/constants/eventType.js +1 -1
- package/libEs5/components/Personalization/constants/loggerMessage.js +0 -1
- package/libEs5/components/Personalization/constants/propositionEventType.js +1 -1
- package/libEs5/components/Personalization/constants/schema.js +1 -1
- package/libEs5/components/Personalization/constants/scopeType.js +1 -1
- package/libEs5/components/Personalization/constants/surface.js +1 -1
- package/libEs5/components/Personalization/createApplyPropositions.js +47 -49
- package/libEs5/components/Personalization/createClickStorage.js +1 -10
- package/libEs5/components/Personalization/createCollect.js +5 -15
- package/libEs5/components/Personalization/createComponent.js +40 -42
- package/libEs5/components/Personalization/createFetchDataHandler.js +81 -26
- package/libEs5/components/Personalization/createGetPageLocation.js +0 -2
- package/libEs5/components/Personalization/createOnClickHandler.js +8 -18
- package/libEs5/components/Personalization/{utils/composePersonalizationResultingObject.js → createPendingNotificationsHandler.js} +9 -18
- package/libEs5/components/Personalization/createPersonalizationDetails.js +24 -30
- package/libEs5/components/Personalization/createSetTargetMigration.js +0 -5
- package/libEs5/components/Personalization/createViewCacheManager.js +54 -28
- package/libEs5/components/Personalization/createViewChangeHandler.js +25 -37
- package/libEs5/components/Personalization/dom-actions/action.js +6 -37
- package/libEs5/components/Personalization/dom-actions/addNonceToInlineStyleElements.js +1 -13
- package/libEs5/components/Personalization/dom-actions/appendHtml.js +0 -7
- package/libEs5/components/Personalization/dom-actions/clicks/collectClicks.js +16 -27
- package/{libEs6/components/Personalization/utils/composePersonalizationResultingObject.js → libEs5/components/Personalization/dom-actions/createPreprocess.js} +14 -14
- package/libEs5/components/Personalization/dom-actions/dom/createFragment.js +0 -4
- package/libEs5/components/Personalization/dom-actions/dom/getAttribute.js +0 -2
- package/libEs5/components/Personalization/dom-actions/dom/getChildNodes.js +0 -5
- package/libEs5/components/Personalization/dom-actions/dom/getChildren.js +0 -5
- package/libEs5/components/Personalization/dom-actions/dom/getElementById.js +0 -3
- package/libEs5/components/Personalization/dom-actions/dom/getFirstChild.js +0 -2
- package/libEs5/components/Personalization/dom-actions/dom/getNextSibling.js +0 -2
- package/libEs5/components/Personalization/dom-actions/dom/getNonce.js +4 -10
- package/libEs5/components/Personalization/dom-actions/dom/getParent.js +0 -2
- package/libEs5/components/Personalization/dom-actions/dom/helperForEq.js +1 -6
- package/libEs5/components/Personalization/dom-actions/dom/index.js +0 -14
- package/libEs5/components/Personalization/dom-actions/dom/insertAfter.js +0 -6
- package/libEs5/components/Personalization/dom-actions/dom/insertBefore.js +0 -5
- package/libEs5/components/Personalization/dom-actions/dom/matchesSelectorWithEq.js +6 -11
- package/libEs5/components/Personalization/dom-actions/dom/removeAttribute.js +0 -2
- package/libEs5/components/Personalization/dom-actions/dom/selectNodesWithEq.js +16 -36
- package/libEs5/components/Personalization/dom-actions/dom/setAttribute.js +0 -2
- package/libEs5/components/Personalization/dom-actions/dom/setStyle.js +0 -4
- package/libEs5/components/Personalization/dom-actions/images.js +1 -11
- package/libEs5/components/Personalization/dom-actions/index.js +1 -10
- package/libEs5/components/Personalization/dom-actions/initDomActionsModules.js +2 -14
- package/libEs5/components/Personalization/dom-actions/insertHtmlAfter.js +0 -6
- package/libEs5/components/Personalization/dom-actions/insertHtmlBefore.js +0 -6
- package/libEs5/components/Personalization/dom-actions/prependHtml.js +4 -12
- package/libEs5/components/Personalization/dom-actions/rearrangeChildren.js +1 -6
- package/libEs5/components/Personalization/dom-actions/remapCustomCodeOffers.js +2 -8
- package/libEs5/components/Personalization/dom-actions/remapHeadOffers.js +5 -15
- package/libEs5/components/Personalization/dom-actions/replaceHtml.js +0 -4
- package/libEs5/components/Personalization/dom-actions/scripts.js +13 -35
- package/libEs5/components/Personalization/dom-actions/setAttributes.js +0 -3
- package/libEs5/components/Personalization/dom-actions/setHtml.js +1 -6
- package/libEs5/components/Personalization/dom-actions/setStyles.js +12 -8
- package/libEs5/components/Personalization/dom-actions/setText.js +0 -2
- package/libEs5/components/Personalization/dom-actions/swapImage.js +6 -9
- package/libEs5/components/Personalization/event.js +2 -10
- package/libEs5/components/Personalization/flicker/index.js +17 -31
- package/libEs5/components/Personalization/handlers/createProcessDomAction.js +54 -0
- package/libEs5/components/Personalization/handlers/createProcessHtmlContent.js +38 -0
- package/libEs5/components/Personalization/handlers/createProcessPropositions.js +195 -0
- package/libEs5/components/Personalization/handlers/createProcessRedirect.js +42 -0
- package/libEs5/components/Personalization/handlers/injectCreateProposition.js +118 -0
- package/libEs5/components/Personalization/{dom-actions/clicks/index.js → handlers/processDefaultContent.js} +7 -5
- package/libEs5/components/Personalization/index.js +72 -80
- package/libEs5/components/Personalization/utils/addRenderAttemptedToDecisions.js +1 -4
- package/libEs5/components/Personalization/utils/createAsyncArray.js +39 -0
- package/libEs5/components/Personalization/utils/isAuthoringModeEnabled.js +0 -2
- package/libEs5/components/Personalization/utils/isPageWideScope.js +0 -4
- package/libEs5/components/Personalization/utils/surfaceUtils.js +1 -27
- package/libEs5/components/Personalization/validateApplyPropositionsOptions.js +5 -8
- package/libEs5/components/Privacy/computeConsentHash.js +11 -8
- package/libEs5/components/Privacy/createComponent.js +24 -26
- package/libEs5/components/Privacy/createConsentHashStore.js +14 -15
- package/libEs5/components/Privacy/createConsentRequest.js +1 -4
- package/libEs5/components/Privacy/createConsentRequestPayload.js +0 -5
- package/libEs5/components/Privacy/createStoredConsent.js +2 -6
- package/libEs5/components/Privacy/index.js +5 -15
- package/libEs5/components/Privacy/injectSendSetConsentRequest.js +7 -12
- package/libEs5/components/Privacy/parseConsentCookie.js +3 -13
- package/libEs5/components/Privacy/validateSetConsentOptions.js +0 -4
- package/libEs5/constants/apiVersion.js +0 -1
- package/libEs5/constants/browser.js +1 -1
- package/libEs5/constants/consentPurpose.js +1 -1
- package/libEs5/constants/consentStatus.js +1 -1
- package/libEs5/constants/cookieNameKey.js +1 -1
- package/libEs5/constants/cookieNamePrefix.js +0 -1
- package/libEs5/constants/coreCommands.js +1 -1
- package/libEs5/constants/debugQueryParam.js +0 -1
- package/libEs5/constants/domain.js +1 -1
- package/libEs5/constants/ecidNamespace.js +0 -1
- package/libEs5/constants/edgeBasePath.js +0 -1
- package/libEs5/constants/elementAttribute.js +1 -1
- package/libEs5/constants/highEntropyUserAgentClientHints.js +0 -1
- package/libEs5/constants/httpHeaderNames.js +1 -1
- package/libEs5/constants/httpStatusCode.js +1 -1
- package/libEs5/constants/identityMapAuthenticatedState.js +0 -1
- package/libEs5/constants/legacyCookies.js +1 -1
- package/libEs5/constants/libraryName.js +0 -1
- package/libEs5/constants/libraryVersion.js +1 -2
- package/libEs5/constants/namespace.js +0 -1
- package/libEs5/constants/pageWideScope.js +0 -1
- package/libEs5/constants/queryStringIdentityParam.js +0 -1
- package/libEs5/constants/shadowSeparator.js +0 -1
- package/libEs5/constants/tagName.js +1 -1
- package/libEs5/core/buildAndValidateConfig.js +21 -32
- package/libEs5/core/componentCreators.js +0 -12
- package/libEs5/core/config/createConfig.js +1 -3
- package/libEs5/core/config/createCoreConfigs.js +0 -7
- package/libEs5/core/consent/createConsent.js +1 -11
- package/libEs5/core/consent/createConsentStateMachine.js +1 -18
- package/libEs5/core/createComponentRegistry.js +4 -14
- package/libEs5/core/createCookieTransfer.js +9 -18
- package/libEs5/core/createEvent.js +41 -32
- package/libEs5/core/createEventManager.js +27 -33
- package/libEs5/core/createInstanceFunction.js +0 -2
- package/libEs5/core/createLifecycle.js +14 -14
- package/libEs5/core/createLogController.js +5 -17
- package/libEs5/core/createLogger.js +3 -17
- package/libEs5/core/edgeNetwork/handleRequestFailure.js +0 -3
- package/libEs5/core/edgeNetwork/injectApplyResponse.js +12 -18
- package/libEs5/core/edgeNetwork/injectExtractEdgeInfo.js +4 -8
- package/libEs5/core/edgeNetwork/injectGetLocationHint.js +1 -11
- package/libEs5/core/edgeNetwork/injectProcessWarningsAndErrors.js +6 -11
- package/libEs5/core/edgeNetwork/injectSendEdgeNetworkRequest.js +18 -26
- package/libEs5/core/edgeNetwork/mergeLifecycleResponses.js +11 -10
- package/libEs5/core/index.js +12 -54
- package/libEs5/core/initializeComponents.js +5 -10
- package/libEs5/core/injectCreateResponse.js +8 -16
- package/libEs5/core/injectExecuteCommand.js +8 -19
- package/libEs5/core/injectHandleError.js +4 -8
- package/libEs5/core/injectShouldTransferCookie.js +1 -5
- package/libEs5/core/network/getRequestRetryDelay.js +10 -17
- package/libEs5/core/network/injectSendNetworkRequest.js +20 -22
- package/libEs5/core/network/isRequestRetryable.js +5 -7
- package/libEs5/core/network/requestMethods/injectSendBeaconRequest.js +5 -8
- package/libEs5/core/network/requestMethods/injectSendFetchRequest.js +0 -2
- package/libEs5/core/network/requestMethods/injectSendXhrRequest.js +0 -5
- package/libEs5/core/validateCommandOptions.js +5 -9
- package/libEs5/index.js +7 -15
- package/libEs5/utils/areThirdPartyCookiesSupportedByDefault.js +1 -5
- package/libEs5/utils/assign.js +0 -2
- package/libEs5/utils/assignIf.js +0 -4
- package/libEs5/utils/clone.js +0 -3
- package/libEs5/utils/cookieJar.js +0 -2
- package/libEs5/utils/crc32.js +0 -8
- package/libEs5/utils/createCallbackAggregator.js +0 -4
- package/libEs5/utils/createLoggingCookieJar.js +1 -6
- package/libEs5/utils/createMerger.js +0 -4
- package/libEs5/utils/createTaskQueue.js +0 -7
- package/libEs5/utils/deduplicateArray.js +32 -0
- package/libEs5/utils/deepAssign.js +2 -10
- package/libEs5/utils/defer.js +0 -3
- package/libEs5/utils/dom/appendNode.js +0 -2
- package/libEs5/utils/dom/awaitSelector.js +1 -29
- package/libEs5/utils/dom/createNode.js +1 -5
- package/libEs5/utils/dom/index.js +0 -8
- package/libEs5/utils/dom/isShadowSelector.js +0 -3
- package/libEs5/utils/dom/matchesSelector.js +2 -5
- package/libEs5/utils/dom/querySelectorAll.js +3 -6
- package/libEs5/utils/dom/removeNode.js +0 -4
- package/libEs5/utils/dom/selectNodes.js +0 -8
- package/libEs5/utils/dom/selectNodesWithShadow.js +6 -20
- package/libEs5/utils/endsWith.js +0 -3
- package/libEs5/utils/filterObject.js +13 -17
- package/libEs5/utils/find.js +0 -5
- package/libEs5/utils/fireImage.js +2 -7
- package/libEs5/utils/flatMap.js +0 -2
- package/libEs5/utils/getApexDomain.js +4 -8
- package/libEs5/utils/getBrowser.js +11 -11
- package/libEs5/utils/getLastArrayItems.js +0 -3
- package/libEs5/utils/getNamespacedCookieName.js +0 -4
- package/libEs5/utils/groupBy.js +0 -5
- package/libEs5/utils/includes.js +0 -3
- package/libEs5/utils/index.js +7 -55
- package/libEs5/utils/injectDoesIdentityCookieExist.js +0 -6
- package/libEs5/utils/injectFireReferrerHideableImage.js +21 -29
- package/libEs5/utils/injectStorage.js +1 -7
- package/libEs5/utils/intersection.js +0 -4
- package/libEs5/utils/isBlankString.js +0 -4
- package/libEs5/utils/isBoolean.js +0 -3
- package/libEs5/utils/isEmptyObject.js +0 -4
- package/libEs5/utils/isFunction.js +0 -3
- package/libEs5/utils/isInteger.js +0 -4
- package/libEs5/utils/isNamespacedCookieName.js +0 -5
- package/libEs5/utils/isNil.js +0 -3
- package/libEs5/utils/isNonEmptyArray.js +0 -3
- package/libEs5/utils/isNonEmptyString.js +0 -4
- package/libEs5/utils/isNumber.js +0 -3
- package/libEs5/utils/isObject.js +11 -5
- package/libEs5/utils/isString.js +0 -3
- package/libEs5/utils/isUnique.js +0 -7
- package/libEs5/utils/isValidRegExp.js +0 -3
- package/libEs5/utils/memoize.js +0 -5
- package/libEs5/utils/noop.js +0 -3
- package/libEs5/utils/padStart.js +0 -6
- package/libEs5/utils/prepareConfigOverridesForEdge.js +13 -21
- package/libEs5/utils/querystring.js +0 -2
- package/libEs5/utils/request/createAddIdentity.js +0 -2
- package/libEs5/utils/request/createDataCollectionRequest.js +1 -6
- package/libEs5/utils/request/createDataCollectionRequestPayload.js +0 -8
- package/libEs5/utils/request/createGetAssuranceValidationTokenParams.js +2 -11
- package/libEs5/utils/request/createHasIdentity.js +0 -2
- package/libEs5/utils/request/createRequest.js +3 -6
- package/libEs5/utils/request/createRequestParams.js +4 -12
- package/libEs5/utils/request/createRequestPayload.js +2 -7
- package/libEs5/utils/request/index.js +0 -8
- package/libEs5/utils/sanitizeOrgIdForCookieName.js +0 -2
- package/libEs5/utils/stackError.js +1 -6
- package/libEs5/utils/startsWith.js +0 -3
- package/libEs5/utils/stringToBoolean.js +0 -3
- package/libEs5/utils/toArray.js +0 -4
- package/libEs5/utils/toError.js +0 -3
- package/libEs5/utils/toISOStringLocal.js +3 -7
- package/libEs5/utils/toInteger.js +2 -8
- package/libEs5/utils/updateErrorMessage.js +3 -5
- package/libEs5/utils/uuid.js +0 -2
- package/libEs5/utils/validateConfigOverride.js +0 -3
- package/libEs5/utils/validateIdentityMap.js +0 -4
- package/libEs5/utils/validation/booleanValidator.js +0 -4
- package/libEs5/utils/validation/callbackValidator.js +0 -4
- package/libEs5/utils/validation/createAnyOfValidator.js +0 -5
- package/libEs5/utils/validation/createArrayOfValidator.js +0 -6
- package/libEs5/utils/validation/createDefaultValidator.js +0 -3
- package/libEs5/utils/validation/createDeprecatedValidator.js +13 -21
- package/libEs5/utils/validation/createLiteralValidator.js +0 -3
- package/libEs5/utils/validation/createMapOfValuesValidator.js +0 -9
- package/libEs5/utils/validation/createMinimumValidator.js +0 -3
- package/libEs5/utils/validation/createNoUnknownFieldsValidator.js +0 -4
- package/libEs5/utils/validation/createNonEmptyValidator.js +0 -6
- package/libEs5/utils/validation/createObjectOfValidator.js +2 -10
- package/libEs5/utils/validation/createUniqueItemsValidator.js +0 -4
- package/libEs5/utils/validation/createUniqueValidator.js +0 -3
- package/libEs5/utils/validation/domainValidator.js +1 -4
- package/libEs5/utils/validation/index.js +76 -59
- package/libEs5/utils/validation/integerValidator.js +0 -4
- package/libEs5/utils/validation/numberValidator.js +0 -4
- package/libEs5/utils/validation/regexpValidator.js +0 -4
- package/libEs5/utils/validation/requiredValidator.js +0 -3
- package/libEs5/utils/validation/stringValidator.js +0 -4
- package/libEs5/utils/validation/utils.js +7 -21
- package/libEs5/utils/values.js +0 -3
- package/libEs6/baseCode/index.js +3 -8
- package/libEs6/components/ActivityCollector/attachClickActivityCollector.js +5 -6
- package/libEs6/components/ActivityCollector/configValidators.js +1 -0
- package/libEs6/components/ActivityCollector/createGetLinkDetails.js +1 -8
- package/libEs6/components/ActivityCollector/createLinkClick.js +0 -3
- package/libEs6/components/ActivityCollector/getLinkName.js +8 -23
- package/libEs6/components/ActivityCollector/getLinkRegion.js +2 -12
- package/libEs6/components/ActivityCollector/index.js +3 -6
- package/libEs6/components/ActivityCollector/utils.js +2 -29
- package/libEs6/components/Audiences/index.js +1 -2
- package/libEs6/components/Audiences/injectProcessDestinations.js +3 -6
- package/libEs6/components/Audiences/injectProcessResponse.js +1 -2
- package/libEs6/components/Context/createComponent.js +1 -2
- package/libEs6/components/Context/index.js +3 -3
- package/libEs6/components/Context/injectDevice.js +1 -16
- package/libEs6/components/Context/injectEnvironment.js +1 -4
- package/libEs6/components/Context/injectHighEntropyUserAgentHints.js +2 -5
- package/libEs6/components/Context/injectPlaceContext.js +2 -5
- package/libEs6/components/Context/injectTimestamp.js +1 -0
- package/libEs6/components/Context/injectWeb.js +1 -0
- package/libEs6/components/DataCollector/index.js +5 -12
- package/libEs6/components/DataCollector/validateApplyResponse.js +6 -1
- package/libEs6/components/DataCollector/validateUserEventOptions.js +6 -2
- package/libEs6/components/EventMerge/createComponent.js +1 -0
- package/libEs6/components/EventMerge/createEventMergeId.js +1 -0
- package/libEs6/components/EventMerge/index.js +1 -2
- package/libEs6/components/Identity/addEcidQueryToPayload.js +1 -0
- package/libEs6/components/Identity/addEcidToPayload.js +1 -0
- package/libEs6/components/Identity/appendIdentityToUrl/appendIdentityToUrlOptionsValidator.js +1 -1
- package/libEs6/components/Identity/appendIdentityToUrl/injectAppendIdentityToUrl.js +0 -4
- package/libEs6/components/Identity/configValidators.js +1 -0
- package/libEs6/components/Identity/constants/authState.js +1 -0
- package/libEs6/components/Identity/constants/defaultIdSyncTtlMinutes.js +1 -0
- package/libEs6/components/Identity/createComponent.js +5 -7
- package/libEs6/components/Identity/createLegacyIdentity.js +0 -10
- package/libEs6/components/Identity/getEcidFromResponse.js +1 -0
- package/libEs6/components/Identity/getIdentity/createGetIdentity.js +1 -0
- package/libEs6/components/Identity/getIdentity/createIdentityRequest.js +1 -3
- package/libEs6/components/Identity/getIdentity/createIdentityRequestPayload.js +1 -0
- package/libEs6/components/Identity/getIdentity/getIdentityOptionsValidator.js +1 -1
- package/libEs6/components/Identity/index.js +1 -2
- package/libEs6/components/Identity/injectAddLegacyEcidToPayload.js +1 -1
- package/libEs6/components/Identity/injectAddQueryStringIdentityToPayload.js +5 -7
- package/libEs6/components/Identity/injectAwaitIdentityCookie.js +6 -3
- package/libEs6/components/Identity/injectEnsureSingleIdentity.js +12 -11
- package/libEs6/components/Identity/injectHandleResponseForIdSyncs.js +1 -0
- package/libEs6/components/Identity/injectProcessIdSyncs.js +0 -4
- package/libEs6/components/Identity/injectSetDomainForInitialIdentityPayload.js +1 -0
- package/libEs6/components/Identity/visitorService/awaitVisitorOptIn.js +1 -0
- package/libEs6/components/Identity/visitorService/getVisitor.js +1 -0
- package/libEs6/components/Identity/visitorService/injectGetEcidFromVisitor.js +1 -2
- package/libEs6/components/LibraryInfo/index.js +3 -6
- package/libEs6/components/MachineLearning/index.js +1 -2
- package/libEs6/components/MachineLearning/processResponse.js +1 -0
- package/libEs6/components/Personalization/constants/eventType.js +1 -0
- package/libEs6/components/Personalization/constants/propositionEventType.js +1 -0
- package/libEs6/components/Personalization/constants/schema.js +1 -0
- package/libEs6/components/Personalization/constants/scopeType.js +1 -0
- package/libEs6/components/Personalization/constants/surface.js +1 -0
- package/libEs6/components/Personalization/createApplyPropositions.js +31 -34
- package/libEs6/components/Personalization/createClickStorage.js +1 -8
- package/libEs6/components/Personalization/createCollect.js +0 -5
- package/libEs6/components/Personalization/createComponent.js +23 -21
- package/libEs6/components/Personalization/createFetchDataHandler.js +61 -10
- package/libEs6/components/Personalization/createGetPageLocation.js +1 -0
- package/libEs6/components/Personalization/createOnClickHandler.js +4 -7
- package/{libEs5/components/Personalization/dom-actions/click.js → libEs6/components/Personalization/createPendingNotificationsHandler.js} +11 -15
- package/libEs6/components/Personalization/createPersonalizationDetails.js +9 -22
- package/libEs6/components/Personalization/createSetTargetMigration.js +1 -1
- package/libEs6/components/Personalization/createViewCacheManager.js +50 -24
- package/libEs6/components/Personalization/createViewChangeHandler.js +25 -29
- package/libEs6/components/Personalization/dom-actions/action.js +5 -14
- package/libEs6/components/Personalization/dom-actions/addNonceToInlineStyleElements.js +1 -8
- package/libEs6/components/Personalization/dom-actions/appendHtml.js +1 -0
- package/libEs6/components/Personalization/dom-actions/clicks/collectClicks.js +2 -14
- package/libEs6/components/Personalization/dom-actions/{click.js → createPreprocess.js} +7 -11
- package/libEs6/components/Personalization/dom-actions/dom/createFragment.js +1 -0
- package/libEs6/components/Personalization/dom-actions/dom/getAttribute.js +1 -0
- package/libEs6/components/Personalization/dom-actions/dom/getChildNodes.js +1 -2
- package/libEs6/components/Personalization/dom-actions/dom/getChildren.js +1 -2
- package/libEs6/components/Personalization/dom-actions/dom/getFirstChild.js +1 -0
- package/libEs6/components/Personalization/dom-actions/dom/getNextSibling.js +1 -0
- package/libEs6/components/Personalization/dom-actions/dom/getNonce.js +6 -5
- package/libEs6/components/Personalization/dom-actions/dom/getParent.js +1 -0
- package/libEs6/components/Personalization/dom-actions/dom/helperForEq.js +1 -0
- package/libEs6/components/Personalization/dom-actions/dom/index.js +1 -0
- package/libEs6/components/Personalization/dom-actions/dom/insertAfter.js +1 -2
- package/libEs6/components/Personalization/dom-actions/dom/insertBefore.js +1 -2
- package/libEs6/components/Personalization/dom-actions/dom/matchesSelectorWithEq.js +7 -6
- package/libEs6/components/Personalization/dom-actions/dom/removeAttribute.js +1 -0
- package/libEs6/components/Personalization/dom-actions/dom/selectNodesWithEq.js +6 -18
- package/libEs6/components/Personalization/dom-actions/dom/setAttribute.js +1 -0
- package/libEs6/components/Personalization/dom-actions/dom/setStyle.js +1 -2
- package/libEs6/components/Personalization/dom-actions/images.js +1 -1
- package/libEs6/components/Personalization/dom-actions/index.js +2 -2
- package/libEs6/components/Personalization/dom-actions/initDomActionsModules.js +4 -7
- package/libEs6/components/Personalization/dom-actions/insertHtmlAfter.js +1 -0
- package/libEs6/components/Personalization/dom-actions/insertHtmlBefore.js +1 -0
- package/libEs6/components/Personalization/dom-actions/prependHtml.js +5 -5
- package/libEs6/components/Personalization/dom-actions/rearrangeChildren.js +1 -2
- package/libEs6/components/Personalization/dom-actions/remapCustomCodeOffers.js +0 -3
- package/libEs6/components/Personalization/dom-actions/remapHeadOffers.js +4 -6
- package/libEs6/components/Personalization/dom-actions/replaceHtml.js +1 -0
- package/libEs6/components/Personalization/dom-actions/scripts.js +5 -16
- package/libEs6/components/Personalization/dom-actions/setAttributes.js +1 -0
- package/libEs6/components/Personalization/dom-actions/setHtml.js +1 -2
- package/libEs6/components/Personalization/dom-actions/setStyles.js +1 -0
- package/libEs6/components/Personalization/dom-actions/setText.js +1 -0
- package/libEs6/components/Personalization/dom-actions/swapImage.js +7 -4
- package/libEs6/components/Personalization/event.js +4 -4
- package/libEs6/components/Personalization/flicker/index.js +9 -12
- package/libEs6/components/Personalization/handlers/createProcessDomAction.js +48 -0
- package/libEs6/components/Personalization/handlers/createProcessHtmlContent.js +34 -0
- package/libEs6/components/Personalization/handlers/createProcessPropositions.js +175 -0
- package/libEs6/components/Personalization/handlers/createProcessRedirect.js +38 -0
- package/libEs6/components/Personalization/handlers/injectCreateProposition.js +113 -0
- package/libEs6/components/Personalization/{dom-actions/clicks/index.js → handlers/processDefaultContent.js} +7 -3
- package/libEs6/components/Personalization/index.js +61 -42
- package/libEs6/components/Personalization/utils/addRenderAttemptedToDecisions.js +1 -0
- package/libEs6/components/Personalization/utils/createAsyncArray.js +35 -0
- package/libEs6/components/Personalization/utils/isAuthoringModeEnabled.js +1 -0
- package/libEs6/components/Personalization/utils/isPageWideScope.js +1 -0
- package/libEs6/components/Personalization/utils/surfaceUtils.js +1 -20
- package/libEs6/components/Personalization/validateApplyPropositionsOptions.js +4 -4
- package/libEs6/components/Privacy/computeConsentHash.js +3 -4
- package/libEs6/components/Privacy/createComponent.js +5 -10
- package/libEs6/components/Privacy/createConsentHashStore.js +0 -10
- package/libEs6/components/Privacy/createConsentRequest.js +1 -3
- package/libEs6/components/Privacy/createConsentRequestPayload.js +1 -2
- package/libEs6/components/Privacy/createStoredConsent.js +1 -2
- package/libEs6/components/Privacy/index.js +1 -2
- package/libEs6/components/Privacy/injectSendSetConsentRequest.js +3 -3
- package/libEs6/constants/browser.js +1 -0
- package/libEs6/constants/consentPurpose.js +1 -0
- package/libEs6/constants/consentStatus.js +1 -0
- package/libEs6/constants/cookieNameKey.js +1 -0
- package/libEs6/constants/cookieNamePrefix.js +1 -0
- package/libEs6/constants/coreCommands.js +1 -0
- package/libEs6/constants/debugQueryParam.js +1 -0
- package/libEs6/constants/domain.js +1 -0
- package/libEs6/constants/ecidNamespace.js +1 -0
- package/libEs6/constants/elementAttribute.js +1 -0
- package/libEs6/constants/highEntropyUserAgentClientHints.js +1 -0
- package/libEs6/constants/httpHeaderNames.js +1 -0
- package/libEs6/constants/httpStatusCode.js +1 -0
- package/libEs6/constants/legacyCookies.js +1 -0
- package/libEs6/constants/libraryName.js +1 -0
- package/libEs6/constants/libraryVersion.js +3 -1
- package/libEs6/constants/namespace.js +1 -0
- package/libEs6/constants/pageWideScope.js +1 -0
- package/libEs6/constants/queryStringIdentityParam.js +1 -0
- package/libEs6/constants/shadowSeparator.js +1 -0
- package/libEs6/constants/tagName.js +1 -0
- package/libEs6/core/buildAndValidateConfig.js +4 -10
- package/libEs6/core/componentCreators.js +3 -3
- package/libEs6/core/config/createConfig.js +1 -2
- package/libEs6/core/config/createCoreConfigs.js +1 -0
- package/libEs6/core/consent/createConsent.js +1 -9
- package/libEs6/core/consent/createConsentStateMachine.js +1 -20
- package/libEs6/core/createComponentRegistry.js +3 -15
- package/libEs6/core/createCookieTransfer.js +6 -12
- package/libEs6/core/createEvent.js +25 -31
- package/libEs6/core/createEventManager.js +8 -10
- package/libEs6/core/createInstanceFunction.js +1 -0
- package/libEs6/core/createLifecycle.js +14 -10
- package/libEs6/core/createLogController.js +1 -7
- package/libEs6/core/createLogger.js +1 -17
- package/libEs6/core/edgeNetwork/handleRequestFailure.js +0 -1
- package/libEs6/core/edgeNetwork/injectApplyResponse.js +2 -3
- package/libEs6/core/edgeNetwork/injectExtractEdgeInfo.js +5 -6
- package/libEs6/core/edgeNetwork/injectGetLocationHint.js +1 -5
- package/libEs6/core/edgeNetwork/injectProcessWarningsAndErrors.js +1 -2
- package/libEs6/core/edgeNetwork/injectSendEdgeNetworkRequest.js +5 -5
- package/libEs6/core/index.js +4 -10
- package/libEs6/core/initializeComponents.js +3 -4
- package/libEs6/core/injectCreateResponse.js +3 -7
- package/libEs6/core/injectExecuteCommand.js +5 -11
- package/libEs6/core/injectHandleError.js +4 -3
- package/libEs6/core/injectShouldTransferCookie.js +1 -0
- package/libEs6/core/network/getRequestRetryDelay.js +11 -13
- package/libEs6/core/network/injectSendNetworkRequest.js +3 -7
- package/libEs6/core/network/isRequestRetryable.js +4 -2
- package/libEs6/core/network/requestMethods/injectSendBeaconRequest.js +4 -6
- package/libEs6/core/network/requestMethods/injectSendFetchRequest.js +1 -2
- package/libEs6/core/network/requestMethods/injectSendXhrRequest.js +1 -5
- package/libEs6/core/validateCommandOptions.js +1 -2
- package/libEs6/index.js +5 -3
- package/libEs6/utils/areThirdPartyCookiesSupportedByDefault.js +4 -2
- package/libEs6/utils/assign.js +1 -0
- package/libEs6/utils/assignIf.js +1 -1
- package/libEs6/utils/cookieJar.js +1 -0
- package/libEs6/utils/crc32.js +0 -7
- package/libEs6/utils/createCallbackAggregator.js +0 -2
- package/libEs6/utils/createLoggingCookieJar.js +3 -3
- package/libEs6/utils/createMerger.js +2 -1
- package/libEs6/utils/createTaskQueue.js +0 -4
- package/libEs6/utils/deduplicateArray.js +23 -0
- package/libEs6/utils/deepAssign.js +2 -5
- package/libEs6/utils/dom/appendNode.js +1 -0
- package/libEs6/utils/dom/awaitSelector.js +1 -14
- package/libEs6/utils/dom/createNode.js +1 -2
- package/libEs6/utils/dom/index.js +1 -0
- package/libEs6/utils/dom/isShadowSelector.js +1 -0
- package/libEs6/utils/dom/matchesSelector.js +2 -2
- package/libEs6/utils/dom/querySelectorAll.js +3 -2
- package/libEs6/utils/dom/removeNode.js +1 -2
- package/libEs6/utils/dom/selectNodes.js +2 -2
- package/libEs6/utils/dom/selectNodesWithShadow.js +6 -16
- package/libEs6/utils/filterObject.js +8 -12
- package/libEs6/utils/find.js +0 -2
- package/libEs6/utils/fireImage.js +2 -1
- package/libEs6/utils/getApexDomain.js +4 -4
- package/libEs6/utils/getBrowser.js +1 -7
- package/libEs6/utils/getNamespacedCookieName.js +1 -0
- package/libEs6/utils/groupBy.js +0 -2
- package/libEs6/utils/index.js +2 -0
- package/libEs6/utils/injectDoesIdentityCookieExist.js +1 -1
- package/libEs6/utils/injectFireReferrerHideableImage.js +1 -4
- package/libEs6/utils/injectStorage.js +1 -5
- package/libEs6/utils/intersection.js +2 -1
- package/libEs6/utils/isBlankString.js +2 -1
- package/libEs6/utils/isEmptyObject.js +2 -1
- package/libEs6/utils/isInteger.js +2 -1
- package/libEs6/utils/isNamespacedCookieName.js +2 -1
- package/libEs6/utils/isNonEmptyString.js +2 -1
- package/libEs6/utils/isObject.js +2 -1
- package/libEs6/utils/isUnique.js +0 -5
- package/libEs6/utils/memoize.js +0 -2
- package/libEs6/utils/padStart.js +1 -4
- package/libEs6/utils/prepareConfigOverridesForEdge.js +5 -12
- package/libEs6/utils/querystring.js +1 -0
- package/libEs6/utils/request/createDataCollectionRequest.js +1 -3
- package/libEs6/utils/request/createDataCollectionRequestPayload.js +0 -3
- package/libEs6/utils/request/createGetAssuranceValidationTokenParams.js +1 -6
- package/libEs6/utils/request/createHasIdentity.js +1 -0
- package/libEs6/utils/request/createRequest.js +3 -9
- package/libEs6/utils/request/createRequestParams.js +0 -3
- package/libEs6/utils/request/createRequestPayload.js +4 -4
- package/libEs6/utils/request/index.js +1 -0
- package/libEs6/utils/sanitizeOrgIdForCookieName.js +1 -0
- package/libEs6/utils/stackError.js +2 -1
- package/libEs6/utils/toArray.js +1 -2
- package/libEs6/utils/toISOStringLocal.js +4 -3
- package/libEs6/utils/toInteger.js +4 -4
- package/libEs6/utils/updateErrorMessage.js +3 -1
- package/libEs6/utils/uuid.js +1 -0
- package/libEs6/utils/validateConfigOverride.js +1 -0
- package/libEs6/utils/validateIdentityMap.js +1 -0
- package/libEs6/utils/validation/booleanValidator.js +1 -0
- package/libEs6/utils/validation/createArrayOfValidator.js +0 -2
- package/libEs6/utils/validation/createDefaultValidator.js +1 -1
- package/libEs6/utils/validation/createDeprecatedValidator.js +0 -4
- package/libEs6/utils/validation/createMapOfValuesValidator.js +1 -4
- package/libEs6/utils/validation/createNoUnknownFieldsValidator.js +1 -2
- package/libEs6/utils/validation/createNonEmptyValidator.js +1 -1
- package/libEs6/utils/validation/createObjectOfValidator.js +3 -5
- package/libEs6/utils/validation/createUniqueValidator.js +1 -0
- package/libEs6/utils/validation/index.js +14 -32
- package/libEs6/utils/validation/integerValidator.js +1 -0
- package/libEs6/utils/validation/numberValidator.js +1 -0
- package/libEs6/utils/validation/regexpValidator.js +1 -0
- package/libEs6/utils/validation/requiredValidator.js +1 -1
- package/libEs6/utils/validation/utils.js +8 -12
- package/package.json +2 -2
- package/libEs5/components/Personalization/createAutoRenderingHandler.js +0 -92
- package/libEs5/components/Personalization/createExecuteDecisions.js +0 -89
- package/libEs5/components/Personalization/createNonRenderingHandler.js +0 -66
- package/libEs5/components/Personalization/createOnResponseHandler.js +0 -73
- package/libEs5/components/Personalization/createRedirectHandler.js +0 -58
- package/libEs5/components/Personalization/dom-actions/executeActions.js +0 -75
- package/libEs5/components/Personalization/groupDecisions.js +0 -160
- package/libEs6/components/Personalization/createAutoRenderingHandler.js +0 -84
- package/libEs6/components/Personalization/createExecuteDecisions.js +0 -77
- package/libEs6/components/Personalization/createNonRenderingHandler.js +0 -56
- package/libEs6/components/Personalization/createOnResponseHandler.js +0 -68
- package/libEs6/components/Personalization/createRedirectHandler.js +0 -57
- package/libEs6/components/Personalization/dom-actions/executeActions.js +0 -66
- package/libEs6/components/Personalization/groupDecisions.js +0 -131
|
@@ -9,7 +9,8 @@ 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
|
-
|
|
12
|
+
|
|
13
|
+
import { isNonEmptyArray, isNonEmptyString } from "../../utils";
|
|
13
14
|
import { INTERACT } from "./constants/eventType";
|
|
14
15
|
import { PropositionEventType } from "./constants/propositionEventType";
|
|
15
16
|
import PAGE_WIDE_SCOPE from "../../constants/pageWideScope";
|
|
@@ -25,27 +26,23 @@ export default (({
|
|
|
25
26
|
clickedElement
|
|
26
27
|
}) => {
|
|
27
28
|
const selectors = getClickSelectors();
|
|
28
|
-
|
|
29
29
|
if (isNonEmptyArray(selectors)) {
|
|
30
30
|
const {
|
|
31
31
|
decisionsMeta,
|
|
32
32
|
eventLabel
|
|
33
33
|
} = collectClicks(clickedElement, selectors, getClickMetasBySelector);
|
|
34
|
-
|
|
35
34
|
if (isNonEmptyArray(decisionsMeta)) {
|
|
36
35
|
const xdm = {
|
|
37
36
|
eventType: INTERACT
|
|
38
37
|
};
|
|
39
38
|
const scope = decisionsMeta[0].scope;
|
|
40
|
-
|
|
41
|
-
if (scope !== PAGE_WIDE_SCOPE) {
|
|
39
|
+
if (isNonEmptyString(scope) && scope !== PAGE_WIDE_SCOPE) {
|
|
42
40
|
xdm.web = {
|
|
43
41
|
webPageDetails: {
|
|
44
|
-
viewName: scope
|
|
42
|
+
viewName: scope.toLowerCase()
|
|
45
43
|
}
|
|
46
44
|
};
|
|
47
45
|
}
|
|
48
|
-
|
|
49
46
|
event.mergeXdm(xdm);
|
|
50
47
|
mergeDecisionsMeta(event, decisionsMeta, PropositionEventType.INTERACT, eventLabel);
|
|
51
48
|
}
|
|
@@ -1,9 +1,5 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
exports.default = void 0;
|
|
4
|
-
|
|
5
1
|
/*
|
|
6
|
-
Copyright
|
|
2
|
+
Copyright 2023 Adobe. All rights reserved.
|
|
7
3
|
This file is licensed to you under the Apache License, Version 2.0 (the "License");
|
|
8
4
|
you may not use this file except in compliance with the License. You may obtain a copy
|
|
9
5
|
of the License at http://www.apache.org/licenses/LICENSE-2.0
|
|
@@ -13,14 +9,14 @@ the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTA
|
|
|
13
9
|
OF ANY KIND, either express or implied. See the License for the specific language
|
|
14
10
|
governing permissions and limitations under the License.
|
|
15
11
|
*/
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
12
|
+
import { PropositionEventType } from "./constants/propositionEventType";
|
|
13
|
+
export default (({
|
|
14
|
+
pendingDisplayNotifications,
|
|
15
|
+
mergeDecisionsMeta
|
|
16
|
+
}) => ({
|
|
17
|
+
event
|
|
18
|
+
}) => {
|
|
19
|
+
return pendingDisplayNotifications.clear().then(decisionsMeta => {
|
|
20
|
+
mergeDecisionsMeta(event, decisionsMeta, PropositionEventType.DISPLAY);
|
|
22
21
|
});
|
|
23
|
-
|
|
24
|
-
};
|
|
25
|
-
|
|
26
|
-
exports.default = _default;
|
|
22
|
+
});
|
|
@@ -9,34 +9,30 @@ 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
|
+
|
|
12
13
|
import { includes, isNonEmptyString, isNonEmptyArray } from "../../utils";
|
|
13
14
|
import { buildPageSurface, normalizeSurfaces } from "./utils/surfaceUtils";
|
|
14
15
|
import PAGE_WIDE_SCOPE from "../../constants/pageWideScope";
|
|
15
16
|
import { DEFAULT_CONTENT_ITEM, DOM_ACTION, HTML_CONTENT_ITEM, JSON_CONTENT_ITEM, REDIRECT_ITEM } from "./constants/schema";
|
|
16
|
-
|
|
17
17
|
const addPageWideScope = scopes => {
|
|
18
18
|
if (!includes(scopes, PAGE_WIDE_SCOPE)) {
|
|
19
19
|
scopes.push(PAGE_WIDE_SCOPE);
|
|
20
20
|
}
|
|
21
21
|
};
|
|
22
|
-
|
|
23
22
|
const addPageSurface = (surfaces, getPageLocation) => {
|
|
24
23
|
const pageSurface = buildPageSurface(getPageLocation);
|
|
25
|
-
|
|
26
24
|
if (!includes(surfaces, pageSurface)) {
|
|
27
25
|
surfaces.push(pageSurface);
|
|
28
26
|
}
|
|
29
27
|
};
|
|
30
|
-
|
|
31
28
|
const dedupe = array => array.filter((item, pos) => array.indexOf(item) === pos);
|
|
32
|
-
|
|
33
29
|
export default (({
|
|
34
30
|
getPageLocation,
|
|
35
31
|
renderDecisions,
|
|
36
32
|
decisionScopes,
|
|
37
33
|
personalization,
|
|
38
34
|
event,
|
|
39
|
-
|
|
35
|
+
isCacheInitialized,
|
|
40
36
|
logger
|
|
41
37
|
}) => {
|
|
42
38
|
const viewName = event.getViewName();
|
|
@@ -44,61 +40,52 @@ export default (({
|
|
|
44
40
|
isRenderDecisions() {
|
|
45
41
|
return renderDecisions;
|
|
46
42
|
},
|
|
47
|
-
|
|
43
|
+
isSendDisplayNotifications() {
|
|
44
|
+
return !!personalization.sendDisplayNotifications;
|
|
45
|
+
},
|
|
46
|
+
shouldAddPendingDisplayNotifications() {
|
|
47
|
+
return !!personalization.includePendingDisplayNotifications;
|
|
48
|
+
},
|
|
48
49
|
getViewName() {
|
|
49
50
|
return viewName;
|
|
50
51
|
},
|
|
51
|
-
|
|
52
52
|
hasScopes() {
|
|
53
53
|
return decisionScopes.length > 0 || isNonEmptyArray(personalization.decisionScopes);
|
|
54
54
|
},
|
|
55
|
-
|
|
56
55
|
hasSurfaces() {
|
|
57
56
|
return isNonEmptyArray(personalization.surfaces);
|
|
58
57
|
},
|
|
59
|
-
|
|
60
58
|
hasViewName() {
|
|
61
59
|
return isNonEmptyString(viewName);
|
|
62
60
|
},
|
|
63
|
-
|
|
64
61
|
createQueryDetails() {
|
|
65
62
|
const scopes = [...decisionScopes];
|
|
66
|
-
|
|
67
63
|
if (isNonEmptyArray(personalization.decisionScopes)) {
|
|
68
64
|
scopes.push(...personalization.decisionScopes);
|
|
69
65
|
}
|
|
70
|
-
|
|
71
66
|
const eventSurfaces = normalizeSurfaces(personalization.surfaces, getPageLocation, logger);
|
|
72
|
-
|
|
73
67
|
if (!this.isCacheInitialized()) {
|
|
74
68
|
addPageWideScope(scopes);
|
|
75
69
|
addPageSurface(eventSurfaces, getPageLocation);
|
|
76
70
|
}
|
|
77
|
-
|
|
78
71
|
const schemas = [DEFAULT_CONTENT_ITEM, HTML_CONTENT_ITEM, JSON_CONTENT_ITEM, REDIRECT_ITEM];
|
|
79
|
-
|
|
80
72
|
if (includes(scopes, PAGE_WIDE_SCOPE)) {
|
|
81
73
|
schemas.push(DOM_ACTION);
|
|
82
74
|
}
|
|
83
|
-
|
|
84
75
|
return {
|
|
85
76
|
schemas,
|
|
86
77
|
decisionScopes: dedupe(scopes),
|
|
87
78
|
surfaces: dedupe(eventSurfaces)
|
|
88
79
|
};
|
|
89
80
|
},
|
|
90
|
-
|
|
91
81
|
isCacheInitialized() {
|
|
92
|
-
return
|
|
82
|
+
return isCacheInitialized;
|
|
93
83
|
},
|
|
94
|
-
|
|
95
84
|
shouldFetchData() {
|
|
96
85
|
return this.hasScopes() || this.hasSurfaces() || !this.isCacheInitialized();
|
|
97
86
|
},
|
|
98
|
-
|
|
99
87
|
shouldUseCachedData() {
|
|
100
88
|
return this.hasViewName() && this.isCacheInitialized();
|
|
101
89
|
}
|
|
102
|
-
|
|
103
90
|
};
|
|
104
91
|
});
|
|
@@ -9,6 +9,7 @@ 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
|
+
|
|
12
13
|
import { noop } from "../../utils";
|
|
13
14
|
export default (({
|
|
14
15
|
targetMigrationEnabled
|
|
@@ -22,6 +23,5 @@ export default (({
|
|
|
22
23
|
});
|
|
23
24
|
};
|
|
24
25
|
}
|
|
25
|
-
|
|
26
26
|
return noop;
|
|
27
27
|
});
|
|
@@ -9,39 +9,65 @@ 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";
|
|
13
|
-
import defer from "../../utils/defer";
|
|
14
|
-
export default (() => {
|
|
15
|
-
let viewStorage;
|
|
16
|
-
const viewStorageDeferred = defer();
|
|
17
12
|
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
13
|
+
import { assign, groupBy } from "../../utils";
|
|
14
|
+
import defer from "../../utils/defer";
|
|
15
|
+
import { DEFAULT_CONTENT_ITEM } from "./constants/schema";
|
|
16
|
+
export default (({
|
|
17
|
+
createProposition
|
|
18
|
+
}) => {
|
|
19
|
+
const viewStorage = {};
|
|
20
|
+
let cacheUpdateCreatedAtLeastOnce = false;
|
|
21
|
+
let previousUpdateCacheComplete = Promise.resolve();
|
|
22
|
+
const getViewPropositions = (currentViewStorage, viewName) => {
|
|
23
|
+
const viewPropositions = currentViewStorage[viewName.toLowerCase()];
|
|
24
|
+
if (viewPropositions && viewPropositions.length > 0) {
|
|
25
|
+
return viewPropositions;
|
|
26
|
+
}
|
|
27
|
+
const emptyViewProposition = createProposition({
|
|
28
|
+
scope: viewName,
|
|
29
|
+
scopeDetails: {
|
|
30
|
+
characteristics: {
|
|
31
|
+
scopeType: "view"
|
|
32
|
+
}
|
|
33
|
+
},
|
|
34
|
+
items: [{
|
|
35
|
+
schema: DEFAULT_CONTENT_ITEM
|
|
36
|
+
}]
|
|
37
|
+
}, false);
|
|
38
|
+
return [emptyViewProposition];
|
|
39
|
+
};
|
|
23
40
|
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
41
|
+
// This should be called before making the request to experience edge.
|
|
42
|
+
const createCacheUpdate = viewName => {
|
|
43
|
+
const updateCacheDeferred = defer();
|
|
44
|
+
cacheUpdateCreatedAtLeastOnce = true;
|
|
45
|
+
previousUpdateCacheComplete = previousUpdateCacheComplete.then(() => updateCacheDeferred.promise).then(newViewStorage => {
|
|
46
|
+
assign(viewStorage, newViewStorage);
|
|
47
|
+
}).catch(() => {});
|
|
48
|
+
return {
|
|
49
|
+
update(viewPropositions) {
|
|
50
|
+
const viewPropositionsWithScope = viewPropositions.filter(proposition => proposition.getScope());
|
|
51
|
+
const newViewStorage = groupBy(viewPropositionsWithScope, proposition => proposition.getScope().toLowerCase());
|
|
52
|
+
updateCacheDeferred.resolve(newViewStorage);
|
|
53
|
+
if (viewName) {
|
|
54
|
+
return getViewPropositions(newViewStorage, viewName);
|
|
55
|
+
}
|
|
56
|
+
return [];
|
|
57
|
+
},
|
|
58
|
+
cancel() {
|
|
59
|
+
updateCacheDeferred.reject();
|
|
29
60
|
}
|
|
30
|
-
|
|
31
|
-
viewStorageDeferred.resolve();
|
|
32
|
-
});
|
|
61
|
+
};
|
|
33
62
|
};
|
|
34
|
-
|
|
35
63
|
const getView = viewName => {
|
|
36
|
-
return
|
|
64
|
+
return previousUpdateCacheComplete.then(() => getViewPropositions(viewStorage, viewName));
|
|
37
65
|
};
|
|
38
|
-
|
|
39
66
|
const isInitialized = () => {
|
|
40
|
-
return
|
|
67
|
+
return cacheUpdateCreatedAtLeastOnce;
|
|
41
68
|
};
|
|
42
|
-
|
|
43
69
|
return {
|
|
44
|
-
|
|
70
|
+
createCacheUpdate,
|
|
45
71
|
getView,
|
|
46
72
|
isInitialized
|
|
47
73
|
};
|
|
@@ -9,13 +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
|
-
|
|
13
|
-
import { isNonEmptyArray } from "../../utils";
|
|
12
|
+
|
|
14
13
|
import { PropositionEventType } from "./constants/propositionEventType";
|
|
15
14
|
export default (({
|
|
16
15
|
mergeDecisionsMeta,
|
|
17
|
-
|
|
18
|
-
executeDecisions,
|
|
16
|
+
processPropositions,
|
|
19
17
|
viewCache
|
|
20
18
|
}) => {
|
|
21
19
|
return ({
|
|
@@ -23,34 +21,32 @@ export default (({
|
|
|
23
21
|
event,
|
|
24
22
|
onResponse
|
|
25
23
|
}) => {
|
|
24
|
+
let returnedPropositions;
|
|
25
|
+
let returnedDecisions;
|
|
26
26
|
const viewName = personalizationDetails.getViewName();
|
|
27
|
-
|
|
27
|
+
onResponse(() => {
|
|
28
|
+
return {
|
|
29
|
+
propositions: returnedPropositions,
|
|
30
|
+
decisions: returnedDecisions
|
|
31
|
+
};
|
|
32
|
+
});
|
|
33
|
+
return viewCache.getView(viewName).then(propositions => {
|
|
34
|
+
let render;
|
|
28
35
|
if (personalizationDetails.isRenderDecisions()) {
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
});
|
|
36
|
-
return;
|
|
37
|
-
} // if there are no decisions in cache for this view, we will send a empty notification
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
onResponse(() => {
|
|
41
|
-
collect({
|
|
42
|
-
decisionsMeta: [],
|
|
43
|
-
viewName
|
|
44
|
-
});
|
|
45
|
-
return composePersonalizationResultingObject(viewDecisions, true);
|
|
46
|
-
});
|
|
47
|
-
});
|
|
36
|
+
({
|
|
37
|
+
render,
|
|
38
|
+
returnedPropositions,
|
|
39
|
+
returnedDecisions
|
|
40
|
+
} = processPropositions(propositions));
|
|
41
|
+
return render();
|
|
48
42
|
}
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
});
|
|
53
|
-
return
|
|
43
|
+
({
|
|
44
|
+
returnedPropositions,
|
|
45
|
+
returnedDecisions
|
|
46
|
+
} = processPropositions([], propositions));
|
|
47
|
+
return [];
|
|
48
|
+
}).then(decisionsMeta => {
|
|
49
|
+
mergeDecisionsMeta(event, decisionsMeta, PropositionEventType.DISPLAY);
|
|
54
50
|
});
|
|
55
51
|
};
|
|
56
52
|
});
|
|
@@ -9,6 +9,7 @@ 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
|
+
|
|
12
13
|
import { awaitSelector } from "../../../utils/dom";
|
|
13
14
|
import { hideElements, showElements } from "../flicker";
|
|
14
15
|
import { selectNodesWithEq } from "./dom";
|
|
@@ -23,36 +24,26 @@ export { default as setStyles } from "./setStyles";
|
|
|
23
24
|
export { default as setAttributes } from "./setAttributes";
|
|
24
25
|
export { default as swapImage } from "./swapImage";
|
|
25
26
|
export { default as rearrangeChildren } from "./rearrangeChildren";
|
|
26
|
-
export { default as click } from "./click";
|
|
27
|
-
|
|
28
27
|
const renderContent = (elements, content, renderFunc) => {
|
|
29
28
|
const executions = elements.map(element => renderFunc(element, content));
|
|
30
29
|
return Promise.all(executions);
|
|
31
30
|
};
|
|
32
|
-
|
|
33
31
|
export const createAction = renderFunc => {
|
|
34
|
-
return
|
|
32
|
+
return itemData => {
|
|
35
33
|
const {
|
|
36
34
|
selector,
|
|
37
35
|
prehidingSelector,
|
|
38
|
-
content
|
|
39
|
-
|
|
40
|
-
} = settings;
|
|
36
|
+
content
|
|
37
|
+
} = itemData;
|
|
41
38
|
hideElements(prehidingSelector);
|
|
42
39
|
return awaitSelector(selector, selectNodesWithEq).then(elements => renderContent(elements, content, renderFunc)).then(() => {
|
|
43
40
|
// if everything is OK, show elements
|
|
44
41
|
showElements(prehidingSelector);
|
|
45
|
-
return {
|
|
46
|
-
meta
|
|
47
|
-
};
|
|
48
42
|
}, error => {
|
|
49
43
|
// in case of awaiting timing or error, we need to remove the style tag
|
|
50
44
|
// hence showing the pre-hidden elements
|
|
51
45
|
showElements(prehidingSelector);
|
|
52
|
-
|
|
53
|
-
meta,
|
|
54
|
-
error
|
|
55
|
-
};
|
|
46
|
+
throw error;
|
|
56
47
|
});
|
|
57
48
|
};
|
|
58
49
|
};
|
|
@@ -9,35 +9,28 @@ 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
|
+
|
|
12
13
|
import { selectNodes } from "../../../utils/dom";
|
|
13
14
|
import { STYLE } from "../../../constants/tagName";
|
|
14
15
|
import { SRC } from "../../../constants/elementAttribute";
|
|
15
16
|
import { getAttribute, getNonce } from "./dom";
|
|
16
|
-
|
|
17
17
|
const is = (element, tagName) => element.tagName === tagName;
|
|
18
|
-
|
|
19
18
|
const isInlineStyleElement = element => is(element, STYLE) && !getAttribute(element, SRC);
|
|
20
|
-
|
|
21
19
|
export default (fragment => {
|
|
22
20
|
const styleNodes = selectNodes(STYLE, fragment);
|
|
23
21
|
const {
|
|
24
22
|
length
|
|
25
23
|
} = styleNodes;
|
|
26
24
|
const nonce = getNonce();
|
|
27
|
-
|
|
28
25
|
if (!nonce) {
|
|
29
26
|
return;
|
|
30
27
|
}
|
|
31
28
|
/* eslint-disable no-continue */
|
|
32
|
-
|
|
33
|
-
|
|
34
29
|
for (let i = 0; i < length; i += 1) {
|
|
35
30
|
const element = styleNodes[i];
|
|
36
|
-
|
|
37
31
|
if (!isInlineStyleElement(element)) {
|
|
38
32
|
continue;
|
|
39
33
|
}
|
|
40
|
-
|
|
41
34
|
element.nonce = nonce;
|
|
42
35
|
}
|
|
43
36
|
});
|
|
@@ -9,6 +9,7 @@ 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
|
+
|
|
12
13
|
import { appendNode } from "../../../utils/dom";
|
|
13
14
|
import { createFragment, getChildNodes } from "./dom";
|
|
14
15
|
import { loadImages } from "./images";
|
|
@@ -9,20 +9,18 @@ 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 matchesSelectorWithEq from "../dom/matchesSelectorWithEq";
|
|
13
12
|
|
|
13
|
+
import matchesSelectorWithEq from "../dom/matchesSelectorWithEq";
|
|
14
14
|
const getMetasIfMatches = (clickedElement, selector, getClickMetasBySelector) => {
|
|
15
15
|
const {
|
|
16
16
|
documentElement
|
|
17
17
|
} = document;
|
|
18
18
|
let element = clickedElement;
|
|
19
19
|
let i = 0;
|
|
20
|
-
|
|
21
20
|
while (element && element !== documentElement) {
|
|
22
21
|
if (matchesSelectorWithEq(selector, element)) {
|
|
23
22
|
const matchedMetas = getClickMetasBySelector(selector);
|
|
24
23
|
const foundMetaWithLabel = matchedMetas.find(meta => meta.trackingLabel);
|
|
25
|
-
|
|
26
24
|
if (foundMetaWithLabel) {
|
|
27
25
|
return {
|
|
28
26
|
metas: matchedMetas,
|
|
@@ -30,56 +28,46 @@ const getMetasIfMatches = (clickedElement, selector, getClickMetasBySelector) =>
|
|
|
30
28
|
weight: i
|
|
31
29
|
};
|
|
32
30
|
}
|
|
33
|
-
|
|
34
31
|
return {
|
|
35
32
|
metas: matchedMetas
|
|
36
33
|
};
|
|
37
34
|
}
|
|
38
|
-
|
|
39
35
|
element = element.parentNode;
|
|
40
36
|
i += 1;
|
|
41
37
|
}
|
|
42
|
-
|
|
43
38
|
return {
|
|
44
39
|
metas: null
|
|
45
40
|
};
|
|
46
41
|
};
|
|
47
|
-
|
|
48
42
|
const cleanMetas = metas => metas.map(meta => {
|
|
49
43
|
delete meta.trackingLabel;
|
|
50
44
|
return meta;
|
|
51
45
|
});
|
|
52
|
-
|
|
53
46
|
const dedupMetas = metas => metas.filter((meta, index) => {
|
|
54
47
|
const stringifiedMeta = JSON.stringify(meta);
|
|
55
48
|
return index === metas.findIndex(innerMeta => JSON.stringify(innerMeta) === stringifiedMeta);
|
|
56
49
|
});
|
|
57
|
-
|
|
58
50
|
export default ((clickedElement, selectors, getClickMetasBySelector) => {
|
|
59
51
|
const result = [];
|
|
60
52
|
let resultLabel = "";
|
|
61
53
|
let resultLabelWeight = Number.MAX_SAFE_INTEGER;
|
|
62
|
-
/* eslint-disable no-continue */
|
|
63
54
|
|
|
55
|
+
/* eslint-disable no-continue */
|
|
64
56
|
for (let i = 0; i < selectors.length; i += 1) {
|
|
65
57
|
const {
|
|
66
58
|
metas,
|
|
67
59
|
label,
|
|
68
60
|
weight
|
|
69
61
|
} = getMetasIfMatches(clickedElement, selectors[i], getClickMetasBySelector);
|
|
70
|
-
|
|
71
62
|
if (!metas) {
|
|
72
63
|
continue;
|
|
73
64
|
}
|
|
74
|
-
|
|
75
65
|
if (label && weight <= resultLabelWeight) {
|
|
76
66
|
resultLabel = label;
|
|
77
67
|
resultLabelWeight = weight;
|
|
78
68
|
}
|
|
79
|
-
|
|
80
69
|
result.push(...cleanMetas(metas));
|
|
81
70
|
}
|
|
82
|
-
|
|
83
71
|
return {
|
|
84
72
|
decisionsMeta: dedupMetas(result),
|
|
85
73
|
eventLabel: resultLabel
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*
|
|
2
|
-
Copyright
|
|
2
|
+
Copyright 2023 Adobe. All rights reserved.
|
|
3
3
|
This file is licensed to you under the Apache License, Version 2.0 (the "License");
|
|
4
4
|
you may not use this file except in compliance with the License. You may obtain a copy
|
|
5
5
|
of the License at http://www.apache.org/licenses/LICENSE-2.0
|
|
@@ -9,14 +9,10 @@ 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
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
selector,
|
|
19
|
-
meta
|
|
20
|
-
});
|
|
21
|
-
return Promise.resolve();
|
|
12
|
+
import { assign } from "../../../utils";
|
|
13
|
+
export default (preprocessors => action => {
|
|
14
|
+
if (!action) {
|
|
15
|
+
return action;
|
|
16
|
+
}
|
|
17
|
+
return preprocessors.reduce((processed, fn) => assign(processed, fn(processed)), action);
|
|
22
18
|
});
|
|
@@ -9,6 +9,7 @@ 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
|
+
|
|
12
13
|
import { createNode } from "../../../../utils/dom";
|
|
13
14
|
import { DIV } from "../../../../constants/tagName";
|
|
14
15
|
export default (content => {
|
|
@@ -9,6 +9,7 @@ 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
|
+
|
|
12
13
|
export default ((element, name) => {
|
|
13
14
|
return element.getAttribute(name);
|
|
14
15
|
});
|
|
@@ -9,15 +9,14 @@ 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
|
+
|
|
12
13
|
import { toArray } from "../../../../utils";
|
|
13
14
|
export default (element => {
|
|
14
15
|
const {
|
|
15
16
|
childNodes
|
|
16
17
|
} = element;
|
|
17
|
-
|
|
18
18
|
if (childNodes) {
|
|
19
19
|
return toArray(childNodes);
|
|
20
20
|
}
|
|
21
|
-
|
|
22
21
|
return [];
|
|
23
22
|
});
|
|
@@ -9,15 +9,14 @@ 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
|
+
|
|
12
13
|
import { toArray } from "../../../../utils";
|
|
13
14
|
export default (element => {
|
|
14
15
|
const {
|
|
15
16
|
children
|
|
16
17
|
} = element;
|
|
17
|
-
|
|
18
18
|
if (children) {
|
|
19
19
|
return toArray(children);
|
|
20
20
|
}
|
|
21
|
-
|
|
22
21
|
return [];
|
|
23
22
|
});
|
|
@@ -9,6 +9,7 @@ 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
|
+
|
|
12
13
|
export default (element => {
|
|
13
14
|
return element.firstElementChild;
|
|
14
15
|
});
|
|
@@ -9,6 +9,7 @@ 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
|
+
|
|
12
13
|
export default (element => {
|
|
13
14
|
return element.nextElementSibling;
|
|
14
15
|
});
|
|
@@ -9,24 +9,25 @@ 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
|
+
|
|
12
13
|
let nonce;
|
|
14
|
+
|
|
13
15
|
/**
|
|
14
16
|
* Returns the nonce if available.
|
|
15
17
|
* @param {Node} [context=document] defaults to document
|
|
16
18
|
* @returns {(String|undefined)} the nonce or undefined if not available
|
|
17
19
|
*/
|
|
18
|
-
|
|
19
20
|
export default ((context = document) => {
|
|
20
21
|
if (nonce === undefined) {
|
|
21
|
-
const n = context.querySelector("[nonce]");
|
|
22
|
+
const n = context.querySelector("[nonce]");
|
|
23
|
+
// NOTE: We're keeping n.getAttribute("nonce") until it is safe to remove:
|
|
22
24
|
// ref: https://github.com/whatwg/html/issues/2369#issuecomment-280853946
|
|
23
|
-
|
|
24
25
|
nonce = n && (n.nonce || n.getAttribute("nonce"));
|
|
25
26
|
}
|
|
26
|
-
|
|
27
27
|
return nonce;
|
|
28
|
-
});
|
|
28
|
+
});
|
|
29
29
|
|
|
30
|
+
// This function is only used for testing and removed when library is built (tree-shaking)
|
|
30
31
|
export const testResetCachedNonce = () => {
|
|
31
32
|
nonce = undefined;
|
|
32
33
|
};
|