stream-chat
Version:
JS SDK for the Stream Chat API
40 lines (39 loc) • 1.21 kB
TypeScript
import type { TextSelection } from './types';
/**
* For commands, we want to match all patterns except:
* 1. Text not starting with trigger
* 2. Trigger in middle of text
*/
export declare const getTriggerCharWithToken: ({ trigger, text, isCommand, acceptTrailingSpaces, }: {
trigger: string;
text: string;
isCommand?: boolean;
acceptTrailingSpaces?: boolean;
}) => string | null;
export declare const insertItemWithTrigger: ({ insertText, selection, text, trigger, }: {
insertText: string;
selection: TextSelection;
text: string;
trigger: string;
}) => {
text: string;
selection: {
start: number;
end: number;
};
};
export declare const replaceWordWithEntity: ({ caretPosition, getEntityString, text, }: {
caretPosition: number;
getEntityString: (word: string) => Promise<string | null> | string | null;
text: string;
}) => Promise<string>;
export type TokenizationPayload = {
tokenizedDisplayName: {
token: string;
parts: string[];
};
};
export declare const getTokenizedSuggestionDisplayName: ({ displayName, searchToken, }: {
displayName: string;
searchToken: string;
}) => TokenizationPayload;