Files
worldmonitor/convex/contactMessages.ts
Elie Habib bbe6a828f1 feat(pro): harden enterprise form with mandatory fields and lead qualification (#1382)
* feat(pro): harden enterprise contact form with mandatory fields and lead qualification

- Add mandatory phone number and company fields (client + server validation)
- Block free email domains (gmail, yahoo, hotmail, etc.) with 422 response and inline error
- Include phone (clickable tel: link) and email domain (clickable company link) in sales notification
- Add i18n translations for phone placeholder and work email error across all 21 locales
- Tighten phone regex to require start/end with digit, rejecting junk input

* fix(pro): rebuild static assets and fix contact handler tests

- Rebuild public/pro/ bundle to include new phone/company/email validation fields
- Add phone field to test validBody() fixture
- Add tests for free email domain rejection (422), missing org, missing/invalid phone
2026-03-10 17:25:09 +04:00

26 lines
649 B
TypeScript

import { mutation } from "./_generated/server";
import { v } from "convex/values";
export const submit = mutation({
args: {
name: v.string(),
email: v.string(),
organization: v.optional(v.string()),
phone: v.optional(v.string()),
message: v.optional(v.string()),
source: v.string(),
},
handler: async (ctx, args) => {
await ctx.db.insert("contactMessages", {
name: args.name,
email: args.email,
organization: args.organization,
phone: args.phone,
message: args.message,
source: args.source,
receivedAt: Date.now(),
});
return { status: "sent" as const };
},
});