import type { InjectionKey, Ref, VNodeChild } from 'vue'; import type { MergedTheme } from '../../_mixins'; import type { AvatarProps } from '../../avatar'; import type { BadgeProps } from '../../badge'; import type { ButtonProps } from '../../button'; import type { EmptyProps } from '../../empty'; import type { IconProps } from '../../icon'; import type { InputProps } from '../../input'; import type { UploadProps } from '../../upload'; import type { OnChangePayload } from '../../upload/src/interface'; import type { ChatTheme } from '../styles'; export declare enum MessageStatus { READ = "read", UNREAD = "unread", PENDING = "pending", RETRY = "retry", INCOME = "income" } export declare enum ChatMessageType { TEXT = "text", FILE = "file", MARK = "mark" } export declare enum ChatAttachmentStatus { PENDING = "pending", UPLOADING = "uploading", FINISHED = "finished", ERROR = "error" } export declare enum ChatMarkType { SYSTEM = "system", EVENT = "event", DIVIDER = "divider" } export declare enum ChatBubbleActionKey { EDIT = "edit", COPY = "copy", DELETE = "delete" } export type ChatId = string | number | symbol; export interface ChatListItemData { id: ChatId; disabled?: boolean; title?: string | (() => VNodeChild); subtitle?: string | (() => VNodeChild); datetime?: string | number | Date | (() => VNodeChild); unreadCount?: number; messageStatus?: MessageStatus; lastMessageIsOwn?: boolean; avatarProps?: Partial; avatar?: string | (() => VNodeChild); } export interface ChatMessageMark { id: ChatId; type: ChatMessageType.MARK; } export interface ChatMessageText { id: ChatId; type: ChatMessageType.TEXT; isOwn: boolean; content: string | (() => VNodeChild); timestamp?: string | number | Date | (() => VNodeChild); status?: MessageStatus; } export interface ChatMessageFile { id: ChatId; type: ChatMessageType.FILE; isOwn: boolean; content?: string | (() => VNodeChild); timestamp?: string | number | Date | (() => VNodeChild); status?: MessageStatus; attachments: ChatAttachment[]; } export interface ChatMessageData { id: ChatId; type?: ChatMessageType; isOwn?: boolean; content?: string; timestamp?: string | number | Date | (() => VNodeChild); status?: MessageStatus; date?: string; attachment?: ChatAttachment[]; uploadProps?: Partial; senderAvatar?: string | (() => VNodeChild); senderName?: string | (() => VNodeChild); markType?: ChatMarkType; } export interface ChatMessageProps { id: ChatId; type?: ChatMessageType; isOwn?: boolean; content?: string; timestamp?: string | number | Date | (() => VNodeChild); status?: MessageStatus; attachment?: ChatAttachment[]; uploadProps?: Partial; senderAvatar?: string | (() => VNodeChild); senderName?: string | (() => VNodeChild); disabled?: boolean; } export interface ChatListItemProps { id: ChatId; disabled?: boolean; title?: string | (() => VNodeChild); subtitle?: string | (() => VNodeChild); datetime?: string | number | Date | (() => VNodeChild); unreadCount?: number; messageStatus?: MessageStatus; lastMessageIsOwn?: boolean; avatarProps?: Partial; avatar?: string | (() => VNodeChild); selectedChatId?: ChatId; } export interface ChatMarkProps { id: ChatId; type?: ChatMarkType; disabled?: boolean; } export interface ChatMarkSlots { default?: () => VNodeChild; } export interface ChatAttachment { id: ChatId; type: ChatMessageType.FILE; name: string; url: string; size?: number | string; thumbnail?: string | (() => VNodeChild); preview?: string | (() => VNodeChild); status?: ChatAttachmentStatus; percentage?: number; uploadProps?: Partial; } export interface ChatProps { chatItems?: ChatListItemData[]; selectedChatId?: ChatId; messages?: ChatMessageData[]; disabled?: boolean; listEmptyProps?: Partial; listHeaderTitle?: string | (() => VNodeChild); listHeaderActions?: Array<() => VNodeChild>; listHeaderButtonProps?: Partial; listHeaderIconProps?: Partial; listItemAvatarProps?: Partial; listItemBadgeProps?: Partial; headerTitle?: string | (() => VNodeChild); headerActions?: Array<() => VNodeChild>; showUnreadNotification?: boolean; unreadCount?: number; headerButtonProps?: Partial; headerIconProps?: Partial; headerShareButtonProps?: Partial; headerProfileButtonProps?: Partial; headerCloseButtonProps?: Partial; headerShareIconProps?: Partial; headerProfileIconProps?: Partial; messageSenderAvatarProps?: Partial; messageUploadProps?: Partial; messageButtonProps?: Partial; footerInputProps?: Partial; footerButtonProps?: Partial; footerUploadProps?: Partial; footerUploadTriggerProps?: any; footerIconProps?: Partial; footerSuffixIconProps?: Partial; emptyProps?: Partial; retryText?: string; typingText?: string; closeButtonText?: string; shareButtonTooltip?: string; profileButtonTooltip?: string; unreadNotificationText?: string; chatItemsLoading?: boolean; chatItemsLoadingCount?: number; messagesLoading?: boolean; messagesLoadingCount?: number; onChatSelect?: OnChatSelect; onMessageSend?: OnMessageSend; onMessageRetry?: (message: ChatMessageData) => void; bubbleActions?: ChatBubbleAction[]; onAttachmentUpload?: OnAttachmentUpload; onAttachmentDownload?: OnAttachmentDownload; onFilterChange?: OnFilterChange; onFooterInputChange?: (value: string, chatId: ChatId) => void; onNetworkError?: OnNetworkError; onUploadError?: OnUploadError; onSendError?: OnSendError; onChatItemsScrollToTop?: () => void; onChatItemsScrollToBottom?: () => void; onMessagesScrollToTop?: () => void; onMessagesScrollToBottom?: () => void; } export interface ChatSlots { header?: () => VNodeChild; footer?: () => VNodeChild; body?: () => VNodeChild; sidebar?: () => VNodeChild; listHeader?: () => VNodeChild; listEmpty?: () => VNodeChild; chatItemStatus?: (item: ChatListItemData) => VNodeChild; chatItemSuffix?: (item: ChatListItemData) => VNodeChild; messageStatus?: (message: ChatMessageData) => VNodeChild; messageContent?: (message: ChatMessageData) => VNodeChild; messageTimestamp?: (message: ChatMessageData) => VNodeChild; messageAttachment?: (message: ChatMessageData) => VNodeChild; messageAttachmentTitle?: (file: any) => VNodeChild; messageAttachmentSubtitle?: (file: any) => VNodeChild; bubbleActions?: (message: ChatMessageData) => VNodeChild; } export interface ChatListItemSlots { avatar?: () => VNodeChild; title?: () => VNodeChild; subtitle?: () => VNodeChild; datetime?: () => VNodeChild; status?: () => VNodeChild; } export interface ChatMessageSlots { default?: () => VNodeChild; timestamp?: () => VNodeChild; status?: () => VNodeChild; } export interface ChatBubbleAction { key: ChatBubbleActionKey | string; label: string | (() => VNodeChild); handler: (message: ChatMessageData) => void; visible?: (message: ChatMessageData) => boolean; } export interface ChatListHeaderProps { title?: string | (() => VNodeChild); actions?: Array<() => VNodeChild>; } export interface ChatHeaderSlots { title?: () => VNodeChild; actions?: () => VNodeChild; } export interface ChatFooterSlots { actions?: () => VNodeChild; input?: () => VNodeChild; } export interface ChatHeaderProps { title?: string | (() => VNodeChild); actions?: Array<() => VNodeChild>; } export interface ChatFooterProps { actions?: Array<() => VNodeChild>; inputProps?: Partial; } export type OnChatSelect = (key: ChatId, item: ChatListItemData) => void; export type OnMessageSend = (content: string, attachments?: ChatAttachment[]) => void; export type OnAttachmentUpload = (file: File) => Promise; export type OnAttachmentDownload = (attachment: ChatAttachment) => Promise; export type OnFilterChange = (filter: { type: string; value: any; }) => void; export type OnNetworkError = (error: { code: string; message: string; }) => void; export type OnUploadError = (error: { file: File; message: string; }) => void; export type OnSendError = (error: { message: string; content: string; }) => void; export interface ChatInst { scrollToBottom: () => void; scrollToMessage: (key: ChatId) => void; sendMessage: (content: string, attachments?: ChatAttachment[]) => void; } export interface ChatListInst { selectChat: (key: ChatId) => void; updateItem: (key: ChatId, item: Partial) => void; addItem: (item: ChatListItemData) => void; removeItem: (key: ChatId) => void; } export declare const chatInjectionKey: InjectionKey<{ mergedClsPrefixRef: Ref; mergedThemeRef: Ref>; chatItemsRef: Ref; selectedChatIdRef: Ref; selectedChatRef: Ref; messagesRef: Ref; typingChatIdsRef: Ref | undefined>; chatItemsLoadingRef: Ref; chatItemsLoadingCountRef: Ref; messagesLoadingRef: Ref; messagesLoadingCountRef: Ref; listEmptyPropsRef: Ref | undefined>; listHeaderTitleRef: Ref VNodeChild) | undefined>; listHeaderActionsRef: Ref VNodeChild> | undefined>; listItemAvatarPropsRef: Ref | undefined>; listItemBadgePropsRef: Ref | undefined>; emptyPropsRef: Ref | undefined>; headerButtonPropsRef: Ref | undefined>; headerIconPropsRef: Ref | undefined>; messageSenderAvatarPropsRef: Ref | undefined>; messageUploadPropsRef: Ref | undefined>; messageButtonPropsRef: Ref | undefined>; footerInputPropsRef: Ref | undefined>; footerButtonPropsRef: Ref | undefined>; footerUploadPropsRef: Ref | undefined>; footerUploadTriggerPropsRef: Ref | undefined>; footerIconPropsRef: Ref | undefined>; footerSuffixIconPropsRef: Ref | undefined>; inputPlaceholderRef: Ref; retryTextRef: Ref; typingTextRef: Ref; closeButtonTextRef: Ref; shareButtonTooltipRef: Ref; profileButtonTooltipRef: Ref; unreadNotificationTextRef: Ref; notificationsShownSetRef: Ref>; unreadCountsBeforeReadRef: Ref>; markNotificationShown: (chatId: ChatId) => void; handleChatSelect: (chatId: ChatId) => void; handleMessageSend: (content: string, attachments?: ChatAttachment[]) => void; handleMessageRetry: (message: ChatMessageData) => void; startEditingMessage?: Ref<((message: ChatMessageData) => void) | undefined>; editMessageIdRef?: Ref; bubbleActionsRef?: Ref; handleFooterInputChange: (value: string, chatId: ChatId) => void; markMessagesAsRead?: (chatId: ChatId) => void; handleFilterChange: (filter: { type: string; value: string | number | boolean; }) => void; handleNetworkError: (error: { code: string; message: string; }) => void; handleUploadError: (error: { file: File; message: string; }) => void; handleSendError: (error: { message: string; content: string; }) => void; onAttachmentUpload?: Ref; onAttachmentDownload?: Ref; onChatClose?: Ref<(() => void) | undefined>; onChatShare?: Ref<(() => void) | undefined>; onUserProfile?: Ref<(() => void) | undefined>; onChatItemsScrollToTop?: Ref<(() => void) | undefined>; onChatItemsScrollToBottom?: Ref<(() => void) | undefined>; onMessagesScrollToTop?: Ref<(() => void) | undefined>; onMessagesScrollToBottom?: Ref<(() => void) | undefined>; headerShareButtonPropsRef: Ref | undefined>; headerProfileButtonPropsRef: Ref | undefined>; headerCloseButtonPropsRef: Ref | undefined>; headerShareIconPropsRef: Ref | undefined>; headerProfileIconPropsRef: Ref | undefined>; }>; export type HandleOnChangeType = ((data: OnChangePayload) => void) | undefined;