@adobe/alloy 2.19.1 → 2.19.2-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/index.js +2 -1
- package/libEs5/components/Identity/injectAddQueryStringIdentityToPayload.js +4 -0
- package/libEs5/components/Identity/injectAwaitIdentityCookie.js +7 -11
- package/libEs5/components/Identity/injectEnsureSingleIdentity.js +6 -3
- package/libEs5/components/Personalization/createFetchDataHandler.js +4 -1
- package/libEs5/components/Personalization/createNotificationHandler.js +8 -2
- package/libEs5/components/Personalization/createOnDecisionHandler.js +1 -1
- package/libEs5/constants/libraryVersion.js +1 -1
- package/libEs6/components/Identity/index.js +2 -1
- package/libEs6/components/Identity/injectAddQueryStringIdentityToPayload.js +5 -1
- package/libEs6/components/Identity/injectAwaitIdentityCookie.js +7 -11
- package/libEs6/components/Identity/injectEnsureSingleIdentity.js +4 -3
- package/libEs6/components/Personalization/createFetchDataHandler.js +4 -1
- package/libEs6/components/Personalization/createNotificationHandler.js +6 -2
- package/libEs6/components/Personalization/createOnDecisionHandler.js +1 -1
- package/libEs6/constants/libraryVersion.js +1 -1
- package/package.json +8 -3
- package/libEs5/utils/debounce.js +0 -30
- package/libEs6/utils/debounce.js +0 -22
|
@@ -86,7 +86,8 @@ var createIdentity = function createIdentity(_ref) {
|
|
|
86
86
|
});
|
|
87
87
|
var awaitIdentityCookie = (0, _injectAwaitIdentityCookie.default)({
|
|
88
88
|
doesIdentityCookieExist: doesIdentityCookieExist,
|
|
89
|
-
orgId: orgId
|
|
89
|
+
orgId: orgId,
|
|
90
|
+
logger: logger
|
|
90
91
|
});
|
|
91
92
|
var ensureSingleIdentity = (0, _injectEnsureSingleIdentity.default)({
|
|
92
93
|
doesIdentityCookieExist: doesIdentityCookieExist,
|
|
@@ -37,6 +37,10 @@ var _default = function _default(_ref) {
|
|
|
37
37
|
if (queryStringValue === undefined) {
|
|
38
38
|
return;
|
|
39
39
|
}
|
|
40
|
+
if (Array.isArray(queryStringValue)) {
|
|
41
|
+
logger.warn("Found multiple adobe_mc query string paramters, only using the last one.");
|
|
42
|
+
queryStringValue = queryStringValue[queryStringValue.length - 1];
|
|
43
|
+
}
|
|
40
44
|
var properties = queryStringValue.split("|").reduce(function (memo, keyValue) {
|
|
41
45
|
var _keyValue$split = keyValue.split("="),
|
|
42
46
|
_keyValue$split2 = _slicedToArray(_keyValue$split, 2),
|
|
@@ -14,7 +14,8 @@ governing permissions and limitations under the License.
|
|
|
14
14
|
*/
|
|
15
15
|
var _default = function _default(_ref) {
|
|
16
16
|
var doesIdentityCookieExist = _ref.doesIdentityCookieExist,
|
|
17
|
-
orgId = _ref.orgId
|
|
17
|
+
orgId = _ref.orgId,
|
|
18
|
+
logger = _ref.logger;
|
|
18
19
|
/**
|
|
19
20
|
* Returns a promise that will be resolved once an identity cookie exists.
|
|
20
21
|
* If an identity cookie doesn't already exist, it should always exist after
|
|
@@ -30,16 +31,11 @@ var _default = function _default(_ref) {
|
|
|
30
31
|
} else {
|
|
31
32
|
// This logic assumes that the code setting the cookie is working as expected and that
|
|
32
33
|
// the cookie was missing from the response.
|
|
33
|
-
|
|
34
|
+
logger.warn("Identity cookie not found. This could be caused by any of the following issues:\n" + ("\t* The org ID " + orgId + " configured in Alloy doesn't match the org ID specified in the edge configuration.\n") + "\t* Experience edge was not able to set the identity cookie due to domain or cookie restrictions.\n" + "\t* The request was canceled by the browser and not fully processed.");
|
|
34
35
|
|
|
35
|
-
// Rejecting the promise will
|
|
36
|
-
//
|
|
37
|
-
|
|
38
|
-
reject(noIdentityCookieError);
|
|
39
|
-
|
|
40
|
-
// Throwing an error will reject the event command that initiated
|
|
41
|
-
// the request.
|
|
42
|
-
throw noIdentityCookieError;
|
|
36
|
+
// Rejecting the promise will tell queued events to still go out
|
|
37
|
+
// one at a time.
|
|
38
|
+
reject(new Error("Identity cookie not found."));
|
|
43
39
|
}
|
|
44
40
|
});
|
|
45
41
|
onRequestFailure(function () {
|
|
@@ -48,7 +44,7 @@ var _default = function _default(_ref) {
|
|
|
48
44
|
} else {
|
|
49
45
|
// The error from the request failure will be logged separately. Rejecting this here
|
|
50
46
|
// will tell ensureSingleIdentity to send the next request without identity
|
|
51
|
-
reject(new Error("
|
|
47
|
+
reject(new Error("Identity cookie not found."));
|
|
52
48
|
}
|
|
53
49
|
});
|
|
54
50
|
});
|
|
@@ -55,9 +55,8 @@ var _default = function _default(_ref) {
|
|
|
55
55
|
if (obtainedIdentityPromise) {
|
|
56
56
|
// We don't have an identity cookie, but at least one request has
|
|
57
57
|
// been sent to get it. Konductor may set the identity cookie in the
|
|
58
|
-
// response. We will hold up this request until the
|
|
59
|
-
//
|
|
60
|
-
// identity was set.
|
|
58
|
+
// response. We will hold up this request until the previous request
|
|
59
|
+
// returns and awaitIdentityCookie confirms the identity was set.
|
|
61
60
|
logger.info("Delaying request while retrieving ECID from server.");
|
|
62
61
|
var previousObtainedIdentityPromise = obtainedIdentityPromise;
|
|
63
62
|
|
|
@@ -92,6 +91,10 @@ var _default = function _default(_ref) {
|
|
|
92
91
|
onResponse: onResponse,
|
|
93
92
|
onRequestFailure: onRequestFailure
|
|
94
93
|
});
|
|
94
|
+
// This prevents an un-caught promise in the console when the identity isn't set.
|
|
95
|
+
obtainedIdentityPromise.catch(function () {
|
|
96
|
+
return undefined;
|
|
97
|
+
});
|
|
95
98
|
return allowRequestToGoWithoutIdentity(request);
|
|
96
99
|
};
|
|
97
100
|
};
|
|
@@ -38,7 +38,10 @@ var _default = function _default(_ref) {
|
|
|
38
38
|
showContainers();
|
|
39
39
|
}
|
|
40
40
|
mergeQuery(event, personalizationDetails.createQueryDetails());
|
|
41
|
-
|
|
41
|
+
|
|
42
|
+
// This needs to be called before the response so that future sendEvent calls
|
|
43
|
+
// can know to wait until this request is complete for pending display notifications.
|
|
44
|
+
var handleNotifications = notificationHandler(personalizationDetails.isRenderDecisions(), personalizationDetails.isSendDisplayEvent(), personalizationDetails.getViewName());
|
|
42
45
|
onResponse(function (_ref3) {
|
|
43
46
|
var response = _ref3.response;
|
|
44
47
|
var handles = response.getPayloadsByType(DECISIONS_HANDLE);
|
|
@@ -14,8 +14,14 @@ OF ANY KIND, either express or implied. See the License for the specific languag
|
|
|
14
14
|
governing permissions and limitations under the License.
|
|
15
15
|
*/
|
|
16
16
|
var _default = function _default(collect, renderedPropositions) {
|
|
17
|
-
return function (
|
|
18
|
-
if (!
|
|
17
|
+
return function (isRenderDecisions, isSendDisplayEvent, viewName) {
|
|
18
|
+
if (!isRenderDecisions) {
|
|
19
|
+
// If we aren't rendering anything, then we don't need to sendDisplayEvents.
|
|
20
|
+
return function () {
|
|
21
|
+
return undefined;
|
|
22
|
+
};
|
|
23
|
+
}
|
|
24
|
+
if (!isSendDisplayEvent) {
|
|
19
25
|
var renderedPropositionsDeferred = (0, _utils.defer)();
|
|
20
26
|
renderedPropositions.concat(renderedPropositionsDeferred.promise);
|
|
21
27
|
return renderedPropositionsDeferred.resolve;
|
|
@@ -34,7 +34,7 @@ var _default = function _default(_ref) {
|
|
|
34
34
|
var _processPropositions = processPropositions(propositionsToExecute),
|
|
35
35
|
render = _processPropositions.render,
|
|
36
36
|
returnedPropositions = _processPropositions.returnedPropositions;
|
|
37
|
-
var handleNotifications = notificationHandler(sendDisplayEvent, viewName);
|
|
37
|
+
var handleNotifications = notificationHandler(renderDecisions, sendDisplayEvent, viewName);
|
|
38
38
|
render().then(handleNotifications);
|
|
39
39
|
return Promise.resolve({
|
|
40
40
|
propositions: returnedPropositions
|
|
@@ -14,5 +14,5 @@ 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 = "2.19.
|
|
17
|
+
var _default = "2.19.2-beta.0";
|
|
18
18
|
exports.default = _default;
|
|
@@ -28,10 +28,14 @@ export default (({
|
|
|
28
28
|
return;
|
|
29
29
|
}
|
|
30
30
|
const parsedQueryString = queryString.parse(locationSearch);
|
|
31
|
-
|
|
31
|
+
let queryStringValue = parsedQueryString[queryStringIdentityParam];
|
|
32
32
|
if (queryStringValue === undefined) {
|
|
33
33
|
return;
|
|
34
34
|
}
|
|
35
|
+
if (Array.isArray(queryStringValue)) {
|
|
36
|
+
logger.warn("Found multiple adobe_mc query string paramters, only using the last one.");
|
|
37
|
+
queryStringValue = queryStringValue[queryStringValue.length - 1];
|
|
38
|
+
}
|
|
35
39
|
const properties = queryStringValue.split("|").reduce((memo, keyValue) => {
|
|
36
40
|
const [key, value] = keyValue.split("=");
|
|
37
41
|
memo[key] = value;
|
|
@@ -12,7 +12,8 @@ governing permissions and limitations under the License.
|
|
|
12
12
|
|
|
13
13
|
export default (({
|
|
14
14
|
doesIdentityCookieExist,
|
|
15
|
-
orgId
|
|
15
|
+
orgId,
|
|
16
|
+
logger
|
|
16
17
|
}) => {
|
|
17
18
|
/**
|
|
18
19
|
* Returns a promise that will be resolved once an identity cookie exists.
|
|
@@ -30,16 +31,11 @@ export default (({
|
|
|
30
31
|
} else {
|
|
31
32
|
// This logic assumes that the code setting the cookie is working as expected and that
|
|
32
33
|
// the cookie was missing from the response.
|
|
33
|
-
|
|
34
|
+
logger.warn(`Identity cookie not found. This could be caused by any of the following issues:\n` + `\t* The org ID ${orgId} configured in Alloy doesn't match the org ID specified in the edge configuration.\n` + `\t* Experience edge was not able to set the identity cookie due to domain or cookie restrictions.\n` + `\t* The request was canceled by the browser and not fully processed.`);
|
|
34
35
|
|
|
35
|
-
// Rejecting the promise will
|
|
36
|
-
//
|
|
37
|
-
|
|
38
|
-
reject(noIdentityCookieError);
|
|
39
|
-
|
|
40
|
-
// Throwing an error will reject the event command that initiated
|
|
41
|
-
// the request.
|
|
42
|
-
throw noIdentityCookieError;
|
|
36
|
+
// Rejecting the promise will tell queued events to still go out
|
|
37
|
+
// one at a time.
|
|
38
|
+
reject(new Error("Identity cookie not found."));
|
|
43
39
|
}
|
|
44
40
|
});
|
|
45
41
|
onRequestFailure(() => {
|
|
@@ -48,7 +44,7 @@ export default (({
|
|
|
48
44
|
} else {
|
|
49
45
|
// The error from the request failure will be logged separately. Rejecting this here
|
|
50
46
|
// will tell ensureSingleIdentity to send the next request without identity
|
|
51
|
-
reject(new Error("
|
|
47
|
+
reject(new Error("Identity cookie not found."));
|
|
52
48
|
}
|
|
53
49
|
});
|
|
54
50
|
});
|
|
@@ -55,9 +55,8 @@ export default (({
|
|
|
55
55
|
if (obtainedIdentityPromise) {
|
|
56
56
|
// We don't have an identity cookie, but at least one request has
|
|
57
57
|
// been sent to get it. Konductor may set the identity cookie in the
|
|
58
|
-
// response. We will hold up this request until the
|
|
59
|
-
//
|
|
60
|
-
// identity was set.
|
|
58
|
+
// response. We will hold up this request until the previous request
|
|
59
|
+
// returns and awaitIdentityCookie confirms the identity was set.
|
|
61
60
|
logger.info("Delaying request while retrieving ECID from server.");
|
|
62
61
|
const previousObtainedIdentityPromise = obtainedIdentityPromise;
|
|
63
62
|
|
|
@@ -92,6 +91,8 @@ export default (({
|
|
|
92
91
|
onResponse,
|
|
93
92
|
onRequestFailure
|
|
94
93
|
});
|
|
94
|
+
// This prevents an un-caught promise in the console when the identity isn't set.
|
|
95
|
+
obtainedIdentityPromise.catch(() => undefined);
|
|
95
96
|
return allowRequestToGoWithoutIdentity(request);
|
|
96
97
|
};
|
|
97
98
|
});
|
|
@@ -32,7 +32,10 @@ export default (({
|
|
|
32
32
|
showContainers();
|
|
33
33
|
}
|
|
34
34
|
mergeQuery(event, personalizationDetails.createQueryDetails());
|
|
35
|
-
|
|
35
|
+
|
|
36
|
+
// This needs to be called before the response so that future sendEvent calls
|
|
37
|
+
// can know to wait until this request is complete for pending display notifications.
|
|
38
|
+
const handleNotifications = notificationHandler(personalizationDetails.isRenderDecisions(), personalizationDetails.isSendDisplayEvent(), personalizationDetails.getViewName());
|
|
36
39
|
onResponse(({
|
|
37
40
|
response
|
|
38
41
|
}) => {
|
|
@@ -11,8 +11,12 @@ governing permissions and limitations under the License.
|
|
|
11
11
|
*/
|
|
12
12
|
import { defer } from "../../utils";
|
|
13
13
|
export default ((collect, renderedPropositions) => {
|
|
14
|
-
return (
|
|
15
|
-
if (!
|
|
14
|
+
return (isRenderDecisions, isSendDisplayEvent, viewName) => {
|
|
15
|
+
if (!isRenderDecisions) {
|
|
16
|
+
// If we aren't rendering anything, then we don't need to sendDisplayEvents.
|
|
17
|
+
return () => undefined;
|
|
18
|
+
}
|
|
19
|
+
if (!isSendDisplayEvent) {
|
|
16
20
|
const renderedPropositionsDeferred = defer();
|
|
17
21
|
renderedPropositions.concat(renderedPropositionsDeferred.promise);
|
|
18
22
|
return renderedPropositionsDeferred.resolve;
|
|
@@ -33,7 +33,7 @@ export default (({
|
|
|
33
33
|
render,
|
|
34
34
|
returnedPropositions
|
|
35
35
|
} = processPropositions(propositionsToExecute);
|
|
36
|
-
const handleNotifications = notificationHandler(sendDisplayEvent, viewName);
|
|
36
|
+
const handleNotifications = notificationHandler(renderDecisions, sendDisplayEvent, viewName);
|
|
37
37
|
render().then(handleNotifications);
|
|
38
38
|
return Promise.resolve({
|
|
39
39
|
propositions: returnedPropositions
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@adobe/alloy",
|
|
3
|
-
"version": "2.19.
|
|
3
|
+
"version": "2.19.2-beta.0",
|
|
4
4
|
"description": "Adobe Experience Platform Web SDK",
|
|
5
5
|
"main": "libEs5/index.js",
|
|
6
6
|
"module": "libEs6/index.js",
|
|
@@ -31,7 +31,8 @@
|
|
|
31
31
|
"prepare": "husky install && cd sandbox && npm install",
|
|
32
32
|
"prepublishOnly": "rimraf libEs5 libEs6 && babel src -d libEs5 --env-name npmEs5 && babel src -d libEs6 --env-name npmEs6",
|
|
33
33
|
"checkthattestfilesexist": "./scripts/checkThatTestFilesExist.js",
|
|
34
|
-
"add-license": "./scripts/add-license.js"
|
|
34
|
+
"add-license": "./scripts/add-license.js",
|
|
35
|
+
"preinstall": "npx force-resolutions"
|
|
35
36
|
},
|
|
36
37
|
"lint-staged": {
|
|
37
38
|
"./*.js": [
|
|
@@ -70,7 +71,7 @@
|
|
|
70
71
|
"uuid": "^3.3.2"
|
|
71
72
|
},
|
|
72
73
|
"devDependencies": {
|
|
73
|
-
"@adobe/alloy": "^2.19.1
|
|
74
|
+
"@adobe/alloy": "^2.19.1",
|
|
74
75
|
"@babel/cli": "^7.12.8",
|
|
75
76
|
"@babel/core": "^7.2.2",
|
|
76
77
|
"@babel/plugin-proposal-object-rest-spread": "^7.3.2",
|
|
@@ -91,6 +92,7 @@
|
|
|
91
92
|
"eslint-plugin-import": "^2.28.1",
|
|
92
93
|
"eslint-plugin-prettier": "^3.0.1",
|
|
93
94
|
"eslint-plugin-testcafe": "^0.2.1",
|
|
95
|
+
"force-resolutions": "^1.0.11",
|
|
94
96
|
"glob": "^7.1.3",
|
|
95
97
|
"handlebars": "^4.7.7",
|
|
96
98
|
"husky": "^6.0.0",
|
|
@@ -134,5 +136,8 @@
|
|
|
134
136
|
"url-exists-nodejs": "^0.1.0",
|
|
135
137
|
"url-parse": "^1.4.7",
|
|
136
138
|
"yargs": "^16.2.0"
|
|
139
|
+
},
|
|
140
|
+
"resolutions": {
|
|
141
|
+
"webdriverio": "^7.19.5"
|
|
137
142
|
}
|
|
138
143
|
}
|
package/libEs5/utils/debounce.js
DELETED
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
exports.default = void 0;
|
|
4
|
-
/*
|
|
5
|
-
Copyright 2023 Adobe. All rights reserved.
|
|
6
|
-
This file is licensed to you under the Apache License, Version 2.0 (the "License");
|
|
7
|
-
you may not use this file except in compliance with the License. You may obtain a copy
|
|
8
|
-
of the License at http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
-
|
|
10
|
-
Unless required by applicable law or agreed to in writing, software distributed under
|
|
11
|
-
the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
|
|
12
|
-
OF ANY KIND, either express or implied. See the License for the specific language
|
|
13
|
-
governing permissions and limitations under the License.
|
|
14
|
-
*/
|
|
15
|
-
var _default = function _default(fn) {
|
|
16
|
-
var delay = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 150;
|
|
17
|
-
var timer;
|
|
18
|
-
return function () {
|
|
19
|
-
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
20
|
-
args[_key] = arguments[_key];
|
|
21
|
-
}
|
|
22
|
-
if (timer) {
|
|
23
|
-
clearTimeout(timer);
|
|
24
|
-
}
|
|
25
|
-
timer = setTimeout(function () {
|
|
26
|
-
fn.apply(void 0, args);
|
|
27
|
-
}, delay);
|
|
28
|
-
};
|
|
29
|
-
};
|
|
30
|
-
exports.default = _default;
|
package/libEs6/utils/debounce.js
DELETED
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
Copyright 2023 Adobe. All rights reserved.
|
|
3
|
-
This file is licensed to you under the Apache License, Version 2.0 (the "License");
|
|
4
|
-
you may not use this file except in compliance with the License. You may obtain a copy
|
|
5
|
-
of the License at http://www.apache.org/licenses/LICENSE-2.0
|
|
6
|
-
|
|
7
|
-
Unless required by applicable law or agreed to in writing, software distributed under
|
|
8
|
-
the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
|
|
9
|
-
OF ANY KIND, either express or implied. See the License for the specific language
|
|
10
|
-
governing permissions and limitations under the License.
|
|
11
|
-
*/
|
|
12
|
-
export default ((fn, delay = 150) => {
|
|
13
|
-
let timer;
|
|
14
|
-
return (...args) => {
|
|
15
|
-
if (timer) {
|
|
16
|
-
clearTimeout(timer);
|
|
17
|
-
}
|
|
18
|
-
timer = setTimeout(() => {
|
|
19
|
-
fn(...args);
|
|
20
|
-
}, delay);
|
|
21
|
-
};
|
|
22
|
-
});
|