@shopgate/pwa-ui-ios 7.32.0-beta.9 → 7.32.1-beta.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,7 +1,8 @@
1
- import React from 'react';
1
+ import React, { useMemo } from 'react';
2
2
  import PropTypes from 'prop-types';
3
3
  import { Typography } from '@shopgate/engage/components';
4
4
  import { makeStyles } from '@shopgate/engage/styles';
5
+ import htmlToText from '@shopgate/pwa-common/helpers/html/htmlToText';
5
6
  import { jsx as _jsx } from "react/jsx-runtime";
6
7
  const useStyles = makeStyles()({
7
8
  root: {
@@ -26,7 +27,10 @@ const AppBarTitle = ({
26
27
  classes,
27
28
  cx
28
29
  } = useStyles();
29
- if (!title) {
30
+ // Titles can contain HTML entities (e.g. product names). They are decoded to plain text, since
31
+ // titles might originate from untrusted sources like URL parameters and must not render as HTML.
32
+ const text = useMemo(() => htmlToText(title), [title]);
33
+ if (!text) {
30
34
  return null;
31
35
  }
32
36
  return /*#__PURE__*/_jsx(Typography, {
@@ -40,10 +44,8 @@ const AppBarTitle = ({
40
44
  "aria-level": "1",
41
45
  "aria-live": "polite",
42
46
  tabIndex: -1,
43
- "data-test-id": `title: ${title}`,
44
- dangerouslySetInnerHTML: {
45
- __html: title
46
- }
47
+ "data-test-id": `title: ${text}`,
48
+ children: text
47
49
  });
48
50
  };
49
51
  export default AppBarTitle;
@@ -6,7 +6,9 @@ import { jsx as _jsx } from "react/jsx-runtime";
6
6
  const useStyles = makeStyles()(theme => ({
7
7
  title: {
8
8
  textAlign: 'center',
9
- fontWeight: theme.typography.fontWeightBold
9
+ fontWeight: theme.typography.fontWeightBold,
10
+ color: theme.palette.common.black,
11
+ paddingBottom: theme.spacing(1)
10
12
  }
11
13
  }));
12
14
 
@@ -18,7 +18,10 @@ const useStyles = makeStyles()({
18
18
  maxHeight: `calc(100vh - ${outerGap * 2}px)`,
19
19
  borderRadius: 14,
20
20
  background: 'rgba(255, 255, 255, 0.82)',
21
- backdropFilter: 'blur(20px)'
21
+ backdropFilter: 'blur(20px)',
22
+ '& input, & textarea': {
23
+ color: 'inherit'
24
+ }
22
25
  },
23
26
  content: {
24
27
  padding: '16px',
package/package.json CHANGED
@@ -1,11 +1,11 @@
1
1
  {
2
2
  "name": "@shopgate/pwa-ui-ios",
3
- "version": "7.32.0-beta.9",
3
+ "version": "7.32.1-beta.1",
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.32.0-beta.9",
8
+ "@shopgate/pwa-common": "7.32.1-beta.1",
9
9
  "react": "^17.0.2"
10
10
  },
11
11
  "peerDependencies": {
@@ -1,29 +0,0 @@
1
- import React from 'react';
2
- import { shallow } from 'enzyme';
3
- import { Button } from '@shopgate/engage/components/v2';
4
- import Buttons from "./index";
5
- import { jsx as _jsx } from "react/jsx-runtime";
6
- const actions = [{
7
- label: 'action0',
8
- action: jest.fn()
9
- }, {
10
- label: 'action1',
11
- action: jest.fn()
12
- }, {
13
- label: 'action2',
14
- action: jest.fn()
15
- }];
16
- describe('<Buttons />', () => {
17
- it('should not render if no actions are passed', () => {
18
- const wrapper = shallow(/*#__PURE__*/_jsx(Buttons, {}));
19
- expect(wrapper).toMatchSnapshot();
20
- expect(wrapper.instance()).toEqual(null);
21
- });
22
- it('should render buttons', () => {
23
- const wrapper = shallow(/*#__PURE__*/_jsx(Buttons, {
24
- actions: actions
25
- }));
26
- expect(wrapper).toMatchSnapshot();
27
- expect(wrapper.find(Button).length).toBe(actions.length);
28
- });
29
- });
@@ -1,18 +0,0 @@
1
- import React from 'react';
2
- import { shallow } from 'enzyme';
3
- import Content from "./index";
4
- import { jsx as _jsx } from "react/jsx-runtime";
5
- describe('<Content />', () => {
6
- it('should not render if no content is passed', () => {
7
- const wrapper = shallow(/*#__PURE__*/_jsx(Content, {}));
8
- expect(wrapper).toMatchSnapshot();
9
- expect(wrapper.instance()).toEqual(null);
10
- });
11
- it('should render content components', () => {
12
- const wrapper = shallow(/*#__PURE__*/_jsx(Content, {
13
- content: "Hello World"
14
- }));
15
- expect(wrapper).toMatchSnapshot();
16
- expect(wrapper.find('[id="basicDialogDesc"]').length).toBe(1);
17
- });
18
- });
@@ -1,18 +0,0 @@
1
- import React from 'react';
2
- import { shallow } from 'enzyme';
3
- import Title from "./index";
4
- import { jsx as _jsx } from "react/jsx-runtime";
5
- describe('<Title />', () => {
6
- it('should not render without a title', () => {
7
- const wrapper = shallow(/*#__PURE__*/_jsx(Title, {}));
8
- expect(wrapper).toMatchSnapshot();
9
- expect(wrapper.instance()).toEqual(null);
10
- });
11
- it('should render with a title', () => {
12
- const wrapper = shallow(/*#__PURE__*/_jsx(Title, {
13
- title: "Some test title"
14
- }));
15
- expect(wrapper).toMatchSnapshot();
16
- expect(wrapper.find('[id="basicDialogTitle"]').length).toBe(1);
17
- });
18
- });
@@ -1,44 +0,0 @@
1
- import React from 'react';
2
- import { shallow } from 'enzyme';
3
- import Title from "./components/Title";
4
- import Content from "./components/Content";
5
- import Buttons from "./components/Buttons";
6
- import BasicDialog from "./index";
7
- import { jsx as _jsx } from "react/jsx-runtime";
8
- const props = {
9
- title: 'Hello World',
10
- children: /*#__PURE__*/_jsx("div", {
11
- children: "Hello World"
12
- }),
13
- actions: [{
14
- label: 'action0',
15
- action: jest.fn()
16
- }, {
17
- label: 'action1',
18
- action: jest.fn()
19
- }, {
20
- label: 'action2',
21
- action: jest.fn()
22
- }]
23
- };
24
- jest.mock('@shopgate/engage/a11y/components');
25
- describe('<BasicDialog />', () => {
26
- it('should render with minimal props', () => {
27
- const wrapper = shallow(/*#__PURE__*/_jsx(BasicDialog, {
28
- actions: []
29
- }));
30
- expect(wrapper).toMatchSnapshot();
31
- });
32
- it('should render as expected', () => {
33
- const wrapper = shallow(/*#__PURE__*/_jsx(BasicDialog, {
34
- ...props
35
- }));
36
- expect(wrapper).toMatchSnapshot();
37
- expect(wrapper.find(Title).length).toBe(1);
38
- expect(wrapper.find(Title).props().title).toEqual(props.title);
39
- expect(wrapper.find(Content).length).toBe(1);
40
- expect(wrapper.find(Content).props().content).toEqual(props.children);
41
- expect(wrapper.find(Buttons).length).toBe(1);
42
- expect(wrapper.find(Buttons).props().actions).toEqual(props.actions);
43
- });
44
- });
@@ -1,16 +0,0 @@
1
- {
2
- "extends": "@shopgate/engage/tsconfig.build.json",
3
- "compilerOptions": {
4
- "outDir": "./dist",
5
- "rootDir": "."
6
- },
7
- "include": ["**/*.ts", "**/*.tsx"],
8
- "exclude": [
9
- "dist",
10
- "node_modules",
11
- "**/*.spec.*",
12
- "**/__tests__/**",
13
- "**/__snapshots__/**",
14
- "coverage"
15
- ]
16
- }
package/tsconfig.json DELETED
@@ -1,3 +0,0 @@
1
- {
2
- "extends": "@shopgate/engage/tsconfig.json",
3
- }