@adobe/alloy 2.19.0-beta.7 → 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/DataCollector/index.js +12 -21
- package/libEs5/components/DataCollector/validateApplyResponse.js +2 -2
- package/libEs5/components/DataCollector/validateUserEventOptions.js +6 -4
- package/libEs5/components/Personalization/constants/scopeType.js +6 -2
- package/libEs5/components/Personalization/createApplyPropositions.js +4 -4
- package/libEs5/components/Personalization/createClickStorage.js +21 -13
- package/libEs5/components/Personalization/createComponent.js +3 -3
- package/libEs5/components/Personalization/createFetchDataHandler.js +5 -5
- package/libEs5/components/Personalization/createOnClickHandler.js +4 -5
- package/libEs5/components/Personalization/createPersonalizationDetails.js +6 -6
- package/libEs5/components/Personalization/createViewCacheManager.js +11 -11
- 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/components/Personalization/index.js +4 -4
- package/libEs5/constants/libraryVersion.js +1 -1
- package/libEs5/core/createEventManager.js +19 -26
- package/libEs6/components/DataCollector/index.js +7 -15
- package/libEs6/components/DataCollector/validateApplyResponse.js +2 -2
- package/libEs6/components/DataCollector/validateUserEventOptions.js +6 -4
- package/libEs6/components/Personalization/constants/scopeType.js +3 -1
- package/libEs6/components/Personalization/createApplyPropositions.js +4 -4
- package/libEs6/components/Personalization/createClickStorage.js +18 -10
- package/libEs6/components/Personalization/createComponent.js +3 -3
- package/libEs6/components/Personalization/createFetchDataHandler.js +5 -5
- package/libEs6/components/Personalization/createOnClickHandler.js +5 -6
- package/libEs6/components/Personalization/createPersonalizationDetails.js +6 -6
- package/libEs6/components/Personalization/createViewCacheManager.js +8 -10
- 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/components/Personalization/index.js +4 -4
- package/libEs6/constants/libraryVersion.js +1 -1
- package/libEs6/core/createEventManager.js +9 -19
- package/package.json +3 -3
- package/libEs5/components/Personalization/utils/isPageWideScope.js +0 -20
- package/libEs6/components/Personalization/utils/isPageWideScope.js +0 -15
|
@@ -4,6 +4,7 @@ exports.default = void 0;
|
|
|
4
4
|
var _validateUserEventOptions = require("./validateUserEventOptions");
|
|
5
5
|
var _validateApplyResponse = require("./validateApplyResponse");
|
|
6
6
|
var _utils = require("../../utils");
|
|
7
|
+
var _excluded = ["xdm", "data", "documentUnloading", "type", "mergeId", "datasetId", "edgeConfigOverrides"];
|
|
7
8
|
/*
|
|
8
9
|
Copyright 2019 Adobe. All rights reserved.
|
|
9
10
|
This file is licensed to you under the Apache License, Version 2.0 (the "License");
|
|
@@ -15,7 +16,8 @@ the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTA
|
|
|
15
16
|
OF ANY KIND, either express or implied. See the License for the specific language
|
|
16
17
|
governing permissions and limitations under the License.
|
|
17
18
|
*/
|
|
18
|
-
|
|
19
|
+
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; }
|
|
20
|
+
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; }
|
|
19
21
|
var createDataCollector = function createDataCollector(_ref) {
|
|
20
22
|
var eventManager = _ref.eventManager,
|
|
21
23
|
logger = _ref.logger;
|
|
@@ -31,18 +33,12 @@ var createDataCollector = function createDataCollector(_ref) {
|
|
|
31
33
|
run: function run(options) {
|
|
32
34
|
var xdm = options.xdm,
|
|
33
35
|
data = options.data,
|
|
34
|
-
|
|
35
|
-
documentUnloading = _options$documentUnlo === void 0 ? false : _options$documentUnlo,
|
|
36
|
+
documentUnloading = options.documentUnloading,
|
|
36
37
|
type = options.type,
|
|
37
38
|
mergeId = options.mergeId,
|
|
38
|
-
_options$renderDecisi = options.renderDecisions,
|
|
39
|
-
renderDecisions = _options$renderDecisi === void 0 ? false : _options$renderDecisi,
|
|
40
|
-
_options$decisionScop = options.decisionScopes,
|
|
41
|
-
decisionScopes = _options$decisionScop === void 0 ? [] : _options$decisionScop,
|
|
42
|
-
_options$personalizat = options.personalization,
|
|
43
|
-
personalization = _options$personalizat === void 0 ? {} : _options$personalizat,
|
|
44
39
|
datasetId = options.datasetId,
|
|
45
|
-
edgeConfigOverrides = options.edgeConfigOverrides
|
|
40
|
+
edgeConfigOverrides = options.edgeConfigOverrides,
|
|
41
|
+
eventManagerOptions = _objectWithoutProperties(options, _excluded);
|
|
46
42
|
var event = eventManager.createEvent();
|
|
47
43
|
if (documentUnloading) {
|
|
48
44
|
event.documentMayUnload();
|
|
@@ -59,18 +55,13 @@ var createDataCollector = function createDataCollector(_ref) {
|
|
|
59
55
|
eventMergeId: mergeId
|
|
60
56
|
});
|
|
61
57
|
}
|
|
62
|
-
var sendEventOptions = {
|
|
63
|
-
renderDecisions: renderDecisions,
|
|
64
|
-
decisionScopes: decisionScopes,
|
|
65
|
-
personalization: personalization
|
|
66
|
-
};
|
|
67
58
|
if (edgeConfigOverrides) {
|
|
68
|
-
|
|
59
|
+
eventManagerOptions.edgeConfigOverrides = edgeConfigOverrides;
|
|
69
60
|
}
|
|
70
61
|
if (datasetId) {
|
|
71
62
|
logger.warn("The 'datasetId' option has been deprecated. Please use 'edgeConfigOverrides.com_adobe_experience_platform.datasets.event.datasetId' instead.");
|
|
72
|
-
|
|
73
|
-
(0, _utils.deepAssign)(
|
|
63
|
+
eventManagerOptions.edgeConfigOverrides = edgeConfigOverrides || {};
|
|
64
|
+
(0, _utils.deepAssign)(eventManagerOptions.edgeConfigOverrides, {
|
|
74
65
|
com_adobe_experience_platform: {
|
|
75
66
|
datasets: {
|
|
76
67
|
event: {
|
|
@@ -80,7 +71,7 @@ var createDataCollector = function createDataCollector(_ref) {
|
|
|
80
71
|
}
|
|
81
72
|
});
|
|
82
73
|
}
|
|
83
|
-
return eventManager.sendEvent(event,
|
|
74
|
+
return eventManager.sendEvent(event, eventManagerOptions);
|
|
84
75
|
}
|
|
85
76
|
},
|
|
86
77
|
applyResponse: {
|
|
@@ -91,8 +82,8 @@ var createDataCollector = function createDataCollector(_ref) {
|
|
|
91
82
|
});
|
|
92
83
|
},
|
|
93
84
|
run: function run(options) {
|
|
94
|
-
var _options$
|
|
95
|
-
renderDecisions = _options$
|
|
85
|
+
var _options$renderDecisi = options.renderDecisions,
|
|
86
|
+
renderDecisions = _options$renderDecisi === void 0 ? false : _options$renderDecisi,
|
|
96
87
|
_options$responseHead = options.responseHeaders,
|
|
97
88
|
responseHeaders = _options$responseHead === void 0 ? {} : _options$responseHead,
|
|
98
89
|
_options$responseBody = options.responseBody,
|
|
@@ -25,9 +25,9 @@ var _default = function _default(_ref) {
|
|
|
25
25
|
})).required()
|
|
26
26
|
}).required(),
|
|
27
27
|
personalization: (0, _validation.objectOf)({
|
|
28
|
-
|
|
28
|
+
sendDisplayEvent: (0, _validation.boolean)().default(true)
|
|
29
29
|
}).default({
|
|
30
|
-
|
|
30
|
+
sendDisplayEvent: true
|
|
31
31
|
})
|
|
32
32
|
}).noUnknownFields();
|
|
33
33
|
return validator(options);
|
|
@@ -34,14 +34,16 @@ var _default = function _default(_ref) {
|
|
|
34
34
|
personalization: (0, _validation.objectOf)({
|
|
35
35
|
decisionScopes: (0, _validation.arrayOf)((0, _validation.string)()).uniqueItems(),
|
|
36
36
|
surfaces: (0, _validation.arrayOf)((0, _validation.string)()).uniqueItems(),
|
|
37
|
-
|
|
38
|
-
|
|
37
|
+
sendDisplayEvent: (0, _validation.boolean)().default(true),
|
|
38
|
+
includeRenderedPropositions: (0, _validation.boolean)().default(false),
|
|
39
|
+
requestPersonalization: (0, _validation.boolean)()
|
|
39
40
|
}).default({
|
|
40
|
-
|
|
41
|
+
sendDisplayEvent: true
|
|
41
42
|
}),
|
|
42
43
|
datasetId: (0, _validation.string)(),
|
|
43
44
|
mergeId: (0, _validation.string)(),
|
|
44
|
-
edgeConfigOverrides: _utils.validateConfigOverride
|
|
45
|
+
edgeConfigOverrides: _utils.validateConfigOverride,
|
|
46
|
+
initializePersonalization: (0, _validation.boolean)()
|
|
45
47
|
}).required().noUnknownFields();
|
|
46
48
|
return eventOptionsValidator(options);
|
|
47
49
|
};
|
|
@@ -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;
|
|
@@ -27,7 +27,7 @@ var SUPPORTED_SCHEMAS = [_schema.DOM_ACTION, _schema.HTML_CONTENT_ITEM];
|
|
|
27
27
|
var _default = function _default(_ref) {
|
|
28
28
|
var processPropositions = _ref.processPropositions,
|
|
29
29
|
createProposition = _ref.createProposition,
|
|
30
|
-
|
|
30
|
+
renderedPropositions = _ref.renderedPropositions,
|
|
31
31
|
viewCache = _ref.viewCache;
|
|
32
32
|
var filterItemsPredicate = function filterItemsPredicate(item) {
|
|
33
33
|
return SUPPORTED_SCHEMAS.indexOf(item.schema) > -1;
|
|
@@ -86,8 +86,8 @@ var _default = function _default(_ref) {
|
|
|
86
86
|
viewName = _ref4.viewName;
|
|
87
87
|
// We need to immediately call concat so that subsequent sendEvent
|
|
88
88
|
// calls will wait for applyPropositions to complete before executing.
|
|
89
|
-
var
|
|
90
|
-
|
|
89
|
+
var renderedPropositionsDeferred = (0, _utils.defer)();
|
|
90
|
+
renderedPropositions.concat(renderedPropositionsDeferred.promise);
|
|
91
91
|
var propositionsToExecute = preparePropositions({
|
|
92
92
|
propositions: propositions,
|
|
93
93
|
metadata: metadata
|
|
@@ -103,7 +103,7 @@ var _default = function _default(_ref) {
|
|
|
103
103
|
var _processPropositions = processPropositions([].concat(_toConsumableArray(propositionsToExecute), _toConsumableArray(additionalPropositions))),
|
|
104
104
|
render = _processPropositions.render,
|
|
105
105
|
returnedPropositions = _processPropositions.returnedPropositions;
|
|
106
|
-
render().then(
|
|
106
|
+
render().then(renderedPropositionsDeferred.resolve);
|
|
107
107
|
return {
|
|
108
108
|
propositions: returnedPropositions
|
|
109
109
|
};
|
|
@@ -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() {
|
|
@@ -30,7 +30,7 @@ var _default = function _default(_ref) {
|
|
|
30
30
|
applyPropositions = _ref.applyPropositions,
|
|
31
31
|
setTargetMigration = _ref.setTargetMigration,
|
|
32
32
|
mergeDecisionsMeta = _ref.mergeDecisionsMeta,
|
|
33
|
-
|
|
33
|
+
renderedPropositions = _ref.renderedPropositions;
|
|
34
34
|
return {
|
|
35
35
|
lifecycle: {
|
|
36
36
|
onBeforeRequest: function onBeforeRequest(_ref2) {
|
|
@@ -77,8 +77,8 @@ var _default = function _default(_ref) {
|
|
|
77
77
|
logger: logger
|
|
78
78
|
});
|
|
79
79
|
var decisionsMetaPromises = [];
|
|
80
|
-
if (personalizationDetails.
|
|
81
|
-
decisionsMetaPromises.push(
|
|
80
|
+
if (personalizationDetails.shouldIncludeRenderedPropositions()) {
|
|
81
|
+
decisionsMetaPromises.push(renderedPropositions.clear());
|
|
82
82
|
}
|
|
83
83
|
if (personalizationDetails.shouldFetchData()) {
|
|
84
84
|
var cacheUpdate = viewCache.createCacheUpdate(personalizationDetails.getViewName());
|
|
@@ -27,7 +27,7 @@ var _default = function _default(_ref) {
|
|
|
27
27
|
collect = _ref.collect,
|
|
28
28
|
processPropositions = _ref.processPropositions,
|
|
29
29
|
createProposition = _ref.createProposition,
|
|
30
|
-
|
|
30
|
+
renderedPropositions = _ref.renderedPropositions;
|
|
31
31
|
return function (_ref2) {
|
|
32
32
|
var cacheUpdate = _ref2.cacheUpdate,
|
|
33
33
|
personalizationDetails = _ref2.personalizationDetails,
|
|
@@ -40,7 +40,7 @@ var _default = function _default(_ref) {
|
|
|
40
40
|
}
|
|
41
41
|
mergeQuery(event, personalizationDetails.createQueryDetails());
|
|
42
42
|
var handleNotifications;
|
|
43
|
-
if (personalizationDetails.
|
|
43
|
+
if (personalizationDetails.isSendDisplayEvent()) {
|
|
44
44
|
handleNotifications = function handleNotifications(decisionsMeta) {
|
|
45
45
|
if (decisionsMeta.length > 0) {
|
|
46
46
|
collect({
|
|
@@ -50,9 +50,9 @@ var _default = function _default(_ref) {
|
|
|
50
50
|
}
|
|
51
51
|
};
|
|
52
52
|
} else {
|
|
53
|
-
var
|
|
54
|
-
|
|
55
|
-
handleNotifications =
|
|
53
|
+
var renderedPropositionsDeferred = (0, _utils.defer)();
|
|
54
|
+
renderedPropositions.concat(renderedPropositionsDeferred.promise);
|
|
55
|
+
handleNotifications = renderedPropositionsDeferred.resolve;
|
|
56
56
|
}
|
|
57
57
|
onResponse(function (_ref3) {
|
|
58
58
|
var response = _ref3.response;
|
|
@@ -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
|
}
|
|
@@ -50,11 +50,11 @@ var _default = function _default(_ref) {
|
|
|
50
50
|
isRenderDecisions: function isRenderDecisions() {
|
|
51
51
|
return renderDecisions;
|
|
52
52
|
},
|
|
53
|
-
|
|
54
|
-
return !!personalization.
|
|
53
|
+
isSendDisplayEvent: function isSendDisplayEvent() {
|
|
54
|
+
return !!personalization.sendDisplayEvent;
|
|
55
55
|
},
|
|
56
|
-
|
|
57
|
-
return !!personalization.
|
|
56
|
+
shouldIncludeRenderedPropositions: function shouldIncludeRenderedPropositions() {
|
|
57
|
+
return !!personalization.includeRenderedPropositions;
|
|
58
58
|
},
|
|
59
59
|
getViewName: function getViewName() {
|
|
60
60
|
return viewName;
|
|
@@ -74,7 +74,7 @@ var _default = function _default(_ref) {
|
|
|
74
74
|
scopes.push.apply(scopes, _toConsumableArray(personalization.decisionScopes));
|
|
75
75
|
}
|
|
76
76
|
var eventSurfaces = (0, _surfaceUtils.normalizeSurfaces)(personalization.surfaces, getPageLocation, logger);
|
|
77
|
-
if (!this.isCacheInitialized()) {
|
|
77
|
+
if (!this.isCacheInitialized() || personalization.requestPersonalization) {
|
|
78
78
|
addPageWideScope(scopes);
|
|
79
79
|
addPageSurface(eventSurfaces, getPageLocation);
|
|
80
80
|
}
|
|
@@ -92,7 +92,7 @@ var _default = function _default(_ref) {
|
|
|
92
92
|
return _isCacheInitialized;
|
|
93
93
|
},
|
|
94
94
|
shouldFetchData: function shouldFetchData() {
|
|
95
|
-
return this.hasScopes() || this.hasSurfaces() || !this.isCacheInitialized();
|
|
95
|
+
return this.hasScopes() || this.hasSurfaces() || personalization.requestPersonalization || !this.isCacheInitialized() && personalization.requestPersonalization !== false;
|
|
96
96
|
},
|
|
97
97
|
shouldUseCachedData: function shouldUseCachedData() {
|
|
98
98
|
return this.hasViewName() && this.isCacheInitialized();
|
|
@@ -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");
|
|
@@ -17,11 +18,10 @@ governing permissions and limitations under the License.
|
|
|
17
18
|
*/
|
|
18
19
|
var _default = function _default(_ref) {
|
|
19
20
|
var createProposition = _ref.createProposition;
|
|
20
|
-
var viewStorage = {};
|
|
21
21
|
var cacheUpdateCreatedAtLeastOnce = false;
|
|
22
|
-
var
|
|
23
|
-
var getViewPropositions = function getViewPropositions(
|
|
24
|
-
var viewPropositions =
|
|
22
|
+
var viewStoragePromise = Promise.resolve({});
|
|
23
|
+
var getViewPropositions = function getViewPropositions(viewStorage, viewName) {
|
|
24
|
+
var viewPropositions = viewStorage[viewName.toLowerCase()];
|
|
25
25
|
if (viewPropositions && viewPropositions.length > 0) {
|
|
26
26
|
return viewPropositions;
|
|
27
27
|
}
|
|
@@ -29,7 +29,7 @@ var _default = function _default(_ref) {
|
|
|
29
29
|
scope: viewName,
|
|
30
30
|
scopeDetails: {
|
|
31
31
|
characteristics: {
|
|
32
|
-
scopeType:
|
|
32
|
+
scopeType: _scopeType.VIEW_SCOPE_TYPE
|
|
33
33
|
}
|
|
34
34
|
},
|
|
35
35
|
items: [{
|
|
@@ -43,11 +43,11 @@ var _default = function _default(_ref) {
|
|
|
43
43
|
var createCacheUpdate = function createCacheUpdate(viewName) {
|
|
44
44
|
var updateCacheDeferred = (0, _defer.default)();
|
|
45
45
|
cacheUpdateCreatedAtLeastOnce = true;
|
|
46
|
-
|
|
47
|
-
return updateCacheDeferred.promise
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
})
|
|
46
|
+
viewStoragePromise = viewStoragePromise.then(function (oldViewStorage) {
|
|
47
|
+
return updateCacheDeferred.promise.catch(function () {
|
|
48
|
+
return oldViewStorage;
|
|
49
|
+
});
|
|
50
|
+
});
|
|
51
51
|
return {
|
|
52
52
|
update: function update(viewPropositions) {
|
|
53
53
|
var viewPropositionsWithScope = viewPropositions.filter(function (proposition) {
|
|
@@ -68,7 +68,7 @@ var _default = function _default(_ref) {
|
|
|
68
68
|
};
|
|
69
69
|
};
|
|
70
70
|
var getView = function getView(viewName) {
|
|
71
|
-
return
|
|
71
|
+
return viewStoragePromise.then(function (viewStorage) {
|
|
72
72
|
return getViewPropositions(viewStorage, viewName);
|
|
73
73
|
});
|
|
74
74
|
};
|
|
@@ -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() {
|