UNPKG

stream-chat

Version:

JS SDK for the Stream Chat API

40 lines (39 loc) 1.9 kB
import type { Channel } from '../../../channel'; import type { Middleware } from '../../../middleware'; import type { SearchSourceOptions } from '../../../search'; import { BaseSearchSourceSync } from '../../../search'; import type { CommandSuggestion, TextComposerMiddlewareOptions } from './types'; import type { TextComposerMiddlewareExecutorState } from './TextComposerMiddlewareExecutor'; export declare class CommandSearchSource extends BaseSearchSourceSync<CommandSuggestion> { readonly type = "commands"; protected channel: Channel; constructor(channel: Channel, options?: SearchSourceOptions); canExecuteQuery: (newSearchString?: string) => boolean; getStateBeforeFirstQuery(newSearchString: string): { items: CommandSuggestion[] | undefined; hasNext: boolean; isActive: boolean; isLoading: boolean; searchQuery: string; lastQueryError?: Error; next?: string | null; offset?: number; }; query(searchQuery: string): { items: { id: "all" | "ban" | "fun_set" | "giphy" | "moderation_set" | "mute" | "unban" | "unmute"; created_at?: string | undefined; updated_at?: string | undefined; args?: string; description?: string; name: "all" | "ban" | "fun_set" | "giphy" | "moderation_set" | "mute" | "unban" | "unmute"; set?: import("../../..").CommandVariants; }[]; next: null; }; protected filterQueryResults(items: CommandSuggestion[]): CommandSuggestion[]; } export type CommandsMiddleware = Middleware<TextComposerMiddlewareExecutorState<CommandSuggestion>, 'onChange' | 'onSuggestionItemSelect'>; export declare const createCommandsMiddleware: (channel: Channel, options?: Partial<TextComposerMiddlewareOptions> & { searchSource?: CommandSearchSource; }) => CommandsMiddleware;