@shopgate/pwa-ui-ios 7.31.8 → 7.31.9-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.
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
import React from 'react';
|
|
1
|
+
import React, { useMemo } from 'react';
|
|
2
2
|
import PropTypes from 'prop-types';
|
|
3
3
|
import { makeStyles } from '@shopgate/engage/styles';
|
|
4
|
+
import htmlToText from '@shopgate/pwa-common/helpers/html/htmlToText';
|
|
4
5
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
5
6
|
const useStyles = makeStyles()({
|
|
6
7
|
root: {
|
|
@@ -31,7 +32,10 @@ const AppBarTitle = ({
|
|
|
31
32
|
classes,
|
|
32
33
|
cx
|
|
33
34
|
} = useStyles();
|
|
34
|
-
|
|
35
|
+
// Titles can contain HTML entities (e.g. product names). They are decoded to plain text, since
|
|
36
|
+
// titles might originate from untrusted sources like URL parameters and must not render as HTML.
|
|
37
|
+
const text = useMemo(() => htmlToText(title), [title]);
|
|
38
|
+
if (!text) {
|
|
35
39
|
return null;
|
|
36
40
|
}
|
|
37
41
|
return /*#__PURE__*/_jsx("div", {
|
|
@@ -40,12 +44,8 @@ const AppBarTitle = ({
|
|
|
40
44
|
"aria-level": "1",
|
|
41
45
|
"aria-live": "polite",
|
|
42
46
|
tabIndex: -1,
|
|
43
|
-
"data-test-id": `title: ${
|
|
44
|
-
|
|
45
|
-
,
|
|
46
|
-
dangerouslySetInnerHTML: {
|
|
47
|
-
__html: title
|
|
48
|
-
}
|
|
47
|
+
"data-test-id": `title: ${text}`,
|
|
48
|
+
children: text
|
|
49
49
|
});
|
|
50
50
|
};
|
|
51
51
|
export default AppBarTitle;
|
package/package.json
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@shopgate/pwa-ui-ios",
|
|
3
|
-
"version": "7.31.
|
|
3
|
+
"version": "7.31.9-beta.2",
|
|
4
4
|
"description": "Shopgate's iOS UI components.",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"license": "Apache-2.0",
|
|
7
7
|
"devDependencies": {
|
|
8
|
-
"@shopgate/pwa-common": "7.31.
|
|
8
|
+
"@shopgate/pwa-common": "7.31.9-beta.2",
|
|
9
9
|
"react": "^17.0.2"
|
|
10
10
|
},
|
|
11
11
|
"peerDependencies": {
|