@shopgate/pwa-ui-shared 7.34.0-beta.1 → 7.34.0-beta.3

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,5 +1,6 @@
1
1
  import React from 'react';
2
2
  import PropTypes from 'prop-types';
3
+ import SafeHtml from '@shopgate/engage/components/SafeHtml';
3
4
  import BasicDialog from "../BasicDialog";
4
5
 
5
6
  /**
@@ -16,10 +17,9 @@ const HtmlContentDialog = ({
16
17
  }) => /*#__PURE__*/_jsx(BasicDialog, {
17
18
  title: title,
18
19
  actions: actions,
19
- children: /*#__PURE__*/_jsx("div", {
20
- dangerouslySetInnerHTML: {
21
- __html: message
22
- }
20
+ children: /*#__PURE__*/_jsx(SafeHtml, {
21
+ profile: "html",
22
+ html: message
23
23
  })
24
24
  });
25
25
  HtmlContentDialog.defaultProps = {
@@ -1,8 +1,16 @@
1
1
  import React from 'react';
2
2
  import PropTypes from 'prop-types';
3
3
  import { I18n } from '@shopgate/engage/components';
4
- import { i18n, nl2br } from '@shopgate/engage/core';
4
+ import SafeHtml from '@shopgate/engage/components/SafeHtml';
5
+ import { i18n } from '@shopgate/engage/core';
6
+ import { makeStyles } from '@shopgate/engage/styles';
5
7
  import BasicDialog from "../BasicDialog";
8
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
9
+ const useStyles = makeStyles()({
10
+ message: {
11
+ whiteSpace: 'pre-line'
12
+ }
13
+ });
6
14
 
7
15
  /**
8
16
  * Renders a simple dialog with a title and a text message.
@@ -10,22 +18,26 @@ import BasicDialog from "../BasicDialog";
10
18
  * @param {Object} props The component properties.
11
19
  * @returns {JSX} The rendered component.
12
20
  */
13
- import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
14
21
  const TextMessageDialog = ({
15
22
  actions,
16
23
  message,
17
24
  title,
18
25
  params,
19
26
  children
20
- }) => /*#__PURE__*/_jsxs(BasicDialog, {
21
- title: title,
22
- actions: actions,
23
- children: [/*#__PURE__*/_jsx("span", {
24
- dangerouslySetInnerHTML: {
25
- __html: nl2br(i18n.text(message, params))
26
- }
27
- }), children]
28
- });
27
+ }) => {
28
+ const {
29
+ classes
30
+ } = useStyles();
31
+ return /*#__PURE__*/_jsxs(BasicDialog, {
32
+ title: title,
33
+ actions: actions,
34
+ children: [/*#__PURE__*/_jsx(SafeHtml, {
35
+ as: "span",
36
+ className: classes.message,
37
+ html: String(i18n.text(message, params))
38
+ }), children]
39
+ });
40
+ };
29
41
  TextMessageDialog.defaultProps = {
30
42
  title: BasicDialog.defaultProps.title,
31
43
  params: I18n.Text.defaultProps.params,
@@ -1,6 +1,7 @@
1
1
  import React from 'react';
2
2
  import PropTypes from 'prop-types';
3
3
  import { makeStyles } from '@shopgate/engage/styles';
4
+ import SafeHtml from '@shopgate/engage/components/SafeHtml';
4
5
  import { jsx as _jsx } from "react/jsx-runtime";
5
6
  const useStyles = makeStyles()(theme => ({
6
7
  root: {
@@ -25,10 +26,9 @@ const Manufacturer = ({
25
26
  } = useStyles();
26
27
  return /*#__PURE__*/_jsx("div", {
27
28
  className: cx(classes.root, className, 'ui-shared__manufacturer'),
28
- children: /*#__PURE__*/_jsx("span", {
29
- dangerouslySetInnerHTML: {
30
- __html: text
31
- }
29
+ children: /*#__PURE__*/_jsx(SafeHtml, {
30
+ as: "span",
31
+ html: text
32
32
  })
33
33
  });
34
34
  };
@@ -1,6 +1,7 @@
1
1
  import React from 'react';
2
2
  import PropTypes from 'prop-types';
3
3
  import { makeStyles } from '@shopgate/engage/styles';
4
+ import SafeHtml from '@shopgate/engage/components/SafeHtml';
4
5
  import { jsx as _jsx } from "react/jsx-runtime";
5
6
  const useStyles = makeStyles()(theme => ({
6
7
  root: {
@@ -23,14 +24,10 @@ const PriceInfo = ({
23
24
  classes,
24
25
  cx
25
26
  } = useStyles();
26
- return /*#__PURE__*/_jsx("div", {
27
- className: cx(classes.root, className, 'ui-shared__price-info')
28
- // eslint-disable-next-line react/no-danger
29
- ,
30
- dangerouslySetInnerHTML: {
31
- __html: text
32
- },
33
- "data-test-id": `priceInfo: ${text}`
27
+ return /*#__PURE__*/_jsx(SafeHtml, {
28
+ className: cx(classes.root, className, 'ui-shared__price-info'),
29
+ "data-test-id": `priceInfo: ${text}`,
30
+ html: text
34
31
  });
35
32
  };
36
33
  PriceInfo.defaultProps = {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@shopgate/pwa-ui-shared",
3
- "version": "7.34.0-beta.1",
3
+ "version": "7.34.0-beta.3",
4
4
  "description": "Shopgate's shared UI components.",
5
5
  "main": "index.js",
6
6
  "license": "Apache-2.0",
@@ -10,13 +10,13 @@
10
10
  "directory": "libraries/ui-shared"
11
11
  },
12
12
  "dependencies": {
13
- "@shopgate/pwa-ui-ios": "7.34.0-beta.1",
14
- "@shopgate/pwa-ui-material": "7.34.0-beta.1",
13
+ "@shopgate/pwa-ui-ios": "7.34.0-beta.3",
14
+ "@shopgate/pwa-ui-material": "7.34.0-beta.3",
15
15
  "css-spring": "git+https://github.com/shopgate/css-spring.git#master"
16
16
  },
17
17
  "devDependencies": {
18
- "@shopgate/pwa-common": "7.34.0-beta.1",
19
- "@shopgate/pwa-common-commerce": "7.34.0-beta.1",
18
+ "@shopgate/pwa-common": "7.34.0-beta.3",
19
+ "@shopgate/pwa-common-commerce": "7.34.0-beta.3",
20
20
  "classnames": "2.5.1",
21
21
  "react": "^17.0.2"
22
22
  },