import { Ref, ComputedRef } from 'vue'; import { GraphQLClient, Cart, CartMainItem, Product, Cluster, MediaImageProductSearchInput, TransformationsInput, Crossupsell, CartProcessResponse } from '@propeller-commerce/propeller-sdk-v2'; import { AnyUser, Result } from '@propeller-commerce/propeller-v2-core-ui'; export interface UseCartOptions { graphqlClient: GraphQLClient; user: Ref; /** Initial cart id. Accepts a plain string or a (computed) ref. */ cartId?: string | Ref; companyId?: Ref; language?: Ref; configuration: { language?: string; imageSearchFiltersGrid: MediaImageProductSearchInput; imageVariantFiltersSmall: TransformationsInput; }; onCartCreated?: (cart: Cart) => void; } export interface AddItemOptions { product: Product; cluster?: Cluster; childItems?: number[]; quantity: number; notes?: string; price?: number; onAddToCart?: (product: Product, clusterId?: number, quantity?: number, childItems?: { productId: number; quantity: number; }[], notes?: string, price?: number) => Cart; afterAddToCart?: (cart: Cart, item: CartMainItem | null) => void; enableStockValidation?: boolean; cartId?: string; createCart?: boolean; } export interface GetCrossupsellsOptions { productId?: number; clusterId?: number; types?: string[]; taxZone?: string; imageVariantFilters?: TransformationsInput; } export interface UseCartReturn { cart: Ref; cartId: Ref; loading: Ref; error: Ref; checkoutAllowed: ComputedRef; resolveCart: () => Promise; fetchActiveCart: () => Promise; addItem: (options: AddItemOptions) => Promise>; /** * Adds several products in one call, sequentially, threading the resolved * cart id from each add into the next. Stops at the first failure. */ addItems: (items: AddItemOptions[]) => Promise>; updateItemQuantity: (cartItemId: string, quantity: number) => Promise; updateItemNotes: (cartItemId: string, notes: string, debounceMs?: number) => void; deleteItem: (cartItemId: string) => Promise; addActionCode: (code: string) => Promise; removeActionCode: (code: string) => Promise; requestAuthorization: () => Promise>; processCart: (orderStatus?: string) => Promise>; getCrossupsells: (options: GetCrossupsellsOptions) => Promise; getMinQuantity: (product: Product | null | undefined) => number; getStep: (product: Product | null | undefined) => number; } export declare function useCart(options: UseCartOptions): UseCartReturn;