@shopgate/pwa-common 7.12.3 → 7.20.0-beta.1
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.
- package/App.js +6 -6
- package/actions/app/handleLink.js +7 -5
- package/actions/client/fetchClientInformation.js +1 -1
- package/actions/page/fetchPageConfig.js +2 -2
- package/actions/user/login.js +2 -2
- package/collections/AuthRoutes.js +3 -3
- package/collections/Configuration.js +3 -3
- package/collections/EmbeddedMedia.js +2 -2
- package/collections/PersistedReducers.js +2 -2
- package/collections/Redirects.js +3 -3
- package/collections/media-providers/MediaProvider.js +2 -2
- package/collections/media-providers/Vimeo.js +7 -7
- package/collections/media-providers/YouTube.js +5 -5
- package/components/Backdrop/index.js +11 -11
- package/components/Button/index.js +7 -7
- package/components/Checkbox/index.js +27 -14
- package/components/CountdownTimer/index.js +7 -7
- package/components/Drawer/index.js +13 -13
- package/components/Dropdown/index.js +5 -5
- package/components/Ellipsis/index.js +1 -1
- package/components/ErrorBoundary/index.js +5 -5
- package/components/Grid/components/Item/index.js +4 -4
- package/components/Grid/index.js +4 -4
- package/components/HtmlSanitizer/connector.js +5 -0
- package/components/HtmlSanitizer/index.js +10 -10
- package/components/HtmlSanitizer/spec.js +3 -3
- package/components/I18n/components/FormatPrice/index.js +2 -2
- package/components/I18n/components/I18nProvider/index.js +9 -9
- package/components/I18n/components/Translate/index.js +11 -7
- package/components/Icon/index.js +1 -1
- package/components/Image/index.js +9 -9
- package/components/Image/spec.js +2 -2
- package/components/InfiniteContainer/index.js +21 -21
- package/components/Input/components/DateInput.js +2 -2
- package/components/Input/components/MultiLineInput.js +10 -10
- package/components/Input/components/SimpleInput.js +27 -21
- package/components/KeyboardConsumer/index.js +7 -7
- package/components/Link/index.js +8 -5
- package/components/List/components/Item/index.js +1 -1
- package/components/List/index.js +1 -1
- package/components/Modal/index.js +1 -1
- package/components/Modal/style.js +1 -1
- package/components/Picker/components/List/index.js +1 -1
- package/components/Picker/components/Modal/index.js +7 -7
- package/components/Picker/index.js +19 -9
- package/components/Portal/index.js +15 -11
- package/components/ProductCharacteristics/helpers/index.js +1 -1
- package/components/ProductCharacteristics/index.js +27 -12
- package/components/RangeSlider/index.js +33 -24
- package/components/Route/RouteNotFound.js +3 -3
- package/components/Route/index.js +5 -5
- package/components/Router/index.js +18 -10
- package/components/ScannerContainer/index.js +3 -3
- package/components/Select/index.js +25 -15
- package/components/SelectBox/components/Item/index.js +5 -3
- package/components/SelectBox/index.js +17 -8
- package/components/Swiper/components/SwiperItem/spec.js +1 -1
- package/components/Swiper/index.js +3 -3
- package/components/Swiper/styles.js +4 -1
- package/components/Transition/index.js +4 -4
- package/components/Widgets/components/Widget/index.js +4 -4
- package/components/Widgets/components/WidgetGrid/index.js +5 -5
- package/components/Widgets/index.js +7 -7
- package/components/index.js +1 -2
- package/constants/Configuration.js +1 -1
- package/constants/Device.js +2 -2
- package/constants/Portals.js +2 -2
- package/helpers/config/mock.js +2 -2
- package/helpers/config/theme.js +2 -2
- package/helpers/i18n/getTranslator.js +10 -4
- package/helpers/portals/portalCollection.js +3 -3
- package/helpers/redux/mutable.js +3 -2
- package/helpers/redux/shouldFetchData.js +1 -1
- package/helpers/style/index.js +2 -2
- package/package.json +4 -4
- package/providers/loading/index.js +24 -14
- package/providers/toast/index.js +10 -8
- package/reducers/page/index.js +1 -1
- package/reducers/router/index.js +1 -1
- package/selectors/client.js +9 -7
- package/streams/app.js +8 -2
- package/streams/main.js +1 -1
- package/streams/view.js +12 -0
- package/subscriptions/error.js +4 -4
- package/subscriptions/helpers/handleLinks.js +2 -2
- package/subscriptions/menu.js +4 -2
- package/subscriptions/router.js +6 -6
- package/subscriptions/user.js +1 -1
package/App.js
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
import _regeneratorRuntime from"@babel/runtime/regenerator";function _typeof(obj){if(typeof Symbol==="function"&&typeof Symbol.iterator==="symbol"){_typeof=function _typeof(obj){return typeof obj;};}else{_typeof=function _typeof(obj){return obj&&typeof Symbol==="function"&&obj.constructor===Symbol&&obj!==Symbol.prototype?"symbol":typeof obj;};}return _typeof(obj);}function asyncGeneratorStep(gen,resolve,reject,_next,_throw,key,arg){try{var info=gen[key](arg);var value=info.value;}catch(error){reject(error);return;}if(info.done){resolve(value);}else{Promise.resolve(value).then(_next,_throw);}}function _asyncToGenerator(fn){return function(){var self=this,args=arguments;return new Promise(function(resolve,reject){var gen=fn.apply(self,args);function _next(value){asyncGeneratorStep(gen,resolve,reject,_next,_throw,"next",value);}function _throw(err){asyncGeneratorStep(gen,resolve,reject,_next,_throw,"throw",err);}_next(undefined);});};}function _classCallCheck(instance,Constructor){if(!(instance instanceof Constructor)){throw new TypeError("Cannot call a class as a function");}}function _defineProperties(target,props){for(var i=0;i<props.length;i++){var descriptor=props[i];descriptor.enumerable=descriptor.enumerable||false;descriptor.configurable=true;if("value"in descriptor)descriptor.writable=true;Object.defineProperty(target,descriptor.key,descriptor);}}function _createClass(Constructor,protoProps,staticProps){if(protoProps)_defineProperties(Constructor.prototype,protoProps);if(staticProps)_defineProperties(Constructor,staticProps);return Constructor;}function _possibleConstructorReturn(self,call){if(call&&(_typeof(call)==="object"||typeof call==="function")){return call;}return _assertThisInitialized(self);}function _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{CookiesProvider}from'react-cookie';import{loadCustomStyles}from'@shopgate/engage/styles';import ErrorBoundary from"./components/ErrorBoundary";import{appDidStart}from"./action-creators/app";import I18n from"./components/I18n";import{getIsSessionExpired}from"./selectors/user";import logout from"./actions/user/logout";/**
|
|
1
|
+
import _regeneratorRuntime from"@babel/runtime/regenerator";function _typeof(obj){if(typeof Symbol==="function"&&typeof Symbol.iterator==="symbol"){_typeof=function _typeof(obj){return typeof obj;};}else{_typeof=function _typeof(obj){return obj&&typeof Symbol==="function"&&obj.constructor===Symbol&&obj!==Symbol.prototype?"symbol":typeof obj;};}return _typeof(obj);}function asyncGeneratorStep(gen,resolve,reject,_next,_throw,key,arg){try{var info=gen[key](arg);var value=info.value;}catch(error){reject(error);return;}if(info.done){resolve(value);}else{Promise.resolve(value).then(_next,_throw);}}function _asyncToGenerator(fn){return function(){var self=this,args=arguments;return new Promise(function(resolve,reject){var gen=fn.apply(self,args);function _next(value){asyncGeneratorStep(gen,resolve,reject,_next,_throw,"next",value);}function _throw(err){asyncGeneratorStep(gen,resolve,reject,_next,_throw,"throw",err);}_next(undefined);});};}function _classCallCheck(instance,Constructor){if(!(instance instanceof Constructor)){throw new TypeError("Cannot call a class as a function");}}function _defineProperties(target,props){for(var i=0;i<props.length;i++){var descriptor=props[i];descriptor.enumerable=descriptor.enumerable||false;descriptor.configurable=true;if("value"in descriptor)descriptor.writable=true;Object.defineProperty(target,descriptor.key,descriptor);}}function _createClass(Constructor,protoProps,staticProps){if(protoProps)_defineProperties(Constructor.prototype,protoProps);if(staticProps)_defineProperties(Constructor,staticProps);return Constructor;}function _callSuper(_this,derived,args){function isNativeReflectConstruct(){if(typeof Reflect==="undefined"||!Reflect.construct)return false;if(Reflect.construct.sham)return false;if(typeof Proxy==="function")return true;try{return!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}));}catch(e){return false;}}derived=_getPrototypeOf(derived);return _possibleConstructorReturn(_this,isNativeReflectConstruct()?Reflect.construct(derived,args||[],_getPrototypeOf(_this).constructor):derived.apply(_this,args));}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{CookiesProvider}from'react-cookie';import{loadCustomStyles}from'@shopgate/engage/styles';import ErrorBoundary from"./components/ErrorBoundary";import{appDidStart}from"./action-creators/app";import I18n from"./components/I18n";import{getIsSessionExpired}from"./selectors/user";import logout from"./actions/user/logout";/**
|
|
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){
|
|
6
|
+
*/var App=/*#__PURE__*/function(_Component){function App(){_classCallCheck(this,App);return _callSuper(this,App,arguments);}_inherits(App,_Component);return _createClass(App,[{key:"componentDidMount",value:/**
|
|
7
7
|
* Registers the component for the native events and fires the onload AppCommand.
|
|
8
|
-
*/
|
|
8
|
+
*/function componentDidMount(){var _this2=this;/**
|
|
9
9
|
* Async helper function that performs optional steps before appDidStart action is dispatched
|
|
10
|
-
*/var performAppStart=/*#__PURE__*/function(){var _ref=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee(){return _regeneratorRuntime.wrap(function _callee$(_context){while(1)
|
|
11
|
-
console.error('AppStartLogout failed',_context.t0);case 9:
|
|
10
|
+
*/var performAppStart=/*#__PURE__*/function(){var _ref=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee(){return _regeneratorRuntime.wrap(function _callee$(_context){while(1)switch(_context.prev=_context.next){case 0:if(!getIsSessionExpired(_this2.props.store.getState())){_context.next=9;break;}_context.prev=1;_context.next=4;return _this2.props.store.dispatch(logout(undefined,true));case 4:_context.next=9;break;case 6:_context.prev=6;_context.t0=_context["catch"](1);// Noting to do here
|
|
11
|
+
console.error('AppStartLogout failed',_context.t0);case 9:_this2.props.store.dispatch(appDidStart("".concat(window.location.pathname).concat(window.location.search)));case 10:case"end":return _context.stop();}},_callee,null,[[1,6]]);}));return function performAppStart(){return _ref.apply(this,arguments);};}();performAppStart();loadCustomStyles();}/**
|
|
12
12
|
* Renders the component.
|
|
13
13
|
* @returns {JSX}
|
|
14
|
-
*/},{key:"render",value:function render(){return React.createElement(CookiesProvider,null,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)))));}}]);
|
|
14
|
+
*/},{key:"render",value:function render(){return React.createElement(CookiesProvider,null,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)))));}}]);}(Component);export default App;
|
|
@@ -1,11 +1,13 @@
|
|
|
1
1
|
import _regeneratorRuntime from"@babel/runtime/regenerator";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 asyncGeneratorStep(gen,resolve,reject,_next,_throw,key,arg){try{var info=gen[key](arg);var value=info.value;}catch(error){reject(error);return;}if(info.done){resolve(value);}else{Promise.resolve(value).then(_next,_throw);}}function _asyncToGenerator(fn){return function(){var self=this,args=arguments;return new Promise(function(resolve,reject){var gen=fn.apply(self,args);function _next(value){asyncGeneratorStep(gen,resolve,reject,_next,_throw,"next",value);}function _throw(err){asyncGeneratorStep(gen,resolve,reject,_next,_throw,"throw",err);}_next(undefined);});};}import{logger}from'@shopgate/pwa-core/helpers';import{DEEPLINK_CART_ADD_PRODUCT_PATTERN}from'@shopgate/pwa-common-commerce/cart/constants';import fetchProduct from'@shopgate/pwa-common-commerce/product/actions/fetchProduct';import{historyPush,historyReset}from"../router";import{INDEX_PATH_DEEPLINK,INDEX_PATH}from"../../constants/RoutePaths";/**
|
|
2
2
|
* @param {Object} payload The link payload.
|
|
3
|
-
* @param {boolean}
|
|
3
|
+
* @param {boolean} allowExternalLinks Wether the function should open external links or should try
|
|
4
|
+
* to convert them to internal links
|
|
4
5
|
* @return {Function}
|
|
5
|
-
*/export default function handleLink(payload){var
|
|
6
|
-
link=String(link);if(!link.startsWith('http')){_context.next=11;break;}if(!
|
|
7
|
-
pathname=link.replace(/^(.*:)(\/\/)?/,'/');
|
|
6
|
+
*/export default function handleLink(payload){var allowExternalLinks=arguments.length>1&&arguments[1]!==undefined?arguments[1]:false;return(/*#__PURE__*/function(){var _ref=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee(dispatch){var link,pathname,_ref2,_pathname$split3,_pathname$split4,productId;return _regeneratorRuntime.wrap(function _callee$(_context){while(1)switch(_context.prev=_context.next){case 0:link=payload.link;if(link){_context.next=3;break;}return _context.abrupt("return");case 3:// cast to string
|
|
7
|
+
link=String(link);if(!link.startsWith('http')){_context.next=11;break;}if(!allowExternalLinks){_context.next=8;break;}dispatch(historyPush({pathname:link}));return _context.abrupt("return");case 8:try{_ref2=new URL(link);pathname=_ref2.pathname;}catch(linkParseError){logger.error("Could not parse link ".concat(link),linkParseError);}_context.next=13;break;case 11:// Remove the deeplink protocol from the link.
|
|
8
|
+
pathname=link.replace(/^(.*:)(\/\/)?/,'/');if(!pathname.startsWith('/')){// Take care that pathname starts with a slash. Otherwise routing can break
|
|
9
|
+
pathname="/".concat(pathname);}case 13:if(!(!pathname||pathname===INDEX_PATH||pathname.startsWith(INDEX_PATH_DEEPLINK))){_context.next=16;break;}/**
|
|
8
10
|
* Special treatment for the index page. To avoid multiple index pages within the history,
|
|
9
11
|
* the parsed link helper will only emit the openLink events for the link to inform the
|
|
10
12
|
* streams, but not open a real page. Additionally the history is reset.
|
|
11
|
-
*/dispatch(historyReset());return _context.abrupt("return");case
|
|
13
|
+
*/dispatch(historyReset());return _context.abrupt("return");case 16:if(!pathname.includes(DEEPLINK_CART_ADD_PRODUCT_PATTERN.split('/')[1])){_context.next=20;break;}_pathname$split3=pathname.split('/'),_pathname$split4=_slicedToArray(_pathname$split3,3),productId=_pathname$split4[2];_context.next=20;return dispatch(fetchProduct(decodeURIComponent(productId)));case 20:dispatch(historyPush({pathname:pathname}));case 21:case"end":return _context.stop();}},_callee);}));return function(_x){return _ref.apply(this,arguments);};}());}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import{hasSGJavaScriptBridge,defaultClientInformation,getWebStorageEntry}from'@shopgate/pwa-core';import{requestClientInformation,receiveClientInformation,errorClientInformation}from"../../action-creators/client";/**
|
|
2
2
|
* Requests the client information from the web storage.
|
|
3
3
|
* @return {Function} A redux thunk.
|
|
4
|
-
*/function fetchClientInformation(){return function(dispatch){dispatch(requestClientInformation());if(!hasSGJavaScriptBridge()){dispatch(receiveClientInformation(defaultClientInformation));return;}getWebStorageEntry({name:'clientInformation'}).then(function(response){return dispatch(receiveClientInformation(response.value));})["catch"](function(){dispatch(errorClientInformation());});};}export default fetchClientInformation;
|
|
4
|
+
*/function fetchClientInformation(){return function(dispatch){dispatch(requestClientInformation());if(!hasSGJavaScriptBridge()){dispatch(receiveClientInformation(defaultClientInformation));return Promise.resolve({aga:0,value:defaultClientInformation});}var request=getWebStorageEntry({name:'clientInformation'});request.then(function(response){return dispatch(receiveClientInformation(response.value));})["catch"](function(){dispatch(errorClientInformation());});return request;};}export default fetchClientInformation;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import{PipelineRequest}from'@shopgate/pwa-core';import{getDeviceTypeForCms}from'@shopgate/engage/core';import{SHOPGATE_CMS_GET_PAGE_CONFIG}from"../../constants/Pipelines";import{requestPageConfig,receivePageConfig,errorPageConfig}from"../../action-creators/page";import{shouldFetchData,mutable}from"../../helpers/redux";import{getPageConfigById}from"../../selectors/page";/**
|
|
1
|
+
function _extends(){_extends=Object.assign||function(target){for(var i=1;i<arguments.length;i++){var source=arguments[i];for(var key in source){if(Object.prototype.hasOwnProperty.call(source,key)){target[key]=source[key];}}}return target;};return _extends.apply(this,arguments);}import{PipelineRequest}from'@shopgate/pwa-core';import{getDeviceTypeForCms}from'@shopgate/engage/core';import{hasNewServices}from'@shopgate/engage/core/helpers';import{SHOPGATE_CMS_GET_PAGE_CONFIG}from"../../constants/Pipelines";import{requestPageConfig,receivePageConfig,errorPageConfig}from"../../action-creators/page";import{shouldFetchData,mutable}from"../../helpers/redux";import{getPageConfigById}from"../../selectors/page";/**
|
|
2
2
|
* Retrieves the config for a page.
|
|
3
3
|
* @param {string} pageId The ID of the page to request.
|
|
4
4
|
* @return {Function} The dispatched action.
|
|
5
|
-
*/function fetchPageConfig(pageId){return function(dispatch,getState){var state=getState();var pageConfig=getPageConfigById(state,{pageId:pageId});if(!shouldFetchData(pageConfig)){return Promise.resolve(null);}var deviceTypeOfCmsPage=getDeviceTypeForCms();dispatch(requestPageConfig(pageId));var request=new PipelineRequest(SHOPGATE_CMS_GET_PAGE_CONFIG).setInput({pageId:pageId,deviceType:deviceTypeOfCmsPage}).dispatch();request.then(function(result){dispatch(receivePageConfig(pageId,result));})["catch"](function(error){dispatch(errorPageConfig(pageId,error.code));});return request;};}/** @mixes {MutableFunction} */export default mutable(fetchPageConfig);
|
|
5
|
+
*/function fetchPageConfig(pageId){return function(dispatch,getState){var state=getState();var pageConfig=getPageConfigById(state,{pageId:pageId});if(!shouldFetchData(pageConfig)){return Promise.resolve(null);}var deviceTypeOfCmsPage=getDeviceTypeForCms();dispatch(requestPageConfig(pageId));var request=new PipelineRequest(SHOPGATE_CMS_GET_PAGE_CONFIG).setInput(_extends({pageId:pageId},hasNewServices()?{deviceType:deviceTypeOfCmsPage}:null)).dispatch();request.then(function(result){dispatch(receivePageConfig(pageId,result));})["catch"](function(error){dispatch(errorPageConfig(pageId,error.code));});return request;};}/** @mixes {MutableFunction} */export default mutable(fetchPageConfig);
|
package/actions/user/login.js
CHANGED
|
@@ -6,11 +6,11 @@ import _regeneratorRuntime from"@babel/runtime/regenerator";function _extends(){
|
|
|
6
6
|
* @param {string} redirect The location to redirect to when logged in.
|
|
7
7
|
* @param {string} strategy basic or facebook, amazon, etc
|
|
8
8
|
* @return {Function} A redux thunk.
|
|
9
|
-
*/function login(parameters,redirect){var strategy=arguments.length>2&&arguments[2]!==undefined?arguments[2]:DEFAULT_LOGIN_STRATEGY;return(/*#__PURE__*/function(){var _ref=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee(dispatch){var _ref2,recaptchaEnabled,googleCloudSiteKey,recaptchaToken,request;return _regeneratorRuntime.wrap(function _callee$(_context){while(1)
|
|
9
|
+
*/function login(parameters,redirect){var strategy=arguments.length>2&&arguments[2]!==undefined?arguments[2]:DEFAULT_LOGIN_STRATEGY;return(/*#__PURE__*/function(){var _ref=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee(dispatch){var _ref2,recaptchaEnabled,googleCloudSiteKey,recaptchaToken,request;return _regeneratorRuntime.wrap(function _callee$(_context){while(1)switch(_context.prev=_context.next){case 0:_ref2=(appConfig===null||appConfig===void 0?void 0:appConfig.recaptcha)||{},recaptchaEnabled=_ref2.enabled,googleCloudSiteKey=_ref2.googleCloudSiteKey;dispatch(requestLogin(parameters.login,parameters.password,strategy));if(!(recaptchaEnabled&&googleCloudSiteKey)){_context.next=13;break;}_context.prev=3;_context.next=6;return new Promise(function(resolve){return window.grecaptcha.enterprise.ready(resolve);});case 6:_context.next=8;return window.grecaptcha.enterprise.execute(googleCloudSiteKey,{action:'login'});case 8:recaptchaToken=_context.sent;_context.next=13;break;case 11:_context.prev=11;_context.t0=_context["catch"](3);case 13:request=new PipelineRequest(SHOPGATE_USER_LOGIN_USER).setTrusted().setErrorBlacklist([EINVALIDCALL,ELEGACYSGCONNECT,EINCOMPLETELOGIN]).setInput({strategy:strategy,parameters:_extends({},parameters,{},recaptchaToken?{recaptchaToken:recaptchaToken}:null)}).dispatch();request.then(function(result){var success=result.success,messages=result.messages,sessionLifetimeInSeconds=result.sessionLifetimeInSeconds;if(success){dispatch(successLogin(redirect,strategy,sessionLifetimeInSeconds));}else{dispatch(errorLogin(messages));}})["catch"](function(error){var code=error.code;if(code===EINVALIDCALL){/**
|
|
10
10
|
* This code is thrown when the login request failed, because the user was already logged
|
|
11
11
|
* in. In that situation the success action can also dispatch to trigger the necessary
|
|
12
12
|
* processes which has to happen after a successful login.
|
|
13
13
|
*/dispatch(successLogin(redirect,strategy));}else if(code===ELEGACYSGCONNECT){/**
|
|
14
14
|
* The app is connected to the shop system via the legacy shopgate connect. Login via
|
|
15
15
|
* the shop system credentials failed and further steps are necessary to login the user.
|
|
16
|
-
*/dispatch(errorLegacyConnectRegister());dispatch(errorLogin([],ELEGACYSGCONNECT));}else{dispatch(errorLogin([],code));}});return _context.abrupt("return",request);case 16:case"end":return _context.stop();}}
|
|
16
|
+
*/dispatch(errorLegacyConnectRegister());dispatch(errorLogin([],ELEGACYSGCONNECT));}else{dispatch(errorLogin([],code));}});return _context.abrupt("return",request);case 16:case"end":return _context.stop();}},_callee,null,[[3,11]]);}));return function(_x){return _ref.apply(this,arguments);};}());}/** @mixes {MutableFunction} */export default mutable(login);
|
|
@@ -6,7 +6,7 @@ function _slicedToArray(arr,i){return _arrayWithHoles(arr)||_iterableToArrayLimi
|
|
|
6
6
|
* Finds a particular protected route.
|
|
7
7
|
* @param {string} pattern The pattern to find.
|
|
8
8
|
* @return {string|null}
|
|
9
|
-
*/_createClass(AuthRoutes,[{key:"get",value:function get(pattern){return this.routes.get(pattern)||null;}/**
|
|
9
|
+
*/return _createClass(AuthRoutes,[{key:"get",value:function get(pattern){return this.routes.get(pattern)||null;}/**
|
|
10
10
|
* Returns all protected routes.
|
|
11
11
|
* @return {Map}
|
|
12
12
|
*/},{key:"getAll",value:function getAll(){return this.routes;}/**
|
|
@@ -28,7 +28,7 @@ function _slicedToArray(arr,i){return _arrayWithHoles(arr)||_iterableToArrayLimi
|
|
|
28
28
|
* If we didn't find a direct match then we need to match
|
|
29
29
|
* the given location against the protected patters.
|
|
30
30
|
*/if(!protector){// Get the protected patterns as an array.
|
|
31
|
-
var patterns=Array.from(this.routes.keys());var _location$
|
|
31
|
+
var patterns=Array.from(this.routes.keys());var _location$split3=location.split('?'),_location$split4=_slicedToArray(_location$split3,1),locationWithoutParams=_location$split4[0];// Loop over the patterns until a match is found.
|
|
32
32
|
patterns.some(function(pattern){// Check for a match.
|
|
33
33
|
var match=_this.matcher(pattern)(locationWithoutParams);// Match found, set the protector.
|
|
34
|
-
if(match){protector=_this.routes.get(pattern);}return match;});}return protector;}}]);
|
|
34
|
+
if(match){protector=_this.routes.get(pattern);}return match;});}return protector;}}]);}();export default new AuthRoutes();
|
|
@@ -7,7 +7,7 @@ function _classCallCheck(instance,Constructor){if(!(instance instanceof Construc
|
|
|
7
7
|
* @param {*} key config key
|
|
8
8
|
* @param {*} defaultValue defaultValue
|
|
9
9
|
* @returns {*|undefined}
|
|
10
|
-
*/_createClass(Configuration,[{key:"get",value:function get(key,defaultValue){return this.store.get(key)||defaultValue;}/**
|
|
10
|
+
*/return _createClass(Configuration,[{key:"get",value:function get(key,defaultValue){return this.store.get(key)||defaultValue;}/**
|
|
11
11
|
* Sets a configuration.
|
|
12
12
|
* @param {*} key key
|
|
13
13
|
* @param {*} value value
|
|
@@ -17,5 +17,5 @@ function _classCallCheck(instance,Constructor){if(!(instance instanceof Construc
|
|
|
17
17
|
* @param {*} key key
|
|
18
18
|
* @param {Function} updater function to update value
|
|
19
19
|
* @returns {Configuration}
|
|
20
|
-
*/},{key:"update",value:function update(key,updater){if(typeof updater!=='function'){logGroup('CONFIGURATION%c updater is not function',{key:key},'#e0061e');return this;}var prevValue=this.store.get(key);var newValue=updater(this.store.get(key));// eslint-disable-next-line extra-rules/no-single-line-objects
|
|
21
|
-
logGroup('CONFIGURATION%c changed',{key:key,prevValue:prevValue,newValue:newValue},'#069215');return this.set(key,newValue);}}]);
|
|
20
|
+
*/},{key:"update",value:function update(key,updater){if(!this.store.has(key)){logGroup('CONFIGURATION%c not found',{key:key},'#e0061e');return this;}if(typeof updater!=='function'){logGroup('CONFIGURATION%c updater is not function',{key:key},'#e0061e');return this;}var prevValue=this.store.get(key);var newValue=updater(this.store.get(key));// eslint-disable-next-line extra-rules/no-single-line-objects
|
|
21
|
+
logGroup('CONFIGURATION%c changed',{key:key,prevValue:prevValue,newValue:newValue},'#069215');return this.set(key,newValue);}}]);}();/** @type {Configuration} */export default new Configuration();
|
|
@@ -5,7 +5,7 @@ function _classCallCheck(instance,Constructor){if(!(instance instanceof Construc
|
|
|
5
5
|
*/function EmbeddedMedia(){_classCallCheck(this,EmbeddedMedia);this.providers=new Set();}/**
|
|
6
6
|
* Add a provider for embedded media.
|
|
7
7
|
* @param {Object} provider A provider instance.
|
|
8
|
-
*/_createClass(EmbeddedMedia,[{key:"addProvider",value:function addProvider(provider){this.providers.add(provider);}/**
|
|
8
|
+
*/return _createClass(EmbeddedMedia,[{key:"addProvider",value:function addProvider(provider){this.providers.add(provider);}/**
|
|
9
9
|
* Remove a provider for embedded media.
|
|
10
10
|
* @param {Object} provider A provider instance.
|
|
11
11
|
*/},{key:"removeProvider",value:function removeProvider(provider){this.providers["delete"](provider);}/**
|
|
@@ -20,4 +20,4 @@ function _classCallCheck(instance,Constructor){if(!(instance instanceof Construc
|
|
|
20
20
|
*/},{key:"stop",value:function stop(){this.providers.forEach(function(provider){provider.stop();});}/**
|
|
21
21
|
* Check if we have media providers with not-ready SDK
|
|
22
22
|
* @returns {boolean}
|
|
23
|
-
*/},{key:"getHasPendingProviders",value:function getHasPendingProviders(){var hasPendingProviders=false;this.providers.forEach(function(provider){if(provider.isPending){hasPendingProviders=true;}});return hasPendingProviders;}}]);
|
|
23
|
+
*/},{key:"getHasPendingProviders",value:function getHasPendingProviders(){var hasPendingProviders=false;this.providers.forEach(function(provider){if(provider.isPending){hasPendingProviders=true;}});return hasPendingProviders;}}]);}();export default new EmbeddedMedia();/* eslint-enable extra-rules/potential-point-free */
|
|
@@ -5,7 +5,7 @@ function _classCallCheck(instance,Constructor){if(!(instance instanceof Construc
|
|
|
5
5
|
*/function PersistedReducers(){_classCallCheck(this,PersistedReducers);this.reducers=[];}/**
|
|
6
6
|
* Returns all reducers.
|
|
7
7
|
* @return {Array}
|
|
8
|
-
*/_createClass(PersistedReducers,[{key:"getAll",value:function getAll(){return this.reducers;}/**
|
|
8
|
+
*/return _createClass(PersistedReducers,[{key:"getAll",value:function getAll(){return this.reducers;}/**
|
|
9
9
|
* Sets a new reducers to be persisted.
|
|
10
10
|
* @param {string|Array} reducer The name of the reducer to persist.
|
|
11
11
|
* @return {PersistedReducers}
|
|
@@ -13,4 +13,4 @@ function _classCallCheck(instance,Constructor){if(!(instance instanceof Construc
|
|
|
13
13
|
* Removes a reducer from the list of persisted reducers.
|
|
14
14
|
* @param {string} reducer The name of the reducer to remove.
|
|
15
15
|
* @return {PersistedReducers}
|
|
16
|
-
*/},{key:"remove",value:function remove(reducer){this.reducers=this.reducers.filter(function(red){return red!==reducer;});return this;}}]);
|
|
16
|
+
*/},{key:"remove",value:function remove(reducer){this.reducers=this.reducers.filter(function(red){return red!==reducer;});return this;}}]);}();export default new PersistedReducers();
|
package/collections/Redirects.js
CHANGED
|
@@ -7,7 +7,7 @@ function _slicedToArray(arr,i){return _arrayWithHoles(arr)||_iterableToArrayLimi
|
|
|
7
7
|
* @param {string} pathname The pathname to lookup.
|
|
8
8
|
* @private
|
|
9
9
|
* @returns {string|Function|Promise|null}
|
|
10
|
-
*/_createClass(Redirects,[{key:"get",value:function get(pathname){return this.redirects.get(pathname)||null;}/**
|
|
10
|
+
*/return _createClass(Redirects,[{key:"get",value:function get(pathname){return this.redirects.get(pathname)||null;}/**
|
|
11
11
|
* Returns the redirect for a passed pathname.
|
|
12
12
|
* @param {string} pathname The pathname to check.
|
|
13
13
|
* @return {string|Function|Promise|null}
|
|
@@ -18,7 +18,7 @@ function _slicedToArray(arr,i){return _arrayWithHoles(arr)||_iterableToArrayLimi
|
|
|
18
18
|
* If we didn't find a direct match then we need to match
|
|
19
19
|
* the given pathname against the protected patters.
|
|
20
20
|
*/if(!redirect){// Get the protected patterns as an array.
|
|
21
|
-
var patterns=Array.from(this.redirects.keys());var _pathname$
|
|
21
|
+
var patterns=Array.from(this.redirects.keys());var _pathname$split3=pathname.split('?'),_pathname$split4=_slicedToArray(_pathname$split3,1),withoutParams=_pathname$split4[0];// Loop over the patterns until a match is found.
|
|
22
22
|
var patternMatch=patterns.find(function(pattern){return!!_this.matcher(pattern)(withoutParams);});// Match found, set the redirect.
|
|
23
23
|
if(patternMatch){redirect=this.redirects.get(patternMatch);}}return redirect;}/**
|
|
24
24
|
* @typedef RedirectExtendedData
|
|
@@ -43,4 +43,4 @@ var matcherResult=this.matcher(patternMatch)(url);result.matcher=patternMatch;re
|
|
|
43
43
|
*/},{key:"set",value:function set(){var from=arguments.length>0&&arguments[0]!==undefined?arguments[0]:null;var to=arguments.length>1&&arguments[1]!==undefined?arguments[1]:null;var force=arguments.length>2&&arguments[2]!==undefined?arguments[2]:false;if(!from||!to){return;}if(!force&&this.redirects.has(from)){return;}this.redirects.set(from,to);}/* eslint-disable extra-rules/potential-point-free */ /**
|
|
44
44
|
* Removes a specified element from the internal "redirects" Map object.
|
|
45
45
|
* @param {string} pathname The pathname to remove.
|
|
46
|
-
*/},{key:"unset",value:function unset(pathname){this.redirects["delete"](pathname);}/* eslint-enable extra-rules/potential-point-free */}]);
|
|
46
|
+
*/},{key:"unset",value:function unset(pathname){this.redirects["delete"](pathname);}/* eslint-enable extra-rules/potential-point-free */}]);}();export default new Redirects();
|
|
@@ -6,7 +6,7 @@ function _classCallCheck(instance,Constructor){if(!(instance instanceof Construc
|
|
|
6
6
|
* Callback for when Provider script is loaded
|
|
7
7
|
* @callback
|
|
8
8
|
* @abstract
|
|
9
|
-
*/ /* eslint-disable-next-line class-methods-use-this, require-jsdoc */_createClass(MediaProvider,[{key:"onScriptLoaded",value:function onScriptLoaded(){logger.error('MediaProvider.onScriptLoaded() needs to be implemented within an inheriting class');}/**
|
|
9
|
+
*/ /* eslint-disable-next-line class-methods-use-this, require-jsdoc */return _createClass(MediaProvider,[{key:"onScriptLoaded",value:function onScriptLoaded(){logger.error('MediaProvider.onScriptLoaded() needs to be implemented within an inheriting class');}/**
|
|
10
10
|
* Optimizes video container to make it responsive.
|
|
11
11
|
* @param {Element} container A DOM container.
|
|
12
12
|
* @returns {MediaProvider}
|
|
@@ -26,4 +26,4 @@ wrapper.appendChild(container);return this;}/**
|
|
|
26
26
|
*/},{key:"remove",value:function remove(container){this.containers["delete"](container);return this;}/**
|
|
27
27
|
* Stops all playing videos within the DOM containers.
|
|
28
28
|
* @returns {MediaProvider}
|
|
29
|
-
*/},{key:"stop",value:function stop(){logger.error('MediaProvider.stop() needs to be implemented within an inheriting class');return this;}}]);
|
|
29
|
+
*/},{key:"stop",value:function stop(){logger.error('MediaProvider.stop() needs to be implemented within an inheriting class');return this;}}]);}();export default MediaProvider;
|
|
@@ -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 MediaProvider from"./MediaProvider";var scriptUrl='https://player.vimeo.com/api/player.js';/**
|
|
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 _callSuper(_this,derived,args){function isNativeReflectConstruct(){if(typeof Reflect==="undefined"||!Reflect.construct)return false;if(Reflect.construct.sham)return false;if(typeof Proxy==="function")return true;try{return!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}));}catch(e){return false;}}derived=_getPrototypeOf(derived);return _possibleConstructorReturn(_this,isNativeReflectConstruct()?Reflect.construct(derived,args||[],_getPrototypeOf(_this).constructor):derived.apply(_this,args));}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';/**
|
|
2
2
|
* The Vimeo media provider class.
|
|
3
|
-
*/var VimeoMediaProvider=/*#__PURE__*/function(_MediaProvider){
|
|
3
|
+
*/var VimeoMediaProvider=/*#__PURE__*/function(_MediaProvider){/**
|
|
4
4
|
* Constructor.
|
|
5
|
-
*/function VimeoMediaProvider(){var
|
|
6
|
-
|
|
5
|
+
*/function VimeoMediaProvider(){var _this2;_classCallCheck(this,VimeoMediaProvider);_this2=_callSuper(this,VimeoMediaProvider);// Need to check Vimeo.Player presence later
|
|
6
|
+
_this2.isPending=true;_this2.remoteScriptUrl=scriptUrl;_this2.deferred=[];return _this2;}/**
|
|
7
7
|
* @inheritDoc
|
|
8
|
-
*/_createClass(VimeoMediaProvider,[{key:"onScriptLoaded",value:function onScriptLoaded(){var
|
|
8
|
+
*/_inherits(VimeoMediaProvider,_MediaProvider);return _createClass(VimeoMediaProvider,[{key:"onScriptLoaded",value:function onScriptLoaded(){var _this3=this;this.isPending=false;if(this.deferred.length){this.deferred.forEach(function(container){_this3.add(container);});this.deferred=[];}}/**
|
|
9
9
|
* Check if the Provider script to be loaded externally is finished loading
|
|
10
10
|
* @returns {boolean}
|
|
11
11
|
*/},{key:"checkScriptLoadingStatus",value:function checkScriptLoadingStatus(){if(this.isPending&&typeof window.Vimeo!=='undefined'){this.isPending=false;}return!this.isPending;}/**
|
|
@@ -13,8 +13,8 @@ _this.isPending=true;_this.remoteScriptUrl=scriptUrl;_this.deferred=[];return _t
|
|
|
13
13
|
* @override
|
|
14
14
|
* @param {ParentNode} container A DOM container.
|
|
15
15
|
* @returns {VimeoMediaProvider}
|
|
16
|
-
*/},{key:"add",value:function add(container){var
|
|
16
|
+
*/},{key:"add",value:function add(container){var _this4=this;if(!this.checkScriptLoadingStatus()){this.deferred.push(container);return this;}var iframes=container.querySelectorAll('iframe[src*="vimeo.com"]');if(!iframes.length){return this;}var players=[];iframes.forEach(function(iframe){_this4.responsify(iframe);players.push(new window.Vimeo.Player(iframe));});this.containers.set(container,players);return this;}/**
|
|
17
17
|
* Stops all playing videos within the DOM containers.
|
|
18
18
|
* @override
|
|
19
19
|
* @returns {VimeoMediaProvider}
|
|
20
|
-
*/},{key:"stop",value:function stop(){this.containers.forEach(function(players){players.forEach(function(player){player.pause();});});return this;}}]);
|
|
20
|
+
*/},{key:"stop",value:function stop(){this.containers.forEach(function(players){players.forEach(function(player){player.pause();});});return this;}}]);}(MediaProvider);export default VimeoMediaProvider;
|
|
@@ -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 _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){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 _callSuper(_this,derived,args){function isNativeReflectConstruct(){if(typeof Reflect==="undefined"||!Reflect.construct)return false;if(Reflect.construct.sham)return false;if(typeof Proxy==="function")return true;try{return!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}));}catch(e){return false;}}derived=_getPrototypeOf(derived);return _possibleConstructorReturn(_this,isNativeReflectConstruct()?Reflect.construct(derived,args||[],_getPrototypeOf(_this).constructor):derived.apply(_this,args));}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";/**
|
|
2
2
|
* The YouTube media provider class.
|
|
3
|
-
*/var YouTubeMediaProvider=/*#__PURE__*/function(_MediaProvider){
|
|
3
|
+
*/var YouTubeMediaProvider=/*#__PURE__*/function(_MediaProvider){function YouTubeMediaProvider(){_classCallCheck(this,YouTubeMediaProvider);return _callSuper(this,YouTubeMediaProvider,arguments);}_inherits(YouTubeMediaProvider,_MediaProvider);return _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
|
-
*/
|
|
9
|
-
iframes.forEach(function(iframe,index){
|
|
8
|
+
*/function add(container){var _this2=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
|
+
iframes.forEach(function(iframe,index){_this2.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;}/**
|
|
12
12
|
* Stops all playing videos within the DOM containers.
|
|
13
13
|
* @override
|
|
14
14
|
* @returns {YouTubeMediaProvider}
|
|
15
|
-
*/},{key:"stop",value:function stop(){this.containers.forEach(function(iframes){iframes.forEach(function(iframe){if(iframe.contentWindow&&iframe.contentWindow.postMessage){iframe.contentWindow.postMessage('{"event":"command","func":"stopVideo","args":""}','*');}});});return this;}}]);
|
|
15
|
+
*/},{key:"stop",value:function stop(){this.containers.forEach(function(iframes){iframes.forEach(function(iframe){if(iframe.contentWindow&&iframe.contentWindow.postMessage){iframe.contentWindow.postMessage('{"event":"command","func":"stopVideo","args":""}','*');}});});return this;}}]);}(MediaProvider);export default YouTubeMediaProvider;
|
|
@@ -1,16 +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 _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{toggleBodyScroll}from'@shopgate/engage/styles';import style from"./style";/**
|
|
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 _callSuper(_this,derived,args){function isNativeReflectConstruct(){if(typeof Reflect==="undefined"||!Reflect.construct)return false;if(Reflect.construct.sham)return false;if(typeof Proxy==="function")return true;try{return!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}));}catch(e){return false;}}derived=_getPrototypeOf(derived);return _possibleConstructorReturn(_this,isNativeReflectConstruct()?Reflect.construct(derived,args||[],_getPrototypeOf(_this).constructor):derived.apply(_this,args));}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{toggleBodyScroll}from'@shopgate/engage/styles';import style from"./style";/**
|
|
2
2
|
* Backdrop component.
|
|
3
|
-
*/var Backdrop=/*#__PURE__*/function(_Component){
|
|
4
|
-
* The component prop types.
|
|
5
|
-
* @type {Object}
|
|
6
|
-
*/ /**
|
|
7
|
-
* The component default props.
|
|
8
|
-
* @type {Object}
|
|
9
|
-
*/ /**
|
|
3
|
+
*/var Backdrop=/*#__PURE__*/function(_Component){/**
|
|
10
4
|
* @param {Object} props The component props
|
|
11
|
-
*/function Backdrop(props){var
|
|
5
|
+
*/function Backdrop(props){var _this2;_classCallCheck(this,Backdrop);_this2=_callSuper(this,Backdrop,[props]);_this2.bodyScrollRef=Math.random().toString(36).substring(2,15)+Math.random().toString(36).substring(2,15);return _this2;}/**
|
|
12
6
|
* Sets the initial state for the body scroll lock
|
|
13
|
-
*/_createClass(Backdrop,[{key:"componentDidMount",value:function componentDidMount(){var _this$props=this.props,isVisible=_this$props.isVisible,lockBodyScroll=_this$props.lockBodyScroll;if(lockBodyScroll){toggleBodyScroll(isVisible,this.bodyScrollRef);}}/**
|
|
7
|
+
*/_inherits(Backdrop,_Component);return _createClass(Backdrop,[{key:"componentDidMount",value:function componentDidMount(){var _this$props=this.props,isVisible=_this$props.isVisible,lockBodyScroll=_this$props.lockBodyScroll;if(lockBodyScroll){toggleBodyScroll(isVisible,this.bodyScrollRef);}}/**
|
|
14
8
|
* Toggles the body scroll lock when the visibility state changes
|
|
15
9
|
* @param {Object} nextProps The next component props
|
|
16
10
|
*/},{key:"UNSAFE_componentWillReceiveProps",value:function UNSAFE_componentWillReceiveProps(nextProps){var isVisible=nextProps.isVisible,lockBodyScroll=nextProps.lockBodyScroll;if(isVisible===this.props.isVisible){return;}if(lockBodyScroll){toggleBodyScroll(isVisible,this.bodyScrollRef);}}/**
|
|
@@ -22,4 +16,10 @@ function _typeof(obj){if(typeof Symbol==="function"&&typeof Symbol.iterator==="s
|
|
|
22
16
|
*/},{key:"componentWillUnmount",value:function componentWillUnmount(){var lockBodyScroll=this.props.lockBodyScroll;if(lockBodyScroll){toggleBodyScroll(false,this.bodyScrollRef);}}/**
|
|
23
17
|
* Renders the component.
|
|
24
18
|
* @returns {JSX}
|
|
25
|
-
*/},{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);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);}}]);
|
|
19
|
+
*/},{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);}}]);}(Component);/**
|
|
20
|
+
* The component prop types.
|
|
21
|
+
* @type {Object}
|
|
22
|
+
*/ /**
|
|
23
|
+
* The component default props.
|
|
24
|
+
* @type {Object}
|
|
25
|
+
*/_defineProperty(Backdrop,"defaultProps",{className:'',color:'#000',duration:200,isVisible:false,level:2,onClick:function onClick(){},opacity:50,lockBodyScroll:true});export default Backdrop;
|
|
@@ -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
|
|
1
|
+
var _excluded=["children","testId","className","disabled","onClick"];function _typeof(obj){if(typeof Symbol==="function"&&typeof Symbol.iterator==="symbol"){_typeof=function _typeof(obj){return typeof obj;};}else{_typeof=function _typeof(obj){return obj&&typeof Symbol==="function"&&obj.constructor===Symbol&&obj!==Symbol.prototype?"symbol":typeof obj;};}return _typeof(obj);}function _extends(){_extends=Object.assign||function(target){for(var i=1;i<arguments.length;i++){var source=arguments[i];for(var key in source){if(Object.prototype.hasOwnProperty.call(source,key)){target[key]=source[key];}}}return target;};return _extends.apply(this,arguments);}function _objectWithoutProperties(source,excluded){if(source==null)return{};var target=_objectWithoutPropertiesLoose(source,excluded);var key,i;if(Object.getOwnPropertySymbols){var sourceSymbolKeys=Object.getOwnPropertySymbols(source);for(i=0;i<sourceSymbolKeys.length;i++){key=sourceSymbolKeys[i];if(excluded.indexOf(key)>=0)continue;if(!Object.prototype.propertyIsEnumerable.call(source,key))continue;target[key]=source[key];}}return target;}function _objectWithoutPropertiesLoose(source,excluded){if(source==null)return{};var target={};var sourceKeys=Object.keys(source);var key,i;for(i=0;i<sourceKeys.length;i++){key=sourceKeys[i];if(excluded.indexOf(key)>=0)continue;target[key]=source[key];}return target;}function _classCallCheck(instance,Constructor){if(!(instance instanceof Constructor)){throw new TypeError("Cannot call a class as a function");}}function _defineProperties(target,props){for(var i=0;i<props.length;i++){var descriptor=props[i];descriptor.enumerable=descriptor.enumerable||false;descriptor.configurable=true;if("value"in descriptor)descriptor.writable=true;Object.defineProperty(target,descriptor.key,descriptor);}}function _createClass(Constructor,protoProps,staticProps){if(protoProps)_defineProperties(Constructor.prototype,protoProps);if(staticProps)_defineProperties(Constructor,staticProps);return Constructor;}function _callSuper(_this,derived,args){function isNativeReflectConstruct(){if(typeof Reflect==="undefined"||!Reflect.construct)return false;if(Reflect.construct.sham)return false;if(typeof Proxy==="function")return true;try{return!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}));}catch(e){return false;}}derived=_getPrototypeOf(derived);return _possibleConstructorReturn(_this,isNativeReflectConstruct()?Reflect.construct(derived,args||[],_getPrototypeOf(_this).constructor):derived.apply(_this,args));}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";/**
|
|
2
2
|
* The button component.
|
|
3
|
-
*/var Button=/*#__PURE__*/function(_Component){
|
|
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){function Button(){_classCallCheck(this,Button);return _callSuper(this,Button,arguments);}_inherits(Button,_Component);return _createClass(Button,[{key:"buttonProps",get:/**
|
|
8
4
|
* Getter for the calculated button props.
|
|
9
5
|
* @returns {Object}
|
|
10
|
-
*/
|
|
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(// eslint-disable-next-line react/button-has-type
|
|
10
|
+
React.createElement("button",_extends({"data-test-id":this.props.testId},this.buttonProps),this.props.children));}}]);}(Component);_defineProperty(Button,"defaultProps",{className:'',disabled:false,onClick:null,testId:'Button'});export default Button;
|
|
@@ -1,24 +1,37 @@
|
|
|
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
|
|
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 _callSuper(_this,derived,args){function isNativeReflectConstruct(){if(typeof Reflect==="undefined"||!Reflect.construct)return false;if(Reflect.construct.sham)return false;if(typeof Proxy==="function")return true;try{return!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}));}catch(e){return false;}}derived=_getPrototypeOf(derived);return _possibleConstructorReturn(_this,isNativeReflectConstruct()?Reflect.construct(derived,args||[],_getPrototypeOf(_this).constructor):derived.apply(_this,args));}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 classNames from'classnames';/**
|
|
2
2
|
* Base checkbox component.
|
|
3
3
|
* @type {Object}
|
|
4
|
-
*/var Checkbox=/*#__PURE__*/function(_Component){
|
|
4
|
+
*/var Checkbox=/*#__PURE__*/function(_Component){/**
|
|
5
5
|
* The checkbox component constructor.
|
|
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
|
|
10
|
-
:_this.state.checked// Uncontrolled.
|
|
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.
|
|
13
|
-
_this.state={checked:props.defaultChecked};}else{// Controlled input
|
|
14
|
-
_this.state={checked:props.checked};}return _this;}/**
|
|
15
|
-
* Make sure state is updated with new checked value when input is controlled
|
|
16
|
-
* @param {Object} nextProps Contains the new "checked" status
|
|
17
|
-
*/_createClass(Checkbox,[{key:"UNSAFE_componentWillReceiveProps",value:function UNSAFE_componentWillReceiveProps(nextProps){// Update only for controlled input
|
|
18
|
-
if(typeof this.props.defaultChecked==='undefined'){if(this.state.checked!==nextProps.checked){this.setState({checked:nextProps.checked});}}}/**
|
|
9
|
+
*/function Checkbox(props){var _this2;_classCallCheck(this,Checkbox);_this2=_callSuper(this,Checkbox,[props]);/**
|
|
19
10
|
* Returns if the checkbox is checked or not.
|
|
20
11
|
* @return {boolean} Is the checkbox checked?
|
|
21
|
-
*/
|
|
12
|
+
*/_defineProperty(_this2,"isChecked",function(){return typeof _this2.props.defaultChecked==='undefined'?_this2.props.checked// Controlled.
|
|
13
|
+
:_this2.state.checked// Uncontrolled.
|
|
14
|
+
;});/**
|
|
15
|
+
* Inverts the current "checked" value and calls the callback function with it.
|
|
16
|
+
* If the checkbox is uncontrolled, it keeps track of the value.
|
|
17
|
+
*/_defineProperty(_this2,"handleCheck",function(){if(_this2.props.disabled){return;}var checked=!_this2.isChecked();if(typeof _this2.props.defaultChecked!=='undefined'){// Uncontrolled.
|
|
18
|
+
_this2.setState({checked:checked});}_this2.props.onCheck(checked);});/**
|
|
19
|
+
* Renders the checked/unchecked icon.
|
|
20
|
+
* @returns {JSX}
|
|
21
|
+
*/_defineProperty(_this2,"renderIcon",function(){return _this2.isChecked()?_this2.props.checkedIcon:_this2.props.uncheckedIcon;});/**
|
|
22
|
+
* Renders an input if a "name" prop is provided.
|
|
23
|
+
* @returns {JSX}
|
|
24
|
+
*/_defineProperty(_this2,"renderInput",function(){var _this3=_this2,name=_this3.props.name,isChecked=_this3.isChecked;return _this2.props.name?React.createElement("input",{className:"input",type:"hidden",name:name,value:isChecked()?1:0}):null;});/**
|
|
25
|
+
* Renders the label if "side" matches he labelPosition prop.
|
|
26
|
+
* @param {string} side Used to check against which side to render the label on.
|
|
27
|
+
* @returns {JSX}
|
|
28
|
+
*/_defineProperty(_this2,"renderLabelIfItIsOnThe",function(side){return _this2.props.labelPosition===side?_this2.props.label:null;});if(typeof props.defaultChecked!=='undefined'){// Uncontrolled input.
|
|
29
|
+
_this2.state={checked:props.defaultChecked};}else{// Controlled input
|
|
30
|
+
_this2.state={checked:props.checked};}return _this2;}/**
|
|
31
|
+
* Make sure state is updated with new checked value when input is controlled
|
|
32
|
+
* @param {Object} nextProps Contains the new "checked" status
|
|
33
|
+
*/_inherits(Checkbox,_Component);return _createClass(Checkbox,[{key:"UNSAFE_componentWillReceiveProps",value:function UNSAFE_componentWillReceiveProps(nextProps){// Update only for controlled input
|
|
34
|
+
if(typeof this.props.defaultChecked==='undefined'){if(this.state.checked!==nextProps.checked){this.setState({checked:nextProps.checked});}}}},{key:"render",value:/**
|
|
22
35
|
* Renders the checkbox component.
|
|
23
36
|
* @returns {JSX}
|
|
24
|
-
*/
|
|
37
|
+
*/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'));}}]);}(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,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){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 _callSuper(_this,derived,args){function isNativeReflectConstruct(){if(typeof Reflect==="undefined"||!Reflect.construct)return false;if(Reflect.construct.sham)return false;if(typeof Proxy==="function")return true;try{return!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}));}catch(e){return false;}}derived=_getPrototypeOf(derived);return _possibleConstructorReturn(_this,isNativeReflectConstruct()?Reflect.construct(derived,args||[],_getPrototypeOf(_this).constructor):derived.apply(_this,args));}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";/**
|
|
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,17 +12,17 @@ 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){
|
|
15
|
+
*/var CountdownTimer=/*#__PURE__*/function(_Component){/**
|
|
16
16
|
* The component constructor.
|
|
17
17
|
* @param {Object} props The component properties.
|
|
18
|
-
*/function CountdownTimer(props){var
|
|
19
|
-
|
|
18
|
+
*/function CountdownTimer(props){var _this2;_classCallCheck(this,CountdownTimer);_this2=_callSuper(this,CountdownTimer,[props]);_this2.intervalHandle=null;_this2.remainingTime=_this2.getRemainingTime();_this2.expired=_this2.remainingTime<=0;// Calculate the initial formatted time string.
|
|
19
|
+
_this2.state={formattedTime:createFormattedTime(_this2.remainingTime)};return _this2;}/**
|
|
20
20
|
* Installs a new interval to update the timer if the component did mount.
|
|
21
|
-
*/_createClass(CountdownTimer,[{key:"componentDidMount",value:function componentDidMount(){var
|
|
21
|
+
*/_inherits(CountdownTimer,_Component);return _createClass(CountdownTimer,[{key:"componentDidMount",value:function componentDidMount(){var _this3=this;// Install the interval.
|
|
22
22
|
this.intervalHandle=setInterval(function(){/**
|
|
23
23
|
* To allow mocked tests of the timing functions and still be able to deal
|
|
24
24
|
* with paused execution, the delta time is expected to be at least 1.
|
|
25
|
-
*/
|
|
25
|
+
*/_this3.remainingTime=_this3.getRemainingTime();_this3.updateTimer();},1000);}/**
|
|
26
26
|
* Clears the timer interval.
|
|
27
27
|
*/},{key:"componentWillUnmount",value:function componentWillUnmount(){if(this.intervalHandle){clearInterval(this.intervalHandle);}}/**
|
|
28
28
|
* @returns {number} The remaining time until the timer runs out.
|
|
@@ -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:this.props.className});}}]);
|
|
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")});}}]);}(Component);_defineProperty(CountdownTimer,"defaultProps",{className:'',onExpire:null});export default CountdownTimer;
|
|
@@ -1,20 +1,20 @@
|
|
|
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
|
|
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 _callSuper(_this,derived,args){function isNativeReflectConstruct(){if(typeof Reflect==="undefined"||!Reflect.construct)return false;if(Reflect.construct.sham)return false;if(typeof Proxy==="function")return true;try{return!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}));}catch(e){return false;}}derived=_getPrototypeOf(derived);return _possibleConstructorReturn(_this,isNativeReflectConstruct()?Reflect.construct(derived,args||[],_getPrototypeOf(_this).constructor):derived.apply(_this,args));}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 classNames from'classnames';import styles from"./style";/**
|
|
2
2
|
* Drawer component.
|
|
3
|
-
*/var Drawer=/*#__PURE__*/function(_Component){
|
|
4
|
-
* The component prop types.
|
|
5
|
-
* @type {Object}
|
|
6
|
-
*/ /**
|
|
7
|
-
* The component default props.
|
|
8
|
-
* @type {Object}
|
|
9
|
-
*/ /**
|
|
3
|
+
*/var Drawer=/*#__PURE__*/function(_Component){/**
|
|
10
4
|
* Initializes the Drawer component.
|
|
11
5
|
* @param {Object} props The components props.
|
|
12
|
-
*/function Drawer(props){var
|
|
6
|
+
*/function Drawer(props){var _this2;_classCallCheck(this,Drawer);_this2=_callSuper(this,Drawer,[props]);/**
|
|
7
|
+
* Syncs the internal active state when an animation ends.
|
|
8
|
+
*/_defineProperty(_this2,"handleAnimationEnd",function(){_this2.setState({active:_this2.props.isOpen});if(!_this2.props.isOpen){_this2.props.onDidClose();}else{_this2.props.onDidOpen();}});_this2.state={active:props.isOpen};return _this2;}/**
|
|
13
9
|
* Update state when isOpen changes.
|
|
14
10
|
* @param {Object} nextProps The next component props.
|
|
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
|
-
* Syncs the internal active state when an animation ends.
|
|
17
|
-
*/},{key:"render",/**
|
|
11
|
+
*/_inherits(Drawer,_Component);return _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();}}}},{key:"render",value:/**
|
|
18
12
|
* Renders the component.
|
|
19
13
|
* @returns {JSX}
|
|
20
|
-
*/
|
|
14
|
+
*/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,role:"dialog","aria-modal":true},children):null;}}]);}(Component);/**
|
|
15
|
+
* The component prop types.
|
|
16
|
+
* @type {Object}
|
|
17
|
+
*/ /**
|
|
18
|
+
* The component default props.
|
|
19
|
+
* @type {Object}
|
|
20
|
+
*/_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;
|