@adobe/alloy 2.14.0-alpha.8 → 2.14.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/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
|
@@ -21,16 +21,10 @@ 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
|
-
|
|
27
24
|
return {
|
|
28
25
|
mergeMeta: (0, _.createMerger)(content, "meta"),
|
|
29
26
|
mergeState: (0, _.createMerger)(content, "meta.state"),
|
|
30
27
|
mergeQuery: (0, _.createMerger)(content, "query"),
|
|
31
|
-
mergeConfigOverride: function mergeConfigOverride(updates) {
|
|
32
|
-
return _mergeConfigOverride((0, _.prepareConfigOverridesForEdge)(updates));
|
|
33
|
-
},
|
|
34
28
|
addIdentity: addIdentity,
|
|
35
29
|
hasIdentity: hasIdentity,
|
|
36
30
|
toJSON: function toJSON() {
|
|
@@ -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;
|
|
@@ -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,11 +11,9 @@ 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";
|
|
15
14
|
|
|
16
15
|
const createDataCollector = ({
|
|
17
|
-
eventManager
|
|
18
|
-
logger
|
|
16
|
+
eventManager
|
|
19
17
|
}) => {
|
|
20
18
|
return {
|
|
21
19
|
commands: {
|
|
@@ -37,8 +35,7 @@ const createDataCollector = ({
|
|
|
37
35
|
decisionScopes = [],
|
|
38
36
|
// Note: this option will soon be deprecated, please use personalization.decisionScopes instead
|
|
39
37
|
personalization = {},
|
|
40
|
-
datasetId
|
|
41
|
-
edgeConfigOverrides
|
|
38
|
+
datasetId
|
|
42
39
|
} = options;
|
|
43
40
|
const event = eventManager.createEvent();
|
|
44
41
|
|
|
@@ -61,31 +58,19 @@ const createDataCollector = ({
|
|
|
61
58
|
});
|
|
62
59
|
}
|
|
63
60
|
|
|
64
|
-
const sendEventOptions = {
|
|
65
|
-
renderDecisions,
|
|
66
|
-
decisionScopes,
|
|
67
|
-
personalization
|
|
68
|
-
};
|
|
69
|
-
|
|
70
|
-
if (edgeConfigOverrides) {
|
|
71
|
-
sendEventOptions.edgeConfigOverrides = edgeConfigOverrides;
|
|
72
|
-
}
|
|
73
|
-
|
|
74
61
|
if (datasetId) {
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
com_adobe_experience_platform: {
|
|
79
|
-
datasets: {
|
|
80
|
-
event: {
|
|
81
|
-
datasetId
|
|
82
|
-
}
|
|
83
|
-
}
|
|
62
|
+
event.mergeMeta({
|
|
63
|
+
collect: {
|
|
64
|
+
datasetId
|
|
84
65
|
}
|
|
85
66
|
});
|
|
86
67
|
}
|
|
87
68
|
|
|
88
|
-
return eventManager.sendEvent(event,
|
|
69
|
+
return eventManager.sendEvent(event, {
|
|
70
|
+
renderDecisions,
|
|
71
|
+
decisionScopes,
|
|
72
|
+
personalization
|
|
73
|
+
});
|
|
89
74
|
}
|
|
90
75
|
},
|
|
91
76
|
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 {
|
|
13
|
+
import { validateIdentityMap } from "../../utils";
|
|
14
14
|
/**
|
|
15
15
|
* Verifies user provided event options.
|
|
16
16
|
* @param {*} options The user event options to validate
|
|
@@ -35,8 +35,7 @@ export default (({
|
|
|
35
35
|
surfaces: arrayOf(string()).uniqueItems()
|
|
36
36
|
}),
|
|
37
37
|
datasetId: string(),
|
|
38
|
-
mergeId: string()
|
|
39
|
-
edgeConfigOverrides: validateConfigOverride
|
|
38
|
+
mergeId: string()
|
|
40
39
|
}).required().noUnknownFields();
|
|
41
40
|
return eventOptionsValidator(options);
|
|
42
41
|
});
|
package/libEs6/components/Identity/appendIdentityToUrl/appendIdentityToUrlOptionsValidator.js
CHANGED
|
@@ -9,7 +9,6 @@ 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";
|
|
13
12
|
import { objectOf, string } from "../../../utils/validation";
|
|
14
13
|
/**
|
|
15
14
|
* Verifies user provided event options.
|
|
@@ -18,6 +17,5 @@ import { objectOf, string } from "../../../utils/validation";
|
|
|
18
17
|
*/
|
|
19
18
|
|
|
20
19
|
export default objectOf({
|
|
21
|
-
url: string().required().nonEmpty()
|
|
22
|
-
edgeConfigOverrides: validateConfigOverride
|
|
20
|
+
url: string().required().nonEmpty()
|
|
23
21
|
}).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.namespaces);
|
|
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.namespaces);
|
|
76
76
|
}).then(() => {
|
|
77
77
|
return {
|
|
78
78
|
url: appendIdentityToUrl(ecid, options.url)
|
|
@@ -12,18 +12,11 @@ governing permissions and limitations under the License.
|
|
|
12
12
|
export default (({
|
|
13
13
|
sendEdgeNetworkRequest,
|
|
14
14
|
createIdentityRequestPayload,
|
|
15
|
-
createIdentityRequest
|
|
16
|
-
globalConfigOverrides
|
|
15
|
+
createIdentityRequest
|
|
17
16
|
}) => {
|
|
18
|
-
return
|
|
19
|
-
namespaces,
|
|
20
|
-
edgeConfigOverrides: localConfigOverrides
|
|
21
|
-
} = {}) => {
|
|
17
|
+
return namespaces => {
|
|
22
18
|
const payload = createIdentityRequestPayload(namespaces);
|
|
23
|
-
const request = createIdentityRequest(payload);
|
|
24
|
-
|
|
25
|
-
payload.mergeConfigOverride(globalConfigOverrides);
|
|
26
|
-
payload.mergeConfigOverride(localConfigOverrides);
|
|
19
|
+
const request = createIdentityRequest(payload);
|
|
27
20
|
return sendEdgeNetworkRequest({
|
|
28
21
|
request
|
|
29
22
|
});
|
|
@@ -9,7 +9,6 @@ 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";
|
|
13
12
|
import { objectOf, literal, arrayOf } from "../../../utils/validation";
|
|
14
13
|
/**
|
|
15
14
|
* Verifies user provided event options.
|
|
@@ -17,9 +16,14 @@ import { objectOf, literal, arrayOf } from "../../../utils/validation";
|
|
|
17
16
|
* @returns {*} Validated options
|
|
18
17
|
*/
|
|
19
18
|
|
|
20
|
-
export default
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
}).noUnknownFields()
|
|
24
|
-
|
|
19
|
+
export default (options => {
|
|
20
|
+
const getIdentityOptionsValidator = objectOf({
|
|
21
|
+
namespaces: arrayOf(literal("ECID")).nonEmpty().uniqueItems()
|
|
22
|
+
}).noUnknownFields();
|
|
23
|
+
getIdentityOptionsValidator(options); // Return default options for now
|
|
24
|
+
// To-Do: Accept namespace from given options
|
|
25
|
+
|
|
26
|
+
return {
|
|
27
|
+
namespaces: ["ECID"]
|
|
28
|
+
};
|
|
25
29
|
});
|
|
@@ -40,8 +40,7 @@ const createIdentity = ({
|
|
|
40
40
|
}) => {
|
|
41
41
|
const {
|
|
42
42
|
orgId,
|
|
43
|
-
thirdPartyCookiesEnabled
|
|
44
|
-
edgeConfigOverrides: globalConfigOverrides
|
|
43
|
+
thirdPartyCookiesEnabled
|
|
45
44
|
} = config;
|
|
46
45
|
const getEcidFromVisitor = injectGetEcidFromVisitor({
|
|
47
46
|
logger,
|
|
@@ -65,8 +64,7 @@ const createIdentity = ({
|
|
|
65
64
|
const getIdentity = createGetIdentity({
|
|
66
65
|
sendEdgeNetworkRequest,
|
|
67
66
|
createIdentityRequestPayload,
|
|
68
|
-
createIdentityRequest
|
|
69
|
-
globalConfigOverrides
|
|
67
|
+
createIdentityRequest
|
|
70
68
|
});
|
|
71
69
|
const setDomainForInitialIdentityPayload = injectSetDomainForInitialIdentityPayload({
|
|
72
70
|
thirdPartyCookiesEnabled,
|
|
@@ -102,8 +100,7 @@ const createIdentity = ({
|
|
|
102
100
|
});
|
|
103
101
|
const appendIdentityToUrl = injectAppendIdentityToUrl({
|
|
104
102
|
dateProvider: () => new Date(),
|
|
105
|
-
orgId
|
|
106
|
-
globalConfigOverrides
|
|
103
|
+
orgId
|
|
107
104
|
});
|
|
108
105
|
return createComponent({
|
|
109
106
|
addEcidQueryToPayload,
|
|
@@ -115,8 +112,7 @@ const createIdentity = ({
|
|
|
115
112
|
getIdentity,
|
|
116
113
|
consent,
|
|
117
114
|
appendIdentityToUrl,
|
|
118
|
-
logger
|
|
119
|
-
config
|
|
115
|
+
logger
|
|
120
116
|
});
|
|
121
117
|
};
|
|
122
118
|
|
|
@@ -15,8 +15,9 @@ export default (({
|
|
|
15
15
|
orgId,
|
|
16
16
|
awaitVisitorOptIn
|
|
17
17
|
}) => {
|
|
18
|
-
const Visitor = getVisitor(window);
|
|
19
18
|
return () => {
|
|
19
|
+
const Visitor = getVisitor(window);
|
|
20
|
+
|
|
20
21
|
if (Visitor) {
|
|
21
22
|
// Need to explicitly wait for optIn because visitor will call callback
|
|
22
23
|
// with invalid values prior to optIn being approved
|
|
@@ -9,7 +9,9 @@ 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
|
|
12
|
+
import remapHeadOffers from "./remapHeadOffers";
|
|
13
|
+
import { assign } from "../../../utils";
|
|
14
|
+
import remapCustomCodeOffers from "./remapCustomCodeOffers";
|
|
13
15
|
|
|
14
16
|
const logActionError = (logger, action, error) => {
|
|
15
17
|
if (logger.enabled) {
|
|
@@ -42,6 +44,10 @@ const executeAction = (logger, modules, type, args) => {
|
|
|
42
44
|
return execute(...args);
|
|
43
45
|
};
|
|
44
46
|
|
|
47
|
+
const PREPROCESSORS = [remapHeadOffers, remapCustomCodeOffers];
|
|
48
|
+
|
|
49
|
+
const preprocess = action => PREPROCESSORS.reduce((processed, fn) => assign(processed, fn(processed)), action);
|
|
50
|
+
|
|
45
51
|
export default ((actions, modules, logger) => {
|
|
46
52
|
const actionPromises = actions.map(action => {
|
|
47
53
|
const processedAction = preprocess(action);
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
/*
|
|
2
|
+
Copyright 2021 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
|
+
|
|
13
|
+
/*
|
|
14
|
+
* Preprocess customCode actions before rendering, so that offer selectors are remapped appropriately for
|
|
15
|
+
* target offers, to align with the way it works in at.js.
|
|
16
|
+
*/
|
|
17
|
+
import { assign } from "../../../utils";
|
|
18
|
+
const ACTION_CUSTOM_CODE = "customCode";
|
|
19
|
+
const TARGET_BODY_SELECTOR = "BODY > *:eq(0)";
|
|
20
|
+
export default (action => {
|
|
21
|
+
const {
|
|
22
|
+
selector,
|
|
23
|
+
type
|
|
24
|
+
} = action;
|
|
25
|
+
|
|
26
|
+
if (type !== ACTION_CUSTOM_CODE) {
|
|
27
|
+
return action;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
if (selector !== TARGET_BODY_SELECTOR) {
|
|
31
|
+
return action;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
return assign({}, action, {
|
|
35
|
+
selector: "BODY"
|
|
36
|
+
});
|
|
37
|
+
});
|
|
@@ -57,8 +57,7 @@ export default (({
|
|
|
57
57
|
optionsValidator: validateSetConsentOptions,
|
|
58
58
|
run: ({
|
|
59
59
|
consent: consentOptions,
|
|
60
|
-
identityMap
|
|
61
|
-
edgeConfigOverrides
|
|
60
|
+
identityMap
|
|
62
61
|
}) => {
|
|
63
62
|
consent.suspend();
|
|
64
63
|
const consentHashes = consentHashStore.lookup(consentOptions);
|
|
@@ -66,8 +65,7 @@ export default (({
|
|
|
66
65
|
if (consentHashes.isNew()) {
|
|
67
66
|
return sendSetConsentRequest({
|
|
68
67
|
consentOptions,
|
|
69
|
-
identityMap
|
|
70
|
-
edgeConfigOverrides
|
|
68
|
+
identityMap
|
|
71
69
|
});
|
|
72
70
|
}
|
|
73
71
|
|
|
@@ -38,8 +38,7 @@ const createPrivacy = ({
|
|
|
38
38
|
const sendSetConsentRequest = injectSendSetConsentRequest({
|
|
39
39
|
createConsentRequestPayload,
|
|
40
40
|
createConsentRequest,
|
|
41
|
-
sendEdgeNetworkRequest
|
|
42
|
-
edgeConfigOverrides: config.edgeConfigOverrides
|
|
41
|
+
sendEdgeNetworkRequest
|
|
43
42
|
});
|
|
44
43
|
const storage = createNamespacedStorage(`${sanitizeOrgIdForCookieName(orgId)}.consentHashes.`);
|
|
45
44
|
const consentHashStore = createConsentHashStore({
|
|
@@ -13,17 +13,13 @@ import { isObject } from "../../utils";
|
|
|
13
13
|
export default (({
|
|
14
14
|
createConsentRequestPayload,
|
|
15
15
|
createConsentRequest,
|
|
16
|
-
sendEdgeNetworkRequest
|
|
17
|
-
edgeConfigOverrides: globalConfigOverrides
|
|
16
|
+
sendEdgeNetworkRequest
|
|
18
17
|
}) => ({
|
|
19
18
|
consentOptions,
|
|
20
|
-
identityMap
|
|
21
|
-
edgeConfigOverrides: localConfigOverrides
|
|
19
|
+
identityMap
|
|
22
20
|
}) => {
|
|
23
21
|
const payload = createConsentRequestPayload();
|
|
24
22
|
payload.setConsent(consentOptions);
|
|
25
|
-
payload.mergeConfigOverride(globalConfigOverrides);
|
|
26
|
-
payload.mergeConfigOverride(localConfigOverrides);
|
|
27
23
|
|
|
28
24
|
if (isObject(identityMap)) {
|
|
29
25
|
Object.keys(identityMap).forEach(key => {
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { objectOf, anything, arrayOf } from "../../utils/validation";
|
|
2
|
-
import { validateIdentityMap
|
|
2
|
+
import { validateIdentityMap } from "../../utils";
|
|
3
3
|
export default objectOf({
|
|
4
4
|
consent: arrayOf(anything()).required().nonEmpty(),
|
|
5
|
-
identityMap: validateIdentityMap
|
|
6
|
-
edgeConfigOverrides: validateConfigOverride
|
|
5
|
+
identityMap: validateIdentityMap
|
|
7
6
|
}).noUnknownFields().required();
|
|
@@ -9,4 +9,4 @@ 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
|
-
export default ["architecture", "bitness", "model", "platformVersion", "wow64"];
|
|
12
|
+
export default [["architecture", "string"], ["bitness", "string"], ["model", "string"], ["platformVersion", "string"], ["wow64", "boolean"]];
|
|
@@ -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 { boolean, string, callback, enumOf } from "../../utils/validation";
|
|
13
|
-
import { noop
|
|
13
|
+
import { noop } from "../../utils";
|
|
14
14
|
import { EDGE as EDGE_DOMAIN } from "../../constants/domain";
|
|
15
15
|
import EDGE_BASE_PATH from "../../constants/edgeBasePath";
|
|
16
16
|
import { IN, OUT, PENDING } from "../../constants/consentStatus";
|
|
@@ -21,6 +21,5 @@ export default (() => ({
|
|
|
21
21
|
edgeDomain: string().domain().default(EDGE_DOMAIN),
|
|
22
22
|
edgeBasePath: string().nonEmpty().default(EDGE_BASE_PATH),
|
|
23
23
|
orgId: string().unique().required(),
|
|
24
|
-
onBeforeEventSend: callback().default(noop)
|
|
25
|
-
edgeConfigOverrides: validateConfigOverride
|
|
24
|
+
onBeforeEventSend: callback().default(noop)
|
|
26
25
|
}));
|
|
@@ -24,8 +24,7 @@ export default (({
|
|
|
24
24
|
applyResponse
|
|
25
25
|
}) => {
|
|
26
26
|
const {
|
|
27
|
-
onBeforeEventSend
|
|
28
|
-
edgeConfigOverrides: globalConfigOverrides
|
|
27
|
+
onBeforeEventSend
|
|
29
28
|
} = config;
|
|
30
29
|
return {
|
|
31
30
|
createEvent,
|
|
@@ -50,15 +49,12 @@ export default (({
|
|
|
50
49
|
const {
|
|
51
50
|
renderDecisions = false,
|
|
52
51
|
decisionScopes,
|
|
53
|
-
edgeConfigOverrides: localConfigOverrides,
|
|
54
52
|
personalization
|
|
55
53
|
} = options;
|
|
56
54
|
const payload = createDataCollectionRequestPayload();
|
|
57
55
|
const request = createDataCollectionRequest(payload);
|
|
58
56
|
const onResponseCallbackAggregator = createCallbackAggregator();
|
|
59
57
|
const onRequestFailureCallbackAggregator = createCallbackAggregator();
|
|
60
|
-
payload.mergeConfigOverride(globalConfigOverrides);
|
|
61
|
-
payload.mergeConfigOverride(localConfigOverrides);
|
|
62
58
|
return lifecycle.onBeforeEvent({
|
|
63
59
|
event,
|
|
64
60
|
renderDecisions,
|
package/libEs6/utils/index.js
CHANGED
|
@@ -26,7 +26,6 @@ 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";
|
|
30
29
|
export { default as flatMap } from "./flatMap";
|
|
31
30
|
export { default as getApexDomain } from "./getApexDomain";
|
|
32
31
|
export { default as getLastArrayItems } from "./getLastArrayItems";
|
|
@@ -50,7 +49,6 @@ export { default as isString } from "./isString";
|
|
|
50
49
|
export { default as memoize } from "./memoize";
|
|
51
50
|
export { default as noop } from "./noop";
|
|
52
51
|
export { default as padStart } from "./padStart";
|
|
53
|
-
export { default as prepareConfigOverridesForEdge } from "./prepareConfigOverridesForEdge";
|
|
54
52
|
export { default as queryString } from "./querystring";
|
|
55
53
|
export { default as sanitizeOrgIdForCookieName } from "./sanitizeOrgIdForCookieName";
|
|
56
54
|
export { default as stackError } from "./stackError";
|
|
@@ -63,5 +61,4 @@ export { default as toISOStringLocal } from "./toISOStringLocal";
|
|
|
63
61
|
export { default as uuid } from "./uuid";
|
|
64
62
|
export { default as updateErrorMessage } from "./updateErrorMessage";
|
|
65
63
|
export { default as validateIdentityMap } from "./validateIdentityMap";
|
|
66
|
-
export { default as validateConfigOverride } from "./validateConfigOverride";
|
|
67
64
|
export { default as values } from "./values";
|
|
@@ -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
|
|
12
|
+
import { createMerger } from ".."; // This provides the base functionality that all types of
|
|
13
13
|
// request payloads share.
|
|
14
14
|
|
|
15
15
|
export default (options => {
|
|
@@ -18,12 +18,10 @@ export default (options => {
|
|
|
18
18
|
addIdentity,
|
|
19
19
|
hasIdentity
|
|
20
20
|
} = options;
|
|
21
|
-
const mergeConfigOverride = createMerger(content, "meta.configOverrides");
|
|
22
21
|
return {
|
|
23
22
|
mergeMeta: createMerger(content, "meta"),
|
|
24
23
|
mergeState: createMerger(content, "meta.state"),
|
|
25
24
|
mergeQuery: createMerger(content, "query"),
|
|
26
|
-
mergeConfigOverride: updates => mergeConfigOverride(prepareConfigOverridesForEdge(updates)),
|
|
27
25
|
addIdentity,
|
|
28
26
|
hasIdentity,
|
|
29
27
|
|