@authing/react-ui-components 4.0.3-alpha.0 → 4.0.3-hep.1
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.
- package/lib/index.min.css +2 -2
- package/lib/index.min.js +1 -1
- package/package.json +1 -1
- package/types/AccountMerge/UserRadio.d.ts +5 -0
- package/types/AccountMerge/index.d.ts +3 -0
- package/types/AccountMerge/interface.d.ts +27 -0
- package/types/AccountMerge/utils.d.ts +3 -0
- package/types/BindTotp/api/constant.d.ts +2 -0
- package/types/BindTotp/api/index.d.ts +19 -0
- package/types/ChangePassword/api/index.d.ts +3 -0
- package/types/CompleteInfo/api/constant.d.ts +1 -0
- package/types/CompleteInfo/api/index.d.ts +4 -0
- package/types/CompleteInfo/api/request.d.ts +8 -0
- package/types/CompleteInfo/businessRequest.d.ts +1 -1
- package/types/CompleteInfo/core/components/TreeSelect.d.ts +11 -0
- package/types/CompleteInfo/index.d.ts +1 -0
- package/types/CompleteInfo/interface.d.ts +8 -4
- package/types/CompleteInfo/utils.d.ts +7 -1
- package/types/ForgetPassword/api/constant.d.ts +1 -0
- package/types/ForgetPassword/api/index.d.ts +1 -0
- package/types/ForgetPassword/api/request.d.ts +24 -0
- package/types/Guard/api/constant.d.ts +2 -0
- package/types/Guard/api/index.d.ts +13 -0
- package/types/Guard/core/componentsMapping.d.ts +8 -0
- package/types/Guard/core/hooks/useBusinessRequest.d.ts +14 -0
- package/types/Guard/core/hooks/useCss.d.ts +5 -0
- package/types/Guard/core/hooks/useEvents.d.ts +15 -0
- package/types/Guard/core/hooks/useFDA.d.ts +20 -0
- package/types/Guard/core/hooks/useModule.d.ts +16 -0
- package/types/Guard/module.d.ts +2 -0
- package/types/IdentityBinding/api/index.d.ts +1 -0
- package/types/IdentityBinding/api/request.d.ts +1 -0
- package/types/IdentityBindingAsk/api/index.d.ts +9 -0
- package/types/Login/api/constant.d.ts +6 -0
- package/types/Login/api/index.d.ts +1 -0
- package/types/Login/api/request.d.ts +114 -0
- package/types/Login/core/withWeComQrcode.d.ts +2 -0
- package/types/MFA/api/constant.d.ts +6 -0
- package/types/MFA/api/index.d.ts +2 -0
- package/types/MFA/api/request.d.ts +50 -0
- package/types/MFA/interface.d.ts +1 -0
- package/types/NeedHelpView/api/constant.d.ts +1 -0
- package/types/NeedHelpView/api/index.d.ts +1 -0
- package/types/NeedHelpView/api/request.d.ts +12 -0
- package/types/Qrcode/api/constant.d.ts +3 -0
- package/types/Qrcode/api/index.d.ts +1 -0
- package/types/Qrcode/api/request.d.ts +44 -0
- package/types/RecoveryCode/api/constant.d.ts +1 -0
- package/types/RecoveryCode/api/index.d.ts +1 -0
- package/types/RecoveryCode/api/request.d.ts +10 -0
- package/types/Register/api/constant.d.ts +2 -0
- package/types/Register/api/index.d.ts +2 -0
- package/types/Register/api/request.d.ts +57 -0
- package/types/Register/core/WithCode.d.ts +5 -0
- package/types/SelfUnlock/api/index.d.ts +1 -0
- package/types/SendCode/api/index.d.ts +1 -0
- package/types/Type/application.d.ts +3 -0
- package/types/ValidatorRules/api/index.d.ts +1 -0
- package/types/_utils/actions/index.d.ts +23 -0
- package/types/_utils/hooks/index.d.ts +0 -4
- package/types/_utils/http/api/constant.d.ts +7 -0
- package/types/_utils/http/api/index.d.ts +1 -0
- package/types/_utils/http/api/request.d.ts +72 -0
- package/types/_utils/http/base/index.d.ts +10 -0
- package/types/_utils/http/constant.d.ts +46 -0
- package/types/_utils/http/events/index.d.ts +16 -0
- package/types/_utils/http/events/modal/login.d.ts +62 -0
- package/types/_utils/http/events/modal/register.d.ts +73 -0
- package/types/_utils/http/events/utils.d.ts +25 -0
- package/types/_utils/http/header/index.d.ts +41 -0
- package/types/_utils/http/index.d.ts +6 -0
- package/types/_utils/http/instance.d.ts +2 -0
- package/types/_utils/http/interceptors/request.d.ts +6 -0
- package/types/_utils/http/interceptors/response.d.ts +43 -0
- package/types/_utils/http/utils.d.ts +20 -0
- package/types/_utils/responseManagement/interface.d.ts +1 -0
- package/types/version/version.d.ts +1 -1
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import { AxiosRequestConfig } from 'axios';
|
|
2
|
+
/**
|
|
3
|
+
* 邮箱验证码注册
|
|
4
|
+
* @param data
|
|
5
|
+
* @param config
|
|
6
|
+
* @returns
|
|
7
|
+
*/
|
|
8
|
+
export declare const registerEmailCodeByAxios: (data: {
|
|
9
|
+
email: string;
|
|
10
|
+
code: string;
|
|
11
|
+
profile: {
|
|
12
|
+
browser: string | null;
|
|
13
|
+
device: string | null | undefined;
|
|
14
|
+
};
|
|
15
|
+
context: string;
|
|
16
|
+
generateToken: boolean;
|
|
17
|
+
password?: string;
|
|
18
|
+
postUserInfoPipeline?: boolean;
|
|
19
|
+
params?: string;
|
|
20
|
+
}, config?: AxiosRequestConfig<any> | undefined) => Promise<import("../../_utils/http").AuthingGuardResponse<any>>;
|
|
21
|
+
/**
|
|
22
|
+
* 短信验证码注册
|
|
23
|
+
* @param data
|
|
24
|
+
* @param config
|
|
25
|
+
*/
|
|
26
|
+
export declare const registerSmsCodeByAxios: (data: {
|
|
27
|
+
phone: string;
|
|
28
|
+
code: string;
|
|
29
|
+
phoneCountryCode?: string;
|
|
30
|
+
profile: {
|
|
31
|
+
browser: string | null;
|
|
32
|
+
device: string | null | undefined;
|
|
33
|
+
};
|
|
34
|
+
forceLogin: boolean;
|
|
35
|
+
generateToken: boolean;
|
|
36
|
+
params?: string;
|
|
37
|
+
context?: string;
|
|
38
|
+
postUserInfoPipeline?: boolean;
|
|
39
|
+
}, config?: AxiosRequestConfig<any> | undefined) => Promise<import("../../_utils/http").AuthingGuardResponse<any>>;
|
|
40
|
+
/**
|
|
41
|
+
* 邮箱密码注册
|
|
42
|
+
* @param data
|
|
43
|
+
* @param config
|
|
44
|
+
*/
|
|
45
|
+
export declare const registerEmailPasswordByAxios: (data: {
|
|
46
|
+
email: string;
|
|
47
|
+
password: string;
|
|
48
|
+
profile: {
|
|
49
|
+
browser: string | null;
|
|
50
|
+
device: string | null | undefined;
|
|
51
|
+
};
|
|
52
|
+
forceLogin: boolean;
|
|
53
|
+
generateToken: boolean;
|
|
54
|
+
params?: string;
|
|
55
|
+
context?: string;
|
|
56
|
+
postUserInfoPipeline?: boolean;
|
|
57
|
+
}, config?: AxiosRequestConfig<any> | undefined) => Promise<import("../../_utils/http").AuthingGuardResponse<any>>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { authFlowByAxios } from 'service/api';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { sendEmailCodeByAxios } from 'service/api';
|
|
@@ -251,6 +251,9 @@ export interface ApplicationConfig {
|
|
|
251
251
|
verifyCodeLength: number;
|
|
252
252
|
websocket: string;
|
|
253
253
|
welcomeMessage: any;
|
|
254
|
+
userPortal?: {
|
|
255
|
+
mergeAccount?: boolean;
|
|
256
|
+
};
|
|
254
257
|
skipComplateFileds: boolean;
|
|
255
258
|
selfUnlockStrategy: 'captcha' | 'password-captcha';
|
|
256
259
|
defaultLanguageConfig: Lang;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { validateAccountByAxios } from 'service/api';
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Response Action 是否为渲染信息
|
|
3
|
+
* @param parseStatusCode
|
|
4
|
+
* @returns
|
|
5
|
+
*/
|
|
6
|
+
export declare const isRenderMessageByStatusCode: (parseStatusCode: number) => boolean;
|
|
7
|
+
/**
|
|
8
|
+
* Response Action 是否为内部流程状态处理(交由业务处理)
|
|
9
|
+
* @param parseStatusCode
|
|
10
|
+
* @param apiCode
|
|
11
|
+
*/
|
|
12
|
+
export declare const isFlowBusinessByStatusCode: (parseStatusCode: number) => boolean;
|
|
13
|
+
/**
|
|
14
|
+
* Response Action 是否为流程结束
|
|
15
|
+
* @param parseStatusCode
|
|
16
|
+
* @param apiCode
|
|
17
|
+
*/
|
|
18
|
+
export declare const isFlowEndByStatusCode: (parseStatusCode: number, apiCode: number) => boolean;
|
|
19
|
+
/**
|
|
20
|
+
* Response Action 是否为下个流程
|
|
21
|
+
* @param parseStatusCode
|
|
22
|
+
*/
|
|
23
|
+
export declare const isNextFlowByStatusCode: (parseStatusCode: number, apiCode: number) => boolean;
|
|
@@ -28,10 +28,6 @@ export declare const parsePhone: (isInternationSms: boolean, fieldValue: string,
|
|
|
28
28
|
countryCode: string | undefined;
|
|
29
29
|
phoneNumber: string;
|
|
30
30
|
};
|
|
31
|
-
export declare enum SocialConnectionEvent {
|
|
32
|
-
Message = "message",
|
|
33
|
-
Auth = "auth"
|
|
34
|
-
}
|
|
35
31
|
/**
|
|
36
32
|
*
|
|
37
33
|
* @param config
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export declare const authFlowUrl: () => string;
|
|
2
|
+
export declare const VerifyEmailUrl: () => string;
|
|
3
|
+
export declare const validateAccountUrl: () => string;
|
|
4
|
+
export declare const countryListsUrl: () => string;
|
|
5
|
+
export declare const validatePhoneCodeUrl: () => string;
|
|
6
|
+
export declare const validateEmailCodeUrl: () => string;
|
|
7
|
+
export declare const sendPhoneCodeUrl: () => string;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './request';
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
import { AxiosRequestConfig } from 'axios';
|
|
2
|
+
import { EmailScene, SceneType } from 'components/Type';
|
|
3
|
+
/**
|
|
4
|
+
* AuthFlow 相关请求
|
|
5
|
+
* @param data
|
|
6
|
+
*/
|
|
7
|
+
export declare const authFlowByAxios: <A = string, T = any>(data: {
|
|
8
|
+
action: A;
|
|
9
|
+
data?: any;
|
|
10
|
+
}, config?: AxiosRequestConfig<any> | undefined) => Promise<import("../../http").AuthingGuardResponse<T>>;
|
|
11
|
+
/**
|
|
12
|
+
* 发送邮箱验证码
|
|
13
|
+
* @param data
|
|
14
|
+
*/
|
|
15
|
+
export declare const sendEmailCodeByAxios: (data: {
|
|
16
|
+
email: string;
|
|
17
|
+
scene: EmailScene;
|
|
18
|
+
}, config?: AxiosRequestConfig<any> | undefined) => Promise<import("../../http").AuthingGuardResponse<any>>;
|
|
19
|
+
/**
|
|
20
|
+
* 账号登陆前置校验
|
|
21
|
+
*/
|
|
22
|
+
export interface ValidateAccountParams<T = any> {
|
|
23
|
+
/**
|
|
24
|
+
* publicConfig.userPoolId
|
|
25
|
+
*/
|
|
26
|
+
userPoolId?: string;
|
|
27
|
+
/**
|
|
28
|
+
* 校验的输入值
|
|
29
|
+
*/
|
|
30
|
+
key: T;
|
|
31
|
+
/**
|
|
32
|
+
* 本次校验类型
|
|
33
|
+
*/
|
|
34
|
+
type: 'phone' | 'email' | 'username';
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* 登陆/注册 前置,校验(用户/手机/邮箱)是否存在/用户是否不存在
|
|
38
|
+
* @param params
|
|
39
|
+
* @returns {Promise<boolean>} 是否通过
|
|
40
|
+
*/
|
|
41
|
+
export declare const validateAccountByAxios: <T = boolean>(params: ValidateAccountParams) => Promise<import("../../http").AuthingGuardResponse<T>>;
|
|
42
|
+
/**
|
|
43
|
+
* 拉取国家列表
|
|
44
|
+
*/
|
|
45
|
+
export declare const getCountryLists: <T extends string>() => Promise<import("../../http").AuthingGuardResponse<Record<T, {
|
|
46
|
+
zh: {
|
|
47
|
+
[props: string]: string;
|
|
48
|
+
};
|
|
49
|
+
cn: {
|
|
50
|
+
[props: string]: string;
|
|
51
|
+
};
|
|
52
|
+
}>>>;
|
|
53
|
+
/**
|
|
54
|
+
* 验证手机号验证码是否正确
|
|
55
|
+
*/
|
|
56
|
+
export declare const validatePhoneCodeByAxios: (data: {
|
|
57
|
+
phone: number | string;
|
|
58
|
+
phoneCode: number | string;
|
|
59
|
+
phoneCountryCode?: number | string;
|
|
60
|
+
}, config?: AxiosRequestConfig<any> | undefined) => Promise<import("../../http").AuthingGuardResponse<any>>;
|
|
61
|
+
/**
|
|
62
|
+
* 验证邮箱验证码是否正确
|
|
63
|
+
*/
|
|
64
|
+
export declare const validateEmailCodeByAxios: (data: {
|
|
65
|
+
email: number | string;
|
|
66
|
+
emailCode: number | string;
|
|
67
|
+
}, config?: AxiosRequestConfig<any> | undefined) => Promise<import("../../http").AuthingGuardResponse<any>>;
|
|
68
|
+
export declare const sendSmsCodeByAxios: (data: {
|
|
69
|
+
phone: string;
|
|
70
|
+
phoneCountryCode?: string;
|
|
71
|
+
scene?: SceneType;
|
|
72
|
+
}, config?: AxiosRequestConfig<any> | undefined) => Promise<import("../../http").AuthingGuardResponse<any>>;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { AuthenticationClient } from 'authing-js-sdk';
|
|
2
|
+
/**
|
|
3
|
+
* 修改 baseUrl 配置
|
|
4
|
+
*/
|
|
5
|
+
export declare const setBaseUrl: (baseUrl: string) => void;
|
|
6
|
+
export declare const setAuthClient: (client: AuthenticationClient) => void;
|
|
7
|
+
/**
|
|
8
|
+
* 设置加密公钥
|
|
9
|
+
*/
|
|
10
|
+
export declare const setPublishByEncrypt: (publishKey?: string | undefined) => void;
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { AuthingResponse } from './interceptors/response';
|
|
2
|
+
import { GuardModuleType } from '../../Guard/module';
|
|
3
|
+
import JSEncrypt from 'jsencrypt';
|
|
4
|
+
/**
|
|
5
|
+
* 加密实例
|
|
6
|
+
*/
|
|
7
|
+
export declare const encryptedInstance: JSEncrypt;
|
|
8
|
+
export declare enum CodeAction {
|
|
9
|
+
CHANGE_MODULE = "changeModule",
|
|
10
|
+
RENDER_MESSAGE = "renderMessage",
|
|
11
|
+
INNER_MODULE = "innerModule",
|
|
12
|
+
FLOW_END = "flowEnd"
|
|
13
|
+
}
|
|
14
|
+
export declare enum ApiCode {
|
|
15
|
+
IDENTITY_BINDING_ASK = 1641,
|
|
16
|
+
IDENTITY_BINDING = 1640,
|
|
17
|
+
APP_MFA = 1636,
|
|
18
|
+
MFA = 1635,
|
|
19
|
+
ABORT_FLOW = 1699,
|
|
20
|
+
COMPLETE_INFO = 1642,
|
|
21
|
+
UNLOCK = 1643,
|
|
22
|
+
FLOW_END = 1600,
|
|
23
|
+
FIRST_LOGIN_PASSWORD = 1639,
|
|
24
|
+
FORCED_PASSWORD_RESET = 2058
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* APi Code 对应的模块映射
|
|
28
|
+
*/
|
|
29
|
+
export declare const ChangeModuleApiCodeMapping: Record<string, GuardModuleType>;
|
|
30
|
+
/**
|
|
31
|
+
* 高阶函数 记录每次请求的 responseData
|
|
32
|
+
* 同时根据返回的 apiCode 对应的 action 处理
|
|
33
|
+
* @param responseData
|
|
34
|
+
* @returns
|
|
35
|
+
*/
|
|
36
|
+
export declare const getCodeActionMapping: (responseData: AuthingResponse) => {
|
|
37
|
+
/**
|
|
38
|
+
* 返回的 apiCode 匹配跳转模块时
|
|
39
|
+
* @param responseData
|
|
40
|
+
* @returns
|
|
41
|
+
*/
|
|
42
|
+
changeModule: () => CodeAction;
|
|
43
|
+
renderMessage: () => CodeAction;
|
|
44
|
+
innerModule: () => CodeAction;
|
|
45
|
+
flowEnd: () => CodeAction;
|
|
46
|
+
};
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { AxiosRequestConfig, AxiosResponse } from 'axios';
|
|
2
|
+
import { AuthingGuardResponse } from 'components/_utils/http';
|
|
3
|
+
import { setLoginEvents, setRegisterEvents } from './utils';
|
|
4
|
+
/**
|
|
5
|
+
* 请求前置事件处理
|
|
6
|
+
* 比如 beforeLogin / beforeRegister
|
|
7
|
+
* @param config
|
|
8
|
+
* @returns
|
|
9
|
+
*/
|
|
10
|
+
declare const processBeforeRequestEvent: (config: AxiosRequestConfig) => Promise<boolean>;
|
|
11
|
+
/**
|
|
12
|
+
* 响应器拦截 Events
|
|
13
|
+
* @param response
|
|
14
|
+
*/
|
|
15
|
+
declare const processEventsByResponse: (response: AxiosResponse<AuthingGuardResponse>) => void;
|
|
16
|
+
export { setLoginEvents, setRegisterEvents, processEventsByResponse, processBeforeRequestEvent, };
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import { AuthenticationClient } from 'authing-js-sdk';
|
|
2
|
+
import { AuthingResponse } from 'service/interceptors/response';
|
|
3
|
+
declare class LoginEventsManage {
|
|
4
|
+
private static instance;
|
|
5
|
+
private successEvent;
|
|
6
|
+
private failEvent;
|
|
7
|
+
private constructor();
|
|
8
|
+
/**
|
|
9
|
+
* 设置登录成功的回调函数
|
|
10
|
+
*/
|
|
11
|
+
private setSuccessEvent;
|
|
12
|
+
/**
|
|
13
|
+
* 设置失败成功的回调函数
|
|
14
|
+
*/
|
|
15
|
+
private setFailEvent;
|
|
16
|
+
/**
|
|
17
|
+
* 获取登录成功的回调函数
|
|
18
|
+
*/
|
|
19
|
+
private getSuccessEvents;
|
|
20
|
+
/**
|
|
21
|
+
* 获取失败成功的回调函数
|
|
22
|
+
*/
|
|
23
|
+
private getFailEvents;
|
|
24
|
+
/**
|
|
25
|
+
* 判断本次响应是否算做成功的方法
|
|
26
|
+
*/
|
|
27
|
+
private isLoginSuccess;
|
|
28
|
+
/**
|
|
29
|
+
* 触发登录成功事件
|
|
30
|
+
* @param responseData
|
|
31
|
+
*/
|
|
32
|
+
private emitSuccessEvent;
|
|
33
|
+
/**
|
|
34
|
+
* 触发登录失败事件
|
|
35
|
+
* @param responseData
|
|
36
|
+
*/
|
|
37
|
+
private emitFailEvent;
|
|
38
|
+
/**
|
|
39
|
+
* 当前是否请求失败
|
|
40
|
+
* statusCode 4xx 5xx 请求失败
|
|
41
|
+
*/
|
|
42
|
+
private isLoginFail;
|
|
43
|
+
/**
|
|
44
|
+
* 统一触发事件
|
|
45
|
+
* @param responseData
|
|
46
|
+
* @param client
|
|
47
|
+
*/
|
|
48
|
+
private emitEvents;
|
|
49
|
+
/**
|
|
50
|
+
* 获取登录事件实例
|
|
51
|
+
*/
|
|
52
|
+
static getInstance: () => LoginEventsManage;
|
|
53
|
+
getCallableMethod(): {
|
|
54
|
+
getSuccessEvents: () => ((user: import("authing-js-sdk").User, authClient: AuthenticationClient) => void) | null | undefined;
|
|
55
|
+
setSuccessEvent: (successEvents: ((user: import("authing-js-sdk").User, authClient: AuthenticationClient) => void) | undefined) => void;
|
|
56
|
+
setFailEvent: (failEvent: ((errorMessages: any) => void) | undefined) => void;
|
|
57
|
+
emitSuccessEvent: (responseData: AuthingResponse<any>, client: AuthenticationClient) => void;
|
|
58
|
+
emitFailEvent: (responseData: AuthingResponse<any>) => void;
|
|
59
|
+
emitEvents: (responseData: AuthingResponse<any>, client: AuthenticationClient) => void;
|
|
60
|
+
};
|
|
61
|
+
}
|
|
62
|
+
export { LoginEventsManage };
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
import { AuthenticationClient } from 'authing-js-sdk';
|
|
2
|
+
import { AuthingResponse } from 'service/interceptors/response';
|
|
3
|
+
declare type ConditionTypeFunction = (responseData: AuthingResponse) => boolean;
|
|
4
|
+
declare class RegisterEventsManage {
|
|
5
|
+
private static instance;
|
|
6
|
+
private successEvent;
|
|
7
|
+
private failEvent;
|
|
8
|
+
private constructor();
|
|
9
|
+
/**
|
|
10
|
+
* 设置注册成功的回调函数
|
|
11
|
+
*/
|
|
12
|
+
private setSuccessEvent;
|
|
13
|
+
/**
|
|
14
|
+
* 设置失败成功的回调函数
|
|
15
|
+
*/
|
|
16
|
+
private setFailEvent;
|
|
17
|
+
/**
|
|
18
|
+
* 获取注册成功的回调函数
|
|
19
|
+
*/
|
|
20
|
+
private getSuccessEvents;
|
|
21
|
+
/**
|
|
22
|
+
* 获取失败成功的回调函数
|
|
23
|
+
*/
|
|
24
|
+
private getFailEvents;
|
|
25
|
+
/**
|
|
26
|
+
* 内置校验:判断本次响应是否算做成功的方法
|
|
27
|
+
*/
|
|
28
|
+
private isRegisterSuccess;
|
|
29
|
+
/**
|
|
30
|
+
* 触发注册成功事件
|
|
31
|
+
* @param responseData
|
|
32
|
+
* @param successCondition 自定义的注册成功事件
|
|
33
|
+
*/
|
|
34
|
+
private emitSuccessEvent;
|
|
35
|
+
/**
|
|
36
|
+
* 触发注册失败事件
|
|
37
|
+
* @param responseData
|
|
38
|
+
* @param failCondition 自定义的请求失败条件
|
|
39
|
+
*/
|
|
40
|
+
private emitFailEvent;
|
|
41
|
+
/**
|
|
42
|
+
* 内置校验:当前是否请求失败
|
|
43
|
+
*/
|
|
44
|
+
private isRegisterFail;
|
|
45
|
+
/**
|
|
46
|
+
* 统一触发事件
|
|
47
|
+
* @param responseData
|
|
48
|
+
* @param client
|
|
49
|
+
*/
|
|
50
|
+
private emitEvents;
|
|
51
|
+
/**
|
|
52
|
+
* 获取注册事件实例
|
|
53
|
+
*/
|
|
54
|
+
static getInstance: () => RegisterEventsManage;
|
|
55
|
+
getCallableMethod(): {
|
|
56
|
+
setSuccessEvent: (successEvents: ((user: import("authing-js-sdk").User, authClient: AuthenticationClient) => void) | undefined) => void;
|
|
57
|
+
setFailEvent: (failEvent: ((error: any) => void) | undefined) => void;
|
|
58
|
+
emitSuccessEvent: (params: {
|
|
59
|
+
responseData: AuthingResponse<any>;
|
|
60
|
+
client: AuthenticationClient;
|
|
61
|
+
condition?: ConditionTypeFunction | undefined;
|
|
62
|
+
}) => void;
|
|
63
|
+
emitFailEvent: (params: {
|
|
64
|
+
responseData: AuthingResponse<any>;
|
|
65
|
+
condition?: ConditionTypeFunction | undefined;
|
|
66
|
+
}) => void;
|
|
67
|
+
emitEvents: (responseData: AuthingResponse<any>, client: AuthenticationClient, options?: {
|
|
68
|
+
successCondition?: ConditionTypeFunction | undefined;
|
|
69
|
+
failCondition?: ConditionTypeFunction | undefined;
|
|
70
|
+
} | undefined) => void;
|
|
71
|
+
};
|
|
72
|
+
}
|
|
73
|
+
export { RegisterEventsManage };
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { LoginEventsManage } from './modal/login';
|
|
2
|
+
import { RegisterEventsManage } from './modal/register';
|
|
3
|
+
/**
|
|
4
|
+
* 内置的登录类型
|
|
5
|
+
*/
|
|
6
|
+
export declare const instanceEventMap: {
|
|
7
|
+
login: typeof LoginEventsManage;
|
|
8
|
+
register: typeof RegisterEventsManage;
|
|
9
|
+
};
|
|
10
|
+
/**
|
|
11
|
+
* 设置登录事件
|
|
12
|
+
* @returns
|
|
13
|
+
*/
|
|
14
|
+
export declare const setLoginEvents: () => {
|
|
15
|
+
setSuccessEvent: ((successEvents: ((user: import("authing-js-sdk").User, authClient: import("authing-js-sdk").AuthenticationClient) => void) | undefined) => void) | ((successEvents: ((user: import("authing-js-sdk").User, authClient: import("authing-js-sdk").AuthenticationClient) => void) | undefined) => void);
|
|
16
|
+
setFailEvent: ((failEvent: ((errorMessages: any) => void) | undefined) => void) | ((failEvent: ((error: any) => void) | undefined) => void);
|
|
17
|
+
};
|
|
18
|
+
/**
|
|
19
|
+
* 设置注册事件
|
|
20
|
+
* @returns
|
|
21
|
+
*/
|
|
22
|
+
export declare const setRegisterEvents: () => {
|
|
23
|
+
setSuccessEvent: ((successEvents: ((user: import("authing-js-sdk").User, authClient: import("authing-js-sdk").AuthenticationClient) => void) | undefined) => void) | ((successEvents: ((user: import("authing-js-sdk").User, authClient: import("authing-js-sdk").AuthenticationClient) => void) | undefined) => void);
|
|
24
|
+
setFailEvent: ((failEvent: ((errorMessages: any) => void) | undefined) => void) | ((failEvent: ((error: any) => void) | undefined) => void);
|
|
25
|
+
};
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 设置 version
|
|
3
|
+
* @param value
|
|
4
|
+
* @param key
|
|
5
|
+
*/
|
|
6
|
+
export declare const setVersionByHeader: (value: string, key?: string) => void;
|
|
7
|
+
/**
|
|
8
|
+
* 设置 sdk version
|
|
9
|
+
* @param value
|
|
10
|
+
* @param key
|
|
11
|
+
*/
|
|
12
|
+
export declare const setSdkVersionByHeader: (value: string, key?: string) => void;
|
|
13
|
+
/**
|
|
14
|
+
* 设置 AppId
|
|
15
|
+
* @param value
|
|
16
|
+
* @param key
|
|
17
|
+
*/
|
|
18
|
+
export declare const setAppIdByRequestHeader: (value: string, key?: string) => void;
|
|
19
|
+
/**
|
|
20
|
+
* 设置 x-authing-app-tenant-id 请求头
|
|
21
|
+
* @param value
|
|
22
|
+
* @param key
|
|
23
|
+
*/
|
|
24
|
+
export declare const setTenantIdByRequestHeader: (value?: string | undefined, key?: string) => void;
|
|
25
|
+
/**
|
|
26
|
+
* 根据 publishConfig 中的 userid 设置
|
|
27
|
+
* @param value
|
|
28
|
+
* @param key
|
|
29
|
+
*/
|
|
30
|
+
export declare const setUserPoolIdByRequestHeader: (value: string, key?: string) => void;
|
|
31
|
+
export declare const setLanguageInRequestHeader: () => void;
|
|
32
|
+
/**
|
|
33
|
+
* 获取当前所有 headers
|
|
34
|
+
*/
|
|
35
|
+
export declare const getHeader: () => import("axios").HeadersDefaults;
|
|
36
|
+
/**
|
|
37
|
+
* 修改/设置请求头
|
|
38
|
+
* @param key
|
|
39
|
+
* @param value
|
|
40
|
+
*/
|
|
41
|
+
export declare const _setRequestHeader: (key: string, value: string) => void;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import instance from './instance';
|
|
2
|
+
import * as httpHeaderMethods from './header';
|
|
3
|
+
import * as httpEvents from './events';
|
|
4
|
+
import * as httpBaseConfig from './base';
|
|
5
|
+
import * as commonRequest from './api/index';
|
|
6
|
+
export { instance, httpHeaderMethods, httpEvents, httpBaseConfig, commonRequest, };
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { AxiosInstance } from 'axios';
|
|
2
|
+
export interface AuthingResponse<T = any> {
|
|
3
|
+
/**
|
|
4
|
+
* 错误码
|
|
5
|
+
*/
|
|
6
|
+
code?: number;
|
|
7
|
+
/**
|
|
8
|
+
* 返回状态
|
|
9
|
+
* 3XX:状态机流转
|
|
10
|
+
* 4XX|6XX:错误处理
|
|
11
|
+
*/
|
|
12
|
+
statusCode?: number;
|
|
13
|
+
/**
|
|
14
|
+
* statusCode 3XX 时下个阶段的 code 码
|
|
15
|
+
*/
|
|
16
|
+
apiCode?: number;
|
|
17
|
+
/**
|
|
18
|
+
* 返回的数据
|
|
19
|
+
*/
|
|
20
|
+
data?: T;
|
|
21
|
+
/**
|
|
22
|
+
*
|
|
23
|
+
*/
|
|
24
|
+
messages?: string;
|
|
25
|
+
/**
|
|
26
|
+
*
|
|
27
|
+
*/
|
|
28
|
+
message?: string;
|
|
29
|
+
/**
|
|
30
|
+
* 当前流程 ID
|
|
31
|
+
* ResponseData 返回则更新当前流程 ID
|
|
32
|
+
*/
|
|
33
|
+
flowHandle?: string;
|
|
34
|
+
/**
|
|
35
|
+
* 响应是否为当前业务内小状态处理
|
|
36
|
+
* statusCode === 200 下进入该状态
|
|
37
|
+
*/
|
|
38
|
+
isBusiness?: boolean;
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* 初始化响应拦截器
|
|
42
|
+
*/
|
|
43
|
+
export declare const initResponseInterceptors: (instance: AxiosInstance) => void;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { AxiosRequestConfig, AxiosResponse } from 'axios';
|
|
2
|
+
import { AuthingResponse } from './interceptors/response';
|
|
3
|
+
/**
|
|
4
|
+
* 根据 Response 中的 apiCode & statusCode 做拦截
|
|
5
|
+
* @param response
|
|
6
|
+
* @returns
|
|
7
|
+
*/
|
|
8
|
+
export declare const processCodeByResponse: (response: AxiosResponse<AuthingResponse>) => AuthingResponse<any>;
|
|
9
|
+
/**
|
|
10
|
+
* 处理请求加密字段
|
|
11
|
+
* @param config
|
|
12
|
+
* @returns
|
|
13
|
+
*/
|
|
14
|
+
export declare const processEncryptRequestKey: (config: AxiosRequestConfig) => Promise<any>;
|
|
15
|
+
/**
|
|
16
|
+
* 处理 flowHandler
|
|
17
|
+
* @param response
|
|
18
|
+
* @returns
|
|
19
|
+
*/
|
|
20
|
+
export declare const processFlowHandler: (response: AuthingResponse) => AuthingResponse<any>;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
declare const _default: "4.0.3-
|
|
1
|
+
declare const _default: "4.0.3-hep.1";
|
|
2
2
|
export default _default;
|