@adobe/alloy 2.14.0-alpha.1 → 2.14.0-alpha.11

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/injectPlaceContext.js +6 -3
  2. package/libEs5/components/DataCollector/index.js +28 -9
  3. package/libEs5/components/DataCollector/validateUserEventOptions.js +6 -1
  4. package/libEs5/components/Identity/appendIdentityToUrl/appendIdentityToUrlOptionsValidator.js +4 -1
  5. package/libEs5/components/Identity/createComponent.js +2 -2
  6. package/libEs5/components/Identity/getIdentity/createGetIdentity.js +11 -3
  7. package/libEs5/components/Identity/getIdentity/getIdentityOptionsValidator.js +8 -11
  8. package/libEs5/components/Identity/index.js +8 -4
  9. package/libEs5/components/Personalization/constants/surface.js +23 -0
  10. package/libEs5/components/Personalization/createComponent.js +8 -2
  11. package/libEs5/components/Personalization/createGetPageLocation.js +23 -0
  12. package/libEs5/components/Personalization/createPersonalizationDetails.js +44 -10
  13. package/libEs5/components/Personalization/groupDecisions.js +3 -3
  14. package/libEs5/components/Personalization/index.js +6 -0
  15. package/libEs5/components/Personalization/utils/isPageWideScope.js +24 -0
  16. package/libEs5/components/Personalization/utils/surfaceUtils.js +128 -0
  17. package/libEs5/components/Privacy/createComponent.js +4 -2
  18. package/libEs5/components/Privacy/index.js +2 -1
  19. package/libEs5/components/Privacy/injectSendSetConsentRequest.js +6 -2
  20. package/libEs5/components/Privacy/validateSetConsentOptions.js +2 -1
  21. package/libEs5/constants/libraryVersion.js +1 -1
  22. package/libEs5/core/config/createCoreConfigs.js +2 -1
  23. package/libEs5/core/createEventManager.js +12 -3
  24. package/libEs5/core/edgeNetwork/injectSendEdgeNetworkRequest.js +3 -2
  25. package/libEs5/core/index.js +6 -1
  26. package/libEs5/utils/filterObject.js +57 -0
  27. package/libEs5/utils/index.js +24 -0
  28. package/libEs5/utils/isNil.js +1 -1
  29. package/libEs5/utils/prepareConfigOverridesForEdge.js +61 -0
  30. package/libEs5/utils/request/createGetAssuranceValidationTokenParams.js +54 -0
  31. package/libEs5/utils/request/createRequestPayload.js +6 -0
  32. package/libEs5/utils/request/index.js +9 -1
  33. package/libEs5/utils/validateConfigOverride.js +20 -0
  34. package/libEs6/components/Context/injectPlaceContext.js +6 -3
  35. package/libEs6/components/DataCollector/index.js +27 -9
  36. package/libEs6/components/DataCollector/validateUserEventOptions.js +7 -2
  37. package/libEs6/components/Identity/appendIdentityToUrl/appendIdentityToUrlOptionsValidator.js +3 -1
  38. package/libEs6/components/Identity/createComponent.js +2 -2
  39. package/libEs6/components/Identity/getIdentity/createGetIdentity.js +10 -3
  40. package/libEs6/components/Identity/getIdentity/getIdentityOptionsValidator.js +6 -10
  41. package/libEs6/components/Identity/index.js +8 -4
  42. package/libEs6/components/Personalization/constants/surface.js +15 -0
  43. package/libEs6/components/Personalization/createComponent.js +6 -1
  44. package/libEs6/components/Personalization/createGetPageLocation.js +16 -0
  45. package/libEs6/components/Personalization/createPersonalizationDetails.js +40 -8
  46. package/libEs6/components/Personalization/groupDecisions.js +2 -2
  47. package/libEs6/components/Personalization/index.js +5 -0
  48. package/libEs6/components/Personalization/utils/isPageWideScope.js +14 -0
  49. package/libEs6/components/Personalization/utils/surfaceUtils.js +93 -0
  50. package/libEs6/components/Privacy/createComponent.js +4 -2
  51. package/libEs6/components/Privacy/index.js +2 -1
  52. package/libEs6/components/Privacy/injectSendSetConsentRequest.js +6 -2
  53. package/libEs6/components/Privacy/validateSetConsentOptions.js +3 -2
  54. package/libEs6/constants/libraryVersion.js +1 -1
  55. package/libEs6/core/config/createCoreConfigs.js +3 -2
  56. package/libEs6/core/createEventManager.js +12 -3
  57. package/libEs6/core/edgeNetwork/injectSendEdgeNetworkRequest.js +3 -2
  58. package/libEs6/core/index.js +7 -2
  59. package/libEs6/utils/filterObject.js +59 -0
  60. package/libEs6/utils/index.js +3 -0
  61. package/libEs6/utils/isNil.js +1 -1
  62. package/libEs6/utils/prepareConfigOverridesForEdge.js +57 -0
  63. package/libEs6/utils/request/createGetAssuranceValidationTokenParams.js +47 -0
  64. package/libEs6/utils/request/createRequestPayload.js +3 -1
  65. package/libEs6/utils/request/index.js +2 -1
  66. package/libEs6/utils/validateConfigOverride.js +13 -0
  67. package/package.json +5 -4
@@ -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: {
@@ -39,7 +42,10 @@ var createDataCollector = function createDataCollector(_ref) {
39
42
  renderDecisions = _options$renderDecisi === void 0 ? false : _options$renderDecisi,
40
43
  _options$decisionScop = options.decisionScopes,
41
44
  decisionScopes = _options$decisionScop === void 0 ? [] : _options$decisionScop,
42
- datasetId = options.datasetId;
45
+ _options$personalizat = options.personalization,
46
+ personalization = _options$personalizat === void 0 ? {} : _options$personalizat,
47
+ datasetId = options.datasetId,
48
+ edgeConfigOverrides = options.edgeConfigOverrides;
43
49
  var event = eventManager.createEvent();
44
50
 
45
51
  if (documentUnloading) {
@@ -61,18 +67,31 @@ var createDataCollector = function createDataCollector(_ref) {
61
67
  });
62
68
  }
63
69
 
70
+ var sendEventOptions = {
71
+ renderDecisions: renderDecisions,
72
+ decisionScopes: decisionScopes,
73
+ personalization: personalization
74
+ };
75
+
76
+ if (edgeConfigOverrides) {
77
+ sendEventOptions.edgeConfigOverrides = edgeConfigOverrides;
78
+ }
79
+
64
80
  if (datasetId) {
65
- event.mergeMeta({
66
- collect: {
67
- 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
+ }
68
90
  }
69
91
  });
70
92
  }
71
93
 
72
- return eventManager.sendEvent(event, {
73
- renderDecisions: renderDecisions,
74
- decisionScopes: decisionScopes
75
- });
94
+ return eventManager.sendEvent(event, sendEventOptions);
76
95
  }
77
96
  },
78
97
  applyResponse: {
@@ -35,8 +35,13 @@ var _default = function _default(_ref) {
35
35
  documentUnloading: (0, _validation.boolean)(),
36
36
  renderDecisions: (0, _validation.boolean)(),
37
37
  decisionScopes: (0, _validation.arrayOf)((0, _validation.string)()).uniqueItems(),
38
+ personalization: (0, _validation.objectOf)({
39
+ decisionScopes: (0, _validation.arrayOf)((0, _validation.string)()).uniqueItems(),
40
+ surfaces: (0, _validation.arrayOf)((0, _validation.string)()).uniqueItems()
41
+ }),
38
42
  datasetId: (0, _validation.string)(),
39
- mergeId: (0, _validation.string)()
43
+ mergeId: (0, _validation.string)(),
44
+ edgeConfigOverrides: _utils.validateConfigOverride
40
45
  }).required().noUnknownFields();
41
46
  return eventOptionsValidator(options);
42
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
 
@@ -0,0 +1,23 @@
1
+ "use strict";
2
+
3
+ exports.WEBAPP = exports.WEB = exports.SURFACE_TYPE_DELIMITER = exports.FRAGMENT_DELIMITER = 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 WEB = "web";
17
+ exports.WEB = WEB;
18
+ var WEBAPP = "webapp";
19
+ exports.WEBAPP = WEBAPP;
20
+ var SURFACE_TYPE_DELIMITER = "://";
21
+ exports.SURFACE_TYPE_DELIMITER = SURFACE_TYPE_DELIMITER;
22
+ var FRAGMENT_DELIMITER = "#";
23
+ exports.FRAGMENT_DELIMITER = FRAGMENT_DELIMITER;
@@ -22,7 +22,8 @@ OF ANY KIND, either express or implied. See the License for the specific languag
22
22
  governing permissions and limitations under the License.
23
23
  */
24
24
  var _default = function _default(_ref) {
25
- var logger = _ref.logger,
25
+ var getPageLocation = _ref.getPageLocation,
26
+ logger = _ref.logger,
26
27
  fetchDataHandler = _ref.fetchDataHandler,
27
28
  viewChangeHandler = _ref.viewChangeHandler,
28
29
  onClickHandler = _ref.onClickHandler,
@@ -44,6 +45,8 @@ var _default = function _default(_ref) {
44
45
  renderDecisions = _ref3.renderDecisions,
45
46
  _ref3$decisionScopes = _ref3.decisionScopes,
46
47
  decisionScopes = _ref3$decisionScopes === void 0 ? [] : _ref3$decisionScopes,
48
+ _ref3$personalization = _ref3.personalization,
49
+ personalization = _ref3$personalization === void 0 ? {} : _ref3$personalization,
47
50
  _ref3$onResponse = _ref3.onResponse,
48
51
  onResponse = _ref3$onResponse === void 0 ? _utils.noop : _ref3$onResponse,
49
52
  _ref3$onRequestFailur = _ref3.onRequestFailure,
@@ -68,10 +71,13 @@ var _default = function _default(_ref) {
68
71
  }
69
72
 
70
73
  var personalizationDetails = (0, _createPersonalizationDetails.default)({
74
+ getPageLocation: getPageLocation,
71
75
  renderDecisions: renderDecisions,
72
76
  decisionScopes: decisionScopes,
77
+ personalization: personalization,
73
78
  event: event,
74
- viewCache: viewCache
79
+ viewCache: viewCache,
80
+ logger: logger
75
81
  });
76
82
 
77
83
  if (personalizationDetails.shouldFetchData()) {
@@ -0,0 +1,23 @@
1
+ "use strict";
2
+
3
+ exports.default = 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 _default = function _default(_ref) {
17
+ var window = _ref.window;
18
+ return function () {
19
+ return window.location;
20
+ };
21
+ };
22
+
23
+ exports.default = _default;
@@ -4,12 +4,12 @@ exports.default = void 0;
4
4
 
5
5
  var _utils = require("../../utils");
6
6
 
7
+ var _surfaceUtils = require("./utils/surfaceUtils");
8
+
7
9
  var _pageWideScope = require("../../constants/pageWideScope");
8
10
 
9
11
  var _schema = require("./constants/schema");
10
12
 
11
- var _isNonEmptyString = require("../../utils/isNonEmptyString");
12
-
13
13
  function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
14
14
 
15
15
  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."); }
@@ -22,11 +22,34 @@ function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToAr
22
22
 
23
23
  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; }
24
24
 
25
+ var addPageWideScope = function addPageWideScope(scopes) {
26
+ if (!(0, _utils.includes)(scopes, _pageWideScope.default)) {
27
+ scopes.push(_pageWideScope.default);
28
+ }
29
+ };
30
+
31
+ var addPageSurface = function addPageSurface(surfaces, getPageLocation) {
32
+ var pageSurface = (0, _surfaceUtils.buildPageSurface)(getPageLocation);
33
+
34
+ if (!(0, _utils.includes)(surfaces, pageSurface)) {
35
+ surfaces.push(pageSurface);
36
+ }
37
+ };
38
+
39
+ var dedupe = function dedupe(array) {
40
+ return array.filter(function (item, pos) {
41
+ return array.indexOf(item) === pos;
42
+ });
43
+ };
44
+
25
45
  var _default = function _default(_ref) {
26
- var renderDecisions = _ref.renderDecisions,
46
+ var getPageLocation = _ref.getPageLocation,
47
+ renderDecisions = _ref.renderDecisions,
27
48
  decisionScopes = _ref.decisionScopes,
49
+ personalization = _ref.personalization,
28
50
  event = _ref.event,
29
- viewCache = _ref.viewCache;
51
+ viewCache = _ref.viewCache,
52
+ logger = _ref.logger;
30
53
  var viewName = event.getViewName();
31
54
  return {
32
55
  isRenderDecisions: function isRenderDecisions() {
@@ -36,16 +59,26 @@ var _default = function _default(_ref) {
36
59
  return viewName;
37
60
  },
38
61
  hasScopes: function hasScopes() {
39
- return decisionScopes.length > 0;
62
+ return decisionScopes.length > 0 || (0, _utils.isNonEmptyArray)(personalization.decisionScopes);
63
+ },
64
+ hasSurfaces: function hasSurfaces() {
65
+ return (0, _utils.isNonEmptyArray)(personalization.surfaces);
40
66
  },
41
67
  hasViewName: function hasViewName() {
42
- return (0, _isNonEmptyString.default)(viewName);
68
+ return (0, _utils.isNonEmptyString)(viewName);
43
69
  },
44
70
  createQueryDetails: function createQueryDetails() {
45
71
  var scopes = _toConsumableArray(decisionScopes);
46
72
 
47
- if (!this.isCacheInitialized() && !(0, _utils.includes)(scopes, _pageWideScope.default)) {
48
- scopes.push(_pageWideScope.default);
73
+ if ((0, _utils.isNonEmptyArray)(personalization.decisionScopes)) {
74
+ scopes.push.apply(scopes, _toConsumableArray(personalization.decisionScopes));
75
+ }
76
+
77
+ var eventSurfaces = (0, _surfaceUtils.normalizeSurfaces)(personalization.surfaces, getPageLocation, logger);
78
+
79
+ if (!this.isCacheInitialized()) {
80
+ addPageWideScope(scopes);
81
+ addPageSurface(eventSurfaces, getPageLocation);
49
82
  }
50
83
 
51
84
  var schemas = [_schema.DEFAULT_CONTENT_ITEM, _schema.HTML_CONTENT_ITEM, _schema.JSON_CONTENT_ITEM, _schema.REDIRECT_ITEM];
@@ -56,14 +89,15 @@ var _default = function _default(_ref) {
56
89
 
57
90
  return {
58
91
  schemas: schemas,
59
- decisionScopes: scopes
92
+ decisionScopes: dedupe(scopes),
93
+ surfaces: dedupe(eventSurfaces)
60
94
  };
61
95
  },
62
96
  isCacheInitialized: function isCacheInitialized() {
63
97
  return viewCache.isInitialized();
64
98
  },
65
99
  shouldFetchData: function shouldFetchData() {
66
- return this.hasScopes() || !this.isCacheInitialized();
100
+ return this.hasScopes() || this.hasSurfaces() || !this.isCacheInitialized();
67
101
  },
68
102
  shouldUseCachedData: function shouldUseCachedData() {
69
103
  return this.hasViewName() && this.isCacheInitialized();
@@ -4,12 +4,12 @@ exports.default = void 0;
4
4
 
5
5
  var _utils = require("../../utils");
6
6
 
7
+ var _isPageWideScope = require("./utils/isPageWideScope");
8
+
7
9
  var _schema = require("./constants/schema");
8
10
 
9
11
  var _scopeType = require("./constants/scopeType");
10
12
 
11
- var _pageWideScope = require("../../constants/pageWideScope");
12
-
13
13
  function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
14
14
 
15
15
  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."); }
@@ -118,7 +118,7 @@ var extractDecisionsByScope = function extractDecisionsByScope(decisions) {
118
118
 
119
119
  if ((0, _utils.isNonEmptyArray)(decisions)) {
120
120
  decisions.forEach(function (decision) {
121
- if (decision.scope === _pageWideScope.default) {
121
+ if ((0, _isPageWideScope.default)(decision.scope)) {
122
122
  pageWideScopeDecisions.push(decision);
123
123
  } else if (isViewScope(decision.scopeDetails)) {
124
124
  appendScopeDecision(viewScopeDecisions, decision);
@@ -42,6 +42,8 @@ var _createNonRenderingHandler = require("./createNonRenderingHandler");
42
42
 
43
43
  var _createApplyPropositions = require("./createApplyPropositions");
44
44
 
45
+ var _createGetPageLocation = require("./createGetPageLocation");
46
+
45
47
  var _createSetTargetMigration = require("./createSetTargetMigration");
46
48
 
47
49
  /*
@@ -71,6 +73,9 @@ var createPersonalization = function createPersonalization(_ref) {
71
73
  getClickSelectors = _createClickStorage.getClickSelectors,
72
74
  storeClickMetrics = _createClickStorage.storeClickMetrics;
73
75
 
76
+ var getPageLocation = (0, _createGetPageLocation.default)({
77
+ window: window
78
+ });
74
79
  var viewCache = (0, _createViewCacheManager.default)();
75
80
  var modules = (0, _domActions.initDomActionsModules)(storeClickMetrics);
76
81
  var executeDecisions = (0, _createExecuteDecisions.default)({
@@ -125,6 +130,7 @@ var createPersonalization = function createPersonalization(_ref) {
125
130
  targetMigrationEnabled: targetMigrationEnabled
126
131
  });
127
132
  return (0, _createComponent.default)({
133
+ getPageLocation: getPageLocation,
128
134
  logger: logger,
129
135
  fetchDataHandler: fetchDataHandler,
130
136
  viewChangeHandler: viewChangeHandler,
@@ -0,0 +1,24 @@
1
+ "use strict";
2
+
3
+ exports.default = void 0;
4
+
5
+ var _surfaceUtils = require("./surfaceUtils");
6
+
7
+ var _pageWideScope = require("../../../constants/pageWideScope");
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
+ */
20
+ var _default = function _default(scope) {
21
+ return scope === _pageWideScope.default || (0, _surfaceUtils.isPageWideSurface)(scope);
22
+ };
23
+
24
+ exports.default = _default;
@@ -0,0 +1,128 @@
1
+ "use strict";
2
+
3
+ exports.normalizeSurfaces = exports.isPageWideSurface = exports.buildPageSurface = void 0;
4
+
5
+ var _surface = require("../constants/surface");
6
+
7
+ var _utils = require("../../../utils");
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
+ */
20
+ var SURFACE_REGEX = /^(\w+):\/\/([^/#]+)(\/[^#]*)?(#.*)?$/;
21
+ var AUTHORITY_REGEX = /^(?:.*@)?(?:[a-z\d\u00a1-\uffff.-]+|\[[a-f\d:]+])(?::\d+)?$/;
22
+ var PATH_REGEX = /^\/(?:[/\w\u00a1-\uffff-.~]|%[a-fA-F\d]{2})*$/;
23
+ var FRAGMENT_REGEX = /^#(?:[/\w\u00a1-\uffff-.~]|%[a-fA-F\d]{2})+$/;
24
+
25
+ var normalizePath = function normalizePath() {
26
+ var path = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : "/";
27
+ var end = path.length;
28
+
29
+ while (end > 0 && "/".indexOf(path.charAt(end - 1)) !== -1) {
30
+ end -= 1;
31
+ }
32
+
33
+ return path.substring(0, end) || "/";
34
+ };
35
+
36
+ var getSurfaceType = function getSurfaceType(surfaceTypeMatch) {
37
+ return (0, _utils.isNonEmptyString)(surfaceTypeMatch) ? surfaceTypeMatch.toLowerCase() : "";
38
+ };
39
+
40
+ var getAuthority = function getAuthority(authorityMatch) {
41
+ return (0, _utils.isNonEmptyString)(authorityMatch) ? authorityMatch.toLowerCase() : "";
42
+ };
43
+
44
+ var getPath = function getPath(pathMatch) {
45
+ return (0, _utils.isNonEmptyString)(pathMatch) ? normalizePath(pathMatch) : "/";
46
+ };
47
+
48
+ var parseSurface = function parseSurface(surfaceString) {
49
+ var matched = surfaceString.match(SURFACE_REGEX);
50
+ return matched ? {
51
+ surfaceType: getSurfaceType(matched[1]),
52
+ authority: getAuthority(matched[2]),
53
+ path: getPath(matched[3]),
54
+ fragment: matched[4]
55
+ } : null;
56
+ };
57
+
58
+ var stringifySurface = function stringifySurface(surface) {
59
+ return "" + surface.surfaceType + _surface.SURFACE_TYPE_DELIMITER + surface.authority + (surface.path || "") + (surface.fragment || "");
60
+ };
61
+
62
+ var buildPageSurface = function buildPageSurface(getPageLocation) {
63
+ var location = getPageLocation();
64
+ var host = location.host.toLowerCase();
65
+ var path = location.pathname;
66
+ return _surface.WEB + _surface.SURFACE_TYPE_DELIMITER + host + normalizePath(path);
67
+ };
68
+
69
+ exports.buildPageSurface = buildPageSurface;
70
+
71
+ var expandFragmentSurface = function expandFragmentSurface(surface, getPageLocation) {
72
+ return (0, _utils.startsWith)(surface, _surface.FRAGMENT_DELIMITER) ? buildPageSurface(getPageLocation) + surface : surface;
73
+ };
74
+
75
+ var validateSurface = function validateSurface(surface, getPageLocation, logger) {
76
+ var invalidateSurface = function invalidateSurface(validationError) {
77
+ logger.warn(validationError);
78
+ return null;
79
+ };
80
+
81
+ if (!(0, _utils.isNonEmptyString)(surface)) {
82
+ return invalidateSurface("Invalid surface: " + surface);
83
+ }
84
+
85
+ var expanded = expandFragmentSurface(surface, getPageLocation);
86
+ var parsed = parseSurface(expanded);
87
+
88
+ if (parsed === null) {
89
+ return invalidateSurface("Invalid surface: " + surface);
90
+ }
91
+
92
+ if (!(0, _utils.includes)([_surface.WEB, _surface.WEBAPP], parsed.surfaceType)) {
93
+ return invalidateSurface("Unsupported surface type " + parsed.surfaceType + " in surface: " + surface);
94
+ }
95
+
96
+ if (!parsed.authority || !AUTHORITY_REGEX.test(parsed.authority)) {
97
+ return invalidateSurface("Invalid authority " + parsed.authority + " in surface: " + surface);
98
+ }
99
+
100
+ if (parsed.path && !PATH_REGEX.test(parsed.path)) {
101
+ return invalidateSurface("Invalid path " + parsed.path + " in surface: " + surface);
102
+ }
103
+
104
+ if (parsed.fragment && !FRAGMENT_REGEX.test(parsed.fragment)) {
105
+ return invalidateSurface("Invalid fragment " + parsed.fragment + " in surface: " + surface);
106
+ }
107
+
108
+ return parsed;
109
+ };
110
+
111
+ var isPageWideSurface = function isPageWideSurface(scope) {
112
+ return !!scope && scope.indexOf(_surface.WEB + _surface.SURFACE_TYPE_DELIMITER) === 0 && scope.indexOf(_surface.FRAGMENT_DELIMITER) === -1;
113
+ };
114
+
115
+ exports.isPageWideSurface = isPageWideSurface;
116
+
117
+ var normalizeSurfaces = function normalizeSurfaces() {
118
+ var surfaces = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
119
+ var getPageLocation = arguments.length > 1 ? arguments[1] : undefined;
120
+ var logger = arguments.length > 2 ? arguments[2] : undefined;
121
+ return surfaces.map(function (surface) {
122
+ return validateSurface(surface, getPageLocation, logger);
123
+ }).filter(function (surface) {
124
+ return !(0, _utils.isNil)(surface);
125
+ }).map(stringifySurface);
126
+ };
127
+
128
+ exports.normalizeSurfaces = normalizeSurfaces;
@@ -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)({