import { z } from "zod"; import { getCurrentAuthRedirect, getOAuthSignedQuery, } from "@/lib/auth-redirect"; import { isHostedClientAuthMode } from "@/lib/auth-mode"; import { getFieldError as getSharedFieldError, getFormError as getSharedFormError, } from "@/client/lib/forms"; export const authRedirectSearchSchema = z.object({ redirect: z.string().optional(), }); export function useAuthPageState(redirect: string | undefined) { const redirectTo = getCurrentAuthRedirect(redirect); const oauthQuery = typeof window !== "undefined" ? getOAuthSignedQuery(window.location.search) : null; const isHostedMode = isHostedClientAuthMode(); return { redirectTo, oauthQuery, isHostedMode, }; } export function getFieldError(errors: readonly unknown[]) { return getSharedFieldError(errors); } export function getFormError(error: unknown) { return getSharedFormError(error); } export function AuthMethodChooser({ googleLabel, emailLabel = "Continue with email", isBusy, disabled, onContinueWithGoogle, onContinueWithEmail, }: { googleLabel: string; emailLabel?: string; isBusy?: boolean; disabled?: boolean; onContinueWithGoogle: () => void; onContinueWithEmail: () => void; }) { return (
); } function GoogleLogo() { return ( ); } export function AuthPageCard({ title, helperText, children, footer, }: { title: string; helperText?: string; children: React.ReactNode; footer?: React.ReactNode; }) { return (
OpenSEO

{title}

{helperText ? (

{helperText}

) : null}
{children} {footer ?
{footer}
: null}
); } export function AuthPageShell({ children }: { children: React.ReactNode }) { return (
{children}
); }