:hedgehog: PostHog is the leading platform for building self-driving products. Our developer tools – AI observability, analytics, session replay, flags, experiments, error tracking, logs, and more – capture all the context agents need to diagnose problems, uncover opportunities, and ship fixes. Steer it all from Slack, web, desktop, or the MCP.
Python ab-testingai-analyticsanalyticscdpdata-warehouseexperimentsfeature-flagsjavascriptproduct-analyticspythonreactsession-replaysurveystypescriptweb-analytics
feat(auth): redesign auth pages (#61281)
Fernando Gomes9ec16e36e698
diff --git a/frontend/public/hedgehog/disguise-hog.png b/frontend/public/hedgehog/disguise-hog.pngnew file mode 100644index 000000000000..8424ff7c9dc7Binary files /dev/null and b/frontend/public/hedgehog/disguise-hog.png differdiff --git a/frontend/src/exporter/ExporterLogin.tsx b/frontend/src/exporter/ExporterLogin.tsxindex 877a91a79646..cdadcd0b0ab5 100644--- a/frontend/src/exporter/ExporterLogin.tsx+++ b/frontend/src/exporter/ExporterLogin.tsx@@ -9,7 +9,7 @@ import { LemonBanner } from 'lib/lemon-ui/LemonBanner'import { LemonButton } from 'lib/lemon-ui/LemonButton'import { LemonField } from 'lib/lemon-ui/LemonField'import { LemonInput } from 'lib/lemon-ui/LemonInput'-import { ERROR_MESSAGES } from 'scenes/authentication/login/Login'+import { ERROR_MESSAGES } from 'scenes/authentication/shared/loginErrorMessages'import { SupportModalButton } from 'scenes/authentication/shared/SupportModalButton'import type { loginLogicType } from './ExporterLoginType'diff --git a/frontend/src/lib/components/TaxonomicFilter/menu/Combobox.tsx b/frontend/src/lib/components/TaxonomicFilter/menu/Combobox.tsxindex 3da915419357..c55c060b70b3 100644--- a/frontend/src/lib/components/TaxonomicFilter/menu/Combobox.tsx+++ b/frontend/src/lib/components/TaxonomicFilter/menu/Combobox.tsx@@ -367,7 +367,10 @@ export function MenuFilterCombobox({// branch). The legacy list reaches the same filter via the QuickFilterItem// `eventName` path instead — see `buildUrlContainsShortcut`.// `isContainsShortcut` tags it for commit telemetry + the lead-first ordering.- item: { name: trimmedQuery, isContainsShortcut: true } as unknown as TaxonomicDefinitionTypes,+ item: {+ name: trimmedQuery,+ isContainsShortcut: true,+ } as unknown as TaxonomicDefinitionTypes,group,name: label,friendlyLabel: label,@@ -1145,7 +1148,9 @@ function AutocompleteLemonInput({className: _baseClassName,onKeyDown: baseOnKeyDown,...baseInputAttrs- } = autoProps as React.InputHTMLAttributes<HTMLInputElement> & { ref?: React.Ref<HTMLInputElement> }+ } = autoProps as React.InputHTMLAttributes<HTMLInputElement> & {+ ref?: React.Ref<HTMLInputElement>+ }const setRef = (el: HTMLInputElement | null): void => {if (typeof ref === 'function') {ref(el)@@ -1213,17 +1218,29 @@ interface RowProps {* the friendly label; everything else uses the entry name and has no* distinct raw value to show.*/-function resolveRowCells(entry: MenuFilterEntry): { name: string; value?: string; category: string } {+function resolveRowCells(entry: MenuFilterEntry): {+ name: string+ value?: string+ category: string+} {if (entry.recentLabel) {return { name: entry.recentLabel, category: entry.group.name }}const friendly = entry.friendlyLabelconst pathTail = parseUrlPathTail(entry.name)if (pathTail !== null) {- return { name: pathTail, value: entry.name, category: entry.group.name }+ return {+ name: pathTail,+ value: entry.name,+ category: entry.group.name,+ }}if (friendly && friendly.length > 0 && friendly !== entry.name) {- return { name: friendly, value: entry.name, category: entry.group.name }+ return {+ name: friendly,+ value: entry.name,+ category: entry.group.name,+ }}return { name: entry.name, category: entry.group.name }}diff --git a/frontend/src/lib/components/hedgehogs.tsx b/frontend/src/lib/components/hedgehogs.tsxindex 013e7e9dc69b..0ea3f8362769 100644--- a/frontend/src/lib/components/hedgehogs.tsx+++ b/frontend/src/lib/components/hedgehogs.tsx@@ -12,6 +12,7 @@ import climberHog1 from 'public/hedgehog/climber-hog-01.png'import climberHog2 from 'public/hedgehog/climber-hog-02.png'import deskHog from 'public/hedgehog/desk-hog.png'import detectiveHog from 'public/hedgehog/detective-hog.png'+import disguiseHog from 'public/hedgehog/disguise-hog.png'import experimentsHog from 'public/hedgehog/experiments-hog.png'import explorerHog from 'public/hedgehog/explorer-hog.png'import featureFlagHog from 'public/hedgehog/feature-flag-hog.png'@@ -211,3 +212,8 @@ export const DeskHog = React.forwardRef<HTMLImageElement, HedgehogProps>(functioexport const GraphsHog = React.forwardRef<HTMLImageElement, HedgehogProps>(function GraphsHog(props, ref): JSX.Element {return <RectangularHedgehog src={graphsHog} {...props} ref={ref} />})+export const DisguiseHog = React.forwardRef<HTMLImageElement, HedgehogProps>(+ function DisguiseHog(props, ref): JSX.Element {+ return <RectangularHedgehog src={disguiseHog} {...props} ref={ref} />+ }+)diff --git a/frontend/src/lib/constants.tsx b/frontend/src/lib/constants.tsxindex f288870dd92a..ce60eeb2c9fd 100644--- a/frontend/src/lib/constants.tsx+++ b/frontend/src/lib/constants.tsx@@ -180,7 +180,7 @@ export const FEATURE_FLAGS = {AGENT_PLATFORM: 'agent-platform', // owner: @benwhite #team-agents, gates the agent-platform surface — MCP tools + the PostHog Code agents view (hidden until GA; product DB is dev-only)AI_TRAINING: 'ai-training', // owner: @nicowaltz #team-replay #ai-research, gates the AI training opt-out UI and API enforcementAUDIT_LOGS_ACCESS: 'audit-logs-access', // owner: #team-platform-features, used to control access to audit logs- AUTH_FLOW_VARIANT: 'auth-flow-variant', // owner: @fercgomes #team-growth multivariate=legacy,redesign-2026-06-02 — selects the signin/signup experience (login, signup, invited signup); legacy is the existing design+ AUTH_FLOW_VARIANT: 'auth-flow-variant', // owner: @fercgomes #team-growth multivariate=legacy,paper-desk — selects the auth flow experience (login, signup, invited signup, email verification); paper-desk is the new design, legacy is the existing designBATCH_EXPORT_EARLIEST_BACKFILL: 'batch-export-earliest-backfill', // owner: #team-batch-exports, allow backfilling from beginning of timeCONTROL_SUPPORT_LOGIN: 'control_support_login', // owner: #team-security, used to control whether users can opt out of support impersonationCUSTOM_CSS_THEMES: 'custom-css-themes', // owner: #team-growth, used to enable custom CSS for teams who want to have fundiff --git a/frontend/src/scenes/authentication/authFlowVariantRegistry.tsx b/frontend/src/scenes/authentication/authFlowVariantRegistry.tsxindex 269f67554061..f45b85c265da 100644--- a/frontend/src/scenes/authentication/authFlowVariantRegistry.tsx+++ b/frontend/src/scenes/authentication/authFlowVariantRegistry.tsx@@ -1,19 +1,32 @@import type { AuthFlowVariant } from './authFlowVariants'import { LegacyInviteSignup } from './invite-signup/variants/legacy/LegacyInviteSignup'-import { InviteSignupV2 } from './invite-signup/variants/redesign-2026-06-02/InviteSignupV2'+import { PaperDeskInviteSignup } from './invite-signup/variants/paper-desk/PaperDeskInviteSignup'import { LegacyLogin } from './login/variants/legacy/LegacyLogin'-import { LoginV2 } from './login/variants/redesign-2026-06-02/LoginV2'+import { PaperDeskLogin } from './login/variants/paper-desk/PaperDeskLogin'import { LegacySignup } from './signup/variants/legacy/LegacySignup'-import { SignupV2 } from './signup/variants/redesign-2026-06-02/SignupV2'+import { PaperDeskSignup } from './signup/variants/paper-desk/PaperDeskSignup'+import { LegacyVerifyEmail } from './verify-email/variants/legacy/LegacyVerifyEmail'+import { PaperDeskVerifyEmail } from './verify-email/variants/paper-desk/PaperDeskVerifyEmail'interface AuthFlowVariantComponents {Login: () => JSX.Element | nullSignup: () => JSX.Element | nullInviteSignup: () => JSX.Element | null+ VerifyEmail: () => JSX.Element | null}-// One variant value selects login, signup and invited signup together.+// One variant value selects every auth-flow screen together: login, signup, invited signup and email verification.export const authFlowVariantRegistry: Record<AuthFlowVariant, AuthFlowVariantComponents> = {- legacy: { Login: LegacyLogin, Signup: LegacySignup, InviteSignup: LegacyInviteSignup },- 'redesign-2026-06-02': { Login: LoginV2, Signup: SignupV2, InviteSignup: InviteSignupV2 },+ legacy: {+ Login: LegacyLogin,+ Signup: LegacySignup,+ InviteSignup: LegacyInviteSignup,+ VerifyEmail: LegacyVerifyEmail,+ },+ 'paper-desk': {+ Login: PaperDeskLogin,+ Signup: PaperDeskSignup,+ InviteSignup: PaperDeskInviteSignup,+ VerifyEmail: PaperDeskVerifyEmail,+ },}diff --git a/frontend/src/scenes/authentication/authFlowVariants.ts b/frontend/src/scenes/authentication/authFlowVariants.tsindex 7f6a66aad1ee..23686adba3fb 100644--- a/frontend/src/scenes/authentication/authFlowVariants.ts+++ b/frontend/src/scenes/authentication/authFlowVariants.ts@@ -1,11 +1,11 @@import { FEATURE_FLAGS } from 'lib/constants'import type { FeatureFlagsSet } from 'lib/logic/featureFlagLogic'-export type AuthFlowVariant = 'legacy' | 'redesign-2026-06-02'+export type AuthFlowVariant = 'legacy' | 'paper-desk'const DEFAULT_VARIANT: AuthFlowVariant = 'legacy'-export const AUTH_FLOW_VARIANTS: AuthFlowVariant[] = ['legacy', 'redesign-2026-06-02']+export const AUTH_FLOW_VARIANTS: AuthFlowVariant[] = ['legacy', 'paper-desk']export function resolveAuthFlowVariant(featureFlags: FeatureFlagsSet): AuthFlowVariant {const variant = featureFlags[FEATURE_FLAGS.AUTH_FLOW_VARIANT]diff --git a/frontend/src/scenes/authentication/invite-signup/PaperDeskInviteSignup.stories.tsx b/frontend/src/scenes/authentication/invite-signup/PaperDeskInviteSignup.stories.tsxnew file mode 100644index 000000000000..61e415209df1--- /dev/null+++ b/frontend/src/scenes/authentication/invite-signup/PaperDeskInviteSignup.stories.tsx@@ -0,0 +1,149 @@+import type { Meta, StoryFn } from '@storybook/react'+import { HttpResponse, delay } from 'msw'+import { useEffect } from 'react'++import { FEATURE_FLAGS } from 'lib/constants'+import { useDelayedOnMountEffect } from 'lib/hooks/useOnMountEffect'++import { mswDecorator, useStorybookMocks } from '~/mocks/browser'+import preflightJson from '~/mocks/fixtures/_preflight.json'++import { InviteSignup } from './InviteSignup'+import { inviteSignupLogic } from './inviteSignupLogic'++const MOCK_INVITE_ID = '1234'++type StoryArgs = {+ scenario: 'new-user' | 'existing-account' | 'invalid-link'+ cloud: boolean+ googleOAuth: boolean+ github: boolean+ gitlab: boolean+ ssoEnforcement: 'none' | 'google-oauth2' | 'github' | 'gitlab' | 'saml'+}++const meta: Meta<StoryArgs> = {+ title: 'Scenes-Other/Invite Signup (paper-desk)',+ tags: ['test-skip'],+ parameters: {+ layout: 'fullscreen',+ viewMode: 'story',+ featureFlags: { [FEATURE_FLAGS.AUTH_FLOW_VARIANT]: 'paper-desk' },+ },+ decorators: [+ mswDecorator({+ get: {+ [`/api/signup/${MOCK_INVITE_ID}/`]: () => [+ 200,+ {+ id: MOCK_INVITE_ID,+ target_email: '[email protected]',+ first_name: 'Jane Doe',+ organization_name: 'Acme Corp',+ },+ ],+ '/api/signup/not-found/': () => [404, { detail: 'Invite not found or already used.' }],+ },+ post: {+ '/api/signup': async () => {+ await delay(1000)+ return HttpResponse.json({ success: true })+ },+ [`/api/signup/${MOCK_INVITE_ID}`]: async () => {+ await delay(1000)+ return HttpResponse.json({ success: true })+ },+ },+ }),+ ],+ argTypes: {+ scenario: {+ control: 'select',+ name: 'Scenario',+ options: ['new-user', 'existing-account', 'invalid-link'],+ },+ cloud: { control: 'boolean', name: 'Cloud' },+ googleOAuth: { control: 'boolean', name: 'Google OAuth' },+ github: { control: 'boolean', name: 'GitHub' },+ gitlab: { control: 'boolean', name: 'GitLab' },+ ssoEnforcement: {+ control: 'select',+ name: 'SSO enforcement',+ options: ['none', 'google-oauth2', 'github', 'gitlab', 'saml'],+ },+ },+ args: {+ scenario: 'new-user',+ cloud: true,+ googleOAuth: true,+ github: true,+ gitlab: true,+ ssoEnforcement: 'none',+ },+}+export default meta++const Template: StoryFn<StoryArgs> = ({ scenario, cloud, googleOAuth, github, gitlab, ssoEnforcement }) => {+ const enforcement = ssoEnforcement === 'none' ? null : ssoEnforcement+ const isExistingAccount = scenario === 'existing-account'+ const inviteId = scenario === 'invalid-link' ? 'not-found' : MOCK_INVITE_ID++ useStorybookMocks({+ get: {+ '/_preflight': {+ ...preflightJson,+ cloud,+ realm: cloud ? 'cloud' : 'hosted-clickhouse',+ is_debug: cloud,+ can_create_org: cloud,+ available_social_auth_providers: {+ 'google-oauth2': googleOAuth,+ github,+ gitlab,+ saml: false,+ },+ },+ '/api/users/@me': isExistingAccount+ ? () => [200, { email: '[email protected]', first_name: 'Jane Doe', organization: { name: 'Acme Corp' } }]+ : () => [500, null],+ },+ post: {+ '/api/login/precheck': { sso_enforcement: enforcement, saml_available: false },+ },+ })++ useDelayedOnMountEffect(() => {+ inviteSignupLogic.actions.prevalidateInvite(inviteId)+ })++ useEffect(() => {+ if (enforcement) {+ inviteSignupLogic.actions.prevalidateInvite(inviteId)+ }+ }, [enforcement, inviteId])++ return <InviteSignup />+}++export const Default: StoryFn<StoryArgs> = Template.bind({})++export const NewUserCloud: StoryFn<StoryArgs> = Template.bind({})+NewUserCloud.args = { scenario: 'new-user', cloud: true }++export const NewUserSelfHosted: StoryFn<StoryArgs> = Template.bind({})+NewUserSelfHosted.args = {+ scenario: 'new-user',+ cloud: false,+ googleOAuth: false,+ github: false,+ gitlab: false,+}++export const ExistingAccount: StoryFn<StoryArgs> = Template.bind({})+ExistingAccount.args = { scenario: 'existing-account' }++export const InvalidLink: StoryFn<StoryArgs> = Template.bind({})+InvalidLink.args = { scenario: 'invalid-link' }++export const SSOEnforced: StoryFn<StoryArgs> = Template.bind({})+SSOEnforced.args = { ssoEnforcement: 'google-oauth2' }diff --git a/frontend/src/scenes/authentication/invite-signup/variants/legacy/LegacyInviteSignup.tsx b/frontend/src/scenes/authentication/invite-signup/variants/legacy/LegacyInviteSignup.tsxindex 2b36aaf9f7d3..c5cad45ea2bd 100644--- a/frontend/src/scenes/authentication/invite-signup/variants/legacy/LegacyInviteSignup.tsx+++ b/frontend/src/scenes/authentication/invite-signup/variants/legacy/LegacyInviteSignup.tsx@@ -430,7 +430,7 @@ function UnauthenticatedAcceptInvite({ invite }: { invite: PrevalidatedInvite }))}-export function LegacyInviteSignup(): JSX.Element {+function InviteSignup(): JSX.Element {const { invite, inviteLoading } = useValues(inviteSignupLogic)const { user } = useValues(userLogic)@@ -450,3 +450,5 @@ export function LegacyInviteSignup(): JSX.Element {</div>)}++export { InviteSignup as LegacyInviteSignup }diff --git a/frontend/src/scenes/authentication/invite-signup/variants/paper-desk/PaperDeskInviteSignup.tsx b/frontend/src/scenes/authentication/invite-signup/variants/paper-desk/PaperDeskInviteSignup.tsxnew file mode 100644index 000000000000..fc7004f8af26--- /dev/null+++ b/frontend/src/scenes/authentication/invite-signup/variants/paper-desk/PaperDeskInviteSignup.tsx@@ -0,0 +1,445 @@+import { useActions, useValues } from 'kea'+import { Form } from 'kea-forms'+import { type ReactNode, useEffect } from 'react'++import { PostHogLogo } from 'lib/brand/v2'+import { JudgeHog } from 'lib/components/hedgehogs'+import PasswordStrength from 'lib/components/PasswordStrength'+import SignupRoleSelect from 'lib/components/SignupRoleSelect'+import { SocialLoginButtons, SSOEnforcedLoginButton } from 'lib/components/SocialLoginButton/SocialLoginButton'+import { supportLogic } from 'lib/components/Support/supportLogic'+import { LemonButton } from 'lib/lemon-ui/LemonButton'+import { LemonField } from 'lib/lemon-ui/LemonField'+import { LemonInput } from 'lib/lemon-ui/LemonInput/LemonInput'+import { Link } from 'lib/lemon-ui/Link'+import { ProfilePicture } from 'lib/lemon-ui/ProfilePicture'+import { SpinnerOverlay } from 'lib/lemon-ui/Spinner/Spinner'+import { loginLogic } from 'scenes/authentication/login/loginLogic'+import { CardTitle } from 'scenes/authentication/shared/paperDesk/CardTitle'+import { OrgTile } from 'scenes/authentication/shared/paperDesk/OrgTile'+import { PaperDeskCard, PaperDeskScene } from 'scenes/authentication/shared/paperDesk/PaperDeskScene'+import { TurnstileChallenge } from 'scenes/authentication/signup/signupForm/TurnstileChallenge'+import { urls } from 'scenes/urls'+import { userLogic } from 'scenes/userLogic'++import { PrevalidatedInvite } from '~/types'++import { ErrorCodes, inviteSignupLogic } from '../../inviteSignupLogic'++function InviteNewUser({ invite }: { invite: PrevalidatedInvite }): JSX.Element {+ const {+ isSignupSubmitting,+ signupManualErrors,+ validatedPassword,+ passkeyRegistered,+ isPasskeyRegistering,+ passkeyError,+ passkeySignupEnabled,+ challengeRequired,+ turnstileSiteKey,+ turnstileToken,+ } = useValues(inviteSignupLogic)+ const { registerPasskey, setTurnstileToken } = useActions(inviteSignupLogic)+ const { precheck } = useActions(loginLogic)+ const { precheckResponse, precheckResponseLoading } = useValues(loginLogic)+ const { openSupportForm } = useActions(supportLogic)+ const org = invite.organization_name+ const extraFieldsHidden = !!precheckResponse.sso_enforcement++ useEffect(() => {+ precheck({ email: invite.target_email })+ }, [invite.target_email]) // oxlint-disable-line react-hooks/exhaustive-deps++ const inviteHeader = (+ <div className="flex flex-col gap-3 items-center mb-5">+ <div className="flex gap-3 items-center">+ <OrgTile name={org} />+ <span className="PaperDesk__inviteHeader-mark inline-flex opacity-90">+ <PostHogLogo wordmark={false} className="h-7 w-auto" />+ </span>+ </div>+ <div className="text-center">+ <p className="m-0 text-sm text-secondary">You've been invited to join</p>+ <p className="pb-1.5 mt-0.5 mb-0 font-title text-3xl font-extrabold text-primary tracking-tight border-b border-dashed border-[#c5c6bd]">+ {org}+ </p>+ <p className="m-0 mt-1.5 text-sm text-secondary">on PostHog</p>+ </div>+ </div>+ )++ const footer = (+ <>+ <p className="PaperDesk__terms mt-5 mb-0 text-xs leading-relaxed text-tertiary text-center">+ By continuing you agree to our{' '}+ <Link to="https://posthog.com/terms" target="_blank">+ terms+ </Link>{' '}+ and{' '}+ <Link to="https://posthog.com/privacy" target="_blank">+ privacy policy+ </Link>+ .+ </p>+ <p className="mt-5 mb-0 text-sm text-secondary text-center">+ Already have an account?{' '}+ <Link+ to={urls.login()}+ className="font-semibold no-underline cursor-pointer hover:underline hover:underline-offset-2 text-warning"+ >+ Log in →+ </Link>+ </p>+ </>+ )++ return (+ <PaperDeskScene notes={["// you've been invited", `// ${org.toLowerCase()} is waiting`]}>+ <PaperDeskCard top={inviteHeader} footer={footer}>+ <CardTitle title="Create your account" sub="Your teammates are already in. This takes a minute." />+ {signupManualErrors?.generic && (+ <div className="mb-4 py-2.5 px-3 text-sm leading-normal text-primary text-left bg-danger-highlight border border-danger rounded">+ {signupManualErrors.generic.detail || 'Could not complete your signup.'}{' '}+ <Link+ data-attr="invite-signup-error-contact-support"+ onClick={() => openSupportForm({ kind: 'support', target_area: 'login' })}+ className="font-semibold no-underline cursor-pointer hover:underline hover:underline-offset-2 text-warning"+ >+ Need help?+ </Link>+ </div>+ )}+ {passkeyError && (+ <div className="mb-4 py-2.5 px-3 text-sm leading-normal text-primary text-left bg-danger-highlight border border-danger rounded">+ {passkeyError}+ </div>+ )}+ <Form logic={inviteSignupLogic} formKey="signup" enableFormOnSubmit className="flex flex-col gap-4">+ <LemonField.Pure label="Email" help="The invite is tied to this address.">+ <LemonInput type="email" value={invite.target_email} disabled fullWidth />+ </LemonField.Pure>++ {!extraFieldsHidden && (+ <>+ {passkeySignupEnabled && !passkeyRegistered && (+ <LemonButton+ size="large"+ center+ fullWidth+ onClick={registerPasskey}+ disabled={isPasskeyRegistering}+ data-attr="invite-signup-passkey"+ >+ Sign up with a passkey+ </LemonButton>+ )}+ {!passkeyRegistered && (+ <LemonField+ name="password"+ label={+ <div className="flex items-baseline justify-between w-full">+ <span>Password</span>+ <PasswordStrength validatedPassword={validatedPassword} />+ </div>+ }+ >+ {({ value, onChange, error, id }) => (+ <LemonInput+ id={id}+ className="ph-ignore-input"+ data-attr="password"+ type="password"+ autoComplete="new-password"+ placeholder="••••••••••"+ value={value ?? ''}+ onChange={onChange}+ status={error ? 'danger' : 'default'}+ fullWidth+ />+ )}+ </LemonField>+ )}+ <LemonField name="first_name" label="Your name">+ {({ value, onChange, error, id }) => (+ <LemonInput+ id={id}+ className="ph-ignore-input"+ data-attr="first_name"+ placeholder="Jane Doe"+ autoComplete="name"+ value={value ?? ''}+ onChange={onChange}+ status={error ? 'danger' : 'default'}+ fullWidth+ />+ )}+ </LemonField>+ <SignupRoleSelect />+ </>+ )}++ {!precheckResponse.sso_enforcement &&+ (challengeRequired && turnstileSiteKey ? (+ <TurnstileChallenge+ siteKey={turnstileSiteKey}+ onSuccess={setTurnstileToken}+ tokenReceived={!!turnstileToken}+ email={invite.target_email}+ />+ ) : (+ <LemonButton+ type="primary"+ size="large"+ center+ fullWidth+ htmlType="submit"+ data-attr="password-signup"+ loading={isSignupSubmitting || precheckResponseLoading}+ >+ Join {org}+ </LemonButton>+ ))}+ {precheckResponse.sso_enforcement && (+ <SSOEnforcedLoginButton+ provider={precheckResponse.sso_enforcement}+ email={invite.target_email}+ actionText="Continue"+ extraQueryParams={{ invite_id: invite.id }}+ />+ )}+ {precheckResponse.saml_available && !precheckResponse.sso_enforcement && (+ <SSOEnforcedLoginButton+ provider="saml"+ email={invite.target_email}+ actionText="Continue"+ extraQueryParams={{ invite_id: invite.id }}+ />+ )}+ </Form>+ {!extraFieldsHidden && (+ <SocialLoginButtons+ topDivider+ caption="or continue with"+ captionLocation="top"+ extraQueryParams={{ invite_id: invite.id }}+ />+ )}+ </PaperDeskCard>+ </PaperDeskScene>+ )+}++function InviteExistingAccount({ invite }: { invite: PrevalidatedInvite }): JSX.Element {+ const { user } = useValues(userLogic)+ const { acceptInvite } = useActions(inviteSignupLogic)+ const { acceptedInvite, acceptedInviteLoading } = useValues(inviteSignupLogic)+ const org = invite.organization_name++ return (+ <PaperDeskScene notes={['// hey, welcome back', '// one more org for you']}>+ <PaperDeskCard>+ <div className="mb-4 flex justify-center">+ <OrgTile name={org} />+ </div>+ <CardTitle+ title={`Join ${org}`}+ sub="You'll accept this invite with your existing PostHog account:"+ className="mb-4"+ />+ {user && (+ <div+ className="mb-4 flex gap-3 items-center py-2.5 px-3 border border-dashed border-[#c5c6bd] rounded-lg"+ data-attr="accept-invite-whoami"+ >+ <ProfilePicture user={user} size="xl" />+ <div className="min-w-0">+ <p className="m-0 text-sm font-semibold text-primary">{user.first_name}</p>+ <p className="m-0 overflow-hidden font-mono text-xs text-secondary text-ellipsis whitespace-nowrap">+ {user.email}+ </p>+ </div>+ </div>+ )}+ <p className="PaperDesk__sub mb-4 text-left text-sm text-secondary text-pretty">+ Accepting adds <b className="text-primary">{org}</b> to your account. Switch between organizations+ any time from the upper left of the app.+ </p>+ {acceptedInvite ? (+ <LemonButton+ type="primary"+ size="large"+ center+ fullWidth+ onClick={() => {+ window.location.href = '/'+ }}+ >+ Go to {org} →+ </LemonButton>+ ) : (+ <div className="flex flex-col gap-2.5">+ <LemonButton+ type="primary"+ size="large"+ center+ fullWidth+ loading={acceptedInviteLoading}+ onClick={acceptInvite}+ >+ Accept invite+ </LemonButton>+ <LemonButton+ size="large"+ center+ fullWidth+ onClick={() => {+ window.location.href = '/'+ }}+ >+ Not now, back to PostHog+ </LemonButton>+ </div>+ )}+ </PaperDeskCard>+ </PaperDeskScene>+ )+}++function InviteInvalid(): JSX.Element {+ const { error } = useValues(inviteSignupLogic)+ const { user } = useValues(userLogic)+ const { openSupportForm } = useActions(supportLogic)++ const code = error?.code ?? ErrorCodes.Unknown++ const titles: Record<ErrorCodes, string> = {+ [ErrorCodes.InvalidInvite]: 'This invite link is invalid or expired',+ [ErrorCodes.UserAlreadyMember]: "You're already a member",+ [ErrorCodes.InvalidRecipient]: "This invite link can't be used",+ [ErrorCodes.Unknown]: "We couldn't validate this invite link",+ }++ const details: Record<ErrorCodes, ReactNode> = {+ [ErrorCodes.InvalidInvite]: (+ <>+ {error?.detail} If you believe this is a mistake, ask whoever created the invite to{' '}+ <b>send you a new one</b>.+ </>+ ),+ [ErrorCodes.UserAlreadyMember]: (+ <>+ {error?.detail || 'You already are a member of this organization.'} Your account+ {user?.email ? (+ <>+ {' '}+ (<b>{user.email}</b>)+ </>+ ) : null}{' '}+ already belongs to it. To join a different organization, ask the inviter to send a new invite to a+ different email address.+ </>+ ),+ [ErrorCodes.InvalidRecipient]: (+ <>+ {error?.detail}{' '}+ {user ? (+ <>+ You can log out and create a new account under the invited email address, or ask the+ organization admin to send a new invite to <b>{user.email}</b>.+ </>+ ) : (+ 'Log in with the invited email address above, or create your own password.'+ )}+ </>+ ),+ [ErrorCodes.Unknown]: (+ <>+ {error?.detail} There was an issue with your invite link. Please try again in a few seconds. If the+ problem persists, contact us.+ </>+ ),+ }++ const footer = (+ <p className="mt-5 mb-0 text-sm text-secondary text-center">+ {!user && (+ <>+ <Link+ to={urls.login()}+ className="font-semibold no-underline cursor-pointer hover:underline hover:underline-offset-2 text-warning"+ >+ Log in+ </Link>+ <span className="mx-1.5 text-muted">·</span>+ </>+ )}+ <Link+ to="https://posthog.com"+ target="_blank"+ className="font-semibold no-underline cursor-pointer hover:underline hover:underline-offset-2 text-warning"+ >+ posthog.com ↗+ </Link>+ </p>+ )++ return (+ <PaperDeskScene notes={['// hmm', "// this invite isn't right"]}>+ <PaperDeskCard footer={footer}>+ <div className="flex flex-col items-center text-center">+ <JudgeHog className="block w-auto mx-auto h-28" />+ <h1 className="m-0 mt-3 font-title text-2xl font-extrabold leading-tight text-primary text-center tracking-tight">+ {titles[code]}+ </h1>+ <p className="PaperDesk__sub mt-2 mb-4 text-sm text-secondary text-center text-pretty">+ {details[code]}+ </p>+ <div className="flex flex-col gap-2.5 w-full">+ {user ? (+ <LemonButton size="large" center fullWidth type="primary" to={urls.default()}>+ Go back to PostHog+ </LemonButton>+ ) : code === ErrorCodes.InvalidRecipient ? (+ <LemonButton+ size="large"+ center+ fullWidth+ type="primary"+ to={window.location.pathname}+ disableClientSideRouting+ >+ Try again+ </LemonButton>+ ) : null}+ <LemonButton+ size="large"+ center+ fullWidth+ onClick={() => openSupportForm({ kind: 'bug', target_area: 'login' })}+ >+ Contact support+ </LemonButton>+ </div>+ </div>+ </PaperDeskCard>+ </PaperDeskScene>+ )+}++function InviteSignup(): JSX.Element {+ const { invite, inviteLoading, error } = useValues(inviteSignupLogic)+ const { user } = useValues(userLogic)++ if (inviteLoading) {+ return <SpinnerOverlay sceneLevel />+ }+ if (error) {+ return <InviteInvalid />+ }+ if (invite) {+ return user ? <InviteExistingAccount invite={invite} /> : <InviteNewUser invite={invite} />+ }+ return <SpinnerOverlay sceneLevel />+}++export { InviteSignup as PaperDeskInviteSignup }diff --git a/frontend/src/scenes/authentication/invite-signup/variants/redesign-2026-06-02/InviteSignupV2.tsx b/frontend/src/scenes/authentication/invite-signup/variants/redesign-2026-06-02/InviteSignupV2.tsxdeleted file mode 100644index 6a20728df578..000000000000--- a/frontend/src/scenes/authentication/invite-signup/variants/redesign-2026-06-02/InviteSignupV2.tsx+++ /dev/null@@ -1,13 +0,0 @@-import { BridgePage } from 'lib/components/BridgePage/BridgePage'--// TODO: build the redesign-2026-06-02 invited signup; renders under the `auth-flow-variant` flag.-export function InviteSignupV2(): JSX.Element {- return (- <BridgePage view="invites-signup" hedgehog message="You're invited">- <div className="deprecated-space-y-4">- <h2>Create your account</h2>- <p className="text-secondary">Redesigned invited signup — coming soon.</p>- </div>- </BridgePage>- )-}diff --git a/frontend/src/scenes/authentication/login/Login.tsx b/frontend/src/scenes/authentication/login/Login.tsxindex 90b5c199f156..91f0810113e3 100644--- a/frontend/src/scenes/authentication/login/Login.tsx+++ b/frontend/src/scenes/authentication/login/Login.tsx@@ -7,9 +7,6 @@ import { authFlowVariantRegistry } from '../authFlowVariantRegistry'import { resolveAuthFlowVariant } from '../authFlowVariants'import { loginLogic } from './loginLogic'-// ExporterLogin imports ERROR_MESSAGES from this module path.-export { ERROR_MESSAGES } from './variants/legacy/LegacyLogin'-export const scene: SceneExport = {component: Login,logic: loginLogic,diff --git a/frontend/src/scenes/authentication/login/PaperDeskLogin.stories.tsx b/frontend/src/scenes/authentication/login/PaperDeskLogin.stories.tsxnew file mode 100644index 000000000000..efbea2ba5b4d--- /dev/null+++ b/frontend/src/scenes/authentication/login/PaperDeskLogin.stories.tsx@@ -0,0 +1,136 @@+import type { Meta, StoryFn } from '@storybook/react'+import { useEffect } from 'react'++import { FEATURE_FLAGS } from 'lib/constants'++import { useStorybookMocks } from '~/mocks/browser'+import preflightJson from '~/mocks/fixtures/_preflight.json'++import { Login } from './Login'+import { loginLogic } from './loginLogic'++type StoryArgs = {+ cloud: boolean+ region: 'US' | 'EU'+ googleOAuth: boolean+ github: boolean+ gitlab: boolean+ samlAvailable: boolean+ ssoEnforcement: 'none' | 'google-oauth2' | 'github' | 'gitlab' | 'saml'+ generalError: 'none' | 'invalid_credentials' | 'email_verification_sent'+}++const meta: Meta<StoryArgs> = {+ title: 'Scenes-Other/Login (paper-desk)',+ tags: ['test-skip'],+ parameters: {+ layout: 'fullscreen',+ viewMode: 'story',+ featureFlags: { [FEATURE_FLAGS.AUTH_FLOW_VARIANT]: 'paper-desk' },+ },+ argTypes: {+ cloud: { control: 'boolean', name: 'Cloud' },+ region: { control: 'select', options: ['US', 'EU'], name: 'Region', if: { arg: 'cloud' } },+ googleOAuth: { control: 'boolean', name: 'Google OAuth' },+ github: { control: 'boolean', name: 'GitHub' },+ gitlab: { control: 'boolean', name: 'GitLab' },+ samlAvailable: { control: 'boolean', name: 'SAML available' },+ ssoEnforcement: {+ control: 'select',+ name: 'SSO enforcement',+ options: ['none', 'google-oauth2', 'github', 'gitlab', 'saml'],+ },+ generalError: {+ control: 'select',+ name: 'General error',+ options: ['none', 'invalid_credentials', 'email_verification_sent'],+ },+ },+ args: {+ cloud: true,+ region: 'US',+ googleOAuth: true,+ github: true,+ gitlab: true,+ samlAvailable: false,+ ssoEnforcement: 'none',+ generalError: 'none',+ },+}+export default meta++const Template: StoryFn<StoryArgs> = ({+ cloud,+ region,+ googleOAuth,+ github,+ gitlab,+ samlAvailable,+ ssoEnforcement,+ generalError,+}) => {+ const enforcement = ssoEnforcement === 'none' ? null : ssoEnforcement++ useStorybookMocks({+ get: {+ '/_preflight': {+ ...preflightJson,+ cloud,+ region: cloud ? region : undefined,+ realm: cloud ? 'cloud' : 'hosted-clickhouse',+ is_debug: cloud,+ can_create_org: cloud,+ available_social_auth_providers: {+ 'google-oauth2': googleOAuth,+ github,+ gitlab,+ saml: samlAvailable,+ },+ },+ },+ post: {+ '/api/login/precheck': { sso_enforcement: enforcement, saml_available: samlAvailable },+ },+ })++ useEffect(() => {+ if (enforcement) {+ loginLogic.actions.setLoginValue('email', '[email protected]')+ loginLogic.actions.precheck({ email: '[email protected]' })+ }+ }, [enforcement])++ useEffect(() => {+ if (generalError !== 'none') {+ const messages: Record<string, string> = {+ invalid_credentials: 'Invalid email or password.',+ email_verification_sent: 'Check your email to verify your account.',+ }+ loginLogic.actions.setGeneralError(generalError, messages[generalError] ?? '')+ } else {+ loginLogic.actions.clearGeneralError()+ }+ }, [generalError])++ return <Login />+}++export const Default: StoryFn<StoryArgs> = Template.bind({})++export const SelfHosted: StoryFn<StoryArgs> = Template.bind({})+SelfHosted.args = { cloud: false, googleOAuth: false, github: false, gitlab: false, samlAvailable: false }++export const CloudEU: StoryFn<StoryArgs> = Template.bind({})+CloudEU.args = { region: 'EU' }++export const SSOEnforced: StoryFn<StoryArgs> = Template.bind({})+SSOEnforced.args = { ssoEnforcement: 'google-oauth2' }++export const SAMLAvailable: StoryFn<StoryArgs> = Template.bind({})+SAMLAvailable.args = { samlAvailable: true }++export const LoginError: StoryFn<StoryArgs> = Template.bind({})+LoginError.args = { generalError: 'invalid_credentials' }++export const EmailVerification: StoryFn<StoryArgs> = Template.bind({})+EmailVerification.args = { generalError: 'email_verification_sent' }diff --git a/frontend/src/scenes/authentication/login/variants/legacy/LegacyLogin.tsx b/frontend/src/scenes/authentication/login/variants/legacy/LegacyLogin.tsxindex 809408f7cd79..22e90c60bbf7 100644--- a/frontend/src/scenes/authentication/login/variants/legacy/LegacyLogin.tsx+++ b/frontend/src/scenes/authentication/login/variants/legacy/LegacyLogin.tsx@@ -17,6 +17,7 @@ import { Link } from 'lib/lemon-ui/Link'import { Skeleton } from 'lib/ui/quill'import { isEmail } from 'lib/utils/url'import { AuthShell } from 'scenes/authentication/shared/AuthShell'+import { ERROR_MESSAGES } from 'scenes/authentication/shared/loginErrorMessages'import { OtherRegionHint } from 'scenes/authentication/shared/OtherRegionHint'import { RedirectIfLoggedInOtherInstance } from 'scenes/authentication/shared/RedirectToLoggedInInstance'import RegionSelect from 'scenes/authentication/shared/RegionSelect'@@ -28,46 +29,9 @@ import { LoginMethod } from '~/types'import { loginLogic } from '../../loginLogic'-export const ERROR_MESSAGES: Record<string, string | JSX.Element> = {- no_new_organizations:- 'Your email address is not associated with an account. Please ask your administrator for an invite.',- invalid_sso_provider: (- <>- The SSO provider you specified is invalid. Visit{' '}- <Link to="https://posthog.com/sso" target="_blank">- https://posthog.com/sso- </Link>{' '}- for details.- </>- ),- improperly_configured_sso: (- <>- Cannot login with SSO provider because the provider is not configured, or your instance does not have the- required license. Please visit{' '}- <Link to="https://posthog.com/sso" target="_blank">- https://posthog.com/sso- </Link>{' '}- for details.- </>- ),- jit_not_enabled:- 'We could not find an account with your email address and your organization does not support automatic enrollment. Please contact your administrator for an invite.',- saml_sso_enforced:- 'Your organization requires SAML SSO authentication. Please enter your email address to access your account.',- google_sso_enforced: 'Your organization does not allow this authentication method. Please log in with Google.',- github_sso_enforced: 'Your organization does not allow this authentication method. Please log in with GitHub.',- gitlab_sso_enforced: 'Your organization does not allow this authentication method. Please log in with GitLab.',- // our catch-all case, so the message is generic- sso_enforced: "Please log in with your organization's required SSO method.",- oauth_cancelled: "Sign in was cancelled. Please try again when you're ready.",- invalid_invite:- 'This invite link is no longer valid. It may have expired or been revoked. Please ask your administrator for a new invite.',- social_login_failure: 'Login failed. Please try again or contact your administrator.',-}-const LAST_LOGIN_METHOD_COOKIE = 'ph_last_login_method'-export function LegacyLogin(): JSX.Element {+function Login(): JSX.Element {const { precheck, resendEmailMFA, clearGeneralError, resetLogin, devLogin, loadDevUsers } = useActions(loginLogic)const { openSupportForm } = useActions(supportLogic)const {@@ -347,3 +311,5 @@ export function LegacyLogin(): JSX.Element {</AuthShell>)}++export { Login as LegacyLogin }diff --git a/frontend/src/scenes/authentication/login/variants/paper-desk/PaperDeskLogin.tsx b/frontend/src/scenes/authentication/login/variants/paper-desk/PaperDeskLogin.tsxnew file mode 100644index 000000000000..a371219f1043--- /dev/null+++ b/frontend/src/scenes/authentication/login/variants/paper-desk/PaperDeskLogin.tsx@@ -0,0 +1,225 @@+import { useActions, useValues } from 'kea'+import { Form } from 'kea-forms'+import { useEffect } from 'react'++import { getCookie } from 'lib/api'+import { SocialLoginButtons, SSOEnforcedLoginButton } from 'lib/components/SocialLoginButton/SocialLoginButton'+import { supportLogic } from 'lib/components/Support/supportLogic'+import { usePrevious } from 'lib/hooks/usePrevious'+import { LemonButton } from 'lib/lemon-ui/LemonButton'+import { LemonField } from 'lib/lemon-ui/LemonField'+import { LemonInput } from 'lib/lemon-ui/LemonInput/LemonInput'+import { Link } from 'lib/lemon-ui/Link'+import { isEmail } from 'lib/utils/url'+import { ERROR_MESSAGES } from 'scenes/authentication/shared/loginErrorMessages'+import { OtherRegionHint } from 'scenes/authentication/shared/OtherRegionHint'+import { CardTitle } from 'scenes/authentication/shared/paperDesk/CardTitle'+import { PaperDeskCard, PaperDeskScene } from 'scenes/authentication/shared/paperDesk/PaperDeskScene'+import { RegionField } from 'scenes/authentication/shared/paperDesk/RegionField'+import { RedirectIfLoggedInOtherInstance } from 'scenes/authentication/shared/RedirectToLoggedInInstance'+import { preflightLogic } from 'scenes/PreflightCheck/preflightLogic'+import { urls } from 'scenes/urls'++import { LoginMethod } from '~/types'++import { loginLogic } from '../../loginLogic'++const LAST_LOGIN_METHOD_COOKIE = 'ph_last_login_method'++function Login(): JSX.Element {+ const { precheck, clearGeneralError, resendEmailMFA } = useActions(loginLogic)+ const { openSupportForm } = useActions(supportLogic)+ const {+ precheckResponse,+ precheckResponseLoading,+ login,+ isLoginSubmitting,+ generalError,+ signupUrl,+ resendResponseLoading,+ } = useValues(loginLogic)+ const { preflight } = useValues(preflightLogic)++ const isPasswordHidden = !!precheckResponse.sso_enforcement+ const isEmailVerificationSent = generalError?.code === 'email_verification_sent'+ const lastLoginMethod = getCookie(LAST_LOGIN_METHOD_COOKIE) as LoginMethod+ const prevEmail = usePrevious(login.email)++ useEffect(() => {+ const charDelta = login.email.length - (prevEmail?.length ?? 0)+ const isAutofill = charDelta > 1++ if (isAutofill && isEmail(login.email, { requireTLD: true }) && precheckResponse.status === 'pending') {+ precheck({ email: login.email })+ }+ }, [login.email, prevEmail, precheckResponse.status, precheck])++ const footer = (+ <p className="mt-5 mb-0 text-sm text-secondary text-center">+ New to PostHog?{' '}+ <Link+ to={[signupUrl, { email: login.email }]}+ data-attr="signup"+ className="font-semibold no-underline cursor-pointer hover:underline hover:underline-offset-2 text-warning"+ >+ Create an account →+ </Link>+ </p>+ )++ return (+ <PaperDeskScene notes={['// welcome back', '// 100,000+ teams ship here']}>+ {preflight?.cloud && <RedirectIfLoggedInOtherInstance />}+ <PaperDeskCard footer={footer}>+ <CardTitle+ title={isEmailVerificationSent ? 'Check your email' : 'Log in to PostHog'}+ sub={isEmailVerificationSent ? undefined : "Welcome back. Let's go ship something."}+ />+ {generalError && (+ <div className="mb-4 py-2.5 px-3 text-sm leading-normal text-primary text-left bg-danger-highlight border border-danger rounded">+ {generalError.detail ||+ ERROR_MESSAGES[generalError.code] ||+ 'Could not complete your login. Please try again.'}+ {preflight?.cloud && (+ <>+ {' '}+ <Link+ data-attr="login-error-contact-support"+ onClick={(e) => {+ e.preventDefault()+ openSupportForm({+ kind: 'support',+ target_area: 'login',+ email: login.email,+ })+ }}+ className="font-semibold no-underline cursor-pointer hover:underline hover:underline-offset-2 text-warning"+ >+ Need help?+ </Link>+ </>+ )}+ </div>+ )}+ {generalError?.code === 'invalid_credentials' && (+ <div className="mb-4">+ <OtherRegionHint />+ </div>+ )}+ {isEmailVerificationSent ? (+ <div className="flex flex-col items-center gap-3">+ <LemonButton+ size="large"+ center+ fullWidth+ disabled={resendResponseLoading}+ loading={resendResponseLoading}+ onClick={() => resendEmailMFA(null)}+ >+ Resend verification email+ </LemonButton>+ <Link+ onClick={() => clearGeneralError()}+ className="font-semibold no-underline cursor-pointer hover:underline hover:underline-offset-2 text-secondary"+ >+ Back to login+ </Link>+ </div>+ ) : (+ <Form logic={loginLogic} formKey="login" enableFormOnSubmit className="flex flex-col gap-4">+ <RegionField />+ <LemonField name="email" label="Email">+ {({ value, onChange, error, id }) => (+ <LemonInput+ id={id}+ className="ph-ignore-input"+ data-attr="login-email"+ type="email"+ autoFocus+ placeholder="[email protected]"+ autoComplete="email"+ value={value ?? ''}+ onChange={onChange}+ onBlur={() => precheck({ email: login.email })}+ status={error ? 'danger' : 'default'}+ fullWidth+ />+ )}+ </LemonField>+ {!isPasswordHidden && (+ <LemonField+ name="password"+ label={+ <div className="flex items-baseline justify-between w-full">+ <span>Password</span>+ <Link+ to={[urls.passwordReset(), { email: login.email }]}+ data-attr="forgot-password"+ className="text-xs font-semibold text-warning"+ tabIndex={-1}+ >+ Forgot password?+ </Link>+ </div>+ }+ >+ {({ value, onChange, error, id }) => (+ <LemonInput+ id={id}+ className="ph-ignore-input"+ data-attr="password"+ type="password"+ placeholder="••••••••••"+ autoComplete="current-password"+ value={value ?? ''}+ onChange={onChange}+ status={error ? 'danger' : 'default'}+ fullWidth+ />+ )}+ </LemonField>+ )}+ {!precheckResponse.sso_enforcement && (+ <LemonButton+ type="primary"+ size="large"+ center+ fullWidth+ htmlType="submit"+ data-attr="password-login"+ loading={isLoginSubmitting || precheckResponseLoading}+ >+ Log in+ </LemonButton>+ )}+ {precheckResponse.sso_enforcement && (+ <SSOEnforcedLoginButton+ provider={precheckResponse.sso_enforcement}+ email={login.email}+ isLastUsed={lastLoginMethod === precheckResponse.sso_enforcement}+ />+ )}+ {precheckResponse.saml_available && !precheckResponse.sso_enforcement && (+ <SSOEnforcedLoginButton+ provider="saml"+ email={login.email}+ isLastUsed={lastLoginMethod === 'saml'}+ />+ )}+ </Form>+ )}+ {!isEmailVerificationSent && !precheckResponse.saml_available && !precheckResponse.sso_enforcement && (+ <SocialLoginButtons+ topDivider+ caption="Or log in with"+ captionLocation="top"+ lastUsedProvider={lastLoginMethod}+ showPasskey+ />+ )}+ </PaperDeskCard>+ </PaperDeskScene>+ )+}++export { Login as PaperDeskLogin }diff --git a/frontend/src/scenes/authentication/login/variants/redesign-2026-06-02/LoginV2.tsx b/frontend/src/scenes/authentication/login/variants/redesign-2026-06-02/LoginV2.tsxdeleted file mode 100644index 212a0f65a8fa..000000000000--- a/frontend/src/scenes/authentication/login/variants/redesign-2026-06-02/LoginV2.tsx+++ /dev/null@@ -1,13 +0,0 @@-import { BridgePage } from 'lib/components/BridgePage/BridgePage'--// TODO: build the redesign-2026-06-02 login; renders under the `auth-flow-variant` flag.-export function LoginV2(): JSX.Element {- return (- <BridgePage view="login" hedgehog message="Welcome back">- <div className="deprecated-space-y-4">- <h2>Log in</h2>- <p className="text-secondary">Redesigned sign-in — coming soon.</p>- </div>- </BridgePage>- )-}diff --git a/frontend/src/scenes/authentication/shared/KeyboardGardenBackground.tsx b/frontend/src/scenes/authentication/shared/KeyboardGardenBackground.tsxnew file mode 100644index 000000000000..9ad45f586917--- /dev/null+++ b/frontend/src/scenes/authentication/shared/KeyboardGardenBackground.tsx@@ -0,0 +1,47 @@+import { useValues } from 'kea'+import type { ReactNode } from 'react'++import { themeLogic } from '~/layout/navigation-3000/themeLogic'++const KEYBOARD_GARDEN = {+ light: {+ baseColor: '#eeefe9',+ texture: 'https://res.cloudinary.com/dmukukwp6/image/upload/keyboard_garden_bg_light_03a349af5c.png',+ textureSize: '100px 100px',+ illustration:+ 'https://res.cloudinary.com/dmukukwp6/image/upload/keyboard_garden_light_opt_compressed_5094746caf.png',+ },+ dark: {+ baseColor: '#1d1f27',+ texture: 'https://res.cloudinary.com/dmukukwp6/image/upload/keyboard_garden_bg_dark_9ab088797a.png',+ textureSize: '200px 200px',+ illustration: 'https://res.cloudinary.com/dmukukwp6/image/upload/keyboard_garden_dark_opt_15e213413c.png',+ },+}++// posthog.com "keyboard garden" wallpaper: base color, tiled texture, and a bottom-right illustration+// behind the content. themeLogic forces light mode on unauthenticated scenes, so the dark assets stay+// dormant on the auth pages for now.+export function KeyboardGardenBackground({ children }: { children?: ReactNode }): JSX.Element {+ const { isDarkModeOn } = useValues(themeLogic)+ const assets = isDarkModeOn ? KEYBOARD_GARDEN.dark : KEYBOARD_GARDEN.light++ return (+ <div className="relative min-h-screen w-full overflow-hidden" style={{ backgroundColor: assets.baseColor }}>+ <div+ aria-hidden+ className="absolute inset-0 bg-repeat pointer-events-none"+ style={{ backgroundImage: `url(${assets.texture})`, backgroundSize: assets.textureSize }}+ />+ <img+ aria-hidden+ src={assets.illustration}+ alt=""+ draggable={false}+ className="absolute bottom-4 -right-4 max-w-none pointer-events-none select-none"+ style={{ width: 'clamp(14rem, 32vw, 32rem)', height: 'clamp(14rem, 32vw, 32rem)' }}+ />+ <div className="relative z-10 flex min-h-screen flex-col items-center justify-center">{children}</div>+ </div>+ )+}diff --git a/frontend/src/scenes/authentication/shared/loginErrorMessages.tsx b/frontend/src/scenes/authentication/shared/loginErrorMessages.tsxnew file mode 100644index 000000000000..31810fb5c344--- /dev/null+++ b/frontend/src/scenes/authentication/shared/loginErrorMessages.tsx@@ -0,0 +1,39 @@+import { Link } from 'lib/lemon-ui/Link'++// Login error copy shared by the auth login variants and the exporter login screen.+export const ERROR_MESSAGES: Record<string, string | JSX.Element> = {+ no_new_organizations:+ 'Your email address is not associated with an account. Please ask your administrator for an invite.',+ invalid_sso_provider: (+ <>+ The SSO provider you specified is invalid. Visit{' '}+ <Link to="https://posthog.com/sso" target="_blank">+ https://posthog.com/sso+ </Link>{' '}+ for details.+ </>+ ),+ improperly_configured_sso: (+ <>+ Cannot login with SSO provider because the provider is not configured, or your instance does not have the+ required license. Please visit{' '}+ <Link to="https://posthog.com/sso" target="_blank">+ https://posthog.com/sso+ </Link>{' '}+ for details.+ </>+ ),+ jit_not_enabled:+ 'We could not find an account with your email address and your organization does not support automatic enrollment. Please contact your administrator for an invite.',+ saml_sso_enforced:+ 'Your organization requires SAML SSO authentication. Please enter your email address to access your account.',+ google_sso_enforced: 'Your organization does not allow this authentication method. Please log in with Google.',+ github_sso_enforced: 'Your organization does not allow this authentication method. Please log in with GitHub.',+ gitlab_sso_enforced: 'Your organization does not allow this authentication method. Please log in with GitLab.',+ // our catch-all case, so the message is generic+ sso_enforced: "Please log in with your organization's required SSO method.",+ oauth_cancelled: "Sign in was cancelled. Please try again when you're ready.",+ invalid_invite:+ 'This invite link is no longer valid. It may have expired or been revoked. Please ask your administrator for a new invite.',+ social_login_failure: 'Login failed. Please try again or contact your administrator.',+}diff --git a/frontend/src/scenes/authentication/shared/paperDesk/CardTitle.tsx b/frontend/src/scenes/authentication/shared/paperDesk/CardTitle.tsxnew file mode 100644index 000000000000..df33c63c8b00--- /dev/null+++ b/frontend/src/scenes/authentication/shared/paperDesk/CardTitle.tsx@@ -0,0 +1,18 @@+import { type ReactNode } from 'react'++export function CardTitle({+ title,+ sub,+ className,+}: {+ title: ReactNode+ sub?: ReactNode+ className?: string+}): JSX.Element {+ return (+ <div className={className ?? 'mb-6'}>+ <h1 className="m-0 text-xl font-bold leading-tight text-center tracking-tight">{title}</h1>+ {sub && <p className="mt-2 mb-0 text-sm text-gray-600 text-center text-pretty">{sub}</p>}+ </div>+ )+}diff --git a/frontend/src/scenes/authentication/shared/paperDesk/DevLoginPanel.stories.tsx b/frontend/src/scenes/authentication/shared/paperDesk/DevLoginPanel.stories.tsxnew file mode 100644index 000000000000..044134d3847a--- /dev/null+++ b/frontend/src/scenes/authentication/shared/paperDesk/DevLoginPanel.stories.tsx@@ -0,0 +1,91 @@+import type { Meta, StoryFn } from '@storybook/react'++import { useStorybookMocks } from '~/mocks/browser'+import preflightJson from '~/mocks/fixtures/_preflight.json'++import { DevLoginPanel } from './DevLoginPanel'++type StoryArgs = {+ allowDevLogin: boolean+ devUsers: 'none' | 'default' | 'many'+}++const DEV_USERS_MOCKS = {+ none: { users: [] },+ default: {+ users: [+ {+ email: '[email protected]',+ is_staff: true,+ label: 'Default test user',+ },+ { email: '[email protected]', is_staff: true, label: null },+ ],+ },+ many: {+ users: [+ {+ email: '[email protected]',+ is_staff: true,+ label: 'Default test user',+ },+ { email: '[email protected]', is_staff: true, label: null },+ { email: '[email protected]', is_staff: true, label: 'Admin' },+ { email: '[email protected]', is_staff: false, label: null },+ {+ email: '[email protected]',+ is_staff: false,+ label: 'New',+ },+ ],+ },+}++const meta: Meta<StoryArgs> = {+ title: 'Scenes-Other/Authentication/DevLoginPanel',+ tags: ['test-skip'],+ parameters: {+ layout: 'fullscreen',+ viewMode: 'story',+ },+ argTypes: {+ allowDevLogin: { control: 'boolean', name: 'Allow dev login' },+ devUsers: {+ control: 'select',+ options: ['none', 'default', 'many'],+ name: 'Dev users',+ },+ },+ args: {+ allowDevLogin: true,+ devUsers: 'default',+ },+}+export default meta++const Template: StoryFn<StoryArgs> = ({ allowDevLogin, devUsers }) => {+ useStorybookMocks({+ get: {+ '/_preflight': {+ ...preflightJson,+ is_debug: true,+ allow_dev_login: allowDevLogin,+ },+ '/api/login/dev': DEV_USERS_MOCKS[devUsers],+ },+ })++ return (+ <div className="min-h-screen bg-[#eef0e7]">+ <DevLoginPanel />+ </div>+ )+}++export const Default: StoryFn<StoryArgs> = Template.bind({})++export const ManyUsers: StoryFn<StoryArgs> = Template.bind({})+ManyUsers.args = { devUsers: 'many' }++export const NoDevLogin: StoryFn<StoryArgs> = Template.bind({})+NoDevLogin.args = { allowDevLogin: false, devUsers: 'none' }diff --git a/frontend/src/scenes/authentication/shared/paperDesk/DevLoginPanel.tsx b/frontend/src/scenes/authentication/shared/paperDesk/DevLoginPanel.tsxnew file mode 100644index 000000000000..3739751db3bc--- /dev/null+++ b/frontend/src/scenes/authentication/shared/paperDesk/DevLoginPanel.tsx@@ -0,0 +1,100 @@+import { useActions, useValues } from 'kea'+import { useEffect, useState } from 'react'++import { LemonButton } from 'lib/lemon-ui/LemonButton'+import { OAUTH_REGIONS } from 'lib/oauth/oauthClient'+import { oauthLogic } from 'lib/oauth/oauthLogic'+import { preflightLogic } from 'scenes/PreflightCheck/preflightLogic'++import { Region } from '~/types'++import { devLoginLogic } from '../devLoginLogic'++/** Floating dev-only panel (top-right) combining dev-login shortcuts and OAuth prod-data login. */+export function DevLoginPanel(): JSX.Element | null {+ const { preflight } = useValues(preflightLogic)+ const { devUsers, devUsersLoading } = useValues(devLoginLogic)+ const { devLogin, loadDevUsers } = useActions(devLoginLogic)+ const { loginInProgress } = useValues(oauthLogic)+ const { beginLogin } = useActions(oauthLogic)+ const [open, setOpen] = useState(true)++ const isDebug = !!preflight?.is_debug+ const allowDevLogin = !!preflight?.allow_dev_login++ useEffect(() => {+ if (allowDevLogin) {+ loadDevUsers(null)+ }+ }, [allowDevLogin, loadDevUsers])++ if (!isDebug) {+ return null+ }++ const showDevLogin = allowDevLogin && !devUsersLoading && devUsers.length > 0++ return (+ <div className="fixed top-4 right-4 z-50">+ {open ? (+ <div className="w-64 bg-white border rounded shadow p-3">+ <div className="flex items-center justify-between mb-3">+ <span className="text-xs font-semibold text-muted">Login tools</span>+ <button type="button" className="text-muted" onClick={() => setOpen(false)} aria-label="Close">+ ✕+ </button>+ </div>+ {showDevLogin && (+ <div className="mb-4">+ <p className="text-xs font-medium text-muted mb-1.5">Login as</p>+ <div className="flex flex-col gap-1">+ {devUsers.map((u) => (+ <button+ key={u.email}+ type="button"+ onClick={() => devLogin(u.email)}+ data-attr={`dev-login-${u.email}`}+ className="flex items-center gap-2 w-full text-left px-2.5 py-1.5 rounded border border-border bg-bg-light hover:border-accent hover:bg-accent-highlight transition-colors"+ >+ <span className="flex-1 truncate text-xs">{u.email}</span>+ {u.label && <span className="text-xs text-muted">{u.label}</span>}+ </button>+ ))}+ </div>+ </div>+ )}+ {showDevLogin && <div className="border-t border-border my-3" />}+ <div>+ <p className="text-xs font-medium text-muted mb-1.5">Login via OAuth</p>+ <div className="flex flex-col gap-1">+ <button+ type="button"+ disabled={loginInProgress}+ onClick={() => beginLogin(Region.US)}+ data-attr="dev-oauth-us"+ className="flex items-center gap-2 w-full text-left px-2.5 py-1.5 rounded border border-border bg-bg-light hover:border-accent hover:bg-accent-highlight disabled:opacity-50 disabled:hover:border-border disabled:hover:bg-bg-light transition-colors"+ >+ <span className="text-base leading-none">{OAUTH_REGIONS[Region.US].flag}</span>+ <span className="text-xs">US Cloud</span>+ </button>+ <button+ type="button"+ disabled={loginInProgress}+ onClick={() => beginLogin(Region.EU)}+ data-attr="dev-oauth-eu"+ className="flex items-center gap-2 w-full text-left px-2.5 py-1.5 rounded border border-border bg-bg-light hover:border-accent hover:bg-accent-highlight disabled:opacity-50 disabled:hover:border-border disabled:hover:bg-bg-light transition-colors"+ >+ <span className="text-base leading-none">{OAUTH_REGIONS[Region.EU].flag}</span>+ <span className="text-xs">EU Cloud</span>+ </button>+ </div>+ </div>+ </div>+ ) : (+ <LemonButton size="small" type="tertiary" onClick={() => setOpen(true)}>+ Login tools+ </LemonButton>+ )}+ </div>+ )+}diff --git a/frontend/src/scenes/authentication/shared/paperDesk/OrgTile.tsx b/frontend/src/scenes/authentication/shared/paperDesk/OrgTile.tsxnew file mode 100644index 000000000000..f1fa5ae46233--- /dev/null+++ b/frontend/src/scenes/authentication/shared/paperDesk/OrgTile.tsx@@ -0,0 +1,10 @@+export function OrgTile({ name }: { name: string }): JSX.Element {+ return (+ <div+ className="flex items-center justify-center size-11 font-title text-xl font-extrabold text-white bg-warning border-[1.5px] border-[#a36d01] rounded-lg shadow-[0_3px_0_#a36d01]"+ aria-hidden+ >+ {(name || '?').trim().charAt(0).toUpperCase()}+ </div>+ )+}diff --git a/frontend/src/scenes/authentication/shared/paperDesk/PaperDesk.scss b/frontend/src/scenes/authentication/shared/paperDesk/PaperDesk.scssnew file mode 100644index 000000000000..7ac9b4c96613--- /dev/null+++ b/frontend/src/scenes/authentication/shared/paperDesk/PaperDesk.scss@@ -0,0 +1,130 @@+// Paper-desk auth variant — light mode only (unauthenticated auth scenes are forced light).+// Only rules that cannot be expressed in Tailwind utilities live here:+// pseudo-elements, interactive pseudo-class combinators, child selectors, keyframes.++// Dotted paper grid + faint accent glow — require pseudo-elements, not achievable via Tailwind+.PaperDesk {+ --primary-3000-button-bg: var(--warning);+ --primary-3000-frame-bg: var(--primary-3000-button-border-light);+ --primary-3000-button-border: var(--primary-3000-button-border-light);+ --primary-3000-button-border-hover: var(--primary-3000-button-border-hover-light);++ // Links use the bright brand amber, not the darker text-contrast warning token.+ --color-text-warning: var(--warning);++ &::before {+ position: absolute;+ inset: 0;+ pointer-events: none;+ content: '';+ background-image: radial-gradient(rgb(17 17 17 / 5.5%) 1.4px, transparent 1.4px);+ background-size: 16px 16px;+ }++ &::after {+ position: absolute;+ inset: 0;+ pointer-events: none;+ content: '';+ background: radial-gradient(72% 72% at 50% 38%, rgb(247 165 1 / 5%), transparent 70%);+ }+}++// Child SVG sizing — child selector, no Tailwind equivalent+.PaperDesk__logo {+ svg {+ display: block;+ width: auto;+ height: 40px;+ }+}++// Invite header mark SVG sizing+.PaperDesk__inviteHeader-mark {+ svg {+ width: auto;+ height: 30px;+ }+}++// Sub paragraph — code and mono spans inside it share styles+.PaperDesk__sub {+ code,+ .PaperDesk__mono {+ font-family: var(--font-mono);+ font-size: 13px;+ color: #111;+ }+}++// Terms text — nested link style+.PaperDesk__terms {+ a {+ font-weight: 600;+ color: rgb(17 17 17 / 58%);+ text-decoration: underline;+ text-underline-offset: 2px;+ }+}++// Note callout — bold inside it is darker+.PaperDesk__note {+ b {+ color: #111;+ }+}++// Blink animation for typewriter caret+.PaperDesk__caret {+ animation: PaperDesk__blink 1.05s steps(1) infinite;+}++@media (prefers-reduced-motion: no-preference) {+ .PaperDesk__column {+ animation: PaperDesk__rise 0.28s cubic-bezier(0.16, 1, 0.3, 1);+ }++ .PaperDesk__progress-fill {+ animation: PaperDesk__progress 2.2s cubic-bezier(0.16, 1, 0.3, 1);+ }+}++@media (prefers-reduced-motion: reduce) {+ .PaperDesk__caret {+ animation: none;+ }+}++@keyframes PaperDesk__blink {+ 0%,+ 50% {+ opacity: 1;+ }++ 50.01%,+ 100% {+ opacity: 0;+ }+}++@keyframes PaperDesk__rise {+ from {+ opacity: 0;+ transform: translateY(8px);+ }++ to {+ opacity: 1;+ transform: none;+ }+}++@keyframes PaperDesk__progress {+ from {+ width: 0%;+ }++ to {+ width: 100%;+ }+}diff --git a/frontend/src/scenes/authentication/shared/paperDesk/PaperDeskScene.tsx b/frontend/src/scenes/authentication/shared/paperDesk/PaperDeskScene.tsxnew file mode 100644index 000000000000..78b859280847--- /dev/null+++ b/frontend/src/scenes/authentication/shared/paperDesk/PaperDeskScene.tsx@@ -0,0 +1,48 @@+import './PaperDesk.scss'++import { type ReactNode } from 'react'++import { PostHogLogo } from 'lib/brand/v2'++import { DevLoginPanel } from './DevLoginPanel'+import { Typewriter } from './Typewriter'++/** Full-viewport paper-desk stage: dotted parchment + accent glow + mono corner notes. */+export function PaperDeskScene({ notes, children }: { notes: string[]; children: ReactNode }): JSX.Element {+ return (+ <div className="PaperDesk relative min-h-screen overflow-hidden font-sans text-primary bg-[#eef0e7]">+ <Typewriter lines={notes} />+ <div className="relative z-[3] flex flex-col items-center justify-center min-h-screen py-18 px-10">+ <div className="PaperDesk__column flex flex-col items-center w-[27rem] max-w-full">{children}</div>+ </div>+ <DevLoginPanel />+ </div>+ )+}++/** Logo (or custom header) + white card + optional footer note — the column contents. */+export function PaperDeskCard({+ top,+ footer,+ children,+}: {+ top?: ReactNode+ footer?: ReactNode+ children: ReactNode+}): JSX.Element {+ return (+ <>+ {top === undefined ? (+ <span className="PaperDesk__logo block mb-4">+ <PostHogLogo className="h-8 w-auto" />+ </span>+ ) : (+ top+ )}+ <div className="w-full pt-8 px-9 pb-8 bg-white border border-[#e0e1d9] rounded-lg shadow-[0_20px_44px_-26px_rgb(40_38_30/35%),0_3px_0_#e0e1d9]">+ {children}+ </div>+ {footer}+ </>+ )+}diff --git a/frontend/src/scenes/authentication/shared/paperDesk/RegionField.tsx b/frontend/src/scenes/authentication/shared/paperDesk/RegionField.tsxnew file mode 100644index 000000000000..e536d19d087c--- /dev/null+++ b/frontend/src/scenes/authentication/shared/paperDesk/RegionField.tsx@@ -0,0 +1,141 @@+import { useValues } from 'kea'+import { router } from 'kea-router'+import { useState } from 'react'++import { IconCheckCircle } from '@posthog/icons'+import { LemonLabel, LemonModal, LemonSelect, LemonSelectOptions } from '@posthog/lemon-ui'++import { CLOUD_HOSTNAMES } from 'lib/constants'+import { countryCodeToFlag } from 'lib/utils/country'+import { preflightLogic } from 'scenes/PreflightCheck/preflightLogic'++import { Region } from '~/types'++const REGION_SECTIONS = [+ {+ title: 'US hosting',+ features: [+ 'Faster if you and your users are based in the US',+ 'Easier to comply with some US regulations',+ 'Hosted in Virginia, USA',+ ],+ },+ {+ title: 'EU hosting',+ features: [+ 'Faster if you and your users are based in Europe',+ 'Keeps data in the EU to comply with GDPR requirements',+ 'Hosted in Frankfurt, Germany',+ ],+ },+]++function RegionModal({ open, onClose }: { open: boolean; onClose: () => void }): JSX.Element {+ return (+ <LemonModal+ title="Which region would you like to choose?"+ description="It's possible to migrate to another region later."+ isOpen={open}+ onClose={onClose}+ >+ <ul className="list-none">+ {REGION_SECTIONS.map((section) => (+ <li+ key={section.title}+ className="border-t first:border-t-0 border-dashed border-gray-accent mt-2 first:mt-0"+ >+ <h4 className="text-lg m-0 mt-2">{section.title}</h4>+ <ul className="list-none p-0 my-2 deprecated-space-y-1">+ {section.features.map((feature) => (+ <li+ key={feature}+ className="flex items-center deprecated-space-x-2 text-gray-accent-light align-center"+ >+ <IconCheckCircle className="w-[20px] flex-shrink-0" />+ <span className="text-black font-medium">{feature}</span>+ </li>+ ))}+ </ul>+ </li>+ ))}+ </ul>+ </LemonModal>+ )+}++const REGION_COUNTRY_CODE: Record<Region, string> = {+ [Region.US]: 'US',+ [Region.EU]: 'EU',+ [Region.DEV]: 'US',+}++function MiniFlag({ region }: { region: Region }): JSX.Element {+ return (+ <span className="shrink-0 leading-none" aria-hidden>+ {countryCodeToFlag(REGION_COUNTRY_CODE[region])}+ </span>+ )+}++const REGIONS: { value: Region; label: string }[] = [+ { value: Region.US, label: 'United States' },+ { value: Region.EU, label: 'European Union' },+]++export function RegionField(): JSX.Element | null {+ const { preflight } = useValues(preflightLogic)+ const [devRegion, setDevRegion] = useState<Region>(Region.US)+ const [modalOpen, setModalOpen] = useState(false)++ if (!preflight?.cloud && !preflight?.is_debug) {+ return null+ }++ const activeRegion = preflight?.cloud ? (preflight.region ?? Region.US) : devRegion++ const selectRegion = (region: Region): void => {+ if (region === activeRegion) {+ return+ }+ if (preflight?.cloud) {+ const { pathname, search, hash } = router.values.currentLocation+ window.location.href = `https://${CLOUD_HOSTNAMES[region]}${pathname}${search}${hash}`+ return+ }+ setDevRegion(region)+ }++ const options: LemonSelectOptions<Region> = REGIONS.map((region) => ({+ value: region.value,+ label: (+ <span className="flex items-center gap-2">+ <MiniFlag region={region.value} />+ <span>{region.label}</span>+ </span>+ ),+ }))++ return (+ <>+ <RegionModal open={modalOpen} onClose={() => setModalOpen(false)} />+ <div className="flex flex-col gap-2">+ <LemonLabel onExplanationClick={() => setModalOpen(true)}>Data region</LemonLabel>+ <LemonSelect<Region>+ value={activeRegion}+ options={options}+ fullWidth+ onChange={(value) => value && selectRegion(value)}+ renderButtonContent={(leaf) => {+ const region = leaf?.value ?? activeRegion+ return (+ <span className="flex items-center gap-2">+ <MiniFlag region={region} />+ <span>{REGIONS.find((r) => r.value === region)?.label}</span>+ </span>+ )+ }}+ />+ </div>+ </>+ )+}diff --git a/frontend/src/scenes/authentication/shared/paperDesk/Typewriter.tsx b/frontend/src/scenes/authentication/shared/paperDesk/Typewriter.tsxnew file mode 100644index 000000000000..a18cf660d495--- /dev/null+++ b/frontend/src/scenes/authentication/shared/paperDesk/Typewriter.tsx@@ -0,0 +1,53 @@+import { useState, useEffect } from 'react'++/** Types the two mono corner notes (// ...), honoring reduced-motion. Presentational only. */+export function Typewriter({ lines }: { lines: string[] }): JSX.Element {+ const full = lines.join('\n')+ const reduce = typeof window !== 'undefined' && !!window.matchMedia?.('(prefers-reduced-motion: reduce)').matches+ const [shown, setShown] = useState(reduce ? full.length : 0)++ useEffect(() => {+ if (reduce) {+ setShown(full.length)+ return+ }+ setShown(0)+ const schedule: number[] = []+ let acc = 350+ for (const ch of full) {+ acc += ch === '\n' ? 380 : 42+ schedule.push(acc)+ }+ const start = performance.now()+ // Elapsed-time driven so a throttled/background tab catches up in one tick.+ const id = setInterval(() => {+ const elapsed = performance.now() - start+ let k = 0+ while (k < schedule.length && schedule[k] <= elapsed) {+ k+++ }+ setShown(k)+ if (k >= schedule.length) {+ clearInterval(id)+ }+ }, 40)+ return () => clearInterval(id)+ }, [full, reduce])++ const parts = full.slice(0, shown).split('\n')+ return (+ <div+ className="absolute top-[clamp(20px,4vh,40px)] left-[clamp(20px,4vw,44px)] z-[2] min-h-[2.6em] font-mono text-xs leading-relaxed whitespace-pre"+ aria-hidden+ >+ {parts.map((part, idx) => (+ <div key={idx} className="text-primary/50 first:font-semibold">+ {part}+ {idx === parts.length - 1 && (+ <span className="PaperDesk__caret inline-block w-2 h-[1.05em] ml-0.5 [vertical-align:-2px] bg-warning rounded-[1px]" />+ )}+ </div>+ ))}+ </div>+ )+}diff --git a/frontend/src/scenes/authentication/signup/PaperDeskSignup.stories.tsx b/frontend/src/scenes/authentication/signup/PaperDeskSignup.stories.tsxnew file mode 100644index 000000000000..eaae0abade33--- /dev/null+++ b/frontend/src/scenes/authentication/signup/PaperDeskSignup.stories.tsx@@ -0,0 +1,119 @@+import type { Meta, StoryFn } from '@storybook/react'+import { HttpResponse, delay } from 'msw'+import { useEffect } from 'react'++import { FEATURE_FLAGS } from 'lib/constants'+import { useDelayedOnMountEffect } from 'lib/hooks/useOnMountEffect'+import { userLogic } from 'scenes/userLogic'++import { mswDecorator, useStorybookMocks } from '~/mocks/browser'+import preflightJson from '~/mocks/fixtures/_preflight.json'++import { SignupContainer } from './SignupContainer'+import { signupLogic } from './signupForm/signupLogic'++type PanelOption = '1 — Email' | '2 — Password' | '3 — Profile'++const PANEL_INDEX: Record<PanelOption, 0 | 1 | 2> = {+ '1 — Email': 0,+ '2 — Password': 1,+ '3 — Profile': 2,+}++type StoryArgs = {+ cloud: boolean+ region: 'US' | 'EU'+ googleOAuth: boolean+ github: boolean+ gitlab: boolean+ panel: PanelOption+}++const meta: Meta<StoryArgs> = {+ title: 'Scenes-Other/Signup (paper-desk)',+ tags: ['test-skip'],+ parameters: {+ layout: 'fullscreen',+ viewMode: 'story',+ featureFlags: {+ [FEATURE_FLAGS.AUTH_FLOW_VARIANT]: 'paper-desk',+ [FEATURE_FLAGS.PASSKEY_SIGNUP_ENABLED]: true,+ },+ },+ decorators: [+ mswDecorator({+ get: { '/api/users/@me': () => [500, null] },+ post: {+ '/api/signup': async () => {+ await delay(1000)+ return HttpResponse.json({ success: true })+ },+ },+ }),+ ],+ argTypes: {+ cloud: { control: 'boolean', name: 'Cloud' },+ region: { control: 'select', options: ['US', 'EU'], name: 'Region', if: { arg: 'cloud' } },+ googleOAuth: { control: 'boolean', name: 'Google OAuth' },+ github: { control: 'boolean', name: 'GitHub' },+ gitlab: { control: 'boolean', name: 'GitLab' },+ panel: {+ control: 'select',+ name: 'Step',+ options: ['1 — Email', '2 — Password', '3 — Profile'] satisfies PanelOption[],+ },+ },+ args: {+ cloud: true,+ region: 'US',+ googleOAuth: true,+ github: true,+ gitlab: true,+ panel: '1 — Email',+ },+}+export default meta++const Template: StoryFn<StoryArgs> = ({ cloud, region, googleOAuth, github, gitlab, panel: panelOption }) => {+ const panel = PANEL_INDEX[panelOption]+ useStorybookMocks({+ get: {+ '/_preflight': {+ ...preflightJson,+ cloud,+ region: cloud ? region : undefined,+ realm: cloud ? 'cloud' : 'hosted-clickhouse',+ is_debug: cloud,+ can_create_org: cloud,+ available_social_auth_providers: {+ 'google-oauth2': googleOAuth,+ github,+ gitlab,+ saml: false,+ },+ },+ },+ })++ useDelayedOnMountEffect(() => userLogic.actions.loadUserSuccess(null))++ useEffect(() => {+ signupLogic.actions.setPanel(panel)+ if (panel > 0) {+ signupLogic.actions.setSignupPanelEmailValue('email', '[email protected]')+ }+ }, [panel])++ return <SignupContainer />+}++export const Default: StoryFn<StoryArgs> = Template.bind({})++export const SelfHosted: StoryFn<StoryArgs> = Template.bind({})+SelfHosted.args = { cloud: false, googleOAuth: false, github: false, gitlab: false }++export const PasswordStep: StoryFn<StoryArgs> = Template.bind({})+PasswordStep.args = { panel: '2 — Password' }++export const ProfileStep: StoryFn<StoryArgs> = Template.bind({})+ProfileStep.args = { panel: '3 — Profile' }diff --git a/frontend/src/scenes/authentication/signup/signupForm/signupLogic.ts b/frontend/src/scenes/authentication/signup/signupForm/signupLogic.tsindex d28ea1e53dbb..b7017931eef2 100644--- a/frontend/src/scenes/authentication/signup/signupForm/signupLogic.ts+++ b/frontend/src/scenes/authentication/signup/signupForm/signupLogic.ts@@ -220,7 +220,8 @@ export const signupLogic = kea<signupLogicType>([return}actions.setPendingInvite(null)- actions.setPanel(1)+ // Demo is passwordless — skip the password/passkey panel straight to onboarding.+ actions.setPanel(values.preflight?.demo ? 2 : 1)},},signupPanelAuth: {diff --git a/frontend/src/scenes/authentication/signup/variants/legacy/LegacySignup.tsx b/frontend/src/scenes/authentication/signup/variants/legacy/LegacySignup.tsxindex 831ceee43fa6..9859dd154f23 100644--- a/frontend/src/scenes/authentication/signup/variants/legacy/LegacySignup.tsx+++ b/frontend/src/scenes/authentication/signup/variants/legacy/LegacySignup.tsx@@ -14,7 +14,7 @@ import { Region } from '~/types'import { SignupForm } from '../../signupForm/SignupForm'-export function LegacySignup(): JSX.Element | null {+function Signup(): JSX.Element | null {const { preflight } = useValues(preflightLogic)const { user } = useValues(userLogic)const { featureFlags } = useValues(featureFlagLogic)@@ -116,3 +116,5 @@ export function SignupLeftContainer(): JSX.Element {</>)}++export { Signup as LegacySignup }diff --git a/frontend/src/scenes/authentication/signup/variants/paper-desk/PaperDeskSignup.tsx b/frontend/src/scenes/authentication/signup/variants/paper-desk/PaperDeskSignup.tsxnew file mode 100644index 000000000000..8001648a7313--- /dev/null+++ b/frontend/src/scenes/authentication/signup/variants/paper-desk/PaperDeskSignup.tsx@@ -0,0 +1,451 @@+import { useActions, useValues } from 'kea'+import { Form } from 'kea-forms'+import { useState } from 'react'++import { getCookie } from 'lib/api'+import PasswordStrength from 'lib/components/PasswordStrength'+import SignupReferralSource from 'lib/components/SignupReferralSource'+import SignupRoleSelect from 'lib/components/SignupRoleSelect'+import passkeyLogo from 'lib/components/SocialLoginButton/passkey.svg'+import { SocialLoginButtons } from 'lib/components/SocialLoginButton/SocialLoginButton'+import { LemonButton } from 'lib/lemon-ui/LemonButton'+import { LemonField } from 'lib/lemon-ui/LemonField'+import { LemonInput } from 'lib/lemon-ui/LemonInput/LemonInput'+import { Link } from 'lib/lemon-ui/Link'+import { CardTitle } from 'scenes/authentication/shared/paperDesk/CardTitle'+import { PaperDeskCard, PaperDeskScene } from 'scenes/authentication/shared/paperDesk/PaperDeskScene'+import { RegionField } from 'scenes/authentication/shared/paperDesk/RegionField'+import { TurnstileChallenge } from 'scenes/authentication/signup/signupForm/TurnstileChallenge'+import { preflightLogic } from 'scenes/PreflightCheck/preflightLogic'+import { userLogic } from 'scenes/userLogic'++import { LoginMethod } from '~/types'++import { signupLogic } from '../../signupForm/signupLogic'++const NOTES: Record<number, string[]> = {+ 0: ['// create an account', '// 1M events free, every month'],+ 1: ['// step 2 of 2', '// make it a good one'],+ 2: ['// almost there', '// last step'],+}++/** Step 1 — email (+ region, social, pending-invite branch). */+function SignupEmailPanel(): JSX.Element {+ const { isSignupPanelEmailSubmitting, signupPanelEmailManualErrors, pendingInvite, loginUrl, emailCaseNotice } =+ useValues(signupLogic)+ const { preflight } = useValues(preflightLogic)+ const [showJoinOrg, setShowJoinOrg] = useState(false)+ const lastLoginMethod = getCookie('ph_last_login_method') as LoginMethod | null+ const accountExists = !!signupPanelEmailManualErrors?.email++ if (pendingInvite) {+ return <PendingInvitePanel />+ }++ const footer = preflight?.demo ? undefined : (+ <p className="mt-5 mb-0 text-sm text-secondary text-center">+ Already have an account?{' '}+ <Link+ to={loginUrl}+ data-attr="signup-login-link"+ className="font-semibold no-underline cursor-pointer hover:underline hover:underline-offset-2 text-warning"+ >+ Log in →+ </Link>+ </p>+ )++ return (+ <PaperDeskCard footer={footer}>+ <CardTitle title="Get started" sub="No credit card. No sales call. Just hogs." />+ <Form logic={signupLogic} formKey="signupPanelEmail" enableFormOnSubmit className="flex flex-col gap-4">+ <RegionField />+ <LemonField+ name="email"+ label="Email"+ help={emailCaseNotice && <span className="text-warning">{emailCaseNotice}</span>}+ >+ {({ value, onChange, error, id }) => (+ <LemonInput+ id={id}+ className="ph-ignore-input"+ data-attr="signup-email"+ type="email"+ autoFocus+ autoComplete="email"+ placeholder="[email protected]"+ value={value ?? ''}+ onChange={onChange}+ status={error ? 'danger' : 'default'}+ fullWidth+ />+ )}+ </LemonField>+ {accountExists && (+ <p className="text-xs text-danger -mt-2">+ <Link+ to={loginUrl}+ className="font-semibold no-underline cursor-pointer hover:underline hover:underline-offset-2 text-warning"+ >+ Log in instead →+ </Link>+ </p>+ )}+ <LemonButton+ type="primary"+ size="large"+ center+ fullWidth+ htmlType="submit"+ data-attr="signup-start"+ loading={isSignupPanelEmailSubmitting}+ >+ Continue+ </LemonButton>+ </Form>+ {!preflight?.demo && (+ <SocialLoginButtons+ topDivider+ caption="or sign up with"+ lastUsedProvider={lastLoginMethod ?? undefined}+ captionLocation="top"+ />+ )}+ {!preflight?.demo && (+ <div className="mt-4 text-center">+ <button+ type="button"+ data-attr="signup-join-existing-org"+ className="font-semibold no-underline cursor-pointer hover:underline hover:underline-offset-2 text-secondary text-xs"+ onClick={() => setShowJoinOrg((v) => !v)}+ >+ Trying to join an existing organization?+ </button>+ {showJoinOrg && (+ <p className="PaperDesk__note mt-3 py-3 px-3.5 text-xs leading-relaxed text-secondary text-left bg-[#fbfbf9] border border-dashed border-[#c5c6bd] rounded">+ You'll need your invite link. When a teammate invites you, we email you a personal link.+ Didn't get one? Check spam, or ask them to resend it from their members settings.+ </p>+ )}+ </div>+ )}+ </PaperDeskCard>+ )+}++function PendingInvitePanel(): JSX.Element {+ const { signupPanelEmail, pendingInvite, pendingInviteResent, isPendingInviteResending } = useValues(signupLogic)+ const { resendPendingInvite, dismissPendingInvite } = useActions(signupLogic)+ const org = pendingInvite?.organization_name ?? 'your team'++ return (+ <PaperDeskCard>+ <CardTitle+ title="You've already been invited"+ sub={+ <span>+ <b className="text-primary">{org}</b> invited{' '}+ <span className="PaperDesk__mono">{signupPanelEmail.email}</span> to join them on PostHog. The+ invite link is in your inbox.+ </span>+ }+ className="mb-5"+ />+ {pendingInviteResent ? (+ <div className="flex gap-2 items-start py-2.5 px-3 text-sm text-primary text-left bg-success-highlight border border-success rounded">+ <span className="font-bold text-success">✓</span>+ <span>Sent. Look for an email from {org} — the link inside takes you straight in.</span>+ </div>+ ) : (+ <div className="flex flex-col gap-2.5">+ <LemonButton+ type="primary"+ size="large"+ center+ fullWidth+ data-attr="pending-invite-resend"+ loading={isPendingInviteResending}+ onClick={() => resendPendingInvite(signupPanelEmail.email)}+ >+ Resend invite email+ </LemonButton>+ <LemonButton+ size="large"+ center+ fullWidth+ data-attr="pending-invite-create-own-org"+ onClick={() => dismissPendingInvite()}+ >+ I'd rather create my own organization+ </LemonButton>+ </div>+ )}+ </PaperDeskCard>+ )+}++/** Step 2 — passkey or password. */+function SignupAuthPanel(): JSX.Element {+ const {+ signupPanelEmail,+ isSignupPanelAuthSubmitting,+ validatedPassword,+ passkeySignupEnabled,+ passkeyRegistered,+ isPasskeyRegistering,+ passkeyError,+ } = useValues(signupLogic)+ const { registerPasskey, setPanel } = useActions(signupLogic)++ const footer = (+ <>+ <p className="PaperDesk__terms mt-5 mb-0 text-xs leading-relaxed text-tertiary text-center">+ By creating an account, you agree to our{' '}+ <Link to="https://posthog.com/terms" target="_blank">+ Terms of Service ↗+ </Link>{' '}+ and{' '}+ <Link to="https://posthog.com/privacy" target="_blank">+ Privacy Policy ↗+ </Link>+ .+ </p>+ <p className="mt-3 mb-0 text-sm text-secondary text-center">+ <Link+ onClick={() => setPanel(0)}+ className="font-semibold no-underline cursor-pointer hover:underline hover:underline-offset-2 text-warning"+ >+ ← Use a different email+ </Link>+ </p>+ </>+ )++ return (+ <PaperDeskCard footer={footer}>+ <CardTitle+ title="Secure your account"+ sub={+ <span>+ Signing up as <span className="PaperDesk__mono">{signupPanelEmail.email}</span>+ </span>+ }+ />+ {passkeyError && (+ <div className="mb-4 py-2.5 px-3 text-sm leading-normal text-primary text-left bg-danger-highlight border border-danger rounded">+ {passkeyError}+ </div>+ )}+ {passkeySignupEnabled &&+ (passkeyRegistered ? (+ <div className="PaperDesk__note text-center py-3 px-3.5 text-xs leading-relaxed text-secondary bg-[#fbfbf9] border border-dashed border-[#c5c6bd] rounded">+ Passkey registered. Continue below.+ </div>+ ) : (+ <LemonButton+ type="secondary"+ size="large"+ fullWidth+ icon={<img src={passkeyLogo} alt="Passkey" className="object-contain w-7 h-7" />}+ onClick={registerPasskey}+ loading={isPasskeyRegistering}+ disabled={isPasskeyRegistering}+ data-attr="signup-passkey"+ center+ >+ Sign up with a passkey+ </LemonButton>+ ))}+ {!passkeyRegistered && (+ <div className="my-4 flex gap-3 items-center">+ <span className="flex-1 h-px bg-[#e0e1d9]" />+ <span className="text-xs text-secondary whitespace-nowrap">or use a password</span>+ <span className="flex-1 h-px bg-[#e0e1d9]" />+ </div>+ )}+ <Form logic={signupLogic} formKey="signupPanelAuth" enableFormOnSubmit className="flex flex-col gap-4">+ {!passkeyRegistered && (+ <LemonField+ name="password"+ label={+ <div className="flex items-baseline justify-between w-full">+ <span>Password</span>+ <PasswordStrength validatedPassword={validatedPassword} />+ </div>+ }+ >+ {({ value, onChange, error, id }) => (+ <LemonInput+ id={id}+ className="ph-ignore-input"+ data-attr="password"+ type="password"+ autoFocus+ autoComplete="new-password"+ placeholder="••••••••••"+ value={value ?? ''}+ onChange={onChange}+ status={error ? 'danger' : 'default'}+ fullWidth+ />+ )}+ </LemonField>+ )}+ <LemonButton+ type="primary"+ size="large"+ center+ fullWidth+ htmlType="submit"+ data-attr="signup-auth-continue"+ loading={isSignupPanelAuthSubmitting}+ disabledReason={+ !passkeyRegistered && validatedPassword.feedback ? validatedPassword.feedback : undefined+ }+ >+ Create account+ </LemonButton>+ </Form>+ </PaperDeskCard>+ )+}++/** Step 3 — profile (name, organization, role, referral), like the legacy onboarding. */+function SignupProfilePanel(): JSX.Element {+ const {+ isSignupPanelOnboardingSubmitting,+ signupPanelOnboardingManualErrors,+ challengeRequired,+ turnstileSiteKey,+ turnstileToken,+ signupPanelEmail,+ } = useValues(signupLogic)+ const { preflight } = useValues(preflightLogic)+ const { setTurnstileToken, setPanel } = useActions(signupLogic)++ const submitLabel = !preflight?.demo+ ? 'Create account'+ : !isSignupPanelOnboardingSubmitting+ ? 'Enter the demo environment'+ : 'Preparing demo data…'++ const footer = (+ <>+ <p className="PaperDesk__terms mt-5 mb-0 text-xs leading-relaxed text-tertiary text-center">+ By {preflight?.demo ? 'entering the demo environment' : 'creating an account'}, you agree to our{' '}+ <Link to="https://posthog.com/terms" target="_blank">+ Terms of Service ↗+ </Link>{' '}+ and{' '}+ <Link to="https://posthog.com/privacy" target="_blank">+ Privacy Policy ↗+ </Link>+ .+ </p>+ {!preflight?.demo && (+ <p className="mt-5 mb-0 text-sm text-secondary text-center">+ <Link+ onClick={() => setPanel(1)}+ className="font-semibold no-underline cursor-pointer hover:underline hover:underline-offset-2 text-warning"+ >+ ← or go back+ </Link>+ </p>+ )}+ </>+ )++ return (+ <PaperDeskCard footer={footer}>+ <CardTitle+ title="Tell us about yourself"+ sub={+ <span>+ Setting up the account for <span className="PaperDesk__mono">{signupPanelEmail.email}</span>+ </span>+ }+ />+ {signupPanelOnboardingManualErrors?.generic && (+ <div className="mb-4 py-2.5 px-3 text-sm leading-normal text-primary text-left bg-danger-highlight border border-danger rounded">+ {signupPanelOnboardingManualErrors.generic.detail || 'Could not complete your signup.'}+ </div>+ )}+ <Form+ logic={signupLogic}+ formKey="signupPanelOnboarding"+ enableFormOnSubmit+ className="flex flex-col gap-4"+ >+ <LemonField name="name" label="Your name">+ {({ value, onChange, error, id }) => (+ <LemonInput+ id={id}+ className="ph-ignore-input"+ data-attr="signup-name"+ autoFocus+ placeholder="Jane Doe"+ autoComplete="name"+ value={value ?? ''}+ onChange={onChange}+ status={error ? 'danger' : 'default'}+ fullWidth+ />+ )}+ </LemonField>+ <LemonField name="organization_name" label="Organization name">+ {({ value, onChange, error, id }) => (+ <LemonInput+ id={id}+ className="ph-ignore-input"+ data-attr="signup-organization-name"+ placeholder="Hogflix Movies"+ value={value ?? ''}+ onChange={onChange}+ status={error ? 'danger' : 'default'}+ fullWidth+ />+ )}+ </LemonField>+ <SignupRoleSelect />+ <SignupReferralSource disabled={isSignupPanelOnboardingSubmitting} />+ {challengeRequired && turnstileSiteKey ? (+ <TurnstileChallenge+ siteKey={turnstileSiteKey}+ onSuccess={setTurnstileToken}+ tokenReceived={!!turnstileToken}+ email={signupPanelEmail.email}+ />+ ) : (+ <LemonButton+ type="primary"+ size="large"+ center+ fullWidth+ htmlType="submit"+ data-attr="signup-submit"+ loading={isSignupPanelOnboardingSubmitting}+ >+ {submitLabel}+ </LemonButton>+ )}+ </Form>+ </PaperDeskCard>+ )+}++function Signup(): JSX.Element | null {+ const { user } = useValues(userLogic)+ const { panel } = useValues(signupLogic)++ if (user) {+ return null+ }++ return (+ <PaperDeskScene notes={NOTES[panel] ?? NOTES[0]}>+ {panel === 0 ? <SignupEmailPanel /> : panel === 1 ? <SignupAuthPanel /> : <SignupProfilePanel />}+ </PaperDeskScene>+ )+}++export { Signup as PaperDeskSignup }diff --git a/frontend/src/scenes/authentication/signup/variants/redesign-2026-06-02/SignupV2.tsx b/frontend/src/scenes/authentication/signup/variants/redesign-2026-06-02/SignupV2.tsxdeleted file mode 100644index e9210b99f40d..000000000000--- a/frontend/src/scenes/authentication/signup/variants/redesign-2026-06-02/SignupV2.tsx+++ /dev/null@@ -1,18 +0,0 @@-import { useValues } from 'kea'--import { BridgePage } from 'lib/components/BridgePage/BridgePage'-import { userLogic } from 'scenes/userLogic'--// TODO: build the redesign-2026-06-02 signup; renders under the `auth-flow-variant` flag.-export function SignupV2(): JSX.Element | null {- const { user } = useValues(userLogic)-- return !user ? (- <BridgePage view="signup" sideLogo>- <div className="deprecated-space-y-4">- <h2>Create your account</h2>- <p className="text-secondary">Redesigned signup — coming soon.</p>- </div>- </BridgePage>- ) : null-}diff --git a/frontend/src/scenes/authentication/verify-email/PaperDeskVerifyEmail.stories.tsx b/frontend/src/scenes/authentication/verify-email/PaperDeskVerifyEmail.stories.tsxnew file mode 100644index 000000000000..5f98ccc5d581--- /dev/null+++ b/frontend/src/scenes/authentication/verify-email/PaperDeskVerifyEmail.stories.tsx@@ -0,0 +1,68 @@+import type { Meta, StoryFn } from '@storybook/react'+import { useEffect } from 'react'++import { FEATURE_FLAGS } from 'lib/constants'++import { useStorybookMocks } from '~/mocks/browser'+import preflightJson from '~/mocks/fixtures/_preflight.json'++import { VerifyEmail } from './VerifyEmail'+import { verifyEmailLogic } from './verifyEmailLogic'++type VerifyEmailView = 'pending' | 'verify' | 'success' | 'invalid'++type StoryArgs = {+ view: VerifyEmailView+}++const meta: Meta<StoryArgs> = {+ title: 'Scenes-Other/Verify Email (paper-desk)',+ tags: ['test-skip'],+ parameters: {+ layout: 'fullscreen',+ viewMode: 'story',+ featureFlags: { [FEATURE_FLAGS.AUTH_FLOW_VARIANT]: 'paper-desk' },+ },+ argTypes: {+ view: {+ control: 'select',+ name: 'View',+ options: ['pending', 'verify', 'success', 'invalid'] satisfies VerifyEmailView[],+ },+ },+ args: {+ view: 'pending',+ },+}+export default meta++const Template: StoryFn<StoryArgs> = ({ view }) => {+ useStorybookMocks({+ get: {+ '/_preflight': { ...preflightJson },+ '/api/users/@me': () => [200, { email: '[email protected]', first_name: 'Test' }],+ },+ })++ useEffect(() => {+ verifyEmailLogic.actions.setView(view)+ verifyEmailLogic.actions.setUuid('12345678')+ }, [view])++ return <VerifyEmail />+}++export const Default: StoryFn<StoryArgs> = Template.bind({})++export const Pending: StoryFn<StoryArgs> = Template.bind({})+Pending.args = { view: 'pending' }++export const Verifying: StoryFn<StoryArgs> = Template.bind({})+Verifying.args = { view: 'verify' }+Verifying.parameters = { testOptions: { waitForLoadersToDisappear: false } }++export const Success: StoryFn<StoryArgs> = Template.bind({})+Success.args = { view: 'success' }++export const InvalidLink: StoryFn<StoryArgs> = Template.bind({})+InvalidLink.args = { view: 'invalid' }diff --git a/frontend/src/scenes/authentication/verify-email/VerifyEmail.tsx b/frontend/src/scenes/authentication/verify-email/VerifyEmail.tsxindex 2338b2e5c060..2757ff04b92e 100644--- a/frontend/src/scenes/authentication/verify-email/VerifyEmail.tsx+++ b/frontend/src/scenes/authentication/verify-email/VerifyEmail.tsx@@ -1,18 +1,10 @@-import './VerifyEmail.scss'+import { useValues } from 'kea'-import clsx from 'clsx'-import { useActions, useValues } from 'kea'-import { useState } from 'react'--import { LemonButton, LemonCheckbox, LemonModal, Link } from '@posthog/lemon-ui'--import { BridgePage } from 'lib/components/BridgePage/BridgePage'-import { HeartHog, MailHog, SurprisedHog } from 'lib/components/hedgehogs'-import { supportLogic } from 'lib/components/Support/supportLogic'-import { Spinner } from 'lib/lemon-ui/Spinner/Spinner'+import { featureFlagLogic } from 'lib/logic/featureFlagLogic'import { SceneExport } from 'scenes/sceneTypes'-import { urls } from 'scenes/urls'+import { authFlowVariantRegistry } from '../authFlowVariantRegistry'+import { resolveAuthFlowVariant } from '../authFlowVariants'import { verifyEmailLogic } from './verifyEmailLogic'export const scene: SceneExport = {@@ -20,171 +12,8 @@ export const scene: SceneExport = {logic: verifyEmailLogic,}-interface SupportButtonsProps {- disabledReason?: string-}--const SupportButtons = ({ disabledReason }: SupportButtonsProps): JSX.Element => {- const { openSupportForm } = useActions(supportLogic)- const { requestVerificationLink } = useActions(verifyEmailLogic)- const { uuid } = useValues(verifyEmailLogic)-- return (- <div className="flex flex-row gap-x-4 justify-start">- <LemonButton- type="primary"- disabledReason={disabledReason}- onClick={() => {- openSupportForm({ kind: 'bug', target_area: 'login' })- }}- >- Contact support- </LemonButton>- {uuid && (- <LemonButton- type="primary"- disabledReason={disabledReason}- onClick={() => {- requestVerificationLink(uuid)- }}- >- Request a new link- </LemonButton>- )}- </div>- )-}--export const VerifyEmailHelpLinks = (): JSX.Element => {- const [checkListValues, setCheckListValues] = useState<boolean[]>([])-- const checklist = [- 'Wait 5 minutes. Sometimes it takes a bit for email providers to deliver emails.',- 'Check your spam folder and any firewalls you may have active',- 'Ask your company IT department to allow any emails from @posthog.com',- 'Channel your inner hedgehog and take another peek at your inbox',- ]-- const handleChecklistChange = (index: number): void => {- const newCheckListValues = [...checkListValues]- newCheckListValues[index] = !newCheckListValues[index]- setCheckListValues(newCheckListValues)- }-- const allChecked = checklist.every((_, index) => checkListValues[index])-- return (- <div className="bg-primary p-4 rounded relative w-full max-w-160">- <div className="flex flex-col justify-center">- <div className="deprecated-space-y-2 text-left">- {checklist.map((item, index) => (- <LemonCheckbox- key={index}- onChange={() => handleChecklistChange(index)}- checked={checkListValues[index]}- label={item}- bordered- size="small"- />- ))}- </div>- </div>- <div className="mt-4">- <p className="text-left mb-2">Choose one of the following options:</p>- <SupportButtons- disabledReason={!allChecked ? "Please confirm you've done all the steps above" : undefined}- />- </div>- </div>- )-}--const GetHelp = (): JSX.Element => {- const [isOpen, setIsOpen] = useState(false)- return (- <>- <LemonButton type="primary" onClick={() => setIsOpen(true)}>- Get help- </LemonButton>- <LemonModal- isOpen={isOpen}- onClose={() => setIsOpen(false)}- title="Get help"- description={- <p className="max-w-160">- Sorry you're having troubles! We're here to help, but first we ask that you check a few things- first on your end. Generally any issues with email happen after they leave our hands.- </p>- }- >- <VerifyEmailHelpLinks />- </LemonModal>- </>- )-}-export function VerifyEmail(): JSX.Element {- const { view } = useValues(verifyEmailLogic)-- return (- <div className="flex h-full flex-col">- <div className="flex h-full">- <BridgePage view="verifyEmail" fixedWidth={false}>- <div className="px-12 py-8 text-center flex flex-col items-center max-w-160 w-full relative">- {view === 'pending' ? (- <>- <h2 className="text-lg">Welcome to PostHog!</h2>- <h1 className="text-3xl font-bold">Let's verify your email address.</h1>- <div className="max-w-60 my-10">- <MailHog className="w-full h-full" />- </div>- <p className="mb-6">An email has been sent with a link to verify your email address.</p>- <GetHelp />- </>- ) : view === 'verify' ? (- <>- <Spinner className="text-4xl mb-12" />- <p>Verifying your email address...</p>- </>- ) : view === 'success' ? (- <>- <h1 className="text-3xl font-bold">Success!</h1>- <div className="max-w-60 mb-12">- <HeartHog className="w-full h-full" />- </div>- <p>Thanks for verifying your email address. Now taking you to PostHog...</p>- </>- ) : view === 'invalid' ? (- <>- <h1 className="text-3xl font-bold">Whoops!</h1>- <div className="max-w-60 mb-12">- <SurprisedHog className="w-full h-full" />- </div>- <p className="mb-6">Seems like that link isn't quite right. Try again?</p>-- <SupportButtons />-- <p className="text-xs text-muted mt-6">- If you've already verified your email, then{' '}- <Link to={urls.login()}>log in here</Link>.- </p>- </>- ) : (- <Spinner className="text-4xl" />- )}- {view === 'success' && (- <div aria-hidden className="VerifyEmail__ProgressBar">- <div- className={clsx(- 'VerifyEmail__ProgressBarTrack',- process.env.STORYBOOK && 'VerifyEmail__ProgressBarTrack--static'- )}- />- </div>- )}- </div>- </BridgePage>- </div>- </div>- )+ const { featureFlags } = useValues(featureFlagLogic)+ const { VerifyEmail: VariantVerifyEmail } = authFlowVariantRegistry[resolveAuthFlowVariant(featureFlags)]+ return <VariantVerifyEmail />}diff --git a/frontend/src/scenes/authentication/verify-email/variants/legacy/LegacyVerifyEmail.tsx b/frontend/src/scenes/authentication/verify-email/variants/legacy/LegacyVerifyEmail.tsxnew file mode 100644index 000000000000..7be4b39ba2c0--- /dev/null+++ b/frontend/src/scenes/authentication/verify-email/variants/legacy/LegacyVerifyEmail.tsx@@ -0,0 +1,186 @@+import '../../VerifyEmail.scss'++import clsx from 'clsx'+import { useActions, useValues } from 'kea'+import { useState } from 'react'++import { LemonButton, LemonCheckbox, LemonModal, Link } from '@posthog/lemon-ui'++import { BridgePage } from 'lib/components/BridgePage/BridgePage'+import { HeartHog, MailHog, SurprisedHog } from 'lib/components/hedgehogs'+import { supportLogic } from 'lib/components/Support/supportLogic'+import { Spinner } from 'lib/lemon-ui/Spinner/Spinner'+import { urls } from 'scenes/urls'++import { verifyEmailLogic } from '../../verifyEmailLogic'++interface SupportButtonsProps {+ disabledReason?: string+}++const SupportButtons = ({ disabledReason }: SupportButtonsProps): JSX.Element => {+ const { openSupportForm } = useActions(supportLogic)+ const { requestVerificationLink } = useActions(verifyEmailLogic)+ const { uuid } = useValues(verifyEmailLogic)++ return (+ <div className="flex flex-row gap-x-4 justify-start">+ <LemonButton+ type="primary"+ disabledReason={disabledReason}+ onClick={() => {+ openSupportForm({ kind: 'bug', target_area: 'login' })+ }}+ >+ Contact support+ </LemonButton>+ {uuid && (+ <LemonButton+ type="primary"+ disabledReason={disabledReason}+ onClick={() => {+ requestVerificationLink(uuid)+ }}+ >+ Request a new link+ </LemonButton>+ )}+ </div>+ )+}++export const VerifyEmailHelpLinks = (): JSX.Element => {+ const [checkListValues, setCheckListValues] = useState<boolean[]>([])++ const checklist = [+ 'Wait 5 minutes. Sometimes it takes a bit for email providers to deliver emails.',+ 'Check your spam folder and any firewalls you may have active',+ 'Ask your company IT department to allow any emails from @posthog.com',+ 'Channel your inner hedgehog and take another peek at your inbox',+ ]++ const handleChecklistChange = (index: number): void => {+ const newCheckListValues = [...checkListValues]+ newCheckListValues[index] = !newCheckListValues[index]+ setCheckListValues(newCheckListValues)+ }++ const allChecked = checklist.every((_, index) => checkListValues[index])++ return (+ <div className="bg-primary p-4 rounded relative w-full max-w-160">+ <div className="flex flex-col justify-center">+ <div className="deprecated-space-y-2 text-left">+ {checklist.map((item, index) => (+ <LemonCheckbox+ key={index}+ onChange={() => handleChecklistChange(index)}+ checked={checkListValues[index]}+ label={item}+ bordered+ size="small"+ />+ ))}+ </div>+ </div>+ <div className="mt-4">+ <p className="text-left mb-2">Choose one of the following options:</p>+ <SupportButtons+ disabledReason={!allChecked ? "Please confirm you've done all the steps above" : undefined}+ />+ </div>+ </div>+ )+}++const GetHelp = (): JSX.Element => {+ const [isOpen, setIsOpen] = useState(false)+ return (+ <>+ <LemonButton type="primary" onClick={() => setIsOpen(true)}>+ Get help+ </LemonButton>+ <LemonModal+ isOpen={isOpen}+ onClose={() => setIsOpen(false)}+ title="Get help"+ description={+ <p className="max-w-160">+ Sorry you're having troubles! We're here to help, but first we ask that you check a few things+ first on your end. Generally any issues with email happen after they leave our hands.+ </p>+ }+ >+ <VerifyEmailHelpLinks />+ </LemonModal>+ </>+ )+}++function VerifyEmail(): JSX.Element {+ const { view } = useValues(verifyEmailLogic)++ return (+ <div className="flex h-full flex-col">+ <div className="flex h-full">+ <BridgePage view="verifyEmail" fixedWidth={false}>+ <div className="px-12 py-8 text-center flex flex-col items-center max-w-160 w-full relative">+ {view === 'pending' ? (+ <>+ <h2 className="text-lg">Welcome to PostHog!</h2>+ <h1 className="text-3xl font-bold">Let's verify your email address.</h1>+ <div className="max-w-60 my-10">+ <MailHog className="w-full h-full" />+ </div>+ <p className="mb-6">An email has been sent with a link to verify your email address.</p>+ <GetHelp />+ </>+ ) : view === 'verify' ? (+ <>+ <Spinner className="text-4xl mb-12" />+ <p>Verifying your email address...</p>+ </>+ ) : view === 'success' ? (+ <>+ <h1 className="text-3xl font-bold">Success!</h1>+ <div className="max-w-60 mb-12">+ <HeartHog className="w-full h-full" />+ </div>+ <p>Thanks for verifying your email address. Now taking you to PostHog...</p>+ </>+ ) : view === 'invalid' ? (+ <>+ <h1 className="text-3xl font-bold">Whoops!</h1>+ <div className="max-w-60 mb-12">+ <SurprisedHog className="w-full h-full" />+ </div>+ <p className="mb-6">Seems like that link isn't quite right. Try again?</p>++ <SupportButtons />++ <p className="text-xs text-muted mt-6">+ If you've already verified your email, then{' '}+ <Link to={urls.login()}>log in here</Link>.+ </p>+ </>+ ) : (+ <Spinner className="text-4xl" />+ )}+ {view === 'success' && (+ <div aria-hidden className="VerifyEmail__ProgressBar">+ <div+ className={clsx(+ 'VerifyEmail__ProgressBarTrack',+ process.env.STORYBOOK && 'VerifyEmail__ProgressBarTrack--static'+ )}+ />+ </div>+ )}+ </div>+ </BridgePage>+ </div>+ </div>+ )+}++export { VerifyEmail as LegacyVerifyEmail }diff --git a/frontend/src/scenes/authentication/verify-email/variants/paper-desk/PaperDeskVerifyEmail.tsx b/frontend/src/scenes/authentication/verify-email/variants/paper-desk/PaperDeskVerifyEmail.tsxnew file mode 100644index 000000000000..6247f246e00b--- /dev/null+++ b/frontend/src/scenes/authentication/verify-email/variants/paper-desk/PaperDeskVerifyEmail.tsx@@ -0,0 +1,239 @@+import { useActions, useValues } from 'kea'+import { useState } from 'react'++import { DetectiveHog, ExplorerHog, SleepingHog } from 'lib/components/hedgehogs'+import { supportLogic } from 'lib/components/Support/supportLogic'+import { LemonButton } from 'lib/lemon-ui/LemonButton'+import { Link } from 'lib/lemon-ui/Link'+import { Spinner } from 'lib/lemon-ui/Spinner/Spinner'+import { PaperDeskCard, PaperDeskScene } from 'scenes/authentication/shared/paperDesk/PaperDeskScene'+import { urls } from 'scenes/urls'++import { verifyEmailLogic } from '../../verifyEmailLogic'++const NOTES: Record<string, string[]> = {+ pending: ['// one email away', '// we just hit send'],+ success: ['// verified', '// go explore'],+ invalid: ['// that link expired', '// happens to the best of us'],+ verify: ['// hold tight', '// verifying'],+}++const CHECKLIST = [+ 'Wait 5 minutes, some email providers take a beat',+ 'Check spam and any firewalls you run',+ 'Channel your inner hedgehog and peek again',+]++function NotSeeingIt(): JSX.Element {+ const { openSupportForm } = useActions(supportLogic)+ const [open, setOpen] = useState(false)+ const [checked, setChecked] = useState<boolean[]>([])+ const allChecked = CHECKLIST.every((_, i) => checked[i])++ return (+ <>+ <button+ type="button"+ className="font-semibold no-underline cursor-pointer hover:underline hover:underline-offset-2 text-secondary text-xs"+ onClick={() => setOpen((v) => !v)}+ >+ Not seeing it?+ </button>+ {open && (+ <div className="PaperDesk__note mt-3 w-full py-3 px-3.5 text-xs leading-relaxed text-secondary text-left bg-[#fbfbf9] border border-dashed border-[#c5c6bd] rounded">+ <p className="m-0 mb-2.5 font-semibold text-primary">Before we escalate, three quick checks:</p>+ <div className="flex flex-col gap-2">+ {CHECKLIST.map((item, i) => (+ <label key={i} className="flex items-start gap-2.5">+ <input+ type="checkbox"+ checked={!!checked[i]}+ onChange={() =>+ setChecked((prev) => {+ const next = [...prev]+ next[i] = !next[i]+ return next+ })+ }+ />+ <span>{item}</span>+ </label>+ ))}+ </div>+ <LemonButton+ size="large"+ center+ className="mt-3"+ fullWidth+ disabledReason={+ !allChecked ? `Contact support (${checked.filter(Boolean).length}/3 checked)` : undefined+ }+ onClick={() =>+ openSupportForm({+ kind: 'bug',+ target_area: 'login',+ })+ }+ >+ Contact support+ </LemonButton>+ </div>+ )}+ </>+ )+}++function VerifyEmail(): JSX.Element {+ const { view, uuid, user } = useValues(verifyEmailLogic)+ const { requestVerificationLink } = useActions(verifyEmailLogic)+ const { openSupportForm } = useActions(supportLogic)++ const notes = NOTES[view ?? 'pending'] ?? NOTES.pending++ if (view === 'success') {+ return (+ <PaperDeskScene notes={notes}>+ <PaperDeskCard>+ <div className="flex flex-col items-center text-center">+ <ExplorerHog className="block w-auto mx-auto h-32" />+ <h1 className="m-0 mt-3 font-title text-2xl font-extrabold leading-tight text-primary text-center tracking-tight">+ You're verified, go explore!+ </h1>+ <p className="PaperDesk__sub mt-2 mb-5 text-sm text-secondary text-center text-pretty">+ Email confirmed. Next up: a quick setup. Your org, your team, your first events.+ </p>+ <div className="PaperDesk__progress mb-4 w-full h-1.5 overflow-hidden bg-[#e0e1d9] rounded-sm">+ <div className="PaperDesk__progress-fill w-full h-full bg-warning rounded-sm" />+ </div>+ <p className="m-0 text-sm text-secondary text-center">Taking you to PostHog…</p>+ </div>+ </PaperDeskCard>+ </PaperDeskScene>+ )+ }++ if (view === 'invalid') {+ return (+ <PaperDeskScene notes={notes}>+ <PaperDeskCard+ footer={+ <p className="mt-5 mb-0 text-sm text-secondary text-center">+ Already verified?{' '}+ <Link+ to={urls.login()}+ className="font-semibold no-underline cursor-pointer hover:underline hover:underline-offset-2 text-warning"+ >+ Log in →+ </Link>+ </p>+ }+ >+ <div className="flex flex-col items-center text-center">+ <SleepingHog className="block w-auto mx-auto h-28" />+ <h1 className="m-0 mt-3 font-title text-2xl font-extrabold leading-tight text-primary text-center tracking-tight">+ This link fell asleep+ </h1>+ <p className="PaperDesk__sub mt-2 mb-5 text-sm text-secondary text-center text-pretty">+ Verification links last 24 hours, and this one's past its bedtime. Request a fresh one and+ we'll get you in.+ </p>+ <div className="flex w-full flex-col gap-2.5">+ {uuid && (+ <LemonButton+ type="primary"+ size="large"+ center+ fullWidth+ onClick={() => requestVerificationLink(uuid)}+ >+ Email me a new link+ </LemonButton>+ )}+ <LemonButton+ size="large"+ center+ fullWidth+ onClick={() =>+ openSupportForm({+ kind: 'bug',+ target_area: 'login',+ })+ }+ >+ Contact support+ </LemonButton>+ </div>+ </div>+ </PaperDeskCard>+ </PaperDeskScene>+ )+ }++ if (view === 'verify') {+ return (+ <PaperDeskScene notes={notes}>+ <PaperDeskCard>+ <div className="flex flex-col items-center gap-4 text-center">+ <Spinner className="text-4xl" />+ <p className="PaperDesk__sub m-0 text-sm text-secondary text-center text-pretty">+ Verifying your email address…+ </p>+ </div>+ </PaperDeskCard>+ </PaperDeskScene>+ )+ }++ // pending — check inbox+ return (+ <PaperDeskScene notes={notes}>+ <PaperDeskCard+ footer={+ <p className="mt-5 mb-0 text-sm text-secondary text-center">+ Wrong address?{' '}+ <Link+ to={urls.signup()}+ className="font-semibold no-underline cursor-pointer hover:underline hover:underline-offset-2 text-warning"+ >+ Start over →+ </Link>+ </p>+ }+ >+ <div className="flex flex-col items-center text-center">+ <DetectiveHog className="block w-auto mx-auto h-28" />+ <h1 className="m-0 mt-3 font-title text-2xl font-extrabold leading-tight text-primary text-center tracking-tight">+ Check your inbox+ </h1>+ <p className="PaperDesk__sub mt-2 mb-2.5 text-sm text-secondary text-center text-pretty">+ We sent a verification link to+ </p>+ {user?.email && (+ <span className="mb-4 inline-block py-1 px-2.5 font-mono text-sm font-regular text-primary bg-[#fbfbf9] border border-[#e0e1d9] rounded">+ {user.email}+ </span>+ )}+ <p className="PaperDesk__sub mt-0 mb-4 text-sm text-secondary text-center text-pretty">+ Click the link inside and you're in. The link is valid for 24 hours.+ </p>+ {uuid && (+ <LemonButton+ type="primary"+ size="large"+ center+ fullWidth+ onClick={() => requestVerificationLink(uuid)}+ >+ Resend email+ </LemonButton>+ )}+ <div className="mt-3.5">+ <NotSeeingIt />+ </div>+ </div>+ </PaperDeskCard>+ </PaperDeskScene>+ )+}++export { VerifyEmail as PaperDeskVerifyEmail }