import { Result } from "./Result"; import { Observable } from "./Observable"; export interface MountOptions { credentials?: Credentials; externalToken?: { getToken: () => Promise; onError?: (e: string) => void; }; nonce?: string; } export interface MessengerApi extends MessengerActionsApi, MessengerStateApi { } export interface MessengerStateApi { state$: Observable; getState(): State; } export interface MessengerActionsApi { /** * Control the visibility of messenger features. */ setVisibility(conf: VisibilityConfiguration): Promise>; /** * Delete contact's session and restart messenger. */ logout(): Promise>; /** * Simulate as if the contact clicked the messenger button. * * This is a no-op if it's already maximized. */ maximize(): Promise>; /** * Simulate as if the contact clicked the minimize button. */ minimize(): Promise>; /** * Set custom data. */ setCustomData(data: Record): Promise>; /** * Set contact info. */ setContactInfo(data: Partial): Promise>; /** * Experimental. */ __unstableStartConversation(): Promise>; /** * Experimental. */ __unstableStartConversationWithOperator(operatorId: number): Promise>; /** * Experimental. * Opens a conversation by id. */ __unstableOpenConversation(id: number): Promise>; /** * Experimental. */ __unstableSetRegistration(enabled: boolean): Promise>; /** * Experimental. */ __unstableSetProactive(enabled: boolean): Promise>; } export interface State { state: MessengerState; conversations: Conversation[]; contact: ContactInfo; } export declare enum MessengerState { Hidden = "hidden", Minimized = "minimized", Maximized = "maximized" } export interface Conversation { id: number; unread: Message[]; __unstableMessages: Message[]; } export interface ContactInfo { name: string | null; email: string | null; phone_number: string | null; mobile_number: string | null; company: string | null; external_customer_id: string | null; city: string | null; street: string | null; country: string | null; salutation: "mr" | "ms" | "pr" | "prof" | null; gender: "m" | "f" | "d" | null; custom_field_data: Record; instagram_username: string | null; } export interface Message { id: string; } /** * @deprecated */ export declare enum EnableRegistration { Normal = 0, Registration = 1, Proactive = 2 } export interface VisibilityConfiguration { main: boolean; button: boolean; notifications: boolean; } export interface Credentials { token: string; uuid: string; }