import React from 'react'; import { UIConfig, LoginFormData, AuthMethodType, LoginMethodItem, LegalTermsConfig, OAuthConfig } from './shared/types'; import './index.less'; /** 登录组件配置 */ export interface Login2Config { /** * 登录方式配置数组 * 数组顺序决定显示顺序,第一项为默认登录方式 */ loginMethods: LoginMethodItem[]; /** UI 配置 */ ui?: UIConfig; /** 三方 OAuth 配置 */ oauth?: OAuthConfig; /** 渠道标识 - 用于区分不同来源的登录请求 */ channel?: string; /** 法律条款配置 */ legalTerms?: LegalTermsConfig; /** 邮件链接验证配置 - 从邮件链接进入重置密码时使用 */ emailLinkVerification?: { /** 是否启用邮件链接验证模式 */ enabled: boolean; /** 从URL参数获取的验证码 */ code: string; }; } /** 登录组件事件 */ export interface Login2Events { /** 登录回调 */ onLogin?: (originResult: any, method: AuthMethodType, data: LoginFormData, channel?: string) => Promise | void; /** 三方登录回调 */ onOAuthLogin?: (provider: 'google' | 'facebook' | 'apple', channel?: string) => Promise | void; /** 发送验证码回调 */ onSendVerificationCode?: (account: string, type: 'email' | 'phone', channel?: string) => Promise | void; /** 忘记密码回调 */ onForgotPassword?: (account: string, channel?: string) => Promise | void; /** 切换到注册回调 */ onSwitchToRegister?: () => void; /** 错误处理回调 */ onError?: (error: any, method?: AuthMethodType) => void; } /** 登录组件属性 */ export interface Login2Props extends Login2Events { /** 配置对象 */ config: Login2Config; /** 是否显示 */ visible?: boolean; /** 关闭回调 */ onClose?: () => void; /** 自定义类名 */ className?: string; /** 自定义样式 */ style?: React.CSSProperties; } /** * 登录 2.0 组件 * 支持邮箱、手机、三方登录 * 组件宽度固定 360px */ declare const Login2: React.FC; export default Login2;