11
packages/schemas/features/blocks/inputs/email/constants.ts
Normal file
11
packages/schemas/features/blocks/inputs/email/constants.ts
Normal file
@ -0,0 +1,11 @@
|
||||
import { defaultButtonLabel } from '../constants'
|
||||
import { EmailInputBlock } from './schema'
|
||||
|
||||
export const defaultEmailInputOptions = {
|
||||
labels: {
|
||||
button: defaultButtonLabel,
|
||||
placeholder: 'Type your email...',
|
||||
},
|
||||
retryMessageContent:
|
||||
"This email doesn't seem to be valid. Can you type it again?",
|
||||
} as const satisfies EmailInputBlock['options']
|
1
packages/schemas/features/blocks/inputs/email/index.ts
Normal file
1
packages/schemas/features/blocks/inputs/email/index.ts
Normal file
@ -0,0 +1 @@
|
||||
export * from './schema'
|
22
packages/schemas/features/blocks/inputs/email/schema.ts
Normal file
22
packages/schemas/features/blocks/inputs/email/schema.ts
Normal file
@ -0,0 +1,22 @@
|
||||
import { z } from 'zod'
|
||||
import { optionBaseSchema, blockBaseSchema } from '../../shared'
|
||||
import { InputBlockType } from '../constants'
|
||||
import { textInputOptionsBaseSchema } from '../text'
|
||||
|
||||
export const emailInputOptionsSchema = optionBaseSchema
|
||||
.merge(textInputOptionsBaseSchema)
|
||||
.merge(
|
||||
z.object({
|
||||
retryMessageContent: z.string().optional(),
|
||||
})
|
||||
)
|
||||
|
||||
export const emailInputSchema = blockBaseSchema.merge(
|
||||
z.object({
|
||||
type: z.enum([InputBlockType.EMAIL]),
|
||||
options: emailInputOptionsSchema.optional(),
|
||||
})
|
||||
)
|
||||
|
||||
export type EmailInputBlock = z.infer<typeof emailInputSchema>
|
||||
export type EmailInputOptions = z.infer<typeof emailInputOptionsSchema>
|
Reference in New Issue
Block a user