@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
|
@@ -40,7 +40,8 @@ const createIdentity = ({
|
|
|
40
40
|
}) => {
|
|
41
41
|
const {
|
|
42
42
|
orgId,
|
|
43
|
-
thirdPartyCookiesEnabled
|
|
43
|
+
thirdPartyCookiesEnabled,
|
|
44
|
+
edgeConfigOverrides: globalConfigOverrides
|
|
44
45
|
} = config;
|
|
45
46
|
const getEcidFromVisitor = injectGetEcidFromVisitor({
|
|
46
47
|
logger,
|
|
@@ -64,7 +65,8 @@ const createIdentity = ({
|
|
|
64
65
|
const getIdentity = createGetIdentity({
|
|
65
66
|
sendEdgeNetworkRequest,
|
|
66
67
|
createIdentityRequestPayload,
|
|
67
|
-
createIdentityRequest
|
|
68
|
+
createIdentityRequest,
|
|
69
|
+
globalConfigOverrides
|
|
68
70
|
});
|
|
69
71
|
const setDomainForInitialIdentityPayload = injectSetDomainForInitialIdentityPayload({
|
|
70
72
|
thirdPartyCookiesEnabled,
|
|
@@ -100,7 +102,8 @@ const createIdentity = ({
|
|
|
100
102
|
});
|
|
101
103
|
const appendIdentityToUrl = injectAppendIdentityToUrl({
|
|
102
104
|
dateProvider: () => new Date(),
|
|
103
|
-
orgId
|
|
105
|
+
orgId,
|
|
106
|
+
globalConfigOverrides
|
|
104
107
|
});
|
|
105
108
|
return createComponent({
|
|
106
109
|
addEcidQueryToPayload,
|
|
@@ -112,7 +115,8 @@ const createIdentity = ({
|
|
|
112
115
|
getIdentity,
|
|
113
116
|
consent,
|
|
114
117
|
appendIdentityToUrl,
|
|
115
|
-
logger
|
|
118
|
+
logger,
|
|
119
|
+
config
|
|
116
120
|
});
|
|
117
121
|
};
|
|
118
122
|
|
|
@@ -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,7 +57,8 @@ export default (({
|
|
|
57
57
|
optionsValidator: validateSetConsentOptions,
|
|
58
58
|
run: ({
|
|
59
59
|
consent: consentOptions,
|
|
60
|
-
identityMap
|
|
60
|
+
identityMap,
|
|
61
|
+
edgeConfigOverrides
|
|
61
62
|
}) => {
|
|
62
63
|
consent.suspend();
|
|
63
64
|
const consentHashes = consentHashStore.lookup(consentOptions);
|
|
@@ -65,7 +66,8 @@ export default (({
|
|
|
65
66
|
if (consentHashes.isNew()) {
|
|
66
67
|
return sendSetConsentRequest({
|
|
67
68
|
consentOptions,
|
|
68
|
-
identityMap
|
|
69
|
+
identityMap,
|
|
70
|
+
edgeConfigOverrides
|
|
69
71
|
});
|
|
70
72
|
}
|
|
71
73
|
|
|
@@ -38,7 +38,8 @@ const createPrivacy = ({
|
|
|
38
38
|
const sendSetConsentRequest = injectSendSetConsentRequest({
|
|
39
39
|
createConsentRequestPayload,
|
|
40
40
|
createConsentRequest,
|
|
41
|
-
sendEdgeNetworkRequest
|
|
41
|
+
sendEdgeNetworkRequest,
|
|
42
|
+
edgeConfigOverrides: config.edgeConfigOverrides
|
|
42
43
|
});
|
|
43
44
|
const storage = createNamespacedStorage(`${sanitizeOrgIdForCookieName(orgId)}.consentHashes.`);
|
|
44
45
|
const consentHashStore = createConsentHashStore({
|
|
@@ -13,13 +13,17 @@ import { isObject } from "../../utils";
|
|
|
13
13
|
export default (({
|
|
14
14
|
createConsentRequestPayload,
|
|
15
15
|
createConsentRequest,
|
|
16
|
-
sendEdgeNetworkRequest
|
|
16
|
+
sendEdgeNetworkRequest,
|
|
17
|
+
edgeConfigOverrides: globalConfigOverrides
|
|
17
18
|
}) => ({
|
|
18
19
|
consentOptions,
|
|
19
|
-
identityMap
|
|
20
|
+
identityMap,
|
|
21
|
+
edgeConfigOverrides: localConfigOverrides
|
|
20
22
|
}) => {
|
|
21
23
|
const payload = createConsentRequestPayload();
|
|
22
24
|
payload.setConsent(consentOptions);
|
|
25
|
+
payload.mergeConfigOverride(globalConfigOverrides);
|
|
26
|
+
payload.mergeConfigOverride(localConfigOverrides);
|
|
23
27
|
|
|
24
28
|
if (isObject(identityMap)) {
|
|
25
29
|
Object.keys(identityMap).forEach(key => {
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { objectOf, anything, arrayOf } from "../../utils/validation";
|
|
2
|
-
import { validateIdentityMap } from "../../utils";
|
|
2
|
+
import { validateIdentityMap, validateConfigOverride } from "../../utils";
|
|
3
3
|
export default objectOf({
|
|
4
4
|
consent: arrayOf(anything()).required().nonEmpty(),
|
|
5
|
-
identityMap: validateIdentityMap
|
|
5
|
+
identityMap: validateIdentityMap,
|
|
6
|
+
edgeConfigOverrides: validateConfigOverride
|
|
6
7
|
}).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 } from "../../utils";
|
|
13
|
+
import { noop, validateConfigOverride } 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,5 +21,6 @@ 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)
|
|
24
|
+
onBeforeEventSend: callback().default(noop),
|
|
25
|
+
edgeConfigOverrides: validateConfigOverride
|
|
25
26
|
}));
|
|
@@ -24,7 +24,8 @@ export default (({
|
|
|
24
24
|
applyResponse
|
|
25
25
|
}) => {
|
|
26
26
|
const {
|
|
27
|
-
onBeforeEventSend
|
|
27
|
+
onBeforeEventSend,
|
|
28
|
+
edgeConfigOverrides: globalConfigOverrides
|
|
28
29
|
} = config;
|
|
29
30
|
return {
|
|
30
31
|
createEvent,
|
|
@@ -49,12 +50,15 @@ export default (({
|
|
|
49
50
|
const {
|
|
50
51
|
renderDecisions = false,
|
|
51
52
|
decisionScopes,
|
|
53
|
+
edgeConfigOverrides: localConfigOverrides,
|
|
52
54
|
personalization
|
|
53
55
|
} = options;
|
|
54
56
|
const payload = createDataCollectionRequestPayload();
|
|
55
57
|
const request = createDataCollectionRequest(payload);
|
|
56
58
|
const onResponseCallbackAggregator = createCallbackAggregator();
|
|
57
59
|
const onRequestFailureCallbackAggregator = createCallbackAggregator();
|
|
60
|
+
payload.mergeConfigOverride(globalConfigOverrides);
|
|
61
|
+
payload.mergeConfigOverride(localConfigOverrides);
|
|
58
62
|
return lifecycle.onBeforeEvent({
|
|
59
63
|
event,
|
|
60
64
|
renderDecisions,
|
|
@@ -21,7 +21,8 @@ export default (({
|
|
|
21
21
|
sendNetworkRequest,
|
|
22
22
|
createResponse,
|
|
23
23
|
processWarningsAndErrors,
|
|
24
|
-
getLocationHint
|
|
24
|
+
getLocationHint,
|
|
25
|
+
getAssuranceValidationTokenParams
|
|
25
26
|
}) => {
|
|
26
27
|
const {
|
|
27
28
|
edgeDomain,
|
|
@@ -52,7 +53,7 @@ export default (({
|
|
|
52
53
|
const endpointDomain = request.getUseIdThirdPartyDomain() ? ID_THIRD_PARTY_DOMAIN : edgeDomain;
|
|
53
54
|
const locationHint = getLocationHint();
|
|
54
55
|
const edgeBasePathWithLocationHint = locationHint ? `${edgeBasePath}/${locationHint}` : edgeBasePath;
|
|
55
|
-
const url = `https://${endpointDomain}/${edgeBasePathWithLocationHint}/${apiVersion}/${request.getAction()}?configId=${edgeConfigId}&requestId=${request.getId()}`;
|
|
56
|
+
const url = `https://${endpointDomain}/${edgeBasePathWithLocationHint}/${apiVersion}/${request.getAction()}?configId=${edgeConfigId}&requestId=${request.getId()}${getAssuranceValidationTokenParams()}`;
|
|
56
57
|
cookieTransfer.cookiesToPayload(request.getPayload(), endpointDomain);
|
|
57
58
|
return sendNetworkRequest({
|
|
58
59
|
requestId: request.getId(),
|
package/libEs6/core/index.js
CHANGED
|
@@ -35,7 +35,7 @@ import createLogger from "./createLogger";
|
|
|
35
35
|
import createEventManager from "./createEventManager";
|
|
36
36
|
import createCookieTransfer from "./createCookieTransfer";
|
|
37
37
|
import injectShouldTransferCookie from "./injectShouldTransferCookie";
|
|
38
|
-
import { createDataCollectionRequest, createDataCollectionRequestPayload } from "../utils/request";
|
|
38
|
+
import { createDataCollectionRequest, createDataCollectionRequestPayload, createGetAssuranceValidationTokenParams } from "../utils/request";
|
|
39
39
|
import injectSendEdgeNetworkRequest from "./edgeNetwork/injectSendEdgeNetworkRequest";
|
|
40
40
|
import injectProcessWarningsAndErrors from "./edgeNetwork/injectProcessWarningsAndErrors";
|
|
41
41
|
import injectGetLocationHint from "./edgeNetwork/injectGetLocationHint";
|
|
@@ -61,6 +61,10 @@ const sendFetchRequest = isFunction(fetch) ? injectSendFetchRequest({
|
|
|
61
61
|
XMLHttpRequest
|
|
62
62
|
});
|
|
63
63
|
const fireReferrerHideableImage = injectFireReferrerHideableImage();
|
|
64
|
+
const getAssuranceValidationTokenParams = createGetAssuranceValidationTokenParams({
|
|
65
|
+
window,
|
|
66
|
+
createNamespacedStorage
|
|
67
|
+
});
|
|
64
68
|
export const createExecuteCommand = ({
|
|
65
69
|
instanceName,
|
|
66
70
|
logController: {
|
|
@@ -140,7 +144,8 @@ export const createExecuteCommand = ({
|
|
|
140
144
|
sendNetworkRequest,
|
|
141
145
|
createResponse,
|
|
142
146
|
processWarningsAndErrors,
|
|
143
|
-
getLocationHint
|
|
147
|
+
getLocationHint,
|
|
148
|
+
getAssuranceValidationTokenParams
|
|
144
149
|
});
|
|
145
150
|
const applyResponse = injectApplyResponse({
|
|
146
151
|
lifecycle,
|
|
@@ -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
|
+
});
|
|
@@ -0,0 +1,47 @@
|
|
|
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 { uuid, queryString } from "../index";
|
|
13
|
+
const ASSURANCE_VALIDATION_SESSION_URL_PARAM = "adb_validation_sessionid";
|
|
14
|
+
const ASSURANCE_VALIDATION_NAMESPACE = "validation.";
|
|
15
|
+
const CLIENT_ID = "clientId";
|
|
16
|
+
|
|
17
|
+
const getOrCreateAssuranceClientId = storage => {
|
|
18
|
+
let clientId = storage.persistent.getItem(CLIENT_ID);
|
|
19
|
+
|
|
20
|
+
if (!clientId) {
|
|
21
|
+
clientId = uuid();
|
|
22
|
+
storage.persistent.setItem(CLIENT_ID, clientId);
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
return clientId;
|
|
26
|
+
};
|
|
27
|
+
|
|
28
|
+
export default (({
|
|
29
|
+
window,
|
|
30
|
+
createNamespacedStorage
|
|
31
|
+
}) => {
|
|
32
|
+
const storage = createNamespacedStorage(ASSURANCE_VALIDATION_NAMESPACE);
|
|
33
|
+
return () => {
|
|
34
|
+
const parsedQuery = queryString.parse(window.location.search);
|
|
35
|
+
const validationSessionId = parsedQuery[ASSURANCE_VALIDATION_SESSION_URL_PARAM];
|
|
36
|
+
|
|
37
|
+
if (!validationSessionId) {
|
|
38
|
+
return "";
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
const clientId = getOrCreateAssuranceClientId(storage);
|
|
42
|
+
const validationToken = `${validationSessionId}|${clientId}`;
|
|
43
|
+
return `&${queryString.stringify({
|
|
44
|
+
adobeAepValidationToken: validationToken
|
|
45
|
+
})}`;
|
|
46
|
+
};
|
|
47
|
+
});
|
|
@@ -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
|
|
|
@@ -14,4 +14,5 @@ export { default as createDataCollectionRequest } from "./createDataCollectionRe
|
|
|
14
14
|
export { default as createDataCollectionRequestPayload } from "./createDataCollectionRequestPayload";
|
|
15
15
|
export { default as createHasIdentity } from "./createHasIdentity";
|
|
16
16
|
export { default as createRequest } from "./createRequest";
|
|
17
|
-
export { default as createRequestPayload } from "./createRequestPayload";
|
|
17
|
+
export { default as createRequestPayload } from "./createRequestPayload";
|
|
18
|
+
export { default as createGetAssuranceValidationTokenParams } from "./createGetAssuranceValidationTokenParams";
|
|
@@ -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
|
});
|
|
@@ -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.14.0-alpha.
|
|
3
|
+
"version": "2.14.0-alpha.20",
|
|
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-alpha.
|
|
67
|
+
"@adobe/alloy": "^2.14.0-alpha.19",
|
|
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",
|
|
@@ -95,6 +95,7 @@
|
|
|
95
95
|
"karma-jasmine": "^2.0.1",
|
|
96
96
|
"karma-jasmine-html-reporter": "^1.4.2",
|
|
97
97
|
"karma-jasmine-matchers": "^4.0.1",
|
|
98
|
+
"karma-junit-reporter": "^2.0.1",
|
|
98
99
|
"karma-rollup-preprocessor": "^7.0.5",
|
|
99
100
|
"karma-safari-launcher": "^1.0.0",
|
|
100
101
|
"karma-sauce-launcher": "^4.3.6",
|
|
@@ -117,9 +118,9 @@
|
|
|
117
118
|
"rollup-plugin-terser": "^7.0.2",
|
|
118
119
|
"semver": "^7.3.7",
|
|
119
120
|
"start-server-and-test": "^1.10.6",
|
|
120
|
-
"testcafe": "^
|
|
121
|
-
"testcafe-browser-provider-saucelabs": "^1.
|
|
122
|
-
"testcafe-reporter-
|
|
121
|
+
"testcafe": "^2.2.0",
|
|
122
|
+
"testcafe-browser-provider-saucelabs": "^1.9.0",
|
|
123
|
+
"testcafe-reporter-junit": "^3.0.2",
|
|
123
124
|
"url-exists-nodejs": "^0.1.0",
|
|
124
125
|
"url-parse": "^1.4.7",
|
|
125
126
|
"yargs": "^16.2.0"
|