@adobe/alloy 2.15.0-alpha.0 → 2.15.0-alpha.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -5,7 +5,7 @@ exports.default = void 0;
5
5
  var _utils = require("../../utils");
6
6
 
7
7
  /*
8
- Copyright 2019 Adobe. All rights reserved.
8
+ Copyright 2022 Adobe. All rights reserved.
9
9
  This file is licensed to you under the Apache License, Version 2.0 (the "License");
10
10
  you may not use this file except in compliance with the License. You may obtain a copy
11
11
  of the License at http://www.apache.org/licenses/LICENSE-2.0
@@ -17,6 +17,7 @@ governing permissions and limitations under the License.
17
17
  */
18
18
  var _default = {
19
19
  clickCollectionEnabled: (0, _validation.boolean)().default(true),
20
- downloadLinkQualifier: (0, _validation.string)().regexp().default("\\.(exe|zip|wav|mp3|mov|mpg|avi|wmv|pdf|doc|docx|xls|xlsx|ppt|pptx)$")
20
+ downloadLinkQualifier: (0, _validation.string)().regexp().default("\\.(exe|zip|wav|mp3|mov|mpg|avi|wmv|pdf|doc|docx|xls|xlsx|ppt|pptx)$"),
21
+ onBeforeLinkClickSend: (0, _validation.callback)()
21
22
  };
22
23
  exports.default = _default;
@@ -0,0 +1,79 @@
1
+ "use strict";
2
+
3
+ exports.default = void 0;
4
+
5
+ /*
6
+ Copyright 2022 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 = function _default(_ref) {
17
+ var window = _ref.window,
18
+ getLinkName = _ref.getLinkName,
19
+ getLinkRegion = _ref.getLinkRegion,
20
+ getAbsoluteUrlFromAnchorElement = _ref.getAbsoluteUrlFromAnchorElement,
21
+ findSupportedAnchorElement = _ref.findSupportedAnchorElement,
22
+ determineLinkType = _ref.determineLinkType;
23
+ return function (_ref2) {
24
+ var targetElement = _ref2.targetElement,
25
+ config = _ref2.config,
26
+ logger = _ref2.logger;
27
+ var anchorElement = findSupportedAnchorElement(targetElement);
28
+
29
+ if (!anchorElement) {
30
+ logger.info("This link click event is not triggered because the HTML element is not an anchor.");
31
+ return undefined;
32
+ }
33
+
34
+ var linkUrl = getAbsoluteUrlFromAnchorElement(window, anchorElement);
35
+
36
+ if (!linkUrl) {
37
+ logger.info("This link click event is not triggered because the HTML element doesn't have an URL.");
38
+ return undefined;
39
+ }
40
+
41
+ var linkType = determineLinkType(window, config, linkUrl, anchorElement);
42
+ var linkRegion = getLinkRegion(anchorElement);
43
+ var linkName = getLinkName(anchorElement);
44
+ var onBeforeLinkClickSend = config.onBeforeLinkClickSend;
45
+ var options = {
46
+ xdm: {
47
+ eventType: "web.webinteraction.linkClicks",
48
+ web: {
49
+ webInteraction: {
50
+ name: linkName,
51
+ region: linkRegion,
52
+ type: linkType,
53
+ URL: linkUrl,
54
+ linkClicks: {
55
+ value: 1
56
+ }
57
+ }
58
+ }
59
+ },
60
+ data: {},
61
+ clickedElement: targetElement
62
+ };
63
+
64
+ if (!onBeforeLinkClickSend) {
65
+ return options;
66
+ }
67
+
68
+ var shouldEventBeTracked = onBeforeLinkClickSend(options);
69
+
70
+ if (shouldEventBeTracked !== false) {
71
+ return options;
72
+ }
73
+
74
+ logger.info("This link click event is not triggered because it was canceled in onBeforeLinkClickSend.");
75
+ return undefined;
76
+ };
77
+ };
78
+
79
+ exports.default = _default;
@@ -2,10 +2,8 @@
2
2
 
3
3
  exports.default = void 0;
4
4
 
5
- var _utils = require("./utils");
6
-
7
5
  /*
8
- Copyright 2019 Adobe. All rights reserved.
6
+ Copyright 2022 Adobe. All rights reserved.
9
7
  This file is licensed to you under the Apache License, Version 2.0 (the "License");
10
8
  you may not use this file except in compliance with the License. You may obtain a copy
11
9
  of the License at http://www.apache.org/licenses/LICENSE-2.0
@@ -15,71 +13,31 @@ the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTA
15
13
  OF ANY KIND, either express or implied. See the License for the specific language
16
14
  governing permissions and limitations under the License.
17
15
  */
18
- var determineLinkType = function determineLinkType(window, config, linkUrl, clickedObj) {
19
- var linkType = "other";
20
-
21
- if ((0, _utils.isDownloadLink)(config.downloadLinkQualifier, linkUrl, clickedObj)) {
22
- linkType = "download";
23
- } else if ((0, _utils.isExitLink)(window, linkUrl)) {
24
- linkType = "exit";
16
+ var _default = function _default(_ref) {
17
+ var getLinkDetails = _ref.getLinkDetails,
18
+ config = _ref.config,
19
+ logger = _ref.logger;
20
+ var clickCollectionEnabled = config.clickCollectionEnabled;
21
+
22
+ if (!clickCollectionEnabled) {
23
+ return function () {
24
+ return undefined;
25
+ };
25
26
  }
26
27
 
27
- return linkType;
28
- };
29
-
30
- var findSupportedAnchorElement = function findSupportedAnchorElement(targetElement) {
31
- var node = targetElement;
32
-
33
- while (node) {
34
- if ((0, _utils.isSupportedAnchorElement)(node)) {
35
- return node;
36
- }
37
-
38
- node = node.parentNode;
39
- }
40
-
41
- return null;
42
- };
43
-
44
- var _default = function _default(window, config) {
45
- return function (event, targetElement) {
46
- var clickCollectionEnabled = config.clickCollectionEnabled;
47
-
48
- if (!clickCollectionEnabled) {
49
- return;
50
- } // Search parent elements for an anchor element
51
- // TODO: Replace with generic DOM tool that can fetch configured properties
52
-
53
-
54
- var anchorElement = findSupportedAnchorElement(targetElement);
55
-
56
- if (!anchorElement) {
57
- return;
58
- }
59
-
60
- var linkUrl = (0, _utils.getAbsoluteUrlFromAnchorElement)(window, anchorElement);
28
+ return function (_ref2) {
29
+ var targetElement = _ref2.targetElement,
30
+ event = _ref2.event;
31
+ var linkDetails = getLinkDetails({
32
+ targetElement: targetElement,
33
+ config: config,
34
+ logger: logger
35
+ });
61
36
 
62
- if (!linkUrl) {
63
- return;
37
+ if (linkDetails) {
38
+ event.mergeXdm(linkDetails.xdm);
39
+ event.setUserData(linkDetails.data);
64
40
  }
65
-
66
- var linkType = determineLinkType(window, config, linkUrl, anchorElement); // TODO: Update link name from the clicked element context
67
-
68
- var linkName = "Link Click";
69
- event.documentMayUnload();
70
- event.mergeXdm({
71
- eventType: "web.webinteraction.linkClicks",
72
- web: {
73
- webInteraction: {
74
- name: linkName,
75
- type: linkType,
76
- URL: linkUrl,
77
- linkClicks: {
78
- value: 1
79
- }
80
- }
81
- }
82
- });
83
41
  };
84
42
  };
85
43
 
@@ -0,0 +1,158 @@
1
+ "use strict";
2
+
3
+ exports.default = void 0;
4
+
5
+ var _utils = require("./utils");
6
+
7
+ /*
8
+ Copyright 2022 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 unsupportedNodeNames = /^(SCRIPT|STYLE|LINK|CANVAS|NOSCRIPT|#COMMENT)$/i;
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
+
25
+ var isSupportedTextNode = function isSupportedTextNode(node) {
26
+ if (node && node.nodeName) {
27
+ if (node.nodeName.match(unsupportedNodeNames)) {
28
+ return false;
29
+ }
30
+ }
31
+
32
+ return true;
33
+ };
34
+ /**
35
+ * Orders and returns specified node and its child nodes in arrays of supported
36
+ * and unsupported nodes.
37
+ * @param {*} node The node to extract supported and unsupported nodes from.
38
+ * @returns {{supportedNodes: Array, includesUnsupportedNodes: boolean}} Node support object.
39
+ */
40
+
41
+
42
+ var extractSupportedNodes = function extractSupportedNodes(node) {
43
+ var supportedNodes = [];
44
+ var includesUnsupportedNodes = false;
45
+
46
+ if (isSupportedTextNode(node)) {
47
+ supportedNodes.push(node);
48
+
49
+ if (node.childNodes) {
50
+ var childNodes = Array.prototype.slice.call(node.childNodes);
51
+ childNodes.forEach(function (childNode) {
52
+ var nodes = extractSupportedNodes(childNode);
53
+ supportedNodes = supportedNodes.concat(nodes.supportedNodes);
54
+ includesUnsupportedNodes = includesUnsupportedNodes || nodes.includesUnsupportedNodes;
55
+ });
56
+ }
57
+ } else {
58
+ includesUnsupportedNodes = true;
59
+ }
60
+
61
+ return {
62
+ supportedNodes: supportedNodes,
63
+ includesUnsupportedNodes: includesUnsupportedNodes
64
+ };
65
+ };
66
+ /**
67
+ * Returns the value of a node attribute.
68
+ * @param {*} node The node holding the attribute.
69
+ * @param {string} attributeName The name of the attribute.
70
+ * @param {string} nodeName Optional node name constraint.
71
+ * @returns {string} Attribute value or undefined.
72
+ */
73
+
74
+
75
+ var getNodeAttributeValue = function getNodeAttributeValue(node, attributeName, nodeName) {
76
+ var attributeValue;
77
+
78
+ if (!nodeName || nodeName === node.nodeName.toUpperCase()) {
79
+ attributeValue = node.getAttribute(attributeName);
80
+ }
81
+
82
+ return attributeValue;
83
+ };
84
+ /**
85
+ * Extracts the children supported nodes attributes map
86
+ * @param {*} nodes The nodes array holding the children nodes.
87
+ * The returned map contains the supported not empty children attributes values.
88
+ * */
89
+
90
+
91
+ var getChildrenAttributes = function getChildrenAttributes(nodes) {
92
+ var attributes = {
93
+ texts: []
94
+ };
95
+ nodes.supportedNodes.forEach(function (supportedNode) {
96
+ if (supportedNode.getAttribute) {
97
+ if (!attributes.alt) {
98
+ attributes.alt = (0, _utils.truncateWhiteSpace)(supportedNode.getAttribute("alt"));
99
+ }
100
+
101
+ if (!attributes.title) {
102
+ attributes.title = (0, _utils.truncateWhiteSpace)(supportedNode.getAttribute("title"));
103
+ }
104
+
105
+ if (!attributes.inputValue) {
106
+ attributes.inputValue = (0, _utils.truncateWhiteSpace)(getNodeAttributeValue(supportedNode, "value", "INPUT"));
107
+ }
108
+
109
+ if (!attributes.imgSrc) {
110
+ attributes.imgSrc = (0, _utils.truncateWhiteSpace)(getNodeAttributeValue(supportedNode, "src", "IMG"));
111
+ }
112
+ }
113
+
114
+ if (supportedNode.nodeValue) {
115
+ attributes.texts.push(supportedNode.nodeValue);
116
+ }
117
+ });
118
+ return attributes;
119
+ };
120
+ /**
121
+ * Extracts a link-name from a given node.
122
+ *
123
+ * The returned link-name is set to one of the following (in order of priority):
124
+ *
125
+ * 1. Clicked node innerText
126
+ * 2. Clicked node textContent
127
+ * 3. Clicked node and its child nodes nodeValue appended together.
128
+ * 4. Clicked node alt attribute or node descendant alt attribute.
129
+ * Whichever is found first.
130
+ * 5. Clicked node text attribute or node descendant text attribute.
131
+ * Whichever is found first.
132
+ * 6. Clicked node INPUT descendant value attribute.
133
+ * Whichever is found first.
134
+ * 7. Clicked node IMG descendant src attribute.
135
+ * Whichever is found first.
136
+ *
137
+ * @param {*} node The node to find link text for.
138
+ * @returns {string} link-name or an empty string if not link-name is found.
139
+ */
140
+
141
+
142
+ var _default = function _default(node) {
143
+ var nodeText = (0, _utils.truncateWhiteSpace)(node.innerText || node.textContent);
144
+ var nodes = extractSupportedNodes(node); // if contains unsupported nodes we want children node attributes
145
+
146
+ if (!nodeText || nodes.includesUnsupportedNodes) {
147
+ var attributesMap = getChildrenAttributes(nodes);
148
+ nodeText = (0, _utils.truncateWhiteSpace)(attributesMap.texts.join(""));
149
+
150
+ if (!nodeText) {
151
+ nodeText = attributesMap.alt || attributesMap.title || attributesMap.inputValue || attributesMap.imgSrc;
152
+ }
153
+ }
154
+
155
+ return nodeText || "";
156
+ };
157
+
158
+ exports.default = _default;
@@ -0,0 +1,76 @@
1
+ "use strict";
2
+
3
+ exports.default = void 0;
4
+
5
+ var _utils = require("./utils");
6
+
7
+ var _utils2 = require("../../utils");
8
+
9
+ /*
10
+ Copyright 2022 Adobe. All rights reserved.
11
+ This file is licensed to you under the Apache License, Version 2.0 (the "License");
12
+ you may not use this file except in compliance with the License. You may obtain a copy
13
+ of the License at http://www.apache.org/licenses/LICENSE-2.0
14
+
15
+ Unless required by applicable law or agreed to in writing, software distributed under
16
+ the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
17
+ OF ANY KIND, either express or implied. See the License for the specific language
18
+ governing permissions and limitations under the License.
19
+ */
20
+ var semanticElements = /^(HEADER|MAIN|FOOTER|NAV)$/i;
21
+
22
+ var getAriaRegionLabel = function getAriaRegionLabel(node) {
23
+ var regionLabel;
24
+
25
+ if (node.role === "region" && (0, _utils2.isNonEmptyString)(node["aria-label"])) {
26
+ regionLabel = node["aria-label"];
27
+ }
28
+
29
+ return regionLabel;
30
+ };
31
+
32
+ var getSectionNodeName = function getSectionNodeName(node) {
33
+ var nodeName;
34
+
35
+ if (node && node.nodeName) {
36
+ if (node.nodeName.match(semanticElements)) {
37
+ nodeName = node.nodeName;
38
+ }
39
+ }
40
+
41
+ return nodeName;
42
+ };
43
+ /**
44
+ * Extracts a node link-region.
45
+ *
46
+ * The link-region is determined by traversing up the DOM
47
+ * looking for a region that is determined in order of priority:
48
+ *
49
+ * 1. element.id
50
+ * 2. Aria region label
51
+ * 3. Semantic element name
52
+ * 4. BODY (if no other link-region is found).
53
+ *
54
+ * @param {*} node The node to find link region for.
55
+ * @returns {string} link-region.
56
+ */
57
+
58
+
59
+ var _default = function _default(node) {
60
+ var linkParentNode = node.parentNode;
61
+ var regionName;
62
+
63
+ while (linkParentNode) {
64
+ regionName = (0, _utils.truncateWhiteSpace)(linkParentNode.id || getAriaRegionLabel(linkParentNode) || getSectionNodeName(linkParentNode));
65
+
66
+ if (regionName) {
67
+ return regionName;
68
+ }
69
+
70
+ linkParentNode = linkParentNode.parentNode;
71
+ }
72
+
73
+ return "BODY";
74
+ };
75
+
76
+ exports.default = _default;
@@ -8,6 +8,14 @@ var _configValidators = require("./configValidators");
8
8
 
9
9
  var _createLinkClick = require("./createLinkClick");
10
10
 
11
+ var _createGetLinkDetails = require("./createGetLinkDetails");
12
+
13
+ var _getLinkName = require("./getLinkName");
14
+
15
+ var _getLinkRegion = require("./getLinkRegion");
16
+
17
+ var _utils = require("./utils");
18
+
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");
@@ -19,17 +27,30 @@ the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTA
19
27
  OF ANY KIND, either express or implied. See the License for the specific language
20
28
  governing permissions and limitations under the License.
21
29
  */
30
+ var _getLinkDetails = (0, _createGetLinkDetails.default)({
31
+ window: window,
32
+ getLinkName: _getLinkName.default,
33
+ getLinkRegion: _getLinkRegion.default,
34
+ getAbsoluteUrlFromAnchorElement: _utils.getAbsoluteUrlFromAnchorElement,
35
+ findSupportedAnchorElement: _utils.findSupportedAnchorElement,
36
+ determineLinkType: _utils.determineLinkType
37
+ });
38
+
22
39
  var createActivityCollector = function createActivityCollector(_ref) {
23
40
  var config = _ref.config,
24
41
  eventManager = _ref.eventManager,
25
- handleError = _ref.handleError;
26
- var linkClick = (0, _createLinkClick.default)(window, config);
42
+ handleError = _ref.handleError,
43
+ logger = _ref.logger;
44
+ var linkClick = (0, _createLinkClick.default)({
45
+ getLinkDetails: _getLinkDetails,
46
+ config: config,
47
+ logger: logger
48
+ });
27
49
  return {
28
50
  lifecycle: {
29
51
  onComponentsRegistered: function onComponentsRegistered(tools) {
30
52
  var lifecycle = tools.lifecycle;
31
53
  (0, _attachClickActivityCollector.default)({
32
- config: config,
33
54
  eventManager: eventManager,
34
55
  lifecycle: lifecycle,
35
56
  handleError: handleError
@@ -38,7 +59,10 @@ var createActivityCollector = function createActivityCollector(_ref) {
38
59
  onClick: function onClick(_ref2) {
39
60
  var event = _ref2.event,
40
61
  clickedElement = _ref2.clickedElement;
41
- linkClick(event, clickedElement);
62
+ linkClick({
63
+ targetElement: clickedElement,
64
+ event: event
65
+ });
42
66
  }
43
67
  }
44
68
  };
@@ -46,5 +70,20 @@ var createActivityCollector = function createActivityCollector(_ref) {
46
70
 
47
71
  createActivityCollector.namespace = "ActivityCollector";
48
72
  createActivityCollector.configValidators = _configValidators.default;
73
+
74
+ createActivityCollector.buildOnInstanceConfiguredExtraParams = function (_ref3) {
75
+ var config = _ref3.config,
76
+ logger = _ref3.logger;
77
+ return {
78
+ getLinkDetails: function getLinkDetails(targetElement) {
79
+ return _getLinkDetails({
80
+ targetElement: targetElement,
81
+ config: config,
82
+ logger: logger
83
+ });
84
+ }
85
+ };
86
+ };
87
+
49
88
  var _default = createActivityCollector;
50
89
  exports.default = _default;
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
 
3
- exports.urlStartsWithScheme = exports.isSupportedAnchorElement = exports.isExitLink = exports.isDownloadLink = exports.getAbsoluteUrlFromAnchorElement = void 0;
3
+ exports.urlStartsWithScheme = exports.truncateWhiteSpace = exports.isSupportedAnchorElement = exports.isExitLink = exports.isEmptyString = exports.isDownloadLink = exports.getAbsoluteUrlFromAnchorElement = exports.findSupportedAnchorElement = exports.determineLinkType = void 0;
4
4
 
5
5
  /*
6
6
  Copyright 2019 Adobe. All rights reserved.
@@ -78,5 +78,55 @@ var isExitLink = function isExitLink(window, linkUrl) {
78
78
 
79
79
  return true;
80
80
  };
81
+ /**
82
+ * Reduces repeated whitespace within a string. Whitespace surrounding the string
83
+ * is trimmed and any occurrence of whitespace within the string is replaced with
84
+ * a single space.
85
+ * @param {string} str String to be formatted.
86
+ * @returns {string} Formatted string.
87
+ */
81
88
 
82
- exports.isExitLink = isExitLink;
89
+
90
+ exports.isExitLink = isExitLink;
91
+
92
+ var truncateWhiteSpace = function truncateWhiteSpace(str) {
93
+ return str && str.replace(/\s+/g, " ").trim();
94
+ };
95
+
96
+ exports.truncateWhiteSpace = truncateWhiteSpace;
97
+
98
+ var isEmptyString = function isEmptyString(str) {
99
+ return !str || str.length === 0;
100
+ };
101
+
102
+ exports.isEmptyString = isEmptyString;
103
+
104
+ var determineLinkType = function determineLinkType(window, config, linkUrl, clickedObj) {
105
+ var linkType = "other";
106
+
107
+ if (isDownloadLink(config.downloadLinkQualifier, linkUrl, clickedObj)) {
108
+ linkType = "download";
109
+ } else if (isExitLink(window, linkUrl)) {
110
+ linkType = "exit";
111
+ }
112
+
113
+ return linkType;
114
+ };
115
+
116
+ exports.determineLinkType = determineLinkType;
117
+
118
+ var findSupportedAnchorElement = function findSupportedAnchorElement(targetElement) {
119
+ var node = targetElement;
120
+
121
+ while (node) {
122
+ if (isSupportedAnchorElement(node)) {
123
+ return node;
124
+ }
125
+
126
+ node = node.parentNode;
127
+ }
128
+
129
+ return null;
130
+ };
131
+
132
+ exports.findSupportedAnchorElement = findSupportedAnchorElement;
@@ -15,5 +15,5 @@ governing permissions and limitations under the License.
15
15
  */
16
16
  // The __VERSION__ keyword will be replace at alloy build time with the package.json version.
17
17
  // see babel-plugin-version
18
- var _default = "2.15.0-alpha.0";
18
+ var _default = "2.15.0-alpha.1";
19
19
  exports.default = _default;
@@ -6,17 +6,12 @@ var _utils = require("../utils");
6
6
 
7
7
  var _validation = require("../utils/validation");
8
8
 
9
- /*
10
- Copyright 2019 Adobe. All rights reserved.
11
- This file is licensed to you under the Apache License, Version 2.0 (the "License");
12
- you may not use this file except in compliance with the License. You may obtain a copy
13
- of the License at http://www.apache.org/licenses/LICENSE-2.0
14
-
15
- Unless required by applicable law or agreed to in writing, software distributed under
16
- the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
17
- OF ANY KIND, either express or implied. See the License for the specific language
18
- governing permissions and limitations under the License.
19
- */
9
+ function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
10
+
11
+ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
12
+
13
+ function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
14
+
20
15
  var CONFIG_DOC_URI = "https://adobe.ly/3sHh553";
21
16
 
22
17
  var buildSchema = function buildSchema(coreConfigValidators, componentCreators) {
@@ -38,21 +33,38 @@ var transformOptions = function transformOptions(schema, options) {
38
33
  }
39
34
  };
40
35
 
41
- var _default = function _default(_ref) {
42
- var options = _ref.options,
43
- componentCreators = _ref.componentCreators,
44
- coreConfigValidators = _ref.coreConfigValidators,
45
- createConfig = _ref.createConfig,
46
- logger = _ref.logger,
47
- setDebugEnabled = _ref.setDebugEnabled;
36
+ var buildAllOnInstanceConfiguredExtraParams = function buildAllOnInstanceConfiguredExtraParams(config, logger, componentCreators) {
37
+ return componentCreators.reduce(function (memo, _ref) {
38
+ var buildOnInstanceConfiguredExtraParams = _ref.buildOnInstanceConfiguredExtraParams;
39
+
40
+ if (buildOnInstanceConfiguredExtraParams) {
41
+ (0, _utils.assign)(memo, buildOnInstanceConfiguredExtraParams({
42
+ config: config,
43
+ logger: logger
44
+ }));
45
+ }
46
+
47
+ return memo;
48
+ }, {});
49
+ };
50
+
51
+ var _default = function _default(_ref2) {
52
+ var options = _ref2.options,
53
+ componentCreators = _ref2.componentCreators,
54
+ coreConfigValidators = _ref2.coreConfigValidators,
55
+ createConfig = _ref2.createConfig,
56
+ logger = _ref2.logger,
57
+ setDebugEnabled = _ref2.setDebugEnabled;
48
58
  var schema = buildSchema(coreConfigValidators, componentCreators);
49
59
  var config = createConfig(transformOptions(schema, options));
50
60
  setDebugEnabled(config.debugEnabled, {
51
61
  fromConfig: true
52
- });
53
- logger.logOnInstanceConfigured({
62
+ }); // eslint-disable-next-line no-underscore-dangle
63
+
64
+ var extraParams = buildAllOnInstanceConfiguredExtraParams(config, logger, componentCreators);
65
+ logger.logOnInstanceConfigured(_objectSpread(_objectSpread({}, extraParams), {}, {
54
66
  config: config
55
- });
67
+ }));
56
68
  return config;
57
69
  };
58
70
 
@@ -33,6 +33,10 @@ the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTA
33
33
  OF ANY KIND, either express or implied. See the License for the specific language
34
34
  governing permissions and limitations under the License.
35
35
  */
36
+ // This is the only place where core is allowed to import from components.
37
+ // This makes sure that each component could be removed without breaking the library
38
+
39
+ /* eslint-disable import/no-restricted-paths */
36
40
  // TODO: Register the Components here statically for now. They might be registered differently.
37
41
  // TODO: Figure out how sub-components will be made available/registered
38
42
  var _default = [_DataCollector.default, _ActivityCollector.default, _Identity.default, _Audiences.default, _Personalization.default, _Context.default, _Privacy.default, _EventMerge.default, _LibraryInfo.default, _MachineLearning.default];
@@ -1,5 +1,5 @@
1
1
  /*
2
- Copyright 2019 Adobe. All rights reserved.
2
+ Copyright 2022 Adobe. All rights reserved.
3
3
  This file is licensed to you under the Apache License, Version 2.0 (the "License");
4
4
  you may not use this file except in compliance with the License. You may obtain a copy
5
5
  of the License at http://www.apache.org/licenses/LICENSE-2.0
@@ -9,8 +9,9 @@ the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTA
9
9
  OF ANY KIND, either express or implied. See the License for the specific language
10
10
  governing permissions and limitations under the License.
11
11
  */
12
- import { string, boolean } from "../../utils/validation";
12
+ import { string, boolean, callback } from "../../utils/validation";
13
13
  export default {
14
14
  clickCollectionEnabled: boolean().default(true),
15
- downloadLinkQualifier: string().regexp().default("\\.(exe|zip|wav|mp3|mov|mpg|avi|wmv|pdf|doc|docx|xls|xlsx|ppt|pptx)$")
15
+ downloadLinkQualifier: string().regexp().default("\\.(exe|zip|wav|mp3|mov|mpg|avi|wmv|pdf|doc|docx|xls|xlsx|ppt|pptx)$"),
16
+ onBeforeLinkClickSend: callback()
16
17
  };
@@ -0,0 +1,77 @@
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
+ export default (({
13
+ window,
14
+ getLinkName,
15
+ getLinkRegion,
16
+ getAbsoluteUrlFromAnchorElement,
17
+ findSupportedAnchorElement,
18
+ determineLinkType
19
+ }) => {
20
+ return ({
21
+ targetElement,
22
+ config,
23
+ logger
24
+ }) => {
25
+ const anchorElement = findSupportedAnchorElement(targetElement);
26
+
27
+ if (!anchorElement) {
28
+ logger.info("This link click event is not triggered because the HTML element is not an anchor.");
29
+ return undefined;
30
+ }
31
+
32
+ const linkUrl = getAbsoluteUrlFromAnchorElement(window, anchorElement);
33
+
34
+ if (!linkUrl) {
35
+ logger.info("This link click event is not triggered because the HTML element doesn't have an URL.");
36
+ return undefined;
37
+ }
38
+
39
+ const linkType = determineLinkType(window, config, linkUrl, anchorElement);
40
+ const linkRegion = getLinkRegion(anchorElement);
41
+ const linkName = getLinkName(anchorElement);
42
+ const {
43
+ onBeforeLinkClickSend
44
+ } = config;
45
+ const options = {
46
+ xdm: {
47
+ eventType: "web.webinteraction.linkClicks",
48
+ web: {
49
+ webInteraction: {
50
+ name: linkName,
51
+ region: linkRegion,
52
+ type: linkType,
53
+ URL: linkUrl,
54
+ linkClicks: {
55
+ value: 1
56
+ }
57
+ }
58
+ }
59
+ },
60
+ data: {},
61
+ clickedElement: targetElement
62
+ };
63
+
64
+ if (!onBeforeLinkClickSend) {
65
+ return options;
66
+ }
67
+
68
+ const shouldEventBeTracked = onBeforeLinkClickSend(options);
69
+
70
+ if (shouldEventBeTracked !== false) {
71
+ return options;
72
+ }
73
+
74
+ logger.info("This link click event is not triggered because it was canceled in onBeforeLinkClickSend.");
75
+ return undefined;
76
+ };
77
+ });
@@ -1,5 +1,5 @@
1
1
  /*
2
- Copyright 2019 Adobe. All rights reserved.
2
+ Copyright 2022 Adobe. All rights reserved.
3
3
  This file is licensed to you under the Apache License, Version 2.0 (the "License");
4
4
  you may not use this file except in compliance with the License. You may obtain a copy
5
5
  of the License at http://www.apache.org/licenses/LICENSE-2.0
@@ -9,72 +9,32 @@ the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTA
9
9
  OF ANY KIND, either express or implied. See the License for the specific language
10
10
  governing permissions and limitations under the License.
11
11
  */
12
- import { getAbsoluteUrlFromAnchorElement, isSupportedAnchorElement, isDownloadLink, isExitLink } from "./utils";
13
-
14
- const determineLinkType = (window, config, linkUrl, clickedObj) => {
15
- let linkType = "other";
16
-
17
- if (isDownloadLink(config.downloadLinkQualifier, linkUrl, clickedObj)) {
18
- linkType = "download";
19
- } else if (isExitLink(window, linkUrl)) {
20
- linkType = "exit";
21
- }
22
-
23
- return linkType;
24
- };
25
-
26
- const findSupportedAnchorElement = targetElement => {
27
- let node = targetElement;
28
-
29
- while (node) {
30
- if (isSupportedAnchorElement(node)) {
31
- return node;
32
- }
33
-
34
- node = node.parentNode;
12
+ export default (({
13
+ getLinkDetails,
14
+ config,
15
+ logger
16
+ }) => {
17
+ const {
18
+ clickCollectionEnabled
19
+ } = config;
20
+
21
+ if (!clickCollectionEnabled) {
22
+ return () => undefined;
35
23
  }
36
24
 
37
- return null;
38
- };
39
-
40
- export default ((window, config) => {
41
- return (event, targetElement) => {
42
- const clickCollectionEnabled = config.clickCollectionEnabled;
43
-
44
- if (!clickCollectionEnabled) {
45
- return;
46
- } // Search parent elements for an anchor element
47
- // TODO: Replace with generic DOM tool that can fetch configured properties
48
-
49
-
50
- const anchorElement = findSupportedAnchorElement(targetElement);
51
-
52
- if (!anchorElement) {
53
- return;
54
- }
55
-
56
- const linkUrl = getAbsoluteUrlFromAnchorElement(window, anchorElement);
25
+ return ({
26
+ targetElement,
27
+ event
28
+ }) => {
29
+ const linkDetails = getLinkDetails({
30
+ targetElement,
31
+ config,
32
+ logger
33
+ });
57
34
 
58
- if (!linkUrl) {
59
- return;
35
+ if (linkDetails) {
36
+ event.mergeXdm(linkDetails.xdm);
37
+ event.setUserData(linkDetails.data);
60
38
  }
61
-
62
- const linkType = determineLinkType(window, config, linkUrl, anchorElement); // TODO: Update link name from the clicked element context
63
-
64
- const linkName = "Link Click";
65
- event.documentMayUnload();
66
- event.mergeXdm({
67
- eventType: "web.webinteraction.linkClicks",
68
- web: {
69
- webInteraction: {
70
- name: linkName,
71
- type: linkType,
72
- URL: linkUrl,
73
- linkClicks: {
74
- value: 1
75
- }
76
- }
77
- }
78
- });
79
39
  };
80
40
  });
@@ -0,0 +1,151 @@
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
+ import { truncateWhiteSpace } from "./utils";
13
+ const unsupportedNodeNames = /^(SCRIPT|STYLE|LINK|CANVAS|NOSCRIPT|#COMMENT)$/i;
14
+ /**
15
+ * Determines if a node qualifies as a supported link text node.
16
+ * @param {*} node Node to determine support for.
17
+ * @returns {boolean}
18
+ */
19
+
20
+ const isSupportedTextNode = node => {
21
+ if (node && node.nodeName) {
22
+ if (node.nodeName.match(unsupportedNodeNames)) {
23
+ return false;
24
+ }
25
+ }
26
+
27
+ return true;
28
+ };
29
+ /**
30
+ * Orders and returns specified node and its child nodes in arrays of supported
31
+ * and unsupported nodes.
32
+ * @param {*} node The node to extract supported and unsupported nodes from.
33
+ * @returns {{supportedNodes: Array, includesUnsupportedNodes: boolean}} Node support object.
34
+ */
35
+
36
+
37
+ const extractSupportedNodes = node => {
38
+ let supportedNodes = [];
39
+ let includesUnsupportedNodes = false;
40
+
41
+ if (isSupportedTextNode(node)) {
42
+ supportedNodes.push(node);
43
+
44
+ if (node.childNodes) {
45
+ const childNodes = Array.prototype.slice.call(node.childNodes);
46
+ childNodes.forEach(childNode => {
47
+ const nodes = extractSupportedNodes(childNode);
48
+ supportedNodes = supportedNodes.concat(nodes.supportedNodes);
49
+ includesUnsupportedNodes = includesUnsupportedNodes || nodes.includesUnsupportedNodes;
50
+ });
51
+ }
52
+ } else {
53
+ includesUnsupportedNodes = true;
54
+ }
55
+
56
+ return {
57
+ supportedNodes,
58
+ includesUnsupportedNodes
59
+ };
60
+ };
61
+ /**
62
+ * Returns the value of a node attribute.
63
+ * @param {*} node The node holding the attribute.
64
+ * @param {string} attributeName The name of the attribute.
65
+ * @param {string} nodeName Optional node name constraint.
66
+ * @returns {string} Attribute value or undefined.
67
+ */
68
+
69
+
70
+ const getNodeAttributeValue = (node, attributeName, nodeName) => {
71
+ let attributeValue;
72
+
73
+ if (!nodeName || nodeName === node.nodeName.toUpperCase()) {
74
+ attributeValue = node.getAttribute(attributeName);
75
+ }
76
+
77
+ return attributeValue;
78
+ };
79
+ /**
80
+ * Extracts the children supported nodes attributes map
81
+ * @param {*} nodes The nodes array holding the children nodes.
82
+ * The returned map contains the supported not empty children attributes values.
83
+ * */
84
+
85
+
86
+ const getChildrenAttributes = nodes => {
87
+ const attributes = {
88
+ texts: []
89
+ };
90
+ nodes.supportedNodes.forEach(supportedNode => {
91
+ if (supportedNode.getAttribute) {
92
+ if (!attributes.alt) {
93
+ attributes.alt = truncateWhiteSpace(supportedNode.getAttribute("alt"));
94
+ }
95
+
96
+ if (!attributes.title) {
97
+ attributes.title = truncateWhiteSpace(supportedNode.getAttribute("title"));
98
+ }
99
+
100
+ if (!attributes.inputValue) {
101
+ attributes.inputValue = truncateWhiteSpace(getNodeAttributeValue(supportedNode, "value", "INPUT"));
102
+ }
103
+
104
+ if (!attributes.imgSrc) {
105
+ attributes.imgSrc = truncateWhiteSpace(getNodeAttributeValue(supportedNode, "src", "IMG"));
106
+ }
107
+ }
108
+
109
+ if (supportedNode.nodeValue) {
110
+ attributes.texts.push(supportedNode.nodeValue);
111
+ }
112
+ });
113
+ return attributes;
114
+ };
115
+ /**
116
+ * Extracts a link-name from a given node.
117
+ *
118
+ * The returned link-name is set to one of the following (in order of priority):
119
+ *
120
+ * 1. Clicked node innerText
121
+ * 2. Clicked node textContent
122
+ * 3. Clicked node and its child nodes nodeValue appended together.
123
+ * 4. Clicked node alt attribute or node descendant alt attribute.
124
+ * Whichever is found first.
125
+ * 5. Clicked node text attribute or node descendant text attribute.
126
+ * Whichever is found first.
127
+ * 6. Clicked node INPUT descendant value attribute.
128
+ * Whichever is found first.
129
+ * 7. Clicked node IMG descendant src attribute.
130
+ * Whichever is found first.
131
+ *
132
+ * @param {*} node The node to find link text for.
133
+ * @returns {string} link-name or an empty string if not link-name is found.
134
+ */
135
+
136
+
137
+ export default (node => {
138
+ let nodeText = truncateWhiteSpace(node.innerText || node.textContent);
139
+ const nodes = extractSupportedNodes(node); // if contains unsupported nodes we want children node attributes
140
+
141
+ if (!nodeText || nodes.includesUnsupportedNodes) {
142
+ const attributesMap = getChildrenAttributes(nodes);
143
+ nodeText = truncateWhiteSpace(attributesMap.texts.join(""));
144
+
145
+ if (!nodeText) {
146
+ nodeText = attributesMap.alt || attributesMap.title || attributesMap.inputValue || attributesMap.imgSrc;
147
+ }
148
+ }
149
+
150
+ return nodeText || "";
151
+ });
@@ -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
+ import { truncateWhiteSpace } from "./utils";
13
+ import { isNonEmptyString } from "../../utils";
14
+ const semanticElements = /^(HEADER|MAIN|FOOTER|NAV)$/i;
15
+
16
+ const getAriaRegionLabel = node => {
17
+ let regionLabel;
18
+
19
+ if (node.role === "region" && isNonEmptyString(node["aria-label"])) {
20
+ regionLabel = node["aria-label"];
21
+ }
22
+
23
+ return regionLabel;
24
+ };
25
+
26
+ const getSectionNodeName = node => {
27
+ let nodeName;
28
+
29
+ if (node && node.nodeName) {
30
+ if (node.nodeName.match(semanticElements)) {
31
+ nodeName = node.nodeName;
32
+ }
33
+ }
34
+
35
+ return nodeName;
36
+ };
37
+ /**
38
+ * Extracts a node link-region.
39
+ *
40
+ * The link-region is determined by traversing up the DOM
41
+ * looking for a region that is determined in order of priority:
42
+ *
43
+ * 1. element.id
44
+ * 2. Aria region label
45
+ * 3. Semantic element name
46
+ * 4. BODY (if no other link-region is found).
47
+ *
48
+ * @param {*} node The node to find link region for.
49
+ * @returns {string} link-region.
50
+ */
51
+
52
+
53
+ export default (node => {
54
+ let linkParentNode = node.parentNode;
55
+ let regionName;
56
+
57
+ while (linkParentNode) {
58
+ regionName = truncateWhiteSpace(linkParentNode.id || getAriaRegionLabel(linkParentNode) || getSectionNodeName(linkParentNode));
59
+
60
+ if (regionName) {
61
+ return regionName;
62
+ }
63
+
64
+ linkParentNode = linkParentNode.parentNode;
65
+ }
66
+
67
+ return "BODY";
68
+ });
@@ -12,13 +12,30 @@ governing permissions and limitations under the License.
12
12
  import attachClickActivityCollector from "./attachClickActivityCollector";
13
13
  import configValidators from "./configValidators";
14
14
  import createLinkClick from "./createLinkClick";
15
+ import createGetLinkDetails from "./createGetLinkDetails";
16
+ import getLinkName from "./getLinkName";
17
+ import getLinkRegion from "./getLinkRegion";
18
+ import { determineLinkType, findSupportedAnchorElement, getAbsoluteUrlFromAnchorElement } from "./utils";
19
+ const getLinkDetails = createGetLinkDetails({
20
+ window,
21
+ getLinkName,
22
+ getLinkRegion,
23
+ getAbsoluteUrlFromAnchorElement,
24
+ findSupportedAnchorElement,
25
+ determineLinkType
26
+ });
15
27
 
16
28
  const createActivityCollector = ({
17
29
  config,
18
30
  eventManager,
19
- handleError
31
+ handleError,
32
+ logger
20
33
  }) => {
21
- const linkClick = createLinkClick(window, config);
34
+ const linkClick = createLinkClick({
35
+ getLinkDetails,
36
+ config,
37
+ logger
38
+ });
22
39
  return {
23
40
  lifecycle: {
24
41
  onComponentsRegistered(tools) {
@@ -26,7 +43,6 @@ const createActivityCollector = ({
26
43
  lifecycle
27
44
  } = tools;
28
45
  attachClickActivityCollector({
29
- config,
30
46
  eventManager,
31
47
  lifecycle,
32
48
  handleError
@@ -37,7 +53,10 @@ const createActivityCollector = ({
37
53
  event,
38
54
  clickedElement
39
55
  }) {
40
- linkClick(event, clickedElement);
56
+ linkClick({
57
+ targetElement: clickedElement,
58
+ event
59
+ });
41
60
  }
42
61
 
43
62
  }
@@ -46,4 +65,20 @@ const createActivityCollector = ({
46
65
 
47
66
  createActivityCollector.namespace = "ActivityCollector";
48
67
  createActivityCollector.configValidators = configValidators;
68
+
69
+ createActivityCollector.buildOnInstanceConfiguredExtraParams = ({
70
+ config,
71
+ logger
72
+ }) => {
73
+ return {
74
+ getLinkDetails: targetElement => {
75
+ return getLinkDetails({
76
+ targetElement,
77
+ config,
78
+ logger
79
+ });
80
+ }
81
+ };
82
+ };
83
+
49
84
  export default createActivityCollector;
@@ -68,5 +68,47 @@ const isExitLink = (window, linkUrl) => {
68
68
 
69
69
  return true;
70
70
  };
71
+ /**
72
+ * Reduces repeated whitespace within a string. Whitespace surrounding the string
73
+ * is trimmed and any occurrence of whitespace within the string is replaced with
74
+ * a single space.
75
+ * @param {string} str String to be formatted.
76
+ * @returns {string} Formatted string.
77
+ */
71
78
 
72
- export { urlStartsWithScheme, getAbsoluteUrlFromAnchorElement, isSupportedAnchorElement, isDownloadLink, isExitLink };
79
+
80
+ const truncateWhiteSpace = str => {
81
+ return str && str.replace(/\s+/g, " ").trim();
82
+ };
83
+
84
+ const isEmptyString = str => {
85
+ return !str || str.length === 0;
86
+ };
87
+
88
+ const determineLinkType = (window, config, linkUrl, clickedObj) => {
89
+ let linkType = "other";
90
+
91
+ if (isDownloadLink(config.downloadLinkQualifier, linkUrl, clickedObj)) {
92
+ linkType = "download";
93
+ } else if (isExitLink(window, linkUrl)) {
94
+ linkType = "exit";
95
+ }
96
+
97
+ return linkType;
98
+ };
99
+
100
+ const findSupportedAnchorElement = targetElement => {
101
+ let node = targetElement;
102
+
103
+ while (node) {
104
+ if (isSupportedAnchorElement(node)) {
105
+ return node;
106
+ }
107
+
108
+ node = node.parentNode;
109
+ }
110
+
111
+ return null;
112
+ };
113
+
114
+ export { urlStartsWithScheme, getAbsoluteUrlFromAnchorElement, isSupportedAnchorElement, isDownloadLink, isEmptyString, isExitLink, truncateWhiteSpace, findSupportedAnchorElement, determineLinkType };
@@ -11,4 +11,4 @@ governing permissions and limitations under the License.
11
11
  */
12
12
  // The __VERSION__ keyword will be replace at alloy build time with the package.json version.
13
13
  // see babel-plugin-version
14
- export default "2.15.0-alpha.0";
14
+ export default "2.15.0-alpha.1";
@@ -34,6 +34,21 @@ const transformOptions = (schema, options) => {
34
34
  }
35
35
  };
36
36
 
37
+ const buildAllOnInstanceConfiguredExtraParams = (config, logger, componentCreators) => {
38
+ return componentCreators.reduce((memo, {
39
+ buildOnInstanceConfiguredExtraParams
40
+ }) => {
41
+ if (buildOnInstanceConfiguredExtraParams) {
42
+ assign(memo, buildOnInstanceConfiguredExtraParams({
43
+ config,
44
+ logger
45
+ }));
46
+ }
47
+
48
+ return memo;
49
+ }, {});
50
+ };
51
+
37
52
  export default (({
38
53
  options,
39
54
  componentCreators,
@@ -46,8 +61,10 @@ export default (({
46
61
  const config = createConfig(transformOptions(schema, options));
47
62
  setDebugEnabled(config.debugEnabled, {
48
63
  fromConfig: true
49
- });
50
- logger.logOnInstanceConfigured({
64
+ }); // eslint-disable-next-line no-underscore-dangle
65
+
66
+ const extraParams = buildAllOnInstanceConfiguredExtraParams(config, logger, componentCreators);
67
+ logger.logOnInstanceConfigured({ ...extraParams,
51
68
  config
52
69
  });
53
70
  return config;
@@ -9,6 +9,10 @@ the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTA
9
9
  OF ANY KIND, either express or implied. See the License for the specific language
10
10
  governing permissions and limitations under the License.
11
11
  */
12
+ // This is the only place where core is allowed to import from components.
13
+ // This makes sure that each component could be removed without breaking the library
14
+
15
+ /* eslint-disable import/no-restricted-paths */
12
16
  import createDataCollector from "../components/DataCollector";
13
17
  import createActivityCollector from "../components/ActivityCollector";
14
18
  import createIdentity from "../components/Identity";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@adobe/alloy",
3
- "version": "2.15.0-alpha.0",
3
+ "version": "2.15.0-alpha.1",
4
4
  "description": "Adobe Experience Platform Web SDK",
5
5
  "main": "libEs5/index.js",
6
6
  "module": "libEs6/index.js",
@@ -64,7 +64,7 @@
64
64
  "uuid": "^3.3.2"
65
65
  },
66
66
  "devDependencies": {
67
- "@adobe/alloy": "^2.14.0",
67
+ "@adobe/alloy": "^2.15.0-alpha.0",
68
68
  "@babel/cli": "^7.12.8",
69
69
  "@babel/core": "^7.2.2",
70
70
  "@babel/plugin-proposal-object-rest-spread": "^7.3.2",