@adobe/alloy 2.22.0 → 2.23.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/Identity/createComponent.js +20 -17
- package/libEs5/components/Identity/getIdentity/{getIdentityOptionsValidator.js → createGetIdentityOptionsValidator.js} +20 -4
- package/libEs5/components/Identity/{getEcidFromResponse.js → getNamespacesFromResponse.js} +6 -3
- package/libEs5/components/Identity/index.js +14 -5
- package/libEs5/components/Identity/{addEcidQueryToPayload.js → injectAddEcidQueryToPayload.js} +13 -3
- package/{libEs6/components/Identity/addEcidQueryToPayload.js → libEs5/constants/coreNamespace.js} +5 -10
- package/libEs5/constants/libraryVersion.js +1 -1
- package/libEs5/core/createCookieTransfer.js +3 -1
- package/libEs5/utils/validation/createUniqueItemsValidator.js +1 -0
- package/libEs5/utils/validation/index.js +1 -1
- package/libEs6/components/Identity/createComponent.js +19 -16
- package/libEs6/components/Identity/getIdentity/{getIdentityOptionsValidator.js → createGetIdentityOptionsValidator.js} +19 -4
- package/libEs6/components/Identity/{getEcidFromResponse.js → getNamespacesFromResponse.js} +6 -3
- package/libEs6/components/Identity/index.js +13 -4
- package/libEs6/components/Identity/injectAddEcidQueryToPayload.js +30 -0
- package/libEs6/constants/coreNamespace.js +13 -0
- package/libEs6/constants/libraryVersion.js +1 -1
- package/libEs6/core/createCookieTransfer.js +3 -1
- package/libEs6/utils/validation/createUniqueItemsValidator.js +1 -0
- package/libEs6/utils/validation/index.js +1 -1
- package/package.json +3 -5
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
exports.default = void 0;
|
|
4
|
-
var _getIdentityOptionsValidator = require("./getIdentity/getIdentityOptionsValidator.js");
|
|
5
4
|
var _appendIdentityToUrlOptionsValidator = require("./appendIdentityToUrl/appendIdentityToUrlOptionsValidator.js");
|
|
5
|
+
var _ecidNamespace = require("../../constants/ecidNamespace.js");
|
|
6
6
|
/*
|
|
7
7
|
Copyright 2023 Adobe. All rights reserved.
|
|
8
8
|
This file is licensed to you under the Apache License, Version 2.0 (the "License");
|
|
@@ -20,13 +20,14 @@ var _default = ({
|
|
|
20
20
|
ensureSingleIdentity,
|
|
21
21
|
setLegacyEcid,
|
|
22
22
|
handleResponseForIdSyncs,
|
|
23
|
-
|
|
23
|
+
getNamespacesFromResponse,
|
|
24
24
|
getIdentity,
|
|
25
25
|
consent,
|
|
26
26
|
appendIdentityToUrl,
|
|
27
|
-
logger
|
|
27
|
+
logger,
|
|
28
|
+
getIdentityOptionsValidator
|
|
28
29
|
}) => {
|
|
29
|
-
let
|
|
30
|
+
let namespaces;
|
|
30
31
|
let edge = {};
|
|
31
32
|
return {
|
|
32
33
|
lifecycle: {
|
|
@@ -48,15 +49,13 @@ var _default = ({
|
|
|
48
49
|
onResponse({
|
|
49
50
|
response
|
|
50
51
|
}) {
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
52
|
+
const newNamespaces = getNamespacesFromResponse(response);
|
|
53
|
+
if ((!namespaces || !namespaces[_ecidNamespace.default]) && newNamespaces && newNamespaces[_ecidNamespace.default]) {
|
|
54
54
|
// Only data collection calls will have an ECID in the response.
|
|
55
55
|
// https://jira.corp.adobe.com/browse/EXEG-1234
|
|
56
|
-
|
|
57
|
-
setLegacyEcid(ecid);
|
|
58
|
-
}
|
|
56
|
+
setLegacyEcid(newNamespaces[_ecidNamespace.default]);
|
|
59
57
|
}
|
|
58
|
+
namespaces = newNamespaces;
|
|
60
59
|
// For sendBeacon requests, getEdge() will return {}, so we are using assign here
|
|
61
60
|
// so that sendBeacon requests don't override the edge info from before.
|
|
62
61
|
edge = {
|
|
@@ -68,15 +67,19 @@ var _default = ({
|
|
|
68
67
|
},
|
|
69
68
|
commands: {
|
|
70
69
|
getIdentity: {
|
|
71
|
-
optionsValidator:
|
|
70
|
+
optionsValidator: getIdentityOptionsValidator,
|
|
72
71
|
run: options => {
|
|
72
|
+
const {
|
|
73
|
+
namespaces: requestedNamespaces
|
|
74
|
+
} = options;
|
|
73
75
|
return consent.awaitConsent().then(() => {
|
|
74
|
-
return
|
|
76
|
+
return namespaces ? undefined : getIdentity(options);
|
|
75
77
|
}).then(() => {
|
|
76
78
|
return {
|
|
77
|
-
identity: {
|
|
78
|
-
|
|
79
|
-
|
|
79
|
+
identity: requestedNamespaces.reduce((acc, namespace) => {
|
|
80
|
+
acc[namespace] = namespaces[namespace] || null;
|
|
81
|
+
return acc;
|
|
82
|
+
}, {}),
|
|
80
83
|
edge
|
|
81
84
|
};
|
|
82
85
|
});
|
|
@@ -86,10 +89,10 @@ var _default = ({
|
|
|
86
89
|
optionsValidator: _appendIdentityToUrlOptionsValidator.default,
|
|
87
90
|
run: options => {
|
|
88
91
|
return consent.withConsent().then(() => {
|
|
89
|
-
return
|
|
92
|
+
return namespaces ? undefined : getIdentity(options);
|
|
90
93
|
}).then(() => {
|
|
91
94
|
return {
|
|
92
|
-
url: appendIdentityToUrl(
|
|
95
|
+
url: appendIdentityToUrl(namespaces[_ecidNamespace.default], options.url)
|
|
93
96
|
};
|
|
94
97
|
}).catch(error => {
|
|
95
98
|
logger.warn("Unable to append identity to url. " + error.message);
|
|
@@ -3,6 +3,8 @@
|
|
|
3
3
|
exports.default = void 0;
|
|
4
4
|
var _index = require("../../../utils/index.js");
|
|
5
5
|
var _index2 = require("../../../utils/validation/index.js");
|
|
6
|
+
var _ecidNamespace = require("../../../constants/ecidNamespace.js");
|
|
7
|
+
var _coreNamespace = require("../../../constants/coreNamespace.js");
|
|
6
8
|
/*
|
|
7
9
|
Copyright 2020 Adobe. All rights reserved.
|
|
8
10
|
This file is licensed to you under the Apache License, Version 2.0 (the "License");
|
|
@@ -14,14 +16,28 @@ the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTA
|
|
|
14
16
|
OF ANY KIND, either express or implied. See the License for the specific language
|
|
15
17
|
governing permissions and limitations under the License.
|
|
16
18
|
*/
|
|
19
|
+
|
|
17
20
|
/**
|
|
18
21
|
* Verifies user provided event options.
|
|
19
22
|
* @param {*} options The user event options to validate
|
|
20
23
|
* @returns {*} Validated options
|
|
21
24
|
*/
|
|
22
|
-
|
|
23
|
-
|
|
25
|
+
|
|
26
|
+
const validator = (0, _index2.objectOf)({
|
|
27
|
+
namespaces: (0, _index2.arrayOf)((0, _index2.enumOf)(_ecidNamespace.default, _coreNamespace.default)).nonEmpty().uniqueItems().default([_ecidNamespace.default]),
|
|
24
28
|
edgeConfigOverrides: _index.validateConfigOverride
|
|
25
29
|
}).noUnknownFields().default({
|
|
26
|
-
namespaces: [
|
|
27
|
-
});
|
|
30
|
+
namespaces: [_ecidNamespace.default]
|
|
31
|
+
});
|
|
32
|
+
var _default = ({
|
|
33
|
+
thirdPartyCookiesEnabled
|
|
34
|
+
}) => {
|
|
35
|
+
return options => {
|
|
36
|
+
const validatedOptions = validator(options);
|
|
37
|
+
if (!thirdPartyCookiesEnabled && validatedOptions.namespaces.includes(_coreNamespace.default)) {
|
|
38
|
+
throw new Error("namespaces: The " + _coreNamespace.default + " namespace cannot be requested when third-party cookies are disabled.");
|
|
39
|
+
}
|
|
40
|
+
return validatedOptions;
|
|
41
|
+
};
|
|
42
|
+
};
|
|
43
|
+
exports.default = _default;
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
exports.default = void 0;
|
|
4
|
-
var _ecidNamespace = require("../../constants/ecidNamespace.js");
|
|
5
4
|
/*
|
|
6
5
|
Copyright 2020 Adobe. All rights reserved.
|
|
7
6
|
This file is licensed to you under the Apache License, Version 2.0 (the "License");
|
|
@@ -15,7 +14,11 @@ governing permissions and limitations under the License.
|
|
|
15
14
|
*/
|
|
16
15
|
var _default = response => {
|
|
17
16
|
const identityResultPayloads = response.getPayloadsByType("identity:result");
|
|
18
|
-
|
|
19
|
-
|
|
17
|
+
return identityResultPayloads.reduce((acc, payload) => {
|
|
18
|
+
if (payload.namespace && payload.namespace.code) {
|
|
19
|
+
acc[payload.namespace.code] = payload.id;
|
|
20
|
+
}
|
|
21
|
+
return acc;
|
|
22
|
+
}, {});
|
|
20
23
|
};
|
|
21
24
|
exports.default = _default;
|
|
@@ -10,17 +10,18 @@ var _awaitVisitorOptIn = require("./visitorService/awaitVisitorOptIn.js");
|
|
|
10
10
|
var _injectGetEcidFromVisitor = require("./visitorService/injectGetEcidFromVisitor.js");
|
|
11
11
|
var _injectHandleResponseForIdSyncs = require("./injectHandleResponseForIdSyncs.js");
|
|
12
12
|
var _injectEnsureSingleIdentity = require("./injectEnsureSingleIdentity.js");
|
|
13
|
-
var
|
|
13
|
+
var _injectAddEcidQueryToPayload = require("./injectAddEcidQueryToPayload.js");
|
|
14
14
|
var _injectSetDomainForInitialIdentityPayload = require("./injectSetDomainForInitialIdentityPayload.js");
|
|
15
15
|
var _injectAddLegacyEcidToPayload = require("./injectAddLegacyEcidToPayload.js");
|
|
16
16
|
var _injectAddQueryStringIdentityToPayload = require("./injectAddQueryStringIdentityToPayload.js");
|
|
17
17
|
var _addEcidToPayload = require("./addEcidToPayload.js");
|
|
18
18
|
var _injectAwaitIdentityCookie = require("./injectAwaitIdentityCookie.js");
|
|
19
|
-
var
|
|
19
|
+
var _getNamespacesFromResponse = require("./getNamespacesFromResponse.js");
|
|
20
20
|
var _createGetIdentity = require("./getIdentity/createGetIdentity.js");
|
|
21
21
|
var _createIdentityRequest = require("./getIdentity/createIdentityRequest.js");
|
|
22
22
|
var _createIdentityRequestPayload = require("./getIdentity/createIdentityRequestPayload.js");
|
|
23
23
|
var _injectAppendIdentityToUrl = require("./appendIdentityToUrl/injectAppendIdentityToUrl.js");
|
|
24
|
+
var _createGetIdentityOptionsValidator = require("./getIdentity/createGetIdentityOptionsValidator.js");
|
|
24
25
|
/*
|
|
25
26
|
Copyright 2019 Adobe. All rights reserved.
|
|
26
27
|
This file is licensed to you under the Apache License, Version 2.0 (the "License");
|
|
@@ -113,18 +114,26 @@ const createIdentity = ({
|
|
|
113
114
|
orgId,
|
|
114
115
|
globalConfigOverrides
|
|
115
116
|
});
|
|
117
|
+
const getIdentityOptionsValidator = (0, _createGetIdentityOptionsValidator.default)({
|
|
118
|
+
thirdPartyCookiesEnabled
|
|
119
|
+
});
|
|
120
|
+
const addEcidQueryToPayload = (0, _injectAddEcidQueryToPayload.default)({
|
|
121
|
+
thirdPartyCookiesEnabled,
|
|
122
|
+
areThirdPartyCookiesSupportedByDefault
|
|
123
|
+
});
|
|
116
124
|
return (0, _createComponent.default)({
|
|
117
|
-
addEcidQueryToPayload
|
|
125
|
+
addEcidQueryToPayload,
|
|
118
126
|
addQueryStringIdentityToPayload,
|
|
119
127
|
ensureSingleIdentity,
|
|
120
128
|
setLegacyEcid: legacyIdentity.setEcid,
|
|
121
129
|
handleResponseForIdSyncs,
|
|
122
|
-
|
|
130
|
+
getNamespacesFromResponse: _getNamespacesFromResponse.default,
|
|
123
131
|
getIdentity,
|
|
124
132
|
consent,
|
|
125
133
|
appendIdentityToUrl,
|
|
126
134
|
logger,
|
|
127
|
-
config
|
|
135
|
+
config,
|
|
136
|
+
getIdentityOptionsValidator
|
|
128
137
|
});
|
|
129
138
|
};
|
|
130
139
|
createIdentity.namespace = "Identity";
|
package/libEs5/components/Identity/{addEcidQueryToPayload.js → injectAddEcidQueryToPayload.js}
RENAMED
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
exports.default = void 0;
|
|
4
4
|
var _ecidNamespace = require("../../constants/ecidNamespace.js");
|
|
5
|
+
var _coreNamespace = require("../../constants/coreNamespace.js");
|
|
5
6
|
/*
|
|
6
7
|
Copyright 2020 Adobe. All rights reserved.
|
|
7
8
|
This file is licensed to you under the Apache License, Version 2.0 (the "License");
|
|
@@ -13,11 +14,20 @@ the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTA
|
|
|
13
14
|
OF ANY KIND, either express or implied. See the License for the specific language
|
|
14
15
|
governing permissions and limitations under the License.
|
|
15
16
|
*/
|
|
16
|
-
var _default =
|
|
17
|
-
|
|
17
|
+
var _default = ({
|
|
18
|
+
thirdPartyCookiesEnabled,
|
|
19
|
+
areThirdPartyCookiesSupportedByDefault
|
|
20
|
+
}) => {
|
|
21
|
+
const query = {
|
|
18
22
|
identity: {
|
|
19
23
|
fetch: [_ecidNamespace.default]
|
|
20
24
|
}
|
|
21
|
-
}
|
|
25
|
+
};
|
|
26
|
+
if (thirdPartyCookiesEnabled && areThirdPartyCookiesSupportedByDefault()) {
|
|
27
|
+
query.identity.fetch.push(_coreNamespace.default);
|
|
28
|
+
}
|
|
29
|
+
return payload => {
|
|
30
|
+
payload.mergeQuery(query);
|
|
31
|
+
};
|
|
22
32
|
};
|
|
23
33
|
exports.default = _default;
|
package/{libEs6/components/Identity/addEcidQueryToPayload.js → libEs5/constants/coreNamespace.js}
RENAMED
|
@@ -1,5 +1,8 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
exports.default = void 0;
|
|
1
4
|
/*
|
|
2
|
-
Copyright
|
|
5
|
+
Copyright 2024 Adobe. All rights reserved.
|
|
3
6
|
This file is licensed to you under the Apache License, Version 2.0 (the "License");
|
|
4
7
|
you may not use this file except in compliance with the License. You may obtain a copy
|
|
5
8
|
of the License at http://www.apache.org/licenses/LICENSE-2.0
|
|
@@ -9,12 +12,4 @@ the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTA
|
|
|
9
12
|
OF ANY KIND, either express or implied. See the License for the specific language
|
|
10
13
|
governing permissions and limitations under the License.
|
|
11
14
|
*/
|
|
12
|
-
|
|
13
|
-
import ecidNamespace from "../../constants/ecidNamespace.js";
|
|
14
|
-
export default (payload => {
|
|
15
|
-
payload.mergeQuery({
|
|
16
|
-
identity: {
|
|
17
|
-
fetch: [ecidNamespace]
|
|
18
|
-
}
|
|
19
|
-
});
|
|
20
|
-
});
|
|
15
|
+
var _default = exports.default = "CORE";
|
|
@@ -14,4 +14,4 @@ governing permissions and limitations under the License.
|
|
|
14
14
|
*/
|
|
15
15
|
// The __VERSION__ keyword will be replace at alloy build time with the package.json version.
|
|
16
16
|
// see babel-plugin-version
|
|
17
|
-
var _default = exports.default = "2.
|
|
17
|
+
var _default = exports.default = "2.23.0-beta.0";
|
|
@@ -26,7 +26,9 @@ var _default = ({
|
|
|
26
26
|
* the request body so they can be read by the server.
|
|
27
27
|
*/
|
|
28
28
|
cookiesToPayload(payload, endpointDomain) {
|
|
29
|
-
|
|
29
|
+
// localhost is a special case where the apexDomain is ""
|
|
30
|
+
// We want to treat localhost as a third-party domain.
|
|
31
|
+
const isEndpointFirstParty = apexDomain !== "" && endpointDomain.endsWith(apexDomain);
|
|
30
32
|
const state = {
|
|
31
33
|
domain: apexDomain,
|
|
32
34
|
cookiesEnabled: true
|
|
@@ -17,6 +17,7 @@ governing permissions and limitations under the License.
|
|
|
17
17
|
var _default = () => {
|
|
18
18
|
return (value, path) => {
|
|
19
19
|
(0, _utils.assertValid)((0, _isUnique.default)(value), value, path, "array values to be unique");
|
|
20
|
+
return value;
|
|
20
21
|
};
|
|
21
22
|
};
|
|
22
23
|
exports.default = _default;
|
|
@@ -233,5 +233,5 @@ const boundString = exports.string = string.bind(base);
|
|
|
233
233
|
|
|
234
234
|
// compound validators
|
|
235
235
|
const boundEnumOf = exports.enumOf = function boundEnumOf(...values) {
|
|
236
|
-
return boundAnyOf(values.map(boundLiteral), "one of these values:
|
|
236
|
+
return boundAnyOf(values.map(boundLiteral), "one of these values: " + JSON.stringify(values));
|
|
237
237
|
};
|
|
@@ -9,21 +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
|
-
import getIdentityOptionsValidator from "./getIdentity/getIdentityOptionsValidator.js";
|
|
13
12
|
import appendIdentityToUrlOptionsValidator from "./appendIdentityToUrl/appendIdentityToUrlOptionsValidator.js";
|
|
13
|
+
import ecidNamespace from "../../constants/ecidNamespace.js";
|
|
14
14
|
export default (({
|
|
15
15
|
addEcidQueryToPayload,
|
|
16
16
|
addQueryStringIdentityToPayload,
|
|
17
17
|
ensureSingleIdentity,
|
|
18
18
|
setLegacyEcid,
|
|
19
19
|
handleResponseForIdSyncs,
|
|
20
|
-
|
|
20
|
+
getNamespacesFromResponse,
|
|
21
21
|
getIdentity,
|
|
22
22
|
consent,
|
|
23
23
|
appendIdentityToUrl,
|
|
24
|
-
logger
|
|
24
|
+
logger,
|
|
25
|
+
getIdentityOptionsValidator
|
|
25
26
|
}) => {
|
|
26
|
-
let
|
|
27
|
+
let namespaces;
|
|
27
28
|
let edge = {};
|
|
28
29
|
return {
|
|
29
30
|
lifecycle: {
|
|
@@ -45,15 +46,13 @@ export default (({
|
|
|
45
46
|
onResponse({
|
|
46
47
|
response
|
|
47
48
|
}) {
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
49
|
+
const newNamespaces = getNamespacesFromResponse(response);
|
|
50
|
+
if ((!namespaces || !namespaces[ecidNamespace]) && newNamespaces && newNamespaces[ecidNamespace]) {
|
|
51
51
|
// Only data collection calls will have an ECID in the response.
|
|
52
52
|
// https://jira.corp.adobe.com/browse/EXEG-1234
|
|
53
|
-
|
|
54
|
-
setLegacyEcid(ecid);
|
|
55
|
-
}
|
|
53
|
+
setLegacyEcid(newNamespaces[ecidNamespace]);
|
|
56
54
|
}
|
|
55
|
+
namespaces = newNamespaces;
|
|
57
56
|
// For sendBeacon requests, getEdge() will return {}, so we are using assign here
|
|
58
57
|
// so that sendBeacon requests don't override the edge info from before.
|
|
59
58
|
edge = {
|
|
@@ -67,13 +66,17 @@ export default (({
|
|
|
67
66
|
getIdentity: {
|
|
68
67
|
optionsValidator: getIdentityOptionsValidator,
|
|
69
68
|
run: options => {
|
|
69
|
+
const {
|
|
70
|
+
namespaces: requestedNamespaces
|
|
71
|
+
} = options;
|
|
70
72
|
return consent.awaitConsent().then(() => {
|
|
71
|
-
return
|
|
73
|
+
return namespaces ? undefined : getIdentity(options);
|
|
72
74
|
}).then(() => {
|
|
73
75
|
return {
|
|
74
|
-
identity: {
|
|
75
|
-
|
|
76
|
-
|
|
76
|
+
identity: requestedNamespaces.reduce((acc, namespace) => {
|
|
77
|
+
acc[namespace] = namespaces[namespace] || null;
|
|
78
|
+
return acc;
|
|
79
|
+
}, {}),
|
|
77
80
|
edge
|
|
78
81
|
};
|
|
79
82
|
});
|
|
@@ -83,10 +86,10 @@ export default (({
|
|
|
83
86
|
optionsValidator: appendIdentityToUrlOptionsValidator,
|
|
84
87
|
run: options => {
|
|
85
88
|
return consent.withConsent().then(() => {
|
|
86
|
-
return
|
|
89
|
+
return namespaces ? undefined : getIdentity(options);
|
|
87
90
|
}).then(() => {
|
|
88
91
|
return {
|
|
89
|
-
url: appendIdentityToUrl(
|
|
92
|
+
url: appendIdentityToUrl(namespaces[ecidNamespace], options.url)
|
|
90
93
|
};
|
|
91
94
|
}).catch(error => {
|
|
92
95
|
logger.warn(`Unable to append identity to url. ${error.message}`);
|
|
@@ -11,15 +11,30 @@ governing permissions and limitations under the License.
|
|
|
11
11
|
*/
|
|
12
12
|
|
|
13
13
|
import { validateConfigOverride } from "../../../utils/index.js";
|
|
14
|
-
import { objectOf,
|
|
14
|
+
import { objectOf, enumOf, arrayOf } from "../../../utils/validation/index.js";
|
|
15
|
+
import ecidNamespace from "../../../constants/ecidNamespace.js";
|
|
16
|
+
import coreNamespace from "../../../constants/coreNamespace.js";
|
|
17
|
+
|
|
15
18
|
/**
|
|
16
19
|
* Verifies user provided event options.
|
|
17
20
|
* @param {*} options The user event options to validate
|
|
18
21
|
* @returns {*} Validated options
|
|
19
22
|
*/
|
|
20
|
-
|
|
21
|
-
|
|
23
|
+
|
|
24
|
+
const validator = objectOf({
|
|
25
|
+
namespaces: arrayOf(enumOf(ecidNamespace, coreNamespace)).nonEmpty().uniqueItems().default([ecidNamespace]),
|
|
22
26
|
edgeConfigOverrides: validateConfigOverride
|
|
23
27
|
}).noUnknownFields().default({
|
|
24
|
-
namespaces: [
|
|
28
|
+
namespaces: [ecidNamespace]
|
|
29
|
+
});
|
|
30
|
+
export default (({
|
|
31
|
+
thirdPartyCookiesEnabled
|
|
32
|
+
}) => {
|
|
33
|
+
return options => {
|
|
34
|
+
const validatedOptions = validator(options);
|
|
35
|
+
if (!thirdPartyCookiesEnabled && validatedOptions.namespaces.includes(coreNamespace)) {
|
|
36
|
+
throw new Error(`namespaces: The ${coreNamespace} namespace cannot be requested when third-party cookies are disabled.`);
|
|
37
|
+
}
|
|
38
|
+
return validatedOptions;
|
|
39
|
+
};
|
|
25
40
|
});
|
|
@@ -9,9 +9,12 @@ 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 ecidNamespace from "../../constants/ecidNamespace.js";
|
|
13
12
|
export default (response => {
|
|
14
13
|
const identityResultPayloads = response.getPayloadsByType("identity:result");
|
|
15
|
-
|
|
16
|
-
|
|
14
|
+
return identityResultPayloads.reduce((acc, payload) => {
|
|
15
|
+
if (payload.namespace && payload.namespace.code) {
|
|
16
|
+
acc[payload.namespace.code] = payload.id;
|
|
17
|
+
}
|
|
18
|
+
return acc;
|
|
19
|
+
}, {});
|
|
17
20
|
});
|
|
@@ -19,17 +19,18 @@ import awaitVisitorOptIn from "./visitorService/awaitVisitorOptIn.js";
|
|
|
19
19
|
import injectGetEcidFromVisitor from "./visitorService/injectGetEcidFromVisitor.js";
|
|
20
20
|
import injectHandleResponseForIdSyncs from "./injectHandleResponseForIdSyncs.js";
|
|
21
21
|
import injectEnsureSingleIdentity from "./injectEnsureSingleIdentity.js";
|
|
22
|
-
import
|
|
22
|
+
import injectAddEcidQueryToPayload from "./injectAddEcidQueryToPayload.js";
|
|
23
23
|
import injectSetDomainForInitialIdentityPayload from "./injectSetDomainForInitialIdentityPayload.js";
|
|
24
24
|
import injectAddLegacyEcidToPayload from "./injectAddLegacyEcidToPayload.js";
|
|
25
25
|
import injectAddQueryStringIdentityToPayload from "./injectAddQueryStringIdentityToPayload.js";
|
|
26
26
|
import addEcidToPayload from "./addEcidToPayload.js";
|
|
27
27
|
import injectAwaitIdentityCookie from "./injectAwaitIdentityCookie.js";
|
|
28
|
-
import
|
|
28
|
+
import getNamespacesFromResponse from "./getNamespacesFromResponse.js";
|
|
29
29
|
import createGetIdentity from "./getIdentity/createGetIdentity.js";
|
|
30
30
|
import createIdentityRequest from "./getIdentity/createIdentityRequest.js";
|
|
31
31
|
import createIdentityRequestPayload from "./getIdentity/createIdentityRequestPayload.js";
|
|
32
32
|
import injectAppendIdentityToUrl from "./appendIdentityToUrl/injectAppendIdentityToUrl.js";
|
|
33
|
+
import createGetIdentityOptionsValidator from "./getIdentity/createGetIdentityOptionsValidator.js";
|
|
33
34
|
const createIdentity = ({
|
|
34
35
|
config,
|
|
35
36
|
logger,
|
|
@@ -110,18 +111,26 @@ const createIdentity = ({
|
|
|
110
111
|
orgId,
|
|
111
112
|
globalConfigOverrides
|
|
112
113
|
});
|
|
114
|
+
const getIdentityOptionsValidator = createGetIdentityOptionsValidator({
|
|
115
|
+
thirdPartyCookiesEnabled
|
|
116
|
+
});
|
|
117
|
+
const addEcidQueryToPayload = injectAddEcidQueryToPayload({
|
|
118
|
+
thirdPartyCookiesEnabled,
|
|
119
|
+
areThirdPartyCookiesSupportedByDefault
|
|
120
|
+
});
|
|
113
121
|
return createComponent({
|
|
114
122
|
addEcidQueryToPayload,
|
|
115
123
|
addQueryStringIdentityToPayload,
|
|
116
124
|
ensureSingleIdentity,
|
|
117
125
|
setLegacyEcid: legacyIdentity.setEcid,
|
|
118
126
|
handleResponseForIdSyncs,
|
|
119
|
-
|
|
127
|
+
getNamespacesFromResponse,
|
|
120
128
|
getIdentity,
|
|
121
129
|
consent,
|
|
122
130
|
appendIdentityToUrl,
|
|
123
131
|
logger,
|
|
124
|
-
config
|
|
132
|
+
config,
|
|
133
|
+
getIdentityOptionsValidator
|
|
125
134
|
});
|
|
126
135
|
};
|
|
127
136
|
createIdentity.namespace = "Identity";
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
/*
|
|
2
|
+
Copyright 2020 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
|
+
import ecidNamespace from "../../constants/ecidNamespace.js";
|
|
14
|
+
import coreNamespace from "../../constants/coreNamespace.js";
|
|
15
|
+
export default (({
|
|
16
|
+
thirdPartyCookiesEnabled,
|
|
17
|
+
areThirdPartyCookiesSupportedByDefault
|
|
18
|
+
}) => {
|
|
19
|
+
const query = {
|
|
20
|
+
identity: {
|
|
21
|
+
fetch: [ecidNamespace]
|
|
22
|
+
}
|
|
23
|
+
};
|
|
24
|
+
if (thirdPartyCookiesEnabled && areThirdPartyCookiesSupportedByDefault()) {
|
|
25
|
+
query.identity.fetch.push(coreNamespace);
|
|
26
|
+
}
|
|
27
|
+
return payload => {
|
|
28
|
+
payload.mergeQuery(query);
|
|
29
|
+
};
|
|
30
|
+
});
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/*
|
|
2
|
+
Copyright 2024 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
|
+
export default "CORE";
|
|
@@ -23,7 +23,9 @@ export default (({
|
|
|
23
23
|
* the request body so they can be read by the server.
|
|
24
24
|
*/
|
|
25
25
|
cookiesToPayload(payload, endpointDomain) {
|
|
26
|
-
|
|
26
|
+
// localhost is a special case where the apexDomain is ""
|
|
27
|
+
// We want to treat localhost as a third-party domain.
|
|
28
|
+
const isEndpointFirstParty = apexDomain !== "" && endpointDomain.endsWith(apexDomain);
|
|
27
29
|
const state = {
|
|
28
30
|
domain: apexDomain,
|
|
29
31
|
cookiesEnabled: true
|
|
@@ -231,6 +231,6 @@ const boundString = string.bind(base);
|
|
|
231
231
|
|
|
232
232
|
// compound validators
|
|
233
233
|
const boundEnumOf = function boundEnumOf(...values) {
|
|
234
|
-
return boundAnyOf(values.map(boundLiteral), `one of these values:
|
|
234
|
+
return boundAnyOf(values.map(boundLiteral), `one of these values: ${JSON.stringify(values)}`);
|
|
235
235
|
};
|
|
236
236
|
export { boundAnyOf as anyOf, boundAnything as anything, boundArrayOf as arrayOf, boundBoolean as boolean, boundCallback as callback, boundLiteral as literal, boundNumber as number, boundMapOfValues as mapOfValues, boundObjectOf as objectOf, boundString as string, boundEnumOf as enumOf };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@adobe/alloy",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.23.0-beta.0",
|
|
4
4
|
"description": "Adobe Experience Platform Web SDK",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "libEs5/index.js",
|
|
@@ -43,8 +43,7 @@
|
|
|
43
43
|
"prepare": "husky && cd sandbox && npm install",
|
|
44
44
|
"prepack": "rimraf libEs5 libEs6 && babel src -d libEs5 --env-name npmEs5 && babel src -d libEs6 --env-name npmEs6",
|
|
45
45
|
"checkthattestfilesexist": "./scripts/checkThatTestFilesExist.js",
|
|
46
|
-
"add-license": "./scripts/add-license.js"
|
|
47
|
-
"preinstall": "npx force-resolutions"
|
|
46
|
+
"add-license": "./scripts/add-license.js"
|
|
48
47
|
},
|
|
49
48
|
"lint-staged": {
|
|
50
49
|
"./*.{cjs,mjs,js,jsx}": [
|
|
@@ -95,7 +94,7 @@
|
|
|
95
94
|
"uuid": "^10.0.0"
|
|
96
95
|
},
|
|
97
96
|
"devDependencies": {
|
|
98
|
-
"@adobe/alloy": "^2.22.0
|
|
97
|
+
"@adobe/alloy": "^2.22.0",
|
|
99
98
|
"@babel/cli": "^7.24.8",
|
|
100
99
|
"@babel/plugin-transform-runtime": "^7.24.7",
|
|
101
100
|
"@eslint/js": "^9.9.0",
|
|
@@ -113,7 +112,6 @@
|
|
|
113
112
|
"eslint-plugin-import": "^2.29.1",
|
|
114
113
|
"eslint-plugin-prettier": "^5.2.1",
|
|
115
114
|
"eslint-plugin-testcafe": "^0.2.1",
|
|
116
|
-
"force-resolutions": "^1.0.11",
|
|
117
115
|
"glob": "^11.0.0",
|
|
118
116
|
"globals": "^15.9.0",
|
|
119
117
|
"handlebars": "^4.7.8",
|