@adobe/alloy 2.21.1 → 2.22.0-alpha.0

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.
Files changed (436) hide show
  1. package/babel.config.cjs +0 -1
  2. package/libEs5/baseCode/index.js +3 -2
  3. package/libEs5/components/ActivityCollector/attachClickActivityCollector.js +23 -20
  4. package/libEs5/components/ActivityCollector/configValidators.js +2 -2
  5. package/libEs5/components/ActivityCollector/createClickActivityStorage.js +11 -9
  6. package/libEs5/components/ActivityCollector/createClickedElementProperties.js +39 -32
  7. package/libEs5/components/ActivityCollector/createGetClickedElementProperties.js +28 -20
  8. package/libEs5/components/ActivityCollector/createInjectClickedElementProperties.js +24 -21
  9. package/libEs5/components/ActivityCollector/createRecallAndInjectClickedElementProperties.js +10 -8
  10. package/libEs5/components/ActivityCollector/createStorePageViewProperties.js +6 -4
  11. package/libEs5/components/ActivityCollector/getLinkName.js +19 -18
  12. package/libEs5/components/ActivityCollector/getLinkRegion.js +10 -9
  13. package/libEs5/components/ActivityCollector/index.js +61 -45
  14. package/libEs5/components/ActivityCollector/utils/activityMapExtensionEnabled.js +3 -5
  15. package/libEs5/components/ActivityCollector/utils/createTransientStorage.js +7 -6
  16. package/libEs5/components/ActivityCollector/utils/determineLinkType.js +4 -3
  17. package/libEs5/components/ActivityCollector/utils/dom/elementHasClickHandler.js +3 -2
  18. package/libEs5/components/ActivityCollector/utils/dom/extractDomain.js +5 -4
  19. package/libEs5/components/ActivityCollector/utils/dom/findClickableElement.js +4 -3
  20. package/libEs5/components/ActivityCollector/utils/dom/getAbsoluteUrlFromAnchorElement.js +11 -8
  21. package/libEs5/components/ActivityCollector/utils/dom/isButtonSubmitElement.js +3 -2
  22. package/libEs5/components/ActivityCollector/utils/dom/isDownloadLink.js +6 -5
  23. package/libEs5/components/ActivityCollector/utils/dom/isExitLink.js +6 -5
  24. package/libEs5/components/ActivityCollector/utils/dom/isInputSubmitElement.js +4 -3
  25. package/libEs5/components/ActivityCollector/utils/dom/isSupportedAnchorElement.js +3 -2
  26. package/libEs5/components/ActivityCollector/utils/dom/isSupportedTextNode.js +4 -3
  27. package/libEs5/components/ActivityCollector/utils/hasPageName.js +4 -3
  28. package/libEs5/components/ActivityCollector/utils/isDifferentDomains.js +5 -4
  29. package/libEs5/components/ActivityCollector/utils/trimQueryFromUrl.js +5 -4
  30. package/libEs5/components/ActivityCollector/utils/truncateWhiteSpace.js +3 -2
  31. package/libEs5/components/ActivityCollector/utils/urlStartsWithScheme.js +3 -2
  32. package/libEs5/components/Audiences/index.js +13 -12
  33. package/libEs5/components/Audiences/injectProcessDestinations.js +32 -35
  34. package/libEs5/components/Audiences/injectProcessResponse.js +19 -16
  35. package/libEs5/components/Context/createComponent.js +10 -13
  36. package/libEs5/components/Context/implementationDetails.js +5 -4
  37. package/libEs5/components/Context/index.js +24 -28
  38. package/libEs5/components/Context/injectDevice.js +23 -15
  39. package/libEs5/components/Context/injectEnvironment.js +17 -12
  40. package/libEs5/components/Context/injectHighEntropyUserAgentHints.js +12 -21
  41. package/libEs5/components/Context/injectPlaceContext.js +8 -7
  42. package/libEs5/components/Context/injectTimestamp.js +6 -5
  43. package/libEs5/components/Context/injectWeb.js +6 -5
  44. package/libEs5/components/DataCollector/index.js +37 -38
  45. package/libEs5/components/DataCollector/validateApplyResponse.js +6 -4
  46. package/libEs5/components/DataCollector/validateUserEventOptions.js +6 -4
  47. package/libEs5/components/DecisioningEngine/consequenceAdapters/inAppMessageConsequenceAdapter.js +11 -8
  48. package/libEs5/components/DecisioningEngine/consequenceAdapters/schemaTypeConsequenceAdapter.js +10 -7
  49. package/libEs5/components/DecisioningEngine/constants.js +3 -3
  50. package/libEs5/components/DecisioningEngine/createApplyResponse.js +15 -15
  51. package/libEs5/components/DecisioningEngine/createConsequenceAdapter.js +17 -13
  52. package/libEs5/components/DecisioningEngine/createContextProvider.js +48 -44
  53. package/libEs5/components/DecisioningEngine/createDecisionHistory.js +7 -5
  54. package/libEs5/components/DecisioningEngine/createDecisionProvider.js +16 -21
  55. package/libEs5/components/DecisioningEngine/createEvaluableRulesetPayload.js +39 -37
  56. package/libEs5/components/DecisioningEngine/createEvaluateRulesetsCommand.js +21 -19
  57. package/libEs5/components/DecisioningEngine/createEventRegistry.js +63 -67
  58. package/libEs5/components/DecisioningEngine/createOnResponseHandler.js +23 -22
  59. package/libEs5/components/DecisioningEngine/createSubscribeRulesetItems.js +100 -55
  60. package/libEs5/components/DecisioningEngine/index.js +83 -54
  61. package/libEs5/components/DecisioningEngine/utils.js +43 -38
  62. package/libEs5/components/EventMerge/createComponent.js +5 -3
  63. package/libEs5/components/EventMerge/createEventMergeId.js +3 -2
  64. package/libEs5/components/EventMerge/index.js +1 -1
  65. package/libEs5/components/Identity/addEcidQueryToPayload.js +3 -2
  66. package/libEs5/components/Identity/addEcidToPayload.js +3 -2
  67. package/libEs5/components/Identity/appendIdentityToUrl/injectAppendIdentityToUrl.js +13 -23
  68. package/libEs5/components/Identity/configValidators.js +1 -1
  69. package/libEs5/components/Identity/constants/authState.js +3 -3
  70. package/libEs5/components/Identity/createComponent.js +39 -33
  71. package/libEs5/components/Identity/createLegacyIdentity.js +29 -29
  72. package/libEs5/components/Identity/getEcidFromResponse.js +5 -7
  73. package/libEs5/components/Identity/getIdentity/createGetIdentity.js +17 -15
  74. package/libEs5/components/Identity/getIdentity/createIdentityRequest.js +10 -8
  75. package/libEs5/components/Identity/getIdentity/createIdentityRequestPayload.js +5 -4
  76. package/libEs5/components/Identity/index.js +61 -62
  77. package/libEs5/components/Identity/injectAddLegacyEcidToPayload.js +8 -6
  78. package/libEs5/components/Identity/injectAddQueryStringIdentityToPayload.js +46 -52
  79. package/libEs5/components/Identity/injectAwaitIdentityCookie.js +14 -11
  80. package/libEs5/components/Identity/injectEnsureSingleIdentity.js +25 -24
  81. package/libEs5/components/Identity/injectHandleResponseForIdSyncs.js +6 -4
  82. package/libEs5/components/Identity/injectProcessIdSyncs.js +20 -22
  83. package/libEs5/components/Identity/injectSetDomainForInitialIdentityPayload.js +7 -5
  84. package/libEs5/components/Identity/visitorService/awaitVisitorOptIn.js +8 -6
  85. package/libEs5/components/Identity/visitorService/getVisitor.js +4 -3
  86. package/libEs5/components/Identity/visitorService/injectGetEcidFromVisitor.js +15 -13
  87. package/libEs5/components/LegacyMediaAnalytics/constants/constants.js +9 -9
  88. package/libEs5/components/LegacyMediaAnalytics/constants/mediaKeysToXdmConverter.js +2 -2
  89. package/libEs5/components/LegacyMediaAnalytics/createGetInstance.js +61 -63
  90. package/libEs5/components/LegacyMediaAnalytics/createLegacyMediaComponent.js +38 -37
  91. package/libEs5/components/LegacyMediaAnalytics/createMediaHelper.js +54 -52
  92. package/libEs5/components/LegacyMediaAnalytics/index.js +32 -33
  93. package/libEs5/components/LibraryInfo/index.js +23 -30
  94. package/libEs5/components/MachineLearning/index.js +1 -1
  95. package/libEs5/components/MachineLearning/processResponse.js +5 -3
  96. package/libEs5/components/Personalization/constants/loggerMessage.js +2 -2
  97. package/libEs5/components/Personalization/constants/scopeType.js +3 -3
  98. package/libEs5/components/Personalization/constants/surface.js +4 -4
  99. package/libEs5/components/Personalization/createActionsProvider.js +37 -32
  100. package/libEs5/components/Personalization/createApplyPropositions.js +71 -81
  101. package/libEs5/components/Personalization/createClickStorage.js +30 -32
  102. package/libEs5/components/Personalization/createComponent.js +65 -74
  103. package/libEs5/components/Personalization/createFetchDataHandler.js +49 -52
  104. package/libEs5/components/Personalization/createGetPageLocation.js +6 -6
  105. package/libEs5/components/Personalization/createHandleConsentFlicker.js +15 -14
  106. package/libEs5/components/Personalization/createInteractionStorage.js +25 -39
  107. package/libEs5/components/Personalization/createNotificationHandler.js +9 -10
  108. package/libEs5/components/Personalization/createOnClickHandler.js +29 -25
  109. package/libEs5/components/Personalization/createOnDecisionHandler.js +23 -21
  110. package/libEs5/components/Personalization/createPersonalizationDetails.js +39 -45
  111. package/libEs5/components/Personalization/createPreprocessors.js +7 -7
  112. package/libEs5/components/Personalization/createSetTargetMigration.js +6 -4
  113. package/libEs5/components/Personalization/createViewCacheManager.js +29 -32
  114. package/libEs5/components/Personalization/createViewChangeHandler.js +25 -20
  115. package/libEs5/components/Personalization/dom-actions/action.js +24 -25
  116. package/libEs5/components/Personalization/dom-actions/addNonceToInlineStyleElements.js +12 -13
  117. package/libEs5/components/Personalization/dom-actions/appendHtml.js +8 -7
  118. package/libEs5/components/Personalization/dom-actions/clicks/collectClicks.js +28 -33
  119. package/libEs5/components/Personalization/dom-actions/clicks/collectInteractions.js +37 -40
  120. package/libEs5/components/Personalization/dom-actions/collectInteractions.js +3 -2
  121. package/libEs5/components/Personalization/dom-actions/createPreprocess.js +10 -11
  122. package/libEs5/components/Personalization/dom-actions/createRedirect.js +11 -13
  123. package/libEs5/components/Personalization/dom-actions/dom/createFragment.js +3 -2
  124. package/libEs5/components/Personalization/dom-actions/dom/getAttribute.js +3 -2
  125. package/libEs5/components/Personalization/dom-actions/dom/getChildNodes.js +6 -3
  126. package/libEs5/components/Personalization/dom-actions/dom/getChildren.js +6 -3
  127. package/libEs5/components/Personalization/dom-actions/dom/getElementById.js +3 -3
  128. package/libEs5/components/Personalization/dom-actions/dom/getFirstChild.js +3 -2
  129. package/libEs5/components/Personalization/dom-actions/dom/getNextSibling.js +3 -2
  130. package/libEs5/components/Personalization/dom-actions/dom/getNonce.js +7 -6
  131. package/libEs5/components/Personalization/dom-actions/dom/getParent.js +3 -2
  132. package/libEs5/components/Personalization/dom-actions/dom/helperForEq.js +7 -7
  133. package/libEs5/components/Personalization/dom-actions/dom/index.js +14 -14
  134. package/libEs5/components/Personalization/dom-actions/dom/insertAfter.js +4 -3
  135. package/libEs5/components/Personalization/dom-actions/dom/insertBefore.js +4 -3
  136. package/libEs5/components/Personalization/dom-actions/dom/isDomElement.js +2 -3
  137. package/libEs5/components/Personalization/dom-actions/dom/matchesSelectorWithEq.js +6 -5
  138. package/libEs5/components/Personalization/dom-actions/dom/removeAttribute.js +3 -2
  139. package/libEs5/components/Personalization/dom-actions/dom/selectNodesWithEq.js +39 -38
  140. package/libEs5/components/Personalization/dom-actions/dom/setAttribute.js +3 -2
  141. package/libEs5/components/Personalization/dom-actions/dom/setStyle.js +4 -3
  142. package/libEs5/components/Personalization/dom-actions/images.js +10 -9
  143. package/libEs5/components/Personalization/dom-actions/index.js +1 -1
  144. package/libEs5/components/Personalization/dom-actions/initDomActionsModules.js +40 -25
  145. package/libEs5/components/Personalization/dom-actions/insertHtmlAfter.js +9 -8
  146. package/libEs5/components/Personalization/dom-actions/insertHtmlBefore.js +8 -7
  147. package/libEs5/components/Personalization/dom-actions/prependHtml.js +13 -10
  148. package/libEs5/components/Personalization/dom-actions/rearrangeChildren.js +9 -7
  149. package/libEs5/components/Personalization/dom-actions/remapCustomCodeOffers.js +14 -9
  150. package/libEs5/components/Personalization/dom-actions/remapHeadOffers.js +16 -14
  151. package/libEs5/components/Personalization/dom-actions/replaceHtml.js +4 -3
  152. package/libEs5/components/Personalization/dom-actions/scripts.js +58 -38
  153. package/libEs5/components/Personalization/dom-actions/setAttributes.js +4 -3
  154. package/libEs5/components/Personalization/dom-actions/setHtml.js +5 -4
  155. package/libEs5/components/Personalization/dom-actions/setStyles.js +8 -8
  156. package/libEs5/components/Personalization/dom-actions/setText.js +3 -2
  157. package/libEs5/components/Personalization/dom-actions/swapImage.js +3 -2
  158. package/libEs5/components/Personalization/flicker/index.js +34 -31
  159. package/libEs5/components/Personalization/handlers/createDecorateProposition.js +16 -13
  160. package/libEs5/components/Personalization/handlers/createProcessDomAction.js +45 -50
  161. package/libEs5/components/Personalization/handlers/createProcessHtmlContent.js +30 -29
  162. package/libEs5/components/Personalization/handlers/createProcessInAppMessage.js +35 -31
  163. package/libEs5/components/Personalization/handlers/createProcessPropositions.js +91 -107
  164. package/libEs5/components/Personalization/handlers/createProcessRedirect.js +30 -29
  165. package/libEs5/components/Personalization/handlers/injectCreateProposition.js +59 -64
  166. package/libEs5/components/Personalization/handlers/processDefaultContent.js +3 -2
  167. package/libEs5/components/Personalization/in-app-message-actions/actions/displayIframeContent.js +140 -121
  168. package/libEs5/components/Personalization/in-app-message-actions/initInAppMessageActionsModules.js +4 -5
  169. package/libEs5/components/Personalization/in-app-message-actions/utils.js +23 -19
  170. package/libEs5/components/Personalization/index.js +112 -99
  171. package/libEs5/components/Personalization/utils/addRenderAttemptedToDecisions.js +10 -10
  172. package/libEs5/components/Personalization/utils/createAsyncArray.js +10 -9
  173. package/libEs5/components/Personalization/utils/isAuthoringModeEnabled.js +3 -3
  174. package/libEs5/components/Personalization/utils/metaUtils.js +14 -19
  175. package/libEs5/components/Personalization/utils/surfaceUtils.js +27 -46
  176. package/libEs5/components/Personalization/validateApplyPropositionsOptions.js +8 -6
  177. package/libEs5/components/Privacy/computeConsentHash.js +9 -9
  178. package/libEs5/components/Privacy/createComponent.js +32 -32
  179. package/libEs5/components/Privacy/createConsentHashStore.js +27 -24
  180. package/libEs5/components/Privacy/createConsentRequest.js +10 -8
  181. package/libEs5/components/Privacy/createConsentRequestPayload.js +9 -8
  182. package/libEs5/components/Privacy/createStoredConsent.js +11 -9
  183. package/libEs5/components/Privacy/index.js +26 -23
  184. package/libEs5/components/Privacy/injectSendSetConsentRequest.js +30 -29
  185. package/libEs5/components/Privacy/parseConsentCookie.js +6 -14
  186. package/libEs5/components/StreamingMedia/createMediaEventManager.js +59 -45
  187. package/libEs5/components/StreamingMedia/createMediaRequest.js +8 -6
  188. package/libEs5/components/StreamingMedia/createMediaResponseHandler.js +22 -17
  189. package/libEs5/components/StreamingMedia/createMediaSessionCacheManager.js +22 -18
  190. package/libEs5/components/StreamingMedia/createStreamingMediaComponent.js +30 -29
  191. package/libEs5/components/StreamingMedia/createTrackMediaEvent.js +41 -36
  192. package/libEs5/components/StreamingMedia/createTrackMediaSession.js +25 -22
  193. package/libEs5/components/StreamingMedia/index.js +33 -34
  194. package/libEs5/components/StreamingMedia/validateMediaEventOptions.js +9 -12
  195. package/libEs5/components/StreamingMedia/validateMediaSessionOptions.js +6 -4
  196. package/libEs5/constants/browser.js +7 -7
  197. package/libEs5/constants/consentPurpose.js +1 -1
  198. package/libEs5/constants/consentStatus.js +3 -3
  199. package/libEs5/constants/contentType.js +2 -2
  200. package/libEs5/constants/cookieNameKey.js +3 -3
  201. package/libEs5/constants/coreCommands.js +2 -2
  202. package/libEs5/constants/decisionProvider.js +4 -3
  203. package/libEs5/constants/domain.js +2 -2
  204. package/libEs5/constants/elementAttribute.js +1 -1
  205. package/libEs5/constants/eventType.js +5 -5
  206. package/libEs5/constants/handle.js +1 -1
  207. package/libEs5/constants/httpHeaderNames.js +2 -2
  208. package/libEs5/constants/httpStatusCode.js +5 -5
  209. package/libEs5/constants/identityMapAuthenticatedState.js +3 -3
  210. package/libEs5/constants/legacyCookies.js +3 -3
  211. package/libEs5/constants/libraryVersion.js +1 -1
  212. package/libEs5/constants/propositionEventType.js +18 -12
  213. package/libEs5/constants/propositionInteractionType.js +4 -4
  214. package/libEs5/constants/schema.js +11 -11
  215. package/libEs5/constants/sessionDataKeys.js +1 -1
  216. package/libEs5/constants/tagName.js +7 -7
  217. package/libEs5/core/buildAndValidateConfig.js +55 -69
  218. package/libEs5/core/componentCreators.js +70 -41
  219. package/libEs5/core/config/createConfig.js +4 -3
  220. package/libEs5/core/config/createCoreConfigs.js +11 -12
  221. package/libEs5/core/consent/createConsent.js +16 -14
  222. package/libEs5/core/consent/createConsentStateMachine.js +27 -35
  223. package/libEs5/core/createComponentRegistry.js +28 -27
  224. package/libEs5/core/createCookieTransfer.js +18 -18
  225. package/libEs5/core/createEvent.js +39 -44
  226. package/libEs5/core/createEventManager.js +64 -69
  227. package/libEs5/core/createInstanceFunction.js +4 -11
  228. package/libEs5/core/createLifecycle.js +14 -19
  229. package/libEs5/core/createLogController.js +30 -29
  230. package/libEs5/core/createLogger.js +28 -27
  231. package/libEs5/core/edgeNetwork/handleRequestFailure.js +6 -5
  232. package/libEs5/core/edgeNetwork/injectApplyResponse.js +29 -32
  233. package/libEs5/core/edgeNetwork/injectExtractEdgeInfo.js +19 -25
  234. package/libEs5/core/edgeNetwork/injectGetLocationHint.js +11 -11
  235. package/libEs5/core/edgeNetwork/injectProcessWarningsAndErrors.js +20 -16
  236. package/libEs5/core/edgeNetwork/injectSendEdgeNetworkRequest.js +42 -38
  237. package/libEs5/core/edgeNetwork/mergeLifecycleResponses.js +8 -12
  238. package/libEs5/core/index.js +137 -133
  239. package/libEs5/core/initializeComponents.js +17 -15
  240. package/libEs5/core/injectCreateResponse.js +47 -53
  241. package/libEs5/core/injectExecuteCommand.js +39 -40
  242. package/libEs5/core/injectHandleError.js +19 -19
  243. package/libEs5/core/injectShouldTransferCookie.js +12 -12
  244. package/libEs5/core/network/getRequestRetryDelay.js +20 -18
  245. package/libEs5/core/network/injectSendNetworkRequest.js +46 -49
  246. package/libEs5/core/network/isRequestRetryable.js +9 -8
  247. package/libEs5/core/network/requestMethods/injectSendBeaconRequest.js +10 -8
  248. package/libEs5/core/network/requestMethods/injectSendFetchRequest.js +18 -19
  249. package/libEs5/core/requiredComponentCreators.js +23 -0
  250. package/libEs5/core/validateCommandOptions.js +14 -11
  251. package/libEs5/index.js +43 -22
  252. package/libEs5/standalone.js +6 -1
  253. package/libEs5/utils/areThirdPartyCookiesSupportedByDefault.js +3 -5
  254. package/libEs5/utils/assignConcatArrayValues.js +9 -18
  255. package/libEs5/utils/clone.js +2 -3
  256. package/libEs5/utils/cookieJar.js +4 -4
  257. package/libEs5/utils/crc32.js +8 -8
  258. package/libEs5/utils/createCallbackAggregator.js +7 -11
  259. package/libEs5/utils/createCollect.js +52 -0
  260. package/libEs5/utils/createLoggingCookieJar.js +14 -16
  261. package/libEs5/utils/createMerger.js +9 -10
  262. package/libEs5/utils/createSubscription.js +48 -48
  263. package/libEs5/utils/createTaskQueue.js +8 -7
  264. package/libEs5/utils/deduplicateArray.js +7 -11
  265. package/libEs5/utils/deepAssign.js +7 -11
  266. package/libEs5/utils/defer.js +5 -4
  267. package/libEs5/utils/dom/appendNode.js +3 -2
  268. package/libEs5/utils/dom/awaitSelector.js +36 -34
  269. package/libEs5/utils/dom/createNode.js +10 -15
  270. package/libEs5/utils/dom/index.js +8 -8
  271. package/libEs5/utils/dom/isShadowSelector.js +2 -3
  272. package/libEs5/utils/dom/matchesSelector.js +3 -2
  273. package/libEs5/utils/dom/querySelectorAll.js +5 -13
  274. package/libEs5/utils/dom/removeNode.js +4 -3
  275. package/libEs5/utils/dom/selectNodes.js +3 -3
  276. package/libEs5/utils/dom/selectNodesWithShadow.js +14 -23
  277. package/libEs5/utils/event.js +49 -0
  278. package/libEs5/utils/filterObject.js +14 -12
  279. package/libEs5/utils/fireImage.js +10 -9
  280. package/libEs5/utils/flattenArray.js +4 -11
  281. package/libEs5/utils/flattenObject.js +8 -18
  282. package/libEs5/utils/getApexDomain.js +7 -6
  283. package/libEs5/utils/getBrowser.js +45 -12
  284. package/libEs5/utils/getLastArrayItems.js +2 -3
  285. package/libEs5/utils/getNamespacedCookieName.js +2 -3
  286. package/libEs5/utils/groupBy.js +6 -5
  287. package/libEs5/utils/index.js +50 -113
  288. package/libEs5/utils/injectDoesIdentityCookieExist.js +7 -7
  289. package/libEs5/utils/injectFireReferrerHideableImage.js +28 -34
  290. package/libEs5/utils/injectStorage.js +13 -15
  291. package/libEs5/utils/intersection.js +2 -6
  292. package/libEs5/utils/isBlankString.js +2 -3
  293. package/libEs5/utils/isBoolean.js +2 -3
  294. package/libEs5/utils/isEmptyObject.js +2 -3
  295. package/libEs5/utils/isFunction.js +2 -3
  296. package/libEs5/utils/isInteger.js +4 -3
  297. package/libEs5/utils/isNamespacedCookieName.js +2 -3
  298. package/libEs5/utils/isNil.js +2 -3
  299. package/libEs5/utils/isNonEmptyArray.js +2 -3
  300. package/libEs5/utils/isNonEmptyString.js +2 -3
  301. package/libEs5/utils/isNumber.js +2 -4
  302. package/libEs5/utils/isObject.js +3 -4
  303. package/libEs5/utils/isString.js +2 -3
  304. package/libEs5/utils/isUnique.js +6 -5
  305. package/libEs5/utils/isValidRegExp.js +3 -2
  306. package/libEs5/utils/memoize.js +7 -6
  307. package/libEs5/utils/noop.js +2 -1
  308. package/libEs5/utils/parseUrl.js +19 -25
  309. package/libEs5/utils/prepareConfigOverridesForEdge.js +6 -5
  310. package/libEs5/utils/request/createAddIdentity.js +4 -3
  311. package/libEs5/utils/request/createDataCollectionRequest.js +15 -11
  312. package/libEs5/utils/request/createDataCollectionRequestPayload.js +9 -10
  313. package/libEs5/utils/request/createGetAssuranceValidationTokenParams.js +17 -15
  314. package/libEs5/utils/request/createHasIdentity.js +4 -5
  315. package/libEs5/utils/request/createRequest.js +26 -23
  316. package/libEs5/utils/request/createRequestParams.js +13 -13
  317. package/libEs5/utils/request/createRequestPayload.js +13 -12
  318. package/libEs5/utils/request/index.js +8 -8
  319. package/libEs5/utils/sanitizeOrgIdForCookieName.js +2 -3
  320. package/libEs5/utils/stackError.js +8 -6
  321. package/libEs5/utils/stringToBoolean.js +3 -2
  322. package/libEs5/utils/toArray.js +3 -2
  323. package/libEs5/utils/toError.js +3 -2
  324. package/libEs5/utils/toISOStringLocal.js +29 -14
  325. package/libEs5/utils/toInteger.js +5 -5
  326. package/libEs5/utils/updateErrorMessage.js +6 -4
  327. package/libEs5/utils/validation/booleanValidator.js +3 -2
  328. package/libEs5/utils/validation/callbackValidator.js +3 -2
  329. package/libEs5/utils/validation/createAnyOfValidator.js +14 -17
  330. package/libEs5/utils/validation/createArrayOfValidator.js +16 -18
  331. package/libEs5/utils/validation/createDefaultValidator.js +7 -8
  332. package/libEs5/utils/validation/createDeprecatedValidator.js +12 -14
  333. package/libEs5/utils/validation/createLiteralValidator.js +5 -6
  334. package/libEs5/utils/validation/createMapOfValuesValidator.js +20 -22
  335. package/libEs5/utils/validation/createMaximumValidator.js +5 -6
  336. package/libEs5/utils/validation/createMinimumValidator.js +5 -6
  337. package/libEs5/utils/validation/createNoUnknownFieldsValidator.js +13 -14
  338. package/libEs5/utils/validation/createNonEmptyValidator.js +9 -10
  339. package/libEs5/utils/validation/createObjectOfValidator.js +27 -29
  340. package/libEs5/utils/validation/createRenamedValidator.js +24 -27
  341. package/libEs5/utils/validation/createUniqueItemsValidator.js +4 -3
  342. package/libEs5/utils/validation/createUniqueValidator.js +5 -4
  343. package/libEs5/utils/validation/domainValidator.js +4 -3
  344. package/libEs5/utils/validation/index.js +66 -72
  345. package/libEs5/utils/validation/integerValidator.js +3 -2
  346. package/libEs5/utils/validation/matchesRegexpValidator.js +5 -6
  347. package/libEs5/utils/validation/numberValidator.js +3 -2
  348. package/libEs5/utils/validation/regexpValidator.js +3 -2
  349. package/libEs5/utils/validation/requiredValidator.js +3 -2
  350. package/libEs5/utils/validation/stringValidator.js +3 -2
  351. package/libEs5/utils/validation/utils.js +29 -35
  352. package/libEs6/components/ActivityCollector/index.js +18 -8
  353. package/libEs6/components/Context/createComponent.js +1 -3
  354. package/libEs6/components/DecisioningEngine/createApplyResponse.js +1 -1
  355. package/libEs6/components/DecisioningEngine/createSubscribeRulesetItems.js +78 -28
  356. package/libEs6/components/DecisioningEngine/index.js +22 -2
  357. package/libEs6/components/DecisioningEngine/utils.js +2 -9
  358. package/libEs6/components/Identity/createComponent.js +4 -2
  359. package/libEs6/components/Identity/getEcidFromResponse.js +1 -3
  360. package/libEs6/components/LegacyMediaAnalytics/createGetInstance.js +2 -2
  361. package/libEs6/components/LibraryInfo/index.js +4 -5
  362. package/libEs6/components/Personalization/createActionsProvider.js +4 -2
  363. package/libEs6/components/Personalization/createComponent.js +2 -2
  364. package/libEs6/components/Personalization/createPersonalizationDetails.js +6 -6
  365. package/libEs6/components/Personalization/createViewCacheManager.js +5 -2
  366. package/libEs6/components/Personalization/dom-actions/createPreprocess.js +5 -2
  367. package/libEs6/components/Personalization/dom-actions/dom/selectNodesWithEq.js +1 -3
  368. package/libEs6/components/Personalization/dom-actions/remapCustomCodeOffers.js +6 -4
  369. package/libEs6/components/Personalization/dom-actions/remapHeadOffers.js +3 -2
  370. package/libEs6/components/Personalization/dom-actions/scripts.js +18 -2
  371. package/libEs6/components/Personalization/handlers/createDecorateProposition.js +2 -2
  372. package/libEs6/components/Personalization/in-app-message-actions/actions/displayIframeContent.js +8 -5
  373. package/libEs6/components/Personalization/in-app-message-actions/utils.js +2 -2
  374. package/libEs6/components/Personalization/index.js +2 -2
  375. package/libEs6/components/Personalization/utils/addRenderAttemptedToDecisions.js +4 -4
  376. package/libEs6/components/Personalization/utils/surfaceUtils.js +3 -3
  377. package/libEs6/constants/decisionProvider.js +1 -0
  378. package/libEs6/constants/libraryVersion.js +1 -1
  379. package/libEs6/constants/schema.js +1 -1
  380. package/libEs6/core/buildAndValidateConfig.js +8 -5
  381. package/libEs6/core/componentCreators.js +14 -43
  382. package/libEs6/core/config/createConfig.js +3 -2
  383. package/libEs6/core/createCookieTransfer.js +1 -3
  384. package/libEs6/core/createInstanceFunction.js +1 -9
  385. package/libEs6/core/createLogger.js +4 -2
  386. package/libEs6/core/edgeNetwork/injectExtractEdgeInfo.js +1 -7
  387. package/libEs6/core/index.js +11 -10
  388. package/libEs6/core/injectCreateResponse.js +1 -3
  389. package/libEs6/core/network/isRequestRetryable.js +1 -2
  390. package/libEs6/core/network/requestMethods/injectSendFetchRequest.js +1 -2
  391. package/libEs6/{utils/assignIf.js → core/requiredComponentCreators.js} +4 -8
  392. package/libEs6/index.js +26 -6
  393. package/libEs6/standalone.js +7 -1
  394. package/libEs6/utils/areThirdPartyCookiesSupportedByDefault.js +1 -2
  395. package/libEs6/utils/assignConcatArrayValues.js +1 -2
  396. package/libEs6/utils/cookieJar.js +4 -4
  397. package/libEs6/{components/Personalization → utils}/createCollect.js +3 -3
  398. package/libEs6/utils/createSubscription.js +20 -3
  399. package/libEs6/utils/dom/querySelectorAll.js +1 -10
  400. package/libEs6/utils/dom/selectNodesWithShadow.js +2 -12
  401. package/libEs6/{components/Personalization → utils}/event.js +1 -1
  402. package/libEs6/utils/index.js +1 -10
  403. package/libEs6/utils/injectStorage.js +1 -2
  404. package/libEs6/utils/intersection.js +1 -4
  405. package/libEs6/utils/isNumber.js +1 -2
  406. package/libEs6/utils/toISOStringLocal.js +14 -1
  407. package/libEs6/utils/toInteger.js +1 -2
  408. package/libEs6/utils/validation/createAnyOfValidator.js +1 -2
  409. package/libEs6/utils/validation/utils.js +3 -6
  410. package/package.json +35 -37
  411. package/rollup.config.js +115 -7
  412. package/scripts/alloyBuilder.js +89 -55
  413. package/scripts/helpers/entryPointGeneratorBabelPlugin.js +39 -0
  414. package/libEs5/components/Personalization/createCollect.js +0 -53
  415. package/libEs5/components/Personalization/event.js +0 -49
  416. package/libEs5/core/network/requestMethods/injectSendXhrRequest.js +0 -50
  417. package/libEs5/utils/assign.js +0 -16
  418. package/libEs5/utils/assignIf.js +0 -21
  419. package/libEs5/utils/endsWith.js +0 -23
  420. package/libEs5/utils/find.js +0 -30
  421. package/libEs5/utils/flatMap.js +0 -17
  422. package/libEs5/utils/includes.js +0 -23
  423. package/libEs5/utils/padStart.js +0 -27
  424. package/libEs5/utils/startsWith.js +0 -23
  425. package/libEs5/utils/values.js +0 -25
  426. package/libEs6/core/network/requestMethods/injectSendXhrRequest.js +0 -49
  427. package/libEs6/utils/assign.js +0 -14
  428. package/libEs6/utils/endsWith.js +0 -19
  429. package/libEs6/utils/find.js +0 -28
  430. package/libEs6/utils/flatMap.js +0 -14
  431. package/libEs6/utils/includes.js +0 -21
  432. package/libEs6/utils/padStart.js +0 -25
  433. package/libEs6/utils/startsWith.js +0 -19
  434. package/libEs6/utils/values.js +0 -21
  435. package/scripts/helpers/alloyComponents.js +0 -63
  436. package/scripts/helpers/conditionalBuildBabelPlugin.js +0 -57
@@ -9,12 +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
-
13
- import loadScript from "@adobe/reactor-load-script";
14
12
  import { selectNodes, createNode } from "../../../utils/dom/index.js";
15
13
  import { SCRIPT } from "../../../constants/tagName.js";
16
14
  import { SRC } from "../../../constants/elementAttribute.js";
17
15
  import { getAttribute, getNonce } from "./dom/index.js";
16
+ const getPromise = (url, script) => {
17
+ return new Promise((resolve, reject) => {
18
+ script.onload = () => {
19
+ resolve(script);
20
+ };
21
+ script.onerror = () => {
22
+ reject(new Error(`Failed to load script: ${url}`));
23
+ };
24
+ });
25
+ };
26
+ const loadScript = url => {
27
+ const script = document.createElement("script");
28
+ script.src = url;
29
+ script.async = true;
30
+ const promise = getPromise(url, script);
31
+ document.head.appendChild(script);
32
+ return promise;
33
+ };
18
34
  export const is = (element, tagName) => !!element && element.tagName === tagName;
19
35
  const isInlineScript = element => is(element, SCRIPT) && !getAttribute(element, SRC);
20
36
  const isRemoteScript = element => is(element, SCRIPT) && getAttribute(element, SRC);
@@ -10,7 +10,7 @@ OF ANY KIND, either express or implied. See the License for the specific languag
10
10
  governing permissions and limitations under the License.
11
11
  */
12
12
  import { getAttribute, setAttribute } from "../dom-actions/dom/index.js";
13
- import { includes, noop } from "../../../utils/index.js";
13
+ import { noop } from "../../../utils/index.js";
14
14
  import { DOM_ACTION_CLICK } from "../dom-actions/initDomActionsModules.js";
15
15
  import { ALWAYS, DECORATED_ELEMENTS_ONLY } from "../../../constants/propositionInteractionType.js";
16
16
  export const INTERACT_ID_DATA_ATTRIBUTE = "data-aep-interact-id";
@@ -32,7 +32,7 @@ const interactionTrackingSupported = (autoCollectPropositionInteractions, decisi
32
32
  if (!autoCollectPropositionInteractions[decisionProvider]) {
33
33
  return false;
34
34
  }
35
- return includes([ALWAYS, DECORATED_ELEMENTS_ONLY], autoCollectPropositionInteractions[decisionProvider]);
35
+ return [ALWAYS, DECORATED_ELEMENTS_ONLY].includes(autoCollectPropositionInteractions[decisionProvider]);
36
36
  };
37
37
  const createDecorateProposition = (autoCollectPropositionInteractions, type, propositionId, itemId, trackingLabel, scopeType, notification, storeInteractionMeta) => {
38
38
  const {
@@ -13,7 +13,7 @@ governing permissions and limitations under the License.
13
13
  import { getNonce } from "../../dom-actions/dom/index.js";
14
14
  import { parseAnchor, removeElementById } from "../utils.js";
15
15
  import { TEXT_HTML } from "../../../../constants/contentType.js";
16
- import { assign, includes, isNonEmptyString, values } from "../../../../utils/index.js";
16
+ import { isNonEmptyString } from "../../../../utils/index.js";
17
17
  import { createNode } from "../../../../utils/dom/index.js";
18
18
  import { objectOf } from "../../../../utils/validation/index.js";
19
19
  import { PropositionEventType } from "../../../../constants/propositionEventType.js";
@@ -94,7 +94,10 @@ const renderMessage = (iframe, webParameters, container, overlay) => {
94
94
  style = {},
95
95
  params = {}
96
96
  } = webParameters[id];
97
- assign(element.style, style);
97
+ element.style = {
98
+ ...element.style,
99
+ ...style
100
+ };
98
101
  const {
99
102
  parentElement = "body",
100
103
  insertionMethod = "appendChild",
@@ -178,13 +181,13 @@ const isValidWebParameters = webParameters => {
178
181
  return false;
179
182
  }
180
183
  const ids = Object.keys(webParameters);
181
- if (!includes(ids, MESSAGING_CONTAINER_ID)) {
184
+ if (!ids.includes(MESSAGING_CONTAINER_ID)) {
182
185
  return false;
183
186
  }
184
- if (!includes(ids, OVERLAY_CONTAINER_ID)) {
187
+ if (!ids.includes(OVERLAY_CONTAINER_ID)) {
185
188
  return false;
186
189
  }
187
- const valuesArray = values(webParameters);
190
+ const valuesArray = Object.values(webParameters);
188
191
  for (let i = 0; i < valuesArray.length; i += 1) {
189
192
  if (!objectOf(valuesArray[i], "style")) {
190
193
  return false;
@@ -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
- import { isNonEmptyArray, queryString, startsWith } from "../../../utils/index.js";
12
+ import { isNonEmptyArray, queryString } from "../../../utils/index.js";
13
13
  import { removeNode, selectNodes } from "../../../utils/dom/index.js";
14
14
  export const removeElementById = id => {
15
15
  const element = selectNodes(`#${id}`, document);
@@ -25,7 +25,7 @@ export const parseAnchor = anchor => {
25
25
  const {
26
26
  href
27
27
  } = anchor;
28
- if (!href || !startsWith(href, "adbinapp://")) {
28
+ if (!href || !href.startsWith("adbinapp://")) {
29
29
  return nothing;
30
30
  }
31
31
  const hrefParts = href.split("?");
@@ -13,12 +13,12 @@ governing permissions and limitations under the License.
13
13
  import { anyOf, boolean, literal, objectOf, string } from "../../utils/validation/index.js";
14
14
  import createComponent from "./createComponent.js";
15
15
  import { initDomActionsModules } from "./dom-actions/index.js";
16
- import createCollect from "./createCollect.js";
16
+ import createCollect from "../../utils/createCollect.js";
17
17
  import { hideContainers, showContainers } from "./flicker/index.js";
18
18
  import createFetchDataHandler from "./createFetchDataHandler.js";
19
19
  import collectClicks from "./dom-actions/clicks/collectClicks.js";
20
20
  import isAuthoringModeEnabled from "./utils/isAuthoringModeEnabled.js";
21
- import { mergeDecisionsMeta, mergeQuery } from "./event.js";
21
+ import { mergeDecisionsMeta, mergeQuery } from "../../utils/event.js";
22
22
  import createOnClickHandler from "./createOnClickHandler.js";
23
23
  import createViewCacheManager from "./createViewCacheManager.js";
24
24
  import createViewChangeHandler from "./createViewChangeHandler.js";
@@ -10,12 +10,12 @@ 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 { assign } from "../../../utils/index.js";
14
13
  export default (({
15
14
  decisions,
16
15
  renderAttempted
17
16
  }) => {
18
- return decisions.map(decision => assign({
19
- renderAttempted
20
- }, decision));
17
+ return decisions.map(decision => ({
18
+ renderAttempted,
19
+ ...decision
20
+ }));
21
21
  });
@@ -11,7 +11,7 @@ governing permissions and limitations under the License.
11
11
  */
12
12
 
13
13
  import { WEB, WEBAPP, SURFACE_TYPE_DELIMITER, FRAGMENT_DELIMITER } from "../constants/surface.js";
14
- import { startsWith, isNil, isNonEmptyString, includes } from "../../../utils/index.js";
14
+ import { isNil, isNonEmptyString } from "../../../utils/index.js";
15
15
  const SURFACE_REGEX = /^(\w+):\/\/([^/#]+)(\/[^#]*)?(#.*)?$/;
16
16
  const AUTHORITY_REGEX = /^(?:.*@)?(?:[a-z\d\u00a1-\uffff.-]+|\[[a-f\d:]+])(?::\d+)?$/;
17
17
  const PATH_REGEX = /^\/(?:[/\w\u00a1-\uffff-.~]|%[a-fA-F\d]{2})*$/;
@@ -42,7 +42,7 @@ export const buildPageSurface = getPageLocation => {
42
42
  const path = location.pathname;
43
43
  return WEB + SURFACE_TYPE_DELIMITER + host + normalizePath(path);
44
44
  };
45
- const expandFragmentSurface = (surface, getPageLocation) => startsWith(surface, FRAGMENT_DELIMITER) ? buildPageSurface(getPageLocation) + surface : surface;
45
+ const expandFragmentSurface = (surface, getPageLocation) => surface.startsWith(FRAGMENT_DELIMITER) ? buildPageSurface(getPageLocation) + surface : surface;
46
46
  const validateSurface = (surface, getPageLocation, logger) => {
47
47
  const invalidateSurface = validationError => {
48
48
  logger.warn(validationError);
@@ -56,7 +56,7 @@ const validateSurface = (surface, getPageLocation, logger) => {
56
56
  if (parsed === null) {
57
57
  return invalidateSurface(`Invalid surface: ${surface}`);
58
58
  }
59
- if (!includes([WEB, WEBAPP], parsed.surfaceType)) {
59
+ if (![WEB, WEBAPP].includes(parsed.surfaceType)) {
60
60
  return invalidateSurface(`Unsupported surface type ${parsed.surfaceType} in surface: ${surface}`);
61
61
  }
62
62
  if (!parsed.authority || !AUTHORITY_REGEX.test(parsed.authority)) {
@@ -9,5 +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
+ export const PERSONALIZATION_DECISIONS_HANDLE = "personalization:decisions";
12
13
  export const ADOBE_JOURNEY_OPTIMIZER = "AJO";
13
14
  export const ADOBE_TARGET = "TGT";
@@ -13,4 +13,4 @@ governing permissions and limitations under the License.
13
13
  // The __VERSION__ keyword will be replace at alloy build time with the package.json version.
14
14
  // see babel-plugin-version
15
15
 
16
- export default "2.21.1";
16
+ export default "2.22.0-alpha.0";
@@ -17,6 +17,6 @@ export const JSON_CONTENT_ITEM = "https://ns.adobe.com/personalization/json-cont
17
17
  export const RULESET_ITEM = "https://ns.adobe.com/personalization/ruleset-item";
18
18
  export const REDIRECT_ITEM = "https://ns.adobe.com/personalization/redirect-item";
19
19
  export const MESSAGE_IN_APP = "https://ns.adobe.com/personalization/message/in-app";
20
- export const MESSAGE_FEED_ITEM = "https://ns.adobe.com/personalization/message/feed-item";
20
+ export const MESSAGE_CONTENT_CARD = "https://ns.adobe.com/personalization/message/content-card";
21
21
  export const MESSAGE_NATIVE_ALERT = "https://ns.adobe.com/personalization/message/native-alert";
22
22
  export const MEASUREMENT_SCHEMA = "https://ns.adobe.com/personalization/measurement";
@@ -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
- import { assign } from "../utils/index.js";
12
+
13
13
  const CONFIG_DOC_URI = "https://adobe.ly/3sHh553";
14
14
  const transformOptions = ({
15
15
  combinedConfigValidator,
@@ -30,10 +30,13 @@ const buildAllOnInstanceConfiguredExtraParams = (config, logger, componentCreato
30
30
  buildOnInstanceConfiguredExtraParams
31
31
  }) => {
32
32
  if (buildOnInstanceConfiguredExtraParams) {
33
- assign(memo, buildOnInstanceConfiguredExtraParams({
34
- config,
35
- logger
36
- }));
33
+ memo = {
34
+ ...memo,
35
+ ...buildOnInstanceConfiguredExtraParams({
36
+ config,
37
+ logger
38
+ })
39
+ };
37
40
  }
38
41
  return memo;
39
42
  }, {});
@@ -10,46 +10,17 @@ 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 the only place where core is allowed to import from components.
14
- // This makes sure that each component could be removed without breaking the library
15
-
16
- /* eslint-disable import/no-restricted-paths */
17
-
18
- import createDataCollector from "../components/DataCollector/index.js";
19
-
20
- /* @skipwhen ENV.alloy_activitycollector === false */
21
- import createActivityCollector from "../components/ActivityCollector/index.js";
22
- import createIdentity from "../components/Identity/index.js";
23
-
24
- /* @skipwhen ENV.alloy_audiences === false */
25
- import createAudiences from "../components/Audiences/index.js";
26
-
27
- /* @skipwhen ENV.alloy_personalization === false */
28
- import createPersonalization from "../components/Personalization/index.js";
29
-
30
- /* @skipwhen ENV.alloy_context === false */
31
- import createContext from "../components/Context/index.js";
32
-
33
- /* @skipwhen ENV.alloy_privacy === false */
34
- import createPrivacy from "../components/Privacy/index.js";
35
-
36
- /* @skipwhen ENV.alloy_eventmerge === false */
37
- import createEventMerge from "../components/EventMerge/index.js";
38
- import createLibraryInfo from "../components/LibraryInfo/index.js";
39
-
40
- /* @skipwhen ENV.alloy_decisioningengine === false */
41
- import createDecisioningEngine from "../components/DecisioningEngine/index.js";
42
-
43
- /* @skipwhen ENV.alloy_machinelearning === false */
44
- import createMachineLearning from "../components/MachineLearning/index.js";
45
-
46
- /* @skipwhen ENV.alloy_streamingmedia === false */
47
- import createStreamingMedia from "../components/StreamingMedia/index.js";
48
-
49
- /* @skipwhen ENV.alloy_legacymediaanalytics === false */
50
- import createLegacyMediaAnalytics from "../components/LegacyMediaAnalytics/index.js";
51
-
52
- // TODO: Register the Components here statically for now. They might be registered differently.
53
- // TODO: Figure out how sub-components will be made available/registered
54
-
55
- export default [createDataCollector, createActivityCollector, createIdentity, createAudiences, createPersonalization, createContext, createPrivacy, createEventMerge, createLibraryInfo, createMachineLearning, createDecisioningEngine, createLegacyMediaAnalytics, createStreamingMedia];
13
+ // This file contains the optional components that can be included in an alloy build.
14
+ // The exports names must have the camel case format. If you need to add a required
15
+ // module, you should add it to the core/requiredComponentCreators.js file.
16
+
17
+ export { default as activityCollector } from "../components/ActivityCollector/index.js";
18
+ export { default as audiences } from "../components/Audiences/index.js";
19
+ export { default as context } from "../components/Context/index.js";
20
+ export { default as decisioningEngine } from "../components/DecisioningEngine/index.js";
21
+ export { default as eventMerge } from "../components/EventMerge/index.js";
22
+ export { default as legacyMediaAnalytics } from "../components/LegacyMediaAnalytics/index.js";
23
+ export { default as machineLearning } from "../components/MachineLearning/index.js";
24
+ export { default as personalization } from "../components/Personalization/index.js";
25
+ export { default as privacy } from "../components/Privacy/index.js";
26
+ export { default as streamingMedia } from "../components/StreamingMedia/index.js";
@@ -10,8 +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
 
13
- import { assign } from "../../utils/index.js";
14
13
  const createConfig = options => {
15
- return assign({}, options);
14
+ return {
15
+ ...options
16
+ };
16
17
  };
17
18
  export default createConfig;
@@ -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 { endsWith } from "../utils/index.js";
14
12
  const STATE_STORE_HANDLE_TYPE = "state:store";
15
13
  export default (({
16
14
  cookieJar,
@@ -25,7 +23,7 @@ export default (({
25
23
  * the request body so they can be read by the server.
26
24
  */
27
25
  cookiesToPayload(payload, endpointDomain) {
28
- const isEndpointFirstParty = endsWith(endpointDomain, apexDomain);
26
+ const isEndpointFirstParty = endpointDomain.endsWith(apexDomain);
29
27
  const state = {
30
28
  domain: apexDomain,
31
29
  cookiesEnabled: true
@@ -11,15 +11,7 @@ governing permissions and limitations under the License.
11
11
  */
12
12
 
13
13
  export default (executeCommand => {
14
- return args => {
15
- // Would use destructuring, but destructuring doesn't work on IE
16
- // without polyfilling Symbol.
17
- // https://github.com/babel/babel/issues/7597
18
- const resolve = args[0];
19
- const reject = args[1];
20
- const userProvidedArgs = args[2];
21
- const commandName = userProvidedArgs[0];
22
- const options = userProvidedArgs[1];
14
+ return ([resolve, reject, [commandName, options]]) => {
23
15
  executeCommand(commandName, options).then(resolve, reject);
24
16
  };
25
17
  });
@@ -10,7 +10,6 @@ OF ANY KIND, either express or implied. See the License for the specific languag
10
10
  governing permissions and limitations under the License.
11
11
  */
12
12
 
13
- import { assign } from "../utils/index.js";
14
13
  export default (({
15
14
  getDebugEnabled,
16
15
  console,
@@ -24,7 +23,10 @@ export default (({
24
23
  const notifyMonitors = (method, data) => {
25
24
  const monitors = getMonitors();
26
25
  if (monitors.length > 0) {
27
- const dataWithContext = assign({}, context, data);
26
+ const dataWithContext = {
27
+ ...context,
28
+ ...data
29
+ };
28
30
  monitors.forEach(monitor => {
29
31
  if (monitor[method]) {
30
32
  monitor[method](dataWithContext);
@@ -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
- // eslint recommends using Number.isNaN instead, but this function is
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
  };
@@ -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 = isFunction(fetch) ? injectSendFetchRequest({
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 flatMap(handle.filter(fragment => fragment.type === type), fragment => fragment.payload);
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(RETRYABLE_STATUS_CODES, response.statusCode);
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 but also because it prevents
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 2019 Adobe. All rights reserved.
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
- import assign from "./assign.js";
14
- export default ((target, source, predicate) => {
15
- if (predicate()) {
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 createInstance = (options = {}) => {
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 };
@@ -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(browsersSupportingThirdPartyCookie, browser));
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 "../../constants/eventType.js";
13
- import { getPropositionEventType } from "../../constants/propositionEventType.js";
14
- import { isNonEmptyArray } from "../../utils/index.js";
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