@shopgate/pwa-common 6.19.2 → 6.20.0-beta.11

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
package/App.js CHANGED
@@ -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 _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);}import React,{Component}from'react';import PropTypes from'prop-types';import{Provider}from'react-redux';import ErrorBoundary from"./components/ErrorBoundary";import{appDidStart}from"./action-creators/app";import I18n from"./components/I18n";/**
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);}import React,{Component}from'react';import PropTypes from'prop-types';import{Provider}from'react-redux';import ErrorBoundary from"./components/ErrorBoundary";import{appDidStart}from"./action-creators/app";import I18n from"./components/I18n";/**
2
2
  * The application component.
3
3
  * It sets up the store and the react router. The router's children (routes) come from
4
4
  * the theme's Main.jsx file which uses this component as the root element.
5
5
  * @returns {JSX}
6
- */var App=/*#__PURE__*/function(_Component){_inherits(App,_Component);function App(){_classCallCheck(this,App);return _possibleConstructorReturn(this,_getPrototypeOf(App).apply(this,arguments));}_createClass(App,[{key:"componentDidMount",/**
6
+ */var App=/*#__PURE__*/function(_Component){_inherits(App,_Component);var _super=_createSuper(App);function App(){_classCallCheck(this,App);return _super.apply(this,arguments);}_createClass(App,[{key:"componentDidMount",value:/**
7
7
  * Registers the component for the native events and fires the onload AppCommand.
8
- */value:function componentDidMount(){this.props.store.dispatch(appDidStart("".concat(window.location.pathname).concat(window.location.search)));}/**
8
+ */function componentDidMount(){this.props.store.dispatch(appDidStart("".concat(window.location.pathname).concat(window.location.search)));}/**
9
9
  * Renders the component.
10
10
  * @returns {JSX}
11
- */},{key:"render",value:function render(){return React.createElement(ErrorBoundary,{key:"error.root",store:this.props.store,isRoot:true},React.createElement(Provider,{store:this.props.store},React.createElement(I18n.Provider,null,React.createElement("div",null,this.props.children))));}}]);return App;}(Component);export default App;
11
+ */},{key:"render",value:function render(){return/*#__PURE__*/React.createElement(ErrorBoundary,{key:"error.root",store:this.props.store,isRoot:true},/*#__PURE__*/React.createElement(Provider,{store:this.props.store},/*#__PURE__*/React.createElement(I18n.Provider,null,/*#__PURE__*/React.createElement("div",null,this.props.children))));}}]);return App;}(Component);export default App;
@@ -4,7 +4,7 @@ import{logger}from'@shopgate/pwa-core/helpers';import{historyPush,historyReset}f
4
4
  * @return {Function}
5
5
  */export default function handleLink(payload){var allowExternalLinks=arguments.length>1&&arguments[1]!==undefined?arguments[1]:false;return function(dispatch){var link=payload.link;if(!link){return;}// cast to string
6
6
  link=String(link);var pathname;if(link.startsWith('http')){// Link is common URL schema.
7
- if(allowExternalLinks){dispatch(historyPush({pathname:link}));return;}try{var _ref=new URL(link);pathname=_ref.pathname;}catch(linkParseError){logger.error("Could not parse link ".concat(link),linkParseError);}}else{// Remove the deeplink protocol from the link.
7
+ if(allowExternalLinks){dispatch(historyPush({pathname:link}));return;}try{var _URL=new URL(link);pathname=_URL.pathname;}catch(linkParseError){logger.error("Could not parse link ".concat(link),linkParseError);}}else{// Remove the deeplink protocol from the link.
8
8
  pathname=link.replace(/^(.*:)(\/\/)?/,'/');}if(!pathname||pathname===INDEX_PATH||pathname.startsWith(INDEX_PATH_DEEPLINK)){/**
9
9
  * Special treatment for the index page. To avoid multiple index pages within the history,
10
10
  * the parsed link helper will only emit the openLink events for the link to inform the
@@ -18,4 +18,4 @@ var modal=getModalById(getState(),id);if(modal){/**
18
18
  * Usually the promise which is returned by showModal resolves with a boolean value
19
19
  * when the user interacts with its buttons. Since promise handling is optional for the
20
20
  * action, the promise can't be rejected, but resolves with null.
21
- */logger.warn('Modal creation aborted since an identical one was already added to the modal stack',options);return Promise.resolve(null);}var enrichedOptions=_extends({},defaultModalOptions,{},options,{id:id});dispatch(createModal(enrichedOptions));return new Promise(function(resolve,reject){promiseMap.set(id,{resolve:resolve,reject:reject});});};}/** @mixes {MutableFunction} */export default mutable(showModal);
21
+ */logger.warn('Modal creation aborted since an identical one was already added to the modal stack',options);return Promise.resolve(null);}var enrichedOptions=_extends({},defaultModalOptions,options,{id:id});dispatch(createModal(enrichedOptions));return new Promise(function(resolve,reject){promiseMap.set(id,{resolve:resolve,reject:reject});});};}/** @mixes {MutableFunction} */export default mutable(showModal);
@@ -1,4 +1,4 @@
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;}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;}import pathMatch from'path-match';/**
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;}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;}import pathMatch from'path-match';/**
2
2
  * Class to maintain the routes that should be protected by authentication.
3
3
  */var AuthRoutes=/*#__PURE__*/function(){/**
4
4
  * Constructor
@@ -1,4 +1,4 @@
1
- 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;}import logGroup from'@shopgate/pwa-core/helpers/logGroup';/**
1
+ 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;}import logGroup from'@shopgate/pwa-core/helpers/logGroup';/**
2
2
  * Class to maintain different configurations
3
3
  */var Configuration=/*#__PURE__*/function(){/**
4
4
  * Constructor
@@ -1,4 +1,4 @@
1
- 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;}/* eslint-disable extra-rules/potential-point-free */ /**
1
+ 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;}/* eslint-disable extra-rules/potential-point-free */ /**
2
2
  * Class to maintain embedded media within DOM containers.
3
3
  */var EmbeddedMedia=/*#__PURE__*/function(){/**
4
4
  * Constructor
@@ -1,4 +1,4 @@
1
- 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;}/**
1
+ 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;}/**
2
2
  * Class to maintain the persisted redux reducers.
3
3
  */var PersistedReducers=/*#__PURE__*/function(){/**
4
4
  * Constructor.
@@ -1,4 +1,4 @@
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;}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;}import pathMatch from'path-match';/**
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;}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;}import pathMatch from'path-match';/**
2
2
  * The Redirects class.
3
3
  */var Redirects=/*#__PURE__*/function(){/**
4
4
  * The constructor.
@@ -1,4 +1,4 @@
1
- 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;}import{logger}from'@shopgate/pwa-core/helpers';import{isRelativePosition,isAbsolutePosition}from"../../helpers/dom";import styles from"./style";/**
1
+ 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;}import{logger}from'@shopgate/pwa-core/helpers';import{isRelativePosition,isAbsolutePosition}from"../../helpers/dom";import styles from"./style";/**
2
2
  * The MediaProvider base class.
3
3
  */var MediaProvider=/*#__PURE__*/function(){/**
4
4
  * Constructor.
@@ -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 _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);}import MediaProvider from"./MediaProvider";var scriptUrl='https://player.vimeo.com/api/player.js';/**
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);}import MediaProvider from"./MediaProvider";var scriptUrl='https://player.vimeo.com/api/player.js';/**
2
2
  * The Vimeo media provider class.
3
- */var VimeoMediaProvider=/*#__PURE__*/function(_MediaProvider){_inherits(VimeoMediaProvider,_MediaProvider);/**
3
+ */var VimeoMediaProvider=/*#__PURE__*/function(_MediaProvider){_inherits(VimeoMediaProvider,_MediaProvider);var _super=_createSuper(VimeoMediaProvider);/**
4
4
  * Constructor.
5
- */function VimeoMediaProvider(){var _this;_classCallCheck(this,VimeoMediaProvider);_this=_possibleConstructorReturn(this,_getPrototypeOf(VimeoMediaProvider).call(this));// Need to check Vimeo.Player presence later
5
+ */function VimeoMediaProvider(){var _this;_classCallCheck(this,VimeoMediaProvider);_this=_super.call(this);// Need to check Vimeo.Player presence later
6
6
  _this.isPending=true;_this.remoteScriptUrl=scriptUrl;_this.deferred=[];return _this;}/**
7
7
  * @inheritDoc
8
8
  */_createClass(VimeoMediaProvider,[{key:"onScriptLoaded",value:function onScriptLoaded(){var _this2=this;this.isPending=false;if(this.deferred.length){this.deferred.forEach(function(container){_this2.add(container);});this.deferred=[];}}/**
@@ -1,11 +1,11 @@
1
- function _classCallCheck(instance,Constructor){if(!(instance instanceof Constructor)){throw new TypeError("Cannot call a class as a function");}}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{JSDOM}from'jsdom';import{Vimeo}from"./index";var videos=['https://player.vimeo.com/video/484765967?color=32ac5c&title=0&byline=0&portrait=0','https://player.vimeo.com/video/224765967?color=32ac5c&title=0&byline=0&portrait=0'];/**
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");}}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{JSDOM}from'jsdom';import{Vimeo}from"./index";var videos=['https://player.vimeo.com/video/484765967?color=32ac5c&title=0&byline=0&portrait=0','https://player.vimeo.com/video/224765967?color=32ac5c&title=0&byline=0&portrait=0'];/**
2
2
  * Creates a DOM container with iframes.
3
3
  * @param {Array} srcs A list of video URLs.
4
4
  * @return {Object}
5
5
  */var createContainer=function createContainer(srcs){var html=srcs.map(function(src){return"<iframe src=\"".concat(src,"\"></iframe>");}).join('');return new JSDOM(html).window.document;};describe('Vimeo media provider',function(){var instance;var pauseMock=jest.fn();/**
6
6
  * Updates the global Vimeo player object.
7
7
  * @param {boolean} [available=true] Should the vimeo player object be injected.
8
- */var updatePlayer=function updatePlayer(){var available=arguments.length>0&&arguments[0]!==undefined?arguments[0]:true;if(available){var _temp;window.Vimeo={Player:(_temp=function MockPlayer(){_classCallCheck(this,MockPlayer);_defineProperty(this,"pause",function(){pauseMock();});},_temp)};return;}delete window.Vimeo;};/**
8
+ */var updatePlayer=function updatePlayer(){var available=arguments.length>0&&arguments[0]!==undefined?arguments[0]:true;if(available){window.Vimeo={Player:/*#__PURE__*/_createClass(function MockPlayer(){_classCallCheck(this,MockPlayer);_defineProperty(this,"pause",function(){pauseMock();});})};return;}delete window.Vimeo;};/**
9
9
  * Creates a Vimeo media provider instance.
10
10
  * @param {boolean} [addPlayer=true] Should the vimeo player object be injected.
11
11
  */var createInstance=function createInstance(){var addPlayer=arguments.length>0&&arguments[0]!==undefined?arguments[0]:true;updatePlayer(addPlayer);document.getElementsByTagName('html')[0].innerHTML='';instance=new Vimeo();instance.responsify=jest.fn();};beforeEach(function(){jest.clearAllMocks();createInstance();});describe('.constructor()',function(){it('should construct as expected',function(){createInstance(false);expect(instance.containers).toBeInstanceOf(Map);expect(instance.isPending).toBe(true);expect(instance.deferred).toEqual([]);});});describe('.add()',function(){it('should add multiple containers as expected',function(){var containerOne=createContainer([videos[0]]);var containerTwo=createContainer([videos[1]]);var iframesOne=containerOne.querySelectorAll('iframe');var iframesTwo=containerTwo.querySelectorAll('iframe');instance.add(containerOne);instance.add(containerTwo);instance.add(containerOne);expect(instance.containers.size).toBe(2);expect(instance.containers.get(containerOne)).toEqual([expect.any(window.Vimeo.Player)]);expect(instance.containers.get(containerTwo)).toEqual([expect.any(window.Vimeo.Player)]);expect(instance.responsify).toHaveBeenCalledWith(iframesOne[0]);expect(instance.responsify).toHaveBeenCalledWith(iframesTwo[0]);});it('should defer addition of a container if the player is not ready',function(){createInstance(false);var container=createContainer([videos[0]]);instance.add(container);expect(instance.containers.size).toBe(0);expect(instance.deferred).toEqual([container]);});it('should not add a container when it does not contain a video',function(){var container=new JSDOM('<p>Some HTML content</p>').window.document;instance.add(container);expect(instance.containers.size).toBe(0);});});describe('.remove()',function(){it('should remove containers as expected',function(){var containerOne=createContainer([videos[0]]);var containerTwo=createContainer([videos[1]]);instance.add(containerOne);instance.add(containerTwo);instance.remove(containerTwo);expect(instance.containers.size).toBe(1);expect(instance.containers.get(containerTwo)).toBeUndefined();expect(instance.containers.get(containerOne)).toEqual([expect.any(window.Vimeo.Player)]);instance.remove(containerOne);expect(instance.containers.size).toBe(0);});});describe('.stop()',function(){it('should stop the videos within mutiple containers',function(){var containerOne=createContainer(videos);var containerTwo=createContainer([videos[1]]);instance.add(containerOne);instance.add(containerTwo);instance.stop();expect(pauseMock).toHaveBeenCalledTimes(3);});});describe('.onScriptLoaded()',function(){it('should mark as ready (not pending)',function(){instance.onScriptLoaded();expect(instance.isPending).toBe(false);});it('should run deferred containers on script ready',function(){instance.deferred=['container 1','container 2'];jest.spyOn(instance,'add').mockReturnValue(true);instance.onScriptLoaded();expect(instance.add).toHaveBeenCalledTimes(2);expect(instance.add).nthCalledWith(1,'container 1');expect(instance.add).nthCalledWith(2,'container 2');expect(instance.deferred).toHaveLength(0);});});});
@@ -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 _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);}import URLSearchParams from'url-search-params';import MediaProvider from"./MediaProvider";/**
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);}import URLSearchParams from'url-search-params';import MediaProvider from"./MediaProvider";/**
2
2
  * The YouTube media provider class.
3
- */var YouTubeMediaProvider=/*#__PURE__*/function(_MediaProvider){_inherits(YouTubeMediaProvider,_MediaProvider);function YouTubeMediaProvider(){_classCallCheck(this,YouTubeMediaProvider);return _possibleConstructorReturn(this,_getPrototypeOf(YouTubeMediaProvider).apply(this,arguments));}_createClass(YouTubeMediaProvider,[{key:"add",/**
3
+ */var YouTubeMediaProvider=/*#__PURE__*/function(_MediaProvider){_inherits(YouTubeMediaProvider,_MediaProvider);var _super=_createSuper(YouTubeMediaProvider);function YouTubeMediaProvider(){_classCallCheck(this,YouTubeMediaProvider);return _super.apply(this,arguments);}_createClass(YouTubeMediaProvider,[{key:"add",value:/**
4
4
  * Add a DOM container with embedded videos.
5
5
  * @override
6
6
  * @param {ParentNode} container A DOM container.
7
7
  * @returns {YouTubeMediaProvider}
8
- */value:function add(container){var _this=this;var iframes=container.querySelectorAll('iframe[src*="youtube.com"], iframe[src*="youtube-nocookie.com"]');if(!iframes.length){return this;}// Update the video urls to enable stopping videos via the event API.
8
+ */function add(container){var _this=this;var iframes=container.querySelectorAll('iframe[src*="youtube.com"], iframe[src*="youtube-nocookie.com"]');if(!iframes.length){return this;}// Update the video urls to enable stopping videos via the event API.
9
9
  iframes.forEach(function(iframe,index){_this.responsify(iframe);var src=iframe.src;var _src$split=src.split('?'),_src$split2=_slicedToArray(_src$split,2),url=_src$split2[0],query=_src$split2[1];var urlParams=new URLSearchParams(query);// Enable the js api to allow sending events to the iframe.
10
10
  urlParams.set('enablejsapi',1);// Enable controls to avoid the iframe not being resumable because of controls=0 param on ios.
11
11
  urlParams.set('controls',1);iframes[index].src="".concat(url,"?").concat(urlParams.toString());});this.containers.set(container,iframes);return this;}/**
@@ -1,4 +1,4 @@
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{JSDOM}from'jsdom';import URLSearchParams from'url-search-params';import{YouTube}from"./index";var videos=['https://youtube.com/fooo?enablejsapi=0&controls=0','https://youtube.com/fooo?controls=0&enablejsapi=0','https://youtube.com/fooo','https://youtube-nocookie.com/fooo?controls=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{JSDOM}from'jsdom';import URLSearchParams from'url-search-params';import{YouTube}from"./index";var videos=['https://youtube.com/fooo?enablejsapi=0&controls=0','https://youtube.com/fooo?controls=0&enablejsapi=0','https://youtube.com/fooo','https://youtube-nocookie.com/fooo?controls=0'];/**
2
2
  * Creates a DOM container with iframes.
3
3
  * @param {Array} srcs A list of video URLs.
4
4
  * @return {Object}
@@ -1,6 +1,6 @@
1
- function _typeof(obj){if(typeof Symbol==="function"&&typeof Symbol.iterator==="symbol"){_typeof=function _typeof(obj){return typeof obj;};}else{_typeof=function _typeof(obj){return obj&&typeof Symbol==="function"&&obj.constructor===Symbol&&obj!==Symbol.prototype?"symbol":typeof obj;};}return _typeof(obj);}function _classCallCheck(instance,Constructor){if(!(instance instanceof Constructor)){throw new TypeError("Cannot call a class as a function");}}function _defineProperties(target,props){for(var i=0;i<props.length;i++){var descriptor=props[i];descriptor.enumerable=descriptor.enumerable||false;descriptor.configurable=true;if("value"in descriptor)descriptor.writable=true;Object.defineProperty(target,descriptor.key,descriptor);}}function _createClass(Constructor,protoProps,staticProps){if(protoProps)_defineProperties(Constructor.prototype,protoProps);if(staticProps)_defineProperties(Constructor,staticProps);return Constructor;}function _possibleConstructorReturn(self,call){if(call&&(_typeof(call)==="object"||typeof call==="function")){return call;}return _assertThisInitialized(self);}function _assertThisInitialized(self){if(self===void 0){throw new ReferenceError("this hasn't been initialised - super() hasn't been called");}return self;}function _getPrototypeOf(o){_getPrototypeOf=Object.setPrototypeOf?Object.getPrototypeOf:function _getPrototypeOf(o){return o.__proto__||Object.getPrototypeOf(o);};return _getPrototypeOf(o);}function _inherits(subClass,superClass){if(typeof superClass!=="function"&&superClass!==null){throw new TypeError("Super expression must either be null or a function");}subClass.prototype=Object.create(superClass&&superClass.prototype,{constructor:{value:subClass,writable:true,configurable:true}});if(superClass)_setPrototypeOf(subClass,superClass);}function _setPrototypeOf(o,p){_setPrototypeOf=Object.setPrototypeOf||function _setPrototypeOf(o,p){o.__proto__=p;return o;};return _setPrototypeOf(o,p);}function _defineProperty(obj,key,value){if(key in obj){Object.defineProperty(obj,key,{value:value,enumerable:true,configurable:true,writable:true});}else{obj[key]=value;}return obj;}import React,{Component}from'react';import PropTypes from'prop-types';import Transition from'react-inline-transition-group';import style 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 _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'react-inline-transition-group';import style from"./style";/**
2
2
  * Backdrop component.
3
- */var Backdrop=/*#__PURE__*/function(_Component){_inherits(Backdrop,_Component);function Backdrop(){_classCallCheck(this,Backdrop);return _possibleConstructorReturn(this,_getPrototypeOf(Backdrop).apply(this,arguments));}_createClass(Backdrop,[{key:"shouldComponentUpdate",/**
3
+ */var Backdrop=/*#__PURE__*/function(_Component){_inherits(Backdrop,_Component);var _super=_createSuper(Backdrop);function Backdrop(){_classCallCheck(this,Backdrop);return _super.apply(this,arguments);}_createClass(Backdrop,[{key:"shouldComponentUpdate",value:/**
4
4
  * The component prop types.
5
5
  * @type {Object}
6
6
  */ /**
@@ -10,7 +10,7 @@ function _typeof(obj){if(typeof Symbol==="function"&&typeof Symbol.iterator==="s
10
10
  * Only update when the `isVisible` prop changes.
11
11
  * @param {Object} nextProps The next set of component props.
12
12
  * @return {boolean}
13
- */value:function shouldComponentUpdate(nextProps){return this.props.isVisible!==nextProps.isVisible;}/**
13
+ */function shouldComponentUpdate(nextProps){return this.props.isVisible!==nextProps.isVisible;}/**
14
14
  * Renders the component.
15
15
  * @returns {JSX}
16
- */},{key:"render",value:function render(){var opacity=this.props.opacity/100;var transition={base:{background:this.props.color,opacity:0,transition:"opacity ".concat(this.props.duration,"ms ease-out"),zIndex:this.props.level},appear:{opacity:opacity},enter:{opacity:opacity},leave:{opacity:0}};var className="".concat(style," ").concat(this.props.className," common__backdrop");return React.createElement(Transition,{childrenStyles:transition},this.props.isVisible?React.createElement("div",{"data-test-id":"Backdrop","aria-hidden":true,className:className,onClick:this.props.onClick}):null);}}]);return Backdrop;}(Component);_defineProperty(Backdrop,"defaultProps",{className:'',color:'#000',duration:200,isVisible:false,level:2,onClick:function onClick(){},opacity:50});export default Backdrop;
16
+ */},{key:"render",value:function render(){var opacity=this.props.opacity/100;var transition={base:{background:this.props.color,opacity:0,transition:"opacity ".concat(this.props.duration,"ms ease-out"),zIndex:this.props.level},appear:{opacity:opacity},enter:{opacity:opacity},leave:{opacity:0}};var className="".concat(style," ").concat(this.props.className," common__backdrop");return/*#__PURE__*/React.createElement(Transition,{childrenStyles:transition},this.props.isVisible?/*#__PURE__*/React.createElement("div",{"data-test-id":"Backdrop","aria-hidden":true,className:className,onClick:this.props.onClick}):null);}}]);return Backdrop;}(Component);_defineProperty(Backdrop,"defaultProps",{className:'',color:'#000',duration:200,isVisible:false,level:2,onClick:function onClick(){},opacity:50});export default Backdrop;
@@ -1 +1 @@
1
- import React from'react';import{shallow}from'enzyme';import Backdrop from"./index";describe('<Backdrop />',function(){var mockOpen;beforeEach(function(){mockOpen=jest.fn();});it('should render',function(){var wrapper=shallow(React.createElement(Backdrop,{isVisible:true}));expect(wrapper).toMatchSnapshot();});it('should execute callback when Backdrop is clicked',function(){var wrapper=shallow(React.createElement(Backdrop,{isVisible:true,onClick:mockOpen}));wrapper.find('div').simulate('click');expect(mockOpen).toBeCalled();});});
1
+ import React from'react';import{shallow}from'enzyme';import Backdrop from"./index";describe('<Backdrop />',function(){var mockOpen;beforeEach(function(){mockOpen=jest.fn();});it('should render',function(){var wrapper=shallow(/*#__PURE__*/React.createElement(Backdrop,{isVisible:true}));expect(wrapper).toMatchSnapshot();});it('should execute callback when Backdrop is clicked',function(){var wrapper=shallow(/*#__PURE__*/React.createElement(Backdrop,{isVisible:true,onClick:mockOpen}));wrapper.find('div').simulate('click');expect(mockOpen).toBeCalled();});});
@@ -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 _objectWithoutProperties(source,excluded){if(source==null)return{};var target=_objectWithoutPropertiesLoose(source,excluded);var key,i;if(Object.getOwnPropertySymbols){var sourceSymbolKeys=Object.getOwnPropertySymbols(source);for(i=0;i<sourceSymbolKeys.length;i++){key=sourceSymbolKeys[i];if(excluded.indexOf(key)>=0)continue;if(!Object.prototype.propertyIsEnumerable.call(source,key))continue;target[key]=source[key];}}return target;}function _objectWithoutPropertiesLoose(source,excluded){if(source==null)return{};var target={};var sourceKeys=Object.keys(source);var key,i;for(i=0;i<sourceKeys.length;i++){key=sourceKeys[i];if(excluded.indexOf(key)>=0)continue;target[key]=source[key];}return target;}function _extends(){_extends=Object.assign||function(target){for(var i=1;i<arguments.length;i++){var source=arguments[i];for(var key in source){if(Object.prototype.hasOwnProperty.call(source,key)){target[key]=source[key];}}}return target;};return _extends.apply(this,arguments);}function _classCallCheck(instance,Constructor){if(!(instance instanceof Constructor)){throw new TypeError("Cannot call a class as a function");}}function _defineProperties(target,props){for(var i=0;i<props.length;i++){var descriptor=props[i];descriptor.enumerable=descriptor.enumerable||false;descriptor.configurable=true;if("value"in descriptor)descriptor.writable=true;Object.defineProperty(target,descriptor.key,descriptor);}}function _createClass(Constructor,protoProps,staticProps){if(protoProps)_defineProperties(Constructor.prototype,protoProps);if(staticProps)_defineProperties(Constructor,staticProps);return Constructor;}function _possibleConstructorReturn(self,call){if(call&&(_typeof(call)==="object"||typeof call==="function")){return call;}return _assertThisInitialized(self);}function _assertThisInitialized(self){if(self===void 0){throw new ReferenceError("this hasn't been initialised - super() hasn't been called");}return self;}function _getPrototypeOf(o){_getPrototypeOf=Object.setPrototypeOf?Object.getPrototypeOf:function _getPrototypeOf(o){return o.__proto__||Object.getPrototypeOf(o);};return _getPrototypeOf(o);}function _inherits(subClass,superClass){if(typeof superClass!=="function"&&superClass!==null){throw new TypeError("Super expression must either be null or a function");}subClass.prototype=Object.create(superClass&&superClass.prototype,{constructor:{value:subClass,writable:true,configurable:true}});if(superClass)_setPrototypeOf(subClass,superClass);}function _setPrototypeOf(o,p){_setPrototypeOf=Object.setPrototypeOf||function _setPrototypeOf(o,p){o.__proto__=p;return o;};return _setPrototypeOf(o,p);}function _defineProperty(obj,key,value){if(key in obj){Object.defineProperty(obj,key,{value:value,enumerable:true,configurable:true,writable:true});}else{obj[key]=value;}return obj;}import React,{Component}from'react';import PropTypes from'prop-types';import style from"./style";/**
1
+ function _typeof(obj){"@babel/helpers - typeof";return _typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(obj){return typeof obj;}:function(obj){return obj&&"function"==typeof Symbol&&obj.constructor===Symbol&&obj!==Symbol.prototype?"symbol":typeof obj;},_typeof(obj);}var _excluded=["children","testId","className","disabled","onClick"];function _extends(){_extends=Object.assign||function(target){for(var i=1;i<arguments.length;i++){var source=arguments[i];for(var key in source){if(Object.prototype.hasOwnProperty.call(source,key)){target[key]=source[key];}}}return target;};return _extends.apply(this,arguments);}function _objectWithoutProperties(source,excluded){if(source==null)return{};var target=_objectWithoutPropertiesLoose(source,excluded);var key,i;if(Object.getOwnPropertySymbols){var sourceSymbolKeys=Object.getOwnPropertySymbols(source);for(i=0;i<sourceSymbolKeys.length;i++){key=sourceSymbolKeys[i];if(excluded.indexOf(key)>=0)continue;if(!Object.prototype.propertyIsEnumerable.call(source,key))continue;target[key]=source[key];}}return target;}function _objectWithoutPropertiesLoose(source,excluded){if(source==null)return{};var target={};var sourceKeys=Object.keys(source);var key,i;for(i=0;i<sourceKeys.length;i++){key=sourceKeys[i];if(excluded.indexOf(key)>=0)continue;target[key]=source[key];}return target;}function _classCallCheck(instance,Constructor){if(!(instance instanceof Constructor)){throw new TypeError("Cannot call a class as a function");}}function _defineProperties(target,props){for(var i=0;i<props.length;i++){var descriptor=props[i];descriptor.enumerable=descriptor.enumerable||false;descriptor.configurable=true;if("value"in descriptor)descriptor.writable=true;Object.defineProperty(target,descriptor.key,descriptor);}}function _createClass(Constructor,protoProps,staticProps){if(protoProps)_defineProperties(Constructor.prototype,protoProps);if(staticProps)_defineProperties(Constructor,staticProps);Object.defineProperty(Constructor,"prototype",{writable:false});return Constructor;}function _inherits(subClass,superClass){if(typeof superClass!=="function"&&superClass!==null){throw new TypeError("Super expression must either be null or a function");}subClass.prototype=Object.create(superClass&&superClass.prototype,{constructor:{value:subClass,writable:true,configurable:true}});Object.defineProperty(subClass,"prototype",{writable:false});if(superClass)_setPrototypeOf(subClass,superClass);}function _setPrototypeOf(o,p){_setPrototypeOf=Object.setPrototypeOf||function _setPrototypeOf(o,p){o.__proto__=p;return o;};return _setPrototypeOf(o,p);}function _createSuper(Derived){var hasNativeReflectConstruct=_isNativeReflectConstruct();return function _createSuperInternal(){var Super=_getPrototypeOf(Derived),result;if(hasNativeReflectConstruct){var NewTarget=_getPrototypeOf(this).constructor;result=Reflect.construct(Super,arguments,NewTarget);}else{result=Super.apply(this,arguments);}return _possibleConstructorReturn(this,result);};}function _possibleConstructorReturn(self,call){if(call&&(_typeof(call)==="object"||typeof call==="function")){return call;}else if(call!==void 0){throw new TypeError("Derived constructors may only return object or undefined");}return _assertThisInitialized(self);}function _assertThisInitialized(self){if(self===void 0){throw new ReferenceError("this hasn't been initialised - super() hasn't been called");}return self;}function _isNativeReflectConstruct(){if(typeof Reflect==="undefined"||!Reflect.construct)return false;if(Reflect.construct.sham)return false;if(typeof Proxy==="function")return true;try{Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}));return true;}catch(e){return false;}}function _getPrototypeOf(o){_getPrototypeOf=Object.setPrototypeOf?Object.getPrototypeOf:function _getPrototypeOf(o){return o.__proto__||Object.getPrototypeOf(o);};return _getPrototypeOf(o);}function _defineProperty(obj,key,value){if(key in obj){Object.defineProperty(obj,key,{value:value,enumerable:true,configurable:true,writable:true});}else{obj[key]=value;}return obj;}import React,{Component}from'react';import PropTypes from'prop-types';import style from"./style";/**
2
2
  * The button component.
3
- */var Button=/*#__PURE__*/function(_Component){_inherits(Button,_Component);function Button(){_classCallCheck(this,Button);return _possibleConstructorReturn(this,_getPrototypeOf(Button).apply(this,arguments));}_createClass(Button,[{key:"render",/**
4
- * Renders the component.
5
- * @returns {JSX}
6
- */value:function render(){return(// eslint-disable-next-line react/button-has-type
7
- React.createElement("button",_extends({"data-test-id":this.props.testId},this.buttonProps),this.props.children));}},{key:"buttonProps",/**
3
+ */var Button=/*#__PURE__*/function(_Component){_inherits(Button,_Component);var _super=_createSuper(Button);function Button(){_classCallCheck(this,Button);return _super.apply(this,arguments);}_createClass(Button,[{key:"buttonProps",get:/**
8
4
  * Getter for the calculated button props.
9
5
  * @returns {Object}
10
- */get:function get(){var _this$props=this.props,children=_this$props.children,testId=_this$props.testId,className=_this$props.className,disabled=_this$props.disabled,onClick=_this$props.onClick,props=_objectWithoutProperties(_this$props,["children","testId","className","disabled","onClick"]);var buttonProps=_extends({className:"".concat(className," ").concat(style," common__button"),disabled:disabled,onClick:disabled?null:onClick},props);return buttonProps;}}]);return Button;}(Component);_defineProperty(Button,"defaultProps",{className:'',disabled:false,onClick:null,testId:'Button'});export default Button;
6
+ */function get(){var _this$props=this.props,children=_this$props.children,testId=_this$props.testId,className=_this$props.className,disabled=_this$props.disabled,onClick=_this$props.onClick,props=_objectWithoutProperties(_this$props,_excluded);var buttonProps=_extends({className:"".concat(className," ").concat(style," common__button"),disabled:disabled,onClick:disabled?null:onClick},props);return buttonProps;}/**
7
+ * Renders the component.
8
+ * @returns {JSX}
9
+ */},{key:"render",value:function render(){return/*#__PURE__*/ (// eslint-disable-next-line react/button-has-type
10
+ React.createElement("button",_extends({"data-test-id":this.props.testId},this.buttonProps),this.props.children));}}]);return Button;}(Component);_defineProperty(Button,"defaultProps",{className:'',disabled:false,onClick:null,testId:'Button'});export default Button;
@@ -1 +1 @@
1
- import React from'react';import{shallow}from'enzyme';import Button from"./index";describe('<Button />',function(){it('should render the button',function(){var wrapper=shallow(React.createElement(Button,null,"My content"));expect(wrapper).toMatchSnapshot();expect(wrapper.find('button').length).toBe(1);});it('should render the button in disabled state',function(){var wrapper=shallow(React.createElement(Button,{disabled:true},"My content"));expect(wrapper).toMatchSnapshot();expect(wrapper.find('button[disabled]').length).toBe(1);});it('should trigger the click event',function(){var callback=jest.fn();var wrapper=shallow(React.createElement(Button,{onClick:callback},"My content"));wrapper.simulate('click');expect(wrapper).toMatchSnapshot();expect(callback).toHaveBeenCalled();});it('should not trigger the click event when disabled',function(){var callback=jest.fn();var wrapper=shallow(React.createElement(Button,{disabled:true,onClick:callback},"My content"));wrapper.simulate('click');expect(wrapper).toMatchSnapshot();expect(callback).not.toHaveBeenCalled();});});
1
+ import React from'react';import{shallow}from'enzyme';import Button from"./index";describe('<Button />',function(){it('should render the button',function(){var wrapper=shallow(/*#__PURE__*/React.createElement(Button,null,"My content"));expect(wrapper).toMatchSnapshot();expect(wrapper.find('button').length).toBe(1);});it('should render the button in disabled state',function(){var wrapper=shallow(/*#__PURE__*/React.createElement(Button,{disabled:true},"My content"));expect(wrapper).toMatchSnapshot();expect(wrapper.find('button[disabled]').length).toBe(1);});it('should trigger the click event',function(){var callback=jest.fn();var wrapper=shallow(/*#__PURE__*/React.createElement(Button,{onClick:callback},"My content"));wrapper.simulate('click');expect(wrapper).toMatchSnapshot();expect(callback).toHaveBeenCalled();});it('should not trigger the click event when disabled',function(){var callback=jest.fn();var wrapper=shallow(/*#__PURE__*/React.createElement(Button,{disabled:true,onClick:callback},"My content"));wrapper.simulate('click');expect(wrapper).toMatchSnapshot();expect(callback).not.toHaveBeenCalled();});});
@@ -1,15 +1,15 @@
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 classNames from'classnames';/**
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 classNames from'classnames';/**
2
2
  * Base checkbox component.
3
3
  * @type {Object}
4
- */var Checkbox=/*#__PURE__*/function(_Component){_inherits(Checkbox,_Component);/**
4
+ */var Checkbox=/*#__PURE__*/function(_Component){_inherits(Checkbox,_Component);var _super=_createSuper(Checkbox);/**
5
5
  * The checkbox component contructor.
6
6
  * It checks if the checkbox is a controlled or uncontrolled input and sets an internal state if
7
7
  * uncontrolled to keep track of th checked-state.
8
8
  * @param {Object} props The Checkbox properties.
9
- */function Checkbox(props){var _this;_classCallCheck(this,Checkbox);_this=_possibleConstructorReturn(this,_getPrototypeOf(Checkbox).call(this,props));_defineProperty(_assertThisInitialized(_this),"isChecked",function(){return typeof _this.props.defaultChecked==='undefined'?_this.props.checked// Controlled.
9
+ */function Checkbox(props){var _this;_classCallCheck(this,Checkbox);_this=_super.call(this,props);_defineProperty(_assertThisInitialized(_this),"isChecked",function(){return typeof _this.props.defaultChecked==='undefined'?_this.props.checked// Controlled.
10
10
  :_this.state.checked// Uncontrolled.
11
11
  ;});_defineProperty(_assertThisInitialized(_this),"handleCheck",function(){if(_this.props.disabled){return;}var checked=!_this.isChecked();if(typeof _this.props.defaultChecked!=='undefined'){// Uncontrolled.
12
- _this.setState({checked:checked});}_this.props.onCheck(checked);});_defineProperty(_assertThisInitialized(_this),"renderIcon",function(){return _this.isChecked()?_this.props.checkedIcon:_this.props.uncheckedIcon;});_defineProperty(_assertThisInitialized(_this),"renderInput",function(){var _assertThisInitialize=_assertThisInitialized(_this),name=_assertThisInitialize.props.name,isChecked=_assertThisInitialize.isChecked;return _this.props.name?React.createElement("input",{className:"input",type:"hidden",name:name,value:isChecked()?1:0}):null;});_defineProperty(_assertThisInitialized(_this),"renderLabelIfItIsOnThe",function(side){return _this.props.labelPosition===side?_this.props.label:null;});if(typeof props.defaultChecked!=='undefined'){// Uncontrolled input.
12
+ _this.setState({checked:checked});}_this.props.onCheck(checked);});_defineProperty(_assertThisInitialized(_this),"renderIcon",function(){return _this.isChecked()?_this.props.checkedIcon:_this.props.uncheckedIcon;});_defineProperty(_assertThisInitialized(_this),"renderInput",function(){var _assertThisInitialize=_assertThisInitialized(_this),name=_assertThisInitialize.props.name,isChecked=_assertThisInitialize.isChecked;return _this.props.name?/*#__PURE__*/React.createElement("input",{className:"input",type:"hidden",name:name,value:isChecked()?1:0}):null;});_defineProperty(_assertThisInitialized(_this),"renderLabelIfItIsOnThe",function(side){return _this.props.labelPosition===side?_this.props.label:null;});if(typeof props.defaultChecked!=='undefined'){// Uncontrolled input.
13
13
  _this.state={checked:props.defaultChecked};}else{// Controlled input
14
14
  _this.state={checked:props.checked};}return _this;}/**
15
15
  * Make sure state is updated with new checked value when input is controlled
@@ -18,7 +18,7 @@ _this.state={checked:props.checked};}return _this;}/**
18
18
  if(typeof this.props.defaultChecked==='undefined'){if(this.state.checked!==nextProps.checked){this.setState({checked:nextProps.checked});}}}/**
19
19
  * Returns if the checkbox is checked or not.
20
20
  * @return {boolean} Is the checkbox checked?
21
- */},{key:"render",/**
21
+ */},{key:"render",value:/**
22
22
  * Renders the checkbox component.
23
23
  * @returns {JSX}
24
- */value:function render(){return React.createElement("div",{className:classNames(this.props.className,'checkbox','common__checkbox'),onClick:this.handleCheck,"aria-hidden":true},this.renderInput(),this.renderLabelIfItIsOnThe('left'),this.renderIcon(),this.renderLabelIfItIsOnThe('right'));}}]);return Checkbox;}(Component);_defineProperty(Checkbox,"defaultProps",{checked:undefined,className:undefined,defaultChecked:undefined,disabled:false,label:null,labelPosition:'left',name:undefined,onCheck:function onCheck(){}});export default Checkbox;
24
+ */function render(){return/*#__PURE__*/React.createElement("div",{className:classNames(this.props.className,'checkbox','common__checkbox'),onClick:this.handleCheck,"aria-hidden":true},this.renderInput(),this.renderLabelIfItIsOnThe('left'),this.renderIcon(),this.renderLabelIfItIsOnThe('right'));}}]);return Checkbox;}(Component);_defineProperty(Checkbox,"defaultProps",{checked:undefined,className:undefined,defaultChecked:undefined,disabled:false,label:null,labelPosition:'left',name:undefined,onCheck:function onCheck(){}});export default Checkbox;
@@ -1,7 +1,7 @@
1
1
  import React from'react';import{shallow}from'enzyme';import Checkbox from"./index";/**
2
2
  * Checked Icon
3
3
  * @returns {JSX}
4
- */var Checked=function Checked(){return React.createElement("div",null);};/**
4
+ */var Checked=function Checked(){return/*#__PURE__*/React.createElement("div",null);};/**
5
5
  * Unchecked Icon
6
6
  * @returns {JSX}
7
- */var Unchecked=function Unchecked(){return React.createElement("div",null);};describe('<Checkbox />',function(){it('should render the checkbox with the label before the icon',function(){var wrapper=shallow(React.createElement(Checkbox,{label:React.createElement("span",null,"Test Label Deluxe"),labelPosition:"left",checkedIcon:React.createElement(Checked,null),uncheckedIcon:React.createElement(Unchecked,null),checked:false}));var expected=React.createElement("div",null,React.createElement("span",null,"Test Label Deluxe"),React.createElement(Unchecked,null));expect(wrapper).toMatchSnapshot();expect(wrapper.matchesElement(expected)).toBeTruthy();});it('should render the checkbox with the label after the icon',function(){var wrapper=shallow(React.createElement(Checkbox,{label:React.createElement("span",null,"Test Label Deluxe"),labelPosition:"right",checkedIcon:React.createElement(Checked,null),uncheckedIcon:React.createElement(Unchecked,null),checked:false}));var expected=React.createElement("div",null,React.createElement(Unchecked,null),React.createElement("span",null,"Test Label Deluxe"));expect(wrapper).toMatchSnapshot();expect(wrapper.matchesElement(expected)).toBeTruthy();});it('should render the unchecked icon if "checked" is false',function(){var wrapper=shallow(React.createElement(Checkbox,{checked:false,label:"Test Label Deluxe",checkedIcon:React.createElement(Checked,null),uncheckedIcon:React.createElement(Unchecked,null)}));expect(wrapper).toMatchSnapshot();expect(wrapper.find(Checked).length).toBe(0);expect(wrapper.find(Unchecked).length).toBe(1);});it('should render the unchecked icon if "checked" is false',function(){var wrapper=shallow(React.createElement(Checkbox,{checked:true,label:"Test Label Deluxe",checkedIcon:React.createElement(Checked,null),uncheckedIcon:React.createElement(Unchecked,null)}));expect(wrapper).toMatchSnapshot();expect(wrapper.find(Checked).length).toBe(1);expect(wrapper.find(Unchecked).length).toBe(0);});it('should call the callback with the inverted value',function(){var spy=jest.fn();var wrapper=shallow(React.createElement(Checkbox,{label:"Test Label Deluxe",checkedIcon:React.createElement(Checked,null),uncheckedIcon:React.createElement(Unchecked,null),checked:false,onCheck:spy}));wrapper.simulate('click');expect(spy).toHaveBeenCalledWith(true);});it('should render an <input> element if a name prop is provided',function(){var wrapper=shallow(React.createElement(Checkbox,{label:"Test Label Deluxe",checkedIcon:React.createElement(Checked,null),uncheckedIcon:React.createElement(Unchecked,null),defaultChecked:false,name:"myCheckbox"}));var input=wrapper.find('input');expect(input.length).toBe(1);expect(input.prop('name')).toEqual('myCheckbox');expect(input.prop('value')).toEqual(0);});it('should work as an uncontrolled input',function(){var wrapper=shallow(React.createElement(Checkbox,{label:"Test Label Deluxe",checkedIcon:React.createElement(Checked,null),uncheckedIcon:React.createElement(Unchecked,null),defaultChecked:false}));wrapper.simulate('click');expect(wrapper.state('checked')).toBe(true);});});
7
+ */var Unchecked=function Unchecked(){return/*#__PURE__*/React.createElement("div",null);};describe('<Checkbox />',function(){it('should render the checkbox with the label before the icon',function(){var wrapper=shallow(/*#__PURE__*/React.createElement(Checkbox,{label:/*#__PURE__*/React.createElement("span",null,"Test Label Deluxe"),labelPosition:"left",checkedIcon:/*#__PURE__*/React.createElement(Checked,null),uncheckedIcon:/*#__PURE__*/React.createElement(Unchecked,null),checked:false}));var expected=/*#__PURE__*/React.createElement("div",null,/*#__PURE__*/React.createElement("span",null,"Test Label Deluxe"),/*#__PURE__*/React.createElement(Unchecked,null));expect(wrapper).toMatchSnapshot();expect(wrapper.matchesElement(expected)).toBeTruthy();});it('should render the checkbox with the label after the icon',function(){var wrapper=shallow(/*#__PURE__*/React.createElement(Checkbox,{label:/*#__PURE__*/React.createElement("span",null,"Test Label Deluxe"),labelPosition:"right",checkedIcon:/*#__PURE__*/React.createElement(Checked,null),uncheckedIcon:/*#__PURE__*/React.createElement(Unchecked,null),checked:false}));var expected=/*#__PURE__*/React.createElement("div",null,/*#__PURE__*/React.createElement(Unchecked,null),/*#__PURE__*/React.createElement("span",null,"Test Label Deluxe"));expect(wrapper).toMatchSnapshot();expect(wrapper.matchesElement(expected)).toBeTruthy();});it('should render the unchecked icon if "checked" is false',function(){var wrapper=shallow(/*#__PURE__*/React.createElement(Checkbox,{checked:false,label:"Test Label Deluxe",checkedIcon:/*#__PURE__*/React.createElement(Checked,null),uncheckedIcon:/*#__PURE__*/React.createElement(Unchecked,null)}));expect(wrapper).toMatchSnapshot();expect(wrapper.find(Checked).length).toBe(0);expect(wrapper.find(Unchecked).length).toBe(1);});it('should render the unchecked icon if "checked" is false',function(){var wrapper=shallow(/*#__PURE__*/React.createElement(Checkbox,{checked:true,label:"Test Label Deluxe",checkedIcon:/*#__PURE__*/React.createElement(Checked,null),uncheckedIcon:/*#__PURE__*/React.createElement(Unchecked,null)}));expect(wrapper).toMatchSnapshot();expect(wrapper.find(Checked).length).toBe(1);expect(wrapper.find(Unchecked).length).toBe(0);});it('should call the callback with the inverted value',function(){var spy=jest.fn();var wrapper=shallow(/*#__PURE__*/React.createElement(Checkbox,{label:"Test Label Deluxe",checkedIcon:/*#__PURE__*/React.createElement(Checked,null),uncheckedIcon:/*#__PURE__*/React.createElement(Unchecked,null),checked:false,onCheck:spy}));wrapper.simulate('click');expect(spy).toHaveBeenCalledWith(true);});it('should render an <input> element if a name prop is provided',function(){var wrapper=shallow(/*#__PURE__*/React.createElement(Checkbox,{label:"Test Label Deluxe",checkedIcon:/*#__PURE__*/React.createElement(Checked,null),uncheckedIcon:/*#__PURE__*/React.createElement(Unchecked,null),defaultChecked:false,name:"myCheckbox"}));var input=wrapper.find('input');expect(input.length).toBe(1);expect(input.prop('name')).toEqual('myCheckbox');expect(input.prop('value')).toEqual(0);});it('should work as an uncontrolled input',function(){var wrapper=shallow(/*#__PURE__*/React.createElement(Checkbox,{label:"Test Label Deluxe",checkedIcon:/*#__PURE__*/React.createElement(Checked,null),uncheckedIcon:/*#__PURE__*/React.createElement(Unchecked,null),defaultChecked:false}));wrapper.simulate('click');expect(wrapper.state('checked')).toBe(true);});});
@@ -1,4 +1,4 @@
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 get from'lodash/get';/**
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 get from'lodash/get';/**
2
2
  * Searches an object for the given paths.
3
3
  * Returns a new object with the values found at the end of each path.
4
4
  * @param {Object} obj The object to look through.
@@ -3,4 +3,4 @@ import React from'react';import PropTypes from'prop-types';import buildParams fr
3
3
  * @param {Object} props.context The react context.
4
4
  * @param {Object} props.props The props to create.
5
5
  * @returns {JSX}
6
- */var Consume=function Consume(_ref){var children=_ref.children,Consumer=_ref.context.Consumer,props=_ref.props;return React.createElement(Consumer,null,function(value){return children(buildParams(value,props));});};export default Consume;
6
+ */var Consume=function Consume(_ref){var children=_ref.children,Consumer=_ref.context.Consumer,props=_ref.props;return/*#__PURE__*/React.createElement(Consumer,null,function(value){return children(buildParams(value,props));});};export default Consume;
@@ -1,4 +1,4 @@
1
- function _typeof(obj){if(typeof Symbol==="function"&&typeof Symbol.iterator==="symbol"){_typeof=function _typeof(obj){return typeof obj;};}else{_typeof=function _typeof(obj){return obj&&typeof Symbol==="function"&&obj.constructor===Symbol&&obj!==Symbol.prototype?"symbol":typeof obj;};}return _typeof(obj);}function _classCallCheck(instance,Constructor){if(!(instance instanceof Constructor)){throw new TypeError("Cannot call a class as a function");}}function _defineProperties(target,props){for(var i=0;i<props.length;i++){var descriptor=props[i];descriptor.enumerable=descriptor.enumerable||false;descriptor.configurable=true;if("value"in descriptor)descriptor.writable=true;Object.defineProperty(target,descriptor.key,descriptor);}}function _createClass(Constructor,protoProps,staticProps){if(protoProps)_defineProperties(Constructor.prototype,protoProps);if(staticProps)_defineProperties(Constructor,staticProps);return Constructor;}function _possibleConstructorReturn(self,call){if(call&&(_typeof(call)==="object"||typeof call==="function")){return call;}return _assertThisInitialized(self);}function _assertThisInitialized(self){if(self===void 0){throw new ReferenceError("this hasn't been initialised - super() hasn't been called");}return self;}function _getPrototypeOf(o){_getPrototypeOf=Object.setPrototypeOf?Object.getPrototypeOf:function _getPrototypeOf(o){return o.__proto__||Object.getPrototypeOf(o);};return _getPrototypeOf(o);}function _inherits(subClass,superClass){if(typeof superClass!=="function"&&superClass!==null){throw new TypeError("Super expression must either be null or a function");}subClass.prototype=Object.create(superClass&&superClass.prototype,{constructor:{value:subClass,writable:true,configurable:true}});if(superClass)_setPrototypeOf(subClass,superClass);}function _setPrototypeOf(o,p){_setPrototypeOf=Object.setPrototypeOf||function _setPrototypeOf(o,p){o.__proto__=p;return o;};return _setPrototypeOf(o,p);}function _defineProperty(obj,key,value){if(key in obj){Object.defineProperty(obj,key,{value:value,enumerable:true,configurable:true,writable:true});}else{obj[key]=value;}return obj;}import React,{Component}from'react';import PropTypes from'prop-types';import padStart from'lodash/padStart';import I18n from"../I18n";/**
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 padStart from'lodash/padStart';import I18n from"../I18n";/**
2
2
  * Creates the appropriate format for a given time period.
3
3
  * @param {number} days The remaining days.
4
4
  * @param {number} hours The remaining hours.
@@ -12,10 +12,10 @@ function _typeof(obj){if(typeof Symbol==="function"&&typeof Symbol.iterator==="s
12
12
  */var createFormattedTime=function createFormattedTime(timeSpanInput){var timeSpan=Math.max(0,timeSpanInput);// Calculate remaining days, hours, minutes and seconds.
13
13
  var days=Math.floor(timeSpan/86400);var hours=Math.floor(timeSpan%86400/3600);var minutes=Math.floor(timeSpan%3600/60);var seconds=timeSpan%60;return getFormattedTimeString(days,hours,minutes,seconds);};/**
14
14
  * The Countdown timer component.
15
- */var CountdownTimer=/*#__PURE__*/function(_Component){_inherits(CountdownTimer,_Component);/**
15
+ */var CountdownTimer=/*#__PURE__*/function(_Component){_inherits(CountdownTimer,_Component);var _super=_createSuper(CountdownTimer);/**
16
16
  * The component constructor.
17
17
  * @param {Object} props The component properties.
18
- */function CountdownTimer(props){var _this;_classCallCheck(this,CountdownTimer);_this=_possibleConstructorReturn(this,_getPrototypeOf(CountdownTimer).call(this,props));_this.intervalHandle=null;_this.remainingTime=_this.getRemainingTime();_this.expired=_this.remainingTime<=0;// Calculate the initial formatted time string.
18
+ */function CountdownTimer(props){var _this;_classCallCheck(this,CountdownTimer);_this=_super.call(this,props);_this.intervalHandle=null;_this.remainingTime=_this.getRemainingTime();_this.expired=_this.remainingTime<=0;// Calculate the initial formatted time string.
19
19
  _this.state={formattedTime:createFormattedTime(_this.remainingTime)};return _this;}/**
20
20
  * Installs a new interval to update the timer if the component did mount.
21
21
  */_createClass(CountdownTimer,[{key:"componentDidMount",value:function componentDidMount(){var _this2=this;// Install the interval.
@@ -34,4 +34,4 @@ clearInterval(this.intervalHandle);this.intervalHandle=null;// The timer just ex
34
34
  if(this.props.onExpire){this.props.onExpire();}}this.setState({formattedTime:createFormattedTime(deltaTime)});}/**
35
35
  * Renders the element.
36
36
  * @return {JSX}
37
- */},{key:"render",value:function render(){return React.createElement(I18n.Text,{string:this.state.formattedTime.string,params:this.state.formattedTime.params,className:"".concat(this.props.className," common__countdown-timer")});}}]);return CountdownTimer;}(Component);_defineProperty(CountdownTimer,"defaultProps",{className:'',onExpire:null});export default CountdownTimer;
37
+ */},{key:"render",value:function render(){return/*#__PURE__*/React.createElement(I18n.Text,{string:this.state.formattedTime.string,params:this.state.formattedTime.params,className:"".concat(this.props.className," common__countdown-timer")});}}]);return CountdownTimer;}(Component);_defineProperty(CountdownTimer,"defaultProps",{className:'',onExpire:null});export default CountdownTimer;
@@ -6,7 +6,7 @@ import React from'react';import{shallow}from'enzyme';import CountdownTimer,{getF
6
6
  * @param {number} remainingSeconds The remaining seconds.
7
7
  * @param {Function} callback The expiration callback.
8
8
  * @return {JSX}
9
- */var createTimerElement=function createTimerElement(remainingDays,remainingHours,remainingMinutes,remainingSeconds,callback){var timeout=Math.floor(Date.now()/1000)+remainingDays*86400+remainingHours*3600+remainingMinutes*60+remainingSeconds;var wrapper=shallow(React.createElement(CountdownTimer,{timeout:timeout,onExpire:callback}));var currentTimeOffset=timeout-Math.floor(Date.now()/1000);wrapper.instance().getRemainingTime=function(){currentTimeOffset-=1;return currentTimeOffset;};return wrapper;};/**
9
+ */var createTimerElement=function createTimerElement(remainingDays,remainingHours,remainingMinutes,remainingSeconds,callback){var timeout=Math.floor(Date.now()/1000)+remainingDays*86400+remainingHours*3600+remainingMinutes*60+remainingSeconds;var wrapper=shallow(/*#__PURE__*/React.createElement(CountdownTimer,{timeout:timeout,onExpire:callback}));var currentTimeOffset=timeout-Math.floor(Date.now()/1000);wrapper.instance().getRemainingTime=function(){currentTimeOffset-=1;return currentTimeOffset;};return wrapper;};/**
10
10
  * Performs a time format check for a specific remaining time.
11
11
  * @param {number} remainingDays The remaining days.
12
12
  * @param {number} remainingHours The remaining hours.
@@ -1,6 +1,6 @@
1
- function _typeof(obj){if(typeof Symbol==="function"&&typeof Symbol.iterator==="symbol"){_typeof=function _typeof(obj){return typeof obj;};}else{_typeof=function _typeof(obj){return obj&&typeof Symbol==="function"&&obj.constructor===Symbol&&obj!==Symbol.prototype?"symbol":typeof obj;};}return _typeof(obj);}function _classCallCheck(instance,Constructor){if(!(instance instanceof Constructor)){throw new TypeError("Cannot call a class as a function");}}function _defineProperties(target,props){for(var i=0;i<props.length;i++){var descriptor=props[i];descriptor.enumerable=descriptor.enumerable||false;descriptor.configurable=true;if("value"in descriptor)descriptor.writable=true;Object.defineProperty(target,descriptor.key,descriptor);}}function _createClass(Constructor,protoProps,staticProps){if(protoProps)_defineProperties(Constructor.prototype,protoProps);if(staticProps)_defineProperties(Constructor,staticProps);return Constructor;}function _possibleConstructorReturn(self,call){if(call&&(_typeof(call)==="object"||typeof call==="function")){return call;}return _assertThisInitialized(self);}function _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 classNames from'classnames';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 _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 classNames from'classnames';import styles from"./style";/**
2
2
  * Drawer component.
3
- */var Drawer=/*#__PURE__*/function(_Component){_inherits(Drawer,_Component);/**
3
+ */var Drawer=/*#__PURE__*/function(_Component){_inherits(Drawer,_Component);var _super=_createSuper(Drawer);/**
4
4
  * The component prop types.
5
5
  * @type {Object}
6
6
  */ /**
@@ -9,12 +9,12 @@ function _typeof(obj){if(typeof Symbol==="function"&&typeof Symbol.iterator==="s
9
9
  */ /**
10
10
  * Initializes the Drawer component.
11
11
  * @param {Object} props The components props.
12
- */function Drawer(props){var _this;_classCallCheck(this,Drawer);_this=_possibleConstructorReturn(this,_getPrototypeOf(Drawer).call(this,props));_defineProperty(_assertThisInitialized(_this),"handleAnimationEnd",function(){_this.setState({active:_this.props.isOpen});if(!_this.props.isOpen){_this.props.onDidClose();}else{_this.props.onDidOpen();}});_this.state={active:props.isOpen};return _this;}/**
12
+ */function Drawer(props){var _this;_classCallCheck(this,Drawer);_this=_super.call(this,props);_defineProperty(_assertThisInitialized(_this),"handleAnimationEnd",function(){_this.setState({active:_this.props.isOpen});if(!_this.props.isOpen){_this.props.onDidClose();}else{_this.props.onDidOpen();}});_this.state={active:props.isOpen};return _this;}/**
13
13
  * Update state when isOpen changes.
14
14
  * @param {Object} nextProps The next component props.
15
15
  */_createClass(Drawer,[{key:"UNSAFE_componentWillReceiveProps",value:function UNSAFE_componentWillReceiveProps(nextProps){if(this.props.isOpen!==nextProps.isOpen){if(nextProps.isOpen){if(typeof nextProps.onOpen==='function'){nextProps.onOpen();}this.setState({active:true});}else if(typeof nextProps.onClose==='function'){nextProps.onClose();}}}/**
16
16
  * Syncs the internal active state when an animation ends.
17
- */},{key:"render",/**
17
+ */},{key:"render",value:/**
18
18
  * Renders the component.
19
19
  * @returns {JSX}
20
- */value:function render(){var _this$props=this.props,alwaysActive=_this$props.alwaysActive,className=_this$props.className,children=_this$props.children,isOpen=_this$props.isOpen,animation=_this$props.animation;var active=this.state.active;var animationIn=animation["in"]||styles.animation["in"];var animationOut=animation.out||styles.animation.out;var combinedClassName=classNames(className,styles.container,_defineProperty({},animationIn,isOpen),_defineProperty({},animationOut,!isOpen),'common__drawer');var style={};if(typeof animation.duration==='number'){style.animationDuration="".concat(animation.duration,"ms");}return active||alwaysActive?React.createElement("div",{className:combinedClassName,style:style,onAnimationEnd:this.handleAnimationEnd},children):null;}}]);return Drawer;}(Component);_defineProperty(Drawer,"defaultProps",{alwaysActive:false,className:'',children:null,isOpen:false,onOpen:function onOpen(){},onClose:function onClose(){},onDidClose:function onDidClose(){},onDidOpen:function onDidOpen(){},animation:{duration:null,"in":'',out:''}});export default Drawer;
20
+ */function render(){var _this$props=this.props,alwaysActive=_this$props.alwaysActive,className=_this$props.className,children=_this$props.children,isOpen=_this$props.isOpen,animation=_this$props.animation;var active=this.state.active;var animationIn=animation["in"]||styles.animation["in"];var animationOut=animation.out||styles.animation.out;var combinedClassName=classNames(className,styles.container,_defineProperty({},animationIn,isOpen),_defineProperty({},animationOut,!isOpen),'common__drawer');var style={};if(typeof animation.duration==='number'){style.animationDuration="".concat(animation.duration,"ms");}return active||alwaysActive?/*#__PURE__*/React.createElement("div",{className:combinedClassName,style:style,onAnimationEnd:this.handleAnimationEnd},children):null;}}]);return Drawer;}(Component);_defineProperty(Drawer,"defaultProps",{alwaysActive:false,className:'',children:null,isOpen:false,onOpen:function onOpen(){},onClose:function onClose(){},onDidClose:function onDidClose(){},onDidOpen:function onDidOpen(){},animation:{duration:null,"in":'',out:''}});export default Drawer;
@@ -1 +1 @@
1
- import React from'react';import{mount,shallow}from'enzyme';import Drawer from"./index";describe('<Drawer />',function(){var onOpen=jest.fn();var onClose=jest.fn();var onDidOpen=jest.fn();var onDidClose=jest.fn();beforeEach(function(){jest.clearAllMocks();});it('should render',function(){var wrapper=shallow(React.createElement(Drawer,null));expect(wrapper).toMatchSnapshot();});it('should execute callback when drawer is opened',function(){var wrapper=mount(React.createElement(Drawer,{onOpen:onOpen}));wrapper.setProps({isOpen:true});expect(onOpen).toBeCalled();});it('should execute callback when drawer is closed',function(){var wrapper=mount(React.createElement(Drawer,{isOpen:true,onClose:onClose}));wrapper.setProps({isOpen:false});expect(onClose).toBeCalled();});it('should add custom classes',function(){var wrapper=mount(React.createElement(Drawer,{className:"custom-class-name",isOpen:true}));expect(wrapper).toMatchSnapshot();expect(wrapper.hasClass('custom-class-name')).toEqual(true);});it('should execute callback when drawer open animation did end',function(){var wrapper=mount(React.createElement(Drawer,{className:"custom-class-name",isOpen:false,onOpen:onOpen,onDidOpen:onDidOpen}));expect(wrapper).toMatchSnapshot();wrapper.setProps({isOpen:true});expect(onOpen).toBeCalled();expect(onDidOpen).not.toBeCalled();wrapper.simulate('animationEnd');expect(onDidOpen).toBeCalled();});it('should execute callback when drawer close animation did end',function(){var wrapper=mount(React.createElement(Drawer,{className:"custom-class-name",isOpen:true,onClose:onClose,onDidClose:onDidClose}));expect(wrapper).toMatchSnapshot();wrapper.setProps({isOpen:false});expect(onClose).toBeCalled();expect(onDidClose).not.toBeCalled();wrapper.simulate('animationEnd');expect(onDidClose).toBeCalled();});});
1
+ import React from'react';import{mount,shallow}from'enzyme';import Drawer from"./index";describe('<Drawer />',function(){var onOpen=jest.fn();var onClose=jest.fn();var onDidOpen=jest.fn();var onDidClose=jest.fn();beforeEach(function(){jest.clearAllMocks();});it('should render',function(){var wrapper=shallow(/*#__PURE__*/React.createElement(Drawer,null));expect(wrapper).toMatchSnapshot();});it('should execute callback when drawer is opened',function(){var wrapper=mount(/*#__PURE__*/React.createElement(Drawer,{onOpen:onOpen}));wrapper.setProps({isOpen:true});expect(onOpen).toBeCalled();});it('should execute callback when drawer is closed',function(){var wrapper=mount(/*#__PURE__*/React.createElement(Drawer,{isOpen:true,onClose:onClose}));wrapper.setProps({isOpen:false});expect(onClose).toBeCalled();});it('should add custom classes',function(){var wrapper=mount(/*#__PURE__*/React.createElement(Drawer,{className:"custom-class-name",isOpen:true}));expect(wrapper).toMatchSnapshot();expect(wrapper.hasClass('custom-class-name')).toEqual(true);});it('should execute callback when drawer open animation did end',function(){var wrapper=mount(/*#__PURE__*/React.createElement(Drawer,{className:"custom-class-name",isOpen:false,onOpen:onOpen,onDidOpen:onDidOpen}));expect(wrapper).toMatchSnapshot();wrapper.setProps({isOpen:true});expect(onOpen).toBeCalled();expect(onDidOpen).not.toBeCalled();wrapper.simulate('animationEnd');expect(onDidOpen).toBeCalled();});it('should execute callback when drawer close animation did end',function(){var wrapper=mount(/*#__PURE__*/React.createElement(Drawer,{className:"custom-class-name",isOpen:true,onClose:onClose,onDidClose:onDidClose}));expect(wrapper).toMatchSnapshot();wrapper.setProps({isOpen:false});expect(onClose).toBeCalled();expect(onDidClose).not.toBeCalled();wrapper.simulate('animationEnd');expect(onDidClose).toBeCalled();});});