@rcb-plugins/input-validator
Version:
A lightweight plugin to validate user input with visual feedbacks in React ChatBotify!
16 lines • 811 B
TypeScript
import { Flow, RcbUserSubmitTextEvent, RcbUserUploadFileEvent } from 'react-chatbotify';
import { ValidationResult } from '../types/ValidationResult';
/**
* Union type for user events that can be validated.
*/
type RcbUserEvent = RcbUserSubmitTextEvent | RcbUserUploadFileEvent;
/**
* Retrieves the validator function from the current flow block.
*
* @param event The event emitted by the user action (text submission or file upload).
* @param currFlow The current flow object.
* @returns The validator function if it exists, otherwise undefined.
*/
export declare const getValidator: <T = string | File>(event: RcbUserEvent, currFlow: Flow, validatorType?: "validateTextInput" | "validateFileInput") => ((input: T) => ValidationResult) | undefined;
export {};
//# sourceMappingURL=getValidator.d.ts.map