@pisell/pisellos 3.0.69 → 3.0.71

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -49,6 +49,7 @@ export interface RequestOptions {
49
49
  responseType?: 'json' | 'text' | 'arraybuffer' | 'blob';
50
50
  withCredentials?: boolean;
51
51
  useCache?: boolean;
52
+ customToast?: () => void;
52
53
  }
53
54
  /**
54
55
  * 响应接口
@@ -0,0 +1,87 @@
1
+ /**
2
+ * 注册登录解决方案配置
3
+ * 根据不同渠道配置不同的接口地址和参数
4
+ */
5
+ /**
6
+ * API 配置接口
7
+ */
8
+ export interface ApiConfig {
9
+ url: string;
10
+ method: 'GET' | 'POST' | 'PUT' | 'DELETE';
11
+ transformParams?: (params: any) => any;
12
+ transformResponse?: (response: any) => any;
13
+ options?: Record<string, any>;
14
+ }
15
+ /**
16
+ * 渠道配置接口
17
+ */
18
+ export interface ChannelConfig {
19
+ sendEmailVerificationCode: ApiConfig;
20
+ sendEmailLoginCode: ApiConfig;
21
+ sendSmsRegisterCode: ApiConfig;
22
+ sendEmailRegisterLink: ApiConfig;
23
+ verifyEmailRegistrationLink: ApiConfig;
24
+ emailPasswordLogin: ApiConfig;
25
+ emailCodeRegister: ApiConfig;
26
+ phoneCodeRegister: ApiConfig;
27
+ resendEmailRegisterLink: ApiConfig;
28
+ checkEmailLinkCode: ApiConfig;
29
+ sendSmsLoginCode: ApiConfig;
30
+ phoneCodeLogin: ApiConfig;
31
+ guestLogin: ApiConfig;
32
+ checkEmailExists: ApiConfig;
33
+ checkEmailCode: ApiConfig;
34
+ checkMobileCode: ApiConfig;
35
+ phonePasswordLogin: ApiConfig;
36
+ sendPasswordResetEmail: ApiConfig;
37
+ sendPasswordResetSms: ApiConfig;
38
+ sendResetPasswordLink: ApiConfig;
39
+ checkResetPasswordCode: ApiConfig;
40
+ resetPasswordByCode: ApiConfig;
41
+ resetPasswordByEmail: ApiConfig;
42
+ resetPasswordByPhone: ApiConfig;
43
+ verifyCode: ApiConfig;
44
+ register: ApiConfig;
45
+ login: ApiConfig;
46
+ oauthLogin: ApiConfig;
47
+ validateToken: ApiConfig;
48
+ logout: ApiConfig;
49
+ getCountries: ApiConfig;
50
+ facebookLogin: ApiConfig;
51
+ appleLogin: ApiConfig;
52
+ }
53
+ /**
54
+ * 渠道配置映射
55
+ */
56
+ export declare const channelConfigMap: Record<string, ChannelConfig>;
57
+ /**
58
+ * 获取渠道配置
59
+ */
60
+ export declare function getChannelConfig(channel: string): ChannelConfig;
61
+ /**
62
+ * API 调用器类
63
+ * 负责根据配置执行 API 调用
64
+ */
65
+ export declare class ApiCaller {
66
+ private request;
67
+ private config;
68
+ constructor(request: {
69
+ get: <T = any>(url: string, data?: any, options?: any) => Promise<T>;
70
+ post: <T = any>(url: string, data?: any, options?: any) => Promise<T>;
71
+ put: <T = any>(url: string, data?: any, options?: any) => Promise<T>;
72
+ delete: <T = any>(url: string, options?: any) => Promise<T>;
73
+ }, config: ChannelConfig);
74
+ /**
75
+ * 执行 API 调用
76
+ */
77
+ call<T = any>(apiName: keyof ChannelConfig, params?: any, additionalOptions?: any): Promise<T>;
78
+ }
79
+ /**
80
+ * 创建 API 调用器
81
+ */
82
+ export declare function createApiCaller(request: {
83
+ get: <T = any>(url: string, data?: any, options?: any) => Promise<T>;
84
+ post: <T = any>(url: string, data?: any, options?: any) => Promise<T>;
85
+ put: <T = any>(url: string, data?: any, options?: any) => Promise<T>;
86
+ delete: <T = any>(url: string, options?: any) => Promise<T>;
87
+ }, channel: string): ApiCaller;