@adobe/alloy 2.22.0-beta.0 → 2.22.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.
@@ -4,6 +4,7 @@ exports.default = void 0;
4
4
  var _index = require("../../utils/index.js");
5
5
  var _queryStringIdentityParam = require("../../constants/queryStringIdentityParam.js");
6
6
  var _ecidNamespace = require("../../constants/ecidNamespace.js");
7
+ var _decodeUriComponentSafely = require("../../utils/decodeUriComponentSafely.js");
7
8
  /*
8
9
  Copyright 2023 Adobe. All rights reserved.
9
10
  This file is licensed to you under the Apache License, Version 2.0 (the "License");
@@ -46,7 +47,7 @@ var _default = ({
46
47
  // We are using MCMID and MCORGID to be compatible with Visitor.
47
48
  const ts = parseInt(properties.TS, 10);
48
49
  const mcmid = properties.MCMID;
49
- const mcorgid = decodeURIComponent(properties.MCORGID);
50
+ const mcorgid = (0, _decodeUriComponentSafely.default)(properties.MCORGID);
50
51
  if (
51
52
  // When TS is not specified or not a number, the following inequality returns false.
52
53
  // All inequalities with NaN variables are false.
@@ -3,6 +3,7 @@
3
3
  exports.removeElementById = exports.parseAnchor = void 0;
4
4
  var _index = require("../../../utils/index.js");
5
5
  var _index2 = require("../../../utils/dom/index.js");
6
+ var _decodeUriComponentSafely = require("../../../utils/decodeUriComponentSafely.js");
6
7
  /*
7
8
  Copyright 2023 Adobe. All rights reserved.
8
9
  This file is licensed to you under the Apache License, Version 2.0 (the "License");
@@ -42,7 +43,7 @@ const parseAnchor = anchor => {
42
43
  if ((0, _index.isNonEmptyArray)(hrefParts)) {
43
44
  const queryParams = _index.queryString.parse(hrefParts[1]);
44
45
  interaction = queryParams.interaction || "";
45
- link = decodeURIComponent(queryParams.link || "");
46
+ link = (0, _decodeUriComponentSafely.default)(queryParams.link || "");
46
47
  }
47
48
  return {
48
49
  action,
@@ -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.22.0-beta.0";
17
+ var _default = exports.default = "2.22.0-beta.2";
@@ -0,0 +1,22 @@
1
+ "use strict";
2
+
3
+ exports.default = void 0;
4
+ /*
5
+ Copyright 2024 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 = v => {
16
+ try {
17
+ return decodeURIComponent(v);
18
+ } catch {
19
+ return "";
20
+ }
21
+ };
22
+ exports.default = _default;
@@ -15,6 +15,7 @@ governing permissions and limitations under the License.
15
15
  import { queryString } from "../../utils/index.js";
16
16
  import queryStringIdentityParam from "../../constants/queryStringIdentityParam.js";
17
17
  import ecidNamespace from "../../constants/ecidNamespace.js";
18
+ import decodeUriComponentSafely from "../../utils/decodeUriComponentSafely.js";
18
19
  const LINK_TTL_SECONDS = 300; // 5 minute link time to live
19
20
 
20
21
  export default (({
@@ -44,7 +45,7 @@ export default (({
44
45
  // We are using MCMID and MCORGID to be compatible with Visitor.
45
46
  const ts = parseInt(properties.TS, 10);
46
47
  const mcmid = properties.MCMID;
47
- const mcorgid = decodeURIComponent(properties.MCORGID);
48
+ const mcorgid = decodeUriComponentSafely(properties.MCORGID);
48
49
  if (
49
50
  // When TS is not specified or not a number, the following inequality returns false.
50
51
  // All inequalities with NaN variables are false.
@@ -11,6 +11,7 @@ governing permissions and limitations under the License.
11
11
  */
12
12
  import { isNonEmptyArray, queryString } from "../../../utils/index.js";
13
13
  import { removeNode, selectNodes } from "../../../utils/dom/index.js";
14
+ import decodeUriComponentSafely from "../../../utils/decodeUriComponentSafely.js";
14
15
  export const removeElementById = id => {
15
16
  const element = selectNodes(`#${id}`, document);
16
17
  if (element && element.length > 0) {
@@ -37,7 +38,7 @@ export const parseAnchor = anchor => {
37
38
  if (isNonEmptyArray(hrefParts)) {
38
39
  const queryParams = queryString.parse(hrefParts[1]);
39
40
  interaction = queryParams.interaction || "";
40
- link = decodeURIComponent(queryParams.link || "");
41
+ link = decodeUriComponentSafely(queryParams.link || "");
41
42
  }
42
43
  return {
43
44
  action,
@@ -13,4 +13,4 @@ governing permissions and limitations under the License.
13
13
  // The __VERSION__ keyword will be replace at alloy build time with the package.json version.
14
14
  // see babel-plugin-version
15
15
 
16
- export default "2.22.0-beta.0";
16
+ export default "2.22.0-beta.2";
@@ -0,0 +1,19 @@
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 (v => {
14
+ try {
15
+ return decodeURIComponent(v);
16
+ } catch {
17
+ return "";
18
+ }
19
+ });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@adobe/alloy",
3
- "version": "2.22.0-beta.0",
3
+ "version": "2.22.0-beta.2",
4
4
  "description": "Adobe Experience Platform Web SDK",
5
5
  "type": "module",
6
6
  "main": "libEs5/index.js",
@@ -95,7 +95,7 @@
95
95
  "uuid": "^10.0.0"
96
96
  },
97
97
  "devDependencies": {
98
- "@adobe/alloy": "^2.22.0-alpha.4",
98
+ "@adobe/alloy": "^2.22.0-beta.1",
99
99
  "@babel/cli": "^7.24.8",
100
100
  "@babel/plugin-transform-runtime": "^7.24.7",
101
101
  "@eslint/js": "^9.9.0",
@@ -21,9 +21,9 @@ export default (_ref) => {
21
21
  // __VERSION__
22
22
  ReferencedIdentifier(path, state) {
23
23
  const identifier = state.opts.identifier;
24
- const transform = identifier === undefined ? true : identifier; // 默认转换
24
+ const transform = identifier === undefined ? true : identifier;
25
25
 
26
- const define = state.opts.define || "__VERSION__"; // 默认值
26
+ const define = state.opts.define || "__VERSION__";
27
27
  if (transform && path.node.name === define) {
28
28
  path.replaceWith(t.valueToNode(getVersion(state)));
29
29
  }