@adobe/alloy 2.17.0-beta.0 → 2.18.0-beta.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.
- package/libEs5/components/ActivityCollector/configValidators.js +9 -5
- package/libEs5/components/ActivityCollector/utils.js +22 -3
- package/libEs5/components/Audiences/index.js +0 -1
- package/libEs5/components/Context/index.js +2 -2
- package/libEs5/components/DataCollector/index.js +1 -2
- package/libEs5/components/EventMerge/index.js +0 -1
- package/libEs5/components/Identity/configValidators.js +2 -2
- package/libEs5/components/Identity/getIdentity/createGetIdentity.js +8 -5
- package/libEs5/components/Identity/getIdentity/createIdentityRequest.js +5 -2
- package/libEs5/components/MachineLearning/index.js +0 -1
- package/libEs5/components/Personalization/index.js +2 -2
- package/libEs5/components/Privacy/createConsentRequest.js +5 -2
- package/libEs5/components/Privacy/injectSendSetConsentRequest.js +10 -6
- package/libEs5/constants/libraryVersion.js +1 -1
- package/libEs5/core/buildAndValidateConfig.js +79 -26
- package/libEs5/core/config/createCoreConfigs.js +3 -3
- package/libEs5/core/createEventManager.js +15 -6
- package/libEs5/core/edgeNetwork/injectSendEdgeNetworkRequest.js +3 -2
- package/libEs5/utils/request/createDataCollectionRequest.js +10 -6
- package/libEs5/utils/request/createRequest.js +5 -1
- package/libEs5/utils/request/createRequestParams.js +53 -0
- package/libEs5/utils/request/index.js +8 -0
- package/libEs5/utils/validation/booleanValidator.js +2 -2
- package/libEs5/utils/validation/callbackValidator.js +2 -2
- package/libEs5/utils/validation/createAnyOfValidator.js +8 -5
- package/libEs5/utils/validation/createArrayOfValidator.js +6 -4
- package/libEs5/utils/validation/createDeprecatedValidator.js +53 -0
- package/libEs5/utils/validation/createLiteralValidator.js +2 -2
- package/libEs5/utils/validation/createMapOfValuesValidator.js +6 -4
- package/libEs5/utils/validation/createMinimumValidator.js +2 -2
- package/libEs5/utils/validation/createNonEmptyValidator.js +3 -3
- package/libEs5/utils/validation/createObjectOfValidator.js +6 -4
- package/libEs5/utils/validation/createUniqueItemsValidator.js +2 -2
- package/libEs5/utils/validation/createUniqueValidator.js +2 -2
- package/libEs5/utils/validation/domainValidator.js +2 -2
- package/libEs5/utils/validation/index.js +54 -45
- package/libEs5/utils/validation/integerValidator.js +2 -2
- package/libEs5/utils/validation/numberValidator.js +2 -2
- package/libEs5/utils/validation/regexpValidator.js +2 -2
- package/libEs5/utils/validation/stringValidator.js +2 -2
- package/libEs5/utils/validation/utils.js +155 -0
- package/libEs6/components/ActivityCollector/configValidators.js +6 -5
- package/libEs6/components/ActivityCollector/utils.js +20 -3
- package/libEs6/components/Audiences/index.js +0 -1
- package/libEs6/components/Context/index.js +3 -3
- package/libEs6/components/DataCollector/index.js +1 -2
- package/libEs6/components/EventMerge/index.js +0 -1
- package/libEs6/components/Identity/configValidators.js +3 -3
- package/libEs6/components/Identity/getIdentity/createGetIdentity.js +7 -5
- package/libEs6/components/Identity/getIdentity/createIdentityRequest.js +6 -2
- package/libEs6/components/MachineLearning/index.js +0 -1
- package/libEs6/components/Personalization/index.js +3 -3
- package/libEs6/components/Privacy/createConsentRequest.js +6 -2
- package/libEs6/components/Privacy/injectSendSetConsentRequest.js +9 -6
- package/libEs6/constants/libraryVersion.js +1 -1
- package/libEs6/core/buildAndValidateConfig.js +48 -19
- package/libEs6/core/config/createCoreConfigs.js +4 -4
- package/libEs6/core/createEventManager.js +14 -6
- package/libEs6/core/edgeNetwork/injectSendEdgeNetworkRequest.js +3 -2
- package/libEs6/utils/request/createDataCollectionRequest.js +6 -2
- package/libEs6/utils/request/createRequest.js +6 -1
- package/libEs6/utils/request/createRequestParams.js +43 -0
- package/libEs6/utils/request/index.js +1 -0
- package/libEs6/utils/validation/booleanValidator.js +1 -1
- package/libEs6/utils/validation/callbackValidator.js +1 -1
- package/libEs6/utils/validation/createAnyOfValidator.js +5 -4
- package/libEs6/utils/validation/createArrayOfValidator.js +3 -3
- package/libEs6/utils/validation/createDeprecatedValidator.js +41 -0
- package/libEs6/utils/validation/createLiteralValidator.js +1 -1
- package/libEs6/utils/validation/createMapOfValuesValidator.js +3 -3
- package/libEs6/utils/validation/createMinimumValidator.js +1 -1
- package/libEs6/utils/validation/createNonEmptyValidator.js +1 -1
- package/libEs6/utils/validation/createObjectOfValidator.js +3 -3
- package/libEs6/utils/validation/createUniqueItemsValidator.js +1 -1
- package/libEs6/utils/validation/createUniqueValidator.js +1 -1
- package/libEs6/utils/validation/domainValidator.js +1 -1
- package/libEs6/utils/validation/index.js +84 -13
- package/libEs6/utils/validation/integerValidator.js +1 -1
- package/libEs6/utils/validation/numberValidator.js +1 -1
- package/libEs6/utils/validation/regexpValidator.js +1 -1
- package/libEs6/utils/validation/stringValidator.js +1 -1
- package/libEs6/utils/validation/utils.js +131 -0
- package/package.json +6 -4
- package/libEs5/utils/validation/assertValid.js +0 -22
- package/libEs5/utils/validation/chain.js +0 -76
- package/libEs5/utils/validation/nullSafeChain.js +0 -41
- package/libEs6/utils/validation/assertValid.js +0 -16
- package/libEs6/utils/validation/chain.js +0 -67
- package/libEs6/utils/validation/nullSafeChain.js +0 -32
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
exports.default = void 0;
|
|
3
|
+
exports.downloadLinkQualifier = exports.default = void 0;
|
|
4
4
|
|
|
5
5
|
var _validation = require("../../utils/validation");
|
|
6
6
|
|
|
@@ -15,9 +15,13 @@ the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTA
|
|
|
15
15
|
OF ANY KIND, either express or implied. See the License for the specific language
|
|
16
16
|
governing permissions and limitations under the License.
|
|
17
17
|
*/
|
|
18
|
-
var
|
|
18
|
+
var downloadLinkQualifier = (0, _validation.string)().regexp().default("\\.(exe|zip|wav|mp3|mov|mpg|avi|wmv|pdf|doc|docx|xls|xlsx|ppt|pptx)$");
|
|
19
|
+
exports.downloadLinkQualifier = downloadLinkQualifier;
|
|
20
|
+
|
|
21
|
+
var _default = (0, _validation.objectOf)({
|
|
19
22
|
clickCollectionEnabled: (0, _validation.boolean)().default(true),
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
};
|
|
23
|
+
onBeforeLinkClickSend: (0, _validation.callback)(),
|
|
24
|
+
downloadLinkQualifier: downloadLinkQualifier
|
|
25
|
+
});
|
|
26
|
+
|
|
23
27
|
exports.default = _default;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
exports.urlStartsWithScheme = exports.truncateWhiteSpace = exports.isSupportedAnchorElement = exports.isExitLink = exports.isEmptyString = exports.isDownloadLink = exports.getAbsoluteUrlFromAnchorElement = exports.findSupportedAnchorElement = exports.determineLinkType = void 0;
|
|
3
|
+
exports.urlStartsWithScheme = exports.truncateWhiteSpace = exports.trimQueryFromUrl = exports.isSupportedAnchorElement = exports.isExitLink = exports.isEmptyString = exports.isDownloadLink = exports.getAbsoluteUrlFromAnchorElement = exports.findSupportedAnchorElement = exports.determineLinkType = void 0;
|
|
4
4
|
|
|
5
5
|
/*
|
|
6
6
|
Copyright 2019 Adobe. All rights reserved.
|
|
@@ -62,17 +62,36 @@ var isSupportedAnchorElement = function isSupportedAnchorElement(element) {
|
|
|
62
62
|
|
|
63
63
|
exports.isSupportedAnchorElement = isSupportedAnchorElement;
|
|
64
64
|
|
|
65
|
+
var trimQueryFromUrl = function trimQueryFromUrl(url) {
|
|
66
|
+
var questionMarkIndex = url.indexOf("?");
|
|
67
|
+
var hashIndex = url.indexOf("#");
|
|
68
|
+
|
|
69
|
+
if (questionMarkIndex >= 0 && (questionMarkIndex < hashIndex || hashIndex < 0)) {
|
|
70
|
+
return url.substring(0, questionMarkIndex);
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
if (hashIndex >= 0) {
|
|
74
|
+
return url.substring(0, hashIndex);
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
return url;
|
|
78
|
+
};
|
|
79
|
+
|
|
80
|
+
exports.trimQueryFromUrl = trimQueryFromUrl;
|
|
81
|
+
|
|
65
82
|
var isDownloadLink = function isDownloadLink(downloadLinkQualifier, linkUrl, clickedObj) {
|
|
66
83
|
var re = new RegExp(downloadLinkQualifier);
|
|
67
|
-
|
|
84
|
+
var trimmedLinkUrl = trimQueryFromUrl(linkUrl).toLowerCase();
|
|
85
|
+
return clickedObj.download ? true : re.test(trimmedLinkUrl);
|
|
68
86
|
};
|
|
69
87
|
|
|
70
88
|
exports.isDownloadLink = isDownloadLink;
|
|
71
89
|
|
|
72
90
|
var isExitLink = function isExitLink(window, linkUrl) {
|
|
73
91
|
var currentHostname = window.location.hostname.toLowerCase();
|
|
92
|
+
var trimmedLinkUrl = trimQueryFromUrl(linkUrl).toLowerCase();
|
|
74
93
|
|
|
75
|
-
if (
|
|
94
|
+
if (trimmedLinkUrl.indexOf(currentHostname) >= 0) {
|
|
76
95
|
return false;
|
|
77
96
|
}
|
|
78
97
|
|
|
@@ -57,8 +57,8 @@ var createContext = function createContext(_ref) {
|
|
|
57
57
|
};
|
|
58
58
|
|
|
59
59
|
createContext.namespace = "Context";
|
|
60
|
-
createContext.configValidators = {
|
|
60
|
+
createContext.configValidators = (0, _validation.objectOf)({
|
|
61
61
|
context: (0, _validation.arrayOf)((0, _validation.string)()).default(Object.keys(defaultEnabledContexts))
|
|
62
|
-
};
|
|
62
|
+
});
|
|
63
63
|
var _default = createContext;
|
|
64
64
|
exports.default = _default;
|
|
@@ -78,7 +78,7 @@ var createDataCollector = function createDataCollector(_ref) {
|
|
|
78
78
|
}
|
|
79
79
|
|
|
80
80
|
if (datasetId) {
|
|
81
|
-
logger.warn("The 'datasetId' option has been deprecated. Please use 'edgeConfigOverrides.
|
|
81
|
+
logger.warn("The 'datasetId' option has been deprecated. Please use 'edgeConfigOverrides.com_adobe_experience_platform.datasets.event.datasetId' instead.");
|
|
82
82
|
sendEventOptions.edgeConfigOverrides = edgeConfigOverrides || {};
|
|
83
83
|
(0, _utils.deepAssign)(sendEventOptions.edgeConfigOverrides, {
|
|
84
84
|
com_adobe_experience_platform: {
|
|
@@ -123,6 +123,5 @@ var createDataCollector = function createDataCollector(_ref) {
|
|
|
123
123
|
};
|
|
124
124
|
|
|
125
125
|
createDataCollector.namespace = "DataCollector";
|
|
126
|
-
createDataCollector.configValidators = {};
|
|
127
126
|
var _default = createDataCollector;
|
|
128
127
|
exports.default = _default;
|
|
@@ -15,9 +15,9 @@ the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTA
|
|
|
15
15
|
OF ANY KIND, either express or implied. See the License for the specific language
|
|
16
16
|
governing permissions and limitations under the License.
|
|
17
17
|
*/
|
|
18
|
-
var configValidators = {
|
|
18
|
+
var configValidators = (0, _validation.objectOf)({
|
|
19
19
|
thirdPartyCookiesEnabled: (0, _validation.boolean)().default(true),
|
|
20
20
|
idMigrationEnabled: (0, _validation.boolean)().default(true)
|
|
21
|
-
};
|
|
21
|
+
});
|
|
22
22
|
var _default = configValidators;
|
|
23
23
|
exports.default = _default;
|
|
@@ -2,6 +2,8 @@
|
|
|
2
2
|
|
|
3
3
|
exports.default = void 0;
|
|
4
4
|
|
|
5
|
+
var _request = require("../../../utils/request");
|
|
6
|
+
|
|
5
7
|
/*
|
|
6
8
|
Copyright 2020 Adobe. All rights reserved.
|
|
7
9
|
This file is licensed to you under the Apache License, Version 2.0 (the "License");
|
|
@@ -23,11 +25,12 @@ var _default = function _default(_ref) {
|
|
|
23
25
|
namespaces = _ref2.namespaces,
|
|
24
26
|
localConfigOverrides = _ref2.edgeConfigOverrides;
|
|
25
27
|
|
|
26
|
-
var
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
28
|
+
var requestParams = (0, _request.createRequestParams)({
|
|
29
|
+
payload: createIdentityRequestPayload(namespaces),
|
|
30
|
+
globalConfigOverrides: globalConfigOverrides,
|
|
31
|
+
localConfigOverrides: localConfigOverrides
|
|
32
|
+
});
|
|
33
|
+
var request = createIdentityRequest(requestParams);
|
|
31
34
|
return sendEdgeNetworkRequest({
|
|
32
35
|
request: request
|
|
33
36
|
});
|
|
@@ -15,9 +15,12 @@ the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTA
|
|
|
15
15
|
OF ANY KIND, either express or implied. See the License for the specific language
|
|
16
16
|
governing permissions and limitations under the License.
|
|
17
17
|
*/
|
|
18
|
-
var _default = function _default(
|
|
18
|
+
var _default = function _default(_ref) {
|
|
19
|
+
var payload = _ref.payload,
|
|
20
|
+
datastreamIdOverride = _ref.datastreamIdOverride;
|
|
19
21
|
return (0, _request.createRequest)({
|
|
20
|
-
payload:
|
|
22
|
+
payload: payload,
|
|
23
|
+
datastreamIdOverride: datastreamIdOverride,
|
|
21
24
|
getAction: function getAction() {
|
|
22
25
|
return "identity/acquire";
|
|
23
26
|
},
|
|
@@ -145,9 +145,9 @@ var createPersonalization = function createPersonalization(_ref) {
|
|
|
145
145
|
};
|
|
146
146
|
|
|
147
147
|
createPersonalization.namespace = "Personalization";
|
|
148
|
-
createPersonalization.configValidators = {
|
|
148
|
+
createPersonalization.configValidators = (0, _validation.objectOf)({
|
|
149
149
|
prehidingStyle: (0, _validation.string)().nonEmpty(),
|
|
150
150
|
targetMigrationEnabled: (0, _validation.boolean)().default(false)
|
|
151
|
-
};
|
|
151
|
+
});
|
|
152
152
|
var _default = createPersonalization;
|
|
153
153
|
exports.default = _default;
|
|
@@ -15,9 +15,12 @@ the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTA
|
|
|
15
15
|
OF ANY KIND, either express or implied. See the License for the specific language
|
|
16
16
|
governing permissions and limitations under the License.
|
|
17
17
|
*/
|
|
18
|
-
var _default = function _default(
|
|
18
|
+
var _default = function _default(_ref) {
|
|
19
|
+
var payload = _ref.payload,
|
|
20
|
+
datastreamIdOverride = _ref.datastreamIdOverride;
|
|
19
21
|
return (0, _request.createRequest)({
|
|
20
|
-
payload:
|
|
22
|
+
payload: payload,
|
|
23
|
+
datastreamIdOverride: datastreamIdOverride,
|
|
21
24
|
getAction: function getAction() {
|
|
22
25
|
return "privacy/set-consent";
|
|
23
26
|
},
|
|
@@ -4,6 +4,8 @@ exports.default = void 0;
|
|
|
4
4
|
|
|
5
5
|
var _utils = require("../../utils");
|
|
6
6
|
|
|
7
|
+
var _request = require("../../utils/request");
|
|
8
|
+
|
|
7
9
|
/*
|
|
8
10
|
Copyright 2020 Adobe. All rights reserved.
|
|
9
11
|
This file is licensed to you under the Apache License, Version 2.0 (the "License");
|
|
@@ -24,20 +26,22 @@ var _default = function _default(_ref) {
|
|
|
24
26
|
var consentOptions = _ref2.consentOptions,
|
|
25
27
|
identityMap = _ref2.identityMap,
|
|
26
28
|
localConfigOverrides = _ref2.edgeConfigOverrides;
|
|
27
|
-
var
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
29
|
+
var requestParams = (0, _request.createRequestParams)({
|
|
30
|
+
payload: createConsentRequestPayload(),
|
|
31
|
+
globalConfigOverrides: globalConfigOverrides,
|
|
32
|
+
localConfigOverrides: localConfigOverrides
|
|
33
|
+
});
|
|
34
|
+
requestParams.payload.setConsent(consentOptions);
|
|
31
35
|
|
|
32
36
|
if ((0, _utils.isObject)(identityMap)) {
|
|
33
37
|
Object.keys(identityMap).forEach(function (key) {
|
|
34
38
|
identityMap[key].forEach(function (identity) {
|
|
35
|
-
payload.addIdentity(key, identity);
|
|
39
|
+
requestParams.payload.addIdentity(key, identity);
|
|
36
40
|
});
|
|
37
41
|
});
|
|
38
42
|
}
|
|
39
43
|
|
|
40
|
-
var request = createConsentRequest(
|
|
44
|
+
var request = createConsentRequest(requestParams);
|
|
41
45
|
return sendEdgeNetworkRequest({
|
|
42
46
|
request: request
|
|
43
47
|
}).then(function () {// Don't let response data disseminate beyond this
|
|
@@ -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.
|
|
18
|
+
var _default = "2.18.0-beta.0";
|
|
19
19
|
exports.default = _default;
|
|
@@ -4,38 +4,44 @@ exports.default = void 0;
|
|
|
4
4
|
|
|
5
5
|
var _utils = require("../utils");
|
|
6
6
|
|
|
7
|
-
var _validation = require("../utils/validation");
|
|
8
|
-
|
|
9
7
|
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; }
|
|
10
8
|
|
|
11
9
|
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; }
|
|
12
10
|
|
|
13
11
|
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; }
|
|
14
12
|
|
|
13
|
+
function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
|
|
14
|
+
|
|
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."); }
|
|
16
|
+
|
|
17
|
+
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); }
|
|
18
|
+
|
|
19
|
+
function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
|
|
20
|
+
|
|
21
|
+
function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
|
|
22
|
+
|
|
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
|
+
|
|
15
25
|
var CONFIG_DOC_URI = "https://adobe.ly/3sHh553";
|
|
16
26
|
|
|
17
|
-
var
|
|
18
|
-
var
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
var configValidators = createComponent.configValidators;
|
|
22
|
-
(0, _utils.assign)(schema, configValidators);
|
|
23
|
-
});
|
|
24
|
-
return schema;
|
|
25
|
-
};
|
|
27
|
+
var transformOptions = function transformOptions(_ref) {
|
|
28
|
+
var combinedConfigValidator = _ref.combinedConfigValidator,
|
|
29
|
+
options = _ref.options,
|
|
30
|
+
logger = _ref.logger;
|
|
26
31
|
|
|
27
|
-
var transformOptions = function transformOptions(schema, options) {
|
|
28
32
|
try {
|
|
29
|
-
var validator =
|
|
30
|
-
return validator(
|
|
33
|
+
var validator = combinedConfigValidator.noUnknownFields().required();
|
|
34
|
+
return validator.call({
|
|
35
|
+
logger: logger
|
|
36
|
+
}, options);
|
|
31
37
|
} catch (e) {
|
|
32
38
|
throw new Error("Resolve these configuration problems:\n\t - " + e.message.split("\n").join("\n\t - ") + "\nFor configuration documentation see: " + CONFIG_DOC_URI);
|
|
33
39
|
}
|
|
34
40
|
};
|
|
35
41
|
|
|
36
42
|
var buildAllOnInstanceConfiguredExtraParams = function buildAllOnInstanceConfiguredExtraParams(config, logger, componentCreators) {
|
|
37
|
-
return componentCreators.reduce(function (memo,
|
|
38
|
-
var buildOnInstanceConfiguredExtraParams =
|
|
43
|
+
return componentCreators.reduce(function (memo, _ref2) {
|
|
44
|
+
var buildOnInstanceConfiguredExtraParams = _ref2.buildOnInstanceConfiguredExtraParams;
|
|
39
45
|
|
|
40
46
|
if (buildOnInstanceConfiguredExtraParams) {
|
|
41
47
|
(0, _utils.assign)(memo, buildOnInstanceConfiguredExtraParams({
|
|
@@ -48,18 +54,65 @@ var buildAllOnInstanceConfiguredExtraParams = function buildAllOnInstanceConfigu
|
|
|
48
54
|
}, {});
|
|
49
55
|
};
|
|
50
56
|
|
|
51
|
-
var
|
|
52
|
-
var
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
57
|
+
var wrapLoggerInQueue = function wrapLoggerInQueue(logger) {
|
|
58
|
+
var queue = [];
|
|
59
|
+
var queuedLogger = {
|
|
60
|
+
get enabled() {
|
|
61
|
+
return logger.enabled;
|
|
62
|
+
},
|
|
63
|
+
|
|
64
|
+
flush: function flush() {
|
|
65
|
+
queue.forEach(function (_ref3) {
|
|
66
|
+
var method = _ref3.method,
|
|
67
|
+
args = _ref3.args;
|
|
68
|
+
return logger[method].apply(logger, _toConsumableArray(args));
|
|
69
|
+
});
|
|
70
|
+
}
|
|
71
|
+
};
|
|
72
|
+
Object.keys(logger).filter(function (key) {
|
|
73
|
+
return typeof logger[key] === "function";
|
|
74
|
+
}).forEach(function (method) {
|
|
75
|
+
queuedLogger[method] = function () {
|
|
76
|
+
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
77
|
+
args[_key] = arguments[_key];
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
queue.push({
|
|
81
|
+
method: method,
|
|
82
|
+
args: args
|
|
83
|
+
});
|
|
84
|
+
};
|
|
85
|
+
});
|
|
86
|
+
return queuedLogger;
|
|
87
|
+
};
|
|
88
|
+
|
|
89
|
+
var _default = function _default(_ref4) {
|
|
90
|
+
var options = _ref4.options,
|
|
91
|
+
componentCreators = _ref4.componentCreators,
|
|
92
|
+
coreConfigValidators = _ref4.coreConfigValidators,
|
|
93
|
+
createConfig = _ref4.createConfig,
|
|
94
|
+
logger = _ref4.logger,
|
|
95
|
+
setDebugEnabled = _ref4.setDebugEnabled;
|
|
96
|
+
// We wrap the logger in a queue in case debugEnabled is set in the config
|
|
97
|
+
// but we need to log something before the config is created.
|
|
98
|
+
var queuedLogger = wrapLoggerInQueue(logger);
|
|
99
|
+
var combinedConfigValidator = componentCreators.map(function (_ref5) {
|
|
100
|
+
var configValidators = _ref5.configValidators;
|
|
101
|
+
return configValidators;
|
|
102
|
+
}).filter(function (configValidators) {
|
|
103
|
+
return configValidators;
|
|
104
|
+
}).reduce(function (validator, configValidators) {
|
|
105
|
+
return validator.concat(configValidators);
|
|
106
|
+
}, coreConfigValidators);
|
|
107
|
+
var config = createConfig(transformOptions({
|
|
108
|
+
combinedConfigValidator: combinedConfigValidator,
|
|
109
|
+
options: options,
|
|
110
|
+
logger: queuedLogger
|
|
111
|
+
}));
|
|
60
112
|
setDebugEnabled(config.debugEnabled, {
|
|
61
113
|
fromConfig: true
|
|
62
|
-
});
|
|
114
|
+
});
|
|
115
|
+
queuedLogger.flush(); // eslint-disable-next-line no-underscore-dangle
|
|
63
116
|
|
|
64
117
|
var extraParams = buildAllOnInstanceConfiguredExtraParams(config, logger, componentCreators);
|
|
65
118
|
logger.logOnInstanceConfigured(_objectSpread(_objectSpread({}, extraParams), {}, {
|
|
@@ -24,16 +24,16 @@ OF ANY KIND, either express or implied. See the License for the specific languag
|
|
|
24
24
|
governing permissions and limitations under the License.
|
|
25
25
|
*/
|
|
26
26
|
var _default = function _default() {
|
|
27
|
-
return {
|
|
27
|
+
return (0, _validation.objectOf)({
|
|
28
28
|
debugEnabled: (0, _validation.boolean)().default(false),
|
|
29
29
|
defaultConsent: (0, _validation.enumOf)(_consentStatus.IN, _consentStatus.OUT, _consentStatus.PENDING).default(_consentStatus.IN),
|
|
30
|
-
|
|
30
|
+
datastreamId: (0, _validation.string)().unique().required(),
|
|
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
34
|
onBeforeEventSend: (0, _validation.callback)().default(_utils.noop),
|
|
35
35
|
edgeConfigOverrides: _utils.validateConfigOverride
|
|
36
|
-
};
|
|
36
|
+
}).deprecated("edgeConfigId", (0, _validation.string)().unique(), "datastreamId");
|
|
37
37
|
};
|
|
38
38
|
|
|
39
39
|
exports.default = _default;
|
|
@@ -6,6 +6,8 @@ var _pageWideScope = require("../constants/pageWideScope");
|
|
|
6
6
|
|
|
7
7
|
var _utils = require("../utils");
|
|
8
8
|
|
|
9
|
+
var _request = require("../utils/request");
|
|
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");
|
|
@@ -48,6 +50,9 @@ var _default = function _default(_ref) {
|
|
|
48
50
|
* @param {Object} [options.serverState]
|
|
49
51
|
* This will be passed to components
|
|
50
52
|
* so they can take appropriate action.
|
|
53
|
+
* @param {Object} [options.edgeConfigOverrides] Settings that take
|
|
54
|
+
* precedence over the global datastream configuration, including which
|
|
55
|
+
* datastream to use.
|
|
51
56
|
* @returns {*}
|
|
52
57
|
*/
|
|
53
58
|
sendEvent: function sendEvent(event) {
|
|
@@ -57,12 +62,14 @@ var _default = function _default(_ref) {
|
|
|
57
62
|
decisionScopes = options.decisionScopes,
|
|
58
63
|
localConfigOverrides = options.edgeConfigOverrides,
|
|
59
64
|
personalization = options.personalization;
|
|
60
|
-
var
|
|
61
|
-
|
|
65
|
+
var requestParams = (0, _request.createRequestParams)({
|
|
66
|
+
payload: createDataCollectionRequestPayload(),
|
|
67
|
+
localConfigOverrides: localConfigOverrides,
|
|
68
|
+
globalConfigOverrides: globalConfigOverrides
|
|
69
|
+
});
|
|
70
|
+
var request = createDataCollectionRequest(requestParams);
|
|
62
71
|
var onResponseCallbackAggregator = (0, _utils.createCallbackAggregator)();
|
|
63
72
|
var onRequestFailureCallbackAggregator = (0, _utils.createCallbackAggregator)();
|
|
64
|
-
payload.mergeConfigOverride(globalConfigOverrides);
|
|
65
|
-
payload.mergeConfigOverride(localConfigOverrides);
|
|
66
73
|
return lifecycle.onBeforeEvent({
|
|
67
74
|
event: event,
|
|
68
75
|
renderDecisions: renderDecisions,
|
|
@@ -71,7 +78,7 @@ var _default = function _default(_ref) {
|
|
|
71
78
|
onResponse: onResponseCallbackAggregator.add,
|
|
72
79
|
onRequestFailure: onRequestFailureCallbackAggregator.add
|
|
73
80
|
}).then(function () {
|
|
74
|
-
payload.addEvent(event);
|
|
81
|
+
requestParams.payload.addEvent(event);
|
|
75
82
|
return consent.awaitConsent();
|
|
76
83
|
}).then(function () {
|
|
77
84
|
try {
|
|
@@ -118,7 +125,9 @@ var _default = function _default(_ref) {
|
|
|
118
125
|
handle: []
|
|
119
126
|
} : _options$responseBody;
|
|
120
127
|
var payload = createDataCollectionRequestPayload();
|
|
121
|
-
var request = createDataCollectionRequest(
|
|
128
|
+
var request = createDataCollectionRequest({
|
|
129
|
+
payload: payload
|
|
130
|
+
});
|
|
122
131
|
var onResponseCallbackAggregator = (0, _utils.createCallbackAggregator)();
|
|
123
132
|
return lifecycle.onBeforeEvent({
|
|
124
133
|
event: event,
|
|
@@ -34,7 +34,7 @@ var _default = function _default(_ref) {
|
|
|
34
34
|
getAssuranceValidationTokenParams = _ref.getAssuranceValidationTokenParams;
|
|
35
35
|
var edgeDomain = config.edgeDomain,
|
|
36
36
|
edgeBasePath = config.edgeBasePath,
|
|
37
|
-
|
|
37
|
+
datastreamId = config.datastreamId;
|
|
38
38
|
/**
|
|
39
39
|
* Sends a network request that is aware of payload interfaces,
|
|
40
40
|
* lifecycle methods, configured edge domains, response structures, etc.
|
|
@@ -60,7 +60,8 @@ var _default = function _default(_ref) {
|
|
|
60
60
|
var endpointDomain = request.getUseIdThirdPartyDomain() ? _domain.ID_THIRD_PARTY : edgeDomain;
|
|
61
61
|
var locationHint = getLocationHint();
|
|
62
62
|
var edgeBasePathWithLocationHint = locationHint ? edgeBasePath + "/" + locationHint : edgeBasePath;
|
|
63
|
-
var
|
|
63
|
+
var configId = request.getDatastreamIdOverride() || datastreamId;
|
|
64
|
+
var url = "https://" + endpointDomain + "/" + edgeBasePathWithLocationHint + "/" + _apiVersion.default + "/" + request.getAction() + "?configId=" + configId + "&requestId=" + request.getId() + getAssuranceValidationTokenParams();
|
|
64
65
|
cookieTransfer.cookiesToPayload(request.getPayload(), endpointDomain);
|
|
65
66
|
return sendNetworkRequest({
|
|
66
67
|
requestId: request.getId(),
|
|
@@ -15,9 +15,12 @@ the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTA
|
|
|
15
15
|
OF ANY KIND, either express or implied. See the License for the specific language
|
|
16
16
|
governing permissions and limitations under the License.
|
|
17
17
|
*/
|
|
18
|
-
var _default = function _default(
|
|
19
|
-
var
|
|
20
|
-
|
|
18
|
+
var _default = function _default(_ref) {
|
|
19
|
+
var dataCollectionRequestPayload = _ref.payload,
|
|
20
|
+
datastreamIdOverride = _ref.datastreamIdOverride;
|
|
21
|
+
|
|
22
|
+
var getUseSendBeacon = function getUseSendBeacon(_ref2) {
|
|
23
|
+
var isIdentityEstablished = _ref2.isIdentityEstablished;
|
|
21
24
|
// When the document may be unloading, we still hit the interact endpoint
|
|
22
25
|
// using fetch if an identity has not been established. If we were instead
|
|
23
26
|
// to hit the collect endpoint using sendBeacon in this case, one of three
|
|
@@ -57,13 +60,14 @@ var _default = function _default(dataCollectionRequestPayload) {
|
|
|
57
60
|
|
|
58
61
|
return (0, _createRequest.default)({
|
|
59
62
|
payload: dataCollectionRequestPayload,
|
|
60
|
-
getAction: function getAction(
|
|
61
|
-
var isIdentityEstablished =
|
|
63
|
+
getAction: function getAction(_ref3) {
|
|
64
|
+
var isIdentityEstablished = _ref3.isIdentityEstablished;
|
|
62
65
|
return getUseSendBeacon({
|
|
63
66
|
isIdentityEstablished: isIdentityEstablished
|
|
64
67
|
}) ? "collect" : "interact";
|
|
65
68
|
},
|
|
66
|
-
getUseSendBeacon: getUseSendBeacon
|
|
69
|
+
getUseSendBeacon: getUseSendBeacon,
|
|
70
|
+
datastreamIdOverride: datastreamIdOverride
|
|
67
71
|
});
|
|
68
72
|
};
|
|
69
73
|
|
|
@@ -19,7 +19,8 @@ governing permissions and limitations under the License.
|
|
|
19
19
|
var _default = function _default(options) {
|
|
20
20
|
var payload = options.payload,
|
|
21
21
|
_getAction = options.getAction,
|
|
22
|
-
_getUseSendBeacon = options.getUseSendBeacon
|
|
22
|
+
_getUseSendBeacon = options.getUseSendBeacon,
|
|
23
|
+
datastreamIdOverride = options.datastreamIdOverride;
|
|
23
24
|
var id = (0, _.uuid)();
|
|
24
25
|
var shouldUseThirdPartyDomain = false;
|
|
25
26
|
var isIdentityEstablished = false;
|
|
@@ -35,6 +36,9 @@ var _default = function _default(options) {
|
|
|
35
36
|
isIdentityEstablished: isIdentityEstablished
|
|
36
37
|
});
|
|
37
38
|
},
|
|
39
|
+
getDatastreamIdOverride: function getDatastreamIdOverride() {
|
|
40
|
+
return datastreamIdOverride;
|
|
41
|
+
},
|
|
38
42
|
getUseSendBeacon: function getUseSendBeacon() {
|
|
39
43
|
return _getUseSendBeacon({
|
|
40
44
|
isIdentityEstablished: isIdentityEstablished
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
exports.default = void 0;
|
|
4
|
+
var _excluded = ["datastreamId"];
|
|
5
|
+
|
|
6
|
+
function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
|
|
7
|
+
|
|
8
|
+
function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
|
|
9
|
+
|
|
10
|
+
/*
|
|
11
|
+
Copyright 2023 Adobe. All rights reserved.
|
|
12
|
+
This file is licensed to you under the Apache License, Version 2.0 (the "License");
|
|
13
|
+
you may not use this file except in compliance with the License. You may obtain a copy
|
|
14
|
+
of the License at http://www.apache.org/licenses/LICENSE-2.0
|
|
15
|
+
|
|
16
|
+
Unless required by applicable law or agreed to in writing, software distributed under
|
|
17
|
+
the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
|
|
18
|
+
OF ANY KIND, either express or implied. See the License for the specific language
|
|
19
|
+
governing permissions and limitations under the License.
|
|
20
|
+
*/
|
|
21
|
+
|
|
22
|
+
/**
|
|
23
|
+
* @typedef {{ datastreamId: string, [k: string]: Object }} Override
|
|
24
|
+
* @typedef {Object} RequestPayload
|
|
25
|
+
* @property {function(Override): void} mergeConfigOverride
|
|
26
|
+
* @param {Object} params
|
|
27
|
+
* @param {Override} params.localConfigOverrides
|
|
28
|
+
* @param {Override} params.globalConfigOverrides
|
|
29
|
+
* @param {RequestPayload} params.payload
|
|
30
|
+
* @returns {{ payload: RequestPayload, datastreamIdOverride: string }}
|
|
31
|
+
*/
|
|
32
|
+
var _default = function _default(_ref) {
|
|
33
|
+
var localConfigOverrides = _ref.localConfigOverrides,
|
|
34
|
+
globalConfigOverrides = _ref.globalConfigOverrides,
|
|
35
|
+
payload = _ref.payload;
|
|
36
|
+
var requestParams = {
|
|
37
|
+
payload: payload
|
|
38
|
+
};
|
|
39
|
+
|
|
40
|
+
var _ref2 = localConfigOverrides || {},
|
|
41
|
+
datastreamId = _ref2.datastreamId,
|
|
42
|
+
localConfigOverridesWithoutDatastreamId = _objectWithoutProperties(_ref2, _excluded);
|
|
43
|
+
|
|
44
|
+
if (datastreamId) {
|
|
45
|
+
requestParams.datastreamIdOverride = datastreamId;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
payload.mergeConfigOverride(globalConfigOverrides);
|
|
49
|
+
payload.mergeConfigOverride(localConfigOverridesWithoutDatastreamId);
|
|
50
|
+
return requestParams;
|
|
51
|
+
};
|
|
52
|
+
|
|
53
|
+
exports.default = _default;
|
|
@@ -36,6 +36,12 @@ Object.defineProperty(exports, "createRequest", {
|
|
|
36
36
|
return _createRequest.default;
|
|
37
37
|
}
|
|
38
38
|
});
|
|
39
|
+
Object.defineProperty(exports, "createRequestParams", {
|
|
40
|
+
enumerable: true,
|
|
41
|
+
get: function get() {
|
|
42
|
+
return _createRequestParams.default;
|
|
43
|
+
}
|
|
44
|
+
});
|
|
39
45
|
Object.defineProperty(exports, "createRequestPayload", {
|
|
40
46
|
enumerable: true,
|
|
41
47
|
get: function get() {
|
|
@@ -53,6 +59,8 @@ var _createHasIdentity = require("./createHasIdentity");
|
|
|
53
59
|
|
|
54
60
|
var _createRequest = require("./createRequest");
|
|
55
61
|
|
|
62
|
+
var _createRequestParams = require("./createRequestParams");
|
|
63
|
+
|
|
56
64
|
var _createRequestPayload = require("./createRequestPayload");
|
|
57
65
|
|
|
58
66
|
var _createGetAssuranceValidationTokenParams = require("./createGetAssuranceValidationTokenParams");
|
|
@@ -4,7 +4,7 @@ exports.default = void 0;
|
|
|
4
4
|
|
|
5
5
|
var _isBoolean = require("../isBoolean");
|
|
6
6
|
|
|
7
|
-
var
|
|
7
|
+
var _utils = require("./utils");
|
|
8
8
|
|
|
9
9
|
/*
|
|
10
10
|
Copyright 2019 Adobe. All rights reserved.
|
|
@@ -18,7 +18,7 @@ OF ANY KIND, either express or implied. See the License for the specific languag
|
|
|
18
18
|
governing permissions and limitations under the License.
|
|
19
19
|
*/
|
|
20
20
|
var _default = function _default(value, path) {
|
|
21
|
-
(0,
|
|
21
|
+
(0, _utils.assertValid)((0, _isBoolean.default)(value), value, path, "true or false");
|
|
22
22
|
return value;
|
|
23
23
|
};
|
|
24
24
|
|