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

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.
@@ -26,7 +26,8 @@ var _default = function _default(_ref) {
26
26
  onClickHandler = _ref.onClickHandler,
27
27
  isAuthoringModeEnabled = _ref.isAuthoringModeEnabled,
28
28
  mergeQuery = _ref.mergeQuery,
29
- viewCache = _ref.viewCache;
29
+ viewCache = _ref.viewCache,
30
+ showContainers = _ref.showContainers;
30
31
  return {
31
32
  lifecycle: {
32
33
  onBeforeEvent: function onBeforeEvent(_ref2) {
@@ -38,12 +39,15 @@ var _default = function _default(_ref) {
38
39
  onResponse = _ref2$onResponse === void 0 ? _utils.noop : _ref2$onResponse,
39
40
  _ref2$onRequestFailur = _ref2.onRequestFailure,
40
41
  onRequestFailure = _ref2$onRequestFailur === void 0 ? _utils.noop : _ref2$onRequestFailur;
41
- // Include proositions on all responses, overridden with data as needed
42
+ // Include propositions on all responses, overridden with data as needed
42
43
  onResponse(function () {
43
44
  return {
44
45
  propositions: []
45
46
  };
46
47
  });
48
+ onRequestFailure(function () {
49
+ return showContainers();
50
+ });
47
51
 
48
52
  if (isAuthoringModeEnabled()) {
49
53
  logger.warn(_loggerMessage.AUTHORING_ENABLED); // If we are in authoring mode we disable personalization
@@ -64,12 +68,14 @@ var _default = function _default(_ref) {
64
68
  if (personalizationDetails.shouldFetchData()) {
65
69
  var decisionsDeferred = (0, _utils.defer)();
66
70
  viewCache.storeViews(decisionsDeferred.promise);
71
+ onRequestFailure(function () {
72
+ return decisionsDeferred.reject();
73
+ });
67
74
  fetchDataHandler({
68
75
  decisionsDeferred: decisionsDeferred,
69
76
  personalizationDetails: personalizationDetails,
70
77
  event: event,
71
- onResponse: onResponse,
72
- onRequestFailure: onRequestFailure
78
+ onResponse: onResponse
73
79
  });
74
80
  return;
75
81
  }
@@ -16,15 +16,13 @@ governing permissions and limitations under the License.
16
16
  var _default = function _default(_ref) {
17
17
  var config = _ref.config,
18
18
  responseHandler = _ref.responseHandler,
19
- showContainers = _ref.showContainers,
20
19
  hideContainers = _ref.hideContainers,
21
20
  mergeQuery = _ref.mergeQuery;
22
21
  return function (_ref2) {
23
22
  var decisionsDeferred = _ref2.decisionsDeferred,
24
23
  personalizationDetails = _ref2.personalizationDetails,
25
24
  event = _ref2.event,
26
- onResponse = _ref2.onResponse,
27
- onRequestFailure = _ref2.onRequestFailure;
25
+ onResponse = _ref2.onResponse;
28
26
  var prehidingStyle = config.prehidingStyle;
29
27
 
30
28
  if (personalizationDetails.isRenderDecisions()) {
@@ -40,10 +38,6 @@ var _default = function _default(_ref) {
40
38
  response: response
41
39
  });
42
40
  });
43
- onRequestFailure(function () {
44
- decisionsDeferred.reject();
45
- showContainers();
46
- });
47
41
  };
48
42
  };
49
43
 
@@ -6,6 +6,8 @@ var _utils = require("../../utils");
6
6
 
7
7
  var _eventType = require("./constants/eventType");
8
8
 
9
+ var _scope = require("./constants/scope");
10
+
9
11
  /*
10
12
  Copyright 2020 Adobe. All rights reserved.
11
13
  This file is licensed to you under the Apache License, Version 2.0 (the "License");
@@ -32,9 +34,20 @@ var _default = function _default(_ref) {
32
34
  var decisionsMeta = collectClicks(clickedElement, selectors, getClickMetasBySelector);
33
35
 
34
36
  if ((0, _utils.isNonEmptyArray)(decisionsMeta)) {
35
- event.mergeXdm({
37
+ var xdm = {
36
38
  eventType: _eventType.INTERACT
37
- });
39
+ };
40
+ var scope = decisionsMeta[0].scope;
41
+
42
+ if (scope !== _scope.default) {
43
+ xdm.web = {
44
+ webPageDetails: {
45
+ viewName: scope
46
+ }
47
+ };
48
+ }
49
+
50
+ event.mergeXdm(xdm);
38
51
  mergeDecisionsMeta(event, decisionsMeta);
39
52
  }
40
53
  }
@@ -17,12 +17,10 @@ governing permissions and limitations under the License.
17
17
  */
18
18
  var _default = function _default(_ref) {
19
19
  var executeCachedViewDecisions = _ref.executeCachedViewDecisions,
20
- viewCache = _ref.viewCache,
21
- showContainers = _ref.showContainers;
20
+ viewCache = _ref.viewCache;
22
21
  return function (_ref2) {
23
22
  var personalizationDetails = _ref2.personalizationDetails,
24
- onResponse = _ref2.onResponse,
25
- onRequestFailure = _ref2.onRequestFailure;
23
+ onResponse = _ref2.onResponse;
26
24
  var viewName = personalizationDetails.getViewName();
27
25
  return viewCache.getView(viewName).then(function (currentViewDecisions) {
28
26
  if (personalizationDetails.isRenderDecisions()) {
@@ -46,9 +44,6 @@ var _default = function _default(_ref) {
46
44
  })
47
45
  };
48
46
  });
49
- onRequestFailure(function () {
50
- showContainers();
51
- });
52
47
  });
53
48
  };
54
49
  };
@@ -117,7 +117,6 @@ var createPersonalization = function createPersonalization(_ref) {
117
117
  var fetchDataHandler = (0, _createFetchDataHandler.default)({
118
118
  config: config,
119
119
  responseHandler: responseHandler,
120
- showContainers: _flicker.showContainers,
121
120
  hideContainers: _flicker.hideContainers,
122
121
  mergeQuery: _event.mergeQuery
123
122
  });
@@ -129,8 +128,7 @@ var createPersonalization = function createPersonalization(_ref) {
129
128
  });
130
129
  var viewChangeHandler = (0, _createViewChangeHandler.default)({
131
130
  executeCachedViewDecisions: executeCachedViewDecisions,
132
- viewCache: viewCache,
133
- showContainers: _flicker.showContainers
131
+ viewCache: viewCache
134
132
  });
135
133
  return (0, _createComponent.default)({
136
134
  logger: logger,
@@ -139,7 +137,8 @@ var createPersonalization = function createPersonalization(_ref) {
139
137
  onClickHandler: onClickHandler,
140
138
  isAuthoringModeEnabled: _isAuthoringModeEnabled.default,
141
139
  mergeQuery: _event.mergeQuery,
142
- viewCache: viewCache
140
+ viewCache: viewCache,
141
+ showContainers: _flicker.showContainers
143
142
  });
144
143
  };
145
144
 
@@ -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.0";
18
+ var _default = "2.9.0-alpha.3";
19
19
  exports.default = _default;
@@ -19,7 +19,8 @@ export default (({
19
19
  onClickHandler,
20
20
  isAuthoringModeEnabled,
21
21
  mergeQuery,
22
- viewCache
22
+ viewCache,
23
+ showContainers
23
24
  }) => {
24
25
  return {
25
26
  lifecycle: {
@@ -30,10 +31,11 @@ export default (({
30
31
  onResponse = noop,
31
32
  onRequestFailure = noop
32
33
  }) {
33
- // Include proositions on all responses, overridden with data as needed
34
+ // Include propositions on all responses, overridden with data as needed
34
35
  onResponse(() => ({
35
36
  propositions: []
36
37
  }));
38
+ onRequestFailure(() => showContainers());
37
39
 
38
40
  if (isAuthoringModeEnabled()) {
39
41
  logger.warn(AUTHORING_ENABLED); // If we are in authoring mode we disable personalization
@@ -54,12 +56,12 @@ export default (({
54
56
  if (personalizationDetails.shouldFetchData()) {
55
57
  const decisionsDeferred = defer();
56
58
  viewCache.storeViews(decisionsDeferred.promise);
59
+ onRequestFailure(() => decisionsDeferred.reject());
57
60
  fetchDataHandler({
58
61
  decisionsDeferred,
59
62
  personalizationDetails,
60
63
  event,
61
- onResponse,
62
- onRequestFailure
64
+ onResponse
63
65
  });
64
66
  return;
65
67
  }
@@ -12,7 +12,6 @@ governing permissions and limitations under the License.
12
12
  export default (({
13
13
  config,
14
14
  responseHandler,
15
- showContainers,
16
15
  hideContainers,
17
16
  mergeQuery
18
17
  }) => {
@@ -20,8 +19,7 @@ export default (({
20
19
  decisionsDeferred,
21
20
  personalizationDetails,
22
21
  event,
23
- onResponse,
24
- onRequestFailure
22
+ onResponse
25
23
  }) => {
26
24
  const {
27
25
  prehidingStyle
@@ -39,9 +37,5 @@ export default (({
39
37
  personalizationDetails,
40
38
  response
41
39
  }));
42
- onRequestFailure(() => {
43
- decisionsDeferred.reject();
44
- showContainers();
45
- });
46
40
  };
47
41
  });
@@ -11,6 +11,7 @@ governing permissions and limitations under the License.
11
11
  */
12
12
  import { isNonEmptyArray } from "../../utils";
13
13
  import { INTERACT } from "./constants/eventType";
14
+ import PAGE_WIDE_SCOPE from "./constants/scope";
14
15
  export default (({
15
16
  mergeDecisionsMeta,
16
17
  collectClicks,
@@ -28,9 +29,20 @@ export default (({
28
29
  const decisionsMeta = collectClicks(clickedElement, selectors, getClickMetasBySelector);
29
30
 
30
31
  if (isNonEmptyArray(decisionsMeta)) {
31
- event.mergeXdm({
32
+ const xdm = {
32
33
  eventType: INTERACT
33
- });
34
+ };
35
+ const scope = decisionsMeta[0].scope;
36
+
37
+ if (scope !== PAGE_WIDE_SCOPE) {
38
+ xdm.web = {
39
+ webPageDetails: {
40
+ viewName: scope
41
+ }
42
+ };
43
+ }
44
+
45
+ event.mergeXdm(xdm);
34
46
  mergeDecisionsMeta(event, decisionsMeta);
35
47
  }
36
48
  }
@@ -12,13 +12,11 @@ governing permissions and limitations under the License.
12
12
  import addRenderAttemptedToDecisions from "./utils/addRenderAttemptedToDecisions";
13
13
  export default (({
14
14
  executeCachedViewDecisions,
15
- viewCache,
16
- showContainers
15
+ viewCache
17
16
  }) => {
18
17
  return ({
19
18
  personalizationDetails,
20
- onResponse,
21
- onRequestFailure
19
+ onResponse
22
20
  }) => {
23
21
  const viewName = personalizationDetails.getViewName();
24
22
  return viewCache.getView(viewName).then(currentViewDecisions => {
@@ -43,9 +41,6 @@ export default (({
43
41
  })
44
42
  };
45
43
  });
46
- onRequestFailure(() => {
47
- showContainers();
48
- });
49
44
  });
50
45
  };
51
46
  });
@@ -93,7 +93,6 @@ const createPersonalization = ({
93
93
  const fetchDataHandler = createFetchDataHandler({
94
94
  config,
95
95
  responseHandler,
96
- showContainers,
97
96
  hideContainers,
98
97
  mergeQuery
99
98
  });
@@ -105,8 +104,7 @@ const createPersonalization = ({
105
104
  });
106
105
  const viewChangeHandler = createViewChangeHandler({
107
106
  executeCachedViewDecisions,
108
- viewCache,
109
- showContainers
107
+ viewCache
110
108
  });
111
109
  return createComponent({
112
110
  logger,
@@ -115,7 +113,8 @@ const createPersonalization = ({
115
113
  onClickHandler,
116
114
  isAuthoringModeEnabled,
117
115
  mergeQuery,
118
- viewCache
116
+ viewCache,
117
+ showContainers
119
118
  });
120
119
  };
121
120
 
@@ -11,4 +11,4 @@ governing permissions and limitations under the License.
11
11
  */
12
12
  // The __VERSION__ keyword will be replace at alloy build time with the package.json version.
13
13
  // see babel-plugin-version
14
- export default "2.9.0-alpha.0";
14
+ export default "2.9.0-alpha.3";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@adobe/alloy",
3
- "version": "2.9.0-alpha.0",
3
+ "version": "2.9.0-alpha.3",
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.8.0",
67
+ "@adobe/alloy": "^2.9.0-alpha.2",
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",