Macro is a unified workspace for teams: email, chat, docs, tasks, agents, calls, and CRM — @-linked together with shared AI memory.
TypeScript agentaiai-agentsall-in-onecrmcrm-systememaillinearmcpmessagingnotesnotionofficerustslackslack-alternativestartupstartup-toolstypescriptworkspace
fix(marketing): book demos inline on /tour (#8054)
juliawest366e99b7f5cd
diff --git a/apps/marketing/src/features/marketing/components/DemoBookingDialog.tsx b/apps/marketing/src/features/marketing/components/DemoBookingDialog.tsxindex 0a71f6e7d2..32bd2cd821 100644--- a/apps/marketing/src/features/marketing/components/DemoBookingDialog.tsx+++ b/apps/marketing/src/features/marketing/components/DemoBookingDialog.tsx@@ -7,9 +7,9 @@ import { createFrameEscape } from '../primitives/createFrameEscape';import './demo-booking-dialog.css';// The booking page allows framing from its own origin only.-const BOOKING_PATH = new URL(DEMO_BOOKING_URL).pathname;+export const BOOKING_PATH = new URL(DEMO_BOOKING_URL).pathname;// The framed booking page posts this to the page around it once a guest books.-const BOOKING_MADE = 'macro:booking-made';+export const BOOKING_MADE = 'macro:booking-made';/*** A refused frame (booking paths that do not allow framing yet, or an app copy@@ -17,13 +17,17 @@ const BOOKING_MADE = 'macro:booking-made';* booking page itself rather than leave them in front of it.*/const leaveIfRefused = (frame: HTMLIFrameElement) => {- let shown = false;+ if (wasRefused(frame)) window.open(DEMO_BOOKING_URL, '_self');+};++/** Whether a booking frame holds a browser error page instead of the app. */+export const wasRefused = (frame: HTMLIFrameElement) => {try {- shown = frame.contentWindow?.location.pathname.startsWith('/app/') === true;+ return !frame.contentWindow?.location.pathname.startsWith('/app/');} catch {// The error page is cross-origin, so reading its location throws.+ return true;}- if (!shown) window.open(DEMO_BOOKING_URL, '_self');};/**diff --git a/apps/marketing/src/features/marketing/components/sales/DemoBookingInline.tsx b/apps/marketing/src/features/marketing/components/sales/DemoBookingInline.tsxnew file mode 100644index 0000000000..193c62b3e9--- /dev/null+++ b/apps/marketing/src/features/marketing/components/sales/DemoBookingInline.tsx@@ -0,0 +1,76 @@+import { createSignal, onCleanup, onMount, Show } from 'solid-js';+import { demoHref, handleDemoBooked } from '../../../../app/utils/utilCta';+import { BOOKING_MADE, BOOKING_PATH, wasRefused } from '../DemoBookingDialog';++/**+ * The Macro demo booking page, framed inline. Loads the frame only once the+ * visitor nears it, so the ad landing page's first paint stays light. A+ * refused frame falls back to a link to the booking page.+ */+export function DemoBookingInline() {+ let host!: HTMLDivElement;+ let frame: HTMLIFrameElement | undefined;+ const [near, setNear] = createSignal(false);+ const [loaded, setLoaded] = createSignal(false);+ const [refused, setRefused] = createSignal(false);++ onMount(() => {+ const observer = new IntersectionObserver(+ (entries) => {+ if (!entries.some((entry) => entry.isIntersecting)) return;+ observer.disconnect();+ setNear(true);+ },+ { rootMargin: '1200px 0px' }+ );+ observer.observe(host);+ const reportBooking = (event: MessageEvent) => {+ if (!frame?.contentWindow || event.source !== frame.contentWindow) return;+ if (event.origin !== window.location.origin) return;+ if (event.data?.type === BOOKING_MADE) handleDemoBooked();+ };+ window.addEventListener('message', reportBooking);+ onCleanup(() => {+ observer.disconnect();+ window.removeEventListener('message', reportBooking);+ });+ });++ return (+ <Show+ when={!refused()}+ fallback={+ // The dialog would open the refused frame again, so keep the click+ // from reaching its document listener. Solid delegates `onClick` to+ // the document, so only a native handler runs first.+ <a+ class="site-nav-start homepage-hero-cta tour-cta"+ href={demoHref()}+ on:click={(event) => event.stopPropagation()}+ >+ Pick a time+ </a>+ }+ >+ <div ref={host} class="sales-booking-embed">+ <Show when={!loaded()}>+ <div class="sales-booking-loading" role="status">+ Loading…+ </div>+ </Show>+ <Show when={near()}>+ <iframe+ ref={frame}+ src={BOOKING_PATH}+ title="Book a demo"+ class="sales-booking-frame"+ onLoad={(event) => {+ setLoaded(true);+ setRefused(wasRefused(event.currentTarget));+ }}+ />+ </Show>+ </div>+ </Show>+ );+}diff --git a/apps/marketing/src/features/marketing/components/sales/SalesCalculator.tsx b/apps/marketing/src/features/marketing/components/sales/SalesCalculator.tsxindex 3b58da919f..687eb790a6 100644--- a/apps/marketing/src/features/marketing/components/sales/SalesCalculator.tsx+++ b/apps/marketing/src/features/marketing/components/sales/SalesCalculator.tsx@@ -29,7 +29,9 @@ const TIERS: readonly { id: SalesTier; label: string }[] = [];/** Thumb-sized version of the pricing calculator for the ad landing page. */-export function SalesCalculator(props: { onBook: () => void }) {+export function SalesCalculator(props: {+ onBook: (event: MouseEvent) => void;+}) {const [seats, setSeats] = createSignal(SALES_DEFAULT_SEATS);const [tier, setTier] = createSignal<SalesTier>(SALES_DEFAULT_TIER);const [selected, setSelected] =@@ -160,7 +162,7 @@ export function SalesCalculator(props: { onBook: () => void }) {<aclass="site-nav-start homepage-hero-cta tour-cta"href={demoHref()}- onClick={() => props.onBook()}+ onClick={(event) => props.onBook(event)}>Book a demo</a>diff --git a/apps/marketing/src/features/marketing/views/SalesPage.tsx b/apps/marketing/src/features/marketing/views/SalesPage.tsxindex 1b37c27616..7d1f6097c7 100644--- a/apps/marketing/src/features/marketing/views/SalesPage.tsx+++ b/apps/marketing/src/features/marketing/views/SalesPage.tsx@@ -4,6 +4,7 @@ import { FeatureConstellation } from '../../setup/components/FeatureOverview';import { WelcomeStep } from '../../setup/components/WelcomeSteps';import { FeaturePage } from '../components/FeaturePage';import { HomepageTrustBadges } from '../components/HomepageTrustBadges';+import { DemoBookingInline } from '../components/sales/DemoBookingInline';import { SalesCalculator } from '../components/sales/SalesCalculator';import { formatWholeUsd } from '../core/sales-savings';import { MACRO_SEAT_CENTS } from '../core/savings-calculator';@@ -38,6 +39,21 @@ function TourHeading(props: {);}+/**+ * Every demo CTA scrolls to the inline booker instead of opening the booking+ * dialog. Cancelling the click keeps `DemoBookingDialog` from opening it; a+ * new-tab click still follows the link.+ */+function bookDemo(event: MouseEvent, buttonName: string) {+ handleDemoClick(buttonName);+ if (event.defaultPrevented || event.button !== 0) return;+ if (event.metaKey || event.ctrlKey || event.shiftKey || event.altKey) return;+ event.preventDefault();+ document+ .getElementById('book')+ ?.scrollIntoView({ behavior: 'smooth', block: 'start' });+}+export function RouteTour() {setPageSeo({title: 'Macro — Email, Docs, Tasks, and Agents in One App',@@ -68,7 +84,9 @@ export function RouteTour() {<aclass="site-nav-start homepage-hero-cta tour-cta"href={demoHref()}- onClick={() => handleDemoClick('tour_hero_book_demo')}+ onClick={(event) =>+ bookDemo(event, 'tour_hero_book_demo')+ }>Book a demo</a>@@ -124,7 +142,7 @@ export function RouteTour() {description="Choose your team size and the tools you pay for today. Every Macro plan includes every module."/><SalesCalculator- onBook={() => handleDemoClick('tour_calculator_book_demo')}+ onBook={(event) => bookDemo(event, 'tour_calculator_book_demo')}/></section>@@ -136,15 +154,9 @@ export function RouteTour() {<TourHeadingid="book-title"title="See how to grow your business faster."- description="A 30-minute call with our CEO or a member of our team."+ description="A 30-minute call with our CEO or a member of our team. Pick a time below."/>- <a- class="site-nav-start homepage-hero-cta tour-cta"- href={demoHref()}- onClick={() => handleDemoClick('tour_closing_book_demo')}- >- Pick a time- </a>+ <DemoBookingInline /></section><footer class="tour-footer">diff --git a/apps/marketing/src/features/marketing/views/sales-page.css b/apps/marketing/src/features/marketing/views/sales-page.cssindex a6fd3d3fde..77c529b845 100644--- a/apps/marketing/src/features/marketing/views/sales-page.css+++ b/apps/marketing/src/features/marketing/views/sales-page.css@@ -38,6 +38,9 @@ body:has(.tour-page) .site-header-actions { display: none; }.tour-hero [data-constellation-tool=Linear] { left: 88% !important; top: 95% !important; width: calc(44px * var(--welcome-scale, 1)) !important; height: calc(44px * var(--welcome-scale, 1)) !important; }.tour-section { scroll-margin-top: 80px; }.tour-booking { display: flex; flex-direction: column; align-items: center; padding-bottom: 0; }+.sales-booking-embed { position: relative; width: 100%; max-width: 960px; height: min(760px, calc(100dvh - 96px)); min-height: 560px; overflow: hidden; border: 1px solid var(--color-edge-muted); border-radius: 24px; background: var(--color-panel); }+.sales-booking-frame { display: block; width: 100%; height: 100%; border: 0; }+.sales-booking-loading { position: absolute; inset: 0; display: grid; place-items: center; color: var(--color-ink-muted); font: 400 14px/1.5 'Inter Variable', Inter, sans-serif; }/* The full 15-feature grid on desktop, the compact ring on phones. */.tour-constellation-mobile { display: none; }@media (max-width: 767px) {