@nacelle/react-hooks
Version:
Custom convenience hooks for use when building apps with Nacelle
15 lines (14 loc) • 729 B
TypeScript
import { CartItem } from '../../common/types';
import { LegacyCartItem, StorageTypes } from '../use-cart.types';
/**
* A utility function which will return true if the item is already in the cart
*
* @param cart the current cart state
* @param payload a Shopify item
*
* @returns a boolean indiciating if the item is already in the cart
*/
export declare function isItemInCart(cart: CartItem[], payload: CartItem): boolean;
export declare function setCacheItem(storage: StorageTypes | null): (key: string, value: string) => void;
export declare function unsetCacheItem(storage: StorageTypes | null): (key: string) => void;
export declare function convertLegacyCartItem(legacyItem: LegacyCartItem): CartItem;