import { ApiProperty } from '@nestjs/swagger'; import { ChatElement } from 'chat-element-json-ts'; import { ButtonElementName } from './constants'; export type ButtonType = ChatElement; export class ButtonElementPropsType { @ApiProperty() label: string; @ApiProperty() action: 'webLink' | 'message' | 'block' | 'phone' | 'operator'; @ApiProperty() webLinkUrl?: string; @ApiProperty() messageText?: string; @ApiProperty() blockId?: string; @ApiProperty() phoneNumber?: string; @ApiProperty() extra?: Record; } export function Button(buttonProps: ButtonElementPropsType): ButtonType { return new ChatElement(ButtonElementName, buttonProps); }