import { Ref } from 'vue'; import { GraphQLClient, Cart, CartUpdateAddressInput, MediaImageProductSearchInput, TransformationsInput, Address } from '@propeller-commerce/propeller-sdk-v2'; import { AnyUser, Result } from '@propeller-commerce/propeller-v2-core-ui'; export interface UseCheckoutOptions { graphqlClient: GraphQLClient; user: Ref; companyId?: Ref; language?: Ref; configuration: { imageSearchFiltersGrid: MediaImageProductSearchInput; imageVariantFiltersSmall: TransformationsInput; }; } export interface CartSettingsInput { paymentMethod?: string; carrier?: string; requestDate?: string; reference?: string; notes?: string; } export interface PlaceOrderOptions { isQuoteMode?: boolean; reference?: string; notes?: string; /** * Order status to set. When omitted it defaults to `'REQUEST'` in quote mode * and `'NEW'` otherwise. Pass `'UNFINISHED'` for an order awaiting an external * payment (PSP) whose final status the payment webhook sets later. Any backend * status string is accepted. */ orderStatus?: 'NEW' | 'REQUEST' | 'UNFINISHED' | (string & {}); /** * Whether this placement *finalizes* the order — i.e. sends the order * confirmation email, fires the confirm event, attaches the order PDF, and * clears the cart. Defaults to `true`. * * Set this to `false` for an order awaiting an external payment (e.g. * `'UNFINISHED'` orders handed off to a PSP). The confirmation/cart deletion * should then happen when the payment is confirmed (the PSP webhook), not at * placement — otherwise the shopper is emailed and the cart cleared before * they've paid. */ finalizeOrder?: boolean; } /** Backwards-friendly alias kept for the public `UseCheckout*` type re-exports. */ export type PlaceOrderResult = Result<{ orderId: number; }, string>; export interface UseCheckoutReturn { loading: Ref; error: Ref; updateCartAddress: (cartId: string, type: 'INVOICE' | 'DELIVERY', address: any) => Promise; updateCartSettings: (cartId: string, input: CartSettingsInput) => Promise; placeOrder: (cartId: string, options?: PlaceOrderOptions) => Promise>; getUserDefaultAddress: (type: 'invoice' | 'delivery') => Address | undefined; buildAddressInput: (type: 'INVOICE' | 'DELIVERY', addr: any) => CartUpdateAddressInput; } export declare function useCheckout(options: UseCheckoutOptions): UseCheckoutReturn;