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.

Add mobile web signup flow for unauthenticated visitors (#5082)

Jacob Beckermanbd1e9c92c3cf
diff --git a/apps/web/src/components/app/Layout.tsx b/apps/web/src/components/app/Layout.tsx
index dce41b7cd1..d15e78d303 100644
--- a/apps/web/src/components/app/Layout.tsx
+++ b/apps/web/src/components/app/Layout.tsx
@@ -82,6 +82,7 @@ const AUTH_URLS = [
`${ROUTER_BASE_CONCAT}email-signup-callback`,
`${ROUTER_BASE_CONCAT}offline`,
`${ROUTER_BASE_CONCAT}welcome`,
+ `${ROUTER_BASE_CONCAT}mobile-email-signup`,
`${ROUTER_BASE_CONCAT}team-invite`,
];
diff --git a/apps/web/src/features/onboarding/MobileWebSignup.tsx b/apps/web/src/features/onboarding/MobileWebSignup.tsx
new file mode 100644
index 0000000000..bf801e31c3
--- /dev/null
+++ b/apps/web/src/features/onboarding/MobileWebSignup.tsx
@@ -0,0 +1,37 @@
+import { useAnalytics } from '@app/lib/analytics/analytics-context';
+import { createSignal, Match, Switch } from 'solid-js';
+import MobileWebSignupSent from './MobileWebSignupSent';
+import MobileWebWelcome from './MobileWebWelcome';
+
+/**
+ * Mobile-web entry flow for unauthenticated visitors on a phone/tablet browser.
+ *
+ * Signing up on mobile web is a poor experience, so instead of pushing visitors
+ * through Google SSO + onboarding we capture their email and tell them we've
+ * emailed a link to open on desktop. The two screens are:
+ * 1. {@link MobileWebWelcome} — captures the email.
+ * 2. {@link MobileWebSignupSent} — confirms "we emailed you a desktop link".
+ *
+ * Identifying the email hands it to the analytics providers, which is what the
+ * downstream marketing automation keys the desktop-download email off of.
+ */
+export default function MobileWebSignup() {
+ const analytics = useAnalytics();
+ const [submittedEmail, setSubmittedEmail] = createSignal<string | null>(null);
+
+ const handleSignUp = (email: string) => {
+ const trimmed = email.trim();
+ // Don't advance on an empty submit — keep the visitor on the capture step.
+ if (!trimmed) return;
+ analytics.identify(trimmed, { email: trimmed });
+ setSubmittedEmail(trimmed);
+ };
+
+ return (
+ <Switch fallback={<MobileWebWelcome onSignUp={handleSignUp} />}>
+ <Match when={submittedEmail() !== null}>
+ <MobileWebSignupSent email={submittedEmail() ?? undefined} />
+ </Match>
+ </Switch>
+ );
+}
diff --git a/apps/web/src/routes/Root.tsx b/apps/web/src/routes/Root.tsx
index fb8740322a..d908afea9b 100644
--- a/apps/web/src/routes/Root.tsx
+++ b/apps/web/src/routes/Root.tsx
@@ -11,6 +11,7 @@ import { GlobalShareInboxConflictDialog } from '@app/features/inbox/ShareInboxCo
import { SearchProvider } from '@app/features/next-soup/search-context';
import { usePendingNotificationNavigationEffect } from '@app/features/notifications/PendingNotificationNavigationEffect';
import { InteractiveOnboardingModal } from '@app/features/onboarding/InteractiveOnboardingModal';
+import MobileWebSignup from '@app/features/onboarding/MobileWebSignup';
import { useCheckoutCompletionListener } from '@app/features/paywall/use-checkout-completion-listener';
import { TeamInviteAcceptance } from '@app/features/team-invitations/TeamInviteAcceptance';
import {
@@ -408,6 +409,14 @@ const ROUTES: RouteDefinition[] = [
<Navigate href="/login" />
),
},
+ {
+ // Mobile-web visitors can't sign up on a phone, so instead of pushing them
+ // through Google SSO + onboarding we capture their email and email them a
+ // link to open on desktop. The marketing site redirects mobile browsers
+ // here.
+ path: '/mobile-email-signup',
+ component: MobileWebSignup,
+ },
{
path: '/onboarding',
component: () =>