@shopgate/engage 6.20.0-rc.6 → 6.20.0-rc.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,4 +1,4 @@
1
- function _slicedToArray(arr,i){return _arrayWithHoles(arr)||_iterableToArrayLimit(arr,i)||_unsupportedIterableToArray(arr,i)||_nonIterableRest();}function _nonIterableRest(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");}function _unsupportedIterableToArray(o,minLen){if(!o)return;if(typeof o==="string")return _arrayLikeToArray(o,minLen);var n=Object.prototype.toString.call(o).slice(8,-1);if(n==="Object"&&o.constructor)n=o.constructor.name;if(n==="Map"||n==="Set")return Array.from(o);if(n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return _arrayLikeToArray(o,minLen);}function _arrayLikeToArray(arr,len){if(len==null||len>arr.length)len=arr.length;for(var i=0,arr2=new Array(len);i<len;i++){arr2[i]=arr[i];}return arr2;}function _iterableToArrayLimit(arr,i){var _i=arr==null?null:typeof Symbol!=="undefined"&&arr[Symbol.iterator]||arr["@@iterator"];if(_i==null)return;var _arr=[];var _n=true;var _d=false;var _s,_e;try{for(_i=_i.call(arr);!(_n=(_s=_i.next()).done);_n=true){_arr.push(_s.value);if(i&&_arr.length===i)break;}}catch(err){_d=true;_e=err;}finally{try{if(!_n&&_i["return"]!=null)_i["return"]();}finally{if(_d)throw _e;}}return _arr;}function _arrayWithHoles(arr){if(Array.isArray(arr))return arr;}import React,{Fragment,useCallback,useEffect,useState}from'react';import PropTypes from'prop-types';import{connect}from'react-redux';import{css}from'glamor';import{i18n}from'@shopgate/engage/core';import{themeConfig}from'@shopgate/pwa-common/helpers/config';import{Accordion,Card,ContextMenu,SurroundPortals,RippleButton}from'@shopgate/engage/components';import{getFavoritesCount,makeGetFavoritesIdsByList,getHasMultipleFavoritesListsSupport}from'@shopgate/engage/favorites';import{FAVORITES_LIST_CONTEXT_MENU}from"../../constants/Portals";import Item from"../Item";import{ProductProvider}from"../../../product";import{FAVORITES_SHOW_LIMIT}from"../../constants/constants";var colors=themeConfig.colors,variables=themeConfig.variables;var styles={root:css({margin:'8px 8px 10px'}).toString(),rootNoFavoritesLists:css({background:colors.light,flexGrow:1,paddingTop:variables.gap.xsmall,paddingLeft:'16px',paddingRight:'16px'}).toString(),title:css({flex:1,textOverflow:'ellipsis',overflow:'hidden',whiteSpace:'nowrap'}).toString(),divider:css({height:1,width:'calc(100% + 32px)',backgroundColor:'rgb(234, 234, 234)',marginLeft:-16,marginRight:-16,marginBottom:16}).toString(),spacer:css({height:1,width:'calc(100% + 32px)',marginLeft:-16,marginRight:-16,marginBottom:16}).toString(),loadMoreButton:css({width:'calc(100% - 32px)',margin:'16px 16px 0 16px',borderRadius:5}).toString()};/**
1
+ function _slicedToArray(arr,i){return _arrayWithHoles(arr)||_iterableToArrayLimit(arr,i)||_unsupportedIterableToArray(arr,i)||_nonIterableRest();}function _nonIterableRest(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");}function _unsupportedIterableToArray(o,minLen){if(!o)return;if(typeof o==="string")return _arrayLikeToArray(o,minLen);var n=Object.prototype.toString.call(o).slice(8,-1);if(n==="Object"&&o.constructor)n=o.constructor.name;if(n==="Map"||n==="Set")return Array.from(o);if(n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return _arrayLikeToArray(o,minLen);}function _arrayLikeToArray(arr,len){if(len==null||len>arr.length)len=arr.length;for(var i=0,arr2=new Array(len);i<len;i++){arr2[i]=arr[i];}return arr2;}function _iterableToArrayLimit(arr,i){var _i=arr==null?null:typeof Symbol!=="undefined"&&arr[Symbol.iterator]||arr["@@iterator"];if(_i==null)return;var _arr=[];var _n=true;var _d=false;var _s,_e;try{for(_i=_i.call(arr);!(_n=(_s=_i.next()).done);_n=true){_arr.push(_s.value);if(i&&_arr.length===i)break;}}catch(err){_d=true;_e=err;}finally{try{if(!_n&&_i["return"]!=null)_i["return"]();}finally{if(_d)throw _e;}}return _arr;}function _arrayWithHoles(arr){if(Array.isArray(arr))return arr;}import _regeneratorRuntime from"@babel/runtime/regenerator";function asyncGeneratorStep(gen,resolve,reject,_next,_throw,key,arg){try{var info=gen[key](arg);var value=info.value;}catch(error){reject(error);return;}if(info.done){resolve(value);}else{Promise.resolve(value).then(_next,_throw);}}function _asyncToGenerator(fn){return function(){var self=this,args=arguments;return new Promise(function(resolve,reject){var gen=fn.apply(self,args);function _next(value){asyncGeneratorStep(gen,resolve,reject,_next,_throw,"next",value);}function _throw(err){asyncGeneratorStep(gen,resolve,reject,_next,_throw,"throw",err);}_next(undefined);});};}import React,{Fragment,useCallback,useEffect,useState}from'react';import PropTypes from'prop-types';import{connect}from'react-redux';import{css}from'glamor';import{i18n,showModal}from'@shopgate/engage/core';import{themeConfig}from'@shopgate/pwa-common/helpers/config';import{Accordion,Card,ContextMenu,SurroundPortals,RippleButton}from'@shopgate/engage/components';import{getFavoritesCount,makeGetFavoritesIdsByList,getHasMultipleFavoritesListsSupport}from'@shopgate/engage/favorites';import{FAVORITES_LIST_CONTEXT_MENU}from"../../constants/Portals";import Item from"../Item";import{ProductProvider}from"../../../product";import{FAVORITES_SHOW_LIMIT}from"../../constants/constants";var colors=themeConfig.colors,variables=themeConfig.variables;var styles={root:css({margin:'8px 8px 10px'}).toString(),rootNoFavoritesLists:css({background:colors.light,flexGrow:1,paddingTop:variables.gap.xsmall,paddingLeft:'16px',paddingRight:'16px'}).toString(),title:css({flex:1,textOverflow:'ellipsis',overflow:'hidden',whiteSpace:'nowrap'}).toString(),divider:css({height:1,width:'calc(100% + 32px)',backgroundColor:'rgb(234, 234, 234)',marginLeft:-16,marginRight:-16,marginBottom:16}).toString(),spacer:css({height:1,width:'calc(100% + 32px)',marginLeft:-16,marginRight:-16,marginBottom:16}).toString(),loadMoreButton:css({width:'calc(100% - 32px)',margin:'16px 16px 0 16px',borderRadius:5}).toString()};/**
2
2
  * Favorite List Label component
3
3
  * @return {JSX}
4
4
  */var FavoriteListLabel=function FavoriteListLabel(_ref){var id=_ref.id,title=_ref.title,rename=_ref.rename,remove=_ref.remove,disableRemoveList=_ref.disableRemoveList;return/*#__PURE__*/React.createElement(Fragment,null,/*#__PURE__*/React.createElement("span",{className:styles.title},title),/*#__PURE__*/React.createElement(SurroundPortals,{portalName:FAVORITES_LIST_CONTEXT_MENU,portalProps:{id:id}},/*#__PURE__*/React.createElement(ContextMenu,null,/*#__PURE__*/React.createElement(ContextMenu.Item,{onClick:rename},i18n.text('favorites.rename_list')),/*#__PURE__*/React.createElement(ContextMenu.Item,{onClick:remove,disabled:disableRemoveList},i18n.text('favorites.remove_list')))));};/**
@@ -13,6 +13,10 @@ function _slicedToArray(arr,i){return _arrayWithHoles(arr)||_iterableToArrayLimi
13
13
  * @param {Object} props Props
14
14
  * @returns {Object}
15
15
  */var makeMapStateToProps=function makeMapStateToProps(_,_ref5){var id=_ref5.id;var getFavoritesIds=makeGetFavoritesIdsByList(function(){return id;});return function(state){return{favoriteIds:getFavoritesIds(state),favoritesCount:getFavoritesCount(state),hasMultipleFavoritesListsSupport:getHasMultipleFavoritesListsSupport(state)};};};/**
16
+ * @param {Object} dispatch Dispatch
17
+ * @param {Object} props The component props
18
+ * @returns {Object}
19
+ */var mapDispatchToProps=function mapDispatchToProps(dispatch,props){return{remove:function(){var _remove=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee(id){var confirmed;return _regeneratorRuntime.wrap(function _callee$(_context){while(1){switch(_context.prev=_context.next){case 0:_context.next=2;return dispatch(showModal({message:'favorites.delete_list_modal.message',title:'favorites.delete_list_modal.title',params:{name:props.name}}));case 2:confirmed=_context.sent;if(confirmed){props.remove(id);}case 4:case"end":return _context.stop();}}},_callee);}));function remove(_x){return _remove.apply(this,arguments);}return remove;}()};};/**
16
20
  * Favorite List component
17
21
  * @return {JSX}
18
- */var FavoriteList=function FavoriteList(_ref6){var id=_ref6.id,name=_ref6.name,favoriteIds=_ref6.favoriteIds,_rename=_ref6.rename,remove=_ref6.remove,removeItem=_ref6.removeItem,addToCart=_ref6.addToCart,disableRemoveList=_ref6.disableRemoveList,hasMultipleFavoritesListsSupport=_ref6.hasMultipleFavoritesListsSupport;var _useState=useState(FAVORITES_SHOW_LIMIT),_useState2=_slicedToArray(_useState,2),offset=_useState2[0],setOffset=_useState2[1];var productIds=favoriteIds.slice(0,offset).map(function(productId){return{productId:productId};});var allFavoritesLoaded=favoriteIds.length-productIds.length>0;var _useState3=useState(allFavoritesLoaded),_useState4=_slicedToArray(_useState3,2),shouldShowLoadMoreButton=_useState4[0],setShouldShowLoadMoreButton=_useState4[1];var loadMore=useCallback(function(){setOffset(offset+FAVORITES_SHOW_LIMIT);},[offset]);useEffect(function(){setShouldShowLoadMoreButton(allFavoritesLoaded);},[offset,allFavoritesLoaded]);return hasMultipleFavoritesListsSupport?/*#__PURE__*/React.createElement(Card,{className:styles.root},/*#__PURE__*/React.createElement(Accordion,{className:"",openWithChevron:true,renderLabel:function renderLabel(){return/*#__PURE__*/React.createElement(FavoriteListLabel,{id:id,title:name,rename:function rename(newName){return _rename(id,newName);},remove:remove,disableRemoveList:disableRemoveList});},chevronPosition:"left",startOpened:true,testId:id},/*#__PURE__*/React.createElement(FavoritesListContent,{addToCart:addToCart,id:id,loadMore:loadMore,productIds:productIds,removeItem:removeItem,shouldShowLoadMoreButton:shouldShowLoadMoreButton,hasMultipleFavoritesListsSupport:hasMultipleFavoritesListsSupport}))):/*#__PURE__*/React.createElement("div",{className:styles.rootNoFavoritesLists},/*#__PURE__*/React.createElement(FavoritesListContent,{addToCart:addToCart,id:id,loadMore:loadMore,productIds:productIds,removeItem:removeItem,shouldShowLoadMoreButton:shouldShowLoadMoreButton}));};FavoriteList.defaultProps={hasMultipleFavoritesListsSupport:false};export default connect(makeMapStateToProps)(FavoriteList);
22
+ */var FavoriteList=function FavoriteList(_ref6){var id=_ref6.id,name=_ref6.name,favoriteIds=_ref6.favoriteIds,_rename=_ref6.rename,remove=_ref6.remove,removeItem=_ref6.removeItem,addToCart=_ref6.addToCart,disableRemoveList=_ref6.disableRemoveList,hasMultipleFavoritesListsSupport=_ref6.hasMultipleFavoritesListsSupport;var _useState=useState(FAVORITES_SHOW_LIMIT),_useState2=_slicedToArray(_useState,2),offset=_useState2[0],setOffset=_useState2[1];var productIds=favoriteIds.slice(0,offset).map(function(productId){return{productId:productId};});var allFavoritesLoaded=favoriteIds.length-productIds.length>0;var _useState3=useState(allFavoritesLoaded),_useState4=_slicedToArray(_useState3,2),shouldShowLoadMoreButton=_useState4[0],setShouldShowLoadMoreButton=_useState4[1];var loadMore=useCallback(function(){setOffset(offset+FAVORITES_SHOW_LIMIT);},[offset]);useEffect(function(){setShouldShowLoadMoreButton(allFavoritesLoaded);},[offset,allFavoritesLoaded]);return hasMultipleFavoritesListsSupport?/*#__PURE__*/React.createElement(Card,{className:styles.root},/*#__PURE__*/React.createElement(Accordion,{className:"",openWithChevron:true,renderLabel:function renderLabel(){return/*#__PURE__*/React.createElement(FavoriteListLabel,{id:id,title:name,rename:function rename(newName){return _rename(id,newName);},remove:remove,disableRemoveList:disableRemoveList});},chevronPosition:"left",startOpened:true,testId:id},/*#__PURE__*/React.createElement(FavoritesListContent,{addToCart:addToCart,id:id,loadMore:loadMore,productIds:productIds,removeItem:removeItem,shouldShowLoadMoreButton:shouldShowLoadMoreButton,hasMultipleFavoritesListsSupport:hasMultipleFavoritesListsSupport}))):/*#__PURE__*/React.createElement("div",{className:styles.rootNoFavoritesLists},/*#__PURE__*/React.createElement(FavoritesListContent,{addToCart:addToCart,id:id,loadMore:loadMore,productIds:productIds,removeItem:removeItem,shouldShowLoadMoreButton:shouldShowLoadMoreButton}));};FavoriteList.defaultProps={hasMultipleFavoritesListsSupport:false};export default connect(makeMapStateToProps,mapDispatchToProps)(FavoriteList);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@shopgate/engage",
3
- "version": "6.20.0-rc.6",
3
+ "version": "6.20.0-rc.7",
4
4
  "description": "Shopgate's ENGAGE library.",
5
5
  "license": "Apache-2.0",
6
6
  "author": "Shopgate <support@shopgate.com>",
@@ -15,12 +15,12 @@
15
15
  "connect"
16
16
  ],
17
17
  "dependencies": {
18
- "@shopgate/pwa-common": "6.20.0-rc.6",
19
- "@shopgate/pwa-common-commerce": "6.20.0-rc.6",
20
- "@shopgate/pwa-core": "6.20.0-rc.6",
21
- "@shopgate/pwa-ui-ios": "6.20.0-rc.6",
22
- "@shopgate/pwa-ui-material": "6.20.0-rc.6",
23
- "@shopgate/pwa-ui-shared": "6.20.0-rc.6",
18
+ "@shopgate/pwa-common": "6.20.0-rc.7",
19
+ "@shopgate/pwa-common-commerce": "6.20.0-rc.7",
20
+ "@shopgate/pwa-core": "6.20.0-rc.7",
21
+ "@shopgate/pwa-ui-ios": "6.20.0-rc.7",
22
+ "@shopgate/pwa-ui-material": "6.20.0-rc.7",
23
+ "@shopgate/pwa-ui-shared": "6.20.0-rc.7",
24
24
  "@virtuous/conductor": "~2.4.0",
25
25
  "babel-plugin-transform-es3-member-expression-literals": "^6.8.0",
26
26
  "babel-plugin-transform-es3-property-literals": "^6.8.0",