@automattic/shopping-cart
Version:
A library to use the WordPress.com shopping cart.
29 lines • 1.44 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.createActions = void 0;
const create_request_cart_product_1 = require("./create-request-cart-product");
function createActions(dispatch) {
return {
reloadFromServer: () => dispatch({ type: 'CART_RELOAD' }),
clearMessages: () => dispatch({ type: 'CLEAR_MESSAGES' }),
removeCoupon: () => dispatch({ type: 'REMOVE_COUPON' }),
addProductsToCart: async (products) => dispatch({
type: 'CART_PRODUCTS_ADD',
products: (0, create_request_cart_product_1.createRequestCartProducts)(products),
}),
removeProductFromCart: (uuidToRemove) => dispatch({ type: 'REMOVE_CART_ITEM', uuidToRemove }),
replaceProductsInCart: async (products) => dispatch({
type: 'CART_PRODUCTS_REPLACE_ALL',
products: (0, create_request_cart_product_1.createRequestCartProducts)(products),
}),
replaceProductInCart: (uuidToReplace, productPropertiesToChange) => dispatch({
type: 'CART_PRODUCT_REPLACE',
uuidToReplace,
productPropertiesToChange,
}),
updateLocation: (location) => dispatch({ type: 'SET_LOCATION', location }),
applyCoupon: (newCoupon) => dispatch({ type: 'ADD_COUPON', couponToAdd: newCoupon }),
};
}
exports.createActions = createActions;
//# sourceMappingURL=shopping-cart-actions.js.map