@adobe/alloy 2.19.0-beta.8 → 2.19.0-beta.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/libEs5/components/Personalization/constants/scopeType.js +6 -2
- package/libEs5/components/Personalization/createClickStorage.js +21 -13
- package/libEs5/components/Personalization/createOnClickHandler.js +4 -5
- package/libEs5/components/Personalization/createViewCacheManager.js +2 -1
- package/libEs5/components/Personalization/dom-actions/clicks/collectClicks.js +43 -23
- package/libEs5/components/Personalization/handlers/createProcessDomAction.js +7 -1
- package/libEs5/components/Personalization/handlers/createProcessRedirect.js +1 -1
- package/libEs5/components/Personalization/handlers/injectCreateProposition.js +13 -15
- package/libEs5/constants/libraryVersion.js +1 -1
- package/libEs6/components/Personalization/constants/scopeType.js +3 -1
- package/libEs6/components/Personalization/createClickStorage.js +18 -10
- package/libEs6/components/Personalization/createOnClickHandler.js +5 -6
- package/libEs6/components/Personalization/createViewCacheManager.js +2 -1
- package/libEs6/components/Personalization/dom-actions/clicks/collectClicks.js +28 -12
- package/libEs6/components/Personalization/handlers/createProcessDomAction.js +5 -1
- package/libEs6/components/Personalization/handlers/createProcessRedirect.js +1 -1
- package/libEs6/components/Personalization/handlers/injectCreateProposition.js +12 -15
- package/libEs6/constants/libraryVersion.js +1 -1
- package/package.json +1 -1
- package/libEs5/components/Personalization/utils/isPageWideScope.js +0 -20
- package/libEs6/components/Personalization/utils/isPageWideScope.js +0 -15
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
exports.VIEW_SCOPE_TYPE = void 0;
|
|
3
|
+
exports.VIEW_SCOPE_TYPE = exports.PROPOSITION_SCOPE_TYPE = exports.PAGE_SCOPE_TYPE = void 0;
|
|
4
4
|
/*
|
|
5
5
|
Copyright 2022 Adobe. All rights reserved.
|
|
6
6
|
This file is licensed to you under the Apache License, Version 2.0 (the "License");
|
|
@@ -14,4 +14,8 @@ governing permissions and limitations under the License.
|
|
|
14
14
|
*/
|
|
15
15
|
|
|
16
16
|
var VIEW_SCOPE_TYPE = "view";
|
|
17
|
-
exports.VIEW_SCOPE_TYPE = VIEW_SCOPE_TYPE;
|
|
17
|
+
exports.VIEW_SCOPE_TYPE = VIEW_SCOPE_TYPE;
|
|
18
|
+
var PAGE_SCOPE_TYPE = "page";
|
|
19
|
+
exports.PAGE_SCOPE_TYPE = PAGE_SCOPE_TYPE;
|
|
20
|
+
var PROPOSITION_SCOPE_TYPE = "proposition";
|
|
21
|
+
exports.PROPOSITION_SCOPE_TYPE = PROPOSITION_SCOPE_TYPE;
|
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
exports.default = void 0;
|
|
4
|
+
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; }
|
|
5
|
+
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; }
|
|
6
|
+
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; }
|
|
4
7
|
/*
|
|
5
8
|
Copyright 2020 Adobe. All rights reserved.
|
|
6
9
|
This file is licensed to you under the Apache License, Version 2.0 (the "License");
|
|
@@ -15,24 +18,29 @@ governing permissions and limitations under the License.
|
|
|
15
18
|
|
|
16
19
|
var metasToArray = function metasToArray(metas) {
|
|
17
20
|
return Object.keys(metas).map(function (key) {
|
|
18
|
-
return {
|
|
19
|
-
id: key
|
|
20
|
-
|
|
21
|
-
scopeDetails: metas[key].scopeDetails,
|
|
22
|
-
trackingLabel: metas[key].trackingLabel
|
|
23
|
-
};
|
|
21
|
+
return _objectSpread({
|
|
22
|
+
id: key
|
|
23
|
+
}, metas[key]);
|
|
24
24
|
});
|
|
25
25
|
};
|
|
26
26
|
var _default = function _default() {
|
|
27
27
|
var clickStorage = {};
|
|
28
|
-
var storeClickMetrics = function storeClickMetrics(
|
|
29
|
-
|
|
30
|
-
|
|
28
|
+
var storeClickMetrics = function storeClickMetrics(_ref) {
|
|
29
|
+
var selector = _ref.selector,
|
|
30
|
+
_ref$meta = _ref.meta,
|
|
31
|
+
id = _ref$meta.id,
|
|
32
|
+
scope = _ref$meta.scope,
|
|
33
|
+
scopeDetails = _ref$meta.scopeDetails,
|
|
34
|
+
trackingLabel = _ref$meta.trackingLabel,
|
|
35
|
+
scopeType = _ref$meta.scopeType;
|
|
36
|
+
if (!clickStorage[selector]) {
|
|
37
|
+
clickStorage[selector] = {};
|
|
31
38
|
}
|
|
32
|
-
clickStorage[
|
|
33
|
-
scope:
|
|
34
|
-
scopeDetails:
|
|
35
|
-
trackingLabel:
|
|
39
|
+
clickStorage[selector][id] = {
|
|
40
|
+
scope: scope,
|
|
41
|
+
scopeDetails: scopeDetails,
|
|
42
|
+
trackingLabel: trackingLabel,
|
|
43
|
+
scopeType: scopeType
|
|
36
44
|
};
|
|
37
45
|
};
|
|
38
46
|
var getClickSelectors = function getClickSelectors() {
|
|
@@ -4,7 +4,6 @@ exports.default = void 0;
|
|
|
4
4
|
var _utils = require("../../utils");
|
|
5
5
|
var _eventType = require("./constants/eventType");
|
|
6
6
|
var _propositionEventType = require("./constants/propositionEventType");
|
|
7
|
-
var _pageWideScope = require("../../constants/pageWideScope");
|
|
8
7
|
/*
|
|
9
8
|
Copyright 2020 Adobe. All rights reserved.
|
|
10
9
|
This file is licensed to you under the Apache License, Version 2.0 (the "License");
|
|
@@ -29,16 +28,16 @@ var _default = function _default(_ref) {
|
|
|
29
28
|
if ((0, _utils.isNonEmptyArray)(selectors)) {
|
|
30
29
|
var _collectClicks = collectClicks(clickedElement, selectors, getClickMetasBySelector),
|
|
31
30
|
decisionsMeta = _collectClicks.decisionsMeta,
|
|
32
|
-
eventLabel = _collectClicks.eventLabel
|
|
31
|
+
eventLabel = _collectClicks.eventLabel,
|
|
32
|
+
viewName = _collectClicks.viewName;
|
|
33
33
|
if ((0, _utils.isNonEmptyArray)(decisionsMeta)) {
|
|
34
34
|
var xdm = {
|
|
35
35
|
eventType: _eventType.INTERACT
|
|
36
36
|
};
|
|
37
|
-
|
|
38
|
-
if ((0, _utils.isNonEmptyString)(scope) && scope !== _pageWideScope.default) {
|
|
37
|
+
if (viewName) {
|
|
39
38
|
xdm.web = {
|
|
40
39
|
webPageDetails: {
|
|
41
|
-
viewName:
|
|
40
|
+
viewName: viewName
|
|
42
41
|
}
|
|
43
42
|
};
|
|
44
43
|
}
|
|
@@ -4,6 +4,7 @@ exports.default = void 0;
|
|
|
4
4
|
var _utils = require("../../utils");
|
|
5
5
|
var _defer = require("../../utils/defer");
|
|
6
6
|
var _schema = require("./constants/schema");
|
|
7
|
+
var _scopeType = require("./constants/scopeType");
|
|
7
8
|
/*
|
|
8
9
|
Copyright 2020 Adobe. All rights reserved.
|
|
9
10
|
This file is licensed to you under the Apache License, Version 2.0 (the "License");
|
|
@@ -28,7 +29,7 @@ var _default = function _default(_ref) {
|
|
|
28
29
|
scope: viewName,
|
|
29
30
|
scopeDetails: {
|
|
30
31
|
characteristics: {
|
|
31
|
-
scopeType:
|
|
32
|
+
scopeType: _scopeType.VIEW_SCOPE_TYPE
|
|
32
33
|
}
|
|
33
34
|
},
|
|
34
35
|
items: [{
|
|
@@ -2,22 +2,27 @@
|
|
|
2
2
|
|
|
3
3
|
exports.default = void 0;
|
|
4
4
|
var _matchesSelectorWithEq = require("../dom/matchesSelectorWithEq");
|
|
5
|
+
var _scopeType = require("../../constants/scopeType");
|
|
6
|
+
var _excluded = ["trackingLabel", "scopeType"];
|
|
7
|
+
/*
|
|
8
|
+
Copyright 2019 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
|
+
*/
|
|
5
18
|
function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
|
|
6
19
|
function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
7
20
|
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
8
21
|
function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
|
|
9
22
|
function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
|
|
10
|
-
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
you may not use this file except in compliance with the License. You may obtain a copy
|
|
14
|
-
of the License at http://www.apache.org/licenses/LICENSE-2.0
|
|
15
|
-
|
|
16
|
-
Unless required by applicable law or agreed to in writing, software distributed under
|
|
17
|
-
the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
|
|
18
|
-
OF ANY KIND, either express or implied. See the License for the specific language
|
|
19
|
-
governing permissions and limitations under the License.
|
|
20
|
-
*/
|
|
23
|
+
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
|
|
24
|
+
function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
|
|
25
|
+
function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
|
|
21
26
|
var getMetasIfMatches = function getMetasIfMatches(clickedElement, selector, getClickMetasBySelector) {
|
|
22
27
|
var _document = document,
|
|
23
28
|
documentElement = _document.documentElement;
|
|
@@ -26,19 +31,24 @@ var getMetasIfMatches = function getMetasIfMatches(clickedElement, selector, get
|
|
|
26
31
|
while (element && element !== documentElement) {
|
|
27
32
|
if ((0, _matchesSelectorWithEq.default)(selector, element)) {
|
|
28
33
|
var matchedMetas = getClickMetasBySelector(selector);
|
|
34
|
+
var returnValue = {
|
|
35
|
+
metas: matchedMetas
|
|
36
|
+
};
|
|
29
37
|
var foundMetaWithLabel = matchedMetas.find(function (meta) {
|
|
30
38
|
return meta.trackingLabel;
|
|
31
39
|
});
|
|
32
40
|
if (foundMetaWithLabel) {
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
label: foundMetaWithLabel.trackingLabel,
|
|
36
|
-
weight: i
|
|
37
|
-
};
|
|
41
|
+
returnValue.label = foundMetaWithLabel.trackingLabel;
|
|
42
|
+
returnValue.weight = i;
|
|
38
43
|
}
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
};
|
|
44
|
+
var foundMetaWithScopeTypeView = matchedMetas.find(function (meta) {
|
|
45
|
+
return meta.scopeType === _scopeType.VIEW_SCOPE_TYPE;
|
|
46
|
+
});
|
|
47
|
+
if (foundMetaWithScopeTypeView) {
|
|
48
|
+
returnValue.viewName = foundMetaWithScopeTypeView.scope;
|
|
49
|
+
returnValue.weight = i;
|
|
50
|
+
}
|
|
51
|
+
return returnValue;
|
|
42
52
|
}
|
|
43
53
|
element = element.parentNode;
|
|
44
54
|
i += 1;
|
|
@@ -49,8 +59,10 @@ var getMetasIfMatches = function getMetasIfMatches(clickedElement, selector, get
|
|
|
49
59
|
};
|
|
50
60
|
var cleanMetas = function cleanMetas(metas) {
|
|
51
61
|
return metas.map(function (meta) {
|
|
52
|
-
|
|
53
|
-
|
|
62
|
+
var trackingLabel = meta.trackingLabel,
|
|
63
|
+
scopeType = meta.scopeType,
|
|
64
|
+
rest = _objectWithoutProperties(meta, _excluded);
|
|
65
|
+
return rest;
|
|
54
66
|
});
|
|
55
67
|
};
|
|
56
68
|
var dedupMetas = function dedupMetas(metas) {
|
|
@@ -65,13 +77,16 @@ var _default = function _default(clickedElement, selectors, getClickMetasBySelec
|
|
|
65
77
|
var result = [];
|
|
66
78
|
var resultLabel = "";
|
|
67
79
|
var resultLabelWeight = Number.MAX_SAFE_INTEGER;
|
|
80
|
+
var resultViewName;
|
|
81
|
+
var resultViewNameWeight = Number.MAX_SAFE_INTEGER;
|
|
68
82
|
|
|
69
83
|
/* eslint-disable no-continue */
|
|
70
84
|
for (var i = 0; i < selectors.length; i += 1) {
|
|
71
85
|
var _getMetasIfMatches = getMetasIfMatches(clickedElement, selectors[i], getClickMetasBySelector),
|
|
72
86
|
metas = _getMetasIfMatches.metas,
|
|
73
87
|
label = _getMetasIfMatches.label,
|
|
74
|
-
weight = _getMetasIfMatches.weight
|
|
88
|
+
weight = _getMetasIfMatches.weight,
|
|
89
|
+
viewName = _getMetasIfMatches.viewName;
|
|
75
90
|
if (!metas) {
|
|
76
91
|
continue;
|
|
77
92
|
}
|
|
@@ -79,11 +94,16 @@ var _default = function _default(clickedElement, selectors, getClickMetasBySelec
|
|
|
79
94
|
resultLabel = label;
|
|
80
95
|
resultLabelWeight = weight;
|
|
81
96
|
}
|
|
97
|
+
if (viewName && weight <= resultViewNameWeight) {
|
|
98
|
+
resultViewName = viewName;
|
|
99
|
+
resultViewNameWeight = weight;
|
|
100
|
+
}
|
|
82
101
|
result.push.apply(result, _toConsumableArray(cleanMetas(metas)));
|
|
83
102
|
}
|
|
84
103
|
return {
|
|
85
104
|
decisionsMeta: dedupMetas(result),
|
|
86
|
-
eventLabel: resultLabel
|
|
105
|
+
eventLabel: resultLabel,
|
|
106
|
+
viewName: resultViewName
|
|
87
107
|
};
|
|
88
108
|
};
|
|
89
109
|
exports.default = _default;
|
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
exports.default = void 0;
|
|
4
|
+
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; }
|
|
5
|
+
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; }
|
|
6
|
+
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; }
|
|
4
7
|
/*
|
|
5
8
|
Copyright 2023 Adobe. All rights reserved.
|
|
6
9
|
This file is licensed to you under the Apache License, Version 2.0 (the "License");
|
|
@@ -37,7 +40,10 @@ var _default = function _default(_ref) {
|
|
|
37
40
|
}
|
|
38
41
|
storeClickMetrics({
|
|
39
42
|
selector: selector,
|
|
40
|
-
meta: item.
|
|
43
|
+
meta: _objectSpread(_objectSpread({}, item.getProposition().getNotification()), {}, {
|
|
44
|
+
trackingLabel: item.getTrackingLabel(),
|
|
45
|
+
scopeType: item.getProposition().getScopeType()
|
|
46
|
+
})
|
|
41
47
|
});
|
|
42
48
|
return {
|
|
43
49
|
setRenderAttempted: true,
|
|
@@ -25,7 +25,7 @@ var _default = function _default(_ref) {
|
|
|
25
25
|
}
|
|
26
26
|
var render = function render() {
|
|
27
27
|
return collect({
|
|
28
|
-
decisionsMeta: [item.
|
|
28
|
+
decisionsMeta: [item.getProposition().getNotification()],
|
|
29
29
|
documentMayUnload: true
|
|
30
30
|
}).then(function () {
|
|
31
31
|
executeRedirect(content);
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
exports.default = void 0;
|
|
4
4
|
var _pageWideScope = require("../../../constants/pageWideScope");
|
|
5
|
+
var _scopeType = require("../constants/scopeType");
|
|
5
6
|
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; }
|
|
6
7
|
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; }
|
|
7
8
|
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; } /*
|
|
@@ -18,16 +19,13 @@ function _defineProperty(obj, key, value) { if (key in obj) { Object.definePrope
|
|
|
18
19
|
var _default = function _default(_ref) {
|
|
19
20
|
var preprocess = _ref.preprocess,
|
|
20
21
|
isPageWideSurface = _ref.isPageWideSurface;
|
|
21
|
-
var createItem = function createItem(item,
|
|
22
|
+
var createItem = function createItem(item, proposition) {
|
|
22
23
|
var schema = item.schema,
|
|
23
24
|
data = item.data,
|
|
24
25
|
_item$characteristics = item.characteristics;
|
|
25
26
|
_item$characteristics = _item$characteristics === void 0 ? {} : _item$characteristics;
|
|
26
27
|
var trackingLabel = _item$characteristics.trackingLabel;
|
|
27
28
|
var processedData = preprocess(data);
|
|
28
|
-
if (trackingLabel) {
|
|
29
|
-
meta.trackingLabel = trackingLabel;
|
|
30
|
-
}
|
|
31
29
|
return {
|
|
32
30
|
getSchema: function getSchema() {
|
|
33
31
|
return schema;
|
|
@@ -35,8 +33,11 @@ var _default = function _default(_ref) {
|
|
|
35
33
|
getData: function getData() {
|
|
36
34
|
return processedData;
|
|
37
35
|
},
|
|
38
|
-
|
|
39
|
-
return
|
|
36
|
+
getProposition: function getProposition() {
|
|
37
|
+
return proposition;
|
|
38
|
+
},
|
|
39
|
+
getTrackingLabel: function getTrackingLabel() {
|
|
40
|
+
return trackingLabel;
|
|
40
41
|
},
|
|
41
42
|
getOriginalItem: function getOriginalItem() {
|
|
42
43
|
return item;
|
|
@@ -69,20 +70,17 @@ var _default = function _default(_ref) {
|
|
|
69
70
|
},
|
|
70
71
|
getScopeType: function getScopeType() {
|
|
71
72
|
if (scope === _pageWideScope.default || isPageWideSurface(scope)) {
|
|
72
|
-
return
|
|
73
|
+
return _scopeType.PAGE_SCOPE_TYPE;
|
|
73
74
|
}
|
|
74
|
-
if (scopeType ===
|
|
75
|
-
return
|
|
75
|
+
if (scopeType === _scopeType.VIEW_SCOPE_TYPE) {
|
|
76
|
+
return _scopeType.VIEW_SCOPE_TYPE;
|
|
76
77
|
}
|
|
77
|
-
return
|
|
78
|
+
return _scopeType.PROPOSITION_SCOPE_TYPE;
|
|
78
79
|
},
|
|
79
80
|
getItems: function getItems() {
|
|
81
|
+
var _this = this;
|
|
80
82
|
return items.map(function (item) {
|
|
81
|
-
return createItem(item,
|
|
82
|
-
id: id,
|
|
83
|
-
scope: scope,
|
|
84
|
-
scopeDetails: scopeDetails
|
|
85
|
-
});
|
|
83
|
+
return createItem(item, _this);
|
|
86
84
|
});
|
|
87
85
|
},
|
|
88
86
|
getNotification: function getNotification() {
|
|
@@ -14,5 +14,5 @@ governing permissions and limitations under the License.
|
|
|
14
14
|
*/
|
|
15
15
|
// The __VERSION__ keyword will be replace at alloy build time with the package.json version.
|
|
16
16
|
// see babel-plugin-version
|
|
17
|
-
var _default = "2.19.0-beta.
|
|
17
|
+
var _default = "2.19.0-beta.9";
|
|
18
18
|
exports.default = _default;
|
|
@@ -10,4 +10,6 @@ OF ANY KIND, either express or implied. See the License for the specific languag
|
|
|
10
10
|
governing permissions and limitations under the License.
|
|
11
11
|
*/
|
|
12
12
|
|
|
13
|
-
export const VIEW_SCOPE_TYPE = "view";
|
|
13
|
+
export const VIEW_SCOPE_TYPE = "view";
|
|
14
|
+
export const PAGE_SCOPE_TYPE = "page";
|
|
15
|
+
export const PROPOSITION_SCOPE_TYPE = "proposition";
|
|
@@ -14,22 +14,30 @@ const metasToArray = metas => {
|
|
|
14
14
|
return Object.keys(metas).map(key => {
|
|
15
15
|
return {
|
|
16
16
|
id: key,
|
|
17
|
-
|
|
18
|
-
scopeDetails: metas[key].scopeDetails,
|
|
19
|
-
trackingLabel: metas[key].trackingLabel
|
|
17
|
+
...metas[key]
|
|
20
18
|
};
|
|
21
19
|
});
|
|
22
20
|
};
|
|
23
21
|
export default (() => {
|
|
24
22
|
const clickStorage = {};
|
|
25
|
-
const storeClickMetrics =
|
|
26
|
-
|
|
27
|
-
|
|
23
|
+
const storeClickMetrics = ({
|
|
24
|
+
selector,
|
|
25
|
+
meta: {
|
|
26
|
+
id,
|
|
27
|
+
scope,
|
|
28
|
+
scopeDetails,
|
|
29
|
+
trackingLabel,
|
|
30
|
+
scopeType
|
|
28
31
|
}
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
32
|
+
}) => {
|
|
33
|
+
if (!clickStorage[selector]) {
|
|
34
|
+
clickStorage[selector] = {};
|
|
35
|
+
}
|
|
36
|
+
clickStorage[selector][id] = {
|
|
37
|
+
scope,
|
|
38
|
+
scopeDetails,
|
|
39
|
+
trackingLabel,
|
|
40
|
+
scopeType
|
|
33
41
|
};
|
|
34
42
|
};
|
|
35
43
|
const getClickSelectors = () => {
|
|
@@ -10,10 +10,9 @@ OF ANY KIND, either express or implied. See the License for the specific languag
|
|
|
10
10
|
governing permissions and limitations under the License.
|
|
11
11
|
*/
|
|
12
12
|
|
|
13
|
-
import { isNonEmptyArray
|
|
13
|
+
import { isNonEmptyArray } from "../../utils";
|
|
14
14
|
import { INTERACT } from "./constants/eventType";
|
|
15
15
|
import { PropositionEventType } from "./constants/propositionEventType";
|
|
16
|
-
import PAGE_WIDE_SCOPE from "../../constants/pageWideScope";
|
|
17
16
|
export default (({
|
|
18
17
|
mergeDecisionsMeta,
|
|
19
18
|
collectClicks,
|
|
@@ -29,17 +28,17 @@ export default (({
|
|
|
29
28
|
if (isNonEmptyArray(selectors)) {
|
|
30
29
|
const {
|
|
31
30
|
decisionsMeta,
|
|
32
|
-
eventLabel
|
|
31
|
+
eventLabel,
|
|
32
|
+
viewName
|
|
33
33
|
} = collectClicks(clickedElement, selectors, getClickMetasBySelector);
|
|
34
34
|
if (isNonEmptyArray(decisionsMeta)) {
|
|
35
35
|
const xdm = {
|
|
36
36
|
eventType: INTERACT
|
|
37
37
|
};
|
|
38
|
-
|
|
39
|
-
if (isNonEmptyString(scope) && scope !== PAGE_WIDE_SCOPE) {
|
|
38
|
+
if (viewName) {
|
|
40
39
|
xdm.web = {
|
|
41
40
|
webPageDetails: {
|
|
42
|
-
viewName
|
|
41
|
+
viewName
|
|
43
42
|
}
|
|
44
43
|
};
|
|
45
44
|
}
|
|
@@ -13,6 +13,7 @@ governing permissions and limitations under the License.
|
|
|
13
13
|
import { groupBy } from "../../utils";
|
|
14
14
|
import defer from "../../utils/defer";
|
|
15
15
|
import { DEFAULT_CONTENT_ITEM } from "./constants/schema";
|
|
16
|
+
import { VIEW_SCOPE_TYPE } from "./constants/scopeType";
|
|
16
17
|
export default (({
|
|
17
18
|
createProposition
|
|
18
19
|
}) => {
|
|
@@ -27,7 +28,7 @@ export default (({
|
|
|
27
28
|
scope: viewName,
|
|
28
29
|
scopeDetails: {
|
|
29
30
|
characteristics: {
|
|
30
|
-
scopeType:
|
|
31
|
+
scopeType: VIEW_SCOPE_TYPE
|
|
31
32
|
}
|
|
32
33
|
},
|
|
33
34
|
items: [{
|
|
@@ -11,6 +11,7 @@ governing permissions and limitations under the License.
|
|
|
11
11
|
*/
|
|
12
12
|
|
|
13
13
|
import matchesSelectorWithEq from "../dom/matchesSelectorWithEq";
|
|
14
|
+
import { VIEW_SCOPE_TYPE } from "../../constants/scopeType";
|
|
14
15
|
const getMetasIfMatches = (clickedElement, selector, getClickMetasBySelector) => {
|
|
15
16
|
const {
|
|
16
17
|
documentElement
|
|
@@ -20,17 +21,20 @@ const getMetasIfMatches = (clickedElement, selector, getClickMetasBySelector) =>
|
|
|
20
21
|
while (element && element !== documentElement) {
|
|
21
22
|
if (matchesSelectorWithEq(selector, element)) {
|
|
22
23
|
const matchedMetas = getClickMetasBySelector(selector);
|
|
24
|
+
const returnValue = {
|
|
25
|
+
metas: matchedMetas
|
|
26
|
+
};
|
|
23
27
|
const foundMetaWithLabel = matchedMetas.find(meta => meta.trackingLabel);
|
|
24
28
|
if (foundMetaWithLabel) {
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
label: foundMetaWithLabel.trackingLabel,
|
|
28
|
-
weight: i
|
|
29
|
-
};
|
|
29
|
+
returnValue.label = foundMetaWithLabel.trackingLabel;
|
|
30
|
+
returnValue.weight = i;
|
|
30
31
|
}
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
32
|
+
const foundMetaWithScopeTypeView = matchedMetas.find(meta => meta.scopeType === VIEW_SCOPE_TYPE);
|
|
33
|
+
if (foundMetaWithScopeTypeView) {
|
|
34
|
+
returnValue.viewName = foundMetaWithScopeTypeView.scope;
|
|
35
|
+
returnValue.weight = i;
|
|
36
|
+
}
|
|
37
|
+
return returnValue;
|
|
34
38
|
}
|
|
35
39
|
element = element.parentNode;
|
|
36
40
|
i += 1;
|
|
@@ -40,8 +44,12 @@ const getMetasIfMatches = (clickedElement, selector, getClickMetasBySelector) =>
|
|
|
40
44
|
};
|
|
41
45
|
};
|
|
42
46
|
const cleanMetas = metas => metas.map(meta => {
|
|
43
|
-
|
|
44
|
-
|
|
47
|
+
const {
|
|
48
|
+
trackingLabel,
|
|
49
|
+
scopeType,
|
|
50
|
+
...rest
|
|
51
|
+
} = meta;
|
|
52
|
+
return rest;
|
|
45
53
|
});
|
|
46
54
|
const dedupMetas = metas => metas.filter((meta, index) => {
|
|
47
55
|
const stringifiedMeta = JSON.stringify(meta);
|
|
@@ -51,13 +59,16 @@ export default ((clickedElement, selectors, getClickMetasBySelector) => {
|
|
|
51
59
|
const result = [];
|
|
52
60
|
let resultLabel = "";
|
|
53
61
|
let resultLabelWeight = Number.MAX_SAFE_INTEGER;
|
|
62
|
+
let resultViewName;
|
|
63
|
+
let resultViewNameWeight = Number.MAX_SAFE_INTEGER;
|
|
54
64
|
|
|
55
65
|
/* eslint-disable no-continue */
|
|
56
66
|
for (let i = 0; i < selectors.length; i += 1) {
|
|
57
67
|
const {
|
|
58
68
|
metas,
|
|
59
69
|
label,
|
|
60
|
-
weight
|
|
70
|
+
weight,
|
|
71
|
+
viewName
|
|
61
72
|
} = getMetasIfMatches(clickedElement, selectors[i], getClickMetasBySelector);
|
|
62
73
|
if (!metas) {
|
|
63
74
|
continue;
|
|
@@ -66,10 +77,15 @@ export default ((clickedElement, selectors, getClickMetasBySelector) => {
|
|
|
66
77
|
resultLabel = label;
|
|
67
78
|
resultLabelWeight = weight;
|
|
68
79
|
}
|
|
80
|
+
if (viewName && weight <= resultViewNameWeight) {
|
|
81
|
+
resultViewName = viewName;
|
|
82
|
+
resultViewNameWeight = weight;
|
|
83
|
+
}
|
|
69
84
|
result.push(...cleanMetas(metas));
|
|
70
85
|
}
|
|
71
86
|
return {
|
|
72
87
|
decisionsMeta: dedupMetas(result),
|
|
73
|
-
eventLabel: resultLabel
|
|
88
|
+
eventLabel: resultLabel,
|
|
89
|
+
viewName: resultViewName
|
|
74
90
|
};
|
|
75
91
|
});
|
|
@@ -35,7 +35,11 @@ export default (({
|
|
|
35
35
|
}
|
|
36
36
|
storeClickMetrics({
|
|
37
37
|
selector,
|
|
38
|
-
meta:
|
|
38
|
+
meta: {
|
|
39
|
+
...item.getProposition().getNotification(),
|
|
40
|
+
trackingLabel: item.getTrackingLabel(),
|
|
41
|
+
scopeType: item.getProposition().getScopeType()
|
|
42
|
+
}
|
|
39
43
|
});
|
|
40
44
|
return {
|
|
41
45
|
setRenderAttempted: true,
|
|
@@ -11,11 +11,12 @@ governing permissions and limitations under the License.
|
|
|
11
11
|
*/
|
|
12
12
|
|
|
13
13
|
import PAGE_WIDE_SCOPE from "../../../constants/pageWideScope";
|
|
14
|
+
import { VIEW_SCOPE_TYPE, PAGE_SCOPE_TYPE, PROPOSITION_SCOPE_TYPE } from "../constants/scopeType";
|
|
14
15
|
export default (({
|
|
15
16
|
preprocess,
|
|
16
17
|
isPageWideSurface
|
|
17
18
|
}) => {
|
|
18
|
-
const createItem = (item,
|
|
19
|
+
const createItem = (item, proposition) => {
|
|
19
20
|
const {
|
|
20
21
|
schema,
|
|
21
22
|
data,
|
|
@@ -24,9 +25,6 @@ export default (({
|
|
|
24
25
|
} = {}
|
|
25
26
|
} = item;
|
|
26
27
|
const processedData = preprocess(data);
|
|
27
|
-
if (trackingLabel) {
|
|
28
|
-
meta.trackingLabel = trackingLabel;
|
|
29
|
-
}
|
|
30
28
|
return {
|
|
31
29
|
getSchema() {
|
|
32
30
|
return schema;
|
|
@@ -34,8 +32,11 @@ export default (({
|
|
|
34
32
|
getData() {
|
|
35
33
|
return processedData;
|
|
36
34
|
},
|
|
37
|
-
|
|
38
|
-
return
|
|
35
|
+
getProposition() {
|
|
36
|
+
return proposition;
|
|
37
|
+
},
|
|
38
|
+
getTrackingLabel() {
|
|
39
|
+
return trackingLabel;
|
|
39
40
|
},
|
|
40
41
|
getOriginalItem() {
|
|
41
42
|
return item;
|
|
@@ -69,19 +70,15 @@ export default (({
|
|
|
69
70
|
},
|
|
70
71
|
getScopeType() {
|
|
71
72
|
if (scope === PAGE_WIDE_SCOPE || isPageWideSurface(scope)) {
|
|
72
|
-
return
|
|
73
|
+
return PAGE_SCOPE_TYPE;
|
|
73
74
|
}
|
|
74
|
-
if (scopeType ===
|
|
75
|
-
return
|
|
75
|
+
if (scopeType === VIEW_SCOPE_TYPE) {
|
|
76
|
+
return VIEW_SCOPE_TYPE;
|
|
76
77
|
}
|
|
77
|
-
return
|
|
78
|
+
return PROPOSITION_SCOPE_TYPE;
|
|
78
79
|
},
|
|
79
80
|
getItems() {
|
|
80
|
-
return items.map(item => createItem(item,
|
|
81
|
-
id,
|
|
82
|
-
scope,
|
|
83
|
-
scopeDetails
|
|
84
|
-
}));
|
|
81
|
+
return items.map(item => createItem(item, this));
|
|
85
82
|
},
|
|
86
83
|
getNotification() {
|
|
87
84
|
return {
|
package/package.json
CHANGED
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
exports.default = void 0;
|
|
4
|
-
var _surfaceUtils = require("./surfaceUtils");
|
|
5
|
-
var _pageWideScope = require("../../../constants/pageWideScope");
|
|
6
|
-
/*
|
|
7
|
-
Copyright 2022 Adobe. All rights reserved.
|
|
8
|
-
This file is licensed to you under the Apache License, Version 2.0 (the "License");
|
|
9
|
-
you may not use this file except in compliance with the License. You may obtain a copy
|
|
10
|
-
of the License at http://www.apache.org/licenses/LICENSE-2.0
|
|
11
|
-
|
|
12
|
-
Unless required by applicable law or agreed to in writing, software distributed under
|
|
13
|
-
the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
|
|
14
|
-
OF ANY KIND, either express or implied. See the License for the specific language
|
|
15
|
-
governing permissions and limitations under the License.
|
|
16
|
-
*/
|
|
17
|
-
var _default = function _default(scope) {
|
|
18
|
-
return scope === _pageWideScope.default || (0, _surfaceUtils.isPageWideSurface)(scope);
|
|
19
|
-
};
|
|
20
|
-
exports.default = _default;
|
|
@@ -1,15 +0,0 @@
|
|
|
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 { isPageWideSurface } from "./surfaceUtils";
|
|
14
|
-
import PAGE_WIDE_SCOPE from "../../../constants/pageWideScope";
|
|
15
|
-
export default (scope => scope === PAGE_WIDE_SCOPE || isPageWideSurface(scope));
|