@shopgate/pwa-common 7.30.0-alpha.9 → 7.30.0-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.
Files changed (106) hide show
  1. package/App.js +28 -13
  2. package/actions/app/handleUniversalLink.js +0 -2
  3. package/collections/AuthRoutes.js +15 -13
  4. package/collections/Configuration.js +11 -10
  5. package/collections/EmbeddedMedia.js +21 -19
  6. package/collections/PersistedReducers.js +11 -9
  7. package/collections/Redirects.js +15 -13
  8. package/collections/media-providers/MediaProvider.js +23 -21
  9. package/collections/media-providers/Vimeo.js +28 -22
  10. package/collections/media-providers/YouTube.js +17 -10
  11. package/components/Backdrop/index.js +15 -13
  12. package/components/Backdrop/spec.js +3 -2
  13. package/components/Button/index.js +41 -29
  14. package/components/Button/spec.js +16 -10
  15. package/components/Checkbox/index.js +36 -28
  16. package/components/Checkbox/spec.js +40 -27
  17. package/components/Consume/index.js +4 -1
  18. package/components/CountdownTimer/index.js +27 -20
  19. package/components/CountdownTimer/spec.js +2 -1
  20. package/components/Drawer/index.js +31 -23
  21. package/components/Drawer/spec.js +7 -6
  22. package/components/Dropdown/index.js +27 -18
  23. package/components/Ellipsis/index.js +5 -3
  24. package/components/Ellipsis/spec.js +5 -3
  25. package/components/EmbeddedMedia/index.js +9 -6
  26. package/components/EmbeddedMedia/spec.js +11 -2
  27. package/components/ErrorBoundary/index.js +26 -16
  28. package/components/Grid/components/Item/index.js +13 -6
  29. package/components/Grid/components/Item/spec.js +4 -3
  30. package/components/Grid/index.js +13 -6
  31. package/components/Grid/spec.js +4 -3
  32. package/components/HtmlSanitizer/index.js +42 -45
  33. package/components/HtmlSanitizer/spec.js +16 -12
  34. package/components/I18n/components/FormatDate/index.js +11 -4
  35. package/components/I18n/components/FormatDate/spec.js +22 -14
  36. package/components/I18n/components/FormatNumber/index.js +8 -6
  37. package/components/I18n/components/FormatNumber/spec.js +10 -5
  38. package/components/I18n/components/FormatPrice/index.js +5 -3
  39. package/components/I18n/components/FormatPrice/spec.js +22 -14
  40. package/components/I18n/components/FormatTime/index.js +11 -4
  41. package/components/I18n/components/FormatTime/spec.js +22 -14
  42. package/components/I18n/components/I18nProvider/index.js +18 -11
  43. package/components/I18n/components/I18nProvider/spec.js +2 -1
  44. package/components/I18n/components/Placeholder/index.js +10 -3
  45. package/components/I18n/components/Placeholder/spec.js +12 -5
  46. package/components/I18n/components/Translate/index.js +12 -8
  47. package/components/I18n/components/Translate/spec.js +9 -6
  48. package/components/Icon/index.js +2 -1
  49. package/components/Image/Image.js +23 -21
  50. package/components/Image/ImageInner.js +2 -1
  51. package/components/InfiniteContainer/index.js +59 -53
  52. package/components/InfiniteContainer/spec.js +10 -5
  53. package/components/Input/components/MultiLineInput.js +33 -26
  54. package/components/Input/components/SimpleInput.js +70 -54
  55. package/components/Input/index.js +7 -17
  56. package/components/Input/spec.js +12 -11
  57. package/components/KeyboardConsumer/index.js +19 -13
  58. package/components/Link/index.js +28 -20
  59. package/components/Link/spec.js +13 -9
  60. package/components/List/components/Item/index.js +5 -3
  61. package/components/List/index.js +5 -3
  62. package/components/List/spec.js +6 -9
  63. package/components/Loading/index.js +1 -3
  64. package/components/Modal/index.js +13 -10
  65. package/components/ModalContainer/spec.js +24 -20
  66. package/components/Picker/components/Button/index.js +18 -12
  67. package/components/Picker/components/List/index.js +19 -16
  68. package/components/Picker/components/Modal/index.js +34 -25
  69. package/components/Picker/index.js +44 -33
  70. package/components/Picker/spec.js +4 -1
  71. package/components/Portal/index.js +26 -17
  72. package/components/ProductCharacteristics/index.js +65 -57
  73. package/components/RangeSlider/components/Handle/index.js +7 -5
  74. package/components/RangeSlider/index.js +98 -84
  75. package/components/Route/RouteNotFound.js +30 -19
  76. package/components/Route/index.js +31 -21
  77. package/components/Router/index.js +51 -34
  78. package/components/ScannerContainer/index.js +17 -10
  79. package/components/Select/components/Item/index.js +5 -3
  80. package/components/Select/index.js +59 -47
  81. package/components/Select/spec.js +7 -6
  82. package/components/SelectBox/components/Item/index.js +23 -13
  83. package/components/SelectBox/index.js +83 -80
  84. package/components/SelectBox/spec.js +8 -5
  85. package/components/SurroundPortals/index.js +15 -11
  86. package/components/Swiper/components/SwiperItem/index.js +6 -5
  87. package/components/Swiper/components/SwiperItem/spec.js +8 -4
  88. package/components/Swiper/index.js +23 -20
  89. package/components/Toaster/index.js +4 -1
  90. package/components/Transition/index.js +19 -12
  91. package/components/Widgets/components/Widget/index.js +27 -16
  92. package/components/Widgets/components/Widget/spec.js +5 -4
  93. package/components/Widgets/components/WidgetGrid/index.js +27 -19
  94. package/components/Widgets/components/WidgetGrid/spec.js +4 -3
  95. package/components/Widgets/index.js +33 -26
  96. package/components/Widgets/spec.js +12 -13
  97. package/helpers/data/index.js +1 -1
  98. package/helpers/portals/portalCollection.js +13 -10
  99. package/helpers/redux/mutable.js +2 -2
  100. package/package.json +5 -5
  101. package/providers/loading/index.js +71 -57
  102. package/providers/toast/index.js +39 -28
  103. package/reducers/modal/index.js +1 -1
  104. package/store/index.js +1 -1
  105. package/subscriptions/helpers/buildRegisterUrl.js +1 -0
  106. package/components/Input/components/DateInput.js +0 -273
@@ -1,3 +1,4 @@
1
+ import _inheritsLoose from "@babel/runtime/helpers/inheritsLoose";
1
2
  import React, { Component } from 'react';
2
3
  import PropTypes from 'prop-types';
3
4
  import padStart from 'lodash/padStart';
@@ -11,6 +12,7 @@ import I18n from "../I18n";
11
12
  * @param {number} seconds The remaining seconds.
12
13
  * @return {Object} String and params for the i18n component
13
14
  */
15
+ import { jsx as _jsx } from "react/jsx-runtime";
14
16
  export const getFormattedTimeString = (days, hours, minutes, seconds) => {
15
17
  const formattedHours = padStart(hours, 2, '0');
16
18
  const formattedMinutes = padStart(minutes, 2, '0');
@@ -44,27 +46,31 @@ const createFormattedTime = timeSpanInput => {
44
46
  /**
45
47
  * The Countdown timer component.
46
48
  */
47
- class CountdownTimer extends Component {
49
+ let CountdownTimer = /*#__PURE__*/function (_Component) {
48
50
  /**
49
51
  * The component constructor.
50
52
  * @param {Object} props The component properties.
51
53
  */
52
- constructor(props) {
53
- super(props);
54
- this.intervalHandle = null;
55
- this.remainingTime = this.getRemainingTime();
56
- this.expired = this.remainingTime <= 0;
54
+ function CountdownTimer(props) {
55
+ var _this;
56
+ _this = _Component.call(this, props) || this;
57
+ _this.intervalHandle = null;
58
+ _this.remainingTime = _this.getRemainingTime();
59
+ _this.expired = _this.remainingTime <= 0;
57
60
 
58
61
  // Calculate the initial formatted time string.
59
- this.state = {
60
- formattedTime: createFormattedTime(this.remainingTime)
62
+ _this.state = {
63
+ formattedTime: createFormattedTime(_this.remainingTime)
61
64
  };
65
+ return _this;
62
66
  }
63
67
 
64
68
  /**
65
69
  * Installs a new interval to update the timer if the component did mount.
66
70
  */
67
- componentDidMount() {
71
+ _inheritsLoose(CountdownTimer, _Component);
72
+ var _proto = CountdownTimer.prototype;
73
+ _proto.componentDidMount = function componentDidMount() {
68
74
  // Install the interval.
69
75
  this.intervalHandle = setInterval(() => {
70
76
  /**
@@ -78,8 +84,8 @@ class CountdownTimer extends Component {
78
84
 
79
85
  /**
80
86
  * Clears the timer interval.
81
- */
82
- componentWillUnmount() {
87
+ */;
88
+ _proto.componentWillUnmount = function componentWillUnmount() {
83
89
  if (this.intervalHandle) {
84
90
  clearInterval(this.intervalHandle);
85
91
  }
@@ -87,15 +93,15 @@ class CountdownTimer extends Component {
87
93
 
88
94
  /**
89
95
  * @returns {number} The remaining time until the timer runs out.
90
- */
91
- getRemainingTime() {
96
+ */;
97
+ _proto.getRemainingTime = function getRemainingTime() {
92
98
  return Math.ceil(this.props.timeout - Date.now() / 1000);
93
99
  }
94
100
 
95
101
  /**
96
102
  * Updates the formatted time. Will not cause a re-rendering of the component.
97
- */
98
- updateTimer() {
103
+ */;
104
+ _proto.updateTimer = function updateTimer() {
99
105
  // Calculate the remaining time until the timer is expired. Also ignore negative durations.
100
106
  const deltaTime = Math.max(0, this.remainingTime);
101
107
  const isExpired = deltaTime <= 0;
@@ -119,15 +125,16 @@ class CountdownTimer extends Component {
119
125
  /**
120
126
  * Renders the element.
121
127
  * @return {JSX.Element}
122
- */
123
- render() {
124
- return /*#__PURE__*/React.createElement(I18n.Text, {
128
+ */;
129
+ _proto.render = function render() {
130
+ return /*#__PURE__*/_jsx(I18n.Text, {
125
131
  string: this.state.formattedTime.string,
126
132
  params: this.state.formattedTime.params,
127
133
  className: `${this.props.className} common__countdown-timer`
128
134
  });
129
- }
130
- }
135
+ };
136
+ return CountdownTimer;
137
+ }(Component);
131
138
  CountdownTimer.defaultProps = {
132
139
  className: '',
133
140
  onExpire: null
@@ -2,6 +2,7 @@ import React from 'react';
2
2
  import { shallow } from 'enzyme';
3
3
  import { act } from 'react-dom/test-utils';
4
4
  import CountdownTimer, { getFormattedTimeString } from "./index";
5
+ import { jsx as _jsx } from "react/jsx-runtime";
5
6
  describe('<CountdownTimer>', () => {
6
7
  jest.useFakeTimers();
7
8
 
@@ -16,7 +17,7 @@ describe('<CountdownTimer>', () => {
16
17
  */
17
18
  const createTimerElement = (remainingDays, remainingHours, remainingMinutes, remainingSeconds, callback) => {
18
19
  const timeout = Math.floor(Date.now() / 1000) + remainingDays * 86400 + remainingHours * 3600 + remainingMinutes * 60 + remainingSeconds;
19
- const wrapper = shallow(/*#__PURE__*/React.createElement(CountdownTimer, {
20
+ const wrapper = shallow(/*#__PURE__*/_jsx(CountdownTimer, {
20
21
  timeout: timeout,
21
22
  onExpire: callback
22
23
  }));
@@ -1,3 +1,4 @@
1
+ import _inheritsLoose from "@babel/runtime/helpers/inheritsLoose";
1
2
  import React, { Component } from 'react';
2
3
  import PropTypes from 'prop-types';
3
4
  import classNames from 'classnames';
@@ -6,34 +7,39 @@ import styles from "./style";
6
7
  /**
7
8
  * Drawer component.
8
9
  */
9
- class Drawer extends Component {
10
+ import { jsx as _jsx } from "react/jsx-runtime";
11
+ let Drawer = /*#__PURE__*/function (_Component) {
10
12
  /**
11
13
  * Initializes the Drawer component.
12
14
  * @param {Object} props The components props.
13
15
  */
14
- constructor(props) {
15
- super(props);
16
+ function Drawer(props) {
17
+ var _this;
18
+ _this = _Component.call(this, props) || this;
16
19
  /**
17
20
  * Syncs the internal active state when an animation ends.
18
21
  */
19
- this.handleAnimationEnd = () => {
20
- this.setState({
21
- active: this.props.isOpen
22
+ _this.handleAnimationEnd = () => {
23
+ _this.setState({
24
+ active: _this.props.isOpen
22
25
  });
23
- if (!this.props.isOpen) {
24
- this.props.onDidClose();
26
+ if (!_this.props.isOpen) {
27
+ _this.props.onDidClose();
25
28
  } else {
26
- this.props.onDidOpen();
29
+ _this.props.onDidOpen();
27
30
  }
28
31
  };
29
- this.sheetRef = /*#__PURE__*/React.createRef();
30
- this.state = {
32
+ _this.sheetRef = /*#__PURE__*/React.createRef();
33
+ _this.state = {
31
34
  active: props.isOpen
32
35
  };
36
+ return _this;
33
37
  }
34
38
 
35
39
  /** inheritdoc */
36
- componentDidMount() {
40
+ _inheritsLoose(Drawer, _Component);
41
+ var _proto = Drawer.prototype;
42
+ _proto.componentDidMount = function componentDidMount() {
37
43
  if (this.props.isOpen) {
38
44
  if (this.sheetRef.current) {
39
45
  this.sheetRef.current.focus();
@@ -44,8 +50,8 @@ class Drawer extends Component {
44
50
  /**
45
51
  * Update state when isOpen changes.
46
52
  * @param {Object} nextProps The next component props.
47
- */
48
- UNSAFE_componentWillReceiveProps(nextProps) {
53
+ */;
54
+ _proto.UNSAFE_componentWillReceiveProps = function UNSAFE_componentWillReceiveProps(nextProps) {
49
55
  if (this.props.isOpen !== nextProps.isOpen) {
50
56
  if (nextProps.isOpen) {
51
57
  if (typeof nextProps.onOpen === 'function') {
@@ -63,19 +69,19 @@ class Drawer extends Component {
63
69
  /**
64
70
  * Set focus for a11y when sheet opens
65
71
  * @param {Object} prevProps The previous component props.
66
- */
67
- componentDidUpdate(prevProps) {
72
+ */;
73
+ _proto.componentDidUpdate = function componentDidUpdate(prevProps) {
68
74
  if (!prevProps.isOpen && this.props.isOpen) {
69
75
  if (this.sheetRef.current) {
70
76
  this.sheetRef.current.focus();
71
77
  }
72
78
  }
73
- }
79
+ };
74
80
  /**
75
81
  * Renders the component.
76
82
  * @returns {JSX}
77
83
  */
78
- render() {
84
+ _proto.render = function render() {
79
85
  const {
80
86
  className,
81
87
  children,
@@ -96,7 +102,7 @@ class Drawer extends Component {
96
102
  if (typeof animation.duration === 'number') {
97
103
  style.animationDuration = `${animation.duration}ms`;
98
104
  }
99
- return active ? /*#__PURE__*/React.createElement("div", {
105
+ return active ? /*#__PURE__*/_jsx("div", {
100
106
  ref: this.sheetRef,
101
107
  className: combinedClassName,
102
108
  style: style,
@@ -111,10 +117,12 @@ class Drawer extends Component {
111
117
  },
112
118
  role: "dialog",
113
119
  "aria-modal": true,
114
- tabIndex: -1
115
- }, children) : null;
116
- }
117
- }
120
+ tabIndex: -1,
121
+ children: children
122
+ }) : null;
123
+ };
124
+ return Drawer;
125
+ }(Component);
118
126
  /**
119
127
  * The component prop types.
120
128
  * @type {Object}
@@ -1,6 +1,7 @@
1
1
  import React from 'react';
2
2
  import { mount, shallow } from 'enzyme';
3
3
  import Drawer from "./index";
4
+ import { jsx as _jsx } from "react/jsx-runtime";
4
5
  jest.mock('@shopgate/engage/a11y/components');
5
6
  describe('<Drawer />', () => {
6
7
  const onOpen = jest.fn();
@@ -11,11 +12,11 @@ describe('<Drawer />', () => {
11
12
  jest.clearAllMocks();
12
13
  });
13
14
  it('should render', () => {
14
- const wrapper = shallow(/*#__PURE__*/React.createElement(Drawer, null));
15
+ const wrapper = shallow(/*#__PURE__*/_jsx(Drawer, {}));
15
16
  expect(wrapper).toMatchSnapshot();
16
17
  });
17
18
  it('should execute callback when drawer is opened', () => {
18
- const wrapper = mount(/*#__PURE__*/React.createElement(Drawer, {
19
+ const wrapper = mount(/*#__PURE__*/_jsx(Drawer, {
19
20
  onOpen: onOpen
20
21
  }));
21
22
  wrapper.setProps({
@@ -24,7 +25,7 @@ describe('<Drawer />', () => {
24
25
  expect(onOpen).toBeCalled();
25
26
  });
26
27
  it('should execute callback when drawer is closed', () => {
27
- const wrapper = mount(/*#__PURE__*/React.createElement(Drawer, {
28
+ const wrapper = mount(/*#__PURE__*/_jsx(Drawer, {
28
29
  isOpen: true,
29
30
  onClose: onClose
30
31
  }));
@@ -34,7 +35,7 @@ describe('<Drawer />', () => {
34
35
  expect(onClose).toBeCalled();
35
36
  });
36
37
  it('should add custom classes', () => {
37
- const wrapper = mount(/*#__PURE__*/React.createElement(Drawer, {
38
+ const wrapper = mount(/*#__PURE__*/_jsx(Drawer, {
38
39
  className: "custom-class-name",
39
40
  isOpen: true
40
41
  }));
@@ -42,7 +43,7 @@ describe('<Drawer />', () => {
42
43
  expect(wrapper.hasClass('custom-class-name')).toEqual(true);
43
44
  });
44
45
  it('should execute callback when drawer open animation did end', () => {
45
- const wrapper = mount(/*#__PURE__*/React.createElement(Drawer, {
46
+ const wrapper = mount(/*#__PURE__*/_jsx(Drawer, {
46
47
  className: "custom-class-name",
47
48
  isOpen: false,
48
49
  onOpen: onOpen,
@@ -58,7 +59,7 @@ describe('<Drawer />', () => {
58
59
  expect(onDidOpen).toBeCalled();
59
60
  });
60
61
  it('should execute callback when drawer close animation did end', () => {
61
- const wrapper = mount(/*#__PURE__*/React.createElement(Drawer, {
62
+ const wrapper = mount(/*#__PURE__*/_jsx(Drawer, {
62
63
  className: "custom-class-name",
63
64
  isOpen: true,
64
65
  onClose: onClose,
@@ -1,4 +1,4 @@
1
- import _extends from "@babel/runtime/helpers/extends";
1
+ import _inheritsLoose from "@babel/runtime/helpers/inheritsLoose";
2
2
  import React, { Component } from 'react';
3
3
  import PropTypes from 'prop-types';
4
4
  import Transition from "../Transition";
@@ -9,23 +9,28 @@ import transitions from "./transitions";
9
9
  * This component slides it's child content up or down based on it's isOpen property.
10
10
  * @returns {JSX}
11
11
  */
12
- class Dropdown extends Component {
12
+ import { jsx as _jsx } from "react/jsx-runtime";
13
+ let Dropdown = /*#__PURE__*/function (_Component) {
13
14
  /**
14
15
  * Constructor
15
16
  * @param {Object} props Props of the Component
16
17
  */
17
- constructor(props) {
18
- super(props);
19
- this.state = {
18
+ function Dropdown(props) {
19
+ var _this;
20
+ _this = _Component.call(this, props) || this;
21
+ _this.state = {
20
22
  initialRender: true
21
23
  };
24
+ return _this;
22
25
  }
23
26
 
24
27
  /**
25
28
  * Update the initialRender state if the isOpen state changes from false to true
26
29
  * @param {Object} nextProps The new props
27
30
  */
28
- UNSAFE_componentWillReceiveProps(nextProps) {
31
+ _inheritsLoose(Dropdown, _Component);
32
+ var _proto = Dropdown.prototype;
33
+ _proto.UNSAFE_componentWillReceiveProps = function UNSAFE_componentWillReceiveProps(nextProps) {
29
34
  if (this.props.isOpen === false && nextProps.isOpen === true) {
30
35
  this.setState({
31
36
  initialRender: false
@@ -37,33 +42,37 @@ class Dropdown extends Component {
37
42
  * Only update the component if isOpen changed
38
43
  * @param {Object} nextProps The new props
39
44
  * @returns {boolean}
40
- */
41
- shouldComponentUpdate(nextProps) {
45
+ */;
46
+ _proto.shouldComponentUpdate = function shouldComponentUpdate(nextProps) {
42
47
  return this.props.isOpen !== nextProps.isOpen;
43
48
  }
44
49
 
45
50
  /**
46
51
  * Renders the component.
47
52
  * @returns {JSX}
48
- */
49
- render() {
53
+ */;
54
+ _proto.render = function render() {
50
55
  let transitionProps;
51
56
  if (this.props.isOpen) {
52
57
  transitionProps = this.state.initialRender ? transitions.initialOpen : transitions.open;
53
58
  } else {
54
59
  transitionProps = this.state.initialRender ? transitions.initialClose : transitions.close;
55
60
  }
56
- return /*#__PURE__*/React.createElement(Transition, _extends({}, transitionProps, {
61
+ return /*#__PURE__*/_jsx(Transition, {
62
+ ...transitionProps,
57
63
  onComplete: this.props.onComplete,
58
64
  onStart: this.props.onStart,
59
65
  duration: this.props.duration,
60
- easing: this.props.easing
61
- }), /*#__PURE__*/React.createElement("div", {
62
- className: `${styles} ${this.props.className} common__dropdown`,
63
- "aria-hidden": !this.props.isOpen
64
- }, this.props.children));
65
- }
66
- }
66
+ easing: this.props.easing,
67
+ children: /*#__PURE__*/_jsx("div", {
68
+ className: `${styles} ${this.props.className} common__dropdown`,
69
+ "aria-hidden": !this.props.isOpen,
70
+ children: this.props.children
71
+ })
72
+ });
73
+ };
74
+ return Dropdown;
75
+ }(Component);
67
76
  Dropdown.defaultProps = {
68
77
  className: '',
69
78
  children: null,
@@ -7,11 +7,13 @@ import Dotdotdot from 'react-dotdotdot';
7
7
  * @param {Object} props The component props.
8
8
  * @returns {JSX.Element}
9
9
  */
10
- const Ellipsis = props => /*#__PURE__*/React.createElement(Dotdotdot, {
10
+ import { jsx as _jsx } from "react/jsx-runtime";
11
+ const Ellipsis = props => /*#__PURE__*/_jsx(Dotdotdot, {
11
12
  clamp: props.rows,
12
13
  className: `${props.className} common__ellipsis`,
13
- useNativeClamp: true
14
- }, props.children);
14
+ useNativeClamp: true,
15
+ children: props.children
16
+ });
15
17
  Ellipsis.defaultProps = {
16
18
  className: '',
17
19
  rows: 3
@@ -1,13 +1,15 @@
1
1
  import React from 'react';
2
2
  import { shallow } from 'enzyme';
3
3
  import Ellipsis from "./index";
4
+ import { jsx as _jsx } from "react/jsx-runtime";
4
5
  const clamp = 3;
5
6
  const text = 'Some very long text that should be cut off by this ellipsis component.';
6
7
  describe('<Ellipsis />', () => {
7
8
  it('should render', () => {
8
- const wrapper = shallow(/*#__PURE__*/React.createElement(Ellipsis, {
9
- rows: clamp
10
- }, text));
9
+ const wrapper = shallow(/*#__PURE__*/_jsx(Ellipsis, {
10
+ rows: clamp,
11
+ children: text
12
+ }));
11
13
  expect(wrapper).toMatchSnapshot();
12
14
  });
13
15
  });
@@ -7,6 +7,7 @@ import { embeddedMedia } from '@shopgate/pwa-common/collections';
7
7
  * EmbeddedMedia component. Handles loading of media related scripts e.g. the Vimeo Player.
8
8
  * @returns {JSX}
9
9
  */
10
+ import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
10
11
  const EmbeddedMedia = ({
11
12
  children,
12
13
  cookieConsentSettings
@@ -45,12 +46,14 @@ const EmbeddedMedia = ({
45
46
  src: provider.remoteScriptUrl,
46
47
  type: 'text/javascript'
47
48
  }));
48
- return /*#__PURE__*/React.createElement(Fragment, null, /*#__PURE__*/React.createElement(Helmet, {
49
- script: scripts
50
- // Helmet doesn't support `onload` in script objects so we have to hack in our own
51
- ,
52
- onChangeClientState: (newState, addedTags) => updateProviderScripts(addedTags)
53
- }), children);
49
+ return /*#__PURE__*/_jsxs(_Fragment, {
50
+ children: [/*#__PURE__*/_jsx(Helmet, {
51
+ script: scripts
52
+ // Helmet doesn't support `onload` in script objects so we have to hack in our own
53
+ ,
54
+ onChangeClientState: (newState, addedTags) => updateProviderScripts(addedTags)
55
+ }), children]
56
+ });
54
57
  };
55
58
  EmbeddedMedia.defaultProps = {
56
59
  cookieConsentSettings: {
@@ -2,6 +2,7 @@ import React from 'react';
2
2
  import { shallow } from 'enzyme';
3
3
  import { embeddedMedia } from '@shopgate/pwa-common/collections';
4
4
  import EmbeddedMedia from "./index";
5
+ import { jsx as _jsx } from "react/jsx-runtime";
5
6
  jest.mock('@shopgate/pwa-common/collections', () => ({
6
7
  embeddedMedia: {
7
8
  getHasPendingProviders: jest.fn(),
@@ -21,12 +22,20 @@ describe('<EmbeddedMedia />', () => {
21
22
  });
22
23
  it('should return children', () => {
23
24
  embeddedMedia.getHasPendingProviders.mockReturnValueOnce(false);
24
- const wrapper = shallow(/*#__PURE__*/React.createElement(EmbeddedMedia, null, /*#__PURE__*/React.createElement("div", null, "Children")));
25
+ const wrapper = shallow(/*#__PURE__*/_jsx(EmbeddedMedia, {
26
+ children: /*#__PURE__*/_jsx("div", {
27
+ children: "Children"
28
+ })
29
+ }));
25
30
  expect(wrapper.html()).toEqual('<div>Children</div>');
26
31
  });
27
32
  it.skip('should render Helmet with a script', () => {
28
33
  embeddedMedia.getHasPendingProviders.mockReturnValueOnce(true);
29
- const wrapper = shallow(/*#__PURE__*/React.createElement(EmbeddedMedia, null, /*#__PURE__*/React.createElement("div", null, "Content with embedded media (youtube, vimeo, etc)")));
34
+ const wrapper = shallow(/*#__PURE__*/_jsx(EmbeddedMedia, {
35
+ children: /*#__PURE__*/_jsx("div", {
36
+ children: "Content with embedded media (youtube, vimeo, etc)"
37
+ })
38
+ }));
30
39
  const helmetProps = wrapper.find('HelmetWrapper').props();
31
40
  expect(helmetProps).toEqual({
32
41
  defer: true,
@@ -1,3 +1,4 @@
1
+ import _inheritsLoose from "@babel/runtime/helpers/inheritsLoose";
1
2
  import { PureComponent } from 'react';
2
3
  import PropTypes from 'prop-types';
3
4
  import connector from "./connector";
@@ -5,27 +6,35 @@ import connector from "./connector";
5
6
  /**
6
7
  * The App error boundary component.
7
8
  */
8
- class ErrorBoundary extends PureComponent {
9
- constructor(...args) {
10
- super(...args);
11
- this.state = {
12
- hasError: false
13
- };
14
- }
9
+ let ErrorBoundary = /*#__PURE__*/function (_PureComponent) {
15
10
  /**
16
- * @returns {{hasError: boolean}}
11
+ * Constructor for the ErrorBoundary component.
12
+ * @param {Object} props - The component props.
17
13
  */
18
- static getDerivedStateFromError() {
19
- return {
20
- hasError: true
14
+ function ErrorBoundary(props) {
15
+ var _this;
16
+ _this = _PureComponent.call(this, props) || this;
17
+ _this.state = {
18
+ hasError: false
21
19
  };
20
+ return _this;
22
21
  }
23
22
 
24
23
  /**
25
24
  * @param {Object} error The error object.
26
25
  * @param {Object} errorInfo The error information.
27
26
  */
28
- componentDidCatch(error, errorInfo) {
27
+ _inheritsLoose(ErrorBoundary, _PureComponent);
28
+ /**
29
+ * @returns {{hasError: boolean}}
30
+ */
31
+ ErrorBoundary.getDerivedStateFromError = function getDerivedStateFromError() {
32
+ return {
33
+ hasError: true
34
+ };
35
+ };
36
+ var _proto = ErrorBoundary.prototype;
37
+ _proto.componentDidCatch = function componentDidCatch(error, errorInfo) {
29
38
  // eslint-disable-next-line no-param-reassign
30
39
  error.stack = errorInfo.componentStack;
31
40
  this.props.appError(error);
@@ -33,14 +42,15 @@ class ErrorBoundary extends PureComponent {
33
42
 
34
43
  /**
35
44
  * @returns {JSX}
36
- */
37
- render() {
45
+ */;
46
+ _proto.render = function render() {
38
47
  if (this.state.hasError) {
39
48
  return this.props.fallbackUi;
40
49
  }
41
50
  return this.props.children;
42
- }
43
- }
51
+ };
52
+ return ErrorBoundary;
53
+ }(PureComponent);
44
54
  ErrorBoundary.defaultProps = {
45
55
  fallbackUi: null
46
56
  };
@@ -1,3 +1,4 @@
1
+ import _inheritsLoose from "@babel/runtime/helpers/inheritsLoose";
1
2
  import React, { Component } from 'react';
2
3
  import PropTypes from 'prop-types';
3
4
  import { objectWithoutProps } from "../../../../helpers/data";
@@ -6,12 +7,17 @@ import styles from "./style";
6
7
  /**
7
8
  * The grid item component.
8
9
  */
9
- class GridItem extends Component {
10
+ let GridItem = /*#__PURE__*/function (_Component) {
11
+ function GridItem() {
12
+ return _Component.apply(this, arguments) || this;
13
+ }
14
+ _inheritsLoose(GridItem, _Component);
15
+ var _proto = GridItem.prototype;
10
16
  /**
11
17
  * Composes the props.
12
18
  * @returns {Object} The composed props.
13
19
  */
14
- getProps() {
20
+ _proto.getProps = function getProps() {
15
21
  let {
16
22
  className
17
23
  } = this.props;
@@ -31,11 +37,12 @@ class GridItem extends Component {
31
37
  /**
32
38
  * Renders the component.
33
39
  * @returns {JSX}
34
- */
35
- render() {
40
+ */;
41
+ _proto.render = function render() {
36
42
  return /*#__PURE__*/React.createElement(this.props.component, this.getProps());
37
- }
38
- }
43
+ };
44
+ return GridItem;
45
+ }(Component);
39
46
  GridItem.defaultProps = {
40
47
  className: '',
41
48
  component: 'li',
@@ -1,20 +1,21 @@
1
1
  import React from 'react';
2
2
  import { shallow } from 'enzyme';
3
3
  import GridItem from "./index";
4
+ import { jsx as _jsx } from "react/jsx-runtime";
4
5
  describe('<GridItem />', () => {
5
6
  it('should render without any further props', () => {
6
- const wrapper = shallow(/*#__PURE__*/React.createElement(GridItem, null));
7
+ const wrapper = shallow(/*#__PURE__*/_jsx(GridItem, {}));
7
8
  expect(wrapper).toMatchSnapshot();
8
9
  });
9
10
  it('should be able to render a custom tag', () => {
10
- const wrapper = shallow(/*#__PURE__*/React.createElement(GridItem, {
11
+ const wrapper = shallow(/*#__PURE__*/_jsx(GridItem, {
11
12
  component: "section"
12
13
  }));
13
14
  expect(wrapper).toMatchSnapshot();
14
15
  expect(wrapper.type()).toEqual('section');
15
16
  });
16
17
  it('should add custom classes on demand', () => {
17
- const wrapper = shallow(/*#__PURE__*/React.createElement(GridItem, {
18
+ const wrapper = shallow(/*#__PURE__*/_jsx(GridItem, {
18
19
  className: "custom-class-name"
19
20
  }));
20
21
  expect(wrapper).toMatchSnapshot();
@@ -1,3 +1,4 @@
1
+ import _inheritsLoose from "@babel/runtime/helpers/inheritsLoose";
1
2
  import React, { Component } from 'react';
2
3
  import PropTypes from 'prop-types';
3
4
  import { objectWithoutProps } from "../../helpers/data";
@@ -7,12 +8,17 @@ import styles, { wrap } from "./style";
7
8
  /**
8
9
  * The grid component.
9
10
  */
10
- class Grid extends Component {
11
+ let Grid = /*#__PURE__*/function (_Component) {
12
+ function Grid() {
13
+ return _Component.apply(this, arguments) || this;
14
+ }
15
+ _inheritsLoose(Grid, _Component);
16
+ var _proto = Grid.prototype;
11
17
  /**
12
18
  * Composes the props.
13
19
  * @returns {Object} The composed props.
14
20
  */
15
- getProps() {
21
+ _proto.getProps = function getProps() {
16
22
  let className = `${this.props.className} ${styles} common__grid`;
17
23
  if (this.props.wrap) {
18
24
  className += ` ${wrap(this.props.wrap)}`;
@@ -27,11 +33,12 @@ class Grid extends Component {
27
33
  /**
28
34
  * Renders the component.
29
35
  * @returns {JSX}
30
- */
31
- render() {
36
+ */;
37
+ _proto.render = function render() {
32
38
  return /*#__PURE__*/React.createElement(this.props.component, this.getProps());
33
- }
34
- }
39
+ };
40
+ return Grid;
41
+ }(Component);
35
42
  Grid.Item = GridItem;
36
43
  Grid.defaultProps = {
37
44
  className: '',