@open-wa/wa-automate-types-only
Version:
Types generated from the @open-wa/wa-automate package
56 lines (55 loc) • 1.38 kB
TypeScript
import { Message } from "..";
export interface CurrentDialogProps {
[k: string]: any;
}
export interface DialogState {
currentStep: number;
currentProps: any;
lastInput: any;
isComplete: boolean;
isError: boolean;
errorMessage: string;
}
export interface DialogTemplate {
"dialogId": string;
"privateOnly": boolean;
"identifier": string;
"successMessage": string;
"startMessage": string;
"properties": {
[key: string]: DialogProperty;
};
}
export type CheckFunction = (lastReceivedMessage: Message, currentProps: CurrentDialogProps) => boolean;
export interface DialogProperty {
"order": number;
"key": string;
"prompt": string;
"type": string;
"skipCondition"?: CheckFunction;
"options"?: DialogButtons[] | DialogListMessageSection[];
"validation": DialogValidation[];
}
export interface DialogButtons {
label: string;
value: string;
}
export interface DialogListMessageSection {
title: string;
rows: DialogListMessageRow[];
}
export interface DialogListMessageRow {
title: string;
description: string;
value: string;
}
export interface DialogValidation {
"type": ValidationType;
"value": string | CheckFunction;
"errorMessage": string;
}
export declare enum ValidationType {
REGEX = "regex",
LENGTH = "length",
CHECK = "check"
}