forked from usesend/useSend
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathschema.ts
More file actions
33 lines (30 loc) · 1.01 KB
/
schema.ts
File metadata and controls
33 lines (30 loc) · 1.01 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
import { z } from "zod";
export const WAITLIST_EMAIL_TYPES = [
"transactional",
"marketing",
] as const;
export const waitlistSubmissionSchema = z.object({
domain: z
.string({ required_error: "Domain is required" })
.trim()
.min(1, "Domain is required")
.max(255, "Domain must be 255 characters or fewer")
.regex(
/^(?!:\/\/)([a-zA-Z0-9-]+\.)+[a-zA-Z]{2,}$/,
"Please enter a valid domain (e.g. example.com)"
),
emailTypes: z
.array(z.enum(WAITLIST_EMAIL_TYPES))
.min(1, "Select at least one email type"),
emailVolume: z
.string({ required_error: "Share your expected volume" })
.trim()
.min(1, "Tell us how many emails you expect to send")
.max(500, "Keep the volume details under 500 characters"),
description: z
.string({ required_error: "Provide a short description" })
.trim()
.min(10, "Please share a bit more detail")
.max(2000, "Description must be under 2000 characters"),
});
export type WaitlistSubmissionInput = z.infer<typeof waitlistSubmissionSchema>;