import { ComponentOptionsMixin } from 'vue'; import { ComponentProvideOptions } from 'vue'; import { DefineComponent } from 'vue'; import { PublicProps } from 'vue'; /** * A user-triggerable action surfaced through one of the dropdown menus * (header, message, chat row, or message-selection toolbar). Identified * by `id` for routing in the consumer's `*-action-handler`; rendered * with `label`. */ declare interface Action { id: string; label: string; /** * Optional leading icon. Resolves to a built-in `SvgIcon` name when * the value matches one (e.g. `'pencil'`, `'deleted'`, `'send'`); * otherwise consumers can override the icon slot. */ icon?: string; /** * When true, the action only appears on messages sent by the current * user (typical for `edit`/`delete`). */ ownMessageOnly?: boolean; } declare type AdvancedChatComponentProps = InstanceType['$props']; export declare interface AdvancedChatElementConstructor extends CustomElementConstructor { new (): AdvancedChatHTMLElement; } declare type AdvancedChatEventListeners = { [Key in keyof AdvancedChatComponentProps as Key extends `onVnode${string}` ? never : Key extends `on${string}` ? Key : never]-?: AdvancedChatComponentProps[Key]; }; export declare type AdvancedChatEventMap = { [Key in keyof AdvancedChatEventListeners as EventName]-?: CustomEvent>; }; export declare interface AdvancedChatHTMLElement extends HTMLElement, AdvancedChatProps { addEventListener(type: Key, listener: (this: AdvancedChatHTMLElement, event: AdvancedChatEventMap[Key]) => unknown, options?: boolean | AddEventListenerOptions): void; addEventListener(type: string, listener: EventListenerOrEventListenerObject | null, options?: boolean | AddEventListenerOptions): void; removeEventListener(type: Key, listener: (this: AdvancedChatHTMLElement, event: AdvancedChatEventMap[Key]) => unknown, options?: boolean | EventListenerOptions): void; removeEventListener(type: string, listener: EventListenerOrEventListenerObject | null, options?: boolean | EventListenerOptions): void; } declare interface AdvancedChatOptions { localization?: Localization; strings?: Partial; } declare interface AdvancedChatProps { /** Outer container height as a CSS length. Defaults to `'600px'`. */ height?: string; /** Visual theme. Defaults to `'auto'`, which follows the user's OS preference. */ theme?: Theme; /** Identifies the viewer; required to render most UI. Defaults to `null`. */ currentUser?: UserReference | null; /** Chats shown in the left-hand list. */ chats?: Chat[]; /** Initially-active chat; the inner `Chat` switches to this when it changes. */ chat?: Chat | null; /** Messages for the active chat. */ messages?: Message[]; /** Shows the chats-list spinner while `true`. */ loadingChats?: boolean; /** Set to `true` once all chats have been delivered to disable further `fetch-more-chats`. */ chatsLoaded?: boolean; /** Shows the messages spinner while `true`. */ loadingMessages?: boolean; /** Set to `true` once all messages for the active chat have been delivered. */ messagesLoaded?: boolean; /** Items rendered in the chat-header overflow menu. */ headerActions?: Action[]; /** Items rendered in each message's actions menu. */ messageActions?: Action[]; /** Items rendered in each chat-list item's actions menu. */ chatActions?: Action[]; /** * Bulk-action items rendered in the message-selection toolbar. Pass * non-empty to enable selection mode; pass empty (the default) to * disable it. Replaces the prior `messageSelectionActions` prop. */ selectionActions?: Action[]; /** Renders the chats sidebar when `true`. Defaults to `true`. */ showChats?: boolean; /** Shows the search input in the chats sidebar. Defaults to `true`. */ showSearch?: boolean; /** Shows the "add chat" button in the chats sidebar. Defaults to `true`. */ showAddChat?: boolean; /** Shows the file-attachment button in the composer. Defaults to `true`. */ showFiles?: boolean; /** Shows the emoji-picker button in the composer. Defaults to `true`. */ showEmojis?: boolean; /** Renders the composer footer. Defaults to `true`. */ showFooter?: boolean; /** Shows the send-icon button in the composer. Defaults to `true`. */ showSendIcon?: boolean; /** Shows the inline emoji-reaction picker on each message. Defaults to `true`. */ showReactionEmojis?: boolean; /** Renders the "new messages" divider above the first unread message. Defaults to `true`. */ showNewMessagesDivider?: boolean; /** * Text-formatting applied to every message body in the active chat. */ textFormatting?: Partial; /** `accept` attribute forwarded to the file input. Defaults to `'*'`. */ accept?: string; /** Allows selecting multiple files in the file picker. Defaults to `true`. */ multiple?: boolean; /** `capture` attribute forwarded to the file input (mobile camera/mic). */ capture?: '' | 'user' | 'environment'; /** Max files in the composer at once. `0` / unset disables. */ maxFiles?: number; /** Max bytes per file. `0` / unset disables. */ maxFileSize?: number; /** * Where to render the typing-users indicator. See `Chat`'s prop for * full semantics. Default `'header'`. */ typingIndicatorPosition?: 'header' | 'composer' | 'both' | 'none'; /** * Auto-scroll policy for the message list. See `Chat`'s prop for * the per-leg semantics. All legs default `true`. */ autoScroll?: { onMount?: boolean; onChatSwitch?: boolean; onSend?: boolean; onReceive?: boolean; }; /** * When `true`, `search-chat` still fires on every keystroke but the * built-in local filter is suppressed — the host renders server-driven * results. */ customSearchEnabled?: boolean; /** When `true`, the header becomes clickable and emits `show-chat-info`. */ chatInfoEnabled?: boolean; /** Operational state shown by the component. Offline states preserve the chat UI. */ status?: 'ready' | 'loading' | 'empty' | 'error' | 'offline' | 'reconnecting' | 'permission-denied'; /** Optional host-provided copy for the operational state. */ statusMessage?: string; /** Optional label for the error-state retry action. */ retryLabel?: string; /** Disables the composer while preserving history and navigation. */ composerDisabled?: boolean; } declare interface Chat { id: Id; name: string; /** * Display picture for the chat — usually a group icon for multi-user * rooms; for 1:1 rooms consumers can leave this unset and let the * library fall back to the other user's avatar. */ avatar?: string; unreadCount?: number; /** * Latest message in the chat, used to render the chat-list preview * row. Typed as `MessageSummary` so consumers can supply a tiny * projection without filling in `reactions`, `reply`, `disableActions`, * etc.; any full `Message` value is also assignable. */ lastMessage?: MessageSummary; users?: User[]; typingUsers?: UserReference[]; } declare interface ChatFileItem extends MessageFile { loading?: boolean; /** * Object URL used for a local preview. `ChatFooter` owns and revokes it * while pending; ownership transfers to the send/edit event listener. */ localUrl?: string; } export declare const createAdvancedChatElement: (options?: AdvancedChatOptions) => AdvancedChatElementConstructor; declare const _default: DefineComponent any; "send-message": (payload: { content: string; files: ChatFileItem[]; mentionedUsers: User[]; reply?: Message | null; }) => any; "edit-message": (payload: { messageId: Message["id"]; content: string; files: ChatFileItem[]; mentionedUsers: User[]; }) => any; "typing-message": (value: string) => any; "invalid-file": (payload: { file: File; reason: "size" | "count"; }) => any; "show-chat-info": (chat: Chat) => any; "menu-action-handler": (payload: { chat: Chat; action: Action; }) => any; "cancel-message-selection": () => any; "message-selection-action-handler": (payload: { chat: Chat; action: Action; messages: Message[]; }) => any; "message-action-handler": (payload: { action: Action; message: Message; }) => any; "send-message-reaction": (payload: { emoji: string; message: Message; }) => any; "open-file": (payload: { file: MessageFile; action: "preview" | "download"; }) => any; "open-failed-message": (message: Message) => any; "fetch-messages": () => any; "search-chat": (query: string) => any; "add-chat": () => any; "chat-action-handler": (payload: { chat: Chat; action: Action; }) => any; "fetch-more-chats": () => any; "open-chat": (chat: Chat) => any; retry: () => any; }, string, PublicProps, Readonly & Readonly<{ "onClick-user-tag"?: ((user: User) => any) | undefined; "onSend-message"?: ((payload: { content: string; files: ChatFileItem[]; mentionedUsers: User[]; reply?: Message | null; }) => any) | undefined; "onEdit-message"?: ((payload: { messageId: Message["id"]; content: string; files: ChatFileItem[]; mentionedUsers: User[]; }) => any) | undefined; "onTyping-message"?: ((value: string) => any) | undefined; "onInvalid-file"?: ((payload: { file: File; reason: "size" | "count"; }) => any) | undefined; "onShow-chat-info"?: ((chat: Chat) => any) | undefined; "onMenu-action-handler"?: ((payload: { chat: Chat; action: Action; }) => any) | undefined; "onCancel-message-selection"?: (() => any) | undefined; "onMessage-selection-action-handler"?: ((payload: { chat: Chat; action: Action; messages: Message[]; }) => any) | undefined; "onMessage-action-handler"?: ((payload: { action: Action; message: Message; }) => any) | undefined; "onSend-message-reaction"?: ((payload: { emoji: string; message: Message; }) => any) | undefined; "onOpen-file"?: ((payload: { file: MessageFile; action: "preview" | "download"; }) => any) | undefined; "onOpen-failed-message"?: ((message: Message) => any) | undefined; "onFetch-messages"?: (() => any) | undefined; "onSearch-chat"?: ((query: string) => any) | undefined; "onAdd-chat"?: (() => any) | undefined; "onChat-action-handler"?: ((payload: { chat: Chat; action: Action; }) => any) | undefined; "onFetch-more-chats"?: (() => any) | undefined; "onOpen-chat"?: ((chat: Chat) => any) | undefined; onRetry?: (() => any) | undefined; }>, { height: string; status: "ready" | "loading" | "empty" | "error" | "offline" | "reconnecting" | "permission-denied"; chat: Chat | null; textFormatting: Partial; showSendIcon: boolean; showFiles: boolean; showEmojis: boolean; showFooter: boolean; accept: string; multiple: boolean; capture: "" | "user" | "environment"; maxFiles: number; maxFileSize: number; currentUser: UserReference | null; chatInfoEnabled: boolean; selectionActions: Action[]; showReactionEmojis: boolean; messages: Message[]; showNewMessagesDivider: boolean; loadingMessages: boolean; messagesLoaded: boolean; headerActions: Action[]; messageActions: Action[]; composerDisabled: boolean; typingIndicatorPosition: "header" | "composer" | "both" | "none"; autoScroll: { onMount?: boolean; onChatSwitch?: boolean; onSend?: boolean; onReceive?: boolean; }; showSearch: boolean; showAddChat: boolean; loadingChats: boolean; chats: Chat[]; showChats: boolean; chatsLoaded: boolean; chatActions: Action[]; customSearchEnabled: boolean; theme: Theme; statusMessage: string; retryLabel: string; }, {}, {}, {}, string, ComponentProvideOptions, false, { container: HTMLDivElement; }, HTMLDivElement>; export declare const DEFAULT_CUSTOM_ELEMENT_TAG = "advanced-chat-components"; declare type EventDetail = NonNullable extends (...args: infer Arguments) => unknown ? Arguments extends [] ? null : Arguments extends [infer Detail] ? Detail : Arguments : never; declare type EventName = ListenerName extends `on${infer Name}` ? Uncapitalize : never; /** * Identifier for chats, messages, and users. Pinned to `string` so * downstream lookups can use direct equality without coercion. Map * numeric backend ids with `String(id)` at the API boundary. */ declare type Id = string; declare interface LinkOptions { target?: '_blank' | '_self' | '_parent' | '_top'; rel?: string; } declare type Localization = 'en' | 'auto'; declare interface Message extends MessageSummary { reactions?: Record; /** True if this message is part of the unread batch that triggers the divider line. */ unread?: boolean; system?: boolean; disableActions?: boolean; disableReactions?: boolean; /** * The message being quoted by this one. Tightened to `MessageSummary` * so a reply preview never recurses into yet another reply chain. */ reply?: MessageSummary; } declare interface MessageFile { name: string; type: string; extension: string; url: string; previewUrl?: string; /** Set to `false` to force image/video files through the host-controlled download flow. */ previewable?: boolean; size?: number; /** Duration in seconds for audio/video files. */ duration?: number; /** Upload progress (0-100) while a pending file is being sent. */ progress?: number; /** In-memory blob for pending uploads (not for received files). */ blob?: Blob; } /** * Delivery / failure state of a message. Replaces the four overlapping * booleans (`saved`/`delivered`/`read`/`failure`) used in earlier * alphas. Components render checkmarks based on this single value. */ declare type MessageStatus = 'sending' | 'sent' | 'delivered' | 'read' | 'failed'; /** * The projection of a message that downstream surfaces actually need: * the chat-list last-message preview row and the reply-quote bubble. * * Consumers can pass any `Message` value here — every additional field * on `Message` is optional or unused by these surfaces. Use this type * for `Chat.lastMessage` and `Message.reply` so the recursive case * (a reply to a reply to a reply…) doesn't fall out of the model. */ declare interface MessageSummary { id: Id; sender: User; content?: string; createdAt: string; status?: MessageStatus; deleted?: boolean; edited?: boolean; files?: MessageFile[]; } export declare const registerAdvancedChat: ({ tagName, ...pluginOptions }?: RegisterAdvancedChatOptions) => AdvancedChatElementConstructor; export declare interface RegisterAdvancedChatOptions extends AdvancedChatOptions { tagName?: string; } declare type Strings = { 'chats.empty': string; 'chats.search.placeholder': string; 'chat.empty': string; 'chat.messages.empty': string; 'chat.messages.new': string; 'chat.message.placeholder': string; 'chat.message.deleted': string; 'chat.message.failure': string; 'chat.typing': string; 'chat.cancel-selection': string; 'chat.cancel-reply': string; 'chat.cancel-edit': string; 'chat.scroll-to-bottom': string; 'chat.user.is-online': string; 'chat.user.last-seen': string; 'chat.autocomplete.emojis': string; 'chat.autocomplete.users': string; 'chat.state.loading': string; 'chat.state.empty': string; 'chat.state.error': string; 'chat.state.offline': string; 'chat.state.reconnecting': string; 'chat.state.permission-denied': string; 'chat.state.retry': string; }; declare type Styles = { '--chat-color': string; '--chat-color-button-clear': string; '--chat-color-button': string; '--chat-bg-color-button': string; '--chat-bg-color-input': string; '--chat-color-spinner': string; '--chat-color-placeholder': string; '--chat-color-caret': string; '--chat-border-style': string; '--chat-bg-scroll-icon': string; '--chat-container-border': string; '--chat-container-border-radius': string; '--chat-container-box-shadow': string; '--chat-header-bg-color': string; '--chat-header-color-name': string; '--chat-header-color-info': string; '--chat-header-position': string; '--chat-header-width': string; '--chat-footer-bg-color': string; '--chat-border-style-input': string; '--chat-border-color-input-selected': string; '--chat-footer-bg-color-reply': string; '--chat-footer-bg-color-tag-active': string; '--chat-footer-bg-color-tag': string; '--chat-content-bg-color': string; '--chat-sidemenu-bg-color': string; '--chat-sidemenu-bg-color-hover': string; '--chat-sidemenu-bg-color-active': string; '--chat-sidemenu-color-active': string; '--chat-sidemenu-border-color-search': string; '--chat-dropdown-bg-color': string; '--chat-dropdown-bg-color-hover': string; '--chat-message-bg-color': string; '--chat-message-bg-color-me': string; '--chat-message-color-started': string; '--chat-message-bg-color-deleted': string; '--chat-message-bg-color-selected': string; '--chat-message-color-deleted': string; '--chat-message-color-username': string; '--chat-message-color-timestamp': string; '--chat-message-bg-color-date': string; '--chat-message-color-date': string; '--chat-message-bg-color-system': string; '--chat-message-color-system': string; '--chat-message-color': string; '--chat-message-bg-color-media': string; '--chat-message-bg-color-reply': string; '--chat-message-color-reply-username': string; '--chat-message-color-reply-content': string; '--chat-message-color-tag': string; '--chat-message-bg-color-image': string; '--chat-message-color-new-messages': string; '--chat-message-bg-color-scroll-counter': string; '--chat-message-color-scroll-counter': string; '--chat-message-bg-color-reaction': string; '--chat-message-border-style-reaction': string; '--chat-message-bg-color-reaction-hover': string; '--chat-message-border-style-reaction-hover': string; '--chat-message-color-reaction-counter': string; '--chat-message-bg-color-reaction-me': string; '--chat-message-border-style-reaction-me': string; '--chat-message-bg-color-reaction-hover-me': string; '--chat-message-border-style-reaction-hover-me': string; '--chat-message-color-reaction-counter-me': string; '--chat-message-bg-color-audio-record': string; '--chat-message-bg-color-audio-line': string; '--chat-message-bg-color-audio-progress': string; '--chat-message-bg-color-audio-progress-selector': string; '--chat-message-color-file-extension': string; '--chat-markdown-bg': string; '--chat-markdown-border': string; '--chat-markdown-color': string; '--chat-markdown-color-multi': string; '--chat-room-color-username': string; '--chat-room-color-message': string; '--chat-room-color-timestamp': string; '--chat-room-color-online': string; '--chat-room-color-offline': string; '--chat-room-bg-color-badge': string; '--chat-room-color-badge': string; '--chat-emoji-bg-color': string; '--chat-icon-color-search': string; '--chat-icon-color-add': string; '--chat-icon-color-toggle': string; '--chat-icon-color-menu': string; '--chat-icon-color-close': string; '--chat-icon-color-close-image': string; '--chat-icon-color-file': string; '--chat-icon-color-paperclip': string; '--chat-icon-color-close-outline': string; '--chat-icon-color-close-preview': string; '--chat-icon-color-send': string; '--chat-icon-color-send-disabled': string; '--chat-icon-color-emoji': string; '--chat-icon-color-emoji-reaction': string; '--chat-icon-color-document': string; '--chat-icon-color-pencil': string; '--chat-icon-color-checkmark': string; '--chat-icon-color-checkmark-seen': string; '--chat-icon-color-eye': string; '--chat-icon-color-dropdown-message': string; '--chat-icon-bg-dropdown-message': string; '--chat-icon-color-dropdown-room': string; '--chat-icon-color-dropdown-scroll': string; '--chat-icon-color-microphone': string; '--chat-icon-color-audio-play': string; '--chat-icon-color-audio-pause': string; '--chat-icon-color-audio-cancel': string; '--chat-icon-color-audio-confirm': string; '--chat-message-color-failure': string; '--chat-message-bg-color-failure': string; }; declare interface TextFormattingOptions { markdown?: boolean; singleLine?: boolean; linkify?: boolean; linkOptions?: LinkOptions; } declare type Theme = 'light' | 'dark' | 'auto' | { base: 'light' | 'dark'; overrides: Partial; }; declare interface User { id: Id; name: string; /** * Optional URL of the user's profile picture. Rendered as an avatar * in the message author block, the user-tag autocomplete row, and * (for 1:1 chats) as a fallback for `Chat.avatar`. */ avatar?: string; status: { state: 'online' | 'offline' | 'away' | 'busy'; lastActiveAt?: string; }; } declare interface UserReference { id: Id; } export { }