2
0

(customDomains) Fix custom domain update feedback

This commit is contained in:
Baptiste Arnaud
2023-08-21 15:32:27 +02:00
parent dc4c19a755
commit c08e0cdb0a
19 changed files with 506 additions and 104 deletions

View File

@@ -0,0 +1,10 @@
import { CustomDomain as CustomDomainInDb } from '@typebot.io/prisma'
import { z } from 'zod'
const domainNameRegex = /^([a-z0-9]+(-[a-z0-9]+)*\.)+[a-z]{2,}$/
export const customDomainSchema = z.object({
name: z.string().refine((name) => domainNameRegex.test(name)),
workspaceId: z.string(),
createdAt: z.date(),
}) satisfies z.ZodType<CustomDomainInDb>

View File

@@ -39,7 +39,7 @@ const resultsTablePreferencesSchema = z.object({
})
const isPathNameCompatible = (str: string) =>
/^([a-z0-9]+-[a-z0-9]*)*$/.test(str) || /^[a-z0-9]*$/.test(str)
/^([a-zA-Z0-9]+(-|.)[a-zA-z0-9]*)*$/.test(str) || /^[a-zA-Z0-9]*$/.test(str)
const isDomainNameWithPathNameCompatible = (str: string) =>
/^(?:(?:[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?\.)+[a-zA-Z]{2,}(?:\/[\w-\/]*)?)$/.test(