UNPKG

@goodpath/react-chat-components

Version:

PubNub Chat Components is a development kit of React components that aims to help you to easily build Chat applications using PubNub infrastructure. It removes the complexicity of picking an adequate Chat engine, learning its APIs and dealing with its low

74 lines (73 loc) 1.96 kB
import { UUIDMetadataObject, ChannelMetadataObject, ObjectCustom } from "pubnub"; export declare type Themes = "light" | "dark" | "support" | "support-dark" | "event" | "event-dark"; export interface EmojiPickerElementProps { onEmojiSelect?: ({ native }: { native: any; }) => void; } export declare type ChannelEntity = ChannelMetadataObject<ObjectCustom>; export declare type UserEntity = UUIDMetadataObject<ObjectCustom>; export interface MessageEnvelope { channel?: string; message: MessagePayload | FilePayload; timetoken: string | number; messageType?: string | number; publisher?: string; uuid?: string; meta?: { [key: string]: unknown; }; actions?: { [type: string]: { [value: string]: Array<{ uuid: string; actionTimetoken: string | number; }>; }; }; } export interface MessagePayload { id: string; type?: string; text?: string; sender?: UUIDMetadataObject<ObjectCustom>; attachments?: Array<ImageAttachment | LinkAttachment>; createdAt?: string; [key: string]: unknown; } export interface FilePayload { message?: MessagePayload; file: FileAttachment; } export declare function isFilePayload(message: MessagePayload | FilePayload): message is FilePayload; export interface FileAttachment { id: string; name: string; url?: string; } export interface ImageAttachment { type: "image"; image: { source: string; }; } export interface LinkAttachment { type: "link"; description?: string; title?: string; icon?: { source: string; }; image: { source: string; }; provider?: { name: string; url: string; }; } export interface RetryOptions { maxRetries: number; timeout: number; exponentialFactor: number; }