@shopgate/engage 6.20.0-beta.3 → 6.20.0-beta.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (257) hide show
  1. package/a11y/components/LiveMessage/__tests__/index.spec.js +1 -1
  2. package/a11y/components/LiveMessage/index.js +1 -1
  3. package/a11y/components/LiveMessenger/__tests__/index.spec.js +1 -1
  4. package/a11y/components/LiveMessenger/helpers.js +1 -1
  5. package/a11y/components/LiveMessenger/index.js +2 -2
  6. package/a11y/components/Navigation/__tests__/index.spec.js +1 -1
  7. package/a11y/components/Navigation/index.js +1 -1
  8. package/a11y/components/Section/__tests__/index.spec.js +1 -1
  9. package/a11y/components/Section/index.js +2 -2
  10. package/a11y/index.spec.js +1 -1
  11. package/account/constants/index.js +1 -0
  12. package/account/constants/routes.js +1 -0
  13. package/account/index.js +1 -0
  14. package/app-rating/actions/showModal.js +2 -2
  15. package/cart/index.spec.js +1 -1
  16. package/category/components/CategoryList/index.js +1 -1
  17. package/category/index.spec.js +1 -1
  18. package/checkout/index.spec.js +1 -1
  19. package/components/ChipLayout/index.js +11 -11
  20. package/components/ChipLayout/spec.js +1 -1
  21. package/components/Footer/Footer.js +9 -9
  22. package/components/Footer/__tests__/Footer.spec.js +4 -4
  23. package/components/Form/Builder/Builder.js +10 -10
  24. package/components/Form/Builder/Builder.spec.js +4 -4
  25. package/components/Form/Builder/ElementCheckbox.js +1 -1
  26. package/components/Form/Builder/ElementRadio.js +1 -1
  27. package/components/Form/Builder/ElementSelect.js +1 -1
  28. package/components/Form/Builder/ElementText.js +1 -1
  29. package/components/Form/Builder/classes/ActionListener.js +3 -3
  30. package/components/Form/Builder/helpers/buildCountryList.js +1 -1
  31. package/components/Form/Builder/helpers/buildFormDefaults.js +1 -1
  32. package/components/Form/Builder/helpers/buildFormElements.js +2 -2
  33. package/components/Form/Builder/helpers/buildFormElements.spec.js +2 -2
  34. package/components/Form/Builder/helpers/buildProvinceList.js +1 -1
  35. package/components/Form/Form.js +8 -8
  36. package/components/IntersectionVisibility/index.js +5 -5
  37. package/components/Logo/index.js +1 -1
  38. package/components/Logo/spec.js +1 -1
  39. package/components/MessageBar/index.js +1 -1
  40. package/components/MessageBar/spec.js +1 -1
  41. package/components/NavigationHandler/index.js +5 -5
  42. package/components/NavigationHandler/spec.js +1 -1
  43. package/components/Picker/components/Button/index.js +1 -1
  44. package/components/Picker/components/List/index.js +1 -1
  45. package/components/Picker/components/Modal/index.js +5 -5
  46. package/components/Picker/index.js +9 -9
  47. package/components/Picker/spec.js +1 -1
  48. package/components/PickerUtilize/components/Button/index.js +1 -1
  49. package/components/PickerUtilize/index.js +6 -6
  50. package/components/PickerUtilize/spec.js +1 -1
  51. package/components/QuantityInput/QuantityInput.js +4 -4
  52. package/components/RangeSlider/components/Handle/index.js +1 -1
  53. package/components/RangeSlider/index.js +11 -11
  54. package/components/RangeSlider/spec.js +4 -4
  55. package/components/ScrollHeader/index.js +2 -2
  56. package/components/SheetDrawer/index.js +1 -1
  57. package/components/SheetList/components/Item/index.js +5 -5
  58. package/components/SheetList/components/Item/spec.js +2 -2
  59. package/components/SheetList/index.js +4 -4
  60. package/components/SheetList/spec.js +1 -1
  61. package/components/SnackBarContainer/index.js +1 -1
  62. package/components/TimeBoundary/index.js +5 -5
  63. package/components/TimeBoundary/spec.js +3 -3
  64. package/components/VideoPlayer/index.js +6 -6
  65. package/components/View/__mocks__/index.js +1 -1
  66. package/components/View/__tests__/index.spec.js +1 -1
  67. package/components/View/__tests__/provider.spec.js +1 -1
  68. package/components/View/components/Above/__tests__/index.spec.js +1 -1
  69. package/components/View/components/Above/index.js +1 -1
  70. package/components/View/components/Below/__tests__/index.spec.js +1 -1
  71. package/components/View/components/Below/index.js +1 -1
  72. package/components/View/components/Content/__tests__/index.spec.js +1 -1
  73. package/components/View/components/Content/index.js +9 -9
  74. package/components/View/context.js +1 -1
  75. package/components/View/index.js +2 -2
  76. package/components/View/provider.js +6 -4
  77. package/components/index.spec.js +1 -1
  78. package/core/actions/__tests__/getGeolocation.spec.js +2 -2
  79. package/core/actions/__tests__/grantPermissions.spec.js +1 -1
  80. package/core/actions/getGeolocation.js +1 -1
  81. package/core/actions/grantPermissions.js +3 -3
  82. package/core/classes/GeolocationRequest.js +3 -3
  83. package/core/config/ThemeConfigResolver.js +1 -1
  84. package/core/constants/shopSettings.js +2 -0
  85. package/core/contexts/AppContext.js +1 -1
  86. package/core/helpers/getFullImageSource.js +2 -2
  87. package/core/helpers/updateLegacyNavigationBar.js +1 -1
  88. package/core/hocs/__mocks__/withWidgetSettings.js +1 -1
  89. package/core/hocs/__tests__/withApp.spec.js +1 -1
  90. package/core/hocs/__tests__/withCurrentProduct.spec.js +1 -1
  91. package/core/hocs/__tests__/withForwardedRef.spec.js +1 -1
  92. package/core/hocs/__tests__/withNavigation.spec.js +1 -1
  93. package/core/hocs/__tests__/withRoute.spec.js +1 -1
  94. package/core/hocs/__tests__/withTheme.spec.js +2 -2
  95. package/core/hocs/__tests__/withWidgetSettings.spec.js +1 -1
  96. package/core/hocs/__tests__/withWidgetStyles.spec.js +1 -1
  97. package/core/hocs/withApp.js +1 -1
  98. package/core/hocs/withCurrentProduct.js +1 -1
  99. package/core/hocs/withForwardedRef.js +1 -1
  100. package/core/hocs/withNavigation.js +1 -1
  101. package/core/hocs/withRoute.js +1 -1
  102. package/core/hocs/withTheme.js +2 -2
  103. package/core/hocs/withWidgetSettings.js +1 -1
  104. package/core/hocs/withWidgetStyles.js +1 -1
  105. package/core/hooks/__tests__/useNavigation.spec.js +1 -1
  106. package/core/hooks/html/useLoadImage.js +1 -1
  107. package/core/hooks/useTheme.js +2 -2
  108. package/core/index.spec.js +1 -1
  109. package/core/providers/AppProvider.js +9 -7
  110. package/core/providers/__tests__/AppProvider.spec.js +2 -2
  111. package/core/selectors/index.js +1 -0
  112. package/core/selectors/shopSettings.js +14 -0
  113. package/favorites/components/FavoriteProvider/connector.js +5 -0
  114. package/favorites/components/FavoriteProvider/index.js +4 -0
  115. package/favorites/components/Item/Item.js +10 -0
  116. package/favorites/components/Item/ItemCharacteristics.js +4 -0
  117. package/favorites/components/Item/index.js +1 -0
  118. package/favorites/components/List/List.js +16 -0
  119. package/favorites/components/List/index.js +1 -0
  120. package/favorites/components/ListChooser/ListChooser.js +10 -0
  121. package/favorites/components/ListChooser/ListChooserItem.js +7 -0
  122. package/favorites/components/ListChooser/index.js +1 -0
  123. package/favorites/components/Lists/Lists.js +16 -0
  124. package/favorites/components/Lists/ListsModal.js +4 -0
  125. package/favorites/components/Lists/index.js +1 -0
  126. package/favorites/components/RemoveButton/RemoveButton.js +4 -0
  127. package/favorites/components/RemoveButton/index.js +1 -0
  128. package/favorites/constants/Portals.js +2 -0
  129. package/favorites/index.js +3 -4
  130. package/favorites/index.spec.js +1 -1
  131. package/filter/components/FilterItem/index.js +1 -1
  132. package/filter/components/FilterItem/spec.js +1 -1
  133. package/filter/components/PriceSlider/components/Label/index.js +2 -2
  134. package/filter/components/PriceSlider/components/Label/spec.js +1 -1
  135. package/filter/components/PriceSlider/index.js +6 -6
  136. package/filter/components/PriceSlider/spec.js +1 -1
  137. package/filter/helpers/__tests__/buildUpdatedFilters.spec.js +1 -1
  138. package/filter/helpers/buildInitialFilters.js +1 -1
  139. package/filter/helpers/buildUpdatedFilters.js +2 -2
  140. package/filter/index.spec.js +1 -1
  141. package/index.spec.js +1 -1
  142. package/market/index.spec.js +1 -1
  143. package/orders/index.spec.js +1 -1
  144. package/package.json +7 -7
  145. package/page/index.spec.js +1 -1
  146. package/product/components/Characteristics/Characteristic/components/Sheet/index.js +4 -4
  147. package/product/components/Characteristics/Characteristic/components/SheetItem/index.js +3 -3
  148. package/product/components/Characteristics/Characteristic/components/VariantAvailability/index.js +3 -3
  149. package/product/components/Characteristics/Characteristic/index.js +5 -5
  150. package/product/components/Characteristics/Swatch/index.js +5 -5
  151. package/product/components/Characteristics/index.js +3 -3
  152. package/product/components/Description/__tests__/Description.spec.js +1 -1
  153. package/product/components/Description/index.js +2 -2
  154. package/product/components/EffectivityDates/index.js +1 -1
  155. package/product/components/Header/PriceStriked/index.js +1 -1
  156. package/product/components/Header/Shipping/components/Label/index.js +2 -2
  157. package/product/components/Header/Shipping/index.js +1 -1
  158. package/product/components/Header/Shipping/spec.js +1 -1
  159. package/product/components/Header/Tiers/components/Tier/index.js +2 -2
  160. package/product/components/Header/Tiers/components/Tier/spec.js +1 -1
  161. package/product/components/Header/Tiers/index.js +1 -1
  162. package/product/components/Header/Tiers/spec.js +1 -1
  163. package/product/components/MapPriceHint/index.js +1 -1
  164. package/product/components/Media/FeaturedMedia.js +1 -1
  165. package/product/components/Media/MediaImage.js +2 -2
  166. package/product/components/Media/MediaPlaceholder.js +1 -1
  167. package/product/components/Media/helpers.js +2 -2
  168. package/product/components/MediaSlider/components/MediaImage/index.js +1 -1
  169. package/product/components/MediaSlider/components/MediaVideo/index.js +1 -1
  170. package/product/components/MediaSlider/index.js +1 -1
  171. package/product/components/Options/components/Content/index.js +6 -6
  172. package/product/components/Options/components/Content/spec.js +1 -1
  173. package/product/components/Options/components/Option/index.js +1 -1
  174. package/product/components/Options/components/TextOption/components/OptionInfo/index.js +2 -2
  175. package/product/components/Options/components/TextOption/components/OptionInfo/spec.js +1 -1
  176. package/product/components/Options/components/TextOption/index.js +6 -6
  177. package/product/components/Options/index.js +1 -1
  178. package/product/components/OrderQuantityHint/index.js +1 -1
  179. package/product/components/PriceDifference/index.js +1 -1
  180. package/product/components/ProductBadges/index.js +2 -2
  181. package/product/components/ProductCard/index.js +2 -2
  182. package/product/components/ProductCharacteristics/context.js +1 -1
  183. package/product/components/ProductCharacteristics/index.js +9 -9
  184. package/product/components/ProductDiscountBadge/index.js +1 -1
  185. package/product/components/ProductDiscountBadge/spec.js +1 -1
  186. package/product/components/ProductGridPrice/index.js +1 -1
  187. package/product/components/ProductGridPrice/index.spec.js +1 -1
  188. package/product/components/ProductImage/index.js +7 -7
  189. package/product/components/ProductImage/spec.js +1 -1
  190. package/product/components/ProductList/components/Item/index.js +1 -1
  191. package/product/components/ProductList/components/Iterator/index.js +1 -1
  192. package/product/components/ProductList/components/Layout/index.js +1 -1
  193. package/product/components/ProductList/index.js +1 -1
  194. package/product/components/ProductProperties/Content.js +2 -2
  195. package/product/components/ProductProperties/Group.js +1 -1
  196. package/product/components/ProductProperties/GroupedProperties.js +1 -1
  197. package/product/components/ProductProperties/Lists.js +1 -1
  198. package/product/components/ProductProperties/ProductProperties.js +1 -1
  199. package/product/components/ProductProperties/Row.js +1 -1
  200. package/product/components/ProductProperties/Rows.js +1 -1
  201. package/product/components/ProductProperties/Wrapper.js +1 -1
  202. package/product/components/ProductProperties/__tests__/Content.spec.js +1 -1
  203. package/product/components/ProductProperties/__tests__/Group.spec.js +1 -1
  204. package/product/components/ProductProperties/__tests__/GroupedProperties.spec.js +1 -1
  205. package/product/components/ProductProperties/__tests__/Lists.spec.js +1 -1
  206. package/product/components/ProductProperties/__tests__/ProductProperties.spec.js +1 -1
  207. package/product/components/ProductProperties/__tests__/Row.spec.js +1 -1
  208. package/product/components/ProductProperties/__tests__/Rows.spec.js +1 -1
  209. package/product/components/ProductProvider/index.js +1 -1
  210. package/product/components/ProductSlider/index.js +1 -1
  211. package/product/components/ProductSlider/spec.js +1 -1
  212. package/product/components/QuantityPicker/index.js +2 -2
  213. package/product/components/Rating/index.js +2 -2
  214. package/product/components/Rating/spec.js +1 -1
  215. package/product/components/RelationsSlider/RelationsSheet.js +2 -2
  216. package/product/components/RelationsSlider/RelationsSlider.js +1 -1
  217. package/product/components/RelationsSlider/RelationsSliderContent.js +1 -1
  218. package/product/components/Swatch/Swatch.js +1 -1
  219. package/product/components/Swatch/SwatchContent.js +1 -1
  220. package/product/components/Swatch/VariantSwatch.js +1 -1
  221. package/product/components/Swatches/Swatches.js +1 -1
  222. package/product/components/UnitQuantityPicker/ProductUnitQuantityPicker.js +1 -1
  223. package/product/components/UnitQuantityPicker/UnitQuantityPicker.js +1 -1
  224. package/product/components/UnitQuantityPicker/UnitQuantityPickerWithSection.js +1 -1
  225. package/product/components/__mocks__/context.js +1 -1
  226. package/product/components/context.js +1 -1
  227. package/product/helpers/index.js +1 -1
  228. package/product/hocs/withMapPricing.js +4 -4
  229. package/product/hocs/withPriceCalculation.js +2 -2
  230. package/product/hooks/useLoadProductImage.js +1 -1
  231. package/product/index.spec.js +1 -1
  232. package/reviews/components/Reviews/components/AllReviewsLink/index.js +1 -1
  233. package/reviews/components/Reviews/components/Header/components/AverageRating/index.js +2 -2
  234. package/reviews/components/Reviews/components/Header/components/NoReviews/index.js +1 -1
  235. package/reviews/components/Reviews/components/Header/components/ReviewsExcerpt/index.js +1 -1
  236. package/reviews/components/Reviews/components/Header/components/WriteReviewLink/index.js +1 -1
  237. package/reviews/components/Reviews/components/Header/components/WriteReviewLink/spec.js +1 -1
  238. package/reviews/components/Reviews/components/Header/index.js +1 -1
  239. package/reviews/components/Reviews/components/Header/spec.js +1 -1
  240. package/reviews/components/Reviews/components/List/components/Info/components/Author/index.js +1 -1
  241. package/reviews/components/Reviews/components/List/components/Info/components/ReviewDate/index.js +1 -1
  242. package/reviews/components/Reviews/components/List/components/Info/index.js +2 -2
  243. package/reviews/components/Reviews/components/List/components/Rating/index.js +1 -1
  244. package/reviews/components/Reviews/components/List/components/Review/index.js +1 -1
  245. package/reviews/components/Reviews/components/List/components/Text/index.js +1 -1
  246. package/reviews/components/Reviews/components/List/components/Title/index.js +1 -1
  247. package/reviews/components/Reviews/components/List/index.js +3 -3
  248. package/reviews/components/Reviews/components/List/spec.js +1 -1
  249. package/reviews/components/Reviews/components/RatingCount/index.js +1 -1
  250. package/reviews/components/Reviews/components/RatingCount/spec.js +1 -1
  251. package/reviews/components/Reviews/index.js +1 -1
  252. package/reviews/components/Reviews/spec.js +2 -2
  253. package/reviews/index.spec.js +1 -1
  254. package/scanner/index.spec.js +1 -1
  255. package/search/index.spec.js +1 -1
  256. package/user/index.spec.js +1 -1
  257. package/core/helpers/getImageFormat.js +0 -4
@@ -0,0 +1,16 @@
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,useState}from'react';import PropTypes from'prop-types';import{connect}from'react-redux';import{css}from'glamor';import{i18n}from'@shopgate/engage/core';import appConfig,{themeConfig}from'@shopgate/pwa-common/helpers/config';import{Accordion,Card,ContextMenu,SurroundPortals,RippleButton}from'@shopgate/engage/components';import{getFavoritesCount,isFetching,makeGetFavoritesIdsByList}from'@shopgate/pwa-common-commerce/favorites/selectors';import{FAVORITES_LIST_CONTEXT_MENU}from"../../constants/Portals";import Item from"../Item";import{ProductProvider}from"../../../product";import{FAVORITES_SHOW_LIMIT}from"../../../../../themes/theme-ios11/pages/Favorites/constants";var colors=themeConfig.colors,variables=themeConfig.variables;var styles={root:css({margin:'8px 8px 10px'}).toString(),rootNoFavoritesLists:css({// padding: '0 16px 16px',
2
+ // overflow: 'hidden',
3
+ background:colors.background,flexGrow:1,paddingTop:variables.gap.xsmall,paddingBottom:variables.gap.xxbig,paddingLeft:'16px',paddingRight:'16px'}).toString(),title:css({flex:1}).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:16,backgroundColor:'var(--color-primary)',borderRadius:5}).toString()};/**
4
+ * Favorite List Label component
5
+ * @return {JSX}
6
+ */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')))));};/**
7
+ * The content of a favorites list
8
+ * @returns {JSX}
9
+ */var FavoritesListContent=function FavoritesListContent(_ref2){var id=_ref2.id,productIds=_ref2.productIds,_addToCart=_ref2.addToCart,removeItem=_ref2.removeItem,shouldShowLoadMoreButton=_ref2.shouldShowLoadMoreButton,loadMore=_ref2.loadMore;return/*#__PURE__*/React.createElement(React.Fragment,null,/*#__PURE__*/React.createElement("div",{className:styles.divider}),productIds.length===0?/*#__PURE__*/React.createElement("span",null,i18n.text('favorites.empty')):null,productIds.map(function(_ref3){var productId=_ref3.productId;return/*#__PURE__*/React.createElement(ProductProvider,{productId:productId,key:productId},function(_ref4){var product=_ref4.product;return product?/*#__PURE__*/React.createElement(Item,{key:product.id,product:product,listId:id,productId:product.id,addToCart:function addToCart(e){e.preventDefault();e.stopPropagation();return _addToCart(product);},remove:function remove(e){e.preventDefault();e.stopPropagation();removeItem(product.id);}}):null;});}),shouldShowLoadMoreButton&&/*#__PURE__*/React.createElement(RippleButton,{type:"primary",className:styles.loadMoreButton,onClick:loadMore,disabled:false},i18n.text('favorites.load_more_button')),/*#__PURE__*/React.createElement("div",{className:styles.spacer}));};/**
10
+ * @param {Object} _ State
11
+ * @param {Object} props Props
12
+ * @returns {Object}
13
+ */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),isFetchingState:isFetching(state)};};};/**
14
+ * Favorite List component
15
+ * @return {JSX}
16
+ */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;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 shouldShowLoadMoreButton=favoriteIds.length-productIds.length>0;var loadMore=useCallback(function(){var nextOffset=offset+FAVORITES_SHOW_LIMIT;setOffset(nextOffset);},[offset]);return appConfig.hasMultipleFavoritesLists?/*#__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}))):/*#__PURE__*/React.createElement("div",{className:styles.rootNoFavoritesLists},/*#__PURE__*/React.createElement(FavoritesListContent,{addToCart:addToCart,id:id,loadMore:loadMore,productIds:productIds,removeItem:removeItem,shouldShowLoadMoreButton:shouldShowLoadMoreButton}));};export default connect(makeMapStateToProps)(FavoriteList);
@@ -0,0 +1 @@
1
+ export{default}from"./List";
@@ -0,0 +1,10 @@
1
+ import React from'react';import PropTypes from'prop-types';import{connect}from'react-redux';import{getFavoritesListState,getFavoritesLists}from'@shopgate/pwa-common-commerce/favorites/selectors';import{i18n}from'@shopgate/engage/core';import{SheetList,SheetDrawer}from'@shopgate/engage/components';import{closeFavoritesListChooser}from'@shopgate/pwa-common-commerce/favorites/action-creators';import{toggleFavorite}from'@shopgate/pwa-common-commerce/favorites/actions/toggleFavorites';import ListChooserItem from"./ListChooserItem";/**
2
+ * @param {Object} state State.
3
+ * @returns {Object}
4
+ */var mapStateToProps=function mapStateToProps(state){return{settings:getFavoritesListState(state).chooser,lists:getFavoritesLists(state)};};/**
5
+ * @param {Object} dispatch Dispatch.
6
+ * @returns {Object}
7
+ */var mapDispatchToProps=function mapDispatchToProps(dispatch){return{close:function close(){return dispatch(closeFavoritesListChooser());},toggle:function toggle(){return dispatch(toggleFavorite.apply(void 0,arguments));}};};/**
8
+ * @param {Object} props Props.
9
+ * @returns {JSX}
10
+ */var ListChooser=function ListChooser(_ref){var settings=_ref.settings,lists=_ref.lists,close=_ref.close,toggle=_ref.toggle;var isVisible=!!settings;var productId=settings===null||settings===void 0?void 0:settings.productId;var withRelatives=settings===null||settings===void 0?void 0:settings.withRelatives;return/*#__PURE__*/React.createElement(SheetDrawer,{isOpen:isVisible,title:i18n.text('favorites.list_chooser.title'),onDidClose:close},/*#__PURE__*/React.createElement(SheetList,null,lists.map(function(list){return/*#__PURE__*/React.createElement(SheetList.Item,{key:list.id,title:list.name,onClick:function onClick(){close();toggle(productId,list.id,withRelatives);},rightComponent:/*#__PURE__*/React.createElement(ListChooserItem,{listId:list.id,productId:productId})});})));};ListChooser.defaultProps={settings:null,lists:[]};export default connect(mapStateToProps,mapDispatchToProps)(ListChooser);
@@ -0,0 +1,7 @@
1
+ import React from'react';import PropTypes from'prop-types';import{connect}from'react-redux';import{css}from'glamor';import{makeIsProductOnSpecificFavoriteList}from'@shopgate/pwa-common-commerce/favorites/selectors';import{i18n}from'@shopgate/engage/core';/**
2
+ * @param {Object} state State.
3
+ * @returns {Object}
4
+ */var makeMapStateToProps=function makeMapStateToProps(){var getIsOnList=makeIsProductOnSpecificFavoriteList(function(_,props){return props.productId;},function(_,props){return props.listId;});return function(state,props){return{isOnList:getIsOnList(state,props)};};};var styles={remove:css({color:'var(--color-state-alert)'}).toString(),add:css({color:'var(--color-state-ok)'}).toString()};/**
5
+ * @param {Object} props Props.
6
+ * @returns {JSX}
7
+ */var ListChooserItem=function ListChooserItem(_ref){var isOnList=_ref.isOnList;return isOnList?/*#__PURE__*/React.createElement("span",{className:styles.remove},i18n.text('favorites.list_chooser.remove')):/*#__PURE__*/React.createElement("span",{className:styles.add},i18n.text('favorites.list_chooser.add'));};export default connect(makeMapStateToProps)(ListChooserItem);
@@ -0,0 +1 @@
1
+ export{default}from"./ListChooser";
@@ -0,0 +1,16 @@
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,{useState,useCallback,useRef}from'react';import PropTypes from'prop-types';import{connect}from'react-redux';import{css}from'glamor';import{RippleButton,SurroundPortals}from'@shopgate/engage/components';import{i18n}from'@shopgate/engage/core';import appConfig from'@shopgate/pwa-common/helpers/config';import{getFavoritesLists,isInitialLoading}from'@shopgate/pwa-common-commerce/favorites/selectors';import addFavoritesList from'@shopgate/pwa-common-commerce/favorites/actions/addFavoritesList';import updateFavoritesList from'@shopgate/pwa-common-commerce/favorites/actions/updateFavoritesList';import removeFavoritesList from'@shopgate/pwa-common-commerce/favorites/actions/removeFavoritesList';import{removeFavorites}from'@shopgate/pwa-common-commerce/favorites/actions/toggleFavorites';import addProductsToCart from'@shopgate/pwa-common-commerce/cart/actions/addProductsToCart';import{getWishlistMode}from'@shopgate/engage/core/selectors/shopSettings';import{WISHLIST_MODE_PERSIST_ON_ADD}from'@shopgate/engage/core/constants/shopSettings';import List from"../List";import ListsModal from"./ListsModal";import{FAVORITES_LIST_ADD_BUTTON,FAVORITES_LIST}from"../../constants/Portals";/**
2
+ * @param {Object} state State
3
+ * @param {Object} props Props
4
+ * @returns {Object}
5
+ */var mapStateToProps=function mapStateToProps(state){return{isInitializing:isInitialLoading(state),lists:getFavoritesLists(state),wishlistMode:getWishlistMode(state)};};/**
6
+ * @param {Object} dispatch Dispatch
7
+ * @returns {Object}
8
+ */var mapDispatchToProps=function mapDispatchToProps(dispatch){return{addList:function addList(name){return dispatch(addFavoritesList(name));},updateList:function updateList(id,name){return dispatch(updateFavoritesList(id,name));},removeList:function removeList(id){return dispatch(removeFavoritesList(id));},removeItem:function removeItem(listId,productId){return dispatch(removeFavorites(productId,false,listId));},addToCart:function addToCart(){return dispatch(addProductsToCart.apply(void 0,arguments));}};};var styles={root:css({}),addButton:css({width:'calc(100% - 32px)',margin:16,backgroundColor:'var(--color-primary)',borderRadius:5}).toString()};/**
9
+ * @param {Object} props Props
10
+ * @returns {Object}
11
+ */var FavoriteLists=function FavoriteLists(_ref){var addList=_ref.addList,updateList=_ref.updateList,removeList=_ref.removeList,_removeItem=_ref.removeItem,addToCart=_ref.addToCart,wishlistMode=_ref.wishlistMode,lists=_ref.lists,isInitializing=_ref.isInitializing;// Add to cart state.
12
+ var promiseRef=useRef(null);var handleAddToCart=useCallback(function(listId,product){// Create promise to inform add to cart button when ready.
13
+ var promise=new Promise(function(_resolve,reject){promiseRef.current={resolve:function resolve(){// Remove item from wishlist after adding to cart.
14
+ if(wishlistMode!==WISHLIST_MODE_PERSIST_ON_ADD){_removeItem(listId,product.id);}_resolve();},reject:reject};});// If all options are already configured immediately add it to the cart.
15
+ addToCart([{productId:product.id,quantity:1}]);promiseRef.current.resolve();return promise;},[addToCart,_removeItem,wishlistMode]);// Modal for renaming and adding.
16
+ var _useState=useState(false),_useState2=_slicedToArray(_useState,2),modalOpen=_useState2[0],setModalOpen=_useState2[1];var _useState3=useState(null),_useState4=_slicedToArray(_useState3,2),modalType=_useState4[0],setModalType=_useState4[1];var _useState5=useState(null),_useState6=_slicedToArray(_useState5,2),modalTarget=_useState6[0],setModalTarget=_useState6[1];var openAddModal=useCallback(function(){setModalOpen(true);setModalType('add_list');setModalTarget(null);},[]);var openRenameModal=useCallback(function(code){setModalOpen(true);setModalType('rename_list');setModalTarget(code);},[]);var closeModal=useCallback(function(){setModalOpen(false);setModalType(null);setModalTarget(null);},[]);var confirmModal=useCallback(function(name){if(modalType==='add_list'){addList(name);}else if(modalType==='rename_list'){updateList(modalTarget,name);}closeModal();},[addList,closeModal,modalTarget,modalType,updateList]);if(isInitializing){return null;}return/*#__PURE__*/React.createElement("div",{className:styles.root},lists.map(function(list){return/*#__PURE__*/React.createElement(SurroundPortals,{key:list.id,portalName:FAVORITES_LIST,portalProps:list},/*#__PURE__*/React.createElement(List,{id:list.id,name:list.name,rename:openRenameModal,remove:function remove(){return removeList(list.id);},removeItem:function removeItem(productId){return _removeItem(list.id,productId);},addToCart:function addToCart(product){return handleAddToCart(list.id,product);},disableRemoveList:lists.length<2}));}),modalOpen?/*#__PURE__*/React.createElement(ListsModal,{type:modalType,onDismiss:closeModal,onConfirm:confirmModal}):null,/*#__PURE__*/React.createElement(SurroundPortals,{portalName:FAVORITES_LIST_ADD_BUTTON},appConfig.hasMultipleFavoritesLists?/*#__PURE__*/React.createElement(RippleButton,{type:"primary",className:styles.addButton,onClick:openAddModal,disabled:false},i18n.text('favorites.add_list')):null));};FavoriteLists.defaultProps={lists:[],isInitializing:true};export default connect(mapStateToProps,mapDispatchToProps)(FavoriteLists);
@@ -0,0 +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,{useState,useCallback}from'react';import PropTypes from'prop-types';import{Dialog,TextField}from'@shopgate/engage/components';import{i18n}from'@shopgate/engage/core';import{css}from'glamor';var styles={root:css({display:'flex',flexDirection:'column'}),textField:css({textAlign:'left'})};/**
2
+ * @param {Object} props Props
3
+ * @returns {Object}
4
+ */var ListsModal=function ListsModal(_ref){var type=_ref.type,onConfirm=_ref.onConfirm,onDismiss=_ref.onDismiss;var _useState=useState(''),_useState2=_slicedToArray(_useState,2),input=_useState2[0],setInput=_useState2[1];var _useState3=useState(null),_useState4=_slicedToArray(_useState3,2),error=_useState4[0],setError=_useState4[1];var onConfirmWrapped=useCallback(function(){if(input.length===0){setError(i18n.text('favorites.errors.invalid_name'));return;}onConfirm(input);},[input,onConfirm]);var onChange=useCallback(function(value){setInput(value);},[]);return/*#__PURE__*/React.createElement(Dialog,{onConfirm:onConfirmWrapped,onDismiss:onDismiss,modal:{title:i18n.text("favorites.".concat(type,"_modal.title")),dismiss:i18n.text("favorites.".concat(type,"_modal.dismiss")),confirm:i18n.text("favorites.".concat(type,"_modal.confirm"))}},/*#__PURE__*/React.createElement("div",{className:styles.root},/*#__PURE__*/React.createElement("span",null,i18n.text("favorites.".concat(type,"_modal.message"))),/*#__PURE__*/React.createElement(TextField,{name:"name",label:i18n.text("favorites.".concat(type,"_modal.label")),onChange:onChange,value:input,errorText:error||undefined,className:styles.textField})));};export default ListsModal;
@@ -0,0 +1 @@
1
+ export{default}from"./Lists";
@@ -0,0 +1,4 @@
1
+ import React from'react';import PropTypes from'prop-types';import{css}from'glamor';import{i18n}from'@shopgate/engage/core';import{Ripple}from'@shopgate/engage/components';import CrossIcon from'@shopgate/pwa-ui-shared/icons/CrossIcon';import{themeShadows,themeColors}from'@shopgate/pwa-common/helpers/config';var styles={root:css({display:'flex',position:'relative',background:themeColors.light,borderRadius:'50%',padding:0,fontSize:20,lineHeight:1,color:"var(--color-secondary, ".concat(themeColors.accent,")"),outline:0,boxShadow:themeShadows.buttons.elevated,height:32,width:32,justifyContent:'center',alignItems:'center'}).toString()};/**
2
+ * The remove favorites button component.
3
+ * @returns {JSX}
4
+ */var RemoveButton=function RemoveButton(_ref){var onClick=_ref.onClick;return/*#__PURE__*/React.createElement("button",{className:styles.root,onClick:onClick,type:"button","aria-label":i18n.text('favorites.remove')},/*#__PURE__*/React.createElement(Ripple,null,/*#__PURE__*/React.createElement(CrossIcon,{className:styles.icon})));};export default RemoveButton;
@@ -0,0 +1 @@
1
+ export{default}from"./RemoveButton";
@@ -0,0 +1,2 @@
1
+ // @flow
2
+ import{FAVORITES}from'@shopgate/pwa-common-commerce/favorites/constants/Portals';export var FAVORITES_LIST="".concat(FAVORITES,".list");export var FAVORITES_LIST_ADD_BUTTON="".concat(FAVORITES,".list-add-button");export var FAVORITES_LIST_CONTEXT_MENU="".concat(FAVORITES,".list-context-menu");export var FAVORITES_LIST_ITEM_ACTIONS="".concat(FAVORITES,".list-item-actions");export var FAVORITES_LIST_ITEM="".concat(FAVORITES,".list-item");
@@ -1,6 +1,5 @@
1
- /** @module favorites */ // ACTION CREATORS
2
- export{addProductToFavorites,removeProductFromFavorites}from'@shopgate/pwa-common-commerce/favorites/action-creators';// ACTIONS
3
- export{default as fetchFavorites}from'@shopgate/pwa-common-commerce/favorites/actions/fetchFavorites';export{addFavorite,removeFavorites,requestSync as toggleFavorites}from'@shopgate/pwa-common-commerce/favorites/actions/toggleFavorites';// CONSTANTS
4
- export*from'@shopgate/pwa-common-commerce/favorites/constants/index';export*from'@shopgate/pwa-common-commerce/favorites/constants/Pipelines';export*from'@shopgate/pwa-common-commerce/favorites/constants/Portals';// SELECTORS
1
+ /** @module favorites */ // ACTIONS
2
+ export{default as fetchFavorites}from'@shopgate/pwa-common-commerce/favorites/actions/fetchFavorites';export{default as fetchFavoritesLists}from'@shopgate/pwa-common-commerce/favorites/actions/fetchFavoritesList';export{default as addFavoritesList}from'@shopgate/pwa-common-commerce/favorites/actions/addFavoritesList';export{addFavorite,removeFavorites,requestSync as toggleFavorites,toggleFavoriteWithListChooser,toggleFavorite}from'@shopgate/pwa-common-commerce/favorites/actions/toggleFavorites';// CONSTANTS
3
+ export*from'@shopgate/pwa-common-commerce/favorites/constants/index';export*from'@shopgate/pwa-common-commerce/favorites/constants/Pipelines';export*from'@shopgate/pwa-common-commerce/favorites/constants/Portals';export*from"./constants/Portals";// SELECTORS
5
4
  export*from'@shopgate/pwa-common-commerce/favorites/selectors';// STREAMS
6
5
  export*from'@shopgate/pwa-common-commerce/favorites/streams';
@@ -1 +1 @@
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);}import*as favorites from'.';describe('engage > favorites',function(){it('should have exports',function(){expect(_typeof(favorites)).toEqual('object');});it('should not do undefined exports',function(){Object.keys(favorites).forEach(function(exportKey){expect(typeof favorites[exportKey]!=='undefined').toBe(true);});});});
1
+ function _typeof(obj){"@babel/helpers - typeof";return _typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(obj){return typeof obj;}:function(obj){return obj&&"function"==typeof Symbol&&obj.constructor===Symbol&&obj!==Symbol.prototype?"symbol":typeof obj;},_typeof(obj);}import*as favorites from'.';describe('engage > favorites',function(){it('should have exports',function(){expect(_typeof(favorites)).toEqual('object');});it('should not do undefined exports',function(){Object.keys(favorites).forEach(function(exportKey){expect(typeof favorites[exportKey]!=='undefined').toBe(true);});});});
@@ -2,4 +2,4 @@ import React from'react';import PropTypes from'prop-types';import styles from"./
2
2
  * Wraps a single fiter page item.
3
3
  * @param {Object} props The component props.
4
4
  * @returns {JSX}
5
- */var FilterItem=function FilterItem(_ref){var children=_ref.children;return React.createElement("div",{className:styles},children);};export default FilterItem;
5
+ */var FilterItem=function FilterItem(_ref){var children=_ref.children;return/*#__PURE__*/React.createElement("div",{className:styles},children);};export default FilterItem;
@@ -1 +1 @@
1
- import React from'react';import{shallow}from'enzyme';import Item from"./index";describe('Filter: <Item />',function(){it('should render',function(){var wrapper=shallow(React.createElement(Item,null,React.createElement("div",null,"Some")));expect(wrapper).toMatchSnapshot();});});
1
+ import React from'react';import{shallow}from'enzyme';import Item from"./index";describe('Filter: <Item />',function(){it('should render',function(){var wrapper=shallow(/*#__PURE__*/React.createElement(Item,null,/*#__PURE__*/React.createElement("div",null,"Some")));expect(wrapper).toMatchSnapshot();});});
@@ -1,4 +1,4 @@
1
- function _slicedToArray(arr,i){return _arrayWithHoles(arr)||_iterableToArrayLimit(arr,i)||_nonIterableRest();}function _nonIterableRest(){throw new TypeError("Invalid attempt to destructure non-iterable instance");}function _iterableToArrayLimit(arr,i){var _arr=[];var _n=true;var _d=false;var _e=undefined;try{for(var _i=arr[Symbol.iterator](),_s;!(_n=(_s=_i.next()).done);_n=true){_arr.push(_s.value);if(i&&_arr.length===i)break;}}catch(err){_d=true;_e=err;}finally{try{if(!_n&&_i["return"]!=null)_i["return"]();}finally{if(_d)throw _e;}}return _arr;}function _arrayWithHoles(arr){if(Array.isArray(arr))return arr;}import React,{memo,useState,useEffect,useRef}from'react';import PropTypes from'prop-types';import appConfig from'@shopgate/pwa-common/helpers/config';import{I18n}from'@shopgate/engage/components';import{i18n}from'@shopgate/engage/core';import styles from"../../style";var currency=appConfig.currency;/**
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,{memo,useState,useEffect,useRef}from'react';import PropTypes from'prop-types';import appConfig from'@shopgate/pwa-common/helpers/config';import{I18n}from'@shopgate/engage/components';import{i18n}from'@shopgate/engage/core';import styles from"../../style";var currency=appConfig.currency;/**
2
2
  * The filter price range slider label component.
3
3
  * @param {Object} props The component props.
4
4
  * @returns {JSX}
@@ -13,4 +13,4 @@ useEffect(function(){setMinOffset(minRef.current.offsetLeft);setMMaxOffset(maxRe
13
13
  */function handleChangeMin(_ref2){var target=_ref2.target;setMinValue(target.value);if(target.value){onChange([parseInt(target.value,10)*100,parseInt(maxValue,10)*100]);}}/**
14
14
  * Handles the change of the maximum price field.
15
15
  * @param {SyntheticEvent} event The change event object.
16
- */function handleChangeMax(_ref3){var target=_ref3.target;setMaxValue(target.value);if(target.value){onChange([parseInt(minValue,10)*100,parseInt(target.value,10)*100]);}}var currencySymbol=Intl.NumberFormat('en-US',{style:'currency',currency:currency}).format('0').replace('0.00','');return React.createElement("div",{className:styles.editableContainer},React.createElement("span",{className:styles.srOnly},i18n.text('price.range',{fromPrice:i18n.price(priceMin,currency,false),toPrice:i18n.price(priceMax,currency,false)})),React.createElement(I18n.Text,{string:"price.range","aria-hidden":true},React.createElement(I18n.Placeholder,{forKey:"fromPrice"},React.createElement("span",{className:styles.price,style:{minWidth:priceLength},ref:minRef},React.createElement(I18n.Price,{price:priceMin,currency:currency,fractions:false}))),React.createElement(I18n.Placeholder,{forKey:"toPrice"},React.createElement("span",{className:styles.price,style:{minWidth:priceLength},ref:maxRef},React.createElement(I18n.Price,{price:priceMax,currency:currency,fractions:false})))),React.createElement("span",{"aria-hidden":true,hidden:true,id:"price-slider-currency-label"},currencySymbol),React.createElement("input",{type:"text",id:"priceMin",name:"priceMin",value:minValue,onChange:handleChangeMin,onClick:handleFieldClick,style:{width:priceLength,left:minOffset},className:styles.editableField,"aria-label":i18n.text('price.range_from'),"aria-describedby":"price-slider-currency-label"}),React.createElement("input",{type:"text",id:"priceMax",name:"priceMax",value:maxValue,onChange:handleChangeMax,onClick:handleFieldClick,style:{width:priceLength,left:maxOffset},className:styles.editableField,"aria-label":i18n.text('price.range_to'),"aria-describedby":"price-slider-currency-label"}));}export default memo(Label);
16
+ */function handleChangeMax(_ref3){var target=_ref3.target;setMaxValue(target.value);if(target.value){onChange([parseInt(minValue,10)*100,parseInt(target.value,10)*100]);}}var currencySymbol=Intl.NumberFormat('en-US',{style:'currency',currency:currency}).format('0').replace('0.00','');return/*#__PURE__*/React.createElement("div",{className:styles.editableContainer},/*#__PURE__*/React.createElement("span",{className:styles.srOnly},i18n.text('price.range',{fromPrice:i18n.price(priceMin,currency,false),toPrice:i18n.price(priceMax,currency,false)})),/*#__PURE__*/React.createElement(I18n.Text,{string:"price.range","aria-hidden":true},/*#__PURE__*/React.createElement(I18n.Placeholder,{forKey:"fromPrice"},/*#__PURE__*/React.createElement("span",{className:styles.price,style:{minWidth:priceLength},ref:minRef},/*#__PURE__*/React.createElement(I18n.Price,{price:priceMin,currency:currency,fractions:false}))),/*#__PURE__*/React.createElement(I18n.Placeholder,{forKey:"toPrice"},/*#__PURE__*/React.createElement("span",{className:styles.price,style:{minWidth:priceLength},ref:maxRef},/*#__PURE__*/React.createElement(I18n.Price,{price:priceMax,currency:currency,fractions:false})))),/*#__PURE__*/React.createElement("span",{"aria-hidden":true,hidden:true,id:"price-slider-currency-label"},currencySymbol),/*#__PURE__*/React.createElement("input",{type:"text",id:"priceMin",name:"priceMin",value:minValue,onChange:handleChangeMin,onClick:handleFieldClick,style:{width:priceLength,left:minOffset},className:styles.editableField,"aria-label":i18n.text('price.range_from'),"aria-describedby":"price-slider-currency-label"}),/*#__PURE__*/React.createElement("input",{type:"text",id:"priceMax",name:"priceMax",value:maxValue,onChange:handleChangeMax,onClick:handleFieldClick,style:{width:priceLength,left:maxOffset},className:styles.editableField,"aria-label":i18n.text('price.range_to'),"aria-describedby":"price-slider-currency-label"}));}export default/*#__PURE__*/memo(Label);
@@ -1 +1 @@
1
- import React from'react';import{shallow}from'enzyme';import Label from"./index";describe('PriceSlider: <Label />',function(){it('should render',function(){var wrapper=shallow(React.createElement(Label,{priceLength:"5",priceMax:999,priceMin:25}));expect(wrapper).toMatchSnapshot();});});
1
+ import React from'react';import{shallow}from'enzyme';import Label from"./index";describe('PriceSlider: <Label />',function(){it('should render',function(){var wrapper=shallow(/*#__PURE__*/React.createElement(Label,{priceLength:"5",priceMax:999,priceMin:25}));expect(wrapper).toMatchSnapshot();});});
@@ -1,22 +1,22 @@
1
- function _typeof(obj){if(typeof Symbol==="function"&&typeof Symbol.iterator==="symbol"){_typeof=function _typeof(obj){return typeof obj;};}else{_typeof=function _typeof(obj){return obj&&typeof Symbol==="function"&&obj.constructor===Symbol&&obj!==Symbol.prototype?"symbol":typeof obj;};}return _typeof(obj);}function _classCallCheck(instance,Constructor){if(!(instance instanceof Constructor)){throw new TypeError("Cannot call a class as a function");}}function _defineProperties(target,props){for(var i=0;i<props.length;i++){var descriptor=props[i];descriptor.enumerable=descriptor.enumerable||false;descriptor.configurable=true;if("value"in descriptor)descriptor.writable=true;Object.defineProperty(target,descriptor.key,descriptor);}}function _createClass(Constructor,protoProps,staticProps){if(protoProps)_defineProperties(Constructor.prototype,protoProps);if(staticProps)_defineProperties(Constructor,staticProps);return Constructor;}function _possibleConstructorReturn(self,call){if(call&&(_typeof(call)==="object"||typeof call==="function")){return call;}return _assertThisInitialized(self);}function _getPrototypeOf(o){_getPrototypeOf=Object.setPrototypeOf?Object.getPrototypeOf:function _getPrototypeOf(o){return o.__proto__||Object.getPrototypeOf(o);};return _getPrototypeOf(o);}function _assertThisInitialized(self){if(self===void 0){throw new ReferenceError("this hasn't been initialised - super() hasn't been called");}return self;}function _inherits(subClass,superClass){if(typeof superClass!=="function"&&superClass!==null){throw new TypeError("Super expression must either be null or a function");}subClass.prototype=Object.create(superClass&&superClass.prototype,{constructor:{value:subClass,writable:true,configurable:true}});if(superClass)_setPrototypeOf(subClass,superClass);}function _setPrototypeOf(o,p){_setPrototypeOf=Object.setPrototypeOf||function _setPrototypeOf(o,p){o.__proto__=p;return o;};return _setPrototypeOf(o,p);}function _defineProperty(obj,key,value){if(key in obj){Object.defineProperty(obj,key,{value:value,enumerable:true,configurable:true,writable:true});}else{obj[key]=value;}return obj;}import React,{PureComponent}from'react';import PropTypes from'prop-types';import isEqual from'lodash/isEqual';import{RangeSlider}from'@shopgate/engage/components';import{FilterItem}from'@shopgate/engage/filter';import Label from"./components/Label";import styles from"./style";/**
1
+ function _typeof(obj){"@babel/helpers - typeof";return _typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(obj){return typeof obj;}:function(obj){return obj&&"function"==typeof Symbol&&obj.constructor===Symbol&&obj!==Symbol.prototype?"symbol":typeof obj;},_typeof(obj);}function _classCallCheck(instance,Constructor){if(!(instance instanceof Constructor)){throw new TypeError("Cannot call a class as a function");}}function _defineProperties(target,props){for(var i=0;i<props.length;i++){var descriptor=props[i];descriptor.enumerable=descriptor.enumerable||false;descriptor.configurable=true;if("value"in descriptor)descriptor.writable=true;Object.defineProperty(target,descriptor.key,descriptor);}}function _createClass(Constructor,protoProps,staticProps){if(protoProps)_defineProperties(Constructor.prototype,protoProps);if(staticProps)_defineProperties(Constructor,staticProps);Object.defineProperty(Constructor,"prototype",{writable:false});return Constructor;}function _inherits(subClass,superClass){if(typeof superClass!=="function"&&superClass!==null){throw new TypeError("Super expression must either be null or a function");}subClass.prototype=Object.create(superClass&&superClass.prototype,{constructor:{value:subClass,writable:true,configurable:true}});Object.defineProperty(subClass,"prototype",{writable:false});if(superClass)_setPrototypeOf(subClass,superClass);}function _setPrototypeOf(o,p){_setPrototypeOf=Object.setPrototypeOf||function _setPrototypeOf(o,p){o.__proto__=p;return o;};return _setPrototypeOf(o,p);}function _createSuper(Derived){var hasNativeReflectConstruct=_isNativeReflectConstruct();return function _createSuperInternal(){var Super=_getPrototypeOf(Derived),result;if(hasNativeReflectConstruct){var NewTarget=_getPrototypeOf(this).constructor;result=Reflect.construct(Super,arguments,NewTarget);}else{result=Super.apply(this,arguments);}return _possibleConstructorReturn(this,result);};}function _possibleConstructorReturn(self,call){if(call&&(_typeof(call)==="object"||typeof call==="function")){return call;}else if(call!==void 0){throw new TypeError("Derived constructors may only return object or undefined");}return _assertThisInitialized(self);}function _assertThisInitialized(self){if(self===void 0){throw new ReferenceError("this hasn't been initialised - super() hasn't been called");}return self;}function _isNativeReflectConstruct(){if(typeof Reflect==="undefined"||!Reflect.construct)return false;if(Reflect.construct.sham)return false;if(typeof Proxy==="function")return true;try{Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}));return true;}catch(e){return false;}}function _getPrototypeOf(o){_getPrototypeOf=Object.setPrototypeOf?Object.getPrototypeOf:function _getPrototypeOf(o){return o.__proto__||Object.getPrototypeOf(o);};return _getPrototypeOf(o);}function _defineProperty(obj,key,value){if(key in obj){Object.defineProperty(obj,key,{value:value,enumerable:true,configurable:true,writable:true});}else{obj[key]=value;}return obj;}import React,{PureComponent}from'react';import PropTypes from'prop-types';import isEqual from'lodash/isEqual';import{RangeSlider}from'@shopgate/engage/components';import{FilterItem}from'@shopgate/engage/filter';import Label from"./components/Label";import styles from"./style";/**
2
2
  * The PriceSlider component.
3
- */var PriceSlider=/*#__PURE__*/function(_PureComponent){_inherits(PriceSlider,_PureComponent);/**
3
+ */var PriceSlider=/*#__PURE__*/function(_PureComponent){_inherits(PriceSlider,_PureComponent);var _super=_createSuper(PriceSlider);/**
4
4
  * The constructor.
5
5
  * @param {Object} props The component props.
6
- */function PriceSlider(props){var _this;_classCallCheck(this,PriceSlider);_this=_possibleConstructorReturn(this,_getPrototypeOf(PriceSlider).call(this,props));_defineProperty(_assertThisInitialized(_this),"onChange",function(value){var roundedValue=[Math.floor(value[0]),Math.ceil(value[1])];_this.setState({value:value});_this.props.onChange(_this.props.id,roundedValue);});var initialValue=props.value||[props.min,props.max];_this.state={value:initialValue};return _this;}/**
6
+ */function PriceSlider(props){var _this;_classCallCheck(this,PriceSlider);_this=_super.call(this,props);_defineProperty(_assertThisInitialized(_this),"onChange",function(value){var roundedValue=[Math.floor(value[0]),Math.ceil(value[1])];_this.setState({value:value});_this.props.onChange(_this.props.id,roundedValue);});var initialValue=props.value||[props.min,props.max];_this.state={value:initialValue};return _this;}/**
7
7
  * Updates the value state.
8
8
  * @param {Object} nextProps The next component props.
9
9
  */_createClass(PriceSlider,[{key:"UNSAFE_componentWillReceiveProps",value:function UNSAFE_componentWillReceiveProps(nextProps){if(!isEqual(nextProps.value,this.props.value)){this.setState({value:nextProps.value});}}/**
10
10
  * The callback function that is given to the RangeSlider.
11
11
  * @param {Array} value The lower and upper boundary of the set range.
12
- */},{key:"render",/**
12
+ */},{key:"render",value:/**
13
13
  * Renders the component (template).
14
14
  * @returns {JSX}
15
- */value:function render(){var _this$props=this.props,min=_this$props.min,max=_this$props.max;/**
15
+ */function render(){var _this$props=this.props,min=_this$props.min,max=_this$props.max;/**
16
16
  * The min and max price need to be rounded before they are passed to the I18n component,
17
17
  * since it rounds to the full nearest number when fractions are deactivated.
18
18
  */var priceMin=Math.floor(this.state.value[0]/100);var priceMax=Math.ceil(this.state.value[1]/100);/**
19
19
  * Calculate the necessary maximum size for the price value.
20
20
  * The size is 2 characters more than the max possible number length
21
21
  * to reserve space for the currency symbol and a little spacing around.
22
- */var priceLength="".concat((max/100).toString().length+2,"ch");return React.createElement(FilterItem,null,React.createElement("div",{className:styles.wrapper,"data-test-id":"priceRangeSlider"},React.createElement(Label,{priceLength:priceLength,priceMax:priceMax,priceMin:priceMin,onChange:this.onChange}),React.createElement(RangeSlider,{classNames:styles.rangeSlider,easing:"exponential",factor:3,max:max,min:min,onChange:this.onChange,value:this.state.value})));}}]);return PriceSlider;}(PureComponent);_defineProperty(PriceSlider,"defaultProps",{max:100,min:0,onChange:function onChange(){},value:null});export default PriceSlider;
22
+ */var priceLength="".concat((max/100).toString().length+2,"ch");return/*#__PURE__*/React.createElement(FilterItem,null,/*#__PURE__*/React.createElement("div",{className:styles.wrapper,"data-test-id":"priceRangeSlider"},/*#__PURE__*/React.createElement(Label,{priceLength:priceLength,priceMax:priceMax,priceMin:priceMin,onChange:this.onChange}),/*#__PURE__*/React.createElement(RangeSlider,{classNames:styles.rangeSlider,easing:"exponential",factor:3,max:max,min:min,onChange:this.onChange,value:this.state.value})));}}]);return PriceSlider;}(PureComponent);_defineProperty(PriceSlider,"defaultProps",{max:100,min:0,onChange:function onChange(){},value:null});export default PriceSlider;
@@ -1 +1 @@
1
- import React from'react';import{shallow}from'enzyme';import PriceSlider from"./index";describe('Filter: <PriceSlider />',function(){it('should render with default props',function(){var wrapper=shallow(React.createElement(PriceSlider,{id:"foo"}));expect(wrapper).toMatchSnapshot();});it('should render with custom props',function(){var wrapper=shallow(React.createElement(PriceSlider,{id:"foo",values:[5,50]}));expect(wrapper).toMatchSnapshot();});});
1
+ import React from'react';import{shallow}from'enzyme';import PriceSlider from"./index";describe('Filter: <PriceSlider />',function(){it('should render with default props',function(){var wrapper=shallow(/*#__PURE__*/React.createElement(PriceSlider,{id:"foo"}));expect(wrapper).toMatchSnapshot();});it('should render with custom props',function(){var wrapper=shallow(/*#__PURE__*/React.createElement(PriceSlider,{id:"foo",values:[5,50]}));expect(wrapper).toMatchSnapshot();});});
@@ -1 +1 @@
1
- function _objectWithoutProperties(source,excluded){if(source==null)return{};var target=_objectWithoutPropertiesLoose(source,excluded);var key,i;if(Object.getOwnPropertySymbols){var sourceSymbolKeys=Object.getOwnPropertySymbols(source);for(i=0;i<sourceSymbolKeys.length;i++){key=sourceSymbolKeys[i];if(excluded.indexOf(key)>=0)continue;if(!Object.prototype.propertyIsEnumerable.call(source,key))continue;target[key]=source[key];}}return target;}function _objectWithoutPropertiesLoose(source,excluded){if(source==null)return{};var target={};var sourceKeys=Object.keys(source);var key,i;for(i=0;i<sourceKeys.length;i++){key=sourceKeys[i];if(excluded.indexOf(key)>=0)continue;target[key]=source[key];}return target;}import set from'lodash/set';import cloneDeep from'lodash/cloneDeep';import buildUpdatedFilters from"../buildUpdatedFilters";var mockedFilter={display_amount:{id:'display_amount',label:'Price',type:'range',value:[100,2000]},manufacturer:{id:'manufacturer',label:'Manufacturer',type:'multiselect',value:[{id:'wayland_corp',label:'Weyland Corp'},{id:'tyrell_corp',label:'Tyrell Corporation'}]}};describe('buildUpdatedFilters()',function(){it('should update filters as expected',function(){var updated=cloneDeep(mockedFilter);expect(buildUpdatedFilters({},updated)).toEqual(updated);});it('should exclude filters when they do not have values selected',function(){var initial=cloneDeep(mockedFilter);var updated=set(cloneDeep(mockedFilter),'manufacturer.value',[]);var manufacturer=mockedFilter.manufacturer,expected=_objectWithoutProperties(mockedFilter,["manufacturer"]);expect(buildUpdatedFilters(initial,updated)).toEqual(expected);});it('should round the values of a display amount filter',function(){var initial=cloneDeep(mockedFilter);var updated=set(cloneDeep(mockedFilter),'display_amount.value',[125,1920]);expect(buildUpdatedFilters(initial,updated)).toEqual(mockedFilter);});it('should return null both parameters are empty objects',function(){expect(buildUpdatedFilters({},{})).toBeNull();});});
1
+ var _excluded=["manufacturer"];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 set from'lodash/set';import cloneDeep from'lodash/cloneDeep';import buildUpdatedFilters from"../buildUpdatedFilters";var mockedFilter={display_amount:{id:'display_amount',label:'Price',type:'range',value:[100,2000]},manufacturer:{id:'manufacturer',label:'Manufacturer',type:'multiselect',value:[{id:'wayland_corp',label:'Weyland Corp'},{id:'tyrell_corp',label:'Tyrell Corporation'}]}};describe('buildUpdatedFilters()',function(){it('should update filters as expected',function(){var updated=cloneDeep(mockedFilter);expect(buildUpdatedFilters({},updated)).toEqual(updated);});it('should exclude filters when they do not have values selected',function(){var initial=cloneDeep(mockedFilter);var updated=set(cloneDeep(mockedFilter),'manufacturer.value',[]);var manufacturer=mockedFilter.manufacturer,expected=_objectWithoutProperties(mockedFilter,_excluded);expect(buildUpdatedFilters(initial,updated)).toEqual(expected);});it('should round the values of a display amount filter',function(){var initial=cloneDeep(mockedFilter);var updated=set(cloneDeep(mockedFilter),'display_amount.value',[125,1920]);expect(buildUpdatedFilters(initial,updated)).toEqual(mockedFilter);});it('should return null both parameters are empty objects',function(){expect(buildUpdatedFilters({},{})).toBeNull();});});
@@ -2,4 +2,4 @@ function _extends(){_extends=Object.assign||function(target){for(var i=1;i<argum
2
2
  * @param {Object} filters The available filters.
3
3
  * @param {Object} activeFilters The selected filters.
4
4
  * @returns {Object}
5
- */export default function buildInitialFilters(filters,activeFilters){var defaults={};if(!filters){return defaults;}filters.forEach(function(filter){var id=filter.id,maximum=filter.maximum,minimum=filter.minimum,type=filter.type;defaults[id]={type:type,value:type===FILTER_TYPE_RANGE?[minimum,maximum]:[]};});return _extends({},defaults,{},activeFilters);}
5
+ */export default function buildInitialFilters(filters,activeFilters){var defaults={};if(!filters){return defaults;}filters.forEach(function(filter){var id=filter.id,maximum=filter.maximum,minimum=filter.minimum,type=filter.type;defaults[id]={type:type,value:type===FILTER_TYPE_RANGE?[minimum,maximum]:[]};});return _extends({},defaults,activeFilters);}
@@ -1,8 +1,8 @@
1
- function _defineProperty(obj,key,value){if(key in obj){Object.defineProperty(obj,key,{value:value,enumerable:true,configurable:true,writable:true});}else{obj[key]=value;}return obj;}function _slicedToArray(arr,i){return _arrayWithHoles(arr)||_iterableToArrayLimit(arr,i)||_nonIterableRest();}function _nonIterableRest(){throw new TypeError("Invalid attempt to destructure non-iterable instance");}function _iterableToArrayLimit(arr,i){var _arr=[];var _n=true;var _d=false;var _e=undefined;try{for(var _i=arr[Symbol.iterator](),_s;!(_n=(_s=_i.next()).done);_n=true){_arr.push(_s.value);if(i&&_arr.length===i)break;}}catch(err){_d=true;_e=err;}finally{try{if(!_n&&_i["return"]!=null)_i["return"]();}finally{if(_d)throw _e;}}return _arr;}function _arrayWithHoles(arr){if(Array.isArray(arr))return arr;}function _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);}/**
1
+ function _defineProperty(obj,key,value){if(key in obj){Object.defineProperty(obj,key,{value:value,enumerable:true,configurable:true,writable:true});}else{obj[key]=value;}return obj;}function _slicedToArray(arr,i){return _arrayWithHoles(arr)||_iterableToArrayLimit(arr,i)||_unsupportedIterableToArray(arr,i)||_nonIterableRest();}function _nonIterableRest(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");}function _unsupportedIterableToArray(o,minLen){if(!o)return;if(typeof o==="string")return _arrayLikeToArray(o,minLen);var n=Object.prototype.toString.call(o).slice(8,-1);if(n==="Object"&&o.constructor)n=o.constructor.name;if(n==="Map"||n==="Set")return Array.from(o);if(n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return _arrayLikeToArray(o,minLen);}function _arrayLikeToArray(arr,len){if(len==null||len>arr.length)len=arr.length;for(var i=0,arr2=new Array(len);i<len;i++){arr2[i]=arr[i];}return arr2;}function _iterableToArrayLimit(arr,i){var _i=arr==null?null:typeof Symbol!=="undefined"&&arr[Symbol.iterator]||arr["@@iterator"];if(_i==null)return;var _arr=[];var _n=true;var _d=false;var _s,_e;try{for(_i=_i.call(arr);!(_n=(_s=_i.next()).done);_n=true){_arr.push(_s.value);if(i&&_arr.length===i)break;}}catch(err){_d=true;_e=err;}finally{try{if(!_n&&_i["return"]!=null)_i["return"]();}finally{if(_d)throw _e;}}return _arr;}function _arrayWithHoles(arr){if(Array.isArray(arr))return arr;}function _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);}/**
2
2
  * @param {Object} initialFilters The filters before they where modified.
3
3
  * @param {Object} updatedFilters The filters after they where modified.
4
4
  * @return {Object}
5
5
  */export default function buildUpdatedFilters(initialFilters,updatedFilters){// Create a set of active filters by combining state and updatedFilters.
6
- var activeFilters=_extends({},initialFilters,{},updatedFilters);return Object.keys(activeFilters).reduce(function(result,filterId){var filter=activeFilters[filterId];if(filterId==='display_amount'){var _filter$value=_slicedToArray(filter.value,2),min=_filter$value[0],max=_filter$value[1];// Take care that the values for the display amount reflect the state of the price slider.
6
+ var activeFilters=_extends({},initialFilters,updatedFilters);return Object.keys(activeFilters).reduce(function(result,filterId){var filter=activeFilters[filterId];if(filterId==='display_amount'){var _filter$value=_slicedToArray(filter.value,2),min=_filter$value[0],max=_filter$value[1];// Take care that the values for the display amount reflect the state of the price slider.
7
7
  filter.value=[Math.floor(min/100)*100,Math.ceil(max/100)*100];}if(filter.value.length){// Only add filters with selected values.
8
8
  return _extends({},result===null?{}:result,_defineProperty({},filterId,filter));}return result;},null);}
@@ -1 +1 @@
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);}import*as filter from'.';describe('engage > filter',function(){it('should have exports',function(){expect(_typeof(filter)).toEqual('object');});it('should not do undefined exports',function(){Object.keys(filter).forEach(function(exportKey){expect(typeof filter[exportKey]!=='undefined').toBe(true);});});});
1
+ function _typeof(obj){"@babel/helpers - typeof";return _typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(obj){return typeof obj;}:function(obj){return obj&&"function"==typeof Symbol&&obj.constructor===Symbol&&obj!==Symbol.prototype?"symbol":typeof obj;},_typeof(obj);}import*as filter from'.';describe('engage > filter',function(){it('should have exports',function(){expect(_typeof(filter)).toEqual('object');});it('should not do undefined exports',function(){Object.keys(filter).forEach(function(exportKey){expect(typeof filter[exportKey]!=='undefined').toBe(true);});});});
package/index.spec.js CHANGED
@@ -1 +1 @@
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);}import*as engage from'.';describe('engage',function(){it('should have exports',function(){expect(_typeof(engage)).toEqual('object');});it('should not do undefined exports',function(){Object.keys(engage).forEach(function(exportKey){expect(typeof engage[exportKey]!=='undefined').toBe(true);});});});
1
+ function _typeof(obj){"@babel/helpers - typeof";return _typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(obj){return typeof obj;}:function(obj){return obj&&"function"==typeof Symbol&&obj.constructor===Symbol&&obj!==Symbol.prototype?"symbol":typeof obj;},_typeof(obj);}import*as engage from'.';describe('engage',function(){it('should have exports',function(){expect(_typeof(engage)).toEqual('object');});it('should not do undefined exports',function(){Object.keys(engage).forEach(function(exportKey){expect(typeof engage[exportKey]!=='undefined').toBe(true);});});});
@@ -1 +1 @@
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);}import*as market from'.';describe('engage > market',function(){it('should have exports',function(){expect(_typeof(market)).toEqual('object');});it('should not do undefined exports',function(){Object.keys(market).forEach(function(exportKey){expect(typeof market[exportKey]!=='undefined').toBe(true);});});});
1
+ function _typeof(obj){"@babel/helpers - typeof";return _typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(obj){return typeof obj;}:function(obj){return obj&&"function"==typeof Symbol&&obj.constructor===Symbol&&obj!==Symbol.prototype?"symbol":typeof obj;},_typeof(obj);}import*as market from'.';describe('engage > market',function(){it('should have exports',function(){expect(_typeof(market)).toEqual('object');});it('should not do undefined exports',function(){Object.keys(market).forEach(function(exportKey){expect(typeof market[exportKey]!=='undefined').toBe(true);});});});
@@ -1 +1 @@
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);}import*as orders from'.';describe('engage > orders',function(){it('should have exports',function(){expect(_typeof(orders)).toEqual('object');});it('should not do undefined exports',function(){Object.keys(orders).forEach(function(exportKey){expect(typeof orders[exportKey]!=='undefined').toBe(true);});});});
1
+ function _typeof(obj){"@babel/helpers - typeof";return _typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(obj){return typeof obj;}:function(obj){return obj&&"function"==typeof Symbol&&obj.constructor===Symbol&&obj!==Symbol.prototype?"symbol":typeof obj;},_typeof(obj);}import*as orders from'.';describe('engage > orders',function(){it('should have exports',function(){expect(_typeof(orders)).toEqual('object');});it('should not do undefined exports',function(){Object.keys(orders).forEach(function(exportKey){expect(typeof orders[exportKey]!=='undefined').toBe(true);});});});
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@shopgate/engage",
3
- "version": "6.20.0-beta.3",
3
+ "version": "6.20.0-beta.6",
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-beta.3",
19
- "@shopgate/pwa-common-commerce": "6.20.0-beta.3",
20
- "@shopgate/pwa-core": "6.20.0-beta.3",
21
- "@shopgate/pwa-ui-ios": "6.20.0-beta.3",
22
- "@shopgate/pwa-ui-material": "6.20.0-beta.3",
23
- "@shopgate/pwa-ui-shared": "6.20.0-beta.3",
18
+ "@shopgate/pwa-common": "6.20.0-beta.6",
19
+ "@shopgate/pwa-common-commerce": "6.20.0-beta.6",
20
+ "@shopgate/pwa-core": "6.20.0-beta.6",
21
+ "@shopgate/pwa-ui-ios": "6.20.0-beta.6",
22
+ "@shopgate/pwa-ui-material": "6.20.0-beta.6",
23
+ "@shopgate/pwa-ui-shared": "6.20.0-beta.6",
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",
@@ -1 +1 @@
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);}import*as page from'.';describe('engage > page',function(){it('should have exports',function(){expect(_typeof(page)).toEqual('object');});it('should not do undefined exports',function(){Object.keys(page).forEach(function(exportKey){expect(typeof page[exportKey]!=='undefined').toBe(true);});});});
1
+ function _typeof(obj){"@babel/helpers - typeof";return _typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(obj){return typeof obj;}:function(obj){return obj&&"function"==typeof Symbol&&obj.constructor===Symbol&&obj!==Symbol.prototype?"symbol":typeof obj;},_typeof(obj);}import*as page from'.';describe('engage > page',function(){it('should have exports',function(){expect(_typeof(page)).toEqual('object');});it('should not do undefined exports',function(){Object.keys(page).forEach(function(exportKey){expect(typeof page[exportKey]!=='undefined').toBe(true);});});});
@@ -1,8 +1,8 @@
1
- function _typeof(obj){if(typeof Symbol==="function"&&typeof Symbol.iterator==="symbol"){_typeof=function _typeof(obj){return typeof obj;};}else{_typeof=function _typeof(obj){return obj&&typeof Symbol==="function"&&obj.constructor===Symbol&&obj!==Symbol.prototype?"symbol":typeof obj;};}return _typeof(obj);}function _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 _getPrototypeOf(o){_getPrototypeOf=Object.setPrototypeOf?Object.getPrototypeOf:function _getPrototypeOf(o){return o.__proto__||Object.getPrototypeOf(o);};return _getPrototypeOf(o);}function _assertThisInitialized(self){if(self===void 0){throw new ReferenceError("this hasn't been initialised - super() hasn't been called");}return self;}function _inherits(subClass,superClass){if(typeof superClass!=="function"&&superClass!==null){throw new TypeError("Super expression must either be null or a function");}subClass.prototype=Object.create(superClass&&superClass.prototype,{constructor:{value:subClass,writable:true,configurable:true}});if(superClass)_setPrototypeOf(subClass,superClass);}function _setPrototypeOf(o,p){_setPrototypeOf=Object.setPrototypeOf||function _setPrototypeOf(o,p){o.__proto__=p;return o;};return _setPrototypeOf(o,p);}function _defineProperty(obj,key,value){if(key in obj){Object.defineProperty(obj,key,{value:value,enumerable:true,configurable:true,writable:true});}else{obj[key]=value;}return obj;}import React,{PureComponent}from'react';import PropTypes from'prop-types';import{SheetDrawer,SheetList}from'@shopgate/engage/components';import{VariantContext,ProductContext}from'@shopgate/engage/product';import{ViewContext}from'@shopgate/engage/components/View';import Item from"../SheetItem";import VariantAvailability from"../VariantAvailability";/**
1
+ function _typeof(obj){"@babel/helpers - typeof";return _typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(obj){return typeof obj;}:function(obj){return obj&&"function"==typeof Symbol&&obj.constructor===Symbol&&obj!==Symbol.prototype?"symbol":typeof obj;},_typeof(obj);}function _extends(){_extends=Object.assign||function(target){for(var i=1;i<arguments.length;i++){var source=arguments[i];for(var key in source){if(Object.prototype.hasOwnProperty.call(source,key)){target[key]=source[key];}}}return target;};return _extends.apply(this,arguments);}function _classCallCheck(instance,Constructor){if(!(instance instanceof Constructor)){throw new TypeError("Cannot call a class as a function");}}function _defineProperties(target,props){for(var i=0;i<props.length;i++){var descriptor=props[i];descriptor.enumerable=descriptor.enumerable||false;descriptor.configurable=true;if("value"in descriptor)descriptor.writable=true;Object.defineProperty(target,descriptor.key,descriptor);}}function _createClass(Constructor,protoProps,staticProps){if(protoProps)_defineProperties(Constructor.prototype,protoProps);if(staticProps)_defineProperties(Constructor,staticProps);Object.defineProperty(Constructor,"prototype",{writable:false});return Constructor;}function _inherits(subClass,superClass){if(typeof superClass!=="function"&&superClass!==null){throw new TypeError("Super expression must either be null or a function");}subClass.prototype=Object.create(superClass&&superClass.prototype,{constructor:{value:subClass,writable:true,configurable:true}});Object.defineProperty(subClass,"prototype",{writable:false});if(superClass)_setPrototypeOf(subClass,superClass);}function _setPrototypeOf(o,p){_setPrototypeOf=Object.setPrototypeOf||function _setPrototypeOf(o,p){o.__proto__=p;return o;};return _setPrototypeOf(o,p);}function _createSuper(Derived){var hasNativeReflectConstruct=_isNativeReflectConstruct();return function _createSuperInternal(){var Super=_getPrototypeOf(Derived),result;if(hasNativeReflectConstruct){var NewTarget=_getPrototypeOf(this).constructor;result=Reflect.construct(Super,arguments,NewTarget);}else{result=Super.apply(this,arguments);}return _possibleConstructorReturn(this,result);};}function _possibleConstructorReturn(self,call){if(call&&(_typeof(call)==="object"||typeof call==="function")){return call;}else if(call!==void 0){throw new TypeError("Derived constructors may only return object or undefined");}return _assertThisInitialized(self);}function _assertThisInitialized(self){if(self===void 0){throw new ReferenceError("this hasn't been initialised - super() hasn't been called");}return self;}function _isNativeReflectConstruct(){if(typeof Reflect==="undefined"||!Reflect.construct)return false;if(Reflect.construct.sham)return false;if(typeof Proxy==="function")return true;try{Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}));return true;}catch(e){return false;}}function _getPrototypeOf(o){_getPrototypeOf=Object.setPrototypeOf?Object.getPrototypeOf:function _getPrototypeOf(o){return o.__proto__||Object.getPrototypeOf(o);};return _getPrototypeOf(o);}function _defineProperty(obj,key,value){if(key in obj){Object.defineProperty(obj,key,{value:value,enumerable:true,configurable:true,writable:true});}else{obj[key]=value;}return obj;}import React,{PureComponent}from'react';import PropTypes from'prop-types';import{SheetDrawer,SheetList}from'@shopgate/engage/components';import{VariantContext,ProductContext}from'@shopgate/engage/product';import{ViewContext}from'@shopgate/engage/components/View';import Item from"../SheetItem";import VariantAvailability from"../VariantAvailability";/**
2
2
  * The CharacteristicSheet component.
3
- */var CharacteristicSheet=/*#__PURE__*/function(_PureComponent){_inherits(CharacteristicSheet,_PureComponent);function CharacteristicSheet(){var _getPrototypeOf2;var _this;_classCallCheck(this,CharacteristicSheet);for(var _len=arguments.length,args=new Array(_len),_key=0;_key<_len;_key++){args[_key]=arguments[_key];}_this=_possibleConstructorReturn(this,(_getPrototypeOf2=_getPrototypeOf(CharacteristicSheet)).call.apply(_getPrototypeOf2,[this].concat(args)));_defineProperty(_assertThisInitialized(_this),"firstSelectableItemRef",React.createRef());_defineProperty(_assertThisInitialized(_this),"onDidOpen",function(){if(_this.firstSelectableItemRef.current){_this.firstSelectableItemRef.current.focus();}_this.props.setViewAriaHidden(true);});_defineProperty(_assertThisInitialized(_this),"onClose",function(e){_this.props.onClose(e);_this.props.setViewAriaHidden(false);});_defineProperty(_assertThisInitialized(_this),"handleItemClick",function(event){event.stopPropagation();_this.props.onSelect(event.target.value);});_defineProperty(_assertThisInitialized(_this),"renderAvailability",function(value){var selection=_extends({},_this.props.selection,_defineProperty({},_this.props.charId,value));return React.createElement(VariantAvailability,{characteristics:selection,productId:_this.props.productId});});return _this;}_createClass(CharacteristicSheet,[{key:"render",/**
3
+ */var CharacteristicSheet=/*#__PURE__*/function(_PureComponent){_inherits(CharacteristicSheet,_PureComponent);var _super=_createSuper(CharacteristicSheet);function CharacteristicSheet(){var _this;_classCallCheck(this,CharacteristicSheet);for(var _len=arguments.length,args=new Array(_len),_key=0;_key<_len;_key++){args[_key]=arguments[_key];}_this=_super.call.apply(_super,[this].concat(args));_defineProperty(_assertThisInitialized(_this),"firstSelectableItemRef",/*#__PURE__*/React.createRef());_defineProperty(_assertThisInitialized(_this),"onDidOpen",function(){if(_this.firstSelectableItemRef.current){_this.firstSelectableItemRef.current.focus();}_this.props.setViewAriaHidden(true);});_defineProperty(_assertThisInitialized(_this),"onClose",function(e){_this.props.onClose(e);_this.props.setViewAriaHidden(false);});_defineProperty(_assertThisInitialized(_this),"handleItemClick",function(event){event.stopPropagation();_this.props.onSelect(event.target.value);});_defineProperty(_assertThisInitialized(_this),"renderAvailability",function(value){var selection=_extends({},_this.props.selection,_defineProperty({},_this.props.charId,value));return/*#__PURE__*/React.createElement(VariantAvailability,{characteristics:selection,productId:_this.props.productId});});return _this;}_createClass(CharacteristicSheet,[{key:"render",value:/**
4
4
  * @return {JSX}
5
- */value:function render(){var _this2=this;var _this$props=this.props,items=_this$props.items,label=_this$props.label,open=_this$props.open,selectedValue=_this$props.selectedValue;var selectedIndex;if(selectedValue){selectedIndex=items.findIndex(function(item){return item.id===selectedValue;});}else{selectedIndex=items.findIndex(function(item){return item.selectable;});}return React.createElement(SheetDrawer,{title:label,isOpen:open,onClose:this.onClose,onDidOpen:this.onDidOpen},React.createElement(SheetList,{className:"theme__product__characteristic__sheet"},items.map(function(item,index){return React.createElement(Item,{item:item,key:item.id,onClick:_this2.handleItemClick,rightComponent:function rightComponent(){return _this2.renderAvailability(item.id);},selected:item.id===selectedValue,ref:index===selectedIndex?_this2.firstSelectableItemRef:null});})));}}]);return CharacteristicSheet;}(PureComponent);/**
5
+ */function render(){var _this2=this;var _this$props=this.props,items=_this$props.items,label=_this$props.label,open=_this$props.open,selectedValue=_this$props.selectedValue;var selectedIndex;if(selectedValue){selectedIndex=items.findIndex(function(item){return item.id===selectedValue;});}else{selectedIndex=items.findIndex(function(item){return item.selectable;});}return/*#__PURE__*/React.createElement(SheetDrawer,{title:label,isOpen:open,onClose:this.onClose,onDidOpen:this.onDidOpen},/*#__PURE__*/React.createElement(SheetList,{className:"theme__product__characteristic__sheet"},items.map(function(item,index){return/*#__PURE__*/React.createElement(Item,{item:item,key:item.id,onClick:_this2.handleItemClick,rightComponent:function rightComponent(){return _this2.renderAvailability(item.id);},selected:item.id===selectedValue,ref:index===selectedIndex?_this2.firstSelectableItemRef:null});})));}}]);return CharacteristicSheet;}(PureComponent);/**
6
6
  * @param {Object} props The original component props.
7
7
  * @returns {JSX}
8
- */_defineProperty(CharacteristicSheet,"defaultProps",{onClose:function onClose(){},onSelect:function onSelect(){},productId:null,selectedValue:null,selection:null});var SheetComponent=function SheetComponent(props){return React.createElement(ViewContext.Consumer,null,function(_ref){var setAriaHidden=_ref.setAriaHidden;return React.createElement(ProductContext.Consumer,null,function(_ref2){var productId=_ref2.productId;return React.createElement(VariantContext.Consumer,null,function(_ref3){var characteristics=_ref3.characteristics;return React.createElement(CharacteristicSheet,_extends({productId:productId,selection:characteristics,setViewAriaHidden:setAriaHidden},props));});});});};export default SheetComponent;
8
+ */_defineProperty(CharacteristicSheet,"defaultProps",{onClose:function onClose(){},onSelect:function onSelect(){},productId:null,selectedValue:null,selection:null});var SheetComponent=function SheetComponent(props){return/*#__PURE__*/React.createElement(ViewContext.Consumer,null,function(_ref){var setAriaHidden=_ref.setAriaHidden;return/*#__PURE__*/React.createElement(ProductContext.Consumer,null,function(_ref2){var productId=_ref2.productId;return/*#__PURE__*/React.createElement(VariantContext.Consumer,null,function(_ref3){var characteristics=_ref3.characteristics;return/*#__PURE__*/React.createElement(CharacteristicSheet,_extends({productId:productId,selection:characteristics,setViewAriaHidden:setAriaHidden},props));});});});};export default SheetComponent;
@@ -1,5 +1,5 @@
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 _getPrototypeOf(o){_getPrototypeOf=Object.setPrototypeOf?Object.getPrototypeOf:function _getPrototypeOf(o){return o.__proto__||Object.getPrototypeOf(o);};return _getPrototypeOf(o);}function _assertThisInitialized(self){if(self===void 0){throw new ReferenceError("this hasn't been initialised - super() hasn't been called");}return self;}function _inherits(subClass,superClass){if(typeof superClass!=="function"&&superClass!==null){throw new TypeError("Super expression must either be null or a function");}subClass.prototype=Object.create(superClass&&superClass.prototype,{constructor:{value:subClass,writable:true,configurable:true}});if(superClass)_setPrototypeOf(subClass,superClass);}function _setPrototypeOf(o,p){_setPrototypeOf=Object.setPrototypeOf||function _setPrototypeOf(o,p){o.__proto__=p;return o;};return _setPrototypeOf(o,p);}function _defineProperty(obj,key,value){if(key in obj){Object.defineProperty(obj,key,{value:value,enumerable:true,configurable:true,writable:true});}else{obj[key]=value;}return obj;}import React,{PureComponent}from'react';import PropTypes from'prop-types';import{withForwardedRef}from'@shopgate/engage/core';import styles from"./style";/**
1
+ function _typeof(obj){"@babel/helpers - typeof";return _typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(obj){return typeof obj;}:function(obj){return obj&&"function"==typeof Symbol&&obj.constructor===Symbol&&obj!==Symbol.prototype?"symbol":typeof obj;},_typeof(obj);}function _extends(){_extends=Object.assign||function(target){for(var i=1;i<arguments.length;i++){var source=arguments[i];for(var key in source){if(Object.prototype.hasOwnProperty.call(source,key)){target[key]=source[key];}}}return target;};return _extends.apply(this,arguments);}function _classCallCheck(instance,Constructor){if(!(instance instanceof Constructor)){throw new TypeError("Cannot call a class as a function");}}function _defineProperties(target,props){for(var i=0;i<props.length;i++){var descriptor=props[i];descriptor.enumerable=descriptor.enumerable||false;descriptor.configurable=true;if("value"in descriptor)descriptor.writable=true;Object.defineProperty(target,descriptor.key,descriptor);}}function _createClass(Constructor,protoProps,staticProps){if(protoProps)_defineProperties(Constructor.prototype,protoProps);if(staticProps)_defineProperties(Constructor,staticProps);Object.defineProperty(Constructor,"prototype",{writable:false});return Constructor;}function _inherits(subClass,superClass){if(typeof superClass!=="function"&&superClass!==null){throw new TypeError("Super expression must either be null or a function");}subClass.prototype=Object.create(superClass&&superClass.prototype,{constructor:{value:subClass,writable:true,configurable:true}});Object.defineProperty(subClass,"prototype",{writable:false});if(superClass)_setPrototypeOf(subClass,superClass);}function _setPrototypeOf(o,p){_setPrototypeOf=Object.setPrototypeOf||function _setPrototypeOf(o,p){o.__proto__=p;return o;};return _setPrototypeOf(o,p);}function _createSuper(Derived){var hasNativeReflectConstruct=_isNativeReflectConstruct();return function _createSuperInternal(){var Super=_getPrototypeOf(Derived),result;if(hasNativeReflectConstruct){var NewTarget=_getPrototypeOf(this).constructor;result=Reflect.construct(Super,arguments,NewTarget);}else{result=Super.apply(this,arguments);}return _possibleConstructorReturn(this,result);};}function _possibleConstructorReturn(self,call){if(call&&(_typeof(call)==="object"||typeof call==="function")){return call;}else if(call!==void 0){throw new TypeError("Derived constructors may only return object or undefined");}return _assertThisInitialized(self);}function _assertThisInitialized(self){if(self===void 0){throw new ReferenceError("this hasn't been initialised - super() hasn't been called");}return self;}function _isNativeReflectConstruct(){if(typeof Reflect==="undefined"||!Reflect.construct)return false;if(Reflect.construct.sham)return false;if(typeof Proxy==="function")return true;try{Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}));return true;}catch(e){return false;}}function _getPrototypeOf(o){_getPrototypeOf=Object.setPrototypeOf?Object.getPrototypeOf:function _getPrototypeOf(o){return o.__proto__||Object.getPrototypeOf(o);};return _getPrototypeOf(o);}function _defineProperty(obj,key,value){if(key in obj){Object.defineProperty(obj,key,{value:value,enumerable:true,configurable:true,writable:true});}else{obj[key]=value;}return obj;}import React,{PureComponent}from'react';import PropTypes from'prop-types';import{withForwardedRef}from'@shopgate/engage/core';import styles from"./style";/**
2
2
  * The SheetItem component.
3
- */var SheetItem=/*#__PURE__*/function(_PureComponent){_inherits(SheetItem,_PureComponent);function SheetItem(){var _getPrototypeOf2;var _this;_classCallCheck(this,SheetItem);for(var _len=arguments.length,args=new Array(_len),_key=0;_key<_len;_key++){args[_key]=arguments[_key];}_this=_possibleConstructorReturn(this,(_getPrototypeOf2=_getPrototypeOf(SheetItem)).call.apply(_getPrototypeOf2,[this].concat(args)));_defineProperty(_assertThisInitialized(_this),"getStyle",function(selectable){var selected=_this.props.selected;if(selected){return styles.buttonSelected;}if(!selectable){return styles.buttonDisabled;}return styles.button;});_defineProperty(_assertThisInitialized(_this),"buildProps",function(){var _this$props=_this.props,item=_this$props.item,onClick=_this$props.onClick,forwardedRef=_this$props.forwardedRef;return _extends({className:"".concat(_this.getStyle(item.selectable).toString()," theme__product__characteristic__option"),key:item.id,ref:forwardedRef,value:item.id,'aria-hidden':!item.selectable},item.selectable&&{onClick:onClick});});return _this;}_createClass(SheetItem,[{key:"render",/**
3
+ */var SheetItem=/*#__PURE__*/function(_PureComponent){_inherits(SheetItem,_PureComponent);var _super=_createSuper(SheetItem);function SheetItem(){var _this;_classCallCheck(this,SheetItem);for(var _len=arguments.length,args=new Array(_len),_key=0;_key<_len;_key++){args[_key]=arguments[_key];}_this=_super.call.apply(_super,[this].concat(args));_defineProperty(_assertThisInitialized(_this),"getStyle",function(selectable){var selected=_this.props.selected;if(selected){return styles.buttonSelected;}if(!selectable){return styles.buttonDisabled;}return styles.button;});_defineProperty(_assertThisInitialized(_this),"buildProps",function(){var _this$props=_this.props,item=_this$props.item,onClick=_this$props.onClick,forwardedRef=_this$props.forwardedRef;return _extends({className:"".concat(_this.getStyle(item.selectable).toString()," theme__product__characteristic__option"),key:item.id,ref:forwardedRef,value:item.id,'aria-hidden':!item.selectable},item.selectable&&{onClick:onClick});});return _this;}_createClass(SheetItem,[{key:"render",value:/**
4
4
  * @returns {JSX}
5
- */value:function render(){var _this$props2=this.props,item=_this$props2.item,Right=_this$props2.rightComponent,selected=_this$props2.selected;return React.createElement("button",_extends({},this.buildProps(),{"data-test-id":item.label,"aria-selected":selected,role:"option",type:"button"}),item.label,item.selectable&&React.createElement(Right,null));}}]);return SheetItem;}(PureComponent);_defineProperty(SheetItem,"defaultProps",{forwardedRef:null,onClick:function onClick(){},rightComponent:null,selected:false});export default withForwardedRef(SheetItem);
5
+ */function render(){var _this$props2=this.props,item=_this$props2.item,Right=_this$props2.rightComponent,selected=_this$props2.selected;return/*#__PURE__*/React.createElement("button",_extends({},this.buildProps(),{"data-test-id":item.label,"aria-selected":selected,role:"option",type:"button"}),item.label,item.selectable&&/*#__PURE__*/React.createElement(Right,null));}}]);return SheetItem;}(PureComponent);_defineProperty(SheetItem,"defaultProps",{forwardedRef:null,onClick:function onClick(){},rightComponent:null,selected:false});export default withForwardedRef(SheetItem);
@@ -1,5 +1,5 @@
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,{PureComponent,Fragment}from'react';import PropTypes from'prop-types';import Availability from'@shopgate/pwa-ui-shared/Availability';import Portal from'@shopgate/pwa-common/components/Portal';import{PRODUCT_VARIANT_SELECT_PICKER_AVAILABILITY_BEFORE,PRODUCT_VARIANT_SELECT_PICKER_AVAILABILITY,PRODUCT_VARIANT_SELECT_PICKER_AVAILABILITY_AFTER}from'@shopgate/pwa-common-commerce/product/constants/Portals';import connect from"./connector";import styles from"./style";/**
1
+ function _typeof(obj){"@babel/helpers - typeof";return _typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(obj){return typeof obj;}:function(obj){return obj&&"function"==typeof Symbol&&obj.constructor===Symbol&&obj!==Symbol.prototype?"symbol":typeof obj;},_typeof(obj);}function _classCallCheck(instance,Constructor){if(!(instance instanceof Constructor)){throw new TypeError("Cannot call a class as a function");}}function _defineProperties(target,props){for(var i=0;i<props.length;i++){var descriptor=props[i];descriptor.enumerable=descriptor.enumerable||false;descriptor.configurable=true;if("value"in descriptor)descriptor.writable=true;Object.defineProperty(target,descriptor.key,descriptor);}}function _createClass(Constructor,protoProps,staticProps){if(protoProps)_defineProperties(Constructor.prototype,protoProps);if(staticProps)_defineProperties(Constructor,staticProps);Object.defineProperty(Constructor,"prototype",{writable:false});return Constructor;}function _inherits(subClass,superClass){if(typeof superClass!=="function"&&superClass!==null){throw new TypeError("Super expression must either be null or a function");}subClass.prototype=Object.create(superClass&&superClass.prototype,{constructor:{value:subClass,writable:true,configurable:true}});Object.defineProperty(subClass,"prototype",{writable:false});if(superClass)_setPrototypeOf(subClass,superClass);}function _setPrototypeOf(o,p){_setPrototypeOf=Object.setPrototypeOf||function _setPrototypeOf(o,p){o.__proto__=p;return o;};return _setPrototypeOf(o,p);}function _createSuper(Derived){var hasNativeReflectConstruct=_isNativeReflectConstruct();return function _createSuperInternal(){var Super=_getPrototypeOf(Derived),result;if(hasNativeReflectConstruct){var NewTarget=_getPrototypeOf(this).constructor;result=Reflect.construct(Super,arguments,NewTarget);}else{result=Super.apply(this,arguments);}return _possibleConstructorReturn(this,result);};}function _possibleConstructorReturn(self,call){if(call&&(_typeof(call)==="object"||typeof call==="function")){return call;}else if(call!==void 0){throw new TypeError("Derived constructors may only return object or undefined");}return _assertThisInitialized(self);}function _assertThisInitialized(self){if(self===void 0){throw new ReferenceError("this hasn't been initialised - super() hasn't been called");}return self;}function _isNativeReflectConstruct(){if(typeof Reflect==="undefined"||!Reflect.construct)return false;if(Reflect.construct.sham)return false;if(typeof Proxy==="function")return true;try{Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}));return true;}catch(e){return false;}}function _getPrototypeOf(o){_getPrototypeOf=Object.setPrototypeOf?Object.getPrototypeOf:function _getPrototypeOf(o){return o.__proto__||Object.getPrototypeOf(o);};return _getPrototypeOf(o);}function _defineProperty(obj,key,value){if(key in obj){Object.defineProperty(obj,key,{value:value,enumerable:true,configurable:true,writable:true});}else{obj[key]=value;}return obj;}import React,{PureComponent,Fragment}from'react';import PropTypes from'prop-types';import Availability from'@shopgate/pwa-ui-shared/Availability';import Portal from'@shopgate/pwa-common/components/Portal';import{PRODUCT_VARIANT_SELECT_PICKER_AVAILABILITY_BEFORE,PRODUCT_VARIANT_SELECT_PICKER_AVAILABILITY,PRODUCT_VARIANT_SELECT_PICKER_AVAILABILITY_AFTER}from'@shopgate/pwa-common-commerce/product/constants/Portals';import connect from"./connector";import styles from"./style";/**
2
2
  * The VariantAvailability component.
3
- */var VariantAvailability=/*#__PURE__*/function(_PureComponent){_inherits(VariantAvailability,_PureComponent);function VariantAvailability(){_classCallCheck(this,VariantAvailability);return _possibleConstructorReturn(this,_getPrototypeOf(VariantAvailability).apply(this,arguments));}_createClass(VariantAvailability,[{key:"render",/**
3
+ */var VariantAvailability=/*#__PURE__*/function(_PureComponent){_inherits(VariantAvailability,_PureComponent);var _super=_createSuper(VariantAvailability);function VariantAvailability(){_classCallCheck(this,VariantAvailability);return _super.apply(this,arguments);}_createClass(VariantAvailability,[{key:"render",value:/**
4
4
  * @returns {JSX}
5
- */value:function render(){if(!this.props.availability){return null;}var availability=this.props.availability;var state=availability.state,text=availability.text;return React.createElement(Fragment,null,React.createElement(Portal,{name:PRODUCT_VARIANT_SELECT_PICKER_AVAILABILITY_BEFORE,props:availability}),React.createElement(Portal,{name:PRODUCT_VARIANT_SELECT_PICKER_AVAILABILITY,props:availability},React.createElement(Availability,{className:styles,state:state,text:text})),React.createElement(Portal,{name:PRODUCT_VARIANT_SELECT_PICKER_AVAILABILITY_AFTER,props:availability}));}}]);return VariantAvailability;}(PureComponent);_defineProperty(VariantAvailability,"defaultProps",{availability:null});export default connect(VariantAvailability);
5
+ */function render(){if(!this.props.availability){return null;}var availability=this.props.availability;var state=availability.state,text=availability.text;return/*#__PURE__*/React.createElement(Fragment,null,/*#__PURE__*/React.createElement(Portal,{name:PRODUCT_VARIANT_SELECT_PICKER_AVAILABILITY_BEFORE,props:availability}),/*#__PURE__*/React.createElement(Portal,{name:PRODUCT_VARIANT_SELECT_PICKER_AVAILABILITY,props:availability},/*#__PURE__*/React.createElement(Availability,{className:styles,state:state,text:text})),/*#__PURE__*/React.createElement(Portal,{name:PRODUCT_VARIANT_SELECT_PICKER_AVAILABILITY_AFTER,props:availability}));}}]);return VariantAvailability;}(PureComponent);_defineProperty(VariantAvailability,"defaultProps",{availability:null});export default connect(VariantAvailability);
@@ -1,10 +1,10 @@
1
- function _typeof(obj){if(typeof Symbol==="function"&&typeof Symbol.iterator==="symbol"){_typeof=function _typeof(obj){return typeof obj;};}else{_typeof=function _typeof(obj){return obj&&typeof Symbol==="function"&&obj.constructor===Symbol&&obj!==Symbol.prototype?"symbol":typeof obj;};}return _typeof(obj);}function _extends(){_extends=Object.assign||function(target){for(var i=1;i<arguments.length;i++){var source=arguments[i];for(var key in source){if(Object.prototype.hasOwnProperty.call(source,key)){target[key]=source[key];}}}return target;};return _extends.apply(this,arguments);}function _classCallCheck(instance,Constructor){if(!(instance instanceof Constructor)){throw new TypeError("Cannot call a class as a function");}}function _defineProperties(target,props){for(var i=0;i<props.length;i++){var descriptor=props[i];descriptor.enumerable=descriptor.enumerable||false;descriptor.configurable=true;if("value"in descriptor)descriptor.writable=true;Object.defineProperty(target,descriptor.key,descriptor);}}function _createClass(Constructor,protoProps,staticProps){if(protoProps)_defineProperties(Constructor.prototype,protoProps);if(staticProps)_defineProperties(Constructor,staticProps);return Constructor;}function _possibleConstructorReturn(self,call){if(call&&(_typeof(call)==="object"||typeof call==="function")){return call;}return _assertThisInitialized(self);}function _getPrototypeOf(o){_getPrototypeOf=Object.setPrototypeOf?Object.getPrototypeOf:function _getPrototypeOf(o){return o.__proto__||Object.getPrototypeOf(o);};return _getPrototypeOf(o);}function _assertThisInitialized(self){if(self===void 0){throw new ReferenceError("this hasn't been initialised - super() hasn't been called");}return self;}function _inherits(subClass,superClass){if(typeof superClass!=="function"&&superClass!==null){throw new TypeError("Super expression must either be null or a function");}subClass.prototype=Object.create(superClass&&superClass.prototype,{constructor:{value:subClass,writable:true,configurable:true}});if(superClass)_setPrototypeOf(subClass,superClass);}function _setPrototypeOf(o,p){_setPrototypeOf=Object.setPrototypeOf||function _setPrototypeOf(o,p){o.__proto__=p;return o;};return _setPrototypeOf(o,p);}function _defineProperty(obj,key,value){if(key in obj){Object.defineProperty(obj,key,{value:value,enumerable:true,configurable:true,writable:true});}else{obj[key]=value;}return obj;}import React,{PureComponent,Fragment}from'react';import PropTypes from'prop-types';import classNames from'classnames';import Transition from'react-transition-group/Transition';import Sheet from"./components/Sheet";import styles from"./style";import transition from"../transition";/**
1
+ function _typeof(obj){"@babel/helpers - typeof";return _typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(obj){return typeof obj;}:function(obj){return obj&&"function"==typeof Symbol&&obj.constructor===Symbol&&obj!==Symbol.prototype?"symbol":typeof obj;},_typeof(obj);}function _extends(){_extends=Object.assign||function(target){for(var i=1;i<arguments.length;i++){var source=arguments[i];for(var key in source){if(Object.prototype.hasOwnProperty.call(source,key)){target[key]=source[key];}}}return target;};return _extends.apply(this,arguments);}function _classCallCheck(instance,Constructor){if(!(instance instanceof Constructor)){throw new TypeError("Cannot call a class as a function");}}function _defineProperties(target,props){for(var i=0;i<props.length;i++){var descriptor=props[i];descriptor.enumerable=descriptor.enumerable||false;descriptor.configurable=true;if("value"in descriptor)descriptor.writable=true;Object.defineProperty(target,descriptor.key,descriptor);}}function _createClass(Constructor,protoProps,staticProps){if(protoProps)_defineProperties(Constructor.prototype,protoProps);if(staticProps)_defineProperties(Constructor,staticProps);Object.defineProperty(Constructor,"prototype",{writable:false});return Constructor;}function _inherits(subClass,superClass){if(typeof superClass!=="function"&&superClass!==null){throw new TypeError("Super expression must either be null or a function");}subClass.prototype=Object.create(superClass&&superClass.prototype,{constructor:{value:subClass,writable:true,configurable:true}});Object.defineProperty(subClass,"prototype",{writable:false});if(superClass)_setPrototypeOf(subClass,superClass);}function _setPrototypeOf(o,p){_setPrototypeOf=Object.setPrototypeOf||function _setPrototypeOf(o,p){o.__proto__=p;return o;};return _setPrototypeOf(o,p);}function _createSuper(Derived){var hasNativeReflectConstruct=_isNativeReflectConstruct();return function _createSuperInternal(){var Super=_getPrototypeOf(Derived),result;if(hasNativeReflectConstruct){var NewTarget=_getPrototypeOf(this).constructor;result=Reflect.construct(Super,arguments,NewTarget);}else{result=Super.apply(this,arguments);}return _possibleConstructorReturn(this,result);};}function _possibleConstructorReturn(self,call){if(call&&(_typeof(call)==="object"||typeof call==="function")){return call;}else if(call!==void 0){throw new TypeError("Derived constructors may only return object or undefined");}return _assertThisInitialized(self);}function _assertThisInitialized(self){if(self===void 0){throw new ReferenceError("this hasn't been initialised - super() hasn't been called");}return self;}function _isNativeReflectConstruct(){if(typeof Reflect==="undefined"||!Reflect.construct)return false;if(Reflect.construct.sham)return false;if(typeof Proxy==="function")return true;try{Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}));return true;}catch(e){return false;}}function _getPrototypeOf(o){_getPrototypeOf=Object.setPrototypeOf?Object.getPrototypeOf:function _getPrototypeOf(o){return o.__proto__||Object.getPrototypeOf(o);};return _getPrototypeOf(o);}function _defineProperty(obj,key,value){if(key in obj){Object.defineProperty(obj,key,{value:value,enumerable:true,configurable:true,writable:true});}else{obj[key]=value;}return obj;}import React,{PureComponent,Fragment}from'react';import PropTypes from'prop-types';import classNames from'classnames';import Transition from'react-transition-group/Transition';import Sheet from"./components/Sheet";import styles from"./style";import transition from"../transition";/**
2
2
  * A single characteristic.
3
- */var Characteristic=/*#__PURE__*/function(_PureComponent){_inherits(Characteristic,_PureComponent);function Characteristic(){var _getPrototypeOf2;var _this;_classCallCheck(this,Characteristic);for(var _len=arguments.length,args=new Array(_len),_key=0;_key<_len;_key++){args[_key]=arguments[_key];}_this=_possibleConstructorReturn(this,(_getPrototypeOf2=_getPrototypeOf(Characteristic)).call.apply(_getPrototypeOf2,[this].concat(args)));_defineProperty(_assertThisInitialized(_this),"state",{highlight:false,sheet:false});_defineProperty(_assertThisInitialized(_this),"getButtonLabel",function(defaultLabel){if(!_this.props.selected){return defaultLabel;}var value=_this.props.values.find(function(val){return val.id===_this.props.selected;});return value.label;});_defineProperty(_assertThisInitialized(_this),"handleButtonClick",function(event){event.preventDefault();if(_this.props.disabled){return;}_this.setState({sheet:true});});_defineProperty(_assertThisInitialized(_this),"handleItemSelection",function(valueId){_this.props.select({id:_this.props.id,value:valueId});_this.closeSheet();});_defineProperty(_assertThisInitialized(_this),"closeSheet",function(){_this.setState({sheet:false});if(_this.props.charRef&&_this.props.charRef.current){_this.props.charRef.current.focus();}});_defineProperty(_assertThisInitialized(_this),"removeHighlight",function(){_this.setState({highlight:false});});_defineProperty(_assertThisInitialized(_this),"transitionRenderer",function(state){var _this$context$i18n=_this.context.i18n(),__=_this$context$i18n.__;var _this$props=_this.props,disabled=_this$props.disabled,selected=_this$props.selected,charRef=_this$props.charRef,label=_this$props.label;var translatedLabel=__('product.pick_an_attribute',[label]);var buttonLabel=_this.getButtonLabel(translatedLabel);var classes=classNames(styles.button,_defineProperty({},styles.buttonDisabled,disabled),'theme__product__characteristic');return React.createElement("div",{role:"button","aria-disabled":disabled,"aria-haspopup":!disabled,tabIndex:0,className:classes,onClick:_this.handleButtonClick,onKeyDown:function onKeyDown(){},ref:charRef,style:transition[state],"data-test-id":label},selected&&React.createElement("div",{className:"".concat(styles.label," theme__product__characteristic__label")},label),React.createElement("div",_extends({className:"".concat(styles.selection," theme__product__characteristic__selection")},selected&&{'data-selected':true}),buttonLabel));});return _this;}_createClass(Characteristic,[{key:"UNSAFE_componentWillReceiveProps",/**
3
+ */var Characteristic=/*#__PURE__*/function(_PureComponent){_inherits(Characteristic,_PureComponent);var _super=_createSuper(Characteristic);function Characteristic(){var _this;_classCallCheck(this,Characteristic);for(var _len=arguments.length,args=new Array(_len),_key=0;_key<_len;_key++){args[_key]=arguments[_key];}_this=_super.call.apply(_super,[this].concat(args));_defineProperty(_assertThisInitialized(_this),"state",{highlight:false,sheet:false});_defineProperty(_assertThisInitialized(_this),"getButtonLabel",function(defaultLabel){if(!_this.props.selected){return defaultLabel;}var value=_this.props.values.find(function(val){return val.id===_this.props.selected;});return value.label;});_defineProperty(_assertThisInitialized(_this),"handleButtonClick",function(event){event.preventDefault();if(_this.props.disabled){return;}_this.setState({sheet:true});});_defineProperty(_assertThisInitialized(_this),"handleItemSelection",function(valueId){_this.props.select({id:_this.props.id,value:valueId});_this.closeSheet();});_defineProperty(_assertThisInitialized(_this),"closeSheet",function(){_this.setState({sheet:false});if(_this.props.charRef&&_this.props.charRef.current){_this.props.charRef.current.focus();}});_defineProperty(_assertThisInitialized(_this),"removeHighlight",function(){_this.setState({highlight:false});});_defineProperty(_assertThisInitialized(_this),"transitionRenderer",function(state){var _this$context$i18n=_this.context.i18n(),__=_this$context$i18n.__;var _this$props=_this.props,disabled=_this$props.disabled,selected=_this$props.selected,charRef=_this$props.charRef,label=_this$props.label;var translatedLabel=__('product.pick_an_attribute',[label]);var buttonLabel=_this.getButtonLabel(translatedLabel);var classes=classNames(styles.button,_defineProperty({},styles.buttonDisabled,disabled),'theme__product__characteristic');return/*#__PURE__*/React.createElement("div",{role:"button","aria-disabled":disabled,"aria-haspopup":!disabled,tabIndex:0,className:classes,onClick:_this.handleButtonClick,onKeyDown:function onKeyDown(){},ref:charRef,style:transition[state],"data-test-id":label},selected&&/*#__PURE__*/React.createElement("div",{className:"".concat(styles.label," theme__product__characteristic__label")},label),/*#__PURE__*/React.createElement("div",_extends({className:"".concat(styles.selection," theme__product__characteristic__selection")},selected&&{'data-selected':true}),buttonLabel));});return _this;}_createClass(Characteristic,[{key:"UNSAFE_componentWillReceiveProps",value:/**
4
4
  * @param {Object} nextProps The next component props.
5
- */value:function UNSAFE_componentWillReceiveProps(nextProps){this.setState({highlight:nextProps.highlight});}/**
5
+ */function UNSAFE_componentWillReceiveProps(nextProps){this.setState({highlight:nextProps.highlight});}/**
6
6
  * @param {string} defaultLabel The default button label.
7
7
  * @return {string}
8
- */},{key:"render",/**
8
+ */},{key:"render",value:/**
9
9
  * @return {JSX}
10
- */value:function render(){var _this$context$i18n2=this.context.i18n(),__=_this$context$i18n2.__;var _this$props2=this.props,id=_this$props2.id,selected=_this$props2.selected,values=_this$props2.values;var displayLabel=this.props.label;var translatedLabel=__('product.pick_an_attribute',[displayLabel]);return React.createElement(Fragment,null,React.createElement(Transition,{"in":this.state.highlight,timeout:500,onEntered:this.removeHighlight},this.transitionRenderer),React.createElement(Sheet,{charId:id,items:values,label:translatedLabel,onClose:this.closeSheet,onSelect:this.handleItemSelection,open:this.state.sheet,selectedValue:selected}));}}]);return Characteristic;}(PureComponent);_defineProperty(Characteristic,"contextTypes",{i18n:PropTypes.func});_defineProperty(Characteristic,"defaultProps",{selected:null});export default Characteristic;
10
+ */function render(){var _this$context$i18n2=this.context.i18n(),__=_this$context$i18n2.__;var _this$props2=this.props,id=_this$props2.id,selected=_this$props2.selected,values=_this$props2.values;var displayLabel=this.props.label;var translatedLabel=__('product.pick_an_attribute',[displayLabel]);return/*#__PURE__*/React.createElement(Fragment,null,/*#__PURE__*/React.createElement(Transition,{"in":this.state.highlight,timeout:500,onEntered:this.removeHighlight},this.transitionRenderer),/*#__PURE__*/React.createElement(Sheet,{charId:id,items:values,label:translatedLabel,onClose:this.closeSheet,onSelect:this.handleItemSelection,open:this.state.sheet,selectedValue:selected}));}}]);return Characteristic;}(PureComponent);_defineProperty(Characteristic,"contextTypes",{i18n:PropTypes.func});_defineProperty(Characteristic,"defaultProps",{selected:null});export default Characteristic;
@@ -1,10 +1,10 @@
1
- function _typeof(obj){if(typeof Symbol==="function"&&typeof Symbol.iterator==="symbol"){_typeof=function _typeof(obj){return typeof obj;};}else{_typeof=function _typeof(obj){return obj&&typeof Symbol==="function"&&obj.constructor===Symbol&&obj!==Symbol.prototype?"symbol":typeof obj;};}return _typeof(obj);}function _classCallCheck(instance,Constructor){if(!(instance instanceof Constructor)){throw new TypeError("Cannot call a class as a function");}}function _defineProperties(target,props){for(var i=0;i<props.length;i++){var descriptor=props[i];descriptor.enumerable=descriptor.enumerable||false;descriptor.configurable=true;if("value"in descriptor)descriptor.writable=true;Object.defineProperty(target,descriptor.key,descriptor);}}function _createClass(Constructor,protoProps,staticProps){if(protoProps)_defineProperties(Constructor.prototype,protoProps);if(staticProps)_defineProperties(Constructor,staticProps);return Constructor;}function _possibleConstructorReturn(self,call){if(call&&(_typeof(call)==="object"||typeof call==="function")){return call;}return _assertThisInitialized(self);}function _getPrototypeOf(o){_getPrototypeOf=Object.setPrototypeOf?Object.getPrototypeOf:function _getPrototypeOf(o){return o.__proto__||Object.getPrototypeOf(o);};return _getPrototypeOf(o);}function _assertThisInitialized(self){if(self===void 0){throw new ReferenceError("this hasn't been initialised - super() hasn't been called");}return self;}function _inherits(subClass,superClass){if(typeof superClass!=="function"&&superClass!==null){throw new TypeError("Super expression must either be null or a function");}subClass.prototype=Object.create(superClass&&superClass.prototype,{constructor:{value:subClass,writable:true,configurable:true}});if(superClass)_setPrototypeOf(subClass,superClass);}function _setPrototypeOf(o,p){_setPrototypeOf=Object.setPrototypeOf||function _setPrototypeOf(o,p){o.__proto__=p;return o;};return _setPrototypeOf(o,p);}function _defineProperty(obj,key,value){if(key in obj){Object.defineProperty(obj,key,{value:value,enumerable:true,configurable:true,writable:true});}else{obj[key]=value;}return obj;}import React,{PureComponent,Fragment}from'react';import PropTypes from'prop-types';import classNames from'classnames';import Transition from'react-transition-group/Transition';import{VariantSwatch}from'@shopgate/engage/product';import styles from"./style";import transition from"../transition";/**
1
+ function _typeof(obj){"@babel/helpers - typeof";return _typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(obj){return typeof obj;}:function(obj){return obj&&"function"==typeof Symbol&&obj.constructor===Symbol&&obj!==Symbol.prototype?"symbol":typeof obj;},_typeof(obj);}function _classCallCheck(instance,Constructor){if(!(instance instanceof Constructor)){throw new TypeError("Cannot call a class as a function");}}function _defineProperties(target,props){for(var i=0;i<props.length;i++){var descriptor=props[i];descriptor.enumerable=descriptor.enumerable||false;descriptor.configurable=true;if("value"in descriptor)descriptor.writable=true;Object.defineProperty(target,descriptor.key,descriptor);}}function _createClass(Constructor,protoProps,staticProps){if(protoProps)_defineProperties(Constructor.prototype,protoProps);if(staticProps)_defineProperties(Constructor,staticProps);Object.defineProperty(Constructor,"prototype",{writable:false});return Constructor;}function _inherits(subClass,superClass){if(typeof superClass!=="function"&&superClass!==null){throw new TypeError("Super expression must either be null or a function");}subClass.prototype=Object.create(superClass&&superClass.prototype,{constructor:{value:subClass,writable:true,configurable:true}});Object.defineProperty(subClass,"prototype",{writable:false});if(superClass)_setPrototypeOf(subClass,superClass);}function _setPrototypeOf(o,p){_setPrototypeOf=Object.setPrototypeOf||function _setPrototypeOf(o,p){o.__proto__=p;return o;};return _setPrototypeOf(o,p);}function _createSuper(Derived){var hasNativeReflectConstruct=_isNativeReflectConstruct();return function _createSuperInternal(){var Super=_getPrototypeOf(Derived),result;if(hasNativeReflectConstruct){var NewTarget=_getPrototypeOf(this).constructor;result=Reflect.construct(Super,arguments,NewTarget);}else{result=Super.apply(this,arguments);}return _possibleConstructorReturn(this,result);};}function _possibleConstructorReturn(self,call){if(call&&(_typeof(call)==="object"||typeof call==="function")){return call;}else if(call!==void 0){throw new TypeError("Derived constructors may only return object or undefined");}return _assertThisInitialized(self);}function _assertThisInitialized(self){if(self===void 0){throw new ReferenceError("this hasn't been initialised - super() hasn't been called");}return self;}function _isNativeReflectConstruct(){if(typeof Reflect==="undefined"||!Reflect.construct)return false;if(Reflect.construct.sham)return false;if(typeof Proxy==="function")return true;try{Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}));return true;}catch(e){return false;}}function _getPrototypeOf(o){_getPrototypeOf=Object.setPrototypeOf?Object.getPrototypeOf:function _getPrototypeOf(o){return o.__proto__||Object.getPrototypeOf(o);};return _getPrototypeOf(o);}function _defineProperty(obj,key,value){if(key in obj){Object.defineProperty(obj,key,{value:value,enumerable:true,configurable:true,writable:true});}else{obj[key]=value;}return obj;}import React,{PureComponent,Fragment}from'react';import PropTypes from'prop-types';import classNames from'classnames';import Transition from'react-transition-group/Transition';import{VariantSwatch}from'@shopgate/engage/product';import styles from"./style";import transition from"../transition";/**
2
2
  * A single characteristic swatch type.
3
- */var Swatch=/*#__PURE__*/function(_PureComponent){_inherits(Swatch,_PureComponent);function Swatch(){var _getPrototypeOf2;var _this;_classCallCheck(this,Swatch);for(var _len=arguments.length,args=new Array(_len),_key=0;_key<_len;_key++){args[_key]=arguments[_key];}_this=_possibleConstructorReturn(this,(_getPrototypeOf2=_getPrototypeOf(Swatch)).call.apply(_getPrototypeOf2,[this].concat(args)));_defineProperty(_assertThisInitialized(_this),"state",{highlight:false});_defineProperty(_assertThisInitialized(_this),"getLabel",function(charLabel){if(!_this.props.selected){return charLabel;}var value=_this.props.values.find(function(val){return val.id===_this.props.selected;});return"".concat(charLabel," - ").concat(value.label);});_defineProperty(_assertThisInitialized(_this),"handleItemSelection",function(valueId){_this.props.select({id:_this.props.id,value:valueId});});_defineProperty(_assertThisInitialized(_this),"removeHighlight",function(){_this.setState({highlight:false});});return _this;}_createClass(Swatch,[{key:"UNSAFE_componentWillReceiveProps",/**
3
+ */var Swatch=/*#__PURE__*/function(_PureComponent){_inherits(Swatch,_PureComponent);var _super=_createSuper(Swatch);function Swatch(){var _this;_classCallCheck(this,Swatch);for(var _len=arguments.length,args=new Array(_len),_key=0;_key<_len;_key++){args[_key]=arguments[_key];}_this=_super.call.apply(_super,[this].concat(args));_defineProperty(_assertThisInitialized(_this),"state",{highlight:false});_defineProperty(_assertThisInitialized(_this),"getLabel",function(charLabel){if(!_this.props.selected){return charLabel;}var value=_this.props.values.find(function(val){return val.id===_this.props.selected;});return"".concat(charLabel," - ").concat(value.label);});_defineProperty(_assertThisInitialized(_this),"handleItemSelection",function(valueId){_this.props.select({id:_this.props.id,value:valueId});});_defineProperty(_assertThisInitialized(_this),"removeHighlight",function(){_this.setState({highlight:false});});return _this;}_createClass(Swatch,[{key:"UNSAFE_componentWillReceiveProps",value:/**
4
4
  * @param {Object} nextProps The next component props.
5
- */value:function UNSAFE_componentWillReceiveProps(nextProps){this.setState({highlight:nextProps.highlight});}/**
5
+ */function UNSAFE_componentWillReceiveProps(nextProps){this.setState({highlight:nextProps.highlight});}/**
6
6
  * @param {string} charLabel The default button label.
7
7
  * @return {string}
8
- */},{key:"render",/**
8
+ */},{key:"render",value:/**
9
9
  * @return {JSX}
10
- */value:function render(){var _this2=this;var _this$props=this.props,id=_this$props.id,disabled=_this$props.disabled,charRef=_this$props.charRef,label=_this$props.label,values=_this$props.values;var swatch={id:id,label:label,values:values};return React.createElement(Fragment,null,React.createElement(Transition,{"in":this.state.highlight,timeout:500,onEntered:this.removeHighlight},function(state){return React.createElement("div",{"aria-hidden":true,className:classNames(styles.label,_defineProperty({},styles.labelDisabled,disabled)),ref:charRef,style:transition[state],"data-test-id":label},_this2.getLabel(label));}),React.createElement("div",{className:styles.items},React.createElement(VariantSwatch,{swatch:swatch,onClick:this.handleItemSelection})));}}]);return Swatch;}(PureComponent);_defineProperty(Swatch,"defaultProps",{selected:null});export default Swatch;
10
+ */function render(){var _this2=this;var _this$props=this.props,id=_this$props.id,disabled=_this$props.disabled,charRef=_this$props.charRef,label=_this$props.label,values=_this$props.values;var swatch={id:id,label:label,values:values};return/*#__PURE__*/React.createElement(Fragment,null,/*#__PURE__*/React.createElement(Transition,{"in":this.state.highlight,timeout:500,onEntered:this.removeHighlight},function(state){return/*#__PURE__*/React.createElement("div",{"aria-hidden":true,className:classNames(styles.label,_defineProperty({},styles.labelDisabled,disabled)),ref:charRef,style:transition[state],"data-test-id":label},_this2.getLabel(label));}),/*#__PURE__*/React.createElement("div",{className:styles.items},/*#__PURE__*/React.createElement(VariantSwatch,{swatch:swatch,onClick:this.handleItemSelection})));}}]);return Swatch;}(PureComponent);_defineProperty(Swatch,"defaultProps",{selected:null});export default Swatch;