@adobe/alloy 2.14.0-alpha.2 → 2.14.0-alpha.20
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/libEs5/components/Context/injectDevice.js +25 -12
- package/libEs5/components/Context/injectEnvironment.js +10 -3
- package/libEs5/components/Context/injectHighEntropyUserAgentHints.js +26 -15
- package/libEs5/components/Context/injectPlaceContext.js +6 -3
- package/libEs5/components/DataCollector/index.js +26 -10
- package/libEs5/components/DataCollector/validateUserEventOptions.js +2 -1
- package/libEs5/components/Identity/appendIdentityToUrl/appendIdentityToUrlOptionsValidator.js +4 -1
- package/libEs5/components/Identity/createComponent.js +2 -2
- package/libEs5/components/Identity/getIdentity/createGetIdentity.js +11 -3
- package/libEs5/components/Identity/getIdentity/getIdentityOptionsValidator.js +8 -11
- package/libEs5/components/Identity/index.js +8 -4
- package/libEs5/components/Identity/visitorService/injectGetEcidFromVisitor.js +2 -1
- package/libEs5/components/Personalization/dom-actions/executeActions.js +13 -1
- package/libEs5/components/Personalization/dom-actions/remapCustomCodeOffers.js +43 -0
- package/libEs5/components/Privacy/createComponent.js +4 -2
- package/libEs5/components/Privacy/index.js +2 -1
- package/libEs5/components/Privacy/injectSendSetConsentRequest.js +6 -2
- package/libEs5/components/Privacy/validateSetConsentOptions.js +2 -1
- package/libEs5/constants/highEntropyUserAgentClientHints.js +1 -1
- package/libEs5/constants/libraryVersion.js +1 -1
- package/libEs5/core/config/createCoreConfigs.js +2 -1
- package/libEs5/core/createEventManager.js +5 -1
- package/libEs5/core/edgeNetwork/injectSendEdgeNetworkRequest.js +3 -2
- package/libEs5/core/index.js +6 -1
- package/libEs5/core/network/requestMethods/injectSendFetchRequest.js +1 -1
- package/libEs5/utils/filterObject.js +57 -0
- package/libEs5/utils/index.js +24 -0
- package/libEs5/utils/prepareConfigOverridesForEdge.js +61 -0
- package/libEs5/utils/request/createGetAssuranceValidationTokenParams.js +54 -0
- package/libEs5/utils/request/createRequestPayload.js +6 -0
- package/libEs5/utils/request/index.js +9 -1
- package/libEs5/utils/toInteger.js +14 -2
- package/libEs5/utils/validateConfigOverride.js +20 -0
- package/libEs6/components/Context/injectDevice.js +26 -13
- package/libEs6/components/Context/injectEnvironment.js +11 -4
- package/libEs6/components/Context/injectHighEntropyUserAgentHints.js +6 -4
- package/libEs6/components/Context/injectPlaceContext.js +6 -3
- package/libEs6/components/DataCollector/index.js +25 -10
- package/libEs6/components/DataCollector/validateUserEventOptions.js +3 -2
- package/libEs6/components/Identity/appendIdentityToUrl/appendIdentityToUrlOptionsValidator.js +3 -1
- package/libEs6/components/Identity/createComponent.js +2 -2
- package/libEs6/components/Identity/getIdentity/createGetIdentity.js +10 -3
- package/libEs6/components/Identity/getIdentity/getIdentityOptionsValidator.js +6 -10
- package/libEs6/components/Identity/index.js +8 -4
- package/libEs6/components/Identity/visitorService/injectGetEcidFromVisitor.js +2 -1
- package/libEs6/components/Personalization/dom-actions/executeActions.js +7 -1
- package/libEs6/components/Personalization/dom-actions/remapCustomCodeOffers.js +37 -0
- package/libEs6/components/Privacy/createComponent.js +4 -2
- package/libEs6/components/Privacy/index.js +2 -1
- package/libEs6/components/Privacy/injectSendSetConsentRequest.js +6 -2
- package/libEs6/components/Privacy/validateSetConsentOptions.js +3 -2
- package/libEs6/constants/highEntropyUserAgentClientHints.js +1 -1
- package/libEs6/constants/libraryVersion.js +1 -1
- package/libEs6/core/config/createCoreConfigs.js +3 -2
- package/libEs6/core/createEventManager.js +5 -1
- package/libEs6/core/edgeNetwork/injectSendEdgeNetworkRequest.js +3 -2
- package/libEs6/core/index.js +7 -2
- package/libEs6/core/network/requestMethods/injectSendFetchRequest.js +1 -1
- package/libEs6/utils/filterObject.js +59 -0
- package/libEs6/utils/index.js +3 -0
- package/libEs6/utils/prepareConfigOverridesForEdge.js +57 -0
- package/libEs6/utils/request/createGetAssuranceValidationTokenParams.js +47 -0
- package/libEs6/utils/request/createRequestPayload.js +3 -1
- package/libEs6/utils/request/index.js +2 -1
- package/libEs6/utils/toInteger.js +13 -3
- package/libEs6/utils/validateConfigOverride.js +13 -0
- package/package.json +6 -5
|
@@ -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;
|
package/libEs5/utils/index.js
CHANGED
|
@@ -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");
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
exports.default = void 0;
|
|
4
|
+
|
|
5
|
+
var _isNil = require("./isNil");
|
|
6
|
+
|
|
7
|
+
var _filterObject = require("./filterObject");
|
|
8
|
+
|
|
9
|
+
var _isEmptyObject = require("./isEmptyObject");
|
|
10
|
+
|
|
11
|
+
var _isNonEmptyArray = require("./isNonEmptyArray");
|
|
12
|
+
|
|
13
|
+
var _isNonEmptyString = require("./isNonEmptyString");
|
|
14
|
+
|
|
15
|
+
var _isNumber = require("./isNumber");
|
|
16
|
+
|
|
17
|
+
var _isBoolean = require("./isBoolean");
|
|
18
|
+
|
|
19
|
+
function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
|
|
20
|
+
|
|
21
|
+
// We want to avoid mapping between specific keys because we want Konductor
|
|
22
|
+
// to be able to add overrides in the future without us needing to make
|
|
23
|
+
// any changes to the Web SDK
|
|
24
|
+
var _default = function _default(configuration) {
|
|
25
|
+
if ((0, _isNil.default)(configuration) || _typeof(configuration) !== "object") {
|
|
26
|
+
return null;
|
|
27
|
+
} // remove entries that are empty strings or arrays
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
var configOverrides = (0, _filterObject.default)(configuration, function (value) {
|
|
31
|
+
if ((0, _isNil.default)(value)) {
|
|
32
|
+
return false;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
if ((0, _isBoolean.default)(value)) {
|
|
36
|
+
return true;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
if ((0, _isNumber.default)(value)) {
|
|
40
|
+
return true;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
if ((0, _isNonEmptyString.default)(value)) {
|
|
44
|
+
return true;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
if ((0, _isNonEmptyArray.default)(value)) {
|
|
48
|
+
return true;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
return false;
|
|
52
|
+
});
|
|
53
|
+
|
|
54
|
+
if ((0, _isEmptyObject.default)(configOverrides)) {
|
|
55
|
+
return null;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
return configOverrides;
|
|
59
|
+
};
|
|
60
|
+
|
|
61
|
+
exports.default = _default;
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
exports.default = void 0;
|
|
4
|
+
|
|
5
|
+
var _index = require("../index");
|
|
6
|
+
|
|
7
|
+
/*
|
|
8
|
+
Copyright 2022 Adobe. All rights reserved.
|
|
9
|
+
This file is licensed to you under the Apache License, Version 2.0 (the "License");
|
|
10
|
+
you may not use this file except in compliance with the License. You may obtain a copy
|
|
11
|
+
of the License at http://www.apache.org/licenses/LICENSE-2.0
|
|
12
|
+
|
|
13
|
+
Unless required by applicable law or agreed to in writing, software distributed under
|
|
14
|
+
the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
|
|
15
|
+
OF ANY KIND, either express or implied. See the License for the specific language
|
|
16
|
+
governing permissions and limitations under the License.
|
|
17
|
+
*/
|
|
18
|
+
var ASSURANCE_VALIDATION_SESSION_URL_PARAM = "adb_validation_sessionid";
|
|
19
|
+
var ASSURANCE_VALIDATION_NAMESPACE = "validation.";
|
|
20
|
+
var CLIENT_ID = "clientId";
|
|
21
|
+
|
|
22
|
+
var getOrCreateAssuranceClientId = function getOrCreateAssuranceClientId(storage) {
|
|
23
|
+
var clientId = storage.persistent.getItem(CLIENT_ID);
|
|
24
|
+
|
|
25
|
+
if (!clientId) {
|
|
26
|
+
clientId = (0, _index.uuid)();
|
|
27
|
+
storage.persistent.setItem(CLIENT_ID, clientId);
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
return clientId;
|
|
31
|
+
};
|
|
32
|
+
|
|
33
|
+
var _default = function _default(_ref) {
|
|
34
|
+
var window = _ref.window,
|
|
35
|
+
createNamespacedStorage = _ref.createNamespacedStorage;
|
|
36
|
+
var storage = createNamespacedStorage(ASSURANCE_VALIDATION_NAMESPACE);
|
|
37
|
+
return function () {
|
|
38
|
+
var parsedQuery = _index.queryString.parse(window.location.search);
|
|
39
|
+
|
|
40
|
+
var validationSessionId = parsedQuery[ASSURANCE_VALIDATION_SESSION_URL_PARAM];
|
|
41
|
+
|
|
42
|
+
if (!validationSessionId) {
|
|
43
|
+
return "";
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
var clientId = getOrCreateAssuranceClientId(storage);
|
|
47
|
+
var validationToken = validationSessionId + "|" + clientId;
|
|
48
|
+
return "&" + _index.queryString.stringify({
|
|
49
|
+
adobeAepValidationToken: validationToken
|
|
50
|
+
});
|
|
51
|
+
};
|
|
52
|
+
};
|
|
53
|
+
|
|
54
|
+
exports.default = _default;
|
|
@@ -21,10 +21,16 @@ var _default = function _default(options) {
|
|
|
21
21
|
var content = options.content,
|
|
22
22
|
addIdentity = options.addIdentity,
|
|
23
23
|
hasIdentity = options.hasIdentity;
|
|
24
|
+
|
|
25
|
+
var _mergeConfigOverride = (0, _.createMerger)(content, "meta.configOverrides");
|
|
26
|
+
|
|
24
27
|
return {
|
|
25
28
|
mergeMeta: (0, _.createMerger)(content, "meta"),
|
|
26
29
|
mergeState: (0, _.createMerger)(content, "meta.state"),
|
|
27
30
|
mergeQuery: (0, _.createMerger)(content, "query"),
|
|
31
|
+
mergeConfigOverride: function mergeConfigOverride(updates) {
|
|
32
|
+
return _mergeConfigOverride((0, _.prepareConfigOverridesForEdge)(updates));
|
|
33
|
+
},
|
|
28
34
|
addIdentity: addIdentity,
|
|
29
35
|
hasIdentity: hasIdentity,
|
|
30
36
|
toJSON: function toJSON() {
|
|
@@ -18,6 +18,12 @@ Object.defineProperty(exports, "createDataCollectionRequestPayload", {
|
|
|
18
18
|
return _createDataCollectionRequestPayload.default;
|
|
19
19
|
}
|
|
20
20
|
});
|
|
21
|
+
Object.defineProperty(exports, "createGetAssuranceValidationTokenParams", {
|
|
22
|
+
enumerable: true,
|
|
23
|
+
get: function get() {
|
|
24
|
+
return _createGetAssuranceValidationTokenParams.default;
|
|
25
|
+
}
|
|
26
|
+
});
|
|
21
27
|
Object.defineProperty(exports, "createHasIdentity", {
|
|
22
28
|
enumerable: true,
|
|
23
29
|
get: function get() {
|
|
@@ -47,4 +53,6 @@ var _createHasIdentity = require("./createHasIdentity");
|
|
|
47
53
|
|
|
48
54
|
var _createRequest = require("./createRequest");
|
|
49
55
|
|
|
50
|
-
var _createRequestPayload = require("./createRequestPayload");
|
|
56
|
+
var _createRequestPayload = require("./createRequestPayload");
|
|
57
|
+
|
|
58
|
+
var _createGetAssuranceValidationTokenParams = require("./createGetAssuranceValidationTokenParams");
|
|
@@ -2,6 +2,10 @@
|
|
|
2
2
|
|
|
3
3
|
exports.default = void 0;
|
|
4
4
|
|
|
5
|
+
var _isNumber = require("./isNumber");
|
|
6
|
+
|
|
7
|
+
var _isString = require("./isString");
|
|
8
|
+
|
|
5
9
|
/*
|
|
6
10
|
Copyright 2022 Adobe. All rights reserved.
|
|
7
11
|
This file is licensed to you under the Apache License, Version 2.0 (the "License");
|
|
@@ -16,11 +20,19 @@ governing permissions and limitations under the License.
|
|
|
16
20
|
|
|
17
21
|
/*
|
|
18
22
|
* coerce `value` to a number or return `defaultValue` if it cannot be.
|
|
23
|
+
*
|
|
24
|
+
* The coersion is attempted if value is a number or string.
|
|
19
25
|
*/
|
|
20
26
|
var _default = function _default(value, defaultValue) {
|
|
21
|
-
|
|
27
|
+
if ((0, _isNumber.default)(value) || (0, _isString.default)(value)) {
|
|
28
|
+
var n = Math.round(Number(value)); // eslint-disable-next-line no-restricted-globals
|
|
29
|
+
|
|
30
|
+
if (!isNaN(n)) {
|
|
31
|
+
return n;
|
|
32
|
+
}
|
|
33
|
+
}
|
|
22
34
|
|
|
23
|
-
return
|
|
35
|
+
return defaultValue;
|
|
24
36
|
};
|
|
25
37
|
|
|
26
38
|
exports.default = _default;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
exports.default = void 0;
|
|
4
|
+
|
|
5
|
+
var _validation = require("./validation");
|
|
6
|
+
|
|
7
|
+
/*
|
|
8
|
+
Copyright 2022 Adobe. All rights reserved.
|
|
9
|
+
This file is licensed to you under the Apache License, Version 2.0 (the "License");
|
|
10
|
+
you may not use this file except in compliance with the License. You may obtain a copy
|
|
11
|
+
of the License at http://www.apache.org/licenses/LICENSE-2.0
|
|
12
|
+
|
|
13
|
+
Unless required by applicable law or agreed to in writing, software distributed under
|
|
14
|
+
the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
|
|
15
|
+
OF ANY KIND, either express or implied. See the License for the specific language
|
|
16
|
+
governing permissions and limitations under the License.
|
|
17
|
+
*/
|
|
18
|
+
var _default = (0, _validation.objectOf)({});
|
|
19
|
+
|
|
20
|
+
exports.default = _default;
|
|
@@ -9,7 +9,7 @@ the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTA
|
|
|
9
9
|
OF ANY KIND, either express or implied. See the License for the specific language
|
|
10
10
|
governing permissions and limitations under the License.
|
|
11
11
|
*/
|
|
12
|
-
import { deepAssign } from "../../utils";
|
|
12
|
+
import { deepAssign, isFunction, toInteger } from "../../utils";
|
|
13
13
|
|
|
14
14
|
const getScreenOrientationViaProperty = window => {
|
|
15
15
|
const {
|
|
@@ -36,12 +36,14 @@ const getScreenOrientationViaProperty = window => {
|
|
|
36
36
|
};
|
|
37
37
|
|
|
38
38
|
const getScreenOrientationViaMediaQuery = window => {
|
|
39
|
-
if (window.matchMedia
|
|
40
|
-
|
|
41
|
-
|
|
39
|
+
if (isFunction(window.matchMedia)) {
|
|
40
|
+
if (window.matchMedia("(orientation: portrait)").matches) {
|
|
41
|
+
return "portrait";
|
|
42
|
+
}
|
|
42
43
|
|
|
43
|
-
|
|
44
|
-
|
|
44
|
+
if (window.matchMedia("(orientation: landscape)").matches) {
|
|
45
|
+
return "landscape";
|
|
46
|
+
}
|
|
45
47
|
}
|
|
46
48
|
|
|
47
49
|
return null;
|
|
@@ -55,18 +57,29 @@ export default (window => {
|
|
|
55
57
|
height
|
|
56
58
|
}
|
|
57
59
|
} = window;
|
|
58
|
-
const device = {
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
60
|
+
const device = {};
|
|
61
|
+
const screenHeight = toInteger(height);
|
|
62
|
+
|
|
63
|
+
if (screenHeight >= 0) {
|
|
64
|
+
device.screenHeight = screenHeight;
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
const screenWidth = toInteger(width);
|
|
68
|
+
|
|
69
|
+
if (screenWidth >= 0) {
|
|
70
|
+
device.screenWidth = screenWidth;
|
|
71
|
+
}
|
|
72
|
+
|
|
62
73
|
const orientation = getScreenOrientationViaProperty(window) || getScreenOrientationViaMediaQuery(window);
|
|
63
74
|
|
|
64
75
|
if (orientation) {
|
|
65
76
|
device.screenOrientation = orientation;
|
|
66
77
|
}
|
|
67
78
|
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
79
|
+
if (Object.keys(device).length > 0) {
|
|
80
|
+
deepAssign(xdm, {
|
|
81
|
+
device
|
|
82
|
+
});
|
|
83
|
+
}
|
|
71
84
|
};
|
|
72
85
|
});
|
|
@@ -9,7 +9,7 @@ the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTA
|
|
|
9
9
|
OF ANY KIND, either express or implied. See the License for the specific language
|
|
10
10
|
governing permissions and limitations under the License.
|
|
11
11
|
*/
|
|
12
|
-
import { deepAssign,
|
|
12
|
+
import { deepAssign, toInteger } from "../../utils";
|
|
13
13
|
export default (window => {
|
|
14
14
|
return xdm => {
|
|
15
15
|
const {
|
|
@@ -23,14 +23,21 @@ export default (window => {
|
|
|
23
23
|
const environment = {
|
|
24
24
|
type: "browser"
|
|
25
25
|
};
|
|
26
|
+
const viewportWidth = toInteger(clientWidth);
|
|
26
27
|
|
|
27
|
-
if (
|
|
28
|
+
if (viewportWidth >= 0) {
|
|
28
29
|
environment.browserDetails = {
|
|
29
|
-
viewportWidth
|
|
30
|
-
viewportHeight: Math.round(clientHeight)
|
|
30
|
+
viewportWidth
|
|
31
31
|
};
|
|
32
32
|
}
|
|
33
33
|
|
|
34
|
+
const viewportHeight = toInteger(clientHeight);
|
|
35
|
+
|
|
36
|
+
if (viewportHeight >= 0) {
|
|
37
|
+
environment.browserDetails = environment.browserDetails || {};
|
|
38
|
+
environment.browserDetails.viewportHeight = viewportHeight;
|
|
39
|
+
}
|
|
40
|
+
|
|
34
41
|
deepAssign(xdm, {
|
|
35
42
|
environment
|
|
36
43
|
});
|
|
@@ -23,11 +23,13 @@ export default (navigator => {
|
|
|
23
23
|
|
|
24
24
|
return (xdm, logger) => {
|
|
25
25
|
try {
|
|
26
|
-
return navigator.userAgentData.getHighEntropyValues(highEntropyUserAgentHints).then(hints => {
|
|
26
|
+
return navigator.userAgentData.getHighEntropyValues(highEntropyUserAgentHints.map(hint => hint[0])).then(hints => {
|
|
27
27
|
const userAgentClientHints = {};
|
|
28
|
-
highEntropyUserAgentHints.forEach(
|
|
29
|
-
if (Object.prototype.hasOwnProperty.call(hints,
|
|
30
|
-
|
|
28
|
+
highEntropyUserAgentHints.forEach(([hintName, hintType]) => {
|
|
29
|
+
if (Object.prototype.hasOwnProperty.call(hints, hintName) &&
|
|
30
|
+
/* eslint-disable-next-line valid-typeof */
|
|
31
|
+
typeof hints[hintName] === hintType) {
|
|
32
|
+
userAgentClientHints[hintName] = hints[hintName];
|
|
31
33
|
}
|
|
32
34
|
});
|
|
33
35
|
deepAssign(xdm, {
|
|
@@ -13,13 +13,16 @@ import { deepAssign, toISOStringLocal, toInteger } from "../../utils";
|
|
|
13
13
|
export default (dateProvider => {
|
|
14
14
|
return xdm => {
|
|
15
15
|
const date = dateProvider();
|
|
16
|
-
const placeContext = {
|
|
17
|
-
localTime: toISOStringLocal(date)
|
|
18
|
-
};
|
|
16
|
+
const placeContext = {};
|
|
19
17
|
const localTimezoneOffset = toInteger(date.getTimezoneOffset());
|
|
20
18
|
|
|
21
19
|
if (localTimezoneOffset !== undefined) {
|
|
22
20
|
placeContext.localTimezoneOffset = localTimezoneOffset;
|
|
21
|
+
} // make sure the timezone offset only uses two digits
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
if (localTimezoneOffset === undefined || Math.abs(localTimezoneOffset) < 6000) {
|
|
25
|
+
placeContext.localTime = toISOStringLocal(date);
|
|
23
26
|
}
|
|
24
27
|
|
|
25
28
|
deepAssign(xdm, {
|
|
@@ -11,9 +11,11 @@ governing permissions and limitations under the License.
|
|
|
11
11
|
*/
|
|
12
12
|
import validateUserEventOptions from "./validateUserEventOptions";
|
|
13
13
|
import validateApplyResponse from "./validateApplyResponse";
|
|
14
|
+
import { deepAssign } from "../../utils";
|
|
14
15
|
|
|
15
16
|
const createDataCollector = ({
|
|
16
|
-
eventManager
|
|
17
|
+
eventManager,
|
|
18
|
+
logger
|
|
17
19
|
}) => {
|
|
18
20
|
return {
|
|
19
21
|
commands: {
|
|
@@ -35,7 +37,8 @@ const createDataCollector = ({
|
|
|
35
37
|
decisionScopes = [],
|
|
36
38
|
// Note: this option will soon be deprecated, please use personalization.decisionScopes instead
|
|
37
39
|
personalization = {},
|
|
38
|
-
datasetId
|
|
40
|
+
datasetId,
|
|
41
|
+
edgeConfigOverrides
|
|
39
42
|
} = options;
|
|
40
43
|
const event = eventManager.createEvent();
|
|
41
44
|
|
|
@@ -58,19 +61,31 @@ const createDataCollector = ({
|
|
|
58
61
|
});
|
|
59
62
|
}
|
|
60
63
|
|
|
64
|
+
const sendEventOptions = {
|
|
65
|
+
renderDecisions,
|
|
66
|
+
decisionScopes,
|
|
67
|
+
personalization
|
|
68
|
+
};
|
|
69
|
+
|
|
70
|
+
if (edgeConfigOverrides) {
|
|
71
|
+
sendEventOptions.edgeConfigOverrides = edgeConfigOverrides;
|
|
72
|
+
}
|
|
73
|
+
|
|
61
74
|
if (datasetId) {
|
|
62
|
-
event.
|
|
63
|
-
|
|
64
|
-
|
|
75
|
+
logger.warn("The 'datasetId' option has been deprecated. Please use 'edgeConfigOverrides.experience_platform.datasets.event' instead.");
|
|
76
|
+
sendEventOptions.edgeConfigOverrides = edgeConfigOverrides || {};
|
|
77
|
+
deepAssign(sendEventOptions.edgeConfigOverrides, {
|
|
78
|
+
com_adobe_experience_platform: {
|
|
79
|
+
datasets: {
|
|
80
|
+
event: {
|
|
81
|
+
datasetId
|
|
82
|
+
}
|
|
83
|
+
}
|
|
65
84
|
}
|
|
66
85
|
});
|
|
67
86
|
}
|
|
68
87
|
|
|
69
|
-
return eventManager.sendEvent(event,
|
|
70
|
-
renderDecisions,
|
|
71
|
-
decisionScopes,
|
|
72
|
-
personalization
|
|
73
|
-
});
|
|
88
|
+
return eventManager.sendEvent(event, sendEventOptions);
|
|
74
89
|
}
|
|
75
90
|
},
|
|
76
91
|
applyResponse: {
|
|
@@ -10,7 +10,7 @@ OF ANY KIND, either express or implied. See the License for the specific languag
|
|
|
10
10
|
governing permissions and limitations under the License.
|
|
11
11
|
*/
|
|
12
12
|
import { string, objectOf, boolean, arrayOf } from "../../utils/validation";
|
|
13
|
-
import { validateIdentityMap } from "../../utils";
|
|
13
|
+
import { validateConfigOverride, validateIdentityMap } from "../../utils";
|
|
14
14
|
/**
|
|
15
15
|
* Verifies user provided event options.
|
|
16
16
|
* @param {*} options The user event options to validate
|
|
@@ -35,7 +35,8 @@ export default (({
|
|
|
35
35
|
surfaces: arrayOf(string()).uniqueItems()
|
|
36
36
|
}),
|
|
37
37
|
datasetId: string(),
|
|
38
|
-
mergeId: string()
|
|
38
|
+
mergeId: string(),
|
|
39
|
+
edgeConfigOverrides: validateConfigOverride
|
|
39
40
|
}).required().noUnknownFields();
|
|
40
41
|
return eventOptionsValidator(options);
|
|
41
42
|
});
|
package/libEs6/components/Identity/appendIdentityToUrl/appendIdentityToUrlOptionsValidator.js
CHANGED
|
@@ -9,6 +9,7 @@ the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTA
|
|
|
9
9
|
OF ANY KIND, either express or implied. See the License for the specific language
|
|
10
10
|
governing permissions and limitations under the License.
|
|
11
11
|
*/
|
|
12
|
+
import { validateConfigOverride } from "../../../utils";
|
|
12
13
|
import { objectOf, string } from "../../../utils/validation";
|
|
13
14
|
/**
|
|
14
15
|
* Verifies user provided event options.
|
|
@@ -17,5 +18,6 @@ import { objectOf, string } from "../../../utils/validation";
|
|
|
17
18
|
*/
|
|
18
19
|
|
|
19
20
|
export default objectOf({
|
|
20
|
-
url: string().required().nonEmpty()
|
|
21
|
+
url: string().required().nonEmpty(),
|
|
22
|
+
edgeConfigOverrides: validateConfigOverride
|
|
21
23
|
}).required().noUnknownFields();
|
|
@@ -57,7 +57,7 @@ export default (({
|
|
|
57
57
|
optionsValidator: getIdentityOptionsValidator,
|
|
58
58
|
run: options => {
|
|
59
59
|
return consent.awaitConsent().then(() => {
|
|
60
|
-
return ecid ? undefined : getIdentity(options
|
|
60
|
+
return ecid ? undefined : getIdentity(options);
|
|
61
61
|
}).then(() => {
|
|
62
62
|
return {
|
|
63
63
|
identity: {
|
|
@@ -72,7 +72,7 @@ export default (({
|
|
|
72
72
|
optionsValidator: appendIdentityToUrlOptionsValidator,
|
|
73
73
|
run: options => {
|
|
74
74
|
return consent.withConsent().then(() => {
|
|
75
|
-
return ecid ? undefined : getIdentity(options
|
|
75
|
+
return ecid ? undefined : getIdentity(options);
|
|
76
76
|
}).then(() => {
|
|
77
77
|
return {
|
|
78
78
|
url: appendIdentityToUrl(ecid, options.url)
|
|
@@ -12,11 +12,18 @@ governing permissions and limitations under the License.
|
|
|
12
12
|
export default (({
|
|
13
13
|
sendEdgeNetworkRequest,
|
|
14
14
|
createIdentityRequestPayload,
|
|
15
|
-
createIdentityRequest
|
|
15
|
+
createIdentityRequest,
|
|
16
|
+
globalConfigOverrides
|
|
16
17
|
}) => {
|
|
17
|
-
return
|
|
18
|
+
return ({
|
|
19
|
+
namespaces,
|
|
20
|
+
edgeConfigOverrides: localConfigOverrides
|
|
21
|
+
} = {}) => {
|
|
18
22
|
const payload = createIdentityRequestPayload(namespaces);
|
|
19
|
-
const request = createIdentityRequest(payload);
|
|
23
|
+
const request = createIdentityRequest(payload); // merge the configurations, but give preference to the command-local configs
|
|
24
|
+
|
|
25
|
+
payload.mergeConfigOverride(globalConfigOverrides);
|
|
26
|
+
payload.mergeConfigOverride(localConfigOverrides);
|
|
20
27
|
return sendEdgeNetworkRequest({
|
|
21
28
|
request
|
|
22
29
|
});
|
|
@@ -9,6 +9,7 @@ the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTA
|
|
|
9
9
|
OF ANY KIND, either express or implied. See the License for the specific language
|
|
10
10
|
governing permissions and limitations under the License.
|
|
11
11
|
*/
|
|
12
|
+
import { validateConfigOverride } from "../../../utils";
|
|
12
13
|
import { objectOf, literal, arrayOf } from "../../../utils/validation";
|
|
13
14
|
/**
|
|
14
15
|
* Verifies user provided event options.
|
|
@@ -16,14 +17,9 @@ import { objectOf, literal, arrayOf } from "../../../utils/validation";
|
|
|
16
17
|
* @returns {*} Validated options
|
|
17
18
|
*/
|
|
18
19
|
|
|
19
|
-
export default (
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
// To-Do: Accept namespace from given options
|
|
25
|
-
|
|
26
|
-
return {
|
|
27
|
-
namespaces: ["ECID"]
|
|
28
|
-
};
|
|
20
|
+
export default objectOf({
|
|
21
|
+
namespaces: arrayOf(literal("ECID")).nonEmpty().uniqueItems().default(["ECID"]),
|
|
22
|
+
edgeConfigOverrides: validateConfigOverride
|
|
23
|
+
}).noUnknownFields().default({
|
|
24
|
+
namespaces: ["ECID"]
|
|
29
25
|
});
|