@shopgate/engage 6.22.0-beta.13 → 6.22.0-beta.14
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import React from'react';import PropTypes from'prop-types';import{bin2hex}from'@shopgate/pwa-common/helpers/data';import{CATEGORY_PATH}from'@shopgate/pwa-common-commerce/category/constants';import Portal from'@shopgate/pwa-common/components/Portal';import{Placeholder}from'@shopgate/pwa-ui-shared';import{CATEGORY_ITEM}from'@shopgate/pwa-common-commerce/category/constants/Portals';import{SheetList}from"../../../components";import styles from"./style";/**
|
|
1
|
+
import React from'react';import PropTypes from'prop-types';import{bin2hex}from'@shopgate/pwa-common/helpers/data';import{CATEGORY_PATH}from'@shopgate/pwa-common-commerce/category/constants';import Portal from'@shopgate/pwa-common/components/Portal';import{Placeholder}from'@shopgate/pwa-ui-shared';import{CATEGORY_ITEM}from'@shopgate/pwa-common-commerce/category/constants/Portals';import{i18n}from'@shopgate/engage/core';import{getShowAllProductsFilters}from'@shopgate/engage/category';import{SheetList}from"../../../components";import styles from"./style";/**
|
|
2
2
|
* The CategoryList component.
|
|
3
3
|
* @param {Object} props The component props.
|
|
4
4
|
* @param {Array} props.categories The categories to display.
|
|
5
5
|
* @param {Array} props.categories The number of rows to prerender.
|
|
6
6
|
* @returns {JSX}
|
|
7
|
-
*/var CategoryList=function CategoryList(_ref){var categories=_ref.categories,prerender=_ref.prerender;if(!categories||!categories.length){if(prerender===0){return null;}return/*#__PURE__*/React.createElement(SheetList,{className:"".concat(styles," engage__category__category-list")},[].concat(Array(prerender)).map(function(val,index){var key="placeholder-".concat(index);return/*#__PURE__*/React.createElement(Placeholder,{height:20,key:key,left:0,top:18,width:220});}));}return/*#__PURE__*/React.createElement(SheetList,{className:"".concat(styles," engage__category__category-list")},categories.map(function(category){return/*#__PURE__*/React.createElement(Portal,{key:category.id,name:CATEGORY_ITEM,props:{categoryId:category.id}},/*#__PURE__*/React.createElement(SheetList.Item,{link:"".concat(CATEGORY_PATH,"/").concat(bin2hex(category.id)),title:category.name,linkState:{categoryId:category.id,title:category.name},testId:category.name}));}));};CategoryList.defaultProps={categories:null,prerender:0};export default CategoryList;
|
|
7
|
+
*/var CategoryList=function CategoryList(_ref){var categories=_ref.categories,parentCategory=_ref.parentCategory,prerender=_ref.prerender,showAllProducts=_ref.showAllProducts;if(!categories||!categories.length){if(prerender===0){return null;}return/*#__PURE__*/React.createElement(SheetList,{className:"".concat(styles," engage__category__category-list")},[].concat(Array(prerender)).map(function(val,index){var key="placeholder-".concat(index);return/*#__PURE__*/React.createElement(Placeholder,{height:20,key:key,left:0,top:18,width:220});}));}var filters=getShowAllProductsFilters(parentCategory);return/*#__PURE__*/React.createElement(SheetList,{className:"".concat(styles.sheet," engage__category__category-list")},showAllProducts?/*#__PURE__*/React.createElement("div",{className:"".concat(styles.showAllProducts," engage__category__category-show-all-products")},/*#__PURE__*/React.createElement(Portal,{key:parentCategory.id,name:"category.show-all-products",props:{categoryId:parentCategory.id}},/*#__PURE__*/React.createElement(SheetList.Item,{link:"".concat(CATEGORY_PATH,"/").concat(bin2hex(parentCategory.id),"/all"),title:i18n.text('category.showAllProducts.label'),linkState:{categoryName:parentCategory.name,categoryId:parentCategory.id,filters:filters},testId:"showAllProducts"}))):null,categories.map(function(category){return/*#__PURE__*/React.createElement(Portal,{key:category.id,name:CATEGORY_ITEM,props:{categoryId:category.id}},/*#__PURE__*/React.createElement(SheetList.Item,{link:"".concat(CATEGORY_PATH,"/").concat(bin2hex(category.id)),title:category.name,linkState:{categoryId:category.id,title:category.name},testId:category.name}));}));};CategoryList.defaultProps={categories:null,parentCategory:null,prerender:0,showAllProducts:false};export default CategoryList;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{css}from'glamor';import{themeConfig}from'@shopgate/pwa-common/helpers/config';var colors=themeConfig.colors;
|
|
1
|
+
import{css}from'glamor';import{themeConfig}from'@shopgate/pwa-common/helpers/config';var colors=themeConfig.colors;var sheet=css({background:colors.light}).toString();var showAllProducts=css({fontWeight:800}).toString();export default{sheet:sheet,showAllProducts:showAllProducts};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
var _excluded=["useForFetchFilters"],_excluded2=["useForFetchFilters"];function _extends(){_extends=Object.assign||function(target){for(var i=1;i<arguments.length;i++){var source=arguments[i];for(var key in source){if(Object.prototype.hasOwnProperty.call(source,key)){target[key]=source[key];}}}return target;};return _extends.apply(this,arguments);}function _objectWithoutProperties(source,excluded){if(source==null)return{};var target=_objectWithoutPropertiesLoose(source,excluded);var key,i;if(Object.getOwnPropertySymbols){var sourceSymbolKeys=Object.getOwnPropertySymbols(source);for(i=0;i<sourceSymbolKeys.length;i++){key=sourceSymbolKeys[i];if(excluded.indexOf(key)>=0)continue;if(!Object.prototype.propertyIsEnumerable.call(source,key))continue;target[key]=source[key];}}return target;}function _objectWithoutPropertiesLoose(source,excluded){if(source==null)return{};var target={};var sourceKeys=Object.keys(source);var key,i;for(i=0;i<sourceKeys.length;i++){key=sourceKeys[i];if(excluded.indexOf(key)>=0)continue;target[key]=source[key];}return target;}import isPlainObject from'lodash/isPlainObject';/**
|
|
2
|
+
* Creates the filter params to be used with a fetchFilters request.
|
|
3
|
+
* @param {Object} filters All configured filters
|
|
4
|
+
* @return {Object}
|
|
5
|
+
*/var buildFilterParamsForFetchFiltersRequest=function buildFilterParamsForFetchFiltersRequest(){var filters=arguments.length>0&&arguments[0]!==undefined?arguments[0]:{};if(!isPlainObject(filters)){return null;}var sanitizedFilters=Object.keys(filters).reduce(function(acc,filterId){var filter=filters[filterId];if(filter!==null&&filter!==void 0&&filter.useForFetchFilters){// flag is set on filter level - remove flag and add to the result object
|
|
6
|
+
var useForFetchFilters=filter.useForFetchFilters,sanitizedFilter=_objectWithoutProperties(filter,_excluded);acc[filterId]=sanitizedFilter;}else if(Array.isArray(filter.value)){// check for flags on value level
|
|
7
|
+
var _sanitizedFilter=_extends({},filter,{value:filter.value.reduce(function(valueAcc,currentValue){var useForFetchFilters=currentValue.useForFetchFilters,sanitizedValue=_objectWithoutProperties(currentValue,_excluded2);if(currentValue!==null&¤tValue!==void 0&¤tValue.useForFetchFilters){// flag is set on value level - consider value for the results object
|
|
8
|
+
valueAcc.push(sanitizedValue);}return valueAcc;},[])});if(_sanitizedFilter.value.length){// only add the filter when it has values that are supposed to be used for a filter request
|
|
9
|
+
acc[filterId]=_sanitizedFilter;}}return acc;},{});return Object.keys(sanitizedFilters).length?sanitizedFilters:null;};export default buildFilterParamsForFetchFiltersRequest;
|
package/filter/index.js
CHANGED
|
@@ -4,4 +4,4 @@ export*from'@shopgate/pwa-common-commerce/filter/constants/index';export*from'@s
|
|
|
4
4
|
export*from'@shopgate/pwa-common-commerce/filter/selectors';// STREAMS
|
|
5
5
|
export*from'@shopgate/pwa-common-commerce/filter/streams';// COMPONENTS
|
|
6
6
|
export{default as FilterItem}from"./components/FilterItem";export{default as PriceSlider}from"./components/PriceSlider";// HELPERS
|
|
7
|
-
export{default as buildInitialFilters}from"./helpers/buildInitialFilters";export{default as buildUpdatedFilters}from"./helpers/buildUpdatedFilters";export{translateFilterLabel}from"./helpers/translateFilterLabel";
|
|
7
|
+
export{default as buildInitialFilters}from"./helpers/buildInitialFilters";export{default as buildUpdatedFilters}from"./helpers/buildUpdatedFilters";export{default as buildFilterParamsForFetchFiltersRequest}from"./helpers/buildFilterParamsForFetchFiltersRequest";export{translateFilterLabel}from"./helpers/translateFilterLabel";
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@shopgate/engage",
|
|
3
|
-
"version": "6.22.0-beta.
|
|
3
|
+
"version": "6.22.0-beta.14",
|
|
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.22.0-beta.
|
|
19
|
-
"@shopgate/pwa-common-commerce": "6.22.0-beta.
|
|
20
|
-
"@shopgate/pwa-core": "6.22.0-beta.
|
|
21
|
-
"@shopgate/pwa-ui-ios": "6.22.0-beta.
|
|
22
|
-
"@shopgate/pwa-ui-material": "6.22.0-beta.
|
|
23
|
-
"@shopgate/pwa-ui-shared": "6.22.0-beta.
|
|
18
|
+
"@shopgate/pwa-common": "6.22.0-beta.14",
|
|
19
|
+
"@shopgate/pwa-common-commerce": "6.22.0-beta.14",
|
|
20
|
+
"@shopgate/pwa-core": "6.22.0-beta.14",
|
|
21
|
+
"@shopgate/pwa-ui-ios": "6.22.0-beta.14",
|
|
22
|
+
"@shopgate/pwa-ui-material": "6.22.0-beta.14",
|
|
23
|
+
"@shopgate/pwa-ui-shared": "6.22.0-beta.14",
|
|
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",
|