UNPKG

@ethora/chat-component

Version:

1. npm create vite@latest 2. select name of project, select type (react/js) 3. cd project-name 4. npm i 5. npm i @ethora/chat-component 6. go to file src/App.tsx and replace it with this code

108 lines (107 loc) 2.97 kB
import { User } from './user.model'; import { xmppSettingsInterface } from './xmpp.model'; import { PartialRoomWithMandatoryKeys, ConfigRoom } from './room.model'; import { MessageBubble } from './message.model'; import { Iso639_1Codes } from './language.model'; import { default as React } from 'react'; export interface FBConfig { apiKey: string; authDomain: string; projectId: string; storageBucket: string; messagingSenderId: string; appId: string; } export interface IConfig { disableHeader?: boolean; disableMedia?: boolean; colors?: { primary: string; secondary: string; }; googleLogin?: { enabled: boolean; firebaseConfig: FBConfig; }; jwtLogin?: { token: string; enabled: boolean; handleBadlogin?: React.ReactElement; }; userLogin?: { enabled: boolean; user: User | null; }; customLogin?: { enabled: boolean; loginFunction: () => Promise<User | null>; }; baseUrl?: string; customAppToken?: string; xmppSettings?: xmppSettingsInterface; disableRooms?: boolean; defaultLogin?: boolean; disableInteractions?: boolean; chatHeaderBurgerMenu?: boolean; forceSetRoom?: boolean; roomListStyles?: React.CSSProperties; chatRoomStyles?: React.CSSProperties; setRoomJidInPath?: boolean; disableRoomMenu?: boolean; defaultRooms?: ConfigRoom[]; refreshTokens?: { enabled: boolean; refreshFunction?: () => Promise<{ accessToken: string; refreshToken?: string; } | null>; }; backgroundChat?: { color?: string; image?: string | File; }; bubleMessage?: MessageBubble; headerLogo?: string | React.ReactElement; headerMenu?: () => void; headerChatMenu?: () => void; customRooms?: { rooms: PartialRoomWithMandatoryKeys[]; disableGetRooms?: boolean; singleRoom: boolean; }; translates?: { enabled: boolean; translations?: Iso639_1Codes; }; disableRoomConfig?: boolean; disableProfilesInteractions?: boolean; disableUserCount?: boolean; clearStoreBeforeInit?: boolean; disableSentLogic?: boolean; initBeforeLoad?: boolean; newArch?: boolean; qrUrl?: string; secondarySendButton?: { enabled: boolean; messageEdit: string; label?: React.ReactNode; buttonStyles?: React.CSSProperties; hideInputSendButton?: boolean; overwriteEnterClick?: true; }; enableRoomsRetry?: { enabled: boolean; helperText: string; }; disableNewChatButton?: boolean; chatHeaderAdditional?: { enabled: boolean; element: any; }; botMessageAutoScroll?: boolean; messageTextFilter?: { enabled: boolean; filterFunction: (text: string) => string; }; disableTypingIndicator?: boolean; }