courier-vue-embedded
Version:
Vue 3 wrapper for trycourier
48 lines (46 loc) • 1.23 kB
TypeScript
import { InboxSdk } from './inbox';
import { PreferencesSdk } from './preferences';
import { ToastSdk } from './toast';
export interface ICourierConfig {
tenantId?: string;
apiUrl?: string;
authorization?: string;
brandId?: string;
clientKey?: string;
inboxApiUrl?: string;
onRouteChange?: (route: string) => void;
components?: {
inbox?: any;
toast?: any;
preferences?: any;
};
unsubscribePage?: {
topicId: string;
preferencePageUrl: string;
list?: string;
};
initOnLoad?: boolean;
userId?: string;
userSignature?: string;
wsOptions?: any;
preferencePageDraftMode?: boolean;
}
export interface EventPayload<T = unknown> {
payload: T;
}
export interface CourierSDK {
init: (config: ICourierConfig) => void;
on: <T = unknown>(action: string, event: (payload: EventPayload<T>) => void) => void;
toast: ToastSdk;
inbox: InboxSdk;
preferences: PreferencesSdk;
transport: any;
renewSession: (token: string) => void;
}
declare global {
interface Window {
courier: CourierSDK;
courierConfig: ICourierConfig;
courierAsyncInit?: () => void | Array<() => void>;
}
}