@shopgate/pwa-ui-shared 7.30.0-alpha.10 → 7.30.0-alpha.12

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 (188) hide show
  1. package/AccordionContainer/index.js +17 -11
  2. package/AccordionContainer/spec.js +12 -3
  3. package/ActionButton/index.js +47 -33
  4. package/ActionButton/spec.js +5 -1
  5. package/AddToCartButton/index.js +44 -33
  6. package/AddToCartButton/mock.js +20 -8
  7. package/AddToCartButton/spec.js +4 -3
  8. package/Availability/index.js +5 -3
  9. package/Availability/spec.js +6 -5
  10. package/Button/index.js +73 -58
  11. package/Button/spec.js +16 -10
  12. package/ButtonLink/index.js +20 -12
  13. package/ButtonLink/spec.js +5 -3
  14. package/Card/index.js +5 -3
  15. package/CardList/components/Item/index.js +5 -3
  16. package/CardList/index.js +21 -12
  17. package/CartTotalLine/components/Amount/index.js +10 -8
  18. package/CartTotalLine/components/Hint/index.js +7 -5
  19. package/CartTotalLine/components/Label/index.js +12 -10
  20. package/CartTotalLine/components/Spacer/index.js +5 -3
  21. package/CartTotalLine/index.js +5 -3
  22. package/Checkbox/index.js +6 -5
  23. package/Chip/index.js +28 -22
  24. package/Chip/spec.js +9 -6
  25. package/ContextMenu/ContextMenuProvider.js +5 -3
  26. package/ContextMenu/components/Item/index.js +14 -11
  27. package/ContextMenu/components/Position/index.js +20 -12
  28. package/ContextMenu/index.js +54 -44
  29. package/ContextMenu/spec.js +31 -20
  30. package/Dialog/components/HtmlContentDialog/index.js +9 -7
  31. package/Dialog/components/HtmlContentDialog/spec.js +9 -6
  32. package/Dialog/components/PipelineErrorDialog/index.js +106 -47
  33. package/Dialog/components/PipelineErrorDialog/spec.js +5 -4
  34. package/Dialog/components/TextMessageDialog/index.js +9 -7
  35. package/Dialog/components/TextMessageDialog/spec.js +9 -6
  36. package/Dialog/components/VariantSelectModal/index.js +7 -5
  37. package/Dialog/components/VariantSelectModal/spec.js +6 -3
  38. package/Dialog/index.js +12 -8
  39. package/Dialog/spec.js +7 -6
  40. package/DiscountBadge/index.js +10 -8
  41. package/DiscountBadge/spec.js +3 -2
  42. package/FavoritesButton/index.js +40 -31
  43. package/FavoritesButton/spec.js +7 -3
  44. package/Form/Builder/classes/ActionListener/index.js +400 -401
  45. package/Form/Builder/components/CheckboxElement.js +13 -5
  46. package/Form/Builder/components/CountryElement.js +13 -5
  47. package/Form/Builder/components/ProvinceElement.js +13 -5
  48. package/Form/Builder/components/RadioElement.js +19 -11
  49. package/Form/Builder/components/SelectElement.js +26 -16
  50. package/Form/Builder/components/TextElement.js +13 -5
  51. package/Form/Builder/index.js +70 -60
  52. package/Form/Builder/spec.js +10 -9
  53. package/Form/Checkbox/index.js +31 -21
  54. package/Form/InfoField/index.js +19 -12
  55. package/Form/InfoField/spec.js +4 -1
  56. package/Form/Password/index.js +22 -15
  57. package/Form/Password/spec.js +10 -5
  58. package/Form/RadioGroup/components/Item/index.js +34 -25
  59. package/Form/RadioGroup/index.js +37 -28
  60. package/Form/RadioGroup/spec.js +45 -31
  61. package/Form/Select/index.js +52 -43
  62. package/Form/Select/spec.js +5 -2
  63. package/Form/SelectContextChoices/index.js +26 -22
  64. package/Form/SelectContextChoices/spec.js +4 -1
  65. package/Form/TextField/index.js +40 -27
  66. package/Form/TextField/spec.js +34 -21
  67. package/Form/index.js +23 -15
  68. package/FormElement/components/ErrorText/index.js +7 -5
  69. package/FormElement/components/Label/index.js +6 -4
  70. package/FormElement/components/Placeholder/index.js +7 -5
  71. package/FormElement/components/Underline/index.js +8 -6
  72. package/FormElement/index.js +62 -46
  73. package/FormElement/spec.js +10 -9
  74. package/Glow/index.js +30 -22
  75. package/Glow/spec.js +6 -1
  76. package/IndicatorCircle/index.js +10 -8
  77. package/IndicatorCircle/spec.js +3 -2
  78. package/LoadingIndicator/index.js +8 -6
  79. package/Manufacturer/index.js +9 -7
  80. package/MessageBar/index.js +20 -17
  81. package/MessageBar/spec.js +6 -5
  82. package/NoResults/components/Icon/index.js +134 -110
  83. package/NoResults/index.js +27 -21
  84. package/Placeholder/index.js +13 -5
  85. package/PlaceholderLabel/index.js +2 -1
  86. package/PlaceholderLabel/spec.js +13 -6
  87. package/PlaceholderParagraph/index.js +13 -12
  88. package/PlaceholderParagraph/spec.js +13 -6
  89. package/Price/index.js +46 -28
  90. package/PriceInfo/index.js +2 -1
  91. package/PriceStriked/index.js +41 -29
  92. package/ProductProperties/index.js +13 -10
  93. package/ProgressBar/index.js +28 -19
  94. package/ProgressBar/spec.js +2 -1
  95. package/RadioButton/index.js +6 -5
  96. package/RadioButton/spec.js +3 -2
  97. package/RatingNumber/index.js +2 -1
  98. package/RatingStars/index.js +50 -34
  99. package/RatingStars/spec.js +7 -6
  100. package/Ripple/components/RippleAnimation/index.js +12 -10
  101. package/Ripple/index.js +72 -62
  102. package/RippleButton/index.js +44 -27
  103. package/RippleButton/spec.js +20 -13
  104. package/ScannerOverlay/components/CameraOverlay/index.js +8 -5
  105. package/ScannerOverlay/components/ScannerBar/components/FlashlightButton/index.js +25 -21
  106. package/ScannerOverlay/components/ScannerBar/components/ScannerInstructions/index.js +7 -5
  107. package/ScannerOverlay/components/ScannerBar/index.js +17 -12
  108. package/ScannerOverlay/index.js +24 -15
  109. package/Sheet/components/Header/components/SearchBar/index.js +35 -28
  110. package/Sheet/components/Header/components/SearchBar/spec.js +2 -1
  111. package/Sheet/components/Header/index.js +47 -34
  112. package/Sheet/components/Header/spec.js +2 -1
  113. package/Sheet/index.js +80 -65
  114. package/Sheet/spec.js +27 -14
  115. package/TaxDisclaimer/index.js +13 -10
  116. package/TaxDisclaimer/spec.js +3 -2
  117. package/TextField/components/ErrorText/index.js +7 -5
  118. package/TextField/components/FormElement/index.js +4 -3
  119. package/TextField/components/Hint/index.js +7 -5
  120. package/TextField/components/Label/index.js +6 -4
  121. package/TextField/components/Underline/index.js +8 -6
  122. package/TextField/index.js +102 -85
  123. package/TextField/spec.js +37 -23
  124. package/ToggleIcon/index.js +23 -15
  125. package/ToggleIcon/spec.js +12 -8
  126. package/icons/AccountBoxIcon.js +5 -4
  127. package/icons/AddMoreIcon.js +5 -4
  128. package/icons/ArrowDropIcon.js +5 -4
  129. package/icons/ArrowIcon.js +5 -4
  130. package/icons/BarcodeScannerIcon.js +5 -4
  131. package/icons/BoxIcon.js +5 -4
  132. package/icons/BrowseIcon.js +5 -4
  133. package/icons/BurgerIcon.js +5 -4
  134. package/icons/CalendarIcon.js +5 -5
  135. package/icons/CartCouponIcon.js +5 -4
  136. package/icons/CartIcon.js +5 -4
  137. package/icons/CartPlusIcon.js +5 -4
  138. package/icons/CheckIcon.js +5 -4
  139. package/icons/CheckedIcon.js +5 -4
  140. package/icons/ChevronIcon.js +5 -4
  141. package/icons/CreditCardIcon.js +5 -4
  142. package/icons/CrossIcon.js +5 -4
  143. package/icons/DescriptionIcon.js +5 -4
  144. package/icons/FilterIcon.js +5 -4
  145. package/icons/FlashDisabledIcon.js +5 -4
  146. package/icons/FlashEnabledIcon.js +5 -4
  147. package/icons/GridIcon.js +5 -4
  148. package/icons/HeartIcon.js +5 -4
  149. package/icons/HeartOutlineIcon.js +5 -4
  150. package/icons/HeartPlusIcon.js +5 -4
  151. package/icons/HeartPlusOutlineIcon.js +5 -4
  152. package/icons/HomeIcon.js +5 -4
  153. package/icons/InfoIcon.js +5 -4
  154. package/icons/InfoOutlineIcon.js +5 -4
  155. package/icons/ListIcon.js +5 -4
  156. package/icons/LocalShippingIcon.js +5 -4
  157. package/icons/LocationIcon.js +5 -4
  158. package/icons/LocatorIcon.js +5 -4
  159. package/icons/LockIcon.js +5 -4
  160. package/icons/LogoutIcon.js +5 -4
  161. package/icons/MagnifierIcon.js +5 -4
  162. package/icons/MapMarkerIcon.js +5 -4
  163. package/icons/MoreIcon.js +5 -4
  164. package/icons/MoreVertIcon.js +5 -4
  165. package/icons/NotificationIcon.js +5 -4
  166. package/icons/PersonIcon.js +5 -4
  167. package/icons/PhoneIcon.js +5 -4
  168. package/icons/PlaceholderIcon.js +5 -4
  169. package/icons/RadioCheckedIcon.js +5 -4
  170. package/icons/RadioUncheckedIcon.js +5 -4
  171. package/icons/SecurityIcon.js +5 -4
  172. package/icons/ShippingMethodIcon.js +5 -4
  173. package/icons/ShoppingCartIcon.js +5 -4
  174. package/icons/SortIcon.js +5 -4
  175. package/icons/StarHalfIcon.js +5 -4
  176. package/icons/StarIcon.js +5 -4
  177. package/icons/StarOutlineIcon.js +5 -4
  178. package/icons/StopIcon.js +5 -4
  179. package/icons/TickIcon.js +5 -4
  180. package/icons/TimeIcon.js +5 -4
  181. package/icons/TrashIcon.js +5 -4
  182. package/icons/TrashOutlineIcon.js +5 -4
  183. package/icons/UncheckedIcon.js +5 -4
  184. package/icons/ViewListIcon.js +5 -4
  185. package/icons/VisibilityIcon.js +5 -4
  186. package/icons/VisibilityOffIcon.js +5 -4
  187. package/icons/WarningIcon.js +5 -4
  188. package/package.json +7 -8
@@ -25,6 +25,7 @@ import ContextMenuProvider from "./ContextMenuProvider";
25
25
  * @param {boolean} props.showToggle Whether the toggle button should be shown.
26
26
  * @returns {JSX}
27
27
  */
28
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
28
29
  const ContextMenu = props => {
29
30
  const {
30
31
  children,
@@ -75,52 +76,61 @@ const ContextMenu = props => {
75
76
  left: 0
76
77
  };
77
78
  const useScroll = typeof scroll === 'boolean' && !!scroll;
78
- return /*#__PURE__*/React.createElement("div", {
79
+ return /*#__PURE__*/_jsxs("div", {
79
80
  "data-test-id": "contextMenu",
80
81
  ref: elementRef,
81
- className: classNames(styles.container, classes.container, 'ui-shared__context-menu')
82
- }, showToggle && /*#__PURE__*/React.createElement("button", {
83
- className: classNames(styles.button, classes.button, {
84
- [styles.disabled]: disabled
85
- }),
86
- onClick: handleMenuToggle,
87
- disabled: disabled,
88
- type: "button",
89
- "aria-label": i18n.text('navigation.open_menu'),
90
- "aria-haspopup": "true",
91
- "aria-expanded": active,
92
- "aria-controls": "contextMenuDialog"
93
- }, /*#__PURE__*/React.createElement(MoreVertIcon, {
94
- "aria-hidden": true
95
- })), /*#__PURE__*/React.createElement(ConnectedReactPortal, {
96
- isOpened: active
97
- }, /*#__PURE__*/React.createElement(FocusTrap, {
98
- active: active
99
- }, /*#__PURE__*/React.createElement("div", {
100
- className: styles.overlay
101
- }, /*#__PURE__*/React.createElement(Backdrop, {
102
- isVisible: true,
103
- level: 0,
104
- opacity: 0,
105
- onClick: handleMenuToggle
106
- }), /*#__PURE__*/React.createElement(Position, {
107
- offset: offset
108
- }, /*#__PURE__*/React.createElement(ContextMenuProvider, {
109
- handleMenuToggle: handleMenuToggle
110
- }, /*#__PURE__*/React.createElement("div", {
111
- className: classNames(styles.menu, {
112
- [styles.scrollable]: useScroll
113
- }),
114
- ref: menuRef,
115
- tabIndex: "-1",
116
- "aria-modal": "true",
117
- role: "dialog"
118
- }, children, /*#__PURE__*/React.createElement("button", {
119
- onClick: handleMenuToggle,
120
- className: "sr-only",
121
- "aria-label": i18n.text('common.close'),
122
- type: "button"
123
- }, i18n.text('common.close')))))))));
82
+ className: classNames(styles.container, classes.container, 'ui-shared__context-menu'),
83
+ children: [showToggle && /*#__PURE__*/_jsx("button", {
84
+ className: classNames(styles.button, classes.button, {
85
+ [styles.disabled]: disabled
86
+ }),
87
+ onClick: handleMenuToggle,
88
+ disabled: disabled,
89
+ type: "button",
90
+ "aria-label": i18n.text('navigation.open_menu'),
91
+ "aria-haspopup": "true",
92
+ "aria-expanded": active,
93
+ "aria-controls": "contextMenuDialog",
94
+ children: /*#__PURE__*/_jsx(MoreVertIcon, {
95
+ "aria-hidden": true
96
+ })
97
+ }), /*#__PURE__*/_jsx(ConnectedReactPortal, {
98
+ isOpened: active,
99
+ children: /*#__PURE__*/_jsx(FocusTrap, {
100
+ active: active,
101
+ children: /*#__PURE__*/_jsxs("div", {
102
+ className: styles.overlay,
103
+ children: [/*#__PURE__*/_jsx(Backdrop, {
104
+ isVisible: true,
105
+ level: 0,
106
+ opacity: 0,
107
+ onClick: handleMenuToggle
108
+ }), /*#__PURE__*/_jsx(Position, {
109
+ offset: offset,
110
+ children: /*#__PURE__*/_jsx(ContextMenuProvider, {
111
+ handleMenuToggle: handleMenuToggle,
112
+ children: /*#__PURE__*/_jsxs("div", {
113
+ className: classNames(styles.menu, {
114
+ [styles.scrollable]: useScroll
115
+ }),
116
+ ref: menuRef,
117
+ tabIndex: "-1",
118
+ "aria-modal": "true",
119
+ role: "dialog",
120
+ children: [children, /*#__PURE__*/_jsx("button", {
121
+ onClick: handleMenuToggle,
122
+ className: "sr-only",
123
+ "aria-label": i18n.text('common.close'),
124
+ type: "button",
125
+ children: i18n.text('common.close')
126
+ })]
127
+ })
128
+ })
129
+ })]
130
+ })
131
+ })
132
+ })]
133
+ });
124
134
  };
125
135
  ContextMenu.defaultProps = {
126
136
  children: null,
@@ -3,7 +3,9 @@ import { mount, shallow } from 'enzyme';
3
3
  import { act } from 'react-dom/test-utils';
4
4
  import Backdrop from '@shopgate/pwa-common/components/Backdrop';
5
5
  import ContextMenu from "./index";
6
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
6
7
  jest.mock('@shopgate/engage/components');
8
+ jest.mock('@shopgate/engage/a11y/components');
7
9
  global.requestAnimationFrame = fn => fn();
8
10
  jest.useFakeTimers();
9
11
  describe('<ContextMenu />', () => {
@@ -12,25 +14,30 @@ describe('<ContextMenu />', () => {
12
14
  const numMenuItems = 2;
13
15
  describe('Snapshot test', () => {
14
16
  it('should match snapshot', () => {
15
- const wrapper = shallow(/*#__PURE__*/React.createElement(ContextMenu, {
16
- isOpened: true
17
- }, /*#__PURE__*/React.createElement(ContextMenu.Item, {
18
- onClick: mockItemAClick,
19
- className: "menu-active-item"
20
- }, 'Item A'), /*#__PURE__*/React.createElement(ContextMenu.Item, {
21
- onClick: mockItemBClick,
22
- className: "menu-active-item"
23
- }, 'Item B')));
17
+ const wrapper = shallow(/*#__PURE__*/_jsxs(ContextMenu, {
18
+ isOpened: true,
19
+ children: [/*#__PURE__*/_jsx(ContextMenu.Item, {
20
+ onClick: mockItemAClick,
21
+ className: "menu-active-item",
22
+ children: "Item A"
23
+ }), /*#__PURE__*/_jsx(ContextMenu.Item, {
24
+ onClick: mockItemBClick,
25
+ className: "menu-active-item",
26
+ children: "Item B"
27
+ })]
28
+ }));
24
29
  expect(wrapper).toMatchSnapshot();
25
30
  });
26
31
  it('should match snapshot without toggle', () => {
27
- const wrapper = shallow(/*#__PURE__*/React.createElement(ContextMenu, {
32
+ const wrapper = shallow(/*#__PURE__*/_jsx(ContextMenu, {
28
33
  isOpened: true,
29
- showToggle: false
30
- }, /*#__PURE__*/React.createElement(ContextMenu.Item, {
31
- onClick: mockItemAClick,
32
- className: "menu-active-item"
33
- }, 'Item A')));
34
+ showToggle: false,
35
+ children: /*#__PURE__*/_jsx(ContextMenu.Item, {
36
+ onClick: mockItemAClick,
37
+ className: "menu-active-item",
38
+ children: "Item A"
39
+ })
40
+ }));
34
41
  expect(wrapper).toMatchSnapshot();
35
42
  });
36
43
  });
@@ -41,11 +48,15 @@ describe('<ContextMenu />', () => {
41
48
  * The view component
42
49
  */
43
50
  const renderComponent = () => {
44
- renderedElement = mount(/*#__PURE__*/React.createElement(ContextMenu, null, /*#__PURE__*/React.createElement(ContextMenu.Item, {
45
- onClick: mockItemAClick
46
- }, "Item A"), /*#__PURE__*/React.createElement(ContextMenu.Item, {
47
- onClick: mockItemBClick
48
- }, "Item B")));
51
+ renderedElement = mount(/*#__PURE__*/_jsxs(ContextMenu, {
52
+ children: [/*#__PURE__*/_jsx(ContextMenu.Item, {
53
+ onClick: mockItemAClick,
54
+ children: "Item A"
55
+ }), /*#__PURE__*/_jsx(ContextMenu.Item, {
56
+ onClick: mockItemBClick,
57
+ children: "Item B"
58
+ })]
59
+ }));
49
60
  };
50
61
  beforeEach(renderComponent);
51
62
  it('should match snapshot', () => {
@@ -8,18 +8,20 @@ import BasicDialog from "../BasicDialog";
8
8
  * @param {Object} props The component properties.
9
9
  * @returns {JSX.Element} The rendered component.
10
10
  */
11
+ import { jsx as _jsx } from "react/jsx-runtime";
11
12
  const HtmlContentDialog = ({
12
13
  actions,
13
14
  message,
14
15
  title
15
- }) => /*#__PURE__*/React.createElement(BasicDialog, {
16
+ }) => /*#__PURE__*/_jsx(BasicDialog, {
16
17
  title: title,
17
- actions: actions
18
- }, /*#__PURE__*/React.createElement("div", {
19
- dangerouslySetInnerHTML: {
20
- __html: message
21
- }
22
- }));
18
+ actions: actions,
19
+ children: /*#__PURE__*/_jsx("div", {
20
+ dangerouslySetInnerHTML: {
21
+ __html: message
22
+ }
23
+ })
24
+ });
23
25
  HtmlContentDialog.defaultProps = {
24
26
  title: BasicDialog.defaultProps.title
25
27
  };
@@ -1,12 +1,13 @@
1
1
  import React from 'react';
2
2
  import { shallow } from 'enzyme';
3
3
  import HtmlContentDialog from "./index";
4
+ import { jsx as _jsx } from "react/jsx-runtime";
4
5
  const message = '<p><i>This is a html message.</i></p>';
5
6
  const title = 'This is the title.';
6
7
  jest.mock('@shopgate/engage/a11y/components');
7
8
  describe('<HtmlContentDialog />', () => {
8
9
  it('should render with minimal props', () => {
9
- const wrapper = shallow(/*#__PURE__*/React.createElement(HtmlContentDialog, {
10
+ const wrapper = shallow(/*#__PURE__*/_jsx(HtmlContentDialog, {
10
11
  message: message,
11
12
  actions: []
12
13
  }));
@@ -14,7 +15,7 @@ describe('<HtmlContentDialog />', () => {
14
15
  expect(wrapper.html()).toMatch(message);
15
16
  });
16
17
  it('should render with title and html message', () => {
17
- const wrapper = shallow(/*#__PURE__*/React.createElement(HtmlContentDialog, {
18
+ const wrapper = shallow(/*#__PURE__*/_jsx(HtmlContentDialog, {
18
19
  title: title,
19
20
  message: message,
20
21
  actions: []
@@ -23,7 +24,7 @@ describe('<HtmlContentDialog />', () => {
23
24
  expect(wrapper.html()).toMatch(title);
24
25
  });
25
26
  it('should render with title, html message and messageParams', () => {
26
- const wrapper = shallow(/*#__PURE__*/React.createElement(HtmlContentDialog, {
27
+ const wrapper = shallow(/*#__PURE__*/_jsx(HtmlContentDialog, {
27
28
  title: title,
28
29
  message: "Message with {name}",
29
30
  params: {
@@ -38,7 +39,7 @@ describe('<HtmlContentDialog />', () => {
38
39
  label: 'fooAction',
39
40
  action: () => {}
40
41
  }];
41
- const wrapper = shallow(/*#__PURE__*/React.createElement(HtmlContentDialog, {
42
+ const wrapper = shallow(/*#__PURE__*/_jsx(HtmlContentDialog, {
42
43
  title: title,
43
44
  message: message,
44
45
  actions: actions
@@ -47,8 +48,10 @@ describe('<HtmlContentDialog />', () => {
47
48
  expect(wrapper.html()).toMatch(actions[0].label);
48
49
  });
49
50
  it('should pass title through', () => {
50
- const customTitle = /*#__PURE__*/React.createElement("div", null, "Title");
51
- const wrapper = shallow(/*#__PURE__*/React.createElement(HtmlContentDialog, {
51
+ const customTitle = /*#__PURE__*/_jsx("div", {
52
+ children: "Title"
53
+ });
54
+ const wrapper = shallow(/*#__PURE__*/_jsx(HtmlContentDialog, {
52
55
  title: customTitle,
53
56
  message: message,
54
57
  params: {},
@@ -1,3 +1,5 @@
1
+ import _createClass from "@babel/runtime/helpers/createClass";
2
+ import _inheritsLoose from "@babel/runtime/helpers/inheritsLoose";
1
3
  import React, { Component } from 'react';
2
4
  import PropTypes from 'prop-types';
3
5
  import I18n from '@shopgate/pwa-common/components/I18n';
@@ -6,6 +8,7 @@ import BasicDialog from "../BasicDialog";
6
8
  /**
7
9
  * The number of taps required until the dialog switches to/from developer mode.
8
10
  */
11
+ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
9
12
  const requiredTapsToSwitchModes = 10;
10
13
 
11
14
  /**
@@ -18,45 +21,46 @@ const switchModeTapTimeout = 4000 / requiredTapsToSwitchModes;
18
21
  * The special behaviour of this message is that the user may tap the message body
19
22
  * ten times until it reveals additional information about the error that occurred.
20
23
  */
21
- class PipelineErrorDialog extends Component {
24
+ let PipelineErrorDialog = /*#__PURE__*/function (_Component) {
22
25
  /**
23
26
  * Creates the component.
24
27
  * @param {Object} props The component props.
25
28
  */
26
- constructor(props) {
27
- super(props);
29
+ function PipelineErrorDialog(props) {
30
+ var _this;
31
+ _this = _Component.call(this, props) || this;
28
32
  /**
29
33
  * Clears the tap counter once the
30
34
  */
31
- this.handleTapTimeout = () => {
32
- this.tapCounter = 0;
35
+ _this.handleTapTimeout = () => {
36
+ _this.tapCounter = 0;
33
37
  };
34
38
  /**
35
39
  * User tapped the message, increase the tap counter and switch view modes if required.
36
40
  */
37
- this.handleClick = () => {
38
- this.tapCounter += 1;
39
- if (this.tapTimeout) {
41
+ _this.handleClick = () => {
42
+ _this.tapCounter += 1;
43
+ if (_this.tapTimeout) {
40
44
  // Clear the timeout.
41
- clearTimeout(this.tapTimeout);
45
+ clearTimeout(_this.tapTimeout);
42
46
  }
43
- if (this.tapCounter >= requiredTapsToSwitchModes) {
47
+ if (_this.tapCounter >= requiredTapsToSwitchModes) {
44
48
  // Switch modes and reset the tap counter.
45
- this.tapCounter = 0;
46
- this.setState(({
49
+ _this.tapCounter = 0;
50
+ _this.setState(({
47
51
  devMode
48
52
  }) => ({
49
53
  devMode: !devMode
50
54
  }));
51
55
  } else {
52
- this.tapTimeout = setTimeout(this.handleTapTimeout, switchModeTapTimeout);
56
+ _this.tapTimeout = setTimeout(_this.handleTapTimeout, switchModeTapTimeout);
53
57
  }
54
58
  };
55
59
  /**
56
60
  * Renders the error message in developer mode.
57
61
  * @returns {JSX}
58
62
  */
59
- this.renderDevErrorMessage = () => {
63
+ _this.renderDevErrorMessage = () => {
60
64
  /**
61
65
  * Checks the input to be truthy, "0" or "false" and enables it to be rendered then.
62
66
  * @param {Object|string|number|boolean} value The value to be checked if it should be rendered.
@@ -65,60 +69,115 @@ class PipelineErrorDialog extends Component {
65
69
  const checkValue = value => !!value || value === 0 || value === false;
66
70
  const {
67
71
  params
68
- } = this.props;
69
- return /*#__PURE__*/React.createElement("div", {
70
- "aria-hidden": true
71
- }, /*#__PURE__*/React.createElement("span", null, /*#__PURE__*/React.createElement("strong", null, "Pipeline:"), /*#__PURE__*/React.createElement("span", null, ` ${params.pipeline}`), /*#__PURE__*/React.createElement("br", null)), checkValue(params.entityId) && /*#__PURE__*/React.createElement("span", null, /*#__PURE__*/React.createElement("strong", null, "Entity id:"), /*#__PURE__*/React.createElement("span", null, ` ${params.entityId}`), /*#__PURE__*/React.createElement("br", null)), checkValue(params.code) && /*#__PURE__*/React.createElement("span", null, /*#__PURE__*/React.createElement("strong", null, "Code:"), /*#__PURE__*/React.createElement("span", null, ` ${params.code}`), /*#__PURE__*/React.createElement("br", null)), /*#__PURE__*/React.createElement("span", null, /*#__PURE__*/React.createElement("strong", null, "Message:"), /*#__PURE__*/React.createElement("span", null, ` ${params.message}`), /*#__PURE__*/React.createElement("br", null)), checkValue(params.translated) && /*#__PURE__*/React.createElement("span", null, /*#__PURE__*/React.createElement("strong", null, "Message Translated:"), /*#__PURE__*/React.createElement("span", null, ` ${params.translated.toString()}`), /*#__PURE__*/React.createElement("br", null)), checkValue(params.messageParams) && /*#__PURE__*/React.createElement("p", null, /*#__PURE__*/React.createElement("strong", null, "Message Params:"), /*#__PURE__*/React.createElement("br", null), /*#__PURE__*/React.createElement("span", null, JSON.stringify(params.messageParams, null, ' ')), /*#__PURE__*/React.createElement("br", null)), checkValue(params.request) && /*#__PURE__*/React.createElement("p", null, /*#__PURE__*/React.createElement("strong", null, "Request Params:"), /*#__PURE__*/React.createElement("br", null), /*#__PURE__*/React.createElement("span", null, JSON.stringify(params.request, null, ' ')), /*#__PURE__*/React.createElement("br", null)));
72
+ } = _this.props;
73
+ return /*#__PURE__*/_jsxs("div", {
74
+ "aria-hidden": true,
75
+ children: [/*#__PURE__*/_jsxs("span", {
76
+ children: [/*#__PURE__*/_jsx("strong", {
77
+ children: "Pipeline:"
78
+ }), /*#__PURE__*/_jsx("span", {
79
+ children: ` ${params.pipeline}`
80
+ }), /*#__PURE__*/_jsx("br", {})]
81
+ }), checkValue(params.entityId) && /*#__PURE__*/_jsxs("span", {
82
+ children: [/*#__PURE__*/_jsx("strong", {
83
+ children: "Entity id:"
84
+ }), /*#__PURE__*/_jsx("span", {
85
+ children: ` ${params.entityId}`
86
+ }), /*#__PURE__*/_jsx("br", {})]
87
+ }), checkValue(params.code) && /*#__PURE__*/_jsxs("span", {
88
+ children: [/*#__PURE__*/_jsx("strong", {
89
+ children: "Code:"
90
+ }), /*#__PURE__*/_jsx("span", {
91
+ children: ` ${params.code}`
92
+ }), /*#__PURE__*/_jsx("br", {})]
93
+ }), /*#__PURE__*/_jsxs("span", {
94
+ children: [/*#__PURE__*/_jsx("strong", {
95
+ children: "Message:"
96
+ }), /*#__PURE__*/_jsx("span", {
97
+ children: ` ${params.message}`
98
+ }), /*#__PURE__*/_jsx("br", {})]
99
+ }), checkValue(params.translated) && /*#__PURE__*/_jsxs("span", {
100
+ children: [/*#__PURE__*/_jsx("strong", {
101
+ children: "Message Translated:"
102
+ }), /*#__PURE__*/_jsx("span", {
103
+ children: ` ${params.translated.toString()}`
104
+ }), /*#__PURE__*/_jsx("br", {})]
105
+ }), checkValue(params.messageParams) && /*#__PURE__*/_jsxs("p", {
106
+ children: [/*#__PURE__*/_jsx("strong", {
107
+ children: "Message Params:"
108
+ }), /*#__PURE__*/_jsx("br", {}), /*#__PURE__*/_jsx("span", {
109
+ children: JSON.stringify(params.messageParams, null, ' ')
110
+ }), /*#__PURE__*/_jsx("br", {})]
111
+ }), checkValue(params.request) && /*#__PURE__*/_jsxs("p", {
112
+ children: [/*#__PURE__*/_jsx("strong", {
113
+ children: "Request Params:"
114
+ }), /*#__PURE__*/_jsx("br", {}), /*#__PURE__*/_jsx("span", {
115
+ children: JSON.stringify(params.request, null, ' ')
116
+ }), /*#__PURE__*/_jsx("br", {})]
117
+ })]
118
+ });
72
119
  };
73
120
  /**
74
121
  * Renders the regular error message in user mode.
75
122
  * @returns {JSX}
76
123
  */
77
- this.renderUserErrorMessage = () => {
124
+ _this.renderUserErrorMessage = () => {
78
125
  const {
79
126
  message = '',
80
127
  params = {}
81
- } = this.props;
82
- return /*#__PURE__*/React.createElement(React.Fragment, null, !!params.translated && (message || params.message || /*#__PURE__*/React.createElement(I18n.Text, {
83
- string: "modal.body_error"
84
- })), !params.translated && /*#__PURE__*/React.createElement(I18n.Text, {
85
- string: message || params.message || 'modal.body_error',
86
- params: params.messageParams || {}
87
- }));
128
+ } = _this.props;
129
+ return /*#__PURE__*/_jsxs(_Fragment, {
130
+ children: [!!params.translated && (message || params.message || /*#__PURE__*/_jsx(I18n.Text, {
131
+ string: "modal.body_error"
132
+ })), !params.translated && /*#__PURE__*/_jsx(I18n.Text, {
133
+ string: message || params.message || 'modal.body_error',
134
+ params: params.messageParams || {}
135
+ })]
136
+ });
88
137
  };
89
- this.tapTimeout = null;
90
- this.tapCounter = 0;
91
- this.state = {
138
+ _this.tapTimeout = null;
139
+ _this.tapCounter = 0;
140
+ _this.state = {
92
141
  devMode: false // Indicating whether we are in dev mode.
93
142
  };
143
+ return _this;
94
144
  }
95
145
 
96
146
  /**
97
147
  * @return {string} The title based on the current state of the dialog.
98
148
  */
99
- get title() {
100
- return this.state.devMode ? 'Pipeline Error' : 'modal.title_error';
101
- }
102
-
103
- /**
104
- * @return {JSX} The content component based on the the current state of the dialog.
105
- */
106
- get content() {
107
- return this.state.devMode ? this.renderDevErrorMessage() : this.renderUserErrorMessage();
108
- }
149
+ _inheritsLoose(PipelineErrorDialog, _Component);
150
+ var _proto = PipelineErrorDialog.prototype;
109
151
  /**
110
152
  * Renders the error message depending on the current mode.
111
153
  * @return {JSX}
112
154
  */
113
- render() {
114
- return /*#__PURE__*/React.createElement(BasicDialog, {
155
+ _proto.render = function render() {
156
+ return /*#__PURE__*/_jsx(BasicDialog, {
115
157
  title: this.title,
116
- actions: this.props.actions
117
- }, /*#__PURE__*/React.createElement("div", {
118
- onClick: this.handleClick
119
- }, this.content));
120
- }
121
- }
158
+ actions: this.props.actions,
159
+ children: /*#__PURE__*/_jsx("div", {
160
+ onClick: this.handleClick,
161
+ children: this.content
162
+ })
163
+ });
164
+ };
165
+ return _createClass(PipelineErrorDialog, [{
166
+ key: "title",
167
+ get: function () {
168
+ return this.state.devMode ? 'Pipeline Error' : 'modal.title_error';
169
+ }
170
+
171
+ /**
172
+ * @return {JSX} The content component based on the the current state of the dialog.
173
+ */
174
+ }, {
175
+ key: "content",
176
+ get: function () {
177
+ return this.state.devMode ? this.renderDevErrorMessage() : this.renderUserErrorMessage();
178
+ }
179
+ }]);
180
+ }(Component);
122
181
  PipelineErrorDialog.defaultProps = {
123
182
  message: ''
124
183
  };
@@ -1,6 +1,7 @@
1
1
  import React from 'react';
2
2
  import { mount } from 'enzyme';
3
3
  import PipelineErrorDialog from "./index";
4
+ import { jsx as _jsx } from "react/jsx-runtime";
4
5
  jest.mock('@shopgate/engage/a11y/components');
5
6
  describe('<PipelineErrorDialog />', () => {
6
7
  const defaultParams = {
@@ -10,7 +11,7 @@ describe('<PipelineErrorDialog />', () => {
10
11
  request: {}
11
12
  };
12
13
  it('should render with minimal props', () => {
13
- const wrapper = mount(/*#__PURE__*/React.createElement(PipelineErrorDialog, {
14
+ const wrapper = mount(/*#__PURE__*/_jsx(PipelineErrorDialog, {
14
15
  actions: [],
15
16
  params: defaultParams
16
17
  }));
@@ -18,7 +19,7 @@ describe('<PipelineErrorDialog />', () => {
18
19
  });
19
20
  it('should show a custom message if a message is is provided', () => {
20
21
  const message = 'Custom message';
21
- const wrapper = mount(/*#__PURE__*/React.createElement(PipelineErrorDialog, {
22
+ const wrapper = mount(/*#__PURE__*/_jsx(PipelineErrorDialog, {
22
23
  actions: [],
23
24
  message: message,
24
25
  params: defaultParams
@@ -27,7 +28,7 @@ describe('<PipelineErrorDialog />', () => {
27
28
  expect(wrapper.html()).toMatch(message);
28
29
  });
29
30
  it('should switch modes on tap', () => {
30
- const wrapper = mount(/*#__PURE__*/React.createElement(PipelineErrorDialog, {
31
+ const wrapper = mount(/*#__PURE__*/_jsx(PipelineErrorDialog, {
31
32
  actions: [],
32
33
  params: defaultParams
33
34
  }));
@@ -51,7 +52,7 @@ describe('<PipelineErrorDialog />', () => {
51
52
  });
52
53
  it('should not switch modes if tapped too slow', () => {
53
54
  jest.useFakeTimers();
54
- const wrapper = mount(/*#__PURE__*/React.createElement(PipelineErrorDialog, {
55
+ const wrapper = mount(/*#__PURE__*/_jsx(PipelineErrorDialog, {
55
56
  actions: [],
56
57
  params: defaultParams
57
58
  }));
@@ -10,20 +10,22 @@ import BasicDialog from "../BasicDialog";
10
10
  * @param {Object} props The component properties.
11
11
  * @returns {JSX} The rendered component.
12
12
  */
13
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
13
14
  const TextMessageDialog = ({
14
15
  actions,
15
16
  message,
16
17
  title,
17
18
  params,
18
19
  children
19
- }) => /*#__PURE__*/React.createElement(BasicDialog, {
20
+ }) => /*#__PURE__*/_jsxs(BasicDialog, {
20
21
  title: title,
21
- actions: actions
22
- }, /*#__PURE__*/React.createElement("span", {
23
- dangerouslySetInnerHTML: {
24
- __html: nl2br(i18n.text(message, params))
25
- }
26
- }), children);
22
+ actions: actions,
23
+ children: [/*#__PURE__*/_jsx("span", {
24
+ dangerouslySetInnerHTML: {
25
+ __html: nl2br(i18n.text(message, params))
26
+ }
27
+ }), children]
28
+ });
27
29
  TextMessageDialog.defaultProps = {
28
30
  title: BasicDialog.defaultProps.title,
29
31
  params: I18n.Text.defaultProps.params,
@@ -1,12 +1,13 @@
1
1
  import React from 'react';
2
2
  import { shallow } from 'enzyme';
3
3
  import TextMessageDialog from "./index";
4
+ import { jsx as _jsx } from "react/jsx-runtime";
4
5
  const message = 'This is the message.';
5
6
  const title = 'This is the title.';
6
7
  jest.mock('@shopgate/engage/a11y/components');
7
8
  describe('<TextMessageDialog />', () => {
8
9
  it('should render with minimal props', () => {
9
- const wrapper = shallow(/*#__PURE__*/React.createElement(TextMessageDialog, {
10
+ const wrapper = shallow(/*#__PURE__*/_jsx(TextMessageDialog, {
10
11
  message: message,
11
12
  actions: []
12
13
  }));
@@ -14,7 +15,7 @@ describe('<TextMessageDialog />', () => {
14
15
  expect(wrapper.html()).toMatch(message);
15
16
  });
16
17
  it('should render with title and message', () => {
17
- const wrapper = shallow(/*#__PURE__*/React.createElement(TextMessageDialog, {
18
+ const wrapper = shallow(/*#__PURE__*/_jsx(TextMessageDialog, {
18
19
  title: title,
19
20
  message: message,
20
21
  actions: []
@@ -23,7 +24,7 @@ describe('<TextMessageDialog />', () => {
23
24
  expect(wrapper.html()).toMatch(title);
24
25
  });
25
26
  it('should render with title, message and messageParams', () => {
26
- const wrapper = shallow(/*#__PURE__*/React.createElement(TextMessageDialog, {
27
+ const wrapper = shallow(/*#__PURE__*/_jsx(TextMessageDialog, {
27
28
  title: title,
28
29
  message: "Message with {name}",
29
30
  params: {
@@ -38,7 +39,7 @@ describe('<TextMessageDialog />', () => {
38
39
  label: 'fooAction',
39
40
  action: () => {}
40
41
  }];
41
- const wrapper = shallow(/*#__PURE__*/React.createElement(TextMessageDialog, {
42
+ const wrapper = shallow(/*#__PURE__*/_jsx(TextMessageDialog, {
42
43
  title: title,
43
44
  message: message,
44
45
  actions: actions
@@ -47,8 +48,10 @@ describe('<TextMessageDialog />', () => {
47
48
  expect(wrapper.html()).toMatch(actions[0].label);
48
49
  });
49
50
  it('should pass title through', () => {
50
- const customTitle = /*#__PURE__*/React.createElement("div", null, "Title");
51
- const wrapper = shallow(/*#__PURE__*/React.createElement(TextMessageDialog, {
51
+ const customTitle = /*#__PURE__*/_jsx("div", {
52
+ children: "Title"
53
+ });
54
+ const wrapper = shallow(/*#__PURE__*/_jsx(TextMessageDialog, {
52
55
  title: customTitle,
53
56
  message: message,
54
57
  params: {},
@@ -14,6 +14,7 @@ import connect from "./connector";
14
14
  * @param {string} navigate The navigate action.
15
15
  * @return {Array} Reordered and extended actions.
16
16
  */
17
+ import { jsx as _jsx } from "react/jsx-runtime";
17
18
  const reorderActions = (actions, {
18
19
  productId
19
20
  }, navigate) => {
@@ -61,12 +62,13 @@ const VariantSelectModal = ({
61
62
  params
62
63
  }) => {
63
64
  const parsedActions = reorderActions(actions, params, navigate);
64
- return /*#__PURE__*/React.createElement(BasicDialog, {
65
+ return /*#__PURE__*/_jsx(BasicDialog, {
65
66
  title: title,
66
- actions: parsedActions
67
- }, /*#__PURE__*/React.createElement(I18n.Text, {
68
- string: message
69
- }));
67
+ actions: parsedActions,
68
+ children: /*#__PURE__*/_jsx(I18n.Text, {
69
+ string: message
70
+ })
71
+ });
70
72
  };
71
73
  VariantSelectModal.defaultProps = {
72
74
  params: {