UNPKG

@connectycube/chat-widget

Version:

A React component that seamlessly integrates ConnectyCube's real-time chat capabilities into your web applications. This widget offers an out-of-the-box solution for embedding chat features—such as instant messaging, user presence, and file sharing—withou

48 lines (47 loc) 3.31 kB
import { Config, Users, Auth, Chat, EmptyResponse, PushNotifications } from 'connectycube/types'; import { PushSubscriptionData } from './notifications'; export declare enum SIGNAL { UPDATE_USER = "user/UPDATE" } export declare enum USER_STATUS { AVAILABLE = "Available", BUSY = "Busy", AWAY = "Away" } export declare const SESSION_KEY = "@connectycube/chat-widget:session"; export declare const initConnectyCubeSDK: (credentials: Config.Credentials, config?: Config.Options) => void; export declare const tryReuseSession: (userName?: string, userId?: string, userAvatar?: string, userProfileLink?: string) => Promise<boolean>; export declare const restoreSession: () => Promise<Auth.Session | null>; export declare const createUserSession: (login: string, password: string) => Promise<Auth.Session>; export declare const createSession: (userId?: string, userName?: string, userAvatar?: string, userProfileLink?: string) => Promise<Auth.Session | null>; export declare const destroyUserSession: () => Promise<void>; export declare const userSignup: (login: string, password: string, name?: string, externalId?: string, userAvatar?: string, userProfileLink?: string) => Promise<Auth.Session>; export declare const upsertConnectyCubeConfig: (config?: Config.Options) => void; export declare const autoconnect: (connect: (credentials: Chat.ConnectionParams) => Promise<boolean>, session?: Auth.Session | null) => Promise<boolean>; export declare const updateUserProfileIfNeeded: (session: Auth.Session, name?: string, externalId?: string, avatar?: string, userProfileLink?: string) => Promise<Auth.Session>; export declare const setSessionToLocalStorage: (session: Auth.Session) => void; export declare const getSessionFromLocalStorage: () => Auth.Session | null; export declare const clearSessionInLocalStorage: () => void; export declare const getCurrentUser: () => Users.User | null | undefined; export declare const parseUserCustomData: (user: Users.User | null | undefined) => { [key: string]: any; } | null; export declare const getUserSettings: () => { [key: string]: any; } | null; export declare const getUserStatus: (user: Users.User | null | undefined) => USER_STATUS; export declare const updateUserSettings: (settings: { [key: string]: any; }, onlyLocal?: boolean) => Promise<Users.User>; export declare const getSessionToken: () => string | null; export declare const getSessionUserId: () => number | null; export declare const isSessionExpired: () => boolean; export declare const isUserIdChanged: (userId?: string) => boolean; export declare const sha256: (str: string) => Promise<string>; export declare const getUserName: (user: Users.User | null | undefined, force?: boolean) => string; export declare const getPhotoUrl: (photoOrAvatar?: string | null) => string; export declare const generateConnectyCubeLogin: (userId?: string) => string; export declare const createUserReport: (reportedUserId: number, reason: string) => Promise<import("connectycube/types").Data.DataRecord>; export declare const subscribeToPushNotifications: (pushSubscriptionData?: PushSubscriptionData) => Promise<PushNotifications.Subscription | undefined>; export declare const unsubscribeFromPushNotifications: () => Promise<EmptyResponse[]>; export declare const isCallsSupported: boolean;