@adobe/alloy 2.19.0-beta.6 → 2.19.0-beta.7

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.
@@ -107,9 +107,12 @@ var _default = function _default(_ref) {
107
107
  return Promise.all(decisionsMetaPromises).then(function (decisionsMetas) {
108
108
  // We only want to call mergeDecisionsMeta once, but we can get the propositions
109
109
  // from two places: the pending display notifications and the view change handler.
110
- mergeDecisionsMeta(event, (0, _utils.flatMap)(decisionsMetas, function (dms) {
110
+ var decisionsMeta = (0, _utils.flatMap)(decisionsMetas, function (dms) {
111
111
  return dms;
112
- }), _propositionEventType.PropositionEventType.DISPLAY);
112
+ });
113
+ if ((0, _utils.isNonEmptyArray)(decisionsMeta)) {
114
+ mergeDecisionsMeta(event, decisionsMeta, _propositionEventType.PropositionEventType.DISPLAY);
115
+ }
113
116
  });
114
117
  },
115
118
  onClick: function onClick(_ref4) {
@@ -0,0 +1,20 @@
1
+ "use strict";
2
+
3
+ exports.default = void 0;
4
+ /*
5
+ Copyright 2019 Adobe. All rights reserved.
6
+ This file is licensed to you under the Apache License, Version 2.0 (the "License");
7
+ you may not use this file except in compliance with the License. You may obtain a copy
8
+ of the License at http://www.apache.org/licenses/LICENSE-2.0
9
+
10
+ Unless required by applicable law or agreed to in writing, software distributed under
11
+ the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
12
+ OF ANY KIND, either express or implied. See the License for the specific language
13
+ governing permissions and limitations under the License.
14
+ */
15
+ var _default = function _default(window) {
16
+ return function (url) {
17
+ return window.location.replace(url);
18
+ };
19
+ };
20
+ exports.default = _default;
@@ -21,11 +21,6 @@ var EVENT_TYPE_TRUE = 1;
21
21
  /* eslint-disable no-underscore-dangle */
22
22
  var mergeDecisionsMeta = function mergeDecisionsMeta(event, decisionsMeta, eventType) {
23
23
  var eventLabel = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : "";
24
- // Do not send a display notification with no decisions. Even empty view changes
25
- // should include a proposition.
26
- if (decisionsMeta.length === 0) {
27
- return;
28
- }
29
24
  var xdm = {
30
25
  _experience: {
31
26
  decisioning: {
@@ -25,7 +25,8 @@ var _default = function _default(_ref) {
25
25
  }
26
26
  var render = function render() {
27
27
  return collect({
28
- decisionsMeta: [item.getMeta()]
28
+ decisionsMeta: [item.getMeta()],
29
+ documentMayUnload: true
29
30
  }).then(function () {
30
31
  executeRedirect(content);
31
32
  // We've already sent the display notification, so don't return anything
@@ -29,6 +29,7 @@ var _createProcessDomAction = require("./handlers/createProcessDomAction");
29
29
  var _createProcessHtmlContent = require("./handlers/createProcessHtmlContent");
30
30
  var _createProcessRedirect = require("./handlers/createProcessRedirect");
31
31
  var _createProcessPropositions = require("./handlers/createProcessPropositions");
32
+ var _createRedirect = require("./dom-actions/createRedirect");
32
33
  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; } /*
33
34
  Copyright 2019 Adobe. All rights reserved.
34
35
  This file is licensed to you under the Apache License, Version 2.0 (the "License");
@@ -67,6 +68,7 @@ var createPersonalization = function createPersonalization(_ref) {
67
68
  var viewCache = (0, _createViewCacheManager.default)({
68
69
  createProposition: createProposition
69
70
  });
71
+ var executeRedirect = (0, _createRedirect.default)(window);
70
72
  var schemaProcessors = (_schemaProcessors = {}, _defineProperty(_schemaProcessors, schema.DEFAULT_CONTENT_ITEM, _processDefaultContent.default), _defineProperty(_schemaProcessors, schema.DOM_ACTION, (0, _createProcessDomAction.default)({
71
73
  modules: modules,
72
74
  logger: logger,
@@ -76,9 +78,7 @@ var createPersonalization = function createPersonalization(_ref) {
76
78
  logger: logger
77
79
  })), _defineProperty(_schemaProcessors, schema.REDIRECT_ITEM, (0, _createProcessRedirect.default)({
78
80
  logger: logger,
79
- executeRedirect: function executeRedirect(url) {
80
- return window.location.replace(url);
81
- },
81
+ executeRedirect: executeRedirect,
82
82
  collect: collect
83
83
  })), _schemaProcessors);
84
84
  var processPropositions = (0, _createProcessPropositions.default)({
@@ -14,5 +14,5 @@ governing permissions and limitations under the License.
14
14
  */
15
15
  // The __VERSION__ keyword will be replace at alloy build time with the package.json version.
16
16
  // see babel-plugin-version
17
- var _default = "2.19.0-beta.6";
17
+ var _default = "2.19.0-beta.7";
18
18
  exports.default = _default;
@@ -129,7 +129,7 @@ var _default = function _default() {
129
129
  return shouldSendEvent;
130
130
  },
131
131
  getViewName: function getViewName() {
132
- if (!userXdm || !userXdm.web || !userXdm.web.webPageDetails || !userXdm.web.webPageDetails.viewName) {
132
+ if (!userXdm || !userXdm.web || !userXdm.web.webPageDetails) {
133
133
  return undefined;
134
134
  }
135
135
  return userXdm.web.webPageDetails.viewName;
@@ -10,7 +10,7 @@ OF ANY KIND, either express or implied. See the License for the specific languag
10
10
  governing permissions and limitations under the License.
11
11
  */
12
12
 
13
- import { noop, flatMap } from "../../utils";
13
+ import { noop, flatMap, isNonEmptyArray } from "../../utils";
14
14
  import createPersonalizationDetails from "./createPersonalizationDetails";
15
15
  import { AUTHORING_ENABLED } from "./constants/loggerMessage";
16
16
  import validateApplyPropositionsOptions from "./validateApplyPropositionsOptions";
@@ -98,7 +98,10 @@ export default (({
98
98
  return Promise.all(decisionsMetaPromises).then(decisionsMetas => {
99
99
  // We only want to call mergeDecisionsMeta once, but we can get the propositions
100
100
  // from two places: the pending display notifications and the view change handler.
101
- mergeDecisionsMeta(event, flatMap(decisionsMetas, dms => dms), PropositionEventType.DISPLAY);
101
+ const decisionsMeta = flatMap(decisionsMetas, dms => dms);
102
+ if (isNonEmptyArray(decisionsMeta)) {
103
+ mergeDecisionsMeta(event, decisionsMeta, PropositionEventType.DISPLAY);
104
+ }
102
105
  });
103
106
  },
104
107
  onClick({
@@ -0,0 +1,13 @@
1
+ /*
2
+ Copyright 2019 Adobe. All rights reserved.
3
+ This file is licensed to you under the Apache License, Version 2.0 (the "License");
4
+ you may not use this file except in compliance with the License. You may obtain a copy
5
+ of the License at http://www.apache.org/licenses/LICENSE-2.0
6
+
7
+ Unless required by applicable law or agreed to in writing, software distributed under
8
+ the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
9
+ OF ANY KIND, either express or implied. See the License for the specific language
10
+ governing permissions and limitations under the License.
11
+ */
12
+
13
+ export default (window => url => window.location.replace(url));
@@ -14,11 +14,6 @@ const EVENT_TYPE_TRUE = 1;
14
14
 
15
15
  /* eslint-disable no-underscore-dangle */
16
16
  export const mergeDecisionsMeta = (event, decisionsMeta, eventType, eventLabel = "") => {
17
- // Do not send a display notification with no decisions. Even empty view changes
18
- // should include a proposition.
19
- if (decisionsMeta.length === 0) {
20
- return;
21
- }
22
17
  const xdm = {
23
18
  _experience: {
24
19
  decisioning: {
@@ -23,7 +23,8 @@ export default (({
23
23
  }
24
24
  const render = () => {
25
25
  return collect({
26
- decisionsMeta: [item.getMeta()]
26
+ decisionsMeta: [item.getMeta()],
27
+ documentMayUnload: true
27
28
  }).then(() => {
28
29
  executeRedirect(content);
29
30
  // We've already sent the display notification, so don't return anything
@@ -38,6 +38,7 @@ import createProcessDomAction from "./handlers/createProcessDomAction";
38
38
  import createProcessHtmlContent from "./handlers/createProcessHtmlContent";
39
39
  import createProcessRedirect from "./handlers/createProcessRedirect";
40
40
  import createProcessPropositions from "./handlers/createProcessPropositions";
41
+ import createRedirect from "./dom-actions/createRedirect";
41
42
  const createPersonalization = ({
42
43
  config,
43
44
  logger,
@@ -68,6 +69,7 @@ const createPersonalization = ({
68
69
  const viewCache = createViewCacheManager({
69
70
  createProposition
70
71
  });
72
+ const executeRedirect = createRedirect(window);
71
73
  const schemaProcessors = {
72
74
  [schema.DEFAULT_CONTENT_ITEM]: processDefaultContent,
73
75
  [schema.DOM_ACTION]: createProcessDomAction({
@@ -81,7 +83,7 @@ const createPersonalization = ({
81
83
  }),
82
84
  [schema.REDIRECT_ITEM]: createProcessRedirect({
83
85
  logger,
84
- executeRedirect: url => window.location.replace(url),
86
+ executeRedirect,
85
87
  collect
86
88
  })
87
89
  };
@@ -13,4 +13,4 @@ governing permissions and limitations under the License.
13
13
  // The __VERSION__ keyword will be replace at alloy build time with the package.json version.
14
14
  // see babel-plugin-version
15
15
 
16
- export default "2.19.0-beta.6";
16
+ export default "2.19.0-beta.7";
@@ -120,7 +120,7 @@ export default (() => {
120
120
  return shouldSendEvent;
121
121
  },
122
122
  getViewName() {
123
- if (!userXdm || !userXdm.web || !userXdm.web.webPageDetails || !userXdm.web.webPageDetails.viewName) {
123
+ if (!userXdm || !userXdm.web || !userXdm.web.webPageDetails) {
124
124
  return undefined;
125
125
  }
126
126
  return userXdm.web.webPageDetails.viewName;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@adobe/alloy",
3
- "version": "2.19.0-beta.6",
3
+ "version": "2.19.0-beta.7",
4
4
  "description": "Adobe Experience Platform Web SDK",
5
5
  "main": "libEs5/index.js",
6
6
  "module": "libEs6/index.js",
@@ -66,7 +66,7 @@
66
66
  "uuid": "^3.3.2"
67
67
  },
68
68
  "devDependencies": {
69
- "@adobe/alloy": "^2.19.0-beta.5",
69
+ "@adobe/alloy": "^2.19.0-beta.6",
70
70
  "@babel/cli": "^7.12.8",
71
71
  "@babel/core": "^7.2.2",
72
72
  "@babel/plugin-proposal-object-rest-spread": "^7.3.2",