@adobe/alloy 2.21.0-beta.1 → 2.21.0-beta.11

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 (87) hide show
  1. package/LICENSE_BANNER +9 -0
  2. package/babel.config.cjs +93 -0
  3. package/libEs5/components/ActivityCollector/attachClickActivityCollector.js +4 -0
  4. package/libEs5/components/ActivityCollector/configValidators.js +17 -2
  5. package/libEs5/components/ActivityCollector/createClickActivityStorage.js +35 -0
  6. package/libEs5/components/ActivityCollector/createClickedElementProperties.js +215 -0
  7. package/libEs5/components/ActivityCollector/createGetClickedElementProperties.js +64 -0
  8. package/libEs5/components/ActivityCollector/createInjectClickedElementProperties.js +70 -0
  9. package/libEs5/components/ActivityCollector/createRecallAndInjectClickedElementProperties.js +46 -0
  10. package/libEs5/components/ActivityCollector/{createLinkClick.js → createStorePageViewProperties.js} +6 -21
  11. package/libEs5/components/ActivityCollector/getLinkName.js +9 -24
  12. package/libEs5/components/ActivityCollector/getLinkRegion.js +2 -2
  13. package/libEs5/components/ActivityCollector/index.js +54 -19
  14. package/libEs5/components/ActivityCollector/utils/activityMapExtensionEnabled.js +20 -0
  15. package/libEs5/components/ActivityCollector/utils/createTransientStorage.js +28 -0
  16. package/libEs5/components/ActivityCollector/utils/determineLinkType.js +28 -0
  17. package/libEs5/components/ActivityCollector/utils/dom/elementHasClickHandler.js +17 -0
  18. package/libEs5/components/ActivityCollector/utils/dom/extractDomain.js +22 -0
  19. package/libEs5/components/ActivityCollector/utils/dom/findClickableElement.js +28 -0
  20. package/libEs5/components/ActivityCollector/utils/dom/getAbsoluteUrlFromAnchorElement.js +42 -0
  21. package/libEs5/components/ActivityCollector/utils/dom/isButtonSubmitElement.js +17 -0
  22. package/libEs5/components/ActivityCollector/utils/dom/isDownloadLink.js +28 -0
  23. package/libEs5/components/ActivityCollector/utils/dom/isExitLink.js +25 -0
  24. package/libEs5/components/ActivityCollector/utils/dom/isInputSubmitElement.js +28 -0
  25. package/libEs5/components/ActivityCollector/utils/dom/isSupportedAnchorElement.js +20 -0
  26. package/libEs5/components/ActivityCollector/utils/dom/isSupportedTextNode.js +30 -0
  27. package/libEs5/components/ActivityCollector/utils/hasPageName.js +21 -0
  28. package/libEs5/components/ActivityCollector/utils/isDifferentDomains.js +20 -0
  29. package/libEs5/components/ActivityCollector/utils/trimQueryFromUrl.js +25 -0
  30. package/libEs5/components/ActivityCollector/utils/truncateWhiteSpace.js +24 -0
  31. package/libEs5/components/ActivityCollector/utils/urlStartsWithScheme.js +17 -0
  32. package/libEs5/constants/libraryVersion.js +1 -1
  33. package/libEs5/constants/sessionDataKeys.js +15 -0
  34. package/libEs5/core/componentCreators.js +4 -0
  35. package/libEs5/core/config/createCoreConfigs.js +1 -1
  36. package/libEs5/standalone.js +18 -0
  37. package/libEs5/utils/validation/createDeprecatedValidator.js +8 -23
  38. package/libEs5/utils/validation/createRenamedValidator.js +44 -0
  39. package/libEs5/utils/validation/index.js +7 -3
  40. package/libEs6/components/ActivityCollector/attachClickActivityCollector.js +4 -0
  41. package/libEs6/components/ActivityCollector/configValidators.js +17 -2
  42. package/libEs6/components/ActivityCollector/createClickActivityStorage.js +34 -0
  43. package/libEs6/components/ActivityCollector/createClickedElementProperties.js +218 -0
  44. package/libEs6/components/ActivityCollector/createGetClickedElementProperties.js +69 -0
  45. package/libEs6/components/ActivityCollector/createInjectClickedElementProperties.js +69 -0
  46. package/libEs6/components/ActivityCollector/createRecallAndInjectClickedElementProperties.js +45 -0
  47. package/libEs6/components/ActivityCollector/{createLinkClick.js → createStorePageViewProperties.js} +7 -22
  48. package/libEs6/components/ActivityCollector/getLinkName.js +2 -16
  49. package/libEs6/components/ActivityCollector/getLinkRegion.js +1 -1
  50. package/libEs6/components/ActivityCollector/index.js +50 -14
  51. package/libEs6/components/ActivityCollector/utils/activityMapExtensionEnabled.js +14 -0
  52. package/libEs6/components/ActivityCollector/utils/createTransientStorage.js +26 -0
  53. package/libEs6/components/ActivityCollector/utils/determineLinkType.js +26 -0
  54. package/libEs6/components/ActivityCollector/utils/dom/elementHasClickHandler.js +15 -0
  55. package/libEs6/components/ActivityCollector/utils/dom/extractDomain.js +20 -0
  56. package/libEs6/components/ActivityCollector/utils/dom/findClickableElement.js +26 -0
  57. package/libEs6/components/ActivityCollector/utils/dom/getAbsoluteUrlFromAnchorElement.js +42 -0
  58. package/libEs6/components/ActivityCollector/utils/dom/isButtonSubmitElement.js +15 -0
  59. package/libEs6/components/ActivityCollector/utils/dom/isDownloadLink.js +26 -0
  60. package/libEs6/components/ActivityCollector/utils/dom/isExitLink.js +23 -0
  61. package/libEs6/components/ActivityCollector/utils/dom/isInputSubmitElement.js +26 -0
  62. package/libEs6/components/ActivityCollector/utils/dom/isSupportedAnchorElement.js +18 -0
  63. package/libEs6/components/ActivityCollector/utils/dom/isSupportedTextNode.js +27 -0
  64. package/libEs6/components/ActivityCollector/utils/hasPageName.js +19 -0
  65. package/libEs6/components/ActivityCollector/utils/isDifferentDomains.js +18 -0
  66. package/libEs6/components/ActivityCollector/utils/trimQueryFromUrl.js +23 -0
  67. package/libEs6/components/ActivityCollector/utils/truncateWhiteSpace.js +22 -0
  68. package/libEs6/components/ActivityCollector/utils/urlStartsWithScheme.js +15 -0
  69. package/libEs6/constants/libraryVersion.js +1 -1
  70. package/libEs6/constants/sessionDataKeys.js +12 -0
  71. package/libEs6/core/componentCreators.js +8 -0
  72. package/libEs6/core/config/createCoreConfigs.js +1 -1
  73. package/libEs6/standalone.js +16 -0
  74. package/libEs6/utils/validation/createDeprecatedValidator.js +7 -20
  75. package/libEs6/utils/validation/createRenamedValidator.js +37 -0
  76. package/libEs6/utils/validation/index.js +7 -3
  77. package/package.json +35 -29
  78. package/rollup.config.js +164 -0
  79. package/scripts/alloyBuilder.js +215 -0
  80. package/scripts/helpers/alloyComponents.js +63 -0
  81. package/scripts/helpers/conditionalBuildBabelPlugin.js +57 -0
  82. package/scripts/helpers/versionBabelPlugin.js +43 -0
  83. package/libEs5/components/ActivityCollector/createGetLinkDetails.js +0 -68
  84. package/libEs5/components/ActivityCollector/utils.js +0 -104
  85. package/libEs6/components/ActivityCollector/createGetLinkDetails.js +0 -70
  86. package/libEs6/components/ActivityCollector/utils.js +0 -104
  87. package/scripts/build-alloy.js +0 -125
@@ -1,7 +1,8 @@
1
1
  "use strict";
2
2
 
3
3
  exports.default = void 0;
4
- var _utils = require("./utils.js");
4
+ var _truncateWhiteSpace = require("./utils/truncateWhiteSpace.js");
5
+ var _isSupportedTextNode = require("./utils/dom/isSupportedTextNode.js");
5
6
  /*
6
7
  Copyright 2022 Adobe. All rights reserved.
7
8
  This file is licensed to you under the Apache License, Version 2.0 (the "License");
@@ -14,22 +15,6 @@ OF ANY KIND, either express or implied. See the License for the specific languag
14
15
  governing permissions and limitations under the License.
15
16
  */
16
17
 
17
- var unsupportedNodeNames = /^(SCRIPT|STYLE|LINK|CANVAS|NOSCRIPT|#COMMENT)$/i;
18
-
19
- /**
20
- * Determines if a node qualifies as a supported link text node.
21
- * @param {*} node Node to determine support for.
22
- * @returns {boolean}
23
- */
24
- var isSupportedTextNode = function isSupportedTextNode(node) {
25
- if (node && node.nodeName) {
26
- if (node.nodeName.match(unsupportedNodeNames)) {
27
- return false;
28
- }
29
- }
30
- return true;
31
- };
32
-
33
18
  /**
34
19
  * Orders and returns specified node and its child nodes in arrays of supported
35
20
  * and unsupported nodes.
@@ -39,7 +24,7 @@ var isSupportedTextNode = function isSupportedTextNode(node) {
39
24
  var extractSupportedNodes = function extractSupportedNodes(node) {
40
25
  var supportedNodes = [];
41
26
  var includesUnsupportedNodes = false;
42
- if (isSupportedTextNode(node)) {
27
+ if ((0, _isSupportedTextNode.default)(node)) {
43
28
  supportedNodes.push(node);
44
29
  if (node.childNodes) {
45
30
  var childNodes = Array.prototype.slice.call(node.childNodes);
@@ -85,16 +70,16 @@ var getChildrenAttributes = function getChildrenAttributes(nodes) {
85
70
  nodes.supportedNodes.forEach(function (supportedNode) {
86
71
  if (supportedNode.getAttribute) {
87
72
  if (!attributes.alt) {
88
- attributes.alt = (0, _utils.truncateWhiteSpace)(supportedNode.getAttribute("alt"));
73
+ attributes.alt = (0, _truncateWhiteSpace.default)(supportedNode.getAttribute("alt"));
89
74
  }
90
75
  if (!attributes.title) {
91
- attributes.title = (0, _utils.truncateWhiteSpace)(supportedNode.getAttribute("title"));
76
+ attributes.title = (0, _truncateWhiteSpace.default)(supportedNode.getAttribute("title"));
92
77
  }
93
78
  if (!attributes.inputValue) {
94
- attributes.inputValue = (0, _utils.truncateWhiteSpace)(getNodeAttributeValue(supportedNode, "value", "INPUT"));
79
+ attributes.inputValue = (0, _truncateWhiteSpace.default)(getNodeAttributeValue(supportedNode, "value", "INPUT"));
95
80
  }
96
81
  if (!attributes.imgSrc) {
97
- attributes.imgSrc = (0, _utils.truncateWhiteSpace)(getNodeAttributeValue(supportedNode, "src", "IMG"));
82
+ attributes.imgSrc = (0, _truncateWhiteSpace.default)(getNodeAttributeValue(supportedNode, "src", "IMG"));
98
83
  }
99
84
  }
100
85
  if (supportedNode.nodeValue) {
@@ -125,12 +110,12 @@ var getChildrenAttributes = function getChildrenAttributes(nodes) {
125
110
  * @returns {string} link-name or an empty string if not link-name is found.
126
111
  */
127
112
  var _default = exports.default = function _default(node) {
128
- var nodeText = (0, _utils.truncateWhiteSpace)(node.innerText || node.textContent);
113
+ var nodeText = (0, _truncateWhiteSpace.default)(node.innerText || node.textContent);
129
114
  var nodes = extractSupportedNodes(node);
130
115
  // if contains unsupported nodes we want children node attributes
131
116
  if (!nodeText || nodes.includesUnsupportedNodes) {
132
117
  var attributesMap = getChildrenAttributes(nodes);
133
- nodeText = (0, _utils.truncateWhiteSpace)(attributesMap.texts.join(""));
118
+ nodeText = (0, _truncateWhiteSpace.default)(attributesMap.texts.join(""));
134
119
  if (!nodeText) {
135
120
  nodeText = attributesMap.alt || attributesMap.title || attributesMap.inputValue || attributesMap.imgSrc;
136
121
  }
@@ -1,7 +1,7 @@
1
1
  "use strict";
2
2
 
3
3
  exports.default = void 0;
4
- var _utils = require("./utils.js");
4
+ var _truncateWhiteSpace = require("./utils/truncateWhiteSpace.js");
5
5
  var _index = require("../../utils/index.js");
6
6
  /*
7
7
  Copyright 2022 Adobe. All rights reserved.
@@ -51,7 +51,7 @@ var _default = exports.default = function _default(node) {
51
51
  var linkParentNode = node.parentNode;
52
52
  var regionName;
53
53
  while (linkParentNode) {
54
- regionName = (0, _utils.truncateWhiteSpace)(linkParentNode.id || getAriaRegionLabel(linkParentNode) || getSectionNodeName(linkParentNode));
54
+ regionName = (0, _truncateWhiteSpace.default)(linkParentNode.id || getAriaRegionLabel(linkParentNode) || getSectionNodeName(linkParentNode));
55
55
  if (regionName) {
56
56
  return regionName;
57
57
  }
@@ -3,11 +3,19 @@
3
3
  exports.default = void 0;
4
4
  var _attachClickActivityCollector = require("./attachClickActivityCollector.js");
5
5
  var _configValidators = require("./configValidators.js");
6
- var _createLinkClick = require("./createLinkClick.js");
7
- var _createGetLinkDetails = require("./createGetLinkDetails.js");
6
+ var _createInjectClickedElementProperties = require("./createInjectClickedElementProperties.js");
7
+ var _createRecallAndInjectClickedElementProperties = require("./createRecallAndInjectClickedElementProperties.js");
8
+ var _createGetClickedElementProperties = require("./createGetClickedElementProperties.js");
9
+ var _createClickActivityStorage = require("./createClickActivityStorage.js");
10
+ var _createStorePageViewProperties = require("./createStorePageViewProperties.js");
8
11
  var _getLinkName = require("./getLinkName.js");
9
12
  var _getLinkRegion = require("./getLinkRegion.js");
10
- var _utils = require("./utils.js");
13
+ var _getAbsoluteUrlFromAnchorElement = require("./utils/dom/getAbsoluteUrlFromAnchorElement.js");
14
+ var _findClickableElement = require("./utils/dom/findClickableElement.js");
15
+ var _determineLinkType = require("./utils/determineLinkType.js");
16
+ var _hasPageName = require("./utils/hasPageName.js");
17
+ var _createTransientStorage = require("./utils/createTransientStorage.js");
18
+ var _index = require("../../utils/index.js");
11
19
  /*
12
20
  Copyright 2019 Adobe. All rights reserved.
13
21
  This file is licensed to you under the Apache License, Version 2.0 (the "License");
@@ -20,23 +28,40 @@ OF ANY KIND, either express or implied. See the License for the specific languag
20
28
  governing permissions and limitations under the License.
21
29
  */
22
30
 
23
- var _getLinkDetails = (0, _createGetLinkDetails.default)({
31
+ var getClickedElementProperties = (0, _createGetClickedElementProperties.default)({
24
32
  window: window,
25
33
  getLinkName: _getLinkName.default,
26
34
  getLinkRegion: _getLinkRegion.default,
27
- getAbsoluteUrlFromAnchorElement: _utils.getAbsoluteUrlFromAnchorElement,
28
- findSupportedAnchorElement: _utils.findSupportedAnchorElement,
29
- determineLinkType: _utils.determineLinkType
35
+ getAbsoluteUrlFromAnchorElement: _getAbsoluteUrlFromAnchorElement.default,
36
+ findClickableElement: _findClickableElement.default,
37
+ determineLinkType: _determineLinkType.default
30
38
  });
39
+ var clickActivityStorage;
31
40
  var createActivityCollector = function createActivityCollector(_ref) {
32
41
  var config = _ref.config,
33
42
  eventManager = _ref.eventManager,
34
43
  handleError = _ref.handleError,
35
44
  logger = _ref.logger;
36
- var linkClick = (0, _createLinkClick.default)({
37
- getLinkDetails: _getLinkDetails,
45
+ var clickCollection = config.clickCollection;
46
+ var createNamespacedStorage = (0, _index.injectStorage)(window);
47
+ var nameSpacedStorage = createNamespacedStorage(config.orgId || "");
48
+ // Use transient in-memory if sessionStorage is disabled
49
+ var transientStorage = (0, _createTransientStorage.default)();
50
+ var storage = clickCollection.sessionStorageEnabled ? nameSpacedStorage.session : transientStorage;
51
+ clickActivityStorage = (0, _createClickActivityStorage.default)({
52
+ storage: storage
53
+ });
54
+ var injectClickedElementProperties = (0, _createInjectClickedElementProperties.default)({
38
55
  config: config,
39
- logger: logger
56
+ logger: logger,
57
+ clickActivityStorage: clickActivityStorage,
58
+ getClickedElementProperties: getClickedElementProperties
59
+ });
60
+ var recallAndInjectClickedElementProperties = (0, _createRecallAndInjectClickedElementProperties.default)({
61
+ clickActivityStorage: clickActivityStorage
62
+ });
63
+ var storePageViewProperties = (0, _createStorePageViewProperties.default)({
64
+ clickActivityStorage: clickActivityStorage
40
65
  });
41
66
  return {
42
67
  lifecycle: {
@@ -52,26 +77,36 @@ var createActivityCollector = function createActivityCollector(_ref) {
52
77
  onClick: function onClick(_ref2) {
53
78
  var event = _ref2.event,
54
79
  clickedElement = _ref2.clickedElement;
55
- linkClick({
56
- targetElement: clickedElement,
57
- event: event
80
+ injectClickedElementProperties({
81
+ event: event,
82
+ clickedElement: clickedElement
58
83
  });
84
+ },
85
+ onBeforeEvent: function onBeforeEvent(_ref3) {
86
+ var event = _ref3.event;
87
+ if ((0, _hasPageName.default)(event)) {
88
+ if (clickCollection.eventGroupingEnabled) {
89
+ recallAndInjectClickedElementProperties(event);
90
+ }
91
+ storePageViewProperties(event, logger, clickActivityStorage);
92
+ }
59
93
  }
60
94
  }
61
95
  };
62
96
  };
63
97
  createActivityCollector.namespace = "ActivityCollector";
64
98
  createActivityCollector.configValidators = _configValidators.default;
65
- createActivityCollector.buildOnInstanceConfiguredExtraParams = function (_ref3) {
66
- var config = _ref3.config,
67
- logger = _ref3.logger;
99
+ createActivityCollector.buildOnInstanceConfiguredExtraParams = function (_ref4) {
100
+ var config = _ref4.config,
101
+ logger = _ref4.logger;
68
102
  return {
69
103
  getLinkDetails: function getLinkDetails(targetElement) {
70
- return _getLinkDetails({
71
- targetElement: targetElement,
104
+ return getClickedElementProperties({
105
+ clickActivityStorage: clickActivityStorage,
106
+ clickedElement: targetElement,
72
107
  config: config,
73
108
  logger: logger
74
- });
109
+ }).properties;
75
110
  }
76
111
  };
77
112
  };
@@ -0,0 +1,20 @@
1
+ "use strict";
2
+
3
+ exports.default = void 0;
4
+ /*
5
+ Copyright 2024 Adobe. All rights reserved.
6
+ This file is licensed to you under the Apache License, Version 2.0 (the "License");
7
+ you may not use this file except in compliance with the License. You may obtain a copy
8
+ of the License at http://www.apache.org/licenses/LICENSE-2.0
9
+
10
+ Unless required by applicable law or agreed to in writing, software distributed under
11
+ the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
12
+ OF ANY KIND, either express or implied. See the License for the specific language
13
+ governing permissions and limitations under the License.
14
+ */
15
+
16
+ var ACTIVITY_MAP_EXTENSION_ID = "cppXYctnr";
17
+ var _default = exports.default = function _default() {
18
+ var context = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : document;
19
+ return context.getElementById(ACTIVITY_MAP_EXTENSION_ID) !== null;
20
+ };
@@ -0,0 +1,28 @@
1
+ "use strict";
2
+
3
+ exports.default = void 0;
4
+ /*
5
+ Copyright 2024 Adobe. All rights reserved.
6
+ This file is licensed to you under the Apache License, Version 2.0 (the "License");
7
+ you may not use this file except in compliance with the License. You may obtain a copy
8
+ of the License at http://www.apache.org/licenses/LICENSE-2.0
9
+
10
+ Unless required by applicable law or agreed to in writing, software distributed under
11
+ the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
12
+ OF ANY KIND, either express or implied. See the License for the specific language
13
+ governing permissions and limitations under the License.
14
+ */
15
+ var _default = exports.default = function _default() {
16
+ var storage = {};
17
+ return {
18
+ getItem: function getItem(key) {
19
+ return storage[key];
20
+ },
21
+ setItem: function setItem(key, value) {
22
+ storage[key] = value;
23
+ },
24
+ removeItem: function removeItem(key) {
25
+ delete storage[key];
26
+ }
27
+ };
28
+ };
@@ -0,0 +1,28 @@
1
+ "use strict";
2
+
3
+ exports.default = void 0;
4
+ var _isDownloadLink = require("./dom/isDownloadLink");
5
+ var _isExitLink = require("./dom/isExitLink");
6
+ var _isNonEmptyString = require("../../../utils/isNonEmptyString");
7
+ /*
8
+ Copyright 2024 Adobe. All rights reserved.
9
+ This file is licensed to you under the Apache License, Version 2.0 (the "License");
10
+ you may not use this file except in compliance with the License. You may obtain a copy
11
+ of the License at http://www.apache.org/licenses/LICENSE-2.0
12
+
13
+ Unless required by applicable law or agreed to in writing, software distributed under
14
+ the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
15
+ OF ANY KIND, either express or implied. See the License for the specific language
16
+ governing permissions and limitations under the License.
17
+ */
18
+ var _default = exports.default = function _default(window, config, linkUrl, clickedObj) {
19
+ var linkType = "other";
20
+ if ((0, _isNonEmptyString.default)(linkUrl)) {
21
+ if ((0, _isDownloadLink.default)(config.downloadLinkQualifier, linkUrl, clickedObj)) {
22
+ linkType = "download";
23
+ } else if ((0, _isExitLink.default)(window, linkUrl)) {
24
+ linkType = "exit";
25
+ }
26
+ }
27
+ return linkType;
28
+ };
@@ -0,0 +1,17 @@
1
+ "use strict";
2
+
3
+ exports.default = void 0;
4
+ /*
5
+ Copyright 2024 Adobe. All rights reserved.
6
+ This file is licensed to you under the Apache License, Version 2.0 (the "License");
7
+ you may not use this file except in compliance with the License. You may obtain a copy
8
+ of the License at http://www.apache.org/licenses/LICENSE-2.0
9
+
10
+ Unless required by applicable law or agreed to in writing, software distributed under
11
+ the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
12
+ OF ANY KIND, either express or implied. See the License for the specific language
13
+ governing permissions and limitations under the License.
14
+ */
15
+ var _default = exports.default = function _default(element) {
16
+ return !element ? false : !!element.onclick;
17
+ };
@@ -0,0 +1,22 @@
1
+ "use strict";
2
+
3
+ exports.default = void 0;
4
+ /*
5
+ Copyright 2024 Adobe. All rights reserved.
6
+ This file is licensed to you under the Apache License, Version 2.0 (the "License");
7
+ you may not use this file except in compliance with the License. You may obtain a copy
8
+ of the License at http://www.apache.org/licenses/LICENSE-2.0
9
+
10
+ Unless required by applicable law or agreed to in writing, software distributed under
11
+ the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
12
+ OF ANY KIND, either express or implied. See the License for the specific language
13
+ governing permissions and limitations under the License.
14
+ */
15
+ var _default = exports.default = function _default(uri) {
16
+ var fullUrl = uri;
17
+ if (!/^https?:\/\//i.test(fullUrl)) {
18
+ fullUrl = window.location.protocol + "//" + uri;
19
+ }
20
+ var url = new URL(fullUrl);
21
+ return url.hostname;
22
+ };
@@ -0,0 +1,28 @@
1
+ "use strict";
2
+
3
+ exports.default = void 0;
4
+ var _isSupportedAnchorElement = require("./isSupportedAnchorElement.js");
5
+ var _elementHasClickHandler = require("./elementHasClickHandler.js");
6
+ var _isInputSubmitElement = require("./isInputSubmitElement.js");
7
+ var _isButtonSubmitElement = require("./isButtonSubmitElement.js");
8
+ /*
9
+ Copyright 2024 Adobe. All rights reserved.
10
+ This file is licensed to you under the Apache License, Version 2.0 (the "License");
11
+ you may not use this file except in compliance with the License. You may obtain a copy
12
+ of the License at http://www.apache.org/licenses/LICENSE-2.0
13
+
14
+ Unless required by applicable law or agreed to in writing, software distributed under
15
+ the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
16
+ OF ANY KIND, either express or implied. See the License for the specific language
17
+ governing permissions and limitations under the License.
18
+ */
19
+ var _default = exports.default = function _default(element) {
20
+ var node = element;
21
+ while (node) {
22
+ if ((0, _isSupportedAnchorElement.default)(node) || (0, _elementHasClickHandler.default)(node) || (0, _isInputSubmitElement.default)(node) || (0, _isButtonSubmitElement.default)(node)) {
23
+ return node;
24
+ }
25
+ node = node.parentNode;
26
+ }
27
+ return null;
28
+ };
@@ -0,0 +1,42 @@
1
+ "use strict";
2
+
3
+ exports.default = void 0;
4
+ var _urlStartsWithScheme = require("../urlStartsWithScheme");
5
+ /*
6
+ Copyright 2024 Adobe. All rights reserved.
7
+ This file is licensed to you under the Apache License, Version 2.0 (the "License");
8
+ you may not use this file except in compliance with the License. You may obtain a copy
9
+ of the License at http://www.apache.org/licenses/LICENSE-2.0
10
+
11
+ Unless required by applicable law or agreed to in writing, software distributed under
12
+ the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
13
+ OF ANY KIND, either express or implied. See the License for the specific language
14
+ governing permissions and limitations under the License.
15
+ */
16
+ var _default = exports.default = function _default(window, element) {
17
+ var loc = window.location;
18
+ var href = element.href || "";
19
+ // Some objects (like SVG animations) can contain a href object instead of a string
20
+ if (typeof href !== "string") {
21
+ href = "";
22
+ }
23
+ var protocol = element.protocol,
24
+ host = element.host;
25
+ if (href && !(0, _urlStartsWithScheme.default)(href)) {
26
+ if (!protocol) {
27
+ protocol = loc.protocol ? loc.protocol : "";
28
+ }
29
+ protocol = protocol ? protocol + "//" : "";
30
+ if (!host) {
31
+ host = loc.host ? loc.host : "";
32
+ }
33
+ var path = "";
34
+ if (href.substring(0, 1) !== "/") {
35
+ var indx = loc.pathname.lastIndexOf("/");
36
+ indx = indx < 0 ? 0 : indx;
37
+ path = loc.pathname.substring(0, indx);
38
+ }
39
+ href = "" + protocol + host + path + "/" + href;
40
+ }
41
+ return href;
42
+ };
@@ -0,0 +1,17 @@
1
+ "use strict";
2
+
3
+ exports.default = void 0;
4
+ /*
5
+ Copyright 2024 Adobe. All rights reserved.
6
+ This file is licensed to you under the Apache License, Version 2.0 (the "License");
7
+ you may not use this file except in compliance with the License. You may obtain a copy
8
+ of the License at http://www.apache.org/licenses/LICENSE-2.0
9
+
10
+ Unless required by applicable law or agreed to in writing, software distributed under
11
+ the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
12
+ OF ANY KIND, either express or implied. See the License for the specific language
13
+ governing permissions and limitations under the License.
14
+ */
15
+ var _default = exports.default = function _default(element) {
16
+ return element.tagName === "BUTTON" && element.type === "submit";
17
+ };
@@ -0,0 +1,28 @@
1
+ "use strict";
2
+
3
+ exports.default = void 0;
4
+ var _trimQueryFromUrl = require("../trimQueryFromUrl");
5
+ /*
6
+ Copyright 2024 Adobe. All rights reserved.
7
+ This file is licensed to you under the Apache License, Version 2.0 (the "License");
8
+ you may not use this file except in compliance with the License. You may obtain a copy
9
+ of the License at http://www.apache.org/licenses/LICENSE-2.0
10
+
11
+ Unless required by applicable law or agreed to in writing, software distributed under
12
+ the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
13
+ OF ANY KIND, either express or implied. See the License for the specific language
14
+ governing permissions and limitations under the License.
15
+ */
16
+ var _default = exports.default = function _default(downloadLinkQualifier, linkUrl, clickedObj) {
17
+ var result = false;
18
+ if (linkUrl) {
19
+ if (clickedObj && clickedObj.download) {
20
+ result = true;
21
+ } else if (downloadLinkQualifier) {
22
+ var re = new RegExp(downloadLinkQualifier);
23
+ var trimmedLinkUrl = (0, _trimQueryFromUrl.default)(linkUrl).toLowerCase();
24
+ result = re.test(trimmedLinkUrl);
25
+ }
26
+ }
27
+ return result;
28
+ };
@@ -0,0 +1,25 @@
1
+ "use strict";
2
+
3
+ exports.default = void 0;
4
+ var _trimQueryFromUrl = require("../trimQueryFromUrl");
5
+ /*
6
+ Copyright 2024 Adobe. All rights reserved.
7
+ This file is licensed to you under the Apache License, Version 2.0 (the "License");
8
+ you may not use this file except in compliance with the License. You may obtain a copy
9
+ of the License at http://www.apache.org/licenses/LICENSE-2.0
10
+
11
+ Unless required by applicable law or agreed to in writing, software distributed under
12
+ the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
13
+ OF ANY KIND, either express or implied. See the License for the specific language
14
+ governing permissions and limitations under the License.
15
+ */
16
+ var _default = exports.default = function _default(window, linkUrl) {
17
+ var result = false;
18
+ // window.location.hostname should always be defined, but checking just in case
19
+ if (linkUrl && window.location.hostname) {
20
+ var currentHostname = window.location.hostname.toLowerCase();
21
+ var trimmedLinkUrl = (0, _trimQueryFromUrl.default)(linkUrl).toLowerCase();
22
+ result = trimmedLinkUrl.indexOf(currentHostname) < 0;
23
+ }
24
+ return result;
25
+ };
@@ -0,0 +1,28 @@
1
+ "use strict";
2
+
3
+ exports.default = void 0;
4
+ /*
5
+ Copyright 2024 Adobe. All rights reserved.
6
+ This file is licensed to you under the Apache License, Version 2.0 (the "License");
7
+ you may not use this file except in compliance with the License. You may obtain a copy
8
+ of the License at http://www.apache.org/licenses/LICENSE-2.0
9
+
10
+ Unless required by applicable law or agreed to in writing, software distributed under
11
+ the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
12
+ OF ANY KIND, either express or implied. See the License for the specific language
13
+ governing permissions and limitations under the License.
14
+ */
15
+ var _default = exports.default = function _default(element) {
16
+ if (element.tagName === "INPUT") {
17
+ var type = element.getAttribute("type");
18
+ if (type === "submit") {
19
+ return true;
20
+ }
21
+ // Image type input elements are considered submit elements.
22
+ // https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input/image
23
+ if (type === "image" && element.src) {
24
+ return true;
25
+ }
26
+ }
27
+ return false;
28
+ };
@@ -0,0 +1,20 @@
1
+ "use strict";
2
+
3
+ exports.default = void 0;
4
+ /*
5
+ Copyright 2024 Adobe. All rights reserved.
6
+ This file is licensed to you under the Apache License, Version 2.0 (the "License");
7
+ you may not use this file except in compliance with the License. You may obtain a copy
8
+ of the License at http://www.apache.org/licenses/LICENSE-2.0
9
+
10
+ Unless required by applicable law or agreed to in writing, software distributed under
11
+ the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
12
+ OF ANY KIND, either express or implied. See the License for the specific language
13
+ governing permissions and limitations under the License.
14
+ */
15
+ var _default = exports.default = function _default(element) {
16
+ if (element.href && (element.tagName === "A" || element.tagName === "AREA") && (!element.onclick || !element.protocol || element.protocol.toLowerCase().indexOf("javascript") < 0)) {
17
+ return true;
18
+ }
19
+ return false;
20
+ };
@@ -0,0 +1,30 @@
1
+ "use strict";
2
+
3
+ exports.default = void 0;
4
+ /*
5
+ Copyright 2024 Adobe. All rights reserved.
6
+ This file is licensed to you under the Apache License, Version 2.0 (the "License");
7
+ you may not use this file except in compliance with the License. You may obtain a copy
8
+ of the License at http://www.apache.org/licenses/LICENSE-2.0
9
+
10
+ Unless required by applicable law or agreed to in writing, software distributed under
11
+ the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
12
+ OF ANY KIND, either express or implied. See the License for the specific language
13
+ governing permissions and limitations under the License.
14
+ */
15
+
16
+ var unsupportedNodeNames = /^(SCRIPT|STYLE|LINK|CANVAS|NOSCRIPT|#COMMENT)$/i;
17
+
18
+ /**
19
+ * Determines if a node qualifies as a supported link text node.
20
+ * @param {*} node Node to determine support for.
21
+ * @returns {boolean}
22
+ */
23
+ var _default = exports.default = function _default(node) {
24
+ if (node && node.nodeName) {
25
+ if (node.nodeName.match(unsupportedNodeNames)) {
26
+ return false;
27
+ }
28
+ }
29
+ return true;
30
+ };
@@ -0,0 +1,21 @@
1
+ "use strict";
2
+
3
+ exports.default = void 0;
4
+ /*
5
+ Copyright 2024 Adobe. All rights reserved.
6
+ This file is licensed to you under the Apache License, Version 2.0 (the "License");
7
+ you may not use this file except in compliance with the License. You may obtain a copy
8
+ of the License at http://www.apache.org/licenses/LICENSE-2.0
9
+
10
+ Unless required by applicable law or agreed to in writing, software distributed under
11
+ the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
12
+ OF ANY KIND, either express or implied. See the License for the specific language
13
+ governing permissions and limitations under the License.
14
+ */
15
+ var _default = exports.default = function _default(event) {
16
+ var content = event.getContent();
17
+ return content.xdm !== undefined &&
18
+ // NOTE: A page view event should "ideally" include the pageViews type
19
+ // && event.xdm.eventType === "web.webpagedetails.pageViews"
20
+ content.xdm.web !== undefined && content.xdm.web.webPageDetails !== undefined && content.xdm.web.webPageDetails.name !== undefined;
21
+ };
@@ -0,0 +1,20 @@
1
+ "use strict";
2
+
3
+ exports.default = void 0;
4
+ var _extractDomain = require("./dom/extractDomain");
5
+ /*
6
+ Copyright 2024 Adobe. All rights reserved.
7
+ This file is licensed to you under the Apache License, Version 2.0 (the "License");
8
+ you may not use this file except in compliance with the License. You may obtain a copy
9
+ of the License at http://www.apache.org/licenses/LICENSE-2.0
10
+
11
+ Unless required by applicable law or agreed to in writing, software distributed under
12
+ the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
13
+ OF ANY KIND, either express or implied. See the License for the specific language
14
+ governing permissions and limitations under the License.
15
+ */
16
+ var _default = exports.default = function _default(uri1, uri2) {
17
+ var domain1 = (0, _extractDomain.default)(uri1);
18
+ var domain2 = (0, _extractDomain.default)(uri2);
19
+ return domain1 !== domain2;
20
+ };
@@ -0,0 +1,25 @@
1
+ "use strict";
2
+
3
+ exports.default = void 0;
4
+ /*
5
+ Copyright 2024 Adobe. All rights reserved.
6
+ This file is licensed to you under the Apache License, Version 2.0 (the "License");
7
+ you may not use this file except in compliance with the License. You may obtain a copy
8
+ of the License at http://www.apache.org/licenses/LICENSE-2.0
9
+
10
+ Unless required by applicable law or agreed to in writing, software distributed under
11
+ the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
12
+ OF ANY KIND, either express or implied. See the License for the specific language
13
+ governing permissions and limitations under the License.
14
+ */
15
+ var _default = exports.default = function _default(url) {
16
+ var questionMarkIndex = url.indexOf("?");
17
+ var hashIndex = url.indexOf("#");
18
+ if (questionMarkIndex >= 0 && (questionMarkIndex < hashIndex || hashIndex < 0)) {
19
+ return url.substring(0, questionMarkIndex);
20
+ }
21
+ if (hashIndex >= 0) {
22
+ return url.substring(0, hashIndex);
23
+ }
24
+ return url;
25
+ };
@@ -0,0 +1,24 @@
1
+ "use strict";
2
+
3
+ exports.default = void 0;
4
+ /*
5
+ Copyright 2024 Adobe. All rights reserved.
6
+ This file is licensed to you under the Apache License, Version 2.0 (the "License");
7
+ you may not use this file except in compliance with the License. You may obtain a copy
8
+ of the License at http://www.apache.org/licenses/LICENSE-2.0
9
+
10
+ Unless required by applicable law or agreed to in writing, software distributed under
11
+ the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
12
+ OF ANY KIND, either express or implied. See the License for the specific language
13
+ governing permissions and limitations under the License.
14
+ */
15
+ /**
16
+ * Reduces repeated whitespace within a string. Whitespace surrounding the string
17
+ * is trimmed and any occurrence of whitespace within the string is replaced with
18
+ * a single space.
19
+ * @param {string} str String to be formatted.
20
+ * @returns {string} Formatted string.
21
+ */
22
+ var _default = exports.default = function _default(str) {
23
+ return str && str.replace(/\s+/g, " ").trim();
24
+ };