Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
subscribe(appDidStart$, ({ dispatch }) => {
// Setup sync pipeline dependencies (concurrency to each other and themselves)
pipelineDependencies.set(SHOPGATE_USER_ADD_FAVORITES, [
SHOPGATE_USER_ADD_FAVORITES,
SHOPGATE_USER_DELETE_FAVORITES,
]);
pipelineDependencies.set(SHOPGATE_USER_DELETE_FAVORITES, [
SHOPGATE_USER_ADD_FAVORITES,
SHOPGATE_USER_DELETE_FAVORITES,
]);
dispatch(fetchFavorites());
});
subscribe(appDidStart$, ({ dispatch }) => {
pipelineDependencies.set(pipelines.SHOPGATE_CART_GET_CART, [
pipelines.SHOPGATE_CART_ADD_PRODUCTS,
pipelines.SHOPGATE_CART_UPDATE_PRODUCTS,
pipelines.SHOPGATE_CART_DELETE_PRODUCTS,
pipelines.SHOPGATE_CART_ADD_COUPONS,
pipelines.SHOPGATE_CART_DELETE_COUPONS,
]);
// Push (deeplink) with coupon concurrent to get cart on app start
pipelineDependencies.set(pipelines.SHOPGATE_CART_ADD_COUPONS, [
pipelines.SHOPGATE_CART_ADD_PRODUCTS,
pipelines.SHOPGATE_CART_GET_CART,
]);
pipelineDependencies.set(pipelines.SHOPGATE_CART_DELETE_COUPONS, [
pipelines.SHOPGATE_CART_ADD_PRODUCTS,
pipelines.SHOPGATE_CART_GET_CART,
]);
/**
* Reload the cart whenever the WebView becomes visible.
* This is needed, for example, when the cart is modified from another inAppBrowser tab like a
* web-checkout and the user closes the said tab before reaching the success page.
*/
event.addCallback('viewWillAppear', () => {
dispatch(fetchCart());
});
// Reset the productPendingCount on app start to avoid a wrong value in the cart badge.
dispatch(setCartProductPendingCount(0));
});
subscribe(appDidStart$, ({ dispatch }) => {
pipelineDependencies.set(pipelines.SHOPGATE_CART_GET_CART, [
pipelines.SHOPGATE_CART_ADD_PRODUCTS,
pipelines.SHOPGATE_CART_UPDATE_PRODUCTS,
pipelines.SHOPGATE_CART_DELETE_PRODUCTS,
pipelines.SHOPGATE_CART_ADD_COUPONS,
pipelines.SHOPGATE_CART_DELETE_COUPONS,
]);
// Push (deeplink) with coupon concurrent to get cart on app start
pipelineDependencies.set(pipelines.SHOPGATE_CART_ADD_COUPONS, [
pipelines.SHOPGATE_CART_ADD_PRODUCTS,
pipelines.SHOPGATE_CART_GET_CART,
]);
pipelineDependencies.set(pipelines.SHOPGATE_CART_DELETE_COUPONS, [
pipelines.SHOPGATE_CART_ADD_PRODUCTS,
pipelines.SHOPGATE_CART_GET_CART,
]);
subscribe(appDidStart$, ({ dispatch }) => {
// Setup sync pipeline dependencies (concurrency to each other and themselves)
pipelineDependencies.set(SHOPGATE_USER_ADD_FAVORITES, [
SHOPGATE_USER_ADD_FAVORITES,
SHOPGATE_USER_DELETE_FAVORITES,
]);
pipelineDependencies.set(SHOPGATE_USER_DELETE_FAVORITES, [
SHOPGATE_USER_ADD_FAVORITES,
SHOPGATE_USER_DELETE_FAVORITES,
]);
dispatch(fetchFavorites());
});
subscribe(appDidStart$, ({ dispatch }) => {
pipelineDependencies.set(pipelines.SHOPGATE_CART_GET_CART, [
pipelines.SHOPGATE_CART_ADD_PRODUCTS,
pipelines.SHOPGATE_CART_UPDATE_PRODUCTS,
pipelines.SHOPGATE_CART_DELETE_PRODUCTS,
pipelines.SHOPGATE_CART_ADD_COUPONS,
pipelines.SHOPGATE_CART_DELETE_COUPONS,
]);
// Push (deeplink) with coupon concurrent to get cart on app start
pipelineDependencies.set(pipelines.SHOPGATE_CART_ADD_COUPONS, [
pipelines.SHOPGATE_CART_ADD_PRODUCTS,
pipelines.SHOPGATE_CART_GET_CART,
]);
pipelineDependencies.set(pipelines.SHOPGATE_CART_DELETE_COUPONS, [
pipelines.SHOPGATE_CART_ADD_PRODUCTS,
pipelines.SHOPGATE_CART_GET_CART,
]);
/**
* Reload the cart whenever the WebView becomes visible.
* This is needed, for example, when the cart is modified from another inAppBrowser tab like a
* web-checkout and the user closes the said tab before reaching the success page.
*/
event.addCallback('viewWillAppear', () => {
dispatch(fetchCart());
});