@adobe/alloy 2.14.0-alpha.2 → 2.14.0-alpha.20

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 (67) hide show
  1. package/libEs5/components/Context/injectDevice.js +25 -12
  2. package/libEs5/components/Context/injectEnvironment.js +10 -3
  3. package/libEs5/components/Context/injectHighEntropyUserAgentHints.js +26 -15
  4. package/libEs5/components/Context/injectPlaceContext.js +6 -3
  5. package/libEs5/components/DataCollector/index.js +26 -10
  6. package/libEs5/components/DataCollector/validateUserEventOptions.js +2 -1
  7. package/libEs5/components/Identity/appendIdentityToUrl/appendIdentityToUrlOptionsValidator.js +4 -1
  8. package/libEs5/components/Identity/createComponent.js +2 -2
  9. package/libEs5/components/Identity/getIdentity/createGetIdentity.js +11 -3
  10. package/libEs5/components/Identity/getIdentity/getIdentityOptionsValidator.js +8 -11
  11. package/libEs5/components/Identity/index.js +8 -4
  12. package/libEs5/components/Identity/visitorService/injectGetEcidFromVisitor.js +2 -1
  13. package/libEs5/components/Personalization/dom-actions/executeActions.js +13 -1
  14. package/libEs5/components/Personalization/dom-actions/remapCustomCodeOffers.js +43 -0
  15. package/libEs5/components/Privacy/createComponent.js +4 -2
  16. package/libEs5/components/Privacy/index.js +2 -1
  17. package/libEs5/components/Privacy/injectSendSetConsentRequest.js +6 -2
  18. package/libEs5/components/Privacy/validateSetConsentOptions.js +2 -1
  19. package/libEs5/constants/highEntropyUserAgentClientHints.js +1 -1
  20. package/libEs5/constants/libraryVersion.js +1 -1
  21. package/libEs5/core/config/createCoreConfigs.js +2 -1
  22. package/libEs5/core/createEventManager.js +5 -1
  23. package/libEs5/core/edgeNetwork/injectSendEdgeNetworkRequest.js +3 -2
  24. package/libEs5/core/index.js +6 -1
  25. package/libEs5/core/network/requestMethods/injectSendFetchRequest.js +1 -1
  26. package/libEs5/utils/filterObject.js +57 -0
  27. package/libEs5/utils/index.js +24 -0
  28. package/libEs5/utils/prepareConfigOverridesForEdge.js +61 -0
  29. package/libEs5/utils/request/createGetAssuranceValidationTokenParams.js +54 -0
  30. package/libEs5/utils/request/createRequestPayload.js +6 -0
  31. package/libEs5/utils/request/index.js +9 -1
  32. package/libEs5/utils/toInteger.js +14 -2
  33. package/libEs5/utils/validateConfigOverride.js +20 -0
  34. package/libEs6/components/Context/injectDevice.js +26 -13
  35. package/libEs6/components/Context/injectEnvironment.js +11 -4
  36. package/libEs6/components/Context/injectHighEntropyUserAgentHints.js +6 -4
  37. package/libEs6/components/Context/injectPlaceContext.js +6 -3
  38. package/libEs6/components/DataCollector/index.js +25 -10
  39. package/libEs6/components/DataCollector/validateUserEventOptions.js +3 -2
  40. package/libEs6/components/Identity/appendIdentityToUrl/appendIdentityToUrlOptionsValidator.js +3 -1
  41. package/libEs6/components/Identity/createComponent.js +2 -2
  42. package/libEs6/components/Identity/getIdentity/createGetIdentity.js +10 -3
  43. package/libEs6/components/Identity/getIdentity/getIdentityOptionsValidator.js +6 -10
  44. package/libEs6/components/Identity/index.js +8 -4
  45. package/libEs6/components/Identity/visitorService/injectGetEcidFromVisitor.js +2 -1
  46. package/libEs6/components/Personalization/dom-actions/executeActions.js +7 -1
  47. package/libEs6/components/Personalization/dom-actions/remapCustomCodeOffers.js +37 -0
  48. package/libEs6/components/Privacy/createComponent.js +4 -2
  49. package/libEs6/components/Privacy/index.js +2 -1
  50. package/libEs6/components/Privacy/injectSendSetConsentRequest.js +6 -2
  51. package/libEs6/components/Privacy/validateSetConsentOptions.js +3 -2
  52. package/libEs6/constants/highEntropyUserAgentClientHints.js +1 -1
  53. package/libEs6/constants/libraryVersion.js +1 -1
  54. package/libEs6/core/config/createCoreConfigs.js +3 -2
  55. package/libEs6/core/createEventManager.js +5 -1
  56. package/libEs6/core/edgeNetwork/injectSendEdgeNetworkRequest.js +3 -2
  57. package/libEs6/core/index.js +7 -2
  58. package/libEs6/core/network/requestMethods/injectSendFetchRequest.js +1 -1
  59. package/libEs6/utils/filterObject.js +59 -0
  60. package/libEs6/utils/index.js +3 -0
  61. package/libEs6/utils/prepareConfigOverridesForEdge.js +57 -0
  62. package/libEs6/utils/request/createGetAssuranceValidationTokenParams.js +47 -0
  63. package/libEs6/utils/request/createRequestPayload.js +3 -1
  64. package/libEs6/utils/request/index.js +2 -1
  65. package/libEs6/utils/toInteger.js +13 -3
  66. package/libEs6/utils/validateConfigOverride.js +13 -0
  67. package/package.json +6 -5
@@ -36,12 +36,14 @@ var getScreenOrientationViaProperty = function getScreenOrientationViaProperty(w
36
36
  };
37
37
 
38
38
  var getScreenOrientationViaMediaQuery = function getScreenOrientationViaMediaQuery(window) {
39
- if (window.matchMedia("(orientation: portrait)").matches) {
40
- return "portrait";
41
- }
39
+ if ((0, _utils.isFunction)(window.matchMedia)) {
40
+ if (window.matchMedia("(orientation: portrait)").matches) {
41
+ return "portrait";
42
+ }
42
43
 
43
- if (window.matchMedia("(orientation: landscape)").matches) {
44
- return "landscape";
44
+ if (window.matchMedia("(orientation: landscape)").matches) {
45
+ return "landscape";
46
+ }
45
47
  }
46
48
 
47
49
  return null;
@@ -52,19 +54,30 @@ var _default = function _default(window) {
52
54
  var _window$screen = window.screen,
53
55
  width = _window$screen.width,
54
56
  height = _window$screen.height;
55
- var device = {
56
- screenHeight: height,
57
- screenWidth: width
58
- };
57
+ var device = {};
58
+ var screenHeight = (0, _utils.toInteger)(height);
59
+
60
+ if (screenHeight >= 0) {
61
+ device.screenHeight = screenHeight;
62
+ }
63
+
64
+ var screenWidth = (0, _utils.toInteger)(width);
65
+
66
+ if (screenWidth >= 0) {
67
+ device.screenWidth = screenWidth;
68
+ }
69
+
59
70
  var orientation = getScreenOrientationViaProperty(window) || getScreenOrientationViaMediaQuery(window);
60
71
 
61
72
  if (orientation) {
62
73
  device.screenOrientation = orientation;
63
74
  }
64
75
 
65
- (0, _utils.deepAssign)(xdm, {
66
- device: device
67
- });
76
+ if (Object.keys(device).length > 0) {
77
+ (0, _utils.deepAssign)(xdm, {
78
+ device: device
79
+ });
80
+ }
68
81
  };
69
82
  };
70
83
 
@@ -24,14 +24,21 @@ var _default = function _default(window) {
24
24
  var environment = {
25
25
  type: "browser"
26
26
  };
27
+ var viewportWidth = (0, _utils.toInteger)(clientWidth);
27
28
 
28
- if ((0, _utils.isNumber)(clientWidth) && clientWidth >= 0 && (0, _utils.isNumber)(clientHeight) && clientHeight >= 0) {
29
+ if (viewportWidth >= 0) {
29
30
  environment.browserDetails = {
30
- viewportWidth: Math.round(clientWidth),
31
- viewportHeight: Math.round(clientHeight)
31
+ viewportWidth: viewportWidth
32
32
  };
33
33
  }
34
34
 
35
+ var viewportHeight = (0, _utils.toInteger)(clientHeight);
36
+
37
+ if (viewportHeight >= 0) {
38
+ environment.browserDetails = environment.browserDetails || {};
39
+ environment.browserDetails.viewportHeight = viewportHeight;
40
+ }
41
+
35
42
  (0, _utils.deepAssign)(xdm, {
36
43
  environment: environment
37
44
  });
@@ -6,17 +6,20 @@ var _utils = require("../../utils");
6
6
 
7
7
  var _highEntropyUserAgentClientHints = require("../../constants/highEntropyUserAgentClientHints");
8
8
 
9
- /*
10
- Copyright 2022 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
- */
9
+ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
10
+
11
+ function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
12
+
13
+ function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
14
+
15
+ 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); }
16
+
17
+ 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
+
19
+ function _iterableToArrayLimit(arr, i) { var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"]; if (_i == null) return; var _arr = []; var _n = true; var _d = false; var _s, _e; try { for (_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; }
20
+
21
+ function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
22
+
20
23
  var browserSupportsUserAgentClientHints = function browserSupportsUserAgentClientHints(navigator) {
21
24
  return typeof navigator.userAgentData !== "undefined";
22
25
  };
@@ -28,12 +31,20 @@ var _default = function _default(navigator) {
28
31
 
29
32
  return function (xdm, logger) {
30
33
  try {
31
- return navigator.userAgentData.getHighEntropyValues(_highEntropyUserAgentClientHints.default).then(function (hints) {
34
+ return navigator.userAgentData.getHighEntropyValues(_highEntropyUserAgentClientHints.default.map(function (hint) {
35
+ return hint[0];
36
+ })).then(function (hints) {
32
37
  var userAgentClientHints = {};
33
38
 
34
- _highEntropyUserAgentClientHints.default.forEach(function (hint) {
35
- if (Object.prototype.hasOwnProperty.call(hints, hint)) {
36
- userAgentClientHints[hint] = hints[hint];
39
+ _highEntropyUserAgentClientHints.default.forEach(function (_ref) {
40
+ var _ref2 = _slicedToArray(_ref, 2),
41
+ hintName = _ref2[0],
42
+ hintType = _ref2[1];
43
+
44
+ if (Object.prototype.hasOwnProperty.call(hints, hintName) &&
45
+ /* eslint-disable-next-line valid-typeof */
46
+ _typeof(hints[hintName]) === hintType) {
47
+ userAgentClientHints[hintName] = hints[hintName];
37
48
  }
38
49
  });
39
50
 
@@ -18,13 +18,16 @@ governing permissions and limitations under the License.
18
18
  var _default = function _default(dateProvider) {
19
19
  return function (xdm) {
20
20
  var date = dateProvider();
21
- var placeContext = {
22
- localTime: (0, _utils.toISOStringLocal)(date)
23
- };
21
+ var placeContext = {};
24
22
  var localTimezoneOffset = (0, _utils.toInteger)(date.getTimezoneOffset());
25
23
 
26
24
  if (localTimezoneOffset !== undefined) {
27
25
  placeContext.localTimezoneOffset = localTimezoneOffset;
26
+ } // make sure the timezone offset only uses two digits
27
+
28
+
29
+ if (localTimezoneOffset === undefined || Math.abs(localTimezoneOffset) < 6000) {
30
+ placeContext.localTime = (0, _utils.toISOStringLocal)(date);
28
31
  }
29
32
 
30
33
  (0, _utils.deepAssign)(xdm, {
@@ -6,6 +6,8 @@ var _validateUserEventOptions = require("./validateUserEventOptions");
6
6
 
7
7
  var _validateApplyResponse = require("./validateApplyResponse");
8
8
 
9
+ var _utils = require("../../utils");
10
+
9
11
  /*
10
12
  Copyright 2019 Adobe. All rights reserved.
11
13
  This file is licensed to you under the Apache License, Version 2.0 (the "License");
@@ -18,7 +20,8 @@ OF ANY KIND, either express or implied. See the License for the specific languag
18
20
  governing permissions and limitations under the License.
19
21
  */
20
22
  var createDataCollector = function createDataCollector(_ref) {
21
- var eventManager = _ref.eventManager;
23
+ var eventManager = _ref.eventManager,
24
+ logger = _ref.logger;
22
25
  return {
23
26
  commands: {
24
27
  sendEvent: {
@@ -41,7 +44,8 @@ var createDataCollector = function createDataCollector(_ref) {
41
44
  decisionScopes = _options$decisionScop === void 0 ? [] : _options$decisionScop,
42
45
  _options$personalizat = options.personalization,
43
46
  personalization = _options$personalizat === void 0 ? {} : _options$personalizat,
44
- datasetId = options.datasetId;
47
+ datasetId = options.datasetId,
48
+ edgeConfigOverrides = options.edgeConfigOverrides;
45
49
  var event = eventManager.createEvent();
46
50
 
47
51
  if (documentUnloading) {
@@ -63,19 +67,31 @@ var createDataCollector = function createDataCollector(_ref) {
63
67
  });
64
68
  }
65
69
 
70
+ var sendEventOptions = {
71
+ renderDecisions: renderDecisions,
72
+ decisionScopes: decisionScopes,
73
+ personalization: personalization
74
+ };
75
+
76
+ if (edgeConfigOverrides) {
77
+ sendEventOptions.edgeConfigOverrides = edgeConfigOverrides;
78
+ }
79
+
66
80
  if (datasetId) {
67
- event.mergeMeta({
68
- collect: {
69
- datasetId: datasetId
81
+ logger.warn("The 'datasetId' option has been deprecated. Please use 'edgeConfigOverrides.experience_platform.datasets.event' instead.");
82
+ sendEventOptions.edgeConfigOverrides = edgeConfigOverrides || {};
83
+ (0, _utils.deepAssign)(sendEventOptions.edgeConfigOverrides, {
84
+ com_adobe_experience_platform: {
85
+ datasets: {
86
+ event: {
87
+ datasetId: datasetId
88
+ }
89
+ }
70
90
  }
71
91
  });
72
92
  }
73
93
 
74
- return eventManager.sendEvent(event, {
75
- renderDecisions: renderDecisions,
76
- decisionScopes: decisionScopes,
77
- personalization: personalization
78
- });
94
+ return eventManager.sendEvent(event, sendEventOptions);
79
95
  }
80
96
  },
81
97
  applyResponse: {
@@ -40,7 +40,8 @@ var _default = function _default(_ref) {
40
40
  surfaces: (0, _validation.arrayOf)((0, _validation.string)()).uniqueItems()
41
41
  }),
42
42
  datasetId: (0, _validation.string)(),
43
- mergeId: (0, _validation.string)()
43
+ mergeId: (0, _validation.string)(),
44
+ edgeConfigOverrides: _utils.validateConfigOverride
44
45
  }).required().noUnknownFields();
45
46
  return eventOptionsValidator(options);
46
47
  };
@@ -2,6 +2,8 @@
2
2
 
3
3
  exports.default = void 0;
4
4
 
5
+ var _utils = require("../../../utils");
6
+
5
7
  var _validation = require("../../../utils/validation");
6
8
 
7
9
  /*
@@ -22,7 +24,8 @@ governing permissions and limitations under the License.
22
24
  * @returns {*} Validated options
23
25
  */
24
26
  var _default = (0, _validation.objectOf)({
25
- url: (0, _validation.string)().required().nonEmpty()
27
+ url: (0, _validation.string)().required().nonEmpty(),
28
+ edgeConfigOverrides: _utils.validateConfigOverride
26
29
  }).required().noUnknownFields();
27
30
 
28
31
  exports.default = _default;
@@ -60,7 +60,7 @@ var _default = function _default(_ref) {
60
60
  optionsValidator: _getIdentityOptionsValidator.default,
61
61
  run: function run(options) {
62
62
  return consent.awaitConsent().then(function () {
63
- return ecid ? undefined : getIdentity(options.namespaces);
63
+ return ecid ? undefined : getIdentity(options);
64
64
  }).then(function () {
65
65
  return {
66
66
  identity: {
@@ -75,7 +75,7 @@ var _default = function _default(_ref) {
75
75
  optionsValidator: _appendIdentityToUrlOptionsValidator.default,
76
76
  run: function run(options) {
77
77
  return consent.withConsent().then(function () {
78
- return ecid ? undefined : getIdentity(options.namespaces);
78
+ return ecid ? undefined : getIdentity(options);
79
79
  }).then(function () {
80
80
  return {
81
81
  url: appendIdentityToUrl(ecid, options.url)
@@ -16,10 +16,18 @@ governing permissions and limitations under the License.
16
16
  var _default = function _default(_ref) {
17
17
  var sendEdgeNetworkRequest = _ref.sendEdgeNetworkRequest,
18
18
  createIdentityRequestPayload = _ref.createIdentityRequestPayload,
19
- createIdentityRequest = _ref.createIdentityRequest;
20
- return function (namespaces) {
19
+ createIdentityRequest = _ref.createIdentityRequest,
20
+ globalConfigOverrides = _ref.globalConfigOverrides;
21
+ return function () {
22
+ var _ref2 = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
23
+ namespaces = _ref2.namespaces,
24
+ localConfigOverrides = _ref2.edgeConfigOverrides;
25
+
21
26
  var payload = createIdentityRequestPayload(namespaces);
22
- var request = createIdentityRequest(payload);
27
+ var request = createIdentityRequest(payload); // merge the configurations, but give preference to the command-local configs
28
+
29
+ payload.mergeConfigOverride(globalConfigOverrides);
30
+ payload.mergeConfigOverride(localConfigOverrides);
23
31
  return sendEdgeNetworkRequest({
24
32
  request: request
25
33
  });
@@ -2,6 +2,8 @@
2
2
 
3
3
  exports.default = void 0;
4
4
 
5
+ var _utils = require("../../../utils");
6
+
5
7
  var _validation = require("../../../utils/validation");
6
8
 
7
9
  /*
@@ -21,16 +23,11 @@ governing permissions and limitations under the License.
21
23
  * @param {*} options The user event options to validate
22
24
  * @returns {*} Validated options
23
25
  */
24
- var _default = function _default(options) {
25
- var getIdentityOptionsValidator = (0, _validation.objectOf)({
26
- namespaces: (0, _validation.arrayOf)((0, _validation.literal)("ECID")).nonEmpty().uniqueItems()
27
- }).noUnknownFields();
28
- getIdentityOptionsValidator(options); // Return default options for now
29
- // To-Do: Accept namespace from given options
30
-
31
- return {
32
- namespaces: ["ECID"]
33
- };
34
- };
26
+ var _default = (0, _validation.objectOf)({
27
+ namespaces: (0, _validation.arrayOf)((0, _validation.literal)("ECID")).nonEmpty().uniqueItems().default(["ECID"]),
28
+ edgeConfigOverrides: _utils.validateConfigOverride
29
+ }).noUnknownFields().default({
30
+ namespaces: ["ECID"]
31
+ });
35
32
 
36
33
  exports.default = _default;
@@ -61,7 +61,8 @@ var createIdentity = function createIdentity(_ref) {
61
61
  sendEdgeNetworkRequest = _ref.sendEdgeNetworkRequest,
62
62
  apexDomain = _ref.apexDomain;
63
63
  var orgId = config.orgId,
64
- thirdPartyCookiesEnabled = config.thirdPartyCookiesEnabled;
64
+ thirdPartyCookiesEnabled = config.thirdPartyCookiesEnabled,
65
+ globalConfigOverrides = config.edgeConfigOverrides;
65
66
  var getEcidFromVisitor = (0, _injectGetEcidFromVisitor.default)({
66
67
  logger: logger,
67
68
  orgId: orgId,
@@ -84,7 +85,8 @@ var createIdentity = function createIdentity(_ref) {
84
85
  var getIdentity = (0, _createGetIdentity.default)({
85
86
  sendEdgeNetworkRequest: sendEdgeNetworkRequest,
86
87
  createIdentityRequestPayload: _createIdentityRequestPayload.default,
87
- createIdentityRequest: _createIdentityRequest.default
88
+ createIdentityRequest: _createIdentityRequest.default,
89
+ globalConfigOverrides: globalConfigOverrides
88
90
  });
89
91
  var setDomainForInitialIdentityPayload = (0, _injectSetDomainForInitialIdentityPayload.default)({
90
92
  thirdPartyCookiesEnabled: thirdPartyCookiesEnabled,
@@ -124,7 +126,8 @@ var createIdentity = function createIdentity(_ref) {
124
126
  dateProvider: function dateProvider() {
125
127
  return new Date();
126
128
  },
127
- orgId: orgId
129
+ orgId: orgId,
130
+ globalConfigOverrides: globalConfigOverrides
128
131
  });
129
132
  return (0, _createComponent.default)({
130
133
  addEcidQueryToPayload: _addEcidQueryToPayload.default,
@@ -136,7 +139,8 @@ var createIdentity = function createIdentity(_ref) {
136
139
  getIdentity: getIdentity,
137
140
  consent: consent,
138
141
  appendIdentityToUrl: appendIdentityToUrl,
139
- logger: logger
142
+ logger: logger,
143
+ config: config
140
144
  });
141
145
  };
142
146
 
@@ -19,8 +19,9 @@ var _default = function _default(_ref) {
19
19
  var logger = _ref.logger,
20
20
  orgId = _ref.orgId,
21
21
  awaitVisitorOptIn = _ref.awaitVisitorOptIn;
22
- var Visitor = (0, _getVisitor.default)(window);
23
22
  return function () {
23
+ var Visitor = (0, _getVisitor.default)(window);
24
+
24
25
  if (Visitor) {
25
26
  // Need to explicitly wait for optIn because visitor will call callback
26
27
  // with invalid values prior to optIn being approved
@@ -4,6 +4,10 @@ exports.default = void 0;
4
4
 
5
5
  var _remapHeadOffers = require("./remapHeadOffers");
6
6
 
7
+ var _utils = require("../../../utils");
8
+
9
+ var _remapCustomCodeOffers = require("./remapCustomCodeOffers");
10
+
7
11
  function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
8
12
 
9
13
  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."); }
@@ -45,9 +49,17 @@ var executeAction = function executeAction(logger, modules, type, args) {
45
49
  return execute.apply(void 0, _toConsumableArray(args));
46
50
  };
47
51
 
52
+ var PREPROCESSORS = [_remapHeadOffers.default, _remapCustomCodeOffers.default];
53
+
54
+ var preprocess = function preprocess(action) {
55
+ return PREPROCESSORS.reduce(function (processed, fn) {
56
+ return (0, _utils.assign)(processed, fn(processed));
57
+ }, action);
58
+ };
59
+
48
60
  var _default = function _default(actions, modules, logger) {
49
61
  var actionPromises = actions.map(function (action) {
50
- var processedAction = (0, _remapHeadOffers.default)(action);
62
+ var processedAction = preprocess(action);
51
63
  var type = processedAction.type;
52
64
  return executeAction(logger, modules, type, [processedAction]).then(function (result) {
53
65
  logActionCompleted(logger, processedAction);
@@ -0,0 +1,43 @@
1
+ "use strict";
2
+
3
+ exports.default = void 0;
4
+
5
+ var _utils = require("../../../utils");
6
+
7
+ /*
8
+ Copyright 2021 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
+
19
+ /*
20
+ * Preprocess customCode actions before rendering, so that offer selectors are remapped appropriately for
21
+ * target offers, to align with the way it works in at.js.
22
+ */
23
+ var ACTION_CUSTOM_CODE = "customCode";
24
+ var TARGET_BODY_SELECTOR = "BODY > *:eq(0)";
25
+
26
+ var _default = function _default(action) {
27
+ var selector = action.selector,
28
+ type = action.type;
29
+
30
+ if (type !== ACTION_CUSTOM_CODE) {
31
+ return action;
32
+ }
33
+
34
+ if (selector !== TARGET_BODY_SELECTOR) {
35
+ return action;
36
+ }
37
+
38
+ return (0, _utils.assign)({}, action, {
39
+ selector: "BODY"
40
+ });
41
+ };
42
+
43
+ exports.default = _default;
@@ -52,14 +52,16 @@ var _default = function _default(_ref) {
52
52
  optionsValidator: validateSetConsentOptions,
53
53
  run: function run(_ref2) {
54
54
  var consentOptions = _ref2.consent,
55
- identityMap = _ref2.identityMap;
55
+ identityMap = _ref2.identityMap,
56
+ edgeConfigOverrides = _ref2.edgeConfigOverrides;
56
57
  consent.suspend();
57
58
  var consentHashes = consentHashStore.lookup(consentOptions);
58
59
  return taskQueue.addTask(function () {
59
60
  if (consentHashes.isNew()) {
60
61
  return sendSetConsentRequest({
61
62
  consentOptions: consentOptions,
62
- identityMap: identityMap
63
+ identityMap: identityMap,
64
+ edgeConfigOverrides: edgeConfigOverrides
63
65
  });
64
66
  }
65
67
 
@@ -47,7 +47,8 @@ var createPrivacy = function createPrivacy(_ref) {
47
47
  var sendSetConsentRequest = (0, _injectSendSetConsentRequest.default)({
48
48
  createConsentRequestPayload: _createConsentRequestPayload.default,
49
49
  createConsentRequest: _createConsentRequest.default,
50
- sendEdgeNetworkRequest: sendEdgeNetworkRequest
50
+ sendEdgeNetworkRequest: sendEdgeNetworkRequest,
51
+ edgeConfigOverrides: config.edgeConfigOverrides
51
52
  });
52
53
  var storage = createNamespacedStorage((0, _utils.sanitizeOrgIdForCookieName)(orgId) + ".consentHashes.");
53
54
  var consentHashStore = (0, _createConsentHashStore.default)({
@@ -18,12 +18,16 @@ governing permissions and limitations under the License.
18
18
  var _default = function _default(_ref) {
19
19
  var createConsentRequestPayload = _ref.createConsentRequestPayload,
20
20
  createConsentRequest = _ref.createConsentRequest,
21
- sendEdgeNetworkRequest = _ref.sendEdgeNetworkRequest;
21
+ sendEdgeNetworkRequest = _ref.sendEdgeNetworkRequest,
22
+ globalConfigOverrides = _ref.edgeConfigOverrides;
22
23
  return function (_ref2) {
23
24
  var consentOptions = _ref2.consentOptions,
24
- identityMap = _ref2.identityMap;
25
+ identityMap = _ref2.identityMap,
26
+ localConfigOverrides = _ref2.edgeConfigOverrides;
25
27
  var payload = createConsentRequestPayload();
26
28
  payload.setConsent(consentOptions);
29
+ payload.mergeConfigOverride(globalConfigOverrides);
30
+ payload.mergeConfigOverride(localConfigOverrides);
27
31
 
28
32
  if ((0, _utils.isObject)(identityMap)) {
29
33
  Object.keys(identityMap).forEach(function (key) {
@@ -8,7 +8,8 @@ var _utils = require("../../utils");
8
8
 
9
9
  var _default = (0, _validation.objectOf)({
10
10
  consent: (0, _validation.arrayOf)((0, _validation.anything)()).required().nonEmpty(),
11
- identityMap: _utils.validateIdentityMap
11
+ identityMap: _utils.validateIdentityMap,
12
+ edgeConfigOverrides: _utils.validateConfigOverride
12
13
  }).noUnknownFields().required();
13
14
 
14
15
  exports.default = _default;
@@ -13,5 +13,5 @@ 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 = ["architecture", "bitness", "model", "platformVersion", "wow64"];
16
+ var _default = [["architecture", "string"], ["bitness", "string"], ["model", "string"], ["platformVersion", "string"], ["wow64", "boolean"]];
17
17
  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.14.0-alpha.2";
18
+ var _default = "2.14.0-alpha.20";
19
19
  exports.default = _default;
@@ -31,7 +31,8 @@ var _default = function _default() {
31
31
  edgeDomain: (0, _validation.string)().domain().default(_domain.EDGE),
32
32
  edgeBasePath: (0, _validation.string)().nonEmpty().default(_edgeBasePath.default),
33
33
  orgId: (0, _validation.string)().unique().required(),
34
- onBeforeEventSend: (0, _validation.callback)().default(_utils.noop)
34
+ onBeforeEventSend: (0, _validation.callback)().default(_utils.noop),
35
+ edgeConfigOverrides: _utils.validateConfigOverride
35
36
  };
36
37
  };
37
38
 
@@ -29,7 +29,8 @@ var _default = function _default(_ref) {
29
29
  createDataCollectionRequest = _ref.createDataCollectionRequest,
30
30
  sendEdgeNetworkRequest = _ref.sendEdgeNetworkRequest,
31
31
  _applyResponse = _ref.applyResponse;
32
- var onBeforeEventSend = config.onBeforeEventSend;
32
+ var onBeforeEventSend = config.onBeforeEventSend,
33
+ globalConfigOverrides = config.edgeConfigOverrides;
33
34
  return {
34
35
  createEvent: createEvent,
35
36
 
@@ -54,11 +55,14 @@ var _default = function _default(_ref) {
54
55
  var _options$renderDecisi = options.renderDecisions,
55
56
  renderDecisions = _options$renderDecisi === void 0 ? false : _options$renderDecisi,
56
57
  decisionScopes = options.decisionScopes,
58
+ localConfigOverrides = options.edgeConfigOverrides,
57
59
  personalization = options.personalization;
58
60
  var payload = createDataCollectionRequestPayload();
59
61
  var request = createDataCollectionRequest(payload);
60
62
  var onResponseCallbackAggregator = (0, _utils.createCallbackAggregator)();
61
63
  var onRequestFailureCallbackAggregator = (0, _utils.createCallbackAggregator)();
64
+ payload.mergeConfigOverride(globalConfigOverrides);
65
+ payload.mergeConfigOverride(localConfigOverrides);
62
66
  return lifecycle.onBeforeEvent({
63
67
  event: event,
64
68
  renderDecisions: renderDecisions,
@@ -30,7 +30,8 @@ var _default = function _default(_ref) {
30
30
  sendNetworkRequest = _ref.sendNetworkRequest,
31
31
  createResponse = _ref.createResponse,
32
32
  processWarningsAndErrors = _ref.processWarningsAndErrors,
33
- getLocationHint = _ref.getLocationHint;
33
+ getLocationHint = _ref.getLocationHint,
34
+ getAssuranceValidationTokenParams = _ref.getAssuranceValidationTokenParams;
34
35
  var edgeDomain = config.edgeDomain,
35
36
  edgeBasePath = config.edgeBasePath,
36
37
  edgeConfigId = config.edgeConfigId;
@@ -59,7 +60,7 @@ var _default = function _default(_ref) {
59
60
  var endpointDomain = request.getUseIdThirdPartyDomain() ? _domain.ID_THIRD_PARTY : edgeDomain;
60
61
  var locationHint = getLocationHint();
61
62
  var edgeBasePathWithLocationHint = locationHint ? edgeBasePath + "/" + locationHint : edgeBasePath;
62
- var url = "https://" + endpointDomain + "/" + edgeBasePathWithLocationHint + "/" + _apiVersion.default + "/" + request.getAction() + "?configId=" + edgeConfigId + "&requestId=" + request.getId();
63
+ var url = "https://" + endpointDomain + "/" + edgeBasePathWithLocationHint + "/" + _apiVersion.default + "/" + request.getAction() + "?configId=" + edgeConfigId + "&requestId=" + request.getId() + getAssuranceValidationTokenParams();
63
64
  cookieTransfer.cookiesToPayload(request.getPayload(), endpointDomain);
64
65
  return sendNetworkRequest({
65
66
  requestId: request.getId(),
@@ -99,6 +99,10 @@ var sendFetchRequest = (0, _utils.isFunction)(fetch) ? (0, _injectSendFetchReque
99
99
  XMLHttpRequest: XMLHttpRequest
100
100
  });
101
101
  var fireReferrerHideableImage = (0, _utils.injectFireReferrerHideableImage)();
102
+ var getAssuranceValidationTokenParams = (0, _request.createGetAssuranceValidationTokenParams)({
103
+ window: window,
104
+ createNamespacedStorage: createNamespacedStorage
105
+ });
102
106
 
103
107
  var createExecuteCommand = function createExecuteCommand(_ref) {
104
108
  var instanceName = _ref.instanceName,
@@ -177,7 +181,8 @@ var createExecuteCommand = function createExecuteCommand(_ref) {
177
181
  sendNetworkRequest: sendNetworkRequest,
178
182
  createResponse: createResponse,
179
183
  processWarningsAndErrors: processWarningsAndErrors,
180
- getLocationHint: getLocationHint
184
+ getLocationHint: getLocationHint,
185
+ getAssuranceValidationTokenParams: getAssuranceValidationTokenParams
181
186
  });
182
187
  var applyResponse = (0, _injectApplyResponse.default)({
183
188
  lifecycle: lifecycle,
@@ -24,7 +24,7 @@ var _default = function _default(_ref) {
24
24
  headers: {
25
25
  "Content-Type": "text/plain; charset=UTF-8"
26
26
  },
27
- referrer: "client",
27
+ referrerPolicy: "no-referrer-when-downgrade",
28
28
  body: body
29
29
  }).then(function (response) {
30
30
  return response.text().then(function (responseBody) {