2
0
Files
bot/packages/bot-engine/blocks/inputs/rating/validateRatingReply.ts
Baptiste Arnaud 35300eaf34 ♻️ Introduce typebot v6 with events (#1013)
Closes #885
2023-11-08 15:34:16 +01:00

6 lines
318 B
TypeScript

import { RatingInputBlock } from '@typebot.io/schemas'
import { defaultRatingInputOptions } from '@typebot.io/schemas/features/blocks/inputs/rating/constants'
export const validateRatingReply = (reply: string, block: RatingInputBlock) =>
Number(reply) <= (block.options?.length ?? defaultRatingInputOptions.length)