import React from 'react'; import { EmailAuthConfig, PhoneAuthConfig, OAuthConfig, UIConfig, RegisterFormData, AuthMethodType, RegistrationMethodItem, LegalTermsConfig } from './shared/types'; import './index.less'; import './steps/steps.less'; /** 注册组件配置 */ export interface Register2Config { /** 注册方式列表 - 数组顺序决定显示顺序,第一项为默认注册方式 */ registrationMethods?: RegistrationMethodItem[]; /** 邮箱认证配置(向后兼容,建议使用 registrationMethods) */ email?: EmailAuthConfig; /** 手机认证配置(向后兼容,建议使用 registrationMethods) */ phone?: PhoneAuthConfig; /** 三方 OAuth 配置(向后兼容,建议使用 registrationMethods) */ oauth?: OAuthConfig; /** UI 配置 */ ui?: UIConfig; /** 默认认证方式(向后兼容,建议使用 registrationMethods) */ defaultAuthMethod?: AuthMethodType; /** 渠道标识 - 用于区分不同来源的注册请求 */ channel?: string; /** 邮件链接验证模式 - 从邮件链接跳转过来 */ emailLinkVerification?: { /** 是否启用邮件链接验证模式 */ enabled: boolean; /** 验证码(从 URL 参数中获取,如 code=602ec2dc2ab8954b2b7bc63a5d920662) */ code: string; }; /** 法律条款配置 */ legalTerms?: LegalTermsConfig; } /** 注册组件事件 */ export interface Register2Events { /** 注册回调 */ onRegister?: (originResult: any, method: AuthMethodType, data: RegisterFormData, channel?: string) => Promise | void; /** 三方登录回调 */ onOAuthLogin?: (provider: 'google' | 'facebook' | 'apple', channel?: string) => Promise | void; /** 发送验证码回调 */ onSendVerificationCode?: (account: string, type: 'email' | 'phone', channel?: string) => Promise | void; /** 邮件链接过期 - 点击"Back to Registration"按钮回调 */ onEmailLinkExpired?: () => void; /** 跳转到登录页回调 */ onGoToLogin?: () => void; /** 错误处理回调 */ onError?: (error: any, method?: AuthMethodType) => void; } /** 注册组件属性 */ export interface Register2Props extends Register2Events { /** 配置对象 */ config: Register2Config; /** 是否显示 */ visible?: boolean; /** 关闭回调 */ onClose?: () => void; /** 自定义类名 */ className?: string; /** 自定义样式 */ style?: React.CSSProperties; } /** * 注册 2.0 组件 * 支持邮箱、手机、三方注册 * 组件宽度固定 360px */ declare const Register2: React.FC; export default Register2;