@adobe/alloy 2.11.0 → 2.12.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/LibraryInfo/index.js +47 -19
- package/libEs5/constants/cookieNameKey.js +4 -2
- package/libEs5/constants/libraryVersion.js +1 -1
- package/libEs5/core/edgeNetwork/injectGetLocationHint.js +29 -0
- package/libEs5/core/edgeNetwork/injectSendEdgeNetworkRequest.js +5 -2
- package/libEs5/core/index.js +10 -2
- package/libEs6/components/LibraryInfo/index.js +28 -7
- package/libEs6/constants/cookieNameKey.js +2 -1
- package/libEs6/constants/libraryVersion.js +1 -1
- package/libEs6/core/edgeNetwork/injectGetLocationHint.js +20 -0
- package/libEs6/core/edgeNetwork/injectSendEdgeNetworkRequest.js +5 -2
- package/libEs6/core/index.js +11 -2
- package/package.json +2 -2
|
@@ -6,32 +6,60 @@ var _libraryVersion = require("../../constants/libraryVersion");
|
|
|
6
6
|
|
|
7
7
|
var _coreCommands = require("../../constants/coreCommands");
|
|
8
8
|
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
9
|
+
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
10
|
+
|
|
11
|
+
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
12
|
+
|
|
13
|
+
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
14
|
+
|
|
15
|
+
function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
|
|
16
|
+
|
|
17
|
+
function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
18
|
+
|
|
19
|
+
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
20
|
+
|
|
21
|
+
function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
|
|
22
|
+
|
|
23
|
+
function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
|
|
24
|
+
|
|
25
|
+
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
|
|
26
|
+
|
|
27
|
+
var prepareLibraryInfo = function prepareLibraryInfo(_ref) {
|
|
21
28
|
var config = _ref.config,
|
|
22
29
|
componentRegistry = _ref.componentRegistry;
|
|
23
|
-
var allCommands = componentRegistry.getCommandNames();
|
|
24
|
-
|
|
30
|
+
var allCommands = [].concat(_toConsumableArray(componentRegistry.getCommandNames()), [_coreCommands.CONFIGURE, _coreCommands.SET_DEBUG]).sort();
|
|
31
|
+
|
|
32
|
+
var resultConfig = _objectSpread({}, config);
|
|
33
|
+
|
|
34
|
+
Object.keys(config).forEach(function (key) {
|
|
35
|
+
var value = config[key];
|
|
36
|
+
|
|
37
|
+
if (typeof value !== "function") {
|
|
38
|
+
return;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
resultConfig[key] = value.toString();
|
|
42
|
+
});
|
|
43
|
+
return {
|
|
44
|
+
version: _libraryVersion.default,
|
|
45
|
+
configs: resultConfig,
|
|
46
|
+
commands: allCommands
|
|
47
|
+
};
|
|
48
|
+
};
|
|
49
|
+
|
|
50
|
+
var createLibraryInfo = function createLibraryInfo(_ref2) {
|
|
51
|
+
var config = _ref2.config,
|
|
52
|
+
componentRegistry = _ref2.componentRegistry;
|
|
53
|
+
var libraryInfo = prepareLibraryInfo({
|
|
54
|
+
config: config,
|
|
55
|
+
componentRegistry: componentRegistry
|
|
56
|
+
});
|
|
25
57
|
return {
|
|
26
58
|
commands: {
|
|
27
59
|
getLibraryInfo: {
|
|
28
60
|
run: function run() {
|
|
29
61
|
return {
|
|
30
|
-
libraryInfo:
|
|
31
|
-
version: _libraryVersion.default,
|
|
32
|
-
configs: config,
|
|
33
|
-
commands: allCommands.sort()
|
|
34
|
-
}
|
|
62
|
+
libraryInfo: libraryInfo
|
|
35
63
|
};
|
|
36
64
|
}
|
|
37
65
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
exports.IDENTITY = exports.CONSENT = void 0;
|
|
3
|
+
exports.IDENTITY = exports.CONSENT = exports.CLUSTER = void 0;
|
|
4
4
|
|
|
5
5
|
/*
|
|
6
6
|
Copyright 2019 Adobe. All rights reserved.
|
|
@@ -16,4 +16,6 @@ governing permissions and limitations under the License.
|
|
|
16
16
|
var IDENTITY = "identity";
|
|
17
17
|
exports.IDENTITY = IDENTITY;
|
|
18
18
|
var CONSENT = "consent";
|
|
19
|
-
exports.CONSENT = CONSENT;
|
|
19
|
+
exports.CONSENT = CONSENT;
|
|
20
|
+
var CLUSTER = "cluster";
|
|
21
|
+
exports.CLUSTER = CLUSTER;
|
|
@@ -15,5 +15,5 @@ governing permissions and limitations under the License.
|
|
|
15
15
|
*/
|
|
16
16
|
// The __VERSION__ keyword will be replace at alloy build time with the package.json version.
|
|
17
17
|
// see babel-plugin-version
|
|
18
|
-
var _default = "2.
|
|
18
|
+
var _default = "2.12.0-beta.0";
|
|
19
19
|
exports.default = _default;
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
exports.default = void 0;
|
|
4
|
+
|
|
5
|
+
var _utils = require("../../utils");
|
|
6
|
+
|
|
7
|
+
var _cookieNameKey = require("../../constants/cookieNameKey");
|
|
8
|
+
|
|
9
|
+
/*
|
|
10
|
+
Copyright 2022 Adobe. All rights reserved.
|
|
11
|
+
This file is licensed to you under the Apache License, Version 2.0 (the "License");
|
|
12
|
+
you may not use this file except in compliance with the License. You may obtain a copy
|
|
13
|
+
of the License at http://www.apache.org/licenses/LICENSE-2.0
|
|
14
|
+
|
|
15
|
+
Unless required by applicable law or agreed to in writing, software distributed under
|
|
16
|
+
the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
|
|
17
|
+
OF ANY KIND, either express or implied. See the License for the specific language
|
|
18
|
+
governing permissions and limitations under the License.
|
|
19
|
+
*/
|
|
20
|
+
var _default = function _default(_ref) {
|
|
21
|
+
var orgId = _ref.orgId,
|
|
22
|
+
cookieJar = _ref.cookieJar;
|
|
23
|
+
var clusterCookieName = (0, _utils.getNamespacedCookieName)(orgId, _cookieNameKey.CLUSTER);
|
|
24
|
+
return function () {
|
|
25
|
+
return cookieJar.get(clusterCookieName);
|
|
26
|
+
};
|
|
27
|
+
};
|
|
28
|
+
|
|
29
|
+
exports.default = _default;
|
|
@@ -26,7 +26,8 @@ var _default = function _default(_ref) {
|
|
|
26
26
|
cookieTransfer = _ref.cookieTransfer,
|
|
27
27
|
sendNetworkRequest = _ref.sendNetworkRequest,
|
|
28
28
|
createResponse = _ref.createResponse,
|
|
29
|
-
processWarningsAndErrors = _ref.processWarningsAndErrors
|
|
29
|
+
processWarningsAndErrors = _ref.processWarningsAndErrors,
|
|
30
|
+
getLocationHint = _ref.getLocationHint;
|
|
30
31
|
var edgeDomain = config.edgeDomain,
|
|
31
32
|
edgeBasePath = config.edgeBasePath,
|
|
32
33
|
edgeConfigId = config.edgeConfigId;
|
|
@@ -53,7 +54,9 @@ var _default = function _default(_ref) {
|
|
|
53
54
|
onRequestFailure: onRequestFailureCallbackAggregator.add
|
|
54
55
|
}).then(function () {
|
|
55
56
|
var endpointDomain = request.getUseIdThirdPartyDomain() ? _domain.ID_THIRD_PARTY : edgeDomain;
|
|
56
|
-
var
|
|
57
|
+
var locationHint = getLocationHint();
|
|
58
|
+
var edgeBasePathWithLocationHint = locationHint ? edgeBasePath + "/" + locationHint : edgeBasePath;
|
|
59
|
+
var url = "https://" + endpointDomain + "/" + edgeBasePathWithLocationHint + "/" + _apiVersion.default + "/" + request.getAction() + "?configId=" + edgeConfigId + "&requestId=" + request.getId();
|
|
57
60
|
cookieTransfer.cookiesToPayload(request.getPayload(), endpointDomain);
|
|
58
61
|
return sendNetworkRequest({
|
|
59
62
|
requestId: request.getId(),
|
package/libEs5/core/index.js
CHANGED
|
@@ -58,6 +58,8 @@ var _injectSendEdgeNetworkRequest = require("./edgeNetwork/injectSendEdgeNetwork
|
|
|
58
58
|
|
|
59
59
|
var _injectProcessWarningsAndErrors = require("./edgeNetwork/injectProcessWarningsAndErrors");
|
|
60
60
|
|
|
61
|
+
var _injectGetLocationHint = require("./edgeNetwork/injectGetLocationHint");
|
|
62
|
+
|
|
61
63
|
var _isRequestRetryable = require("./network/isRequestRetryable");
|
|
62
64
|
|
|
63
65
|
var _getRequestRetryDelay = require("./network/getRequestRetryDelay");
|
|
@@ -123,9 +125,10 @@ var createExecuteCommand = function createExecuteCommand(_ref) {
|
|
|
123
125
|
logger: logger,
|
|
124
126
|
setDebugEnabled: setDebugEnabled
|
|
125
127
|
});
|
|
128
|
+
var orgId = config.orgId;
|
|
126
129
|
var cookieTransfer = (0, _createCookieTransfer.default)({
|
|
127
130
|
cookieJar: loggingCookieJar,
|
|
128
|
-
orgId:
|
|
131
|
+
orgId: orgId,
|
|
129
132
|
apexDomain: apexDomain,
|
|
130
133
|
dateProvider: function dateProvider() {
|
|
131
134
|
return new Date();
|
|
@@ -154,13 +157,18 @@ var createExecuteCommand = function createExecuteCommand(_ref) {
|
|
|
154
157
|
var createResponse = (0, _injectCreateResponse.default)({
|
|
155
158
|
extractEdgeInfo: extractEdgeInfo
|
|
156
159
|
});
|
|
160
|
+
var getLocationHint = (0, _injectGetLocationHint.default)({
|
|
161
|
+
orgId: orgId,
|
|
162
|
+
cookieJar: _utils.cookieJar
|
|
163
|
+
});
|
|
157
164
|
var sendEdgeNetworkRequest = (0, _injectSendEdgeNetworkRequest.default)({
|
|
158
165
|
config: config,
|
|
159
166
|
lifecycle: lifecycle,
|
|
160
167
|
cookieTransfer: cookieTransfer,
|
|
161
168
|
sendNetworkRequest: sendNetworkRequest,
|
|
162
169
|
createResponse: createResponse,
|
|
163
|
-
processWarningsAndErrors: processWarningsAndErrors
|
|
170
|
+
processWarningsAndErrors: processWarningsAndErrors,
|
|
171
|
+
getLocationHint: getLocationHint
|
|
164
172
|
});
|
|
165
173
|
var generalConsentState = (0, _createConsentStateMachine.default)({
|
|
166
174
|
logger: logger
|
|
@@ -12,22 +12,43 @@ governing permissions and limitations under the License.
|
|
|
12
12
|
import libraryVersion from "../../constants/libraryVersion";
|
|
13
13
|
import { CONFIGURE, SET_DEBUG } from "../../constants/coreCommands";
|
|
14
14
|
|
|
15
|
+
const prepareLibraryInfo = ({
|
|
16
|
+
config,
|
|
17
|
+
componentRegistry
|
|
18
|
+
}) => {
|
|
19
|
+
const allCommands = [...componentRegistry.getCommandNames(), CONFIGURE, SET_DEBUG].sort();
|
|
20
|
+
const resultConfig = { ...config
|
|
21
|
+
};
|
|
22
|
+
Object.keys(config).forEach(key => {
|
|
23
|
+
const value = config[key];
|
|
24
|
+
|
|
25
|
+
if (typeof value !== "function") {
|
|
26
|
+
return;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
resultConfig[key] = value.toString();
|
|
30
|
+
});
|
|
31
|
+
return {
|
|
32
|
+
version: libraryVersion,
|
|
33
|
+
configs: resultConfig,
|
|
34
|
+
commands: allCommands
|
|
35
|
+
};
|
|
36
|
+
};
|
|
37
|
+
|
|
15
38
|
const createLibraryInfo = ({
|
|
16
39
|
config,
|
|
17
40
|
componentRegistry
|
|
18
41
|
}) => {
|
|
19
|
-
const
|
|
20
|
-
|
|
42
|
+
const libraryInfo = prepareLibraryInfo({
|
|
43
|
+
config,
|
|
44
|
+
componentRegistry
|
|
45
|
+
});
|
|
21
46
|
return {
|
|
22
47
|
commands: {
|
|
23
48
|
getLibraryInfo: {
|
|
24
49
|
run: () => {
|
|
25
50
|
return {
|
|
26
|
-
libraryInfo
|
|
27
|
-
version: libraryVersion,
|
|
28
|
-
configs: config,
|
|
29
|
-
commands: allCommands.sort()
|
|
30
|
-
}
|
|
51
|
+
libraryInfo
|
|
31
52
|
};
|
|
32
53
|
}
|
|
33
54
|
}
|
|
@@ -10,4 +10,5 @@ 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
|
export const IDENTITY = "identity";
|
|
13
|
-
export const CONSENT = "consent";
|
|
13
|
+
export const CONSENT = "consent";
|
|
14
|
+
export const CLUSTER = "cluster";
|
|
@@ -0,0 +1,20 @@
|
|
|
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 { getNamespacedCookieName } from "../../utils";
|
|
13
|
+
import { CLUSTER } from "../../constants/cookieNameKey";
|
|
14
|
+
export default (({
|
|
15
|
+
orgId,
|
|
16
|
+
cookieJar
|
|
17
|
+
}) => {
|
|
18
|
+
const clusterCookieName = getNamespacedCookieName(orgId, CLUSTER);
|
|
19
|
+
return () => cookieJar.get(clusterCookieName);
|
|
20
|
+
});
|
|
@@ -18,7 +18,8 @@ export default (({
|
|
|
18
18
|
cookieTransfer,
|
|
19
19
|
sendNetworkRequest,
|
|
20
20
|
createResponse,
|
|
21
|
-
processWarningsAndErrors
|
|
21
|
+
processWarningsAndErrors,
|
|
22
|
+
getLocationHint
|
|
22
23
|
}) => {
|
|
23
24
|
const {
|
|
24
25
|
edgeDomain,
|
|
@@ -47,7 +48,9 @@ export default (({
|
|
|
47
48
|
onRequestFailure: onRequestFailureCallbackAggregator.add
|
|
48
49
|
}).then(() => {
|
|
49
50
|
const endpointDomain = request.getUseIdThirdPartyDomain() ? ID_THIRD_PARTY_DOMAIN : edgeDomain;
|
|
50
|
-
const
|
|
51
|
+
const locationHint = getLocationHint();
|
|
52
|
+
const edgeBasePathWithLocationHint = locationHint ? `${edgeBasePath}/${locationHint}` : edgeBasePath;
|
|
53
|
+
const url = `https://${endpointDomain}/${edgeBasePathWithLocationHint}/${apiVersion}/${request.getAction()}?configId=${edgeConfigId}&requestId=${request.getId()}`;
|
|
51
54
|
cookieTransfer.cookiesToPayload(request.getPayload(), endpointDomain);
|
|
52
55
|
return sendNetworkRequest({
|
|
53
56
|
requestId: request.getId(),
|
package/libEs6/core/index.js
CHANGED
|
@@ -37,6 +37,7 @@ import createCookieTransfer from "./createCookieTransfer";
|
|
|
37
37
|
import { createDataCollectionRequest, createDataCollectionRequestPayload } from "../utils/request";
|
|
38
38
|
import injectSendEdgeNetworkRequest from "./edgeNetwork/injectSendEdgeNetworkRequest";
|
|
39
39
|
import injectProcessWarningsAndErrors from "./edgeNetwork/injectProcessWarningsAndErrors";
|
|
40
|
+
import injectGetLocationHint from "./edgeNetwork/injectGetLocationHint";
|
|
40
41
|
import isRequestRetryable from "./network/isRequestRetryable";
|
|
41
42
|
import getRequestRetryDelay from "./network/getRequestRetryDelay";
|
|
42
43
|
const createNamespacedStorage = injectStorage(window);
|
|
@@ -89,9 +90,12 @@ export const createExecuteCommand = ({
|
|
|
89
90
|
logger,
|
|
90
91
|
setDebugEnabled
|
|
91
92
|
});
|
|
93
|
+
const {
|
|
94
|
+
orgId
|
|
95
|
+
} = config;
|
|
92
96
|
const cookieTransfer = createCookieTransfer({
|
|
93
97
|
cookieJar: loggingCookieJar,
|
|
94
|
-
orgId
|
|
98
|
+
orgId,
|
|
95
99
|
apexDomain,
|
|
96
100
|
dateProvider: () => new Date()
|
|
97
101
|
});
|
|
@@ -118,13 +122,18 @@ export const createExecuteCommand = ({
|
|
|
118
122
|
const createResponse = injectCreateResponse({
|
|
119
123
|
extractEdgeInfo
|
|
120
124
|
});
|
|
125
|
+
const getLocationHint = injectGetLocationHint({
|
|
126
|
+
orgId,
|
|
127
|
+
cookieJar
|
|
128
|
+
});
|
|
121
129
|
const sendEdgeNetworkRequest = injectSendEdgeNetworkRequest({
|
|
122
130
|
config,
|
|
123
131
|
lifecycle,
|
|
124
132
|
cookieTransfer,
|
|
125
133
|
sendNetworkRequest,
|
|
126
134
|
createResponse,
|
|
127
|
-
processWarningsAndErrors
|
|
135
|
+
processWarningsAndErrors,
|
|
136
|
+
getLocationHint
|
|
128
137
|
});
|
|
129
138
|
const generalConsentState = createConsentStateMachine({
|
|
130
139
|
logger
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@adobe/alloy",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.12.0-beta.0",
|
|
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.11.0
|
|
67
|
+
"@adobe/alloy": "^2.11.0",
|
|
68
68
|
"@babel/cli": "^7.12.8",
|
|
69
69
|
"@babel/core": "^7.2.2",
|
|
70
70
|
"@babel/plugin-proposal-object-rest-spread": "^7.3.2",
|