import { MessageModel, MessagePayload } from '@chatscope/chat-ui-kit-react'; import { AvatarPosition } from '@chatscope/chat-ui-kit-react/src/types/unions'; import { CSSProperties, ReactNode } from 'react'; declare global { interface Window { chatUIInstance: IChatUIInstance; } } export interface IMessageModel extends MessageModel { key: string; avatarPosition: AvatarPosition; avatarUrl: string; messageTraceId: string; isShowSeparator?: boolean; separatorContent?: string; } export type IMessageModelList = IMessageModel[]; export type AgreeType = 0 | 1 | -1; export interface IChatUiContext { feedbackReasonsList: string[]; } export interface IMessageListItem { avatarUrl?: string; avatarPosition?: AvatarPosition; isShowAvatar?: boolean; messageTraceId?: string; direction: 'incoming' | 'outgoing'; isTempMessage?: boolean; sentTime?: number; sentTimeFormat?: string; sender?: string; type?: 'text' | 'html' | 'image' | 'custom'; extendType?: 'feedback-container' | 'feedback-card'; isEnableListCollapse?: boolean; isShowSeparator?: boolean; separatorContent?: string; isAutoScrollToBottom?: boolean; template?: string; config?: ICardRenderConfig; payload?: MessagePayload; headerChildren?: ReactNode; agreeType?: AgreeType; defaultFeedbackType?: string; defaultFeedbackContent?: string; defaultFeedbackCanEdit?: boolean; isShowAgreeType?: boolean; isFeedbackDisabled?: boolean; onAgreeTypeChange?: (agreeType: AgreeType, detailInfo?: { type: string; reason: string; }) => void; onFeedbackCardSubmit?: (data: { type: string; reason: string; }) => void; info?: any; } export type IMessageList = IMessageListItem[]; export interface ICardRenderConfig { [key: string]: { type: 'text' | 'list' | 'image' | 'order' | 'welcomeList'; data: { content?: string; format?: 'b' | 'strong' | 'i' | 'em' | 'mark' | 'small' | 'del' | 'ins' | 'sub' | 'sup' | 'block' | 'h1' | 'h2' | 'h3' | 'h4' | 'h5' | 'h6' | 'br'; href?: string; detail?: ICardRenderConfig; }[]; }; } export type OnEvents = (params: { data: any; path: string; info: any; dataset: AnyObject; target: EventTarget; }) => void; export interface ISendButtonProps { image?: string; size?: [string, string]; } export interface IChatUIInstance { setMessageList: (messageList: IMessageList) => void; addMessage: (message: IMessageListItem) => void; } export interface IChatUIProps { className?: string; style?: CSSProperties; messageList?: IMessageList; isShowAvatar?: boolean; attachButton?: boolean | ReactNode; sendButton?: boolean | ReactNode; isAutoScroll?: boolean; disabled?: boolean; sendDisabled?: boolean; attachDisabled?: boolean; feedbackReasonsList?: string[]; attachType?: 'file'; incomingAvatarUrl?: string; outgoingAvatarUrl?: string; inputToolbox?: ReactNode; sendDirection?: IMessageListItem['direction']; sendButtonProps?: ISendButtonProps; timeFormat?: string; messageInputType?: 'default' | 'advanced'; messageInputHeader?: ReactNode; messageInputFooter?: ReactNode; getChatUIInstance?: (params: IChatUIInstance) => void; onTextClick?: OnEvents; onTextMouseOver?: OnEvents; onTextMouseOut?: OnEvents; onSend?: (data: string) => boolean | void | Promise; onAttachClick?: () => void; } export interface IHelmetProps extends ISendButtonProps { messageInputType: IChatUIProps['messageInputType']; }