@vchatcloud/react-ui-kit
Version:
VChatCloud UI Kit for react integration
40 lines (39 loc) • 1.64 kB
TypeScript
import { ExtendedMessage, PrivateRoomData, SessionType, VChatCloudAPIFile } from '../global.types';
import { Channel, VChatCloud } from '@vchatcloud/sdk';
type Store = {
instance?: VChatCloud;
email?: string;
channel?: Channel;
chattingLog: ExtendedMessage[];
fileList: VChatCloudAPIFile[];
translateClientKeyMap: Record<string, string>;
sessionType: SessionType;
privateRoom: PrivateRoomData;
};
type Action = {
/**
* 새 채팅방에 접속하고 store에 `channel`객체를 저장합니다.
* 채팅방에 접속 후 최근기록 20개를 받아와서 `chattingLog`에 집어넣습니다.
*
* @param instance `VChatCloud`객체
* @param user 접속할 유저 데이터
* @returns 채널 객체
*/
joinRoom: (instance: VChatCloud, user: Parameters<VChatCloud["joinChannel"]>[0]) => Promise<Channel>;
setInstance: (instance: VChatCloud) => void;
setEmail: (email?: string) => void;
setChannel: (channel: Channel) => void;
setChattingLog: (chattingLog: ExtendedMessage[]) => void;
addChattingLog: (message: ExtendedMessage) => void;
removeChattingLog: (uuid: string) => void;
updateChattingData: (message: ExtendedMessage) => void;
setTranslateUser: (data: {
clientKey: string;
language: string | undefined;
}) => void;
setSessionType: (sessionType: SessionType) => void;
setPrivateRoom: (data: PrivateRoomData) => void;
cleanUp: () => void;
};
declare const createVChatCloudStore: () => import('zustand').UseBoundStore<import('zustand').StoreApi<Store & Action>>;
export default createVChatCloudStore;