UNPKG

@shopgate/pwa-common-commerce

Version:

Commerce library for the Shopgate Connect PWA.

9 lines 841 B
import{bin2hex}from'@shopgate/pwa-common/helpers/data';import{i18n}from'@shopgate/engage/core';import{CATEGORY_PATH}from"../constants";/** * Generate category route for navigation. * @param {string} id category Id * @returns {string} */export var getCategoryRoute=function getCategoryRoute(id){return"".concat(CATEGORY_PATH,"/").concat(bin2hex(id));};/** * Generate filters for show all products. * @param {Object} parentCategory parent category * @returns {Object} */export var getShowAllProductsFilters=function getShowAllProductsFilters(parentCategory){var filters={categories:{id:'categories',label:i18n.text('filter.label.category'),source:'categories',type:'multiselect',value:[{id:parentCategory?parentCategory.path:null,label:parentCategory?parentCategory.name:null,isHidden:true,useForFetchFilters:true}]}};return filters;};