@adobe/alloy 2.11.0-alpha.1 → 2.11.0-alpha.4
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/injectPlaceContext.js +7 -2
- package/libEs5/components/Identity/appendIdentityToUrl/injectAppendIdentityToUrl.js +1 -1
- package/libEs5/components/Identity/configValidators.js +1 -2
- package/libEs5/components/Identity/index.js +2 -4
- package/libEs5/components/Identity/injectAddQueryStringIdentityToPayload.js +2 -11
- package/libEs5/constants/libraryVersion.js +1 -1
- package/libEs5/utils/index.js +8 -0
- package/libEs5/utils/toISOStringLocal.js +3 -1
- package/libEs5/utils/toInteger.js +26 -0
- package/libEs6/components/Context/injectPlaceContext.js +8 -3
- package/libEs6/components/Identity/appendIdentityToUrl/injectAppendIdentityToUrl.js +1 -1
- package/libEs6/components/Identity/configValidators.js +1 -2
- package/libEs6/components/Identity/index.js +2 -4
- package/libEs6/components/Identity/injectAddQueryStringIdentityToPayload.js +2 -11
- package/libEs6/constants/libraryVersion.js +1 -1
- package/libEs6/utils/index.js +1 -0
- package/libEs6/utils/toISOStringLocal.js +2 -1
- package/libEs6/utils/toInteger.js +20 -0
- package/package.json +2 -2
|
@@ -19,9 +19,14 @@ var _default = function _default(dateProvider) {
|
|
|
19
19
|
return function (xdm) {
|
|
20
20
|
var date = dateProvider();
|
|
21
21
|
var placeContext = {
|
|
22
|
-
localTime: (0, _utils.toISOStringLocal)(date)
|
|
23
|
-
localTimezoneOffset: date.getTimezoneOffset()
|
|
22
|
+
localTime: (0, _utils.toISOStringLocal)(date)
|
|
24
23
|
};
|
|
24
|
+
var localTimezoneOffset = (0, _utils.toInteger)(date.getTimezoneOffset());
|
|
25
|
+
|
|
26
|
+
if (localTimezoneOffset !== undefined) {
|
|
27
|
+
placeContext.localTimezoneOffset = localTimezoneOffset;
|
|
28
|
+
}
|
|
29
|
+
|
|
25
30
|
(0, _utils.deepAssign)(xdm, {
|
|
26
31
|
placeContext: placeContext
|
|
27
32
|
});
|
|
@@ -44,7 +44,7 @@ var _default = function _default(_ref) {
|
|
|
44
44
|
orgId = _ref.orgId;
|
|
45
45
|
return function (ecid, url) {
|
|
46
46
|
var ts = Math.round(dateProvider().getTime() / 1000);
|
|
47
|
-
var adobemc = encodeURIComponent("TS=" + ts + "|MCMID=" + ecid + "|MCORGID=" + orgId);
|
|
47
|
+
var adobemc = encodeURIComponent("TS=" + ts + "|MCMID=" + ecid + "|MCORGID=" + encodeURIComponent(orgId));
|
|
48
48
|
|
|
49
49
|
var _url$match = url.match(URL_REGEX),
|
|
50
50
|
_url$match2 = _slicedToArray(_url$match, 4),
|
|
@@ -17,8 +17,7 @@ governing permissions and limitations under the License.
|
|
|
17
17
|
*/
|
|
18
18
|
var configValidators = {
|
|
19
19
|
thirdPartyCookiesEnabled: (0, _validation.boolean)().default(true),
|
|
20
|
-
idMigrationEnabled: (0, _validation.boolean)().default(true)
|
|
21
|
-
idOverwriteEnabled: (0, _validation.boolean)().default(false)
|
|
20
|
+
idMigrationEnabled: (0, _validation.boolean)().default(true)
|
|
22
21
|
};
|
|
23
22
|
var _default = configValidators;
|
|
24
23
|
exports.default = _default;
|
|
@@ -60,8 +60,7 @@ var createIdentity = function createIdentity(_ref) {
|
|
|
60
60
|
fireReferrerHideableImage = _ref.fireReferrerHideableImage,
|
|
61
61
|
sendEdgeNetworkRequest = _ref.sendEdgeNetworkRequest;
|
|
62
62
|
var orgId = config.orgId,
|
|
63
|
-
thirdPartyCookiesEnabled = config.thirdPartyCookiesEnabled
|
|
64
|
-
idOverwriteEnabled = config.idOverwriteEnabled;
|
|
63
|
+
thirdPartyCookiesEnabled = config.thirdPartyCookiesEnabled;
|
|
65
64
|
var getEcidFromVisitor = (0, _injectGetEcidFromVisitor.default)({
|
|
66
65
|
logger: logger,
|
|
67
66
|
orgId: orgId,
|
|
@@ -93,8 +92,7 @@ var createIdentity = function createIdentity(_ref) {
|
|
|
93
92
|
return new Date();
|
|
94
93
|
},
|
|
95
94
|
orgId: orgId,
|
|
96
|
-
logger: logger
|
|
97
|
-
idOverwriteEnabled: idOverwriteEnabled
|
|
95
|
+
logger: logger
|
|
98
96
|
});
|
|
99
97
|
var awaitIdentityCookie = (0, _injectAwaitIdentityCookie.default)({
|
|
100
98
|
doesIdentityCookieExist: doesIdentityCookieExist,
|
|
@@ -26,8 +26,7 @@ var _default = function _default(_ref) {
|
|
|
26
26
|
var locationSearch = _ref.locationSearch,
|
|
27
27
|
dateProvider = _ref.dateProvider,
|
|
28
28
|
orgId = _ref.orgId,
|
|
29
|
-
logger = _ref.logger
|
|
30
|
-
idOverwriteEnabled = _ref.idOverwriteEnabled;
|
|
29
|
+
logger = _ref.logger;
|
|
31
30
|
return function (payload) {
|
|
32
31
|
if (payload.hasIdentity(_ecidNamespace.default)) {
|
|
33
32
|
// don't overwrite a user provided ecid identity
|
|
@@ -54,7 +53,7 @@ var _default = function _default(_ref) {
|
|
|
54
53
|
|
|
55
54
|
var ts = parseInt(properties.TS, 10);
|
|
56
55
|
var mcmid = properties.MCMID;
|
|
57
|
-
var mcorgid = properties.MCORGID;
|
|
56
|
+
var mcorgid = decodeURIComponent(properties.MCORGID);
|
|
58
57
|
|
|
59
58
|
if ( // When TS is not specified or not a number, the following inequality returns false.
|
|
60
59
|
// All inequalities with NaN variables are false.
|
|
@@ -63,14 +62,6 @@ var _default = function _default(_ref) {
|
|
|
63
62
|
payload.addIdentity(_ecidNamespace.default, {
|
|
64
63
|
id: mcmid
|
|
65
64
|
});
|
|
66
|
-
|
|
67
|
-
if (idOverwriteEnabled) {
|
|
68
|
-
payload.mergeQuery({
|
|
69
|
-
identity: {
|
|
70
|
-
overwriteExisting: true
|
|
71
|
-
}
|
|
72
|
-
});
|
|
73
|
-
}
|
|
74
65
|
} else {
|
|
75
66
|
logger.info("Detected invalid or expired adobe_mc query string parameter.");
|
|
76
67
|
}
|
|
@@ -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.11.0-alpha.
|
|
18
|
+
var _default = "2.11.0-alpha.4";
|
|
19
19
|
exports.default = _default;
|
package/libEs5/utils/index.js
CHANGED
|
@@ -282,6 +282,12 @@ Object.defineProperty(exports, "toISOStringLocal", {
|
|
|
282
282
|
return _toISOStringLocal.default;
|
|
283
283
|
}
|
|
284
284
|
});
|
|
285
|
+
Object.defineProperty(exports, "toInteger", {
|
|
286
|
+
enumerable: true,
|
|
287
|
+
get: function get() {
|
|
288
|
+
return _toInteger.default;
|
|
289
|
+
}
|
|
290
|
+
});
|
|
285
291
|
Object.defineProperty(exports, "updateErrorMessage", {
|
|
286
292
|
enumerable: true,
|
|
287
293
|
get: function get() {
|
|
@@ -399,6 +405,8 @@ var _toArray = require("./toArray");
|
|
|
399
405
|
|
|
400
406
|
var _toError = require("./toError");
|
|
401
407
|
|
|
408
|
+
var _toInteger = require("./toInteger");
|
|
409
|
+
|
|
402
410
|
var _toISOStringLocal = require("./toISOStringLocal");
|
|
403
411
|
|
|
404
412
|
var _uuid = require("./uuid");
|
|
@@ -4,6 +4,8 @@ exports.default = void 0;
|
|
|
4
4
|
|
|
5
5
|
var _padStart = require("./padStart");
|
|
6
6
|
|
|
7
|
+
var _toInteger = require("./toInteger");
|
|
8
|
+
|
|
7
9
|
/*
|
|
8
10
|
Copyright 2019 Adobe. All rights reserved.
|
|
9
11
|
This file is licensed to you under the Apache License, Version 2.0 (the "License");
|
|
@@ -32,7 +34,7 @@ var _default = function _default(date) {
|
|
|
32
34
|
// means that the offset is positive if the local timezone is behind UTC and negative if it is
|
|
33
35
|
// ahead. For example, for time zone UTC+10:00, -600 will be returned.
|
|
34
36
|
|
|
35
|
-
var timezoneOffset = date.getTimezoneOffset();
|
|
37
|
+
var timezoneOffset = (0, _toInteger.default)(date.getTimezoneOffset(), 0);
|
|
36
38
|
var ts = timezoneOffset > 0 ? "-" : "+";
|
|
37
39
|
var th = (0, _padStart.default)(Math.floor(Math.abs(timezoneOffset) / 60), 2, "0");
|
|
38
40
|
var tm = (0, _padStart.default)(Math.abs(timezoneOffset) % 60, 2, "0");
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
exports.default = void 0;
|
|
4
|
+
|
|
5
|
+
/*
|
|
6
|
+
Copyright 2022 Adobe. All rights reserved.
|
|
7
|
+
This file is licensed to you under the Apache License, Version 2.0 (the "License");
|
|
8
|
+
you may not use this file except in compliance with the License. You may obtain a copy
|
|
9
|
+
of the License at http://www.apache.org/licenses/LICENSE-2.0
|
|
10
|
+
|
|
11
|
+
Unless required by applicable law or agreed to in writing, software distributed under
|
|
12
|
+
the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
|
|
13
|
+
OF ANY KIND, either express or implied. See the License for the specific language
|
|
14
|
+
governing permissions and limitations under the License.
|
|
15
|
+
*/
|
|
16
|
+
|
|
17
|
+
/*
|
|
18
|
+
* coerce `value` to a number or return `defaultValue` if it cannot be.
|
|
19
|
+
*/
|
|
20
|
+
var _default = function _default(value, defaultValue) {
|
|
21
|
+
var n = Math.round(Number(value)); // eslint-disable-next-line no-restricted-globals
|
|
22
|
+
|
|
23
|
+
return isNaN(n) ? defaultValue : n;
|
|
24
|
+
};
|
|
25
|
+
|
|
26
|
+
exports.default = _default;
|
|
@@ -9,14 +9,19 @@ the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTA
|
|
|
9
9
|
OF ANY KIND, either express or implied. See the License for the specific language
|
|
10
10
|
governing permissions and limitations under the License.
|
|
11
11
|
*/
|
|
12
|
-
import { deepAssign, toISOStringLocal } from "../../utils";
|
|
12
|
+
import { deepAssign, toISOStringLocal, toInteger } from "../../utils";
|
|
13
13
|
export default (dateProvider => {
|
|
14
14
|
return xdm => {
|
|
15
15
|
const date = dateProvider();
|
|
16
16
|
const placeContext = {
|
|
17
|
-
localTime: toISOStringLocal(date)
|
|
18
|
-
localTimezoneOffset: date.getTimezoneOffset()
|
|
17
|
+
localTime: toISOStringLocal(date)
|
|
19
18
|
};
|
|
19
|
+
const localTimezoneOffset = toInteger(date.getTimezoneOffset());
|
|
20
|
+
|
|
21
|
+
if (localTimezoneOffset !== undefined) {
|
|
22
|
+
placeContext.localTimezoneOffset = localTimezoneOffset;
|
|
23
|
+
}
|
|
24
|
+
|
|
20
25
|
deepAssign(xdm, {
|
|
21
26
|
placeContext
|
|
22
27
|
});
|
|
@@ -28,7 +28,7 @@ export default (({
|
|
|
28
28
|
orgId
|
|
29
29
|
}) => (ecid, url) => {
|
|
30
30
|
const ts = Math.round(dateProvider().getTime() / 1000);
|
|
31
|
-
const adobemc = encodeURIComponent(`TS=${ts}|MCMID=${ecid}|MCORGID=${orgId}`);
|
|
31
|
+
const adobemc = encodeURIComponent(`TS=${ts}|MCMID=${ecid}|MCORGID=${encodeURIComponent(orgId)}`);
|
|
32
32
|
const [, location, queryString, fragment] = url.match(URL_REGEX);
|
|
33
33
|
const separator = getSeparator(queryString);
|
|
34
34
|
return `${location}${queryString}${separator}adobe_mc=${adobemc}${fragment}`;
|
|
@@ -12,7 +12,6 @@ governing permissions and limitations under the License.
|
|
|
12
12
|
import { boolean } from "../../utils/validation";
|
|
13
13
|
const configValidators = {
|
|
14
14
|
thirdPartyCookiesEnabled: boolean().default(true),
|
|
15
|
-
idMigrationEnabled: boolean().default(true)
|
|
16
|
-
idOverwriteEnabled: boolean().default(false)
|
|
15
|
+
idMigrationEnabled: boolean().default(true)
|
|
17
16
|
};
|
|
18
17
|
export default configValidators;
|
|
@@ -39,8 +39,7 @@ const createIdentity = ({
|
|
|
39
39
|
}) => {
|
|
40
40
|
const {
|
|
41
41
|
orgId,
|
|
42
|
-
thirdPartyCookiesEnabled
|
|
43
|
-
idOverwriteEnabled
|
|
42
|
+
thirdPartyCookiesEnabled
|
|
44
43
|
} = config;
|
|
45
44
|
const getEcidFromVisitor = injectGetEcidFromVisitor({
|
|
46
45
|
logger,
|
|
@@ -71,8 +70,7 @@ const createIdentity = ({
|
|
|
71
70
|
locationSearch: window.document.location.search,
|
|
72
71
|
dateProvider: () => new Date(),
|
|
73
72
|
orgId,
|
|
74
|
-
logger
|
|
75
|
-
idOverwriteEnabled
|
|
73
|
+
logger
|
|
76
74
|
});
|
|
77
75
|
const awaitIdentityCookie = injectAwaitIdentityCookie({
|
|
78
76
|
doesIdentityCookieExist,
|
|
@@ -9,8 +9,7 @@ export default (({
|
|
|
9
9
|
locationSearch,
|
|
10
10
|
dateProvider,
|
|
11
11
|
orgId,
|
|
12
|
-
logger
|
|
13
|
-
idOverwriteEnabled
|
|
12
|
+
logger
|
|
14
13
|
}) => payload => {
|
|
15
14
|
if (payload.hasIdentity(ecidNamespace)) {
|
|
16
15
|
// don't overwrite a user provided ecid identity
|
|
@@ -32,7 +31,7 @@ export default (({
|
|
|
32
31
|
|
|
33
32
|
const ts = parseInt(properties.TS, 10);
|
|
34
33
|
const mcmid = properties.MCMID;
|
|
35
|
-
const mcorgid = properties.MCORGID;
|
|
34
|
+
const mcorgid = decodeURIComponent(properties.MCORGID);
|
|
36
35
|
|
|
37
36
|
if ( // When TS is not specified or not a number, the following inequality returns false.
|
|
38
37
|
// All inequalities with NaN variables are false.
|
|
@@ -41,14 +40,6 @@ export default (({
|
|
|
41
40
|
payload.addIdentity(ecidNamespace, {
|
|
42
41
|
id: mcmid
|
|
43
42
|
});
|
|
44
|
-
|
|
45
|
-
if (idOverwriteEnabled) {
|
|
46
|
-
payload.mergeQuery({
|
|
47
|
-
identity: {
|
|
48
|
-
overwriteExisting: true
|
|
49
|
-
}
|
|
50
|
-
});
|
|
51
|
-
}
|
|
52
43
|
} else {
|
|
53
44
|
logger.info("Detected invalid or expired adobe_mc query string parameter.");
|
|
54
45
|
}
|
package/libEs6/utils/index.js
CHANGED
|
@@ -56,6 +56,7 @@ export { default as startsWith } from "./startsWith";
|
|
|
56
56
|
export { default as stringToBoolean } from "./stringToBoolean";
|
|
57
57
|
export { default as toArray } from "./toArray";
|
|
58
58
|
export { default as toError } from "./toError";
|
|
59
|
+
export { default as toInteger } from "./toInteger";
|
|
59
60
|
export { default as toISOStringLocal } from "./toISOStringLocal";
|
|
60
61
|
export { default as uuid } from "./uuid";
|
|
61
62
|
export { default as updateErrorMessage } from "./updateErrorMessage";
|
|
@@ -10,6 +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 padStart from "./padStart";
|
|
13
|
+
import toInteger from "./toInteger";
|
|
13
14
|
/**
|
|
14
15
|
* Formats the date into an ISO date-time string in the local timezone
|
|
15
16
|
* @param {Date} date
|
|
@@ -27,7 +28,7 @@ export default (date => {
|
|
|
27
28
|
// means that the offset is positive if the local timezone is behind UTC and negative if it is
|
|
28
29
|
// ahead. For example, for time zone UTC+10:00, -600 will be returned.
|
|
29
30
|
|
|
30
|
-
const timezoneOffset = date.getTimezoneOffset();
|
|
31
|
+
const timezoneOffset = toInteger(date.getTimezoneOffset(), 0);
|
|
31
32
|
const ts = timezoneOffset > 0 ? "-" : "+";
|
|
32
33
|
const th = padStart(Math.floor(Math.abs(timezoneOffset) / 60), 2, "0");
|
|
33
34
|
const tm = padStart(Math.abs(timezoneOffset) % 60, 2, "0");
|
|
@@ -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
|
+
|
|
13
|
+
/*
|
|
14
|
+
* coerce `value` to a number or return `defaultValue` if it cannot be.
|
|
15
|
+
*/
|
|
16
|
+
export default ((value, defaultValue) => {
|
|
17
|
+
const n = Math.round(Number(value)); // eslint-disable-next-line no-restricted-globals
|
|
18
|
+
|
|
19
|
+
return isNaN(n) ? defaultValue : n;
|
|
20
|
+
});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@adobe/alloy",
|
|
3
|
-
"version": "2.11.0-alpha.
|
|
3
|
+
"version": "2.11.0-alpha.4",
|
|
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-alpha.
|
|
67
|
+
"@adobe/alloy": "^2.11.0-alpha.3",
|
|
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",
|