@adobe/alloy 2.9.0-alpha.5 → 2.9.0
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/createAutoRenderingHandler.js +66 -39
- package/libEs5/components/Personalization/createCollect.js +23 -6
- package/libEs5/components/Personalization/createComponent.js +3 -1
- package/libEs5/components/Personalization/createExecuteDecisions.js +4 -11
- package/libEs5/components/Personalization/createViewChangeHandler.js +28 -18
- package/libEs5/components/Personalization/index.js +6 -24
- package/libEs5/components/Personalization/utils/composePersonalizationResultingObject.js +24 -0
- package/libEs5/constants/libraryVersion.js +1 -1
- package/libEs6/components/Personalization/createAutoRenderingHandler.js +59 -33
- package/libEs6/components/Personalization/createCollect.js +21 -6
- package/libEs6/components/Personalization/createComponent.js +3 -1
- package/libEs6/components/Personalization/createExecuteDecisions.js +5 -12
- package/libEs6/components/Personalization/createViewChangeHandler.js +27 -18
- package/libEs6/components/Personalization/index.js +6 -22
- package/libEs6/components/Personalization/utils/composePersonalizationResultingObject.js +15 -0
- package/libEs6/constants/libraryVersion.js +1 -1
- package/package.json +2 -2
- package/libEs5/components/Personalization/createExecuteCachedViewDecisions.js +0 -47
- package/libEs5/components/Personalization/createViewCollect.js +0 -48
- package/libEs6/components/Personalization/createExecuteCachedViewDecisions.js +0 -41
- package/libEs6/components/Personalization/createViewCollect.js +0 -42
|
@@ -4,6 +4,8 @@ exports.default = void 0;
|
|
|
4
4
|
|
|
5
5
|
var _addRenderAttemptedToDecisions = require("./utils/addRenderAttemptedToDecisions");
|
|
6
6
|
|
|
7
|
+
var _isNonEmptyArray = require("../../utils/isNonEmptyArray");
|
|
8
|
+
|
|
7
9
|
function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
|
|
8
10
|
|
|
9
11
|
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."); }
|
|
@@ -16,49 +18,74 @@ function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToAr
|
|
|
16
18
|
|
|
17
19
|
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; }
|
|
18
20
|
|
|
19
|
-
var
|
|
21
|
+
var getPropositions = function getPropositions(_ref) {
|
|
20
22
|
var viewCache = _ref.viewCache,
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
showContainers = _ref.showContainers;
|
|
24
|
-
return function (_ref2) {
|
|
25
|
-
var viewName = _ref2.viewName,
|
|
26
|
-
pageWideScopeDecisions = _ref2.pageWideScopeDecisions,
|
|
27
|
-
nonAutoRenderableDecisions = _ref2.nonAutoRenderableDecisions;
|
|
28
|
-
|
|
29
|
-
if (viewName) {
|
|
30
|
-
return viewCache.getView(viewName).then(function (currentViewDecisions) {
|
|
31
|
-
executeDecisions(pageWideScopeDecisions);
|
|
32
|
-
executeCachedViewDecisions({
|
|
33
|
-
viewName: viewName,
|
|
34
|
-
viewDecisions: currentViewDecisions
|
|
35
|
-
});
|
|
36
|
-
showContainers();
|
|
37
|
-
return {
|
|
38
|
-
decisions: _toConsumableArray(nonAutoRenderableDecisions),
|
|
39
|
-
propositions: [].concat(_toConsumableArray((0, _addRenderAttemptedToDecisions.default)({
|
|
40
|
-
decisions: [].concat(_toConsumableArray(pageWideScopeDecisions), _toConsumableArray(currentViewDecisions)),
|
|
41
|
-
renderAttempted: true
|
|
42
|
-
})), _toConsumableArray((0, _addRenderAttemptedToDecisions.default)({
|
|
43
|
-
decisions: nonAutoRenderableDecisions,
|
|
44
|
-
renderAttempted: false
|
|
45
|
-
})))
|
|
46
|
-
};
|
|
47
|
-
});
|
|
48
|
-
}
|
|
23
|
+
viewName = _ref.viewName,
|
|
24
|
+
pageWideScopeDecisions = _ref.pageWideScopeDecisions;
|
|
49
25
|
|
|
50
|
-
|
|
51
|
-
showContainers();
|
|
26
|
+
if (!viewName) {
|
|
52
27
|
return {
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
decisions: pageWideScopeDecisions,
|
|
56
|
-
renderAttempted: true
|
|
57
|
-
})), _toConsumableArray((0, _addRenderAttemptedToDecisions.default)({
|
|
58
|
-
decisions: nonAutoRenderableDecisions,
|
|
59
|
-
renderAttempted: false
|
|
60
|
-
})))
|
|
28
|
+
pageWideScopeDecisions: pageWideScopeDecisions,
|
|
29
|
+
viewPropositions: []
|
|
61
30
|
};
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
return viewCache.getView(viewName).then(function (viewPropositions) {
|
|
34
|
+
return {
|
|
35
|
+
pageWideScopeDecisions: pageWideScopeDecisions,
|
|
36
|
+
viewPropositions: viewPropositions
|
|
37
|
+
};
|
|
38
|
+
});
|
|
39
|
+
};
|
|
40
|
+
|
|
41
|
+
var _default = function _default(_ref2) {
|
|
42
|
+
var viewCache = _ref2.viewCache,
|
|
43
|
+
executeDecisions = _ref2.executeDecisions,
|
|
44
|
+
showContainers = _ref2.showContainers,
|
|
45
|
+
collect = _ref2.collect;
|
|
46
|
+
return function (_ref3) {
|
|
47
|
+
var viewName = _ref3.viewName,
|
|
48
|
+
pageWideScopeDecisions = _ref3.pageWideScopeDecisions,
|
|
49
|
+
nonAutoRenderableDecisions = _ref3.nonAutoRenderableDecisions;
|
|
50
|
+
return Promise.resolve(pageWideScopeDecisions).then(function (propositions) {
|
|
51
|
+
return getPropositions({
|
|
52
|
+
viewCache: viewCache,
|
|
53
|
+
viewName: viewName,
|
|
54
|
+
executeDecisions: executeDecisions,
|
|
55
|
+
pageWideScopeDecisions: propositions
|
|
56
|
+
});
|
|
57
|
+
}).then(function (propositions) {
|
|
58
|
+
executeDecisions(propositions.pageWideScopeDecisions).then(function (decisionsMeta) {
|
|
59
|
+
if ((0, _isNonEmptyArray.default)(decisionsMeta)) {
|
|
60
|
+
collect({
|
|
61
|
+
decisionsMeta: decisionsMeta
|
|
62
|
+
});
|
|
63
|
+
}
|
|
64
|
+
});
|
|
65
|
+
|
|
66
|
+
if (viewName) {
|
|
67
|
+
executeDecisions(propositions.viewPropositions).then(function (decisionsMeta) {
|
|
68
|
+
collect({
|
|
69
|
+
decisionsMeta: decisionsMeta,
|
|
70
|
+
viewName: viewName
|
|
71
|
+
});
|
|
72
|
+
});
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
showContainers();
|
|
76
|
+
return [].concat(_toConsumableArray(propositions.pageWideScopeDecisions), _toConsumableArray(propositions.viewPropositions));
|
|
77
|
+
}).then(function (renderablePropositions) {
|
|
78
|
+
return {
|
|
79
|
+
decisions: _toConsumableArray(nonAutoRenderableDecisions),
|
|
80
|
+
propositions: [].concat(_toConsumableArray((0, _addRenderAttemptedToDecisions.default)({
|
|
81
|
+
decisions: renderablePropositions,
|
|
82
|
+
renderAttempted: true
|
|
83
|
+
})), _toConsumableArray((0, _addRenderAttemptedToDecisions.default)({
|
|
84
|
+
decisions: nonAutoRenderableDecisions,
|
|
85
|
+
renderAttempted: false
|
|
86
|
+
})))
|
|
87
|
+
};
|
|
88
|
+
});
|
|
62
89
|
};
|
|
63
90
|
};
|
|
64
91
|
|
|
@@ -4,6 +4,8 @@ exports.default = void 0;
|
|
|
4
4
|
|
|
5
5
|
var _eventType = require("./constants/eventType");
|
|
6
6
|
|
|
7
|
+
var _utils = require("../../utils");
|
|
8
|
+
|
|
7
9
|
/*
|
|
8
10
|
Copyright 2020 Adobe. All rights reserved.
|
|
9
11
|
This file is licensed to you under the Apache License, Version 2.0 (the "License");
|
|
@@ -18,16 +20,31 @@ governing permissions and limitations under the License.
|
|
|
18
20
|
var _default = function _default(_ref) {
|
|
19
21
|
var eventManager = _ref.eventManager,
|
|
20
22
|
mergeDecisionsMeta = _ref.mergeDecisionsMeta;
|
|
21
|
-
// Called when a decision is auto-rendered for the __view__ scope
|
|
23
|
+
// Called when a decision is auto-rendered for the __view__ scope or a SPA view(display and empty display notification)
|
|
22
24
|
return function (_ref2) {
|
|
23
|
-
var decisionsMeta = _ref2.decisionsMeta,
|
|
25
|
+
var _ref2$decisionsMeta = _ref2.decisionsMeta,
|
|
26
|
+
decisionsMeta = _ref2$decisionsMeta === void 0 ? [] : _ref2$decisionsMeta,
|
|
24
27
|
_ref2$documentMayUnlo = _ref2.documentMayUnload,
|
|
25
|
-
documentMayUnload = _ref2$documentMayUnlo === void 0 ? false : _ref2$documentMayUnlo
|
|
28
|
+
documentMayUnload = _ref2$documentMayUnlo === void 0 ? false : _ref2$documentMayUnlo,
|
|
29
|
+
viewName = _ref2.viewName;
|
|
26
30
|
var event = eventManager.createEvent();
|
|
27
|
-
|
|
31
|
+
var data = {
|
|
28
32
|
eventType: _eventType.DISPLAY
|
|
29
|
-
}
|
|
30
|
-
|
|
33
|
+
};
|
|
34
|
+
|
|
35
|
+
if (viewName) {
|
|
36
|
+
data.web = {
|
|
37
|
+
webPageDetails: {
|
|
38
|
+
viewName: viewName
|
|
39
|
+
}
|
|
40
|
+
};
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
if ((0, _utils.isNonEmptyArray)(decisionsMeta)) {
|
|
44
|
+
mergeDecisionsMeta(event, decisionsMeta);
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
event.mergeXdm(data);
|
|
31
48
|
|
|
32
49
|
if (documentMayUnload) {
|
|
33
50
|
event.documentMayUnload();
|
|
@@ -81,8 +81,10 @@ var _default = function _default(_ref) {
|
|
|
81
81
|
}
|
|
82
82
|
|
|
83
83
|
if (personalizationDetails.shouldUseCachedData()) {
|
|
84
|
-
|
|
84
|
+
// eslint-disable-next-line consistent-return
|
|
85
|
+
return viewChangeHandler({
|
|
85
86
|
personalizationDetails: personalizationDetails,
|
|
87
|
+
event: event,
|
|
86
88
|
onResponse: onResponse,
|
|
87
89
|
onRequestFailure: onRequestFailure
|
|
88
90
|
});
|
|
@@ -36,7 +36,7 @@ var buildActions = function buildActions(decision) {
|
|
|
36
36
|
});
|
|
37
37
|
};
|
|
38
38
|
|
|
39
|
-
var processMetas = function processMetas(
|
|
39
|
+
var processMetas = function processMetas(logger, actionResults) {
|
|
40
40
|
var results = (0, _utils.flatMap)(actionResults, identity);
|
|
41
41
|
var finalMetas = [];
|
|
42
42
|
var set = new Set();
|
|
@@ -60,27 +60,20 @@ var processMetas = function processMetas(collect, logger, actionResults) {
|
|
|
60
60
|
set.add(meta.id);
|
|
61
61
|
finalMetas.push(meta);
|
|
62
62
|
});
|
|
63
|
-
|
|
64
|
-
if ((0, _utils.isNonEmptyArray)(finalMetas)) {
|
|
65
|
-
// collect here can either be the function from createCollect or createViewCollect.
|
|
66
|
-
collect({
|
|
67
|
-
decisionsMeta: finalMetas
|
|
68
|
-
});
|
|
69
|
-
}
|
|
63
|
+
return finalMetas;
|
|
70
64
|
};
|
|
71
65
|
|
|
72
66
|
var _default = function _default(_ref) {
|
|
73
67
|
var modules = _ref.modules,
|
|
74
68
|
logger = _ref.logger,
|
|
75
|
-
executeActions = _ref.executeActions
|
|
76
|
-
collect = _ref.collect;
|
|
69
|
+
executeActions = _ref.executeActions;
|
|
77
70
|
return function (decisions) {
|
|
78
71
|
var actionResultsPromises = decisions.map(function (decision) {
|
|
79
72
|
var actions = buildActions(decision);
|
|
80
73
|
return executeActions(actions, modules, logger);
|
|
81
74
|
});
|
|
82
75
|
return Promise.all(actionResultsPromises).then(function (results) {
|
|
83
|
-
return processMetas(
|
|
76
|
+
return processMetas(logger, results);
|
|
84
77
|
}).catch(function (error) {
|
|
85
78
|
logger.error(error);
|
|
86
79
|
});
|
|
@@ -2,7 +2,9 @@
|
|
|
2
2
|
|
|
3
3
|
exports.default = void 0;
|
|
4
4
|
|
|
5
|
-
var
|
|
5
|
+
var _composePersonalizationResultingObject = require("./utils/composePersonalizationResultingObject");
|
|
6
|
+
|
|
7
|
+
var _utils = require("../../utils");
|
|
6
8
|
|
|
7
9
|
/*
|
|
8
10
|
Copyright 2020 Adobe. All rights reserved.
|
|
@@ -16,34 +18,42 @@ OF ANY KIND, either express or implied. See the License for the specific languag
|
|
|
16
18
|
governing permissions and limitations under the License.
|
|
17
19
|
*/
|
|
18
20
|
var _default = function _default(_ref) {
|
|
19
|
-
var
|
|
21
|
+
var mergeDecisionsMeta = _ref.mergeDecisionsMeta,
|
|
22
|
+
collect = _ref.collect,
|
|
23
|
+
executeDecisions = _ref.executeDecisions,
|
|
20
24
|
viewCache = _ref.viewCache;
|
|
21
25
|
return function (_ref2) {
|
|
22
26
|
var personalizationDetails = _ref2.personalizationDetails,
|
|
27
|
+
event = _ref2.event,
|
|
23
28
|
onResponse = _ref2.onResponse;
|
|
24
29
|
var viewName = personalizationDetails.getViewName();
|
|
25
|
-
return viewCache.getView(viewName).then(function (
|
|
30
|
+
return viewCache.getView(viewName).then(function (viewDecisions) {
|
|
26
31
|
if (personalizationDetails.isRenderDecisions()) {
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
32
|
+
return executeDecisions(viewDecisions).then(function (decisionsMeta) {
|
|
33
|
+
// if there are decisions to be rendered we render them and attach the result in experience.decisions.propositions
|
|
34
|
+
if ((0, _utils.isNonEmptyArray)(decisionsMeta)) {
|
|
35
|
+
mergeDecisionsMeta(event, decisionsMeta);
|
|
36
|
+
onResponse(function () {
|
|
37
|
+
return (0, _composePersonalizationResultingObject.default)(viewDecisions, true);
|
|
38
|
+
});
|
|
39
|
+
return;
|
|
40
|
+
} // if there are no decisions in cache for this view, we will send a empty notification
|
|
41
|
+
|
|
42
|
+
|
|
43
|
+
onResponse(function () {
|
|
44
|
+
collect({
|
|
45
|
+
decisionsMeta: [],
|
|
46
|
+
viewName: viewName
|
|
47
|
+
});
|
|
48
|
+
return (0, _composePersonalizationResultingObject.default)(viewDecisions, true);
|
|
49
|
+
});
|
|
30
50
|
});
|
|
31
51
|
}
|
|
32
52
|
|
|
33
53
|
onResponse(function () {
|
|
34
|
-
return
|
|
35
|
-
propositions: (0, _addRenderAttemptedToDecisions.default)({
|
|
36
|
-
decisions: currentViewDecisions,
|
|
37
|
-
renderAttempted: true
|
|
38
|
-
})
|
|
39
|
-
} : {
|
|
40
|
-
decisions: currentViewDecisions,
|
|
41
|
-
propositions: (0, _addRenderAttemptedToDecisions.default)({
|
|
42
|
-
decisions: currentViewDecisions,
|
|
43
|
-
renderAttempted: false
|
|
44
|
-
})
|
|
45
|
-
};
|
|
54
|
+
return (0, _composePersonalizationResultingObject.default)(viewDecisions, false);
|
|
46
55
|
});
|
|
56
|
+
return {};
|
|
47
57
|
});
|
|
48
58
|
};
|
|
49
59
|
};
|
|
@@ -10,8 +10,6 @@ var _domActions = require("./dom-actions");
|
|
|
10
10
|
|
|
11
11
|
var _createCollect = require("./createCollect");
|
|
12
12
|
|
|
13
|
-
var _createViewCollect = require("./createViewCollect");
|
|
14
|
-
|
|
15
13
|
var _createExecuteDecisions = require("./createExecuteDecisions");
|
|
16
14
|
|
|
17
15
|
var _flicker = require("./flicker");
|
|
@@ -26,8 +24,6 @@ var _event = require("./event");
|
|
|
26
24
|
|
|
27
25
|
var _createOnClickHandler = require("./createOnClickHandler");
|
|
28
26
|
|
|
29
|
-
var _createExecuteCachedViewDecisions = require("./createExecuteCachedViewDecisions");
|
|
30
|
-
|
|
31
27
|
var _createViewCacheManager = require("./createViewCacheManager");
|
|
32
28
|
|
|
33
29
|
var _createViewChangeHandler = require("./createViewChangeHandler");
|
|
@@ -63,10 +59,6 @@ var createPersonalization = function createPersonalization(_ref) {
|
|
|
63
59
|
eventManager: eventManager,
|
|
64
60
|
mergeDecisionsMeta: _event.mergeDecisionsMeta
|
|
65
61
|
});
|
|
66
|
-
var viewCollect = (0, _createViewCollect.default)({
|
|
67
|
-
eventManager: eventManager,
|
|
68
|
-
mergeDecisionsMeta: _event.mergeDecisionsMeta
|
|
69
|
-
});
|
|
70
62
|
|
|
71
63
|
var _createClickStorage = (0, _createClickStorage2.default)(),
|
|
72
64
|
getClickMetasBySelector = _createClickStorage.getClickMetasBySelector,
|
|
@@ -78,14 +70,7 @@ var createPersonalization = function createPersonalization(_ref) {
|
|
|
78
70
|
var executeDecisions = (0, _createExecuteDecisions.default)({
|
|
79
71
|
modules: modules,
|
|
80
72
|
logger: logger,
|
|
81
|
-
executeActions: _domActions.executeActions
|
|
82
|
-
collect: collect
|
|
83
|
-
});
|
|
84
|
-
var executeViewDecisions = (0, _createExecuteDecisions.default)({
|
|
85
|
-
modules: modules,
|
|
86
|
-
logger: logger,
|
|
87
|
-
executeActions: _domActions.executeActions,
|
|
88
|
-
collect: viewCollect
|
|
73
|
+
executeActions: _domActions.executeActions
|
|
89
74
|
});
|
|
90
75
|
var handleRedirectDecisions = (0, _createRedirectHandler.default)({
|
|
91
76
|
collect: collect,
|
|
@@ -93,16 +78,11 @@ var createPersonalization = function createPersonalization(_ref) {
|
|
|
93
78
|
logger: logger,
|
|
94
79
|
showContainers: _flicker.showContainers
|
|
95
80
|
});
|
|
96
|
-
var executeCachedViewDecisions = (0, _createExecuteCachedViewDecisions.default)({
|
|
97
|
-
viewCache: viewCache,
|
|
98
|
-
executeViewDecisions: executeViewDecisions,
|
|
99
|
-
collect: viewCollect
|
|
100
|
-
});
|
|
101
81
|
var autoRenderingHandler = (0, _createAutoRenderingHandler.default)({
|
|
102
82
|
viewCache: viewCache,
|
|
103
83
|
executeDecisions: executeDecisions,
|
|
104
|
-
|
|
105
|
-
|
|
84
|
+
showContainers: _flicker.showContainers,
|
|
85
|
+
collect: collect
|
|
106
86
|
});
|
|
107
87
|
var nonRenderingHandler = (0, _createNonRenderingHandler.default)({
|
|
108
88
|
viewCache: viewCache
|
|
@@ -127,7 +107,9 @@ var createPersonalization = function createPersonalization(_ref) {
|
|
|
127
107
|
getClickMetasBySelector: getClickMetasBySelector
|
|
128
108
|
});
|
|
129
109
|
var viewChangeHandler = (0, _createViewChangeHandler.default)({
|
|
130
|
-
|
|
110
|
+
mergeDecisionsMeta: _event.mergeDecisionsMeta,
|
|
111
|
+
collect: collect,
|
|
112
|
+
executeDecisions: executeDecisions,
|
|
131
113
|
viewCache: viewCache
|
|
132
114
|
});
|
|
133
115
|
return (0, _createComponent.default)({
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
exports.default = void 0;
|
|
4
|
+
|
|
5
|
+
var _addRenderAttemptedToDecisions = require("./addRenderAttemptedToDecisions");
|
|
6
|
+
|
|
7
|
+
var _default = function _default() {
|
|
8
|
+
var decisions = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
|
|
9
|
+
var renderDecisions = arguments.length > 1 ? arguments[1] : undefined;
|
|
10
|
+
var resultingObject = {
|
|
11
|
+
propositions: (0, _addRenderAttemptedToDecisions.default)({
|
|
12
|
+
decisions: decisions,
|
|
13
|
+
renderAttempted: renderDecisions
|
|
14
|
+
})
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
if (!renderDecisions) {
|
|
18
|
+
resultingObject.decisions = decisions;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
return resultingObject;
|
|
22
|
+
};
|
|
23
|
+
|
|
24
|
+
exports.default = _default;
|
|
@@ -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.9.0
|
|
18
|
+
var _default = "2.9.0";
|
|
19
19
|
exports.default = _default;
|
|
@@ -10,49 +10,75 @@ 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
|
import addRenderAttemptedToDecisions from "./utils/addRenderAttemptedToDecisions";
|
|
13
|
+
import isNonEmptyArray from "../../utils/isNonEmptyArray";
|
|
14
|
+
|
|
15
|
+
const getPropositions = ({
|
|
16
|
+
viewCache,
|
|
17
|
+
viewName,
|
|
18
|
+
pageWideScopeDecisions
|
|
19
|
+
}) => {
|
|
20
|
+
if (!viewName) {
|
|
21
|
+
return {
|
|
22
|
+
pageWideScopeDecisions,
|
|
23
|
+
viewPropositions: []
|
|
24
|
+
};
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
return viewCache.getView(viewName).then(viewPropositions => {
|
|
28
|
+
return {
|
|
29
|
+
pageWideScopeDecisions,
|
|
30
|
+
viewPropositions
|
|
31
|
+
};
|
|
32
|
+
});
|
|
33
|
+
};
|
|
34
|
+
|
|
13
35
|
export default (({
|
|
14
36
|
viewCache,
|
|
15
37
|
executeDecisions,
|
|
16
|
-
|
|
17
|
-
|
|
38
|
+
showContainers,
|
|
39
|
+
collect
|
|
18
40
|
}) => {
|
|
19
41
|
return ({
|
|
20
42
|
viewName,
|
|
21
43
|
pageWideScopeDecisions,
|
|
22
44
|
nonAutoRenderableDecisions
|
|
23
45
|
}) => {
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
renderAttempted: true
|
|
37
|
-
}), ...addRenderAttemptedToDecisions({
|
|
38
|
-
decisions: nonAutoRenderableDecisions,
|
|
39
|
-
renderAttempted: false
|
|
40
|
-
})]
|
|
41
|
-
};
|
|
46
|
+
return Promise.resolve(pageWideScopeDecisions).then(propositions => getPropositions({
|
|
47
|
+
viewCache,
|
|
48
|
+
viewName,
|
|
49
|
+
executeDecisions,
|
|
50
|
+
pageWideScopeDecisions: propositions
|
|
51
|
+
})).then(propositions => {
|
|
52
|
+
executeDecisions(propositions.pageWideScopeDecisions).then(decisionsMeta => {
|
|
53
|
+
if (isNonEmptyArray(decisionsMeta)) {
|
|
54
|
+
collect({
|
|
55
|
+
decisionsMeta
|
|
56
|
+
});
|
|
57
|
+
}
|
|
42
58
|
});
|
|
43
|
-
}
|
|
44
59
|
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
}
|
|
60
|
+
if (viewName) {
|
|
61
|
+
executeDecisions(propositions.viewPropositions).then(decisionsMeta => {
|
|
62
|
+
collect({
|
|
63
|
+
decisionsMeta,
|
|
64
|
+
viewName
|
|
65
|
+
});
|
|
66
|
+
});
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
showContainers();
|
|
70
|
+
return [...propositions.pageWideScopeDecisions, ...propositions.viewPropositions];
|
|
71
|
+
}).then(renderablePropositions => {
|
|
72
|
+
return {
|
|
73
|
+
decisions: [...nonAutoRenderableDecisions],
|
|
74
|
+
propositions: [...addRenderAttemptedToDecisions({
|
|
75
|
+
decisions: renderablePropositions,
|
|
76
|
+
renderAttempted: true
|
|
77
|
+
}), ...addRenderAttemptedToDecisions({
|
|
78
|
+
decisions: nonAutoRenderableDecisions,
|
|
79
|
+
renderAttempted: false
|
|
80
|
+
})]
|
|
81
|
+
};
|
|
82
|
+
});
|
|
57
83
|
};
|
|
58
84
|
});
|
|
@@ -10,20 +10,35 @@ 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
|
import { DISPLAY } from "./constants/eventType";
|
|
13
|
+
import { isNonEmptyArray } from "../../utils";
|
|
13
14
|
export default (({
|
|
14
15
|
eventManager,
|
|
15
16
|
mergeDecisionsMeta
|
|
16
17
|
}) => {
|
|
17
|
-
// Called when a decision is auto-rendered for the __view__ scope
|
|
18
|
+
// Called when a decision is auto-rendered for the __view__ scope or a SPA view(display and empty display notification)
|
|
18
19
|
return ({
|
|
19
|
-
decisionsMeta,
|
|
20
|
-
documentMayUnload = false
|
|
20
|
+
decisionsMeta = [],
|
|
21
|
+
documentMayUnload = false,
|
|
22
|
+
viewName
|
|
21
23
|
}) => {
|
|
22
24
|
const event = eventManager.createEvent();
|
|
23
|
-
|
|
25
|
+
const data = {
|
|
24
26
|
eventType: DISPLAY
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
+
};
|
|
28
|
+
|
|
29
|
+
if (viewName) {
|
|
30
|
+
data.web = {
|
|
31
|
+
webPageDetails: {
|
|
32
|
+
viewName
|
|
33
|
+
}
|
|
34
|
+
};
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
if (isNonEmptyArray(decisionsMeta)) {
|
|
38
|
+
mergeDecisionsMeta(event, decisionsMeta);
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
event.mergeXdm(data);
|
|
27
42
|
|
|
28
43
|
if (documentMayUnload) {
|
|
29
44
|
event.documentMayUnload();
|
|
@@ -67,8 +67,10 @@ export default (({
|
|
|
67
67
|
}
|
|
68
68
|
|
|
69
69
|
if (personalizationDetails.shouldUseCachedData()) {
|
|
70
|
-
|
|
70
|
+
// eslint-disable-next-line consistent-return
|
|
71
|
+
return viewChangeHandler({
|
|
71
72
|
personalizationDetails,
|
|
73
|
+
event,
|
|
72
74
|
onResponse,
|
|
73
75
|
onRequestFailure
|
|
74
76
|
});
|
|
@@ -9,7 +9,7 @@ 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 { assign, flatMap
|
|
12
|
+
import { assign, flatMap } from "../../utils";
|
|
13
13
|
const DEFAULT_ACTION_TYPE = "defaultContent";
|
|
14
14
|
|
|
15
15
|
const identity = item => item;
|
|
@@ -27,7 +27,7 @@ const buildActions = decision => {
|
|
|
27
27
|
}));
|
|
28
28
|
};
|
|
29
29
|
|
|
30
|
-
const processMetas = (
|
|
30
|
+
const processMetas = (logger, actionResults) => {
|
|
31
31
|
const results = flatMap(actionResults, identity);
|
|
32
32
|
const finalMetas = [];
|
|
33
33
|
const set = new Set();
|
|
@@ -53,27 +53,20 @@ const processMetas = (collect, logger, actionResults) => {
|
|
|
53
53
|
set.add(meta.id);
|
|
54
54
|
finalMetas.push(meta);
|
|
55
55
|
});
|
|
56
|
-
|
|
57
|
-
if (isNonEmptyArray(finalMetas)) {
|
|
58
|
-
// collect here can either be the function from createCollect or createViewCollect.
|
|
59
|
-
collect({
|
|
60
|
-
decisionsMeta: finalMetas
|
|
61
|
-
});
|
|
62
|
-
}
|
|
56
|
+
return finalMetas;
|
|
63
57
|
};
|
|
64
58
|
|
|
65
59
|
export default (({
|
|
66
60
|
modules,
|
|
67
61
|
logger,
|
|
68
|
-
executeActions
|
|
69
|
-
collect
|
|
62
|
+
executeActions
|
|
70
63
|
}) => {
|
|
71
64
|
return decisions => {
|
|
72
65
|
const actionResultsPromises = decisions.map(decision => {
|
|
73
66
|
const actions = buildActions(decision);
|
|
74
67
|
return executeActions(actions, modules, logger);
|
|
75
68
|
});
|
|
76
|
-
return Promise.all(actionResultsPromises).then(results => processMetas(
|
|
69
|
+
return Promise.all(actionResultsPromises).then(results => processMetas(logger, results)).catch(error => {
|
|
77
70
|
logger.error(error);
|
|
78
71
|
});
|
|
79
72
|
};
|
|
@@ -9,38 +9,47 @@ 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
|
|
12
|
+
import composePersonalizationResultingObject from "./utils/composePersonalizationResultingObject";
|
|
13
|
+
import { isNonEmptyArray } from "../../utils";
|
|
13
14
|
export default (({
|
|
14
|
-
|
|
15
|
+
mergeDecisionsMeta,
|
|
16
|
+
collect,
|
|
17
|
+
executeDecisions,
|
|
15
18
|
viewCache
|
|
16
19
|
}) => {
|
|
17
20
|
return ({
|
|
18
21
|
personalizationDetails,
|
|
22
|
+
event,
|
|
19
23
|
onResponse
|
|
20
24
|
}) => {
|
|
21
25
|
const viewName = personalizationDetails.getViewName();
|
|
22
|
-
return viewCache.getView(viewName).then(
|
|
26
|
+
return viewCache.getView(viewName).then(viewDecisions => {
|
|
23
27
|
if (personalizationDetails.isRenderDecisions()) {
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
28
|
+
return executeDecisions(viewDecisions).then(decisionsMeta => {
|
|
29
|
+
// if there are decisions to be rendered we render them and attach the result in experience.decisions.propositions
|
|
30
|
+
if (isNonEmptyArray(decisionsMeta)) {
|
|
31
|
+
mergeDecisionsMeta(event, decisionsMeta);
|
|
32
|
+
onResponse(() => {
|
|
33
|
+
return composePersonalizationResultingObject(viewDecisions, true);
|
|
34
|
+
});
|
|
35
|
+
return;
|
|
36
|
+
} // if there are no decisions in cache for this view, we will send a empty notification
|
|
37
|
+
|
|
38
|
+
|
|
39
|
+
onResponse(() => {
|
|
40
|
+
collect({
|
|
41
|
+
decisionsMeta: [],
|
|
42
|
+
viewName
|
|
43
|
+
});
|
|
44
|
+
return composePersonalizationResultingObject(viewDecisions, true);
|
|
45
|
+
});
|
|
27
46
|
});
|
|
28
47
|
}
|
|
29
48
|
|
|
30
49
|
onResponse(() => {
|
|
31
|
-
return
|
|
32
|
-
propositions: addRenderAttemptedToDecisions({
|
|
33
|
-
decisions: currentViewDecisions,
|
|
34
|
-
renderAttempted: true
|
|
35
|
-
})
|
|
36
|
-
} : {
|
|
37
|
-
decisions: currentViewDecisions,
|
|
38
|
-
propositions: addRenderAttemptedToDecisions({
|
|
39
|
-
decisions: currentViewDecisions,
|
|
40
|
-
renderAttempted: false
|
|
41
|
-
})
|
|
42
|
-
};
|
|
50
|
+
return composePersonalizationResultingObject(viewDecisions, false);
|
|
43
51
|
});
|
|
52
|
+
return {};
|
|
44
53
|
});
|
|
45
54
|
};
|
|
46
55
|
});
|
|
@@ -13,7 +13,6 @@ import { string } from "../../utils/validation";
|
|
|
13
13
|
import createComponent from "./createComponent";
|
|
14
14
|
import { initDomActionsModules, executeActions } from "./dom-actions";
|
|
15
15
|
import createCollect from "./createCollect";
|
|
16
|
-
import createViewCollect from "./createViewCollect";
|
|
17
16
|
import createExecuteDecisions from "./createExecuteDecisions";
|
|
18
17
|
import { hideContainers, showContainers } from "./flicker";
|
|
19
18
|
import createFetchDataHandler from "./createFetchDataHandler";
|
|
@@ -21,7 +20,6 @@ import collectClicks from "./dom-actions/clicks/collectClicks";
|
|
|
21
20
|
import isAuthoringModeEnabled from "./utils/isAuthoringModeEnabled";
|
|
22
21
|
import { mergeDecisionsMeta, mergeQuery } from "./event";
|
|
23
22
|
import createOnClickHandler from "./createOnClickHandler";
|
|
24
|
-
import createExecuteCachedViewDecisions from "./createExecuteCachedViewDecisions";
|
|
25
23
|
import createViewCacheManager from "./createViewCacheManager";
|
|
26
24
|
import createViewChangeHandler from "./createViewChangeHandler";
|
|
27
25
|
import groupDecisions from "./groupDecisions";
|
|
@@ -40,10 +38,6 @@ const createPersonalization = ({
|
|
|
40
38
|
eventManager,
|
|
41
39
|
mergeDecisionsMeta
|
|
42
40
|
});
|
|
43
|
-
const viewCollect = createViewCollect({
|
|
44
|
-
eventManager,
|
|
45
|
-
mergeDecisionsMeta
|
|
46
|
-
});
|
|
47
41
|
const {
|
|
48
42
|
getClickMetasBySelector,
|
|
49
43
|
getClickSelectors,
|
|
@@ -54,14 +48,7 @@ const createPersonalization = ({
|
|
|
54
48
|
const executeDecisions = createExecuteDecisions({
|
|
55
49
|
modules,
|
|
56
50
|
logger,
|
|
57
|
-
executeActions
|
|
58
|
-
collect
|
|
59
|
-
});
|
|
60
|
-
const executeViewDecisions = createExecuteDecisions({
|
|
61
|
-
modules,
|
|
62
|
-
logger,
|
|
63
|
-
executeActions,
|
|
64
|
-
collect: viewCollect
|
|
51
|
+
executeActions
|
|
65
52
|
});
|
|
66
53
|
const handleRedirectDecisions = createRedirectHandler({
|
|
67
54
|
collect,
|
|
@@ -69,16 +56,11 @@ const createPersonalization = ({
|
|
|
69
56
|
logger,
|
|
70
57
|
showContainers
|
|
71
58
|
});
|
|
72
|
-
const executeCachedViewDecisions = createExecuteCachedViewDecisions({
|
|
73
|
-
viewCache,
|
|
74
|
-
executeViewDecisions,
|
|
75
|
-
collect: viewCollect
|
|
76
|
-
});
|
|
77
59
|
const autoRenderingHandler = createAutorenderingHandler({
|
|
78
60
|
viewCache,
|
|
79
61
|
executeDecisions,
|
|
80
|
-
|
|
81
|
-
|
|
62
|
+
showContainers,
|
|
63
|
+
collect
|
|
82
64
|
});
|
|
83
65
|
const nonRenderingHandler = createNonRenderingHandler({
|
|
84
66
|
viewCache
|
|
@@ -103,7 +85,9 @@ const createPersonalization = ({
|
|
|
103
85
|
getClickMetasBySelector
|
|
104
86
|
});
|
|
105
87
|
const viewChangeHandler = createViewChangeHandler({
|
|
106
|
-
|
|
88
|
+
mergeDecisionsMeta,
|
|
89
|
+
collect,
|
|
90
|
+
executeDecisions,
|
|
107
91
|
viewCache
|
|
108
92
|
});
|
|
109
93
|
return createComponent({
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import addRenderAttemptedToDecisions from "./addRenderAttemptedToDecisions";
|
|
2
|
+
export default ((decisions = [], renderDecisions) => {
|
|
3
|
+
const resultingObject = {
|
|
4
|
+
propositions: addRenderAttemptedToDecisions({
|
|
5
|
+
decisions,
|
|
6
|
+
renderAttempted: renderDecisions
|
|
7
|
+
})
|
|
8
|
+
};
|
|
9
|
+
|
|
10
|
+
if (!renderDecisions) {
|
|
11
|
+
resultingObject.decisions = decisions;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
return resultingObject;
|
|
15
|
+
});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@adobe/alloy",
|
|
3
|
-
"version": "2.9.0
|
|
3
|
+
"version": "2.9.0",
|
|
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.9.0-
|
|
67
|
+
"@adobe/alloy": "^2.9.0-beta.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",
|
|
@@ -1,47 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
exports.default = void 0;
|
|
4
|
-
|
|
5
|
-
var _isNonEmptyArray = require("../../utils/isNonEmptyArray");
|
|
6
|
-
|
|
7
|
-
/*
|
|
8
|
-
Copyright 2020 Adobe. All rights reserved.
|
|
9
|
-
This file is licensed to you under the Apache License, Version 2.0 (the "License");
|
|
10
|
-
you may not use this file except in compliance with the License. You may obtain a copy
|
|
11
|
-
of the License at http://www.apache.org/licenses/LICENSE-2.0
|
|
12
|
-
|
|
13
|
-
Unless required by applicable law or agreed to in writing, software distributed under
|
|
14
|
-
the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
|
|
15
|
-
OF ANY KIND, either express or implied. See the License for the specific language
|
|
16
|
-
governing permissions and limitations under the License.
|
|
17
|
-
*/
|
|
18
|
-
var _default = function _default(_ref) {
|
|
19
|
-
var executeViewDecisions = _ref.executeViewDecisions,
|
|
20
|
-
collect = _ref.collect;
|
|
21
|
-
return function (_ref2) {
|
|
22
|
-
var viewName = _ref2.viewName,
|
|
23
|
-
viewDecisions = _ref2.viewDecisions;
|
|
24
|
-
|
|
25
|
-
// if there are viewDecisions for current view we will execute them and then send the collect call
|
|
26
|
-
if ((0, _isNonEmptyArray.default)(viewDecisions)) {
|
|
27
|
-
executeViewDecisions(viewDecisions);
|
|
28
|
-
return; // return here is to avoid the following code to be executed, that one is meant for the condition when viewDecisions is empty
|
|
29
|
-
} // if there are no viewDecisions for current view we will send a collect call
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
var xdm = {
|
|
33
|
-
web: {
|
|
34
|
-
webPageDetails: {
|
|
35
|
-
viewName: viewName
|
|
36
|
-
}
|
|
37
|
-
}
|
|
38
|
-
}; // This collect function is not from createCollect. It's the function from createViewCollect.
|
|
39
|
-
|
|
40
|
-
collect({
|
|
41
|
-
decisionsMeta: [],
|
|
42
|
-
xdm: xdm
|
|
43
|
-
});
|
|
44
|
-
};
|
|
45
|
-
};
|
|
46
|
-
|
|
47
|
-
exports.default = _default;
|
|
@@ -1,48 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
exports.default = void 0;
|
|
4
|
-
|
|
5
|
-
var _utils = require("../../utils");
|
|
6
|
-
|
|
7
|
-
var _eventType = require("./constants/eventType");
|
|
8
|
-
|
|
9
|
-
/*
|
|
10
|
-
Copyright 2020 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 _default = function _default(_ref) {
|
|
21
|
-
var eventManager = _ref.eventManager,
|
|
22
|
-
mergeDecisionsMeta = _ref.mergeDecisionsMeta;
|
|
23
|
-
// Called when an offer for a specific SPA view is auto-rendered.
|
|
24
|
-
return function (_ref2) {
|
|
25
|
-
var decisionsMeta = _ref2.decisionsMeta,
|
|
26
|
-
xdm = _ref2.xdm;
|
|
27
|
-
var data = {
|
|
28
|
-
eventType: _eventType.DISPLAY
|
|
29
|
-
};
|
|
30
|
-
var event = eventManager.createEvent();
|
|
31
|
-
|
|
32
|
-
if ((0, _utils.isNonEmptyArray)(decisionsMeta)) {
|
|
33
|
-
var viewName = decisionsMeta[0].scope;
|
|
34
|
-
data.web = {
|
|
35
|
-
webPageDetails: {
|
|
36
|
-
viewName: viewName
|
|
37
|
-
}
|
|
38
|
-
};
|
|
39
|
-
mergeDecisionsMeta(event, decisionsMeta);
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
event.mergeXdm(data);
|
|
43
|
-
event.mergeXdm(xdm);
|
|
44
|
-
return eventManager.sendEvent(event);
|
|
45
|
-
};
|
|
46
|
-
};
|
|
47
|
-
|
|
48
|
-
exports.default = _default;
|
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
Copyright 2020 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 isNonEmptyArray from "../../utils/isNonEmptyArray";
|
|
13
|
-
export default (({
|
|
14
|
-
executeViewDecisions,
|
|
15
|
-
collect
|
|
16
|
-
}) => {
|
|
17
|
-
return ({
|
|
18
|
-
viewName,
|
|
19
|
-
viewDecisions
|
|
20
|
-
}) => {
|
|
21
|
-
// if there are viewDecisions for current view we will execute them and then send the collect call
|
|
22
|
-
if (isNonEmptyArray(viewDecisions)) {
|
|
23
|
-
executeViewDecisions(viewDecisions);
|
|
24
|
-
return; // return here is to avoid the following code to be executed, that one is meant for the condition when viewDecisions is empty
|
|
25
|
-
} // if there are no viewDecisions for current view we will send a collect call
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
const xdm = {
|
|
29
|
-
web: {
|
|
30
|
-
webPageDetails: {
|
|
31
|
-
viewName
|
|
32
|
-
}
|
|
33
|
-
}
|
|
34
|
-
}; // This collect function is not from createCollect. It's the function from createViewCollect.
|
|
35
|
-
|
|
36
|
-
collect({
|
|
37
|
-
decisionsMeta: [],
|
|
38
|
-
xdm
|
|
39
|
-
});
|
|
40
|
-
};
|
|
41
|
-
});
|
|
@@ -1,42 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
Copyright 2020 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 { isNonEmptyArray } from "../../utils";
|
|
13
|
-
import { DISPLAY } from "./constants/eventType";
|
|
14
|
-
export default (({
|
|
15
|
-
eventManager,
|
|
16
|
-
mergeDecisionsMeta
|
|
17
|
-
}) => {
|
|
18
|
-
// Called when an offer for a specific SPA view is auto-rendered.
|
|
19
|
-
return ({
|
|
20
|
-
decisionsMeta,
|
|
21
|
-
xdm
|
|
22
|
-
}) => {
|
|
23
|
-
const data = {
|
|
24
|
-
eventType: DISPLAY
|
|
25
|
-
};
|
|
26
|
-
const event = eventManager.createEvent();
|
|
27
|
-
|
|
28
|
-
if (isNonEmptyArray(decisionsMeta)) {
|
|
29
|
-
const viewName = decisionsMeta[0].scope;
|
|
30
|
-
data.web = {
|
|
31
|
-
webPageDetails: {
|
|
32
|
-
viewName
|
|
33
|
-
}
|
|
34
|
-
};
|
|
35
|
-
mergeDecisionsMeta(event, decisionsMeta);
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
event.mergeXdm(data);
|
|
39
|
-
event.mergeXdm(xdm);
|
|
40
|
-
return eventManager.sendEvent(event);
|
|
41
|
-
};
|
|
42
|
-
});
|