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.

chore(onboarding): add a staff Bypass button that skips onboarding (#7207)

Wolf Mermelstein764229d4622a
diff --git a/apps/web/src/features/setup/flow/OnboardingFlow.tsx b/apps/web/src/features/setup/flow/OnboardingFlow.tsx
index 624f464ca1..723c06186e 100644
--- a/apps/web/src/features/setup/flow/OnboardingFlow.tsx
+++ b/apps/web/src/features/setup/flow/OnboardingFlow.tsx
@@ -15,7 +15,7 @@ import { useOnboardingQuery } from '@queries/onboarding';
import { usePipedreamConnectionsQuery } from '@queries/pipedream-connectors';
import type { GtmInviteOffer } from '@service-auth/generated/schemas/gtmInviteOffer';
import { useNavigate } from '@solidjs/router';
-import { cn } from '@ui';
+import { Button, cn } from '@ui';
import { Stepper } from '@ui/components/Stepper';
import {
createEffect,
@@ -45,6 +45,7 @@ import { PlanStep } from './PlanStep';
import { connectorLogo, StepModule } from './StepModule';
import { SummaryStep } from './SummaryStep';
import {
+ canBypassOnboarding,
FLOW_NEXT_STORAGE_KEY,
FLOW_STEP_STORAGE_KEY,
NoiseBackground,
@@ -457,6 +458,14 @@ function FlowContent() {
inviteOffer,
};
+ // Gated read: `data` suspends while the user-info query is pending.
+ const staffEmail = () => {
+ if (!userInfoQuery.isSuccess) return undefined;
+ const info = userInfoQuery.data;
+ if (info?.authenticated !== true) return undefined;
+ return info.email;
+ };
+
// Heal a half-landed finish: NewOnboardingRedirect keys off
// tutorialComplete while this flow keys off the onboarding row, and the
// two are not completed atomically — row completed + flag stuck false
@@ -517,6 +526,20 @@ function FlowContent() {
<NoiseBackground />
+ <Show when={canBypassOnboarding(staffEmail())}>
+ <div class="absolute top-4 right-4 z-30">
+ <Button
+ variant="ghost"
+ size="sm"
+ class="text-ink-muted"
+ disabled={finish.finishing()}
+ onClick={() => void finish.bypass(currentStepKey())}
+ >
+ Bypass
+ </Button>
+ </div>
+ </Show>
+
{/* The backdrop layers are viewport-sized absolutes, so scrolling has
to happen inside them — a tall step (the summary's pill cloud)
would otherwise scroll the wash and grain away with the content,
diff --git a/apps/web/src/features/setup/flow/createFlowFinish.ts b/apps/web/src/features/setup/flow/createFlowFinish.ts
index d7b0235ada..d08875dfdb 100644
--- a/apps/web/src/features/setup/flow/createFlowFinish.ts
+++ b/apps/web/src/features/setup/flow/createFlowFinish.ts
@@ -72,9 +72,9 @@ export function createFlowFinish(options?: {
* off tutorialComplete, so navigating before the cache reflects the PATCH
* would bounce straight back here.
*/
- const completeFlow = async (): Promise<boolean> => {
+ const completeFlow = async (skipped = false): Promise<boolean> => {
const [onboardingResult] = await Promise.allSettled([
- completeOnboarding.mutateAsync({ skipped: false }),
+ completeOnboarding.mutateAsync({ skipped }),
completeTutorial.mutateAsync(),
]);
// Exiting with the row still active would leave staged candidates
@@ -153,11 +153,35 @@ export function createFlowFinish(options?: {
}
};
+ /**
+ * Staff escape hatch: close the flow without touching any step, recorded
+ * server-side as skipped. Lands on the preserved deep link or straight in
+ * the app — the Getting Started checklist is onboarding too.
+ */
+ const bypass = async (stepKey: string) => {
+ if (finishing()) return;
+ setFinishing(true);
+ // Resolved up front: completing the flow clears the persisted deep link.
+ const target =
+ sanitizeNext(searchParams.next) ??
+ sanitizeNext(sessionStorage.getItem(FLOW_NEXT_STORAGE_KEY)) ??
+ DEFAULT_ROUTE;
+ try {
+ if (await completeFlow(true)) {
+ analytics.track('onboarding_v4_bypassed', { step: stepKey });
+ navigate(target, { replace: true });
+ }
+ } finally {
+ setFinishing(false);
+ }
+ };
+
return {
finishing,
finishFree,
startPremiumCheckout,
finishPremium,
+ bypass,
afterTarget,
};
}
diff --git a/apps/web/src/features/setup/flow/shared.test.ts b/apps/web/src/features/setup/flow/shared.test.ts
new file mode 100644
index 0000000000..e4e72dd2bb
--- /dev/null
+++ b/apps/web/src/features/setup/flow/shared.test.ts
@@ -0,0 +1,26 @@
+import { describe, expect, it } from 'vitest';
+import { canBypassOnboarding, isMacroStaffEmail } from './shared';
+
+describe('canBypassOnboarding', () => {
+ it('shows Bypass for @macro.com accounts', () => {
+ expect(canBypassOnboarding('[email protected]')).toBe(true);
+ expect(canBypassOnboarding('[email protected]')).toBe(true);
+ expect(canBypassOnboarding(' [email protected] ')).toBe(true);
+ });
+
+ it('hides Bypass from everyone else', () => {
+ expect(canBypassOnboarding('[email protected]')).toBe(false);
+ expect(canBypassOnboarding('[email protected]')).toBe(false);
+ expect(canBypassOnboarding(undefined)).toBe(false);
+ expect(canBypassOnboarding('not-an-email')).toBe(false);
+ });
+});
+
+describe('isMacroStaffEmail', () => {
+ it('matches only the macro.com domain', () => {
+ expect(isMacroStaffEmail('[email protected]')).toBe(true);
+ expect(isMacroStaffEmail('[email protected]')).toBe(true);
+ expect(isMacroStaffEmail('[email protected]')).toBe(false);
+ expect(isMacroStaffEmail('[email protected]')).toBe(false);
+ });
+});
diff --git a/apps/web/src/features/setup/flow/shared.tsx b/apps/web/src/features/setup/flow/shared.tsx
index bc2d061582..2cf41a886c 100644
--- a/apps/web/src/features/setup/flow/shared.tsx
+++ b/apps/web/src/features/setup/flow/shared.tsx
@@ -21,6 +21,18 @@ export function emailDomain(address: string | undefined): string | undefined {
return address.slice(at + 1).toLowerCase();
}
+const MACRO_STAFF_DOMAIN = 'macro.com';
+
+/** Whether the address belongs to a Macro staff account (`@macro.com`). */
+export function isMacroStaffEmail(address: string | undefined): boolean {
+ return emailDomain(address) === MACRO_STAFF_DOMAIN;
+}
+
+/** Whether this account gets the staff Bypass button on the onboarding flow. */
+export function canBypassOnboarding(address: string | undefined): boolean {
+ return isMacroStaffEmail(address?.trim());
+}
+
/** "macro.com" → "Macro": the domain root, capitalized. Whether a domain
* deserves a team suggestion at all is judged server-side
* (`OnboardingState.suggested_team_domain`) — no domain list lives here. */
diff --git a/apps/web/src/lib/analytics/app-events.ts b/apps/web/src/lib/analytics/app-events.ts
index 30aa88fefa..2871ec150c 100644
--- a/apps/web/src/lib/analytics/app-events.ts
+++ b/apps/web/src/lib/analytics/app-events.ts
@@ -114,6 +114,8 @@ export type AppEvents = {
emails_connected: number;
connectors_connected: string[];
};
+ /** A @macro.com account used the staff Bypass button; `step` is where. */
+ onboarding_v4_bypassed: { step: string };
subscription_start: Record<string, unknown>;
subscription_cancel: Record<string, unknown>;
diff --git a/docs/AGENT_GUIDE/surfaces.md b/docs/AGENT_GUIDE/surfaces.md
index 32ffd7ebce..d6588997bd 100644
--- a/docs/AGENT_GUIDE/surfaces.md
+++ b/docs/AGENT_GUIDE/surfaces.md
@@ -1834,6 +1834,12 @@ use a glass sheet with a title, description, Close confirmation button, and
side-by-side cancel and confirm actions. Pending actions disable both buttons
and prevent dismissal; canceling leaves the underlying data unchanged.
+## Onboarding bypass — `/app/onboarding`
+
+All `@macro.com` accounts see a **Bypass** button on every onboarding step. It
+skips the rest of the flow and leaves onboarding. Accounts on other domains
+do not see it.
+
## Setup plan step — `/app/onboarding`
The plan step shows two cards: Free and Premium. Premium starts Stripe Checkout.