@@ -8,7 +8,7 @@ export const emailInputOptionsSchema = optionBaseSchema
|
||||
.merge(textInputOptionsBaseSchema)
|
||||
.merge(
|
||||
z.object({
|
||||
retryMessageContent: z.string(),
|
||||
retryMessageContent: z.string().optional(),
|
||||
})
|
||||
)
|
||||
|
||||
@@ -19,13 +19,14 @@ export const emailInputSchema = blockBaseSchema.merge(
|
||||
})
|
||||
)
|
||||
|
||||
export const invalidEmailDefaultRetryMessage =
|
||||
"This email doesn't seem to be valid. Can you type it again?"
|
||||
|
||||
export const defaultEmailInputOptions: EmailInputOptions = {
|
||||
labels: {
|
||||
button: defaultButtonLabel,
|
||||
placeholder: 'Type your email...',
|
||||
},
|
||||
retryMessageContent:
|
||||
"This email doesn't seem to be valid. Can you type it again?",
|
||||
}
|
||||
|
||||
export type EmailInputBlock = z.infer<typeof emailInputSchema>
|
||||
|
||||
10
packages/schemas/features/collaborators.ts
Normal file
10
packages/schemas/features/collaborators.ts
Normal file
@@ -0,0 +1,10 @@
|
||||
import { CollaborationType, CollaboratorsOnTypebots } from '@typebot.io/prisma'
|
||||
import { z } from 'zod'
|
||||
|
||||
export const collaboratorSchema = z.object({
|
||||
type: z.nativeEnum(CollaborationType),
|
||||
userId: z.string(),
|
||||
typebotId: z.string(),
|
||||
createdAt: z.date(),
|
||||
updatedAt: z.date(),
|
||||
}) satisfies z.ZodType<CollaboratorsOnTypebots>
|
||||
@@ -11,7 +11,7 @@ import { z } from 'zod'
|
||||
|
||||
export const publicTypebotSchema = z.object({
|
||||
id: z.string(),
|
||||
version: z.enum(['3', '4']).nullable(),
|
||||
version: z.enum(['3', '4', '5']).nullable(),
|
||||
createdAt: z.date(),
|
||||
updatedAt: z.date(),
|
||||
typebotId: z.string(),
|
||||
|
||||
@@ -37,9 +37,13 @@ export const settingsSchema = z.object({
|
||||
metadata: metadataSchema,
|
||||
})
|
||||
|
||||
export const defaultSettings: Settings = {
|
||||
export const defaultSettings = ({
|
||||
isBrandingEnabled,
|
||||
}: {
|
||||
isBrandingEnabled: boolean
|
||||
}): Settings => ({
|
||||
general: {
|
||||
isBrandingEnabled: true,
|
||||
isBrandingEnabled,
|
||||
rememberUser: {
|
||||
isEnabled: false,
|
||||
},
|
||||
@@ -51,7 +55,7 @@ export const defaultSettings: Settings = {
|
||||
description:
|
||||
'Build beautiful conversational forms and embed them directly in your applications without a line of code. Triple your response rate and collect answers that has more value compared to a traditional form.',
|
||||
},
|
||||
}
|
||||
})
|
||||
|
||||
export type Settings = z.infer<typeof settingsSchema>
|
||||
export type GeneralSettings = z.infer<typeof generalSettings>
|
||||
|
||||
@@ -38,8 +38,11 @@ const resultsTablePreferencesSchema = z.object({
|
||||
columnsWidth: z.record(z.string(), z.number()),
|
||||
})
|
||||
|
||||
const isPathNameCompatible = (str: string) =>
|
||||
/^([a-z0-9]+-[a-z0-9]*)*$/.test(str) || /^[a-z0-9]*$/.test(str)
|
||||
|
||||
export const typebotSchema = z.object({
|
||||
version: z.enum(['3', '4']).nullable(),
|
||||
version: z.enum(['3', '4', '5']).nullable(),
|
||||
id: z.string(),
|
||||
name: z.string(),
|
||||
groups: z.array(groupSchema),
|
||||
@@ -52,8 +55,8 @@ export const typebotSchema = z.object({
|
||||
updatedAt: z.date(),
|
||||
icon: z.string().nullable(),
|
||||
folderId: z.string().nullable(),
|
||||
publicId: z.string().nullable(),
|
||||
customDomain: z.string().nullable(),
|
||||
publicId: z.string().refine(isPathNameCompatible).nullable(),
|
||||
customDomain: z.string().refine(isPathNameCompatible).nullable(),
|
||||
workspaceId: z.string(),
|
||||
resultsTablePreferences: resultsTablePreferencesSchema.nullable(),
|
||||
isArchived: z.boolean(),
|
||||
|
||||
Reference in New Issue
Block a user