@shopgate/pwa-common 6.20.0-beta.3 → 6.20.0-beta.9

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 (127) hide show
  1. package/App.js +4 -4
  2. package/actions/app/handleLink.js +1 -1
  3. package/actions/modal/showModal.js +1 -1
  4. package/collections/AuthRoutes.js +1 -1
  5. package/collections/Configuration.js +1 -1
  6. package/collections/EmbeddedMedia.js +1 -1
  7. package/collections/PersistedReducers.js +1 -1
  8. package/collections/Redirects.js +1 -1
  9. package/collections/media-providers/MediaProvider.js +1 -1
  10. package/collections/media-providers/Vimeo.js +3 -3
  11. package/collections/media-providers/Vimeo.spec.js +2 -2
  12. package/collections/media-providers/YouTube.js +3 -3
  13. package/collections/media-providers/YouTube.spec.js +1 -1
  14. package/components/Backdrop/index.js +4 -4
  15. package/components/Backdrop/spec.js +1 -1
  16. package/components/Button/index.js +7 -7
  17. package/components/Button/spec.js +1 -1
  18. package/components/Checkbox/index.js +6 -6
  19. package/components/Checkbox/spec.js +2 -2
  20. package/components/Consume/helpers/buildParams.js +1 -1
  21. package/components/Consume/index.js +1 -1
  22. package/components/CountdownTimer/index.js +4 -4
  23. package/components/CountdownTimer/spec.js +1 -1
  24. package/components/Drawer/index.js +5 -5
  25. package/components/Drawer/spec.js +1 -1
  26. package/components/Dropdown/index.js +4 -4
  27. package/components/Ellipsis/index.js +1 -1
  28. package/components/Ellipsis/spec.js +1 -1
  29. package/components/EmbeddedMedia/index.js +1 -1
  30. package/components/EmbeddedMedia/spec.js +1 -1
  31. package/components/ErrorBoundary/index.js +5 -5
  32. package/components/Grid/components/Item/index.js +4 -4
  33. package/components/Grid/components/Item/spec.js +1 -1
  34. package/components/Grid/index.js +4 -4
  35. package/components/Grid/spec.js +1 -1
  36. package/components/HtmlSanitizer/index.js +5 -5
  37. package/components/HtmlSanitizer/spec.js +2 -2
  38. package/components/I18n/components/FormatDate/index.js +1 -1
  39. package/components/I18n/components/FormatDate/spec.js +1 -1
  40. package/components/I18n/components/FormatNumber/index.js +1 -1
  41. package/components/I18n/components/FormatNumber/spec.js +2 -2
  42. package/components/I18n/components/FormatPrice/index.js +2 -2
  43. package/components/I18n/components/FormatPrice/spec.js +1 -1
  44. package/components/I18n/components/FormatTime/index.js +1 -1
  45. package/components/I18n/components/FormatTime/spec.js +1 -1
  46. package/components/I18n/components/I18nProvider/index.js +5 -5
  47. package/components/I18n/components/I18nProvider/spec.js +1 -1
  48. package/components/I18n/components/Placeholder/index.js +1 -1
  49. package/components/I18n/components/Placeholder/spec.js +1 -1
  50. package/components/I18n/components/Translate/index.js +3 -3
  51. package/components/I18n/components/Translate/spec.js +1 -1
  52. package/components/Icon/index.js +1 -1
  53. package/components/Image/index.js +6 -6
  54. package/components/Image/spec.js +2 -2
  55. package/components/InfiniteContainer/index.js +4 -4
  56. package/components/InfiniteContainer/spec.js +4 -4
  57. package/components/Input/components/MultiLineInput.js +6 -6
  58. package/components/Input/components/SimpleInput.js +13 -13
  59. package/components/Input/index.js +1 -1
  60. package/components/Input/spec.js +1 -1
  61. package/components/KeyboardConsumer/index.js +5 -5
  62. package/components/Link/index.js +3 -3
  63. package/components/Link/spec.js +1 -1
  64. package/components/List/components/Item/index.js +1 -1
  65. package/components/List/index.js +1 -1
  66. package/components/List/spec.js +1 -1
  67. package/components/Loading/index.js +1 -1
  68. package/components/Modal/index.js +1 -1
  69. package/components/ModalContainer/index.js +1 -1
  70. package/components/ModalContainer/spec.js +2 -2
  71. package/components/Picker/components/Button/index.js +1 -1
  72. package/components/Picker/components/List/index.js +1 -1
  73. package/components/Picker/components/Modal/index.js +5 -5
  74. package/components/Picker/index.js +9 -9
  75. package/components/Picker/spec.js +1 -1
  76. package/components/Portal/index.js +5 -5
  77. package/components/ProductCharacteristics/context.js +1 -1
  78. package/components/ProductCharacteristics/index.js +8 -8
  79. package/components/RangeSlider/components/Handle/index.js +1 -1
  80. package/components/RangeSlider/index.js +11 -11
  81. package/components/Route/index.js +7 -7
  82. package/components/ScannerContainer/index.js +5 -5
  83. package/components/ScannerContainer/index.spec.js +1 -1
  84. package/components/Select/components/Item/index.js +1 -1
  85. package/components/Select/index.js +5 -5
  86. package/components/Select/spec.js +2 -2
  87. package/components/SelectBox/components/Item/index.js +3 -3
  88. package/components/SelectBox/index.js +5 -5
  89. package/components/SelectBox/spec.js +2 -2
  90. package/components/SurroundPortals/index.js +1 -1
  91. package/components/Swiper/components/SwiperItem/index.js +1 -1
  92. package/components/Swiper/components/SwiperItem/spec.js +1 -1
  93. package/components/Swiper/index.js +3 -3
  94. package/components/Toaster/index.js +1 -1
  95. package/components/Transition/index.js +7 -7
  96. package/components/Widgets/components/Widget/index.js +4 -4
  97. package/components/Widgets/components/Widget/spec.js +2 -2
  98. package/components/Widgets/components/WidgetGrid/index.js +5 -5
  99. package/components/Widgets/components/WidgetGrid/spec.js +1 -1
  100. package/components/Widgets/index.js +6 -6
  101. package/components/Widgets/spec.js +3 -3
  102. package/context/index.js +1 -1
  103. package/helpers/config/index.js +1 -1
  104. package/helpers/config/theme.js +1 -1
  105. package/helpers/data/index.js +1 -1
  106. package/helpers/i18n/mergeTranslations.js +1 -1
  107. package/helpers/mocks/spec.js +1 -1
  108. package/helpers/portals/portalCollection.js +3 -3
  109. package/helpers/redux/__tests__/shouldFetchData.spec.js +1 -1
  110. package/helpers/redux/generateResultHash.js +1 -1
  111. package/helpers/validation/index.js +1 -1
  112. package/package.json +3 -3
  113. package/providers/loading/context.js +1 -1
  114. package/providers/loading/index.js +15 -12
  115. package/providers/loading/index.spec.js +2 -2
  116. package/providers/toast/context.js +1 -1
  117. package/providers/toast/index.js +8 -6
  118. package/reducers/client/connectivity.js +1 -1
  119. package/reducers/client/info.js +1 -1
  120. package/reducers/index.spec.js +1 -1
  121. package/reducers/page/index.js +1 -1
  122. package/reducers/user/data.js +1 -1
  123. package/streams/app.spec.js +1 -1
  124. package/subscriptions/app.spec.js +1 -1
  125. package/subscriptions/helpers/handleLinks.js +1 -1
  126. package/subscriptions/router.js +3 -3
  127. package/subscriptions/router.spec.js +1 -1
@@ -1,10 +1,10 @@
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 _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 Transition from"../Transition";import styles from"./style";import transitions from"./transitions";/**
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 Transition from"../Transition";import styles from"./style";import transitions from"./transitions";/**
2
2
  * This component slides it's child content up or down based on it's isOpen property.
3
3
  * @returns {JSX}
4
- */var Dropdown=/*#__PURE__*/function(_Component){_inherits(Dropdown,_Component);/**
4
+ */var Dropdown=/*#__PURE__*/function(_Component){_inherits(Dropdown,_Component);var _super=_createSuper(Dropdown);/**
5
5
  * Constructor
6
6
  * @param {Object} props Props of the Component
7
- */function Dropdown(props){var _this;_classCallCheck(this,Dropdown);_this=_possibleConstructorReturn(this,_getPrototypeOf(Dropdown).call(this,props));_this.state={initialRender:true};return _this;}/**
7
+ */function Dropdown(props){var _this;_classCallCheck(this,Dropdown);_this=_super.call(this,props);_this.state={initialRender:true};return _this;}/**
8
8
  * Update the initialRender state if the isOpen state changes from false to true
9
9
  * @param {Object} nextProps The new props
10
10
  */_createClass(Dropdown,[{key:"UNSAFE_componentWillReceiveProps",value:function UNSAFE_componentWillReceiveProps(nextProps){if(this.props.isOpen===false&&nextProps.isOpen===true){this.setState({initialRender:false});}}/**
@@ -14,4 +14,4 @@ function _typeof(obj){if(typeof Symbol==="function"&&typeof Symbol.iterator==="s
14
14
  */},{key:"shouldComponentUpdate",value:function shouldComponentUpdate(nextProps){return this.props.isOpen!==nextProps.isOpen;}/**
15
15
  * Renders the component.
16
16
  * @returns {JSX}
17
- */},{key:"render",value:function render(){var transitionProps;if(this.props.isOpen){transitionProps=this.state.initialRender?transitions.initialOpen:transitions.open;}else{transitionProps=this.state.initialRender?transitions.initialClose:transitions.close;}return React.createElement(Transition,_extends({},transitionProps,{onComplete:this.props.onComplete,onStart:this.props.onStart,duration:this.props.duration,easing:this.props.easing}),React.createElement("div",{className:"".concat(styles," ").concat(this.props.className," common__dropdown"),"aria-hidden":!this.props.isOpen},this.props.children));}}]);return Dropdown;}(Component);_defineProperty(Dropdown,"defaultProps",{className:'',children:null,duration:150,easing:null,isOpen:false,onComplete:function onComplete(){},onStart:function onStart(){}});export default Dropdown;
17
+ */},{key:"render",value:function render(){var transitionProps;if(this.props.isOpen){transitionProps=this.state.initialRender?transitions.initialOpen:transitions.open;}else{transitionProps=this.state.initialRender?transitions.initialClose:transitions.close;}return/*#__PURE__*/React.createElement(Transition,_extends({},transitionProps,{onComplete:this.props.onComplete,onStart:this.props.onStart,duration:this.props.duration,easing:this.props.easing}),/*#__PURE__*/React.createElement("div",{className:"".concat(styles," ").concat(this.props.className," common__dropdown"),"aria-hidden":!this.props.isOpen},this.props.children));}}]);return Dropdown;}(Component);_defineProperty(Dropdown,"defaultProps",{className:'',children:null,duration:150,easing:null,isOpen:false,onComplete:function onComplete(){},onStart:function onStart(){}});export default Dropdown;
@@ -2,4 +2,4 @@ import React from'react';import PropTypes from'prop-types';import Dotdotdot from
2
2
  * The ellipsis text component.
3
3
  * @param {Object} props The component props.
4
4
  * @returns {JSX}
5
- */var Ellipsis=function Ellipsis(props){return React.createElement(Dotdotdot,{clamp:props.rows,ellipsis:props.ellipsis,className:"".concat(props.className," common__ellipsis"),useNativeClamp:true},props.children);};Ellipsis.defaultProps={className:'',ellipsis:'...',rows:3};export default Ellipsis;
5
+ */var Ellipsis=function Ellipsis(props){return/*#__PURE__*/React.createElement(Dotdotdot,{clamp:props.rows,ellipsis:props.ellipsis,className:"".concat(props.className," common__ellipsis"),useNativeClamp:true},props.children);};Ellipsis.defaultProps={className:'',ellipsis:'...',rows:3};export default Ellipsis;
@@ -1 +1 @@
1
- import React from'react';import{shallow}from'enzyme';import Ellipsis from"./index";var clamp=3;var text='Some very long text that should be cut off by this ellipsis component.';describe('<Ellipsis />',function(){it('should render',function(){var wrapper=shallow(React.createElement(Ellipsis,{rows:clamp},text));expect(wrapper).toMatchSnapshot();});});
1
+ import React from'react';import{shallow}from'enzyme';import Ellipsis from"./index";var clamp=3;var text='Some very long text that should be cut off by this ellipsis component.';describe('<Ellipsis />',function(){it('should render',function(){var wrapper=shallow(/*#__PURE__*/React.createElement(Ellipsis,{rows:clamp},text));expect(wrapper).toMatchSnapshot();});});
@@ -7,5 +7,5 @@ var pendingProviders=[].concat(embeddedMedia.providers).filter(function(p){retur
7
7
  * @param {Element[]} scriptTags script tags to listen for
8
8
  * @param {MediaProvider} provider Provider
9
9
  */var updateProviderScripts=function updateProviderScripts(_ref2){var scriptTags=_ref2.scriptTags;if(scriptTags){scriptTags.forEach(function(scriptTag){var provider=pendingProviders.find(function(p){return p.remoteScriptUrl===scriptTag.getAttribute('src');});// eslint-disable-next-line no-param-reassign
10
- scriptTag.onload=function(){provider.onScriptLoaded();};});}};var scripts=pendingProviders.map(function(provider){return{src:provider.remoteScriptUrl,type:'text/javascript'};});return React.createElement(Fragment,null,React.createElement(Helmet,{script:scripts// Helmet doesn't support `onload` in script objects so we have to hack in our own
10
+ scriptTag.onload=function(){provider.onScriptLoaded();};});}};var scripts=pendingProviders.map(function(provider){return{src:provider.remoteScriptUrl,type:'text/javascript'};});return/*#__PURE__*/React.createElement(Fragment,null,/*#__PURE__*/React.createElement(Helmet,{script:scripts// Helmet doesn't support `onload` in script objects so we have to hack in our own
11
11
  ,onChangeClientState:function onChangeClientState(newState,addedTags){return updateProviderScripts(addedTags);}}),children);};export default EmbeddedMedia;
@@ -1,3 +1,3 @@
1
- function _slicedToArray(arr,i){return _arrayWithHoles(arr)||_iterableToArrayLimit(arr,i)||_nonIterableRest();}function _nonIterableRest(){throw new TypeError("Invalid attempt to destructure non-iterable instance");}function _iterableToArrayLimit(arr,i){var _arr=[];var _n=true;var _d=false;var _e=undefined;try{for(var _i=arr[Symbol.iterator](),_s;!(_n=(_s=_i.next()).done);_n=true){_arr.push(_s.value);if(i&&_arr.length===i)break;}}catch(err){_d=true;_e=err;}finally{try{if(!_n&&_i["return"]!=null)_i["return"]();}finally{if(_d)throw _e;}}return _arr;}function _arrayWithHoles(arr){if(Array.isArray(arr))return arr;}import React from'react';import{shallow}from'enzyme';import{embeddedMedia}from'@shopgate/pwa-common/collections';import EmbeddedMedia from"./index";jest.mock('@shopgate/pwa-common/collections',function(){return{embeddedMedia:{getHasPendingProviders:jest.fn(),providers:new Set([{isPending:false,remoteScriptUrl:'http://foo.bar'},{isPending:true,remoteScriptUrl:'http://bar.foo',onScriptLoaded:jest.fn()}])}};});describe('<EmbeddedMedia />',function(){beforeEach(function(){jest.clearAllMocks();});it('should return children',function(){embeddedMedia.getHasPendingProviders.mockReturnValueOnce(false);var wrapper=shallow(React.createElement(EmbeddedMedia,null,React.createElement("div",null,"Children")));expect(wrapper.html()).toEqual('<div>Children</div>');});it.skip('should render Helmet with a script',function(){embeddedMedia.getHasPendingProviders.mockReturnValueOnce(true);var wrapper=shallow(React.createElement(EmbeddedMedia,null,React.createElement("div",null,"Content with embedded media (youtube, vimeo, etc)")));var helmetProps=wrapper.find('HelmetWrapper').props();expect(helmetProps).toEqual({defer:true,encodeSpecialCharacters:true,onChangeClientState:function onChangeClientState(){},script:[]});var scriptTags=[{onload:jest.fn(),getAttribute:jest.fn().mockReturnValue('http://bar.foo')}];// Invoke helmet cb
1
+ function _slicedToArray(arr,i){return _arrayWithHoles(arr)||_iterableToArrayLimit(arr,i)||_unsupportedIterableToArray(arr,i)||_nonIterableRest();}function _nonIterableRest(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");}function _unsupportedIterableToArray(o,minLen){if(!o)return;if(typeof o==="string")return _arrayLikeToArray(o,minLen);var n=Object.prototype.toString.call(o).slice(8,-1);if(n==="Object"&&o.constructor)n=o.constructor.name;if(n==="Map"||n==="Set")return Array.from(o);if(n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return _arrayLikeToArray(o,minLen);}function _arrayLikeToArray(arr,len){if(len==null||len>arr.length)len=arr.length;for(var i=0,arr2=new Array(len);i<len;i++){arr2[i]=arr[i];}return arr2;}function _iterableToArrayLimit(arr,i){var _i=arr==null?null:typeof Symbol!=="undefined"&&arr[Symbol.iterator]||arr["@@iterator"];if(_i==null)return;var _arr=[];var _n=true;var _d=false;var _s,_e;try{for(_i=_i.call(arr);!(_n=(_s=_i.next()).done);_n=true){_arr.push(_s.value);if(i&&_arr.length===i)break;}}catch(err){_d=true;_e=err;}finally{try{if(!_n&&_i["return"]!=null)_i["return"]();}finally{if(_d)throw _e;}}return _arr;}function _arrayWithHoles(arr){if(Array.isArray(arr))return arr;}import React from'react';import{shallow}from'enzyme';import{embeddedMedia}from'@shopgate/pwa-common/collections';import EmbeddedMedia from"./index";jest.mock('@shopgate/pwa-common/collections',function(){return{embeddedMedia:{getHasPendingProviders:jest.fn(),providers:new Set([{isPending:false,remoteScriptUrl:'http://foo.bar'},{isPending:true,remoteScriptUrl:'http://bar.foo',onScriptLoaded:jest.fn()}])}};});describe('<EmbeddedMedia />',function(){beforeEach(function(){jest.clearAllMocks();});it('should return children',function(){embeddedMedia.getHasPendingProviders.mockReturnValueOnce(false);var wrapper=shallow(/*#__PURE__*/React.createElement(EmbeddedMedia,null,/*#__PURE__*/React.createElement("div",null,"Children")));expect(wrapper.html()).toEqual('<div>Children</div>');});it.skip('should render Helmet with a script',function(){embeddedMedia.getHasPendingProviders.mockReturnValueOnce(true);var wrapper=shallow(/*#__PURE__*/React.createElement(EmbeddedMedia,null,/*#__PURE__*/React.createElement("div",null,"Content with embedded media (youtube, vimeo, etc)")));var helmetProps=wrapper.find('HelmetWrapper').props();expect(helmetProps).toEqual({defer:true,encodeSpecialCharacters:true,onChangeClientState:function onChangeClientState(){},script:[]});var scriptTags=[{onload:jest.fn(),getAttribute:jest.fn().mockReturnValue('http://bar.foo')}];// Invoke helmet cb
2
2
  helmetProps.onChangeClientState(null,{scriptTags:scriptTags});// Invoke onload on script
3
3
  scriptTags[0].onload();var _embeddedMedia$provid=_slicedToArray(embeddedMedia.providers,2),secondProvider=_embeddedMedia$provid[1];expect(secondProvider.onScriptLoaded).toHaveBeenCalledTimes(1);});});
@@ -1,11 +1,11 @@
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{PureComponent}from'react';import PropTypes from'prop-types';import connector 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);}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{PureComponent}from'react';import PropTypes from'prop-types';import connector from"./connector";/**
2
2
  * The App error boundary component.
3
- */var ErrorBoundary=/*#__PURE__*/function(_PureComponent){_inherits(ErrorBoundary,_PureComponent);function ErrorBoundary(){var _getPrototypeOf2;var _this;_classCallCheck(this,ErrorBoundary);for(var _len=arguments.length,args=new Array(_len),_key=0;_key<_len;_key++){args[_key]=arguments[_key];}_this=_possibleConstructorReturn(this,(_getPrototypeOf2=_getPrototypeOf(ErrorBoundary)).call.apply(_getPrototypeOf2,[this].concat(args)));_defineProperty(_assertThisInitialized(_this),"state",{hasError:false});return _this;}_createClass(ErrorBoundary,[{key:"componentDidCatch",/**
3
+ */var ErrorBoundary=/*#__PURE__*/function(_PureComponent){_inherits(ErrorBoundary,_PureComponent);var _super=_createSuper(ErrorBoundary);function ErrorBoundary(){var _this;_classCallCheck(this,ErrorBoundary);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),"state",{hasError:false});return _this;}_createClass(ErrorBoundary,[{key:"componentDidCatch",value:/**
4
4
  * @param {Object} error The error object.
5
5
  * @param {Object} errorInfo The error information.
6
- */value:function componentDidCatch(error,errorInfo){// eslint-disable-next-line no-param-reassign
6
+ */function componentDidCatch(error,errorInfo){// eslint-disable-next-line no-param-reassign
7
7
  error.stack=errorInfo.componentStack;this.props.appError(error);}/**
8
8
  * @returns {JSX}
9
- */},{key:"render",value:function render(){if(this.state.hasError){return this.props.fallbackUi;}return this.props.children;}}],[{key:"getDerivedStateFromError",/**
9
+ */},{key:"render",value:function render(){if(this.state.hasError){return this.props.fallbackUi;}return this.props.children;}}],[{key:"getDerivedStateFromError",value:/**
10
10
  * @returns {{hasError: boolean}}
11
- */value:function getDerivedStateFromError(){return{hasError:true};}}]);return ErrorBoundary;}(PureComponent);_defineProperty(ErrorBoundary,"defaultProps",{fallbackUi:null});export default connector(ErrorBoundary);
11
+ */function getDerivedStateFromError(){return{hasError:true};}}]);return ErrorBoundary;}(PureComponent);_defineProperty(ErrorBoundary,"defaultProps",{fallbackUi:null});export default connector(ErrorBoundary);
@@ -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 _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{objectWithoutProps}from"../../../../helpers/data";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{objectWithoutProps}from"../../../../helpers/data";import styles from"./style";/**
2
2
  * The grid item component.
3
- */var GridItem=/*#__PURE__*/function(_Component){_inherits(GridItem,_Component);function GridItem(){_classCallCheck(this,GridItem);return _possibleConstructorReturn(this,_getPrototypeOf(GridItem).apply(this,arguments));}_createClass(GridItem,[{key:"getProps",/**
3
+ */var GridItem=/*#__PURE__*/function(_Component){_inherits(GridItem,_Component);var _super=_createSuper(GridItem);function GridItem(){_classCallCheck(this,GridItem);return _super.apply(this,arguments);}_createClass(GridItem,[{key:"getProps",value:/**
4
4
  * Composes the props.
5
5
  * @returns {Object} The composed props.
6
- */value:function getProps(){var className=this.props.className;if(this.props.grow!==0){className+=" ".concat(styles.grow(this.props.grow));}if(this.props.shrink!==1){className+=" ".concat(styles.shrink(this.props.shrink));}var props=_extends({},this.props,{className:className});return objectWithoutProps(props,['component','grow','shrink']);}/**
6
+ */function getProps(){var className=this.props.className;if(this.props.grow!==0){className+=" ".concat(styles.grow(this.props.grow));}if(this.props.shrink!==1){className+=" ".concat(styles.shrink(this.props.shrink));}var props=_extends({},this.props,{className:className});return objectWithoutProps(props,['component','grow','shrink']);}/**
7
7
  * Renders the component.
8
8
  * @returns {JSX}
9
- */},{key:"render",value:function render(){return React.createElement(this.props.component,this.getProps());}}]);return GridItem;}(Component);_defineProperty(GridItem,"defaultProps",{className:'',component:'li',grow:0,shrink:1});export default GridItem;
9
+ */},{key:"render",value:function render(){return/*#__PURE__*/React.createElement(this.props.component,this.getProps());}}]);return GridItem;}(Component);_defineProperty(GridItem,"defaultProps",{className:'',component:'li',grow:0,shrink:1});export default GridItem;
@@ -1 +1 @@
1
- import React from'react';import{shallow}from'enzyme';import GridItem from"./index";describe('<GridItem />',function(){it('should render without any further props',function(){var wrapper=shallow(React.createElement(GridItem,null));expect(wrapper).toMatchSnapshot();});it('should be able to render a custom tag',function(){var wrapper=shallow(React.createElement(GridItem,{component:"section"}));expect(wrapper).toMatchSnapshot();expect(wrapper.type()).toEqual('section');});it('should add custom classes on demand',function(){var wrapper=shallow(React.createElement(GridItem,{className:"custom-class-name"}));expect(wrapper).toMatchSnapshot();expect(wrapper.hasClass('custom-class-name')).toEqual(true);});});
1
+ import React from'react';import{shallow}from'enzyme';import GridItem from"./index";describe('<GridItem />',function(){it('should render without any further props',function(){var wrapper=shallow(/*#__PURE__*/React.createElement(GridItem,null));expect(wrapper).toMatchSnapshot();});it('should be able to render a custom tag',function(){var wrapper=shallow(/*#__PURE__*/React.createElement(GridItem,{component:"section"}));expect(wrapper).toMatchSnapshot();expect(wrapper.type()).toEqual('section');});it('should add custom classes on demand',function(){var wrapper=shallow(/*#__PURE__*/React.createElement(GridItem,{className:"custom-class-name"}));expect(wrapper).toMatchSnapshot();expect(wrapper.hasClass('custom-class-name')).toEqual(true);});});
@@ -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 _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{objectWithoutProps}from"../../helpers/data";import GridItem from"./components/Item";import styles,{wrap}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{objectWithoutProps}from"../../helpers/data";import GridItem from"./components/Item";import styles,{wrap}from"./style";/**
2
2
  * The grid component.
3
- */var Grid=/*#__PURE__*/function(_Component){_inherits(Grid,_Component);function Grid(){_classCallCheck(this,Grid);return _possibleConstructorReturn(this,_getPrototypeOf(Grid).apply(this,arguments));}_createClass(Grid,[{key:"getProps",/**
3
+ */var Grid=/*#__PURE__*/function(_Component){_inherits(Grid,_Component);var _super=_createSuper(Grid);function Grid(){_classCallCheck(this,Grid);return _super.apply(this,arguments);}_createClass(Grid,[{key:"getProps",value:/**
4
4
  * Composes the props.
5
5
  * @returns {Object} The composed props.
6
- */value:function getProps(){var className="".concat(this.props.className," ").concat(styles," common__grid");if(this.props.wrap){className+=" ".concat(wrap(this.props.wrap));}var props=_extends({},this.props,{className:className});return objectWithoutProps(props,['wrap','component']);}/**
6
+ */function getProps(){var className="".concat(this.props.className," ").concat(styles," common__grid");if(this.props.wrap){className+=" ".concat(wrap(this.props.wrap));}var props=_extends({},this.props,{className:className});return objectWithoutProps(props,['wrap','component']);}/**
7
7
  * Renders the component.
8
8
  * @returns {JSX}
9
- */},{key:"render",value:function render(){return React.createElement(this.props.component,this.getProps());}}]);return Grid;}(Component);_defineProperty(Grid,"Item",GridItem);_defineProperty(Grid,"defaultProps",{className:'',component:'ul',wrap:false});export default Grid;
9
+ */},{key:"render",value:function render(){return/*#__PURE__*/React.createElement(this.props.component,this.getProps());}}]);return Grid;}(Component);_defineProperty(Grid,"Item",GridItem);_defineProperty(Grid,"defaultProps",{className:'',component:'ul',wrap:false});export default Grid;
@@ -1 +1 @@
1
- import React from'react';import{shallow}from'enzyme';import Grid from"./index";describe('<Grid />',function(){it('should render without any further props',function(){var wrapper=shallow(React.createElement(Grid,null));expect(wrapper).toMatchSnapshot();});it('should be able to render a custom tag',function(){var wrapper=shallow(React.createElement(Grid,{component:"article"}));expect(wrapper).toMatchSnapshot();expect(wrapper.type()).toEqual('article');});it('should add custom classes on demand',function(){var wrapper=shallow(React.createElement(Grid,{className:"custom-class-name"}));expect(wrapper).toMatchSnapshot();expect(wrapper.hasClass('custom-class-name')).toEqual(true);});});
1
+ import React from'react';import{shallow}from'enzyme';import Grid from"./index";describe('<Grid />',function(){it('should render without any further props',function(){var wrapper=shallow(/*#__PURE__*/React.createElement(Grid,null));expect(wrapper).toMatchSnapshot();});it('should be able to render a custom tag',function(){var wrapper=shallow(/*#__PURE__*/React.createElement(Grid,{component:"article"}));expect(wrapper).toMatchSnapshot();expect(wrapper.type()).toEqual('article');});it('should add custom classes on demand',function(){var wrapper=shallow(/*#__PURE__*/React.createElement(Grid,{className:"custom-class-name"}));expect(wrapper).toMatchSnapshot();expect(wrapper.hasClass('custom-class-name')).toEqual(true);});});
@@ -1,8 +1,8 @@
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{embeddedMedia}from'@shopgate/pwa-common/collections';import EmbeddedMedia from"../EmbeddedMedia";import parseHTML from"../../helpers/html/parseHTML";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);}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{embeddedMedia}from'@shopgate/pwa-common/collections';import EmbeddedMedia from"../EmbeddedMedia";import parseHTML from"../../helpers/html/parseHTML";import connect from"./connector";/**
2
2
  * HtmlSanitizer component.
3
- */var HtmlSanitizer=/*#__PURE__*/function(_Component){_inherits(HtmlSanitizer,_Component);/**
3
+ */var HtmlSanitizer=/*#__PURE__*/function(_Component){_inherits(HtmlSanitizer,_Component);var _super=_createSuper(HtmlSanitizer);/**
4
4
  * @param {Object} props The component props.
5
- */function HtmlSanitizer(props){var _this;_classCallCheck(this,HtmlSanitizer);_this=_possibleConstructorReturn(this,_getPrototypeOf(HtmlSanitizer).call(this,props));_defineProperty(_assertThisInitialized(_this),"handleTap",function(event){var linkTag=event.target.closest('a');if(linkTag){var _linkTag$attributes=linkTag.attributes;_linkTag$attributes=_linkTag$attributes===void 0?{}:_linkTag$attributes;var _linkTag$attributes$h=_linkTag$attributes.href;_linkTag$attributes$h=_linkTag$attributes$h===void 0?{}:_linkTag$attributes$h;var _linkTag$attributes$h2=_linkTag$attributes$h.value,href=_linkTag$attributes$h2===void 0?'':_linkTag$attributes$h2,_linkTag$attributes$t=_linkTag$attributes.target;_linkTag$attributes$t=_linkTag$attributes$t===void 0?{}:_linkTag$attributes$t;var _linkTag$attributes$t2=_linkTag$attributes$t.value,target=_linkTag$attributes$t2===void 0?'':_linkTag$attributes$t2;if(href){event.preventDefault();if(_this.props.settings.handleClick){_this.props.settings.handleClick(href,target);}else{_this.props.navigate(href,target);}}}});_this.htmlContainer=React.createRef();return _this;}/**
5
+ */function HtmlSanitizer(props){var _this;_classCallCheck(this,HtmlSanitizer);_this=_super.call(this,props);_defineProperty(_assertThisInitialized(_this),"handleTap",function(event){var linkTag=event.target.closest('a');if(linkTag){var _linkTag$attributes=linkTag.attributes;_linkTag$attributes=_linkTag$attributes===void 0?{}:_linkTag$attributes;var _linkTag$attributes$h=_linkTag$attributes.href;_linkTag$attributes$h=_linkTag$attributes$h===void 0?{}:_linkTag$attributes$h;var _linkTag$attributes$h2=_linkTag$attributes$h.value,href=_linkTag$attributes$h2===void 0?'':_linkTag$attributes$h2,_linkTag$attributes$t=_linkTag$attributes.target;_linkTag$attributes$t=_linkTag$attributes$t===void 0?{}:_linkTag$attributes$t;var _linkTag$attributes$t2=_linkTag$attributes$t.value,target=_linkTag$attributes$t2===void 0?'':_linkTag$attributes$t2;if(href){event.preventDefault();if(_this.props.settings.handleClick){_this.props.settings.handleClick(href,target);}else{_this.props.navigate(href,target);}}}});_this.htmlContainer=/*#__PURE__*/React.createRef();return _this;}/**
6
6
  * Registers the event handler for when the user taps inside the html content.
7
7
  */_createClass(HtmlSanitizer,[{key:"componentDidMount",value:function componentDidMount(){this.htmlContainer.current.addEventListener('click',this.handleTap,true);embeddedMedia.add(this.htmlContainer.current);}/**
8
8
  * Only update if the HTML changed.
@@ -15,8 +15,8 @@ function _typeof(obj){if(typeof Symbol==="function"&&typeof Symbol.iterator==="s
15
15
  */},{key:"componentWillUnmount",value:function componentWillUnmount(){this.htmlContainer.current.removeEventListener('click',this.handleTap,true);embeddedMedia.remove(this.htmlContainer.current);}/**
16
16
  * If the user tapped a link element, prevent the default behavior.
17
17
  * @param {Object} event The touchstart event.
18
- */},{key:"render",/**
18
+ */},{key:"render",value:/**
19
19
  * Renders the component.
20
20
  * @returns {JSX}
21
- */value:function render(){var innerHTML={__html:parseHTML(this.props.children,this.props.decode,this.props.settings,this.props.processStyles)};var Wrapper=this.props.wrapper;return React.createElement(Wrapper,null,React.createElement("div",{// eslint-disable-next-line react/no-danger
21
+ */function render(){var innerHTML={__html:parseHTML(this.props.children,this.props.decode,this.props.settings,this.props.processStyles)};var Wrapper=this.props.wrapper;return/*#__PURE__*/React.createElement(Wrapper,null,/*#__PURE__*/React.createElement("div",{// eslint-disable-next-line react/no-danger
22
22
  dangerouslySetInnerHTML:innerHTML,ref:this.htmlContainer,className:"".concat(this.props.className," common__html-sanitizer")}));}}]);return HtmlSanitizer;}(Component);_defineProperty(HtmlSanitizer,"defaultProps",{children:'',className:'',decode:false,processStyles:false,settings:{},wrapper:EmbeddedMedia});export default connect(HtmlSanitizer);
@@ -2,7 +2,7 @@ import React from'react';import{mount}from'enzyme';import{JSDOM}from'jsdom';impo
2
2
  * @param {string} html HTML markup.
3
3
  * @param {Object} props Component props.
4
4
  * @returns {JSX}
5
- */var createWrapper=function createWrapper(html){var props=arguments.length>1&&arguments[1]!==undefined?arguments[1]:{};return mount(React.createElement(HtmlSanitizer,props,html));};describe('<HtmlSanitizer />',function(){beforeEach(function(){jest.clearAllMocks();});it('should render the HtmlSanitizer',function(){/**
5
+ */var createWrapper=function createWrapper(html){var props=arguments.length>1&&arguments[1]!==undefined?arguments[1]:{};return mount(/*#__PURE__*/React.createElement(HtmlSanitizer,props,html));};describe('<HtmlSanitizer />',function(){beforeEach(function(){jest.clearAllMocks();});it('should render the HtmlSanitizer',function(){/**
6
6
  * The value for html is the HTML-escaped equivalent of the following:
7
7
  * <h1>Hello World!</h1>
8
8
  * @type {string}
@@ -15,4 +15,4 @@ expect(wrapper.html()).toEqual('<div class=" common__html-sanitizer"><h1>Hello W
15
15
  * <script>var y = 23;</script>
16
16
  * @type {string}
17
17
  */var html='&lt;script src=&quot;https://cdnjs.cloudflare.com/ajax/libs/jquery/3.2.1/jquery.js&quot;&gt;&lt;/script&gt; &lt;script type=&quot;text/javascript&quot;&gt;var x = 42;&lt;/script&gt; &lt;p&gt;Foo Bar&lt;/p&gt; &lt;script&gt;var y = 23;&lt;/script&gt;';var wrapper=createWrapper(html,{decode:true});// Test result of dangerouslySetInnerHTML.
18
- expect(wrapper.html()).toEqual('<div class=" common__html-sanitizer"> <p>Foo Bar</p> </div>');expect(wrapper).toMatchSnapshot();});describe('Link handling',function(){var mockedHandleClick=jest.fn();beforeEach(function(){mockedHandleClick.mockClear();});it('follows a link from a plain <a>',function(){var doc=new JSDOM('<!doctype html><html><body><div>/<div></body></html>').window.document;var html='&lt;a id=&quot;link&quot; href=&quot;#follow-me-and-everything-is-alright&quot;&gt;Plain Link&lt;/a&gt;';var wrapper=mount(React.createElement(HtmlSanitizer,{decode:true,settings:{handleClick:mockedHandleClick}},html),{attachTo:doc.getElementsByTagName('div')[0]});var aTag=doc.getElementsByTagName('a')[0];aTag.closest=function(){return aTag;};var event={target:aTag,preventDefault:function preventDefault(){}};wrapper.instance().handleTap(event);expect(mockedHandleClick).toHaveBeenCalledTimes(1);expect(mockedHandleClick).toHaveBeenCalledWith('#follow-me-and-everything-is-alright','');});it('follows a link from a <a> with other HTML inside',function(){var doc=new JSDOM('<!doctype html><html><body><div>/<div></body></html>').window.document;var html='&lt;a id=&quot;link&quot; target=&quot;_blank&quot; href=&quot;#I-ll-be-the-one-to-tuck-you-in-at-night&quot;&gt;&lt;span&gt;Span Link&lt;/span&gt;&lt;/a&gt;';var wrapper=mount(React.createElement(HtmlSanitizer,{decode:true,settings:{handleClick:mockedHandleClick}},html),{attachTo:doc.getElementsByTagName('div')[0]});var aTag=doc.getElementsByTagName('a')[0];var spanTag=doc.getElementsByTagName('span')[0];spanTag.closest=function(){return aTag;};var event={target:spanTag,preventDefault:function preventDefault(){}};wrapper.instance().handleTap(event);expect(mockedHandleClick).toHaveBeenCalledTimes(1);expect(mockedHandleClick).toHaveBeenCalledWith('#I-ll-be-the-one-to-tuck-you-in-at-night','_blank');});});});
18
+ expect(wrapper.html()).toEqual('<div class=" common__html-sanitizer"> <p>Foo Bar</p> </div>');expect(wrapper).toMatchSnapshot();});describe('Link handling',function(){var mockedHandleClick=jest.fn();beforeEach(function(){mockedHandleClick.mockClear();});it('follows a link from a plain <a>',function(){var doc=new JSDOM('<!doctype html><html><body><div>/<div></body></html>').window.document;var html='&lt;a id=&quot;link&quot; href=&quot;#follow-me-and-everything-is-alright&quot;&gt;Plain Link&lt;/a&gt;';var wrapper=mount(/*#__PURE__*/React.createElement(HtmlSanitizer,{decode:true,settings:{handleClick:mockedHandleClick}},html),{attachTo:doc.getElementsByTagName('div')[0]});var aTag=doc.getElementsByTagName('a')[0];aTag.closest=function(){return aTag;};var event={target:aTag,preventDefault:function preventDefault(){}};wrapper.instance().handleTap(event);expect(mockedHandleClick).toHaveBeenCalledTimes(1);expect(mockedHandleClick).toHaveBeenCalledWith('#follow-me-and-everything-is-alright','');});it('follows a link from a <a> with other HTML inside',function(){var doc=new JSDOM('<!doctype html><html><body><div>/<div></body></html>').window.document;var html='&lt;a id=&quot;link&quot; target=&quot;_blank&quot; href=&quot;#I-ll-be-the-one-to-tuck-you-in-at-night&quot;&gt;&lt;span&gt;Span Link&lt;/span&gt;&lt;/a&gt;';var wrapper=mount(/*#__PURE__*/React.createElement(HtmlSanitizer,{decode:true,settings:{handleClick:mockedHandleClick}},html),{attachTo:doc.getElementsByTagName('div')[0]});var aTag=doc.getElementsByTagName('a')[0];var spanTag=doc.getElementsByTagName('span')[0];spanTag.closest=function(){return aTag;};var event={target:spanTag,preventDefault:function preventDefault(){}};wrapper.instance().handleTap(event);expect(mockedHandleClick).toHaveBeenCalledTimes(1);expect(mockedHandleClick).toHaveBeenCalledWith('#I-ll-be-the-one-to-tuck-you-in-at-night','_blank');});});});
@@ -2,4 +2,4 @@ import React,{Fragment,memo}from'react';import PropTypes from'prop-types';import
2
2
  * Formats a date.
3
3
  * @param {Object} props The component props.
4
4
  * @returns {JSX}
5
- */var FormatDate=function FormatDate(_ref){var timestamp=_ref.timestamp,format=_ref.format;return React.createElement(Fragment,null,FormatDate.format({timestamp:timestamp,format:format}));};FormatDate.format=function(_ref2){var timestamp=_ref2.timestamp,format=_ref2.format;if(!i18n.ready){return timestamp;}return i18n.date(timestamp,format);};FormatDate.defaultProps={format:'medium'};export default memo(FormatDate);
5
+ */var FormatDate=function FormatDate(_ref){var timestamp=_ref.timestamp,format=_ref.format;return/*#__PURE__*/React.createElement(Fragment,null,FormatDate.format({timestamp:timestamp,format:format}));};FormatDate.format=function(_ref2){var timestamp=_ref2.timestamp,format=_ref2.format;if(!i18n.ready){return timestamp;}return i18n.date(timestamp,format);};FormatDate.defaultProps={format:'medium'};export default/*#__PURE__*/memo(FormatDate);
@@ -1 +1 @@
1
- import React from'react';import{mount}from'enzyme';import{i18n}from'@shopgate/engage/core';import I18n from"../../index";jest.unmock('@shopgate/engage/core/helpers/i18n');describe('<FormatDate />',function(){var locales={greeting:'Hello {date}'};var lang='en-US';var timestamp=123456789000;var formattedDate='Nov 29, 1973';var format='medium';i18n.init({locales:locales,lang:lang});describe('Given the component was mounted to the DOM',function(){var renderedElement;it('should match snapshot',function(){renderedElement=mount(React.createElement(I18n.Provider,null,React.createElement("div",null,React.createElement("span",{className:"only-date"},React.createElement(I18n.Date,{timestamp:timestamp,format:format})),React.createElement("span",{className:"text-with-date"},React.createElement(I18n.Text,{string:"greeting"},React.createElement(I18n.Date,{forKey:"date",timestamp:timestamp,format:format}))))));expect(renderedElement).toMatchSnapshot();});it('should render formatted date',function(){var text=renderedElement.find('.only-date').text();expect(text).toBe(formattedDate);});it('should render within translated text',function(){var text=renderedElement.find('.text-with-date').text();expect(text).toBe("Hello ".concat(formattedDate));});});});
1
+ import React from'react';import{mount}from'enzyme';import{i18n}from'@shopgate/engage/core';import I18n from"../../index";jest.unmock('@shopgate/engage/core/helpers/i18n');describe('<FormatDate />',function(){var locales={greeting:'Hello {date}'};var lang='en-US';var timestamp=123456789000;var formattedDate='Nov 29, 1973';var format='medium';i18n.init({locales:locales,lang:lang});describe('Given the component was mounted to the DOM',function(){var renderedElement;it('should match snapshot',function(){renderedElement=mount(/*#__PURE__*/React.createElement(I18n.Provider,null,/*#__PURE__*/React.createElement("div",null,/*#__PURE__*/React.createElement("span",{className:"only-date"},/*#__PURE__*/React.createElement(I18n.Date,{timestamp:timestamp,format:format})),/*#__PURE__*/React.createElement("span",{className:"text-with-date"},/*#__PURE__*/React.createElement(I18n.Text,{string:"greeting"},/*#__PURE__*/React.createElement(I18n.Date,{forKey:"date",timestamp:timestamp,format:format}))))));expect(renderedElement).toMatchSnapshot();});it('should render formatted date',function(){var text=renderedElement.find('.only-date').text();expect(text).toBe(formattedDate);});it('should render within translated text',function(){var text=renderedElement.find('.text-with-date').text();expect(text).toBe("Hello ".concat(formattedDate));});});});
@@ -2,4 +2,4 @@ import React,{memo}from'react';import PropTypes from'prop-types';import{i18n}fro
2
2
  * Formats a number.
3
3
  * @param {Object} props The component props.
4
4
  * @returns {JSX}
5
- */var FormatNumber=function FormatNumber(_ref){var className=_ref.className,number=_ref.number,fractions=_ref.fractions;if(!className){FormatNumber.format({number:number,fractions:fractions});}return React.createElement("span",{className:className},FormatNumber.format({number:number,fractions:fractions}));};FormatNumber.format=function(props){if(!i18n.ready){return props.number;}return i18n.number(props.number,props.fractions);};FormatNumber.defaultProps={className:null,fractions:0};export default memo(FormatNumber);
5
+ */var FormatNumber=function FormatNumber(_ref){var className=_ref.className,number=_ref.number,fractions=_ref.fractions;if(!className){FormatNumber.format({number:number,fractions:fractions});}return/*#__PURE__*/React.createElement("span",{className:className},FormatNumber.format({number:number,fractions:fractions}));};FormatNumber.format=function(props){if(!i18n.ready){return props.number;}return i18n.number(props.number,props.fractions);};FormatNumber.defaultProps={className:null,fractions:0};export default/*#__PURE__*/memo(FormatNumber);
@@ -1,6 +1,6 @@
1
- function _slicedToArray(arr,i){return _arrayWithHoles(arr)||_iterableToArrayLimit(arr,i)||_nonIterableRest();}function _nonIterableRest(){throw new TypeError("Invalid attempt to destructure non-iterable instance");}function _iterableToArrayLimit(arr,i){var _arr=[];var _n=true;var _d=false;var _e=undefined;try{for(var _i=arr[Symbol.iterator](),_s;!(_n=(_s=_i.next()).done);_n=true){_arr.push(_s.value);if(i&&_arr.length===i)break;}}catch(err){_d=true;_e=err;}finally{try{if(!_n&&_i["return"]!=null)_i["return"]();}finally{if(_d)throw _e;}}return _arr;}function _arrayWithHoles(arr){if(Array.isArray(arr))return arr;}import React from'react';import{mount}from'enzyme';import{i18n}from'@shopgate/engage/core';import I18n from"../../index";import FormatNumber from"./index";jest.unmock('@shopgate/engage/core/helpers/i18n');describe('<FormatNumber>',function(){describe('i18n not ready',function(){it('should return same number and className when i18n is not ready',function(){var component=mount(React.createElement(FormatNumber,{number:1,fractions:2,className:"some-class"}));expect(component.html().includes('some-class')).toBe(true);expect(component.text().includes('1')).toBe(true);expect(component).toMatchSnapshot();});});describe('i18n ready',function(){i18n.init({locales:{},lang:'en-US'});var pairs=[[1,'1.00',2],[0.1,'0.10',2],[1,'1.000',3],[1,'1',0]];/**
1
+ function _slicedToArray(arr,i){return _arrayWithHoles(arr)||_iterableToArrayLimit(arr,i)||_unsupportedIterableToArray(arr,i)||_nonIterableRest();}function _nonIterableRest(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");}function _unsupportedIterableToArray(o,minLen){if(!o)return;if(typeof o==="string")return _arrayLikeToArray(o,minLen);var n=Object.prototype.toString.call(o).slice(8,-1);if(n==="Object"&&o.constructor)n=o.constructor.name;if(n==="Map"||n==="Set")return Array.from(o);if(n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return _arrayLikeToArray(o,minLen);}function _arrayLikeToArray(arr,len){if(len==null||len>arr.length)len=arr.length;for(var i=0,arr2=new Array(len);i<len;i++){arr2[i]=arr[i];}return arr2;}function _iterableToArrayLimit(arr,i){var _i=arr==null?null:typeof Symbol!=="undefined"&&arr[Symbol.iterator]||arr["@@iterator"];if(_i==null)return;var _arr=[];var _n=true;var _d=false;var _s,_e;try{for(_i=_i.call(arr);!(_n=(_s=_i.next()).done);_n=true){_arr.push(_s.value);if(i&&_arr.length===i)break;}}catch(err){_d=true;_e=err;}finally{try{if(!_n&&_i["return"]!=null)_i["return"]();}finally{if(_d)throw _e;}}return _arr;}function _arrayWithHoles(arr){if(Array.isArray(arr))return arr;}import React from'react';import{mount}from'enzyme';import{i18n}from'@shopgate/engage/core';import I18n from"../../index";import FormatNumber from"./index";jest.unmock('@shopgate/engage/core/helpers/i18n');describe('<FormatNumber>',function(){describe('i18n not ready',function(){it('should return same number and className when i18n is not ready',function(){var component=mount(/*#__PURE__*/React.createElement(FormatNumber,{number:1,fractions:2,className:"some-class"}));expect(component.html().includes('some-class')).toBe(true);expect(component.text().includes('1')).toBe(true);expect(component).toMatchSnapshot();});});describe('i18n ready',function(){i18n.init({locales:{},lang:'en-US'});var pairs=[[1,'1.00',2],[0.1,'0.10',2],[1,'1.000',3],[1,'1',0]];/**
2
2
  * Makes a component.
3
3
  * @param {number} number Number
4
4
  * @param {number} fractions Decimal points.
5
5
  * @returns {Object}
6
- */var makeComponent=function makeComponent(number,fractions){return mount(React.createElement(I18n.Provider,null,React.createElement("div",null,React.createElement(FormatNumber,{number:number,fractions:fractions}))));};pairs.forEach(function(_ref){var _ref2=_slicedToArray(_ref,3),input=_ref2[0],expexted=_ref2[1],fractions=_ref2[2];it("should format ".concat(input," into ").concat(expexted),function(){var component=makeComponent(input,fractions);expect(component.text().includes("".concat(expexted))).toBe(true);expect(component).toMatchSnapshot();});});});});
6
+ */var makeComponent=function makeComponent(number,fractions){return mount(/*#__PURE__*/React.createElement(I18n.Provider,null,/*#__PURE__*/React.createElement("div",null,/*#__PURE__*/React.createElement(FormatNumber,{number:number,fractions:fractions}))));};pairs.forEach(function(_ref){var _ref2=_slicedToArray(_ref,3),input=_ref2[0],expexted=_ref2[1],fractions=_ref2[2];it("should format ".concat(input," into ").concat(expexted),function(){var component=makeComponent(input,fractions);expect(component.text().includes("".concat(expexted))).toBe(true);expect(component).toMatchSnapshot();});});});});
@@ -1,5 +1,5 @@
1
- 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,{memo}from'react';import PropTypes from'prop-types';import{i18n}from'@shopgate/engage/core';/**
1
+ var _excluded=["className"];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,{memo}from'react';import PropTypes from'prop-types';import{i18n}from'@shopgate/engage/core';/**
2
2
  * Formats a price.
3
3
  * @param {Object} props The component props.
4
4
  * @returns {JSX}
5
- */var FormatPrice=function FormatPrice(props){var className=props.className,formatProps=_objectWithoutProperties(props,["className"]);if(!className){return FormatPrice.format(formatProps);}return React.createElement("span",{className:className},FormatPrice.format(formatProps));};FormatPrice.format=function(_ref){var price=_ref.price,currency=_ref.currency,fractions=_ref.fractions;if(!i18n.ready){return price;}return i18n.price(price,currency,fractions);};FormatPrice.defaultProps={className:null,fractions:true};export default memo(FormatPrice);
5
+ */var FormatPrice=function FormatPrice(props){var className=props.className,formatProps=_objectWithoutProperties(props,_excluded);if(!className){return FormatPrice.format(formatProps);}return/*#__PURE__*/React.createElement("span",{className:className},FormatPrice.format(formatProps));};FormatPrice.format=function(_ref){var price=_ref.price,currency=_ref.currency,fractions=_ref.fractions;if(!i18n.ready){return price;}return i18n.price(price,currency,fractions);};FormatPrice.defaultProps={className:null,fractions:true};export default/*#__PURE__*/memo(FormatPrice);
@@ -1 +1 @@
1
- import React from'react';import{mount}from'enzyme';import{i18n}from'@shopgate/engage/core';import I18n from"../../index";jest.unmock('@shopgate/engage/core/helpers/i18n');describe('<FormatPrice />',function(){var locales={greeting:'Hello {price}'};var price=1234.56;var formattedPrice='€1,234.56';var currency='EUR';var lang='en-US';i18n.init({locales:locales,lang:lang});describe('Given the component was mounted to the DOM',function(){var renderedElement;it('should match snapshot',function(){renderedElement=mount(React.createElement(I18n.Provider,null,React.createElement("div",null,React.createElement("span",{className:"only-price"},React.createElement(I18n.Price,{price:price,currency:currency})),React.createElement("span",{className:"text-with-price"},React.createElement(I18n.Text,{string:"greeting"},React.createElement(I18n.Price,{forKey:"price",price:price,currency:currency}))))));expect(renderedElement).toMatchSnapshot();});it('should render formatted price',function(){var text=renderedElement.find('.only-price').text();expect(text).toBe(formattedPrice);});it('should render within translated text',function(){var text=renderedElement.find('.text-with-price').text();expect(text).toBe("Hello ".concat(formattedPrice));});});});
1
+ import React from'react';import{mount}from'enzyme';import{i18n}from'@shopgate/engage/core';import I18n from"../../index";jest.unmock('@shopgate/engage/core/helpers/i18n');describe('<FormatPrice />',function(){var locales={greeting:'Hello {price}'};var price=1234.56;var formattedPrice='€1,234.56';var currency='EUR';var lang='en-US';i18n.init({locales:locales,lang:lang});describe('Given the component was mounted to the DOM',function(){var renderedElement;it('should match snapshot',function(){renderedElement=mount(/*#__PURE__*/React.createElement(I18n.Provider,null,/*#__PURE__*/React.createElement("div",null,/*#__PURE__*/React.createElement("span",{className:"only-price"},/*#__PURE__*/React.createElement(I18n.Price,{price:price,currency:currency})),/*#__PURE__*/React.createElement("span",{className:"text-with-price"},/*#__PURE__*/React.createElement(I18n.Text,{string:"greeting"},/*#__PURE__*/React.createElement(I18n.Price,{forKey:"price",price:price,currency:currency}))))));expect(renderedElement).toMatchSnapshot();});it('should render formatted price',function(){var text=renderedElement.find('.only-price').text();expect(text).toBe(formattedPrice);});it('should render within translated text',function(){var text=renderedElement.find('.text-with-price').text();expect(text).toBe("Hello ".concat(formattedPrice));});});});
@@ -2,4 +2,4 @@ import React,{Fragment,memo}from'react';import PropTypes from'prop-types';import
2
2
  * Formats a time.
3
3
  * @param {Object} props The component props.
4
4
  * @returns {JSX}
5
- */var FormatTime=function FormatTime(_ref){var timestamp=_ref.timestamp,format=_ref.format;return React.createElement(Fragment,null,FormatTime.format({timestamp:timestamp,format:format}));};FormatTime.format=function(_ref2){var timestamp=_ref2.timestamp,format=_ref2.format;if(!i18n.ready){return timestamp;}return i18n.time(timestamp,format);};FormatTime.defaultProps={format:'medium'};export default memo(FormatTime);
5
+ */var FormatTime=function FormatTime(_ref){var timestamp=_ref.timestamp,format=_ref.format;return/*#__PURE__*/React.createElement(Fragment,null,FormatTime.format({timestamp:timestamp,format:format}));};FormatTime.format=function(_ref2){var timestamp=_ref2.timestamp,format=_ref2.format;if(!i18n.ready){return timestamp;}return i18n.time(timestamp,format);};FormatTime.defaultProps={format:'medium'};export default/*#__PURE__*/memo(FormatTime);
@@ -1,2 +1,2 @@
1
1
  import React from'react';import{mount}from'enzyme';import{i18n}from'@shopgate/engage/core';import I18n from"../../index";jest.unmock('@shopgate/engage/core/helpers/i18n');describe('<FormatTime />',function(){var locales={greeting:'Hello {time}'};var timestamp=new Date('Dec 25, 1999 04:25:45').getTime();var formattedTime='4:25:45 AM';var format='medium';var lang='en-US';i18n.init({locales:locales,lang:lang});describe('Given the component was mounted to the DOM',function(){// TODO: Handle snapshot test.
2
- var renderedElement=mount(React.createElement(I18n.Provider,null,React.createElement("div",null,React.createElement("span",{className:"only-time"},React.createElement(I18n.Time,{timestamp:timestamp,format:format})),React.createElement("span",{className:"text-with-time"},React.createElement(I18n.Text,{string:"greeting"},React.createElement(I18n.Time,{forKey:"time",timestamp:timestamp,format:format}))))));it('should render formatted time',function(){var text=renderedElement.find('.only-time').text();expect(text).toBe(formattedTime);});it('should render within translated text',function(){var text=renderedElement.find('.text-with-time').text();expect(text).toBe("Hello ".concat(formattedTime));});});});
2
+ var renderedElement=mount(/*#__PURE__*/React.createElement(I18n.Provider,null,/*#__PURE__*/React.createElement("div",null,/*#__PURE__*/React.createElement("span",{className:"only-time"},/*#__PURE__*/React.createElement(I18n.Time,{timestamp:timestamp,format:format})),/*#__PURE__*/React.createElement("span",{className:"text-with-time"},/*#__PURE__*/React.createElement(I18n.Text,{string:"greeting"},/*#__PURE__*/React.createElement(I18n.Time,{forKey:"time",timestamp:timestamp,format:format}))))));it('should render formatted time',function(){var text=renderedElement.find('.only-time').text();expect(text).toBe(formattedTime);});it('should render within translated text',function(){var text=renderedElement.find('.text-with-time').text();expect(text).toBe("Hello ".concat(formattedTime));});});});
@@ -1,16 +1,16 @@
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{i18n}from'@shopgate/engage/core';import{logger}from'@shopgate/pwa-core/helpers';/**
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{i18n}from'@shopgate/engage/core';import{logger}from'@shopgate/pwa-core/helpers';/**
2
2
  * A React component that provides child components with i18n features.
3
3
  * @returns {React.Component}
4
- */var I18nProvider=/*#__PURE__*/function(_Component){_inherits(I18nProvider,_Component);/**
4
+ */var I18nProvider=/*#__PURE__*/function(_Component){_inherits(I18nProvider,_Component);var _super=_createSuper(I18nProvider);/**
5
5
  * @inheritDoc
6
- */function I18nProvider(props){var _this;_classCallCheck(this,I18nProvider);_this=_possibleConstructorReturn(this,_getPrototypeOf(I18nProvider).call(this,props));// eslint-disable-next-line react/prop-types
6
+ */function I18nProvider(props){var _this;_classCallCheck(this,I18nProvider);_this=_super.call(this,props);// eslint-disable-next-line react/prop-types
7
7
  _defineProperty(_assertThisInitialized(_this),"getI18nInstance",function(){return{__:i18n.text,_p:i18n.price,_d:i18n.date,_t:i18n.time,_n:i18n.number};});if(_this.props.lang||_this.props.locales){logger.warn("===== I18nProvider deprecated =====\nI18nProvider and it's related components (@shopgate/pwa-common/component/I18n) or context types are deprecated and will be removed in @shopgate/engage v7.0.0.\nPlease use { i18n } from @shopgate/engage/core.\n===================================\n ");}return _this;}/**
8
8
  * Provides context for child components.
9
9
  * @returns {Object}
10
10
  */_createClass(I18nProvider,[{key:"getChildContext",value:function getChildContext(){return{i18n:this.getI18nInstance};}/**
11
11
  * Gets a shortcut to i18n functionality with preset language.
12
12
  * @returns {Object}
13
- */},{key:"render",/**
13
+ */},{key:"render",value:/**
14
14
  * Renders the component.
15
15
  * @returns {JSX}
16
- */value:function render(){var children=this.props.children;return children?React.cloneElement(children):null;}}]);return I18nProvider;}(Component);_defineProperty(I18nProvider,"childContextTypes",{i18n:PropTypes.func.isRequired});_defineProperty(I18nProvider,"defaultProps",{children:null});export{I18nProvider as default};
16
+ */function render(){var children=this.props.children;return children?/*#__PURE__*/React.cloneElement(children):null;}}]);return I18nProvider;}(Component);_defineProperty(I18nProvider,"childContextTypes",{i18n:PropTypes.func.isRequired});_defineProperty(I18nProvider,"defaultProps",{children:null});export{I18nProvider as default};
@@ -1 +1 @@
1
- import React from'react';import{shallow}from'enzyme';import{i18n as i18nHelper}from'@shopgate/engage/core';import I18nProvider from"./index";jest.unmock('@shopgate/engage/core/helpers/i18n');describe('<I18nProvider />',function(){var locales={greeting:'Guten Tag {name}'};var lang='de-DE';i18nHelper.init({locales:locales,lang:lang});describe('Given the component was mounted to the DOM',function(){var renderedElement;var renderedInstance;it('should match snapshot',function(){renderedElement=shallow(React.createElement(I18nProvider,null));renderedInstance=renderedElement.instance();expect(renderedElement).toMatchSnapshot();});it('should provide access to i18n via context',function(){var _renderedInstance$get=renderedInstance.getChildContext(),i18n=_renderedInstance$get.i18n;expect(i18n).toEqual(renderedInstance.getI18nInstance);});it('should translate when calling an instance method',function(){var _renderedInstance$get2=renderedInstance.getI18nInstance(),__=_renderedInstance$get2.__;var translated=__('greeting',{name:'Test'});expect(translated).toBe('Guten Tag Test');});});});
1
+ import React from'react';import{shallow}from'enzyme';import{i18n as i18nHelper}from'@shopgate/engage/core';import I18nProvider from"./index";jest.unmock('@shopgate/engage/core/helpers/i18n');describe('<I18nProvider />',function(){var locales={greeting:'Guten Tag {name}'};var lang='de-DE';i18nHelper.init({locales:locales,lang:lang});describe('Given the component was mounted to the DOM',function(){var renderedElement;var renderedInstance;it('should match snapshot',function(){renderedElement=shallow(/*#__PURE__*/React.createElement(I18nProvider,null));renderedInstance=renderedElement.instance();expect(renderedElement).toMatchSnapshot();});it('should provide access to i18n via context',function(){var _renderedInstance$get=renderedInstance.getChildContext(),i18n=_renderedInstance$get.i18n;expect(i18n).toEqual(renderedInstance.getI18nInstance);});it('should translate when calling an instance method',function(){var _renderedInstance$get2=renderedInstance.getI18nInstance(),__=_renderedInstance$get2.__;var translated=__('greeting',{name:'Test'});expect(translated).toBe('Guten Tag Test');});});});
@@ -3,4 +3,4 @@ import React,{Fragment}from'react';import PropTypes from'prop-types';/**
3
3
  * @param {Object} props The component props.
4
4
  * @param {Object} context The component context.
5
5
  * @returns {JSX}
6
- */var Placeholder=function Placeholder(props){return React.createElement(Fragment,null,props.children);};Placeholder.format=function(props){return React.createElement(Placeholder,props);};export default Placeholder;
6
+ */var Placeholder=function Placeholder(props){return/*#__PURE__*/React.createElement(Fragment,null,props.children);};Placeholder.format=function(props){return/*#__PURE__*/React.createElement(Placeholder,props);};export default Placeholder;
@@ -1 +1 @@
1
- import React from'react';import{mount}from'enzyme';import{i18n}from'@shopgate/engage/core';import I18n from"../../index";jest.unmock('@shopgate/engage/core/helpers/i18n');describe('<Placeholder />',function(){var locales={greeting:'Hello {world}'};var lang='en-US';i18n.init({locales:locales,lang:lang});describe('Given the component was mounted to the DOM',function(){var renderedElement;it('should render',function(){renderedElement=mount(React.createElement(I18n.Provider,null,React.createElement(I18n.Text,{string:"greeting"},React.createElement(I18n.Placeholder,{forKey:"world"},React.createElement("strong",null,"WORLD")),"/")));expect(renderedElement).toMatchSnapshot();});it('should render with a placeholder text',function(){var text=renderedElement.find('strong').text();expect(text).toBe('WORLD');});});});
1
+ import React from'react';import{mount}from'enzyme';import{i18n}from'@shopgate/engage/core';import I18n from"../../index";jest.unmock('@shopgate/engage/core/helpers/i18n');describe('<Placeholder />',function(){var locales={greeting:'Hello {world}'};var lang='en-US';i18n.init({locales:locales,lang:lang});describe('Given the component was mounted to the DOM',function(){var renderedElement;it('should render',function(){renderedElement=mount(/*#__PURE__*/React.createElement(I18n.Provider,null,/*#__PURE__*/React.createElement(I18n.Text,{string:"greeting"},/*#__PURE__*/React.createElement(I18n.Placeholder,{forKey:"world"},/*#__PURE__*/React.createElement("strong",null,"WORLD")),"/")));expect(renderedElement).toMatchSnapshot();});it('should render with a placeholder text',function(){var text=renderedElement.find('strong').text();expect(text).toBe('WORLD');});});});
@@ -1,4 +1,4 @@
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;}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{logger}from'@shopgate/pwa-core';import{i18n}from'@shopgate/engage/core';/**
1
+ var _excluded=["string","children","params","className","role"];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;}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{logger}from'@shopgate/pwa-core';import{i18n}from'@shopgate/engage/core';/**
2
2
  * Returns a translation and replaces placeholder with children output.
3
3
  * It is possible to either pass JSX components or plain strings as replacement for
4
4
  * the translation keys.
@@ -10,8 +10,8 @@ function _defineProperty(obj,key,value){if(key in obj){Object.defineProperty(obj
10
10
  * provided by I18n.
11
11
  * @param {string} props.className Additional classes to append to the translated wrapper element.
12
12
  * @returns {JSX} The translated string as JSX component.
13
- */var Translate=function Translate(_ref){var string=_ref.string,children=_ref.children,params=_ref.params,className=_ref.className,role=_ref.role,rest=_objectWithoutProperties(_ref,["string","children","params","className","role"]);if(typeof string!=='string'||string.length===0){return string;}if(!i18n.ready){return React.createElement("span",_extends({className:className,role:role},rest),string);}// When the input string is malformed, rather return the original string then raising an error.
13
+ */var Translate=function Translate(_ref){var string=_ref.string,children=_ref.children,params=_ref.params,className=_ref.className,role=_ref.role,rest=_objectWithoutProperties(_ref,_excluded);if(typeof string!=='string'||string.length===0){return string;}if(!i18n.ready){return/*#__PURE__*/React.createElement("span",_extends({className:className,role:role},rest),string);}// When the input string is malformed, rather return the original string then raising an error.
14
14
  var formatted=string;try{// First replace every occurrence of a translation key with a separator.
15
15
  var separator='__%S%__';var childrenArray=React.Children.toArray(children);var values=childrenArray.reduce(function(obj,child){return child.props&&child.props.forKey?_extends({},obj,_defineProperty({},child.props.forKey,separator)):obj;},_extends({},params));// Split the tokenized string at the separators.
16
16
  var stringParts=i18n.text(string,values).split(separator);// Create a new array containing the separated chunks of the text and merge the substitutions.
17
- formatted=stringParts.reduce(function(result,text,index){return[].concat(result,[text,childrenArray[index]]);},[]);}catch(e){logger.error('i18n error for string %s',string,e);}return React.createElement("span",_extends({className:className,role:role},rest),formatted);};Translate.defaultProps={children:null,className:null,params:{},role:null};export default Translate;
17
+ formatted=stringParts.reduce(function(result,text,index){return[].concat(result,[text,childrenArray[index]]);},[]);}catch(e){logger.error('i18n error for string %s',string,e);}return/*#__PURE__*/React.createElement("span",_extends({className:className,role:role},rest),formatted);};Translate.defaultProps={children:null,className:null,params:{},role:null};export default Translate;
@@ -1 +1 @@
1
- import React from'react';import{mount}from'enzyme';import{i18n}from'@shopgate/engage/core';import I18n from"../../index";jest.unmock('@shopgate/engage/core/helpers/i18n');describe('<Translate />',function(){var locales={greeting:'Hello {name}'};i18n.init({locales:locales,lang:'en-US'});describe('Given the component was mounted to the DOM',function(){var renderedElement;it('should match snapshot',function(){renderedElement=mount(React.createElement(I18n.Provider,null,React.createElement(I18n.Text,{string:"greeting",params:{name:'Test'}})));expect(renderedElement).toMatchSnapshot();});it('should render translated text',function(){var text=renderedElement.find(I18n.Text).text();expect(text).toBe('Hello Test');});});});
1
+ import React from'react';import{mount}from'enzyme';import{i18n}from'@shopgate/engage/core';import I18n from"../../index";jest.unmock('@shopgate/engage/core/helpers/i18n');describe('<Translate />',function(){var locales={greeting:'Hello {name}'};i18n.init({locales:locales,lang:'en-US'});describe('Given the component was mounted to the DOM',function(){var renderedElement;it('should match snapshot',function(){renderedElement=mount(/*#__PURE__*/React.createElement(I18n.Provider,null,/*#__PURE__*/React.createElement(I18n.Text,{string:"greeting",params:{name:'Test'}})));expect(renderedElement).toMatchSnapshot();});it('should render translated text',function(){var text=renderedElement.find(I18n.Text).text();expect(text).toBe('Hello Test');});});});
@@ -6,4 +6,4 @@ import React from'react';import PropTypes from'prop-types';import styles from"./
6
6
  * @param {string} [props.viewBox] The viewBox attribute passed to the SVG
7
7
  * @param {number} [props.size=24] The icon size
8
8
  * @returns {JSX}
9
- */var Icon=function Icon(props){return React.createElement("svg",{className:"".concat(styles," ").concat(props.className," common__icon"),viewBox:props.viewBox,xmlns:"http://www.w3.org/2000/svg",dangerouslySetInnerHTML:{__html:props.content},style:{fontSize:props.size,fill:props.color}});};Icon.defaultProps={className:'',color:null,viewBox:'0 0 24 24',size:'inherit'};export default Icon;
9
+ */var Icon=function Icon(props){return/*#__PURE__*/React.createElement("svg",{className:"".concat(styles," ").concat(props.className," common__icon"),viewBox:props.viewBox,xmlns:"http://www.w3.org/2000/svg",dangerouslySetInnerHTML:{__html:props.content},style:{fontSize:props.size,fill:props.color}});};Icon.defaultProps={className:'',color:null,viewBox:'0 0 24 24',size:'inherit'};export default Icon;
@@ -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 _slicedToArray(arr,i){return _arrayWithHoles(arr)||_iterableToArrayLimit(arr,i)||_nonIterableRest();}function _nonIterableRest(){throw new TypeError("Invalid attempt to destructure non-iterable instance");}function _iterableToArrayLimit(arr,i){var _arr=[];var _n=true;var _d=false;var _e=undefined;try{for(var _i=arr[Symbol.iterator](),_s;!(_n=(_s=_i.next()).done);_n=true){_arr.push(_s.value);if(i&&_arr.length===i)break;}}catch(err){_d=true;_e=err;}finally{try{if(!_n&&_i["return"]!=null)_i["return"]();}finally{if(_d)throw _e;}}return _arr;}function _arrayWithHoles(arr){if(Array.isArray(arr))return arr;}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{themeColors}from'@shopgate/pwa-common/helpers/config';import{getFullImageSource,logger}from'@shopgate/engage/core';import Transition from"../Transition";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 _slicedToArray(arr,i){return _arrayWithHoles(arr)||_iterableToArrayLimit(arr,i)||_unsupportedIterableToArray(arr,i)||_nonIterableRest();}function _nonIterableRest(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");}function _unsupportedIterableToArray(o,minLen){if(!o)return;if(typeof o==="string")return _arrayLikeToArray(o,minLen);var n=Object.prototype.toString.call(o).slice(8,-1);if(n==="Object"&&o.constructor)n=o.constructor.name;if(n==="Map"||n==="Set")return Array.from(o);if(n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return _arrayLikeToArray(o,minLen);}function _arrayLikeToArray(arr,len){if(len==null||len>arr.length)len=arr.length;for(var i=0,arr2=new Array(len);i<len;i++){arr2[i]=arr[i];}return arr2;}function _iterableToArrayLimit(arr,i){var _i=arr==null?null:typeof Symbol!=="undefined"&&arr[Symbol.iterator]||arr["@@iterator"];if(_i==null)return;var _arr=[];var _n=true;var _d=false;var _s,_e;try{for(_i=_i.call(arr);!(_n=(_s=_i.next()).done);_n=true){_arr.push(_s.value);if(i&&_arr.length===i)break;}}catch(err){_d=true;_e=err;}finally{try{if(!_n&&_i["return"]!=null)_i["return"]();}finally{if(_d)throw _e;}}return _arr;}function _arrayWithHoles(arr){if(Array.isArray(arr))return arr;}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{themeColors}from'@shopgate/pwa-common/helpers/config';import{getFullImageSource,logger}from'@shopgate/engage/core';import Transition from"../Transition";import styles from"./style";/**
2
2
  * The image component. It supports lazy and progressive loading of images.
3
- */var Image=/*#__PURE__*/function(_Component){_inherits(Image,_Component);/**
3
+ */var Image=/*#__PURE__*/function(_Component){_inherits(Image,_Component);var _super=_createSuper(Image);/**
4
4
  * Sets the initial state, to not render image slider component yet.
5
5
  * @param {Object} props The components props.
6
- */function Image(props){var _this;_classCallCheck(this,Image);_this=_possibleConstructorReturn(this,_getPrototypeOf(Image).call(this,props));logger.assert(!props.srcmap,'Use of srcmap prop is deprecated. Use resolutions instead');/**
6
+ */function Image(props){var _this;_classCallCheck(this,Image);_this=_super.call(this,props);logger.assert(!props.srcmap,'Use of srcmap prop is deprecated. Use resolutions instead');/**
7
7
  * The initial component state.
8
8
  * Pre-loads all resolutions if already cached will
9
9
  * set the state for the resolution to true.
@@ -15,10 +15,10 @@ function _typeof(obj){if(typeof Symbol==="function"&&typeof Symbol.iterator==="s
15
15
  */},{key:"componentWillUnmount",value:function componentWillUnmount(){this.mounted=false;}/**
16
16
  * Sets the image ratio based on width and height.
17
17
  * @return {number} The image ratio.
18
- */},{key:"imageLoaded",/**
18
+ */},{key:"imageRatio",get:function get(){if(this.props.ratio){var _this$props$ratio=_slicedToArray(this.props.ratio,2),x=_this$props$ratio[0],y=_this$props$ratio[1];return(y/x*100).toFixed(3);}var _this$props$resolutio=this.props.resolutions[this.props.resolutions.length-1],width=_this$props$resolutio.width,height=_this$props$resolutio.height;return(height/width*100).toFixed(3);}/**
19
19
  * Image loaded event listener
20
20
  * @param {number} resolutionIndex The index of the loaded resolution
21
- */value:function imageLoaded(resolutionIndex){if(!this.mounted){return;}this.setState(function(_ref){var loaded=_ref.loaded;return{loaded:loaded.map(function(entry,index){if(resolutionIndex===index){return true;}return entry;})};});if(!this.props.srcmap&&resolutionIndex===this.props.resolutions.length-1){this.props.highestResolutionLoaded();}if(this.props.srcmap&&resolutionIndex===this.props.srcmap.length-1){this.props.highestResolutionLoaded();}}/**
21
+ */},{key:"imageLoaded",value:function imageLoaded(resolutionIndex){if(!this.mounted){return;}this.setState(function(_ref){var loaded=_ref.loaded;return{loaded:loaded.map(function(entry,index){if(resolutionIndex===index){return true;}return entry;})};});if(!this.props.srcmap&&resolutionIndex===this.props.resolutions.length-1){this.props.highestResolutionLoaded();}if(this.props.srcmap&&resolutionIndex===this.props.srcmap.length-1){this.props.highestResolutionLoaded();}}/**
22
22
  * Pre-loads the given image in given resolution
23
23
  * @param {string} src Source to the image.
24
24
  * @param {number} resolutionIndex The index of the loaded resolution.
@@ -28,4 +28,4 @@ function _typeof(obj){if(typeof Symbol==="function"&&typeof Symbol.iterator==="s
28
28
  * @returns {JSX}
29
29
  */},{key:"render",value:function render(){var index=this.state.loaded.lastIndexOf(true);var src=null;if(index>-1){src=!this.props.srcmap?getFullImageSource(this.props.src,this.props.resolutions[index]):this.props.srcmap[index];}var innerImage=null;if(src&&!this.props.forcePlaceholder){// Applies a blur effect to every resolution that has the blur flag set to true.
30
30
  var inlineStyles={width:'100%'};if(!this.props.srcmap&&this.props.resolutions[index].blur){inlineStyles.filter="blur(".concat(this.props.resolutions[index].blur,"px)");}// Renders the actual image.
31
- innerImage=React.createElement("img",{className:"".concat(this.props.classNameImg||styles.image," common__image"),src:src,style:inlineStyles,alt:this.props.alt,role:"presentation","data-test-id":"image"});}if(this.props.unwrapped){return innerImage;}var containerStyle=styles.container(this.props.backgroundColor,"".concat(this.imageRatio,"%"));if(!this.props.animating||!this.props.transition){return React.createElement("div",{className:"".concat(containerStyle," ").concat(this.props.className)},innerImage);}return React.createElement(Transition,{childrenStyles:this.props.transition,className:"".concat(containerStyle," ").concat(this.props.className)},innerImage);}},{key:"imageRatio",get:function get(){if(this.props.ratio){var _this$props$ratio=_slicedToArray(this.props.ratio,2),x=_this$props$ratio[0],y=_this$props$ratio[1];return(y/x*100).toFixed(3);}var _this$props$resolutio=this.props.resolutions[this.props.resolutions.length-1],width=_this$props$resolutio.width,height=_this$props$resolutio.height;return(height/width*100).toFixed(3);}}]);return Image;}(Component);_defineProperty(Image,"defaultProps",{alt:null,animating:true,backgroundColor:themeColors.placeholder,className:'',classNameImg:'',forcePlaceholder:false,highestResolutionLoaded:function highestResolutionLoaded(){},onError:null,onLoad:null,ratio:null,resolutions:[{width:50,height:50,blur:2},{width:440,height:440}],src:null,srcmap:null,transition:null,unwrapped:false});export default Image;
31
+ innerImage=/*#__PURE__*/React.createElement("img",{className:"".concat(this.props.classNameImg||styles.image," common__image"),src:src,style:inlineStyles,alt:this.props.alt,role:"presentation","data-test-id":"image"});}if(this.props.unwrapped){return innerImage;}var containerStyle=styles.container(this.props.backgroundColor,"".concat(this.imageRatio,"%"));if(!this.props.animating||!this.props.transition){return/*#__PURE__*/React.createElement("div",{className:"".concat(containerStyle," ").concat(this.props.className)},innerImage);}return/*#__PURE__*/React.createElement(Transition,{childrenStyles:this.props.transition,className:"".concat(containerStyle," ").concat(this.props.className)},innerImage);}}]);return Image;}(Component);_defineProperty(Image,"defaultProps",{alt:null,animating:true,backgroundColor:themeColors.placeholder,className:'',classNameImg:'',forcePlaceholder:false,highestResolutionLoaded:function highestResolutionLoaded(){},onError:null,onLoad:null,ratio:null,resolutions:[{width:50,height:50,blur:2},{width:440,height:440}],src:null,srcmap:null,transition:null,unwrapped:false});export default Image;
@@ -1,3 +1,3 @@
1
- function _classCallCheck(instance,Constructor){if(!(instance instanceof Constructor)){throw new TypeError("Cannot call a class as a function");}}import React from'react';import{mount}from'enzyme';import Image from"./index";window.requestAnimationFrame=function(){};jest.unmock('@shopgate/pwa-core');describe('<Image />',function(){var loadedImages=[];global.Image=/*#__PURE__*/function(){/**
1
+ 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 _classCallCheck(instance,Constructor){if(!(instance instanceof Constructor)){throw new TypeError("Cannot call a class as a function");}}import React from'react';import{mount}from'enzyme';import Image from"./index";window.requestAnimationFrame=function(){};jest.unmock('@shopgate/pwa-core');describe('<Image />',function(){var loadedImages=[];global.Image=/*#__PURE__*/function(){/**
2
2
  * Saves all images on init
3
- */function _class(){_classCallCheck(this,_class);this.complete=true;loadedImages.push(this);}return _class;}();it('should render placeholders if forced to',function(){var wrapper=mount(React.createElement(Image,{src:"foo/bar",forcePlaceholder:true}));expect(wrapper).toMatchSnapshot();expect(wrapper.find('img').length).toEqual(0);});it('should render placeholders if src is null',function(){var wrapper=mount(React.createElement(Image,{src:"foo/bar"}));expect(wrapper).toMatchSnapshot();expect(wrapper.find('img').length).toEqual(1);});});
3
+ */function _class(){_classCallCheck(this,_class);this.complete=true;loadedImages.push(this);}return _createClass(_class);}();it('should render placeholders if forced to',function(){var wrapper=mount(/*#__PURE__*/React.createElement(Image,{src:"foo/bar",forcePlaceholder:true}));expect(wrapper).toMatchSnapshot();expect(wrapper.find('img').length).toEqual(0);});it('should render placeholders if src is null',function(){var wrapper=mount(/*#__PURE__*/React.createElement(Image,{src:"foo/bar"}));expect(wrapper).toMatchSnapshot();expect(wrapper.find('img').length).toEqual(1);});});