-
Notifications
You must be signed in to change notification settings - Fork 3.5k
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
Merged
+2,083
−556
Merged
Changes from all commits
Commits
Show all changes
16 commits
Select commit
Hold shift + click to select a range
aefdc21
fix(ui): add request a demo modal
b59dbd4
Remove dead code
c24c6d6
Remove footer modal
4cf445f
Address greptile comments
730097d
Sanatize CRLF characters from emails
b4c864d
extract shared email header safety regex
cursoragent 0991419
Use pricing CTA action for demo modal
cursoragent e1a1618
fix demo request import ordering
cursoragent 6eff46a
Merge branch 'staging' into feat/demo-modal
cursoragent 6225f21
merge staging and fix hubspot list formatting
cursoragent 72e17bd
fix(generate-docs): fix tool description extraction and simplify script
waleedlatif1 02bd69d
fix(generate-docs): restore extractIconName by aliasing to extractIco…
waleedlatif1 c5a8b37
restore
waleedlatif1 79268a7
fix(demo-modal): reset form on open to prevent stale success state on…
waleedlatif1 769a804
undo hardcoded ff
waleedlatif1 eb3453a
fix(upstash): throw on unknown operation instead of silently falling …
waleedlatif1 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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 | ||
| } |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.