import { IAppearanceConfig } from '../../types/checkout.types'; import { BusinessEntityType, CustomerType, CustomerVerificationStatus, ICustomer } from '../../types/customer.types'; import { ZenskarElementInstance } from '../../types/elements'; /** * The main context type for Zenskar provider * Contains all data and methods needed by child components * * @interface ZenskarContextType */ export type ZenskarContextType = { /** Customer verification status */ customerVerificationStatus: CustomerVerificationStatus; /** * Indicates whether the customer is a guest customer. * When true, the customer is a guest customer and does not have a customer ID. * Use this to show guest customer specific UI. */ isGuestCustomer: boolean; /** Organization ID from Zenskar dashboard */ organisationId: string; /** Customer ID for the current user */ customerId?: CustomerType; /** Business entity ID - automatically fetched, may be empty if not loaded */ businessEntityId: BusinessEntityType; /** Full customer object with all details - may be empty object if not loaded */ customer?: ICustomer; /** Optional theme configuration for styling */ theme?: IAppearanceConfig | null; /** Registry of all mounted Zenskar elements */ elements: Map; /** * Register a new element with the provider * Called automatically by Zenskar elements when they mount * * @param id - Unique identifier for the element * @param element - The element instance to register */ registerElement: (id: string, element: ZenskarElementInstance) => void; /** * Unregister an element from the provider * Called automatically by Zenskar elements when they unmount * * @param id - Unique identifier of the element to unregister */ unregisterElement: (id: string) => void; /** * Indicates whether the Zenskar provider has finished loading and is ready for use. * When true, all Zenskar context methods, elements, and hooks are available to child components. * Use this flag to ensure your components only access Zenskar features after initialization is complete. */ isZenskarLoaded: boolean; /** * Indicates whether the customer data is currently being loaded. * Use this to show loading states in your components. */ isLoading: boolean; /** * Contains any error that occurred during customer data fetching. * Use this to show error states or implement retry logic. */ error: Error | null; /** * Indicates whether Zenskar is in a degraded state due to API failures. * When true, basic functionality is available but some features may be limited. */ isDegraded: boolean; customerError: Error | null; sessionError: Error | null; isSessionLoading: boolean; isTestMode: boolean; }; /** * Hook to access the Zenskar context * * @throws {Error} If used outside of ZenskarProvider * @returns {ZenskarContextType} The Zenskar context * * @example * ```tsx * const { customerId, businessEntityId } = useZenskarProvider() * ``` */ export declare const useZenskarProvider: () => ZenskarContextType; export declare const ZenskarContextProvider: import('react').Provider;