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
feat(onboarding): send phone signups to the website's email capture (#7966)
juliawest20039a458dc0
diff --git a/.sqlx/query-80a3c59c18f6fe25099d9b0a6d2dee52f5cb9461aa059cb1c6a7b6dae8ce3f8c.json b/.sqlx/query-80a3c59c18f6fe25099d9b0a6d2dee52f5cb9461aa059cb1c6a7b6dae8ce3f8c.jsonnew file mode 100644index 0000000000..4ccd8d4b72--- /dev/null+++ b/.sqlx/query-80a3c59c18f6fe25099d9b0a6d2dee52f5cb9461aa059cb1c6a7b6dae8ce3f8c.json@@ -0,0 +1,14 @@+{+ "db_name": "PostgreSQL",+ "query": "\n DELETE FROM mobile_welcome_email\n WHERE email = $1\n ",+ "describe": {+ "columns": [],+ "parameters": {+ "Left": [+ "Text"+ ]+ },+ "nullable": []+ },+ "hash": "80a3c59c18f6fe25099d9b0a6d2dee52f5cb9461aa059cb1c6a7b6dae8ce3f8c"+}diff --git a/apps/marketing/src/app/components/forms/FormMobileSignup.tsx b/apps/marketing/src/app/components/forms/FormMobileSignup.tsxindex 81a1bef295..a002297e3e 100644--- a/apps/marketing/src/app/components/forms/FormMobileSignup.tsx+++ b/apps/marketing/src/app/components/forms/FormMobileSignup.tsx@@ -17,8 +17,9 @@ type FormMobileSignupProps = {/*** `stacked` — field then full-width CTA (hero).* `inline` — CTA nested inside the field (compact header).+ * `card` — the phone signup page, styled by RouteMobileSignup.css.*/- variant?: 'stacked' | 'inline';+ variant?: 'stacked' | 'inline' | 'card';};/**@@ -34,6 +35,7 @@ export function FormMobileSignup(props: FormMobileSignupProps) {const [pending, setPending] = createSignal(false);const [error, setError] = createSignal<string | null>(null);const inline = () => props.variant === 'inline';+ const card = () => props.variant === 'card';let inputRef: HTMLInputElement | undefined;const focusEmail = () => {@@ -93,7 +95,7 @@ export function FormMobileSignup(props: FormMobileSignupProps) {: {'box-sizing': 'border-box',display: 'grid',- gap: '10px',+ gap: card() ? '12px' : '10px','max-width': '420px',width: '100%',}@@ -156,14 +158,18 @@ export function FormMobileSignup(props: FormMobileSignupProps) {}: {display: 'grid',- gap: '10px',+ gap: card() ? '12px' : '10px',width: '100%',}}><inputref={inputRef}- class={`mobile-signup-field${inline() ? ' mobile-signup-field--inline' : ''}`}+ class={+ card()+ ? 'mobile-signup-card-field'+ : `mobile-signup-field${inline() ? ' mobile-signup-field--inline' : ''}`+ }type="email"name="email"autocomplete="email"@@ -178,7 +184,7 @@ export function FormMobileSignup(props: FormMobileSignupProps) {setEmail(event.currentTarget.value);if (error()) setError(null);}}- style={{+ style={card() ? undefined : {'background-color':'color-mix(in srgb, var(--b1) 88%, transparent)',border: '1px solid color-mix(in srgb, var(--b4) 46%, transparent)',@@ -198,13 +204,15 @@ export function FormMobileSignup(props: FormMobileSignupProps) {<buttonclass={- inline()- ? 'mobile-signup-submit mobile-signup-submit--inline'- : 'mobile-signup-submit'+ card()+ ? 'mobile-signup-card-pill'+ : inline()+ ? 'mobile-signup-submit mobile-signup-submit--inline'+ : 'mobile-signup-submit'}type="submit"disabled={pending()}- style={{+ style={card() ? undefined : {'align-items': 'center','background-color': 'var(--c1)',border: '1px solid transparent',@@ -250,7 +258,7 @@ export function FormMobileSignup(props: FormMobileSignupProps) {'font-size': '13px','line-height': 1.4,margin: '0',- 'padding-left': '18px',+ 'padding-left': card() ? '0' : '18px',}}>{error()}diff --git a/apps/marketing/src/app/components/graphics/MobileSignupMark.tsx b/apps/marketing/src/app/components/graphics/MobileSignupMark.tsxnew file mode 100644index 0000000000..1628511142--- /dev/null+++ b/apps/marketing/src/app/components/graphics/MobileSignupMark.tsx@@ -0,0 +1,34 @@+import { MacroMarkIcon } from './MacroMarkIcon';++/**+ * The Macro mark on a rounded tile, linking home. Heads the phone signup+ * pages, which have no site header.+ */+export function MobileSignupMark() {+ return (+ <>+ <style>{`+ .mobile-signup-mark {+ align-items: center;+ background: linear-gradient(145deg, #171717, #090909 65%);+ border-radius: 18px;+ box-shadow: inset .5px .5px 1px #ffffff1c, inset -.5px -.5px 1px #0008, 0 1px 1px #131313, 0 4px 10px #0005;+ color: var(--color-ink);+ display: flex;+ height: 64px;+ justify-content: center;+ width: 64px;+ }+ html[data-palette='cream'] .mobile-signup-mark {+ background: linear-gradient(145deg, #fdfcfb, #faf8f3);+ box-shadow: 0 8px 30px -12px #1d1c1a20;+ }+ `}</style>+ {/* `rel="external"` makes this a full page load: `/` is its own+ prerendered document, not a route in this router. */}+ <a href="/" rel="external" class="mobile-signup-mark" aria-label="Macro home">+ <MacroMarkIcon style={{ height: '22px', width: '32px' }} />+ </a>+ </>+ );+}diff --git a/apps/marketing/src/app/main/App.tsx b/apps/marketing/src/app/main/App.tsxindex ebef603426..2aca2dd826 100644--- a/apps/marketing/src/app/main/App.tsx+++ b/apps/marketing/src/app/main/App.tsx@@ -248,12 +248,21 @@ const RootLayout: ParentComponent = (props) => {width: 'calc(100vw / var(--site-scale, 1))',}}>- <BaseHeader- ctaActive={headerCtaActive()}- hideOpenApp={- location.pathname.replace(/\/$/, '') === '/download'+ {/* The phone signup pages are only the email capture. */}+ <Show+ when={+ ![MOBILE_SIGNUP_PATH, MOBILE_SIGNUP_SENT_PATH].includes(+ location.pathname.replace(/\/$/, '')+ )}- />+ >+ <BaseHeader+ ctaActive={headerCtaActive()}+ hideOpenApp={+ location.pathname.replace(/\/$/, '') === '/download'+ }+ />+ </Show><UtilWrap>{props.children}</UtilWrap></div><PageVignette />diff --git a/apps/marketing/src/app/routes/RouteMobileSignup.css b/apps/marketing/src/app/routes/RouteMobileSignup.cssnew file mode 100644index 0000000000..34f403178e--- /dev/null+++ b/apps/marketing/src/app/routes/RouteMobileSignup.css@@ -0,0 +1,97 @@+/* Phone signup pages, styled like the app's sign-in card. Shared by+ /mobile-signup and /mobile-signup-sent. */++.mobile-signup-card {+ align-content: center;+ box-sizing: border-box;+ display: grid;+ justify-items: center;+ margin: 0 auto;+ max-width: 384px;+ min-height: calc(100dvh / var(--site-scale, 1));+ padding: 56px 0 12vh;+ text-align: center;+ width: 100%;+}++.mobile-signup-card-title {+ color: var(--color-ink);+ font-family: 'Roboto Slab Variable', 'display', serif;+ font-size: 30px;+ font-weight: calc(315 + var(--cream-slab-weight-increase, 0));+ letter-spacing: -0.025em;+ line-height: 1.2;+ margin: 32px 0 0;+ text-wrap: balance;+}++.mobile-signup-card-subtitle {+ color: var(--color-ink-muted);+ font-family: 'Inter Variable', 'body', sans-serif;+ font-size: 14px;+ line-height: 24px;+ margin: 16px 0 0;+ text-wrap: balance;+}++.mobile-signup-card-body {+ display: grid;+ gap: 12px;+ justify-items: center;+ margin-top: 36px;+ width: 100%;+}++/* Scoped under the card to outrank index.css's `button:not(...)` and+ `input:not(...)` defaults. */+.mobile-signup-card .mobile-signup-card-field {+ background: transparent;+ border: 1px solid var(--color-edge);+ border-radius: 16px;+ box-sizing: border-box;+ color: var(--color-ink);+ font-family: 'Inter Variable', 'body', sans-serif;+ /* 16px minimum: iOS Safari zooms the page when focusing a smaller field. */+ font-size: 16px;+ outline: none;+ padding: 12px 16px;+ transition: border-color 160ms ease;+ width: 100%;+}+.mobile-signup-card .mobile-signup-card-field::placeholder {+ color: var(--color-ink-placeholder);+}+.mobile-signup-card .mobile-signup-card-field:focus {+ border-color: color-mix(in srgb, var(--color-ink) 40%, transparent);+}++.mobile-signup-card .mobile-signup-card-pill {+ align-items: center;+ background: var(--color-ink);+ border: 0;+ border-radius: 999px;+ box-sizing: border-box;+ color: var(--color-surface-0);+ cursor: default;+ display: flex;+ font-family: 'Inter Variable', 'body', sans-serif;+ font-size: 16px;+ font-weight: 500;+ justify-content: center;+ min-height: 56px;+ padding: 14px 24px;+ text-decoration: none;+ transition: opacity 160ms ease;+ width: 100%;+}+.mobile-signup-card .mobile-signup-card-pill:hover { opacity: 0.9; }+.mobile-signup-card .mobile-signup-card-pill:disabled { opacity: 0.4; }+.mobile-signup-card .mobile-signup-card-pill:focus-visible {+ outline: 2px solid var(--color-ink);+ outline-offset: 4px;+}++@media (min-width: 640px) {+ .mobile-signup-card-title { font-size: 36px; }+ .mobile-signup-card-subtitle { font-size: 15px; }+}diff --git a/apps/marketing/src/app/routes/RouteMobileSignup.tsx b/apps/marketing/src/app/routes/RouteMobileSignup.tsxindex 6e0b700963..1adda943ef 100644--- a/apps/marketing/src/app/routes/RouteMobileSignup.tsx+++ b/apps/marketing/src/app/routes/RouteMobileSignup.tsx@@ -1,18 +1,13 @@-import { type Component, Show } from 'solid-js';-import { LinkBookDemo } from '../components/buttons/LinkBookDemo';+import type { Component } from 'solid-js';import { FormMobileSignup } from '../components/forms/FormMobileSignup';-import { MacroMarkIcon } from '../components/graphics/MacroMarkIcon';-import { analytics } from '../utils/utilAnalytic';-import { buildAppUrl, buildGoogleSsoUrl } from '../utils/utilBaseUrl';-import { viewportWidth } from '../utils/utilBreakpoint';-import { isMobileWebDevice } from '../utils/utilCta';+import { MobileSignupMark } from '../components/graphics/MobileSignupMark';import { setPageSeo } from '../utils/utilSeo';+import './RouteMobileSignup.css';/**- * Email-capture page for mobile visitors, the destination of every mobile CTA- * outside the home hero (which captures inline). Same two steps as before —- * email, then "check your inbox" — but served by the site, so there is no app- * bundle to download first.+ * Email capture for phones, the destination of every phone signup link. It is+ * only the capture: the visitor leaves an email and is sent a link to finish+ * onboarding on desktop.*/export const RouteMobileSignup: Component = () => {setPageSeo({@@ -24,112 +19,17 @@ export const RouteMobileSignup: Component = () => {noindex: true,});- const mobile = () => viewportWidth() < 700;-return (- <section- style={{- 'box-sizing': 'border-box',- display: 'grid',- gap: '20px',- 'justify-items': 'start',- 'max-width': '520px',- 'padding-bottom': '96px',- 'padding-top': mobile() ? '112px' : '148px',- width: '100%',- }}- >- <MacroMarkIcon- style={{ color: 'var(--a0)', height: '30px', width: '46px' }}- />-- <h1- style={{- color: 'var(--c0)',- 'font-family': 'display',- 'font-size': mobile() ? 'clamp(38px, 11vw, 48px)' : '48px',- 'font-weight': 'calc(315 + var(--cream-slab-weight-increase, 0))',- 'letter-spacing': '-0.012em',- 'line-height': 1.12,- margin: '0',- }}- >- One app for- <br />- all your work.- </h1>-- <p- style={{- color: 'var(--c2)',- 'font-family': 'body',- 'font-size': '14px',- 'font-weight': '400',- 'line-height': 1.5,- margin: '0',- 'max-width': '38ch',- }}- >- Macro sets up on your computer. Drop your email and we’ll send you- a link to start — it takes about a minute at your desk.- </p>-- <FormMobileSignup buttonName="mobile_signup_page" />- <LinkBookDemo buttonName="mobile_signup_page_book_demo" />-- <Show when={!isMobileWebDevice()}>- <a- href={buildGoogleSsoUrl()}- onClick={(event) => {- event.preventDefault();- analytics.track('app_redirect', {- page_location: window.location.href,- button_name: 'mobile_signup_page_google',- });- window.location.href = buildGoogleSsoUrl();- }}- style={{- color: 'var(--c2)',- 'font-family': 'body',- 'font-size': '15px',- 'text-decoration': 'underline',- 'text-underline-offset': '3px',- }}- >- On a computer? Sign up with Google now- </a>- </Show>-- <p- style={{- color: 'color-mix(in srgb, var(--c4) 78%, transparent)',- 'font-family': 'body',- 'font-size': '15px',- 'line-height': 1.5,- margin: '0',- 'margin-top': '8px',- }}- >- Already have an account?{' '}- <a- href={buildAppUrl('/app/login')}- onClick={(event) => {- event.preventDefault();- analytics.track('app_redirect', {- page_location: window.location.href,- button_name: 'mobile_signup_page_login',- });- window.location.href = buildAppUrl('/app/login');- }}- style={{- color: 'var(--c1)',- 'text-decoration': 'underline',- 'text-underline-offset': '3px',- }}- >- Log in- </a>+ <section class="mobile-signup-card">+ <MobileSignupMark />+ <h1 class="mobile-signup-card-title">One app for all your work.</h1>+ <p class="mobile-signup-card-subtitle">+ Macro is better on desktop. Drop your email and we’ll send you a+ link to start.</p>+ <div class="mobile-signup-card-body">+ <FormMobileSignup buttonName="mobile_signup_page" variant="card" />+ </div></section>);};diff --git a/apps/marketing/src/app/routes/RouteMobileSignupSent.tsx b/apps/marketing/src/app/routes/RouteMobileSignupSent.tsxindex b1c208bec4..8fbe6061ec 100644--- a/apps/marketing/src/app/routes/RouteMobileSignupSent.tsx+++ b/apps/marketing/src/app/routes/RouteMobileSignupSent.tsx@@ -1,8 +1,7 @@import { useLocation } from '@solidjs/router';-import { type Component, type JSX, onMount } from 'solid-js';+import { type Component, onMount, Show } from 'solid-js';+import { MobileSignupMark } from '../components/graphics/MobileSignupMark';import { analytics } from '../utils/utilAnalytic';-import { buildAppUrl } from '../utils/utilBaseUrl';-import { viewportWidth } from '../utils/utilBreakpoint';import {conversionAlreadyFired,MOBILE_WEB_SIGNUP_LEAD_VALUE,@@ -10,107 +9,10 @@ import {submittedEmail,} from '../utils/utilMobileSignup';import { setPageSeo } from '../utils/utilSeo';+import './RouteMobileSignup.css';-/** The Macro iOS app — the back door for visitors who already have an account. */const APP_STORE_URL = 'https://apps.apple.com/us/app/macro-app/id6743133649';-const SUCCESS_GREEN = 'oklch(0.74 0.17 155)';--const secondaryButtonStyle = {- 'align-items': 'center',- 'background-color': 'transparent',- border: '1px solid color-mix(in srgb, var(--b4) 38%, transparent)',- 'border-radius': '999px',- 'box-sizing': 'border-box',- color: 'var(--c1)',- display: 'inline-flex',- 'font-family': 'body',- 'font-size': '16px',- 'font-weight': '600',- height: '46px',- 'justify-content': 'center',- 'line-height': 1,- 'text-decoration': 'none',- width: '100%',-} as const;--/** Circle + check that draws in to confirm the email was sent. */-function SentCheck(props: { style?: JSX.CSSProperties }): JSX.Element {- return (- <div- aria-hidden="true"- class="mobile-signup-sent-check"- style={{- display: 'block',- height: '52px',- width: '52px',- ...props.style,- }}- >- <style>{`- .mobile-signup-sent-check__svg {- display: block;- height: 100%;- width: 100%;- }- .mobile-signup-sent-check__circle,- .mobile-signup-sent-check__mark {- fill: none;- stroke: ${SUCCESS_GREEN};- stroke-linecap: round;- stroke-linejoin: round;- }- .mobile-signup-sent-check__circle {- stroke-width: 2.25;- stroke-dasharray: 151;- stroke-dashoffset: 151;- }- .mobile-signup-sent-check__mark {- stroke-width: 3;- stroke-dasharray: 48;- stroke-dashoffset: 48;- }- @media (prefers-reduced-motion: no-preference) {- .mobile-signup-sent-check__circle {- animation: mobile-signup-sent-circle 520ms cubic-bezier(0.22, 1, 0.36, 1) forwards;- }- .mobile-signup-sent-check__mark {- animation: mobile-signup-sent-mark 380ms cubic-bezier(0.22, 1, 0.36, 1) 360ms forwards;- }- }- @media (prefers-reduced-motion: reduce) {- .mobile-signup-sent-check__circle,- .mobile-signup-sent-check__mark {- stroke-dashoffset: 0;- }- }- @keyframes mobile-signup-sent-circle {- to { stroke-dashoffset: 0; }- }- @keyframes mobile-signup-sent-mark {- to { stroke-dashoffset: 0; }- }- `}</style>- <svg- class="mobile-signup-sent-check__svg"- viewBox="0 0 52 52"- xmlns="http://www.w3.org/2000/svg"- >- <circle- class="mobile-signup-sent-check__circle"- cx="26"- cy="26"- r="24"- />- <path- class="mobile-signup-sent-check__mark"- d="M15.5 26.5l7.5 7.5 14-14.5"- />- </svg>- </div>- );-}-/*** Confirmation step of the site's mobile email capture: the visitor has been* emailed a link to finish signing up on a computer.@@ -123,21 +25,20 @@ function SentCheck(props: { style?: JSX.CSSProperties }): JSX.Element {export const RouteMobileSignupSent: Component = () => {setPageSeo({title: 'Check your email — Macro',- description: 'We sent you a link to set up Macro on your computer.',+ description: 'We sent you an email to continue onboarding on desktop.',path: '/mobile-signup-sent',// The tail of the signup flow — never a landing page from search.noindex: true,});const location = useLocation<{ email: string }>();- const mobile = () => viewportWidth() < 700;// Present when the visitor got here by submitting the form (history state// survives a refresh; session storage covers a fresh tab in the same session).const email = (): string | null => location.state?.email ?? submittedEmail();onMount(() => {- // Header signup field can stay mounted across this route change — force the+ // The email field can stay focused across this route change — force the// keyboard down even if blur-before-navigate was skipped somehow.(document.activeElement as HTMLElement | null)?.blur?.();@@ -165,94 +66,36 @@ export const RouteMobileSignupSent: Component = () => {});return (- <section- style={{- 'box-sizing': 'border-box',- display: 'grid',- gap: '32px',- 'justify-items': 'start',- 'max-width': '520px',- // Match the home hero inset (page gutter + these paddings).- 'padding-bottom': '96px',- 'padding-left': mobile() ? '18px' : '64px',- 'padding-right': mobile() ? '18px' : '24px',- 'padding-top': mobile() ? '96px' : '128px',- width: '100%',- }}- >- <SentCheck />-- <h1- style={{- color: 'var(--c0)',- 'font-family': 'display',- 'font-size': mobile() ? 'clamp(28px, 7.5vw, 36px)' : '40px',- 'font-weight': 'calc(315 + var(--cream-slab-weight-increase, 0))',- 'letter-spacing': '-0.012em',- 'line-height': 1.22,- margin: '0',- }}- >- Check your email → complete onboarding on your computer.+ <section class="mobile-signup-card">+ <MobileSignupMark />+ <h1 class="mobile-signup-card-title">+ Continue onboarding on desktop</h1>-- <p- style={{- color: 'var(--c2)',- 'font-family': 'Inter',- 'font-size': '14px',- 'font-weight': '400',- 'line-height': 1.5,- margin: '0',- 'max-width': '40ch',- }}- >- Macro has a mobile app, but to get started you need to complete the- onboarding on desktop.- </p>-- <div- style={{- 'border-top':- '1px solid color-mix(in srgb, var(--b4) 24%, transparent)',- 'box-sizing': 'border-box',- display: 'grid',- gap: '12px',- 'margin-top': '8px',- 'padding-top': '28px',- width: '100%',- }}- >- <p- style={{- color: 'var(--c2)',- 'font-family': 'body',- 'font-size': '15px',- 'font-weight': '600',- 'line-height': 1.5,- margin: '0',- }}+ <p class="mobile-signup-card-subtitle">+ <Show+ when={email()}+ fallback="Open the link on your computer to finish signing up.">- Already a user?- </p>-- <a- href={buildAppUrl('/app/login')}- onClick={(event) => {- event.preventDefault();- analytics.track('app_redirect', {- page_location: window.location.href,- button_name: 'mobile_signup_sent_login',- });- window.location.href = buildAppUrl('/app/login');- }}- style={secondaryButtonStyle}- >- Log in- </a>-+ {(address) => (+ <>+ We emailed{' '}+ <span+ style={{+ color: 'var(--color-ink)',+ 'overflow-wrap': 'anywhere',+ }}+ >+ {address()}+ </span>{' '}+ a link. Open it on your computer to finish signing up.+ </>+ )}+ </Show>+ </p>+ <div class="mobile-signup-card-body"><ahref={APP_STORE_URL}+ class="mobile-signup-card-pill"target="_blank"rel="noreferrer"onClick={() => {@@ -261,24 +104,9 @@ export const RouteMobileSignupSent: Component = () => {button_name: 'mobile_signup_sent_app_store',});}}- style={secondaryButtonStyle}>- Download the iOS app+ Download our mobile app</a>-- <p- style={{- color: 'color-mix(in srgb, var(--c4) 78%, transparent)',- 'font-family': 'body',- 'font-size': '14px',- 'line-height': 1.5,- margin: '0',- 'margin-top': '4px',- }}- >- New to Macro? These are for existing accounts — sign up on your- computer using the link we just emailed you.- </p></div></section>);diff --git a/apps/marketing/src/features/marketing/components/SiteHeader.tsx b/apps/marketing/src/features/marketing/components/SiteHeader.tsxindex 3feea58980..18b09a9954 100644--- a/apps/marketing/src/features/marketing/components/SiteHeader.tsx+++ b/apps/marketing/src/features/marketing/components/SiteHeader.tsx@@ -6,7 +6,11 @@ import {onMount,Show,} from 'solid-js';-import { FEATURE_PAGES, RESOURCE_PAGES } from '../core/navigation';+import {+ FEATURE_PAGES,+ RESOURCE_PAGES,+ routePhoneToMobileSignup,+} from '../core/navigation';import './site-navigation.css';const EXPLORE_PAGES = [@@ -181,6 +185,7 @@ export function SiteHeader(props: { hideOpenApp?: boolean }) {class="site-nav-start"target="_self"href="/app/signup"+ onClick={routePhoneToMobileSignup}onPointerEnter={moveGlow}onPointerMove={moveGlow}onPointerLeave={stopGlow}diff --git a/apps/marketing/src/features/marketing/core/navigation.ts b/apps/marketing/src/features/marketing/core/navigation.tsindex 8ecf56d584..aa9966d54f 100644--- a/apps/marketing/src/features/marketing/core/navigation.ts+++ b/apps/marketing/src/features/marketing/core/navigation.ts@@ -19,9 +19,31 @@ export const RESOURCE_PAGES = [{ href: '/posts', label: 'Blog' },] as const;+const MOBILE_SIGNUP_HREF = '/mobile-signup';++/** Same test as the app's `isMobile()`: a touch-first, phone-width screen. */+function isPhoneBrowser() {+ return (+ window.innerWidth < 640 &&+ window.matchMedia?.('(pointer: coarse)').matches === true+ );+}++/**+ * Phones skip signup and leave an email on `/mobile-signup` instead. For links+ * whose href is fixed at prerender time; `/app/signup` redirects phones there+ * too, this just spares them the app download.+ */+export function routePhoneToMobileSignup(event: MouseEvent) {+ if (!isPhoneBrowser()) return;+ event.preventDefault();+ window.location.href = MOBILE_SIGNUP_HREF;+}+/** Full document navigation keeps the app and marketing CSS independent. */export function journeyHref() {if (typeof window === 'undefined') return '/app/signup';+ if (isPhoneBrowser()) return MOBILE_SIGNUP_HREF;try {const active = JSON.parse(sessionStorage.getItem('onboarding-flow-step') ?? 'null'diff --git a/apps/marketing/src/features/setup/Homepage.tsx b/apps/marketing/src/features/setup/Homepage.tsxindex d9b9cf053a..3cca7bbe61 100644--- a/apps/marketing/src/features/setup/Homepage.tsx+++ b/apps/marketing/src/features/setup/Homepage.tsx@@ -1,5 +1,6 @@import { createSignal } from 'solid-js';import { HomepageScrollCue } from '../marketing/components/HomepageScrollCue';+import { routePhoneToMobileSignup } from '../marketing/core/navigation';import { HomepageSections } from '../marketing/components/HomepageSections';import { HomepageUnification } from '../marketing/components/HomepageUnification';import { OnboardingShell } from './components/OnboardingShell';@@ -34,7 +35,11 @@ export function Homepage() {onContinue={() => {}}action={<div class="homepage-hero-action mt-6 flex justify-center pb-5">- <a class="site-nav-start homepage-hero-cta" href="/app/signup">+ <a+ class="site-nav-start homepage-hero-cta"+ href="/app/signup"+ onClick={routePhoneToMobileSignup}+ >Get Started</a></div>diff --git a/apps/web/src/lib/service-clients/service-auth/generated/client.ts b/apps/web/src/lib/service-clients/service-auth/generated/client.tsindex c4904d662a..838a929eb5 100644--- a/apps/web/src/lib/service-clients/service-auth/generated/client.ts+++ b/apps/web/src/lib/service-clients/service-auth/generated/client.ts@@ -3082,9 +3082,9 @@ export const verifyMergeRequest = async (};/**- * @summary Enrolls a mobile lead in the Loops nurture sequence, which sends the welcome-email inviting them to register on desktop. No-ops if the address was already-enrolled, and rejects blocked addresses.+ * @summary Emails a mobile lead a link to continue onboarding on desktop and enrolls+them in the Loops welcome sequence. No-ops if the address was already+captured, and rejects blocked addresses.*/export type sendMobileWelcomeEmailResponse200 = {data: SendMobileWelcomeEmailResponse;diff --git a/apps/web/src/lib/service-clients/service-auth/openapi.json b/apps/web/src/lib/service-clients/service-auth/openapi.jsonindex 59a171129e..77b99328ee 100644--- a/apps/web/src/lib/service-clients/service-auth/openapi.json+++ b/apps/web/src/lib/service-clients/service-auth/openapi.json@@ -2588,7 +2588,7 @@"/mobile-welcome-email": {"post": {"tags": ["mobile_welcome_email"],- "summary": "Enrolls a mobile lead in the Loops nurture sequence, which sends the welcome\nemail inviting them to register on desktop. No-ops if the address was already\nenrolled, and rejects blocked addresses.",+ "summary": "Emails a mobile lead a link to continue onboarding on desktop and enrolls\nthem in the Loops welcome sequence. No-ops if the address was already\ncaptured, and rejects blocked addresses.","operationId": "send_mobile_welcome_email","requestBody": {"content": {diff --git a/apps/web/src/routes/pages.tsx b/apps/web/src/routes/pages.tsxindex 50a350f926..23eb407560 100644--- a/apps/web/src/routes/pages.tsx+++ b/apps/web/src/routes/pages.tsx@@ -9,7 +9,9 @@ import {} from '@app/features/scheduling/public-booking';import { useRouteParams } from '@app/lib/split-router';import { publishLoginSuccess } from '@core/auth/login-events';+import { isMobile } from '@core/mobile/isMobile';import { isNativeMobilePlatform } from '@core/mobile/isNativeMobilePlatform';+import { getWebOrigin } from '@core/util/webOrigin';import { Button } from '@ui';import { lazy, onCleanup, onMount } from 'solid-js';import {@@ -32,7 +34,17 @@ export function LoginPage() {return <Login />;}+/**+ * Phone browsers (including Meta's in-app browser) leave their email on the+ * website's `/mobile-signup` and get a link to finish signing up on desktop.+ */export function SignupPage() {+ if (isMobile() && !isNativeMobilePlatform()) {+ window.location.replace(+ `${getWebOrigin()}/mobile-signup${window.location.search}`+ );+ return null;+ }return <Login signupMode />;}diff --git a/crates/mobile_welcome_email_db_client/src/mobile_welcome_email.rs b/crates/mobile_welcome_email_db_client/src/mobile_welcome_email.rsindex d732097e3a..232ec59df9 100644--- a/crates/mobile_welcome_email_db_client/src/mobile_welcome_email.rs+++ b/crates/mobile_welcome_email_db_client/src/mobile_welcome_email.rs@@ -45,5 +45,27 @@ pub async fn insert_mobile_welcome_email(Ok(result.rows_affected() > 0)}+/// Removes the record for the given email address, so a send that failed+/// after the address was claimed can be retried.+#[tracing::instrument(skip(db), err)]+pub async fn delete_mobile_welcome_email(+ db: &sqlx::Pool<sqlx::Postgres>,+ email: &str,+) -> anyhow::Result<()> {+ let email = email.to_lowercase();++ sqlx::query!(+ r#"+ DELETE FROM mobile_welcome_email+ WHERE email = $1+ "#,+ )+ .execute(db)+ .await?;++ Ok(())+}+#[cfg(test)]mod test;diff --git a/crates/mobile_welcome_email_db_client/src/mobile_welcome_email/test.rs b/crates/mobile_welcome_email_db_client/src/mobile_welcome_email/test.rsindex afb78005c7..c678303d0e 100644--- a/crates/mobile_welcome_email_db_client/src/mobile_welcome_email/test.rs+++ b/crates/mobile_welcome_email_db_client/src/mobile_welcome_email/test.rs@@ -19,5 +19,10 @@ async fn test_insert_and_get_mobile_welcome_email(pool: Pool<Postgres>) -> anyho// Duplicate insert returns falseassert!(!insert_mobile_welcome_email(&pool, email).await?);+ // Deleting releases the claim so the address can be inserted again+ delete_mobile_welcome_email(&pool, email).await?;+ assert!(!get_mobile_welcome_email(&pool, email).await?);+ assert!(insert_mobile_welcome_email(&pool, email).await?);+Ok(())}diff --git a/packages/sdk/generated/auth/sdk.gen.ts b/packages/sdk/generated/auth/sdk.gen.tsindex 5a250313e5..449f68e12c 100644--- a/packages/sdk/generated/auth/sdk.gen.ts+++ b/packages/sdk/generated/auth/sdk.gen.ts@@ -554,9 +554,9 @@ export class Sdk extends HeyApiClient {}/**- * Enrolls a mobile lead in the Loops nurture sequence, which sends the welcome- * email inviting them to register on desktop. No-ops if the address was already- * enrolled, and rejects blocked addresses.+ * Emails a mobile lead a link to continue onboarding on desktop and enrolls+ * them in the Loops welcome sequence. No-ops if the address was already+ * captured, and rejects blocked addresses.*/public sendMobileWelcomeEmail<ThrowOnError extends boolean = false>(options: Options<SendMobileWelcomeEmailData, ThrowOnError>): RequestResult<SendMobileWelcomeEmailResponses, SendMobileWelcomeEmailErrors, ThrowOnError> {return (options.client ?? this.client).post<SendMobileWelcomeEmailResponses, SendMobileWelcomeEmailErrors, ThrowOnError>({diff --git a/packages/sdk/specs/auth.json b/packages/sdk/specs/auth.jsonindex 59a171129e..77b99328ee 100644--- a/packages/sdk/specs/auth.json+++ b/packages/sdk/specs/auth.json@@ -2588,7 +2588,7 @@"/mobile-welcome-email": {"post": {"tags": ["mobile_welcome_email"],- "summary": "Enrolls a mobile lead in the Loops nurture sequence, which sends the welcome\nemail inviting them to register on desktop. No-ops if the address was already\nenrolled, and rejects blocked addresses.",+ "summary": "Emails a mobile lead a link to continue onboarding on desktop and enrolls\nthem in the Loops welcome sequence. No-ops if the address was already\ncaptured, and rejects blocked addresses.","operationId": "send_mobile_welcome_email","requestBody": {"content": {diff --git a/services/authentication_service/src/api/mobile_welcome_email.rs b/services/authentication_service/src/api/mobile_welcome_email.rsindex 5c00b3338a..7b5ce3bd9e 100644--- a/services/authentication_service/src/api/mobile_welcome_email.rs+++ b/services/authentication_service/src/api/mobile_welcome_email.rs@@ -10,7 +10,9 @@ use thiserror::Error;use tower::ServiceBuilder;use utoipa::ToSchema;-use crate::api::{context::ApiContext, middleware};+use crate::api::{context::ApiContext, middleware, utils::default_redirect_url};++const DESKTOP_EMAIL_SUBJECT: &str = "Continue onboarding on desktop";#[derive(Debug, Error)]pub enum SendMobileWelcomeEmailError {@@ -66,9 +68,9 @@ pub fn router(state: ApiContext) -> Router<ApiContext> {)}-/// Enrolls a mobile lead in the Loops nurture sequence, which sends the welcome-/// email inviting them to register on desktop. No-ops if the address was already-/// enrolled, and rejects blocked addresses.+/// Emails a mobile lead a link to continue onboarding on desktop and enrolls+/// them in the Loops welcome sequence. No-ops if the address was already+/// captured, and rejects blocked addresses.#[utoipa::path(post,path = "/mobile-welcome-email",@@ -111,11 +113,37 @@ pub async fn handler(return Ok(Json(SendMobileWelcomeEmailResponse { sent: false }));}- // Enrolls the lead in the Loops nurture sequence, which owns the welcome- // email from here. Awaited rather than fire-and-forget: `sent: true` tells- // the caller mail is on the way, so it must not report success on a- // Loops failure. The key is namespaced by event so it can't collide with- // the `user_registered` event sent when the lead converts.+ // The "continue on desktop" link the phone confirmation screen promises.+ let url = desktop_signup_url(&default_redirect_url());+ if let Err(e) = ctx+ .ses_client+ .send_email(+ "[email protected]",+ req.email.trim(),+ DESKTOP_EMAIL_SUBJECT,+ &desktop_email_html(&url),+ )+ .await+ {+ tracing::error!(error=?e, "failed to send mobile desktop-link email");+ // Release the claim so a retry sends the email instead of no-oping.+ if let Err(release_err) =+ mobile_welcome_email_db_client::mobile_welcome_email::delete_mobile_welcome_email(+ &ctx.db,+ &lowercase_email,+ )+ .await+ {+ tracing::error!(error=?release_err, "failed to release mobile welcome email claim");+ }+ return Err(SendMobileWelcomeEmailError::InternalError(e));+ }++ // Enrolls the lead in the Loops welcome drip. Awaited rather than+ // fire-and-forget: `sent: true` tells the caller mail is on the way, so it+ // must not report success on a Loops failure. The key is namespaced by+ // event so it can't collide with the `user_registered` event sent when the+ // lead converts.ctx.loops_client.send_event(&lowercase_email,@@ -135,3 +163,84 @@ pub async fn handler(Ok(Json(SendMobileWelcomeEmailResponse { sent: true }))}++/// Desktop signup page. The local frontend origin has no `/app` prefix.+fn desktop_signup_url(base: &url::Url) -> String {+ let mut url = base.clone();+ let path = url.path().trim_end_matches('/').to_string();+ url.set_path(&format!("{path}/signup"));+ url.set_query(None);+ url.to_string()+}++fn desktop_email_html(url: &str) -> String {+ let url = url.replace('&', "&").replace('"', """);+ format!(+ r##"<!doctype html>+<html lang="en">+ <head>+ <meta charset="utf-8" />+ <meta name="viewport" content="width=device-width, initial-scale=1" />+ <meta name="x-apple-disable-message-reformatting" />+ <meta name="color-scheme" content="light" />+ <meta name="supported-color-schemes" content="light" />+ <title>{DESKTOP_EMAIL_SUBJECT}</title>+ </head>+ <body style="margin:0;padding:0;width:100%;background-color:#f5f5f4;">+ <div style="display:none;max-height:0;overflow:hidden;opacity:0;mso-hide:all;">+ Open this link on desktop to finish signing up for Macro.+ </div>+ <table role="presentation" width="100%" cellpadding="0" cellspacing="0" bgcolor="#f5f5f4" style="font-family:Arial,Helvetica,sans-serif;color:#222222;">+ <tr>+ <td align="center" style="padding:48px 20px;">+ <table role="presentation" width="100%" cellpadding="0" cellspacing="0" style="max-width:560px;">+ <tr>+ <td bgcolor="#ffffff" style="padding:36px 40px 40px;border:1px solid #e7e7e5;border-radius:12px;">+ <a href="https://macro.com" style="text-decoration:none;">+ <img src="https://macro.com/app/macro-email-logo.png" width="36" height="36" alt="Macro" style="display:block;border:0;background-color:#ffffff;" />+ </a>+ <h1 style="margin:36px 0 16px;font-size:28px;line-height:36px;font-weight:600;letter-spacing:-0.5px;color:#222222;">{DESKTOP_EMAIL_SUBJECT}</h1>+ <p style="margin:0 0 20px;font-size:16px;line-height:26px;color:#525252;">Macro is a better experience on desktop. Open this link to finish signing up — it only takes a minute.</p>+ <table role="presentation" cellpadding="0" cellspacing="0" style="margin:28px 0 8px;">+ <tr>+ <td bgcolor="#222222" style="border-radius:6px;text-align:center;">+ <a href="{url}" style="display:inline-block;padding:14px 24px;border:1px solid #222222;border-radius:6px;color:#ffffff;background-color:#222222;font-size:15px;line-height:20px;font-weight:600;text-decoration:none;">Continue on desktop</a>+ </td>+ </tr>+ </table>+ <p style="margin:28px 0 0;font-size:14px;line-height:22px;color:#737373;">If you didn't request this, you can safely ignore this email.</p>+ </td>+ </tr>+ <tr>+ <td style="padding:24px 16px 0;text-align:center;font-size:12px;line-height:20px;color:#737373;">+ Need a hand? <a href="mailto:[email protected]" style="color:#525252;text-decoration:underline;">Contact support</a>+ </td>+ </tr>+ </table>+ </td>+ </tr>+ </table>+ </body>+</html>"##+ )+}++#[cfg(test)]+mod tests {+ use super::*;++ #[test]+ fn desktop_link_points_at_signup() {+ let prod = url::Url::parse("https://macro.com/app").unwrap();+ assert_eq!(desktop_signup_url(&prod), "https://macro.com/app/signup");+ let local = url::Url::parse("http://localhost:3000").unwrap();+ assert_eq!(desktop_signup_url(&local), "http://localhost:3000/signup");+ }++ #[test]+ fn desktop_email_links_to_signup() {+ let html = desktop_email_html("https://macro.com/app/signup");+ assert!(html.contains(r#"href="https://macro.com/app/signup""#));+ assert!(html.contains(DESKTOP_EMAIL_SUBJECT));+ }+}