@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
|
@@ -18,13 +18,7 @@ export default (({
|
|
|
18
18
|
if (headerParts.length >= 2 && headerParts[1].length > 0) {
|
|
19
19
|
try {
|
|
20
20
|
const regionId = parseInt(headerParts[1], 10);
|
|
21
|
-
|
|
22
|
-
// not available in Internet Explorer. Number.isNaN is more robust to
|
|
23
|
-
// non-numeric parameters. Since we already know regionId will be an
|
|
24
|
-
// integer, using isNaN is okay.
|
|
25
|
-
// https://github.com/airbnb/javascript#standard-library--isnan
|
|
26
|
-
// eslint-disable-next-line no-restricted-globals
|
|
27
|
-
if (!isNaN(regionId)) {
|
|
21
|
+
if (!Number.isNaN(regionId)) {
|
|
28
22
|
return {
|
|
29
23
|
regionId
|
|
30
24
|
};
|
package/libEs6/core/index.js
CHANGED
|
@@ -23,14 +23,12 @@ import createEvent from "./createEvent.js";
|
|
|
23
23
|
import injectCreateResponse from "./injectCreateResponse.js";
|
|
24
24
|
import injectExecuteCommand from "./injectExecuteCommand.js";
|
|
25
25
|
import validateCommandOptions from "./validateCommandOptions.js";
|
|
26
|
-
import componentCreators from "./componentCreators.js";
|
|
27
26
|
import buildAndValidateConfig from "./buildAndValidateConfig.js";
|
|
28
27
|
import initializeComponents from "./initializeComponents.js";
|
|
29
28
|
import createConfig from "./config/createConfig.js";
|
|
30
29
|
import createCoreConfigs from "./config/createCoreConfigs.js";
|
|
31
30
|
import injectHandleError from "./injectHandleError.js";
|
|
32
31
|
import injectSendFetchRequest from "./network/requestMethods/injectSendFetchRequest.js";
|
|
33
|
-
import injectSendXhrRequest from "./network/requestMethods/injectSendXhrRequest.js";
|
|
34
32
|
import injectSendBeaconRequest from "./network/requestMethods/injectSendBeaconRequest.js";
|
|
35
33
|
import createLogger from "./createLogger.js";
|
|
36
34
|
import createEventManager from "./createEventManager.js";
|
|
@@ -43,12 +41,12 @@ import injectGetLocationHint from "./edgeNetwork/injectGetLocationHint.js";
|
|
|
43
41
|
import isRequestRetryable from "./network/isRequestRetryable.js";
|
|
44
42
|
import getRequestRetryDelay from "./network/getRequestRetryDelay.js";
|
|
45
43
|
import injectApplyResponse from "./edgeNetwork/injectApplyResponse.js";
|
|
44
|
+
import * as requiredComponents from "./requiredComponentCreators.js";
|
|
46
45
|
const createNamespacedStorage = injectStorage(window);
|
|
47
46
|
const {
|
|
48
47
|
console,
|
|
49
48
|
fetch,
|
|
50
|
-
navigator
|
|
51
|
-
XMLHttpRequest
|
|
49
|
+
navigator
|
|
52
50
|
} = window;
|
|
53
51
|
|
|
54
52
|
// set this up as a function so that monitors can be added at anytime
|
|
@@ -56,10 +54,8 @@ const {
|
|
|
56
54
|
const getMonitors = () => window.__alloyMonitors || [];
|
|
57
55
|
const coreConfigValidators = createCoreConfigs();
|
|
58
56
|
const apexDomain = getApexDomain(window, cookieJar);
|
|
59
|
-
const sendFetchRequest =
|
|
57
|
+
const sendFetchRequest = injectSendFetchRequest({
|
|
60
58
|
fetch
|
|
61
|
-
}) : injectSendXhrRequest({
|
|
62
|
-
XMLHttpRequest
|
|
63
59
|
});
|
|
64
60
|
const fireReferrerHideableImage = injectFireReferrerHideableImage();
|
|
65
61
|
const getAssuranceValidationTokenParams = createGetAssuranceValidationTokenParams({
|
|
@@ -72,10 +68,12 @@ export const createExecuteCommand = ({
|
|
|
72
68
|
setDebugEnabled,
|
|
73
69
|
logger,
|
|
74
70
|
createComponentLogger
|
|
75
|
-
}
|
|
71
|
+
},
|
|
72
|
+
components
|
|
76
73
|
}) => {
|
|
77
74
|
const componentRegistry = createComponentRegistry();
|
|
78
75
|
const lifecycle = createLifecycle(componentRegistry);
|
|
76
|
+
const componentCreators = components.concat(Object.values(requiredComponents));
|
|
79
77
|
const setDebugCommand = options => {
|
|
80
78
|
setDebugEnabled(options.enabled, {
|
|
81
79
|
fromConfig: false
|
|
@@ -207,7 +205,9 @@ export const createExecuteCommand = ({
|
|
|
207
205
|
});
|
|
208
206
|
return executeCommand;
|
|
209
207
|
};
|
|
210
|
-
export default ((
|
|
208
|
+
export default (({
|
|
209
|
+
components
|
|
210
|
+
}) => {
|
|
211
211
|
// eslint-disable-next-line no-underscore-dangle
|
|
212
212
|
const instanceNames = window.__alloyNS;
|
|
213
213
|
if (instanceNames) {
|
|
@@ -222,7 +222,8 @@ export default (() => {
|
|
|
222
222
|
});
|
|
223
223
|
const executeCommand = createExecuteCommand({
|
|
224
224
|
instanceName,
|
|
225
|
-
logController
|
|
225
|
+
logController,
|
|
226
|
+
components
|
|
226
227
|
});
|
|
227
228
|
const instance = createInstanceFunction(executeCommand);
|
|
228
229
|
const queue = window[instanceName].q;
|
|
@@ -9,8 +9,6 @@ the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTA
|
|
|
9
9
|
OF ANY KIND, either express or implied. See the License for the specific language
|
|
10
10
|
governing permissions and limitations under the License.
|
|
11
11
|
*/
|
|
12
|
-
|
|
13
|
-
import { flatMap } from "../utils/index.js";
|
|
14
12
|
import { ADOBE_EDGE } from "../constants/httpHeaderNames.js";
|
|
15
13
|
|
|
16
14
|
/**
|
|
@@ -43,7 +41,7 @@ export default (({
|
|
|
43
41
|
* getPayloadsByType("identity:persist")
|
|
44
42
|
*/
|
|
45
43
|
getPayloadsByType(type) {
|
|
46
|
-
return
|
|
44
|
+
return handle.filter(fragment => fragment.type === type).flatMap(fragment => fragment.payload);
|
|
47
45
|
},
|
|
48
46
|
/**
|
|
49
47
|
* Returns all errors.
|
|
@@ -11,7 +11,6 @@ governing permissions and limitations under the License.
|
|
|
11
11
|
*/
|
|
12
12
|
|
|
13
13
|
import { TOO_MANY_REQUESTS, SERVICE_UNAVAILABLE, BAD_GATEWAY, GATEWAY_TIMEOUT } from "../../constants/httpStatusCode.js";
|
|
14
|
-
import { includes } from "../../utils/index.js";
|
|
15
14
|
const MAX_RETRIES = 3;
|
|
16
15
|
const RETRYABLE_STATUS_CODES = [TOO_MANY_REQUESTS, SERVICE_UNAVAILABLE, BAD_GATEWAY, GATEWAY_TIMEOUT];
|
|
17
16
|
|
|
@@ -21,5 +20,5 @@ export default (({
|
|
|
21
20
|
response,
|
|
22
21
|
retriesAttempted
|
|
23
22
|
}) => {
|
|
24
|
-
return retriesAttempted < MAX_RETRIES && includes(
|
|
23
|
+
return retriesAttempted < MAX_RETRIES && RETRYABLE_STATUS_CODES.includes(response.statusCode);
|
|
25
24
|
});
|
|
@@ -29,8 +29,7 @@ export default (({
|
|
|
29
29
|
statusCode: response.status,
|
|
30
30
|
// We expose headers through a function instead of creating an object
|
|
31
31
|
// with all the headers up front largely because the native
|
|
32
|
-
// request.getResponseHeader method is case-insensitive
|
|
33
|
-
// us from having to add header parsing logic when using XHR to make requests.
|
|
32
|
+
// request.getResponseHeader method is case-insensitive.
|
|
34
33
|
getHeader(name) {
|
|
35
34
|
return response.headers.get(name);
|
|
36
35
|
},
|
|
@@ -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
|
|
@@ -10,10 +10,6 @@ OF ANY KIND, either express or implied. See the License for the specific languag
|
|
|
10
10
|
governing permissions and limitations under the License.
|
|
11
11
|
*/
|
|
12
12
|
|
|
13
|
-
|
|
14
|
-
export default
|
|
15
|
-
|
|
16
|
-
assign(target, source);
|
|
17
|
-
}
|
|
18
|
-
return target;
|
|
19
|
-
});
|
|
13
|
+
export { default as dataCollector } from "../components/DataCollector/index.js";
|
|
14
|
+
export { default as identity } from "../components/Identity/index.js";
|
|
15
|
+
export { default as libraryInfo } from "../components/LibraryInfo/index.js";
|
package/libEs6/index.js
CHANGED
|
@@ -18,19 +18,22 @@ import { createExecuteCommand } from "./core/index.js";
|
|
|
18
18
|
import createLogger from "./core/createLogger.js";
|
|
19
19
|
import createLogController from "./core/createLogController.js";
|
|
20
20
|
import { injectStorage } from "./utils/index.js";
|
|
21
|
-
import { arrayOf, objectOf, string } from "./utils/validation/index.js";
|
|
21
|
+
import { arrayOf, objectOf, string, callback } from "./utils/validation/index.js";
|
|
22
|
+
import * as optionalComponents from "./core/componentCreators.js";
|
|
22
23
|
const {
|
|
23
24
|
console
|
|
24
25
|
} = window;
|
|
25
26
|
const createNamespacedStorage = injectStorage(window);
|
|
26
|
-
export const
|
|
27
|
+
export const createCustomInstance = (options = {}) => {
|
|
27
28
|
const eventOptionsValidator = objectOf({
|
|
28
29
|
name: string().default("alloy"),
|
|
29
|
-
monitors: arrayOf(objectOf({})).default([])
|
|
30
|
+
monitors: arrayOf(objectOf({})).default([]),
|
|
31
|
+
components: arrayOf(callback())
|
|
30
32
|
}).noUnknownFields();
|
|
31
33
|
const {
|
|
32
34
|
name,
|
|
33
|
-
monitors
|
|
35
|
+
monitors,
|
|
36
|
+
components
|
|
34
37
|
} = eventOptionsValidator(options);
|
|
35
38
|
|
|
36
39
|
// this is a function so that window.__alloyMonitors can be set or added to at any time
|
|
@@ -46,10 +49,27 @@ export const createInstance = (options = {}) => {
|
|
|
46
49
|
});
|
|
47
50
|
const instance = createExecuteCommand({
|
|
48
51
|
instanceName: name,
|
|
49
|
-
logController
|
|
52
|
+
logController,
|
|
53
|
+
components
|
|
50
54
|
});
|
|
51
55
|
logController.logger.logOnInstanceCreated({
|
|
52
56
|
instance
|
|
53
57
|
});
|
|
54
58
|
return instance;
|
|
55
|
-
};
|
|
59
|
+
};
|
|
60
|
+
export const createInstance = (options = {}) => {
|
|
61
|
+
const eventOptionsValidator = objectOf({
|
|
62
|
+
name: string().default("alloy"),
|
|
63
|
+
monitors: arrayOf(objectOf({})).default([])
|
|
64
|
+
}).noUnknownFields();
|
|
65
|
+
const {
|
|
66
|
+
name,
|
|
67
|
+
monitors
|
|
68
|
+
} = eventOptionsValidator(options);
|
|
69
|
+
return createCustomInstance({
|
|
70
|
+
name,
|
|
71
|
+
monitors,
|
|
72
|
+
components: Object.values(optionalComponents)
|
|
73
|
+
});
|
|
74
|
+
};
|
|
75
|
+
export { optionalComponents as components };
|
package/libEs6/standalone.js
CHANGED
|
@@ -13,4 +13,10 @@ governing permissions and limitations under the License.
|
|
|
13
13
|
// This file is used by rollup to create the browser version that is uploaded to cdn
|
|
14
14
|
|
|
15
15
|
import core from "./core/index.js";
|
|
16
|
-
core
|
|
16
|
+
import * as components from "./core/componentCreators.js";
|
|
17
|
+
|
|
18
|
+
// If you change this line, check if the custom build script is still working.
|
|
19
|
+
// You might need to change the babel plugin in scripts/helpers/entryPointGeneratorBabelPlugin.js.
|
|
20
|
+
core({
|
|
21
|
+
components: Object.values(components)
|
|
22
|
+
});
|
|
@@ -11,10 +11,9 @@ governing permissions and limitations under the License.
|
|
|
11
11
|
*/
|
|
12
12
|
|
|
13
13
|
import { CHROME, EDGE, EDGE_CHROMIUM, IE, UNKNOWN } from "../constants/browser.js";
|
|
14
|
-
import includes from "./includes.js";
|
|
15
14
|
|
|
16
15
|
// Users could have also disabled third-party cookies within these browsers, but
|
|
17
16
|
// we don't know. We also assume "unknown" browsers support third-party cookies,
|
|
18
17
|
// though we don't really know that either. We're making best guesses.
|
|
19
18
|
const browsersSupportingThirdPartyCookie = [CHROME, EDGE, EDGE_CHROMIUM, IE, UNKNOWN];
|
|
20
|
-
export default (browser => includes(
|
|
19
|
+
export default (browser => browsersSupportingThirdPartyCookie.includes(browser));
|
|
@@ -9,12 +9,11 @@ the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTA
|
|
|
9
9
|
OF ANY KIND, either express or implied. See the License for the specific language
|
|
10
10
|
governing permissions and limitations under the License.
|
|
11
11
|
*/
|
|
12
|
-
import assign from "./assign.js";
|
|
13
12
|
import isObject from "./isObject.js";
|
|
14
13
|
export default ((...values) => {
|
|
15
14
|
if (values.length < 2) {
|
|
16
15
|
// if the number of args is 0 or 1, just use the default behavior from Object.assign
|
|
17
|
-
return assign(...values);
|
|
16
|
+
return Object.assign(...values);
|
|
18
17
|
}
|
|
19
18
|
return values.reduce((accumulator, currentValue) => {
|
|
20
19
|
if (isObject(currentValue)) {
|
|
@@ -12,8 +12,8 @@ governing permissions and limitations under the License.
|
|
|
12
12
|
|
|
13
13
|
import cookie from "js-cookie";
|
|
14
14
|
export default {
|
|
15
|
-
get: cookie.get,
|
|
16
|
-
set: cookie.set,
|
|
17
|
-
remove: cookie.remove,
|
|
18
|
-
withConverter: cookie.withConverter
|
|
15
|
+
get: cookie.get.bind(cookie),
|
|
16
|
+
set: cookie.set.bind(cookie),
|
|
17
|
+
remove: cookie.remove.bind(cookie),
|
|
18
|
+
withConverter: cookie.withConverter.bind(cookie)
|
|
19
19
|
};
|
|
@@ -9,9 +9,9 @@ the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTA
|
|
|
9
9
|
OF ANY KIND, either express or implied. See the License for the specific language
|
|
10
10
|
governing permissions and limitations under the License.
|
|
11
11
|
*/
|
|
12
|
-
import { DISPLAY } from "
|
|
13
|
-
import { getPropositionEventType } from "
|
|
14
|
-
import { isNonEmptyArray } from "
|
|
12
|
+
import { DISPLAY } from "../constants/eventType.js";
|
|
13
|
+
import { getPropositionEventType } from "../constants/propositionEventType.js";
|
|
14
|
+
import { isNonEmptyArray } from "./index.js";
|
|
15
15
|
export default (({
|
|
16
16
|
eventManager,
|
|
17
17
|
mergeDecisionsMeta
|
|
@@ -9,7 +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
13
|
const defaultPreprocessor = (params, ...args) => {
|
|
14
14
|
return args;
|
|
15
15
|
};
|
|
@@ -35,7 +35,10 @@ const createSubscription = () => {
|
|
|
35
35
|
callback,
|
|
36
36
|
params
|
|
37
37
|
};
|
|
38
|
-
return
|
|
38
|
+
return {
|
|
39
|
+
id: counter,
|
|
40
|
+
unsubscribe: createUnsubscribe(counter)
|
|
41
|
+
};
|
|
39
42
|
};
|
|
40
43
|
const setEmissionPreprocessor = value => {
|
|
41
44
|
if (typeof value === "function") {
|
|
@@ -48,7 +51,7 @@ const createSubscription = () => {
|
|
|
48
51
|
}
|
|
49
52
|
};
|
|
50
53
|
const emit = (...args) => {
|
|
51
|
-
values(subscriptions).forEach(({
|
|
54
|
+
Object.values(subscriptions).forEach(({
|
|
52
55
|
callback,
|
|
53
56
|
params
|
|
54
57
|
}) => {
|
|
@@ -58,10 +61,24 @@ const createSubscription = () => {
|
|
|
58
61
|
}
|
|
59
62
|
});
|
|
60
63
|
};
|
|
64
|
+
const emitOne = (subscriptionId, ...args) => {
|
|
65
|
+
if (!subscriptionId || !subscriptions[subscriptionId]) {
|
|
66
|
+
return;
|
|
67
|
+
}
|
|
68
|
+
const {
|
|
69
|
+
callback,
|
|
70
|
+
params
|
|
71
|
+
} = subscriptions[subscriptionId];
|
|
72
|
+
const result = preprocessor(params, ...args);
|
|
73
|
+
if (emissionCondition(params, ...result)) {
|
|
74
|
+
callback(...result);
|
|
75
|
+
}
|
|
76
|
+
};
|
|
61
77
|
const hasSubscriptions = () => Object.keys(subscriptions).length > 0;
|
|
62
78
|
return {
|
|
63
79
|
add,
|
|
64
80
|
emit,
|
|
81
|
+
emitOne,
|
|
65
82
|
hasSubscriptions,
|
|
66
83
|
setEmissionPreprocessor,
|
|
67
84
|
setEmissionCondition
|
|
@@ -16,14 +16,5 @@ export default ((context, selector) => {
|
|
|
16
16
|
if (!SIBLING_PATTERN.test(selector)) {
|
|
17
17
|
return toArray(context.querySelectorAll(selector));
|
|
18
18
|
}
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
// We could use a :scope selector here, but we want to be IE compliant
|
|
22
|
-
// so we add a dummy css class to be able to select the children
|
|
23
|
-
try {
|
|
24
|
-
context.classList.add(tag);
|
|
25
|
-
return toArray(context.querySelectorAll(`.${tag} ${selector}`));
|
|
26
|
-
} finally {
|
|
27
|
-
context.classList.remove(tag);
|
|
28
|
-
}
|
|
19
|
+
return toArray(context.querySelectorAll(`:scope ${selector}`));
|
|
29
20
|
});
|
|
@@ -11,31 +11,21 @@ governing permissions and limitations under the License.
|
|
|
11
11
|
*/
|
|
12
12
|
|
|
13
13
|
import querySelectorAll from "./querySelectorAll.js";
|
|
14
|
-
import startsWith from "../startsWith.js";
|
|
15
14
|
import SHADOW_SEPARATOR from "../../constants/shadowSeparator.js";
|
|
16
15
|
const splitWithShadow = selector => {
|
|
17
16
|
return selector.split(SHADOW_SEPARATOR);
|
|
18
17
|
};
|
|
19
18
|
const transformPrefix = (parent, selector) => {
|
|
20
19
|
const result = selector;
|
|
21
|
-
const hasChildCombinatorPrefix = startsWith(
|
|
20
|
+
const hasChildCombinatorPrefix = result.startsWith(">");
|
|
22
21
|
if (!hasChildCombinatorPrefix) {
|
|
23
22
|
return result;
|
|
24
23
|
}
|
|
25
|
-
|
|
26
|
-
// IE doesn't support :scope
|
|
27
|
-
if (window.document.documentMode) {
|
|
28
|
-
return result.substring(1).trim();
|
|
29
|
-
}
|
|
30
|
-
const prefix = parent instanceof Element || parent instanceof HTMLDocument ? ":scope" : ":host"; // see https://bugs.webkit.org/show_bug.cgi?id=233380
|
|
24
|
+
const prefix = parent instanceof Element || parent instanceof Document ? ":scope" : ":host"; // see https://bugs.webkit.org/show_bug.cgi?id=233380
|
|
31
25
|
|
|
32
26
|
return `${prefix} ${result}`;
|
|
33
27
|
};
|
|
34
28
|
export default ((context, selector) => {
|
|
35
|
-
// Shadow DOM should be supported
|
|
36
|
-
if (!window.document.documentElement.attachShadow) {
|
|
37
|
-
return querySelectorAll(context, selector.replace(SHADOW_SEPARATOR, ""));
|
|
38
|
-
}
|
|
39
29
|
const parts = splitWithShadow(selector);
|
|
40
30
|
if (parts.length < 2) {
|
|
41
31
|
return querySelectorAll(context, selector);
|
|
@@ -10,7 +10,7 @@ OF ANY KIND, either express or implied. See the License for the specific languag
|
|
|
10
10
|
governing permissions and limitations under the License.
|
|
11
11
|
*/
|
|
12
12
|
|
|
13
|
-
import { EVENT_TYPE_TRUE } from "
|
|
13
|
+
import { EVENT_TYPE_TRUE } from "../constants/eventType.js";
|
|
14
14
|
|
|
15
15
|
/* eslint-disable no-underscore-dangle */
|
|
16
16
|
export const mergeDecisionsMeta = (event, decisionsMeta, propositionEventTypes, propositionAction) => {
|
package/libEs6/utils/index.js
CHANGED
|
@@ -12,9 +12,7 @@ governing permissions and limitations under the License.
|
|
|
12
12
|
|
|
13
13
|
// Please keep in alphabetical order.
|
|
14
14
|
export { default as areThirdPartyCookiesSupportedByDefault } from "./areThirdPartyCookiesSupportedByDefault.js";
|
|
15
|
-
export { default as assign } from "./assign.js";
|
|
16
15
|
export { default as assignConcatArrayValues } from "./assignConcatArrayValues.js";
|
|
17
|
-
export { default as assignIf } from "./assignIf.js";
|
|
18
16
|
export { default as clone } from "./clone.js";
|
|
19
17
|
export { default as cookieJar } from "./cookieJar.js";
|
|
20
18
|
export { default as createMerger } from "./createMerger.js";
|
|
@@ -25,17 +23,13 @@ export { default as crc32 } from "./crc32.js";
|
|
|
25
23
|
export { default as defer } from "./defer.js";
|
|
26
24
|
export { default as deduplicateArray } from "./deduplicateArray.js";
|
|
27
25
|
export { default as deepAssign } from "./deepAssign.js";
|
|
28
|
-
export { default as endsWith } from "./endsWith.js";
|
|
29
|
-
export { default as find } from "./find.js";
|
|
30
26
|
export { default as fireImage } from "./fireImage.js";
|
|
31
27
|
export { default as injectFireReferrerHideableImage } from "./injectFireReferrerHideableImage.js";
|
|
32
28
|
export { default as filterObject } from "./filterObject.js";
|
|
33
|
-
export { default as flatMap } from "./flatMap.js";
|
|
34
29
|
export { default as getApexDomain } from "./getApexDomain.js";
|
|
35
30
|
export { default as getLastArrayItems } from "./getLastArrayItems.js";
|
|
36
31
|
export { default as getNamespacedCookieName } from "./getNamespacedCookieName.js";
|
|
37
32
|
export { default as groupBy } from "./groupBy.js";
|
|
38
|
-
export { default as includes } from "./includes.js";
|
|
39
33
|
export { default as injectDoesIdentityCookieExist } from "./injectDoesIdentityCookieExist.js";
|
|
40
34
|
export { default as injectStorage } from "./injectStorage.js";
|
|
41
35
|
export { default as intersection } from "./intersection.js";
|
|
@@ -52,13 +46,11 @@ export { default as isObject } from "./isObject.js";
|
|
|
52
46
|
export { default as isString } from "./isString.js";
|
|
53
47
|
export { default as memoize } from "./memoize.js";
|
|
54
48
|
export { default as noop } from "./noop.js";
|
|
55
|
-
export { default as padStart } from "./padStart.js";
|
|
56
49
|
export { default as parseUrl } from "./parseUrl.js";
|
|
57
50
|
export { default as prepareConfigOverridesForEdge } from "./prepareConfigOverridesForEdge.js";
|
|
58
51
|
export { default as queryString } from "./querystring.js";
|
|
59
52
|
export { default as sanitizeOrgIdForCookieName } from "./sanitizeOrgIdForCookieName.js";
|
|
60
53
|
export { default as stackError } from "./stackError.js";
|
|
61
|
-
export { default as startsWith } from "./startsWith.js";
|
|
62
54
|
export { default as stringToBoolean } from "./stringToBoolean.js";
|
|
63
55
|
export { default as toArray } from "./toArray.js";
|
|
64
56
|
export { default as toError } from "./toError.js";
|
|
@@ -67,5 +59,4 @@ export { default as toISOStringLocal } from "./toISOStringLocal.js";
|
|
|
67
59
|
export { default as uuid } from "./uuid.js";
|
|
68
60
|
export { default as updateErrorMessage } from "./updateErrorMessage.js";
|
|
69
61
|
export { default as validateIdentityMap } from "./validateIdentityMap.js";
|
|
70
|
-
export { default as validateConfigOverride } from "./validateConfigOverride.js";
|
|
71
|
-
export { default as values } from "./values.js";
|
|
62
|
+
export { default as validateConfigOverride } from "./validateConfigOverride.js";
|
|
@@ -11,7 +11,6 @@ governing permissions and limitations under the License.
|
|
|
11
11
|
*/
|
|
12
12
|
|
|
13
13
|
import baseNamespace from "../constants/namespace.js";
|
|
14
|
-
import startsWith from "./startsWith.js";
|
|
15
14
|
const getStorageByType = (context, storageType, namespace) => {
|
|
16
15
|
// When storage is disabled on Safari, the mere act of referencing
|
|
17
16
|
// window.localStorage or window.sessionStorage throws an error.
|
|
@@ -49,7 +48,7 @@ const getStorageByType = (context, storageType, namespace) => {
|
|
|
49
48
|
clear() {
|
|
50
49
|
try {
|
|
51
50
|
Object.keys(context[storageType]).forEach(key => {
|
|
52
|
-
if (startsWith(
|
|
51
|
+
if (key.startsWith(namespace)) {
|
|
53
52
|
context[storageType].removeItem(key);
|
|
54
53
|
}
|
|
55
54
|
});
|
|
@@ -9,13 +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
|
-
import includes from "./includes.js";
|
|
14
|
-
|
|
15
12
|
/**
|
|
16
13
|
* Returns items that are found within both arrays.
|
|
17
14
|
* @param {Array} a
|
|
18
15
|
* @param {Array} b
|
|
19
16
|
* @returns {Array}
|
|
20
17
|
*/
|
|
21
|
-
export default ((a, b) => a.filter(x => includes(
|
|
18
|
+
export default ((a, b) => a.filter(x => b.includes(x)));
|
package/libEs6/utils/isNumber.js
CHANGED
|
@@ -15,5 +15,4 @@ governing permissions and limitations under the License.
|
|
|
15
15
|
* @param {*} value
|
|
16
16
|
* @returns {boolean}
|
|
17
17
|
*/
|
|
18
|
-
|
|
19
|
-
export default (value => typeof value === "number" && !isNaN(value));
|
|
18
|
+
export default (value => typeof value === "number" && !Number.isNaN(value));
|
|
@@ -9,9 +9,22 @@ 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 padStart from "./padStart.js";
|
|
13
12
|
import toInteger from "./toInteger.js";
|
|
14
13
|
|
|
14
|
+
/**
|
|
15
|
+
* Add padString to the start of the string until it reaches the target length
|
|
16
|
+
*
|
|
17
|
+
* Different from String.prototype.padStart because this function coerces the
|
|
18
|
+
* input to a string before padding.
|
|
19
|
+
* @param {any} string
|
|
20
|
+
* @param {number} targetLength
|
|
21
|
+
* @param {string} padString
|
|
22
|
+
* @returns {string}
|
|
23
|
+
*/
|
|
24
|
+
const padStart = (string, targetLength, padString) => {
|
|
25
|
+
return `${string}`.padStart(targetLength, padString);
|
|
26
|
+
};
|
|
27
|
+
|
|
15
28
|
/**
|
|
16
29
|
* Formats the date into an ISO date-time string in the local timezone
|
|
17
30
|
* @param {Date} date
|
|
@@ -21,8 +21,7 @@ import isString from "./isString.js";
|
|
|
21
21
|
export default ((value, defaultValue) => {
|
|
22
22
|
if (isNumber(value) || isString(value)) {
|
|
23
23
|
const n = Math.round(Number(value));
|
|
24
|
-
|
|
25
|
-
if (!isNaN(n)) {
|
|
24
|
+
if (!Number.isNaN(n)) {
|
|
26
25
|
return n;
|
|
27
26
|
}
|
|
28
27
|
}
|
|
@@ -10,10 +10,9 @@ OF ANY KIND, either express or implied. See the License for the specific languag
|
|
|
10
10
|
governing permissions and limitations under the License.
|
|
11
11
|
*/
|
|
12
12
|
import { assertValid } from "./utils.js";
|
|
13
|
-
import find from "../find.js";
|
|
14
13
|
export default ((validators, message) => function anyOf(value, path) {
|
|
15
14
|
let newValue;
|
|
16
|
-
const valid = find(
|
|
15
|
+
const valid = validators.find(validator => {
|
|
17
16
|
try {
|
|
18
17
|
newValue = validator.call(this, value, path);
|
|
19
18
|
return true;
|
|
@@ -10,9 +10,6 @@ OF ANY KIND, either express or implied. See the License for the specific languag
|
|
|
10
10
|
governing permissions and limitations under the License.
|
|
11
11
|
*/
|
|
12
12
|
|
|
13
|
-
// This is used to add methods onto a function.
|
|
14
|
-
import assign from "../assign.js";
|
|
15
|
-
|
|
16
13
|
/**
|
|
17
14
|
* Wraps a validator returning the value if it is null or undefined, otherwise
|
|
18
15
|
* it will call the original validator and return the result.
|
|
@@ -73,7 +70,7 @@ const callSequentiallyJoinErrors = (firstValidator, secondValidator) => function
|
|
|
73
70
|
* @returns {function}
|
|
74
71
|
*/
|
|
75
72
|
export const chain = (baseValidator, newValidator, additionalMethods) => {
|
|
76
|
-
return assign(callSequentially(baseValidator, newValidator), baseValidator, additionalMethods);
|
|
73
|
+
return Object.assign(callSequentially(baseValidator, newValidator), baseValidator, additionalMethods);
|
|
77
74
|
};
|
|
78
75
|
|
|
79
76
|
/**
|
|
@@ -92,7 +89,7 @@ export const chain = (baseValidator, newValidator, additionalMethods) => {
|
|
|
92
89
|
* @returns {function}
|
|
93
90
|
*/
|
|
94
91
|
export const nullSafeChain = (baseValidator, newValidator, additionalMethods) => {
|
|
95
|
-
return assign(callSequentially(baseValidator, skipIfNull(newValidator)), baseValidator, additionalMethods);
|
|
92
|
+
return Object.assign(callSequentially(baseValidator, skipIfNull(newValidator)), baseValidator, additionalMethods);
|
|
96
93
|
};
|
|
97
94
|
|
|
98
95
|
/**
|
|
@@ -107,7 +104,7 @@ export const nullSafeChain = (baseValidator, newValidator, additionalMethods) =>
|
|
|
107
104
|
* @returns {function}
|
|
108
105
|
*/
|
|
109
106
|
export const reverseNullSafeChainJoinErrors = (baseValidator, newValidator, additionalMethods) => {
|
|
110
|
-
return assign(callSequentiallyJoinErrors(skipIfNull(newValidator), baseValidator), baseValidator, additionalMethods);
|
|
107
|
+
return Object.assign(callSequentiallyJoinErrors(skipIfNull(newValidator), baseValidator), baseValidator, additionalMethods);
|
|
111
108
|
};
|
|
112
109
|
|
|
113
110
|
/**
|