@adobe/alloy 2.9.0-alpha.3 → 2.9.0-alpha.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (37) hide show
  1. package/libEs5/components/DataCollector/index.js +1 -1
  2. package/libEs5/components/Personalization/constants/schema.js +3 -1
  3. package/libEs5/components/Personalization/constants/scopeType.js +17 -0
  4. package/libEs5/components/Personalization/createAutoRenderingHandler.js +66 -39
  5. package/libEs5/components/Personalization/createCollect.js +23 -6
  6. package/libEs5/components/Personalization/createComponent.js +3 -1
  7. package/libEs5/components/Personalization/createExecuteDecisions.js +9 -12
  8. package/libEs5/components/Personalization/createPersonalizationDetails.js +1 -1
  9. package/libEs5/components/Personalization/createViewChangeHandler.js +28 -18
  10. package/libEs5/components/Personalization/dom-actions/initDomActionsModules.js +5 -0
  11. package/libEs5/components/Personalization/groupDecisions.js +37 -18
  12. package/libEs5/components/Personalization/index.js +6 -24
  13. package/libEs5/components/Personalization/utils/composePersonalizationResultingObject.js +24 -0
  14. package/libEs5/constants/libraryVersion.js +1 -1
  15. package/libEs5/core/buildAndValidateConfig.js +1 -1
  16. package/libEs5/core/validateCommandOptions.js +1 -1
  17. package/libEs6/components/DataCollector/index.js +1 -1
  18. package/libEs6/components/Personalization/constants/schema.js +1 -0
  19. package/libEs6/components/Personalization/constants/scopeType.js +12 -0
  20. package/libEs6/components/Personalization/createAutoRenderingHandler.js +59 -33
  21. package/libEs6/components/Personalization/createCollect.js +21 -6
  22. package/libEs6/components/Personalization/createComponent.js +3 -1
  23. package/libEs6/components/Personalization/createExecuteDecisions.js +9 -13
  24. package/libEs6/components/Personalization/createPersonalizationDetails.js +2 -2
  25. package/libEs6/components/Personalization/createViewChangeHandler.js +27 -18
  26. package/libEs6/components/Personalization/dom-actions/initDomActionsModules.js +4 -1
  27. package/libEs6/components/Personalization/groupDecisions.js +32 -20
  28. package/libEs6/components/Personalization/index.js +6 -22
  29. package/libEs6/components/Personalization/utils/composePersonalizationResultingObject.js +15 -0
  30. package/libEs6/constants/libraryVersion.js +1 -1
  31. package/libEs6/core/buildAndValidateConfig.js +1 -1
  32. package/libEs6/core/validateCommandOptions.js +1 -1
  33. package/package.json +2 -2
  34. package/libEs5/components/Personalization/createExecuteCachedViewDecisions.js +0 -47
  35. package/libEs5/components/Personalization/createViewCollect.js +0 -48
  36. package/libEs6/components/Personalization/createExecuteCachedViewDecisions.js +0 -41
  37. package/libEs6/components/Personalization/createViewCollect.js +0 -42
@@ -20,7 +20,7 @@ var createDataCollector = function createDataCollector(_ref) {
20
20
  return {
21
21
  commands: {
22
22
  sendEvent: {
23
- documentationUri: "https://adobe.ly/2r0uUjh",
23
+ documentationUri: "https://adobe.ly/3GQ3Q7t",
24
24
  optionsValidator: function optionsValidator(options) {
25
25
  return (0, _validateUserEventOptions.default)({
26
26
  options: options
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
 
3
- exports.REDIRECT_ITEM = exports.JSON_CONTENT_ITEM = exports.HTML_CONTENT_ITEM = exports.DOM_ACTION = void 0;
3
+ exports.REDIRECT_ITEM = exports.JSON_CONTENT_ITEM = exports.HTML_CONTENT_ITEM = exports.DOM_ACTION = exports.DEFAULT_CONTENT_ITEM = void 0;
4
4
 
5
5
  /*
6
6
  Copyright 2019 Adobe. All rights reserved.
@@ -13,6 +13,8 @@ the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTA
13
13
  OF ANY KIND, either express or implied. See the License for the specific language
14
14
  governing permissions and limitations under the License.
15
15
  */
16
+ var DEFAULT_CONTENT_ITEM = "https://ns.adobe.com/personalization/default-content-item";
17
+ exports.DEFAULT_CONTENT_ITEM = DEFAULT_CONTENT_ITEM;
16
18
  var DOM_ACTION = "https://ns.adobe.com/personalization/dom-action";
17
19
  exports.DOM_ACTION = DOM_ACTION;
18
20
  var HTML_CONTENT_ITEM = "https://ns.adobe.com/personalization/html-content-item";
@@ -0,0 +1,17 @@
1
+ "use strict";
2
+
3
+ exports.VIEW_SCOPE_TYPE = void 0;
4
+
5
+ /*
6
+ Copyright 2022 Adobe. All rights reserved.
7
+ This file is licensed to you under the Apache License, Version 2.0 (the "License");
8
+ you may not use this file except in compliance with the License. You may obtain a copy
9
+ of the License at http://www.apache.org/licenses/LICENSE-2.0
10
+
11
+ Unless required by applicable law or agreed to in writing, software distributed under
12
+ the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
13
+ OF ANY KIND, either express or implied. See the License for the specific language
14
+ governing permissions and limitations under the License.
15
+ */
16
+ var VIEW_SCOPE_TYPE = "view";
17
+ exports.VIEW_SCOPE_TYPE = VIEW_SCOPE_TYPE;
@@ -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 _default = function _default(_ref) {
21
+ var getPropositions = function getPropositions(_ref) {
20
22
  var viewCache = _ref.viewCache,
21
- executeDecisions = _ref.executeDecisions,
22
- executeCachedViewDecisions = _ref.executeCachedViewDecisions,
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
- executeDecisions(pageWideScopeDecisions);
51
- showContainers();
26
+ if (!viewName) {
52
27
  return {
53
- decisions: _toConsumableArray(nonAutoRenderableDecisions),
54
- propositions: [].concat(_toConsumableArray((0, _addRenderAttemptedToDecisions.default)({
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 (non-SPA view).
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
- event.mergeXdm({
31
+ var data = {
28
32
  eventType: _eventType.DISPLAY
29
- });
30
- mergeDecisionsMeta(event, decisionsMeta);
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
- viewChangeHandler({
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
  });
@@ -15,6 +15,8 @@ the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTA
15
15
  OF ANY KIND, either express or implied. See the License for the specific language
16
16
  governing permissions and limitations under the License.
17
17
  */
18
+ var DEFAULT_ACTION_TYPE = "defaultContent";
19
+
18
20
  var identity = function identity(item) {
19
21
  return item;
20
22
  };
@@ -26,13 +28,15 @@ var buildActions = function buildActions(decision) {
26
28
  scopeDetails: decision.scopeDetails
27
29
  };
28
30
  return decision.items.map(function (item) {
29
- return (0, _utils.assign)({}, item.data, {
31
+ return (0, _utils.assign)({
32
+ type: DEFAULT_ACTION_TYPE
33
+ }, item.data, {
30
34
  meta: meta
31
35
  });
32
36
  });
33
37
  };
34
38
 
35
- var processMetas = function processMetas(collect, logger, actionResults) {
39
+ var processMetas = function processMetas(logger, actionResults) {
36
40
  var results = (0, _utils.flatMap)(actionResults, identity);
37
41
  var finalMetas = [];
38
42
  var set = new Set();
@@ -56,27 +60,20 @@ var processMetas = function processMetas(collect, logger, actionResults) {
56
60
  set.add(meta.id);
57
61
  finalMetas.push(meta);
58
62
  });
59
-
60
- if ((0, _utils.isNonEmptyArray)(finalMetas)) {
61
- // collect here can either be the function from createCollect or createViewCollect.
62
- collect({
63
- decisionsMeta: finalMetas
64
- });
65
- }
63
+ return finalMetas;
66
64
  };
67
65
 
68
66
  var _default = function _default(_ref) {
69
67
  var modules = _ref.modules,
70
68
  logger = _ref.logger,
71
- executeActions = _ref.executeActions,
72
- collect = _ref.collect;
69
+ executeActions = _ref.executeActions;
73
70
  return function (decisions) {
74
71
  var actionResultsPromises = decisions.map(function (decision) {
75
72
  var actions = buildActions(decision);
76
73
  return executeActions(actions, modules, logger);
77
74
  });
78
75
  return Promise.all(actionResultsPromises).then(function (results) {
79
- return processMetas(collect, logger, results);
76
+ return processMetas(logger, results);
80
77
  }).catch(function (error) {
81
78
  logger.error(error);
82
79
  });
@@ -48,7 +48,7 @@ var _default = function _default(_ref) {
48
48
  scopes.push(_scope.default);
49
49
  }
50
50
 
51
- var schemas = [_schema.HTML_CONTENT_ITEM, _schema.JSON_CONTENT_ITEM, _schema.REDIRECT_ITEM];
51
+ var schemas = [_schema.DEFAULT_CONTENT_ITEM, _schema.HTML_CONTENT_ITEM, _schema.JSON_CONTENT_ITEM, _schema.REDIRECT_ITEM];
52
52
 
53
53
  if ((0, _utils.includes)(scopes, _scope.default)) {
54
54
  schemas.push(_schema.DOM_ACTION);
@@ -2,7 +2,9 @@
2
2
 
3
3
  exports.default = void 0;
4
4
 
5
- var _addRenderAttemptedToDecisions = require("./utils/addRenderAttemptedToDecisions");
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 executeCachedViewDecisions = _ref.executeCachedViewDecisions,
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 (currentViewDecisions) {
30
+ return viewCache.getView(viewName).then(function (viewDecisions) {
26
31
  if (personalizationDetails.isRenderDecisions()) {
27
- executeCachedViewDecisions({
28
- viewName: viewName,
29
- viewDecisions: currentViewDecisions
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 personalizationDetails.isRenderDecisions() ? {
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
  };
@@ -36,6 +36,11 @@ var _default = function _default(store) {
36
36
  appendHtml: (0, _action.createAction)(_action.appendHtml),
37
37
  click: function click(settings) {
38
38
  return (0, _action.click)(settings, store);
39
+ },
40
+ defaultContent: function defaultContent(settings) {
41
+ return Promise.resolve({
42
+ meta: settings.meta
43
+ });
39
44
  }
40
45
  };
41
46
  };
@@ -6,6 +6,8 @@ var _utils = require("../../utils");
6
6
 
7
7
  var _schema = require("./constants/schema");
8
8
 
9
+ var _scopeType = require("./constants/scopeType");
10
+
9
11
  var _scope = require("./constants/scope");
10
12
 
11
13
  function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
@@ -20,11 +22,11 @@ function _iterableToArrayLimit(arr, i) { var _i = arr == null ? null : typeof Sy
20
22
 
21
23
  function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
22
24
 
23
- var splitItems = function splitItems(items, schema) {
25
+ var splitItems = function splitItems(items, schemas) {
24
26
  var matched = [];
25
27
  var nonMatched = [];
26
28
  items.forEach(function (item) {
27
- if (item.schema === schema) {
29
+ if ((0, _utils.includes)(schemas, item.schema)) {
28
30
  matched.push(item);
29
31
  } else {
30
32
  nonMatched.push(item);
@@ -42,14 +44,18 @@ var createDecision = function createDecision(decision, items) {
42
44
  };
43
45
  };
44
46
 
45
- var splitDecisions = function splitDecisions(decisions, schema) {
47
+ var splitDecisions = function splitDecisions(decisions) {
48
+ for (var _len = arguments.length, schemas = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
49
+ schemas[_key - 1] = arguments[_key];
50
+ }
51
+
46
52
  var matchedDecisions = [];
47
53
  var unmatchedDecisions = [];
48
54
  decisions.forEach(function (decision) {
49
55
  var _decision$items = decision.items,
50
56
  items = _decision$items === void 0 ? [] : _decision$items;
51
57
 
52
- var _splitItems = splitItems(items, schema),
58
+ var _splitItems = splitItems(items, schemas),
53
59
  _splitItems2 = _slicedToArray(_splitItems, 2),
54
60
  matchedItems = _splitItems2[0],
55
61
  nonMatchedItems = _splitItems2[1];
@@ -68,43 +74,56 @@ var splitDecisions = function splitDecisions(decisions, schema) {
68
74
  };
69
75
  };
70
76
 
71
- var extractDecisionsByScope = function extractDecisionsByScope(decisions, scope) {
77
+ var appendScopeDecision = function appendScopeDecision(scopeDecisions, decision) {
78
+ if (!scopeDecisions[decision.scope]) {
79
+ scopeDecisions[decision.scope] = [];
80
+ }
81
+
82
+ scopeDecisions[decision.scope].push(decision);
83
+ };
84
+
85
+ var isViewScope = function isViewScope(scopeDetails) {
86
+ return scopeDetails.characteristics && scopeDetails.characteristics.scopeType && scopeDetails.characteristics.scopeType === _scopeType.VIEW_SCOPE_TYPE;
87
+ };
88
+
89
+ var extractDecisionsByScope = function extractDecisionsByScope(decisions) {
72
90
  var pageWideScopeDecisions = [];
73
- var nonPageWideScopeDecisions = {};
91
+ var nonPageWideScopeDecisions = [];
92
+ var viewScopeDecisions = {};
74
93
 
75
94
  if ((0, _utils.isNonEmptyArray)(decisions)) {
76
95
  decisions.forEach(function (decision) {
77
- if (decision.scope === scope) {
96
+ if (decision.scope === _scope.default) {
78
97
  pageWideScopeDecisions.push(decision);
98
+ } else if (isViewScope(decision.scopeDetails)) {
99
+ appendScopeDecision(viewScopeDecisions, decision);
79
100
  } else {
80
- if (!nonPageWideScopeDecisions[decision.scope]) {
81
- nonPageWideScopeDecisions[decision.scope] = [];
82
- }
83
-
84
- nonPageWideScopeDecisions[decision.scope].push(decision);
101
+ nonPageWideScopeDecisions.push(decision);
85
102
  }
86
103
  });
87
104
  }
88
105
 
89
106
  return {
90
107
  pageWideScopeDecisions: pageWideScopeDecisions,
91
- nonPageWideScopeDecisions: nonPageWideScopeDecisions
108
+ nonPageWideScopeDecisions: nonPageWideScopeDecisions,
109
+ viewScopeDecisions: viewScopeDecisions
92
110
  };
93
111
  };
94
112
 
95
113
  var groupDecisions = function groupDecisions(unprocessedDecisions) {
96
114
  var decisionsGroupedByRedirectItemSchema = splitDecisions(unprocessedDecisions, _schema.REDIRECT_ITEM);
97
- var decisionsGroupedByDomActionSchema = splitDecisions(decisionsGroupedByRedirectItemSchema.unmatchedDecisions, _schema.DOM_ACTION);
115
+ var decisionsGroupedByRenderableSchemas = splitDecisions(decisionsGroupedByRedirectItemSchema.unmatchedDecisions, _schema.DOM_ACTION, _schema.DEFAULT_CONTENT_ITEM);
98
116
 
99
- var _extractDecisionsBySc = extractDecisionsByScope(decisionsGroupedByDomActionSchema.matchedDecisions, _scope.default),
117
+ var _extractDecisionsBySc = extractDecisionsByScope(decisionsGroupedByRenderableSchemas.matchedDecisions),
100
118
  pageWideScopeDecisions = _extractDecisionsBySc.pageWideScopeDecisions,
101
- nonPageWideScopeDecisions = _extractDecisionsBySc.nonPageWideScopeDecisions;
119
+ nonPageWideScopeDecisions = _extractDecisionsBySc.nonPageWideScopeDecisions,
120
+ viewScopeDecisions = _extractDecisionsBySc.viewScopeDecisions;
102
121
 
103
122
  return {
104
123
  redirectDecisions: decisionsGroupedByRedirectItemSchema.matchedDecisions,
105
124
  pageWideScopeDecisions: pageWideScopeDecisions,
106
- viewDecisions: nonPageWideScopeDecisions,
107
- nonAutoRenderableDecisions: decisionsGroupedByDomActionSchema.unmatchedDecisions
125
+ viewDecisions: viewScopeDecisions,
126
+ nonAutoRenderableDecisions: decisionsGroupedByRenderableSchemas.unmatchedDecisions.concat(nonPageWideScopeDecisions)
108
127
  };
109
128
  };
110
129
 
@@ -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
- executeCachedViewDecisions: executeCachedViewDecisions,
105
- showContainers: _flicker.showContainers
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
- executeCachedViewDecisions: executeCachedViewDecisions,
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-alpha.3";
18
+ var _default = "2.9.0-alpha.6";
19
19
  exports.default = _default;
@@ -17,7 +17,7 @@ the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTA
17
17
  OF ANY KIND, either express or implied. See the License for the specific language
18
18
  governing permissions and limitations under the License.
19
19
  */
20
- var CONFIG_DOC_URI = "https://adobe.ly/2M4ErNE";
20
+ var CONFIG_DOC_URI = "https://adobe.ly/3sHh553";
21
21
 
22
22
  var buildSchema = function buildSchema(coreConfigValidators, componentCreators) {
23
23
  var schema = {};
@@ -13,7 +13,7 @@ the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTA
13
13
  OF ANY KIND, either express or implied. See the License for the specific language
14
14
  governing permissions and limitations under the License.
15
15
  */
16
- var COMMAND_DOC_URI = "https://adobe.ly/2UH0qO7";
16
+ var COMMAND_DOC_URI = "https://adobe.ly/3sHgQHb";
17
17
 
18
18
  var _default = function _default(_ref) {
19
19
  var command = _ref.command,
@@ -17,7 +17,7 @@ const createDataCollector = ({
17
17
  return {
18
18
  commands: {
19
19
  sendEvent: {
20
- documentationUri: "https://adobe.ly/2r0uUjh",
20
+ documentationUri: "https://adobe.ly/3GQ3Q7t",
21
21
  optionsValidator: options => {
22
22
  return validateUserEventOptions({
23
23
  options
@@ -9,6 +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
+ export const DEFAULT_CONTENT_ITEM = "https://ns.adobe.com/personalization/default-content-item";
12
13
  export const DOM_ACTION = "https://ns.adobe.com/personalization/dom-action";
13
14
  export const HTML_CONTENT_ITEM = "https://ns.adobe.com/personalization/html-content-item";
14
15
  export const JSON_CONTENT_ITEM = "https://ns.adobe.com/personalization/json-content-item";
@@ -0,0 +1,12 @@
1
+ /*
2
+ Copyright 2022 Adobe. All rights reserved.
3
+ This file is licensed to you under the Apache License, Version 2.0 (the "License");
4
+ you may not use this file except in compliance with the License. You may obtain a copy
5
+ of the License at http://www.apache.org/licenses/LICENSE-2.0
6
+
7
+ Unless required by applicable law or agreed to in writing, software distributed under
8
+ the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
9
+ OF ANY KIND, either express or implied. See the License for the specific language
10
+ governing permissions and limitations under the License.
11
+ */
12
+ export const VIEW_SCOPE_TYPE = "view";