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