@adobe/alloy 2.32.1-beta.0 → 2.33.0-beta.2

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 (341) hide show
  1. package/components.json +9 -0
  2. package/dist/alloy.js +13696 -12143
  3. package/dist/alloy.min.js +1 -1
  4. package/dist/alloyServiceWorker.js +8 -20
  5. package/dist/alloyServiceWorker.min.js +1 -1
  6. package/dist/types/browser/src/allOptionalComponents.d.ts +2 -0
  7. package/dist/types/{core → browser}/src/components/Advertising/constants/index.d.ts +3 -0
  8. package/dist/types/{core → browser}/src/components/Advertising/handlers/createOnBeforeSendEventHandler.d.ts +4 -1
  9. package/dist/types/{core → browser}/src/components/Advertising/handlers/sendAdConversion.d.ts +3 -1
  10. package/dist/types/{core → browser}/src/components/Advertising/handlers/viewThroughHandler.d.ts +3 -1
  11. package/dist/types/{core → browser}/src/components/Advertising/identities/collectAllIdentities.d.ts +1 -1
  12. package/dist/types/browser/src/components/Advertising/identities/collectSurferId.d.ts +15 -0
  13. package/dist/types/browser/src/components/Advertising/identities/createHashedIpHandler.d.ts +9 -0
  14. package/dist/types/browser/src/components/Advertising/identities/initiateAdvertisingIdentityCall.d.ts +5 -0
  15. package/dist/types/{core → browser}/src/components/Advertising/utils/helpers.d.ts +14 -0
  16. package/dist/types/browser/src/components/Advertising/utils/murmurHash128GuavaHex.d.ts +2 -0
  17. package/dist/types/browser/src/components/Personalization/constants/surface.d.ts +4 -0
  18. package/dist/types/browser/src/components/Personalization/dom-actions/dom/isDomElement.d.ts +2 -0
  19. package/dist/types/browser/src/components/Personalization/utils/addRenderAttemptedToDecisions.d.ts +5 -0
  20. package/dist/types/browser/src/components/Personalization/utils/surfaceUtils.d.ts +3 -0
  21. package/dist/types/{core → browser}/src/components/PushNotifications/helpers/saveToIndexedDb.d.ts +1 -1
  22. package/dist/types/{core → browser}/src/components/PushNotifications/index.d.ts +6 -6
  23. package/dist/types/{core → browser}/src/components/PushNotifications/request/createSendPushSubscriptionPayload.d.ts +2 -2
  24. package/dist/types/browser/src/components/PushNotifications/request/createSendPushSubscriptionRequest.d.ts +6 -0
  25. package/dist/types/{core → browser}/src/components/PushNotifications/request/makeSendPushSubscriptionRequest.d.ts +6 -6
  26. package/dist/types/{core → browser}/src/components/PushNotifications/types.d.ts +1 -1
  27. package/dist/types/browser/src/components/componentCreators.d.ts +4 -0
  28. package/dist/types/browser/src/components/requiredComponentCreators.d.ts +1 -0
  29. package/dist/types/browser/src/index.d.ts +4 -2
  30. package/dist/types/browser/src/initializeStandalone.d.ts +4 -0
  31. package/dist/types/core/src/components/Identity/injectAddQueryStringIdentityToPayload.d.ts +2 -1
  32. package/dist/types/core/src/components/MediaAnalyticsBridge/createGetInstance.d.ts +1 -1
  33. package/dist/types/core/src/components/MediaAnalyticsBridge/createMediaHelper.d.ts +7 -56
  34. package/dist/types/core/src/core/componentCreators.d.ts +0 -4
  35. package/dist/types/core/src/core/requiredComponentCreators.d.ts +0 -1
  36. package/dist/types/core/src/types.d.ts +0 -4
  37. package/dist/utils/createEventMergeId.js +38 -30
  38. package/dist/utils/deepAssign.js +10 -4
  39. package/package.json +9 -13
  40. package/rollup.config.js +9 -15
  41. package/scripts/alloyBuilder.js +34 -42
  42. package/scripts/helpers/componentMetadata.js +25 -0
  43. package/scripts/helpers/generateEntryPoint.js +29 -0
  44. package/src/allOptionalComponents.js +14 -0
  45. package/src/components/ActivityCollector/attachClickActivityCollector.js +55 -0
  46. package/src/components/ActivityCollector/configValidators.js +52 -0
  47. package/src/components/ActivityCollector/createClickActivityStorage.js +33 -0
  48. package/src/components/ActivityCollector/createClickedElementProperties.js +224 -0
  49. package/src/components/ActivityCollector/createGetClickedElementProperties.js +68 -0
  50. package/src/components/ActivityCollector/createInjectClickedElementProperties.js +80 -0
  51. package/src/components/ActivityCollector/createRecallAndInjectClickedElementProperties.js +45 -0
  52. package/src/components/ActivityCollector/createStorePageViewProperties.js +20 -0
  53. package/src/components/ActivityCollector/getLinkName.js +145 -0
  54. package/src/components/ActivityCollector/getLinkRegion.js +65 -0
  55. package/src/components/ActivityCollector/index.js +132 -0
  56. package/src/components/ActivityCollector/utils/activityMapExtensionEnabled.js +16 -0
  57. package/src/components/ActivityCollector/utils/createTransientStorage.js +26 -0
  58. package/src/components/ActivityCollector/utils/determineLinkType.js +27 -0
  59. package/src/components/ActivityCollector/utils/dom/elementHasClickHandler.js +15 -0
  60. package/src/components/ActivityCollector/utils/dom/extractDomain.js +20 -0
  61. package/src/components/ActivityCollector/utils/dom/findClickableElement.js +36 -0
  62. package/src/components/ActivityCollector/utils/dom/getAbsoluteUrlFromAnchorElement.js +25 -0
  63. package/src/components/ActivityCollector/utils/dom/isButtonSubmitElement.js +15 -0
  64. package/src/components/ActivityCollector/utils/dom/isDownloadLink.js +27 -0
  65. package/src/components/ActivityCollector/utils/dom/isExitLink.js +24 -0
  66. package/src/components/ActivityCollector/utils/dom/isInputSubmitElement.js +26 -0
  67. package/src/components/ActivityCollector/utils/dom/isSupportedAnchorElement.js +24 -0
  68. package/src/components/ActivityCollector/utils/dom/isSupportedTextNode.js +27 -0
  69. package/src/components/ActivityCollector/utils/hasPageName.js +23 -0
  70. package/src/components/ActivityCollector/utils/isDifferentDomains.js +19 -0
  71. package/src/components/ActivityCollector/utils/trimQueryFromUrl.js +31 -0
  72. package/src/components/ActivityCollector/utils/truncateWhiteSpace.js +22 -0
  73. package/src/components/ActivityCollector/validateClickCollectionConfig.js +47 -0
  74. package/src/components/Advertising/configValidators.js +32 -0
  75. package/src/components/Advertising/constants/index.js +80 -0
  76. package/src/components/Advertising/createComponent.js +24 -0
  77. package/src/components/Advertising/handlers/clickThroughHandler.js +94 -0
  78. package/src/components/Advertising/handlers/createAdConversionHandler.js +50 -0
  79. package/src/components/Advertising/handlers/createOnBeforeSendEventHandler.js +177 -0
  80. package/src/components/Advertising/handlers/sendAdConversion.js +74 -0
  81. package/src/components/Advertising/handlers/viewThroughHandler.js +107 -0
  82. package/src/components/Advertising/identities/collectAllIdentities.js +57 -0
  83. package/src/components/Advertising/identities/collectID5Id.js +133 -0
  84. package/src/components/Advertising/identities/collectRampId.js +265 -0
  85. package/src/components/Advertising/identities/collectSurferId.js +72 -0
  86. package/src/components/Advertising/identities/createHashedIpHandler.js +36 -0
  87. package/src/components/Advertising/identities/initiateAdvertisingIdentityCall.js +153 -0
  88. package/src/components/Advertising/index.js +109 -0
  89. package/src/components/Advertising/utils/advertisingCookieManager.js +92 -0
  90. package/src/components/Advertising/utils/helpers.js +190 -0
  91. package/src/components/Advertising/utils/murmurHash128GuavaHex.js +195 -0
  92. package/src/components/Context/createComponent.js +35 -0
  93. package/src/components/Context/implementationDetails.js +23 -0
  94. package/src/components/Context/index.js +56 -0
  95. package/src/components/Context/injectDevice.js +77 -0
  96. package/src/components/Context/injectEnvironment.js +38 -0
  97. package/src/components/Context/injectHighEntropyUserAgentHints.js +55 -0
  98. package/src/components/Context/injectOneTimeAnalyticsReferrer.js +61 -0
  99. package/src/components/Context/injectPlaceContext.js +38 -0
  100. package/src/components/Context/injectWeb.js +26 -0
  101. package/src/components/Personalization/constants/loggerMessage.js +14 -0
  102. package/src/components/Personalization/constants/scopeType.js +15 -0
  103. package/src/components/Personalization/constants/surface.js +16 -0
  104. package/src/components/Personalization/createApplyPropositions.js +136 -0
  105. package/src/components/Personalization/createClickStorage.js +56 -0
  106. package/src/components/Personalization/createComponent.js +133 -0
  107. package/src/components/Personalization/createFetchDataHandler.js +149 -0
  108. package/src/components/Personalization/createGetPageLocation.js +16 -0
  109. package/src/components/Personalization/createHandleConsentFlicker.js +22 -0
  110. package/src/components/Personalization/createInteractionStorage.js +104 -0
  111. package/src/components/Personalization/createNotificationHandler.js +49 -0
  112. package/src/components/Personalization/createOnClickHandler.js +102 -0
  113. package/src/components/Personalization/createOnDecisionHandler.js +98 -0
  114. package/src/components/Personalization/createPersonalizationDetails.js +138 -0
  115. package/src/components/Personalization/createSetTargetMigration.js +22 -0
  116. package/src/components/Personalization/createViewCacheManager.js +101 -0
  117. package/src/components/Personalization/createViewChangeHandler.js +53 -0
  118. package/src/components/Personalization/dom-actions/action.js +97 -0
  119. package/src/components/Personalization/dom-actions/addNonceToInlineStyleElements.js +37 -0
  120. package/src/components/Personalization/dom-actions/appendHtml.js +42 -0
  121. package/src/components/Personalization/dom-actions/clicks/collectClicks.js +89 -0
  122. package/src/components/Personalization/dom-actions/clicks/collectInteractions.js +113 -0
  123. package/src/components/Personalization/dom-actions/collectInteractions.js +15 -0
  124. package/src/components/Personalization/dom-actions/createPreprocess.js +21 -0
  125. package/src/components/Personalization/dom-actions/createRedirect.js +23 -0
  126. package/src/components/Personalization/dom-actions/dom/createFragment.js +18 -0
  127. package/src/components/Personalization/dom-actions/dom/getAttribute.js +15 -0
  128. package/src/components/Personalization/dom-actions/dom/getChildNodes.js +23 -0
  129. package/src/components/Personalization/dom-actions/dom/getChildren.js +23 -0
  130. package/src/components/Personalization/dom-actions/dom/getElementById.js +21 -0
  131. package/src/components/Personalization/dom-actions/dom/getFirstChild.js +15 -0
  132. package/src/components/Personalization/dom-actions/dom/getNextSibling.js +15 -0
  133. package/src/components/Personalization/dom-actions/dom/getNonce.js +33 -0
  134. package/src/components/Personalization/dom-actions/dom/getParent.js +15 -0
  135. package/src/components/Personalization/dom-actions/dom/helperForEq.js +22 -0
  136. package/src/components/Personalization/dom-actions/dom/index.js +26 -0
  137. package/src/components/Personalization/dom-actions/dom/insertAfter.js +26 -0
  138. package/src/components/Personalization/dom-actions/dom/insertBefore.js +25 -0
  139. package/src/components/Personalization/dom-actions/dom/isDomElement.js +13 -0
  140. package/src/components/Personalization/dom-actions/dom/matchesSelectorWithEq.js +37 -0
  141. package/src/components/Personalization/dom-actions/dom/removeAttribute.js +15 -0
  142. package/src/components/Personalization/dom-actions/dom/selectNodesWithEq.js +101 -0
  143. package/src/components/Personalization/dom-actions/dom/setAttribute.js +15 -0
  144. package/src/components/Personalization/dom-actions/dom/setStyle.js +23 -0
  145. package/src/components/Personalization/dom-actions/dom/util.js +17 -0
  146. package/src/components/Personalization/dom-actions/images.js +34 -0
  147. package/src/components/Personalization/dom-actions/index.js +13 -0
  148. package/src/components/Personalization/dom-actions/initDomActionsModules.js +67 -0
  149. package/src/components/Personalization/dom-actions/insertHtmlAfter.js +43 -0
  150. package/src/components/Personalization/dom-actions/insertHtmlBefore.js +40 -0
  151. package/src/components/Personalization/dom-actions/move.js +28 -0
  152. package/src/components/Personalization/dom-actions/prependHtml.js +60 -0
  153. package/src/components/Personalization/dom-actions/rearrangeChildren.js +34 -0
  154. package/src/components/Personalization/dom-actions/remapCustomCodeOffers.js +33 -0
  155. package/src/components/Personalization/dom-actions/remapHeadOffers.js +63 -0
  156. package/src/components/Personalization/dom-actions/replaceHtml.js +20 -0
  157. package/src/components/Personalization/dom-actions/resize.js +28 -0
  158. package/src/components/Personalization/dom-actions/scripts.js +106 -0
  159. package/src/components/Personalization/dom-actions/setAttributes.js +21 -0
  160. package/src/components/Personalization/dom-actions/setHtml.js +27 -0
  161. package/src/components/Personalization/dom-actions/setStyles.js +23 -0
  162. package/src/components/Personalization/dom-actions/setText.js +16 -0
  163. package/src/components/Personalization/dom-actions/swapImage.js +32 -0
  164. package/src/components/Personalization/flicker/index.js +106 -0
  165. package/src/components/Personalization/handlers/createDecorateProposition.js +100 -0
  166. package/src/components/Personalization/handlers/createProcessDomAction.js +79 -0
  167. package/src/components/Personalization/handlers/createProcessHtmlContent.js +60 -0
  168. package/src/components/Personalization/handlers/createProcessInAppMessage.js +91 -0
  169. package/src/components/Personalization/handlers/createProcessPropositions.js +228 -0
  170. package/src/components/Personalization/handlers/createProcessRedirect.js +54 -0
  171. package/src/components/Personalization/handlers/createRenderStatusHandler.js +62 -0
  172. package/src/components/Personalization/handlers/injectCreateProposition.js +121 -0
  173. package/src/components/Personalization/handlers/processDefaultContent.js +20 -0
  174. package/src/components/Personalization/in-app-message-actions/actions/displayIframeContent.js +309 -0
  175. package/src/components/Personalization/in-app-message-actions/initInAppMessageActionsModules.js +18 -0
  176. package/src/components/Personalization/in-app-message-actions/utils.js +55 -0
  177. package/src/components/Personalization/index.js +223 -0
  178. package/src/components/Personalization/utils/addRenderAttemptedToDecisions.js +15 -0
  179. package/src/components/Personalization/utils/createAsyncArray.js +37 -0
  180. package/src/components/Personalization/utils/isAuthoringModeEnabled.js +15 -0
  181. package/src/components/Personalization/utils/metaUtils.js +27 -0
  182. package/src/components/Personalization/utils/surfaceUtils.js +120 -0
  183. package/src/components/Personalization/validateApplyPropositionsOptions.js +56 -0
  184. package/src/components/PushNotifications/helpers/constants.js +16 -0
  185. package/src/components/PushNotifications/helpers/getPushSubscriptionDetails.js +122 -0
  186. package/src/components/PushNotifications/helpers/readFromIndexedDb.js +50 -0
  187. package/src/components/PushNotifications/helpers/saveToIndexedDb.js +64 -0
  188. package/src/components/PushNotifications/helpers/serviceWorkerNotificationClickListener.js +84 -0
  189. package/src/components/PushNotifications/helpers/serviceWorkerPushListener.js +72 -0
  190. package/src/components/PushNotifications/index.js +128 -0
  191. package/src/components/PushNotifications/request/createSendPushSubscriptionPayload.js +66 -0
  192. package/src/components/PushNotifications/request/createSendPushSubscriptionRequest.js +35 -0
  193. package/src/components/PushNotifications/request/makeSendPushSubscriptionRequest.js +98 -0
  194. package/src/components/PushNotifications/request/makeSendServiceWorkerTrackingData.js +154 -0
  195. package/src/components/PushNotifications/types.js +104 -0
  196. package/src/components/componentCreators.js +16 -0
  197. package/src/components/requiredComponentCreators.js +13 -0
  198. package/src/createEventListeners.js +81 -0
  199. package/src/index.js +14 -2
  200. package/src/initializeStandalone.js +34 -0
  201. package/src/serviceWorker.js +2 -2
  202. package/src/standalone.js +3 -26
  203. package/.browserslistrc +0 -2
  204. package/babel.config.js +0 -76
  205. package/dist/types/core/src/components/Advertising/identities/collectSurferId.d.ts +0 -2
  206. package/dist/types/core/src/components/PushNotifications/request/createSendPushSubscriptionRequest.d.ts +0 -6
  207. package/dist/types/core/src/constants/sessionDataKeys.d.ts +0 -1
  208. package/scripts/helpers/entryPointGeneratorBabelPlugin.js +0 -101
  209. /package/dist/types/{core → browser}/src/components/ActivityCollector/attachClickActivityCollector.d.ts +0 -0
  210. /package/dist/types/{core → browser}/src/components/ActivityCollector/configValidators.d.ts +0 -0
  211. /package/dist/types/{core → browser}/src/components/ActivityCollector/createClickActivityStorage.d.ts +0 -0
  212. /package/dist/types/{core → browser}/src/components/ActivityCollector/createClickedElementProperties.d.ts +0 -0
  213. /package/dist/types/{core → browser}/src/components/ActivityCollector/createGetClickedElementProperties.d.ts +0 -0
  214. /package/dist/types/{core → browser}/src/components/ActivityCollector/createInjectClickedElementProperties.d.ts +0 -0
  215. /package/dist/types/{core → browser}/src/components/ActivityCollector/createRecallAndInjectClickedElementProperties.d.ts +0 -0
  216. /package/dist/types/{core → browser}/src/components/ActivityCollector/createStorePageViewProperties.d.ts +0 -0
  217. /package/dist/types/{core → browser}/src/components/ActivityCollector/getLinkName.d.ts +0 -0
  218. /package/dist/types/{core → browser}/src/components/ActivityCollector/getLinkRegion.d.ts +0 -0
  219. /package/dist/types/{core → browser}/src/components/ActivityCollector/index.d.ts +0 -0
  220. /package/dist/types/{core → browser}/src/components/ActivityCollector/utils/activityMapExtensionEnabled.d.ts +0 -0
  221. /package/dist/types/{core → browser}/src/components/ActivityCollector/utils/createTransientStorage.d.ts +0 -0
  222. /package/dist/types/{core → browser}/src/components/ActivityCollector/utils/determineLinkType.d.ts +0 -0
  223. /package/dist/types/{core → browser}/src/components/ActivityCollector/utils/dom/elementHasClickHandler.d.ts +0 -0
  224. /package/dist/types/{core → browser}/src/components/ActivityCollector/utils/dom/extractDomain.d.ts +0 -0
  225. /package/dist/types/{core → browser}/src/components/ActivityCollector/utils/dom/findClickableElement.d.ts +0 -0
  226. /package/dist/types/{core → browser}/src/components/ActivityCollector/utils/dom/getAbsoluteUrlFromAnchorElement.d.ts +0 -0
  227. /package/dist/types/{core → browser}/src/components/ActivityCollector/utils/dom/isButtonSubmitElement.d.ts +0 -0
  228. /package/dist/types/{core → browser}/src/components/ActivityCollector/utils/dom/isDownloadLink.d.ts +0 -0
  229. /package/dist/types/{core → browser}/src/components/ActivityCollector/utils/dom/isExitLink.d.ts +0 -0
  230. /package/dist/types/{core → browser}/src/components/ActivityCollector/utils/dom/isInputSubmitElement.d.ts +0 -0
  231. /package/dist/types/{core → browser}/src/components/ActivityCollector/utils/dom/isSupportedAnchorElement.d.ts +0 -0
  232. /package/dist/types/{core → browser}/src/components/ActivityCollector/utils/dom/isSupportedTextNode.d.ts +0 -0
  233. /package/dist/types/{core → browser}/src/components/ActivityCollector/utils/hasPageName.d.ts +0 -0
  234. /package/dist/types/{core → browser}/src/components/ActivityCollector/utils/isDifferentDomains.d.ts +0 -0
  235. /package/dist/types/{core → browser}/src/components/ActivityCollector/utils/trimQueryFromUrl.d.ts +0 -0
  236. /package/dist/types/{core → browser}/src/components/ActivityCollector/utils/truncateWhiteSpace.d.ts +0 -0
  237. /package/dist/types/{core → browser}/src/components/ActivityCollector/validateClickCollectionConfig.d.ts +0 -0
  238. /package/dist/types/{core → browser}/src/components/Advertising/configValidators.d.ts +0 -0
  239. /package/dist/types/{core → browser}/src/components/Advertising/createComponent.d.ts +0 -0
  240. /package/dist/types/{core → browser}/src/components/Advertising/handlers/clickThroughHandler.d.ts +0 -0
  241. /package/dist/types/{core → browser}/src/components/Advertising/handlers/createAdConversionHandler.d.ts +0 -0
  242. /package/dist/types/{core → browser}/src/components/Advertising/identities/collectID5Id.d.ts +0 -0
  243. /package/dist/types/{core → browser}/src/components/Advertising/identities/collectRampId.d.ts +0 -0
  244. /package/dist/types/{core → browser}/src/components/Advertising/index.d.ts +0 -0
  245. /package/dist/types/{core → browser}/src/components/Advertising/utils/advertisingCookieManager.d.ts +0 -0
  246. /package/dist/types/{core → browser}/src/components/Context/createComponent.d.ts +0 -0
  247. /package/dist/types/{core → browser}/src/components/Context/implementationDetails.d.ts +0 -0
  248. /package/dist/types/{core → browser}/src/components/Context/index.d.ts +0 -0
  249. /package/dist/types/{core → browser}/src/components/Context/injectDevice.d.ts +0 -0
  250. /package/dist/types/{core → browser}/src/components/Context/injectEnvironment.d.ts +0 -0
  251. /package/dist/types/{core → browser}/src/components/Context/injectHighEntropyUserAgentHints.d.ts +0 -0
  252. /package/dist/types/{core → browser}/src/components/Context/injectOneTimeAnalyticsReferrer.d.ts +0 -0
  253. /package/dist/types/{core → browser}/src/components/Context/injectPlaceContext.d.ts +0 -0
  254. /package/dist/types/{core → browser}/src/components/Context/injectWeb.d.ts +0 -0
  255. /package/dist/types/{core → browser}/src/components/Personalization/constants/loggerMessage.d.ts +0 -0
  256. /package/dist/types/{core → browser}/src/components/Personalization/constants/scopeType.d.ts +0 -0
  257. /package/dist/types/{core → browser}/src/components/Personalization/createApplyPropositions.d.ts +0 -0
  258. /package/dist/types/{core → browser}/src/components/Personalization/createClickStorage.d.ts +0 -0
  259. /package/dist/types/{core → browser}/src/components/Personalization/createComponent.d.ts +0 -0
  260. /package/dist/types/{core → browser}/src/components/Personalization/createFetchDataHandler.d.ts +0 -0
  261. /package/dist/types/{core → browser}/src/components/Personalization/createGetPageLocation.d.ts +0 -0
  262. /package/dist/types/{core → browser}/src/components/Personalization/createHandleConsentFlicker.d.ts +0 -0
  263. /package/dist/types/{core → browser}/src/components/Personalization/createInteractionStorage.d.ts +0 -0
  264. /package/dist/types/{core → browser}/src/components/Personalization/createNotificationHandler.d.ts +0 -0
  265. /package/dist/types/{core → browser}/src/components/Personalization/createOnClickHandler.d.ts +0 -0
  266. /package/dist/types/{core → browser}/src/components/Personalization/createOnDecisionHandler.d.ts +0 -0
  267. /package/dist/types/{core → browser}/src/components/Personalization/createPersonalizationDetails.d.ts +0 -0
  268. /package/dist/types/{core → browser}/src/components/Personalization/createSetTargetMigration.d.ts +0 -0
  269. /package/dist/types/{core → browser}/src/components/Personalization/createViewCacheManager.d.ts +0 -0
  270. /package/dist/types/{core → browser}/src/components/Personalization/createViewChangeHandler.d.ts +0 -0
  271. /package/dist/types/{core → browser}/src/components/Personalization/dom-actions/action.d.ts +0 -0
  272. /package/dist/types/{core → browser}/src/components/Personalization/dom-actions/addNonceToInlineStyleElements.d.ts +0 -0
  273. /package/dist/types/{core → browser}/src/components/Personalization/dom-actions/appendHtml.d.ts +0 -0
  274. /package/dist/types/{core → browser}/src/components/Personalization/dom-actions/clicks/collectClicks.d.ts +0 -0
  275. /package/dist/types/{core → browser}/src/components/Personalization/dom-actions/clicks/collectInteractions.d.ts +0 -0
  276. /package/dist/types/{core → browser}/src/components/Personalization/dom-actions/collectInteractions.d.ts +0 -0
  277. /package/dist/types/{core → browser}/src/components/Personalization/dom-actions/createPreprocess.d.ts +0 -0
  278. /package/dist/types/{core → browser}/src/components/Personalization/dom-actions/createRedirect.d.ts +0 -0
  279. /package/dist/types/{core → browser}/src/components/Personalization/dom-actions/dom/createFragment.d.ts +0 -0
  280. /package/dist/types/{core → browser}/src/components/Personalization/dom-actions/dom/getAttribute.d.ts +0 -0
  281. /package/dist/types/{core → browser}/src/components/Personalization/dom-actions/dom/getChildNodes.d.ts +0 -0
  282. /package/dist/types/{core → browser}/src/components/Personalization/dom-actions/dom/getChildren.d.ts +0 -0
  283. /package/dist/types/{core → browser}/src/components/Personalization/dom-actions/dom/getElementById.d.ts +0 -0
  284. /package/dist/types/{core → browser}/src/components/Personalization/dom-actions/dom/getFirstChild.d.ts +0 -0
  285. /package/dist/types/{core → browser}/src/components/Personalization/dom-actions/dom/getNextSibling.d.ts +0 -0
  286. /package/dist/types/{core → browser}/src/components/Personalization/dom-actions/dom/getNonce.d.ts +0 -0
  287. /package/dist/types/{core → browser}/src/components/Personalization/dom-actions/dom/getParent.d.ts +0 -0
  288. /package/dist/types/{core → browser}/src/components/Personalization/dom-actions/dom/helperForEq.d.ts +0 -0
  289. /package/dist/types/{core → browser}/src/components/Personalization/dom-actions/dom/index.d.ts +0 -0
  290. /package/dist/types/{core → browser}/src/components/Personalization/dom-actions/dom/insertAfter.d.ts +0 -0
  291. /package/dist/types/{core → browser}/src/components/Personalization/dom-actions/dom/insertBefore.d.ts +0 -0
  292. /package/dist/types/{core → browser}/src/components/Personalization/dom-actions/dom/matchesSelectorWithEq.d.ts +0 -0
  293. /package/dist/types/{core → browser}/src/components/Personalization/dom-actions/dom/removeAttribute.d.ts +0 -0
  294. /package/dist/types/{core → browser}/src/components/Personalization/dom-actions/dom/selectNodesWithEq.d.ts +0 -0
  295. /package/dist/types/{core → browser}/src/components/Personalization/dom-actions/dom/setAttribute.d.ts +0 -0
  296. /package/dist/types/{core → browser}/src/components/Personalization/dom-actions/dom/setStyle.d.ts +0 -0
  297. /package/dist/types/{core → browser}/src/components/Personalization/dom-actions/dom/util.d.ts +0 -0
  298. /package/dist/types/{core → browser}/src/components/Personalization/dom-actions/images.d.ts +0 -0
  299. /package/dist/types/{core → browser}/src/components/Personalization/dom-actions/index.d.ts +0 -0
  300. /package/dist/types/{core → browser}/src/components/Personalization/dom-actions/initDomActionsModules.d.ts +0 -0
  301. /package/dist/types/{core → browser}/src/components/Personalization/dom-actions/insertHtmlAfter.d.ts +0 -0
  302. /package/dist/types/{core → browser}/src/components/Personalization/dom-actions/insertHtmlBefore.d.ts +0 -0
  303. /package/dist/types/{core → browser}/src/components/Personalization/dom-actions/move.d.ts +0 -0
  304. /package/dist/types/{core → browser}/src/components/Personalization/dom-actions/prependHtml.d.ts +0 -0
  305. /package/dist/types/{core → browser}/src/components/Personalization/dom-actions/rearrangeChildren.d.ts +0 -0
  306. /package/dist/types/{core → browser}/src/components/Personalization/dom-actions/remapCustomCodeOffers.d.ts +0 -0
  307. /package/dist/types/{core → browser}/src/components/Personalization/dom-actions/remapHeadOffers.d.ts +0 -0
  308. /package/dist/types/{core → browser}/src/components/Personalization/dom-actions/replaceHtml.d.ts +0 -0
  309. /package/dist/types/{core → browser}/src/components/Personalization/dom-actions/resize.d.ts +0 -0
  310. /package/dist/types/{core → browser}/src/components/Personalization/dom-actions/scripts.d.ts +0 -0
  311. /package/dist/types/{core → browser}/src/components/Personalization/dom-actions/setAttributes.d.ts +0 -0
  312. /package/dist/types/{core → browser}/src/components/Personalization/dom-actions/setHtml.d.ts +0 -0
  313. /package/dist/types/{core → browser}/src/components/Personalization/dom-actions/setStyles.d.ts +0 -0
  314. /package/dist/types/{core → browser}/src/components/Personalization/dom-actions/setText.d.ts +0 -0
  315. /package/dist/types/{core → browser}/src/components/Personalization/dom-actions/swapImage.d.ts +0 -0
  316. /package/dist/types/{core → browser}/src/components/Personalization/flicker/index.d.ts +0 -0
  317. /package/dist/types/{core → browser}/src/components/Personalization/handlers/createDecorateProposition.d.ts +0 -0
  318. /package/dist/types/{core → browser}/src/components/Personalization/handlers/createProcessDomAction.d.ts +0 -0
  319. /package/dist/types/{core → browser}/src/components/Personalization/handlers/createProcessHtmlContent.d.ts +0 -0
  320. /package/dist/types/{core → browser}/src/components/Personalization/handlers/createProcessInAppMessage.d.ts +0 -0
  321. /package/dist/types/{core → browser}/src/components/Personalization/handlers/createProcessPropositions.d.ts +0 -0
  322. /package/dist/types/{core → browser}/src/components/Personalization/handlers/createProcessRedirect.d.ts +0 -0
  323. /package/dist/types/{core → browser}/src/components/Personalization/handlers/createRenderStatusHandler.d.ts +0 -0
  324. /package/dist/types/{core → browser}/src/components/Personalization/handlers/injectCreateProposition.d.ts +0 -0
  325. /package/dist/types/{core → browser}/src/components/Personalization/handlers/processDefaultContent.d.ts +0 -0
  326. /package/dist/types/{core → browser}/src/components/Personalization/in-app-message-actions/actions/displayIframeContent.d.ts +0 -0
  327. /package/dist/types/{core → browser}/src/components/Personalization/in-app-message-actions/initInAppMessageActionsModules.d.ts +0 -0
  328. /package/dist/types/{core → browser}/src/components/Personalization/in-app-message-actions/utils.d.ts +0 -0
  329. /package/dist/types/{core → browser}/src/components/Personalization/index.d.ts +0 -0
  330. /package/dist/types/{core → browser}/src/components/Personalization/utils/createAsyncArray.d.ts +0 -0
  331. /package/dist/types/{core → browser}/src/components/Personalization/utils/isAuthoringModeEnabled.d.ts +0 -0
  332. /package/dist/types/{core → browser}/src/components/Personalization/utils/metaUtils.d.ts +0 -0
  333. /package/dist/types/{core → browser}/src/components/Personalization/validateApplyPropositionsOptions.d.ts +0 -0
  334. /package/dist/types/{core → browser}/src/components/PushNotifications/helpers/constants.d.ts +0 -0
  335. /package/dist/types/{core → browser}/src/components/PushNotifications/helpers/getPushSubscriptionDetails.d.ts +0 -0
  336. /package/dist/types/{core → browser}/src/components/PushNotifications/helpers/readFromIndexedDb.d.ts +0 -0
  337. /package/dist/types/{core → browser}/src/components/PushNotifications/helpers/serviceWorkerNotificationClickListener.d.ts +0 -0
  338. /package/dist/types/{core → browser}/src/components/PushNotifications/helpers/serviceWorkerPushListener.d.ts +0 -0
  339. /package/dist/types/{core → browser}/src/components/PushNotifications/request/makeSendServiceWorkerTrackingData.d.ts +0 -0
  340. /package/dist/types/{core → browser}/src/createEventListeners.d.ts +0 -0
  341. /package/dist/types/core/src/{components/Context → utils}/injectTimestamp.d.ts +0 -0
@@ -0,0 +1,68 @@
1
+ /*
2
+ Copyright 2022 Adobe. All rights reserved.
3
+ This file is licensed to you under the Apache License, Version 2.0 (the "License");
4
+ you may not use this file except in compliance with the License. You may obtain a copy
5
+ of the License at http://www.apache.org/licenses/LICENSE-2.0
6
+
7
+ Unless required by applicable law or agreed to in writing, software distributed under
8
+ the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
9
+ OF ANY KIND, either express or implied. See the License for the specific language
10
+ governing permissions and limitations under the License.
11
+ */
12
+
13
+ import createClickedElementProperties from "./createClickedElementProperties.js";
14
+
15
+ export default ({
16
+ window,
17
+ getLinkName,
18
+ getLinkRegion,
19
+ getAbsoluteUrlFromAnchorElement,
20
+ findClickableElement,
21
+ determineLinkType,
22
+ }) => {
23
+ return ({ clickedElement, config, logger, clickActivityStorage }) => {
24
+ const {
25
+ onBeforeLinkClickSend: optionsFilter, // Deprecated
26
+ clickCollection,
27
+ } = config;
28
+ const { filterClickDetails: propertyFilter } = clickCollection;
29
+ const elementProperties = createClickedElementProperties({ logger });
30
+ if (clickedElement) {
31
+ const clickableElement = findClickableElement(clickedElement);
32
+ if (clickableElement) {
33
+ elementProperties.clickedElement = clickedElement;
34
+ elementProperties.linkUrl = getAbsoluteUrlFromAnchorElement(
35
+ window,
36
+ clickableElement,
37
+ );
38
+ elementProperties.linkType = determineLinkType(
39
+ window,
40
+ config,
41
+ elementProperties.linkUrl,
42
+ clickableElement,
43
+ );
44
+ elementProperties.linkRegion = getLinkRegion(clickableElement);
45
+ elementProperties.linkName = getLinkName(clickableElement);
46
+ elementProperties.pageIDType = 0;
47
+ elementProperties.pageName = window.location.href;
48
+ // Check if we have a page-name stored from an earlier page view event
49
+ const storedLinkData = clickActivityStorage.load();
50
+ if (storedLinkData && storedLinkData.pageName) {
51
+ elementProperties.pageName = storedLinkData.pageName;
52
+ // Perhaps pageIDType should be established after customer filter is applied
53
+ // Like if pageName starts with "http" then pageIDType = 0
54
+ elementProperties.pageIDType = 1;
55
+ }
56
+ // If defined, run user provided filter function
57
+ if (propertyFilter) {
58
+ // clickCollection.filterClickDetails
59
+ elementProperties.applyPropertyFilter(propertyFilter);
60
+ } else if (optionsFilter) {
61
+ // onBeforeLinkClickSend
62
+ elementProperties.applyOptionsFilter(optionsFilter);
63
+ }
64
+ }
65
+ }
66
+ return elementProperties;
67
+ };
68
+ };
@@ -0,0 +1,80 @@
1
+ /*
2
+ Copyright 2022 Adobe. All rights reserved.
3
+ This file is licensed to you under the Apache License, Version 2.0 (the "License");
4
+ you may not use this file except in compliance with the License. You may obtain a copy
5
+ of the License at http://www.apache.org/licenses/LICENSE-2.0
6
+
7
+ Unless required by applicable law or agreed to in writing, software distributed under
8
+ the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
9
+ OF ANY KIND, either express or implied. See the License for the specific language
10
+ governing permissions and limitations under the License.
11
+ */
12
+
13
+ import activityMapExtensionEnabled from "./utils/activityMapExtensionEnabled.js";
14
+ import isDifferentDomains from "./utils/isDifferentDomains.js";
15
+
16
+ const isDissallowedLinkType = (clickCollection, linkType) => {
17
+ return (
18
+ linkType &&
19
+ ((linkType === "download" && !clickCollection.downloadLinkEnabled) ||
20
+ (linkType === "exit" && !clickCollection.externalLinkEnabled) ||
21
+ (linkType === "other" && !clickCollection.internalLinkEnabled))
22
+ );
23
+ };
24
+
25
+ export default ({
26
+ config,
27
+ logger,
28
+ getClickedElementProperties,
29
+ clickActivityStorage,
30
+ }) => {
31
+ const { clickCollectionEnabled, clickCollection } = config;
32
+ if (!clickCollectionEnabled) {
33
+ return () => undefined;
34
+ }
35
+
36
+ return ({ event, clickedElement }) => {
37
+ const elementProperties = getClickedElementProperties({
38
+ clickActivityStorage,
39
+ clickedElement,
40
+ config,
41
+ logger,
42
+ });
43
+ const linkType = elementProperties.linkType;
44
+ // Avoid clicks to be collected for the ActivityMap interface
45
+ if (activityMapExtensionEnabled()) {
46
+ return;
47
+ }
48
+ if (
49
+ elementProperties.isValidLink() &&
50
+ isDissallowedLinkType(clickCollection, linkType)
51
+ ) {
52
+ logger.info(
53
+ `Cancelling link click event due to clickCollection.${linkType}LinkEnabled = false.`,
54
+ );
55
+ } else if (
56
+ // Determine if element properties should be sent with event now, or be saved
57
+ // and grouped with a future page view event.
58
+ // Event grouping is not supported for the deprecated onBeforeLinkClickSend callback
59
+ // because only click properties is saved and not XDM and DATA (which could have been modified).
60
+ // However, if the filterClickDetails callback is available we group events because it takes
61
+ // priority over onBeforeLinkClickSend and only supports processing click properties.
62
+ elementProperties.isInternalLink() &&
63
+ clickCollection.eventGroupingEnabled &&
64
+ (!config.onBeforeLinkClickSend || clickCollection.filterClickDetails) &&
65
+ !isDifferentDomains(window.location.hostname, elementProperties.linkUrl)
66
+ ) {
67
+ clickActivityStorage.save(elementProperties.properties);
68
+ } else if (elementProperties.isValidLink()) {
69
+ // Event will be sent
70
+ event.mergeXdm(elementProperties.xdm);
71
+ event.mergeData(elementProperties.data);
72
+ clickActivityStorage.save({
73
+ pageName: elementProperties.pageName,
74
+ pageIDType: elementProperties.pageIDType,
75
+ });
76
+ } else if (elementProperties.isValidActivityMapData()) {
77
+ clickActivityStorage.save(elementProperties.properties);
78
+ }
79
+ };
80
+ };
@@ -0,0 +1,45 @@
1
+ /*
2
+ Copyright 2024 Adobe. All rights reserved.
3
+ This file is licensed to you under the Apache License, Version 2.0 (the "License");
4
+ you may not use this file except in compliance with the License. You may obtain a copy
5
+ of the License at http://www.apache.org/licenses/LICENSE-2.0
6
+
7
+ Unless required by applicable law or agreed to in writing, software distributed under
8
+ the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
9
+ OF ANY KIND, either express or implied. See the License for the specific language
10
+ governing permissions and limitations under the License.
11
+ */
12
+
13
+ import createClickedElementProperties from "./createClickedElementProperties.js";
14
+ import activityMapExtensionEnabled from "./utils/activityMapExtensionEnabled.js";
15
+
16
+ export default ({ clickActivityStorage }) => {
17
+ return (event) => {
18
+ // Avoid clicks to be collected for the ActivityMap interface
19
+ if (activityMapExtensionEnabled()) {
20
+ return;
21
+ }
22
+ const properties = clickActivityStorage.load();
23
+ const elementProperties = createClickedElementProperties({ properties });
24
+ if (
25
+ elementProperties.isValidLink() ||
26
+ elementProperties.isValidActivityMapData()
27
+ ) {
28
+ if (elementProperties.isValidLink()) {
29
+ const xdm = elementProperties.xdm;
30
+ // Have to delete the eventType not to override the page view
31
+ delete xdm.eventType;
32
+ event.mergeXdm(xdm);
33
+ }
34
+ if (elementProperties.isValidActivityMapData()) {
35
+ event.mergeData(elementProperties.data);
36
+ }
37
+ // NOTE: We can't clear out all the storage here because we might still need to
38
+ // keep a page-name for multiple link-clicks (e.g. downloads) on the same page.
39
+ clickActivityStorage.save({
40
+ pageName: elementProperties.pageName,
41
+ pageIDType: elementProperties.pageIDType,
42
+ });
43
+ }
44
+ };
45
+ };
@@ -0,0 +1,20 @@
1
+ /*
2
+ Copyright 2024 Adobe. All rights reserved.
3
+ This file is licensed to you under the Apache License, Version 2.0 (the "License");
4
+ you may not use this file except in compliance with the License. You may obtain a copy
5
+ of the License at http://www.apache.org/licenses/LICENSE-2.0
6
+
7
+ Unless required by applicable law or agreed to in writing, software distributed under
8
+ the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
9
+ OF ANY KIND, either express or implied. See the License for the specific language
10
+ governing permissions and limitations under the License.
11
+ */
12
+
13
+ export default ({ clickActivityStorage }) => {
14
+ return (event) => {
15
+ clickActivityStorage.save({
16
+ pageName: event.getContent().xdm.web.webPageDetails.name,
17
+ pageIDType: 1, // 1 = name, 0 = URL
18
+ });
19
+ };
20
+ };
@@ -0,0 +1,145 @@
1
+ /*
2
+ Copyright 2022 Adobe. All rights reserved.
3
+ This file is licensed to you under the Apache License, Version 2.0 (the "License");
4
+ you may not use this file except in compliance with the License. You may obtain a copy
5
+ of the License at http://www.apache.org/licenses/LICENSE-2.0
6
+
7
+ Unless required by applicable law or agreed to in writing, software distributed under
8
+ the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
9
+ OF ANY KIND, either express or implied. See the License for the specific language
10
+ governing permissions and limitations under the License.
11
+ */
12
+
13
+ import truncateWhiteSpace from "./utils/truncateWhiteSpace.js";
14
+ import isSupportedTextNode from "./utils/dom/isSupportedTextNode.js";
15
+
16
+ /**
17
+ * Orders and returns specified node and its child nodes in arrays of supported
18
+ * and unsupported nodes.
19
+ * @param {*} node The node to extract supported and unsupported nodes from.
20
+ * @returns {{supportedNodes: Array, includesUnsupportedNodes: boolean}} Node support object.
21
+ */
22
+ const extractSupportedNodes = (node) => {
23
+ let supportedNodes = [];
24
+ let includesUnsupportedNodes = false;
25
+ if (isSupportedTextNode(node)) {
26
+ supportedNodes.push(node);
27
+ if (node.childNodes) {
28
+ const childNodes = Array.prototype.slice.call(node.childNodes);
29
+ childNodes.forEach((childNode) => {
30
+ const nodes = extractSupportedNodes(childNode);
31
+ supportedNodes = supportedNodes.concat(nodes.supportedNodes);
32
+ includesUnsupportedNodes =
33
+ includesUnsupportedNodes || nodes.includesUnsupportedNodes;
34
+ });
35
+ }
36
+ } else {
37
+ includesUnsupportedNodes = true;
38
+ }
39
+ return {
40
+ supportedNodes,
41
+ includesUnsupportedNodes,
42
+ };
43
+ };
44
+
45
+ /**
46
+ * Returns the value of a node attribute.
47
+ * @param {*} node The node holding the attribute.
48
+ * @param {string} attributeName The name of the attribute.
49
+ * @param {string} nodeName Optional node name constraint.
50
+ * @returns {string} Attribute value or undefined.
51
+ */
52
+ const getNodeAttributeValue = (node, attributeName, nodeName) => {
53
+ let attributeValue;
54
+ if (!nodeName || nodeName === node.nodeName.toUpperCase()) {
55
+ attributeValue = node.getAttribute(attributeName);
56
+ }
57
+ return attributeValue;
58
+ };
59
+
60
+ /**
61
+ * Extracts the children supported nodes attributes map
62
+ * @param {*} nodes The nodes array holding the children nodes.
63
+ * The returned map contains the supported not empty children attributes values.
64
+ * */
65
+ const getChildrenAttributes = (nodes) => {
66
+ const attributes = {
67
+ texts: [],
68
+ };
69
+ nodes.supportedNodes.forEach((supportedNode) => {
70
+ if (supportedNode.getAttribute) {
71
+ if (!attributes.alt) {
72
+ attributes.alt = truncateWhiteSpace(supportedNode.getAttribute("alt"));
73
+ }
74
+ if (!attributes.title) {
75
+ attributes.title = truncateWhiteSpace(
76
+ supportedNode.getAttribute("title"),
77
+ );
78
+ }
79
+ if (!attributes.inputValue) {
80
+ attributes.inputValue = truncateWhiteSpace(
81
+ getNodeAttributeValue(supportedNode, "value", "INPUT"),
82
+ );
83
+ }
84
+ if (!attributes.imgSrc) {
85
+ attributes.imgSrc = truncateWhiteSpace(
86
+ getNodeAttributeValue(supportedNode, "src", "IMG"),
87
+ );
88
+ }
89
+ if (!attributes.ariaLabel) {
90
+ attributes.ariaLabel = truncateWhiteSpace(
91
+ supportedNode.getAttribute("aria-label"),
92
+ );
93
+ }
94
+ if (!attributes.name) {
95
+ attributes.name = truncateWhiteSpace(
96
+ supportedNode.getAttribute("name"),
97
+ );
98
+ }
99
+ }
100
+ if (supportedNode.nodeValue) {
101
+ attributes.texts.push(supportedNode.nodeValue);
102
+ }
103
+ });
104
+ return attributes;
105
+ };
106
+
107
+ /**
108
+ * Extracts a link-name from a given node.
109
+ *
110
+ * The returned link-name is set to one of the following (in order of priority):
111
+ *
112
+ * 1. Clicked node innerText
113
+ * 2. Clicked node textContent
114
+ * 3. Clicked node and its child nodes nodeValue appended together.
115
+ * 4. Clicked node alt attribute or node descendant alt attribute.
116
+ * Whichever is found first.
117
+ * 5. Clicked node text attribute or node descendant text attribute.
118
+ * Whichever is found first.
119
+ * 6. Clicked node INPUT descendant value attribute.
120
+ * Whichever is found first.
121
+ * 7. Clicked node IMG descendant src attribute.
122
+ * Whichever is found first.
123
+ *
124
+ * @param {*} node The node to find link text for.
125
+ * @returns {string} link-name or an empty string if not link-name is found.
126
+ */
127
+ export default (node) => {
128
+ let nodeText = truncateWhiteSpace(node.innerText || node.textContent);
129
+ const nodes = extractSupportedNodes(node);
130
+ // if contains unsupported nodes we want children node attributes
131
+ if (!nodeText || nodes.includesUnsupportedNodes) {
132
+ const attributesMap = getChildrenAttributes(nodes);
133
+ nodeText = truncateWhiteSpace(attributesMap.texts.join(""));
134
+ if (!nodeText) {
135
+ nodeText =
136
+ attributesMap.alt ||
137
+ attributesMap.title ||
138
+ attributesMap.inputValue ||
139
+ attributesMap.imgSrc ||
140
+ attributesMap.ariaLabel ||
141
+ attributesMap.name;
142
+ }
143
+ }
144
+ return nodeText || "";
145
+ };
@@ -0,0 +1,65 @@
1
+ /*
2
+ Copyright 2022 Adobe. All rights reserved.
3
+ This file is licensed to you under the Apache License, Version 2.0 (the "License");
4
+ you may not use this file except in compliance with the License. You may obtain a copy
5
+ of the License at http://www.apache.org/licenses/LICENSE-2.0
6
+
7
+ Unless required by applicable law or agreed to in writing, software distributed under
8
+ the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
9
+ OF ANY KIND, either express or implied. See the License for the specific language
10
+ governing permissions and limitations under the License.
11
+ */
12
+
13
+ import truncateWhiteSpace from "./utils/truncateWhiteSpace.js";
14
+ import { isNonEmptyString } from "@adobe/alloy-core/utils";
15
+
16
+ const semanticElements = /^(HEADER|MAIN|FOOTER|NAV)$/i;
17
+
18
+ const getAriaRegionLabel = (node) => {
19
+ let regionLabel;
20
+ if (node.role === "region" && isNonEmptyString(node["aria-label"])) {
21
+ regionLabel = node["aria-label"];
22
+ }
23
+ return regionLabel;
24
+ };
25
+
26
+ const getSectionNodeName = (node) => {
27
+ let nodeName;
28
+ if (node && node.nodeName) {
29
+ if (node.nodeName.match(semanticElements)) {
30
+ nodeName = node.nodeName;
31
+ }
32
+ }
33
+ return nodeName;
34
+ };
35
+
36
+ /**
37
+ * Extracts a node link-region.
38
+ *
39
+ * The link-region is determined by traversing up the DOM
40
+ * looking for a region that is determined in order of priority:
41
+ *
42
+ * 1. element.id
43
+ * 2. Aria region label
44
+ * 3. Semantic element name
45
+ * 4. BODY (if no other link-region is found).
46
+ *
47
+ * @param {*} node The node to find link region for.
48
+ * @returns {string} link-region.
49
+ */
50
+ export default (node) => {
51
+ let linkParentNode = node.parentNode;
52
+ let regionName;
53
+ while (linkParentNode) {
54
+ regionName = truncateWhiteSpace(
55
+ linkParentNode.id ||
56
+ getAriaRegionLabel(linkParentNode) ||
57
+ getSectionNodeName(linkParentNode),
58
+ );
59
+ if (regionName) {
60
+ return regionName;
61
+ }
62
+ linkParentNode = linkParentNode.parentNode;
63
+ }
64
+ return "BODY";
65
+ };
@@ -0,0 +1,132 @@
1
+ /*
2
+ Copyright 2019 Adobe. All rights reserved.
3
+ This file is licensed to you under the Apache License, Version 2.0 (the "License");
4
+ you may not use this file except in compliance with the License. You may obtain a copy
5
+ of the License at http://www.apache.org/licenses/LICENSE-2.0
6
+
7
+ Unless required by applicable law or agreed to in writing, software distributed under
8
+ the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
9
+ OF ANY KIND, either express or implied. See the License for the specific language
10
+ governing permissions and limitations under the License.
11
+ */
12
+
13
+ import attachClickActivityCollector from "./attachClickActivityCollector.js";
14
+ import configValidators from "./configValidators.js";
15
+ import createInjectClickedElementProperties from "./createInjectClickedElementProperties.js";
16
+ import createRecallAndInjectClickedElementProperties from "./createRecallAndInjectClickedElementProperties.js";
17
+ import createGetClickedElementProperties from "./createGetClickedElementProperties.js";
18
+ import createClickActivityStorage from "./createClickActivityStorage.js";
19
+ import createStorePageViewProperties from "./createStorePageViewProperties.js";
20
+ import validateClickCollectionConfig from "./validateClickCollectionConfig.js";
21
+ import getLinkName from "./getLinkName.js";
22
+ import getLinkRegion from "./getLinkRegion.js";
23
+ import getAbsoluteUrlFromAnchorElement from "./utils/dom/getAbsoluteUrlFromAnchorElement.js";
24
+ import findClickableElement from "./utils/dom/findClickableElement.js";
25
+ import determineLinkType from "./utils/determineLinkType.js";
26
+ import hasPageName from "./utils/hasPageName.js";
27
+ import createTransientStorage from "./utils/createTransientStorage.js";
28
+ import { injectStorage } from "@adobe/alloy-core/utils";
29
+
30
+ const getClickedElementProperties = createGetClickedElementProperties({
31
+ window,
32
+ getLinkName,
33
+ getLinkRegion,
34
+ getAbsoluteUrlFromAnchorElement,
35
+ findClickableElement,
36
+ determineLinkType,
37
+ });
38
+
39
+ let clickActivityStorage;
40
+ const initClickActivityStorage = (config) => {
41
+ if (!clickActivityStorage) {
42
+ const createNamespacedStorage = injectStorage(window);
43
+ const nameSpacedStorage = createNamespacedStorage(config.orgId || "");
44
+ // Use transient in-memory if sessionStorage is disabled
45
+ const transientStorage = createTransientStorage();
46
+ const storage = config.clickCollection.sessionStorageEnabled
47
+ ? nameSpacedStorage.session
48
+ : transientStorage;
49
+ clickActivityStorage = createClickActivityStorage({ storage });
50
+ }
51
+ };
52
+
53
+ const createActivityCollector = ({
54
+ config,
55
+ eventManager,
56
+ handleError,
57
+ logger,
58
+ }) => {
59
+ validateClickCollectionConfig(config, logger);
60
+
61
+ const clickCollection = config.clickCollection;
62
+ if (!clickActivityStorage) {
63
+ initClickActivityStorage(config);
64
+ }
65
+
66
+ const injectClickedElementProperties = createInjectClickedElementProperties({
67
+ config,
68
+ logger,
69
+ clickActivityStorage,
70
+ getClickedElementProperties,
71
+ });
72
+
73
+ const recallAndInjectClickedElementProperties =
74
+ createRecallAndInjectClickedElementProperties({
75
+ clickActivityStorage,
76
+ });
77
+
78
+ const storePageViewProperties = createStorePageViewProperties({
79
+ clickActivityStorage,
80
+ });
81
+
82
+ return {
83
+ lifecycle: {
84
+ onComponentsRegistered(tools) {
85
+ const { lifecycle } = tools;
86
+ attachClickActivityCollector({
87
+ eventManager,
88
+ lifecycle,
89
+ handleError,
90
+ });
91
+ // TODO: createScrollActivityCollector ...
92
+ },
93
+ onClick({ event, clickedElement }) {
94
+ injectClickedElementProperties({
95
+ event,
96
+ clickedElement,
97
+ });
98
+ },
99
+ onBeforeEvent({ event }) {
100
+ if (hasPageName(event)) {
101
+ if (clickCollection.eventGroupingEnabled) {
102
+ recallAndInjectClickedElementProperties(event);
103
+ }
104
+ storePageViewProperties(event, logger, clickActivityStorage);
105
+ }
106
+ },
107
+ },
108
+ };
109
+ };
110
+
111
+ createActivityCollector.namespace = "ActivityCollector";
112
+ createActivityCollector.configValidators = configValidators;
113
+ createActivityCollector.buildOnInstanceConfiguredExtraParams = ({
114
+ config,
115
+ logger,
116
+ }) => {
117
+ if (!clickActivityStorage) {
118
+ initClickActivityStorage(config);
119
+ }
120
+ return {
121
+ getLinkDetails: (targetElement) => {
122
+ return getClickedElementProperties({
123
+ clickActivityStorage,
124
+ clickedElement: targetElement,
125
+ config,
126
+ logger,
127
+ }).properties;
128
+ },
129
+ };
130
+ };
131
+
132
+ export default createActivityCollector;
@@ -0,0 +1,16 @@
1
+ /*
2
+ Copyright 2024 Adobe. All rights reserved.
3
+ This file is licensed to you under the Apache License, Version 2.0 (the "License");
4
+ you may not use this file except in compliance with the License. You may obtain a copy
5
+ of the License at http://www.apache.org/licenses/LICENSE-2.0
6
+
7
+ Unless required by applicable law or agreed to in writing, software distributed under
8
+ the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
9
+ OF ANY KIND, either express or implied. See the License for the specific language
10
+ governing permissions and limitations under the License.
11
+ */
12
+
13
+ const ACTIVITY_MAP_EXTENSION_ID = "cppXYctnr";
14
+
15
+ export default (context = document) =>
16
+ context.getElementById(ACTIVITY_MAP_EXTENSION_ID) !== null;
@@ -0,0 +1,26 @@
1
+ /*
2
+ Copyright 2024 Adobe. All rights reserved.
3
+ This file is licensed to you under the Apache License, Version 2.0 (the "License");
4
+ you may not use this file except in compliance with the License. You may obtain a copy
5
+ of the License at http://www.apache.org/licenses/LICENSE-2.0
6
+
7
+ Unless required by applicable law or agreed to in writing, software distributed under
8
+ the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
9
+ OF ANY KIND, either express or implied. See the License for the specific language
10
+ governing permissions and limitations under the License.
11
+ */
12
+
13
+ export default () => {
14
+ const storage = {};
15
+ return {
16
+ getItem: (key) => {
17
+ return storage[key];
18
+ },
19
+ setItem: (key, value) => {
20
+ storage[key] = value;
21
+ },
22
+ removeItem: (key) => {
23
+ delete storage[key];
24
+ },
25
+ };
26
+ };
@@ -0,0 +1,27 @@
1
+ /*
2
+ Copyright 2024 Adobe. All rights reserved.
3
+ This file is licensed to you under the Apache License, Version 2.0 (the "License");
4
+ you may not use this file except in compliance with the License. You may obtain a copy
5
+ of the License at http://www.apache.org/licenses/LICENSE-2.0
6
+
7
+ Unless required by applicable law or agreed to in writing, software distributed under
8
+ the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
9
+ OF ANY KIND, either express or implied. See the License for the specific language
10
+ governing permissions and limitations under the License.
11
+ */
12
+
13
+ import isDownloadLink from "./dom/isDownloadLink.js";
14
+ import isExitLink from "./dom/isExitLink.js";
15
+ import { isNonEmptyString } from "@adobe/alloy-core/utils";
16
+
17
+ export default (window, config, linkUrl, clickedObj) => {
18
+ let linkType = "other";
19
+ if (isNonEmptyString(linkUrl)) {
20
+ if (isDownloadLink(config.downloadLinkQualifier, linkUrl, clickedObj)) {
21
+ linkType = "download";
22
+ } else if (isExitLink(window, linkUrl)) {
23
+ linkType = "exit";
24
+ }
25
+ }
26
+ return linkType;
27
+ };
@@ -0,0 +1,15 @@
1
+ /*
2
+ Copyright 2024 Adobe. All rights reserved.
3
+ This file is licensed to you under the Apache License, Version 2.0 (the "License");
4
+ you may not use this file except in compliance with the License. You may obtain a copy
5
+ of the License at http://www.apache.org/licenses/LICENSE-2.0
6
+
7
+ Unless required by applicable law or agreed to in writing, software distributed under
8
+ the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
9
+ OF ANY KIND, either express or implied. See the License for the specific language
10
+ governing permissions and limitations under the License.
11
+ */
12
+
13
+ export default (element) => {
14
+ return !element ? false : !!element.onclick;
15
+ };
@@ -0,0 +1,20 @@
1
+ /*
2
+ Copyright 2024 Adobe. All rights reserved.
3
+ This file is licensed to you under the Apache License, Version 2.0 (the "License");
4
+ you may not use this file except in compliance with the License. You may obtain a copy
5
+ of the License at http://www.apache.org/licenses/LICENSE-2.0
6
+
7
+ Unless required by applicable law or agreed to in writing, software distributed under
8
+ the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
9
+ OF ANY KIND, either express or implied. See the License for the specific language
10
+ governing permissions and limitations under the License.
11
+ */
12
+
13
+ export default (uri) => {
14
+ let fullUrl = uri;
15
+ if (!/^https?:\/\//i.test(fullUrl)) {
16
+ fullUrl = `${window.location.protocol}//${uri}`;
17
+ }
18
+ const url = new URL(fullUrl);
19
+ return url.hostname;
20
+ };