@adobe/alloy 2.15.0-alpha.1 → 2.16.0-alpha.0

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 (62) hide show
  1. package/libEs5/components/DataCollector/index.js +26 -10
  2. package/libEs5/components/DataCollector/validateApplyResponse.js +11 -0
  3. package/libEs5/components/DataCollector/validateUserEventOptions.js +2 -1
  4. package/libEs5/components/Identity/appendIdentityToUrl/appendIdentityToUrlOptionsValidator.js +4 -1
  5. package/libEs5/components/Identity/createComponent.js +13 -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/loggerMessage.js +12 -0
  10. package/libEs5/components/Personalization/utils/composePersonalizationResultingObject.js +11 -0
  11. package/libEs5/components/Personalization/validateApplyPropositionsOptions.js +11 -0
  12. package/libEs5/components/Privacy/createComponent.js +4 -2
  13. package/libEs5/components/Privacy/index.js +2 -1
  14. package/libEs5/components/Privacy/injectSendSetConsentRequest.js +6 -2
  15. package/libEs5/components/Privacy/validateSetConsentOptions.js +13 -1
  16. package/libEs5/constants/apiVersion.js +12 -0
  17. package/libEs5/constants/edgeBasePath.js +12 -0
  18. package/libEs5/constants/identityMapAuthenticatedState.js +12 -0
  19. package/libEs5/constants/libraryVersion.js +1 -1
  20. package/libEs5/core/config/createCoreConfigs.js +2 -1
  21. package/libEs5/core/createEventManager.js +5 -1
  22. package/libEs5/core/edgeNetwork/handleRequestFailure.js +11 -0
  23. package/libEs5/core/edgeNetwork/injectApplyResponse.js +11 -0
  24. package/libEs5/utils/filterObject.js +57 -0
  25. package/libEs5/utils/index.js +24 -0
  26. package/libEs5/utils/prepareConfigOverridesForEdge.js +61 -0
  27. package/libEs5/utils/request/createRequestPayload.js +6 -0
  28. package/libEs5/utils/stringToBoolean.js +11 -0
  29. package/libEs5/utils/validateConfigOverride.js +20 -0
  30. package/libEs6/components/DataCollector/index.js +25 -10
  31. package/libEs6/components/DataCollector/validateApplyResponse.js +11 -0
  32. package/libEs6/components/DataCollector/validateUserEventOptions.js +3 -2
  33. package/libEs6/components/Identity/appendIdentityToUrl/appendIdentityToUrlOptionsValidator.js +3 -1
  34. package/libEs6/components/Identity/createComponent.js +13 -2
  35. package/libEs6/components/Identity/getIdentity/createGetIdentity.js +10 -3
  36. package/libEs6/components/Identity/getIdentity/getIdentityOptionsValidator.js +6 -10
  37. package/libEs6/components/Identity/index.js +8 -4
  38. package/libEs6/components/Identity/injectAddQueryStringIdentityToPayload.js +11 -0
  39. package/libEs6/components/Personalization/constants/loggerMessage.js +11 -0
  40. package/libEs6/components/Personalization/utils/composePersonalizationResultingObject.js +11 -0
  41. package/libEs6/components/Personalization/validateApplyPropositionsOptions.js +11 -0
  42. package/libEs6/components/Privacy/createComponent.js +4 -2
  43. package/libEs6/components/Privacy/createConsentHashStore.js +11 -0
  44. package/libEs6/components/Privacy/index.js +2 -1
  45. package/libEs6/components/Privacy/injectSendSetConsentRequest.js +6 -2
  46. package/libEs6/components/Privacy/validateSetConsentOptions.js +14 -2
  47. package/libEs6/constants/apiVersion.js +11 -0
  48. package/libEs6/constants/edgeBasePath.js +11 -0
  49. package/libEs6/constants/identityMapAuthenticatedState.js +11 -0
  50. package/libEs6/constants/libraryVersion.js +1 -1
  51. package/libEs6/core/config/createCoreConfigs.js +3 -2
  52. package/libEs6/core/createEventManager.js +5 -1
  53. package/libEs6/core/edgeNetwork/handleRequestFailure.js +11 -0
  54. package/libEs6/core/edgeNetwork/injectApplyResponse.js +11 -0
  55. package/libEs6/core/edgeNetwork/mergeLifecycleResponses.js +11 -0
  56. package/libEs6/utils/filterObject.js +59 -0
  57. package/libEs6/utils/index.js +3 -0
  58. package/libEs6/utils/prepareConfigOverridesForEdge.js +57 -0
  59. package/libEs6/utils/request/createRequestPayload.js +3 -1
  60. package/libEs6/utils/stringToBoolean.js +11 -0
  61. package/libEs6/utils/validateConfigOverride.js +13 -0
  62. package/package.json +6 -3
@@ -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: {
@@ -4,6 +4,17 @@ exports.default = void 0;
4
4
 
5
5
  var _validation = require("../../utils/validation");
6
6
 
7
+ /*
8
+ Copyright 2023 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
+ */
7
18
  var _default = function _default(_ref) {
8
19
  var options = _ref.options;
9
20
  var validator = (0, _validation.objectOf)({
@@ -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;
@@ -8,6 +8,17 @@ var _getIdentityOptionsValidator = require("./getIdentity/getIdentityOptionsVali
8
8
 
9
9
  var _appendIdentityToUrlOptionsValidator = require("./appendIdentityToUrl/appendIdentityToUrlOptionsValidator");
10
10
 
11
+ /*
12
+ Copyright 2023 Adobe. All rights reserved.
13
+ This file is licensed to you under the Apache License, Version 2.0 (the "License");
14
+ you may not use this file except in compliance with the License. You may obtain a copy
15
+ of the License at http://www.apache.org/licenses/LICENSE-2.0
16
+
17
+ Unless required by applicable law or agreed to in writing, software distributed under
18
+ the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
19
+ OF ANY KIND, either express or implied. See the License for the specific language
20
+ governing permissions and limitations under the License.
21
+ */
11
22
  var _default = function _default(_ref) {
12
23
  var addEcidQueryToPayload = _ref.addEcidQueryToPayload,
13
24
  addQueryStringIdentityToPayload = _ref.addQueryStringIdentityToPayload,
@@ -60,7 +71,7 @@ var _default = function _default(_ref) {
60
71
  optionsValidator: _getIdentityOptionsValidator.default,
61
72
  run: function run(options) {
62
73
  return consent.awaitConsent().then(function () {
63
- return ecid ? undefined : getIdentity(options.namespaces);
74
+ return ecid ? undefined : getIdentity(options);
64
75
  }).then(function () {
65
76
  return {
66
77
  identity: {
@@ -75,7 +86,7 @@ var _default = function _default(_ref) {
75
86
  optionsValidator: _appendIdentityToUrlOptionsValidator.default,
76
87
  run: function run(options) {
77
88
  return consent.withConsent().then(function () {
78
- return ecid ? undefined : getIdentity(options.namespaces);
89
+ return ecid ? undefined : getIdentity(options);
79
90
  }).then(function () {
80
91
  return {
81
92
  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
 
@@ -1,6 +1,18 @@
1
1
  "use strict";
2
2
 
3
3
  exports.REDIRECT_EXECUTION_ERROR = exports.AUTHORING_ENABLED = void 0;
4
+
5
+ /*
6
+ Copyright 2023 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
+ */
4
16
  var AUTHORING_ENABLED = "Rendering is disabled for authoring mode.";
5
17
  exports.AUTHORING_ENABLED = AUTHORING_ENABLED;
6
18
  var REDIRECT_EXECUTION_ERROR = "An error occurred while executing the redirect offer.";
@@ -4,6 +4,17 @@ exports.default = void 0;
4
4
 
5
5
  var _addRenderAttemptedToDecisions = require("./addRenderAttemptedToDecisions");
6
6
 
7
+ /*
8
+ Copyright 2023 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
+ */
7
18
  var _default = function _default() {
8
19
  var decisions = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
9
20
  var renderDecisions = arguments.length > 1 ? arguments[1] : undefined;
@@ -4,6 +4,17 @@ exports.default = exports.EMPTY_PROPOSITIONS = void 0;
4
4
 
5
5
  var _validation = require("../../utils/validation");
6
6
 
7
+ /*
8
+ Copyright 2023 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
+ */
7
18
  var EMPTY_PROPOSITIONS = {
8
19
  propositions: []
9
20
  };
@@ -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) {
@@ -6,9 +6,21 @@ var _validation = require("../../utils/validation");
6
6
 
7
7
  var _utils = require("../../utils");
8
8
 
9
+ /*
10
+ Copyright 2023 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
20
  var _default = (0, _validation.objectOf)({
10
21
  consent: (0, _validation.arrayOf)((0, _validation.anything)()).required().nonEmpty(),
11
- identityMap: _utils.validateIdentityMap
22
+ identityMap: _utils.validateIdentityMap,
23
+ edgeConfigOverrides: _utils.validateConfigOverride
12
24
  }).noUnknownFields().required();
13
25
 
14
26
  exports.default = _default;
@@ -1,5 +1,17 @@
1
1
  "use strict";
2
2
 
3
3
  exports.default = void 0;
4
+
5
+ /*
6
+ Copyright 2023 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
+ */
4
16
  var _default = "v1";
5
17
  exports.default = _default;
@@ -1,5 +1,17 @@
1
1
  "use strict";
2
2
 
3
3
  exports.default = void 0;
4
+
5
+ /*
6
+ Copyright 2023 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
+ */
4
16
  var _default = "ee";
5
17
  exports.default = _default;
@@ -1,6 +1,18 @@
1
1
  "use strict";
2
2
 
3
3
  exports.LOGGED_OUT = exports.AUTHENTICATED = exports.AMBIGUOUS = void 0;
4
+
5
+ /*
6
+ Copyright 2023 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
+ */
4
16
  var AMBIGUOUS = "ambiguous";
5
17
  exports.AMBIGUOUS = AMBIGUOUS;
6
18
  var AUTHENTICATED = "authenticated";
@@ -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.15.0-alpha.1";
18
+ var _default = "2.16.0-alpha.0";
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,
@@ -2,6 +2,17 @@
2
2
 
3
3
  exports.default = void 0;
4
4
 
5
+ /*
6
+ Copyright 2023 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
+ */
5
16
  var _default = function _default(onRequestFailureCallbackAggregator) {
6
17
  return function (error) {
7
18
  // Regardless of whether the network call failed, an unexpected status
@@ -8,6 +8,17 @@ var _mergeLifecycleResponses = require("./mergeLifecycleResponses");
8
8
 
9
9
  var _handleRequestFailure = require("./handleRequestFailure");
10
10
 
11
+ /*
12
+ Copyright 2023 Adobe. All rights reserved.
13
+ This file is licensed to you under the Apache License, Version 2.0 (the "License");
14
+ you may not use this file except in compliance with the License. You may obtain a copy
15
+ of the License at http://www.apache.org/licenses/LICENSE-2.0
16
+
17
+ Unless required by applicable law or agreed to in writing, software distributed under
18
+ the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
19
+ OF ANY KIND, either express or implied. See the License for the specific language
20
+ governing permissions and limitations under the License.
21
+ */
11
22
  var HTTP_STATUS_OK = 200;
12
23
 
13
24
  var _default = function _default(_ref) {
@@ -0,0 +1,57 @@
1
+ "use strict";
2
+
3
+ exports.default = void 0;
4
+
5
+ var _isEmptyObject = require("./isEmptyObject");
6
+
7
+ var _isNil = require("./isNil");
8
+
9
+ var _isObject = require("./isObject");
10
+
11
+ function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
12
+
13
+ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
14
+
15
+ 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; }
16
+
17
+ /**
18
+ * Given an object and a function that takes a value and returns a predicate, filter out
19
+ * all non-object deeply nested values that do not pass the predicate.
20
+ *
21
+ * Example: filterObject({ a: 2, b: { c: 6 } }, (val) => val > 5) returns { b { c: 6 } }
22
+ *
23
+ * @param {*} obj
24
+ * @param {* => boolean} predicate a function that takes a value and return a boolean,
25
+ * representing if it should be included in the result object or not.
26
+ * @returns A copy of the original object with the values that fail the predicate, filtered out.
27
+ */
28
+ var filterObject = function filterObject(obj, predicate) {
29
+ if ((0, _isNil.default)(obj) || !(0, _isObject.default)(obj)) {
30
+ return obj;
31
+ }
32
+
33
+ return Object.keys(obj).reduce(function (result, key) {
34
+ var value = obj[key];
35
+
36
+ if ((0, _isObject.default)(value)) {
37
+ // value is object, go deeper
38
+ var filteredValue = filterObject(value, predicate);
39
+
40
+ if ((0, _isEmptyObject.default)(filteredValue)) {
41
+ return result;
42
+ }
43
+
44
+ return _objectSpread(_objectSpread({}, result), {}, _defineProperty({}, key, filteredValue));
45
+ } // value is not an object, test predicate
46
+
47
+
48
+ if (predicate(value)) {
49
+ return _objectSpread(_objectSpread({}, result), {}, _defineProperty({}, key, value));
50
+ }
51
+
52
+ return result;
53
+ }, {});
54
+ };
55
+
56
+ var _default = filterObject;
57
+ exports.default = _default;
@@ -78,6 +78,12 @@ Object.defineProperty(exports, "endsWith", {
78
78
  return _endsWith.default;
79
79
  }
80
80
  });
81
+ Object.defineProperty(exports, "filterObject", {
82
+ enumerable: true,
83
+ get: function get() {
84
+ return _filterObject.default;
85
+ }
86
+ });
81
87
  Object.defineProperty(exports, "find", {
82
88
  enumerable: true,
83
89
  get: function get() {
@@ -234,6 +240,12 @@ Object.defineProperty(exports, "padStart", {
234
240
  return _padStart.default;
235
241
  }
236
242
  });
243
+ Object.defineProperty(exports, "prepareConfigOverridesForEdge", {
244
+ enumerable: true,
245
+ get: function get() {
246
+ return _prepareConfigOverridesForEdge.default;
247
+ }
248
+ });
237
249
  Object.defineProperty(exports, "queryString", {
238
250
  enumerable: true,
239
251
  get: function get() {
@@ -300,6 +312,12 @@ Object.defineProperty(exports, "uuid", {
300
312
  return _uuid.default;
301
313
  }
302
314
  });
315
+ Object.defineProperty(exports, "validateConfigOverride", {
316
+ enumerable: true,
317
+ get: function get() {
318
+ return _validateConfigOverride.default;
319
+ }
320
+ });
303
321
  Object.defineProperty(exports, "validateIdentityMap", {
304
322
  enumerable: true,
305
323
  get: function get() {
@@ -345,6 +363,8 @@ var _fireImage = require("./fireImage");
345
363
 
346
364
  var _injectFireReferrerHideableImage = require("./injectFireReferrerHideableImage");
347
365
 
366
+ var _filterObject = require("./filterObject");
367
+
348
368
  var _flatMap = require("./flatMap");
349
369
 
350
370
  var _getApexDomain = require("./getApexDomain");
@@ -391,6 +411,8 @@ var _noop = require("./noop");
391
411
 
392
412
  var _padStart = require("./padStart");
393
413
 
414
+ var _prepareConfigOverridesForEdge = require("./prepareConfigOverridesForEdge");
415
+
394
416
  var _querystring = require("./querystring");
395
417
 
396
418
  var _sanitizeOrgIdForCookieName = require("./sanitizeOrgIdForCookieName");
@@ -415,4 +437,6 @@ var _updateErrorMessage = require("./updateErrorMessage");
415
437
 
416
438
  var _validateIdentityMap = require("./validateIdentityMap");
417
439
 
440
+ var _validateConfigOverride = require("./validateConfigOverride");
441
+
418
442
  var _values = require("./values");