How to use the @shopgate/pwa-common/components/Router/helpers/connect function in @shopgate/pwa-common

To help you get started, we’ve selected a few @shopgate/pwa-common examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github shopgate / pwa / pages / Register / connector.js View on Github external
*/
const mapStateToProps = state => ({
  hasRegisterUrl: !!getRegisterUrl(state),
});

/**
 * Connects the dispatch function to a callable function in the props.
 * @param {Function} dispatch The redux dispatch function.
 * @return {Object} The extended component props.
 */
const mapDispatchToProps = dispatch => ({
  fetchRegisterUrl: () => dispatch(fetchRegisterUrl()),
  goBackHistory: number => dispatch(goBackHistory(number)),
});

export default connect(mapStateToProps, mapDispatchToProps, null, { withRef: true });
github shopgate / pwa / pages / Login / connector.js View on Github external
*/
const mapStateToProps = state => ({
  isLoading: isViewLoading(state, LOGIN_PATH),
  isDisabled: isUserLoginDisabled(state),
});

/**
 * Connects the dispatch function to a callable function in the props.
 * @param {Function} dispatch The redux dispatch function.
 * @return {Object} The extended component props.
 */
const mapDispatchToProps = dispatch => ({
  login: credentials => dispatch(login(credentials)),
});

export default connect(mapStateToProps, mapDispatchToProps, null, { withRef: true });
github shopgate / pwa / pages / Browse / connector.js View on Github external
const mapStateToProps = (state, props) => ({
  categories: getCurrentCategories(state, props),
});

/**
 * Connects the dispatch function to a callable function in the props.
 * @param {Function} dispatch The redux dispatch function.
 * @return {Object} The extended component props.
 */
const mapDispatchToProps = dispatch => ({
  getCategory(categoryId) {
    dispatch(getCategory(hex2bin(categoryId)));
  },
});

export default connect(mapStateToProps, mapDispatchToProps, null, { withRef: true });
github shopgate / pwa / pages / ProductGallery / connector.js View on Github external
/**
 * Connects the dispatch function to a callable function in the props.
 * @param {Function} dispatch The redux dispatch function.
 * @param {Object} props The current component props.
 * @return {Object} The extended component props.
 */
const mapDispatchToProps = (dispatch, props) => ({
  disableNavigator: () => dispatch(disableNavigator()),
  enableNavigator: () => dispatch(enableNavigator()),
  getProductImages: () => {
    const productId = hex2bin(props.params.productId);
    dispatch(fetchProductImages(productId));
  },
});

export default connect(mapStateToProps, mapDispatchToProps, null, { withRef: true });
github shopgate / pwa / pages / Filter / connector.js View on Github external
availableFilters: getAvailableFilters(state, props),
  temporaryFilters: state.filter.temporaryFilters,
  queryParams: getQueryParamsAsString(state),
});

/**
 * Connects the dispatch function to a callable function in the props.
 * @param {Function} dispatch The redux dispatch function.
 * @return {Object} The extended component props.
 */
const mapDispatchToProps = dispatch => ({
  mergeTemporaryFilters: temporaryFilters => dispatch(mergeTemporaryFilters(temporaryFilters)),
  removeTemporaryFilter: (id, index = null) => dispatch(removeTemporaryFilter(id, index)),
});

export default connect(mapStateToProps, mapDispatchToProps, null, { withRef: true });
github shopgate / pwa / pages / Orders / connector.js View on Github external
import connect from '@shopgate/pwa-common/components/Router/helpers/connect';
import goBackHistory from '@shopgate/pwa-common/actions/history/goBackHistory';

/**
 * Connects the dispatch function to a callable function in the props.
 * @param {Function} dispatch The redux dispatch function.
 * @return {Object} The extended component props.
 */
const mapDispatchToProps = dispatch => ({
  goBackHistory: number => dispatch(goBackHistory(number)),
});

export default connect(null, mapDispatchToProps, null, { withRef: true });
github shopgate / pwa / pages / Page / connector.js View on Github external
const mapStateToProps = state => ({
  configs: state.page,
});

/**
 * Connects the dispatch function to a callable function in the props.
 * @param {Function} dispatch The redux dispatch function.
 * @return {Object} The extended component props.
 */
const mapDispatchToProps = dispatch => ({
  getPageConfig: (pageId) => {
    dispatch(getPageConfig(pageId));
  },
});

export default connect(mapStateToProps, mapDispatchToProps, null, { withRef: true });
github shopgate / pwa / pages / Checkout / connector.js View on Github external
import connect from '@shopgate/pwa-common/components/Router/helpers/connect';
import goBackHistory from '@shopgate/pwa-common/actions/history/goBackHistory';
import fetchCheckoutUrl from '@shopgate/pwa-common-commerce/checkout/actions/fetchCheckoutUrl';

/**
 * Connects the dispatch function to a callable function in the props.
 * @param {Function} dispatch The redux dispatch function.
 * @return {Object} The extended component props.
 */
const mapDispatchToProps = dispatch => ({
  fetchCheckoutUrl: () => dispatch(fetchCheckoutUrl()),
  goBackHistory: number => dispatch(goBackHistory(number)),
});

export default connect(null, mapDispatchToProps, null, { withRef: true });
github shopgate / pwa / pages / FilterAttribute / connector.js View on Github external
currentAttribute: getCurrentFilterAttribute(state),
});

/**
 * Connects the dispatch function to a callable function in the props.
 * @param {Function} dispatch The redux dispatch function.
 * @return {Object} The extended component props.
 */
const mapDispatchToProps = dispatch => ({
  mergeTemporaryFilters: temporaryFilters => dispatch(mergeTemporaryFilters(temporaryFilters)),
  setFilterAttributeClosed: () => dispatch(setFilterAttributeClosed()),
  setFilterAttributeOpened: () => dispatch(setFilterAttributeOpened()),
  removeTemporaryFilter: (...args) => dispatch(removeTemporaryFilter(...args)),
});

export default connect(mapStateToProps, mapDispatchToProps, null, { withRef: true });
github shopgate / pwa / pages / Cart / components / CouponField / connector.js View on Github external
const mapStateToProps = state => ({
  isIos: isIos(state),
  isLoading: isCurrentViewLoading(state),
  isVisible: hasCouponSupport(state),
});

/**
 * Connects the dispatch function to a callable function in the props.
 * @param {Function} dispatch The redux dispatch function.
 * @return {Object} The extended component props.
 */
const mapDispatchToProps = dispatch => ({
  addCoupon: couponId => dispatch(addCouponsToCart([couponId])),
});

export default connect(mapStateToProps, mapDispatchToProps);