The Postgres development platform. Supabase gives you a dedicated Postgres database to build your web, mobile, and AI applications.
TypeScript aialternativeauthdatabasedenoembeddingsexamplefirebasenextjsoauth2pgvectorpostgispostgrespostgresqlpostgrestrealtimesupabasevectorswebsockets
feat: sales contact form (#29365)
Francesco Sansalvadore7ffa0af67a7a
diff --git a/apps/www/app/api-v2/submit-form-contact-sales/route.tsx b/apps/www/app/api-v2/submit-form-contact-sales/route.tsxnew file mode 100644index 00000000000..b41b5d08117--- /dev/null+++ b/apps/www/app/api-v2/submit-form-contact-sales/route.tsx@@ -0,0 +1,67 @@+const corsHeaders = {+ 'Access-Control-Allow-Origin': '*',+ 'Access-Control-Allow-Headers': 'authorization, x-client-info, apikey, content-type',+}++export async function POST(req: Request) {+ const HUBSPOT_PORTAL_ID = process.env.HUBSPOT_PORTAL_ID+ const HUBSPOT_FORM_GUID = process.env.HUBSPOT_ENTERPRISE_FORM_GUID++ const body = await req.json()+ const { firstName, secondName, companyEmail, message } = body++ if (!firstName || !secondName || !companyEmail || !message) {+ return new Response(JSON.stringify({ message: 'All fields are required' }), {+ headers: { ...corsHeaders, 'Content-Type': 'application/json' },+ status: 400,+ })+ }++ try {+ const response = await fetch(+ `https://api.hsforms.com/submissions/v3/integration/submit/${HUBSPOT_PORTAL_ID}/${HUBSPOT_FORM_GUID}`,+ {+ method: 'POST',+ headers: {+ 'Content-Type': 'application/json',+ },+ body: JSON.stringify({+ fields: [+ { objectTypeId: '0-1', name: 'firstname', value: firstName },+ { objectTypeId: '0-1', name: 'lastname', value: secondName },+ { objectTypeId: '0-1', name: 'email', value: companyEmail },+ { objectTypeId: '0-1', name: 'message', value: message },+ ],+ context: {+ pageUri: 'https://supabase.com/contact/sales',+ pageName: 'Enterprise Demo Request Form',+ },+ legalConsentOptions: {+ consent: {+ consentToProcess: true,+ text: 'By submitting this form, I confirm that I have read and understood the Privacy Policy.',+ },+ },+ }),+ }+ )++ if (!response.ok) {+ const errorData = await response.json()+ return new Response(JSON.stringify({ message: errorData.message }), {+ headers: { ...corsHeaders, 'Content-Type': 'application/json' },+ status: response.status,+ })+ }++ return new Response(JSON.stringify({ message: 'Submission successful' }), {+ headers: { ...corsHeaders, 'Content-Type': 'application/json' },+ status: 200,+ })+ } catch (error: any) {+ return new Response(JSON.stringify({ error: error.message }), {+ headers: { ...corsHeaders, 'Content-Type': 'application/json' },+ status: 500,+ })+ }+}diff --git a/apps/www/components/CTABanner/index.tsx b/apps/www/components/CTABanner/index.tsxindex e508db71282..6e783f2bc6d 100644--- a/apps/www/components/CTABanner/index.tsx+++ b/apps/www/components/CTABanner/index.tsx@@ -1,4 +1,5 @@-import { Button } from 'ui'+import Link from 'next/link'+import { Button, cn } from 'ui'interface Props {className?: string@@ -8,11 +9,11 @@ interface Props {const CTABanner = ({ darkerBg, className }: Props) => {return (<div- className={[+ className={cn(`bg-background grid grid-cols-12 items-center gap-4 border-t py-32 text-center px-16`,darkerBg && 'bg-alternative',- className,- ].join(' ')}+ className+ )}><div className="col-span-12"><h2 className="h2">@@ -20,10 +21,13 @@ const CTABanner = ({ darkerBg, className }: Props) => {<span className="text-foreground block sm:inline"> scale to billions</span></h2></div>- <div className="col-span-12 mt-4">- <a href="https://supabase.com/dashboard">- <Button size="medium">Start your project</Button>- </a>+ <div className="flex items-center justify-center gap-2 col-span-12 mt-4">+ <Button asChild size="medium">+ <Link href="https://supabase.com/dashboard">Start your project</Link>+ </Button>+ <Button asChild size="medium" type="default">+ <Link href="/contact/sales">Request a demo</Link>+ </Button></div></div>)diff --git a/apps/www/components/EnterpriseFormQuotes.tsx b/apps/www/components/EnterpriseFormQuotes.tsxnew file mode 100644index 00000000000..9a765d2b442--- /dev/null+++ b/apps/www/components/EnterpriseFormQuotes.tsx@@ -0,0 +1,128 @@+import { useEffect, useState } from 'react'+import { AnimatePresence, motion, useAnimation } from 'framer-motion'+import { cn } from 'ui'++interface TabProps {+ label: string | JSX.Element+ isActive: boolean+ onClick: VoidFunction+}++const Tab = ({ isActive, label, onClick }: TabProps) => (+ <button+ onClick={onClick}+ className={`text-left text-lg flex flex-col group gap-1 transition-opacity flex-[1] ${+ isActive ? 'opacity-100' : 'opacity-50'+ }`}+ aria-selected={isActive}+ role="tab"+ >+ <div>{label}</div>+ </button>+)++interface Tab {+ label: string | JSX.Element+ paragraph?: string+ panel: JSX.Element+}++interface Props {+ tabs: Tab[]+ intervalDuration?: number+ updateFrequency?: number+ className?: string+}++const EnterpriseFormQuotes = ({+ tabs,+ intervalDuration = 25,+ updateFrequency = 10,+ className,+}: Props) => {+ const [activeTab, setActiveTab] = useState(0)+ const [progress, setProgress] = useState(0)+ const [isPaused, setIsPaused] = useState(false)+ const controls = useAnimation()++ const restartInterval = (tabIndex: number) => {+ setProgress(0)+ setActiveTab(tabIndex)+ }++ const animation = {+ width: '100%',+ transition: { duration: intervalDuration, ease: 'linear' },+ }++ useEffect(() => {+ const progressIncrement = (100 / intervalDuration) * (updateFrequency / 1000)++ controls.start(animation)++ const progressInterval = setInterval(() => {+ if (isPaused) return setProgress(0)+ setProgress((prevProgress) => (prevProgress + progressIncrement) % 101)+ }, updateFrequency)++ return () => {+ clearInterval(progressInterval)+ setProgress(0)+ }+ }, [activeTab, controls, isPaused])++ useEffect(() => {+ if (progress >= 100.9) {+ setActiveTab((prevActiveTab) => (prevActiveTab === tabs.length - 1 ? 0 : prevActiveTab + 1))+ }+ }, [progress])++ const handleTabClick = (tabIndex: number) => {+ restartInterval(tabIndex)+ }++ return (+ <div+ className={cn('flex flex-col gap-6 w-full', className)}+ onMouseEnter={() => setIsPaused(true)}+ onMouseLeave={() => setIsPaused(false)}+ >+ {/* dynamic quote */}+ <AnimatePresence mode="wait">+ <motion.div+ key={activeTab}+ initial={{ opacity: 0 }}+ animate={{ opacity: 1, transition: { duration: 0.1, delay: 0.2 } }}+ exit={{ opacity: 0, transition: { duration: 0.05 } }}+ className="text-foreground-lighter text-sm"+ >+ {tabs[activeTab]?.panel}+ </motion.div>+ </AnimatePresence>+ {/* progress bar */}+ <div className="relative w-full h-[1px] bg-border-strong opacity-80 group-hover:opacity-100 rounded-full overflow-hidden">+ <motion.div+ className={cn(+ 'absolute motion-reduce:hidden inset-0 w-full right-full bg-brand h-full transition-all',+ progress! > 99.7 ? 'opacity-0' : 'opacity-100'+ )}+ style={{ x: `${progress! - 100}%` }}+ transition={{ duration: intervalDuration }}+ />+ </div>+ {/* tabs */}+ <div className="w-full col-span-full flex gap-4 lg:gap-8 xl:gap-10" role="tablist">+ {tabs.map((tab, index) => (+ <Tab+ key={index}+ isActive={index === activeTab}+ label={tab.label}+ onClick={() => handleTabClick(index)}+ />+ ))}+ </div>+ </div>+ )+}++export default EnterpriseFormQuotesdiff --git a/apps/www/components/Forms/RequestADemoForm.tsx b/apps/www/components/Forms/RequestADemoForm.tsxnew file mode 100644index 00000000000..81f59845535--- /dev/null+++ b/apps/www/components/Forms/RequestADemoForm.tsx@@ -0,0 +1,265 @@+import { FC, useEffect, useState } from 'react'+import Link from 'next/link'+import { CircleAlert } from 'lucide-react'+import { Button, cn, Input_Shadcn_, Label_Shadcn_, Separator, TextArea_Shadcn_ } from 'ui'+import { Alert } from 'ui/src/components/shadcn/ui/alert'++interface FormData {+ firstName: string+ secondName: string+ companyEmail: string+ message: string+}++interface FormItem {+ type: 'text' | 'textarea'+ label: string+ placeholder: string+ required: boolean+ className?: string+ component: typeof TextArea_Shadcn_ | typeof Input_Shadcn_+}++type FormConfig = {+ [K in keyof FormData]: FormItem+}++interface Props {+ className?: string+}++const formConfig: FormConfig = {+ firstName: {+ type: 'text',+ label: 'First Name',+ placeholder: 'First Name',+ required: true,+ className: 'md:col-span-1',+ component: Input_Shadcn_,+ },+ secondName: {+ type: 'text',+ label: 'Last Name',+ placeholder: 'Last Name',+ required: true,+ className: 'md:col-span-1',+ component: Input_Shadcn_,+ },+ companyEmail: {+ type: 'text',+ label: 'Company Email',+ placeholder: 'Company Email',+ required: true,+ className: '',+ component: Input_Shadcn_,+ },+ message: {+ type: 'textarea',+ label: 'What are you interested in?',+ placeholder: 'Share more about what you want to accomplish',+ required: true,+ className: '[&_textarea]:min-h-[100px] [&_textarea]:bg-foreground/[.026]',+ component: TextArea_Shadcn_,+ },+}++const isValidEmail = (email: string): boolean => {+ const emailPattern = /^[\w-\.+]+@([\w-]+\.)+[\w-]{2,8}$/+ return emailPattern.test(email)+}++const defaultFormValue: FormData = {+ firstName: '',+ secondName: '',+ companyEmail: '',+ message: '',+}++const RequestADemoForm: FC<Props> = ({ className }) => {+ const [formData, setFormData] = useState<FormData>(defaultFormValue)+ const [honeypot, setHoneypot] = useState<string>('') // field to prevent spam+ const [errors, setErrors] = useState<{ [key: string]: string }>({})+ const [isSubmitting, setIsSubmitting] = useState(false)+ const [success, setSuccess] = useState<string | null>(null)+ const [startTime, setStartTime] = useState<number>(0)++ const handleChange = (e: React.ChangeEvent<HTMLInputElement | HTMLTextAreaElement>) => {+ const { name, value } = e.target+ setErrors({})+ setFormData((prev) => ({ ...prev, [name]: value }))+ }++ const handleReset = (e: React.MouseEvent<HTMLButtonElement, MouseEvent>) => {+ e.preventDefault()+ setFormData(defaultFormValue)+ setSuccess(null)+ setErrors({})+ }++ const validate = (): boolean => {+ const newErrors: { [key in keyof FormData]?: string } = {}++ // Check required fields+ for (const key in formConfig) {+ if (formConfig[key as keyof FormData].required && !formData[key as keyof FormData]) {+ newErrors[key as keyof FormData] = `This field is required`+ }+ }++ // Validate email+ if (formData.companyEmail && !isValidEmail(formData.companyEmail)) {+ newErrors.companyEmail = 'Invalid email address'+ }++ setErrors(newErrors)++ // Return validation status, also check if honeypot is filled (indicating a bot)+ return Object.keys(newErrors).length === 0 && honeypot === ''+ }++ const handleSubmit = async (e: React.FormEvent) => {+ e.preventDefault()++ const currentTime = Date.now()+ const timeElapsed = (currentTime - startTime) / 1000++ // Spam prevention: Reject form if submitted too quickly (less than 3 seconds)+ if (timeElapsed < 3) {+ setErrors({ general: 'Submission too fast. Please fill the form correctly.' })+ return+ }++ if (!validate()) {+ return+ }++ setIsSubmitting(true)+ setSuccess(null)++ try {+ const response = await fetch('/api-v2/submit-form-contact-sales', {+ method: 'POST',+ headers: {+ 'Content-Type': 'application/json',+ },+ body: JSON.stringify(formData),+ })++ if (response.ok) {+ setSuccess('Thank you for your submission!')+ setFormData({ firstName: '', secondName: '', companyEmail: '', message: '' })+ } else {+ const errorData = await response.json()+ setErrors({ general: `Submission failed: ${errorData.message}` })+ }+ } catch (error) {+ setErrors({ general: 'An unexpected error occurred. Please try again.' })+ } finally {+ setIsSubmitting(false)+ }+ }++ useEffect(() => {+ setStartTime(Date.now())+ }, [])++ return (+ <div+ className={cn(+ 'flex flex-col gap-4 w-full items-center justify-center min-h-[300px]',+ className+ )}+ >+ <div className="border rounded-xl bg-surface-75 p-4 md:p-6 w-full md:max-w-lg min-h-[200px] md:min-h-[400px]">+ {success ? (+ <div className="flex flex-col h-full w-full min-w-[300px] gap-4 items-center justify-center opacity-0 transition-opacity animate-fade-in scale-1">+ <p className="text-center text-sm">{success}</p>+ <Button onClick={handleReset}>Reset</Button>+ </div>+ ) : (+ <form+ id="support-form"+ className={cn('flex flex-col lg:grid lg:grid-cols-2 gap-4')}+ onSubmit={handleSubmit}+ >+ {Object.entries(formConfig).map(([key, { component: Component, ...fieldValue }]) => {+ const fieldKey = key as keyof FormData++ return (+ <div+ key={key}+ className={cn('flex flex-col col-span-full gap-y-2', fieldValue.className)}+ >+ <Label_Shadcn_+ htmlFor={fieldKey}+ className="text-foreground-light flex justify-between"+ >+ {fieldValue.label}+ <div+ className={cn(+ 'flex flex-nowrap text-right gap-1 items-center text-xs leading-none transition-opacity opacity-0 text-foreground-muted',+ errors[key as keyof FormData] && 'opacity-100 animate-fade-in'+ )}+ >+ {errors[fieldKey]}+ </div>+ </Label_Shadcn_>+ <Component+ type="text"+ id={fieldKey}+ name={fieldKey}+ value={formData[fieldKey]}+ onChange={handleChange}+ placeholder={fieldValue.placeholder}+ />+ </div>+ )+ })}++ {/* Spam prevention */}+ <input+ type="text"+ name="honeypot"+ value={honeypot}+ onChange={(e: React.ChangeEvent<HTMLInputElement>) => setHoneypot(e.target.value)}+ style={{ display: 'none' }}+ aria-hidden="true"+ />++ <Separator className="col-span-full" />+ <Button+ block+ htmlType="submit"+ size="small"+ className="col-span-full"+ disabled={isSubmitting}+ loading={isSubmitting}+ >+ Request a demo+ </Button>+ <p className="text-foreground-lighter text-sm col-span-full">+ By submitting this form, I confirm that I have read and understood the{' '}+ <Link href="/privacy" className="text-foreground hover:underline">+ Privacy Policy+ </Link>+ .+ </p>+ {errors.general && (+ <Alert className="flex gap-2 text-foreground text-sm col-span-full">+ <CircleAlert className="w-3 h-3" /> <span>{errors.general}</span>+ </Alert>+ )}+ </form>+ )}+ </div>+ <p className="text-foreground-lighter text-sm">+ <Link href="/support" className="text-foreground hover:underline">+ Contact support+ </Link>{' '}+ if you need technical help+ </p>+ </div>+ )+}++export default RequestADemoFormdiff --git a/apps/www/components/Hero/Hero.tsx b/apps/www/components/Hero/Hero.tsxindex f4ec5319e98..c71af5cc2df 100644--- a/apps/www/components/Hero/Hero.tsx+++ b/apps/www/components/Hero/Hero.tsx@@ -43,13 +43,13 @@ const Hero = () => {Start your project</Link></Button>- <Button asChild size="medium" type="default" icon={<BookOpen />}>+ <Button asChild size="medium" type="default"><Link- href="/docs"- as="/docs"- onClick={() => sendTelemetryEvent(gaEvents['www_hp_hero_documentation'])}+ href="/contact/sales"+ as="/contact/sales"+ onClick={() => sendTelemetryEvent(gaEvents['www_hp_hero_requestDemo'])}>- Documentation+ Request a demo</Link></Button></div>diff --git a/apps/www/pages/contact/sales.tsx b/apps/www/pages/contact/sales.tsxnew file mode 100644index 00000000000..8bda2255f55--- /dev/null+++ b/apps/www/pages/contact/sales.tsx@@ -0,0 +1,158 @@+import Image from 'next/image'+import { useRouter } from 'next/router'+import { NextSeo } from 'next-seo'+import { cn } from 'ui'++import DefaultLayout from '~/components/Layouts/Default'+import SectionContainer from '~/components/Layouts/SectionContainer'+import EnterpriseFormQuotes from '~/components/EnterpriseFormQuotes'+import RequestADemoForm from '~/components/Forms/RequestADemoForm'++const data = {+ meta_title: 'Contact Sales & Request a Demo | Supabase',+ meta_description: 'Book a demo to explore how Supabase can support your business growth',+}++const ContactSales = () => {+ const router = useRouter()++ return (+ <>+ <NextSeo+ title={data.meta_title}+ description={data.meta_description}+ openGraph={{+ title: data.meta_title,+ description: data.meta_description,+ url: `https://supabase.com/${router.pathname}`,+ }}+ />+ <DefaultLayout className="!min-h-fit">+ <SectionContainer className="text grid gap-8 lg:gap-12 md:grid-cols-2">+ <div className="md:px-4 lg:pb-8 md:h-full w-full flex flex-col justify-between gap-2">+ <div className="flex flex-col gap-2 md:max-w-md">+ <h1 className="h1 !m-0">Talk to our Sales team</h1>+ <p className="md:text-lg text-foreground-lighter">+ Book a demo and set up a trial Enterprise account to see how Supabase's scalable+ features can accelerate your business growth and app development.+ </p>+ </div>+ <EnterpriseFormQuotes+ className="hidden md:flex"+ tabs={[+ {+ label: (+ <CustomerLogo title="Goodtape" logo="/images/customers/logos/good-tape.png" />+ ),+ panel: (+ <CustomerQuote+ quote="My biggest regret is not having gone with Supabase from the beginning."+ author="Jakob Steinn, Co-founder & Tech Lead, Good Tape"+ />+ ),+ },+ {+ label: <CustomerLogo title="Xendit" logo="/images/customers/logos/xendit.png" />,+ panel: (+ <CustomerQuote+ quote="The full solution was built and in production in less than one week."+ author="Developer, Xendit"+ />+ ),+ },+ {+ label: (+ <CustomerLogo title="Chatbase" logo="/images/customers/logos/chatbase.png" />+ ),+ panel: (+ <CustomerQuote+ quote="Supabase is great because it has everything. I don’t need a different solution for authentication, a different solution for database, or a different solution for storage."+ author="Yasser Elsaid, Founder, Chatbase"+ className="max-w-none"+ />+ ),+ },+ ]}+ />+ </div>+ <RequestADemoForm />+ <EnterpriseFormQuotes+ className="md:hidden mt-4"+ tabs={[+ {+ label: (+ <CustomerLogo title="Goodtape" logo="/images/customers/logos/good-tape.png" />+ ),+ panel: (+ <CustomerQuote+ quote="My biggest regret is not having gone with Supabase from the beginning."+ author="Jakob Steinn Co-founder & Tech Lead"+ />+ ),+ },+ {+ label: <CustomerLogo title="Xendit" logo="/images/customers/logos/xendit.png" />,+ panel: (+ <CustomerQuote+ quote="The full solution was built and in production in less than one week."+ author="Xendit developer"+ />+ ),+ },+ {+ label: (+ <CustomerLogo title="Chatbase" logo="/images/customers/logos/chatbase.png" />+ ),+ panel: (+ <CustomerQuote+ quote="Supabase is great because it has everything. I don’t need a different solution for authentication, a different solution for database, or a different solution for storage."+ author="Yasser Elsaid, Founder, Chatbase"+ className="max-w-none"+ />+ ),+ },+ ]}+ />+ </SectionContainer>+ </DefaultLayout>+ </>+ )+}++const CustomerQuote = ({+ quote,+ author,+ className,+}: {+ quote: string+ author: string+ className?: string+}) => (+ <div+ className={cn('text-foreground flex text-base lg:text-lg flex-col gap-1 max-w-xs', className)}+ >+ <p>"{quote}"</p>+ <p className="text-foreground-lighter text-sm">{author}</p>+ </div>+)++const CustomerLogo = ({ title, logo }: { title: string; logo: string }) => (+ <div className="relative h-8 max-h-6 w-28">+ <Image+ fill+ src={logo}+ alt={`${title} logo`}+ priority+ draggable={false}+ className="+ bg-no-repeat m-0+ object-left object-contain+ [[data-theme*=dark]_&]:brightness-200+ [[data-theme*=dark]_&]:contrast-0+ [[data-theme*=dark]_&]:filter+ "+ />+ </div>+)++export default ContactSalesdiff --git a/turbo.json b/turbo.jsonindex 8ee2d47c9e9..f1f79fd0664 100644--- a/turbo.json+++ b/turbo.json@@ -61,7 +61,9 @@"OPENAI_API_KEY","npm_lifecycle_event","LIVE_SUPABASE_COM_SERVICE_ROLE_KEY",- "VERCEL_URL"+ "VERCEL_URL",+ "HUBSPOT_PORTAL_ID",+ "HUBSPOT_ENTERPRISE_FORM_GUID"],"outputs": [".next/**", "!.next/cache/**", ".contentlayer/**"]},