@adobe/alloy 2.26.0-beta.0 → 2.26.0-beta.2
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/ActivityCollector/utils/trimQueryFromUrl.js +5 -0
- package/libEs5/components/Identity/createComponent.js +6 -1
- package/libEs5/components/Identity/injectAddQueryStringIdentityToPayload.js +2 -1
- package/libEs5/constants/libraryVersion.js +1 -1
- package/libEs5/utils/parseUrl.js +29 -2
- package/libEs6/components/ActivityCollector/utils/trimQueryFromUrl.js +5 -0
- package/libEs6/components/Identity/createComponent.js +6 -1
- package/libEs6/components/Identity/injectAddQueryStringIdentityToPayload.js +2 -1
- package/libEs6/constants/libraryVersion.js +1 -1
- package/libEs6/utils/parseUrl.js +28 -1
- package/package.json +2 -4
- package/scripts/alloyBuilder.js +20 -19
|
@@ -12,6 +12,11 @@ the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTA
|
|
|
12
12
|
OF ANY KIND, either express or implied. See the License for the specific language
|
|
13
13
|
governing permissions and limitations under the License.
|
|
14
14
|
*/
|
|
15
|
+
/**
|
|
16
|
+
* Trims the query from the URL.
|
|
17
|
+
* @param {string} url
|
|
18
|
+
* @returns {string}
|
|
19
|
+
*/
|
|
15
20
|
var _default = url => {
|
|
16
21
|
const questionMarkIndex = url.indexOf("?");
|
|
17
22
|
const hashIndex = url.indexOf("#");
|
|
@@ -56,7 +56,12 @@ var _default = ({
|
|
|
56
56
|
// https://jira.corp.adobe.com/browse/EXEG-1234
|
|
57
57
|
setLegacyEcid(newNamespaces[_ecidNamespace.default]);
|
|
58
58
|
}
|
|
59
|
-
|
|
59
|
+
if (newNamespaces && Object.keys(newNamespaces).length > 0) {
|
|
60
|
+
namespaces = {
|
|
61
|
+
...namespaces,
|
|
62
|
+
...newNamespaces
|
|
63
|
+
};
|
|
64
|
+
}
|
|
60
65
|
// For sendBeacon requests, getEdge() will return {}, so we are using assign here
|
|
61
66
|
// so that sendBeacon requests don't override the edge info from before.
|
|
62
67
|
edge = {
|
|
@@ -41,7 +41,8 @@ var _default = ({
|
|
|
41
41
|
}
|
|
42
42
|
const properties = queryStringValue.split("|").reduce((memo, keyValue) => {
|
|
43
43
|
const [key, value] = keyValue.split("=");
|
|
44
|
-
memo[key] = value;
|
|
44
|
+
memo[key] = (0, _decodeUriComponentSafely.default)(value);
|
|
45
|
+
memo[key] = memo[key].replace(/[^a-zA-Z0-9@_-]/g, ""); // sanitization
|
|
45
46
|
return memo;
|
|
46
47
|
}, {});
|
|
47
48
|
// We are using MCMID and MCORGID to be compatible with Visitor.
|
|
@@ -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.26.0-beta.
|
|
17
|
+
var _default = exports.default = "2.26.0-beta.2";
|
package/libEs5/utils/parseUrl.js
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
exports.default = void 0;
|
|
4
|
-
var _parseUri = require("parse-uri");
|
|
5
4
|
var _isString = require("./isString.js");
|
|
6
5
|
/*
|
|
7
6
|
Copyright 2023 Adobe. All rights reserved.
|
|
@@ -44,11 +43,39 @@ const parseDomainBasic = host => {
|
|
|
44
43
|
}
|
|
45
44
|
return result;
|
|
46
45
|
};
|
|
46
|
+
|
|
47
|
+
/**
|
|
48
|
+
* @typedef {Object} ParseUriResult
|
|
49
|
+
* @property {string} host
|
|
50
|
+
* @property {string} path
|
|
51
|
+
* @property {string} query
|
|
52
|
+
* @property {string} anchor
|
|
53
|
+
*
|
|
54
|
+
* @param {string} url
|
|
55
|
+
* @returns {ParseUriResult}
|
|
56
|
+
*/
|
|
57
|
+
const parseUri = url => {
|
|
58
|
+
try {
|
|
59
|
+
const parsed = new URL(url);
|
|
60
|
+
let path = parsed.pathname;
|
|
61
|
+
if (!url.endsWith("/") && path === "/") {
|
|
62
|
+
path = "";
|
|
63
|
+
}
|
|
64
|
+
return {
|
|
65
|
+
host: parsed.hostname,
|
|
66
|
+
path,
|
|
67
|
+
query: parsed.search.replace(/^\?/, ""),
|
|
68
|
+
anchor: parsed.hash.replace(/^#/, "")
|
|
69
|
+
};
|
|
70
|
+
} catch {
|
|
71
|
+
return {};
|
|
72
|
+
}
|
|
73
|
+
};
|
|
47
74
|
const parseUrl = (url, parseDomain = parseDomainBasic) => {
|
|
48
75
|
if (!(0, _isString.default)(url)) {
|
|
49
76
|
url = "";
|
|
50
77
|
}
|
|
51
|
-
const parsed = (
|
|
78
|
+
const parsed = parseUri(url) || {};
|
|
52
79
|
const {
|
|
53
80
|
host = "",
|
|
54
81
|
path = "",
|
|
@@ -10,6 +10,11 @@ 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
|
|
|
13
|
+
/**
|
|
14
|
+
* Trims the query from the URL.
|
|
15
|
+
* @param {string} url
|
|
16
|
+
* @returns {string}
|
|
17
|
+
*/
|
|
13
18
|
export default url => {
|
|
14
19
|
const questionMarkIndex = url.indexOf("?");
|
|
15
20
|
const hashIndex = url.indexOf("#");
|
|
@@ -53,7 +53,12 @@ export default ({
|
|
|
53
53
|
// https://jira.corp.adobe.com/browse/EXEG-1234
|
|
54
54
|
setLegacyEcid(newNamespaces[ecidNamespace]);
|
|
55
55
|
}
|
|
56
|
-
|
|
56
|
+
if (newNamespaces && Object.keys(newNamespaces).length > 0) {
|
|
57
|
+
namespaces = {
|
|
58
|
+
...namespaces,
|
|
59
|
+
...newNamespaces
|
|
60
|
+
};
|
|
61
|
+
}
|
|
57
62
|
// For sendBeacon requests, getEdge() will return {}, so we are using assign here
|
|
58
63
|
// so that sendBeacon requests don't override the edge info from before.
|
|
59
64
|
edge = {
|
|
@@ -39,7 +39,8 @@ export default ({
|
|
|
39
39
|
}
|
|
40
40
|
const properties = queryStringValue.split("|").reduce((memo, keyValue) => {
|
|
41
41
|
const [key, value] = keyValue.split("=");
|
|
42
|
-
memo[key] = value;
|
|
42
|
+
memo[key] = decodeUriComponentSafely(value);
|
|
43
|
+
memo[key] = memo[key].replace(/[^a-zA-Z0-9@_-]/g, ""); // sanitization
|
|
43
44
|
return memo;
|
|
44
45
|
}, {});
|
|
45
46
|
// We are using MCMID and MCORGID to be compatible with Visitor.
|
package/libEs6/utils/parseUrl.js
CHANGED
|
@@ -9,7 +9,6 @@ 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 parseUri from "parse-uri";
|
|
13
12
|
import isString from "./isString.js";
|
|
14
13
|
const parseDomainBasic = host => {
|
|
15
14
|
const result = {};
|
|
@@ -40,6 +39,34 @@ const parseDomainBasic = host => {
|
|
|
40
39
|
}
|
|
41
40
|
return result;
|
|
42
41
|
};
|
|
42
|
+
|
|
43
|
+
/**
|
|
44
|
+
* @typedef {Object} ParseUriResult
|
|
45
|
+
* @property {string} host
|
|
46
|
+
* @property {string} path
|
|
47
|
+
* @property {string} query
|
|
48
|
+
* @property {string} anchor
|
|
49
|
+
*
|
|
50
|
+
* @param {string} url
|
|
51
|
+
* @returns {ParseUriResult}
|
|
52
|
+
*/
|
|
53
|
+
const parseUri = url => {
|
|
54
|
+
try {
|
|
55
|
+
const parsed = new URL(url);
|
|
56
|
+
let path = parsed.pathname;
|
|
57
|
+
if (!url.endsWith("/") && path === "/") {
|
|
58
|
+
path = "";
|
|
59
|
+
}
|
|
60
|
+
return {
|
|
61
|
+
host: parsed.hostname,
|
|
62
|
+
path,
|
|
63
|
+
query: parsed.search.replace(/^\?/, ""),
|
|
64
|
+
anchor: parsed.hash.replace(/^#/, "")
|
|
65
|
+
};
|
|
66
|
+
} catch {
|
|
67
|
+
return {};
|
|
68
|
+
}
|
|
69
|
+
};
|
|
43
70
|
const parseUrl = (url, parseDomain = parseDomainBasic) => {
|
|
44
71
|
if (!isString(url)) {
|
|
45
72
|
url = "";
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@adobe/alloy",
|
|
3
|
-
"version": "2.26.0-beta.
|
|
3
|
+
"version": "2.26.0-beta.2",
|
|
4
4
|
"description": "Adobe Experience Platform Web SDK",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "libEs5/index.js",
|
|
@@ -81,13 +81,12 @@
|
|
|
81
81
|
"commander": "^13.1.0",
|
|
82
82
|
"css.escape": "^1.5.1",
|
|
83
83
|
"js-cookie": "3.0.5",
|
|
84
|
-
"parse-uri": "^1.0.9",
|
|
85
84
|
"rollup": "^4.34.8",
|
|
86
85
|
"rollup-plugin-license": "^3.6.0",
|
|
87
86
|
"uuid": "^11.1.0"
|
|
88
87
|
},
|
|
89
88
|
"devDependencies": {
|
|
90
|
-
"@adobe/alloy": "^2.
|
|
89
|
+
"@adobe/alloy": "^2.26.0-beta.1",
|
|
91
90
|
"@babel/cli": "^7.26.4",
|
|
92
91
|
"@babel/plugin-transform-runtime": "^7.26.9",
|
|
93
92
|
"@eslint/js": "^9.20.0",
|
|
@@ -115,7 +114,6 @@
|
|
|
115
114
|
"prettier": "^3.5.1",
|
|
116
115
|
"read-cache": "^1.0.0",
|
|
117
116
|
"recursive-readdir": "^2.2.3",
|
|
118
|
-
"request": "^2.88.2",
|
|
119
117
|
"rimraf": "^6.0.1",
|
|
120
118
|
"rollup-plugin-glob-import": "^0.5.0",
|
|
121
119
|
"rollup-plugin-istanbul": "^5.0.0",
|
package/scripts/alloyBuilder.js
CHANGED
|
@@ -11,27 +11,25 @@ OF ANY KIND, either express or implied. See the License for the specific languag
|
|
|
11
11
|
governing permissions and limitations under the License.
|
|
12
12
|
*/
|
|
13
13
|
|
|
14
|
+
import babel from "@babel/core";
|
|
15
|
+
import { checkbox, input, select } from "@inquirer/prompts";
|
|
16
|
+
import { Command, InvalidOptionArgumentError, Option } from "commander";
|
|
14
17
|
import fs from "fs";
|
|
15
18
|
import path from "path";
|
|
16
19
|
import { rollup } from "rollup";
|
|
17
|
-
import { Command, Option, InvalidOptionArgumentError } from "commander";
|
|
18
|
-
import { input, checkbox, select } from "@inquirer/prompts";
|
|
19
|
-
import { fileURLToPath } from "url";
|
|
20
|
-
import babel from "@babel/core";
|
|
21
20
|
import { buildConfig } from "../rollup.config.js";
|
|
22
21
|
import entryPointGeneratorBabelPlugin from "./helpers/entryPointGeneratorBabelPlugin.js";
|
|
23
|
-
|
|
24
|
-
const dirname = path.dirname(fileURLToPath(import.meta.url));
|
|
22
|
+
import { getProjectRoot, safePathJoin } from "./helpers/path.js";
|
|
25
23
|
|
|
26
24
|
const packageJsonContent = fs.readFileSync(
|
|
27
|
-
|
|
25
|
+
safePathJoin(getProjectRoot(), "package.json"),
|
|
28
26
|
"utf8",
|
|
29
27
|
);
|
|
30
28
|
const { version } = JSON.parse(packageJsonContent);
|
|
31
29
|
|
|
32
|
-
let sourceRootPath =
|
|
30
|
+
let sourceRootPath = safePathJoin(getProjectRoot(), "src");
|
|
33
31
|
if (!fs.existsSync(sourceRootPath)) {
|
|
34
|
-
sourceRootPath =
|
|
32
|
+
sourceRootPath = safePathJoin(getProjectRoot(), "libEs6");
|
|
35
33
|
}
|
|
36
34
|
|
|
37
35
|
const arrayDifference = (arr1, arr2) => arr1.filter((x) => !arr2.includes(x));
|
|
@@ -44,11 +42,14 @@ const getComponents = (() => {
|
|
|
44
42
|
const components = {};
|
|
45
43
|
[
|
|
46
44
|
{
|
|
47
|
-
filePath:
|
|
45
|
+
filePath: safePathJoin(sourceRootPath, "core/componentCreators.js"),
|
|
48
46
|
key: "optional",
|
|
49
47
|
},
|
|
50
48
|
{
|
|
51
|
-
filePath:
|
|
49
|
+
filePath: safePathJoin(
|
|
50
|
+
sourceRootPath,
|
|
51
|
+
"core/requiredComponentCreators.js",
|
|
52
|
+
),
|
|
52
53
|
key: "required",
|
|
53
54
|
},
|
|
54
55
|
].forEach(({ filePath, key }) => {
|
|
@@ -69,12 +70,12 @@ const getComponents = (() => {
|
|
|
69
70
|
return () => components;
|
|
70
71
|
})();
|
|
71
72
|
|
|
72
|
-
const getDefaultPath = () => {
|
|
73
|
-
return process.cwd();
|
|
74
|
-
};
|
|
75
|
-
|
|
76
73
|
const getOutputFilePath = (argv) => {
|
|
77
|
-
|
|
74
|
+
const outputPath = safePathJoin(
|
|
75
|
+
argv.outputDir,
|
|
76
|
+
`alloy${argv.minify ? ".min" : ""}.js`,
|
|
77
|
+
);
|
|
78
|
+
return outputPath;
|
|
78
79
|
};
|
|
79
80
|
|
|
80
81
|
const getFileSizeInKB = (filePath) => {
|
|
@@ -93,7 +94,7 @@ const generateInputEntryFile = ({
|
|
|
93
94
|
}).code;
|
|
94
95
|
|
|
95
96
|
const destinationDirectory = path.dirname(inputPath);
|
|
96
|
-
const outputPath =
|
|
97
|
+
const outputPath = safePathJoin(destinationDirectory, outputFile);
|
|
97
98
|
|
|
98
99
|
fs.writeFileSync(outputPath, output);
|
|
99
100
|
|
|
@@ -157,10 +158,10 @@ const getMakeBuildCommand = () => {
|
|
|
157
158
|
"-o, --outputDir <dir>",
|
|
158
159
|
"the output directory for the generated build",
|
|
159
160
|
)
|
|
160
|
-
.default(
|
|
161
|
+
.default(getProjectRoot())
|
|
161
162
|
.argParser((value) => {
|
|
162
163
|
if (!path.isAbsolute(value)) {
|
|
163
|
-
value =
|
|
164
|
+
value = safePathJoin(getProjectRoot(), value);
|
|
164
165
|
}
|
|
165
166
|
|
|
166
167
|
try {
|