/// import FormData from 'form-data'; import { AscDesc, ExtendableGenerics, DefaultGenerics, OwnUserResponse, UserResponse, MessageResponse, FormatMessageResponse } from './types'; import { AxiosRequestConfig } from 'axios'; /** * logChatPromiseExecution - utility function for logging the execution of a promise.. * use this when you want to run the promise and handle errors by logging a warning * * @param {Promise} promise The promise you want to run and log * @param {string} name A descriptive name of what the promise does for log output * */ export declare function logChatPromiseExecution(promise: Promise, name: string): void; export declare const sleep: (m: number) => Promise; export declare function isFunction(value: Function | T): value is Function; export declare const chatCodes: { TOKEN_EXPIRED: number; WS_CLOSED_SUCCESS: number; }; export declare function isOwnUser(user?: OwnUserResponse | UserResponse): user is OwnUserResponse; export declare function isOwnUserBaseProperty(property: string): boolean; export declare function addFileToFormData(uri: string | NodeJS.ReadableStream | Buffer | File, name?: string, contentType?: string): FormData; export declare function normalizeQuerySort>(sort: T | T[]): { direction: AscDesc; field: keyof T; }[]; /** * retryInterval - A retry interval which increases acc to number of failures * * @return {number} Duration to wait in milliseconds */ export declare function retryInterval(numberOfFailures: number): number; export declare function randomId(): string; export declare function generateUUIDv4(): string; export declare function convertErrorToJson(err: Error): Record; /** * isOnline safely return the navigator.online value for browser env * if navigator is not in global object, it always return true */ export declare function isOnline(): boolean; /** * listenForConnectionChanges - Adds an event listener fired on browser going online or offline */ export declare function addConnectionEventListeners(cb: (e: Event) => void): void; export declare function removeConnectionEventListeners(cb: (e: Event) => void): void; export declare const axiosParamsSerializer: AxiosRequestConfig['paramsSerializer']; /** * formatMessage - Takes the message object. Parses the dates, sets __html * and sets the status to received if missing. Returns a message object * * @param {MessageResponse} message a message object * */ export declare function formatMessage(message: MessageResponse): FormatMessageResponse; export declare function addToMessageList(messages: Array>, message: FormatMessageResponse, timestampChanged?: boolean, sortBy?: 'pinned_at' | 'created_at', addIfDoesNotExist?: boolean): FormatMessageResponse[]; //# sourceMappingURL=utils.d.ts.map