@wix/wix-ui-icons-common 3.189.28 → 3.189.29

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.
@@ -1,7 +1,9 @@
1
1
  "use strict";
2
+ var __create = Object.create;
2
3
  var __defProp = Object.defineProperty;
3
4
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
5
  var __getOwnPropNames = Object.getOwnPropertyNames;
6
+ var __getProtoOf = Object.getPrototypeOf;
5
7
  var __hasOwnProp = Object.prototype.hasOwnProperty;
6
8
  var __export = (target, all) => {
7
9
  for (var name in all)
@@ -15,15 +17,35 @@ var __copyProps = (to, from, except, desc) => {
15
17
  }
16
18
  return to;
17
19
  };
20
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
21
+ // If the importer is in node compatibility mode or this is not an ESM
22
+ // file that has been converted to a CommonJS file using a Babel-
23
+ // compatible transform (i.e. "__esModule" has not been set), then set
24
+ // "default" to the CommonJS "module.exports" for node compatibility.
25
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
26
+ mod
27
+ ));
18
28
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
29
  var fetcher_exports = {};
20
30
  __export(fetcher_exports, {
21
31
  IconContentFetcher: () => IconContentFetcher,
22
32
  createTimeoutSignal: () => createTimeoutSignal,
23
- iconContentFetcher: () => iconContentFetcher
33
+ iconContentFetcher: () => iconContentFetcher,
34
+ sanitizeSvgContent: () => sanitizeSvgContent
24
35
  });
25
36
  module.exports = __toCommonJS(fetcher_exports);
37
+ var import_dompurify = __toESM(require("dompurify"));
26
38
  const ABORT_SIGNAL_TIMEOUT = 5e3;
39
+ const SVG_NAMESPACE = "http://www.w3.org/2000/svg";
40
+ function sanitizeSvgContent(content) {
41
+ if (typeof content !== "string" || !import_dompurify.default.isSupported) {
42
+ return "";
43
+ }
44
+ return import_dompurify.default.sanitize(content, {
45
+ USE_PROFILES: { svg: true, svgFilters: true },
46
+ NAMESPACE: SVG_NAMESPACE
47
+ });
48
+ }
27
49
  const isTransientError = (error) => error instanceof Error && (error.name === "TimeoutError" || error.name === "AbortError");
28
50
  function createTimeoutSignal(timeout) {
29
51
  if (typeof AbortSignal.timeout === "function") {
@@ -83,7 +105,7 @@ class IconContentFetcher {
83
105
  }
84
106
  };
85
107
  const request = fetchContent(2).then((data) => {
86
- this.cache.set(cacheKey, data.content);
108
+ this.cache.set(cacheKey, sanitizeSvgContent(data.content));
87
109
  this.pendingRequests.delete(cacheKey);
88
110
  }).catch((error) => {
89
111
  this.pendingRequests.delete(cacheKey);
@@ -102,5 +124,6 @@ const iconContentFetcher = new IconContentFetcher();
102
124
  0 && (module.exports = {
103
125
  IconContentFetcher,
104
126
  createTimeoutSignal,
105
- iconContentFetcher
127
+ iconContentFetcher,
128
+ sanitizeSvgContent
106
129
  });
@@ -1,4 +1,15 @@
1
+ import DOMPurify from "dompurify";
1
2
  const ABORT_SIGNAL_TIMEOUT = 5e3;
3
+ const SVG_NAMESPACE = "http://www.w3.org/2000/svg";
4
+ function sanitizeSvgContent(content) {
5
+ if (typeof content !== "string" || !DOMPurify.isSupported) {
6
+ return "";
7
+ }
8
+ return DOMPurify.sanitize(content, {
9
+ USE_PROFILES: { svg: true, svgFilters: true },
10
+ NAMESPACE: SVG_NAMESPACE
11
+ });
12
+ }
2
13
  const isTransientError = (error) => error instanceof Error && (error.name === "TimeoutError" || error.name === "AbortError");
3
14
  function createTimeoutSignal(timeout) {
4
15
  if (typeof AbortSignal.timeout === "function") {
@@ -58,7 +69,7 @@ class IconContentFetcher {
58
69
  }
59
70
  };
60
71
  const request = fetchContent(2).then((data) => {
61
- this.cache.set(cacheKey, data.content);
72
+ this.cache.set(cacheKey, sanitizeSvgContent(data.content));
62
73
  this.pendingRequests.delete(cacheKey);
63
74
  }).catch((error) => {
64
75
  this.pendingRequests.delete(cacheKey);
@@ -76,5 +87,6 @@ const iconContentFetcher = new IconContentFetcher();
76
87
  export {
77
88
  IconContentFetcher,
78
89
  createTimeoutSignal,
79
- iconContentFetcher
90
+ iconContentFetcher,
91
+ sanitizeSvgContent
80
92
  };