Skip to content

armgit / macro

Public Imported from GitHub
0

Macro is a unified workspace for teams: email, chat, docs, tasks, agents, calls, and CRM — @-linked together with shared AI memory.

feat(marketing): book demos through Macro booking links (#7991)

Chaitanya Agarwal521db62db606
diff --git a/README.md b/README.md
index bb9bbd6d4e..d9bc85d14e 100644
--- a/README.md
+++ b/README.md
@@ -11,7 +11,7 @@
·
<a href="https://docs.macro.com">Docs</a>
·
- <a href="https://cal.com/team/macro/macro-demo-call?metadata%5Bfbp%5D=fb.1.1778954074516.817396687896036613">Book demo</a>
+ <a href="https://macro.com/app/book/6de4003c-15e4-549f-b5a9-0e930bbf56e4/demo">Book demo</a>
·
<a href="https://macro.com">Website</a>
·
diff --git a/apps/docs/getting-started.mdx b/apps/docs/getting-started.mdx
index efc83f5947..4bf98ca286 100644
--- a/apps/docs/getting-started.mdx
+++ b/apps/docs/getting-started.mdx
@@ -6,7 +6,7 @@ description: "Set up Macro and learn the core workflow in about 15 minutes."
Macro replaces the pile of tabs (email, chat, tasks, docs, calls) with one fast, keyboard-driven workspace. This guide takes you from a fresh account to a working setup.
-<Card title="Prefer a guided tour?" icon="calendar" href="https://cal.com/team/macro/macro-demo-call">
+<Card title="Prefer a guided tour?" icon="calendar" href="https://macro.com/app/book/6de4003c-15e4-549f-b5a9-0e930bbf56e4/demo">
Book a live onboarding call and a member of our team will walk you through setup and answer questions.
</Card>
diff --git a/apps/docs/index.mdx b/apps/docs/index.mdx
index 09b1265118..cfa8c6e101 100644
--- a/apps/docs/index.mdx
+++ b/apps/docs/index.mdx
@@ -86,5 +86,5 @@ Macro has a Rust backend and a Solid frontend. Search is instant, collaboration
## Demos & Case Studies
- [Demo](https://www.youtube.com/watch?v=Fn5hdzXsQQ8&t=1s) - Founder and CEO, Jacob Beckerman, walks you through Macro's core features
-- [Live Onboarding](https://cal.com/team/macro/macro-demo-call?metadata%5Bfbp%5D=fb.1.1776871324003.617255820779493826&month=2026-06) - Book a time for a member of our team to guide you through onboarding and any questions
+- [Live Onboarding](https://macro.com/app/book/6de4003c-15e4-549f-b5a9-0e930bbf56e4/demo) - Book a time for a member of our team to guide you through onboarding and any questions
- [How Desync Uses Macro](https://www.youtube.com/watch?v=fZFIW2toHwk) - Watch Desync explain how their engineer-heavy company runs on Macro
\ No newline at end of file
diff --git a/apps/docs/support.mdx b/apps/docs/support.mdx
index 3caf0a895b..2340572331 100644
--- a/apps/docs/support.mdx
+++ b/apps/docs/support.mdx
@@ -11,7 +11,7 @@ description: "How to get help with Macro, and fixes for the most common issues."
Write to [[email protected]](mailto:[email protected]). Include what you were doing and what you expected to happen.
</Card>
- <Card title="Book a call" icon="calendar" href="https://cal.com/team/macro/macro-demo-call">
+ <Card title="Book a call" icon="calendar" href="https://macro.com/app/book/6de4003c-15e4-549f-b5a9-0e930bbf56e4/demo">
A member of our team will walk you through setup or dig into a problem live.
</Card>
diff --git a/apps/docs/switch-to-macro.mdx b/apps/docs/switch-to-macro.mdx
index 360229cdf6..494e9165ba 100644
--- a/apps/docs/switch-to-macro.mdx
+++ b/apps/docs/switch-to-macro.mdx
@@ -194,6 +194,6 @@ Here's the full picture side by side of how Macro compares to the rest of the to
| [Unified Search](/product/search) | ✓ | X | X | X | X | X |
| [Unified Memory](/product/unified-memory) | ✓ | X | X | X | X | X |
-<Card title="Want help switching?" icon="calendar" href="https://cal.com/team/macro/macro-demo-call">
+<Card title="Want help switching?" icon="calendar" href="https://macro.com/app/book/6de4003c-15e4-549f-b5a9-0e930bbf56e4/demo">
Book a call and we'll walk your team through the migration.
</Card>
\ No newline at end of file
diff --git a/apps/marketing/README.md b/apps/marketing/README.md
index 8e024f2eb7..6dae8e3ebd 100644
--- a/apps/marketing/README.md
+++ b/apps/marketing/README.md
@@ -212,14 +212,14 @@ Retain FAQ class markers so prerendering emits matching FAQPage structured data.
page. It is prerendered, `noindex`, out of the sitemap, and not linked from the
navigation. It has four parts, top to bottom: the homepage hero markup
(`WelcomeStep` with `ContextScene`), the expanded `FeatureConstellation`, a
-savings calculator, and an inline cal.com booker for the Macro demo call.
+savings calculator, and a closing "Pick a time" button.
`core/sales-savings.ts` reduces the pricing calculator to one plan tier for all
tools and reads prices from `core/savings-calculator.ts`; update prices there,
-not on the page. "Book a demo" buttons scroll to the booker, which loads
-`embed.js` only as the visitor approaches it and appends Meta attribution to
-the booking. Verify at phone width: no horizontal scroll, calculator steppers
-and toggles, and that the booker loads.
+not on the page. "Book a demo" and "Pick a time" are demo links: they open the
+Macro team booking link in `DemoBookingDialog`, which reports a booking made
+there to Meta. Verify at phone width: no horizontal scroll, calculator steppers
+and toggles, and that the dialog opens.
## Blog presentation
diff --git a/apps/marketing/src/app/components/buttons/ButtonBookDemo.tsx b/apps/marketing/src/app/components/buttons/ButtonBookDemo.tsx
deleted file mode 100644
index 8466f62a13..0000000000
--- a/apps/marketing/src/app/components/buttons/ButtonBookDemo.tsx
+++ /dev/null
@@ -1,32 +0,0 @@
-import SvgBookDemo from '../../../assets/designs/design-book-demo.svg';
-import { buildCalLinkWithAttribution } from '../../utils/utilAnalytic';
-
-export function ButtonBookDemo() {
- return (
- <a
- style={{
- transition: 'background-color var(--transition)',
- 'text-decoration': 'none',
- 'border-radius': '3px',
- width: 'min-content',
- overflow: 'hidden',
- color: 'var(--c2)',
- cursor: 'pointer',
- display: 'block',
- }}
- href={buildCalLinkWithAttribution(
- 'https://cal.com/jacob-beckerman-b56mrn'
- )}
- class="hover-relaunch"
- target="_blank"
- rel="noopener"
- >
- <SvgBookDemo
- style={{
- display: 'block',
- height: '28px',
- }}
- />
- </a>
- );
-}
diff --git a/apps/marketing/src/app/components/buttons/LinkBookDemo.tsx b/apps/marketing/src/app/components/buttons/LinkBookDemo.tsx
index 1e3a755919..ec6e0ebad6 100644
--- a/apps/marketing/src/app/components/buttons/LinkBookDemo.tsx
+++ b/apps/marketing/src/app/components/buttons/LinkBookDemo.tsx
@@ -2,7 +2,7 @@ import { demoHref, handleDemoClick } from '../../utils/utilCta';
/**
* Quiet "Book a live demo →" text link for phones, shown under the email
- * capture form where desktop shows the "Book demo" pill. Same cal.com
+ * capture form where desktop shows the "Book demo" pill. Same booking
* destination and `demo_booking_open` tracking as the desktop button.
*/
export function LinkBookDemo(props: { buttonName: string }) {
diff --git a/apps/marketing/src/app/components/featureGraphics/DocsMarkdownScene.tsx b/apps/marketing/src/app/components/featureGraphics/DocsMarkdownScene.tsx
index 3c03b07c38..5dbc4a1149 100644
--- a/apps/marketing/src/app/components/featureGraphics/DocsMarkdownScene.tsx
+++ b/apps/marketing/src/app/components/featureGraphics/DocsMarkdownScene.tsx
@@ -30,6 +30,7 @@ import IconPriorityMedium from '../../../assets/icons/wide-priority-medium.svg';
import avatarGabriel from '../../../assets/people/gabriel.webp';
import avatarJacob from '../../../assets/people/jacob-work.webp';
import avatarJulia from '../../../assets/people/julia.webp';
+import { DEMO_BOOKING_URL } from '../../../features/marketing/core/navigation';
import { createVisible } from '../../utils/utilVisible';
// ---------------------------------------------------------------------------
@@ -161,8 +162,6 @@ type Block = {
segs: Seg[];
};
-const CAL_LINK = 'https://cal.com/jacob-beckerman-b56mrn/30min';
-
/** What a bare @ offers before it has been narrowed: one row from every kind
of thing in the workspace. This is the whole argument of the graphic, so
the first mention is the one that gets to show it. */
@@ -309,7 +308,7 @@ const SCRIPT: Block[] = [
trigger: ';',
insert: 'link',
query: '',
- label: CAL_LINK,
+ label: DEMO_BOOKING_URL,
wide: SNIPPETS,
narrow: SNIPPETS,
},
diff --git a/apps/marketing/src/app/components/sections/MigrationPaths.test.tsx b/apps/marketing/src/app/components/sections/MigrationPaths.test.tsx
index b744093ade..cfb3e3392d 100644
--- a/apps/marketing/src/app/components/sections/MigrationPaths.test.tsx
+++ b/apps/marketing/src/app/components/sections/MigrationPaths.test.tsx
@@ -1,5 +1,6 @@
import { cleanup, fireEvent, render } from '@solidjs/testing-library';
import { afterEach, expect, it } from 'vitest';
+import { DEMO_BOOKING_URL } from '../../../features/marketing/core/navigation';
import { setViewportWidth } from '../../utils/utilBreakpoint';
import { MigrationPaths } from './MigrationPaths';
@@ -7,9 +8,7 @@ afterEach(cleanup);
function setup() {
setViewportWidth(1440);
- const view = render(() => (
- <MigrationPaths helpHref="https://cal.com/team/macro/macro-demo-call" />
- ));
+ const view = render(() => <MigrationPaths helpHref={DEMO_BOOKING_URL} />);
return view;
}
@@ -26,7 +25,7 @@ it('lets a visitor find CSV imports and contextual help', () => {
).toBeTruthy();
expect(
view.getByRole('link', { name: 'Talk to our team →' }).getAttribute('href')
- ).toBe('https://cal.com/team/macro/macro-demo-call');
+ ).toBe(DEMO_BOOKING_URL);
});
it('explains agent-assisted imports without embedding product comparisons', () => {
@@ -55,7 +54,7 @@ it('preserves the other-tools route when the viewport becomes compact', async ()
).toBeTruthy();
expect(
view.getByRole('link', { name: 'Talk to our team →' }).getAttribute('href')
- ).toBe('https://cal.com/team/macro/macro-demo-call');
+ ).toBe(DEMO_BOOKING_URL);
fireEvent.keyDown(trigger, { key: 'ArrowUp' });
await Promise.resolve();
fireEvent.keyDown(document.activeElement!, { key: 'Escape' });
diff --git a/apps/marketing/src/app/components/sections/SectionFeatureGrid.tsx b/apps/marketing/src/app/components/sections/SectionFeatureGrid.tsx
index c9da436bb6..1cec370c5f 100644
--- a/apps/marketing/src/app/components/sections/SectionFeatureGrid.tsx
+++ b/apps/marketing/src/app/components/sections/SectionFeatureGrid.tsx
@@ -7,13 +7,13 @@ import IconGithub from '../../../assets/icons/icon-github.svg';
import markDesyncPlaceholder from '../../../assets/mark-desync-placeholder.jpg';
import placeholderChannelsUrl from '../../../assets/placeholderchannels.webp';
import teamVideoUrl from '../../../assets/team-russell-boswell.mp4';
-import { buildCalLinkWithAttribution } from '../../utils/utilAnalytic';
import { APP_BASE_URL } from '../../utils/utilBaseUrl';
import { breakpoint, viewportWidth } from '../../utils/utilBreakpoint';
import {
CtaIcon,
ctaHref,
ctaLabel,
+ demoHref,
handleCtaClick,
} from '../../utils/utilCta';
import {
@@ -2024,9 +2024,7 @@ export function SectionFeatureGrid(
</Show>
</div>
<a
- href={buildCalLinkWithAttribution(
- 'https://cal.com/team/macro/macro-demo-call'
- )}
+ href={demoHref()}
target="_blank"
rel="noopener noreferrer"
class="hover-color"
diff --git a/apps/marketing/src/app/components/sections/SectionStartupCredit.tsx b/apps/marketing/src/app/components/sections/SectionStartupCredit.tsx
deleted file mode 100644
index b2b29604c1..0000000000
--- a/apps/marketing/src/app/components/sections/SectionStartupCredit.tsx
+++ /dev/null
@@ -1,263 +0,0 @@
-import { onMount } from 'solid-js';
-import { buildCalSlugWithAttribution } from '../../utils/utilAnalytic';
-import { breakpoint } from '../../utils/utilBreakpoint';
-
-const calThemeVars = {
- 'cal-bg': 'oklch(0 0 44)',
- 'cal-bg-emphasis': 'oklch(0 0 44)',
- 'cal-bg-subtle': 'oklch(0.14 0 44)',
- 'cal-bg-muted': 'oklch(0.14 0 44)',
- 'cal-bg-inverted': 'oklch(0.9 0 44)',
- 'cal-border': 'oklch(0.16 0 44)',
- 'cal-border-default': 'oklch(0.16 0 44)',
- 'cal-border-emphasis': 'oklch(0.36 0 44)',
- 'cal-border-subtle': 'oklch(0.18 0 44)',
- 'cal-border-booker': 'oklch(0.16 0 44)',
- 'cal-border-booker-width': '1px',
- 'cal-brand': 'oklch(0.71 0.23 44)',
- 'cal-brand-emphasis': 'oklch(0.78 0.22 44)',
- 'cal-brand-text': 'oklch(0 0 44)',
- 'cal-text': 'oklch(0.8 0 44)',
- 'cal-text-emphasis': 'oklch(0.9 0 44)',
- 'cal-text-muted': 'oklch(0.6 0 44)',
- 'cal-text-subtle': 'oklch(0.7 0 44)',
-} as const;
-
-declare global {
- interface Window {
- Cal?: {
- (...args: any[]): void;
- loaded?: boolean;
- ns?: Record<string, (...args: any[]) => void>;
- q?: unknown[];
- };
- }
-}
-
-export function SectionStartupCredit() {
- onMount(() => {
- type Queueable = {
- q?: unknown[];
- };
-
- const tightenCalSpacing = () => {
- const calInline = document.querySelector(
- '#my-cal-inline-macro cal-inline'
- ) as HTMLElement | null;
- if (!calInline) return false;
-
- Object.assign(calInline.style, {
- height: 'auto',
- minHeight: '0',
- maxHeight: 'none',
- margin: '0',
- padding: '0',
- 'align-content': 'start',
- });
-
- return true;
- };
-
- const initCal = () => {
- if (!window.Cal) return;
-
- window.Cal('init', 'macro', { origin: 'https://app.cal.com' });
-
- window.Cal.ns?.macro?.('inline', {
- elementOrSelector: '#my-cal-inline-macro',
- config: {
- layout: 'month_view',
- theme: 'dark',
- 'ui.color-scheme': 'dark',
- useSlotsViewOnSmallScreen: true,
- },
- calLink: buildCalSlugWithAttribution(
- 'forms/7045081b-4d29-4536-be67-6022b42efd95'
- ),
- });
-
- window.Cal.ns?.macro?.('ui', {
- colorScheme: 'dark',
- styles: {
- branding: {
- brandColor: 'oklch(0.71 0.23 44)',
- },
- },
- cssVarsPerTheme: {
- light: calThemeVars,
- dark: calThemeVars,
- },
- hideEventTypeDetails: false,
- layout: 'month_view',
- theme: 'dark',
- });
-
- requestAnimationFrame(() => {
- tightenCalSpacing();
- });
- };
-
- const observer = new MutationObserver(() => {
- if (tightenCalSpacing()) observer.disconnect();
- });
-
- const calRoot = document.getElementById('my-cal-inline-macro');
- if (calRoot) {
- observer.observe(calRoot, { childList: true, subtree: true });
- }
-
- if (window.Cal?.loaded) {
- initCal();
- return;
- }
-
- ((C, A, L) => {
- const p = (a: Queueable, ar: unknown) => {
- a.q = a.q || [];
- a.q.push(ar);
- };
- const d = C.document;
- C.Cal =
- C.Cal ||
- function (...ar: unknown[]) {
- const cal = C.Cal!;
- if (!cal.loaded) {
- cal.ns = {};
- cal.q = cal.q || [];
- d.head.appendChild(d.createElement('script')).src = A;
- cal.loaded = true;
- }
- if (ar[0] === L) {
- const api: ((...args: unknown[]) => void) & Queueable = function (
- ...args: unknown[]
- ) {
- p(api, args);
- };
- const namespace = ar[1] as string | undefined;
- if (typeof namespace === 'string') {
- cal.ns![namespace] = cal.ns![namespace] || api;
- p(cal.ns![namespace] as Queueable, Array.from(ar));
- p(cal, ['initNamespace', namespace]);
- } else {
- p(cal, Array.from(ar));
- }
- return;
- }
- p(cal, Array.from(ar));
- };
- })(window, 'https://app.cal.com/embed/embed.js', 'init');
-
- initCal();
- });
-
- return (
- <section
- style={{
- display: 'grid',
- gap: breakpoint() ? '48px' : '40px',
- 'padding-top': breakpoint() ? '40px' : '56px',
- 'padding-bottom': breakpoint() ? '0' : '96px',
- 'border-top': '1px solid var(--b2)',
- }}
- >
- <div
- style={{
- display: 'grid',
- 'grid-template-columns': breakpoint()
- ? '1fr'
- : 'minmax(0, 1fr) minmax(0, 600px)',
- gap: breakpoint() ? '48px' : '40px',
- 'align-items': 'start',
- width: '100%',
- }}
- >
- <div
- style={{
- display: 'grid',
- gap: breakpoint() ? '20px' : '28px',
- 'justify-items': breakpoint() ? 'center' : 'start',
- 'text-align': breakpoint() ? 'center' : 'left',
- width: '100%',
- 'max-width': breakpoint() ? '600px' : 'min(100%, 560px)',
- }}
- >
- <div
- style={{
- display: 'grid',
- gap: breakpoint() ? '18px' : '22px',
- }}
- >
- <a
- href="/startups"
- style={{
- 'font-size': breakpoint() ? '16px' : '18px',
- 'line-height': 1.2,
- color: 'var(--a0)',
- 'text-decoration': 'none',
- 'font-weight': '400',
- 'text-transform': 'uppercase',
- 'letter-spacing': '0.045em',
- }}
- >
- Apply by June 1, 2026 &rarr;
- </a>
- <p
- style={{
- 'font-family': 'display',
- 'font-size': breakpoint() ? '26px' : '30px',
- 'line-height': 1.12,
- 'max-width': '100%',
- margin: '0',
- color: 'var(--c1)',
- 'overflow-wrap': 'break-word',
- }}
- >
- We are offering approved startups up to $10,000 in credits{' '}
- <span
- style={{
- color: 'var(--c4)',
- opacity: 0.8,
- display: 'inline',
- }}
- >
- plus hands-on help getting started.
- </span>
- </p>
- <p
- style={{
- color: 'var(--c4)',
- 'font-size': breakpoint() ? '16px' : '17px',
- 'line-height': 1.45,
- margin: '0',
- }}
- >
- Criteria: pre-seed or seed startups, 6-month term, up to 10 users.
- Credits are used toward Claude AI and storage spend usage in
- Macro.
- </p>
- </div>
- </div>
-
- <div
- style={{
- width: '100%',
- 'max-width': '600px',
- 'justify-self': breakpoint() ? 'center' : 'end',
- }}
- >
- <div
- id="my-cal-inline-macro"
- style={{
- width: '100%',
- 'min-height': breakpoint() ? '420px' : '520px',
- 'background-color': 'var(--b0)',
- border: '1px solid var(--b2)',
- 'box-sizing': 'border-box',
- overflow: 'hidden',
- }}
- />
- </div>
- </div>
- </section>
- );
-}
diff --git a/apps/marketing/src/app/routes/RouteMigrate.tsx b/apps/marketing/src/app/routes/RouteMigrate.tsx
index 26b91ee08e..3286056cfe 100644
--- a/apps/marketing/src/app/routes/RouteMigrate.tsx
+++ b/apps/marketing/src/app/routes/RouteMigrate.tsx
@@ -17,10 +17,9 @@ import { HomeHeroBackdrop } from '../components/sections/HomeAppPreview';
import { HomeSectionRule } from '../components/sections/HomeSectionRule';
import { MigrationPaths } from '../components/sections/MigrationPaths';
import { SectionMoreFeatures } from '../components/sections/SectionMoreFeatures';
-import { buildCalLinkWithAttribution } from '../utils/utilAnalytic';
import { APP_BASE_URL } from '../utils/utilBaseUrl';
import { viewportWidth } from '../utils/utilBreakpoint';
-import { ctaHref, handleCtaClick } from '../utils/utilCta';
+import { ctaHref, demoHref, handleCtaClick } from '../utils/utilCta';
import { setPageSeo } from '../utils/utilSeo';
const mobile = () => viewportWidth() < 700;
@@ -31,9 +30,7 @@ const desyncVideoUrl = isLocalhost
? '/video/desync.mp4'
: new URL('/video/desync.mp4', APP_BASE_URL).toString();
-const DEMO_CALL_HREF = buildCalLinkWithAttribution(
- 'https://cal.com/team/macro/macro-demo-call'
-);
+const DEMO_CALL_HREF = demoHref();
const DOCS = 'https://docs.macro.com';
const DOCS_SWITCH = `${DOCS}/switch-to-macro`;
diff --git a/apps/marketing/src/app/routes/RoutePartners.tsx b/apps/marketing/src/app/routes/RoutePartners.tsx
index 2370e26fb6..cf10a52f0c 100644
--- a/apps/marketing/src/app/routes/RoutePartners.tsx
+++ b/apps/marketing/src/app/routes/RoutePartners.tsx
@@ -10,13 +10,13 @@ import { HomeSectionRule } from '../components/sections/HomeSectionRule';
import { type FaqItem, SectionFaq } from '../components/sections/SectionFaq';
import { SectionMoreFeatures } from '../components/sections/SectionMoreFeatures';
import { buildCalLinkWithAttribution } from '../utils/utilAnalytic';
+import { demoHref } from '../utils/utilCta';
import { setPageSeo } from '../utils/utilSeo';
import '../../routes/posts/posts-shell.css';
import './partners-hero.css';
const SUPPORT_EMAIL = '[email protected]';
const KICKOFF_URL = 'https://cal.com/team/macro/partnerships-program';
-const DEMO_URL = 'https://cal.com/team/macro/macro-demo-call';
const partnerFaq: FaqItem[] = [
{
@@ -493,11 +493,7 @@ export const RoutePartners: Component = () => {
<li>
<span>
Book a partner screening call with our team{' '}
- <a
- href={buildCalLinkWithAttribution(DEMO_URL)}
- target="_blank"
- rel="noreferrer"
- >
+ <a href={demoHref()} target="_blank" rel="noreferrer">
here
</a>
.
diff --git a/apps/marketing/src/app/routes/RouteStartups.tsx b/apps/marketing/src/app/routes/RouteStartups.tsx
deleted file mode 100644
index 37cc0577b0..0000000000
--- a/apps/marketing/src/app/routes/RouteStartups.tsx
+++ /dev/null
@@ -1,267 +0,0 @@
-import { type Component, onMount } from 'solid-js';
-import { buildCalSlugWithAttribution } from '../utils/utilAnalytic';
-import { breakpoint } from '../utils/utilBreakpoint';
-import { setPageSeo } from '../utils/utilSeo';
-
-const detailCardStyle = {
- border: '1px solid var(--b2)',
- 'box-sizing': 'border-box',
- 'align-content': 'start',
- padding: '22px',
- display: 'grid',
- gap: '10px',
-} as const;
-
-declare global {
- interface Window {
- Cal?: {
- (...args: any[]): void;
- loaded?: boolean;
- ns?: Record<string, (...args: any[]) => void>;
- q?: unknown[];
- };
- }
-}
-
-export const RouteStartups: Component = () => {
- setPageSeo({
- title: 'Macro for Startups — Up to $10,000 in Credits',
- description:
- 'Macro offers approved pre-seed and seed startups up to $10,000 in credits toward Claude and compute usage, plus hands-on help getting started.',
- path: '/startups',
- });
-
- onMount(() => {
- type Queueable = {
- q?: unknown[];
- };
-
- const tightenCalSpacing = () => {
- const calInline = document.querySelector(
- '#my-cal-inline-macro cal-inline'
- ) as HTMLElement | null;
- if (!calInline) return false;
-
- Object.assign(calInline.style, {
- height: 'auto',
- minHeight: '0',
- maxHeight: 'none',
- margin: '0',
- padding: '0',
- 'align-content': 'start',
- });
-
- return true;
- };
-
- const initCal = () => {
- if (!window.Cal) return;
-
- window.Cal('init', 'macro', { origin: 'https://app.cal.com' });
-
- window.Cal.ns?.macro?.('inline', {
- elementOrSelector: '#my-cal-inline-macro',
- config: {
- layout: 'month_view',
- theme: 'dark',
- 'ui.color-scheme': 'dark',
- useSlotsViewOnSmallScreen: true,
- },
- calLink: buildCalSlugWithAttribution(
- 'forms/7045081b-4d29-4536-be67-6022b42efd95'
- ),
- });
-
- window.Cal.ns?.macro?.('ui', {
- colorScheme: 'dark',
- cssVarsPerTheme: {
- light: { 'cal-brand': '#000' },
- dark: { 'cal-brand': '#fff' },
- },
- hideEventTypeDetails: false,
- layout: 'month_view',
- theme: 'dark',
- });
-
- requestAnimationFrame(() => {
- tightenCalSpacing();
- });
- };
-
- const observer = new MutationObserver(() => {
- if (tightenCalSpacing()) observer.disconnect();
- });
-
- const calRoot = document.getElementById('my-cal-inline-macro');
- if (calRoot) {
- observer.observe(calRoot, { childList: true, subtree: true });
- }
-
- if (window.Cal?.loaded) {
- initCal();
- return;
- }
-
- ((C, A, L) => {
- const p = (a: Queueable, ar: unknown) => {
- a.q = a.q || [];
- a.q.push(ar);
- };
- const d = C.document;
- C.Cal =
- C.Cal ||
- function (...ar: unknown[]) {
- const cal = C.Cal!;
- if (!cal.loaded) {
- cal.ns = {};
- cal.q = cal.q || [];
- d.head.appendChild(d.createElement('script')).src = A;
- cal.loaded = true;
- }
- if (ar[0] === L) {
- const api: ((...args: unknown[]) => void) & Queueable = function (
- ...args: unknown[]
- ) {
- p(api, args);
- };
- const namespace = ar[1] as string | undefined;
- if (typeof namespace === 'string') {
- cal.ns![namespace] = cal.ns![namespace] || api;
- p(cal.ns![namespace] as Queueable, Array.from(ar));
- p(cal, ['initNamespace', namespace]);
- } else {
- p(cal, Array.from(ar));
- }
- return;
- }
- p(cal, Array.from(ar));
- };
- })(window, 'https://app.cal.com/embed/embed.js', 'init');
-
- initCal();
- });
-
- return (
- <div
- style={{
- display: 'grid',
- gap: breakpoint() ? '48px' : '72px',
- 'padding-top': breakpoint() ? '48px' : '80px',
- 'padding-bottom': '0',
- 'padding-left': breakpoint() ? '16px' : '24px',
- 'padding-right': breakpoint() ? '16px' : '24px',
- 'margin-bottom': '0',
- 'box-sizing': 'border-box',
- width: '100%',
- 'justify-items': 'center',
- }}
- >
- <section
- style={{
- display: 'grid',
- gap: breakpoint() ? '18px' : '22px',
- 'justify-items': 'center',
- 'text-align': 'center',
- width: '100%',
- 'max-width': '600px',
- }}
- >
- <h1
- style={{
- 'font-family': 'display',
- 'font-size': breakpoint() ? '38px' : '50px',
- 'line-height': breakpoint() ? '1.02' : '0.98',
- 'letter-spacing': '-0.035em',
- 'font-weight': 'calc(315 + var(--cream-slab-weight-increase, 0))',
- 'max-width': '600px',
- margin: '0',
- color: 'var(--c1)',
- }}
- >
- Up to $10,000 in credits for pre-seed and seed startups.
- </h1>
- <p
- style={{
- 'font-size': breakpoint() ? '18px' : '22px',
- 'line-height': 1.34,
- 'max-width': '600px',
- margin: '0',
- color: 'var(--c4)',
- }}
- >
- We are offering approved startups up to $10,000 in credits toward
- Claude and compute usage in Macro, plus hands-on help getting started.
- </p>
- </section>
-
- <section style={{ width: '100%', 'max-width': '600px' }}>
- <div
- id="my-cal-inline-macro"
- style={{
- width: '100%',
- 'min-height': breakpoint() ? '420px' : '520px',
- overflow: 'hidden',
- }}
- />
- </section>
-
- <section
- style={{
- display: 'grid',
- 'grid-template-columns': breakpoint() ? '1fr' : '1fr 1fr',
- gap: '1px',
- width: '100%',
- 'max-width': '600px',
- 'box-sizing': 'border-box',
- }}
- >
- <div style={detailCardStyle}>
- <div
- style={{
- 'font-family': 'display',
- 'font-size': breakpoint() ? '22px' : '26px',
- 'line-height': 1.1,
- margin: '0',
- color: 'var(--c1)',
- }}
- >
- Who it is for
- </div>
- <div
- style={{
- 'font-size': breakpoint() ? '16px' : '18px',
- 'line-height': 1.5,
- color: 'var(--c4)',
- }}
- >
- Pre-seed and seed-stage teams are the best fit. If you're at Series
- A and the product is a strong fit, you should still apply.
- </div>
- </div>
- <div style={detailCardStyle}>
- <div
- style={{
- 'font-family': 'display',
- 'font-size': breakpoint() ? '22px' : '26px',
- 'line-height': 1.1,
- margin: '0',
- color: 'var(--c1)',
- }}
- >
- What you'll get
- </div>
- <div
- style={{
- 'font-size': breakpoint() ? '16px' : '18px',
- 'line-height': 1.5,
- color: 'var(--c4)',
- }}
- >
- Hands-on help getting started with Macro (or migrating from your
- current tools) and up to $10,000 in credits.
- </div>
- </div>
- </section>
- </div>
- );
-};
diff --git a/apps/marketing/src/app/routes/RouteTasks.tsx b/apps/marketing/src/app/routes/RouteTasks.tsx
index db00c7a36a..1c8b6a9527 100644
--- a/apps/marketing/src/app/routes/RouteTasks.tsx
+++ b/apps/marketing/src/app/routes/RouteTasks.tsx
@@ -16,6 +16,7 @@ import {
TaskGithubDemo,
} from '../../features/marketing/components/tasks/TaskStories';
import { TasksComparison } from '../../features/marketing/components/tasks/TasksComparison';
+import { DEMO_BOOKING_URL } from '../../features/marketing/core/navigation';
import '../../features/marketing/components/tasks/tasks-page.css';
import { setPageSeo } from '../utils/utilSeo';
@@ -53,10 +54,8 @@ const tasksFaq = [
You can import Linear issues or task CSVs. The route depends on what
you’re bringing from your current tool.{' '}
<a href="/migrate">See your migration options</a> or{' '}
- <a href="https://cal.com/team/macro/macro-demo-call">
- talk to our team
- </a>{' '}
- about moving your company.
+ <a href={DEMO_BOOKING_URL}>talk to our team</a> about moving your
+ company.
</>
),
},
diff --git a/apps/marketing/src/app/utils/utilAnalytic.ts b/apps/marketing/src/app/utils/utilAnalytic.ts
index d5b0087b75..95e2c0ecac 100644
--- a/apps/marketing/src/app/utils/utilAnalytic.ts
+++ b/apps/marketing/src/app/utils/utilAnalytic.ts
@@ -317,27 +317,3 @@ export const buildCalLinkWithAttribution = (baseUrl: string): string => {
return baseUrl;
}
};
-
-/**
- * Attach attribution signals to a cal.com embed slug (e.g.
- * `"forms/7045081b-..."` → `"forms/7045081b-...?metadata[fbp]=..."`).
- *
- * The embed's `config.metadata` option did not forward to webhook payloads
- * in testing — likely because cal.com routing forms drop embed-config
- * metadata at the form → event-type handoff. Appending the params to the
- * slug forces them into the iframe URL, which matches the mechanism the
- * link flow proved works.
- *
- * `user_agent` is included here (embed config is not visible in a URL bar).
- */
-export const buildCalSlugWithAttribution = (slug: string): string => {
- const signals = getCalBookingAttribution();
- const params = new URLSearchParams();
- for (const [key, value] of Object.entries(signals)) {
- params.set(`metadata[${key}]`, value);
- }
- const qs = params.toString();
- if (!qs) return slug;
- const separator = slug.includes('?') ? '&' : '?';
- return `${slug}${separator}${qs}`;
-};
diff --git a/apps/marketing/src/app/utils/utilCta.tsx b/apps/marketing/src/app/utils/utilCta.tsx
index 6d32768fb6..9a28d10ca5 100644
--- a/apps/marketing/src/app/utils/utilCta.tsx
+++ b/apps/marketing/src/app/utils/utilCta.tsx
@@ -1,7 +1,10 @@
import type { JSX } from 'solid-js';
import { isServer } from 'solid-js/web';
-import { journeyHref } from '../../features/marketing/core/navigation';
-import { analytics, buildCalLinkWithAttribution } from './utilAnalytic';
+import {
+ DEMO_BOOKING_URL,
+ journeyHref,
+} from '../../features/marketing/core/navigation';
+import { analytics } from './utilAnalytic';
// Mobile/touch browsers (phones, touch tablets). Signing up + onboarding on a
// phone is a poor experience, so these visitors get the site's own email
@@ -28,18 +31,14 @@ export const isMobileWebDevice = (): boolean => mobileWebDevice;
export const ctaHref = (): string => journeyHref();
export const ctaLabel = (_webLabel: string): string => 'Get started';
-/** cal.com event for a live Macro demo with the team. */
-export const DEMO_BOOKING_URL = 'https://cal.com/team/macro/macro-demo-call';
-
-/** Demo booking link with Meta attribution signals attached (see utilAnalytic). */
-export const demoHref = (): string =>
- buildCalLinkWithAttribution(DEMO_BOOKING_URL);
+/** Booking page for a live Macro demo with the team. */
+export const demoHref = (): string => DEMO_BOOKING_URL;
/**
- * Shared "Book Demo" click handler. Tracks the click and lets the anchor's own
- * `target="_blank"` navigation proceed — no preventDefault, so cal.com opens in
- * a new tab and the site stays put. Same event name the app uses for its
- * pricing-page demo CTA (`demo_booking_open`), so both show up together.
+ * Shared "Book Demo" click handler. Tracks the click and leaves the link to
+ * `DemoBookingDialog`, which opens the booking page over the site on a plain
+ * click; a new-tab click follows the link. Same event name the app uses for
+ * its pricing-page demo CTA (`demo_booking_open`), so both show up together.
*/
export const handleDemoClick = (buttonName: string): void => {
analytics.track('demo_booking_open', {
@@ -48,6 +47,23 @@ export const handleDemoClick = (buttonName: string): void => {
});
};
+/**
+ * A demo was booked in the site's dialog. Sends Meta the conversion the backend
+ * sent for a cal.com demo booking (`crates/cal`), so campaigns that count demos
+ * keep counting them.
+ */
+export const handleDemoBooked = (): void => {
+ analytics.track('demo_booking_complete', {
+ page_location: window.location.href,
+ });
+ analytics.trackMeta('CompleteRegistration', {
+ content_name: 'demo_meeting',
+ content_category: 'cal_booking',
+ value: 100,
+ currency: 'USD',
+ });
+};
+
/** Shared primary-CTA click handler: tracks the click, then routes to ctaHref(). */
export const handleCtaClick = (event: MouseEvent, buttonName: string): void => {
event.preventDefault();
diff --git a/apps/marketing/src/features/marketing/components/DemoBookingDialog.test.tsx b/apps/marketing/src/features/marketing/components/DemoBookingDialog.test.tsx
new file mode 100644
index 0000000000..d0ceea7d7f
--- /dev/null
+++ b/apps/marketing/src/features/marketing/components/DemoBookingDialog.test.tsx
@@ -0,0 +1,148 @@
+import {
+ cleanup,
+ fireEvent,
+ render,
+ screen,
+ waitFor,
+} from '@solidjs/testing-library';
+import { afterEach, beforeEach, expect, it, vi } from 'vitest';
+import { DEMO_BOOKING_URL } from '../core/navigation';
+import { DemoBookingDialog } from './DemoBookingDialog';
+
+const analytics = vi.hoisted(() => ({ track: vi.fn(), trackMeta: vi.fn() }));
+vi.mock('../../../app/utils/utilAnalytic', () => ({ analytics }));
+
+const BOOKING_PATH = new URL(DEMO_BOOKING_URL).pathname;
+
+function renderSite() {
+ render(() => (
+ <>
+ <a href={DEMO_BOOKING_URL} target="_blank" rel="noreferrer">
+ <span>Talk to us</span>
+ </a>
+ <a href="/pricing">Pricing</a>
+ <DemoBookingDialog />
+ </>
+ ));
+ return screen.getByRole('link', { name: 'Talk to us' });
+}
+
+/** Clicks and reports whether the browser would go on to follow the link. */
+function followsLink(element: HTMLElement, init?: MouseEventInit) {
+ let followed = false;
+ const record = (event: Event) => {
+ followed = !event.defaultPrevented;
+ // JSDOM cannot navigate; the answer is already recorded.
+ event.preventDefault();
+ };
+ window.addEventListener('click', record, { once: true });
+ fireEvent.click(element, init);
+ return followed;
+}
+
+/** Opens the dialog from the link's inner text and returns its frame. */
+async function openDialog() {
+ const followed = followsLink(screen.getByText('Talk to us'));
+ const frame = (await screen.findByTitle('Book a demo')) as HTMLIFrameElement;
+ return { frame, followed };
+}
+
+/** Stands in for what the browser put in the frame once it finished loading. */
+function finishLoading(
+ frame: HTMLIFrameElement,
+ location: () => { pathname: string }
+) {
+ Object.defineProperty(frame, 'contentWindow', {
+ value: Object.defineProperty({}, 'location', { get: location }),
+ });
+ fireEvent.load(frame);
+}
+
+beforeEach(() => {
+ vi.clearAllMocks();
+ vi.spyOn(window, 'open').mockImplementation(() => null);
+ vi.spyOn(window, 'scrollTo').mockImplementation(() => {});
+ // JSDOM has no default animation-name; presence detection expects `none`.
+ const styles = document.createElement('style');
+ styles.textContent = '* { animation-name: none; }';
+ styles.id = 'test-animation-default';
+ document.head.append(styles);
+});
+afterEach(() => {
+ cleanup();
+ document.getElementById('test-animation-default')?.remove();
+ vi.restoreAllMocks();
+});
+
+it('books in a dialog on the page and returns focus to the link when closed', async () => {
+ const link = renderSite();
+ expect(document.querySelector('iframe')).toBeNull();
+
+ const { frame, followed } = await openDialog();
+ expect(followed).toBe(false);
+ expect(screen.getByRole('dialog', { name: 'Talk to us' })).toBeTruthy();
+ expect(frame.getAttribute('src')).toBe(BOOKING_PATH);
+ // The frame has no body yet, as while a real one loads; focus still lands.
+ expect(frame.contentDocument?.body).toBeNull();
+ await waitFor(() =>
+ expect(document.activeElement).toBe(
+ screen.getByRole('button', { name: 'Close' })
+ )
+ );
+ finishLoading(frame, () => ({ pathname: BOOKING_PATH }));
+ expect(window.open).not.toHaveBeenCalled();
+
+ fireEvent.click(screen.getByRole('button', { name: 'Close' }));
+ await waitFor(() => expect(screen.queryByRole('dialog')).toBeNull());
+ await waitFor(() => expect(document.activeElement).toBe(link));
+});
+
+it('leaves new-tab clicks and other links to the browser', () => {
+ const link = renderSite();
+
+ expect(followsLink(link, { metaKey: true })).toBe(true);
+ expect(followsLink(link, { ctrlKey: true })).toBe(true);
+ expect(followsLink(link, { button: 1 })).toBe(true);
+ expect(followsLink(screen.getByRole('link', { name: 'Pricing' }))).toBe(true);
+
+ expect(screen.queryByRole('dialog')).toBeNull();
+});
+
+it('sends the visitor to the booking page when the frame is refused', async () => {
+ renderSite();
+ const { frame } = await openDialog();
+
+ // A refused frame holds a cross-origin error page, which cannot be read.
+ finishLoading(frame, () => {
+ throw new DOMException('Blocked a frame', 'SecurityError');
+ });
+
+ expect(window.open).toHaveBeenCalledWith(DEMO_BOOKING_URL, '_self');
+});
+
+it('reports a demo booked in the dialog to Meta, and only from its own frame', async () => {
+ renderSite();
+ const { frame } = await openDialog();
+ const booked = (source: Window | null) =>
+ window.dispatchEvent(
+ new MessageEvent('message', {
+ origin: window.location.origin,
+ source,
+ data: { type: 'macro:booking-made' },
+ })
+ );
+
+ booked(window);
+ expect(analytics.trackMeta).not.toHaveBeenCalled();
+
+ booked(frame.contentWindow);
+ expect(analytics.trackMeta).toHaveBeenCalledExactlyOnceWith(
+ 'CompleteRegistration',
+ {
+ content_name: 'demo_meeting',
+ content_category: 'cal_booking',
+ value: 100,
+ currency: 'USD',
+ }
+ );
+});
diff --git a/apps/marketing/src/features/marketing/components/DemoBookingDialog.tsx b/apps/marketing/src/features/marketing/components/DemoBookingDialog.tsx
new file mode 100644
index 0000000000..40a67d2796
--- /dev/null
+++ b/apps/marketing/src/features/marketing/components/DemoBookingDialog.tsx
@@ -0,0 +1,123 @@
+import { Dialog } from '@kobalte/core/dialog';
+import X from '@phosphor/x.svg';
+import { createSignal, onCleanup, onMount, Show } from 'solid-js';
+import { handleDemoBooked } from '../../../app/utils/utilCta';
+import { DEMO_BOOKING_URL } from '../core/navigation';
+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;
+// The framed booking page posts this to the page around it once a guest books.
+const BOOKING_MADE = 'macro:booking-made';
+
+/**
+ * A refused frame (booking paths that do not allow framing yet, or an app copy
+ * cached before they did) holds a browser error page. Hand the visitor to the
+ * booking page itself rather than leave them in front of it.
+ */
+const leaveIfRefused = (frame: HTMLIFrameElement) => {
+ let shown = false;
+ try {
+ shown = frame.contentWindow?.location.pathname.startsWith('/app/') === true;
+ } catch {
+ // The error page is cross-origin, so reading its location throws.
+ }
+ if (!shown) window.open(DEMO_BOOKING_URL, '_self');
+};
+
+/**
+ * Books a demo without leaving the page. Demo links stay ordinary links to the
+ * booking page: a plain click on any of them opens this dialog, and everything
+ * else (a new-tab click, no script) follows the link.
+ */
+export function DemoBookingDialog() {
+ const [open, setOpen] = createSignal(false);
+ const [loaded, setLoaded] = createSignal(false);
+ let opener: HTMLAnchorElement | undefined;
+ let closeButton: HTMLButtonElement | undefined;
+ let frame: HTMLIFrameElement | undefined;
+ const frameEscape = createFrameEscape(() => changeOpen(false));
+ const changeOpen = (value: boolean) => {
+ if (!value) frameEscape.release();
+ setLoaded(false);
+ setOpen(value);
+ };
+
+ onMount(() => {
+ const openFromLink = (event: MouseEvent) => {
+ if (event.defaultPrevented || event.button !== 0) return;
+ if (event.metaKey || event.ctrlKey || event.shiftKey || event.altKey)
+ return;
+ if (!(event.target instanceof Element)) return;
+ const link = event.target.closest('a');
+ if (link?.href !== DEMO_BOOKING_URL) return;
+ event.preventDefault();
+ opener = link;
+ changeOpen(true);
+ };
+ 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();
+ };
+ document.addEventListener('click', openFromLink);
+ window.addEventListener('message', reportBooking);
+ onCleanup(() => {
+ document.removeEventListener('click', openFromLink);
+ window.removeEventListener('message', reportBooking);
+ });
+ });
+
+ return (
+ <Dialog open={open()} onOpenChange={changeOpen} modal>
+ <Dialog.Portal>
+ <Dialog.Overlay class="demo-booking-overlay" />
+ <Dialog.Content
+ class="demo-booking-dialog"
+ onOpenAutoFocus={(event) => {
+ // The library's search for the first focusable element looks
+ // inside the frame, whose document has no body while it loads.
+ event.preventDefault();
+ closeButton?.focus({ preventScroll: true });
+ }}
+ onCloseAutoFocus={(event) => {
+ event.preventDefault();
+ opener?.focus({ preventScroll: true });
+ }}
+ >
+ <header class="demo-booking-titlebar">
+ <Dialog.Title>Talk to us</Dialog.Title>
+ <Dialog.CloseButton
+ ref={closeButton}
+ class="demo-booking-close"
+ aria-label="Close"
+ >
+ <X />
+ </Dialog.CloseButton>
+ </header>
+ <div class="demo-booking-frame-wrap">
+ <Show when={!loaded()}>
+ <div class="demo-booking-loading" role="status">
+ Loading…
+ </div>
+ </Show>
+ <Show when={open()}>
+ <iframe
+ ref={frame}
+ src={BOOKING_PATH}
+ title="Book a demo"
+ class="demo-booking-frame"
+ onLoad={(event) => {
+ frameEscape.watch(event.currentTarget);
+ setLoaded(true);
+ leaveIfRefused(event.currentTarget);
+ }}
+ />
+ </Show>
+ </div>
+ </Dialog.Content>
+ </Dialog.Portal>
+ </Dialog>
+ );
+}
diff --git a/apps/marketing/src/features/marketing/components/HomepageInteractiveDemo.tsx b/apps/marketing/src/features/marketing/components/HomepageInteractiveDemo.tsx
index bf3023290a..ba9c0a43fc 100644
--- a/apps/marketing/src/features/marketing/components/HomepageInteractiveDemo.tsx
+++ b/apps/marketing/src/features/marketing/components/HomepageInteractiveDemo.tsx
@@ -2,6 +2,7 @@ import { Dialog } from '@kobalte/core/dialog';
import X from '@phosphor/x.svg';
import Play from '@phosphor-fill/play-fill.svg';
import { createSignal, onCleanup, onMount, Show } from 'solid-js';
+import { createFrameEscape } from '../primitives/createFrameEscape';
import './homepage-interactive-demo.css';
/** Opens the real standalone sample route, keeping its styles and state isolated. */
@@ -11,30 +12,12 @@ export function HomepageInteractiveDemo() {
let host!: HTMLDivElement;
let path!: SVGPathElement;
let trigger!: HTMLButtonElement;
- let frameDocument: Document | undefined;
- const onFrameKey = (event: KeyboardEvent) => {
- if (event.key !== 'Escape') return;
- // Capture the layer before its own Escape handler removes it from the DOM.
- const innerLayer = frameDocument?.querySelector(
- '[role="dialog"]:not([data-closed]), [role="alertdialog"]:not([data-closed]), [role="menu"]:not([data-closed]), [role="listbox"]:not([data-closed])'
- );
- if (innerLayer) return;
- const currentDocument = frameDocument;
- queueMicrotask(() => {
- if (!event.defaultPrevented && frameDocument === currentDocument)
- changeOpen(false);
- });
- };
- const releaseFrame = () => {
- frameDocument?.removeEventListener('keydown', onFrameKey, true);
- frameDocument = undefined;
- };
+ const frameEscape = createFrameEscape(() => changeOpen(false));
const changeOpen = (value: boolean) => {
- if (!value) releaseFrame();
+ if (!value) frameEscape.release();
setLoaded(false);
setOpen(value);
};
- onCleanup(releaseFrame);
onMount(() => {
const anchor = host
@@ -143,14 +126,7 @@ export function HomepageInteractiveDemo() {
title="Macro interactive sample workspace"
class="homepage-demo-frame"
onLoad={(event) => {
- releaseFrame();
- frameDocument =
- event.currentTarget.contentDocument ?? undefined;
- frameDocument?.addEventListener(
- 'keydown',
- onFrameKey,
- true
- );
+ frameEscape.watch(event.currentTarget);
setLoaded(true);
}}
/>
diff --git a/apps/marketing/src/features/marketing/components/SiteHeader.tsx b/apps/marketing/src/features/marketing/components/SiteHeader.tsx
index 18b09a9954..76887854a1 100644
--- a/apps/marketing/src/features/marketing/components/SiteHeader.tsx
+++ b/apps/marketing/src/features/marketing/components/SiteHeader.tsx
@@ -7,17 +7,19 @@ import {
Show,
} from 'solid-js';
import {
+ DEMO_BOOKING_URL,
FEATURE_PAGES,
RESOURCE_PAGES,
routePhoneToMobileSignup,
} from '../core/navigation';
+import { DemoBookingDialog } from './DemoBookingDialog';
import './site-navigation.css';
const EXPLORE_PAGES = [
{ href: '/', label: 'Home' },
{ href: '/pricing', label: 'Pricing' },
{ href: '/partners', label: 'Partners' },
- { href: 'https://cal.com/team/macro/macro-demo-call', label: 'Talk to us' },
+ { href: DEMO_BOOKING_URL, label: 'Talk to us' },
];
function NavigationGroup(props: {
@@ -174,7 +176,7 @@ export function SiteHeader(props: { hideOpenApp?: boolean }) {
onPointerLeave={stopGlow}
onPointerCancel={stopGlow}
onFocus={centerGlow}
- href="https://cal.com/team/macro/macro-demo-call"
+ href={DEMO_BOOKING_URL}
target="_blank"
rel="noreferrer"
>
@@ -211,6 +213,7 @@ export function SiteHeader(props: { hideOpenApp?: boolean }) {
</a>
</Show>
</div>
+ <DemoBookingDialog />
</header>
);
}
diff --git a/apps/marketing/src/features/marketing/components/demo-booking-dialog.css b/apps/marketing/src/features/marketing/components/demo-booking-dialog.css
new file mode 100644
index 0000000000..68ff105266
--- /dev/null
+++ b/apps/marketing/src/features/marketing/components/demo-booking-dialog.css
@@ -0,0 +1,22 @@
+/* Follows the site palette, which follows the same OS scheme as the booking page. */
+.demo-booking-overlay { position: fixed; inset: 0; z-index: 10000; background: #000b; backdrop-filter: blur(12px); animation: demo-booking-fade 180ms ease-out; }
+/* The html zoom scales viewport units, so undo it to fit the real viewport. */
+.demo-booking-dialog { position: fixed; z-index: 10001; inset: 0; margin: auto; zoom: calc(1 / var(--site-scale, 1)); width: min(960px, calc(100vw - 32px)); height: min(760px, calc(100dvh - 32px)); display: flex; flex-direction: column; overflow: hidden; isolation: isolate; border: 1px solid var(--color-edge-muted); border-radius: 16px; background: var(--color-dialog); color: var(--color-ink); box-shadow: 0 32px 120px #0008; outline: none; animation: demo-booking-open 280ms cubic-bezier(.2,.8,.2,1); }
+.demo-booking-titlebar { display: flex; align-items: center; justify-content: space-between; flex-shrink: 0; height: 48px; padding: 0 12px 0 20px; border-bottom: 1px solid var(--color-edge-muted); }
+.demo-booking-titlebar h2 { margin: 0; font: 500 13px/1.4 'Inter Variable', Inter, sans-serif; color: var(--color-ink-muted); }
+.demo-booking-close { display: grid; place-items: center; width: 30px; height: 30px; padding: 6px; border: 0; border-radius: 50%; background: transparent; color: var(--color-ink-muted); }
+.demo-booking-close:hover { background: color-mix(in srgb, var(--color-ink) 8%, transparent); color: var(--color-ink); }
+.demo-booking-close:focus-visible { outline: 2px solid var(--color-ink); outline-offset: 3px; }
+.demo-booking-close svg { width: 16px; height: 16px; }
+.demo-booking-frame-wrap { position: relative; flex: 1; min-height: 0; }
+.demo-booking-frame { position: relative; display: block; width: 100%; height: 100%; border: 0; }
+.demo-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; }
+@keyframes demo-booking-fade { from { opacity: 0; } }
+@keyframes demo-booking-open { from { opacity: 0; transform: translateY(18px) scale(.97); } }
+@media (max-width: 599px) {
+ .demo-booking-dialog { width: 100vw; height: 100dvh; border: 0; border-radius: 0; }
+}
+@media (prefers-reduced-motion: reduce) {
+ .demo-booking-overlay, .demo-booking-dialog { animation: none; }
+}
+.demo-booking-overlay[data-closed], .demo-booking-dialog[data-closed] { animation: none; }
diff --git a/apps/marketing/src/features/marketing/components/sales/DemoBookingEmbed.tsx b/apps/marketing/src/features/marketing/components/sales/DemoBookingEmbed.tsx
deleted file mode 100644
index de11100a35..0000000000
--- a/apps/marketing/src/features/marketing/components/sales/DemoBookingEmbed.tsx
+++ /dev/null
@@ -1,139 +0,0 @@
-import { onCleanup, onMount } from 'solid-js';
-import { buildCalSlugWithAttribution } from '../../../../app/utils/utilAnalytic';
-import { DEMO_BOOKING_URL } from '../../../../app/utils/utilCta';
-
-type CalApi = ((...args: unknown[]) => void) & {
- loaded?: boolean;
- ns?: Record<string, (...args: unknown[]) => void>;
- q?: unknown[];
-};
-
-const NAMESPACE = 'macro-demo';
-const CAL_SCRIPT = 'https://app.cal.com/embed/embed.js';
-// The homepage's white primary button.
-const BRAND = '#fafafa';
-
-const calThemeVars = {
- 'cal-bg': '#0c0c0c',
- 'cal-bg-emphasis': '#1a1a1a',
- 'cal-bg-subtle': '#141414',
- 'cal-bg-muted': '#141414',
- 'cal-bg-inverted': '#f5f5f5',
- 'cal-border': '#ffffff1a',
- 'cal-border-default': '#ffffff1a',
- 'cal-border-emphasis': '#ffffff40',
- 'cal-border-subtle': '#ffffff14',
- 'cal-border-booker': '#ffffff1a',
- 'cal-border-booker-width': '1px',
- 'cal-brand': BRAND,
- 'cal-brand-emphasis': '#ffffff',
- 'cal-brand-text': '#000',
- 'cal-text': '#d4d4d4',
- 'cal-text-emphasis': '#fff',
- 'cal-text-muted': '#8a8a8a',
- 'cal-text-subtle': '#a3a3a3',
-} as const;
-
-/** cal.com's documented loader: queues calls until embed.js arrives. */
-function loadCal(): CalApi {
- const w = window as unknown as { Cal?: CalApi };
- if (w.Cal) return w.Cal;
- const push = (target: { q?: unknown[] }, args: unknown) => {
- target.q = target.q || [];
- target.q.push(args);
- };
- const cal: CalApi = (...args: unknown[]) => {
- if (!cal.loaded) {
- cal.ns = {};
- cal.q = cal.q || [];
- document.head.appendChild(document.createElement('script')).src =
- CAL_SCRIPT;
- cal.loaded = true;
- }
- if (args[0] === 'init') {
- const api: CalApi = (...apiArgs: unknown[]) => push(api, apiArgs);
- const namespace = args[1];
- if (typeof namespace === 'string') {
- cal.ns![namespace] = cal.ns![namespace] || api;
- push(cal.ns![namespace] as CalApi, args);
- push(cal, ['initNamespace', namespace]);
- } else {
- push(cal, args);
- }
- return;
- }
- push(cal, args);
- };
- w.Cal = cal;
- return cal;
-}
-
-/** The cream site palette (see setup/cream-preview.css). */
-const CREAM_BRAND = '#1d1c1a';
-const creamThemeVars = {
- 'cal-bg': '#faf8f3',
- 'cal-bg-emphasis': '#fdfcfb',
- 'cal-bg-subtle': '#fcfbf8',
- 'cal-bg-muted': '#fcfbf8',
- 'cal-bg-inverted': '#1d1c1a',
- 'cal-border': '#1d1c1a1a',
- 'cal-border-default': '#1d1c1a1a',
- 'cal-border-emphasis': '#1d1c1a40',
- 'cal-border-subtle': '#1d1c1a14',
- 'cal-border-booker': '#1d1c1a1a',
- 'cal-border-booker-width': '1px',
- 'cal-brand': CREAM_BRAND,
- 'cal-brand-emphasis': '#000',
- 'cal-brand-text': '#f5f1e8',
- 'cal-text': '#54524f',
- 'cal-text-emphasis': '#1d1c1a',
- 'cal-text-muted': '#8f8c86',
- 'cal-text-subtle': '#72706c',
-} as const;
-
-/**
- * Inline cal.com booker for the Macro demo call. Loads embed.js only once the
- * visitor nears it, so the ad landing page's first paint stays light.
- */
-export function DemoBookingEmbed(props: { id: string; cream?: boolean }) {
- let host!: HTMLDivElement;
- onMount(() => {
- const start = () => {
- const theme = props.cream ? 'light' : 'dark';
- const brand = props.cream ? CREAM_BRAND : BRAND;
- const vars = props.cream ? creamThemeVars : calThemeVars;
- const cal = loadCal();
- cal('init', NAMESPACE, { origin: 'https://app.cal.com' });
- const api = cal.ns?.[NAMESPACE];
- api?.('inline', {
- elementOrSelector: `#${props.id}`,
- config: {
- layout: 'month_view',
- theme,
- useSlotsViewOnSmallScreen: 'true',
- },
- calLink: buildCalSlugWithAttribution(
- new URL(DEMO_BOOKING_URL).pathname.slice(1)
- ),
- });
- api?.('ui', {
- theme,
- layout: 'month_view',
- hideEventTypeDetails: false,
- styles: { branding: { brandColor: brand } },
- cssVarsPerTheme: { light: vars, dark: vars },
- });
- };
- const observer = new IntersectionObserver(
- (entries) => {
- if (!entries.some((entry) => entry.isIntersecting)) return;
- observer.disconnect();
- start();
- },
- { rootMargin: '1200px 0px' }
- );
- observer.observe(host);
- onCleanup(() => observer.disconnect());
- });
- return <div ref={host} id={props.id} class="sales-booking-embed" />;
-}
diff --git a/apps/marketing/src/features/marketing/components/sales/SalesCalculator.tsx b/apps/marketing/src/features/marketing/components/sales/SalesCalculator.tsx
index c695733fd6..3b58da919f 100644
--- a/apps/marketing/src/features/marketing/components/sales/SalesCalculator.tsx
+++ b/apps/marketing/src/features/marketing/components/sales/SalesCalculator.tsx
@@ -2,6 +2,7 @@ import CheckIcon from '@phosphor/check.svg';
import MinusIcon from '@phosphor/minus.svg';
import PlusIcon from '@phosphor/plus.svg';
import { createSignal, For, Show } from 'solid-js';
+import { demoHref } from '../../../../app/utils/utilCta';
import {
formatWholeUsd,
SALES_DEFAULT_SEATS,
@@ -156,13 +157,13 @@ export function SalesCalculator(props: { onBook: () => void }) {
<span>every year</span>
</p>
</Show>
- <button
- type="button"
- class="site-nav-start homepage-hero-cta"
+ <a
+ class="site-nav-start homepage-hero-cta tour-cta"
+ href={demoHref()}
onClick={() => props.onBook()}
>
Book a demo
- </button>
+ </a>
</div>
</div>
<p class="sales-calc-note">
diff --git a/apps/marketing/src/features/marketing/core/navigation.ts b/apps/marketing/src/features/marketing/core/navigation.ts
index aa9966d54f..08696e12ac 100644
--- a/apps/marketing/src/features/marketing/core/navigation.ts
+++ b/apps/marketing/src/features/marketing/core/navigation.ts
@@ -19,6 +19,10 @@ export const RESOURCE_PAGES = [
{ href: '/posts', label: 'Blog' },
] as const;
+/** Macro team booking link: a live demo with whichever host is free. */
+export const DEMO_BOOKING_URL =
+ 'https://macro.com/app/book/6de4003c-15e4-549f-b5a9-0e930bbf56e4/demo';
+
const MOBILE_SIGNUP_HREF = '/mobile-signup';
/** Same test as the app's `isMobile()`: a touch-first, phone-width screen. */
diff --git a/apps/marketing/src/features/marketing/primitives/createFrameEscape.ts b/apps/marketing/src/features/marketing/primitives/createFrameEscape.ts
new file mode 100644
index 0000000000..ee60e4119c
--- /dev/null
+++ b/apps/marketing/src/features/marketing/primitives/createFrameEscape.ts
@@ -0,0 +1,35 @@
+import { onCleanup } from 'solid-js';
+
+const OPEN_INNER_LAYER =
+ '[role="dialog"]:not([data-closed]), [role="alertdialog"]:not([data-closed]), [role="menu"]:not([data-closed]), [role="listbox"]:not([data-closed])';
+
+/**
+ * Escape pressed inside a same-origin frame never reaches the dialog around
+ * it. `watch` a frame once it loads to pass the key on to `onEscape`, unless
+ * the framed page used it for a layer of its own.
+ */
+export function createFrameEscape(onEscape: () => void) {
+ let frameDocument: Document | undefined;
+ const onFrameKey = (event: KeyboardEvent) => {
+ if (event.key !== 'Escape') return;
+ // Capture the layer before its own Escape handler removes it from the DOM.
+ const innerLayer = frameDocument?.querySelector(OPEN_INNER_LAYER);
+ if (innerLayer) return;
+ const currentDocument = frameDocument;
+ queueMicrotask(() => {
+ if (!event.defaultPrevented && frameDocument === currentDocument)
+ onEscape();
+ });
+ };
+ const release = () => {
+ frameDocument?.removeEventListener('keydown', onFrameKey, true);
+ frameDocument = undefined;
+ };
+ const watch = (frame: HTMLIFrameElement) => {
+ release();
+ frameDocument = frame.contentDocument ?? undefined;
+ frameDocument?.addEventListener('keydown', onFrameKey, true);
+ };
+ onCleanup(release);
+ return { watch, release };
+}
diff --git a/apps/marketing/src/features/marketing/views/SalesPage.tsx b/apps/marketing/src/features/marketing/views/SalesPage.tsx
index 7908c5d937..1b37c27616 100644
--- a/apps/marketing/src/features/marketing/views/SalesPage.tsx
+++ b/apps/marketing/src/features/marketing/views/SalesPage.tsx
@@ -1,11 +1,9 @@
-import { handleDemoClick } from '../../../app/utils/utilCta';
+import { demoHref, handleDemoClick } from '../../../app/utils/utilCta';
import { setPageSeo } from '../../../app/utils/utilSeo';
import { FeatureConstellation } from '../../setup/components/FeatureOverview';
import { WelcomeStep } from '../../setup/components/WelcomeSteps';
-import { createSitePalette } from '../../setup/sitePalette';
import { FeaturePage } from '../components/FeaturePage';
import { HomepageTrustBadges } from '../components/HomepageTrustBadges';
-import { DemoBookingEmbed } from '../components/sales/DemoBookingEmbed';
import { SalesCalculator } from '../components/sales/SalesCalculator';
import { formatWholeUsd } from '../core/sales-savings';
import { MACRO_SEAT_CENTS } from '../core/savings-calculator';
@@ -40,14 +38,6 @@ function TourHeading(props: {
);
}
-/** Every demo CTA scrolls to the inline booker instead of leaving the page. */
-function bookDemo(buttonName: string) {
- handleDemoClick(buttonName);
- document
- .getElementById('book')
- ?.scrollIntoView({ behavior: 'smooth', block: 'start' });
-}
-
export function RouteTour() {
setPageSeo({
title: 'Macro — Email, Docs, Tasks, and Agents in One App',
@@ -56,8 +46,6 @@ export function RouteTour() {
path: '/tour',
noindex: true,
});
- const palette = createSitePalette();
- const cream = () => palette() === 'cream';
return (
<FeaturePage>
@@ -79,11 +67,8 @@ export function RouteTour() {
<div class="homepage-hero-action mt-6 flex justify-center pb-5">
<a
class="site-nav-start homepage-hero-cta tour-cta"
- href="#book"
- onClick={(event) => {
- event.preventDefault();
- bookDemo('tour_hero_book_demo');
- }}
+ href={demoHref()}
+ onClick={() => handleDemoClick('tour_hero_book_demo')}
>
Book a demo
</a>
@@ -139,7 +124,7 @@ export function RouteTour() {
description="Choose your team size and the tools you pay for today. Every Macro plan includes every module."
/>
<SalesCalculator
- onBook={() => bookDemo('tour_calculator_book_demo')}
+ onBook={() => handleDemoClick('tour_calculator_book_demo')}
/>
</section>
@@ -151,9 +136,15 @@ export function RouteTour() {
<TourHeading
id="book-title"
title="See how to grow your business faster."
- description="A 30-minute call with our CEO or a member of our team. Pick a time below."
+ description="A 30-minute call with our CEO or a member of our team."
/>
- <DemoBookingEmbed id="tour-booking" cream={cream()} />
+ <a
+ class="site-nav-start homepage-hero-cta tour-cta"
+ href={demoHref()}
+ onClick={() => handleDemoClick('tour_closing_book_demo')}
+ >
+ Pick a time
+ </a>
</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.css
index 8f740b1fd1..a6fd3d3fde 100644
--- a/apps/marketing/src/features/marketing/views/sales-page.css
+++ b/apps/marketing/src/features/marketing/views/sales-page.css
@@ -38,7 +38,6 @@ 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 { width: 100%; max-width: 760px; min-height: 560px; overflow: hidden; border-radius: 24px; background: var(--color-panel); }
/* The full 15-feature grid on desktop, the compact ring on phones. */
.tour-constellation-mobile { display: none; }
@media (max-width: 767px) {
diff --git a/apps/marketing/src/features/setup/cream-preview.css b/apps/marketing/src/features/setup/cream-preview.css
index 48e06e3993..b168cec567 100644
--- a/apps/marketing/src/features/setup/cream-preview.css
+++ b/apps/marketing/src/features/setup/cream-preview.css
@@ -218,7 +218,6 @@ html[data-palette='cream'] .tour-page :is(.tour-hero, .tour-constellation, .tour
}
html[data-palette='cream'] .sales-calc-check svg { color: #f5f1e8; }
html[data-palette='cream'] .sales-calc-tools button[aria-pressed=true] .sales-calc-check { color: #f5f1e8; }
-html[data-palette='cream'] .sales-booking-embed { background: #faf8f3; box-shadow: 0 0 0 1px #1d1c1a12; }
/* The main site (App.tsx) runs applyTheme, which writes the b and c color inputs inline
on <html>; only !important outranks inline declarations. */
diff --git a/apps/web/public/sw.js b/apps/web/public/sw.js
index 4b32adb373..b5c1ea42c6 100644
--- a/apps/web/public/sw.js
+++ b/apps/web/public/sw.js
@@ -57,6 +57,9 @@ self.addEventListener('fetch', (event) => {
if (!url.pathname.startsWith(SCOPE_PATH)) return;
if (request.mode === 'navigate') {
+ // The cached shell carries the app's frame options. A framed page (a
+ // booking link in the website's dialog) needs the ones served for its path.
+ if (request.destination === 'iframe') return;
// Mirror the routing lambda: paths that look like files are not the app.
const leaf = url.pathname.split('/').pop() ?? '';
if (leaf.includes('.') && !url.pathname.includes('@')) return;
diff --git a/apps/web/src/features/scheduling/public-booking.test.tsx b/apps/web/src/features/scheduling/public-booking.test.tsx
index ecae598c6d..a02a6a97d5 100644
--- a/apps/web/src/features/scheduling/public-booking.test.tsx
+++ b/apps/web/src/features/scheduling/public-booking.test.tsx
@@ -1,8 +1,16 @@
-import { render, screen } from '@solidjs/testing-library';
-import { describe, expect, it, vi } from 'vitest';
+import { PosthogProvider } from '@app/lib/analytics/posthog';
+import { cleanup, fireEvent, render, screen } from '@solidjs/testing-library';
+import type { PostHog } from 'posthog-js';
+import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest';
-vi.mock('@app/lib/analytics/posthog', () => ({
- useFeatureFlag: () => () => ({ enabled: false, loading: false }),
+const posthog = vi.hoisted(() => ({
+ onFeatureFlags: vi.fn<PostHog['onFeatureFlags']>(),
+ getFeatureFlagResult: vi.fn<PostHog['getFeatureFlagResult']>(),
+ featureFlags: { getFlags: vi.fn<() => string[]>() },
+}));
+
+vi.mock('@app/lib/analytics/analytics-context', () => ({
+ useAnalytics: () => ({ posthog }),
}));
vi.mock('@solidjs/router', () => ({
useLocation: () => ({ hash: '#private-receipt-token' }),
@@ -16,17 +24,121 @@ vi.mock('./queries/public', () => ({
reschedule: vi.fn(),
})),
createPublicBookingSource: vi.fn(),
- usePublicProfileQuery: vi.fn(),
+ usePublicProfileQuery: vi.fn(() => ({
+ isSuccess: true,
+ isError: false,
+ data: { id: 'team', name: 'Macro', eventTypes: [] },
+ })),
}));
vi.mock('./views/booking-receipt-view', () => ({
BookingReceiptView: () => <p>Private booking receipt</p>,
}));
vi.mock('./views/public-booking-view', () => ({
- PublicBookingView: () => <p>Choose an event</p>,
+ PublicBookingView: (props: {
+ onReceipt: (receipt: { booking: { id: string }; token: string }) => void;
+ }) => (
+ <button
+ onClick={() => props.onReceipt({ booking: { id: 'b1' }, token: 't1' })}
+ >
+ Choose an event
+ </button>
+ ),
}));
-import { BookingReceiptPage } from './public-booking';
-import { createBookingReceiptSource } from './queries/public';
+import { BookingReceiptPage, PublicBookingPage } from './public-booking';
+import {
+ createBookingReceiptSource,
+ usePublicProfileQuery,
+} from './queries/public';
+
+const SCHEDULING_FLAG = 'enable-calendar-scheduling';
+
+/** Mounts the page and returns PostHog's pending answer to the flag request. */
+function openBookingLink() {
+ render(() => (
+ <PosthogProvider>
+ <PublicBookingPage profile="team" />
+ </PosthogProvider>
+ ));
+ const answer = posthog.onFeatureFlags.mock.calls[0]?.[0];
+ if (!answer) throw new Error('PostHog provider is not mounted');
+ return answer;
+}
+
+beforeEach(() => {
+ vi.clearAllMocks();
+ posthog.getFeatureFlagResult.mockReset();
+ posthog.featureFlags.getFlags.mockReturnValue([]);
+ posthog.onFeatureFlags.mockReturnValue(() => {});
+});
+afterEach(() => {
+ cleanup();
+ vi.unstubAllGlobals();
+});
+
+describe('public booking route', () => {
+ it('lets a guest book when the flag request gets no answer', async () => {
+ const answer = openBookingLink();
+ expect(screen.getByText('Loading…')).toBeTruthy();
+
+ answer([], {}, { errorsLoading: true });
+
+ expect(await screen.findByText('Choose an event')).toBeTruthy();
+ });
+
+ it('opens once PostHog reports the rollout on', async () => {
+ posthog.getFeatureFlagResult.mockReturnValue({
+ key: SCHEDULING_FLAG,
+ enabled: true,
+ variant: undefined,
+ payload: undefined,
+ });
+ const answer = openBookingLink();
+
+ answer([SCHEDULING_FLAG], { [SCHEDULING_FLAG]: true });
+
+ expect(await screen.findByText('Choose an event')).toBeTruthy();
+ });
+
+ it('stays unavailable, without loading the profile, while the rollout is off', async () => {
+ posthog.getFeatureFlagResult.mockReturnValue({
+ key: SCHEDULING_FLAG,
+ enabled: false,
+ variant: undefined,
+ payload: undefined,
+ });
+ const answer = openBookingLink();
+
+ answer([], { [SCHEDULING_FLAG]: false });
+
+ expect(
+ await screen.findByText('This booking page is unavailable.')
+ ).toBeTruthy();
+ expect(usePublicProfileQuery).not.toHaveBeenCalled();
+ });
+});
+
+describe('public booking route in the website dialog', () => {
+ it('tells the website when a guest books', async () => {
+ const website = { postMessage: vi.fn() };
+ vi.stubGlobal('parent', website);
+ posthog.getFeatureFlagResult.mockReturnValue({
+ key: SCHEDULING_FLAG,
+ enabled: true,
+ variant: undefined,
+ payload: undefined,
+ });
+ const answer = openBookingLink();
+ answer([SCHEDULING_FLAG], { [SCHEDULING_FLAG]: true });
+
+ fireEvent.click(await screen.findByText('Choose an event'));
+
+ expect(website.postMessage).toHaveBeenCalledWith(
+ { type: 'macro:booking-made' },
+ window.location.origin
+ );
+ });
+});
describe('booking receipt route', () => {
it('lets a form respondent use their private receipt outside the Calendar rollout', () => {
diff --git a/apps/web/src/features/scheduling/public-booking.tsx b/apps/web/src/features/scheduling/public-booking.tsx
index 74b680db42..e9e38e3846 100644
--- a/apps/web/src/features/scheduling/public-booking.tsx
+++ b/apps/web/src/features/scheduling/public-booking.tsx
@@ -12,6 +12,13 @@ import { PublicBookingView } from './views/public-booking-view';
type BookingPageParams = { profile: string; slug?: string };
+// The website opens these pages in its booking dialog. No other site can frame
+// them: the booking paths allow same-origin framing only.
+const isEmbedded = () => window.parent !== window;
+
+/** Tells the page around a framed booking page that a booking was made. */
+const BOOKING_MADE = 'macro:booking-made';
+
function BookingPageContent(params: BookingPageParams) {
const navigate = useNavigate();
const profile = usePublicProfileQuery(() => params.profile);
@@ -42,8 +49,18 @@ function BookingPageContent(params: BookingPageParams) {
profile={p()}
event={p().eventTypes.find((e) => e.slug === params.slug)}
source={source}
+ embedded={isEmbedded()}
onEvent={(slug) => navigate(`/book/${params.profile}/${slug}`)}
- onReceipt={(r) => navigate(`/booking/${r.booking.id}#${r.token}`)}
+ onReceipt={(r) => {
+ // The website records the booking in its own analytics; it
+ // cannot see into the frame.
+ if (isEmbedded())
+ window.parent.postMessage(
+ { type: BOOKING_MADE },
+ window.location.origin
+ );
+ navigate(`/booking/${r.booking.id}#${r.token}`);
+ }}
/>
</Show>
)}
@@ -51,7 +68,11 @@ function BookingPageContent(params: BookingPageParams) {
);
}
export function PublicBookingPage(props: BookingPageParams) {
- const scheduling = useFeatureFlag(enableCalendarScheduling);
+ // A guest whose browser blocks the flag request must still be able to book;
+ // only an answer that the rollout is off hides the page.
+ const scheduling = useFeatureFlag(enableCalendarScheduling, {
+ enabledWhenUnreachable: true,
+ });
return (
<Show
when={scheduling().enabled}
@@ -81,6 +102,7 @@ function ReceiptContent(params: { id: string }) {
cancel={source.cancel}
loadSlots={source.replacementSlots}
reschedule={source.reschedule}
+ embedded={isEmbedded()}
/>
);
}
diff --git a/apps/web/src/features/scheduling/views/booking-receipt-view.tsx b/apps/web/src/features/scheduling/views/booking-receipt-view.tsx
index 99d8bc3038..5b5e55a161 100644
--- a/apps/web/src/features/scheduling/views/booking-receipt-view.tsx
+++ b/apps/web/src/features/scheduling/views/booking-receipt-view.tsx
@@ -1,4 +1,4 @@
-import { Button } from '@ui';
+import { Button, cn } from '@ui';
import { createSignal, Show } from 'solid-js';
import { RescheduleForm } from '../components/reschedule-form';
import type { BookingReceipt } from '../core/types';
@@ -9,6 +9,8 @@ export function BookingReceiptView(props: {
cancel: () => Promise<void>;
loadSlots: (date: string) => Promise<{ startsAt: string; endsAt: string }[]>;
reschedule: (start: string) => Promise<void>;
+ /** Shown inside another Macro page, which already frames the receipt. */
+ embedded?: boolean;
}) {
const [confirm, setConfirm] = createSignal(false);
const [rescheduling, setRescheduling] = createSignal(false);
@@ -31,7 +33,12 @@ export function BookingReceiptView(props: {
}
};
return (
- <main class="min-h-screen bg-panel px-4 py-20 text-ink">
+ <main
+ class={cn(
+ 'min-h-screen bg-panel px-4 text-ink',
+ props.embedded ? 'py-4' : 'py-20'
+ )}
+ >
<div class="mx-auto max-w-lg rounded-2xl border border-edge-muted bg-surface-1 p-8">
<Show
when={props.receipt}
diff --git a/apps/web/src/features/scheduling/views/public-booking-view.test.tsx b/apps/web/src/features/scheduling/views/public-booking-view.test.tsx
new file mode 100644
index 0000000000..8d1bfe328a
--- /dev/null
+++ b/apps/web/src/features/scheduling/views/public-booking-view.test.tsx
@@ -0,0 +1,41 @@
+import { cleanup, render, screen } from '@solidjs/testing-library';
+import { afterEach, expect, it } from 'vitest';
+import type { PublicProfile } from '../core/types';
+import type { BookingSource } from '../primitives/booking-flow';
+import { PublicBookingView } from './public-booking-view';
+
+const profile: PublicProfile = {
+ id: 'team',
+ name: 'Macro',
+ description: 'Meet the team.',
+ eventTypes: [],
+};
+
+function renderPage(embedded?: boolean) {
+ render(() => (
+ <PublicBookingView
+ profile={profile}
+ source={{} as BookingSource}
+ onEvent={() => {}}
+ onReceipt={() => {}}
+ embedded={embedded}
+ />
+ ));
+}
+
+afterEach(cleanup);
+
+it('carries the Macro name when it is the whole page', () => {
+ renderPage();
+
+ expect(screen.getByRole('link', { name: /Macro\s*Scheduling/ })).toBeTruthy();
+ expect(screen.getByText('Scheduling by Macro')).toBeTruthy();
+});
+
+it('leaves the Macro name to the page that embeds it', () => {
+ renderPage(true);
+
+ expect(screen.getByRole('heading', { name: 'Macro' })).toBeTruthy();
+ expect(screen.queryByRole('link')).toBeNull();
+ expect(screen.queryByText('Scheduling by Macro')).toBeNull();
+});
diff --git a/apps/web/src/features/scheduling/views/public-booking-view.tsx b/apps/web/src/features/scheduling/views/public-booking-view.tsx
index 1e5b67668a..614a650e65 100644
--- a/apps/web/src/features/scheduling/views/public-booking-view.tsx
+++ b/apps/web/src/features/scheduling/views/public-booking-view.tsx
@@ -1,3 +1,4 @@
+import { cn } from '@ui';
import { For, Show } from 'solid-js';
import { BookingPicker } from '../components/booking-picker';
import {
@@ -14,19 +15,28 @@ export function PublicBookingView(props: {
source: BookingSource;
onEvent: (slug: string) => void;
onReceipt: (r: BookingReceipt) => void;
+ /** Shown inside another Macro page, which already carries the Macro name. */
+ embedded?: boolean;
}) {
return (
- <main class="min-h-screen overflow-y-auto bg-panel px-4 py-12 text-ink sm:py-20">
+ <main
+ class={cn(
+ 'min-h-screen overflow-y-auto bg-panel px-4 text-ink',
+ props.embedded ? 'py-4' : 'py-12 sm:py-20'
+ )}
+ >
<div class="mx-auto max-w-4xl">
- <a
- href="https://macro.com"
- class="mb-8 inline-block text-lg font-semibold tracking-tight"
- >
- Macro
- <span class="ml-2 text-sm font-normal text-ink-muted">
- Scheduling
- </span>
- </a>
+ <Show when={!props.embedded}>
+ <a
+ href="https://macro.com"
+ class="mb-8 inline-block text-lg font-semibold tracking-tight"
+ >
+ Macro
+ <span class="ml-2 text-sm font-normal text-ink-muted">
+ Scheduling
+ </span>
+ </a>
+ </Show>
<Show
when={props.event}
fallback={
@@ -76,9 +86,11 @@ export function PublicBookingView(props: {
/>
)}
</Show>
- <p class="mt-8 text-center text-xs text-ink-muted">
- Scheduling by Macro
- </p>
+ <Show when={!props.embedded}>
+ <p class="mt-8 text-center text-xs text-ink-muted">
+ Scheduling by Macro
+ </p>
+ </Show>
</div>
</main>
);
diff --git a/apps/web/src/lib/analytics/posthog.test.tsx b/apps/web/src/lib/analytics/posthog.test.tsx
index 60c1c751d0..c3c5695a5e 100644
--- a/apps/web/src/lib/analytics/posthog.test.tsx
+++ b/apps/web/src/lib/analytics/posthog.test.tsx
@@ -32,16 +32,31 @@ async function receiveFlags(
await new Promise((resolve) => setTimeout(resolve));
}
+/** The flag request got no answer: blocked, offline, or PostHog is down. */
+async function failToReachPostHog(cached?: FeatureFlagResult) {
+ posthog.getFeatureFlagResult.mockReturnValue(cached);
+ const callback = posthog.onFeatureFlags.mock.calls[0]?.[0];
+ if (!callback) throw new Error('PostHog provider is not mounted');
+ callback([], {}, { errorsLoading: true });
+ await new Promise((resolve) => setTimeout(resolve));
+}
+
function flagResult(enabled: boolean, payload?: string): FeatureFlagResult {
return { key: channelTags.key, enabled, variant: undefined, payload };
}
-function renderFlag(flag: RemoteFlag = channelTags) {
+function renderFlag(
+ flag: RemoteFlag = channelTags,
+ opts: { enabledWhenUnreachable?: boolean } = {}
+) {
let result!: ReturnType<typeof useFeatureFlag<string>>;
const mount = vi.fn();
const Probe = () => {
mount();
- result = useFeatureFlag<string>(flag, { fallbackPayload: 'fallback' });
+ result = useFeatureFlag<string>(flag, {
+ fallbackPayload: 'fallback',
+ ...opts,
+ });
return (
<ShowFeatureFlag flag={flag}>
<button>New label</button>
@@ -151,6 +166,48 @@ describe('reactive PostHog flags', () => {
expect(view.mount).toHaveBeenCalledOnce();
});
+ it('treats an unreachable PostHog as flags-off by default', async () => {
+ const view = renderFlag();
+
+ await failToReachPostHog();
+ expect(view.result()).toEqual({
+ enabled: false,
+ payload: 'fallback',
+ loading: false,
+ });
+ });
+
+ it('lets a reader stay on while PostHog is unreachable, until it answers off', async () => {
+ const view = renderFlag(channelTags, { enabledWhenUnreachable: true });
+ expect(view.result().enabled).toBe(false);
+
+ await failToReachPostHog();
+ expect(view.result()).toEqual({
+ enabled: true,
+ payload: 'fallback',
+ loading: false,
+ });
+
+ await receiveFlags(flagResult(false));
+ expect(view.result().enabled).toBe(false);
+
+ // The earlier "off" is still what PostHog last said.
+ await failToReachPostHog(flagResult(false));
+ expect(view.result().enabled).toBe(false);
+ expect(view.mount).toHaveBeenCalledOnce();
+ });
+
+ it('does not turn a missing flag on when PostHog did answer', async () => {
+ const view = renderFlag(channelTags, { enabledWhenUnreachable: true });
+
+ await receiveFlags(undefined);
+ expect(view.result()).toEqual({
+ enabled: false,
+ payload: 'fallback',
+ loading: false,
+ });
+ });
+
it.each([false, true])(
'keeps the explicit %s override authoritative',
async (override) => {
diff --git a/apps/web/src/lib/analytics/posthog.tsx b/apps/web/src/lib/analytics/posthog.tsx
index 1131d2e485..3ea25b43c4 100644
--- a/apps/web/src/lib/analytics/posthog.tsx
+++ b/apps/web/src/lib/analytics/posthog.tsx
@@ -31,6 +31,9 @@ export const [PosthogProvider, usePosthog] = createAssertedContextProvider(
// RedirectSplit) must not fire before the answer arrives. Set even on
// errorsLoading so a PostHog outage degrades to flags-off, not a hang.
const [flagsLoaded, setFlagsLoaded] = createSignal(cachedFlags.length > 0);
+ // Whether the last fetch got no answer at all (blocked, offline, PostHog
+ // down), as opposed to an answer that says a flag is off.
+ const [flagsUnreachable, setFlagsUnreachable] = createSignal(false);
const unsub = analytics.posthog.onFeatureFlags((flags, _, ctx) => {
// Flags usually arrive after first paint and swap flagged subtrees,
@@ -43,13 +46,19 @@ export const [PosthogProvider, usePosthog] = createAssertedContextProvider(
if (!ctx?.errorsLoading) {
setFeatureFlags(flags);
}
+ setFlagsUnreachable(ctx?.errorsLoading === true);
setFlagsLoaded(true);
});
});
onCleanup(unsub);
- return { instance: analytics.posthog, featureFlags, flagsLoaded };
+ return {
+ instance: analytics.posthog,
+ featureFlags,
+ flagsLoaded,
+ flagsUnreachable,
+ };
}
);
@@ -62,6 +71,12 @@ type FeatureFlagResult<T> = {
type FeatureFlagOpts<T> = {
fallbackPayload?: T;
enabledOverride?: boolean;
+ /**
+ * Treat the flag as on when PostHog could not be reached and holds no
+ * earlier answer for it; an answer of "off" still wins. For pages anonymous
+ * visitors depend on, which a blocked flag request must not take down.
+ */
+ enabledWhenUnreachable?: boolean;
};
function readFeatureFlag<T extends JsonType>(
@@ -89,9 +104,11 @@ function readFeatureFlag<T extends JsonType>(
// payload changes that leave the enabled flag list unchanged.
posthog.featureFlags();
const result = posthog.instance.getFeatureFlagResult(key);
+ const unreachableDefault =
+ opts?.enabledWhenUnreachable === true && posthog.flagsUnreachable();
return {
- enabled: result?.enabled ?? false,
+ enabled: result?.enabled ?? unreachableDefault,
payload: (result?.payload as T) ?? fallbackPayload,
loading: false,
};
@@ -108,7 +125,7 @@ function readFeatureFlag<T extends JsonType>(
export function useFeatureFlag<T extends JsonType>(
flag: RemoteFlag,
- opts?: { fallbackPayload?: T }
+ opts?: Pick<FeatureFlagOpts<T>, 'fallbackPayload' | 'enabledWhenUnreachable'>
): Accessor<FeatureFlagResult<T | undefined>>;
export function useFeatureFlag<T extends JsonType>(
key: string,
diff --git a/docs/AGENT_GUIDE/surfaces.md b/docs/AGENT_GUIDE/surfaces.md
index dab43a85d9..7f98af2075 100644
--- a/docs/AGENT_GUIDE/surfaces.md
+++ b/docs/AGENT_GUIDE/surfaces.md
@@ -1338,7 +1338,8 @@ Calendar scheduling is on by default in dev. Production uses the PostHog flag
While off, the Calendar settings tab and calendar booking shortcuts are hidden;
public booking and receipt links show an unavailable page without fetching
scheduling data. When enabling a production rollout, include anonymous visitors
-so invitees can open those links.
+so invitees can open those links. A public booking link stays available when
+the flag request gets no answer, for example when a browser blocks it.
Calendar connections live in **Settings → Calendar** (`/app/settings/calendar`).
Scheduling lives in the separate **Settings → Booking links** item
@@ -1403,7 +1404,10 @@ Oversized result sets return an error instead of silently truncating insights.
The calendar header includes `Copy booking link` and `Open calendar scheduling
settings`. Copy opens settings when no active personal link exists. Public
-`/app/book/:profile/:slug?` pages accept bookings without Macro sign-in. Uncertain
+`/app/book/:profile/:slug?` pages accept bookings without Macro sign-in. The website
+opens them in its own dialog; framed there, a booking page and its receipt drop their
+Macro heading and footer, and the booking page tells the website when a booking is
+made. Only macro.com can frame them. Uncertain
calendar writes retain the booking and show its private receipt while automatic recovery runs.
After a network response cannot be verified, `Check booking status` retries the original request;
do not create a replacement booking. Receipt pages poll while the calendar update is pending. Visitors
diff --git a/docs/CALENDAR_SCHEDULING_V1.md b/docs/CALENDAR_SCHEDULING_V1.md
index 666cfe4962..474b9292a1 100644
--- a/docs/CALENDAR_SCHEDULING_V1.md
+++ b/docs/CALENDAR_SCHEDULING_V1.md
@@ -81,6 +81,8 @@ tests do not verify real invitations, OAuth, or Meet creation.
timestamp, partial recovery index, and bounded per-profile request budgets.
- Leave the production PostHog flag `enable-calendar-scheduling` disabled until the
connected-account checks below pass. An absent flag is also off in production.
+ A flag request that gets no answer (blocked, offline, or a PostHog outage) leaves
+ public booking pages available; only an answer of "off" hides them.
Scheduling is on by default in dev; set `VITE_ENABLE_CALENDAR_SCHEDULING=false`
to test the disabled state locally. The flag gates the Calendar settings tab,
calendar booking shortcuts, and public booking/receipt pages before their queries mount.
diff --git a/infra/stacks/website/index.ts b/infra/stacks/website/index.ts
index 6327b87d7a..94a3a0cd65 100644
--- a/infra/stacks/website/index.ts
+++ b/infra/stacks/website/index.ts
@@ -180,6 +180,33 @@ const securityHeadersPolicy = new aws.cloudfront.ResponseHeadersPolicy(
}
);
+// Booking links open in a dialog on the website, so macro.com may frame them.
+// Otherwise the same headers as the shared app policy, which denies framing.
+const bookingPageHeadersPolicy = new aws.cloudfront.ResponseHeadersPolicy(
+ `booking-page-headers-${stack}`,
+ {
+ securityHeadersConfig: {
+ frameOptions: {
+ frameOption: 'SAMEORIGIN',
+ override: true,
+ },
+ contentSecurityPolicy: {
+ contentSecurityPolicy: "frame-ancestors 'self'",
+ override: true,
+ },
+ },
+ customHeadersConfig: {
+ items: [
+ {
+ header: 'Cross-Origin-Opener-Policy',
+ value: 'same-origin-allow-popups',
+ override: true,
+ },
+ ],
+ },
+ }
+);
+
const compressibleCachePolicy = new aws.cloudfront.CachePolicy(
`cache-policy-${stack}`,
{
@@ -316,6 +343,15 @@ const cdn = new aws.cloudfront.Distribution(`cdn-${stack}`, {
cachePolicyId: compressibleCachePolicy.id,
compress: true,
},
+ ...['/app/book/*', '/app/booking/*'].map((pathPattern) => ({
+ pathPattern,
+ targetOriginId: macroWebAppRouteLambdaId,
+ cachePolicyId: CACHING_DISABLED,
+ responseHeadersPolicyId: bookingPageHeadersPolicy.id,
+ viewerProtocolPolicy: 'redirect-to-https',
+ allowedMethods: ['GET', 'HEAD', 'OPTIONS'],
+ cachedMethods: ['GET', 'HEAD', 'OPTIONS'],
+ })),
{
pathPattern: '/app',
targetOriginId: macroWebAppBucketArn,