@trycourier/courier-js
Version:
A browser-safe API wrapper
81 lines (80 loc) • 2.67 kB
TypeScript
import { CourierClient, CourierProps } from '../client/courier-client';
import { AuthenticationListener } from '../shared/authentication-listener';
/**
* Courier is a singleton class that manages a shared Courier client instance and other resources.
* UI components will automatically syncronize with this instance.
* If you only need to call the Courier api, you should consider using the CourierClient directly.
*/
export declare class Courier {
/**
* The unique identifier for the Courier instance
*/
readonly id: string;
/**
* The shared Courier instance
*/
private static instance;
/**
* The Courier client instance
*/
private instanceClient?;
/**
* Client's name reported in the user agent to the Courier backend.
*
* Other Courier SDKs calling APIs though the courier-js should set this property.
*/
courierUserAgentName?: string;
/**
* Client's version reported in the user agent to the Courier backend.
*
* Other Courier SDKs calling APIs though the courier-js should set this property.
*/
courierUserAgentVersion?: string;
/**
* The pagination limit (min: 1, max: 100)
*/
private _paginationLimit;
get paginationLimit(): number;
set paginationLimit(value: number);
/**
* Get the Courier client instance
* @returns The Courier client instance or undefined if not signed in
*/
get client(): CourierClient | undefined;
/**
* The authentication listeners
*/
private authenticationListeners;
/**
* Get the shared Courier instance
* @returns The shared Courier instance
*/
static get shared(): Courier;
/**
* Sign in to Courier
* @param options - The options for the Courier client
*/
signIn(props: CourierProps): void;
/**
* Sign out of Courier
*/
signOut(): void;
/**
* Register a callback to be notified of authentication state changes
* @param callback - Function to be called when authentication state changes
* @returns AuthenticationListener instance that can be used to remove the listener
*/
addAuthenticationListener(callback: (props: {
userId?: string;
}) => void): AuthenticationListener;
/**
* Unregister an authentication state change listener
* @param listener - The AuthenticationListener instance to remove
*/
removeAuthenticationListener(listener: AuthenticationListener): void;
/**
* Notify all authentication listeners
* @param props - The props to notify the listeners with
*/
private notifyAuthenticationListeners;
}