autumn-js
Version:
Autumn JS Library
78 lines (75 loc) • 3.07 kB
TypeScript
import { C as CustomerData, a as CustomerExpandOption, b as CreateCustomerParams, E as ExpandedCustomer } from '../cusTypes-B1wzqLIi.js';
import { P as Product } from '../prodTypes-C4aZSZfO.js';
import { E as EventsListResponse } from '../eventTypes-5iJYcv30.js';
import { I as IAutumnClient, a as AutumnPromise } from '../ReactAutumnClient-CLd8_4oB.js';
import { EventsListParams, EventAggregationParams, EventAggregationResponse } from './types/clientAnalyticsTypes.js';
import 'zod/v4';
import '../genTypes-BouhbtKm.js';
import '../attachTypes-eg914-6v.js';
import '../error-DHbclCVh.js';
interface ErrorResponse {
message: string;
code: string;
}
type OmitCustomerType = "id" | "name" | "email" | "fingerprint" | "customer_id";
interface ConvexAutumnClientConfig {
convexApi: any;
customerData?: CustomerData;
headers?: Record<string, string>;
getBearerToken?: () => Promise<string | null>;
convex: any;
suppressLogs?: boolean;
}
declare class ConvexAutumnClient implements IAutumnClient {
protected readonly convexApi: any;
protected readonly convex: any;
readonly customerData?: CustomerData;
readonly headers?: Record<string, string>;
readonly backendUrl?: string;
readonly prefix: string;
readonly getBearerToken?: () => Promise<string | null>;
readonly suppressLogs: boolean;
detectCors(): Promise<{
valid: boolean;
includeCredentials: boolean | undefined;
}>;
shouldIncludeCredentials(): Promise<boolean>;
getHeaders(): Promise<{
"Content-Type": string;
}>;
handleFetch(): Promise<void>;
post(): Promise<void>;
get(): Promise<void>;
delete(): Promise<void>;
constructor({ convexApi, customerData, headers, getBearerToken, convex, suppressLogs, }: ConvexAutumnClientConfig);
createCustomer<const T extends readonly CustomerExpandOption[] = readonly []>(params: Omit<CreateCustomerParams<T>, "id" | "data"> & {
errorOnNotFound?: boolean;
}): AutumnPromise<ExpandedCustomer<T>>;
attach: (args: any) => Promise<any>;
checkout: (args: any) => Promise<any>;
cancel: (args: any) => Promise<any>;
check: (args: any) => Promise<any>;
track: (args: any) => Promise<any>;
openBillingPortal: (args: any) => Promise<any>;
setupPayment: (args: any) => Promise<any>;
query: (args: any) => Promise<any>;
entities: {
create: (args: any) => Promise<any>;
get: (entityId: string, args: any) => Promise<any>;
delete: (args: any) => Promise<any>;
};
referrals: {
createCode: (args: any) => Promise<any>;
redeemCode: (args: any) => Promise<any>;
};
products: {
list: () => AutumnPromise<{
list: Product[];
}>;
};
events: {
list: (params: EventsListParams) => AutumnPromise<EventsListResponse>;
aggregate: (params: EventAggregationParams) => AutumnPromise<EventAggregationResponse>;
};
}
export { ConvexAutumnClient, type ConvexAutumnClientConfig, type ErrorResponse, type OmitCustomerType };