@adobe/alloy 2.14.0-alpha.9 → 2.14.0-beta.1
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 +10 -26
- package/libEs5/components/DataCollector/validateUserEventOptions.js +1 -2
- package/libEs5/components/Identity/appendIdentityToUrl/appendIdentityToUrlOptionsValidator.js +1 -4
- package/libEs5/components/Identity/createComponent.js +2 -2
- package/libEs5/components/Identity/getIdentity/createGetIdentity.js +3 -11
- package/libEs5/components/Identity/getIdentity/getIdentityOptionsValidator.js +11 -8
- package/libEs5/components/Identity/index.js +4 -8
- 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 +2 -4
- package/libEs5/components/Privacy/index.js +1 -2
- package/libEs5/components/Privacy/injectSendSetConsentRequest.js +2 -6
- package/libEs5/components/Privacy/validateSetConsentOptions.js +1 -2
- package/libEs5/constants/highEntropyUserAgentClientHints.js +1 -1
- package/libEs5/constants/libraryVersion.js +1 -1
- package/libEs5/core/config/createCoreConfigs.js +1 -2
- package/libEs5/core/createEventManager.js +1 -5
- package/libEs5/core/network/requestMethods/injectSendFetchRequest.js +1 -1
- package/libEs5/utils/index.js +0 -24
- package/libEs5/utils/request/createRequestPayload.js +0 -6
- package/libEs5/utils/toInteger.js +14 -2
- 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 +10 -25
- package/libEs6/components/DataCollector/validateUserEventOptions.js +2 -3
- package/libEs6/components/Identity/appendIdentityToUrl/appendIdentityToUrlOptionsValidator.js +1 -3
- package/libEs6/components/Identity/createComponent.js +2 -2
- package/libEs6/components/Identity/getIdentity/createGetIdentity.js +3 -10
- package/libEs6/components/Identity/getIdentity/getIdentityOptionsValidator.js +10 -6
- package/libEs6/components/Identity/index.js +4 -8
- 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 +2 -4
- package/libEs6/components/Privacy/index.js +1 -2
- package/libEs6/components/Privacy/injectSendSetConsentRequest.js +2 -6
- package/libEs6/components/Privacy/validateSetConsentOptions.js +2 -3
- package/libEs6/constants/highEntropyUserAgentClientHints.js +1 -1
- package/libEs6/constants/libraryVersion.js +1 -1
- package/libEs6/core/config/createCoreConfigs.js +2 -3
- package/libEs6/core/createEventManager.js +1 -5
- package/libEs6/core/network/requestMethods/injectSendFetchRequest.js +1 -1
- package/libEs6/utils/index.js +0 -3
- package/libEs6/utils/request/createRequestPayload.js +1 -3
- package/libEs6/utils/toInteger.js +13 -3
- package/package.json +3 -3
- package/libEs5/utils/filterObject.js +0 -57
- package/libEs5/utils/prepareConfigOverridesForEdge.js +0 -61
- package/libEs5/utils/validateConfigOverride.js +0 -20
- package/libEs6/utils/filterObject.js +0 -59
- package/libEs6/utils/prepareConfigOverridesForEdge.js +0 -57
- package/libEs6/utils/validateConfigOverride.js +0 -13
|
@@ -9,12 +9,22 @@ 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
|
-
|
|
12
|
+
import isNumber from "./isNumber";
|
|
13
|
+
import isString from "./isString";
|
|
13
14
|
/*
|
|
14
15
|
* coerce `value` to a number or return `defaultValue` if it cannot be.
|
|
16
|
+
*
|
|
17
|
+
* The coersion is attempted if value is a number or string.
|
|
15
18
|
*/
|
|
19
|
+
|
|
16
20
|
export default ((value, defaultValue) => {
|
|
17
|
-
|
|
21
|
+
if (isNumber(value) || isString(value)) {
|
|
22
|
+
const n = Math.round(Number(value)); // eslint-disable-next-line no-restricted-globals
|
|
23
|
+
|
|
24
|
+
if (!isNaN(n)) {
|
|
25
|
+
return n;
|
|
26
|
+
}
|
|
27
|
+
}
|
|
18
28
|
|
|
19
|
-
return
|
|
29
|
+
return defaultValue;
|
|
20
30
|
});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@adobe/alloy",
|
|
3
|
-
"version": "2.14.0-
|
|
3
|
+
"version": "2.14.0-beta.1",
|
|
4
4
|
"description": "Adobe Experience Platform Web SDK",
|
|
5
5
|
"main": "libEs5/index.js",
|
|
6
6
|
"module": "libEs6/index.js",
|
|
@@ -64,7 +64,7 @@
|
|
|
64
64
|
"uuid": "^3.3.2"
|
|
65
65
|
},
|
|
66
66
|
"devDependencies": {
|
|
67
|
-
"@adobe/alloy": "^2.14.0-
|
|
67
|
+
"@adobe/alloy": "^2.14.0-beta.0",
|
|
68
68
|
"@babel/cli": "^7.12.8",
|
|
69
69
|
"@babel/core": "^7.2.2",
|
|
70
70
|
"@babel/plugin-proposal-object-rest-spread": "^7.3.2",
|
|
@@ -118,7 +118,7 @@
|
|
|
118
118
|
"rollup-plugin-terser": "^7.0.2",
|
|
119
119
|
"semver": "^7.3.7",
|
|
120
120
|
"start-server-and-test": "^1.10.6",
|
|
121
|
-
"testcafe": "^
|
|
121
|
+
"testcafe": "^2.2.0",
|
|
122
122
|
"testcafe-browser-provider-saucelabs": "^1.9.0",
|
|
123
123
|
"testcafe-reporter-junit": "^3.0.2",
|
|
124
124
|
"url-exists-nodejs": "^0.1.0",
|
|
@@ -1,57 +0,0 @@
|
|
|
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;
|
|
@@ -1,61 +0,0 @@
|
|
|
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;
|
|
@@ -1,20 +0,0 @@
|
|
|
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;
|
|
@@ -1,59 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
Copyright 2022 Adobe. All rights reserved.
|
|
3
|
-
This file is licensed to you under the Apache License, Version 2.0 (the "License");
|
|
4
|
-
you may not use this file except in compliance with the License. You may obtain a copy
|
|
5
|
-
of the License at http://www.apache.org/licenses/LICENSE-2.0
|
|
6
|
-
|
|
7
|
-
Unless required by applicable law or agreed to in writing, software distributed under
|
|
8
|
-
the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
|
|
9
|
-
OF ANY KIND, either express or implied. See the License for the specific language
|
|
10
|
-
governing permissions and limitations under the License.
|
|
11
|
-
*/
|
|
12
|
-
import isEmptyObject from "./isEmptyObject";
|
|
13
|
-
import isNil from "./isNil";
|
|
14
|
-
import isObject from "./isObject";
|
|
15
|
-
/**
|
|
16
|
-
* Given an object and a function that takes a value and returns a predicate, filter out
|
|
17
|
-
* all non-object deeply nested values that do not pass the predicate.
|
|
18
|
-
*
|
|
19
|
-
* Example: filterObject({ a: 2, b: { c: 6 } }, (val) => val > 5) returns { b { c: 6 } }
|
|
20
|
-
*
|
|
21
|
-
* @param {*} obj
|
|
22
|
-
* @param {* => boolean} predicate a function that takes a value and return a boolean,
|
|
23
|
-
* representing if it should be included in the result object or not.
|
|
24
|
-
* @returns A copy of the original object with the values that fail the predicate, filtered out.
|
|
25
|
-
*/
|
|
26
|
-
|
|
27
|
-
const filterObject = (obj, predicate) => {
|
|
28
|
-
if (isNil(obj) || !isObject(obj)) {
|
|
29
|
-
return obj;
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
return Object.keys(obj).reduce((result, key) => {
|
|
33
|
-
const value = obj[key];
|
|
34
|
-
|
|
35
|
-
if (isObject(value)) {
|
|
36
|
-
// value is object, go deeper
|
|
37
|
-
const filteredValue = filterObject(value, predicate);
|
|
38
|
-
|
|
39
|
-
if (isEmptyObject(filteredValue)) {
|
|
40
|
-
return result;
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
return { ...result,
|
|
44
|
-
[key]: filteredValue
|
|
45
|
-
};
|
|
46
|
-
} // value is not an object, test predicate
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
if (predicate(value)) {
|
|
50
|
-
return { ...result,
|
|
51
|
-
[key]: value
|
|
52
|
-
};
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
return result;
|
|
56
|
-
}, {});
|
|
57
|
-
};
|
|
58
|
-
|
|
59
|
-
export default filterObject;
|
|
@@ -1,57 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
Copyright 2022 Adobe. All rights reserved.
|
|
3
|
-
This file is licensed to you under the Apache License, Version 2.0 (the "License");
|
|
4
|
-
you may not use this file except in compliance with the License. You may obtain a copy
|
|
5
|
-
of the License at http://www.apache.org/licenses/LICENSE-2.0
|
|
6
|
-
|
|
7
|
-
Unless required by applicable law or agreed to in writing, software distributed under
|
|
8
|
-
the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
|
|
9
|
-
OF ANY KIND, either express or implied. See the License for the specific language
|
|
10
|
-
governing permissions and limitations under the License.
|
|
11
|
-
*/
|
|
12
|
-
import isNil from "./isNil";
|
|
13
|
-
import filterObject from "./filterObject";
|
|
14
|
-
import isEmptyObject from "./isEmptyObject";
|
|
15
|
-
import isNonEmptyArray from "./isNonEmptyArray";
|
|
16
|
-
import isNonEmptyString from "./isNonEmptyString";
|
|
17
|
-
import isNumber from "./isNumber";
|
|
18
|
-
import isBoolean from "./isBoolean"; // We want to avoid mapping between specific keys because we want Konductor
|
|
19
|
-
// to be able to add overrides in the future without us needing to make
|
|
20
|
-
// any changes to the Web SDK
|
|
21
|
-
|
|
22
|
-
export default (configuration => {
|
|
23
|
-
if (isNil(configuration) || typeof configuration !== "object") {
|
|
24
|
-
return null;
|
|
25
|
-
} // remove entries that are empty strings or arrays
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
const configOverrides = filterObject(configuration, value => {
|
|
29
|
-
if (isNil(value)) {
|
|
30
|
-
return false;
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
if (isBoolean(value)) {
|
|
34
|
-
return true;
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
if (isNumber(value)) {
|
|
38
|
-
return true;
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
if (isNonEmptyString(value)) {
|
|
42
|
-
return true;
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
if (isNonEmptyArray(value)) {
|
|
46
|
-
return true;
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
return false;
|
|
50
|
-
});
|
|
51
|
-
|
|
52
|
-
if (isEmptyObject(configOverrides)) {
|
|
53
|
-
return null;
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
return configOverrides;
|
|
57
|
-
});
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
Copyright 2022 Adobe. All rights reserved.
|
|
3
|
-
This file is licensed to you under the Apache License, Version 2.0 (the "License");
|
|
4
|
-
you may not use this file except in compliance with the License. You may obtain a copy
|
|
5
|
-
of the License at http://www.apache.org/licenses/LICENSE-2.0
|
|
6
|
-
|
|
7
|
-
Unless required by applicable law or agreed to in writing, software distributed under
|
|
8
|
-
the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
|
|
9
|
-
OF ANY KIND, either express or implied. See the License for the specific language
|
|
10
|
-
governing permissions and limitations under the License.
|
|
11
|
-
*/
|
|
12
|
-
import { objectOf } from "./validation";
|
|
13
|
-
export default objectOf({});
|