import * as react from 'react'; import * as react_jsx_runtime from 'react/jsx-runtime'; declare enum AppEnv { Sandbox = "sandbox", Live = "live" } declare enum ProductItemInterval { Minute = "minute", Hour = "hour", Day = "day", Week = "week", Month = "month", Quarter = "quarter", SemiAnnual = "semi_annual", Year = "year" } declare enum ProductStatus { Active = "active", Expired = "expired", Trialing = "trialing", Scheduled = "scheduled" } interface CustomerFeature { feature_id: string; unlimited?: boolean; interval?: ProductItemInterval | null; balance?: number; usage?: number; included_usage?: number; next_reset_at?: number; } interface CustomerProduct { id: string; name: string | null; group: string | null; status: ProductStatus; started_at: number; canceled_at: number | null; subscription_ids?: string[] | null; current_period_start?: number | null; current_period_end?: number | null; } interface Customer { autumn_id: string; created_at: number; env: AppEnv; id: string | null; name: string | null; email: string | null; fingerprint: string | null; stripe_id: string | null; products: CustomerProduct[]; add_ons: CustomerProduct[]; features: CustomerFeature[]; } interface CustomerData { name?: string; email?: string; fingerprint?: string; } interface BillingPortalResponse { customer_id: string; url: string; } interface AttachResult { checkout_url?: string; customer_id: string; product_ids: string[]; code: string; message: string; } interface EventResult { id: string; code: string; customer_id: string; feature_id?: string; event_name?: string; } interface EntitledBalance { feature_id: string; unlimited: boolean; usage_allowed: boolean; required_quantity: number | null; balance: number | null; } interface EntitledResult { customer_id: string; feature_id: string; code: string; allowed: boolean; balances: EntitledBalance[]; } interface AutumnError { message: string; code: string; } interface UseAutumnOptions { autoCreate?: boolean; } declare const useAutumn: (options?: UseAutumnOptions) => { customer: Customer | null; loading: boolean; error: AutumnError | null; attach: ({ productId }: { productId: string; }) => Promise; sendEvent: ({ featureId, value, }: { featureId: string; value: number; }) => Promise<{ data: null; error: AutumnError; } | { data: EventResult; error: null; }>; entitled: ({ featureId }: { featureId: string; }) => Promise<{ data: null; error: AutumnError; } | { data: EntitledResult; error: null; }>; openBillingPortal: () => Promise; }; interface UseCustomerProps { autoCreate?: boolean; customerData?: CustomerData; } declare const useCustomer: ({ autoCreate }: UseCustomerProps) => { customer: Customer | null; error: AutumnError | null; isLoading: boolean; }; interface AutumnContextParams { customerId: string; customerData?: CustomerData; } declare const AutumnProvider: ({ children, customerId, customerData, }: AutumnContextParams & { children?: React.ReactNode; }) => react_jsx_runtime.JSX.Element; declare const AutumnContext: react.Context; declare const useAutumnContext: () => AutumnContextParams; export { AutumnContext, type AutumnContextParams, AutumnProvider, type UseAutumnOptions, type UseCustomerProps, useAutumn, useAutumnContext, useCustomer };