From cdc819451bf4ffd802f07d1bdd18f37dd453ca80 Mon Sep 17 00:00:00 2001 From: waleed Date: Thu, 26 Mar 2026 09:40:14 -0700 Subject: [PATCH] feat(demo-request): block personal email domains --- apps/sim/app/(home)/components/demo-request/consts.ts | 9 ++++++++- apps/sim/package.json | 1 + bun.lock | 3 +++ 3 files changed, 12 insertions(+), 1 deletion(-) diff --git a/apps/sim/app/(home)/components/demo-request/consts.ts b/apps/sim/app/(home)/components/demo-request/consts.ts index fadfdd389a9..5e36e6bb17b 100644 --- a/apps/sim/app/(home)/components/demo-request/consts.ts +++ b/apps/sim/app/(home)/components/demo-request/consts.ts @@ -1,7 +1,10 @@ +import freeEmailDomains from 'free-email-domains' import { z } from 'zod' import { NO_EMAIL_HEADER_CONTROL_CHARS_REGEX } from '@/lib/messaging/email/utils' import { quickValidateEmail } from '@/lib/messaging/email/validation' +const FREE_EMAIL_DOMAINS = new Set(freeEmailDomains) + export const DEMO_REQUEST_REGION_VALUES = [ 'north_america', 'europe', @@ -57,7 +60,11 @@ export const demoRequestSchema = z.object({ .min(1, 'Company email is required') .max(320) .transform((value) => value.toLowerCase()) - .refine((value) => quickValidateEmail(value).isValid, 'Enter a valid work email'), + .refine((value) => quickValidateEmail(value).isValid, 'Enter a valid work email') + .refine((value) => { + const domain = value.split('@')[1] + return domain ? !FREE_EMAIL_DOMAINS.has(domain) : true + }, 'Please use your work email address'), phoneNumber: z .string() .trim() diff --git a/apps/sim/package.json b/apps/sim/package.json index c588585b3dd..981f39c7d93 100644 --- a/apps/sim/package.json +++ b/apps/sim/package.json @@ -109,6 +109,7 @@ "es-toolkit": "1.45.1", "ffmpeg-static": "5.3.0", "fluent-ffmpeg": "2.1.3", + "free-email-domains": "1.2.25", "framer-motion": "^12.5.0", "google-auth-library": "10.5.0", "gray-matter": "^4.0.3", diff --git a/bun.lock b/bun.lock index ed31b1d954d..c75c40f7233 100644 --- a/bun.lock +++ b/bun.lock @@ -135,6 +135,7 @@ "ffmpeg-static": "5.3.0", "fluent-ffmpeg": "2.1.3", "framer-motion": "^12.5.0", + "free-email-domains": "1.2.25", "google-auth-library": "10.5.0", "gray-matter": "^4.0.3", "groq-sdk": "^0.15.0", @@ -2312,6 +2313,8 @@ "framer-motion": ["framer-motion@12.38.0", "", { "dependencies": { "motion-dom": "^12.38.0", "motion-utils": "^12.36.0", "tslib": "^2.4.0" }, "peerDependencies": { "@emotion/is-prop-valid": "*", "react": "^18.0.0 || ^19.0.0", "react-dom": "^18.0.0 || ^19.0.0" }, "optionalPeers": ["@emotion/is-prop-valid", "react", "react-dom"] }, "sha512-rFYkY/pigbcswl1XQSb7q424kSTQ8q6eAC+YUsSKooHQYuLdzdHjrt6uxUC+PRAO++q5IS7+TamgIw1AphxR+g=="], + "free-email-domains": ["free-email-domains@1.2.25", "", {}, "sha512-Uf2rJUjo/agIgQzt6od9XcHrR6rfIMD6TwsNVSJVJCHzjPWWsqjCb+EaQ2VVVY9M55+JB3V0k6ru5sHTGx/ZfA=="], + "fresh": ["fresh@2.0.0", "", {}, "sha512-Rx/WycZ60HOaqLKAi6cHRKKI7zxWbJ31MhntmtwMoaTeF7XFH9hhBp8vITaMidfljRQ6eYWCKkaTK+ykVJHP2A=="], "fs-constants": ["fs-constants@1.0.0", "", {}, "sha512-y6OAwoSIf7FyjMIv94u+b5rdheZEjzR63GTyZJm5qh4Bi+2YgwLCcI/fPFZkL5PSixOt6ZNKm+w+Hfp/Bciwow=="],