Skip to content

The Postgres development platform. Supabase gives you a dedicated Postgres database to build your web, mobile, and AI applications.

/go pages: adding meeting scheduler widget (#43999)

Alan Daniele9176049dc38
diff --git a/apps/www/_go/lead-gen/example-lead-gen.tsx b/apps/www/_go/lead-gen/example-lead-gen.tsx
index c6a234dd6df..a41ea042b64 100644
--- a/apps/www/_go/lead-gen/example-lead-gen.tsx
+++ b/apps/www/_go/lead-gen/example-lead-gen.tsx
@@ -204,6 +204,12 @@ alter table posts enable row level security;`,
},
],
},
+ {
+ type: 'hubspot-meeting',
+ title: 'Schedule a meeting',
+ description: 'Pick a time that works for you to chat with our team.',
+ meetingSlug: 'alan-de-los-santos-rodriguez/test-scheduling-page-go-pages-testing',
+ },
{
type: 'tweets',
title: 'Loved by developers',
diff --git a/apps/www/app/api-v2/hubspot-meetings/[slug]/availability/route.ts b/apps/www/app/api-v2/hubspot-meetings/[slug]/availability/route.ts
new file mode 100644
index 00000000000..1718da6f679
--- /dev/null
+++ b/apps/www/app/api-v2/hubspot-meetings/[slug]/availability/route.ts
@@ -0,0 +1,35 @@
+import { NextRequest, NextResponse } from 'next/server'
+
+import { getMockAvailability, shouldUseMock } from '../../mock'
+
+const HUBSPOT_BASE =
+ 'https://api.hubspot.com/scheduler/v3/meetings/meeting-links/book/availability-page'
+
+export async function GET(request: NextRequest, { params }: { params: Promise<{ slug: string }> }) {
+ const { searchParams } = new URL(request.url)
+ const timezone = searchParams.get('timezone') || 'America/New_York'
+
+ if (shouldUseMock()) {
+ return NextResponse.json(getMockAvailability(timezone))
+ }
+
+ const token = process.env.HUBSPOT_MEETINGS_TOKEN
+ if (!token) {
+ return NextResponse.json({ error: 'HubSpot token not configured' }, { status: 500 })
+ }
+
+ const { slug } = await params
+ const url = `${HUBSPOT_BASE}/${encodeURIComponent(slug)}?timezone=${encodeURIComponent(timezone)}`
+
+ const res = await fetch(url, {
+ headers: { Authorization: `Bearer ${token}` },
+ })
+
+ if (!res.ok) {
+ const text = await res.text()
+ return NextResponse.json({ error: 'HubSpot API error', detail: text }, { status: res.status })
+ }
+
+ const data = await res.json()
+ return NextResponse.json(data)
+}
diff --git a/apps/www/app/api-v2/hubspot-meetings/[slug]/route.ts b/apps/www/app/api-v2/hubspot-meetings/[slug]/route.ts
new file mode 100644
index 00000000000..318f9559601
--- /dev/null
+++ b/apps/www/app/api-v2/hubspot-meetings/[slug]/route.ts
@@ -0,0 +1,57 @@
+import { NextRequest, NextResponse } from 'next/server'
+
+import { getMockBookingInfo, shouldUseMock } from '../mock'
+
+const HUBSPOT_BASE = 'https://api.hubspot.com/scheduler/v3/meetings/meeting-links/book'
+
+export async function GET(request: NextRequest, { params }: { params: Promise<{ slug: string }> }) {
+ const { searchParams } = new URL(request.url)
+ const timezone = searchParams.get('timezone') || 'America/New_York'
+ const monthOffset = parseInt(searchParams.get('monthOffset') || '0', 10)
+
+ if (shouldUseMock()) {
+ return NextResponse.json(getMockBookingInfo(timezone, monthOffset))
+ }
+
+ const token = process.env.HUBSPOT_MEETINGS_TOKEN
+ if (!token) {
+ return NextResponse.json({ error: 'HubSpot token not configured' }, { status: 500 })
+ }
+
+ const { slug } = await params
+ const url = `${HUBSPOT_BASE}/${encodeURIComponent(slug)}?timezone=${encodeURIComponent(timezone)}&monthOffset=${encodeURIComponent(String(monthOffset))}`
+
+ const res = await fetch(url, {
+ headers: { Authorization: `Bearer ${token}` },
+ })
+
+ if (!res.ok) {
+ const text = await res.text()
+ return NextResponse.json({ error: 'HubSpot API error', detail: text }, { status: res.status })
+ }
+
+ const data = await res.json()
+
+ // HubSpot returns `durations` but our types expect `availableDurations`
+ if (data.customParams?.durations && !data.customParams.availableDurations) {
+ data.customParams.availableDurations = data.customParams.durations
+ }
+
+ // Transform linkAvailability from HubSpot's nested structure to a flat Record<string, TimeSlot[]>
+ // HubSpot returns: { linkAvailabilityByDuration: { "1800000": { availabilities: [...] } } }
+ // We need: { "1800000": [...] }
+ if (data.linkAvailability?.linkAvailabilityByDuration) {
+ const flat: Record<string, Array<{ startMillisUtc: number; endMillisUtc: number }>> = {}
+ for (const [duration, value] of Object.entries(
+ data.linkAvailability.linkAvailabilityByDuration as Record<
+ string,
+ { availabilities?: Array<{ startMillisUtc: number; endMillisUtc: number }> }
+ >
+ )) {
+ flat[duration] = value.availabilities ?? []
+ }
+ data.linkAvailability = flat
+ }
+
+ return NextResponse.json(data)
+}
diff --git a/apps/www/app/api-v2/hubspot-meetings/book/route.ts b/apps/www/app/api-v2/hubspot-meetings/book/route.ts
new file mode 100644
index 00000000000..b50e08fe8aa
--- /dev/null
+++ b/apps/www/app/api-v2/hubspot-meetings/book/route.ts
@@ -0,0 +1,59 @@
+import { NextRequest, NextResponse } from 'next/server'
+
+import { getMockBookingConfirmation, shouldUseMock } from '../mock'
+
+const HUBSPOT_BASE = 'https://api.hubspot.com/scheduler/v3/meetings/meeting-links/book'
+
+export async function POST(request: NextRequest) {
+ const body = await request.json()
+
+ if (shouldUseMock()) {
+ return NextResponse.json(getMockBookingConfirmation(body))
+ }
+
+ const token = process.env.HUBSPOT_MEETINGS_TOKEN
+ if (!token) {
+ return NextResponse.json({ error: 'HubSpot token not configured' }, { status: 500 })
+ }
+
+ const timezone = body.timezone || 'America/New_York'
+ const url = `${HUBSPOT_BASE}?timezone=${encodeURIComponent(timezone)}`
+
+ // Transform into HubSpot's expected format
+ // startTime must be ISO 8601, formFields is required (can be empty)
+ const hubspotBody = {
+ slug: body.slug,
+ email: body.email,
+ firstName: body.firstName,
+ lastName: body.lastName,
+ startTime: new Date(body.startTime).toISOString(),
+ duration: body.duration,
+ timezone,
+ locale: body.locale || 'en-us',
+ formFields: body.formFields ?? [],
+ likelyAvailableUserIds: body.likelyAvailableUserIds ?? [],
+ legalConsentResponses: body.legalConsentResponses ?? [],
+ ...(body.guestEmails?.length ? { guestEmails: body.guestEmails } : {}),
+ }
+
+ const res = await fetch(url, {
+ method: 'POST',
+ headers: {
+ Authorization: `Bearer ${token}`,
+ 'Content-Type': 'application/json',
+ },
+ body: JSON.stringify(hubspotBody),
+ })
+
+ if (!res.ok) {
+ const text = await res.text()
+ console.error('[HubSpot booking error]', { status: res.status, body: text })
+ return NextResponse.json(
+ { error: 'Booking failed. Please try again or contact support.' },
+ { status: res.status }
+ )
+ }
+
+ const data = await res.json()
+ return NextResponse.json(data)
+}
diff --git a/apps/www/app/api-v2/hubspot-meetings/mock.ts b/apps/www/app/api-v2/hubspot-meetings/mock.ts
new file mode 100644
index 00000000000..dfe8acb90f2
--- /dev/null
+++ b/apps/www/app/api-v2/hubspot-meetings/mock.ts
@@ -0,0 +1,102 @@
+/**
+ * Mock data for local development when HUBSPOT_MEETINGS_TOKEN is not set.
+ * Only used when NEXT_PUBLIC_VERCEL_ENV !== 'production'.
+ */
+
+const IS_PROD = process.env.NEXT_PUBLIC_VERCEL_ENV === 'production'
+
+export function shouldUseMock(): boolean {
+ return !process.env.HUBSPOT_MEETINGS_TOKEN && !IS_PROD
+}
+
+/** Generate mock time slots for the next 30 days, excluding weekends */
+function generateMockSlots(
+ timezone: string,
+ monthOffset: number
+): Record<string, Array<{ startMillisUtc: number; endMillisUtc: number }>> {
+ const now = new Date()
+ const target = new Date(now.getFullYear(), now.getMonth() + monthOffset, 1)
+ const daysInMonth = new Date(target.getFullYear(), target.getMonth() + 1, 0).getDate()
+
+ const DURATION_30_MIN = 1800000
+ const slots: Array<{ startMillisUtc: number; endMillisUtc: number }> = []
+
+ for (let d = 1; d <= daysInMonth; d++) {
+ const date = new Date(target.getFullYear(), target.getMonth(), d)
+ const dayOfWeek = date.getDay()
+
+ // Skip weekends
+ if (dayOfWeek === 0 || dayOfWeek === 6) continue
+
+ // Skip past dates
+ if (date < new Date(now.getFullYear(), now.getMonth(), now.getDate())) continue
+
+ // Add slots from 9am to 5pm in 30-min increments
+ for (let hour = 9; hour < 17; hour++) {
+ for (const min of [0, 30]) {
+ const slotDate = new Date(date)
+ slotDate.setHours(hour, min, 0, 0)
+ slots.push({
+ startMillisUtc: slotDate.getTime(),
+ endMillisUtc: slotDate.getTime() + DURATION_30_MIN,
+ })
+ }
+ }
+ }
+
+ return { [String(DURATION_30_MIN)]: slots }
+}
+
+export function getMockBookingInfo(timezone: string, monthOffset: number) {
+ return {
+ linkId: 'mock-link-id',
+ linkType: 'PERSONAL_LINK',
+ isOffline: false,
+ customParams: {
+ formFields: [
+ { name: 'firstName', label: 'First name', required: true, fieldType: 'text' },
+ { name: 'lastName', label: 'Last name', required: true, fieldType: 'text' },
+ { name: 'email', label: 'Email', required: true, fieldType: 'email' },
+ ],
+ allowsGuests: false,
+ meetingBufferTime: 0,
+ availableDurations: [1800000], // 30 min
+ },
+ availabilityByDay: {},
+ allUsersBusyTimes: [],
+ linkAvailability: generateMockSlots(timezone, monthOffset),
+ branding: {
+ companyName: 'Mock Company',
+ },
+ }
+}
+
+export function getMockAvailability(timezone: string) {
+ return getMockBookingInfo(timezone, 0)
+}
+
+export function getMockBookingConfirmation(body: {
+ startTime: number
+ duration: number
+ timezone: string
+ email: string
+ firstName: string
+ lastName: string
+}) {
+ const start = new Date(body.startTime)
+ const end = new Date(body.startTime + body.duration)
+
+ return {
+ calendarEventId: 'mock-event-' + Date.now(),
+ start: start.toISOString(),
+ end: end.toISOString(),
+ duration: body.duration,
+ contactId: 'mock-contact-id',
+ bookingTimezone: body.timezone,
+ locale: 'en-US',
+ guestEmails: [],
+ subject: `Meeting with ${body.firstName} ${body.lastName}`,
+ location: 'Zoom (mock)',
+ isOffline: false,
+ }
+}
diff --git a/packages/marketing/src/go/schemas.ts b/packages/marketing/src/go/schemas.ts
index 826adfac939..7772143d153 100644
--- a/packages/marketing/src/go/schemas.ts
+++ b/packages/marketing/src/go/schemas.ts
@@ -289,6 +289,15 @@ export const quoteSectionSchema = z.object({
avatar: imageSchema.optional(),
})
+export const hubspotMeetingSectionSchema = z.object({
+ ...sectionBase,
+ type: z.literal('hubspot-meeting'),
+ title: z.string().optional(),
+ description: z.string().optional(),
+ /** The HubSpot meeting link path, e.g. "your-name/meeting-type" */
+ meetingSlug: z.string().min(1),
+})
+
// ----- Dynamic sections -----
export const goSectionSchema = z.discriminatedUnion('type', [
@@ -303,6 +312,7 @@ export const goSectionSchema = z.discriminatedUnion('type', [
codeBlockSectionSchema,
stepsSectionSchema,
quoteSectionSchema,
+ hubspotMeetingSectionSchema,
])
// ----- Page-level schemas -----
@@ -374,6 +384,7 @@ export type GoCodeBlockSection = z.infer<typeof codeBlockSectionSchema>
export type GoStepItem = z.infer<typeof stepItemSchema>
export type GoStepsSection = z.infer<typeof stepsSectionSchema>
export type GoQuoteSection = z.infer<typeof quoteSectionSchema>
+export type GoHubSpotMeetingSection = z.infer<typeof hubspotMeetingSectionSchema>
export type GoSection = z.infer<typeof goSectionSchema>
export type GoMetadata = z.infer<typeof metadataSchema>
diff --git a/packages/marketing/src/go/sections/HubSpotMeetingSection.tsx b/packages/marketing/src/go/sections/HubSpotMeetingSection.tsx
new file mode 100644
index 00000000000..7cd34779c61
--- /dev/null
+++ b/packages/marketing/src/go/sections/HubSpotMeetingSection.tsx
@@ -0,0 +1,173 @@
+'use client'
+
+import { useEffect, useMemo, useRef, useState } from 'react'
+
+import type { GoHubSpotMeetingSection } from '../schemas'
+import BookingForm from './hubspot-meeting/BookingForm'
+import CalendarPicker from './hubspot-meeting/CalendarPicker'
+import Confirmation from './hubspot-meeting/Confirmation'
+import TimeSlotPicker from './hubspot-meeting/TimeSlotPicker'
+import TimezoneSelector from './hubspot-meeting/TimezoneSelector'
+import { useScheduler } from './hubspot-meeting/useScheduler'
+
+export default function HubSpotMeetingSection({ section }: { section: GoHubSpotMeetingSection }) {
+ const sectionRef = useRef<HTMLDivElement>(null)
+ const [isInView, setIsInView] = useState(false)
+
+ useEffect(() => {
+ const el = sectionRef.current
+ if (!el) return
+
+ const observer = new IntersectionObserver(
+ ([entry]) => {
+ if (entry.isIntersecting) {
+ setIsInView(true)
+ observer.disconnect()
+ }
+ },
+ { rootMargin: '-40% 0px -40% 0px' }
+ )
+
+ observer.observe(el)
+ return () => observer.disconnect()
+ }, [])
+
+ const {
+ state,
+ timezone,
+ availableDates,
+ slotsForSelectedDate,
+ availableMonthOffsets,
+ selectDate,
+ selectSlot,
+ goBackToDate,
+ goBackToTime,
+ changeMonth,
+ setTimezone,
+ submitBooking,
+ retry,
+ dismissError,
+ } = useScheduler(section.meetingSlug, isInView)
+
+ const selectedTimeLabel = useMemo(() => {
+ if (!state.selectedSlot) return ''
+ return new Date(state.selectedSlot.startMillisUtc).toLocaleTimeString('en-US', {
+ hour: 'numeric',
+ minute: '2-digit',
+ timeZone: timezone,
+ })
+ }, [state.selectedSlot, timezone])
+
+ return (
+ <div ref={sectionRef} className="max-w-[80rem] mx-auto px-8">
+ {(section.title || section.description) && (
+ <div className="max-w-3xl mx-auto text-center mb-12">
+ {section.title && (
+ <h2 className="text-foreground text-2xl sm:text-3xl font-medium">{section.title}</h2>
+ )}
+ {section.description && (
+ <p className="text-foreground-lighter mt-3 text-lg">{section.description}</p>
+ )}
+ </div>
+ )}
+
+ <div className="max-w-md mx-auto border border-muted rounded-xl bg-surface-100 p-6 min-h-[440px] flex flex-col h-full">
+ {state.step === 'loading' && (
+ <div className="flex items-center justify-center h-full min-h-[inherit]">
+ <svg
+ width="24"
+ height="24"
+ viewBox="0 0 24 24"
+ fill="none"
+ stroke="currentColor"
+ strokeWidth="2"
+ strokeLinecap="round"
+ strokeLinejoin="round"
+ className="animate-spinner text-foreground-muted"
+ >
+ <path d="M21 12a9 9 0 1 1-6.219-8.56" />
+ </svg>
+ </div>
+ )}
+
+ {state.step === 'error' && (
+ <div className="flex flex-col items-center justify-center h-full min-h-[inherit] gap-3">
+ <div className="rounded-full bg-destructive-200/50 p-3">
+ <svg
+ width="20"
+ height="20"
+ viewBox="0 0 20 20"
+ fill="none"
+ xmlns="http://www.w3.org/2000/svg"
+ className="text-destructive-600"
+ >
+ <path
+ d="M10 6v4m0 4h.01M18 10a8 8 0 1 1-16 0 8 8 0 0 1 16 0Z"
+ stroke="currentColor"
+ strokeWidth="1.5"
+ strokeLinecap="round"
+ strokeLinejoin="round"
+ />
+ </svg>
+ </div>
+ <p className="text-foreground text-sm font-medium">Something went wrong</p>
+ <p className="text-foreground-lighter text-sm text-center max-w-xs">{state.error}</p>
+ <button
+ type="button"
+ onClick={retry}
+ className="mt-1 px-4 py-2 text-sm font-medium rounded-md bg-brand-500 text-white hover:bg-brand-600 transition-colors"
+ >
+ Try again
+ </button>
+ </div>
+ )}
+
+ {(state.step === 'date-select' || state.step === 'time-select') && (
+ <div className="mb-6 flex items-center justify-center">
+ <TimezoneSelector value={timezone} onChange={setTimezone} />
+ </div>
+ )}
+
+ {state.step === 'date-select' && (
+ <CalendarPicker
+ monthOffset={state.monthOffset}
+ availableMonthOffsets={availableMonthOffsets}
+ timezone={timezone}
+ availableDates={availableDates}
+ selectedDate={state.selectedDate}
+ onSelectDate={selectDate}
+ onChangeMonth={changeMonth}
+ />
+ )}
+
+ {state.step === 'time-select' && state.selectedDate && (
+ <TimeSlotPicker
+ slots={slotsForSelectedDate}
+ timezone={timezone}
+ selectedSlot={state.selectedSlot}
+ onSelectSlot={selectSlot}
+ onBack={goBackToDate}
+ selectedDate={state.selectedDate}
+ />
+ )}
+
+ {(state.step === 'form' || state.step === 'submitting') && state.selectedDate && (
+ <BookingForm
+ onSubmit={submitBooking}
+ onBack={goBackToTime}
+ isSubmitting={state.step === 'submitting'}
+ error={state.error}
+ onDismissError={dismissError}
+ selectedDate={state.selectedDate}
+ selectedTimeLabel={selectedTimeLabel}
+ timezone={timezone}
+ />
+ )}
+
+ {state.step === 'confirmed' && state.confirmation && (
+ <Confirmation confirmation={state.confirmation} timezone={timezone} />
+ )}
+ </div>
+ </div>
+ )
+}
diff --git a/packages/marketing/src/go/sections/SectionRenderer.tsx b/packages/marketing/src/go/sections/SectionRenderer.tsx
index e6915fd9245..7fb6b0b5dc6 100644
--- a/packages/marketing/src/go/sections/SectionRenderer.tsx
+++ b/packages/marketing/src/go/sections/SectionRenderer.tsx
@@ -5,6 +5,7 @@ import CodeBlockSection from './CodeBlockSection'
import FaqSection from './FaqSection'
import FeatureGridSection from './FeatureGridSection'
import FormSection from './FormSection'
+import HubSpotMeetingSection from './HubSpotMeetingSection'
import MetricsSection from './MetricsSection'
import QuoteSection from './QuoteSection'
import SingleColumnSection from './SingleColumnSection'
@@ -68,6 +69,9 @@ export default function SectionRenderer({ section, customRenderers }: SectionRen
case 'quote':
content = <QuoteSection section={section} />
break
+ case 'hubspot-meeting':
+ content = <HubSpotMeetingSection section={section} />
+ break
default: {
const _exhaustive: never = section
break
diff --git a/packages/marketing/src/go/sections/hubspot-meeting/BookingForm.tsx b/packages/marketing/src/go/sections/hubspot-meeting/BookingForm.tsx
new file mode 100644
index 00000000000..fa0a607bd96
--- /dev/null
+++ b/packages/marketing/src/go/sections/hubspot-meeting/BookingForm.tsx
@@ -0,0 +1,162 @@
+'use client'
+
+import { useState } from 'react'
+import { Button, Input_Shadcn_ } from 'ui'
+
+interface BookingFormProps {
+ onSubmit: (data: {
+ firstName: string
+ lastName: string
+ email: string
+ guestEmails?: string[]
+ }) => void
+ onBack: () => void
+ isSubmitting: boolean
+ error: string | null
+ onDismissError: () => void
+ selectedDate: string
+ selectedTimeLabel: string
+ timezone: string
+}
+
+export default function BookingForm({
+ onSubmit,
+ onBack,
+ isSubmitting,
+ error,
+ onDismissError,
+ selectedDate,
+ selectedTimeLabel,
+ timezone,
+}: BookingFormProps) {
+ const [firstName, setFirstName] = useState('')
+ const [lastName, setLastName] = useState('')
+ const [email, setEmail] = useState('')
+
+ const dateLabel = (() => {
+ const [year, month, day] = selectedDate.split('-').map(Number)
+ const date = new Date(Date.UTC(year, month - 1, day, 12, 0, 0))
+ return date.toLocaleDateString('en-US', {
+ weekday: 'short',
+ month: 'short',
+ day: 'numeric',
+ timeZone: timezone,
+ })
+ })()
+
+ const handleSubmit = (e: React.FormEvent) => {
+ e.preventDefault()
+ onSubmit({ firstName, lastName, email })
+ }
+
+ const isValid = firstName.trim() && lastName.trim() && email.trim()
+
+ return (
+ <div className="w-full h-full flex-1 flex flex-col gap-6">
+ <div className="flex items-center gap-2">
+ <button
+ type="button"
+ onClick={onBack}
+ className="p-1.5 rounded-md text-foreground-lighter hover:bg-surface-300/50 hover:text-foreground transition-colors"
+ aria-label="Back to time selection"
+ >
+ <svg
+ width="16"
+ height="16"
+ viewBox="0 0 16 16"
+ fill="none"
+ xmlns="http://www.w3.org/2000/svg"
+ >
+ <path
+ d="M10 12L6 8L10 4"
+ stroke="currentColor"
+ strokeWidth="1.5"
+ strokeLinecap="round"
+ strokeLinejoin="round"
+ />
+ </svg>
+ </button>
+ <span className="text-foreground text-sm font-medium">
+ {dateLabel} at {selectedTimeLabel}
+ </span>
+ </div>
+
+ <form onSubmit={handleSubmit} className="flex flex-col gap-4 flex-1">
+ <div className="flex flex-col gap-1.5">
+ <label htmlFor="hs-firstName" className="text-foreground-light text-sm font-medium">
+ First name *
+ </label>
+ <Input_Shadcn_
+ id="hs-firstName"
+ type="text"
+ required
+ value={firstName}
+ onChange={(e) => setFirstName(e.target.value)}
+ placeholder="First name"
+ />
+ </div>
+
+ <div className="flex flex-col gap-1.5">
+ <label htmlFor="hs-lastName" className="text-foreground-light text-sm font-medium">
+ Last name *
+ </label>
+ <Input_Shadcn_
+ id="hs-lastName"
+ type="text"
+ required
+ value={lastName}
+ onChange={(e) => setLastName(e.target.value)}
+ placeholder="Last name"
+ />
+ </div>
+
+ <div className="flex flex-col gap-1.5">
+ <label htmlFor="hs-email" className="text-foreground-light text-sm font-medium">
+ Email *
+ </label>
+ <Input_Shadcn_
+ id="hs-email"
+ type="email"
+ required
+ value={email}
+ onChange={(e) => setEmail(e.target.value)}
+ placeholder="[email protected]"
+ />
+ </div>
+
+ {error && (
+ <div className="flex items-start gap-2 rounded-md bg-destructive-200/30 border border-destructive-500/20 px-3 py-2.5">
+ <p className="text-destructive-600 text-sm flex-1">{error}</p>
+ <button
+ type="button"
+ onClick={onDismissError}
+ className="text-destructive-600/60 hover:text-destructive-600 transition-colors flex-shrink-0 p-0.5"
+ aria-label="Dismiss error"
+ >
+ <svg width="14" height="14" viewBox="0 0 16 16" fill="none">
+ <path
+ d="M12 4L4 12M4 4l8 8"
+ stroke="currentColor"
+ strokeWidth="1.5"
+ strokeLinecap="round"
+ />
+ </svg>
+ </button>
+ </div>
+ )}
+
+ <Button
+ htmlType="submit"
+ type="primary"
+ disabled={!isValid || isSubmitting}
+ loading={isSubmitting}
+ size="medium"
+ block
+ className="mt-auto"
+ >
+ {isSubmitting ? 'Booking...' : 'Confirm booking'}
+ </Button>
+ </form>
+ </div>
+ )
+}
diff --git a/packages/marketing/src/go/sections/hubspot-meeting/CalendarPicker.tsx b/packages/marketing/src/go/sections/hubspot-meeting/CalendarPicker.tsx
new file mode 100644
index 00000000000..75a64fcd0c9
--- /dev/null
+++ b/packages/marketing/src/go/sections/hubspot-meeting/CalendarPicker.tsx
@@ -0,0 +1,163 @@
+import { useMemo } from 'react'
+import { cn } from 'ui'
+
+interface CalendarPickerProps {
+ monthOffset: number
+ availableMonthOffsets: number[]
+ timezone: string
+ availableDates: Set<string>
+ selectedDate: string | null
+ onSelectDate: (date: string) => void
+ onChangeMonth: (offset: number) => void
+}
+
+const DAY_LABELS = ['Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat']
+
+export default function CalendarPicker({
+ monthOffset,
+ availableMonthOffsets,
+ timezone,
+ availableDates,
+ selectedDate,
+ onSelectDate,
+ onChangeMonth,
+}: CalendarPickerProps) {
+ const { year, month, days, monthLabel } = useMemo(() => {
+ const now = new Date()
+ const target = new Date(now.getFullYear(), now.getMonth() + monthOffset, 1)
+ const y = target.getFullYear()
+ const m = target.getMonth()
+
+ const firstDay = new Date(y, m, 1).getDay()
+ const daysInMonth = new Date(y, m + 1, 0).getDate()
+
+ const daysList: Array<{ day: number; dateStr: string } | null> = []
+
+ // Leading empty cells
+ for (let i = 0; i < firstDay; i++) {
+ daysList.push(null)
+ }
+
+ for (let d = 1; d <= daysInMonth; d++) {
+ const dateStr = `${y}-${String(m + 1).padStart(2, '0')}-${String(d).padStart(2, '0')}`
+ daysList.push({ day: d, dateStr })
+ }
+
+ const targetUtcNoon = new Date(Date.UTC(y, m, 1, 12, 0, 0))
+ const label = targetUtcNoon.toLocaleDateString('en-US', {
+ month: 'long',
+ year: 'numeric',
+ timeZone: timezone,
+ })
+
+ return { year: y, month: m, days: daysList, monthLabel: label }
+ }, [monthOffset, timezone])
+
+ const today = new Date().toLocaleDateString('en-CA', { timeZone: timezone })
+
+ const hasPrev = availableMonthOffsets.some((o) => o < monthOffset)
+ const hasNext = availableMonthOffsets.some((o) => o > monthOffset)
+
+ return (
+ <div className="w-full">
+ <div className="flex items-center justify-between mb-4">
+ <button
+ type="button"
+ onClick={() => onChangeMonth(monthOffset - 1)}
+ disabled={!hasPrev}
+ className={cn(
+ 'p-2 rounded-md text-foreground-lighter transition-colors',
+ hasPrev
+ ? 'hover:bg-surface-300/50 hover:text-foreground'
+ : 'opacity-30 cursor-not-allowed'
+ )}
+ aria-label="Previous month"
+ >
+ <ChevronLeftIcon />
+ </button>
+ <span className="text-foreground font-medium text-sm">{monthLabel}</span>
+ <button
+ type="button"
+ onClick={() => onChangeMonth(monthOffset + 1)}
+ disabled={!hasNext}
+ className={cn(
+ 'p-2 rounded-md text-foreground-lighter transition-colors',
+ hasNext
+ ? 'hover:bg-surface-300/50 hover:text-foreground'
+ : 'opacity-30 cursor-not-allowed'
+ )}
+ aria-label="Next month"
+ >
+ <ChevronRightIcon />
+ </button>
+ </div>
+
+ <div className="grid grid-cols-7 gap-1 mb-2">
+ {DAY_LABELS.map((label) => (
+ <div key={label} className="text-center text-xs text-foreground-lighter font-medium py-1">
+ {label}
+ </div>
+ ))}
+ </div>
+
+ <div className="grid grid-cols-7 gap-1">
+ {days.map((cell, i) => {
+ if (!cell) {
+ return <div key={`empty-${i}`} />
+ }
+
+ const isAvailable = availableDates.has(cell.dateStr)
+ const isSelected = selectedDate === cell.dateStr
+ const isPast = cell.dateStr < today
+
+ return (
+ <button
+ key={cell.dateStr}
+ type="button"
+ disabled={!isAvailable || isPast}
+ onClick={() => onSelectDate(cell.dateStr)}
+ className={cn(
+ 'aspect-square flex items-center justify-center rounded-md text-sm transition-colors',
+ isSelected
+ ? 'bg-brand-500 text-white font-medium'
+ : isAvailable && !isPast
+ ? 'text-foreground hover:bg-surface-300/50 font-medium'
+ : 'text-foreground-lighter/40 cursor-not-allowed'
+ )}
+ >
+ {cell.day}
+ </button>
+ )
+ })}
+ </div>
+ </div>
+ )
+}
+
+function ChevronLeftIcon() {
+ return (
+ <svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
+ <path
+ d="M10 12L6 8L10 4"
+ stroke="currentColor"
+ strokeWidth="1.5"
+ strokeLinecap="round"
+ strokeLinejoin="round"
+ />
+ </svg>
+ )
+}
+
+function ChevronRightIcon() {
+ return (
+ <svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
+ <path
+ d="M6 4L10 8L6 12"
+ stroke="currentColor"
+ strokeWidth="1.5"
+ strokeLinecap="round"
+ strokeLinejoin="round"
+ />
+ </svg>
+ )
+}
diff --git a/packages/marketing/src/go/sections/hubspot-meeting/Confirmation.tsx b/packages/marketing/src/go/sections/hubspot-meeting/Confirmation.tsx
new file mode 100644
index 00000000000..f6665c73209
--- /dev/null
+++ b/packages/marketing/src/go/sections/hubspot-meeting/Confirmation.tsx
@@ -0,0 +1,67 @@
+import type { BookingConfirmation } from './types'
+
+interface ConfirmationProps {
+ confirmation: BookingConfirmation
+ timezone: string
+}
+
+export default function Confirmation({ confirmation, timezone }: ConfirmationProps) {
+ const startDate = new Date(confirmation.start)
+ const endDate = new Date(confirmation.end)
+
+ const dateLabel = startDate.toLocaleDateString('en-US', {
+ weekday: 'long',
+ month: 'long',
+ day: 'numeric',
+ year: 'numeric',
+ timeZone: timezone,
+ })
+
+ const timeLabel = `${startDate.toLocaleTimeString('en-US', {
+ hour: 'numeric',
+ minute: '2-digit',
+ timeZone: timezone,
+ })} – ${endDate.toLocaleTimeString('en-US', {
+ hour: 'numeric',
+ minute: '2-digit',
+ timeZone: timezone,
+ })}`
+
+ return (
+ <div className="w-full text-center flex flex-col items-center gap-4">
+ <div className="w-12 h-12 rounded-full bg-brand-500/10 flex items-center justify-center">
+ <svg
+ width="24"
+ height="24"
+ viewBox="0 0 24 24"
+ fill="none"
+ xmlns="http://www.w3.org/2000/svg"
+ >
+ <path
+ d="M20 6L9 17L4 12"
+ stroke="currentColor"
+ strokeWidth="2"
+ strokeLinecap="round"
+ strokeLinejoin="round"
+ className="text-brand-500"
+ />
+ </svg>
+ </div>
+
+ <div className="flex flex-col gap-1">
+ <h3 className="text-foreground text-lg font-medium">Meeting confirmed</h3>
+ <p className="text-foreground-lighter text-sm">
+ You'll receive a calendar invitation at your email.
+ </p>
+ </div>
+
+ <div className="bg-surface-100 border border-muted rounded-lg px-6 py-4 flex flex-col gap-1 w-full max-w-sm">
+ <p className="text-foreground font-medium text-sm">{dateLabel}</p>
+ <p className="text-foreground-lighter text-sm">{timeLabel}</p>
+ {confirmation.location && (
+ <p className="text-foreground-lighter text-sm mt-1">{confirmation.location}</p>
+ )}
+ </div>
+ </div>
+ )
+}
diff --git a/packages/marketing/src/go/sections/hubspot-meeting/TimeSlotPicker.tsx b/packages/marketing/src/go/sections/hubspot-meeting/TimeSlotPicker.tsx
new file mode 100644
index 00000000000..1aa3e8995a7
--- /dev/null
+++ b/packages/marketing/src/go/sections/hubspot-meeting/TimeSlotPicker.tsx
@@ -0,0 +1,155 @@
+import { useCallback, useMemo, useRef, useState } from 'react'
+import { cn } from 'ui'
+
+import type { TimeSlot } from './types'
+
+interface TimeSlotPickerProps {
+ slots: TimeSlot[]
+ timezone: string
+ selectedSlot: TimeSlot | null
+ onSelectSlot: (slot: TimeSlot) => void
+ onBack: () => void
+ selectedDate: string
+}
+
+export default function TimeSlotPicker({
+ slots,
+ timezone,
+ selectedSlot,
+ onSelectSlot,
+ onBack,
+ selectedDate,
+}: TimeSlotPickerProps) {
+ const dateLabel = useMemo(() => {
+ const [year, month, day] = selectedDate.split('-').map(Number)
+ const date = new Date(Date.UTC(year, month - 1, day, 12, 0, 0))
+ return date.toLocaleDateString('en-US', {
+ weekday: 'long',
+ month: 'long',
+ day: 'numeric',
+ timeZone: timezone,
+ })
+ }, [selectedDate, timezone])
+
+ const formattedSlots = useMemo(
+ () =>
+ slots.map((slot) => ({
+ ...slot,
+ label: new Date(slot.startMillisUtc).toLocaleTimeString('en-US', {
+ hour: 'numeric',
+ minute: '2-digit',
+ timeZone: timezone,
+ }),
+ })),
+ [slots, timezone]
+ )
+
+ return (
+ <div className="w-full">
+ <div className="flex items-center gap-2 mb-4">
+ <button
+ type="button"
+ onClick={onBack}
+ className="p-1.5 rounded-md text-foreground-lighter hover:bg-surface-300/50 hover:text-foreground transition-colors"
+ aria-label="Back to calendar"
+ >
+ <svg
+ width="16"
+ height="16"
+ viewBox="0 0 16 16"
+ fill="none"
+ xmlns="http://www.w3.org/2000/svg"
+ >
+ <path
+ d="M10 12L6 8L10 4"
+ stroke="currentColor"
+ strokeWidth="1.5"
+ strokeLinecap="round"
+ strokeLinejoin="round"
+ />
+ </svg>
+ </button>
+ <span className="text-foreground font-medium text-sm">
+ {dateLabel}
+ <span className="text-foreground-lighter font-normal">
+ {' · '}
+ {
+ new Intl.DateTimeFormat('en-US', { timeZone: timezone, timeZoneName: 'short' })
+ .formatToParts(new Date())
+ .find((p) => p.type === 'timeZoneName')?.value
+ }
+ </span>
+ </span>
+ </div>
+
+ {formattedSlots.length === 0 ? (
+ <p className="text-foreground-lighter text-sm text-center py-8">
+ No available times for this date.
+ </p>
+ ) : (
+ <ScrollFadeList>
+ {formattedSlots.map((slot, idx) => {
+ const isSelected = selectedSlot?.startMillisUtc === slot.startMillisUtc
+ return (
+ <button
+ key={`${idx}-${slot.startMillisUtc}`}
+ type="button"
+ onClick={() => onSelectSlot(slot)}
+ className={cn(
+ 'w-full px-4 py-2.5 rounded-md text-sm text-left transition-colors border',
+ isSelected
+ ? 'border-brand-500 bg-brand-500/10 text-brand-500 font-medium'
+ : 'border-muted text-foreground hover:border-foreground-lighter hover:bg-surface-300/30'
+ )}
+ >
+ {slot.label}
+ </button>
+ )
+ })}
+ </ScrollFadeList>
+ )}
+ </div>
+ )
+}
+
+function ScrollFadeList({ children }: { children: React.ReactNode }) {
+ const ref = useRef<HTMLDivElement>(null)
+ const [fadeTop, setFadeTop] = useState(false)
+ const [fadeBottom, setFadeBottom] = useState(false)
+
+ const updateFades = useCallback(() => {
+ const el = ref.current
+ if (!el) return
+ setFadeTop(el.scrollTop > 2)
+ setFadeBottom(el.scrollTop + el.clientHeight < el.scrollHeight - 2)
+ }, [])
+
+ const onRef = useCallback(
+ (el: HTMLDivElement | null) => {
+ ;(ref as React.MutableRefObject<HTMLDivElement | null>).current = el
+ if (el) {
+ updateFades()
+ }
+ },
+ [updateFades]
+ )
+
+ const top = fadeTop ? 'transparent, black 12px' : 'black, black'
+ const bottom = fadeBottom ? 'black calc(100% - 12px), transparent' : 'black, black'
+ const mask = `linear-gradient(to bottom, ${top}, ${bottom})`
+
+ return (
+ <div
+ ref={onRef}
+ onScroll={updateFades}
+ className="flex flex-col gap-2 max-h-[320px] overflow-y-auto pr-1 py-1"
+ style={{
+ maskImage: mask,
+ WebkitMaskImage: mask,
+ transition: 'mask-image 0.15s ease, -webkit-mask-image 0.15s ease',
+ }}
+ >
+ {children}
+ </div>
+ )
+}
diff --git a/packages/marketing/src/go/sections/hubspot-meeting/TimezoneSelector.tsx b/packages/marketing/src/go/sections/hubspot-meeting/TimezoneSelector.tsx
new file mode 100644
index 00000000000..2ddfea500b4
--- /dev/null
+++ b/packages/marketing/src/go/sections/hubspot-meeting/TimezoneSelector.tsx
@@ -0,0 +1,371 @@
+'use client'
+
+import { useCallback, useEffect, useMemo, useRef, useState } from 'react'
+import { cn } from 'ui'
+
+interface TimezoneSelectorProps {
+ value: string
+ onChange: (tz: string) => void
+}
+
+interface TimezoneEntry {
+ id: string
+ label: string
+ offset: string
+ offsetMinutes: number
+}
+
+interface TimezoneGroup {
+ continent: string
+ zones: TimezoneEntry[]
+}
+
+const TIMEZONE_DATA: Array<{ id: string; label: string; continent: string }> = [
+ // Americas
+ { id: 'Pacific/Honolulu', label: 'Hawaii', continent: 'Americas' },
+ { id: 'America/Anchorage', label: 'Alaska', continent: 'Americas' },
+ { id: 'America/Los_Angeles', label: 'Pacific Time', continent: 'Americas' },
+ { id: 'America/Denver', label: 'Mountain Time', continent: 'Americas' },
+ { id: 'America/Chicago', label: 'Central Time', continent: 'Americas' },
+ { id: 'America/New_York', label: 'Eastern Time', continent: 'Americas' },
+ { id: 'America/Halifax', label: 'Atlantic Time', continent: 'Americas' },
+ { id: 'America/St_Johns', label: 'Newfoundland', continent: 'Americas' },
+ { id: 'America/Sao_Paulo', label: 'Brasilia', continent: 'Americas' },
+ { id: 'America/Argentina/Buenos_Aires', label: 'Buenos Aires', continent: 'Americas' },
+ { id: 'America/Santiago', label: 'Santiago', continent: 'Americas' },
+ { id: 'America/Bogota', label: 'Bogota', continent: 'Americas' },
+ { id: 'America/Mexico_City', label: 'Mexico City', continent: 'Americas' },
+ { id: 'America/Toronto', label: 'Toronto', continent: 'Americas' },
+ { id: 'America/Vancouver', label: 'Vancouver', continent: 'Americas' },
+
+ // Europe
+ { id: 'Atlantic/Reykjavik', label: 'Reykjavik', continent: 'Europe' },
+ { id: 'Europe/London', label: 'Dublin, London, Lisbon', continent: 'Europe' },
+ { id: 'Europe/Paris', label: 'Paris, Berlin, Amsterdam', continent: 'Europe' },
+ { id: 'Europe/Helsinki', label: 'Helsinki, Kyiv, Riga', continent: 'Europe' },
+ { id: 'Europe/Moscow', label: 'Moscow, St. Petersburg', continent: 'Europe' },
+ { id: 'Europe/Madrid', label: 'Madrid, Rome', continent: 'Europe' },
+ { id: 'Europe/Warsaw', label: 'Warsaw, Prague, Budapest', continent: 'Europe' },
+ { id: 'Europe/Bucharest', label: 'Bucharest, Athens', continent: 'Europe' },
+ { id: 'Europe/Istanbul', label: 'Istanbul', continent: 'Europe' },
+ { id: 'Europe/Zurich', label: 'Zurich, Vienna', continent: 'Europe' },
+
+ // Africa
+ { id: 'Africa/Casablanca', label: 'Casablanca', continent: 'Africa' },
+ { id: 'Africa/Lagos', label: 'Lagos, West Africa', continent: 'Africa' },
+ { id: 'Africa/Cairo', label: 'Cairo', continent: 'Africa' },
+ { id: 'Africa/Nairobi', label: 'Nairobi, East Africa', continent: 'Africa' },
+ { id: 'Africa/Johannesburg', label: 'Johannesburg', continent: 'Africa' },
+
+ // Asia
+ { id: 'Asia/Dubai', label: 'Dubai, Abu Dhabi', continent: 'Asia' },
+ { id: 'Asia/Karachi', label: 'Karachi', continent: 'Asia' },
+ { id: 'Asia/Kolkata', label: 'Mumbai, Kolkata, Delhi', continent: 'Asia' },
+ { id: 'Asia/Dhaka', label: 'Dhaka', continent: 'Asia' },
+ { id: 'Asia/Bangkok', label: 'Bangkok, Jakarta', continent: 'Asia' },
+ { id: 'Asia/Singapore', label: 'Singapore, Kuala Lumpur', continent: 'Asia' },
+ { id: 'Asia/Shanghai', label: 'Beijing, Shanghai', continent: 'Asia' },
+ { id: 'Asia/Hong_Kong', label: 'Hong Kong', continent: 'Asia' },
+ { id: 'Asia/Tokyo', label: 'Tokyo, Osaka', continent: 'Asia' },
+ { id: 'Asia/Seoul', label: 'Seoul', continent: 'Asia' },
+ { id: 'Asia/Taipei', label: 'Taipei', continent: 'Asia' },
+ { id: 'Asia/Jerusalem', label: 'Jerusalem, Tel Aviv', continent: 'Asia' },
+ { id: 'Asia/Riyadh', label: 'Riyadh', continent: 'Asia' },
+ { id: 'Asia/Tehran', label: 'Tehran', continent: 'Asia' },
+
+ // Australia & Pacific
+ { id: 'Australia/Perth', label: 'Perth', continent: 'Pacific' },
+ { id: 'Australia/Adelaide', label: 'Adelaide', continent: 'Pacific' },
+ { id: 'Australia/Sydney', label: 'Sydney, Melbourne', continent: 'Pacific' },
+ { id: 'Australia/Brisbane', label: 'Brisbane', continent: 'Pacific' },
+ { id: 'Pacific/Auckland', label: 'Auckland, Wellington', continent: 'Pacific' },
+ { id: 'Pacific/Fiji', label: 'Fiji', continent: 'Pacific' },
+]
+
+function getUtcOffset(tzId: string): { label: string; minutes: number } {
+ try {
+ const now = new Date()
+ const formatter = new Intl.DateTimeFormat('en-US', {
+ timeZone: tzId,
+ timeZoneName: 'shortOffset',
+ })
+ const parts = formatter.formatToParts(now)
+ const offsetPart = parts.find((p) => p.type === 'timeZoneName')?.value || ''
+
+ // Parse "GMT+5:30" or "GMT-8" etc.
+ const match = offsetPart.match(/GMT([+-])?(\d{1,2})?(?::(\d{2}))?/)
+ if (!match) return { label: 'UTC +00:00', minutes: 0 }
+
+ const sign = match[1] === '-' ? -1 : 1
+ const hours = parseInt(match[2] || '0', 10)
+ const mins = parseInt(match[3] || '0', 10)
+ const totalMinutes = sign * (hours * 60 + mins)
+
+ const absH = String(Math.abs(Math.floor(totalMinutes / 60))).padStart(2, '0')
+ const absM = String(Math.abs(totalMinutes % 60)).padStart(2, '0')
+ const signStr = totalMinutes >= 0 ? '+' : '-'
+
+ return { label: `UTC ${signStr}${absH}:${absM}`, minutes: totalMinutes }
+ } catch {
+ return { label: 'UTC +00:00', minutes: 0 }
+ }
+}
+
+function buildGroups(userTz: string): { userEntry: TimezoneEntry; groups: TimezoneGroup[] } {
+ const entries: TimezoneEntry[] = TIMEZONE_DATA.map((tz) => {
+ const offset = getUtcOffset(tz.id)
+ return { id: tz.id, label: tz.label, offset: offset.label, offsetMinutes: offset.minutes }
+ })
+
+ // Build user entry
+ const userMatch = entries.find((e) => e.id === userTz)
+ const userOffset = getUtcOffset(userTz)
+ const userEntry: TimezoneEntry = userMatch ?? {
+ id: userTz,
+ label: userTz.split('/').pop()?.replace(/_/g, ' ') || userTz,
+ offset: userOffset.label,
+ offsetMinutes: userOffset.minutes,
+ }
+
+ const continentOrder = ['Americas', 'Europe', 'Africa', 'Asia', 'Pacific']
+ const grouped = new Map<string, TimezoneEntry[]>()
+
+ for (const tz of TIMEZONE_DATA) {
+ const entry = entries.find((e) => e.id === tz.id)!
+ if (!grouped.has(tz.continent)) grouped.set(tz.continent, [])
+ grouped.get(tz.continent)!.push(entry)
+ }
+
+ // Sort each group by offset
+ for (const zones of grouped.values()) {
+ zones.sort((a, b) => a.offsetMinutes - b.offsetMinutes)
+ }
+
+ const groups: TimezoneGroup[] = continentOrder
+ .filter((c) => grouped.has(c))
+ .map((c) => ({ continent: c, zones: grouped.get(c)! }))
+
+ return { userEntry, groups }
+}
+
+export default function TimezoneSelector({ value, onChange }: TimezoneSelectorProps) {
+ const [open, setOpen] = useState(false)
+ const [search, setSearch] = useState('')
+ const [highlightedIndex, setHighlightedIndex] = useState(-1)
+ const containerRef = useRef<HTMLDivElement>(null)
+ const searchRef = useRef<HTMLInputElement>(null)
+ const listRef = useRef<HTMLDivElement>(null)
+
+ const { userEntry, groups } = useMemo(() => buildGroups(value), [value])
+
+ const currentEntry = useMemo(() => {
+ for (const group of groups) {
+ const match = group.zones.find((z) => z.id === value)
+ if (match) return match
+ }
+ return userEntry
+ }, [value, groups, userEntry])
+
+ // Filter by search
+ const filteredGroups = useMemo(() => {
+ if (!search.trim()) return groups
+ const q = search.toLowerCase()
+ return groups
+ .map((g) => ({
+ ...g,
+ zones: g.zones.filter(
+ (z) =>
+ z.label.toLowerCase().includes(q) ||
+ z.id.toLowerCase().includes(q) ||
+ z.offset.toLowerCase().includes(q) ||
+ g.continent.toLowerCase().includes(q)
+ ),
+ }))
+ .filter((g) => g.zones.length > 0)
+ }, [groups, search])
+
+ // Flat list of all visible zones for keyboard navigation
+ const flatZones = useMemo(() => filteredGroups.flatMap((g) => g.zones), [filteredGroups])
+
+ // Reset highlight when search changes
+ useEffect(() => {
+ setHighlightedIndex(-1)
+ }, [search])
+
+ const selectZone = useCallback(
+ (zone: TimezoneEntry) => {
+ onChange(zone.id)
+ setOpen(false)
+ setSearch('')
+ setHighlightedIndex(-1)
+ },
+ [onChange]
+ )
+
+ const handleKeyDown = useCallback(
+ (e: React.KeyboardEvent) => {
+ if (!open || flatZones.length === 0) return
+
+ if (e.key === 'ArrowDown') {
+ e.preventDefault()
+ setHighlightedIndex((i) => {
+ const next = i < flatZones.length - 1 ? i + 1 : 0
+ document.getElementById(`tz-option-${next}`)?.scrollIntoView({ block: 'nearest' })
+ return next
+ })
+ } else if (e.key === 'ArrowUp') {
+ e.preventDefault()
+ setHighlightedIndex((i) => {
+ const next = i > 0 ? i - 1 : flatZones.length - 1
+ document.getElementById(`tz-option-${next}`)?.scrollIntoView({ block: 'nearest' })
+ return next
+ })
+ } else if (e.key === 'Enter' && highlightedIndex >= 0) {
+ e.preventDefault()
+ selectZone(flatZones[highlightedIndex])
+ } else if (e.key === 'Escape') {
+ e.preventDefault()
+ setOpen(false)
+ setSearch('')
+ setHighlightedIndex(-1)
+ }
+ },
+ [open, flatZones, highlightedIndex, selectZone]
+ )
+
+ // Close on outside click
+ useEffect(() => {
+ if (!open) return
+ function handleClick(e: MouseEvent) {
+ if (containerRef.current && !containerRef.current.contains(e.target as Node)) {
+ setOpen(false)
+ setSearch('')
+ }
+ }
+ document.addEventListener('mousedown', handleClick)
+ return () => document.removeEventListener('mousedown', handleClick)
+ }, [open])
+
+ // Focus search on open
+ useEffect(() => {
+ if (open) searchRef.current?.focus()
+ }, [open])
+
+ return (
+ <div ref={containerRef} className="relative">
+ <button
+ type="button"
+ onClick={() => setOpen((o) => !o)}
+ className="flex items-center gap-1.5 text-foreground-lighter text-xs hover:text-foreground transition-colors"
+ >
+ <GlobeIcon />
+ <span>
+ {currentEntry.offset} {currentEntry.label}
+ </span>
+ <ChevronDownIcon className={cn('transition-transform', open && 'rotate-180')} />
+ </button>
+
+ {open && (
+ <div
+ className="absolute z-50 top-full mt-2 left-0 w-72 max-h-80 overflow-hidden rounded-lg border border-muted bg-overlay shadow-lg flex flex-col"
+ onKeyDown={handleKeyDown}
+ >
+ <div className="p-2 border-b border-muted">
+ <input
+ ref={searchRef}
+ type="text"
+ value={search}
+ onChange={(e) => setSearch(e.target.value)}
+ onKeyDown={handleKeyDown}
+ placeholder="Search timezones..."
+ className="w-full text-foreground text-sm placeholder:text-foreground-lighter/50 outline-none focus:ring-transparent focus:border-muted bg-muted rounded-md"
+ role="combobox"
+ aria-expanded={open}
+ aria-activedescendant={
+ highlightedIndex >= 0 ? `tz-option-${highlightedIndex}` : undefined
+ }
+ />
+ </div>
+
+ <div ref={listRef} className="overflow-y-auto flex-1" role="listbox">
+ {(() => {
+ let flatIndex = 0
+ return filteredGroups.map((group) => (
+ <div key={group.continent}>
+ <div className="px-3 py-1.5 text-foreground-light text-xs font-semibold sticky top-0 bg-surface-200">
+ {group.continent}
+ </div>
+ {group.zones.map((zone) => {
+ const idx = flatIndex++
+ const isHighlighted = idx === highlightedIndex
+ return (
+ <button
+ key={zone.id}
+ id={`tz-option-${idx}`}
+ type="button"
+ role="option"
+ aria-selected={zone.id === value}
+ onClick={() => selectZone(zone)}
+ onMouseEnter={() => setHighlightedIndex(idx)}
+ className={cn(
+ 'w-full text-left px-3 py-2 text-sm flex items-center justify-between transition-colors',
+ zone.id === value
+ ? 'bg-brand-500/10 text-brand-500'
+ : isHighlighted
+ ? 'bg-surface-300/50 text-foreground'
+ : 'text-foreground hover:bg-surface-300/50'
+ )}
+ >
+ <span className="truncate">{zone.label}</span>
+ <span className="text-xs text-foreground-lighter flex-shrink-0 ml-2">
+ {zone.offset}
+ </span>
+ </button>
+ )
+ })}
+ </div>
+ ))
+ })()}
+
+ {filteredGroups.length === 0 && (
+ <p className="text-foreground-lighter text-sm text-center py-4">No timezones found</p>
+ )}
+ </div>
+ </div>
+ )}
+ </div>
+ )
+}
+
+function GlobeIcon() {
+ return (
+ <svg
+ width="14"
+ height="14"
+ viewBox="0 0 24 24"
+ fill="none"
+ stroke="currentColor"
+ strokeWidth="1.5"
+ strokeLinecap="round"
+ strokeLinejoin="round"
+ >
+ <circle cx="12" cy="12" r="10" />
+ <path d="M2 12h20" />
+ <path d="M12 2a15.3 15.3 0 0 1 4 10 15.3 15.3 0 0 1-4 10 15.3 15.3 0 0 1-4-10 15.3 15.3 0 0 1 4-10z" />
+ </svg>
+ )
+}
+
+function ChevronDownIcon({ className }: { className?: string }) {
+ return (
+ <svg width="12" height="12" viewBox="0 0 16 16" fill="none" className={className}>
+ <path
+ d="M4 6L8 10L12 6"
+ stroke="currentColor"
+ strokeWidth="1.5"
+ strokeLinecap="round"
+ strokeLinejoin="round"
+ />
+ </svg>
+ )
+}
diff --git a/packages/marketing/src/go/sections/hubspot-meeting/api.ts b/packages/marketing/src/go/sections/hubspot-meeting/api.ts
new file mode 100644
index 00000000000..5182fdcd9fd
--- /dev/null
+++ b/packages/marketing/src/go/sections/hubspot-meeting/api.ts
@@ -0,0 +1,72 @@
+import type { BookingConfirmation, BookingInfo, BookingRequest } from './types'
+
+const BASE = '/api-v2/hubspot-meetings'
+
+async function parseErrorResponse(res: Response, fallback: string): Promise<string> {
+ try {
+ const body = await res.json()
+ return body.error || body.message || fallback
+ } catch {
+ return fallback
+ }
+}
+
+function wrapNetworkError(err: unknown): never {
+ if (
+ err instanceof TypeError &&
+ (err.message === 'Failed to fetch' || err.message === 'Load failed')
+ ) {
+ throw new Error('Unable to connect. Please check your internet connection and try again.')
+ }
+ throw err
+}
+
+export async function fetchBookingInfo(
+ slug: string,
+ timezone: string,
+ monthOffset = 0
+): Promise<BookingInfo> {
+ const params = new URLSearchParams({ timezone, monthOffset: String(monthOffset) })
+ let res: Response
+ try {
+ res = await fetch(`${BASE}/${encodeURIComponent(slug)}?${params}`)
+ } catch (err) {
+ wrapNetworkError(err)
+ }
+ if (!res.ok) {
+ if (res.status === 404) throw new Error('This meeting calendar could not be found.')
+ throw new Error(await parseErrorResponse(res, `Failed to load calendar (${res.status})`))
+ }
+ return res.json()
+}
+
+export async function fetchAvailability(slug: string, timezone: string): Promise<BookingInfo> {
+ const params = new URLSearchParams({ timezone })
+ let res: Response
+ try {
+ res = await fetch(`${BASE}/${encodeURIComponent(slug)}/availability?${params}`)
+ } catch (err) {
+ wrapNetworkError(err)
+ }
+ if (!res.ok) {
+ throw new Error(await parseErrorResponse(res, `Failed to load availability (${res.status})`))
+ }
+ return res.json()
+}
+
+export async function bookMeeting(request: BookingRequest): Promise<BookingConfirmation> {
+ let res: Response
+ try {
+ res = await fetch(`${BASE}/book`, {
+ method: 'POST',
+ headers: { 'Content-Type': 'application/json' },
+ body: JSON.stringify(request),
+ })
+ } catch (err) {
+ wrapNetworkError(err)
+ }
+ if (!res.ok) {
+ throw new Error(await parseErrorResponse(res, `Booking failed (${res.status})`))
+ }
+ return res.json()
+}
diff --git a/packages/marketing/src/go/sections/hubspot-meeting/types.ts b/packages/marketing/src/go/sections/hubspot-meeting/types.ts
new file mode 100644
index 00000000000..3c411a60750
--- /dev/null
+++ b/packages/marketing/src/go/sections/hubspot-meeting/types.ts
@@ -0,0 +1,78 @@
+/** Types for HubSpot Scheduler API responses (proxied through our API routes) */
+
+export interface BookingInfo {
+ linkId: string
+ linkType: string
+ isOffline: boolean
+ customParams: {
+ formFields: FormField[]
+ allowsGuests: boolean
+ meetingBufferTime: number
+ availableDurations: number[] // milliseconds
+ }
+ availabilityByDay: Record<string, DayAvailability>
+ allUsersBusyTimes: BusyTime[]
+ linkAvailability: Record<string, TimeSlot[]> // keyed by duration in ms
+ branding?: {
+ logo?: string
+ companyName?: string
+ primaryColor?: string
+ }
+}
+
+export interface FormField {
+ name: string
+ label: string
+ required: boolean
+ fieldType: string
+}
+
+export interface DayAvailability {
+ startMinutes: number
+ endMinutes: number
+}
+
+export interface BusyTime {
+ startMillisUtc: number
+ endMillisUtc: number
+}
+
+export interface TimeSlot {
+ startMillisUtc: number
+ endMillisUtc: number
+}
+
+export interface BookingRequest {
+ slug: string
+ firstName: string
+ lastName: string
+ email: string
+ startTime: number // milliseconds
+ duration: number // milliseconds
+ timezone: string
+ locale: string
+ guestEmails?: string[]
+}
+
+export interface BookingConfirmation {
+ calendarEventId: string
+ start: string
+ end: string
+ duration: number
+ contactId: string
+ bookingTimezone: string
+ locale: string
+ guestEmails: string[]
+ subject: string
+ location?: string
+ isOffline: boolean
+}
+
+export type SchedulerStep =
+ | 'loading'
+ | 'date-select'
+ | 'time-select'
+ | 'form'
+ | 'submitting'
+ | 'confirmed'
+ | 'error'
diff --git a/packages/marketing/src/go/sections/hubspot-meeting/useScheduler.ts b/packages/marketing/src/go/sections/hubspot-meeting/useScheduler.ts
new file mode 100644
index 00000000000..05d8b93df1f
--- /dev/null
+++ b/packages/marketing/src/go/sections/hubspot-meeting/useScheduler.ts
@@ -0,0 +1,276 @@
+import { useCallback, useEffect, useMemo, useRef, useState } from 'react'
+
+import { bookMeeting, fetchBookingInfo } from './api'
+import type {
+ BookingConfirmation,
+ BookingInfo,
+ BookingRequest,
+ SchedulerStep,
+ TimeSlot,
+} from './types'
+
+/** How many months to prefetch (current + 3 ahead) */
+const MONTHS_TO_FETCH = 4
+
+function getUserTimezone(): string {
+ try {
+ return Intl.DateTimeFormat().resolvedOptions().timeZone
+ } catch {
+ return 'America/New_York'
+ }
+}
+
+function getUserLocale(): string {
+ try {
+ return navigator.language || 'en-US'
+ } catch {
+ return 'en-US'
+ }
+}
+
+export interface SchedulerState {
+ step: SchedulerStep
+ timezone: string
+ selectedDate: string | null // YYYY-MM-DD
+ selectedSlot: TimeSlot | null
+ selectedDuration: number // milliseconds
+ confirmation: BookingConfirmation | null
+ error: string | null
+ /** Current month offset from today (0 = current month) */
+ monthOffset: number
+}
+
+export function useScheduler(slug: string, enabled = true) {
+ const [timezone, setTimezoneState] = useState('America/New_York')
+ const [locale, setLocale] = useState('en-US')
+
+ // Hydrate timezone/locale from browser after mount to avoid SSR mismatches
+ useEffect(() => {
+ setTimezoneState(getUserTimezone())
+ setLocale(getUserLocale())
+ }, [])
+
+ /** Cached booking info keyed by month offset */
+ const [monthCache, setMonthCache] = useState<Record<number, BookingInfo>>({})
+
+ const [state, setState] = useState<SchedulerState>({
+ step: 'loading',
+ timezone,
+ selectedDate: null,
+ selectedSlot: null,
+ selectedDuration: 0,
+ confirmation: null,
+ error: null,
+ monthOffset: 0,
+ })
+
+ const loadAllMonths = useCallback(
+ async (tz?: string) => {
+ const effectiveTz = tz ?? timezone
+ try {
+ setState((s) => ({ ...s, step: 'loading', error: null }))
+
+ const results = await Promise.all(
+ Array.from({ length: MONTHS_TO_FETCH }, (_, i) => fetchBookingInfo(slug, effectiveTz, i))
+ )
+
+ const cache: Record<number, BookingInfo> = {}
+ for (let i = 0; i < results.length; i++) {
+ cache[i] = results[i]
+ }
+
+ const defaultDuration = results[0]?.customParams?.availableDurations?.[0] ?? 1800000
+
+ setMonthCache(cache)
+ setState((s) => ({
+ ...s,
+ step: 'date-select',
+ selectedDuration: defaultDuration,
+ selectedDate: null,
+ selectedSlot: null,
+ monthOffset: 0,
+ }))
+ } catch (err) {
+ setState((s) => ({
+ ...s,
+ step: 'error',
+ error: err instanceof Error ? err.message : 'Failed to load booking info',
+ }))
+ }
+ },
+ [slug, timezone]
+ )
+
+ useEffect(() => {
+ if (enabled) loadAllMonths()
+ }, [enabled, loadAllMonths])
+
+ const setTimezone = useCallback(
+ (tz: string) => {
+ setTimezoneState(tz)
+ setState((s) => ({ ...s, timezone: tz }))
+ loadAllMonths(tz)
+ },
+ [loadAllMonths]
+ )
+
+ const selectDate = useCallback((date: string) => {
+ setState((s) => ({ ...s, selectedDate: date, selectedSlot: null, step: 'time-select' }))
+ }, [])
+
+ const selectSlot = useCallback((slot: TimeSlot) => {
+ setState((s) => ({ ...s, selectedSlot: slot, step: 'form' }))
+ }, [])
+
+ const goBackToDate = useCallback(() => {
+ setState((s) => ({ ...s, selectedSlot: null, step: 'date-select', selectedDate: null }))
+ }, [])
+
+ const goBackToTime = useCallback(() => {
+ setState((s) => ({ ...s, selectedSlot: null, step: 'time-select' }))
+ }, [])
+
+ const retry = useCallback(() => {
+ loadAllMonths()
+ }, [loadAllMonths])
+
+ const dismissError = useCallback(() => {
+ setState((s) => ({ ...s, error: null }))
+ }, [])
+
+ const setDuration = useCallback((duration: number) => {
+ setState((s) => ({ ...s, selectedDuration: duration }))
+ }, [])
+
+ const submitBooking = useCallback(
+ async (form: {
+ firstName: string
+ lastName: string
+ email: string
+ guestEmails?: string[]
+ }) => {
+ if (!state.selectedSlot) return
+
+ setState((s) => ({ ...s, step: 'submitting' }))
+
+ const request: BookingRequest = {
+ slug,
+ firstName: form.firstName,
+ lastName: form.lastName,
+ email: form.email,
+ startTime: state.selectedSlot.startMillisUtc,
+ duration: state.selectedDuration,
+ timezone,
+ locale,
+ guestEmails: form.guestEmails,
+ }
+
+ try {
+ const confirmation = await bookMeeting(request)
+ setState((s) => ({ ...s, step: 'confirmed', confirmation }))
+ } catch (err) {
+ setState((s) => ({
+ ...s,
+ step: 'form',
+ error: err instanceof Error ? err.message : 'Booking failed',
+ }))
+ }
+ },
+ [slug, timezone, locale, state.selectedSlot, state.selectedDuration]
+ )
+
+ /** All slots merged across all cached months */
+ const allSlots = useMemo(() => {
+ const durationKey = String(state.selectedDuration)
+ const slots: TimeSlot[] = []
+ for (const info of Object.values(monthCache)) {
+ const monthSlots = info.linkAvailability?.[durationKey] ?? []
+ slots.push(...monthSlots)
+ }
+ return slots
+ }, [monthCache, state.selectedDuration])
+
+ /** Get available time slots for the selected date and duration */
+ const slotsForSelectedDate = useMemo(() => {
+ if (!state.selectedDate) return []
+
+ return allSlots.filter((slot) => {
+ const date = new Date(slot.startMillisUtc)
+ const dateStr = date.toLocaleDateString('en-CA', { timeZone: timezone })
+ return dateStr === state.selectedDate
+ })
+ }, [allSlots, state.selectedDate, timezone])
+
+ /** Get set of dates (YYYY-MM-DD) that have availability */
+ const availableDates = useMemo(() => {
+ const dates = new Set<string>()
+ for (const slot of allSlots) {
+ const date = new Date(slot.startMillisUtc)
+ const dateStr = date.toLocaleDateString('en-CA', { timeZone: timezone })
+ dates.add(dateStr)
+ }
+ return dates
+ }, [allSlots, timezone])
+
+ /** Month offsets that have at least one available slot */
+ const availableMonthOffsets = useMemo(() => {
+ // Compute "now" in the selected timezone to avoid ±1 month drift near boundaries
+ const nowStr = new Date().toLocaleDateString('en-CA', { timeZone: timezone })
+ const [nowY, nowM] = nowStr.split('-').map(Number)
+ const offsets = new Set<number>()
+ for (const slot of allSlots) {
+ const date = new Date(slot.startMillisUtc)
+ const localDateStr = date.toLocaleDateString('en-CA', { timeZone: timezone })
+ const [y, m] = localDateStr.split('-').map(Number)
+ const offset = (y - nowY) * 12 + (m - nowM)
+ if (offset >= 0 && offset < MONTHS_TO_FETCH) {
+ offsets.add(offset)
+ }
+ }
+ return Array.from(offsets).sort((a, b) => a - b)
+ }, [allSlots, timezone])
+
+ /** Auto-navigate to first month with availability */
+ const hasSetInitialMonth = useRef(false)
+ useEffect(() => {
+ if (hasSetInitialMonth.current) return
+ if (availableMonthOffsets.length > 0 && state.step === 'date-select') {
+ hasSetInitialMonth.current = true
+ setState((s) => ({ ...s, monthOffset: availableMonthOffsets[0] }))
+ }
+ }, [availableMonthOffsets, state.step])
+
+ const changeMonth = useCallback(
+ (offset: number) => {
+ if (availableMonthOffsets.length === 0) return
+ const current = state.monthOffset
+ if (offset > current) {
+ const next = availableMonthOffsets.find((o) => o > current)
+ if (next !== undefined) setState((s) => ({ ...s, monthOffset: next }))
+ } else if (offset < current) {
+ const prev = [...availableMonthOffsets].reverse().find((o) => o < current)
+ if (prev !== undefined) setState((s) => ({ ...s, monthOffset: prev }))
+ }
+ },
+ [availableMonthOffsets, state.monthOffset]
+ )
+
+ return {
+ state,
+ timezone,
+ locale,
+ availableDates,
+ slotsForSelectedDate,
+ availableMonthOffsets,
+ selectDate,
+ selectSlot,
+ goBackToDate,
+ goBackToTime,
+ changeMonth,
+ setTimezone,
+ setDuration,
+ submitBooking,
+ retry,
+ dismissError,
+ }
+}
diff --git a/packages/marketing/src/go/sections/index.ts b/packages/marketing/src/go/sections/index.ts
index 2e6a12f0058..0394e0783a6 100644
--- a/packages/marketing/src/go/sections/index.ts
+++ b/packages/marketing/src/go/sections/index.ts
@@ -12,6 +12,7 @@ export { default as FaqSection } from './FaqSection'
export { default as CodeBlockSection } from './CodeBlockSection'
export { default as StepsSection } from './StepsSection'
export { default as QuoteSection } from './QuoteSection'
+export { default as HubSpotMeetingSection } from './HubSpotMeetingSection'
export { default as SectionRenderer } from './SectionRenderer'
export type { CustomSectionRenderers } from './SectionRenderer'
export { default as MediaBlock } from './MediaBlock'
diff --git a/turbo.json b/turbo.json
index 050e48bbb24..8cfe5187f7b 100644
--- a/turbo.json
+++ b/turbo.json
@@ -117,7 +117,7 @@
"STATUSPAGE_API_KEY",
"STATUSPAGE_PAGE_ID",
"INCIDENT_IO_API_KEY",
- "LIVE_SUPABASE_SECRET_KEY"
+ "LIVE_SUPABASE_SECRET_KEY"
],
"passThroughEnv": [
"CURRENT_CLI_VERSION",
@@ -196,7 +196,8 @@
"NEXT_PUBLIC_SUPASQUAD_APPLICATION_FORM_URL",
"CUSTOMERIO_SITE_ID",
"CUSTOMERIO_API_KEY",
- "CUSTOMERIO_APP_API_KEY"
+ "CUSTOMERIO_APP_API_KEY",
+ "HUBSPOT_MEETINGS_TOKEN"
],
"outputs": [".next/**", "!.next/cache/**", "!.next/dev/**/*", ".contentlayer/**"]
},