2
0
Files
bot/packages/models/features/blocks/inputs/schemas.ts

43 lines
1.6 KiB
TypeScript
Raw Normal View History

import { z } from 'zod'
import { choiceInputOptionsSchema, choiceInputSchema } from './choice'
import { dateInputOptionsSchema, dateInputSchema } from './date'
import { emailInputOptionsSchema, emailInputSchema } from './email'
import { numberInputOptionsSchema, numberInputSchema } from './number'
import { paymentInputOptionsSchema, paymentInputSchema } from './payment'
import {
phoneNumberInputOptionsSchema,
2022-06-11 07:27:38 +02:00
phoneNumberInputBlockSchema,
} from './phone'
2022-06-11 07:27:38 +02:00
import { ratingInputOptionsSchema, ratingInputBlockSchema } from './rating'
import { textInputOptionsSchema, textInputSchema } from './text'
import { fileInputOptionsSchema, fileInputStepSchema } from './file'
import { urlInputOptionsSchema, urlInputSchema } from './url'
import { optionBaseSchema } from '../baseSchemas'
export type OptionBase = z.infer<typeof optionBaseSchema>
2022-06-11 07:27:38 +02:00
export const inputBlockOptionsSchema = textInputOptionsSchema
.or(choiceInputOptionsSchema)
.or(emailInputOptionsSchema)
.or(numberInputOptionsSchema)
.or(urlInputOptionsSchema)
.or(phoneNumberInputOptionsSchema)
.or(dateInputOptionsSchema)
.or(paymentInputOptionsSchema)
2022-06-07 19:09:08 +02:00
.or(ratingInputOptionsSchema)
.or(fileInputOptionsSchema)
2022-06-11 07:27:38 +02:00
export const inputBlockSchema = textInputSchema
.or(numberInputSchema)
.or(emailInputSchema)
.or(urlInputSchema)
.or(dateInputSchema)
2022-06-11 07:27:38 +02:00
.or(phoneNumberInputBlockSchema)
.or(choiceInputSchema)
.or(paymentInputSchema)
2022-06-11 07:27:38 +02:00
.or(ratingInputBlockSchema)
.or(fileInputStepSchema)
2022-06-11 07:27:38 +02:00
export type InputBlock = z.infer<typeof inputBlockSchema>
export type InputBlockOptions = z.infer<typeof inputBlockOptionsSchema>