UNPKG

autumn-js

Version:

Autumn JS Library

87 lines (82 loc) 2.12 kB
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", Multiple = "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 CustomerInvoice { product_ids: string[]; stripe_id: string; status: string; total: number; currency: string; created_at: number; } export type { CustomerData as C, CustomerExpandOption as a, Customer as b, CustomerProduct as c, CustomerFeature as d, CustomerInvoice as e };