react-waitlist
Version:
A customizable waitlist form component for React applications
69 lines (68 loc) • 1.93 kB
TypeScript
/**
* Contact data for Resend API
*/
export interface ResendContact {
/** Email address */
email: string;
/** First name */
firstName?: string;
/** Last name */
lastName?: string;
/** Whether the contact is unsubscribed */
unsubscribed?: boolean;
/** Additional metadata */
metadata?: Record<string, any>;
}
/**
* Response from Resend API
*/
export interface ResendResponse {
/** ID of the created/updated contact */
id: string;
/** Email of the contact */
email: string;
/** First name of the contact */
firstName?: string;
/** Last name of the contact */
lastName?: string;
/** Whether the contact is unsubscribed */
unsubscribed: boolean;
/** Created at timestamp */
createdAt: string;
/** Updated at timestamp */
updatedAt: string;
}
/**
* Hook options
*/
export interface UseResendAudienceOptions {
/** Resend API key */
apiKey?: string;
/** Audience ID */
audienceId: string;
/** Proxy endpoint for client-side usage */
proxyEndpoint?: string;
}
/**
* Hook return value
*/
export interface UseResendAudienceReturn {
/** Add a contact to the audience */
addContact: (contact: ResendContact) => Promise<ResendResponse>;
/** Update a contact in the audience */
updateContact: (id: string, contact: Partial<ResendContact>) => Promise<ResendResponse>;
/** Remove a contact from the audience */
removeContact: (id: string) => Promise<void>;
/** Get a contact from the audience */
getContact: (id: string) => Promise<ResendResponse>;
/** List contacts in the audience */
listContacts: () => Promise<ResendResponse[]>;
/** Loading state */
loading: boolean;
/** Error state */
error: Error | null;
}
/**
* Hook for Resend audience integration
*/
export declare const useResendAudience: (options: UseResendAudienceOptions) => UseResendAudienceReturn;