text: /**
   * Copyright (c) 2017, Shopgate, Inc. All rights reserved.
   *
   * This source code is licensed under the Apache 2.0 license found in the
   * LICENSE file in the root directory of this source tree.
   */
  
  import connect from '@shopgate/pwa-common/components/Router/helpers/connect';
  import getProductsByQuery from '@shopgate/pwa-common-commerce/product/actions/getProductsByQuery';
  import { getProductsResult } from '../selectors';
  
  /**
   * Maps the contents of the state to the component props.
   * @param {Object} state The current application state.
   * @param {Object} props The component properties.
   * @return {Object} The extended component props.
   */
  const mapStateToProps = (state, props) => ({
    products: getProductsResult(state, props.settings.queryType, {
      sort: props.settings.sortOrder,
      value: props.settings.queryParams,
    }).products,
  });
  
  /**
   * Maps the contents of the state to the component props.
   * @param  {Function} dispatch The redux dispatch function.
   * @return {Object} The extended component props.
   */
  const mapDispatchToProps = dispatch => ({
    getProducts: (type, value, sort) =>
      dispatch(
        getProductsByQuery(type, value, sort)
      ),
  });
  
  export default connect(mapStateToProps, mapDispatchToProps);
  