How to use the @shopgate/pwa-common/helpers/data.hex2bin 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 / libraries / commerce / category / selectors / index.js View on Github external
(params, settings, categoryId, pathname) => {
    if (params && params.categoryId) {
      return hex2bin(params.categoryId) || null;
    }

    if (settings && settings.categoryNumber) {
      return settings.categoryNumber;
    }

    if (!categoryId) {
      if (pathname && pathname.startsWith(CATEGORY_PATH)) {
        return hex2bin(pathname.split('/')[2]) || null;
      }
    }

    return categoryId;
  }
);
github shopgate / pwa / libraries / commerce / product / subscriptions / index.js View on Github external
subscribe(productWillEnter$, ({ action, dispatch }) => {
    const { productId } = action.route.params;
    const { productId: variantId } = action.route.state;
    const id = variantId || hex2bin(productId);

    dispatch(fetchProduct(id));
    dispatch(fetchProductDescription(id));
    dispatch(fetchProductProperties(id));
    dispatch(fetchProductImages(id, productImageFormats.getAllUniqueFormats()));
    dispatch(fetchProductShipping(id));
    /**
     * This feature is currently in BETA testing.
     * It should only be used for approved BETA Client Projects
     */
    dispatch(fetchProductMedia(id));
  });
github shopgate / pwa / themes / theme-ios11 / pages / WriteReview / subscriptions.js View on Github external
subscribe(productRoutesWillEnter$, ({ action, dispatch, getState }) => {
    const state = getState();
    const { productId } = action.route.params;

    if (!productId || !state.user.login.isLoggedIn) {
      return;
    }

    dispatch(fetchUserReview(hex2bin(productId)));
  });
github shopgate / pwa / libraries / commerce / filter / actions / helpers / buildFilterParams.js View on Github external
const buildFilterParams = (state) => {
  const { params, query } = getCurrentRoute(state);

  return {
    ...params.categoryId && { categoryId: hex2bin(params.categoryId) },
    ...query.s && { searchPhrase: query.s },
  };
};
github shopgate / pwa / libraries / commerce / filter / actions / helpers / buildFilterParams.js View on Github external
const buildFilterParams = () => {
  const { params, query } = getCurrentRoute();

  return {
    ...params.categoryId && { categoryId: hex2bin(params.categoryId) },
    ...query.s && { searchPhrase: query.s },
  };
};
github shopgate / pwa / themes / theme-gmd / pages / Category / streams.js View on Github external
if (action.type !== type) {
    return false;
  }

  if (typeof action.categoryId === 'undefined') {
    return false;
  }

  const route = getCurrentRoute(getState());

  if (!route.params.categoryId) {
    return false;
  }

  return action.categoryId === hex2bin(route.params.categoryId);
};
github shopgate / pwa / libraries / commerce / product / helpers / index.js View on Github external
export const transformRoute = (route) => {
  if (!route.params.productId || route.state.productId) {
    return route;
  }

  return {
    ...route,
    state: {
      ...route.state,
      productId: hex2bin(route.params.productId),
    },
  };
};
github shopgate / pwa / themes / theme-gmd / pages / Reviews / subscriptions.js View on Github external
subscribe(reviewsWillEnter$, ({ dispatch, action }) => {
    dispatch(fetchReviews(hex2bin(action.route.params.productId), REVIEW_ITEMS_PER_PAGE));
  });
}