UNPKG

@cometchat/chat-uikit-react

Version:

Ready-to-use Chat UI Components for React(Javascript/Web)

283 lines (282 loc) 9.19 kB
import { CallingExtension } from "../components/Calling/CallingExtension"; import { ExtensionsDataSource } from "../components/Extensions/ExtensionsDataSource"; /** * Represents the settings required to initialize the CometChat SDK. * This class holds various configuration options, such as app credentials, socket connection settings, and feature toggles. * * @class UIKitSettings */ export declare class UIKitSettings { /** * Unique ID for the app, available on the CometChat dashboard. * @type {string} */ readonly appId?: string; /** * Region for the app, such as "us" or "eu". * @type {string} */ readonly region?: string; /** * Sets the subscription type for presence. * @type {string} */ readonly subscriptionType?: string; /** * Configures WebSocket connections. When set to true, establishes connection automatically on app initialization. * @type {boolean} * @default true */ readonly autoEstablishSocketConnection?: boolean; /** * Authentication key for the app, available on the CometChat dashboard. * @type {string} */ readonly authKey?: string; /** * Token representing the device, used for push notifications. * @type {string} */ readonly deviceToken?: string; /** * API key for Google services. * @type {string} */ readonly googleApiKey?: string; /** * Flag to disable the calling feature. * @type {boolean} * @default false */ readonly disableCalling: boolean; /** * Subscribes to user presence for users having the specified roles. * @type {string[]} */ readonly roles?: string[]; /** * Custom admin URL, used instead of the default admin URL for dedicated deployments. * @type {string} */ readonly adminHost?: string; /** * Custom client URL, used instead of the default client URL for dedicated deployments. * @type {string} */ readonly clientHost?: string; /** * Data source for managing UI extensions. * @type {ExtensionsDataSource[]} */ readonly extensions?: ExtensionsDataSource[]; /** * Data source for managing calls. * @type {ExtensionsDataSource} */ readonly callingExtension?: CallingExtension; /** * Private constructor to initialize the settings using the provided builder. * @param {UIKitSettingsBuilder} builder - The builder instance containing the settings configuration. */ private constructor(); /** * Creates an instance of UIKitSettings from the provided builder. * @param {UIKitSettingsBuilder} builder - The builder instance containing the settings configuration. * @returns {UIKitSettings} A new instance of UIKitSettings. */ static fromBuilder(builder: UIKitSettingsBuilder): UIKitSettings; /** * Retrieves the app ID. * @returns {string} The unique ID of the app. */ getAppId(): string; /** * Retrieves the region. * @returns {string} The region of the app. */ getRegion(): string; /** * Retrieves the roles for presence subscription. * @returns {string[]} The list of roles subscribed to presence. */ getRoles(): string[]; /** * Retrieves the subscription type for presence. * @returns {string} The subscription type. */ getSubscriptionType(): string; /** * Retrieves the authentication key. * @returns {string} The authentication key. */ getAuthKey(): string; /** * Checks if auto-establish socket connection is enabled. * @returns {boolean} True if auto-establish is enabled, otherwise false. */ isAutoEstablishSocketConnection(): boolean; /** * Retrieves the custom admin host URL. * @returns {string} The admin host URL. */ getAdminHost(): string; /** * Retrieves the custom client host URL. * @returns {string} The client host URL. */ getClientHost(): string; /** * Retrieves the list of UI extensions. * @returns {ExtensionsDataSource[]} The list of UI extensions. */ getExtensions(): ExtensionsDataSource[]; /** * Retrieves the calling extension. * @returns {ExtensionsDataSource[]} */ getCallsExtension(): ExtensionsDataSource; } export declare class UIKitSettingsBuilder { /** * Unique ID for the app, available on the CometChat dashboard. * @type {string} */ appId?: string; /** * Region for the app, such as "us" or "eu". * @type {string} */ region?: string; /** * Sets the subscription type for presence. * @type {string} */ subscriptionType?: string; /** * Subscribes to user presence for users having the specified roles. * @type {string[]} */ roles?: string[]; /** * Configures WebSocket connections. * @type {boolean} */ autoEstablishSocketConnection?: boolean; /** * Authentication key for the app, available on the CometChat dashboard. * @type {string} */ authKey?: string; /** * Token representing the device, used for push notifications. * @type {string} */ deviceToken?: string; /** * API key for Google services. * @type {string} */ googleApiKey?: string; /** * Data source for managing UI extensions. * @type {ExtensionsDataSource[]} */ extensions?: ExtensionsDataSource[]; /** * Data source for managing calls extension. * @type {CallingExtension} */ callingExtension?: CallingExtension; /** * Flag to disable the calling feature. * @type {boolean} * @default false */ disableCalling: boolean; /** * Custom admin URL, used instead of the default admin URL for dedicated deployments. * @type {string} */ adminHost?: string; /** * Custom client URL, used instead of the default client URL for dedicated deployments. * @type {string} */ clientHost?: string; /** * Builds and returns an instance of UIKitSettings. * @returns {UIKitSettings} A new instance of UIKitSettings with the specified configuration. */ build(): UIKitSettings; /** * Sets the app ID. * @param {string} appId - The unique ID of the app. * @returns {UIKitSettingsBuilder} The builder instance. */ setAppId(appId: string): UIKitSettingsBuilder; /** * Sets the region. * @param {string} region - The region of the app. * @returns {UIKitSettingsBuilder} The builder instance. */ setRegion(region: string): UIKitSettingsBuilder; /** * Subscribes to presence updates for all users. * @returns {UIKitSettingsBuilder} The builder instance. */ subscribePresenceForAllUsers(): UIKitSettingsBuilder; /** * Subscribes to presence updates for specific roles. * @param {string[]} roles - The roles to subscribe to. * @returns {UIKitSettingsBuilder} The builder instance. */ subscribePresenceForRoles(roles: string[]): UIKitSettingsBuilder; /** * Subscribes to presence updates for specific roles. * @param {string[]} roles - The roles to subscribe to. * @returns {UIKitSettingsBuilder} The builder instance. */ subscribePresenceForFriends(): UIKitSettingsBuilder; /** * Sets the roles for presence subscription. * @param {string[]} roles - The roles to subscribe to. * @returns {UIKitSettingsBuilder} The builder instance. */ setRoles(roles: string[]): UIKitSettingsBuilder; /** * Enables or disables the auto-establish socket connection. * @param {boolean} autoEstablishSocketConnection - True to enable, false to disable. * @returns {UIKitSettingsBuilder} The builder instance. */ setAutoEstablishSocketConnection(autoEstablishSocketConnection: boolean): UIKitSettingsBuilder; /** * Sets the authentication key. * @param {string} authKey - The authentication key. * @returns {UIKitSettingsBuilder} The builder instance. */ setAuthKey(authKey: string): UIKitSettingsBuilder; /** * Sets the custom admin host URL. * @param {string} adminHost - The admin host URL. * @returns {UIKitSettingsBuilder} The builder instance. */ setAdminHost(adminHost: string): UIKitSettingsBuilder; /** * Sets the custom client host URL. * @param {string} clientHost - The client host URL. * @returns {UIKitSettingsBuilder} The builder instance. */ setClientHost(clientHost: string): UIKitSettingsBuilder; /** * Sets the list of UI extensions. * @param {ExtensionsDataSource[]} extensions - The list of UI extensions. * @returns {UIKitSettingsBuilder} The builder instance. */ setExtensions(extensions: ExtensionsDataSource[]): UIKitSettingsBuilder; /** * Sets the calling extension. * @param {ExtensionsDataSource} calling. * @returns {UIKitSettingsBuilder} The builder instance. */ setCallsExtension(callingExtension: CallingExtension): UIKitSettingsBuilder; }