import type { BagItem, BagOperation, ProductType } from '@farfetch/blackout-client';
import type { BagItemDenormalized, ProductEntity, ProductEntityDenormalized } from '../entities/types/index.js';
import type { CustomAttributesAdapted, SizeAdapted } from '../helpers/adapters/index.js';
import type { StoreState } from '../types/index.js';
/**
* Retrieves current user's bag.
*
* @example
* ```
* import { getBag } from '@farfetch/blackout-redux';
*
* const mapStateToProps = state => ({
* bag: getBag(state)
* });
* ```
*
* @param state - Application state.
*
* @returns - Bag result.
*/
export declare const getBag: (state: StoreState) => import("./types/bag.types.js").BagNormalized | null;
/**
* Retrieves the error state of the current user's bag.
*
* @example
* ```
* import { getBagError } from '@farfetch/blackout-redux';
*
* const mapStateToProps = state => ({
* error: getBagError(state)
* });
* ```
*
* @param state - Application state.
*
* @returns Error information.
*/
export declare const getBagError: (state: StoreState) => import("@farfetch/blackout-client").BlackoutError | null;
/**
* Retrieves the universal identifier of the current user's bag.
*
* @example
* ```
* import { getBagId } from '@farfetch/blackout-redux';
*
* const mapStateToProps = state => ({
* bagId: getBagId(state)
* });
* ```
*
* @param state - Application state.
*
* @returns - Universal identifier of the bag.
*/
export declare const getBagId: (state: StoreState) => string | null;
/**
* Retrieves a specific bag item denormalized by its id, with all properties populated (ie, the
* product). This selector will always return a different reference. If you need a stable
* reference, use getEntityById selector (note though that it will not contain the product
* properties).
*
* @example
* ```
* import { getBagItem } from '@farfetch/blackout-redux';
*
* const mapStateToProps = (state, { bagItem: { id } }) => ({
* bagItem: getBagItem(state, id)
* });
* ```
*
* @param state - Application state.
* @param bagItemId - Numeric identifier of the bag item in the bag.
*
* @returns - Bag item entity for the given id.
*/
export declare const getBagItem: (state: StoreState, bagItemId: BagItem['id']) => BagItemDenormalized | undefined;
/**
* Retrieves the error state of a specific bag item product by its id.
*
* @example
* ```
* import { getBagItemError } from '@farfetch/blackout-redux';
*
* const mapStateToProps = (state, { bagItem: { bagItem: { id } } }) => ({
* error: getBagItemError(state, id)
* });
* ```
*
* @param state - Application state.
* @param bagItemId - Numeric identifier of the bag item in the bag.
*
* @returns - Error information, `undefined` if there are no errors.
*/
export declare const getBagItemError: (state: StoreState, bagItemId: BagItem['id']) => import("@farfetch/blackout-client").BlackoutError | null | undefined;
/**
* Retrieves all bag items ids from the current user's bag.
*
* This is typically used as a helper for other selectors.
*
* @example
* ```
* import { getBagItemsIds } from '@farfetch/blackout-redux';
*
* const mapStateToProps = (state) => ({
* error: getBagItemsIds(state)
* });
* ```
*
* @param state - Application state.
*
* @returns - List of bag items ids.
*/
export declare const getBagItemsIds: (state: StoreState) => number[] | null;
/**
* Retrieves all bag items denormalized from the current user's bag.
*
* @example
* ```
* import { getBagItems } from '@farfetch/blackout-redux';
*
* const mapStateToProps = state => ({
* bagItems: getBagItems(state),
* });
* ```
*
* @param state - Application state.
*
* @returns - List of each bag item entity (with the respective products) from the current user's bag.
*/
export declare const getBagItems: (state: StoreState) => BagItemDenormalized[];
/**
* Retrieves the number of different items in the bag, regardless of each one's
* quantity.
*
* @example
* ```
* import { getBagItemsCounter } from '@farfetch/blackout-redux';
*
* const excludeProductTypes = [3];
* const mapStateToProps = state => ({
* bagItemsCounter: getBagItemsCounter(state, excludeProductTypes),
* });
* ```
*
* @param state - Application state.
* @param excludeProductTypes - List of product types to exclude from the counter.
*
* Product types supported:
.
*
* | Type | Description |
* | ----- | ------------- |
* | **0** | Standard |
* | **1** | BundleProduct |
* | **2** | BundleVariant |
* | **3** | ProductGroup |
* | **4** | Sample |
*
*
.
*
* @returns - Count of the items in the bag.
*/
export declare const getBagItemsCounter: (state: StoreState, excludeProductTypes?: ProductType[]) => number;
/**
* Retrieves the unavailable bag items, if any, from the current user's bag.
*
* @example
* ```
* import { getBagItemsUnavailable } from '@farfetch/blackout-redux';
*
* const mapStateToProps = state => ({
* unavailableItems: getBagItemsUnavailable(state)
* });
* ```
*
* @param state - Application state.
*
* @returns - List of each bag unavailable item entity (with the respective products) from the current
* user's bag.
*/
export declare const getBagItemsUnavailable: (state: StoreState) => BagItemDenormalized[];
/**
* Retrieves the total quantity of products in the current user's bag, accounting
* with each item's quantity.
*
* @example
* ```
* import { getBagTotalQuantity } from '@farfetch/blackout-redux';
*
* const excludeProductTypes = [3];
* const mapStateToProps = state => ({
* bagItemsCount: getBagTotalQuantity(state, excludeProductTypes),
* });
* ```
*
* @param state - Application state.
* @param excludeProductTypes - List of product types to exclude from the counter.
*
* Product types supported:
.
*
* | Type | Description |
* | ----- | ------------- |
* | **0** | Standard |
* | **1** | BundleProduct |
* | **2** | BundleVariant |
* | **3** | ProductGroup |
* | **4** | Sample |
*
*
.
*
* @returns - Total quantity of products in the bag.
*/
export declare const getBagTotalQuantity: (state: StoreState, excludeProductTypes?: ProductType[]) => number;
/**
* Retrieves the loading status of a specific bag item by its id.
*
* @example
* ```
* import { isBagItemLoading } from '@farfetch/blackout-redux';
*
* const mapStateToProps = (state, { bagItem: { id } }) => ({
* isLoading: isBagItemLoading(state, id)
* });
* ```
*
* @param state - Application state.
* @param itemId - Numeric identifier of the bag item in the bag.
*
* @returns - Whether the given bag item is loading.
*/
export declare const isBagItemLoading: (state: StoreState, itemId: BagItem['id']) => boolean | undefined;
/**
* Retrieves the fetched status of a specific bag item by its id.
*
* @example
* ```
* import { isBagItemFetched } from '@farfetch/blackout-redux';
*
* const mapStateToProps = (state, { bagItem: { id } }) => ({
* isFetched: isBagItemFetched(state, id)
* });
* ```
*
* @param state - Application state.
* @param itemId - Numeric identifier of the bag item in the bag.
*
* @returns - Whether the given bag item is fetched.
*/
export declare const isBagItemFetched: (state: StoreState, itemId: BagItem['id']) => boolean;
/**
* Retrieves the loading status of the bag.
*
* This status is affected by the loading of the bag itself, as well as any "add"
* operation.
*
* @example
* ```
* import { isBagLoading } from '@farfetch/blackout-redux';
*
* const mapStateToProps = state => ({
* isLoading: isBagLoading(state)
* });
* ```
*
* @param state - Application state.
*
* @returns - Loading status of the bag.
*/
export declare const isBagLoading: (state: StoreState) => boolean;
/**
* Retrieves if the bag has been fetched.
*
* Will return true if a fetch bag request
* has been made that returned either successfully or failed
* and false otherwise.
*
* @example
* ```
* import { isBagFetched } from '@farfetch/blackout-redux';
*
* const mapStateToProps = state => ({
* isFetched: isBagFetched(state)
* });
* ```
* @param state - Application state.
*
* @returns isFetched status of the bag.
*/
export declare const isBagFetched: (state: StoreState) => boolean;
/**
* Retrieves the available sizes of a bag item.
*
* If there are two or more bag items of the same product, the size selected by one
* will be unavailable for the other.
*
* @example
* ```
* import { getBagItemAvailableSizes } from '@farfetch/blackout-redux';
*
* const mapStateToProps = (state, { bagItem: { id } }) => ({
* availableSizes: getBagItemAvailableSizes(state, id)
* });
* ```
*
* @param state - Application state.
* @param itemId - Item id.
*
* @returns - Available sizes for the given item.
*/
export declare const getBagItemAvailableSizes: (state: StoreState, bagItemId: BagItem['id']) => SizeAdapted[];
/**
* Creates a function responsible for checking if a certain product exists in the
* bag. This selector uses the `buildBagItem` util, so there are some
* `productParams` that are optional like `quantity` and `customAttributes`,
* because in the `buildBagItem` util there are default values.
*
* @example
* ```
* import { findProductInBag } from '@farfetch/blackout-redux';
*
* const mapStateToProps = (state, {size, product}) => ({
* bagItem: findProductInBag(state, {size, product})
* });
*
* ```
*
* @param state - Application state.
* @param productParams - Product params needed to this selector.
*
* @returns - Bag item matching provided product params.
*/
export declare const findProductInBag: (state: StoreState, productParams: {
customAttributes?: CustomAttributesAdapted;
product: ProductEntityDenormalized;
size: SizeAdapted;
merchantId: number;
}) => BagItemDenormalized | undefined;
/**
* Checks if there is a general error in the bag or in one of the bag items.
*
* @example
* ```
* import { isBagWithAnyError } from '@farfetch/blackout-redux';
*
* const mapStateToProps = (state) => ({
* hasBagError: isBagWithAnyError(state),
* });
* ```
*
* @param state - Application state.
*
* @returns - Whether there is an error within the bag or not.
*/
export declare const isBagWithAnyError: (state: StoreState) => boolean;
/**
* Gets item whole quantity. This is needed when there are more than one bag items
* who share the same product id and size but not the same merchant.
*
* @example
* ```
* import { getProductQuantityInBag } from '@farfetch/blackout-redux';
*
* const mapStateToProps = (state, { productId, sizeId }) => ({
* itemWholeQuantity: getProductQuantityInBag(state, productId, sizeId),
* });
*
* ```
*
* @param state - Application state.
* @param productId - Numeric identifier of the bag item product.
* @param sizeId - Numeric identifier of bag item size.
*
* @returns Number of products with the same bag item product and size as the one provided.
*/
export declare const getProductQuantityInBag: (state: StoreState, productId: ProductEntity['id'], sizeId: SizeAdapted['id']) => number;
/**
* Searches the bag items for a specific product. This doesn't care about the size
* of the product, it just finds the bag item that matches 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 bag, you just need to know if that product is
* already there.
*
* @param state - Application state.
* @param productId - Numeric identifier of the product.
*
* @returns Item at the bag if search had results, undefined otherwise.
*/
export declare const isProductInBag: (state: StoreState, productId: ProductEntity['id']) => boolean;
/**
* Retrieves a specific bag operation by its id.
*
* @param state - Application state.
* @param bagOperationId - Unique identifier of the operation.
*
* @returns - Bag operation entity for the given id or undefined if not existent.
*
* @example
* ```
* import { getBagOperation } from '@farfetch/blackout-redux';
*
* const mapStateToProps = (state, { bagOperation: { id } }) => ({
* bagOperation: getBagOperation(state, id)
* });
* ```
*/
export declare const getBagOperation: (state: StoreState, bagOperationId: BagOperation['id']) => BagOperation | undefined;
/**
* Retrieves the error state of a specific bag operation by its id.
*
* @param state - Application state.
* @param bagOperationId - Unique identifier of the bag operation.
*
* @returns - Error information, `undefined` if there are no errors.
*
* @example
* ```
* import { getBagOperationError } from '@farfetch/blackout-redux';
*
* const mapStateToProps = (state, { bagOperation: { bagOperation: { id } } }) => ({
* error: getBagOperationError(state, id)
* });
* ```
*/
export declare const getBagOperationError: (state: StoreState, bagOperationId: BagOperation['id']) => import("@farfetch/blackout-client").BlackoutError | null | undefined;
/**
* Retrieves latest bag operations from the current user's bag.
*
* @param state - Application state.
*
* @returns - List of each bag operation entity from the current user's bag.
*
* @example
* ```
* import { getBagOperations } from '@farfetch/blackout-redux';
*
* const mapStateToProps = state => ({
* bagOperations: getBagOperations(state),
* });
* ```
*/
export declare const getBagOperations: (state: StoreState) => BagOperation[];
/**
* Retrieves the loading status of a specific bag operation by its id.
*
* @param state - Application state.
* @param bagOperationId - Unique identifier of the bag operation in the bag.
*
* @returns - Whether the given bag operation is loading.
*
* @example
* ```
* import { isBagOperationLoading } from '@farfetch/blackout-redux';
*
* const mapStateToProps = (state, { bagOperation: { bagOperation: { id } } }) => ({
* isLoading: isBagOperationLoading(state, id)
* });
* ```
*/
export declare const isBagOperationLoading: (state: StoreState, bagOperationId: BagOperation['id']) => boolean | undefined;
/**
* Retrieves the error state of the bag promocodes.
*
* @param state - Application state.
*
* @returns - Error information, `undefined` if there are no errors.
*
* @example
* ```
* import { getBagPromocodesError } from '@farfetch/blackout-redux';
*
* const mapStateToProps = (state) => ({
* error: getBagPromocodesError(state)
* });
* ```
*/
export declare const getBagPromocodesError: (state: StoreState) => import("@farfetch/blackout-client").BlackoutError | null;
/**
* Retrieves the loading status of bag promocodes.
*
* @param state - Application state.
*
* @returns - Whether the set bag promocodes is loading.
*
* @example
* ```
* import { areBagPromocodesLoading } from '@farfetch/blackout-redux';
*
* const mapStateToProps = (state) => ({
* areLoading: areBagPromocodesLoading(state)
* });
* ```
*/
export declare const areBagPromocodesLoading: (state: StoreState) => boolean;
/**
* Retrieves current promocodes information in bag.
*
* @param state - Application state.
*
* @returns - Bag Promocodes Information, `undefined` if there are no bag id
*
* @example
* ```
* import { getBagPromocodesInformation } from '@farfetch/blackout-redux';
*
* const mapStateToProps = state => ({
* bagPromocodesInformation: getBagPromocodesInformation(state)
* });
* ```
*/
export declare const getBagPromocodesInformation: (state: StoreState) => import("@farfetch/blackout-client").PromocodeInformation[] | undefined;