Uh oh!
There was an error while loading. Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork 3.8k
feat(ui): add request a demo modal#3766
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Uh oh!
There was an error while loading. Please reload this page.
Changes from all commits
aefdc21b59dbd4c24c6d64cf445f730097db4c864d0991419e1a16186eff46a6225f2172e17bd02bd69dc5a8b3779268a7769a804eb3453aFile filter
Filter by extension
Conversations
Uh oh!
There was an error while loading. Please reload this page.
Jump to
Uh oh!
There was an error while loading. Please reload this page.
Diff view
Diff view
There are no files selected for viewing
Large diffs are not rendered by default.
Uh oh!
There was an error while loading. Please reload this page.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,84 @@ | ||
| import { z } from 'zod' | ||
| import { NO_EMAIL_HEADER_CONTROL_CHARS_REGEX } from '@/lib/messaging/email/utils' | ||
| import { quickValidateEmail } from '@/lib/messaging/email/validation' | ||
| export const DEMO_REQUEST_REGION_VALUES = [ | ||
| 'north_america', | ||
| 'europe', | ||
| 'asia_pacific', | ||
| 'latin_america', | ||
| 'middle_east_africa', | ||
| 'other', | ||
| ] as const | ||
| export const DEMO_REQUEST_USER_COUNT_VALUES = [ | ||
| '1_10', | ||
| '11_50', | ||
| '51_200', | ||
| '201_500', | ||
| '501_1000', | ||
| '1000_plus', | ||
| ] as const | ||
| export const DEMO_REQUEST_REGION_OPTIONS = [ | ||
| { value: 'north_america', label: 'North America' }, | ||
| { value: 'europe', label: 'Europe' }, | ||
| { value: 'asia_pacific', label: 'Asia Pacific' }, | ||
| { value: 'latin_america', label: 'Latin America' }, | ||
| { value: 'middle_east_africa', label: 'Middle East & Africa' }, | ||
| { value: 'other', label: 'Other' }, | ||
| ] as const | ||
| export const DEMO_REQUEST_USER_COUNT_OPTIONS = [ | ||
| { value: '1_10', label: '1-10' }, | ||
| { value: '11_50', label: '11-50' }, | ||
| { value: '51_200', label: '51-200' }, | ||
| { value: '201_500', label: '201-500' }, | ||
| { value: '501_1000', label: '501-1,000' }, | ||
| { value: '1000_plus', label: '1,000+' }, | ||
| ] as const | ||
| export const demoRequestSchema = z.object({ | ||
| firstName: z | ||
| .string() | ||
| .trim() | ||
| .min(1, 'First name is required') | ||
| .max(100) | ||
| .regex(NO_EMAIL_HEADER_CONTROL_CHARS_REGEX, 'Invalid characters'), | ||
| lastName: z | ||
| .string() | ||
| .trim() | ||
| .min(1, 'Last name is required') | ||
| .max(100) | ||
| .regex(NO_EMAIL_HEADER_CONTROL_CHARS_REGEX, 'Invalid characters'), | ||
| companyEmail: z | ||
| .string() | ||
| .trim() | ||
| .min(1, 'Company email is required') | ||
| .max(320) | ||
| .transform((value) => value.toLowerCase()) | ||
| .refine((value) => quickValidateEmail(value).isValid, 'Enter a valid work email'), | ||
| phoneNumber: z | ||
| .string() | ||
| .trim() | ||
| .max(50, 'Phone number must be 50 characters or less') | ||
| .optional() | ||
| .transform((value) => (value && value.length > 0 ? value : undefined)), | ||
| region: z.enum(DEMO_REQUEST_REGION_VALUES, { | ||
| errorMap: () => ({ message: 'Please select a region' }), | ||
| }), | ||
| userCount: z.enum(DEMO_REQUEST_USER_COUNT_VALUES, { | ||
| errorMap: () => ({ message: 'Please select the number of users' }), | ||
| }), | ||
| details: z.string().trim().min(1, 'Details are required').max(2000), | ||
| }) | ||
| export type DemoRequestPayload = z.infer<typeof demoRequestSchema> | ||
| export function getDemoRequestRegionLabel(value: DemoRequestPayload['region']): string { | ||
| return DEMO_REQUEST_REGION_OPTIONS.find((option) => option.value === value)?.label ?? value | ||
| } | ||
| export function getDemoRequestUserCountLabel(value: DemoRequestPayload['userCount']): string { | ||
| return DEMO_REQUEST_USER_COUNT_OPTIONS.find((option) => option.value === value)?.label ?? value | ||
| } |
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.