/** * 登录注册 2.0 共享类型定义 */ /** 验证方式枚举 */ export declare type VerificationMethod = 'verification_code' | 'password'; /** 邮箱注册验证方式 */ export declare type EmailRegistrationVerification = 'verification_link' | 'verification_code' | 'none'; /** 手机注册验证方式 */ export declare type PhoneRegistrationVerification = 'verification_code'; /** 认证方式类型 */ export declare type AuthMethodType = 'email' | 'phone' | 'google' | 'facebook' | 'apple' | 'guest'; /** 登录方式项类型 */ export declare type LoginMethodType = 'email' | 'phone' | 'google' | 'facebook' | 'apple' | 'guest'; export interface PhoneValueObject { phone: string; country_calling_code: string; } /** 邮箱登录方式项 */ export interface EmailLoginMethod { type: 'email'; /** 启用的验证方式(按顺序),第一个为默认方式 */ verificationMethods: Array<'password' | 'verification_code'>; /** 密码登录是否分步骤填写(先输入邮箱,再输入密码) */ stepByStep?: boolean; } /** 手机登录方式项 */ export interface PhoneLoginMethod { type: 'phone'; /** 启用的验证方式(按顺序),第一个为默认方式 */ verificationMethods: Array<'password' | 'verification_code'>; /** 密码登录是否分步骤填写(先输入手机号,再输入密码) */ stepByStep?: boolean; } /** Google 登录方式项 */ export interface GoogleLoginMethod { type: 'google'; /** Google Client ID */ clientId?: string; } /** Facebook 登录方式项 */ export interface FacebookLoginMethod { type: 'facebook'; /** Facebook App ID */ appId?: string; } /** Apple 登录方式项 */ export interface AppleLoginMethod { type: 'apple'; /** Apple Client ID */ clientId?: string; } /** Guest 登录方式项 */ export interface GuestLoginMethod { type: 'guest'; } /** 注册方式类型 */ export declare type RegistrationMethodType = 'email' | 'phone' | 'google' | 'facebook' | 'apple'; /** 邮箱注册方式项 */ export interface EmailRegistrationMethod { type: 'email'; /** 注册验证方式(邮箱支持验证链接/验证码/无需验证) */ verificationMethod: 'verification_link' | 'verification_code' | 'none'; } /** 手机注册方式项 */ export interface PhoneRegistrationMethod { type: 'phone'; /** 注册验证方式(手机仅支持验证码) */ verificationMethod: 'verification_code'; } /** Google 注册方式项 */ export interface GoogleRegistrationMethod { type: 'google'; /** Google Client ID */ clientId?: string; } /** Facebook 注册方式项 */ export interface FacebookRegistrationMethod { type: 'facebook'; /** Facebook App ID */ appId?: string; } /** Apple 注册方式项 */ export interface AppleRegistrationMethod { type: 'apple'; /** Apple Client ID */ clientId?: string; } /** 注册方式项联合类型 */ export declare type RegistrationMethodItem = EmailRegistrationMethod | PhoneRegistrationMethod | GoogleRegistrationMethod | FacebookRegistrationMethod | AppleRegistrationMethod; /** 法律条款项 */ export interface LegalTermItem { /** 条款名称 - 支持国际化对象或简单字符串 */ name: string | { en?: string; 'zh-CN'?: string; 'zh-HK'?: string; 'ja'?: string; 'pt'?: string; original?: string; }; /** 条款链接 */ url: string; } /** 法律条款配置 */ export interface LegalTermsConfig { /** 是否显示法律条款区域 */ enabled?: boolean; /** 法律条款列表 */ terms?: LegalTermItem[]; /** 条款文本模板 */ textTemplate?: string; /** 当前模式:login 或 register */ mode?: 'login' | 'register'; } /** 登录方式项联合类型 */ export declare type LoginMethodItem = EmailLoginMethod | PhoneLoginMethod | GoogleLoginMethod | FacebookLoginMethod | AppleLoginMethod | GuestLoginMethod; /** 邮箱认证配置 */ export interface EmailAuthConfig { /** 是否启用邮箱认证 */ enable_email: boolean; /** 注册验证方式 */ registration_verification?: EmailRegistrationVerification; /** 登录验证方式列表 */ login_verification_methods?: VerificationMethod[]; } /** 手机认证配置 */ export interface PhoneAuthConfig { /** 是否启用手机认证 */ enable_phone_number: boolean; /** 注册验证方式 */ registration_verification?: PhoneRegistrationVerification; /** 登录验证方式列表 */ login_verification_methods?: VerificationMethod[]; } /** 三方 OAuth 配置 */ export interface OAuthConfig { /** Google 登录 */ google?: { enabled: boolean; client_id?: string; }; /** Facebook 登录 */ facebook?: { enabled: boolean; app_id?: string; }; /** Apple 登录 */ apple?: { enabled: boolean; client_id?: string; }; } /** UI 配置 */ export interface UIConfig { /** Logo 配置 */ logo?: { show: boolean; url?: string; position?: 'left' | 'center' | 'right'; size?: { width: number; height: number; }; }; /** 标题配置 */ title?: { show: boolean; text?: string; align?: 'left' | 'center' | 'right'; }; /** 副标题配置 */ subtitle?: { show: boolean; text?: string; align?: 'left' | 'center' | 'right'; }; /** 描述配置 */ desc?: { show: boolean; text?: string; align?: 'left' | 'center' | 'right'; }; /** 表单标签配置 */ formLabels?: { /** 邮箱标签配置 */ email?: { show: boolean; text?: string; }; /** 手机标签配置 */ phone?: { show: boolean; text?: string; }; /** 密码标签配置 */ password?: { show: boolean; text?: string; }; /** 验证码标签配置 */ verificationCode?: { show: boolean; text?: string; }; }; /** 密码规则 */ passwordRules?: any; /** 主题色 */ themeColor?: string; } /** 登录表单数据 */ export interface LoginFormData { /** 邮箱或手机号 */ account: string | PhoneValueObject; /** 密码 */ password?: string; /** 验证码 */ verification_code?: string; /** 记住我 */ remember_me?: boolean; } /** 注册表单数据 */ export interface RegisterFormData { /** 邮箱或手机号 */ account: string; /** 密码 */ password?: string; /** 确认密码 */ confirm_password?: string; /** 验证码 */ verification_code?: string; /** 验证链接 token */ verification_token?: string; }