import type { WishlistItem } from '@farfetch/blackout-client'; import type { BuildWishlistItemData } from '../utils/buildWishlistItem.js'; import type { ProductEntity, WishlistItemDenormalized } from '../../entities/types/index.js'; import type { StoreState } from '../../types/index.js'; /** * Retrieves the universal identifier of the current user's wishlist. * * @example * ``` * import { getWishlistId } from '@farfetch/blackout-redux'; * * const mapStateToProps = state => ({ * wishlistId: getWishlistId(state) * }); * ``` * * @param state - Application state. * * @returns Universal identifier of the wishlist. */ export declare const getWishlistId: (state: StoreState) => string | null; /** * Retrieves current user's wishlist. * * @example * ``` * import { getWishlist } from '@farfetch/blackout-redux'; * * const mapStateToProps = state => ({ * wishlist: getWishlist(state) * }); * ``` * * @param state - Application state. * * @returns Wishlist result. */ export declare const getWishlist: (state: StoreState) => import("../types/state.types.js").WishlistNormalized | null; /** * Retrieves a specific wishlist item denormalized by its id, with all properties populated (ie, * the product). * * @example * ``` * import { getWishlistItem } from '@farfetch/blackout-redux'; * * const mapStateToProps = (state, { wishlistItem: { id } }) => ({ * wishlistItem: getWishlistItem(state, id) * }); * ``` * * @param state - Application state. * @param wishlistItemId - Numeric identifier of the wishlist item in the wishlist. * @param withParentSetsInfo - Whether the item should be populated with information about the wishlist * sets it belongs to. * * @returns Wishlist item entity for the given id. */ export declare const getWishlistItem: (state: StoreState, wishlistItemId: WishlistItem['id'], withParentSetsInfo?: boolean) => WishlistItemDenormalized | undefined; /** * Retrieves all wishlist items ids from the current user's wishlist. * * This is typically used as a helper for other selectors. * * @example * ``` * const wishlistItemsIds = getWishlistItemsIds(state); * * wishlistItemsIds.map(otherSelector(state)); * ``` * * @param state - Application state. * * @returns List of wishlist items ids. */ export declare const getWishlistItemsIds: (state: StoreState) => number[] | null | undefined; /** * Retrieves all wishlist items denormalized from the current user's wishlist. * * @example * ``` * import { getWishlistItems } from '@farfetch/blackout-redux'; * * const mapStateToProps = state => ({ * wishlistItems: getWishlistItems(state), * }); * ``` * * @param state - Application state. * @param withParentSetsInfo - Whether each item should be populated with information about the * wishlist sets it belongs to. * * @returns List of each wishlist item entity (with the respective products) from the current user's * wishlist. */ export declare const getWishlistItems: (state: StoreState, withParentSetsInfo?: boolean) => WishlistItemDenormalized[] | undefined; /** * Retrieves the error state of the current user's wishlist. * * @example * ``` * import { getWishlistError } from '@farfetch/blackout-redux'; * * const mapStateToProps = state => ({ * error: getWishlistError(state) * }); * ``` * * @param state - Application state. * * @returns Error information, `undefined` if there are no errors. */ export declare const getWishlistError: (state: StoreState) => import("@farfetch/blackout-client").BlackoutError | null; /** * Retrieves the loading status of the wishlist. * * This status is affected by the loading of the wishlist itself, as well as any * "add" operation. * * @example * ``` * import { isWishlistLoading } from '@farfetch/blackout-redux'; * * const mapStateToProps = state => ({ * isLoading: isWishlistLoading(state) * }); * ``` * * @param state - Application state. * * @returns Loading status of the wishlist. */ export declare const isWishlistLoading: (state: StoreState) => boolean; /** * Retrieves if the wishlist has been fetched. * * Will return true if a fetch wishlist request * has been made that returned either successfully or failed * and false otherwise. * * @example * ``` * import { isWishlistFetched } from '@farfetch/blackout-redux'; * * const mapStateToProps = state => ({ * isFetched: isWishlistFetched(state) * }); * ``` * @param state - Application state. * * @returns isFetched status of the wishlist. */ export declare const isWishlistFetched: (state: StoreState) => boolean; /** * Retrieves the number of different items in the wishlist, regardless of each * one's quantity. * * @example * ``` * import { getWishlistItemsCounter } from '@farfetch/blackout-redux'; * * const mapStateToProps = state => ({ * wishlistItemsCounter: getWishlistItemsCounter(state), * }); * ``` * * @param state - Application state. * * @returns Count of the items in the wishlist. */ export declare const getWishlistItemsCounter: (state: StoreState) => number; /** * Retrieves the total quantity of products in the current user's wishlist, * accounting with each item's quantity. * * @example * ``` * import { getWishlistTotalQuantity } from '@farfetch/blackout-redux'; * * const mapStateToProps = state => ({ * wishlistItemsCount: getWishlistTotalQuantity(state), * }); * ``` * * @param state - Application state. * * @returns Total quantity of products in the wishlist. */ export declare const getWishlistTotalQuantity: (state: StoreState) => number; /** * Retrieves the loading status of a specific wishlist item by its id. * * @example * ``` * import { isWishlistItemLoading } from '@farfetch/blackout-redux'; * * const mapStateToProps = (state, { wishlistItem: { id } }) => ({ * isLoading: isWishlistItemLoading(state, id) * }); * ``` * * @param state - Application state. * @param itemId - Numeric identifier of the wishlist item in the wishlist. * * @returns Whether the given wishlist item is loading. */ export declare const isWishlistItemLoading: (state: StoreState, itemId: WishlistItem['id']) => boolean; /** * Retrieves the fetched status of a specific wishlist item by its id. * * @example * ``` * import { isWishlistItemFetched } from '@farfetch/blackout-redux'; * * const mapStateToProps = (state, { wishlistItem: { id } }) => ({ * isLoading: isWishlistItemFetched(state, id) * }); * ``` * * @param state - Application state. * @param itemId - Numeric identifier of the wishlist item in the wishlist. * * @returns Whether the given wishlist item is fetched. */ export declare const isWishlistItemFetched: (state: StoreState, itemId: WishlistItem['id']) => boolean; /** * Retrieves the error state of a specific wishlist item product by its id. * * @example * ``` * import { getWishlistItemError } from '@farfetch/blackout-redux'; * * const mapStateToProps = ( * state, * { wishlistItem: { product: { id } } * }) => ({ * error: getWishlistItemError(state, id) * }); * ``` * * @param state - Application state. * @param itemId - Numeric identifier of the product in the wishlist. * * @returns Error information, `undefined` if there are no errors. */ export declare const getWishlistItemError: (state: StoreState, itemId: WishlistItem['id']) => import("@farfetch/blackout-client").BlackoutError | null | undefined; /** * Finds a wishlist item for the given product and size, returns undefined if * nothing was found. * * @example * ``` * import { findProductInWishlist } from '@farfetch/blackout-redux'; * * const mapStateToProps = (state) => ({ * getItemInWishlist: findProductInWishlist(state, { product, size: selectedSize }); * }); * ``` * * @param state - Application state. * @param data - Data needed to find check the given product. * @param withParentSetsInfo - Whether the item should be populated with information about the wishlist * sets it belongs to. * * @returns Returns the item found in the wishlist, undefined otherwise. */ export declare const findProductInWishlist: (state: StoreState, data: BuildWishlistItemData, withParentSetsInfo?: boolean) => WishlistItemDenormalized | undefined; /** * Checks if there is a general error in the wishlist or in one of the wishlist * items. * * @example * ``` * import { isWishlistWithAnyError } from '@farfetch/blackout-redux'; * * const mapStateToProps = (state) => ({ * hasWishlistError: isWishlistWithAnyError(state), * }); * ``` * * @param state - Application state. * * @returns Whether there is an error within the wishlist or not. */ export declare const isWishlistWithAnyError: (state: StoreState) => boolean; /** * Searches the wishlist items for a specific product. This doesn't care about the * size of the product, it just finds if there are wishlist items that match the * given product id. This is useful, for example, for the listing page, where you * don't care which size of the product is in the wishlist, you just need to know * if that product is already there. * * @param state - Application state. * @param productId - Numeric identifier of the product. * * @returns True if there is at least one wishlist item with the given productId, false otherwise. */ export declare const isProductInWishlist: (state: StoreState, productId: ProductEntity['id']) => boolean; /** * Finds all wishlist items with the provided product identifier. This is useful * for scenarios where you don't have the item size. * * @param state - Application state. * @param productId - Numeric identifier of the product. * @param withParentSetsInfo - Whether the item should be populated with information about the wishlist * sets it belongs to. * * @returns List of wishlist items. */ export declare const getWishlistItemsByProductId: (state: StoreState, productId: ProductEntity['id']) => WishlistItemDenormalized[];