UNPKG

autumn-js

Version:

Autumn JS Library

121 lines (116 loc) 3.31 kB
declare enum AppEnv { Sandbox = "sandbox", Live = "live" } declare const Infinite = "inf"; declare enum FreeTrialDuration { Day = "day" } declare enum UsageModel { Prepaid = "prepaid", PayPerUse = "pay_per_use" } type UsageModelType = "prepaid" | "pay_per_use"; declare enum ProductItemInterval { Minute = "minute", Hour = "hour", Day = "day", Week = "week", Month = "month", Quarter = "quarter", SemiAnnual = "semi_annual", Year = "year", Multiple = "multiple" } type ProductItemIntervalType = "minute" | "hour" | "day" | "week" | "month" | "quarter" | "semi_annual" | "year" | "multiple"; declare enum ProductStatus { Active = "active", Expired = "expired", Trialing = "trialing", Scheduled = "scheduled", PastDue = "past_due" } type CustomerExpandOption = "invoices" | "rewards" | "trials_used" | "entities"; interface CustomerFeature { id: string; name: string; unlimited?: boolean; interval?: ProductItemInterval | null; balance?: number; usage?: number; included_usage?: number; next_reset_at?: number | null; breakdown?: { interval: ProductItemInterval; 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; trial_ends_at?: number; entity_id?: string; is_add_on: boolean; is_default: boolean; } interface Customer { id: string | null; created_at: number; name: string | null; email: string | null; fingerprint: string | null; stripe_id: string | null; env: AppEnv; metadata: Record<string, any>; products: CustomerProduct[]; features: Record<string, CustomerFeature>; invoices?: CustomerInvoice[]; } interface CustomerData { name?: string; email?: string; fingerprint?: string; } interface GetCustomerParams { expand?: CustomerExpandOption[]; } interface CreateCustomerParams { id?: string | null; email?: string | null; name?: string | null; fingerprint?: string | null; metadata?: Record<string, any>; expand?: CustomerExpandOption[]; } interface UpdateCustomerParams { id?: string | null; name?: string | null; email?: string | null; fingerprint?: string | null; } interface BillingPortalParams { return_url?: string; } interface BillingPortalResponse { customer_id: string; url: string; } interface CustomerInvoice { product_ids: string[]; stripe_id: string; status: string; total: number; currency: string; created_at: number; } export { AppEnv as A, type BillingPortalParams as B, type CustomerData as C, FreeTrialDuration as F, type GetCustomerParams as G, Infinite as I, type ProductItemIntervalType as P, type UpdateCustomerParams as U, type Customer as a, type CreateCustomerParams as b, type BillingPortalResponse as c, type CustomerProduct as d, type CustomerFeature as e, type CustomerInvoice as f, UsageModel as g, type UsageModelType as h };