import * as react_jsx_runtime from 'react/jsx-runtime';
import * as react from 'react';
import * as CheckoutApi from '@noaignite/centra-types';
import { ApiClient } from './ApiClient.cjs';
import { CentraEvents } from './internal/CentraEvents.cjs';

/**
 * The prop types that CentraProvider accepts
 */
interface ProviderProps {
    /**
     * Centra API URL
     */
    apiUrl?: string;
    /**
     * The api client to use instead of the default one
     */
    apiClient?: ApiClient;
    children: React.ReactNode;
    /**
     * Disables automatic client side fetching of the Centra selection
     */
    disableInit?: boolean;
    /**
     * Sets the initial selection.
     * The `initialSelection` is ignore after the initial render
     */
    initialSelection?: CheckoutApi.SuccessResponse<CheckoutApi.SelectionResponse>;
    /**
     * Used when submitting payment using the POST /payment Centra api call
     */
    paymentFailedPage: string | ((selection: CheckoutApi.SuccessResponse<CheckoutApi.SelectionResponse>) => string);
    /**
     * Used when submitting payment using the POST /payment Centra api call
     */
    paymentReturnPage: string | ((selection: CheckoutApi.SuccessResponse<CheckoutApi.SelectionResponse>) => string);
    /**
     * Receipt page to redirect to when Centra payment succeeds directly
     */
    receiptPage: string;
    /**
     *  When the cookie used to store the Centra checkout token will expire, days as a number or a Date
     *  @defaultValue `365`
     */
    tokenExpires?: number | Date;
    /**
     * The name of the cookie used to store the Centra checkout token
     * @defaultValue `centra-checkout-token`
     */
    tokenName?: string;
    tokenCookieOptions?: Cookies.CookieAttributes;
}
interface ContextMethods {
    /**
     * @param item - The Centra item id
     */
    addItem?: (item: string, quantity?: number) => Promise<CheckoutApi.Response<CheckoutApi.SelectionResponse>>;
    /**
     * @param item - The Centra item id
     * @param data - Bundle data
     */
    addBundleItem?: (item: string, data?: Record<string, unknown>) => Promise<CheckoutApi.Response<CheckoutApi.SelectionResponse>>;
    /**
     * @param giftCertificate - The `giftCertificate` value of the gift certificate to add
     */
    addGiftCertificate?: (giftCertificate: string) => Promise<CheckoutApi.Response<CheckoutApi.SelectionResponse>>;
    addBackInStockSubscription?: (data: Record<string, unknown>) => Promise<CheckoutApi.Response<CheckoutApi.SelectionResponse>>;
    /**
     * @param giftCertificate - The `giftCertificate` value of the gift certificate to add
     * @param amount - Custom gift certificate amount
     */
    addCustomGiftCertificate?: (giftCertificate: string, amount: string) => Promise<CheckoutApi.Response<CheckoutApi.SelectionResponse>>;
    addNewsletterSubscription?: (data: Record<string, unknown>) => Promise<CheckoutApi.Response<CheckoutApi.SelectionResponse>>;
    /**
     * @param voucher - The id of the voucher to add
     */
    addVoucher?: (voucher: string) => Promise<CheckoutApi.Response<CheckoutApi.SelectionResponse>>;
    /**
     * @param line - The line id of the item to decrease
     */
    decreaseCartItem?: (line: string) => Promise<CheckoutApi.Response<CheckoutApi.SelectionResponse>>;
    /**
     * @param line - The line id of the item to increase
     */
    increaseCartItem?: (line: string) => Promise<CheckoutApi.Response<CheckoutApi.SelectionResponse>>;
    /**
     * @param selectionData - Initial selection data
     */
    init?: (selectionData?: CheckoutApi.Response<CheckoutApi.SelectionResponse>) => Promise<void>;
    loginCustomer?: (email: string, password: string) => Promise<CheckoutApi.Response<CheckoutApi.SelectionResponse>>;
    logoutCustomer?: () => Promise<CheckoutApi.Response<CheckoutApi.SelectionResponse>>;
    /**
     * @param data - All data to register to customer. See {@link https://docs.centra.com/swagger-ui/?api=CheckoutAPI#/6.%20customer%20handling/post_register | Centra docs} for more details.
     */
    registerCustomer?: (data: Record<string, unknown>) => Promise<CheckoutApi.Response<CheckoutApi.SelectionResponse>>;
    /**
     * @param line - The line id of the item to increase
     */
    removeCartItem?: (line: string) => Promise<CheckoutApi.Response<CheckoutApi.SelectionResponse>>;
    /**
     * @param voucher - The id of the voucher to add
     */
    removeVoucher?: (voucher: string) => Promise<CheckoutApi.Response<CheckoutApi.SelectionResponse>>;
    /**
     * @param i - The `i` query parameter provided by Centra when landing on the password reset page
     * @param id - The `id` query parameter provided by Centra when landing on the password reset page
     */
    resetCustomerPassword?: (i: string, id: string, newPassword: string) => Promise<CheckoutApi.Response<CheckoutApi.SelectionResponse>>;
    resetSelection?: () => Promise<void>;
    /**
     * @param linkUri - URI of the password reset page. Should not be a full url e.g. `account/password-reset`. Domain is set in CheckoutApi.
     */
    sendCustomerResetPasswordEmail?: (email: string, linkUri: string) => Promise<CheckoutApi.Response<CheckoutApi.SelectionResponse>>;
    submitPayment?: (data: Record<string, unknown>) => Promise<CheckoutApi.Response<CheckoutApi.Payment>>;
    updateCartItemQuantity?: (line: string, quantity: number) => Promise<CheckoutApi.Response<CheckoutApi.SelectionResponse>>;
    updateCartItemSize?: (cartItem: CheckoutApi.SelectionItem, item: string) => Promise<CheckoutApi.Response<CheckoutApi.SelectionResponse>>;
    updateCountry?: (country: string, data: {
        language: string;
    }) => Promise<CheckoutApi.Response<CheckoutApi.SelectionResponse>>;
    updateCustomer?: (data: Record<string, unknown>) => Promise<CheckoutApi.Response<CheckoutApi.SelectionResponse>>;
    updateCustomerAddress?: (data: Record<string, unknown>) => Promise<CheckoutApi.Response<CheckoutApi.SelectionResponse>>;
    updateCustomerEmail?: (email: string) => Promise<CheckoutApi.Response<CheckoutApi.SelectionResponse>>;
    updateCustomerPassword?: (password: string, newPassword: string) => Promise<CheckoutApi.Response<CheckoutApi.SelectionResponse>>;
    updateLanguage?: (language: string) => Promise<CheckoutApi.Response<CheckoutApi.SelectionResponse>>;
    updatePaymentFields?: (data: Record<string, unknown>) => Promise<CheckoutApi.Response<CheckoutApi.SelectionResponse>>;
    updatePaymentMethod?: (paymentMethod: string) => Promise<CheckoutApi.Response<CheckoutApi.SelectionResponse>>;
    updateShippingMethod?: (shippingMethod: string) => Promise<CheckoutApi.Response<CheckoutApi.SelectionResponse>>;
    updateCampaignSite?: (uri: string) => Promise<CheckoutApi.Response<CheckoutApi.SelectionResponse>>;
}
type ContextProperties = CheckoutApi.SuccessResponse<CheckoutApi.SelectionResponse> & {
    apiUrl?: string;
    apiClient?: ApiClient;
};
declare const SELECTION_INITIAL_VALUE: CheckoutApi.SelectionResponse;
declare const CentraHandlersContext: react.Context<ContextMethods | null>;
declare const CentraSelectionContext: react.Context<ContextProperties | null>;
/**
 * React Context provider that is required to use the `useCentra` and `useCentraHandlers` hooks.
 * Provides state management and related handlers of the users current Centra selection via the Checkout API.
 * The handlers could be used for adding products to the selection and making purchases, for example.
 */
declare function CentraProvider(props: ProviderProps): react_jsx_runtime.JSX.Element;
/**
 * This hook returns the centra selection
 */
declare function useCentraSelection(): ContextProperties;
/**
 * This hook returns update handlers
 */
declare function useCentraHandlers(): ContextMethods;
/**
 * Returns the latest order receipt given a selection token
 */
declare function useCentraReceipt(token: string): CheckoutApi.Response<CheckoutApi.OrderCompleteResponse>;
/**
 * Returns the latest orders for the currently logged in user
 * @param from - Display orders from this index. Defaults to 0.
 * @param size - Display this many orders. Defaults lists all orders.
 */
declare function useCentraOrders(from?: number, size?: number, apiClient?: ApiClient): CheckoutApi.Response<CheckoutApi.OrdersResponse>;
declare function useCentraEvents(): CentraEvents;

export { CentraHandlersContext, CentraProvider, CentraSelectionContext, type ContextMethods, type ContextProperties, type ProviderProps, SELECTION_INITIAL_VALUE, useCentraEvents, useCentraHandlers, useCentraOrders, useCentraReceipt, useCentraSelection };
