@shopgate/pwa-ui-shared 6.20.0-beta.1 → 6.20.0-beta.7

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 (184) hide show
  1. package/AccordionContainer/index.js +7 -4
  2. package/AccordionContainer/spec.js +2 -2
  3. package/ActionButton/index.js +7 -7
  4. package/ActionButton/spec.js +1 -1
  5. package/AddToCartButton/index.js +7 -6
  6. package/AddToCartButton/mock.js +3 -3
  7. package/AddToCartButton/spec.js +1 -1
  8. package/Availability/index.js +1 -1
  9. package/Availability/spec.js +1 -1
  10. package/Button/index.js +7 -7
  11. package/Button/spec.js +1 -1
  12. package/ButtonLink/index.js +3 -3
  13. package/ButtonLink/spec.js +1 -1
  14. package/Card/index.js +1 -1
  15. package/CardList/components/Item/index.js +1 -1
  16. package/CardList/index.js +3 -3
  17. package/CartTotalLine/components/Amount/index.js +1 -1
  18. package/CartTotalLine/components/Hint/index.js +1 -1
  19. package/CartTotalLine/components/Label/index.js +1 -1
  20. package/CartTotalLine/index.js +1 -1
  21. package/Checkbox/index.js +2 -2
  22. package/Chip/index.js +1 -1
  23. package/Chip/spec.js +1 -1
  24. package/ClientInformation/index.js +5 -5
  25. package/ClientInformation/spec.js +1 -1
  26. package/ContextMenu/components/Item/index.js +2 -2
  27. package/ContextMenu/components/Item/style.js +5 -1
  28. package/ContextMenu/components/Position/index.js +4 -4
  29. package/ContextMenu/index.js +8 -8
  30. package/ContextMenu/spec.js +3 -3
  31. package/ContextMenu/style.js +1 -1
  32. package/Dialog/components/PipelineErrorDialog/index.js +9 -9
  33. package/Dialog/components/PipelineErrorDialog/spec.js +2 -2
  34. package/Dialog/components/TextMessageDialog/index.js +1 -1
  35. package/Dialog/components/TextMessageDialog/spec.js +1 -1
  36. package/Dialog/components/VariantSelectModal/index.js +1 -1
  37. package/Dialog/components/VariantSelectModal/spec.js +2 -2
  38. package/Dialog/constants.js +1 -1
  39. package/Dialog/index.js +4 -4
  40. package/Dialog/spec.js +2 -2
  41. package/DiscountBadge/index.js +1 -1
  42. package/DiscountBadge/spec.js +1 -1
  43. package/FavoritesButton/connector.js +2 -2
  44. package/FavoritesButton/index.js +8 -8
  45. package/FavoritesButton/spec.js +1 -1
  46. package/Footer/index.js +9 -9
  47. package/Footer/index.spec.js +4 -4
  48. package/Form/Builder/builders/buildCountryList.js +1 -1
  49. package/Form/Builder/builders/buildFormDefaults.js +1 -1
  50. package/Form/Builder/builders/buildFormElements.js +2 -2
  51. package/Form/Builder/builders/buildFormElements.spec.js +1 -1
  52. package/Form/Builder/builders/buildProvinceList.js +1 -1
  53. package/Form/Builder/classes/ActionListener/index.js +3 -3
  54. package/Form/Builder/components/CheckboxElement.js +3 -3
  55. package/Form/Builder/components/CountryElement.js +3 -3
  56. package/Form/Builder/components/ProvinceElement.js +3 -3
  57. package/Form/Builder/components/RadioElement.js +3 -3
  58. package/Form/Builder/components/SelectElement.js +3 -3
  59. package/Form/Builder/components/TextElement.js +3 -3
  60. package/Form/Builder/index.js +8 -8
  61. package/Form/Builder/spec.js +3 -3
  62. package/Form/Checkbox/index.js +3 -3
  63. package/Form/Password/index.js +5 -5
  64. package/Form/Password/spec.js +1 -1
  65. package/Form/RadioGroup/components/Item/index.js +3 -3
  66. package/Form/RadioGroup/index.js +7 -7
  67. package/Form/RadioGroup/spec.js +2 -2
  68. package/Form/Select/index.js +5 -5
  69. package/Form/Select/spec.js +1 -1
  70. package/Form/TextField/index.js +5 -5
  71. package/Form/TextField/spec.js +1 -1
  72. package/Form/index.js +8 -8
  73. package/FormElement/components/ErrorText/index.js +1 -1
  74. package/FormElement/components/Label/index.js +1 -1
  75. package/FormElement/components/Placeholder/index.js +1 -1
  76. package/FormElement/components/Underline/index.js +1 -1
  77. package/FormElement/index.js +6 -6
  78. package/FormElement/spec.js +1 -1
  79. package/Glow/index.js +6 -6
  80. package/Glow/spec.js +1 -1
  81. package/IndicatorCircle/index.js +1 -1
  82. package/IndicatorCircle/spec.js +1 -1
  83. package/LoadingIndicator/index.js +1 -1
  84. package/Manufacturer/index.js +1 -1
  85. package/MessageBar/index.js +1 -1
  86. package/MessageBar/spec.js +1 -1
  87. package/NoResults/components/Icon/index.js +1 -1
  88. package/NoResults/index.js +1 -1
  89. package/Placeholder/index.js +3 -3
  90. package/PlaceholderLabel/index.js +1 -1
  91. package/PlaceholderLabel/spec.js +1 -1
  92. package/PlaceholderParagraph/index.js +1 -1
  93. package/PlaceholderParagraph/spec.js +1 -1
  94. package/Price/index.js +1 -1
  95. package/PriceInfo/index.js +1 -1
  96. package/PriceStriked/index.js +6 -6
  97. package/ProductProperties/index.js +1 -1
  98. package/ProductProperties/index.spec.js +1 -1
  99. package/ProgressBar/index.js +4 -4
  100. package/ProgressBar/spec.js +1 -1
  101. package/RadioButton/index.js +1 -1
  102. package/RadioButton/spec.js +1 -1
  103. package/RatingNumber/index.js +1 -1
  104. package/RatingNumber/index.spec.js +2 -2
  105. package/RatingStars/index.js +5 -5
  106. package/RatingStars/spec.js +2 -2
  107. package/Ripple/components/RippleAnimation/index.js +3 -3
  108. package/Ripple/index.js +16 -16
  109. package/RippleButton/index.js +7 -7
  110. package/RippleButton/spec.js +1 -1
  111. package/ScannerOverlay/components/CameraOverlay/index.js +1 -1
  112. package/ScannerOverlay/components/ScannerBar/components/FlashlightButton/index.js +1 -1
  113. package/ScannerOverlay/components/ScannerBar/components/ScannerInstructions/index.js +1 -1
  114. package/ScannerOverlay/components/ScannerBar/index.js +1 -1
  115. package/ScannerOverlay/index.js +7 -7
  116. package/ScannerOverlay/index.spec.js +1 -1
  117. package/Sheet/components/Header/components/SearchBar/index.js +2 -2
  118. package/Sheet/components/Header/components/SearchBar/spec.js +1 -1
  119. package/Sheet/components/Header/index.js +4 -4
  120. package/Sheet/components/Header/spec.js +1 -1
  121. package/Sheet/index.js +10 -10
  122. package/Sheet/spec.js +2 -2
  123. package/TaxDisclaimer/index.js +1 -1
  124. package/TaxDisclaimer/spec.js +2 -2
  125. package/TextField/components/ErrorText/index.js +1 -1
  126. package/TextField/components/FormElement/index.js +1 -1
  127. package/TextField/components/Hint/index.js +1 -1
  128. package/TextField/components/Label/index.js +2 -2
  129. package/TextField/components/Underline/index.js +1 -1
  130. package/TextField/index.js +8 -8
  131. package/TextField/spec.js +2 -2
  132. package/ToggleIcon/index.js +5 -5
  133. package/ToggleIcon/spec.js +1 -1
  134. package/icons/AccountBoxIcon.js +1 -1
  135. package/icons/AddMoreIcon.js +1 -1
  136. package/icons/ArrowDropIcon.js +1 -1
  137. package/icons/ArrowIcon.js +2 -2
  138. package/icons/BarcodeScannerIcon.js +1 -1
  139. package/icons/BoxIcon.js +1 -1
  140. package/icons/BrowseIcon.js +1 -1
  141. package/icons/BurgerIcon.js +1 -1
  142. package/icons/CartCouponIcon.js +1 -1
  143. package/icons/CartIcon.js +1 -1
  144. package/icons/CartPlusIcon.js +1 -1
  145. package/icons/CheckIcon.js +1 -1
  146. package/icons/CheckedIcon.js +1 -1
  147. package/icons/ChevronIcon.js +1 -1
  148. package/icons/CreditCardIcon.js +1 -1
  149. package/icons/CrossIcon.js +1 -1
  150. package/icons/DescriptionIcon.js +1 -1
  151. package/icons/FilterIcon.js +1 -1
  152. package/icons/FlashDisabledIcon.js +1 -1
  153. package/icons/FlashEnabledIcon.js +1 -1
  154. package/icons/GridIcon.js +1 -1
  155. package/icons/HeartIcon.js +1 -1
  156. package/icons/HeartOutlineIcon.js +1 -1
  157. package/icons/HomeIcon.js +1 -1
  158. package/icons/InfoIcon.js +1 -1
  159. package/icons/InfoOutlineIcon.js +1 -1
  160. package/icons/ListIcon.js +1 -1
  161. package/icons/LocalShippingIcon.js +1 -1
  162. package/icons/LockIcon.js +1 -1
  163. package/icons/LogoutIcon.js +1 -1
  164. package/icons/MagnifierIcon.js +1 -1
  165. package/icons/MoreIcon.js +1 -1
  166. package/icons/MoreVertIcon.js +1 -1
  167. package/icons/PlaceholderIcon.js +1 -1
  168. package/icons/RadioCheckedIcon.js +1 -1
  169. package/icons/RadioUncheckedIcon.js +1 -1
  170. package/icons/SecurityIcon.js +1 -1
  171. package/icons/ShoppingCartIcon.js +1 -1
  172. package/icons/SortIcon.js +1 -1
  173. package/icons/StarHalfIcon.js +1 -1
  174. package/icons/StarIcon.js +1 -1
  175. package/icons/StarOutlineIcon.js +1 -1
  176. package/icons/TickIcon.js +1 -1
  177. package/icons/TrashIcon.js +1 -1
  178. package/icons/UncheckedIcon.js +1 -1
  179. package/icons/ViewListIcon.js +1 -1
  180. package/icons/VisibilityIcon.js +1 -1
  181. package/icons/VisibilityOffIcon.js +1 -1
  182. package/package.json +5 -5
  183. package/Dialog/components/HtmlContentDialog/index.js +0 -6
  184. package/Dialog/components/HtmlContentDialog/spec.js +0 -1
@@ -1,6 +1,9 @@
1
- function _typeof(obj){if(typeof Symbol==="function"&&typeof Symbol.iterator==="symbol"){_typeof=function _typeof(obj){return typeof obj;};}else{_typeof=function _typeof(obj){return obj&&typeof Symbol==="function"&&obj.constructor===Symbol&&obj!==Symbol.prototype?"symbol":typeof obj;};}return _typeof(obj);}function _classCallCheck(instance,Constructor){if(!(instance instanceof Constructor)){throw new TypeError("Cannot call a class as a function");}}function _defineProperties(target,props){for(var i=0;i<props.length;i++){var descriptor=props[i];descriptor.enumerable=descriptor.enumerable||false;descriptor.configurable=true;if("value"in descriptor)descriptor.writable=true;Object.defineProperty(target,descriptor.key,descriptor);}}function _createClass(Constructor,protoProps,staticProps){if(protoProps)_defineProperties(Constructor.prototype,protoProps);if(staticProps)_defineProperties(Constructor,staticProps);return Constructor;}function _possibleConstructorReturn(self,call){if(call&&(_typeof(call)==="object"||typeof call==="function")){return call;}return _assertThisInitialized(self);}function _getPrototypeOf(o){_getPrototypeOf=Object.setPrototypeOf?Object.getPrototypeOf:function _getPrototypeOf(o){return o.__proto__||Object.getPrototypeOf(o);};return _getPrototypeOf(o);}function _assertThisInitialized(self){if(self===void 0){throw new ReferenceError("this hasn't been initialised - super() hasn't been called");}return self;}function _inherits(subClass,superClass){if(typeof superClass!=="function"&&superClass!==null){throw new TypeError("Super expression must either be null or a function");}subClass.prototype=Object.create(superClass&&superClass.prototype,{constructor:{value:subClass,writable:true,configurable:true}});if(superClass)_setPrototypeOf(subClass,superClass);}function _setPrototypeOf(o,p){_setPrototypeOf=Object.setPrototypeOf||function _setPrototypeOf(o,p){o.__proto__=p;return o;};return _setPrototypeOf(o,p);}function _defineProperty(obj,key,value){if(key in obj){Object.defineProperty(obj,key,{value:value,enumerable:true,configurable:true,writable:true});}else{obj[key]=value;}return obj;}import{Component}from'react';import PropTypes from'prop-types';/**
1
+ function _typeof(obj){"@babel/helpers - typeof";return _typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(obj){return typeof obj;}:function(obj){return obj&&"function"==typeof Symbol&&obj.constructor===Symbol&&obj!==Symbol.prototype?"symbol":typeof obj;},_typeof(obj);}function _classCallCheck(instance,Constructor){if(!(instance instanceof Constructor)){throw new TypeError("Cannot call a class as a function");}}function _defineProperties(target,props){for(var i=0;i<props.length;i++){var descriptor=props[i];descriptor.enumerable=descriptor.enumerable||false;descriptor.configurable=true;if("value"in descriptor)descriptor.writable=true;Object.defineProperty(target,descriptor.key,descriptor);}}function _createClass(Constructor,protoProps,staticProps){if(protoProps)_defineProperties(Constructor.prototype,protoProps);if(staticProps)_defineProperties(Constructor,staticProps);Object.defineProperty(Constructor,"prototype",{writable:false});return Constructor;}function _inherits(subClass,superClass){if(typeof superClass!=="function"&&superClass!==null){throw new TypeError("Super expression must either be null or a function");}subClass.prototype=Object.create(superClass&&superClass.prototype,{constructor:{value:subClass,writable:true,configurable:true}});Object.defineProperty(subClass,"prototype",{writable:false});if(superClass)_setPrototypeOf(subClass,superClass);}function _setPrototypeOf(o,p){_setPrototypeOf=Object.setPrototypeOf||function _setPrototypeOf(o,p){o.__proto__=p;return o;};return _setPrototypeOf(o,p);}function _createSuper(Derived){var hasNativeReflectConstruct=_isNativeReflectConstruct();return function _createSuperInternal(){var Super=_getPrototypeOf(Derived),result;if(hasNativeReflectConstruct){var NewTarget=_getPrototypeOf(this).constructor;result=Reflect.construct(Super,arguments,NewTarget);}else{result=Super.apply(this,arguments);}return _possibleConstructorReturn(this,result);};}function _possibleConstructorReturn(self,call){if(call&&(_typeof(call)==="object"||typeof call==="function")){return call;}else if(call!==void 0){throw new TypeError("Derived constructors may only return object or undefined");}return _assertThisInitialized(self);}function _assertThisInitialized(self){if(self===void 0){throw new ReferenceError("this hasn't been initialised - super() hasn't been called");}return self;}function _isNativeReflectConstruct(){if(typeof Reflect==="undefined"||!Reflect.construct)return false;if(Reflect.construct.sham)return false;if(typeof Proxy==="function")return true;try{Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}));return true;}catch(e){return false;}}function _getPrototypeOf(o){_getPrototypeOf=Object.setPrototypeOf?Object.getPrototypeOf:function _getPrototypeOf(o){return o.__proto__||Object.getPrototypeOf(o);};return _getPrototypeOf(o);}function _defineProperty(obj,key,value){if(key in obj){Object.defineProperty(obj,key,{value:value,enumerable:true,configurable:true,writable:true});}else{obj[key]=value;}return obj;}import{Component}from'react';import PropTypes from'prop-types';/**
2
2
  * The Accordion container component.
3
- */var AccordionContainer=/*#__PURE__*/function(_Component){_inherits(AccordionContainer,_Component);function AccordionContainer(){var _getPrototypeOf2;var _this;_classCallCheck(this,AccordionContainer);for(var _len=arguments.length,args=new Array(_len),_key=0;_key<_len;_key++){args[_key]=arguments[_key];}_this=_possibleConstructorReturn(this,(_getPrototypeOf2=_getPrototypeOf(AccordionContainer)).call.apply(_getPrototypeOf2,[this].concat(args)));_defineProperty(_assertThisInitialized(_this),"state",{open:false/**
3
+ */var AccordionContainer=/*#__PURE__*/function(_Component){_inherits(AccordionContainer,_Component);var _super=_createSuper(AccordionContainer);/**
4
+ * Init
5
+ * @param {Object} props Props
6
+ */function AccordionContainer(props){var _this;_classCallCheck(this,AccordionContainer);_this=_super.call(this,props);_defineProperty(_assertThisInitialized(_this),"open",function(){_this.setState({open:true});});_defineProperty(_assertThisInitialized(_this),"close",function(){_this.setState({open:false});});_this.state={open:props.open};return _this;}/**
4
7
  * @param {Object} nextProps The next component props.
5
8
  * @param {Object} nextState The next component state.
6
9
  * @returns {boolean}
@@ -8,6 +11,6 @@ function _typeof(obj){if(typeof Symbol==="function"&&typeof Symbol.iterator==="s
8
11
  // shouldComponentUpdate(nextProps, nextState) {
9
12
  // return this.state.open !== nextState.open;
10
13
  // }
11
- });_defineProperty(_assertThisInitialized(_this),"open",function(){_this.setState({open:true});});_defineProperty(_assertThisInitialized(_this),"close",function(){_this.setState({open:false});});return _this;}_createClass(AccordionContainer,[{key:"render",/**
14
+ _createClass(AccordionContainer,[{key:"render",value:/**
12
15
  * @returns {JSX}
13
- */value:function render(){return this.props.children({handleClose:this.close,open:this.state.open,handleOpen:this.open});}}]);return AccordionContainer;}(Component);export default AccordionContainer;
16
+ */function render(){return this.props.children({handleClose:this.close,open:this.state.open,handleOpen:this.open});}}]);return AccordionContainer;}(Component);_defineProperty(AccordionContainer,"defaultProps",{open:false});export default AccordionContainer;
@@ -1,3 +1,3 @@
1
- function _typeof(obj){if(typeof Symbol==="function"&&typeof Symbol.iterator==="symbol"){_typeof=function _typeof(obj){return typeof obj;};}else{_typeof=function _typeof(obj){return obj&&typeof Symbol==="function"&&obj.constructor===Symbol&&obj!==Symbol.prototype?"symbol":typeof obj;};}return _typeof(obj);}import React from'react';import{shallow}from'enzyme';import AccordionContainer from"./index";/**
1
+ function _typeof(obj){"@babel/helpers - typeof";return _typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(obj){return typeof obj;}:function(obj){return obj&&"function"==typeof Symbol&&obj.constructor===Symbol&&obj!==Symbol.prototype?"symbol":typeof obj;},_typeof(obj);}import React from'react';import{shallow}from'enzyme';import AccordionContainer from"./index";/**
2
2
  * @returns {JSX}
3
- */var Child=function Child(){return React.createElement("div",null);};describe('<AccordionContainer />',function(){it('should render children with props',function(){var wrapper=shallow(React.createElement(AccordionContainer,null,function(props){return React.createElement(Child,props);}));var props=wrapper.find('Child').props();expect(wrapper).toMatchSnapshot();expect(props.open).toEqual(false);expect(_typeof(props.handleOpen)).toEqual('function');expect(_typeof(props.handleClose)).toEqual('function');});it('should update children props when state changes',function(){var wrapper=shallow(React.createElement(AccordionContainer,null,function(props){return React.createElement(Child,props);}));wrapper.setState({open:true});expect(wrapper).toMatchSnapshot();expect(wrapper.find('Child').props().open).toEqual(true);});});
3
+ */var Child=function Child(){return/*#__PURE__*/React.createElement("div",null);};describe('<AccordionContainer />',function(){it('should render children with props',function(){var wrapper=shallow(/*#__PURE__*/React.createElement(AccordionContainer,null,function(props){return/*#__PURE__*/React.createElement(Child,props);}));var props=wrapper.find('Child').props();expect(wrapper).toMatchSnapshot();expect(props.open).toEqual(false);expect(_typeof(props.handleOpen)).toEqual('function');expect(_typeof(props.handleClose)).toEqual('function');});it('should update children props when state changes',function(){var wrapper=shallow(/*#__PURE__*/React.createElement(AccordionContainer,null,function(props){return/*#__PURE__*/React.createElement(Child,props);}));wrapper.setState({open:true});expect(wrapper).toMatchSnapshot();expect(wrapper.find('Child').props().open).toEqual(true);});});
@@ -1,12 +1,12 @@
1
- function _typeof(obj){if(typeof Symbol==="function"&&typeof Symbol.iterator==="symbol"){_typeof=function _typeof(obj){return typeof obj;};}else{_typeof=function _typeof(obj){return obj&&typeof Symbol==="function"&&obj.constructor===Symbol&&obj!==Symbol.prototype?"symbol":typeof obj;};}return _typeof(obj);}function _extends(){_extends=Object.assign||function(target){for(var i=1;i<arguments.length;i++){var source=arguments[i];for(var key in source){if(Object.prototype.hasOwnProperty.call(source,key)){target[key]=source[key];}}}return target;};return _extends.apply(this,arguments);}function _classCallCheck(instance,Constructor){if(!(instance instanceof Constructor)){throw new TypeError("Cannot call a class as a function");}}function _defineProperties(target,props){for(var i=0;i<props.length;i++){var descriptor=props[i];descriptor.enumerable=descriptor.enumerable||false;descriptor.configurable=true;if("value"in descriptor)descriptor.writable=true;Object.defineProperty(target,descriptor.key,descriptor);}}function _createClass(Constructor,protoProps,staticProps){if(protoProps)_defineProperties(Constructor.prototype,protoProps);if(staticProps)_defineProperties(Constructor,staticProps);return Constructor;}function _possibleConstructorReturn(self,call){if(call&&(_typeof(call)==="object"||typeof call==="function")){return call;}return _assertThisInitialized(self);}function _getPrototypeOf(o){_getPrototypeOf=Object.setPrototypeOf?Object.getPrototypeOf:function _getPrototypeOf(o){return o.__proto__||Object.getPrototypeOf(o);};return _getPrototypeOf(o);}function _assertThisInitialized(self){if(self===void 0){throw new ReferenceError("this hasn't been initialised - super() hasn't been called");}return self;}function _inherits(subClass,superClass){if(typeof superClass!=="function"&&superClass!==null){throw new TypeError("Super expression must either be null or a function");}subClass.prototype=Object.create(superClass&&superClass.prototype,{constructor:{value:subClass,writable:true,configurable:true}});if(superClass)_setPrototypeOf(subClass,superClass);}function _setPrototypeOf(o,p){_setPrototypeOf=Object.setPrototypeOf||function _setPrototypeOf(o,p){o.__proto__=p;return o;};return _setPrototypeOf(o,p);}function _defineProperty(obj,key,value){if(key in obj){Object.defineProperty(obj,key,{value:value,enumerable:true,configurable:true,writable:true});}else{obj[key]=value;}return obj;}import React,{Component}from'react';import PropTypes from'prop-types';import IndicatorCircle from"../IndicatorCircle";import RippleButton from"../RippleButton";import styles from"./style";/**
1
+ function _typeof(obj){"@babel/helpers - typeof";return _typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(obj){return typeof obj;}:function(obj){return obj&&"function"==typeof Symbol&&obj.constructor===Symbol&&obj!==Symbol.prototype?"symbol":typeof obj;},_typeof(obj);}function _extends(){_extends=Object.assign||function(target){for(var i=1;i<arguments.length;i++){var source=arguments[i];for(var key in source){if(Object.prototype.hasOwnProperty.call(source,key)){target[key]=source[key];}}}return target;};return _extends.apply(this,arguments);}function _classCallCheck(instance,Constructor){if(!(instance instanceof Constructor)){throw new TypeError("Cannot call a class as a function");}}function _defineProperties(target,props){for(var i=0;i<props.length;i++){var descriptor=props[i];descriptor.enumerable=descriptor.enumerable||false;descriptor.configurable=true;if("value"in descriptor)descriptor.writable=true;Object.defineProperty(target,descriptor.key,descriptor);}}function _createClass(Constructor,protoProps,staticProps){if(protoProps)_defineProperties(Constructor.prototype,protoProps);if(staticProps)_defineProperties(Constructor,staticProps);Object.defineProperty(Constructor,"prototype",{writable:false});return Constructor;}function _inherits(subClass,superClass){if(typeof superClass!=="function"&&superClass!==null){throw new TypeError("Super expression must either be null or a function");}subClass.prototype=Object.create(superClass&&superClass.prototype,{constructor:{value:subClass,writable:true,configurable:true}});Object.defineProperty(subClass,"prototype",{writable:false});if(superClass)_setPrototypeOf(subClass,superClass);}function _setPrototypeOf(o,p){_setPrototypeOf=Object.setPrototypeOf||function _setPrototypeOf(o,p){o.__proto__=p;return o;};return _setPrototypeOf(o,p);}function _createSuper(Derived){var hasNativeReflectConstruct=_isNativeReflectConstruct();return function _createSuperInternal(){var Super=_getPrototypeOf(Derived),result;if(hasNativeReflectConstruct){var NewTarget=_getPrototypeOf(this).constructor;result=Reflect.construct(Super,arguments,NewTarget);}else{result=Super.apply(this,arguments);}return _possibleConstructorReturn(this,result);};}function _possibleConstructorReturn(self,call){if(call&&(_typeof(call)==="object"||typeof call==="function")){return call;}else if(call!==void 0){throw new TypeError("Derived constructors may only return object or undefined");}return _assertThisInitialized(self);}function _assertThisInitialized(self){if(self===void 0){throw new ReferenceError("this hasn't been initialised - super() hasn't been called");}return self;}function _isNativeReflectConstruct(){if(typeof Reflect==="undefined"||!Reflect.construct)return false;if(Reflect.construct.sham)return false;if(typeof Proxy==="function")return true;try{Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}));return true;}catch(e){return false;}}function _getPrototypeOf(o){_getPrototypeOf=Object.setPrototypeOf?Object.getPrototypeOf:function _getPrototypeOf(o){return o.__proto__||Object.getPrototypeOf(o);};return _getPrototypeOf(o);}function _defineProperty(obj,key,value){if(key in obj){Object.defineProperty(obj,key,{value:value,enumerable:true,configurable:true,writable:true});}else{obj[key]=value;}return obj;}import React,{Component}from'react';import PropTypes from'prop-types';import IndicatorCircle from"../IndicatorCircle";import RippleButton from"../RippleButton";import styles from"./style";/**
2
2
  * The action button component.
3
- */var ActionButton=/*#__PURE__*/function(_Component){_inherits(ActionButton,_Component);function ActionButton(){var _getPrototypeOf2;var _this;_classCallCheck(this,ActionButton);for(var _len=arguments.length,args=new Array(_len),_key=0;_key<_len;_key++){args[_key]=arguments[_key];}_this=_possibleConstructorReturn(this,(_getPrototypeOf2=_getPrototypeOf(ActionButton)).call.apply(_getPrototypeOf2,[this].concat(args)));_defineProperty(_assertThisInitialized(_this),"handleClick",function(event){var clickDelay=_this.constructor.clickDelay;setTimeout(function(){_this.props.onClick(event);},clickDelay);});return _this;}_createClass(ActionButton,[{key:"render",/**
4
- * The render function.
5
- * @returns {JSX}
6
- */value:function render(){var containerClass=this.props.noGap?styles.noGapContainer:styles.container;if(this.props.loading){return React.createElement("div",{className:styles.containerCircle},React.createElement(IndicatorCircle,null));}return React.createElement("div",{className:"ui-shared__action-button ".concat(containerClass),"data-test-id":this.props.testId},React.createElement(RippleButton,_extends({},this.buttonProps,{onClick:this.handleClick}),this.props.children));}},{key:"buttonProps",/**
3
+ */var ActionButton=/*#__PURE__*/function(_Component){_inherits(ActionButton,_Component);var _super=_createSuper(ActionButton);function ActionButton(){var _this;_classCallCheck(this,ActionButton);for(var _len=arguments.length,args=new Array(_len),_key=0;_key<_len;_key++){args[_key]=arguments[_key];}_this=_super.call.apply(_super,[this].concat(args));_defineProperty(_assertThisInitialized(_this),"handleClick",function(event){var clickDelay=_this.constructor.clickDelay;setTimeout(function(){_this.props.onClick(event);},clickDelay);});return _this;}_createClass(ActionButton,[{key:"buttonProps",get:/**
7
4
  * Getter for the calculated button props.
8
5
  * @returns {Object}
9
- */get:function get(){var buttonProps={className:this.props.className,disabled:this.props.disabled,flat:this.props.flat,type:this.props.type};return buttonProps;}/**
6
+ */function get(){var buttonProps={className:this.props.className,disabled:this.props.disabled,flat:this.props.flat,type:this.props.type};return buttonProps;}/**
10
7
  * The click handler
11
8
  * @param {Object} event The event object for the click handler
12
- */}]);return ActionButton;}(Component);_defineProperty(ActionButton,"clickDelay",300);_defineProperty(ActionButton,"defaultProps",_extends({},RippleButton.defaultProps,{loading:false,type:'primary',flat:true,noGap:false,testId:null}));export default ActionButton;
9
+ */},{key:"render",value:/**
10
+ * The render function.
11
+ * @returns {JSX}
12
+ */function render(){var containerClass=this.props.noGap?styles.noGapContainer:styles.container;if(this.props.loading){return/*#__PURE__*/React.createElement("div",{className:styles.containerCircle},/*#__PURE__*/React.createElement(IndicatorCircle,null));}return/*#__PURE__*/React.createElement("div",{className:"ui-shared__action-button ".concat(containerClass),"data-test-id":this.props.testId},/*#__PURE__*/React.createElement(RippleButton,_extends({},this.buttonProps,{onClick:this.handleClick}),this.props.children));}}]);return ActionButton;}(Component);_defineProperty(ActionButton,"clickDelay",300);_defineProperty(ActionButton,"defaultProps",_extends({},RippleButton.defaultProps,{loading:false,type:'primary',flat:true,noGap:false,testId:null}));export default ActionButton;
@@ -1,4 +1,4 @@
1
1
  import React from'react';import{shallow}from'enzyme';import IndicatorCircle from"../IndicatorCircle";import RippleButton from"../RippleButton";import ActionButton from"./index";describe('<ActionButton />',function(){var renderedElement;var mockOnClick;jest.useFakeTimers();/**
2
2
  * Renders the component.
3
3
  * @param {Object} props The component props.
4
- */var renderComponent=function renderComponent(){var props=arguments.length>0&&arguments[0]!==undefined?arguments[0]:{};renderedElement=shallow(React.createElement(ActionButton,props,"Action Button"));};describe('Given the component was mounted to the DOM',function(){beforeEach(function(){mockOnClick=jest.fn();renderComponent({onClick:mockOnClick});});it('should match snapshot',function(){expect(renderedElement).toMatchSnapshot();});it('should not show the loading indicator by default',function(){var indicator=renderedElement.find(IndicatorCircle);expect(indicator.length).toBe(0);});describe('Given the loading prop is set to true',function(){beforeEach(function(){renderedElement.setProps({loading:true});});it('should match snapshot',function(){expect(renderedElement).toMatchSnapshot();});it('should show the loading indicator',function(){var indicator=renderedElement.find(IndicatorCircle);expect(indicator.length).toBe(1);});});describe('Given the component gets clicked',function(){beforeEach(function(){renderedElement.find(RippleButton).simulate('click');});it('should use setTimeout for delaying the onClick handler',function(){expect(setTimeout.mock.calls.length).toBe(1);expect(setTimeout.mock.calls[0][1]).toBe(ActionButton.clickDelay);});it('should eventually call the onClick handler',function(){jest.runOnlyPendingTimers();expect(mockOnClick).toBeCalled();expect(mockOnClick.mock.calls.length).toBe(1);});});});});
4
+ */var renderComponent=function renderComponent(){var props=arguments.length>0&&arguments[0]!==undefined?arguments[0]:{};renderedElement=shallow(/*#__PURE__*/React.createElement(ActionButton,props,"Action Button"));};describe('Given the component was mounted to the DOM',function(){beforeEach(function(){mockOnClick=jest.fn();renderComponent({onClick:mockOnClick});});it('should match snapshot',function(){expect(renderedElement).toMatchSnapshot();});it('should not show the loading indicator by default',function(){var indicator=renderedElement.find(IndicatorCircle);expect(indicator.length).toBe(0);});describe('Given the loading prop is set to true',function(){beforeEach(function(){renderedElement.setProps({loading:true});});it('should match snapshot',function(){expect(renderedElement).toMatchSnapshot();});it('should show the loading indicator',function(){var indicator=renderedElement.find(IndicatorCircle);expect(indicator.length).toBe(1);});});describe('Given the component gets clicked',function(){beforeEach(function(){renderedElement.find(RippleButton).simulate('click');});it('should use setTimeout for delaying the onClick handler',function(){expect(setTimeout.mock.calls.length).toBe(1);expect(setTimeout.mock.calls[0][1]).toBe(ActionButton.clickDelay);});it('should eventually call the onClick handler',function(){jest.runOnlyPendingTimers();expect(mockOnClick).toBeCalled();expect(mockOnClick.mock.calls.length).toBe(1);});});});});
@@ -1,18 +1,19 @@
1
- import _regeneratorRuntime from"@babel/runtime/regenerator";function _typeof(obj){if(typeof Symbol==="function"&&typeof Symbol.iterator==="symbol"){_typeof=function _typeof(obj){return typeof obj;};}else{_typeof=function _typeof(obj){return obj&&typeof Symbol==="function"&&obj.constructor===Symbol&&obj!==Symbol.prototype?"symbol":typeof obj;};}return _typeof(obj);}function _extends(){_extends=Object.assign||function(target){for(var i=1;i<arguments.length;i++){var source=arguments[i];for(var key in source){if(Object.prototype.hasOwnProperty.call(source,key)){target[key]=source[key];}}}return target;};return _extends.apply(this,arguments);}function asyncGeneratorStep(gen,resolve,reject,_next,_throw,key,arg){try{var info=gen[key](arg);var value=info.value;}catch(error){reject(error);return;}if(info.done){resolve(value);}else{Promise.resolve(value).then(_next,_throw);}}function _asyncToGenerator(fn){return function(){var self=this,args=arguments;return new Promise(function(resolve,reject){var gen=fn.apply(self,args);function _next(value){asyncGeneratorStep(gen,resolve,reject,_next,_throw,"next",value);}function _throw(err){asyncGeneratorStep(gen,resolve,reject,_next,_throw,"throw",err);}_next(undefined);});};}function _classCallCheck(instance,Constructor){if(!(instance instanceof Constructor)){throw new TypeError("Cannot call a class as a function");}}function _defineProperties(target,props){for(var i=0;i<props.length;i++){var descriptor=props[i];descriptor.enumerable=descriptor.enumerable||false;descriptor.configurable=true;if("value"in descriptor)descriptor.writable=true;Object.defineProperty(target,descriptor.key,descriptor);}}function _createClass(Constructor,protoProps,staticProps){if(protoProps)_defineProperties(Constructor.prototype,protoProps);if(staticProps)_defineProperties(Constructor,staticProps);return Constructor;}function _possibleConstructorReturn(self,call){if(call&&(_typeof(call)==="object"||typeof call==="function")){return call;}return _assertThisInitialized(self);}function _getPrototypeOf(o){_getPrototypeOf=Object.setPrototypeOf?Object.getPrototypeOf:function _getPrototypeOf(o){return o.__proto__||Object.getPrototypeOf(o);};return _getPrototypeOf(o);}function _assertThisInitialized(self){if(self===void 0){throw new ReferenceError("this hasn't been initialised - super() hasn't been called");}return self;}function _inherits(subClass,superClass){if(typeof superClass!=="function"&&superClass!==null){throw new TypeError("Super expression must either be null or a function");}subClass.prototype=Object.create(superClass&&superClass.prototype,{constructor:{value:subClass,writable:true,configurable:true}});if(superClass)_setPrototypeOf(subClass,superClass);}function _setPrototypeOf(o,p){_setPrototypeOf=Object.setPrototypeOf||function _setPrototypeOf(o,p){o.__proto__=p;return o;};return _setPrototypeOf(o,p);}function _defineProperty(obj,key,value){if(key in obj){Object.defineProperty(obj,key,{value:value,enumerable:true,configurable:true,writable:true});}else{obj[key]=value;}return obj;}import React,{Component}from'react';import PropTypes from'prop-types';import{themeConfig}from'@shopgate/pwa-common/helpers/config';import{withForwardedRef}from'@shopgate/engage/core';import CartPlusIcon from"../icons/CartPlusIcon";import TickIcon from"../icons/TickIcon";import IndicatorCircle from"../IndicatorCircle";import styles from"./style";/**
1
+ function _typeof(obj){"@babel/helpers - typeof";return _typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(obj){return typeof obj;}:function(obj){return obj&&"function"==typeof Symbol&&obj.constructor===Symbol&&obj!==Symbol.prototype?"symbol":typeof obj;},_typeof(obj);}function _extends(){_extends=Object.assign||function(target){for(var i=1;i<arguments.length;i++){var source=arguments[i];for(var key in source){if(Object.prototype.hasOwnProperty.call(source,key)){target[key]=source[key];}}}return target;};return _extends.apply(this,arguments);}import _regeneratorRuntime from"@babel/runtime/regenerator";function asyncGeneratorStep(gen,resolve,reject,_next,_throw,key,arg){try{var info=gen[key](arg);var value=info.value;}catch(error){reject(error);return;}if(info.done){resolve(value);}else{Promise.resolve(value).then(_next,_throw);}}function _asyncToGenerator(fn){return function(){var self=this,args=arguments;return new Promise(function(resolve,reject){var gen=fn.apply(self,args);function _next(value){asyncGeneratorStep(gen,resolve,reject,_next,_throw,"next",value);}function _throw(err){asyncGeneratorStep(gen,resolve,reject,_next,_throw,"throw",err);}_next(undefined);});};}function _classCallCheck(instance,Constructor){if(!(instance instanceof Constructor)){throw new TypeError("Cannot call a class as a function");}}function _defineProperties(target,props){for(var i=0;i<props.length;i++){var descriptor=props[i];descriptor.enumerable=descriptor.enumerable||false;descriptor.configurable=true;if("value"in descriptor)descriptor.writable=true;Object.defineProperty(target,descriptor.key,descriptor);}}function _createClass(Constructor,protoProps,staticProps){if(protoProps)_defineProperties(Constructor.prototype,protoProps);if(staticProps)_defineProperties(Constructor,staticProps);Object.defineProperty(Constructor,"prototype",{writable:false});return Constructor;}function _inherits(subClass,superClass){if(typeof superClass!=="function"&&superClass!==null){throw new TypeError("Super expression must either be null or a function");}subClass.prototype=Object.create(superClass&&superClass.prototype,{constructor:{value:subClass,writable:true,configurable:true}});Object.defineProperty(subClass,"prototype",{writable:false});if(superClass)_setPrototypeOf(subClass,superClass);}function _setPrototypeOf(o,p){_setPrototypeOf=Object.setPrototypeOf||function _setPrototypeOf(o,p){o.__proto__=p;return o;};return _setPrototypeOf(o,p);}function _createSuper(Derived){var hasNativeReflectConstruct=_isNativeReflectConstruct();return function _createSuperInternal(){var Super=_getPrototypeOf(Derived),result;if(hasNativeReflectConstruct){var NewTarget=_getPrototypeOf(this).constructor;result=Reflect.construct(Super,arguments,NewTarget);}else{result=Super.apply(this,arguments);}return _possibleConstructorReturn(this,result);};}function _possibleConstructorReturn(self,call){if(call&&(_typeof(call)==="object"||typeof call==="function")){return call;}else if(call!==void 0){throw new TypeError("Derived constructors may only return object or undefined");}return _assertThisInitialized(self);}function _assertThisInitialized(self){if(self===void 0){throw new ReferenceError("this hasn't been initialised - super() hasn't been called");}return self;}function _isNativeReflectConstruct(){if(typeof Reflect==="undefined"||!Reflect.construct)return false;if(Reflect.construct.sham)return false;if(typeof Proxy==="function")return true;try{Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}));return true;}catch(e){return false;}}function _getPrototypeOf(o){_getPrototypeOf=Object.setPrototypeOf?Object.getPrototypeOf:function _getPrototypeOf(o){return o.__proto__||Object.getPrototypeOf(o);};return _getPrototypeOf(o);}function _defineProperty(obj,key,value){if(key in obj){Object.defineProperty(obj,key,{value:value,enumerable:true,configurable:true,writable:true});}else{obj[key]=value;}return obj;}import React,{Component}from'react';import PropTypes from'prop-types';import{themeConfig}from'@shopgate/pwa-common/helpers/config';import{withForwardedRef}from'@shopgate/engage/core';import CartPlusIcon from"../icons/CartPlusIcon";import TickIcon from"../icons/TickIcon";import IndicatorCircle from"../IndicatorCircle";import styles from"./style";/**
2
2
  * AddToCartButton component.
3
- */var AddToCartButton=/*#__PURE__*/function(_Component){_inherits(AddToCartButton,_Component);/**
3
+ */var AddToCartButton=/*#__PURE__*/function(_Component){_inherits(AddToCartButton,_Component);var _super=_createSuper(AddToCartButton);/**
4
4
  * Constructor for the AddToCartButton component.
5
5
  * @param {Object} props Props for the component.
6
- */function AddToCartButton(props){var _this;_classCallCheck(this,AddToCartButton);_this=_possibleConstructorReturn(this,_getPrototypeOf(AddToCartButton).call(this,props));_defineProperty(_assertThisInitialized(_this),"handleClick",/*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee(){var success;return _regeneratorRuntime.wrap(function _callee$(_context){while(1){switch(_context.prev=_context.next){case 0:if(!(_this.state.showCheckmark||_this.props.isLoading||_this.props.isDisabled)){_context.next=2;break;}return _context.abrupt("return");case 2:_context.next=4;return _this.props.onClick();case 4:success=_context.sent;if(!(success===false)){_context.next=7;break;}return _context.abrupt("return");case 7:_this.setState({showCheckmark:true});setTimeout(function(){_this.setState({showCheckmark:false});},900);case 9:case"end":return _context.stop();}}},_callee);})));_defineProperty(_assertThisInitialized(_this),"handleCartAnimationEnd",function(){if(_this.state.showCheckmark===false){_this.setState({showCheckmark:null});}_this.props.onReset();});_this.state={showCheckmark:null};return _this;}/**
6
+ */function AddToCartButton(props){var _this;_classCallCheck(this,AddToCartButton);_this=_super.call(this,props);_defineProperty(_assertThisInitialized(_this),"handleClick",/*#__PURE__*/function(){var _ref=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee(e){var success;return _regeneratorRuntime.wrap(function _callee$(_context){while(1){switch(_context.prev=_context.next){case 0:if(!(_this.state.showCheckmark||_this.props.isLoading||_this.props.isDisabled)){_context.next=2;break;}return _context.abrupt("return");case 2:_context.next=4;return _this.props.onClick(e);case 4:success=_context.sent;if(!(success===false)){_context.next=7;break;}return _context.abrupt("return");case 7:_this.setState({showCheckmark:true});setTimeout(function(){_this.setState({showCheckmark:false});},900);case 9:case"end":return _context.stop();}}},_callee);}));return function(_x){return _ref.apply(this,arguments);};}());_defineProperty(_assertThisInitialized(_this),"handleCartAnimationEnd",function(){if(_this.state.showCheckmark===false){_this.setState({showCheckmark:null});}_this.props.onReset();});_this.state={showCheckmark:null};return _this;}/**
7
7
  * Handles the button click.
8
8
  * - Show checkmark.
9
9
  * - Add to cart.
10
10
  * - Wait 900ms.
11
11
  * - Show cart icon again.
12
- */_createClass(AddToCartButton,[{key:"render",/**
12
+ * @param {Event} e Event
13
+ */_createClass(AddToCartButton,[{key:"render",value:/**
13
14
  * Renders the component
14
15
  * @returns {JSX}
15
- */value:function render(){// Set initial base styles
16
+ */function render(){// Set initial base styles
16
17
  var buttonStyle=styles.buttonReady;var tickIconStyle=styles.icon;var cartPlusIconStyle=styles.icon;// Depending on the isLoading prop we only show the spinner or the other way around.
17
18
  var iconOpacity=this.props.isLoading?{opacity:0}:{opacity:1};var spinnerInlineStyle=this.props.isLoading?{opacity:1}:{opacity:0};/**
18
19
  * The initial positions for the icons:
@@ -31,4 +32,4 @@ var iconOpacity=this.props.isLoading?{opacity:0}:{opacity:1};var spinnerInlineSt
31
32
  */tickIconStyle+=" ".concat(styles.springToBottom);cartPlusIconStyle+=" ".concat(styles.springFromTop);/**
32
33
  * After the keyframe animation is done the transform values are reset
33
34
  * We add the inline style to make sure the icons stay where they are even after the animation
34
- */cartInlineStyle=_extends({transform:'translate3d(0, -50%, 0)'},iconOpacity);tickInlineStyle=_extends({transform:'translate3d(0, -300%, 0)'},iconOpacity);}var className=styles.buttonWrapper(this.props.buttonSize,this.props.iconSize);if(this.props.noShadow){className=styles.buttonWrapperNoShadow(this.props.buttonSize,this.props.iconSize);}return React.createElement("button",{"data-test-id":"addToCartButton",className:"ui-shared__add-to-cart-button ".concat(this.props.className," ").concat(className," ").concat(buttonStyle),onClick:this.handleClick,"aria-hidden":this.props['aria-hidden'],"aria-label":this.props['aria-label'],ref:this.props.forwardedRef,type:"button"},this.props.isLoading&&React.createElement("div",{className:"".concat(styles.icon," ").concat(styles.spinnerIcon),style:spinnerInlineStyle},React.createElement(IndicatorCircle,{color:themeConfig.colors.primaryContrast,strokeWidth:5,paused:!this.props.isLoading})),React.createElement("div",{className:tickIconStyle,style:tickInlineStyle},React.createElement(TickIcon,null)),React.createElement("div",{className:cartPlusIconStyle,style:cartInlineStyle,onAnimationEnd:this.handleCartAnimationEnd},React.createElement(CartPlusIcon,null)));}}]);return AddToCartButton;}(Component);_defineProperty(AddToCartButton,"defaultProps",{'aria-hidden':false,'aria-label':null,buttonSize:styles.buttonSize,className:null,forwardedRef:null,iconSize:styles.iconSize,noShadow:false,onReset:function onReset(){}});export default withForwardedRef(AddToCartButton);
35
+ */cartInlineStyle=_extends({transform:'translate3d(0, -50%, 0)'},iconOpacity);tickInlineStyle=_extends({transform:'translate3d(0, -300%, 0)'},iconOpacity);}var className=styles.buttonWrapper(this.props.buttonSize,this.props.iconSize);if(this.props.noShadow){className=styles.buttonWrapperNoShadow(this.props.buttonSize,this.props.iconSize);}return/*#__PURE__*/React.createElement("button",{"data-test-id":"addToCartButton",className:"ui-shared__add-to-cart-button ".concat(this.props.className," ").concat(className," ").concat(buttonStyle),onClick:this.handleClick,"aria-hidden":this.props['aria-hidden'],"aria-label":this.props['aria-label'],ref:this.props.forwardedRef,type:"button"},this.props.isLoading&&/*#__PURE__*/React.createElement("div",{className:"".concat(styles.icon," ").concat(styles.spinnerIcon),style:spinnerInlineStyle},/*#__PURE__*/React.createElement(IndicatorCircle,{color:themeConfig.colors.primaryContrast,strokeWidth:5,paused:!this.props.isLoading})),/*#__PURE__*/React.createElement("div",{className:tickIconStyle,style:tickInlineStyle},/*#__PURE__*/React.createElement(TickIcon,null)),/*#__PURE__*/React.createElement("div",{className:cartPlusIconStyle,style:cartInlineStyle,onAnimationEnd:this.handleCartAnimationEnd},/*#__PURE__*/React.createElement(CartPlusIcon,null)));}}]);return AddToCartButton;}(Component);_defineProperty(AddToCartButton,"defaultProps",{'aria-hidden':false,'aria-label':null,buttonSize:styles.buttonSize,className:null,forwardedRef:null,iconSize:styles.iconSize,noShadow:false,onReset:function onReset(){}});export default withForwardedRef(AddToCartButton);
@@ -1,9 +1,9 @@
1
- var _class,_temp;function _typeof(obj){if(typeof Symbol==="function"&&typeof Symbol.iterator==="symbol"){_typeof=function _typeof(obj){return typeof obj;};}else{_typeof=function _typeof(obj){return obj&&typeof Symbol==="function"&&obj.constructor===Symbol&&obj!==Symbol.prototype?"symbol":typeof obj;};}return _typeof(obj);}function _classCallCheck(instance,Constructor){if(!(instance instanceof Constructor)){throw new TypeError("Cannot call a class as a function");}}function _defineProperties(target,props){for(var i=0;i<props.length;i++){var descriptor=props[i];descriptor.enumerable=descriptor.enumerable||false;descriptor.configurable=true;if("value"in descriptor)descriptor.writable=true;Object.defineProperty(target,descriptor.key,descriptor);}}function _createClass(Constructor,protoProps,staticProps){if(protoProps)_defineProperties(Constructor.prototype,protoProps);if(staticProps)_defineProperties(Constructor,staticProps);return Constructor;}function _possibleConstructorReturn(self,call){if(call&&(_typeof(call)==="object"||typeof call==="function")){return call;}return _assertThisInitialized(self);}function _assertThisInitialized(self){if(self===void 0){throw new ReferenceError("this hasn't been initialised - super() hasn't been called");}return self;}function _getPrototypeOf(o){_getPrototypeOf=Object.setPrototypeOf?Object.getPrototypeOf:function _getPrototypeOf(o){return o.__proto__||Object.getPrototypeOf(o);};return _getPrototypeOf(o);}function _inherits(subClass,superClass){if(typeof superClass!=="function"&&superClass!==null){throw new TypeError("Super expression must either be null or a function");}subClass.prototype=Object.create(superClass&&superClass.prototype,{constructor:{value:subClass,writable:true,configurable:true}});if(superClass)_setPrototypeOf(subClass,superClass);}function _setPrototypeOf(o,p){_setPrototypeOf=Object.setPrototypeOf||function _setPrototypeOf(o,p){o.__proto__=p;return o;};return _setPrototypeOf(o,p);}function _defineProperty(obj,key,value){if(key in obj){Object.defineProperty(obj,key,{value:value,enumerable:true,configurable:true,writable:true});}else{obj[key]=value;}return obj;}import React,{Component}from'react';import PropTypes from'prop-types';/**
1
+ function _typeof(obj){"@babel/helpers - typeof";return _typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(obj){return typeof obj;}:function(obj){return obj&&"function"==typeof Symbol&&obj.constructor===Symbol&&obj!==Symbol.prototype?"symbol":typeof obj;},_typeof(obj);}var _class;function _classCallCheck(instance,Constructor){if(!(instance instanceof Constructor)){throw new TypeError("Cannot call a class as a function");}}function _defineProperties(target,props){for(var i=0;i<props.length;i++){var descriptor=props[i];descriptor.enumerable=descriptor.enumerable||false;descriptor.configurable=true;if("value"in descriptor)descriptor.writable=true;Object.defineProperty(target,descriptor.key,descriptor);}}function _createClass(Constructor,protoProps,staticProps){if(protoProps)_defineProperties(Constructor.prototype,protoProps);if(staticProps)_defineProperties(Constructor,staticProps);Object.defineProperty(Constructor,"prototype",{writable:false});return Constructor;}function _inherits(subClass,superClass){if(typeof superClass!=="function"&&superClass!==null){throw new TypeError("Super expression must either be null or a function");}subClass.prototype=Object.create(superClass&&superClass.prototype,{constructor:{value:subClass,writable:true,configurable:true}});Object.defineProperty(subClass,"prototype",{writable:false});if(superClass)_setPrototypeOf(subClass,superClass);}function _setPrototypeOf(o,p){_setPrototypeOf=Object.setPrototypeOf||function _setPrototypeOf(o,p){o.__proto__=p;return o;};return _setPrototypeOf(o,p);}function _createSuper(Derived){var hasNativeReflectConstruct=_isNativeReflectConstruct();return function _createSuperInternal(){var Super=_getPrototypeOf(Derived),result;if(hasNativeReflectConstruct){var NewTarget=_getPrototypeOf(this).constructor;result=Reflect.construct(Super,arguments,NewTarget);}else{result=Super.apply(this,arguments);}return _possibleConstructorReturn(this,result);};}function _possibleConstructorReturn(self,call){if(call&&(_typeof(call)==="object"||typeof call==="function")){return call;}else if(call!==void 0){throw new TypeError("Derived constructors may only return object or undefined");}return _assertThisInitialized(self);}function _assertThisInitialized(self){if(self===void 0){throw new ReferenceError("this hasn't been initialised - super() hasn't been called");}return self;}function _isNativeReflectConstruct(){if(typeof Reflect==="undefined"||!Reflect.construct)return false;if(Reflect.construct.sham)return false;if(typeof Proxy==="function")return true;try{Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}));return true;}catch(e){return false;}}function _getPrototypeOf(o){_getPrototypeOf=Object.setPrototypeOf?Object.getPrototypeOf:function _getPrototypeOf(o){return o.__proto__||Object.getPrototypeOf(o);};return _getPrototypeOf(o);}function _defineProperty(obj,key,value){if(key in obj){Object.defineProperty(obj,key,{value:value,enumerable:true,configurable:true,writable:true});}else{obj[key]=value;}return obj;}import React,{Component}from'react';import PropTypes from'prop-types';/**
2
2
  * Mocked AddToCartButton.
3
3
  * @type {MockedAddToCartButton}
4
4
  * @deprecated
5
5
  */ // eslint-disable-next-line react/prefer-stateless-function
6
- export var MockedAddToCartButton=(_temp=_class=/*#__PURE__*/function(_Component){_inherits(MockedAddToCartButton,_Component);function MockedAddToCartButton(){_classCallCheck(this,MockedAddToCartButton);return _possibleConstructorReturn(this,_getPrototypeOf(MockedAddToCartButton).apply(this,arguments));}_createClass(MockedAddToCartButton,[{key:"render",/**
6
+ export var MockedAddToCartButton=(_class=/*#__PURE__*/function(_Component){_inherits(MockedAddToCartButton,_Component);var _super=_createSuper(MockedAddToCartButton);function MockedAddToCartButton(){_classCallCheck(this,MockedAddToCartButton);return _super.apply(this,arguments);}_createClass(MockedAddToCartButton,[{key:"render",value:/**
7
7
  * Renders mocked button.
8
8
  * @return {JSX}
9
- */value:function render(){return React.createElement("button",{onClick:this.props.onClick,type:"button"});}}]);return MockedAddToCartButton;}(Component),_defineProperty(_class,"defaultProps",{onClick:function onClick(){}}),_temp);
9
+ */function render(){return/*#__PURE__*/React.createElement("button",{onClick:this.props.onClick,type:"button"});}}]);return MockedAddToCartButton;}(Component),_defineProperty(_class,"defaultProps",{onClick:function onClick(){}}),_class);
@@ -1 +1 @@
1
- import _regeneratorRuntime from"@babel/runtime/regenerator";function asyncGeneratorStep(gen,resolve,reject,_next,_throw,key,arg){try{var info=gen[key](arg);var value=info.value;}catch(error){reject(error);return;}if(info.done){resolve(value);}else{Promise.resolve(value).then(_next,_throw);}}function _asyncToGenerator(fn){return function(){var self=this,args=arguments;return new Promise(function(resolve,reject){var gen=fn.apply(self,args);function _next(value){asyncGeneratorStep(gen,resolve,reject,_next,_throw,"next",value);}function _throw(err){asyncGeneratorStep(gen,resolve,reject,_next,_throw,"throw",err);}_next(undefined);});};}import React from'react';import{mount}from'enzyme';import{act}from'react-dom/test-utils';import AddToCartButton from"./index";describe('<AddToCartButton />',function(){it('should render in loading state and should not be clickable',/*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee2(){var spy,wrapper;return _regeneratorRuntime.wrap(function _callee2$(_context2){while(1){switch(_context2.prev=_context2.next){case 0:spy=jest.fn().mockResolvedValue(true);wrapper=mount(React.createElement(AddToCartButton,{onClick:spy,isLoading:true,isOrderable:true,isDisabled:false}));_context2.next=4;return act(/*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee(){return _regeneratorRuntime.wrap(function _callee$(_context){while(1){switch(_context.prev=_context.next){case 0:wrapper.find('button').simulate('click');case 1:case"end":return _context.stop();}}},_callee);})));case 4:expect(spy).toHaveBeenCalledTimes(0);expect(wrapper).toMatchSnapshot();case 6:case"end":return _context2.stop();}}},_callee2);})));it('should render with checkmark icon and should not be clickable the second time',/*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee5(){var spy,wrapper;return _regeneratorRuntime.wrap(function _callee5$(_context5){while(1){switch(_context5.prev=_context5.next){case 0:spy=jest.fn().mockResolvedValue(true);wrapper=mount(React.createElement(AddToCartButton,{onClick:spy,isLoading:false,isOrderable:true,isDisabled:false}));_context5.next=4;return act(/*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee3(){return _regeneratorRuntime.wrap(function _callee3$(_context3){while(1){switch(_context3.prev=_context3.next){case 0:_context3.next=2;return wrapper.find('button').simulate('click');case 2:wrapper.update();case 3:case"end":return _context3.stop();}}},_callee3);})));case 4:_context5.next=6;return act(/*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee4(){return _regeneratorRuntime.wrap(function _callee4$(_context4){while(1){switch(_context4.prev=_context4.next){case 0:wrapper.find('button').simulate('click');wrapper.update();case 2:case"end":return _context4.stop();}}},_callee4);})));case 6:expect(spy).toHaveBeenCalledTimes(1);expect(wrapper).toMatchSnapshot();case 8:case"end":return _context5.stop();}}},_callee5);})));it('should render with cart icon and should be clickable',/*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee7(){var spy,wrapper;return _regeneratorRuntime.wrap(function _callee7$(_context7){while(1){switch(_context7.prev=_context7.next){case 0:spy=jest.fn().mockResolvedValue(true);wrapper=mount(React.createElement(AddToCartButton,{onClick:spy,isLoading:false,isOrderable:true,isDisabled:false}));_context7.next=4;return act(/*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee6(){return _regeneratorRuntime.wrap(function _callee6$(_context6){while(1){switch(_context6.prev=_context6.next){case 0:wrapper.find('button').simulate('click');case 1:case"end":return _context6.stop();}}},_callee6);})));case 4:expect(spy).toHaveBeenCalledTimes(1);expect(wrapper).toMatchSnapshot();case 6:case"end":return _context7.stop();}}},_callee7);})));});
1
+ import _regeneratorRuntime from"@babel/runtime/regenerator";function asyncGeneratorStep(gen,resolve,reject,_next,_throw,key,arg){try{var info=gen[key](arg);var value=info.value;}catch(error){reject(error);return;}if(info.done){resolve(value);}else{Promise.resolve(value).then(_next,_throw);}}function _asyncToGenerator(fn){return function(){var self=this,args=arguments;return new Promise(function(resolve,reject){var gen=fn.apply(self,args);function _next(value){asyncGeneratorStep(gen,resolve,reject,_next,_throw,"next",value);}function _throw(err){asyncGeneratorStep(gen,resolve,reject,_next,_throw,"throw",err);}_next(undefined);});};}import React from'react';import{mount}from'enzyme';import{act}from'react-dom/test-utils';import AddToCartButton from"./index";describe('<AddToCartButton />',function(){it('should render in loading state and should not be clickable',/*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee2(){var spy,wrapper;return _regeneratorRuntime.wrap(function _callee2$(_context2){while(1){switch(_context2.prev=_context2.next){case 0:spy=jest.fn().mockResolvedValue(true);wrapper=mount(/*#__PURE__*/React.createElement(AddToCartButton,{onClick:spy,isLoading:true,isOrderable:true,isDisabled:false}));_context2.next=4;return act(/*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee(){return _regeneratorRuntime.wrap(function _callee$(_context){while(1){switch(_context.prev=_context.next){case 0:wrapper.find('button').simulate('click');case 1:case"end":return _context.stop();}}},_callee);})));case 4:expect(spy).toHaveBeenCalledTimes(0);expect(wrapper).toMatchSnapshot();case 6:case"end":return _context2.stop();}}},_callee2);})));it('should render with checkmark icon and should not be clickable the second time',/*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee5(){var spy,wrapper;return _regeneratorRuntime.wrap(function _callee5$(_context5){while(1){switch(_context5.prev=_context5.next){case 0:spy=jest.fn().mockResolvedValue(true);wrapper=mount(/*#__PURE__*/React.createElement(AddToCartButton,{onClick:spy,isLoading:false,isOrderable:true,isDisabled:false}));_context5.next=4;return act(/*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee3(){return _regeneratorRuntime.wrap(function _callee3$(_context3){while(1){switch(_context3.prev=_context3.next){case 0:_context3.next=2;return wrapper.find('button').simulate('click');case 2:wrapper.update();case 3:case"end":return _context3.stop();}}},_callee3);})));case 4:_context5.next=6;return act(/*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee4(){return _regeneratorRuntime.wrap(function _callee4$(_context4){while(1){switch(_context4.prev=_context4.next){case 0:wrapper.find('button').simulate('click');wrapper.update();case 2:case"end":return _context4.stop();}}},_callee4);})));case 6:expect(spy).toHaveBeenCalledTimes(1);expect(wrapper).toMatchSnapshot();case 8:case"end":return _context5.stop();}}},_callee5);})));it('should render with cart icon and should be clickable',/*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee7(){var spy,wrapper;return _regeneratorRuntime.wrap(function _callee7$(_context7){while(1){switch(_context7.prev=_context7.next){case 0:spy=jest.fn().mockResolvedValue(true);wrapper=mount(/*#__PURE__*/React.createElement(AddToCartButton,{onClick:spy,isLoading:false,isOrderable:true,isDisabled:false}));_context7.next=4;return act(/*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee6(){return _regeneratorRuntime.wrap(function _callee6$(_context6){while(1){switch(_context6.prev=_context6.next){case 0:wrapper.find('button').simulate('click');case 1:case"end":return _context6.stop();}}},_callee6);})));case 4:expect(spy).toHaveBeenCalledTimes(1);expect(wrapper).toMatchSnapshot();case 6:case"end":return _context7.stop();}}},_callee7);})));});
@@ -7,4 +7,4 @@ import React from'react';import PropTypes from'prop-types';import{AVAILABILITY_S
7
7
  * state of the availability text is "ok"
8
8
  * @param {string} [props.className] CSS classes
9
9
  * @return {JSX}
10
- */var Availability=function Availability(_ref){var text=_ref.text,state=_ref.state,_ref$showWhenAvailabl=_ref.showWhenAvailable,showWhenAvailable=_ref$showWhenAvailabl===void 0?false:_ref$showWhenAvailabl,_ref$className=_ref.className,className=_ref$className===void 0?null:_ref$className;if(!text||state===AVAILABILITY_STATE_OK&&!showWhenAvailable){return null;}var style=styles.stateOk;if(state===AVAILABILITY_STATE_WARNING){style=styles.stateWarning;}if(state===AVAILABILITY_STATE_ALERT){style=styles.stateAlert;}return React.createElement("div",{className:"ui-shared__availability ".concat(className," ").concat(style),"data-test-id":"availabilityText: ".concat(text)},text);};Availability.defaultProps={className:'',showWhenAvailable:false,state:AVAILABILITY_STATE_OK};export default Availability;
10
+ */var Availability=function Availability(_ref){var text=_ref.text,state=_ref.state,_ref$showWhenAvailabl=_ref.showWhenAvailable,showWhenAvailable=_ref$showWhenAvailabl===void 0?false:_ref$showWhenAvailabl,_ref$className=_ref.className,className=_ref$className===void 0?null:_ref$className;if(!text||state===AVAILABILITY_STATE_OK&&!showWhenAvailable){return null;}var style=styles.stateOk;if(state===AVAILABILITY_STATE_WARNING){style=styles.stateWarning;}if(state===AVAILABILITY_STATE_ALERT){style=styles.stateAlert;}return/*#__PURE__*/React.createElement("div",{className:"ui-shared__availability ".concat(className," ").concat(style),"data-test-id":"availabilityText: ".concat(text)},text);};Availability.defaultProps={className:'',showWhenAvailable:false,state:AVAILABILITY_STATE_OK};export default Availability;
@@ -1 +1 @@
1
- import React from'react';import{mount}from'enzyme';import{AVAILABILITY_STATE_OK,AVAILABILITY_STATE_WARNING,AVAILABILITY_STATE_ALERT}from'@shopgate/pwa-common-commerce/product/constants';import Availability from"./index";describe('<Availability />',function(){it('should not render when text is empty',function(){var wrapper=mount(React.createElement(Availability,{text:""}));expect(wrapper).toMatchSnapshot();});it('should not render by default if state is "ok"',function(){var wrapper=mount(React.createElement(Availability,{state:AVAILABILITY_STATE_OK,text:"Available"}));expect(wrapper).toMatchSnapshot();});it('should render if state is "ok" when "showWhenAvailable" is set',function(){var wrapper=mount(React.createElement(Availability,{state:AVAILABILITY_STATE_OK,text:"Available",showWhenAvailable:true}));expect(wrapper).toMatchSnapshot();});it('should render if state is "warning"',function(){var wrapper=mount(React.createElement(Availability,{state:AVAILABILITY_STATE_WARNING,text:"Only 5 left"}));expect(wrapper).toMatchSnapshot();});it('should render if state is "warning"',function(){var wrapper=mount(React.createElement(Availability,{state:AVAILABILITY_STATE_ALERT,text:"Out of stock"}));expect(wrapper).toMatchSnapshot();});});
1
+ import React from'react';import{mount}from'enzyme';import{AVAILABILITY_STATE_OK,AVAILABILITY_STATE_WARNING,AVAILABILITY_STATE_ALERT}from'@shopgate/pwa-common-commerce/product/constants';import Availability from"./index";describe('<Availability />',function(){it('should not render when text is empty',function(){var wrapper=mount(/*#__PURE__*/React.createElement(Availability,{text:""}));expect(wrapper).toMatchSnapshot();});it('should not render by default if state is "ok"',function(){var wrapper=mount(/*#__PURE__*/React.createElement(Availability,{state:AVAILABILITY_STATE_OK,text:"Available"}));expect(wrapper).toMatchSnapshot();});it('should render if state is "ok" when "showWhenAvailable" is set',function(){var wrapper=mount(/*#__PURE__*/React.createElement(Availability,{state:AVAILABILITY_STATE_OK,text:"Available",showWhenAvailable:true}));expect(wrapper).toMatchSnapshot();});it('should render if state is "warning"',function(){var wrapper=mount(/*#__PURE__*/React.createElement(Availability,{state:AVAILABILITY_STATE_WARNING,text:"Only 5 left"}));expect(wrapper).toMatchSnapshot();});it('should render if state is "warning"',function(){var wrapper=mount(/*#__PURE__*/React.createElement(Availability,{state:AVAILABILITY_STATE_ALERT,text:"Out of stock"}));expect(wrapper).toMatchSnapshot();});});
package/Button/index.js CHANGED
@@ -1,14 +1,14 @@
1
- function _typeof(obj){if(typeof Symbol==="function"&&typeof Symbol.iterator==="symbol"){_typeof=function _typeof(obj){return typeof obj;};}else{_typeof=function _typeof(obj){return obj&&typeof Symbol==="function"&&obj.constructor===Symbol&&obj!==Symbol.prototype?"symbol":typeof obj;};}return _typeof(obj);}function _objectWithoutProperties(source,excluded){if(source==null)return{};var target=_objectWithoutPropertiesLoose(source,excluded);var key,i;if(Object.getOwnPropertySymbols){var sourceSymbolKeys=Object.getOwnPropertySymbols(source);for(i=0;i<sourceSymbolKeys.length;i++){key=sourceSymbolKeys[i];if(excluded.indexOf(key)>=0)continue;if(!Object.prototype.propertyIsEnumerable.call(source,key))continue;target[key]=source[key];}}return target;}function _objectWithoutPropertiesLoose(source,excluded){if(source==null)return{};var target={};var sourceKeys=Object.keys(source);var key,i;for(i=0;i<sourceKeys.length;i++){key=sourceKeys[i];if(excluded.indexOf(key)>=0)continue;target[key]=source[key];}return target;}function _extends(){_extends=Object.assign||function(target){for(var i=1;i<arguments.length;i++){var source=arguments[i];for(var key in source){if(Object.prototype.hasOwnProperty.call(source,key)){target[key]=source[key];}}}return target;};return _extends.apply(this,arguments);}function _classCallCheck(instance,Constructor){if(!(instance instanceof Constructor)){throw new TypeError("Cannot call a class as a function");}}function _defineProperties(target,props){for(var i=0;i<props.length;i++){var descriptor=props[i];descriptor.enumerable=descriptor.enumerable||false;descriptor.configurable=true;if("value"in descriptor)descriptor.writable=true;Object.defineProperty(target,descriptor.key,descriptor);}}function _createClass(Constructor,protoProps,staticProps){if(protoProps)_defineProperties(Constructor.prototype,protoProps);if(staticProps)_defineProperties(Constructor,staticProps);return Constructor;}function _possibleConstructorReturn(self,call){if(call&&(_typeof(call)==="object"||typeof call==="function")){return call;}return _assertThisInitialized(self);}function _assertThisInitialized(self){if(self===void 0){throw new ReferenceError("this hasn't been initialised - super() hasn't been called");}return self;}function _getPrototypeOf(o){_getPrototypeOf=Object.setPrototypeOf?Object.getPrototypeOf:function _getPrototypeOf(o){return o.__proto__||Object.getPrototypeOf(o);};return _getPrototypeOf(o);}function _inherits(subClass,superClass){if(typeof superClass!=="function"&&superClass!==null){throw new TypeError("Super expression must either be null or a function");}subClass.prototype=Object.create(superClass&&superClass.prototype,{constructor:{value:subClass,writable:true,configurable:true}});if(superClass)_setPrototypeOf(subClass,superClass);}function _setPrototypeOf(o,p){_setPrototypeOf=Object.setPrototypeOf||function _setPrototypeOf(o,p){o.__proto__=p;return o;};return _setPrototypeOf(o,p);}function _defineProperty(obj,key,value){if(key in obj){Object.defineProperty(obj,key,{value:value,enumerable:true,configurable:true,writable:true});}else{obj[key]=value;}return obj;}import React,{Component}from'react';import PropTypes from'prop-types';import BaseButton from'@shopgate/pwa-common/components/Button';import styles from"./style";/**
1
+ function _typeof(obj){"@babel/helpers - typeof";return _typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(obj){return typeof obj;}:function(obj){return obj&&"function"==typeof Symbol&&obj.constructor===Symbol&&obj!==Symbol.prototype?"symbol":typeof obj;},_typeof(obj);}var _excluded=["className","disabled","onClick","testId","type","wrapContent","flat"];function _extends(){_extends=Object.assign||function(target){for(var i=1;i<arguments.length;i++){var source=arguments[i];for(var key in source){if(Object.prototype.hasOwnProperty.call(source,key)){target[key]=source[key];}}}return target;};return _extends.apply(this,arguments);}function _objectWithoutProperties(source,excluded){if(source==null)return{};var target=_objectWithoutPropertiesLoose(source,excluded);var key,i;if(Object.getOwnPropertySymbols){var sourceSymbolKeys=Object.getOwnPropertySymbols(source);for(i=0;i<sourceSymbolKeys.length;i++){key=sourceSymbolKeys[i];if(excluded.indexOf(key)>=0)continue;if(!Object.prototype.propertyIsEnumerable.call(source,key))continue;target[key]=source[key];}}return target;}function _objectWithoutPropertiesLoose(source,excluded){if(source==null)return{};var target={};var sourceKeys=Object.keys(source);var key,i;for(i=0;i<sourceKeys.length;i++){key=sourceKeys[i];if(excluded.indexOf(key)>=0)continue;target[key]=source[key];}return target;}function _classCallCheck(instance,Constructor){if(!(instance instanceof Constructor)){throw new TypeError("Cannot call a class as a function");}}function _defineProperties(target,props){for(var i=0;i<props.length;i++){var descriptor=props[i];descriptor.enumerable=descriptor.enumerable||false;descriptor.configurable=true;if("value"in descriptor)descriptor.writable=true;Object.defineProperty(target,descriptor.key,descriptor);}}function _createClass(Constructor,protoProps,staticProps){if(protoProps)_defineProperties(Constructor.prototype,protoProps);if(staticProps)_defineProperties(Constructor,staticProps);Object.defineProperty(Constructor,"prototype",{writable:false});return Constructor;}function _inherits(subClass,superClass){if(typeof superClass!=="function"&&superClass!==null){throw new TypeError("Super expression must either be null or a function");}subClass.prototype=Object.create(superClass&&superClass.prototype,{constructor:{value:subClass,writable:true,configurable:true}});Object.defineProperty(subClass,"prototype",{writable:false});if(superClass)_setPrototypeOf(subClass,superClass);}function _setPrototypeOf(o,p){_setPrototypeOf=Object.setPrototypeOf||function _setPrototypeOf(o,p){o.__proto__=p;return o;};return _setPrototypeOf(o,p);}function _createSuper(Derived){var hasNativeReflectConstruct=_isNativeReflectConstruct();return function _createSuperInternal(){var Super=_getPrototypeOf(Derived),result;if(hasNativeReflectConstruct){var NewTarget=_getPrototypeOf(this).constructor;result=Reflect.construct(Super,arguments,NewTarget);}else{result=Super.apply(this,arguments);}return _possibleConstructorReturn(this,result);};}function _possibleConstructorReturn(self,call){if(call&&(_typeof(call)==="object"||typeof call==="function")){return call;}else if(call!==void 0){throw new TypeError("Derived constructors may only return object or undefined");}return _assertThisInitialized(self);}function _assertThisInitialized(self){if(self===void 0){throw new ReferenceError("this hasn't been initialised - super() hasn't been called");}return self;}function _isNativeReflectConstruct(){if(typeof Reflect==="undefined"||!Reflect.construct)return false;if(Reflect.construct.sham)return false;if(typeof Proxy==="function")return true;try{Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}));return true;}catch(e){return false;}}function _getPrototypeOf(o){_getPrototypeOf=Object.setPrototypeOf?Object.getPrototypeOf:function _getPrototypeOf(o){return o.__proto__||Object.getPrototypeOf(o);};return _getPrototypeOf(o);}function _defineProperty(obj,key,value){if(key in obj){Object.defineProperty(obj,key,{value:value,enumerable:true,configurable:true,writable:true});}else{obj[key]=value;}return obj;}import React,{Component}from'react';import PropTypes from'prop-types';import BaseButton from'@shopgate/pwa-common/components/Button';import styles from"./style";/**
2
2
  * The basic button component. This components applies Material Design styles and acts as
3
3
  * base to more feature-rich button components such as ActionButton and RippleButton, but can
4
4
  * also be used as standalone component or any other kind of new button.
5
- */var Button=/*#__PURE__*/function(_Component){_inherits(Button,_Component);function Button(){_classCallCheck(this,Button);return _possibleConstructorReturn(this,_getPrototypeOf(Button).apply(this,arguments));}_createClass(Button,[{key:"render",/**
6
- * Renders the component.
7
- * @return {JSX}
8
- */value:function render(){var style=this.style;var content=this.props.wrapContent?React.createElement("div",{className:style.content},this.props.children):this.props.children;return React.createElement(BaseButton,_extends({},this.buttonProps,{className:"ui-shared__button ".concat(style.button," ").concat(this.props.className),testId:this.props.testId}),content);}},{key:"style",/**
5
+ */var Button=/*#__PURE__*/function(_Component){_inherits(Button,_Component);var _super=_createSuper(Button);function Button(){_classCallCheck(this,Button);return _super.apply(this,arguments);}_createClass(Button,[{key:"style",get:/**
9
6
  * Getter for style depending on prop type.
10
7
  * @returns {Object}
11
- */get:function get(){var _this$props=this.props,flat=_this$props.flat,disabled=_this$props.disabled;switch(this.props.type){case'plain':return styles.plain();case'regular':return styles.regular(disabled);default:case'primary':return styles.primary(disabled,flat);case'secondary':return styles.secondary(disabled,flat);}}/**
8
+ */function get(){var _this$props=this.props,flat=_this$props.flat,disabled=_this$props.disabled;switch(this.props.type){case'plain':return styles.plain();case'regular':return styles.regular(disabled);default:case'primary':return styles.primary(disabled,flat);case'secondary':return styles.secondary(disabled,flat);}}/**
12
9
  * Getter for the calculated button props.
13
10
  * @returns {Object}
14
- */},{key:"buttonProps",get:function get(){var _this$props2=this.props,className=_this$props2.className,disabled=_this$props2.disabled,onClick=_this$props2.onClick,testId=_this$props2.testId,type=_this$props2.type,wrapContent=_this$props2.wrapContent,flat=_this$props2.flat,rest=_objectWithoutProperties(_this$props2,["className","disabled","onClick","testId","type","wrapContent","flat"]);var buttonProps=_extends({className:className,disabled:disabled,onClick:onClick},rest);return buttonProps;}}]);return Button;}(Component);_defineProperty(Button,"defaultProps",_extends({},BaseButton.defaultProps,{className:'',flat:false,type:'primary',wrapContent:true,testId:'Button'}));export default Button;
11
+ */},{key:"buttonProps",get:function get(){var _this$props2=this.props,className=_this$props2.className,disabled=_this$props2.disabled,onClick=_this$props2.onClick,testId=_this$props2.testId,type=_this$props2.type,wrapContent=_this$props2.wrapContent,flat=_this$props2.flat,rest=_objectWithoutProperties(_this$props2,_excluded);var buttonProps=_extends({className:className,disabled:disabled,onClick:onClick},rest);return buttonProps;}/**
12
+ * Renders the component.
13
+ * @return {JSX}
14
+ */},{key:"render",value:function render(){var style=this.style;var content=this.props.wrapContent?/*#__PURE__*/React.createElement("div",{className:style.content},this.props.children):this.props.children;return/*#__PURE__*/React.createElement(BaseButton,_extends({},this.buttonProps,{className:"ui-shared__button ".concat(style.button," ").concat(this.props.className),testId:this.props.testId}),content);}}]);return Button;}(Component);_defineProperty(Button,"defaultProps",_extends({},BaseButton.defaultProps,{className:'',flat:false,type:'primary',wrapContent:true,testId:'Button'}));export default Button;
package/Button/spec.js CHANGED
@@ -1 +1 @@
1
- import trim from'lodash/trim';import React from'react';import{shallow}from'enzyme';import Button from"./index";import styles from"./style";describe('<Button />',function(){it('should render as a regular button if type is omitted',function(){var wrapper=shallow(React.createElement(Button,null,"Press me"));expect(wrapper).toMatchSnapshot();expect(wrapper.render().text()).toEqual('Press me');});it('should render as a regular button if type is explicitly defined',function(){var wrapper=shallow(React.createElement(Button,{type:"regular"},"Press me"));expect(wrapper).toMatchSnapshot();expect(trim(wrapper.prop('className'))).toEqual("ui-shared__button ".concat(styles.regular(false).button));});it('should render as a primary button',function(){var wrapper=shallow(React.createElement(Button,{type:"primary"},"Press me"));expect(trim(wrapper.prop('className'))).toEqual("ui-shared__button ".concat(styles.primary(false,false).button));expect(wrapper).toMatchSnapshot();});it('should render as a secondary button',function(){var wrapper=shallow(React.createElement(Button,{type:"secondary"},"Press me"));expect(trim(wrapper.prop('className'))).toEqual("ui-shared__button ".concat(styles.secondary(false,false).button));expect(wrapper).toMatchSnapshot();});});
1
+ import trim from'lodash/trim';import React from'react';import{shallow}from'enzyme';import Button from"./index";import styles from"./style";describe('<Button />',function(){it('should render as a regular button if type is omitted',function(){var wrapper=shallow(/*#__PURE__*/React.createElement(Button,null,"Press me"));expect(wrapper).toMatchSnapshot();expect(wrapper.render().text()).toEqual('Press me');});it('should render as a regular button if type is explicitly defined',function(){var wrapper=shallow(/*#__PURE__*/React.createElement(Button,{type:"regular"},"Press me"));expect(wrapper).toMatchSnapshot();expect(trim(wrapper.prop('className'))).toEqual("ui-shared__button ".concat(styles.regular(false).button));});it('should render as a primary button',function(){var wrapper=shallow(/*#__PURE__*/React.createElement(Button,{type:"primary"},"Press me"));expect(trim(wrapper.prop('className'))).toEqual("ui-shared__button ".concat(styles.primary(false,false).button));expect(wrapper).toMatchSnapshot();});it('should render as a secondary button',function(){var wrapper=shallow(/*#__PURE__*/React.createElement(Button,{type:"secondary"},"Press me"));expect(trim(wrapper.prop('className'))).toEqual("ui-shared__button ".concat(styles.secondary(false,false).button));expect(wrapper).toMatchSnapshot();});});
@@ -1,6 +1,6 @@
1
- function _typeof(obj){if(typeof Symbol==="function"&&typeof Symbol.iterator==="symbol"){_typeof=function _typeof(obj){return typeof obj;};}else{_typeof=function _typeof(obj){return obj&&typeof Symbol==="function"&&obj.constructor===Symbol&&obj!==Symbol.prototype?"symbol":typeof obj;};}return _typeof(obj);}function _extends(){_extends=Object.assign||function(target){for(var i=1;i<arguments.length;i++){var source=arguments[i];for(var key in source){if(Object.prototype.hasOwnProperty.call(source,key)){target[key]=source[key];}}}return target;};return _extends.apply(this,arguments);}function _objectWithoutProperties(source,excluded){if(source==null)return{};var target=_objectWithoutPropertiesLoose(source,excluded);var key,i;if(Object.getOwnPropertySymbols){var sourceSymbolKeys=Object.getOwnPropertySymbols(source);for(i=0;i<sourceSymbolKeys.length;i++){key=sourceSymbolKeys[i];if(excluded.indexOf(key)>=0)continue;if(!Object.prototype.propertyIsEnumerable.call(source,key))continue;target[key]=source[key];}}return target;}function _objectWithoutPropertiesLoose(source,excluded){if(source==null)return{};var target={};var sourceKeys=Object.keys(source);var key,i;for(i=0;i<sourceKeys.length;i++){key=sourceKeys[i];if(excluded.indexOf(key)>=0)continue;target[key]=source[key];}return target;}function _classCallCheck(instance,Constructor){if(!(instance instanceof Constructor)){throw new TypeError("Cannot call a class as a function");}}function _defineProperties(target,props){for(var i=0;i<props.length;i++){var descriptor=props[i];descriptor.enumerable=descriptor.enumerable||false;descriptor.configurable=true;if("value"in descriptor)descriptor.writable=true;Object.defineProperty(target,descriptor.key,descriptor);}}function _createClass(Constructor,protoProps,staticProps){if(protoProps)_defineProperties(Constructor.prototype,protoProps);if(staticProps)_defineProperties(Constructor,staticProps);return Constructor;}function _possibleConstructorReturn(self,call){if(call&&(_typeof(call)==="object"||typeof call==="function")){return call;}return _assertThisInitialized(self);}function _getPrototypeOf(o){_getPrototypeOf=Object.setPrototypeOf?Object.getPrototypeOf:function _getPrototypeOf(o){return o.__proto__||Object.getPrototypeOf(o);};return _getPrototypeOf(o);}function _assertThisInitialized(self){if(self===void 0){throw new ReferenceError("this hasn't been initialised - super() hasn't been called");}return self;}function _inherits(subClass,superClass){if(typeof superClass!=="function"&&superClass!==null){throw new TypeError("Super expression must either be null or a function");}subClass.prototype=Object.create(superClass&&superClass.prototype,{constructor:{value:subClass,writable:true,configurable:true}});if(superClass)_setPrototypeOf(subClass,superClass);}function _setPrototypeOf(o,p){_setPrototypeOf=Object.setPrototypeOf||function _setPrototypeOf(o,p){o.__proto__=p;return o;};return _setPrototypeOf(o,p);}function _defineProperty(obj,key,value){if(key in obj){Object.defineProperty(obj,key,{value:value,enumerable:true,configurable:true,writable:true});}else{obj[key]=value;}return obj;}import React,{Component}from'react';import PropTypes from'prop-types';import ActionButton from"../ActionButton";import connect from"./connector";/**
1
+ function _typeof(obj){"@babel/helpers - typeof";return _typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(obj){return typeof obj;}:function(obj){return obj&&"function"==typeof Symbol&&obj.constructor===Symbol&&obj!==Symbol.prototype?"symbol":typeof obj;},_typeof(obj);}var _excluded=["children","href","navigate"];function _extends(){_extends=Object.assign||function(target){for(var i=1;i<arguments.length;i++){var source=arguments[i];for(var key in source){if(Object.prototype.hasOwnProperty.call(source,key)){target[key]=source[key];}}}return target;};return _extends.apply(this,arguments);}function _objectWithoutProperties(source,excluded){if(source==null)return{};var target=_objectWithoutPropertiesLoose(source,excluded);var key,i;if(Object.getOwnPropertySymbols){var sourceSymbolKeys=Object.getOwnPropertySymbols(source);for(i=0;i<sourceSymbolKeys.length;i++){key=sourceSymbolKeys[i];if(excluded.indexOf(key)>=0)continue;if(!Object.prototype.propertyIsEnumerable.call(source,key))continue;target[key]=source[key];}}return target;}function _objectWithoutPropertiesLoose(source,excluded){if(source==null)return{};var target={};var sourceKeys=Object.keys(source);var key,i;for(i=0;i<sourceKeys.length;i++){key=sourceKeys[i];if(excluded.indexOf(key)>=0)continue;target[key]=source[key];}return target;}function _classCallCheck(instance,Constructor){if(!(instance instanceof Constructor)){throw new TypeError("Cannot call a class as a function");}}function _defineProperties(target,props){for(var i=0;i<props.length;i++){var descriptor=props[i];descriptor.enumerable=descriptor.enumerable||false;descriptor.configurable=true;if("value"in descriptor)descriptor.writable=true;Object.defineProperty(target,descriptor.key,descriptor);}}function _createClass(Constructor,protoProps,staticProps){if(protoProps)_defineProperties(Constructor.prototype,protoProps);if(staticProps)_defineProperties(Constructor,staticProps);Object.defineProperty(Constructor,"prototype",{writable:false});return Constructor;}function _inherits(subClass,superClass){if(typeof superClass!=="function"&&superClass!==null){throw new TypeError("Super expression must either be null or a function");}subClass.prototype=Object.create(superClass&&superClass.prototype,{constructor:{value:subClass,writable:true,configurable:true}});Object.defineProperty(subClass,"prototype",{writable:false});if(superClass)_setPrototypeOf(subClass,superClass);}function _setPrototypeOf(o,p){_setPrototypeOf=Object.setPrototypeOf||function _setPrototypeOf(o,p){o.__proto__=p;return o;};return _setPrototypeOf(o,p);}function _createSuper(Derived){var hasNativeReflectConstruct=_isNativeReflectConstruct();return function _createSuperInternal(){var Super=_getPrototypeOf(Derived),result;if(hasNativeReflectConstruct){var NewTarget=_getPrototypeOf(this).constructor;result=Reflect.construct(Super,arguments,NewTarget);}else{result=Super.apply(this,arguments);}return _possibleConstructorReturn(this,result);};}function _possibleConstructorReturn(self,call){if(call&&(_typeof(call)==="object"||typeof call==="function")){return call;}else if(call!==void 0){throw new TypeError("Derived constructors may only return object or undefined");}return _assertThisInitialized(self);}function _assertThisInitialized(self){if(self===void 0){throw new ReferenceError("this hasn't been initialised - super() hasn't been called");}return self;}function _isNativeReflectConstruct(){if(typeof Reflect==="undefined"||!Reflect.construct)return false;if(Reflect.construct.sham)return false;if(typeof Proxy==="function")return true;try{Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}));return true;}catch(e){return false;}}function _getPrototypeOf(o){_getPrototypeOf=Object.setPrototypeOf?Object.getPrototypeOf:function _getPrototypeOf(o){return o.__proto__||Object.getPrototypeOf(o);};return _getPrototypeOf(o);}function _defineProperty(obj,key,value){if(key in obj){Object.defineProperty(obj,key,{value:value,enumerable:true,configurable:true,writable:true});}else{obj[key]=value;}return obj;}import React,{Component}from'react';import PropTypes from'prop-types';import ActionButton from"../ActionButton";import connect from"./connector";/**
2
2
  * Simple wrapper around ActionButton so it's easy to render buttons which behave as links.
3
- */var ButtonLink=/*#__PURE__*/function(_Component){_inherits(ButtonLink,_Component);function ButtonLink(){var _getPrototypeOf2;var _this;_classCallCheck(this,ButtonLink);for(var _len=arguments.length,args=new Array(_len),_key=0;_key<_len;_key++){args[_key]=arguments[_key];}_this=_possibleConstructorReturn(this,(_getPrototypeOf2=_getPrototypeOf(ButtonLink)).call.apply(_getPrototypeOf2,[this].concat(args)));_defineProperty(_assertThisInitialized(_this),"handleClick",function(){_this.props.navigate(_this.props.href);});return _this;}_createClass(ButtonLink,[{key:"render",/**
3
+ */var ButtonLink=/*#__PURE__*/function(_Component){_inherits(ButtonLink,_Component);var _super=_createSuper(ButtonLink);function ButtonLink(){var _this;_classCallCheck(this,ButtonLink);for(var _len=arguments.length,args=new Array(_len),_key=0;_key<_len;_key++){args[_key]=arguments[_key];}_this=_super.call.apply(_super,[this].concat(args));_defineProperty(_assertThisInitialized(_this),"handleClick",function(){_this.props.navigate(_this.props.href);});return _this;}_createClass(ButtonLink,[{key:"render",value:/**
4
4
  * Renders an ActionButton and handles link handling.
5
5
  * @returns {XML}
6
- */value:function render(){var _this$props=this.props,children=_this$props.children,href=_this$props.href,navigate=_this$props.navigate,props=_objectWithoutProperties(_this$props,["children","href","navigate"]);return React.createElement(ActionButton,_extends({className:"ui-shared__button-link",onClick:this.handleClick,type:"secondary"},props),children);}}]);return ButtonLink;}(Component);_defineProperty(ButtonLink,"defaultProps",{disabled:false,className:'',navigate:function navigate(){},noGap:false,flat:true});export default connect(ButtonLink);export{ButtonLink as UnwrappedButtonLink};
6
+ */function render(){var _this$props=this.props,children=_this$props.children,href=_this$props.href,navigate=_this$props.navigate,props=_objectWithoutProperties(_this$props,_excluded);return/*#__PURE__*/React.createElement(ActionButton,_extends({className:"ui-shared__button-link",onClick:this.handleClick,type:"secondary"},props),children);}}]);return ButtonLink;}(Component);_defineProperty(ButtonLink,"defaultProps",{disabled:false,className:'',navigate:function navigate(){},noGap:false,flat:true});export default connect(ButtonLink);export{ButtonLink as UnwrappedButtonLink};
@@ -1 +1 @@
1
- import React from'react';import{shallow}from'enzyme';import ActionButton from"../ActionButton";import{UnwrappedButtonLink as ButtonLink}from"./index";describe('<ButtonLink>',function(){describe('On click action',function(){beforeAll(function(){ActionButton.clickDelay=0;});it('should create component and open page on click',function(){var mockedNavigate=jest.fn();var link='https://example.com';var component=shallow(React.createElement(ButtonLink,{href:link,navigate:mockedNavigate},"Text inside"));expect(component).toMatchSnapshot();component.simulate('click');expect(mockedNavigate).toHaveBeenCalledTimes(1);expect(mockedNavigate).toHaveBeenCalledWith(link);});});});
1
+ import React from'react';import{shallow}from'enzyme';import ActionButton from"../ActionButton";import{UnwrappedButtonLink as ButtonLink}from"./index";describe('<ButtonLink>',function(){describe('On click action',function(){beforeAll(function(){ActionButton.clickDelay=0;});it('should create component and open page on click',function(){var mockedNavigate=jest.fn();var link='https://example.com';var component=shallow(/*#__PURE__*/React.createElement(ButtonLink,{href:link,navigate:mockedNavigate},"Text inside"));expect(component).toMatchSnapshot();component.simulate('click');expect(mockedNavigate).toHaveBeenCalledTimes(1);expect(mockedNavigate).toHaveBeenCalledWith(link);});});});
package/Card/index.js CHANGED
@@ -2,4 +2,4 @@ import React from'react';import PropTypes from'prop-types';import styles from"./
2
2
  * Renders the card component.
3
3
  * @param {Object} props The component properties.
4
4
  * @returns {JSX}
5
- */var Card=function Card(_ref){var className=_ref.className,children=_ref.children;return React.createElement("div",{className:"ui-shared__card ".concat(styles," ").concat(className)},children);};Card.defaultProps={className:''};export default Card;
5
+ */var Card=function Card(_ref){var className=_ref.className,children=_ref.children;return/*#__PURE__*/React.createElement("div",{className:"ui-shared__card ".concat(styles," ").concat(className)},children);};Card.defaultProps={className:''};export default Card;
@@ -2,4 +2,4 @@ import React,{Children}from'react';import PropTypes from'prop-types';import List
2
2
  * The Card List Item component implemented as class so that ref prop is available.
3
3
  * @param {Object} props The component props.
4
4
  * @return {JSX}
5
- */var Item=function Item(_ref){var children=_ref.children,className=_ref.className,isSelected=_ref.isSelected;if(!Children.count(children)){return null;}return React.createElement(ListItem,{className:"".concat(styles," ").concat(className),isSelected:isSelected},children);};Item.defaultProps={children:null,className:null,isSelected:false};export default Item;
5
+ */var Item=function Item(_ref){var children=_ref.children,className=_ref.className,isSelected=_ref.isSelected;if(!Children.count(children)){return null;}return/*#__PURE__*/React.createElement(ListItem,{className:"".concat(styles," ").concat(className),isSelected:isSelected},children);};Item.defaultProps={children:null,className:null,isSelected:false};export default Item;
package/CardList/index.js CHANGED
@@ -1,6 +1,6 @@
1
- function _typeof(obj){if(typeof Symbol==="function"&&typeof Symbol.iterator==="symbol"){_typeof=function _typeof(obj){return typeof obj;};}else{_typeof=function _typeof(obj){return obj&&typeof Symbol==="function"&&obj.constructor===Symbol&&obj!==Symbol.prototype?"symbol":typeof obj;};}return _typeof(obj);}function _classCallCheck(instance,Constructor){if(!(instance instanceof Constructor)){throw new TypeError("Cannot call a class as a function");}}function _defineProperties(target,props){for(var i=0;i<props.length;i++){var descriptor=props[i];descriptor.enumerable=descriptor.enumerable||false;descriptor.configurable=true;if("value"in descriptor)descriptor.writable=true;Object.defineProperty(target,descriptor.key,descriptor);}}function _createClass(Constructor,protoProps,staticProps){if(protoProps)_defineProperties(Constructor.prototype,protoProps);if(staticProps)_defineProperties(Constructor,staticProps);return Constructor;}function _possibleConstructorReturn(self,call){if(call&&(_typeof(call)==="object"||typeof call==="function")){return call;}return _assertThisInitialized(self);}function _assertThisInitialized(self){if(self===void 0){throw new ReferenceError("this hasn't been initialised - super() hasn't been called");}return self;}function _getPrototypeOf(o){_getPrototypeOf=Object.setPrototypeOf?Object.getPrototypeOf:function _getPrototypeOf(o){return o.__proto__||Object.getPrototypeOf(o);};return _getPrototypeOf(o);}function _inherits(subClass,superClass){if(typeof superClass!=="function"&&superClass!==null){throw new TypeError("Super expression must either be null or a function");}subClass.prototype=Object.create(superClass&&superClass.prototype,{constructor:{value:subClass,writable:true,configurable:true}});if(superClass)_setPrototypeOf(subClass,superClass);}function _setPrototypeOf(o,p){_setPrototypeOf=Object.setPrototypeOf||function _setPrototypeOf(o,p){o.__proto__=p;return o;};return _setPrototypeOf(o,p);}function _defineProperty(obj,key,value){if(key in obj){Object.defineProperty(obj,key,{value:value,enumerable:true,configurable:true,writable:true});}else{obj[key]=value;}return obj;}import React,{Component,Children,isValidElement}from'react';import PropTypes from'prop-types';import List from'@shopgate/pwa-common/components/List';import Item from"./components/Item";/**
1
+ function _typeof(obj){"@babel/helpers - typeof";return _typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(obj){return typeof obj;}:function(obj){return obj&&"function"==typeof Symbol&&obj.constructor===Symbol&&obj!==Symbol.prototype?"symbol":typeof obj;},_typeof(obj);}function _classCallCheck(instance,Constructor){if(!(instance instanceof Constructor)){throw new TypeError("Cannot call a class as a function");}}function _defineProperties(target,props){for(var i=0;i<props.length;i++){var descriptor=props[i];descriptor.enumerable=descriptor.enumerable||false;descriptor.configurable=true;if("value"in descriptor)descriptor.writable=true;Object.defineProperty(target,descriptor.key,descriptor);}}function _createClass(Constructor,protoProps,staticProps){if(protoProps)_defineProperties(Constructor.prototype,protoProps);if(staticProps)_defineProperties(Constructor,staticProps);Object.defineProperty(Constructor,"prototype",{writable:false});return Constructor;}function _inherits(subClass,superClass){if(typeof superClass!=="function"&&superClass!==null){throw new TypeError("Super expression must either be null or a function");}subClass.prototype=Object.create(superClass&&superClass.prototype,{constructor:{value:subClass,writable:true,configurable:true}});Object.defineProperty(subClass,"prototype",{writable:false});if(superClass)_setPrototypeOf(subClass,superClass);}function _setPrototypeOf(o,p){_setPrototypeOf=Object.setPrototypeOf||function _setPrototypeOf(o,p){o.__proto__=p;return o;};return _setPrototypeOf(o,p);}function _createSuper(Derived){var hasNativeReflectConstruct=_isNativeReflectConstruct();return function _createSuperInternal(){var Super=_getPrototypeOf(Derived),result;if(hasNativeReflectConstruct){var NewTarget=_getPrototypeOf(this).constructor;result=Reflect.construct(Super,arguments,NewTarget);}else{result=Super.apply(this,arguments);}return _possibleConstructorReturn(this,result);};}function _possibleConstructorReturn(self,call){if(call&&(_typeof(call)==="object"||typeof call==="function")){return call;}else if(call!==void 0){throw new TypeError("Derived constructors may only return object or undefined");}return _assertThisInitialized(self);}function _assertThisInitialized(self){if(self===void 0){throw new ReferenceError("this hasn't been initialised - super() hasn't been called");}return self;}function _isNativeReflectConstruct(){if(typeof Reflect==="undefined"||!Reflect.construct)return false;if(Reflect.construct.sham)return false;if(typeof Proxy==="function")return true;try{Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}));return true;}catch(e){return false;}}function _getPrototypeOf(o){_getPrototypeOf=Object.setPrototypeOf?Object.getPrototypeOf:function _getPrototypeOf(o){return o.__proto__||Object.getPrototypeOf(o);};return _getPrototypeOf(o);}function _defineProperty(obj,key,value){if(key in obj){Object.defineProperty(obj,key,{value:value,enumerable:true,configurable:true,writable:true});}else{obj[key]=value;}return obj;}import React,{Component,Children,isValidElement}from'react';import PropTypes from'prop-types';import List from'@shopgate/pwa-common/components/List';import Item from"./components/Item";/**
2
2
  * The CardList component.
3
- */var CardList=/*#__PURE__*/function(_Component){_inherits(CardList,_Component);function CardList(){_classCallCheck(this,CardList);return _possibleConstructorReturn(this,_getPrototypeOf(CardList).apply(this,arguments));}_createClass(CardList,[{key:"render",/**
3
+ */var CardList=/*#__PURE__*/function(_Component){_inherits(CardList,_Component);var _super=_createSuper(CardList);function CardList(){_classCallCheck(this,CardList);return _super.apply(this,arguments);}_createClass(CardList,[{key:"render",value:/**
4
4
  * Renders the component.
5
5
  * @return {JSX}
6
- */value:function render(){var _this$props=this.props,children=_this$props.children,className=_this$props.className;if(!Children.count(children)){return null;}return React.createElement(List,{className:"ui-shared__card-list ".concat(className)},Children.map(children,function(child){if(!isValidElement(child)){return null;}return child;}));}}]);return CardList;}(Component);_defineProperty(CardList,"Item",Item);_defineProperty(CardList,"defaultProps",{children:null,className:''});export default CardList;
6
+ */function render(){var _this$props=this.props,children=_this$props.children,className=_this$props.className;if(!Children.count(children)){return null;}return/*#__PURE__*/React.createElement(List,{className:"ui-shared__card-list ".concat(className)},Children.map(children,function(child){if(!/*#__PURE__*/isValidElement(child)){return null;}return child;}));}}]);return CardList;}(Component);_defineProperty(CardList,"Item",Item);_defineProperty(CardList,"defaultProps",{children:null,className:''});export default CardList;
@@ -2,4 +2,4 @@ import React from'react';import PropTypes from'prop-types';import I18n from'@sho
2
2
  * The Amount component.
3
3
  * @param {Object} props The component props.
4
4
  * @return {JSX}
5
- */var Amount=function Amount(_ref){var amount=_ref.amount,currency=_ref.currency;if(amount===null){return null;}return React.createElement("div",{className:styles.amount},typeof amount==='string'&&React.createElement(I18n.Text,{string:amount}),typeof amount==='number'&&React.createElement(I18n.Price,{price:amount,currency:currency}));};Amount.defaultProps={amount:null,currency:null};export default Amount;
5
+ */var Amount=function Amount(_ref){var amount=_ref.amount,currency=_ref.currency;if(amount===null){return null;}return/*#__PURE__*/React.createElement("div",{className:styles.amount},typeof amount==='string'&&/*#__PURE__*/React.createElement(I18n.Text,{string:amount}),typeof amount==='number'&&/*#__PURE__*/React.createElement(I18n.Price,{price:amount,currency:currency}));};Amount.defaultProps={amount:null,currency:null};export default Amount;
@@ -2,4 +2,4 @@ import React from'react';import PropTypes from'prop-types';import I18n from'@sho
2
2
  * The Hint component.
3
3
  * @param {Object} props The component props.
4
4
  * @return {JSX|null}
5
- */var Hint=function Hint(_ref){var hint=_ref.hint;if(hint===null){return null;}return React.createElement("div",{className:styles.hint},React.createElement(I18n.Text,{string:hint}));};Hint.defaultProps={hint:null};export default Hint;
5
+ */var Hint=function Hint(_ref){var hint=_ref.hint;if(hint===null){return null;}return/*#__PURE__*/React.createElement("div",{className:styles.hint},/*#__PURE__*/React.createElement(I18n.Text,{string:hint}));};Hint.defaultProps={hint:null};export default Hint;
@@ -2,4 +2,4 @@ import React from'react';import PropTypes from'prop-types';import{i18n}from'@sho
2
2
  * The ShippingCostsLabel component.
3
3
  * @param {Object} props The component props.
4
4
  * @return {JSX|null}
5
- */function Label(_ref){var label=_ref.label,showSeparator=_ref.showSeparator,labelParams=_ref.labelParams;if(!label){return React.createElement("div",{className:styles.label});}return React.createElement("div",{className:styles.label},"".concat(i18n.text(label,labelParams)).concat(showSeparator?':':''));}Label.defaultProps={label:null,showSeparator:true,labelParams:{}};export default Label;
5
+ */function Label(_ref){var label=_ref.label,showSeparator=_ref.showSeparator,labelParams=_ref.labelParams;if(!label){return/*#__PURE__*/React.createElement("div",{className:styles.label});}return/*#__PURE__*/React.createElement("div",{className:styles.label},"".concat(i18n.text(label,labelParams)).concat(showSeparator?':':''));}Label.defaultProps={label:null,showSeparator:true,labelParams:{}};export default Label;
@@ -1,3 +1,3 @@
1
1
  function _defineProperty(obj,key,value){if(key in obj){Object.defineProperty(obj,key,{value:value,enumerable:true,configurable:true,writable:true});}else{obj[key]=value;}return obj;}import React from'react';import PropTypes from'prop-types';import classNames from'classnames';import Label from"./components/Label";import Amount from"./components/Amount";import Hint from"./components/Hint";import styles from"./style";/**
2
2
  * @returns {JSX}
3
- */var CartTotalLine=function CartTotalLine(_ref){var _classNames;var children=_ref.children,type=_ref.type,isDisabled=_ref.isDisabled;if(!children){return null;}return React.createElement("div",{className:classNames("ui-shared__cart-total-line ui-shared__cart-".concat(type,"-line"),styles.line,(_classNames={},_defineProperty(_classNames,styles.disabled,isDisabled),_defineProperty(_classNames,styles[type]||styles.base,true),_classNames)),"data-test-id":"".concat(type,"CartTotal")},children);};CartTotalLine.defaultProps={children:null,isDisabled:false,type:null};CartTotalLine.Label=Label;CartTotalLine.Amount=Amount;CartTotalLine.Hint=Hint;export default CartTotalLine;
3
+ */var CartTotalLine=function CartTotalLine(_ref){var _classNames;var children=_ref.children,type=_ref.type,isDisabled=_ref.isDisabled;if(!children){return null;}return/*#__PURE__*/React.createElement("div",{className:classNames("ui-shared__cart-total-line ui-shared__cart-".concat(type,"-line"),styles.line,(_classNames={},_defineProperty(_classNames,styles.disabled,isDisabled),_defineProperty(_classNames,styles[type]||styles.base,true),_classNames)),"data-test-id":"".concat(type,"CartTotal")},children);};CartTotalLine.defaultProps={children:null,isDisabled:false,type:null};CartTotalLine.Label=Label;CartTotalLine.Amount=Amount;CartTotalLine.Hint=Hint;export default CartTotalLine;
package/Checkbox/index.js CHANGED
@@ -1,8 +1,8 @@
1
- function _extends(){_extends=Object.assign||function(target){for(var i=1;i<arguments.length;i++){var source=arguments[i];for(var key in source){if(Object.prototype.hasOwnProperty.call(source,key)){target[key]=source[key];}}}return target;};return _extends.apply(this,arguments);}function _objectWithoutProperties(source,excluded){if(source==null)return{};var target=_objectWithoutPropertiesLoose(source,excluded);var key,i;if(Object.getOwnPropertySymbols){var sourceSymbolKeys=Object.getOwnPropertySymbols(source);for(i=0;i<sourceSymbolKeys.length;i++){key=sourceSymbolKeys[i];if(excluded.indexOf(key)>=0)continue;if(!Object.prototype.propertyIsEnumerable.call(source,key))continue;target[key]=source[key];}}return target;}function _objectWithoutPropertiesLoose(source,excluded){if(source==null)return{};var target={};var sourceKeys=Object.keys(source);var key,i;for(i=0;i<sourceKeys.length;i++){key=sourceKeys[i];if(excluded.indexOf(key)>=0)continue;target[key]=source[key];}return target;}import React from'react';import PropTypes from'prop-types';import classNames from'classnames';import BaseCheckbox from'@shopgate/pwa-common/components/Checkbox';import CheckedIcon from"../icons/CheckedIcon";import UncheckedIcon from"../icons/UncheckedIcon";import styles from"./style";/**
1
+ var _excluded=["checkedClassName","unCheckedClassName","className"];function _extends(){_extends=Object.assign||function(target){for(var i=1;i<arguments.length;i++){var source=arguments[i];for(var key in source){if(Object.prototype.hasOwnProperty.call(source,key)){target[key]=source[key];}}}return target;};return _extends.apply(this,arguments);}function _objectWithoutProperties(source,excluded){if(source==null)return{};var target=_objectWithoutPropertiesLoose(source,excluded);var key,i;if(Object.getOwnPropertySymbols){var sourceSymbolKeys=Object.getOwnPropertySymbols(source);for(i=0;i<sourceSymbolKeys.length;i++){key=sourceSymbolKeys[i];if(excluded.indexOf(key)>=0)continue;if(!Object.prototype.propertyIsEnumerable.call(source,key))continue;target[key]=source[key];}}return target;}function _objectWithoutPropertiesLoose(source,excluded){if(source==null)return{};var target={};var sourceKeys=Object.keys(source);var key,i;for(i=0;i<sourceKeys.length;i++){key=sourceKeys[i];if(excluded.indexOf(key)>=0)continue;target[key]=source[key];}return target;}import React from'react';import PropTypes from'prop-types';import classNames from'classnames';import BaseCheckbox from'@shopgate/pwa-common/components/Checkbox';import CheckedIcon from"../icons/CheckedIcon";import UncheckedIcon from"../icons/UncheckedIcon";import styles from"./style";/**
2
2
  * The checkbox template component.
3
3
  * @param {string} checkedClassName class for checked icon.
4
4
  * @param {string} unCheckedClassName class for unchecked icon.
5
5
  * @param {string} className className
6
6
  * @param {Object} props The component properties.
7
7
  * @returns {JSX}
8
- */var Checkbox=function Checkbox(_ref){var checkedClassName=_ref.checkedClassName,unCheckedClassName=_ref.unCheckedClassName,className=_ref.className,props=_objectWithoutProperties(_ref,["checkedClassName","unCheckedClassName","className"]);return React.createElement(BaseCheckbox,_extends({},props,{className:"ui-shared__checkbox ".concat(props.className),checkedIcon:React.createElement(CheckedIcon,{className:classNames(styles.icon,checkedClassName,'checkedIcon')}),uncheckedIcon:React.createElement(UncheckedIcon,{className:classNames(styles.icon,unCheckedClassName,'uncheckedIcon')})}));};Checkbox.defaultProps={checkedClassName:styles.checkedIcon,className:'',unCheckedClassName:styles.uncheckedIcon};export default Checkbox;
8
+ */var Checkbox=function Checkbox(_ref){var checkedClassName=_ref.checkedClassName,unCheckedClassName=_ref.unCheckedClassName,className=_ref.className,props=_objectWithoutProperties(_ref,_excluded);return/*#__PURE__*/React.createElement(BaseCheckbox,_extends({},props,{className:"ui-shared__checkbox ".concat(props.className),checkedIcon:/*#__PURE__*/React.createElement(CheckedIcon,{className:classNames(styles.icon,checkedClassName,'checkedIcon')}),uncheckedIcon:/*#__PURE__*/React.createElement(UncheckedIcon,{className:classNames(styles.icon,unCheckedClassName,'uncheckedIcon')})}));};Checkbox.defaultProps={checkedClassName:styles.checkedIcon,className:'',unCheckedClassName:styles.uncheckedIcon};export default Checkbox;
package/Chip/index.js CHANGED
@@ -2,4 +2,4 @@ import React,{useRef,useCallback,useEffect}from'react';import PropTypes from'pro
2
2
  * The chip component.
3
3
  * @param {Object} props The component props.
4
4
  * @returns {JSX}
5
- */function Chip(props){var removable=props.removable,children=props.children,id=props.id,onClick=props.onClick,onRemove=props.onRemove,invert=props.invert,removeLabel=props.removeLabel,editLabel=props.editLabel;var ref=useRef(null);var handleRemove=useCallback(function(){onRemove(id);},[onRemove,id]);useEffect(function(){ref.current.removeAttribute('style');});return React.createElement("div",{ref:ref,className:"ui-shared__chip ".concat(styles.chip(removable,invert)),"data-test-id":id},removable&&React.createElement(Button,{className:styles.removeButton,onClick:handleRemove,testId:"removeFilter","aria-label":removeLabel},React.createElement(CrossIcon,{size:16,color:invert?themeConfig.colors.light:themeConfig.colors.accent})),React.createElement(Button,{className:styles.name,onClick:onClick,"aria-label":editLabel},children));}Chip.defaultProps={invert:false,onClick:function onClick(){},onRemove:function onRemove(){},removable:true,removeLabel:null,editLabel:null};export default Chip;
5
+ */function Chip(props){var removable=props.removable,children=props.children,id=props.id,onClick=props.onClick,onRemove=props.onRemove,invert=props.invert,removeLabel=props.removeLabel,editLabel=props.editLabel;var ref=useRef(null);var handleRemove=useCallback(function(){onRemove(id);},[onRemove,id]);useEffect(function(){ref.current.removeAttribute('style');});return/*#__PURE__*/React.createElement("div",{ref:ref,className:"ui-shared__chip ".concat(styles.chip(removable,invert)),"data-test-id":id},removable&&/*#__PURE__*/React.createElement(Button,{className:styles.removeButton,onClick:handleRemove,testId:"removeFilter","aria-label":removeLabel},/*#__PURE__*/React.createElement(CrossIcon,{size:16,color:invert?themeConfig.colors.light:themeConfig.colors.accent})),/*#__PURE__*/React.createElement(Button,{className:styles.name,onClick:onClick,"aria-label":editLabel},children));}Chip.defaultProps={invert:false,onClick:function onClick(){},onRemove:function onRemove(){},removable:true,removeLabel:null,editLabel:null};export default Chip;
package/Chip/spec.js CHANGED
@@ -1 +1 @@
1
- import React from'react';import{mount}from'enzyme';import Chip from'.';describe('<Chip />',function(){it('should render a tag',function(){var wrapper=mount(React.createElement(Chip,{id:"some-id"},"text"));expect(wrapper).toMatchSnapshot();expect(wrapper.find('button').length).toEqual(2);expect(wrapper.find('button').at(1).text()).toEqual('text');});});describe('<Chip />',function(){it('should render a without removable icon',function(){var wrapper=mount(React.createElement(Chip,{id:"some-id",removable:false},"text"));expect(wrapper).toMatchSnapshot();expect(wrapper.find('button').length).toEqual(1);expect(wrapper.find('button').at(0).text()).toEqual('text');});});
1
+ import React from'react';import{mount}from'enzyme';import Chip from'.';describe('<Chip />',function(){it('should render a tag',function(){var wrapper=mount(/*#__PURE__*/React.createElement(Chip,{id:"some-id"},"text"));expect(wrapper).toMatchSnapshot();expect(wrapper.find('button').length).toEqual(2);expect(wrapper.find('button').at(1).text()).toEqual('text');});});describe('<Chip />',function(){it('should render a without removable icon',function(){var wrapper=mount(/*#__PURE__*/React.createElement(Chip,{id:"some-id",removable:false},"text"));expect(wrapper).toMatchSnapshot();expect(wrapper.find('button').length).toEqual(1);expect(wrapper.find('button').at(0).text()).toEqual('text');});});
@@ -1,9 +1,9 @@
1
- function _typeof(obj){if(typeof Symbol==="function"&&typeof Symbol.iterator==="symbol"){_typeof=function _typeof(obj){return typeof obj;};}else{_typeof=function _typeof(obj){return obj&&typeof Symbol==="function"&&obj.constructor===Symbol&&obj!==Symbol.prototype?"symbol":typeof obj;};}return _typeof(obj);}function _classCallCheck(instance,Constructor){if(!(instance instanceof Constructor)){throw new TypeError("Cannot call a class as a function");}}function _defineProperties(target,props){for(var i=0;i<props.length;i++){var descriptor=props[i];descriptor.enumerable=descriptor.enumerable||false;descriptor.configurable=true;if("value"in descriptor)descriptor.writable=true;Object.defineProperty(target,descriptor.key,descriptor);}}function _createClass(Constructor,protoProps,staticProps){if(protoProps)_defineProperties(Constructor.prototype,protoProps);if(staticProps)_defineProperties(Constructor,staticProps);return Constructor;}function _possibleConstructorReturn(self,call){if(call&&(_typeof(call)==="object"||typeof call==="function")){return call;}return _assertThisInitialized(self);}function _getPrototypeOf(o){_getPrototypeOf=Object.setPrototypeOf?Object.getPrototypeOf:function _getPrototypeOf(o){return o.__proto__||Object.getPrototypeOf(o);};return _getPrototypeOf(o);}function _assertThisInitialized(self){if(self===void 0){throw new ReferenceError("this hasn't been initialised - super() hasn't been called");}return self;}function _inherits(subClass,superClass){if(typeof superClass!=="function"&&superClass!==null){throw new TypeError("Super expression must either be null or a function");}subClass.prototype=Object.create(superClass&&superClass.prototype,{constructor:{value:subClass,writable:true,configurable:true}});if(superClass)_setPrototypeOf(subClass,superClass);}function _setPrototypeOf(o,p){_setPrototypeOf=Object.setPrototypeOf||function _setPrototypeOf(o,p){o.__proto__=p;return o;};return _setPrototypeOf(o,p);}function _defineProperty(obj,key,value){if(key in obj){Object.defineProperty(obj,key,{value:value,enumerable:true,configurable:true,writable:true});}else{obj[key]=value;}return obj;}import React,{Component}from'react';import PropTypes from'prop-types';import connect from"./connector";import styles from"./style";var TIMEOUT_SHOW_DEVICE_ID=5000;/**
1
+ function _typeof(obj){"@babel/helpers - typeof";return _typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(obj){return typeof obj;}:function(obj){return obj&&"function"==typeof Symbol&&obj.constructor===Symbol&&obj!==Symbol.prototype?"symbol":typeof obj;},_typeof(obj);}function _classCallCheck(instance,Constructor){if(!(instance instanceof Constructor)){throw new TypeError("Cannot call a class as a function");}}function _defineProperties(target,props){for(var i=0;i<props.length;i++){var descriptor=props[i];descriptor.enumerable=descriptor.enumerable||false;descriptor.configurable=true;if("value"in descriptor)descriptor.writable=true;Object.defineProperty(target,descriptor.key,descriptor);}}function _createClass(Constructor,protoProps,staticProps){if(protoProps)_defineProperties(Constructor.prototype,protoProps);if(staticProps)_defineProperties(Constructor,staticProps);Object.defineProperty(Constructor,"prototype",{writable:false});return Constructor;}function _inherits(subClass,superClass){if(typeof superClass!=="function"&&superClass!==null){throw new TypeError("Super expression must either be null or a function");}subClass.prototype=Object.create(superClass&&superClass.prototype,{constructor:{value:subClass,writable:true,configurable:true}});Object.defineProperty(subClass,"prototype",{writable:false});if(superClass)_setPrototypeOf(subClass,superClass);}function _setPrototypeOf(o,p){_setPrototypeOf=Object.setPrototypeOf||function _setPrototypeOf(o,p){o.__proto__=p;return o;};return _setPrototypeOf(o,p);}function _createSuper(Derived){var hasNativeReflectConstruct=_isNativeReflectConstruct();return function _createSuperInternal(){var Super=_getPrototypeOf(Derived),result;if(hasNativeReflectConstruct){var NewTarget=_getPrototypeOf(this).constructor;result=Reflect.construct(Super,arguments,NewTarget);}else{result=Super.apply(this,arguments);}return _possibleConstructorReturn(this,result);};}function _possibleConstructorReturn(self,call){if(call&&(_typeof(call)==="object"||typeof call==="function")){return call;}else if(call!==void 0){throw new TypeError("Derived constructors may only return object or undefined");}return _assertThisInitialized(self);}function _assertThisInitialized(self){if(self===void 0){throw new ReferenceError("this hasn't been initialised - super() hasn't been called");}return self;}function _isNativeReflectConstruct(){if(typeof Reflect==="undefined"||!Reflect.construct)return false;if(Reflect.construct.sham)return false;if(typeof Proxy==="function")return true;try{Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}));return true;}catch(e){return false;}}function _getPrototypeOf(o){_getPrototypeOf=Object.setPrototypeOf?Object.getPrototypeOf:function _getPrototypeOf(o){return o.__proto__||Object.getPrototypeOf(o);};return _getPrototypeOf(o);}function _defineProperty(obj,key,value){if(key in obj){Object.defineProperty(obj,key,{value:value,enumerable:true,configurable:true,writable:true});}else{obj[key]=value;}return obj;}import React,{Component}from'react';import PropTypes from'prop-types';import connect from"./connector";import styles from"./style";var TIMEOUT_SHOW_DEVICE_ID=5000;/**
2
2
  * Client information component which is shown as the footer of the navigation drawer.
3
- */var ClientInformation=/*#__PURE__*/function(_Component){_inherits(ClientInformation,_Component);/**
3
+ */var ClientInformation=/*#__PURE__*/function(_Component){_inherits(ClientInformation,_Component);var _super=_createSuper(ClientInformation);/**
4
4
  * The component constructor.
5
5
  * @param {Object} props The component props.
6
- */function ClientInformation(props){var _this;_classCallCheck(this,ClientInformation);_this=_possibleConstructorReturn(this,_getPrototypeOf(ClientInformation).call(this,props));_defineProperty(_assertThisInitialized(_this),"startTimer",function(){_this.timer=setTimeout(_this.showDeviceId,TIMEOUT_SHOW_DEVICE_ID);});_defineProperty(_assertThisInitialized(_this),"showDeviceId",function(){if(!_this.state.isDeviceIdVisible){_this.setState({isDeviceIdVisible:true});_this.props.enableDebugLogging();}});_defineProperty(_assertThisInitialized(_this),"cancelTimer",function(){clearTimeout(_this.timer);});_this.state={isDeviceIdVisible:false};return _this;}/**
6
+ */function ClientInformation(props){var _this;_classCallCheck(this,ClientInformation);_this=_super.call(this,props);_defineProperty(_assertThisInitialized(_this),"startTimer",function(){_this.timer=setTimeout(_this.showDeviceId,TIMEOUT_SHOW_DEVICE_ID);});_defineProperty(_assertThisInitialized(_this),"showDeviceId",function(){if(!_this.state.isDeviceIdVisible){_this.setState({isDeviceIdVisible:true});_this.props.enableDebugLogging();}});_defineProperty(_assertThisInitialized(_this),"cancelTimer",function(){clearTimeout(_this.timer);});_this.state={isDeviceIdVisible:false};return _this;}/**
7
7
  * Setup event listener.
8
8
  */_createClass(ClientInformation,[{key:"componentDidMount",value:function componentDidMount(){document.addEventListener('touchend',this.cancelTimer);}/**
9
9
  * @param {Object} nextProps the next component props.
@@ -13,8 +13,8 @@ function _typeof(obj){if(typeof Symbol==="function"&&typeof Symbol.iterator==="s
13
13
  * Remove event listener.
14
14
  */},{key:"componentWillUnmount",value:function componentWillUnmount(){document.removeEventListener('touchend',this.cancelTimer);}/**
15
15
  * Starts the timer.
16
- */},{key:"render",/**
16
+ */},{key:"render",value:/**
17
17
  * Renders the component.
18
18
  * @return {JSX}
19
- */value:function render(){if(this.props.codebaseVersion===null){return null;}var isDeviceIdVisible=this.state.isDeviceIdVisible;var _this$props=this.props,appVersion=_this$props.appVersion,libVersion=_this$props.libVersion,deviceId=_this$props.deviceId,codebaseVersion=_this$props.codebaseVersion;return React.createElement("div",{className:"ui-shared__client-information ".concat(styles.wrapper),onTouchStart:this.startTimer,"aria-hidden":true},React.createElement("p",{className:styles.unselectable},"App Version:",' ',appVersion,' ',"(",codebaseVersion,")",React.createElement("br",null),"Lib Version:",' ',libVersion),isDeviceIdVisible&&React.createElement("p",{className:styles.deviceId},"Device ID:",' ',deviceId));}}]);return ClientInformation;}(Component);_defineProperty(ClientInformation,"defaultProps",{appVersion:null,codebaseVersion:null,deviceId:null,libVersion:null});export default connect(ClientInformation);// For testing.
19
+ */function render(){if(this.props.codebaseVersion===null){return null;}var isDeviceIdVisible=this.state.isDeviceIdVisible;var _this$props=this.props,appVersion=_this$props.appVersion,libVersion=_this$props.libVersion,deviceId=_this$props.deviceId,codebaseVersion=_this$props.codebaseVersion;return/*#__PURE__*/React.createElement("div",{className:"ui-shared__client-information ".concat(styles.wrapper),onTouchStart:this.startTimer,"aria-hidden":true},/*#__PURE__*/React.createElement("p",{className:styles.unselectable},"App Version:",' ',appVersion,' ',"(",codebaseVersion,")",/*#__PURE__*/React.createElement("br",null),"Lib Version:",' ',libVersion),isDeviceIdVisible&&/*#__PURE__*/React.createElement("p",{className:styles.deviceId},"Device ID:",' ',deviceId));}}]);return ClientInformation;}(Component);_defineProperty(ClientInformation,"defaultProps",{appVersion:null,codebaseVersion:null,deviceId:null,libVersion:null});export default connect(ClientInformation);// For testing.
20
20
  export{ClientInformation as Unwrapped};
@@ -1 +1 @@
1
- function _extends(){_extends=Object.assign||function(target){for(var i=1;i<arguments.length;i++){var source=arguments[i];for(var key in source){if(Object.prototype.hasOwnProperty.call(source,key)){target[key]=source[key];}}}return target;};return _extends.apply(this,arguments);}import React from'react';import{shallow,mount}from'enzyme';import{Unwrapped as ClientInformation}from"./index";describe('<ClientInformation />',function(){var mockData={appVersion:'1.2.3',libVersion:'4.5.6',codebaseVersion:'7.8.9',deviceId:'my-awesome-device-id',enableDebugLogging:function enableDebugLogging(){}};it('should not render if no data is available',function(){var wrapper=shallow(React.createElement(ClientInformation,_extends({},mockData,{codebaseVersion:null})));expect(wrapper).toMatchSnapshot();expect(wrapper.isEmptyRender()).toBe(true);});it('should re-render when data comes available',function(){var wrapper=shallow(React.createElement(ClientInformation,_extends({},mockData,{codebaseVersion:null})));expect(wrapper.isEmptyRender()).toBe(true);wrapper.setProps({codebaseVersion:mockData.codebaseVersion});expect(wrapper).toMatchSnapshot();expect(wrapper.isEmptyRender()).toBe(false);});describe('App and lib version, and device ID',function(){it('should render the app and lib version',function(){var wrapper=shallow(React.createElement(ClientInformation,_extends({},mockData,{enableDebugLogging:function enableDebugLogging(){}})));expect(wrapper).toMatchSnapshot();var html=wrapper.html();expect(html.indexOf(mockData.appVersion)>0).toBe(true);expect(html.indexOf(mockData.libVersion)>0).toBe(true);expect(html.indexOf(mockData.codebaseVersion)>0).toBe(true);expect(html.indexOf(mockData.deviceId)>0).toBe(false);});it('should show the device ID',function(){var wrapper=mount(React.createElement(ClientInformation,mockData));wrapper.setState({isDeviceIdVisible:true});wrapper.render();expect(wrapper).toMatchSnapshot();var html=wrapper.html();expect(html.indexOf(mockData.appVersion)>0).toBe(true);expect(html.indexOf(mockData.libVersion)>0).toBe(true);expect(html.indexOf(mockData.codebaseVersion)>0).toBe(true);expect(html.indexOf(mockData.deviceId)>0).toBe(true);});});describe('User interaction',function(){jest.useFakeTimers();it('should start the timer if touched',function(){var wrapper=shallow(React.createElement(ClientInformation,mockData));var instance=wrapper.instance();instance.showDeviceId=jest.fn();wrapper.find('div').simulate('touchstart');jest.runAllTimers();expect(wrapper.instance().showDeviceId).toHaveBeenCalled();});it('should abort the timer if touch ends under 5 seconds',function(){var wrapper=mount(React.createElement(ClientInformation,mockData));var instance=wrapper.instance();instance.showDeviceId=jest.fn();wrapper.find('div').simulate('touchstart');instance.cancelTimer();jest.runAllTimers();expect(wrapper.instance().showDeviceId).not.toHaveBeenCalled();});});});
1
+ function _extends(){_extends=Object.assign||function(target){for(var i=1;i<arguments.length;i++){var source=arguments[i];for(var key in source){if(Object.prototype.hasOwnProperty.call(source,key)){target[key]=source[key];}}}return target;};return _extends.apply(this,arguments);}import React from'react';import{shallow,mount}from'enzyme';import{Unwrapped as ClientInformation}from"./index";describe('<ClientInformation />',function(){var mockData={appVersion:'1.2.3',libVersion:'4.5.6',codebaseVersion:'7.8.9',deviceId:'my-awesome-device-id',enableDebugLogging:function enableDebugLogging(){}};it('should not render if no data is available',function(){var wrapper=shallow(/*#__PURE__*/React.createElement(ClientInformation,_extends({},mockData,{codebaseVersion:null})));expect(wrapper).toMatchSnapshot();expect(wrapper.isEmptyRender()).toBe(true);});it('should re-render when data comes available',function(){var wrapper=shallow(/*#__PURE__*/React.createElement(ClientInformation,_extends({},mockData,{codebaseVersion:null})));expect(wrapper.isEmptyRender()).toBe(true);wrapper.setProps({codebaseVersion:mockData.codebaseVersion});expect(wrapper).toMatchSnapshot();expect(wrapper.isEmptyRender()).toBe(false);});describe('App and lib version, and device ID',function(){it('should render the app and lib version',function(){var wrapper=shallow(/*#__PURE__*/React.createElement(ClientInformation,_extends({},mockData,{enableDebugLogging:function enableDebugLogging(){}})));expect(wrapper).toMatchSnapshot();var html=wrapper.html();expect(html.indexOf(mockData.appVersion)>0).toBe(true);expect(html.indexOf(mockData.libVersion)>0).toBe(true);expect(html.indexOf(mockData.codebaseVersion)>0).toBe(true);expect(html.indexOf(mockData.deviceId)>0).toBe(false);});it('should show the device ID',function(){var wrapper=mount(/*#__PURE__*/React.createElement(ClientInformation,mockData));wrapper.setState({isDeviceIdVisible:true});wrapper.render();expect(wrapper).toMatchSnapshot();var html=wrapper.html();expect(html.indexOf(mockData.appVersion)>0).toBe(true);expect(html.indexOf(mockData.libVersion)>0).toBe(true);expect(html.indexOf(mockData.codebaseVersion)>0).toBe(true);expect(html.indexOf(mockData.deviceId)>0).toBe(true);});});describe('User interaction',function(){jest.useFakeTimers();it('should start the timer if touched',function(){var wrapper=shallow(/*#__PURE__*/React.createElement(ClientInformation,mockData));var instance=wrapper.instance();instance.showDeviceId=jest.fn();wrapper.find('div').simulate('touchstart');jest.runAllTimers();expect(wrapper.instance().showDeviceId).toHaveBeenCalled();});it('should abort the timer if touch ends under 5 seconds',function(){var wrapper=mount(/*#__PURE__*/React.createElement(ClientInformation,mockData));var instance=wrapper.instance();instance.showDeviceId=jest.fn();wrapper.find('div').simulate('touchstart');instance.cancelTimer();jest.runAllTimers();expect(wrapper.instance().showDeviceId).not.toHaveBeenCalled();});});});
@@ -1,8 +1,8 @@
1
- import React from'react';import PropTypes from'prop-types';import compose from'lodash/fp/compose';import Glow from"../../../Glow";import styles from"./style";/**
1
+ import React from'react';import PropTypes from'prop-types';import compose from'lodash/fp/compose';import noop from'lodash/noop';import classNames from'classnames';import Glow from"../../../Glow";import{getItemClass}from"./style";/**
2
2
  * A delay in ms after that the closeMenu callback gets triggered.
3
3
  * @type {number}
4
4
  */var CLOSE_DELAY=250;/**
5
5
  * The Context Menu Item component.
6
6
  * @param {Object} props The component props.
7
7
  * @returns {JSX}
8
- */var Item=function Item(_ref){var children=_ref.children,closeMenu=_ref.closeMenu,onClick=_ref.onClick;var handleClick=compose(onClick,function(){return setTimeout(closeMenu,CLOSE_DELAY);});return React.createElement(Glow,null,React.createElement("div",{className:styles.item,onClick:handleClick,"aria-hidden":true,"data-test-id":"contextMenuButton"},children));};Item.defaultProps={children:null,closeMenu:function closeMenu(){},onClick:function onClick(){}};export default Item;
8
+ */var Item=function Item(_ref){var children=_ref.children,closeMenu=_ref.closeMenu,onClick=_ref.onClick,disabled=_ref.disabled,autoClose=_ref.autoClose,className=_ref.className;var handleClick=compose(onClick,autoClose?function(){return setTimeout(closeMenu,CLOSE_DELAY);}:noop);return/*#__PURE__*/React.createElement(Glow,{disabled:disabled},/*#__PURE__*/React.createElement("div",{className:classNames(getItemClass(disabled),className),onClick:disabled?noop:handleClick,"aria-hidden":true,"data-test-id":"contextMenuButton"},children));};Item.defaultProps={autoClose:true,children:null,className:'',closeMenu:function closeMenu(){},onClick:function onClick(){},disabled:false};export default Item;
@@ -1 +1,5 @@
1
- import{css}from'glamor';import{themeConfig}from'@shopgate/pwa-common/helpers/config';var item=css({position:'relative',whiteSpace:'nowrap',padding:"".concat(themeConfig.variables.gap.big*0.875,"px ").concat(themeConfig.variables.gap.big*1.375,"px"),lineHeight:1,zIndex:1}).toString();export default{item:item};
1
+ function _extends(){_extends=Object.assign||function(target){for(var i=1;i<arguments.length;i++){var source=arguments[i];for(var key in source){if(Object.prototype.hasOwnProperty.call(source,key)){target[key]=source[key];}}}return target;};return _extends.apply(this,arguments);}import{css}from'glamor';import Color from'color';import{themeConfig}from'@shopgate/pwa-common/helpers/config';/**
2
+ * Get the item class.
3
+ * @param {bool} disabled Disabled.
4
+ * @returns {string}
5
+ */export var getItemClass=function getItemClass(disabled){var background=themeConfig.colors.shade8;var customPropColor=themeConfig.colors.primary;if(customPropColor){background=Color(customPropColor).alpha(0.04);}return css(_extends({position:'relative',whiteSpace:'nowrap',marginBottom:2,padding:"".concat(themeConfig.variables.gap.big*0.875,"px ").concat(themeConfig.variables.gap.big*1.375,"px"),lineHeight:1,zIndex:1,color:disabled?themeConfig.colors.shade4:'inherits'},!disabled?{cursor:'pointer',':hover':{background:background}}:{cursor:'default'})).toString();};