Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
(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;
}
);
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));
});
{({ params, visible }) => (
)}
subscribe(productRoutesWillEnter$, ({ action, dispatch, getState }) => {
const state = getState();
const { productId } = action.route.params;
if (!productId || !state.user.login.isLoggedIn) {
return;
}
dispatch(fetchUserReview(hex2bin(productId)));
});
const buildFilterParams = (state) => {
const { params, query } = getCurrentRoute(state);
return {
...params.categoryId && { categoryId: hex2bin(params.categoryId) },
...query.s && { searchPhrase: query.s },
};
};
const buildFilterParams = () => {
const { params, query } = getCurrentRoute();
return {
...params.categoryId && { categoryId: hex2bin(params.categoryId) },
...query.s && { searchPhrase: query.s },
};
};
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);
};
export const transformRoute = (route) => {
if (!route.params.productId || route.state.productId) {
return route;
}
return {
...route,
state: {
...route.state,
productId: hex2bin(route.params.productId),
},
};
};
{({ params }) => (
)}
subscribe(reviewsWillEnter$, ({ dispatch, action }) => {
dispatch(fetchReviews(hex2bin(action.route.params.productId), REVIEW_ITEMS_PER_PAGE));
});
}