@shopgate/pwa-common 7.12.7-beta.1 → 7.20.0-beta.10
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/router/historyReplace.js +11 -1
- package/actions/user/getUser.js +1 -0
- package/actions/user/login.js +2 -2
- package/collections/AuthRoutes.js +3 -3
- package/collections/Configuration.js +3 -3
- package/collections/EmbeddedMedia.js +13 -3
- package/collections/PersistedReducers.js +2 -2
- package/collections/Redirects.js +3 -3
- package/collections/media-providers/MediaProvider.js +32 -4
- package/collections/media-providers/Vimeo.js +26 -7
- package/collections/media-providers/YouTube.js +10 -5
- package/collections/media-providers/style.js +2 -1
- 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/EmbeddedMedia/index.js +5 -5
- 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 +9 -0
- package/components/HtmlSanitizer/index.js +11 -11
- package/components/HtmlSanitizer/spec.js +4 -4
- 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/connector.js +1 -1
- 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/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 +12 -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 +6 -6
- 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/dom/index.js +2 -1
- package/helpers/html/parseHTML.js +10 -3
- package/helpers/i18n/getNumberFormatter.js +1 -1
- package/helpers/i18n/getTranslator.js +10 -4
- package/helpers/i18n/index.js +1 -1
- package/helpers/i18n/mergeTranslations.js +1 -1
- package/helpers/portals/portalCollection.js +3 -3
- package/helpers/redux/shouldFetchData.js +1 -1
- package/helpers/style/index.js +2 -2
- package/package.json +5 -5
- 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
|
@@ -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
|
|
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 styles from"./style";import SelectItem from"./components/Item";var DEFAULT_PLACEHOLDER_TEXT='Select ...';/**
|
|
2
2
|
* Finds an item in a list of items by value.
|
|
3
3
|
* @param {Array} items - The list of items.
|
|
4
4
|
* @param {*} value - The value to look for.
|
|
@@ -12,26 +12,36 @@ function _typeof(obj){if(typeof Symbol==="function"&&typeof Symbol.iterator==="s
|
|
|
12
12
|
* The select component.
|
|
13
13
|
* @param {Object} props - The component props.
|
|
14
14
|
* @param {React.Children} props.children - Some content to display inside.
|
|
15
|
-
*/var Select=/*#__PURE__*/function(_Component){
|
|
16
|
-
* The component prop types.
|
|
17
|
-
* @type {Object}
|
|
18
|
-
*/ /**
|
|
19
|
-
* The component default props.
|
|
20
|
-
* @type {Object}
|
|
21
|
-
*/ /**
|
|
15
|
+
*/var Select=/*#__PURE__*/function(_Component){/**
|
|
22
16
|
* The constructor.
|
|
23
17
|
* @param {Object} props - The component props.
|
|
24
|
-
*/function Select(props){var
|
|
18
|
+
*/function Select(props){var _this2;_classCallCheck(this,Select);_this2=_callSuper(this,Select,[props]);/**
|
|
19
|
+
* Triggers the onChange callback if the selected value has changed.
|
|
20
|
+
* @param {Object} nextState - The next state.
|
|
21
|
+
*/_defineProperty(_this2,"triggerChangeCallback",function(nextState){if(_this2.state.selected&&_this2.state.selected.value===nextState.selected.value){return;}if(_this2.props.onChange instanceof Function){_this2.props.onChange(nextState.selected.value);}});/**
|
|
22
|
+
* Handles any interaction the user does outside of the component.
|
|
23
|
+
* In this case the select gets closed.
|
|
24
|
+
* @param {Event} event - The event of the user interaction (e.g. TouchEvent).
|
|
25
|
+
*/_defineProperty(_this2,"handleInteractionOutside",function(event){if(!_this2.domElement.contains(event.target)){_this2.setState({isOpen:false});}});/**
|
|
26
|
+
* Gets called when a new item is selected
|
|
27
|
+
* @param {*} value - The selected value.
|
|
28
|
+
* @param {string} label - The selected label.
|
|
29
|
+
*/_defineProperty(_this2,"handleItemSelect",function(value,label){var stateUpdate={selected:{label:label,value:value},isOpen:false};_this2.triggerChangeCallback(stateUpdate);_this2.setState(stateUpdate);});/**
|
|
30
|
+
* Toggles the open state of the component.
|
|
31
|
+
*/_defineProperty(_this2,"toggleOpenState",function(){_this2.setState(function(_ref){var isOpen=_ref.isOpen;return{isOpen:!isOpen};});});_this2.state={selected:null,isOpen:false};_this2.domElement=null;if(props.value){_this2.state.selected=normalizeItem(findItemByValue(props.items,props.value));}return _this2;}/**
|
|
25
32
|
* Adds event listener when the component is mounted.
|
|
26
|
-
*/_createClass(Select,[{key:"componentDidMount",value:function componentDidMount(){document.addEventListener('touchstart',this.handleInteractionOutside);}/**
|
|
33
|
+
*/_inherits(Select,_Component);return _createClass(Select,[{key:"componentDidMount",value:function componentDidMount(){document.addEventListener('touchstart',this.handleInteractionOutside);}/**
|
|
27
34
|
* Updates the selected item when the value prop changes.
|
|
28
35
|
* @param {Object} nextProps - The next props.
|
|
29
36
|
*/},{key:"UNSAFE_componentWillReceiveProps",value:function UNSAFE_componentWillReceiveProps(nextProps){if(!this.state.selected||nextProps.value!==this.state.selected.value){this.state.selected=normalizeItem(findItemByValue(nextProps.items,nextProps.value));}}/**
|
|
30
37
|
* Removes event listener when the component will unmount.
|
|
31
|
-
*/},{key:"componentWillUnmount",value:function componentWillUnmount(){document.removeEventListener('touchstart',this.handleInteractionOutside);}
|
|
32
|
-
* Triggers the onChange callback if the selected value has changed.
|
|
33
|
-
* @param {Object} nextState - The next state.
|
|
34
|
-
*/},{key:"render",/**
|
|
38
|
+
*/},{key:"componentWillUnmount",value:function componentWillUnmount(){document.removeEventListener('touchstart',this.handleInteractionOutside);}},{key:"render",value:/**
|
|
35
39
|
* Renders the component.
|
|
36
40
|
* @returns {JSX}
|
|
37
|
-
*/
|
|
41
|
+
*/function render(){var _this3=this;var hasSelection=this.state.selected&&this.state.selected.value!==undefined;var selectedLabel=hasSelection?this.state.selected.label:this.props.placeholder;var items=this.state.isOpen?React.createElement("div",{className:styles.items},this.props.items.map(function(item){var normalizedItem=normalizeItem(item);var selected=hasSelection&&_this3.state.selected.value===normalizedItem.value;return React.createElement(SelectItem,{key:normalizedItem.value,value:normalizedItem.value,label:normalizedItem.label,selected:selected,onSelect:_this3.handleItemSelect});})):null;return React.createElement("div",{className:"".concat(styles.container," ").concat(this.props.className," common_select"),ref:function ref(_ref2){_this3.domElement=_ref2;}},React.createElement("div",{onTouchStart:this.toggleOpenState},React.createElement("span",null,selectedLabel),React.createElement("span",{className:styles.selectHandle},"\u25BE")),items);}}]);}(Component);/**
|
|
42
|
+
* The component prop types.
|
|
43
|
+
* @type {Object}
|
|
44
|
+
*/ /**
|
|
45
|
+
* The component default props.
|
|
46
|
+
* @type {Object}
|
|
47
|
+
*/_defineProperty(Select,"defaultProps",{className:'',items:[],onChange:function onChange(){},placeholder:DEFAULT_PLACEHOLDER_TEXT,value:null});export default Select;
|
|
@@ -1,8 +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
|
|
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 classNames from'classnames';import PropTypes from'prop-types';import I18n from"../../../I18n";import{item}from"./style";/**
|
|
2
2
|
* The SelectBoxItem component.
|
|
3
3
|
* @param {Object} props The components props.
|
|
4
4
|
* @returns {JSX}
|
|
5
|
-
*/var SelectBoxItem=/*#__PURE__*/function(_Component){
|
|
5
|
+
*/var SelectBoxItem=/*#__PURE__*/function(_Component){function SelectBoxItem(){var _this2;_classCallCheck(this,SelectBoxItem);for(var _len=arguments.length,args=new Array(_len),_key=0;_key<_len;_key++){args[_key]=arguments[_key];}_this2=_callSuper(this,SelectBoxItem,[].concat(args));/**
|
|
6
|
+
* Calls the handleSelectionUpdate prop and prevents further events.
|
|
7
|
+
*/_defineProperty(_this2,"handleSelectionUpdate",function(){_this2.props.handleSelectionUpdate(_this2.props.value);});return _this2;}_inherits(SelectBoxItem,_Component);return _createClass(SelectBoxItem,[{key:"render",value:/**
|
|
6
8
|
* Renders the component
|
|
7
9
|
* @returns {JSX}
|
|
8
|
-
*/
|
|
10
|
+
*/function render(){var Wrapper=this.props.wrapper;var _this$props$className=this.props.classNames,selectItem=_this$props$className.selectItem,selectItemSelected=_this$props$className.selectItemSelected;return React.createElement("li",{className:classNames(selectItem,item,_defineProperty({},selectItemSelected,this.props.isSelected)),onKeyUp:function onKeyUp(){},onClick:this.handleSelectionUpdate,"data-test-id":this.props.label,role:"menuitem",ref:this.props.forwardedRef,tabIndex:this.props.isSelected?'0':'-1',"aria-current":this.props.isSelected},React.createElement(Wrapper,null,React.createElement(I18n.Text,{string:this.props.label})));}}]);}(Component);_defineProperty(SelectBoxItem,"defaultProps",{forwardedRef:null,classNames:{}});export default SelectBoxItem;
|
|
@@ -1,15 +1,24 @@
|
|
|
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 find from'lodash/find';import Dropdown from"../Dropdown";import I18n from"../I18n";import SelectBoxItem from"./components/Item";import styles from"./style";/**
|
|
2
2
|
* The select box component.
|
|
3
|
-
*/var SelectBox=/*#__PURE__*/function(_Component){
|
|
3
|
+
*/var SelectBox=/*#__PURE__*/function(_Component){/**
|
|
4
4
|
* Initializes the component.
|
|
5
5
|
* @param {Object} props The components props.
|
|
6
|
-
*/function SelectBox(props){var
|
|
7
|
-
|
|
6
|
+
*/function SelectBox(props){var _this2;_classCallCheck(this,SelectBox);_this2=_callSuper(this,SelectBox,[props]);/**
|
|
7
|
+
* When dropdown animation is finished.
|
|
8
|
+
*/_defineProperty(_this2,"onDropdownComplete",function(){_this2.dropdownCompleted=true;});/**
|
|
9
|
+
* Handles any interaction the user does outside of the component.
|
|
10
|
+
* In this case the select gets closed.
|
|
11
|
+
* @param {Object} event The event object.
|
|
12
|
+
*/_defineProperty(_this2,"handleInteractionOutside",function(event){_this2.setState({isOpen:false});event.preventDefault();event.stopPropagation();});/**
|
|
13
|
+
* Sets the open state to true
|
|
14
|
+
*/_defineProperty(_this2,"handleOpenList",function(){if(_this2.state.isOpen){return;}_this2.dropdownCompleted=false;_this2.setState({isOpen:true});if(_this2.firstItemRef){_this2.firstItemRef.focus();}});/**
|
|
15
|
+
* Sets the new active selection.
|
|
16
|
+
* @param {string} value Value of the selected item.
|
|
17
|
+
*/_defineProperty(_this2,"handleSelectionUpdate",function(value){var selection=find(_this2.props.items,{value:value});_this2.setState({selected:selection,isOpen:false});// Delay the callback to make sure actions are fired after animations are done.
|
|
18
|
+
setTimeout(function(){_this2.props.handleSelectionUpdate(selection.value);},_this2.props.duration);if(_this2.controlRef){_this2.controlRef.focus();}});/** @param {HTMLElement} ref The element */_defineProperty(_this2,"setControlRef",function(ref){_this2.controlRef=ref;});/** @param {HTMLElement} ref The element */_defineProperty(_this2,"setFirstItemRef",function(ref){_this2.firstItemRef=ref;});_this2.dropdownCompleted=false;_this2.state={isOpen:false,selected:find(props.items,{value:props.initialValue})};return _this2;}/**
|
|
8
19
|
* Reset selected when changing the initial value.
|
|
9
20
|
* @param {Object} nextProps The next props the component will receive.
|
|
10
|
-
*/_createClass(SelectBox,[{key:"UNSAFE_componentWillReceiveProps",value:function UNSAFE_componentWillReceiveProps(nextProps){if(this.props.initialValue!==nextProps.initialValue){this.setState({selected:find(nextProps.items,{value:nextProps.initialValue})});}}
|
|
11
|
-
* When dropdown animation is finished.
|
|
12
|
-
*/},{key:"render",/**
|
|
21
|
+
*/_inherits(SelectBox,_Component);return _createClass(SelectBox,[{key:"UNSAFE_componentWillReceiveProps",value:function UNSAFE_componentWillReceiveProps(nextProps){if(this.props.initialValue!==nextProps.initialValue){this.setState({selected:find(nextProps.items,{value:nextProps.initialValue})});}}},{key:"render",value:/**
|
|
13
22
|
* Renders the component
|
|
14
23
|
* @returns {JSX}
|
|
15
|
-
*/
|
|
24
|
+
*/function render(){var _this3=this;var Icon=this.props.icon;var _this$props$className=this.props.classNames,icon=_this$props$className.icon,_this$props$className2=_this$props$className.iconOpen,iconOpen=_this$props$className2===void 0?null:_this$props$className2,selection=_this$props$className.selection,button=_this$props$className.button,dropdown=_this$props$className.dropdown,selectItem=_this$props$className.selectItem,selectItemSelected=_this$props$className.selectItemSelected;var buttonLabel=this.state.selected?this.state.selected.label:this.props.defaultText;var iconClasses=classNames(icon,_defineProperty({},iconOpen,this.state.isOpen&&iconOpen!==null));return React.createElement("div",{className:"".concat(this.props.className," common__select-box"),"data-test-id":this.props.testId},React.createElement("button",{className:button,onClick:this.handleOpenList,"data-test-id":buttonLabel,type:"button","aria-haspopup":true,"aria-expanded":this.state.isOpen?true:null,"aria-controls":buttonLabel,ref:this.setControlRef},React.createElement("span",{className:selection},React.createElement(I18n.Text,{string:buttonLabel})),React.createElement("div",{className:iconClasses},React.createElement(Icon,null))),React.createElement(Dropdown,{className:dropdown,isOpen:this.state.isOpen,onComplete:this.onDropdownComplete,duration:this.props.duration},React.createElement("ul",{role:"menu",id:buttonLabel,tabIndex:"-1"},this.props.items.map(function(item){return React.createElement(SelectBoxItem,{classNames:{selectItem:selectItem,selectItemSelected:selectItemSelected},wrapper:_this3.props.item,key:item.value,value:item.value,label:item.label,handleSelectionUpdate:_this3.handleSelectionUpdate,isSelected:buttonLabel===item.label,forwardedRef:buttonLabel===item.label?_this3.setFirstItemRef:null});}))),this.state.isOpen&&React.createElement("button",{className:styles.overlay,onClick:this.handleInteractionOutside,onTouchMove:this.handleInteractionOutside,type:"button","aria-hidden":true}));}}]);}(Component);_defineProperty(SelectBox,"defaultProps",{className:'',classNames:{},duration:225,defaultText:'filter.sort.default',handleSelectionUpdate:function handleSelectionUpdate(){},initialValue:null,testId:null});export default SelectBox;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import React from'react';import{shallow}from'enzyme';import SwiperItem from'.';describe('<SwiperItem />',function(){it('should not render without children',function(){var wrapper=shallow(React.createElement(SwiperItem,null,React.createElement("div",null)));expect(wrapper).toMatchSnapshot();expect(wrapper.html()).toEqual('<div class="" data-test-id="Slider"><div></div></div>');});it('should add custom className',function(){var wrapper=shallow(React.createElement(SwiperItem,{className:"test"},React.createElement("div",null)));expect(wrapper).toMatchSnapshot();expect(wrapper.html()).toEqual('<div class="test" data-test-id="Slider"><div></div></div>');});});
|
|
1
|
+
import React from'react';import{shallow}from'enzyme';import SwiperItem from'.';describe('<SwiperItem />',function(){it('should not render without children',function(){var wrapper=shallow(React.createElement(SwiperItem,null,React.createElement("div",null)));expect(wrapper).toMatchSnapshot();expect(wrapper.html()).toEqual('<div class="css-10a4qrv" data-test-id="Slider"><div></div></div>');});it('should add custom className',function(){var wrapper=shallow(React.createElement(SwiperItem,{className:"test"},React.createElement("div",null)));expect(wrapper).toMatchSnapshot();expect(wrapper.html()).toEqual('<div class="css-10a4qrv test" data-test-id="Slider"><div></div></div>');});});
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
function _extends(){_extends=Object.assign||function(target){for(var i=1;i<arguments.length;i++){var source=arguments[i];for(var key in source){if(Object.prototype.hasOwnProperty.call(source,key)){target[key]=source[key];}}}return target;};return _extends.apply(this,arguments);}function _defineProperty(obj,key,value){if(key in obj){Object.defineProperty(obj,key,{value:value,enumerable:true,configurable:true,writable:true});}else{obj[key]=value;}return obj;}function _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;}import'react-id-swiper/lib/styles/css/swiper.css';import React,{useRef}from'react';import PropTypes from'prop-types';import cls from'classnames';import IDSwiper from'react-id-swiper';import{Pagination,Navigation,Autoplay,Zoom}from'swiper/dist/js/swiper.esm';import SwiperItem from"./components/SwiperItem";import{container,innerContainer,zoomFix,buttonNext,buttonPrev}from"./styles";/**
|
|
1
|
+
var _excluded=["autoPlay","interval","children","controls","className","classNames","slidesPerView","maxIndicators","indicators","loop","snapItems","onSlideChange","disabled","aria-hidden"];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 _defineProperty(obj,key,value){if(key in obj){Object.defineProperty(obj,key,{value:value,enumerable:true,configurable:true,writable:true});}else{obj[key]=value;}return obj;}function _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;}import'react-id-swiper/lib/styles/css/swiper.css';import React,{useRef}from'react';import PropTypes from'prop-types';import cls from'classnames';import IDSwiper from'react-id-swiper';import{Pagination,Navigation,Autoplay,Zoom}from'swiper/dist/js/swiper.esm';import SwiperItem from"./components/SwiperItem";import{container,innerContainer,zoomFix,buttonNext,buttonPrev}from"./styles";/**
|
|
2
2
|
* The basic swiper component.
|
|
3
3
|
* @param {Object} props The component props.
|
|
4
4
|
* @returns {React.Node}
|
|
5
|
-
*/var Swiper=function Swiper(props){var autoPlay=props.autoPlay,interval=props.interval,children=props.children,controls=props.controls,className=props.className,classNames=props.classNames,slidesPerView=props.slidesPerView,maxIndicators=props.maxIndicators,indicators=props.indicators,loop=props.loop,snapItems=props.snapItems,onSlideChange=props.onSlideChange,disabled=props.disabled,ariaHidden=props['aria-hidden'],additionalParams=_objectWithoutProperties(props,
|
|
5
|
+
*/var Swiper=function Swiper(props){var autoPlay=props.autoPlay,interval=props.interval,children=props.children,controls=props.controls,className=props.className,classNames=props.classNames,slidesPerView=props.slidesPerView,maxIndicators=props.maxIndicators,indicators=props.indicators,loop=props.loop,snapItems=props.snapItems,onSlideChange=props.onSlideChange,disabled=props.disabled,ariaHidden=props['aria-hidden'],additionalParams=_objectWithoutProperties(props,_excluded);var zoom=props.zoom,freeMode=props.freeMode,initialSlide=props.initialSlide,rebuildOnUpdate=props.rebuildOnUpdate;var swiperInstance=useRef(null);/**
|
|
6
6
|
* Updates the swiper instance reference.
|
|
7
7
|
* @param {Object} instance A Swiper instance.
|
|
8
8
|
*/var updateSwiper=function updateSwiper(instance){// Only update the instance, when it differs from the current one.
|
|
@@ -11,6 +11,6 @@ if(loop){var autoplayRunning=instance.autoplay.running;var previousIndex=instanc
|
|
|
11
11
|
if(instance.activeIndex<1){instance.slideToLoop(children.length-1,0);}else if(instance.activeIndex>children.length){instance.slideToLoop(0,0);}if(autoplayRunning&&instance.activeIndex!==previousIndex){// Restart the autoplay when it was active before the auto slide.
|
|
12
12
|
instance.autoplay.start();}}});}};var useFraction=maxIndicators&&maxIndicators<children.length;var paginationType=useFraction?'fraction':'bullets';var el=indicators&&children.length>1?'.swiper-pagination':null;var navigation;if(typeof controls==='boolean'&&controls===false){navigation={nextEl:null,prevEl:null};}if(typeof controls==='boolean'&&controls===true){navigation={// Important to use dot notation (swiper internally use it as selector)
|
|
13
13
|
nextEl:".swiper-button-next.".concat(buttonNext),prevEl:".swiper-button-prev.".concat(buttonPrev)};}if(_typeof(controls)==='object'){navigation=controls;}var zoomEnabled=zoom===true||_typeof(zoom)==='object'&&Object.keys(zoom).length;var params={modules:[Pagination,Navigation,Autoplay,Zoom],containerClass:cls(innerContainer,classNames.container,_defineProperty({},zoomFix,zoomEnabled)),autoplay:autoPlay?{delay:interval}:false,initialSlide:initialSlide,navigation:navigation,pagination:{el:el,type:paginationType,bulletClass:classNames.bulletClass||'swiper-pagination-bullet',bulletActiveClass:classNames.bulletActiveClass||'swiper-pagination-bullet-active',dynamicBullets:true},loop:loop,rebuildOnUpdate:rebuildOnUpdate,// looping does not work with multiple slides per view
|
|
14
|
-
slidesPerView:loop?1:slidesPerView,freeMode:freeMode?true:!snapItems,getSwiper:updateSwiper,zoom:zoom,allowSlidePrev:!disabled,allowSlideNext:!disabled};return React.createElement("div",{className:cls(container,className),"aria-hidden":ariaHidden},React.createElement(IDSwiper,_extends({},params,additionalParams),children));};Swiper.Item=SwiperItem;Swiper.defaultProps={'aria-hidden':false,autoPlay:false,className:null,classNames:{},controls:false,indicators:false,initialSlide:0,interval:3000,loop:false,// @deprecated
|
|
14
|
+
slidesPerView:loop?1:slidesPerView,freeMode:freeMode?true:!snapItems,getSwiper:updateSwiper,zoom:zoom,allowSlidePrev:!disabled,allowSlideNext:!disabled};return React.createElement("div",{className:cls(container,className,'common__swiper'),"aria-hidden":ariaHidden},React.createElement(IDSwiper,_extends({},params,additionalParams),children));};Swiper.Item=SwiperItem;Swiper.defaultProps={'aria-hidden':false,autoPlay:false,className:null,classNames:{},controls:false,indicators:false,initialSlide:0,interval:3000,loop:false,// @deprecated
|
|
15
15
|
maxIndicators:null,onSlideChange:function onSlideChange(){},rebuildOnUpdate:true,slidesPerView:1,freeMode:false,// @deprecated
|
|
16
16
|
snapItems:true,zoom:false,disabled:false};export default Swiper;
|
|
@@ -1,3 +1,6 @@
|
|
|
1
|
-
import{css}from'glamor';import{themeColors}from'@shopgate/pwa-common/helpers/config';export var container=css({position:'relative',maxHeight:'100%'
|
|
1
|
+
import{css}from'glamor';import{themeColors}from'@shopgate/pwa-common/helpers/config';export var container=css({position:'relative',maxHeight:'100%'// This needs to be 100vw to compensate a chrome 80 bug - see related ticket / pr. (PWA-2509)
|
|
2
|
+
// commented out for now since it causes issues in the responsive layout
|
|
3
|
+
// width: '100vw',
|
|
4
|
+
}).toString();export var innerContainer=css({overflow:'hidden',' .swiper-wrapper':{alignItems:'stretch'},' .swiper-slide':{height:'auto'},' .swiper-pagination':{transform:'translate3d(-50%,0,0) !important',' .swiper-pagination-bullet':{background:themeColors.gray,opacity:'.5',margin:'0 4px',transition:'opacity 300ms cubic-bezier(0.25, 0.1, 0.25, 1)'},' .swiper-pagination-bullet-active.swiper-pagination-bullet-active-main':{opacity:1}}}).toString();/**
|
|
2
5
|
* Prevents a visible shrink animation of swiped out slides which where in a zoomed state before.
|
|
3
6
|
*/export var zoomFix=css({' .swiper-slide':{overflow:'hidden'}}).toString();export var wrapper=css({flexShrink:0});export var buttonNext=css({backgroundImage:"url(\"data:image/svg+xml;charset=utf-8,%3Csvg%20xmlns%3D'http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg'%20viewBox%3D'0%200%2027%2044'%3E%3Cpath%20d%3D'M27%2C22L27%2C22L5%2C44l-2.1-2.1L22.8%2C22L2.9%2C2.1L5%2C0L27%2C22L27%2C22z'%20fill%3D'%23808080'%2F%3E%3C%2Fsvg%3E\") !important"}).toString();export var buttonPrev=css({backgroundImage:"url(\"data:image/svg+xml;charset=utf-8,%3Csvg%20xmlns%3D'http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg'%20viewBox%3D'0%200%2027%2044'%3E%3Cpath%20d%3D'M0%2C22L22%2C0l2.1%2C2.1L4.2%2C22l19.9%2C19.9L22%2C44L0%2C22L0%2C22L0%2C22z'%20fill%3D'%23808080'%2F%3E%3C%2Fsvg%3E\") !important"}).toString();
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
function _typeof(obj){if(typeof Symbol==="function"&&typeof Symbol.iterator==="symbol"){_typeof=function _typeof(obj){return typeof obj;};}else{_typeof=function _typeof(obj){return obj&&typeof Symbol==="function"&&obj.constructor===Symbol&&obj!==Symbol.prototype?"symbol":typeof obj;};}return _typeof(obj);}function _extends(){_extends=Object.assign||function(target){for(var i=1;i<arguments.length;i++){var source=arguments[i];for(var key in source){if(Object.prototype.hasOwnProperty.call(source,key)){target[key]=source[key];}}}return target;};return _extends.apply(this,arguments);}function _classCallCheck(instance,Constructor){if(!(instance instanceof Constructor)){throw new TypeError("Cannot call a class as a function");}}function _defineProperties(target,props){for(var i=0;i<props.length;i++){var descriptor=props[i];descriptor.enumerable=descriptor.enumerable||false;descriptor.configurable=true;if("value"in descriptor)descriptor.writable=true;Object.defineProperty(target,descriptor.key,descriptor);}}function _createClass(Constructor,protoProps,staticProps){if(protoProps)_defineProperties(Constructor.prototype,protoProps);if(staticProps)_defineProperties(Constructor,staticProps);return Constructor;}function _possibleConstructorReturn(self,call){if(call&&(_typeof(call)==="object"||typeof call==="function")){return call;}return _assertThisInitialized(self);}function _assertThisInitialized(self){if(self===void 0){throw new ReferenceError("this hasn't been initialised - super() hasn't been called");}return self;}function _getPrototypeOf(o){_getPrototypeOf=Object.setPrototypeOf?Object.getPrototypeOf:function _getPrototypeOf(o){return o.__proto__||Object.getPrototypeOf(o);};return _getPrototypeOf(o);}function _inherits(subClass,superClass){if(typeof superClass!=="function"&&superClass!==null){throw new TypeError("Super expression must either be null or a function");}subClass.prototype=Object.create(superClass&&superClass.prototype,{constructor:{value:subClass,writable:true,configurable:true}});if(superClass)_setPrototypeOf(subClass,superClass);}function _setPrototypeOf(o,p){_setPrototypeOf=Object.setPrototypeOf||function _setPrototypeOf(o,p){o.__proto__=p;return o;};return _setPrototypeOf(o,p);}function _defineProperty(obj,key,value){if(key in obj){Object.defineProperty(obj,key,{value:value,enumerable:true,configurable:true,writable:true});}else{obj[key]=value;}return obj;}import isEqual from'lodash/isEqual';import React,{Component}from'react';import PropTypes from'prop-types';import{findDOMNode}from'react-dom';import gsap from'gsap';/**
|
|
1
|
+
function _typeof(obj){if(typeof Symbol==="function"&&typeof Symbol.iterator==="symbol"){_typeof=function _typeof(obj){return typeof obj;};}else{_typeof=function _typeof(obj){return obj&&typeof Symbol==="function"&&obj.constructor===Symbol&&obj!==Symbol.prototype?"symbol":typeof obj;};}return _typeof(obj);}function _extends(){_extends=Object.assign||function(target){for(var i=1;i<arguments.length;i++){var source=arguments[i];for(var key in source){if(Object.prototype.hasOwnProperty.call(source,key)){target[key]=source[key];}}}return target;};return _extends.apply(this,arguments);}function _classCallCheck(instance,Constructor){if(!(instance instanceof Constructor)){throw new TypeError("Cannot call a class as a function");}}function _defineProperties(target,props){for(var i=0;i<props.length;i++){var descriptor=props[i];descriptor.enumerable=descriptor.enumerable||false;descriptor.configurable=true;if("value"in descriptor)descriptor.writable=true;Object.defineProperty(target,descriptor.key,descriptor);}}function _createClass(Constructor,protoProps,staticProps){if(protoProps)_defineProperties(Constructor.prototype,protoProps);if(staticProps)_defineProperties(Constructor,staticProps);return Constructor;}function _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 isEqual from'lodash/isEqual';import React,{Component}from'react';import PropTypes from'prop-types';import{findDOMNode}from'react-dom';import gsap from'gsap';/**
|
|
2
2
|
* Handles a transition of an object.
|
|
3
3
|
* This component only can have one child element at a time!
|
|
4
|
-
*/var Transition=/*#__PURE__*/function(_Component){
|
|
4
|
+
*/var Transition=/*#__PURE__*/function(_Component){function Transition(){_classCallCheck(this,Transition);return _callSuper(this,Transition,arguments);}_inherits(Transition,_Component);return _createClass(Transition,[{key:"componentDidMount",value:/**
|
|
5
5
|
* Runs the transition animation initially.
|
|
6
|
-
*/
|
|
6
|
+
*/function componentDidMount(){this.animate();}/**
|
|
7
7
|
* Checks if transition related props (from/to) have updated and runs the animation.
|
|
8
8
|
* @param {Object} nextProps - The received props.
|
|
9
9
|
*/},{key:"UNSAFE_componentWillReceiveProps",value:function UNSAFE_componentWillReceiveProps(nextProps){if(!isEqual(this.props.from,nextProps.from)||!isEqual(this.props.to,nextProps.to)){this.animate(nextProps);}}/**
|
|
@@ -21,4 +21,4 @@ this.tween=gsap.from(element,duration,_extends({},props.from,{},transitionSettin
|
|
|
21
21
|
this.tween=gsap.to(element,duration,_extends({},props.to,{},transitionSettings));}}/**
|
|
22
22
|
* Renders the component.
|
|
23
23
|
* @returns {JSX}
|
|
24
|
-
*/},{key:"render",value:function render(){return React.Children.only(this.getFirstChild());}}]);
|
|
24
|
+
*/},{key:"render",value:function render(){return React.Children.only(this.getFirstChild());}}]);}(Component);_defineProperty(Transition,"defaultProps",{easing:'Power1.easeOut',origin:'0 0 0',duration:150,from:null,onComplete:function onComplete(){},set:null,to:null});export default Transition;
|
|
@@ -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);}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,Suspense}from'react';import PropTypes from'prop-types';import isEqual from'lodash/isEqual';import Loading from"../../../Loading";import Grid from"../../../Grid";import styles 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,Suspense}from'react';import PropTypes from'prop-types';import isEqual from'lodash/isEqual';import Loading from"../../../Loading";import Grid from"../../../Grid";import styles from"./style";/**
|
|
2
2
|
* The widget component.
|
|
3
|
-
*/var Widget=/*#__PURE__*/function(_Component){
|
|
3
|
+
*/var Widget=/*#__PURE__*/function(_Component){function Widget(){_classCallCheck(this,Widget);return _callSuper(this,Widget,arguments);}_inherits(Widget,_Component);return _createClass(Widget,[{key:"shouldComponentUpdate",value:/**
|
|
4
4
|
* @param {Object} nextProps The next component props.
|
|
5
5
|
* @return {boolean}
|
|
6
|
-
*/
|
|
6
|
+
*/function shouldComponentUpdate(nextProps){if(this.props.component!==nextProps.component)return true;if(!isEqual(this.props.config,nextProps.config))return true;return false;}/**
|
|
7
7
|
* @return {JSX}
|
|
8
|
-
*/},{key:"render",value:function render(){var _this$props$config=this.props.config,col=_this$props$config.col,row=_this$props$config.row,height=_this$props$config.height,settings=_this$props$config.settings,width=_this$props$config.width;if(!this.props.component){return null;}return React.createElement(Grid.Item,{className:styles.widgetCell({col:col,row:row,height:height,width:width}),component:"div"},React.createElement("div",{className:styles.content},React.createElement(Suspense,{fallback:React.createElement(Loading,null)},React.createElement(this.props.component,{settings:settings,ratio:[width,height]}))));}}]);
|
|
8
|
+
*/},{key:"render",value:function render(){var _this$props$config=this.props.config,col=_this$props$config.col,row=_this$props$config.row,height=_this$props$config.height,settings=_this$props$config.settings,width=_this$props$config.width;if(!this.props.component){return null;}return React.createElement(Grid.Item,{className:"common__widgets__widget ".concat(styles.widgetCell({col:col,row:row,height:height,width:width})),component:"div"},React.createElement("div",{className:styles.content},React.createElement(Suspense,{fallback:React.createElement(Loading,null)},React.createElement(this.props.component,{settings:settings,ratio:[width,height]}))));}}]);}(Component);_defineProperty(Widget,"defaultProps",{component:null});export default Widget;
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
function _typeof(obj){if(typeof Symbol==="function"&&typeof Symbol.iterator==="symbol"){_typeof=function _typeof(obj){return typeof obj;};}else{_typeof=function _typeof(obj){return obj&&typeof Symbol==="function"&&obj.constructor===Symbol&&obj!==Symbol.prototype?"symbol":typeof obj;};}return _typeof(obj);}function _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 isEqual from'lodash/isEqual';import PropTypes from'prop-types';import sortBy from'lodash/sortBy';import Widget from"../Widget";import styles from"./style";import shouldShowWidget from"../../helpers/shouldShowWidget";/**
|
|
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 isEqual from'lodash/isEqual';import PropTypes from'prop-types';import sortBy from'lodash/sortBy';import Widget from"../Widget";import styles from"./style";import shouldShowWidget from"../../helpers/shouldShowWidget";/**
|
|
2
2
|
* The WidgetGrid component.
|
|
3
|
-
*/var WidgetGrid=/*#__PURE__*/function(_Component){
|
|
3
|
+
*/var WidgetGrid=/*#__PURE__*/function(_Component){function WidgetGrid(){_classCallCheck(this,WidgetGrid);return _callSuper(this,WidgetGrid,arguments);}_inherits(WidgetGrid,_Component);return _createClass(WidgetGrid,[{key:"shouldComponentUpdate",value:/**
|
|
4
4
|
* @param {Object} nextProps The next component props.
|
|
5
5
|
* @return {boolean}
|
|
6
|
-
*/
|
|
6
|
+
*/function shouldComponentUpdate(nextProps){if(!isEqual(this.props.components,nextProps.components))return true;if(!isEqual(this.props.config,nextProps.config))return true;return false;}/**
|
|
7
7
|
* Render the component.
|
|
8
8
|
* @return {JSX}
|
|
9
9
|
*/},{key:"render",value:function render(){var _this$props=this.props,components=_this$props.components,config=_this$props.config;if(!config.length){return null;}// TODO: This should not happen within every render call.
|
|
10
10
|
// Sort the widgets by row. This has to happen to take care of the z-index flow.
|
|
11
|
-
var widgets=sortBy(config,['row']).filter(function(w){return shouldShowWidget(w.settings);});return React.createElement("div",{className:styles},Object.keys(widgets).map(function(key){var widget=widgets[key];var widgetKey="w".concat(key);// Map to the correct widget component using the `type` key inside the widget.
|
|
12
|
-
var WidgetComponent=components[widget.type];return React.createElement(Widget,{config:widget,component:WidgetComponent,key:widgetKey});}));}}]);
|
|
11
|
+
var widgets=sortBy(config,['row']).filter(function(w){return shouldShowWidget(w.settings);});return React.createElement("div",{className:"".concat(styles," common__widgets__widget-grid")},Object.keys(widgets).map(function(key){var widget=widgets[key];var widgetKey="w".concat(key);// Map to the correct widget component using the `type` key inside the widget.
|
|
12
|
+
var WidgetComponent=components[widget.type];return React.createElement(Widget,{config:widget,component:WidgetComponent,key:widgetKey});}));}}]);}(Component);_defineProperty(WidgetGrid,"defaultProps",{config:[]});export default WidgetGrid;
|
|
@@ -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 _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 isEqual from'lodash/isEqual';import WidgetGrid from"./components/WidgetGrid";import shouldShowWidget from"./helpers/shouldShowWidget";var WIDGET_GRID_TYPE='@shopgate/commerce-widgets/widget-grid';var GRID_COLUMNS=12;// One grid row has 12 columns. // TODO: is it deprecated since css grid?
|
|
1
|
+
function _typeof(obj){if(typeof Symbol==="function"&&typeof Symbol.iterator==="symbol"){_typeof=function _typeof(obj){return typeof obj;};}else{_typeof=function _typeof(obj){return obj&&typeof Symbol==="function"&&obj.constructor===Symbol&&obj!==Symbol.prototype?"symbol":typeof obj;};}return _typeof(obj);}function _extends(){_extends=Object.assign||function(target){for(var i=1;i<arguments.length;i++){var source=arguments[i];for(var key in source){if(Object.prototype.hasOwnProperty.call(source,key)){target[key]=source[key];}}}return target;};return _extends.apply(this,arguments);}function _classCallCheck(instance,Constructor){if(!(instance instanceof Constructor)){throw new TypeError("Cannot call a class as a function");}}function _defineProperties(target,props){for(var i=0;i<props.length;i++){var descriptor=props[i];descriptor.enumerable=descriptor.enumerable||false;descriptor.configurable=true;if("value"in descriptor)descriptor.writable=true;Object.defineProperty(target,descriptor.key,descriptor);}}function _createClass(Constructor,protoProps,staticProps){if(protoProps)_defineProperties(Constructor.prototype,protoProps);if(staticProps)_defineProperties(Constructor,staticProps);return Constructor;}function _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 isEqual from'lodash/isEqual';import WidgetGrid from"./components/WidgetGrid";import shouldShowWidget from"./helpers/shouldShowWidget";var WIDGET_GRID_TYPE='@shopgate/commerce-widgets/widget-grid';var GRID_COLUMNS=12;// One grid row has 12 columns. // TODO: is it deprecated since css grid?
|
|
2
2
|
/**
|
|
3
3
|
* Creates a grid wrapper for widget(s).
|
|
4
4
|
* @param {string} key The unique key.
|
|
@@ -7,12 +7,12 @@ function _typeof(obj){if(typeof Symbol==="function"&&typeof Symbol.iterator==="s
|
|
|
7
7
|
* @returns {JSX} The wrapper.
|
|
8
8
|
*/var createGridWrapper=function createGridWrapper(key,config,components){return React.createElement(WidgetGrid,{key:key,config:config,components:components});};/**
|
|
9
9
|
* The widgets component.
|
|
10
|
-
*/var Widgets=/*#__PURE__*/function(_Component){
|
|
10
|
+
*/var Widgets=/*#__PURE__*/function(_Component){/**
|
|
11
11
|
* @param {Object} props The component props.
|
|
12
|
-
*/function Widgets(props){var
|
|
12
|
+
*/function Widgets(props){var _this2;_classCallCheck(this,Widgets);_this2=_callSuper(this,Widgets,[props]);_this2.autoReloadInterval=undefined;if(_this2.hasSchedulableWidgets()){_this2.startAutoRerender();}return _this2;}/**
|
|
13
13
|
* @param {Object} nextProps The next component props.
|
|
14
14
|
* @return {JSX}
|
|
15
|
-
*/_createClass(Widgets,[{key:"shouldComponentUpdate",value:function shouldComponentUpdate(nextProps){if(!isEqual(this.props.components,nextProps.components)){return true;}if(!isEqual(this.props.widgets,nextProps.widgets)){return true;}return false;}/**
|
|
15
|
+
*/_inherits(Widgets,_Component);return _createClass(Widgets,[{key:"shouldComponentUpdate",value:function shouldComponentUpdate(nextProps){if(!isEqual(this.props.components,nextProps.components)){return true;}if(!isEqual(this.props.widgets,nextProps.widgets)){return true;}return false;}/**
|
|
16
16
|
* Component will unmount lifecycle method.
|
|
17
17
|
*/},{key:"componentWillUnmount",value:function componentWillUnmount(){this.stopAutoRerender();}/**
|
|
18
18
|
* Checks if any widget is schedulable.
|
|
@@ -20,7 +20,7 @@ function _typeof(obj){if(typeof Symbol==="function"&&typeof Symbol.iterator==="s
|
|
|
20
20
|
* @returns {boolean}
|
|
21
21
|
*/},{key:"hasSchedulableWidgets",value:function hasSchedulableWidgets(){return(this.props.widgets||[]).some(function(widget){return widget.settings.plan;});}/**
|
|
22
22
|
* Sets auto re-render.
|
|
23
|
-
*/},{key:"startAutoRerender",value:function startAutoRerender(){var
|
|
23
|
+
*/},{key:"startAutoRerender",value:function startAutoRerender(){var _this3=this;var minutesToRoundedHour=60-new Date().getMinutes();var nextRerenderIn=minutesToRoundedHour*60000;this.autoReloadTimeout=setTimeout(function(){return _this3.doAutoRerender();},nextRerenderIn);}/**
|
|
24
24
|
* Stops auto re-render. Must be called before component is unmounted to avoid
|
|
25
25
|
* memory leak.
|
|
26
26
|
*/},{key:"stopAutoRerender",value:function stopAutoRerender(){clearTimeout(this.autoReloadTimeout);}/**
|
|
@@ -33,4 +33,4 @@ return createGridWrapper(key,widget.settings.widgets,components);}if(widget.heig
|
|
|
33
33
|
return createGridWrapper(key,[_extends({},widget,{col:0,row:0,width:GRID_COLUMNS})],components);}// In all other cases just create and return the widget component.
|
|
34
34
|
return React.createElement(components[widget.type],_extends({},widget,{key:key}));});}/**
|
|
35
35
|
* @return {JSX}
|
|
36
|
-
*/},{key:"render",value:function render(){var _this$props2=this.props,widgets=_this$props2.widgets,components=_this$props2.components;if(!widgets){return null;}return React.createElement("div",
|
|
36
|
+
*/},{key:"render",value:function render(){var _this$props2=this.props,widgets=_this$props2.widgets,components=_this$props2.components;if(!widgets){return null;}return React.createElement("div",{className:"common__widgets"},this.createArrayOfElements(widgets,components));}}]);}(Component);_defineProperty(Widgets,"defaultProps",{components:null,widgets:null});export default Widgets;
|
package/components/index.js
CHANGED
|
@@ -1,2 +1 @@
|
|
|
1
|
-
export{default as Ellipsis}from"./Ellipsis"
|
|
2
|
-
export{default as Router}from"./Router";export{default as Image}from"./Image";export{default as Link}from"./Link";export{default as Route}from"./Route";export{default as Portal}from"./Portal";export{default as Slider}from"./Slider";export{default as Swiper}from"./Swiper";export{default as SurroundPortals}from"./SurroundPortals";
|
|
1
|
+
export{default as Ellipsis}from"./Ellipsis";export{default as Router}from"./Router";export{default as Image}from"./Image";export{default as Link}from"./Link";export{default as Route}from"./Route";export{default as Portal}from"./Portal";export{default as Slider}from"./Slider";export{default as Swiper}from"./Swiper";export{default as SurroundPortals}from"./SurroundPortals";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export var APP_PLATFORM=Symbol('APP_PLATFORM');export var RESET_APP_REDUCERS=Symbol('RESET_APP_REDUCERS');export var DEFAULT_PRODUCTS_FETCH_PARAMS=Symbol('DEFAULT_PRODUCTS_FETCH_PARAMS');export var TAB_BAR_PATTERNS_BLACK_LIST=Symbol('TAB_BAR_PATTERNS_BLACK_LIST');export var PIPELINES=Symbol('PIPELINES');export var IS_CONNECT_EXTENSION_ATTACHED=Symbol('IS_CONNECT_EXTENSION_ATTACHED');
|
|
1
|
+
export var APP_PLATFORM=Symbol('APP_PLATFORM');export var RESET_APP_REDUCERS=Symbol('RESET_APP_REDUCERS');export var DEFAULT_PRODUCTS_FETCH_PARAMS=Symbol('DEFAULT_PRODUCTS_FETCH_PARAMS');export var TAB_BAR_PATTERNS_BLACK_LIST=Symbol('TAB_BAR_PATTERNS_BLACK_LIST');export var CONFIGURATION_COLLECTION_KEY_BASE_URL='CONFIGURATION_COLLECTION_KEY_BASE_URL';export var PIPELINES=Symbol('PIPELINES');export var IS_CONNECT_EXTENSION_ATTACHED=Symbol('IS_CONNECT_EXTENSION_ATTACHED');
|
package/constants/Device.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
function _extends(){_extends=Object.assign||function(target){for(var i=1;i<arguments.length;i++){var source=arguments[i];for(var key in source){if(Object.prototype.hasOwnProperty.call(source,key)){target[key]=source[key];}}}return target;};return _extends.apply(this,arguments);}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;}export var OS_ALL='all';export var OS_ANDROID='android';export var OS_IOS='ios';export var TYPE_PHONE='phone';export var TYPE_TABLET='tablet';export var MODEL_NAMES_IPHONE_X=['iPhone10,3','iPhone10,6','iPhone11,2','iPhone11,4','iPhone11,6','iPhone11,8'];/**
|
|
2
2
|
* Page insets are device screen areas which can't be used to display content. Those come especially
|
|
3
3
|
* relevant on iOS devices with their status bar ot the iPhone notch at the top of the screen.
|
|
4
|
-
*/export var PAGE_INSET_NAME_TOP='safeAreaInsetTop';export var PAGE_INSET_NAME_BOTTOM='safeAreaInsetBottom';export var PAGE_INSET_NAME_LEFT='safeAreaInsetLeft';export var PAGE_INSET_NAME_RIGHT='safeAreaInsetRight';export var PAGE_INSETS_ANDROID=(
|
|
4
|
+
*/export var PAGE_INSET_NAME_TOP='safeAreaInsetTop';export var PAGE_INSET_NAME_BOTTOM='safeAreaInsetBottom';export var PAGE_INSET_NAME_LEFT='safeAreaInsetLeft';export var PAGE_INSET_NAME_RIGHT='safeAreaInsetRight';export var PAGE_INSETS_ANDROID=_defineProperty(_defineProperty(_defineProperty(_defineProperty({},PAGE_INSET_NAME_TOP,0),PAGE_INSET_NAME_BOTTOM,0),PAGE_INSET_NAME_LEFT,0),PAGE_INSET_NAME_RIGHT,0);export var PAGE_INSETS_IOS=_extends({},PAGE_INSETS_ANDROID,_defineProperty({},PAGE_INSET_NAME_TOP,20));export var PAGE_INSETS_IPHONE_X=_extends({},PAGE_INSETS_IOS,_defineProperty(_defineProperty({},PAGE_INSET_NAME_TOP,44),PAGE_INSET_NAME_BOTTOM,30));
|
package/constants/Portals.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
// FEATURES
|
|
2
2
|
var APP='app';var APP_BAR='app-bar';var VIEW='view';var PAGE='page';var NAV_MENU='nav-menu';var NO_RESULTS='no-results';var USER_MENU='user-menu';var FORM='form';// CONTENTS
|
|
3
|
-
var GLOBALS='globals';var ROUTES='routes';var FOOTER='footer';var CONTENT='content';var QUICK_LINKS='quick-links';var HOME='home';var LOGIN='login';var SCANNER='scanner';var REGISTER_LINK='register-link';var TERMS='terms';var PRIVACY='privacy';var IMPRINT='imprint';var STORE_INFORMATION='store-information';var STORE_INFORMATION_MORE='store-information-more';var STORE_INFORMATION_ABOUT='store-information-about';var MY_ACCOUNT='my-account';var LOGOUT='logout';var CONTAINER='container';var DEFAULT='default';var BACK='back';var CLOSE='close';var SIMPLE='simple';var CART_BUTTON='cart-button';// POSITIONS
|
|
4
|
-
export var BEFORE='before';export var AFTER='after';export var LEFT='left';export var CENTER='center';export var RIGHT='right';export var BELOW='below';export var APP_GLOBALS="".concat(APP,".").concat(GLOBALS);export var APP_ROUTES="".concat(APP,".").concat(ROUTES);export var APP_FOOTER_CONTENT_BEFORE="".concat(APP,".").concat(FOOTER,".").concat(CONTENT,".").concat(BEFORE);export var APP_FOOTER_CONTENT_AFTER="".concat(APP,".").concat(FOOTER,".").concat(CONTENT,".").concat(AFTER);export var VIEW_CONTENT_BEFORE="".concat(VIEW,".").concat(CONTENT,".").concat(BEFORE);export var VIEW_CONTENT="".concat(VIEW,".").concat(CONTENT);export var VIEW_CONTENT_AFTER="".concat(VIEW,".").concat(CONTENT,".").concat(AFTER);export var PAGE_CONTENT_BEFORE="".concat(PAGE,".").concat(CONTENT,".").concat(BEFORE);export var PAGE_CONTENT="".concat(PAGE,".").concat(CONTENT);export var PAGE_CONTENT_AFTER="".concat(PAGE,".").concat(CONTENT,".").concat(AFTER);export var PAGE_LOGIN_BEFORE="".concat(PAGE,".").concat(LOGIN,".").concat(BEFORE);export var PAGE_LOGIN="".concat(PAGE,".").concat(LOGIN);export var PAGE_LOGIN_AFTER="".concat(PAGE,".").concat(LOGIN,".").concat(AFTER);export var PAGE_LOGIN_FORM_BEFORE="".concat(PAGE,".").concat(LOGIN,".").concat(FORM,".").concat(BEFORE);export var PAGE_LOGIN_FORM="".concat(PAGE,".").concat(LOGIN,".").concat(FORM);export var PAGE_LOGIN_FORM_AFTER="".concat(PAGE,".").concat(LOGIN,".").concat(FORM,".").concat(AFTER);export var PAGE_LOGIN_REGISTER_LINK_BEFORE="".concat(PAGE,".").concat(LOGIN,".").concat(REGISTER_LINK,".").concat(BEFORE);export var PAGE_LOGIN_REGISTER_LINK="".concat(PAGE,".").concat(LOGIN,".").concat(REGISTER_LINK);export var PAGE_LOGIN_REGISTER_LINK_AFTER="".concat(PAGE,".").concat(LOGIN,".").concat(REGISTER_LINK,".").concat(AFTER);export var NAV_MENU_CONTENT_BEFORE="".concat(NAV_MENU,".").concat(CONTENT,".").concat(BEFORE);export var NAV_MENU_CONTENT_AFTER="".concat(NAV_MENU,".").concat(CONTENT,".").concat(AFTER);export var NAV_MENU_QUICK_LINKS="".concat(NAV_MENU,".").concat(QUICK_LINKS);export var NAV_MENU_QUICK_LINKS_BEFORE="".concat(NAV_MENU,".").concat(QUICK_LINKS,".").concat(BEFORE);export var NAV_MENU_QUICK_LINKS_AFTER="".concat(NAV_MENU,".").concat(QUICK_LINKS,".").concat(AFTER);export var NAV_MENU_HOME_BEFORE="".concat(NAV_MENU,".").concat(HOME,".").concat(BEFORE);export var NAV_MENU_HOME="".concat(NAV_MENU,".").concat(HOME);export var NAV_MENU_HOME_AFTER="".concat(NAV_MENU,".").concat(HOME,".").concat(AFTER);export var NAV_MENU_SCANNER_BEFORE="".concat(NAV_MENU,".").concat(SCANNER,".").concat(BEFORE);export var NAV_MENU_SCANNER="".concat(NAV_MENU,".").concat(SCANNER);export var NAV_MENU_SCANNER_AFTER="".concat(NAV_MENU,".").concat(SCANNER,".").concat(AFTER);export var NAV_MENU_TERMS_BEFORE="".concat(NAV_MENU,".").concat(TERMS,".").concat(BEFORE);export var NAV_MENU_TERMS="".concat(NAV_MENU,".").concat(TERMS);export var NAV_MENU_TERMS_AFTER="".concat(NAV_MENU,".").concat(TERMS,".").concat(AFTER);export var NAV_MENU_PRIVACY_BEFORE="".concat(NAV_MENU,".").concat(PRIVACY,".").concat(BEFORE);export var NAV_MENU_PRIVACY="".concat(NAV_MENU,".").concat(PRIVACY);export var NAV_MENU_PRIVACY_AFTER="".concat(NAV_MENU,".").concat(PRIVACY,".").concat(AFTER);export var NAV_MENU_IMPRINT_BEFORE="".concat(NAV_MENU,".").concat(IMPRINT,".").concat(BEFORE);export var NAV_MENU_IMPRINT="".concat(NAV_MENU,".").concat(IMPRINT);export var NAV_MENU_IMPRINT_AFTER="".concat(NAV_MENU,".").concat(IMPRINT,".").concat(AFTER);export var NAV_MENU_STORE_INFORMATION_BEFORE="".concat(NAV_MENU,".").concat(STORE_INFORMATION,".").concat(BEFORE);export var NAV_MENU_STORE_INFORMATION="".concat(NAV_MENU,".").concat(STORE_INFORMATION);export var NAV_MENU_STORE_INFORMATION_AFTER="".concat(NAV_MENU,".").concat(STORE_INFORMATION,".").concat(AFTER);export var NAV_MENU_STORE_INFORMATION_MORE_BEFORE="".concat(NAV_MENU,".").concat(STORE_INFORMATION_MORE,".").concat(BEFORE);export var NAV_MENU_STORE_INFORMATION_MORE="".concat(NAV_MENU,".").concat(STORE_INFORMATION_MORE);export var NAV_MENU_STORE_INFORMATION_MORE_AFTER="".concat(NAV_MENU,".").concat(STORE_INFORMATION_MORE,".").concat(AFTER);export var NAV_MENU_STORE_INFORMATION_ABOUT_BEFORE="".concat(NAV_MENU,".").concat(STORE_INFORMATION_ABOUT,".").concat(BEFORE);export var NAV_MENU_STORE_INFORMATION_ABOUT="".concat(NAV_MENU,".").concat(STORE_INFORMATION_ABOUT);export var NAV_MENU_STORE_INFORMATION_ABOUT_AFTER="".concat(NAV_MENU,".").concat(STORE_INFORMATION_ABOUT,".").concat(AFTER);export var NAV_MENU_MY_ACCOUNT_BEFORE="".concat(NAV_MENU,".").concat(MY_ACCOUNT,".").concat(BEFORE);export var NAV_MENU_MY_ACCOUNT="".concat(NAV_MENU,".").concat(MY_ACCOUNT);export var NAV_MENU_MY_ACCOUNT_AFTER="".concat(NAV_MENU,".").concat(MY_ACCOUNT,".").concat(AFTER);export var NAV_MENU_LOGOUT_BEFORE="".concat(NAV_MENU,".").concat(LOGOUT,".").concat(BEFORE);export var NAV_MENU_LOGOUT="".concat(NAV_MENU,".").concat(LOGOUT);export var NAV_MENU_LOGOUT_AFTER="".concat(NAV_MENU,".").concat(LOGOUT,".").concat(AFTER);export var NO_RESULTS_CONTENT_BEFORE="".concat(NO_RESULTS,".").concat(CONTENT,".").concat(BEFORE);export var NO_RESULTS_CONTENT="".concat(NO_RESULTS,".").concat(CONTENT);export var NO_RESULTS_CONTENT_AFTER="".concat(NO_RESULTS,".").concat(CONTENT,".").concat(AFTER);export var USER_MENU_CONTAINER_BEFORE="".concat(USER_MENU,".").concat(CONTAINER,".").concat(BEFORE);export var USER_MENU_CONTAINER="".concat(USER_MENU,".").concat(CONTAINER);export var USER_MENU_CONTAINER_AFTER="".concat(USER_MENU,".").concat(CONTAINER,".").concat(AFTER);export var APP_BAR_DEFAULT_BEFORE="".concat(APP_BAR,".").concat(DEFAULT,".").concat(BEFORE);export var APP_BAR_DEFAULT="".concat(APP_BAR,".").concat(DEFAULT);export var APP_BAR_DEFAULT_AFTER="".concat(APP_BAR,".").concat(DEFAULT,".").concat(AFTER);export var APP_BAR_BACK_BEFORE="".concat(APP_BAR,".").concat(BACK,".").concat(BEFORE);export var APP_BAR_BACK="".concat(APP_BAR,".").concat(BACK);export var APP_BAR_BACK_AFTER="".concat(APP_BAR,".").concat(BACK,".").concat(AFTER);export var APP_BAR_CLOSE_BEFORE="".concat(APP_BAR,".").concat(CLOSE,".").concat(BEFORE);export var APP_BAR_CLOSE="".concat(APP_BAR,".").concat(CLOSE);export var APP_BAR_CLOSE_AFTER="".concat(APP_BAR,".").concat(CLOSE,".").concat(AFTER);export var APP_BAR_SIMPLE_BEFORE="".concat(APP_BAR,".").concat(SIMPLE,".").concat(BEFORE);export var APP_BAR_SIMPLE="".concat(APP_BAR,".").concat(SIMPLE);export var APP_BAR_SIMPLE_AFTER="".concat(APP_BAR,".").concat(SIMPLE,".").concat(AFTER);export var APP_BAR_LEFT="".concat(APP_BAR,".").concat(LEFT);export var APP_BAR_LEFT_BEFORE="".concat(APP_BAR,".").concat(LEFT,".").concat(BEFORE);export var APP_BAR_LEFT_AFTER="".concat(APP_BAR,".").concat(LEFT,".").concat(AFTER);export var APP_BAR_CENTER="".concat(APP_BAR,".").concat(CENTER);export var APP_BAR_CENTER_BEFORE="".concat(APP_BAR,".").concat(CENTER,".").concat(BEFORE);export var APP_BAR_CENTER_AFTER="".concat(APP_BAR,".").concat(CENTER,".").concat(AFTER);export var APP_BAR_RIGHT="".concat(APP_BAR,".").concat(RIGHT);export var APP_BAR_RIGHT_BEFORE="".concat(APP_BAR,".").concat(RIGHT,".").concat(BEFORE);export var APP_BAR_RIGHT_AFTER="".concat(APP_BAR,".").concat(RIGHT,".").concat(AFTER);export var APP_BAR_BELOW="".concat(APP_BAR,".").concat(BELOW);export var APP_BAR_BELOW_BEFORE="".concat(APP_BAR,".").concat(BELOW,".").concat(BEFORE);export var APP_BAR_BELOW_AFTER="".concat(APP_BAR,".").concat(BELOW,".").concat(AFTER);export var APP_BAR_CART_BUTTON="".concat(APP_BAR,".").concat(CART_BUTTON);export var APP_BAR_CART_BUTTON_BEFORE="".concat(APP_BAR,".").concat(CART_BUTTON,".").concat(BEFORE);export var APP_BAR_CART_BUTTON_AFTER="".concat(APP_BAR,".").concat(CART_BUTTON,".").concat(AFTER);
|
|
3
|
+
var GLOBALS='globals';var ROUTES='routes';var FOOTER='footer';var CONTENT='content';var QUICK_LINKS='quick-links';var HOME='home';var LOGIN='login';var SCANNER='scanner';var REGISTER_LINK='register-link';var TERMS='terms';var PRIVACY='privacy';var PRIVACY_SETTINGS='privacy-settings';var IMPRINT='imprint';var STORE_INFORMATION='store-information';var STORE_INFORMATION_MORE='store-information-more';var STORE_INFORMATION_ABOUT='store-information-about';var MY_ACCOUNT='my-account';var LOGOUT='logout';var CONTAINER='container';var DEFAULT='default';var BACK='back';var CLOSE='close';var SIMPLE='simple';var CART_BUTTON='cart-button';var ITEMS='items';// POSITIONS
|
|
4
|
+
export var BEFORE='before';export var AFTER='after';export var LEFT='left';export var CENTER='center';export var RIGHT='right';export var BELOW='below';export var APP_GLOBALS="".concat(APP,".").concat(GLOBALS);export var APP_ROUTES="".concat(APP,".").concat(ROUTES);export var APP_FOOTER_CONTENT_BEFORE="".concat(APP,".").concat(FOOTER,".").concat(CONTENT,".").concat(BEFORE);export var APP_FOOTER_CONTENT_AFTER="".concat(APP,".").concat(FOOTER,".").concat(CONTENT,".").concat(AFTER);export var VIEW_CONTENT_BEFORE="".concat(VIEW,".").concat(CONTENT,".").concat(BEFORE);export var VIEW_CONTENT="".concat(VIEW,".").concat(CONTENT);export var VIEW_CONTENT_AFTER="".concat(VIEW,".").concat(CONTENT,".").concat(AFTER);export var PAGE_CONTENT_BEFORE="".concat(PAGE,".").concat(CONTENT,".").concat(BEFORE);export var PAGE_CONTENT="".concat(PAGE,".").concat(CONTENT);export var PAGE_CONTENT_AFTER="".concat(PAGE,".").concat(CONTENT,".").concat(AFTER);export var PAGE_LOGIN_BEFORE="".concat(PAGE,".").concat(LOGIN,".").concat(BEFORE);export var PAGE_LOGIN="".concat(PAGE,".").concat(LOGIN);export var PAGE_LOGIN_AFTER="".concat(PAGE,".").concat(LOGIN,".").concat(AFTER);export var PAGE_LOGIN_FORM_BEFORE="".concat(PAGE,".").concat(LOGIN,".").concat(FORM,".").concat(BEFORE);export var PAGE_LOGIN_FORM="".concat(PAGE,".").concat(LOGIN,".").concat(FORM);export var PAGE_LOGIN_FORM_AFTER="".concat(PAGE,".").concat(LOGIN,".").concat(FORM,".").concat(AFTER);export var PAGE_LOGIN_REGISTER_LINK_BEFORE="".concat(PAGE,".").concat(LOGIN,".").concat(REGISTER_LINK,".").concat(BEFORE);export var PAGE_LOGIN_REGISTER_LINK="".concat(PAGE,".").concat(LOGIN,".").concat(REGISTER_LINK);export var PAGE_LOGIN_REGISTER_LINK_AFTER="".concat(PAGE,".").concat(LOGIN,".").concat(REGISTER_LINK,".").concat(AFTER);export var NAV_MENU_CONTENT_BEFORE="".concat(NAV_MENU,".").concat(CONTENT,".").concat(BEFORE);export var NAV_MENU_CONTENT_AFTER="".concat(NAV_MENU,".").concat(CONTENT,".").concat(AFTER);export var NAV_MENU_QUICK_LINKS="".concat(NAV_MENU,".").concat(QUICK_LINKS);export var NAV_MENU_QUICK_LINKS_BEFORE="".concat(NAV_MENU,".").concat(QUICK_LINKS,".").concat(BEFORE);export var NAV_MENU_QUICK_LINKS_AFTER="".concat(NAV_MENU,".").concat(QUICK_LINKS,".").concat(AFTER);export var NAV_MENU_QUICK_LINKS_ITEMS="".concat(NAV_MENU,".").concat(QUICK_LINKS,".").concat(ITEMS);export var NAV_MENU_QUICK_LINKS_ITEMS_BEFORE="".concat(NAV_MENU,".").concat(QUICK_LINKS,".").concat(ITEMS,".").concat(BEFORE);export var NAV_MENU_QUICK_LINKS_ITEMS_AFTER="".concat(NAV_MENU,".").concat(QUICK_LINKS,".").concat(ITEMS,".").concat(AFTER);export var NAV_MENU_HOME_BEFORE="".concat(NAV_MENU,".").concat(HOME,".").concat(BEFORE);export var NAV_MENU_HOME="".concat(NAV_MENU,".").concat(HOME);export var NAV_MENU_HOME_AFTER="".concat(NAV_MENU,".").concat(HOME,".").concat(AFTER);export var NAV_MENU_SCANNER_BEFORE="".concat(NAV_MENU,".").concat(SCANNER,".").concat(BEFORE);export var NAV_MENU_SCANNER="".concat(NAV_MENU,".").concat(SCANNER);export var NAV_MENU_SCANNER_AFTER="".concat(NAV_MENU,".").concat(SCANNER,".").concat(AFTER);export var NAV_MENU_TERMS_BEFORE="".concat(NAV_MENU,".").concat(TERMS,".").concat(BEFORE);export var NAV_MENU_TERMS="".concat(NAV_MENU,".").concat(TERMS);export var NAV_MENU_TERMS_AFTER="".concat(NAV_MENU,".").concat(TERMS,".").concat(AFTER);export var NAV_MENU_PRIVACY_BEFORE="".concat(NAV_MENU,".").concat(PRIVACY,".").concat(BEFORE);export var NAV_MENU_PRIVACY="".concat(NAV_MENU,".").concat(PRIVACY);export var NAV_MENU_PRIVACY_AFTER="".concat(NAV_MENU,".").concat(PRIVACY,".").concat(AFTER);export var NAV_MENU_PRIVACY_SETTINGS_BEFORE="".concat(NAV_MENU,".").concat(PRIVACY_SETTINGS,".").concat(BEFORE);export var NAV_MENU_PRIVACY_SETTINGS="".concat(NAV_MENU,".").concat(PRIVACY_SETTINGS);export var NAV_MENU_PRIVACY_SETTINGS_AFTER="".concat(NAV_MENU,".").concat(PRIVACY_SETTINGS,".").concat(AFTER);export var NAV_MENU_IMPRINT_BEFORE="".concat(NAV_MENU,".").concat(IMPRINT,".").concat(BEFORE);export var NAV_MENU_IMPRINT="".concat(NAV_MENU,".").concat(IMPRINT);export var NAV_MENU_IMPRINT_AFTER="".concat(NAV_MENU,".").concat(IMPRINT,".").concat(AFTER);export var NAV_MENU_STORE_INFORMATION_BEFORE="".concat(NAV_MENU,".").concat(STORE_INFORMATION,".").concat(BEFORE);export var NAV_MENU_STORE_INFORMATION="".concat(NAV_MENU,".").concat(STORE_INFORMATION);export var NAV_MENU_STORE_INFORMATION_AFTER="".concat(NAV_MENU,".").concat(STORE_INFORMATION,".").concat(AFTER);export var NAV_MENU_STORE_INFORMATION_MORE_BEFORE="".concat(NAV_MENU,".").concat(STORE_INFORMATION_MORE,".").concat(BEFORE);export var NAV_MENU_STORE_INFORMATION_MORE="".concat(NAV_MENU,".").concat(STORE_INFORMATION_MORE);export var NAV_MENU_STORE_INFORMATION_MORE_AFTER="".concat(NAV_MENU,".").concat(STORE_INFORMATION_MORE,".").concat(AFTER);export var NAV_MENU_STORE_INFORMATION_ABOUT_BEFORE="".concat(NAV_MENU,".").concat(STORE_INFORMATION_ABOUT,".").concat(BEFORE);export var NAV_MENU_STORE_INFORMATION_ABOUT="".concat(NAV_MENU,".").concat(STORE_INFORMATION_ABOUT);export var NAV_MENU_STORE_INFORMATION_ABOUT_AFTER="".concat(NAV_MENU,".").concat(STORE_INFORMATION_ABOUT,".").concat(AFTER);export var NAV_MENU_MY_ACCOUNT_BEFORE="".concat(NAV_MENU,".").concat(MY_ACCOUNT,".").concat(BEFORE);export var NAV_MENU_MY_ACCOUNT="".concat(NAV_MENU,".").concat(MY_ACCOUNT);export var NAV_MENU_MY_ACCOUNT_AFTER="".concat(NAV_MENU,".").concat(MY_ACCOUNT,".").concat(AFTER);export var NAV_MENU_LOGOUT_BEFORE="".concat(NAV_MENU,".").concat(LOGOUT,".").concat(BEFORE);export var NAV_MENU_LOGOUT="".concat(NAV_MENU,".").concat(LOGOUT);export var NAV_MENU_LOGOUT_AFTER="".concat(NAV_MENU,".").concat(LOGOUT,".").concat(AFTER);export var NO_RESULTS_CONTENT_BEFORE="".concat(NO_RESULTS,".").concat(CONTENT,".").concat(BEFORE);export var NO_RESULTS_CONTENT="".concat(NO_RESULTS,".").concat(CONTENT);export var NO_RESULTS_CONTENT_AFTER="".concat(NO_RESULTS,".").concat(CONTENT,".").concat(AFTER);export var USER_MENU_CONTAINER_BEFORE="".concat(USER_MENU,".").concat(CONTAINER,".").concat(BEFORE);export var USER_MENU_CONTAINER="".concat(USER_MENU,".").concat(CONTAINER);export var USER_MENU_CONTAINER_AFTER="".concat(USER_MENU,".").concat(CONTAINER,".").concat(AFTER);export var APP_BAR_DEFAULT_BEFORE="".concat(APP_BAR,".").concat(DEFAULT,".").concat(BEFORE);export var APP_BAR_DEFAULT="".concat(APP_BAR,".").concat(DEFAULT);export var APP_BAR_DEFAULT_AFTER="".concat(APP_BAR,".").concat(DEFAULT,".").concat(AFTER);export var APP_BAR_BACK_BEFORE="".concat(APP_BAR,".").concat(BACK,".").concat(BEFORE);export var APP_BAR_BACK="".concat(APP_BAR,".").concat(BACK);export var APP_BAR_BACK_AFTER="".concat(APP_BAR,".").concat(BACK,".").concat(AFTER);export var APP_BAR_CLOSE_BEFORE="".concat(APP_BAR,".").concat(CLOSE,".").concat(BEFORE);export var APP_BAR_CLOSE="".concat(APP_BAR,".").concat(CLOSE);export var APP_BAR_CLOSE_AFTER="".concat(APP_BAR,".").concat(CLOSE,".").concat(AFTER);export var APP_BAR_SIMPLE_BEFORE="".concat(APP_BAR,".").concat(SIMPLE,".").concat(BEFORE);export var APP_BAR_SIMPLE="".concat(APP_BAR,".").concat(SIMPLE);export var APP_BAR_SIMPLE_AFTER="".concat(APP_BAR,".").concat(SIMPLE,".").concat(AFTER);export var APP_BAR_LEFT="".concat(APP_BAR,".").concat(LEFT);export var APP_BAR_LEFT_BEFORE="".concat(APP_BAR,".").concat(LEFT,".").concat(BEFORE);export var APP_BAR_LEFT_AFTER="".concat(APP_BAR,".").concat(LEFT,".").concat(AFTER);export var APP_BAR_CENTER="".concat(APP_BAR,".").concat(CENTER);export var APP_BAR_CENTER_BEFORE="".concat(APP_BAR,".").concat(CENTER,".").concat(BEFORE);export var APP_BAR_CENTER_AFTER="".concat(APP_BAR,".").concat(CENTER,".").concat(AFTER);export var APP_BAR_RIGHT="".concat(APP_BAR,".").concat(RIGHT);export var APP_BAR_RIGHT_BEFORE="".concat(APP_BAR,".").concat(RIGHT,".").concat(BEFORE);export var APP_BAR_RIGHT_AFTER="".concat(APP_BAR,".").concat(RIGHT,".").concat(AFTER);export var APP_BAR_BELOW="".concat(APP_BAR,".").concat(BELOW);export var APP_BAR_BELOW_BEFORE="".concat(APP_BAR,".").concat(BELOW,".").concat(BEFORE);export var APP_BAR_BELOW_AFTER="".concat(APP_BAR,".").concat(BELOW,".").concat(AFTER);export var APP_BAR_CART_BUTTON="".concat(APP_BAR,".").concat(CART_BUTTON);export var APP_BAR_CART_BUTTON_BEFORE="".concat(APP_BAR,".").concat(CART_BUTTON,".").concat(BEFORE);export var APP_BAR_CART_BUTTON_AFTER="".concat(APP_BAR,".").concat(CART_BUTTON,".").concat(AFTER);
|
package/helpers/config/mock.js
CHANGED
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
*/var shadows={material:'0 1px 6px rgba(0, 0, 0, .117647), 0 1px 4px rgba(0, 0, 0, .117647)',navDrawer:'0 0 15px rgba(0, 0, 0, .24)',widget:'0 4px 8px rgba(0, 0, 0, 0.16)',productCard:'0 4px 8px rgba(0, 0, 0, 0.16)',productImage:'inset 0 0 20px rgba(0, 0, 0, .05)',tabBar:'0 -1px 0 0 rgba(0, 0, 0, 0.1)',filter:{sort:'rgba(0, 0, 0, 0.16) 0 2px 2px',priceSlider:'0 0 8px rgba(0, 0, 0, .16)'},cart:{paymentBar:'0 -4px 5px -2px rgba(0, 0, 0, 0.1)'},dialog:'0 0.75em 3em 0 rgba(0, 0, 0, 0.5)',toast:'0 3px 1px -2px rgba(0, 0, 0, .2), 0 2px 2px 0 rgba(0, 0, 0, .14), 0 1px 5px 0 rgba(0, 0, 0, .12)',contextMenu:'0 2px 6px rgba(0, 0, 0, .4)',buttons:{disabled:'0 3px 4px rgba(0, 0, 0, 0.13)',elevated:'0 8px 13px rgba(0, 0, 0, 0.25)'},scannerBar:'0 0 0 1px rgba(0, 0, 0, 0.1)',sheet:'0 -2px 4px rgba(0, 0, 0, 0.1)'};/**
|
|
6
6
|
*
|
|
7
7
|
* @mixin ThemeVariables
|
|
8
|
-
*/var variables={materialShadow:shadows.material,gap:{xsmall:4,small:8,big:16,bigger:20,xbig:32,xxbig:64},emptyPage:{icon:216,titleTopGap:36,buttonVerticalGap:24},navbar:{height:56},toast:{duration:5000},navigator:{height:56,shadow:shadows.material},filterbar:{height:48},loadingIndicator:{size:32,strokeWidth:3},paymentBar:{height:78},buttonBase:{borderRadius:2,fontWeight:500,fontSize:17,padding:0,textTransform:'uppercase'},discountBadgeBase:{borderRadius:2,fontSize:'0.75rem'},productSliderWidget:{borderRadius:11,boxShadow:shadows.widget},liveshoppingWidget:{borderRadius:11,boxShadow:shadows.widget},tabBar:{height:0}};/**
|
|
8
|
+
*/var variables={materialShadow:shadows.material,gap:{xsmall:4,small:8,big:16,bigger:20,xbig:32,xxbig:64},emptyPage:{icon:216,titleTopGap:36,buttonVerticalGap:24},navbar:{height:56},toast:{duration:5000},navigator:{height:56,shadow:shadows.material},filterbar:{height:48},loadingIndicator:{size:32,strokeWidth:3,imgSrc:null},paymentBar:{height:78},buttonBase:{borderRadius:2,fontWeight:500,fontSize:17,padding:0,textTransform:'uppercase'},discountBadgeBase:{borderRadius:2,fontSize:'0.75rem'},productSliderWidget:{borderRadius:11,boxShadow:shadows.widget},liveshoppingWidget:{borderRadius:11,boxShadow:shadows.widget},tabBar:{height:0}};/**
|
|
9
9
|
* @mixin ThemeIcons
|
|
10
10
|
*/var icons={// ui-shared icons
|
|
11
11
|
accountBox:'<path d="M3 5v14c0 1.1.89 2 2 2h14c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2H5c-1.11 0-2 .9-2 2zm12 4c0 1.66-1.34 3-3 3s-3-1.34-3-3 1.34-3 3-3 3 1.34 3 3zm-9 8c0-2 4-3.1 6-3.1s6 1.1 6 3.1v1H6v-1z"/><path d="M0 0h24v24H0z" fill="none"/>',addMore:'<g fill="#000" fill-rule="nonzero"><path d="M11.326 20.682a1.193 1.193 0 1 0 2.385-.004 1.193 1.193 0 0 0-2.385.004zm-4.4 0a1.193 1.193 0 1 0 1.192-1.192 1.193 1.193 0 0 0-1.198 1.192h.006zm-2.4-14.8a.906.906 0 0 0-.843-.587h-1.98a.903.903 0 1 0 0 1.806h1.355l2.772 7.217a.906.906 0 0 0 .843.588h6.266a.875.875 0 1 1 0 1.75H6.187a.903.903 0 1 0 0 1.806h6.758a2.677 2.677 0 0 0 1.87-4.596l2.221-4.005a.902.902 0 0 0-.654-1.33H5.537L4.526 5.882zM20.897 6.682H23.8V4.87h-2.903V2h-1.794v2.869h-2.897v1.813h2.897v2.88h1.794z"/></g>',arrowDrop:'<path d="M7 10l5 5 5-5z"/>',arrow:'<path d="M20 11H7.83l5.59-5.59L12 4l-8 8 8 8 1.41-1.41L7.83 13H20v-2z"/>',arrowShadowed:'<defs><filter id="shadow"><feGaussianBlur in="SourceAlpha" stdDeviation="1" result="blur" /> <feOffset in="blur" dx="0" dy="1" result="offsetBlur" /> <feMerge> <feMergeNode in="offsetBlur" /> <feMergeNode in="SourceGraphic" /> </feMerge></filter> </defs> <path filter="url(#shadow)" d="M20 11H7.83l5.59-5.59L12 4l-8 8 8 8 1.41-1.41L7.83 13H20v-2z" />',barcodeScanner:'<path d="M4.3 6.226h1.926V17.77H4.3V6.226zm2.89 0h.965V17.77H7.19V6.226zm1.925 0H12V17.77H9.115V6.226zm3.85 0h.965V17.77h-.97l.005-11.544zm2.885 0h1.924V17.77H15.85V6.226zm2.884 0h.965V17.77h-.965V6.226zM2.376 4.3v3.85H.451V4.3a1.922 1.922 0 011.92-1.92h3.85v1.925H2.376zm19.248-1.925a1.922 1.922 0 011.92 1.92v3.85h-1.925V4.3h-3.85V2.376h3.855zM2.376 15.85v3.85h3.85v1.924h-3.85c-.254 0-.504-.048-.74-.149a1.9 1.9 0 01-.623-.417 1.952 1.952 0 01-.418-.624 1.95 1.95 0 01-.144-.74V15.85h1.925zm19.248 3.85v-3.85h1.925v3.85a1.922 1.922 0 01-1.92 1.92h-3.85v-1.926l3.845.005z"/>',box:'<path d="M 13.900391,1.4433594 1.5996094,4.171875 l 0,0.025391 8.5390626,4.2089844 c 4.073387,-0.9018528 8.163817,-1.7958087 12.24414,-2.69141 z m 8.490221,4.8261718 -11.986328,2.6152344 0.111328,13.4472654 11.875,-2.658203 z M 9.9003906,22.25 c -6.600261,1.166667 -3.3001305,0.583333 0,0 z m 0,0 0,-13.4316406 -8.3007812,-4.0957032 0,13.4589848 z M 4.4238281,9.2304688 c 1.01719,0.50398 2.0367375,1.0052022 3.0546875,1.5078122 0.32345,0.12833 0.4898582,0.544909 0.3300782,0.855469 C 6.7949938,11.0955 5.7712662,10.587588 4.7539062,10.085938 4.4304763,9.9572575 4.2659081,9.5411387 4.4238281,9.2304688 Z" />',browse:'<path fill="currentColor" d="M14.999 20.205l-4.454-4.531a6.48 6.48 0 01-3.764 1.228 6.682 6.682 0 116.605-6.681 6.77 6.77 0 01-1.69 4.454l4.382 4.455a.742.742 0 010 1.075.696.696 0 01-.541.23.81.81 0 01-.538-.23zM1.713 10.22a5.182 5.182 0 005.068 5.145 5.146 5.146 0 10-5.068-5.145zm15.36 1.766a.768.768 0 010-1.536h6.144a.768.768 0 010 1.536zm-.768-3.072a.768.768 0 110-1.536h6.912a.768.768 0 110 1.536zm-.768-3.072a.768.768 0 010-1.536h7.68a.768.768 0 010 1.536z"/>',burger:'<path d="M3 18h18v-2H3v2zm0-5h18v-2H3v2zm0-7v2h18V6H3z"/>',cart:'<path d="M7.9,18c-1.1,0-2,0.9-2,2s0.9,2,2,2s2-0.9,2-2S9,18,7.9,18z M17.9,18c-1.1,0-2,0.9-2,2s0.9,2,2,2c1.1,0,2-0.9,2-2S19,18,17.9,18z M8.1,14.8l0-0.1L9,13h7.5c0.7,0,1.4-0.4,1.7-1l3.9-7l-1.7-1h0l-1.1,2l-2.8,5h-7l-0.1-0.3L7.1,6L6.1,4L5.2,2H1.9v2h2l3.6,7.6L6.2,14c-0.2,0.3-0.2,0.6-0.2,1c0,1.1,0.9,2,2,2h12v-2H8.3C8.2,15,8.1,14.9,8.1,14.8z"/>',cartPlus:'<path d="M0 0h24v24H0zm18.31 6l-2.76 5z" fill="none"/><path d="M11 9h2V6h3V4h-3V1h-2v3H8v2h3v3zm-4 9c-1.1 0-1.99.9-1.99 2S5.9 22 7 22s2-.9 2-2-.9-2-2-2zm10 0c-1.1 0-1.99.9-1.99 2s.89 2 1.99 2 2-.9 2-2-.9-2-2-2zm-9.83-3.25l.03-.12.9-1.63h7.45c.75 0 1.41-.41 1.75-1.03l3.86-7.01L19.42 4h-.01l-1.1 2-2.76 5H8.53l-.13-.27L6.16 6l-.95-2-.94-2H1v2h2l3.6 7.59-1.35 2.45c-.16.28-.25.61-.25.96 0 1.1.9 2 2 2h12v-2H7.42c-.13 0-.25-.11-.25-.25z"/>',checked:'<path d="M19 3H5c-1.11 0-2 .9-2 2v14c0 1.1.89 2 2 2h14c1.11 0 2-.9 2-2V5c0-1.1-.89-2-2-2zm-9 14l-5-5 1.41-1.41L10 14.17l7.59-7.59L19 8l-9 9z"/>',check:'<path d="M1 11.248L8.84 19 23 5" stroke="#000" stroke-width="2" fill="none" fill-rule="evenodd"/>',chevron:'<path d="M15.41 7.41L14 6l-6 6 6 6 1.41-1.41L10.83 12z"/><path d="M0 0h24v24H0z" fill="none" />',creditCard:'<path d="M0 0h24v24H0z" fill="none"/><path d="M20 4H4c-1.11 0-1.99.89-1.99 2L2 18c0 1.11.89 2 2 2h16c1.11 0 2-.89 2-2V6c0-1.11-.89-2-2-2zm0 14H4v-6h16v6zm0-10H4V6h16v2z"/>',cross:'<path d="M19 6.41L17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12z"/>',description:'<path d="M0 0h24v24H0z" fill="none"/><path d="M14 2H6c-1.1 0-1.99.9-1.99 2L4 20c0 1.1.89 2 1.99 2H18c1.1 0 2-.9 2-2V8l-6-6zm2 16H8v-2h8v2zm0-4H8v-2h8v2zm-3-5V3.5L18.5 9H13z"/>',filter:'<path d="M10 18h4v-2h-4v2zM3 6v2h18V6H3zm3 7h12v-2H6v2z"/>',flashDisabled:'<path d="M15.22,3.1,12,9.51l-.8,1.59h3.86l-4,6.83v-6h-3V3.1h7.12M17,2h0Zm0,0H7V13h3v9l7-12H13l4-8Z" />',flashEnabled:'<path d="M0 0h24v24H0z" fill="none"/><path d="M7 2v11h3v9l7-12h-4l4-8z"/>',grid:' <rect width="8" height="8" rx="1" transform="translate(3 3)"/> <rect width="8" height="8" rx="1" transform="translate(3 13)"/> <rect width="8" height="8" rx="1" transform="translate(13 3)"/> <rect width="8" height="8" rx="1" transform="translate(13 13)"/>',heart:'<path d="M12 21.35l-1.45-1.32C5.4 15.36 2 12.28 2 8.5 2 5.42 4.42 3 7.5 3c1.74 0 3.41.81 4.5 2.09C13.09 3.81 14.76 3 16.5 3 19.58 3 22 5.42 22 8.5c0 3.78-3.4 6.86-8.55 11.54L12 21.35z"/>',heartOutline:'<path d="M16.5 3c-1.74 0-3.41.81-4.5 2.09C10.91 3.81 9.24 3 7.5 3 4.42 3 2 5.42 2 8.5c0 3.78 3.4 6.86 8.55 11.54L12 21.35l1.45-1.32C18.6 15.36 22 12.28 22 8.5 22 5.42 19.58 3 16.5 3zm-4.4 15.55l-.1.1-.1-.1C7.14 14.24 4 11.39 4 8.5 4 6.5 5.5 5 7.5 5c1.54 0 3.04.99 3.57 2.36h1.87C13.46 5.99 14.96 5 16.5 5c2 0 3.5 1.5 3.5 3.5 0 2.89-3.14 5.74-7.9 10.05z"/>',home:'<path d="M10 20v-6h4v6h5v-8h3L12 3 2 12h3v8z"/><path d="M0 0h24v24H0z" fill="none"/>',info:'<path d="M0 0h24v24H0z" fill="none"/><path d="M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm1 15h-2v-6h2v6zm0-8h-2V7h2v2z"/>',infoOutline:'<path d="M0 0h24v24H0z" fill="none"/><path d="M11 17h2v-6h-2v6zm1-15C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm0 18c-4.41 0-8-3.59-8-8s3.59-8 8-8 8 3.59 8 8-3.59 8-8 8zM11 9h2V7h-2v2z"/>',list:'<path d="M3 13h2v-2H3v2zm0 4h2v-2H3v2zm0-8h2V7H3v2zm4 4h14v-2H7v2zm0 4h14v-2H7v2zM7 7v2h14V7H7z"/>',localShipping:'<path d="M0 0h24v24H0z" fill="none"/><path d="M20 8h-3V4H3c-1.1 0-2 .9-2 2v11h2c0 1.66 1.34 3 3 3s3-1.34 3-3h6c0 1.66 1.34 3 3 3s3-1.34 3-3h2v-5l-3-4zM6 18.5c-.83 0-1.5-.67-1.5-1.5s.67-1.5 1.5-1.5 1.5.67 1.5 1.5-.67 1.5-1.5 1.5zm13.5-9l1.96 2.5H17V9.5h2.5zm-1.5 9c-.83 0-1.5-.67-1.5-1.5s.67-1.5 1.5-1.5 1.5.67 1.5 1.5-.67 1.5-1.5 1.5z"/>',lock:'<path d="M0 0h24v24H0z" fill="none"/><path d="M18 8h-1V6c0-2.76-2.24-5-5-5S7 3.24 7 6v2H6c-1.1 0-2 .9-2 2v10c0 1.1.9 2 2 2h12c1.1 0 2-.9 2-2V10c0-1.1-.9-2-2-2zm-6 9c-1.1 0-2-.9-2-2s.9-2 2-2 2 .9 2 2-.9 2-2 2zm3.1-9H8.9V6c0-1.71 1.39-3.1 3.1-3.1 1.71 0 3.1 1.39 3.1 3.1v2z"/>',logout:'<path d="M0 0h24v24H0z" fill="none"/><path d="M13 3h-2v10h2V3zm4.83 2.17l-1.42 1.42C17.99 7.86 19 9.81 19 12c0 3.87-3.13 7-7 7s-7-3.13-7-7c0-2.19 1.01-4.14 2.58-5.42L6.17 5.17C4.23 6.82 3 9.26 3 12c0 4.97 4.03 9 9 9s9-4.03 9-9c0-2.74-1.23-5.18-3.17-6.83z"/>',magnifier:'<path d="M15.5 14h-.79l-.28-.27C15.41 12.59 16 11.11 16 9.5 16 5.91 13.09 3 9.5 3S3 5.91 3 9.5 5.91 16 9.5 16c1.61 0 3.09-.59 4.23-1.57l.27.28v.79l5 4.99L20.49 19l-4.99-5zm-6 0C7.01 14 5 11.99 5 9.5S7.01 5 9.5 5 14 7.01 14 9.5 11.99 14 9.5 14z"/>',more:'<path fill="currentColor" d="M18.115 11.693a2.943 2.943 0 112.943 2.943 2.942 2.942 0 01-2.943-2.943zm-9.056 0a2.945 2.945 0 112.943 2.943 2.946 2.946 0 01-2.947-2.943zm-9.056 0a2.943 2.943 0 112.942 2.943A2.945 2.945 0 010 11.693z"/>',moreVert:'<path d="M0 0h24v24H0z" fill="none"/><path d="M12 8c1.1 0 2-.9 2-2s-.9-2-2-2-2 .9-2 2 .9 2 2 2zm0 2c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2zm0 6c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2z"/>',placeholder:'<circle cx="12" cy="12" r="3.2"/><path d="M9 2L7.17 4H4c-1.1 0-2 .9-2 2v12c0 1.1.9 2 2 2h16c1.1 0 2-.9 2-2V6c0-1.1-.9-2-2-2h-3.17L15 2H9zm3 15c-2.76 0-5-2.24-5-5s2.24-5 5-5 5 2.24 5 5-2.24 5-5 5z"/><path d="M0 0h24v24H0z" fill="none"/>',radioChecked:'<path d="M12 7c-2.76 0-5 2.24-5 5s2.24 5 5 5 5-2.24 5-5-2.24-5-5-5zm0-5C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm0 18c-4.42 0-8-3.58-8-8s3.58-8 8-8 8 3.58 8 8-3.58 8-8 8z"/>',radioUnchecked:'<path d="M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm0 18c-4.42 0-8-3.58-8-8s3.58-8 8-8 8 3.58 8 8-3.58 8-8 8z"/>',security:'<path d="M12 1L3 5v6c0 5.55 3.84 10.74 9 12 5.16-1.26 9-6.45 9-12V5l-9-4zm0 10.99h7c-.53 4.12-3.28 7.79-7 8.94V12H5V6.3l7-3.11v8.8z"/><path d="M0 0h24v24H0z" fill="none"/>',shoppingCart:'<path d="M7 18c-1.1 0-1.99.9-1.99 2S5.9 22 7 22s2-.9 2-2-.9-2-2-2zM1 2v2h2l3.6 7.59-1.35 2.45c-.16.28-.25.61-.25.96 0 1.1.9 2 2 2h12v-2H7.42c-.14 0-.25-.11-.25-.25l.03-.12.9-1.63h7.45c.75 0 1.41-.41 1.75-1.03l3.58-6.49c.08-.14.12-.31.12-.48 0-.55-.45-1-1-1H5.21l-.94-2H1zm16 16c-1.1 0-1.99.9-1.99 2s.89 2 1.99 2 2-.9 2-2-.9-2-2-2z"/><path d="M0 0h24v24H0z" fill="none"/>',sort:'<path d="M5.5,6C5.2,6,4.9,6.3,4.9,6.7c0,0,0,0,0,0v9l-1.3-1.1c-0.3-0.2-0.7-0.2-0.9,0.1 c-0.2,0.3-0.2,0.7,0.1,0.9l0,0l1,0.9l0,0l0.7,0.6L5,17.6l0,0L5.5,18l0,0L6,17.6l0.3-0.2l1-0.9l0,0l1-0.9c0.3-0.2,0.3-0.7,0.1-0.9 c-0.2-0.3-0.7-0.3-0.9-0.1l0,0l-1.3,1.1v-9C6.2,6.3,5.9,6,5.5,6C5.5,6,5.5,6,5.5,6L5.5,6z M10.4,6.1c-0.4,0-0.7,0.3-0.7,0.7 c0,0.4,0.3,0.7,0.7,0.7l0,0h10.3c0.4,0,0.7-0.3,0.7-0.7c0-0.4-0.3-0.7-0.7-0.7H10.4z M10.4,9.5c-0.4,0-0.7,0.3-0.7,0.7 c0,0.4,0.3,0.7,0.7,0.7l0,0h8.1c0.4,0,0.7-0.3,0.7-0.7c0-0.4-0.3-0.7-0.7-0.7H10.4z M10.4,12.9c-0.4,0-0.7,0.3-0.7,0.7 c0,0.4,0.3,0.7,0.7,0.7l0,0h5.8c0.4,0,0.7-0.3,0.7-0.7c0-0.4-0.3-0.7-0.7-0.7H10.4z M10.4,16.3c-0.4,0-0.7,0.3-0.7,0.7 s0.3,0.7,0.7,0.7H14c0.4,0,0.7-0.3,0.7-0.7s-0.3-0.7-0.7-0.7l0,0H10.4z"/>',starHalf:'<defs><path id="a" d="M0 0h24v24H0z"/></defs> <clipPath id="b"><use xlink:href="#a" overflow="visible"/></clipPath> <path clip-path="ul(#b)" d="M12 2L9.2 8.6 2 9.2 7.5 14l-1.6 7 6.2-3.7m-.1-1.9V6.1m2.8 7.3"/>',star:'<path d="M12 17.27L18.18 21l-1.64-7.03L22 9.24l-7.19-.61L12 2 9.19 8.63 2 9.24l5.46 4.73L5.82 21z"/>',starOutline:'<path d="M22 9.24l-7.19-.62L12 2 9.19 8.63 2 9.24l5.46 4.73L5.82 21 12 17.27 18.18 21l-1.63-7.03L22 9.24zM12 15.4l-3.76 2.27 1-4.28-3.32-2.88 4.38-.38L12 6.1l1.71 4.04 4.38.38-3.32 2.88 1 4.28L12 15.4z"/>',tick:'<path d="M9 16.17L4.83 12l-1.42 1.41L9 19 21 7l-1.41-1.41z"/>',trash:'<path d="M6 19c0 1.1.9 2 2 2h8c1.1 0 2-.9 2-2V7H6v12zM19 4h-3.5l-1-1h-5l-1 1H5v2h14V4z"/>',unchecked:'<path d="M19 5v14H5V5h14m0-2H5c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2z"/>',viewList:'<path d="M4 14h4v-4H4v4zm0 5h4v-4H4v4zM4 9h4V5H4v4zm5 5h12v-4H9v4zm0 5h12v-4H9v4zM9 5v4h12V5H9z"/><path d="M0 0h24v24H0z" fill="none"/>',visibility:'<path d="M0 0h24v24H0z" fill="none"/><path d="M12 4.5C7 4.5 2.73 7.61 1 12c1.73 4.39 6 7.5 11 7.5s9.27-3.11 11-7.5c-1.73-4.39-6-7.5-11-7.5zM12 17c-2.76 0-5-2.24-5-5s2.24-5 5-5 5 2.24 5 5-2.24 5-5 5zm0-8c-1.66 0-3 1.34-3 3s1.34 3 3 3 3-1.34 3-3-1.34-3-3-3z"/>',visibilityOff:'<path d="M0 0h24v24H0zm0 0h24v24H0zm0 0h24v24H0zm0 0h24v24H0z" fill="none"/><path d="M12 7c2.76 0 5 2.24 5 5 0 .65-.13 1.26-.36 1.83l2.92 2.92c1.51-1.26 2.7-2.89 3.43-4.75-1.73-4.39-6-7.5-11-7.5-1.4 0-2.74.25-3.98.7l2.16 2.16C10.74 7.13 11.35 7 12 7zM2 4.27l2.28 2.28.46.46C3.08 8.3 1.78 10.02 1 12c1.73 4.39 6 7.5 11 7.5 1.55 0 3.03-.3 4.38-.84l.42.42L19.73 22 21 20.73 3.27 3 2 4.27zM7.53 9.8l1.55 1.55c-.05.21-.08.43-.08.65 0 1.66 1.34 3 3 3 .22 0 .44-.03.65-.08l1.55 1.55c-.67.33-1.41.53-2.2.53-2.76 0-5-2.24-5-5 0-.79.2-1.53.53-2.2zm4.31-.78l3.15 3.15.02-.16c0-1.66-1.34-3-3-3l-.17.01z"/>',// ui-material icons
|
|
@@ -16,4 +16,4 @@ share:'<path d="M18 16.1364C17.24 16.1364 16.56 16.4376 16.04 16.9095L8.91 12.74
|
|
|
16
16
|
* @property {ThemeVariables} variables
|
|
17
17
|
* @property {ThemeIcons} icons
|
|
18
18
|
*/ /** @type {ThemeConfig} */export var themeConfig={typography:{family:'Roboto, Arial, sans-serif',rootSize:16,lineHeight:1.5},colors:colors,shadows:shadows,variables:variables,icons:icons};// Alias for jest hoisting
|
|
19
|
-
export var mockThemeConfig=themeConfig;
|
|
19
|
+
export var mockThemeConfig=themeConfig;export var themeName='theme';
|
package/helpers/config/theme.js
CHANGED
|
@@ -5,5 +5,5 @@ function _extends(){_extends=Object.assign||function(target){for(var i=1;i<argum
|
|
|
5
5
|
* Builds and returns a new theme config object.
|
|
6
6
|
* @param {Object} appConfig The app config.
|
|
7
7
|
* @returns {Object}
|
|
8
|
-
*/export function buildThemeConfig(appConfig){if(process.env.NODE_ENV==='test'){return mockConfig;}var _appConfig$colors=appConfig.colors,colors=_appConfig$colors===void 0?{}:_appConfig$colors,_appConfig$theme=appConfig.theme,theme=_appConfig$theme===void 0?{}:_appConfig$theme;// Force cta colors
|
|
9
|
-
if(!colors.cta&&colors.primary){colors.cta=colors.primary;}if(!colors.ctaContrast&&colors.primaryContrast){colors.ctaContrast=colors.primaryContrast;}
|
|
8
|
+
*/export function buildThemeConfig(appConfig){if(process.env.NODE_ENV==='test'){return mockConfig;}var _appConfig$colors=appConfig.colors,colors=_appConfig$colors===void 0?{}:_appConfig$colors,_appConfig$theme=appConfig.theme,theme=_appConfig$theme===void 0?{}:_appConfig$theme;var oldTheme=process.env.THEME_CONFIG||defaultConfig;var themeConfig=_extends({},theme);assignObjectDeep(themeConfig,{colors:_extends({},colors,{},oldTheme.colors),variables:_extends({},oldTheme.variables||{},{materialShadow:theme.shadows.material})});// Force cta colors
|
|
9
|
+
if(!themeConfig.colors.cta&&themeConfig.colors.primary){themeConfig.colors.cta=themeConfig.colors.primary;}if(!themeConfig.colors.ctaContrast&&themeConfig.colors.primaryContrast){themeConfig.colors.ctaContrast=themeConfig.colors.primaryContrast;}return themeConfig;}
|
package/helpers/dom/index.js
CHANGED
|
@@ -19,7 +19,8 @@ return Math.ceil(element.offsetHeight+margins);};/**
|
|
|
19
19
|
* @param {HTMLElement} element The DOM element.
|
|
20
20
|
* @param {string} property The style property in camel case
|
|
21
21
|
* @returns {string}
|
|
22
|
-
*/export var getStyle=function getStyle(element,property){
|
|
22
|
+
*/export var getStyle=function getStyle(element,property){// Use computed styles if possible - doesn't work with elements which are not mounted to the DOM
|
|
23
|
+
if(window.getComputedStyle&&document.body.contains(element)){// getPropertyValue expects the property in kebab case.
|
|
23
24
|
return window.getComputedStyle(element,null).getPropertyValue(property.replace(/([a-z])([A-Z])/g,'$1-$2').toLowerCase());}return element.style[property];};/**
|
|
24
25
|
* Check if element is relative.
|
|
25
26
|
* @param {Element} element The DOM element.
|
|
@@ -1,13 +1,20 @@
|
|
|
1
|
-
import{logger}from'@shopgate/pwa-core/helpers';import CryptoJs from'crypto-js';import{getExternalScripts,getInlineScripts,getHTMLContent,getDOMContainer,getStyles}from"./handleDOM";import decodeHTML from"./decodeHTML";/**
|
|
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{logger}from'@shopgate/pwa-core/helpers';import CryptoJs from'crypto-js';import{embeddedMedia}from"../../collections";import{getExternalScripts,getInlineScripts,getHTMLContent,getDOMContainer,getStyles}from"./handleDOM";import decodeHTML from"./decodeHTML";/**
|
|
2
2
|
* Receives custom HTML from a widget configuration, parses possible
|
|
3
3
|
* script tags and executes them after loading external scripts.
|
|
4
4
|
* @param {string} html The HTML string. It might contain script tags.
|
|
5
5
|
* @param {boolean} decode Whether the html must be decoded.
|
|
6
6
|
* @param {Object} settings The settings are used to create a unique ID.
|
|
7
7
|
* @param {boolean} [processStyles=false] When true, found styles are also added to the DOM.
|
|
8
|
+
* @param {Object} [cookieConsentSettings] Additional settings related to cookie consent.
|
|
9
|
+
* @param {boolean} [cookieConsentSettings.comfortCookiesAccepted] Whether comfort cookies
|
|
10
|
+
* are accepted.
|
|
11
|
+
* @param {boolean} [cookieConsentSettings.statisticsCookiesAccepted] Whether statistics cookies
|
|
12
|
+
* are accepted.
|
|
8
13
|
* @returns {string} The HTML without any script tags.
|
|
9
|
-
*/var parseHTML=function parseHTML(html,decode,settings){var processStyles=arguments.length>3&&arguments[3]!==undefined?arguments[3]:false;var id=CryptoJs.MD5(JSON.stringify(settings)).toString();var container=getDOMContainer("html-sanitizer-".concat(id));try{var parser=new DOMParser();var unparsedHTML=decode?decodeHTML(html):html;// Parse the html string to a DOM object.
|
|
10
|
-
var dom=parser.parseFromString("<body>".concat(unparsedHTML,"</body>"),'text/html');//
|
|
14
|
+
*/var parseHTML=function parseHTML(html,decode,settings){var processStyles=arguments.length>3&&arguments[3]!==undefined?arguments[3]:false;var cookieConsentSettings=arguments.length>4&&arguments[4]!==undefined?arguments[4]:{};var id=CryptoJs.MD5(JSON.stringify(settings)).toString();var container=getDOMContainer("html-sanitizer-".concat(id));var cookieConsent=_extends({comfortCookiesAccepted:false,statisticsCookiesAccepted:false},cookieConsentSettings);try{var parser=new DOMParser();var unparsedHTML=decode?decodeHTML(html):html;// Parse the html string to a DOM object.
|
|
15
|
+
var dom=parser.parseFromString("<body>".concat(unparsedHTML,"</body>"),'text/html');// Run cookie consent logic from embedded media to remove markup that's not supposed to run
|
|
16
|
+
// when consent is not accepted.
|
|
17
|
+
embeddedMedia.handleCookieConsent(dom,cookieConsent);// How many onloads have been processed.
|
|
11
18
|
var onloads=0;var inlineScripts=[];var externalScripts=[];/**
|
|
12
19
|
* Handles the onload events for external scripts.
|
|
13
20
|
* @return {Array} The collection of external scripts.
|