@legalplace/wizardx-core 4.12.0 → 4.12.1
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,18 +1,15 @@
|
|
|
1
1
|
import { componentConnector } from "./connector/componentConnector";
|
|
2
2
|
import { getRelatedVariablesValues, parseContentWithVariables, } from "../helpers/outputsParsing";
|
|
3
|
-
import HtmlSanitizer from "../service/htmlSanitizer";
|
|
4
3
|
const stateToProps = (selectors) => (state, ownProps) => {
|
|
5
4
|
const { id, index } = ownProps;
|
|
6
5
|
const option = selectors.selectOptionReference(id);
|
|
7
6
|
const boxReference = selectors.selectBoxReference(id);
|
|
8
7
|
const variables = getRelatedVariablesValues(id, index, boxReference.variables);
|
|
9
|
-
const htmlSanitizer = new HtmlSanitizer();
|
|
10
8
|
const condition = selectors.selectOptionConditionValue(id, index);
|
|
11
9
|
let content = condition === false
|
|
12
10
|
? ""
|
|
13
11
|
: parseContentWithVariables(boxReference.raw, id, index, variables);
|
|
14
12
|
content = content.replace(/</g, "<").replace(/>/g, ">");
|
|
15
|
-
content = htmlSanitizer.sanitize(content);
|
|
16
13
|
const { options, meta } = option;
|
|
17
14
|
const { tags, type, box } = meta;
|
|
18
15
|
return {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { filterXSS } from "xss";
|
|
2
1
|
import { selectVariableParents, selectOptionRelations, selectVariableReference, selectOptionReference, selectVariableRelations, areVariablesSiblings, } from "../redux/selectors/references";
|
|
3
2
|
import { selectVariableInput, selectVariableInputByIndex, } from "../redux/selectors/inputs";
|
|
3
|
+
import HtmlSanitizer from "../service/htmlSanitizer";
|
|
4
4
|
const frenchNumber = (value) => {
|
|
5
5
|
let result = typeof value === "number" ? value.toString() : value;
|
|
6
6
|
if (/^([0-9]+)\.([0-9]+)$/.test(result.trim()))
|
|
@@ -42,17 +42,14 @@ export const parseContentWithVariables = (content, id, index, variables) => {
|
|
|
42
42
|
if (Object.prototype.hasOwnProperty.call(contentParsingCache, cacheKey)) {
|
|
43
43
|
return contentParsingCache[cacheKey];
|
|
44
44
|
}
|
|
45
|
+
const htmlSanitizer = new HtmlSanitizer();
|
|
45
46
|
let parsedContent = `${content}`;
|
|
46
47
|
Object.keys(variables).forEach((variableId) => {
|
|
47
48
|
let value = variables[variableId].toString();
|
|
48
49
|
if (value.trim().length === 0) {
|
|
49
50
|
value = new Array(16).join("_");
|
|
50
51
|
}
|
|
51
|
-
parsedContent = parsedContent.replace(new RegExp(`\\[var:${variableId}\\]`, "gi"),
|
|
52
|
-
whiteList: {
|
|
53
|
-
a: [],
|
|
54
|
-
},
|
|
55
|
-
}));
|
|
52
|
+
parsedContent = parsedContent.replace(new RegExp(`\\[var:${variableId}\\]`, "gi"), htmlSanitizer.sanitize(value));
|
|
56
53
|
});
|
|
57
54
|
contentParsingCache[cacheKey] = parsedContent;
|
|
58
55
|
return contentParsingCache[cacheKey];
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@legalplace/wizardx-core",
|
|
3
|
-
"version": "4.12.
|
|
3
|
+
"version": "4.12.1",
|
|
4
4
|
"author": "Moncef Hammou (moncef@legalplace.fr)",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"files": [
|
|
@@ -96,5 +96,5 @@
|
|
|
96
96
|
"*.test.ts",
|
|
97
97
|
"*.test.tsx"
|
|
98
98
|
],
|
|
99
|
-
"gitHead": "
|
|
99
|
+
"gitHead": "bea0bb48f984bab83b87f42aeb9495ece4d9e837"
|
|
100
100
|
}
|