@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.
- package/libEs5/components/DataCollector/index.js +26 -10
- package/libEs5/components/DataCollector/validateApplyResponse.js +11 -0
- package/libEs5/components/DataCollector/validateUserEventOptions.js +2 -1
- package/libEs5/components/Identity/appendIdentityToUrl/appendIdentityToUrlOptionsValidator.js +4 -1
- package/libEs5/components/Identity/createComponent.js +13 -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/Personalization/constants/loggerMessage.js +12 -0
- package/libEs5/components/Personalization/utils/composePersonalizationResultingObject.js +11 -0
- package/libEs5/components/Personalization/validateApplyPropositionsOptions.js +11 -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 +13 -1
- package/libEs5/constants/apiVersion.js +12 -0
- package/libEs5/constants/edgeBasePath.js +12 -0
- package/libEs5/constants/identityMapAuthenticatedState.js +12 -0
- 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/handleRequestFailure.js +11 -0
- package/libEs5/core/edgeNetwork/injectApplyResponse.js +11 -0
- 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/createRequestPayload.js +6 -0
- package/libEs5/utils/stringToBoolean.js +11 -0
- package/libEs5/utils/validateConfigOverride.js +20 -0
- package/libEs6/components/DataCollector/index.js +25 -10
- package/libEs6/components/DataCollector/validateApplyResponse.js +11 -0
- package/libEs6/components/DataCollector/validateUserEventOptions.js +3 -2
- package/libEs6/components/Identity/appendIdentityToUrl/appendIdentityToUrlOptionsValidator.js +3 -1
- package/libEs6/components/Identity/createComponent.js +13 -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/injectAddQueryStringIdentityToPayload.js +11 -0
- package/libEs6/components/Personalization/constants/loggerMessage.js +11 -0
- package/libEs6/components/Personalization/utils/composePersonalizationResultingObject.js +11 -0
- package/libEs6/components/Personalization/validateApplyPropositionsOptions.js +11 -0
- package/libEs6/components/Privacy/createComponent.js +4 -2
- package/libEs6/components/Privacy/createConsentHashStore.js +11 -0
- package/libEs6/components/Privacy/index.js +2 -1
- package/libEs6/components/Privacy/injectSendSetConsentRequest.js +6 -2
- package/libEs6/components/Privacy/validateSetConsentOptions.js +14 -2
- package/libEs6/constants/apiVersion.js +11 -0
- package/libEs6/constants/edgeBasePath.js +11 -0
- package/libEs6/constants/identityMapAuthenticatedState.js +11 -0
- 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/handleRequestFailure.js +11 -0
- package/libEs6/core/edgeNetwork/injectApplyResponse.js +11 -0
- package/libEs6/core/edgeNetwork/mergeLifecycleResponses.js +11 -0
- 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/createRequestPayload.js +3 -1
- package/libEs6/utils/stringToBoolean.js +11 -0
- package/libEs6/utils/validateConfigOverride.js +13 -0
- package/package.json +6 -3
|
@@ -0,0 +1,59 @@
|
|
|
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;
|
package/libEs6/utils/index.js
CHANGED
|
@@ -26,6 +26,7 @@ export { default as endsWith } from "./endsWith";
|
|
|
26
26
|
export { default as find } from "./find";
|
|
27
27
|
export { default as fireImage } from "./fireImage";
|
|
28
28
|
export { default as injectFireReferrerHideableImage } from "./injectFireReferrerHideableImage";
|
|
29
|
+
export { default as filterObject } from "./filterObject";
|
|
29
30
|
export { default as flatMap } from "./flatMap";
|
|
30
31
|
export { default as getApexDomain } from "./getApexDomain";
|
|
31
32
|
export { default as getLastArrayItems } from "./getLastArrayItems";
|
|
@@ -49,6 +50,7 @@ export { default as isString } from "./isString";
|
|
|
49
50
|
export { default as memoize } from "./memoize";
|
|
50
51
|
export { default as noop } from "./noop";
|
|
51
52
|
export { default as padStart } from "./padStart";
|
|
53
|
+
export { default as prepareConfigOverridesForEdge } from "./prepareConfigOverridesForEdge";
|
|
52
54
|
export { default as queryString } from "./querystring";
|
|
53
55
|
export { default as sanitizeOrgIdForCookieName } from "./sanitizeOrgIdForCookieName";
|
|
54
56
|
export { default as stackError } from "./stackError";
|
|
@@ -61,4 +63,5 @@ export { default as toISOStringLocal } from "./toISOStringLocal";
|
|
|
61
63
|
export { default as uuid } from "./uuid";
|
|
62
64
|
export { default as updateErrorMessage } from "./updateErrorMessage";
|
|
63
65
|
export { default as validateIdentityMap } from "./validateIdentityMap";
|
|
66
|
+
export { default as validateConfigOverride } from "./validateConfigOverride";
|
|
64
67
|
export { default as values } from "./values";
|
|
@@ -0,0 +1,57 @@
|
|
|
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
|
+
});
|
|
@@ -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 { createMerger } from ".."; // This provides the base functionality that all types of
|
|
12
|
+
import { createMerger, prepareConfigOverridesForEdge } from ".."; // This provides the base functionality that all types of
|
|
13
13
|
// request payloads share.
|
|
14
14
|
|
|
15
15
|
export default (options => {
|
|
@@ -18,10 +18,12 @@ export default (options => {
|
|
|
18
18
|
addIdentity,
|
|
19
19
|
hasIdentity
|
|
20
20
|
} = options;
|
|
21
|
+
const mergeConfigOverride = createMerger(content, "meta.configOverrides");
|
|
21
22
|
return {
|
|
22
23
|
mergeMeta: createMerger(content, "meta"),
|
|
23
24
|
mergeState: createMerger(content, "meta.state"),
|
|
24
25
|
mergeQuery: createMerger(content, "query"),
|
|
26
|
+
mergeConfigOverride: updates => mergeConfigOverride(prepareConfigOverridesForEdge(updates)),
|
|
25
27
|
addIdentity,
|
|
26
28
|
hasIdentity,
|
|
27
29
|
|
|
@@ -1,3 +1,14 @@
|
|
|
1
|
+
/*
|
|
2
|
+
Copyright 2023 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
|
+
*/
|
|
1
12
|
import isString from "./isString";
|
|
2
13
|
export default (str => {
|
|
3
14
|
return isString(str) && str.toLowerCase() === "true";
|
|
@@ -0,0 +1,13 @@
|
|
|
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({});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@adobe/alloy",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.16.0-alpha.0",
|
|
4
4
|
"description": "Adobe Experience Platform Web SDK",
|
|
5
5
|
"main": "libEs5/index.js",
|
|
6
6
|
"module": "libEs6/index.js",
|
|
@@ -28,7 +28,8 @@
|
|
|
28
28
|
"build": "npm run format && npm run lint && npm run clean && rollup -c --environment BASE_CODE_MIN,STANDALONE,STANDALONE_MIN && echo \"Base Code:\" && cat distTest/baseCode.min.js",
|
|
29
29
|
"prepare": "husky install && cd sandbox && npm install",
|
|
30
30
|
"prepublishOnly": "rimraf libEs5 libEs6 && babel src -d libEs5 --env-name npmEs5 && babel src -d libEs6 --env-name npmEs6",
|
|
31
|
-
"checkthattestfilesexist": "./scripts/checkThatTestFilesExist.js"
|
|
31
|
+
"checkthattestfilesexist": "./scripts/checkThatTestFilesExist.js",
|
|
32
|
+
"add-license": "./scripts/add-license.js"
|
|
32
33
|
},
|
|
33
34
|
"lint-staged": {
|
|
34
35
|
"./*.js": [
|
|
@@ -64,7 +65,7 @@
|
|
|
64
65
|
"uuid": "^3.3.2"
|
|
65
66
|
},
|
|
66
67
|
"devDependencies": {
|
|
67
|
-
"@adobe/alloy": "^2.15.0
|
|
68
|
+
"@adobe/alloy": "^2.15.0",
|
|
68
69
|
"@babel/cli": "^7.12.8",
|
|
69
70
|
"@babel/core": "^7.2.2",
|
|
70
71
|
"@babel/plugin-proposal-object-rest-spread": "^7.3.2",
|
|
@@ -86,6 +87,7 @@
|
|
|
86
87
|
"eslint-plugin-prettier": "^3.0.1",
|
|
87
88
|
"eslint-plugin-testcafe": "^0.2.1",
|
|
88
89
|
"glob": "^7.1.3",
|
|
90
|
+
"handlebars": "^4.7.7",
|
|
89
91
|
"husky": "^6.0.0",
|
|
90
92
|
"jasmine-core": "^3.4.0",
|
|
91
93
|
"karma": "^6.3.9",
|
|
@@ -117,6 +119,7 @@
|
|
|
117
119
|
"rollup-plugin-node-resolve": "^5.2.0",
|
|
118
120
|
"rollup-plugin-terser": "^7.0.2",
|
|
119
121
|
"semver": "^7.3.7",
|
|
122
|
+
"staged-git-files": "^1.3.0",
|
|
120
123
|
"start-server-and-test": "^1.10.6",
|
|
121
124
|
"testcafe": "^2.3.1",
|
|
122
125
|
"testcafe-browser-provider-saucelabs": "^1.9.0",
|