@authing/react-ui-components 4.0.0 → 4.0.1-beta.0
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 +1 -1
- package/lib/index.min.js +1 -1
- package/package.json +2 -1
- package/types/Login/core/withAppQrcode.d.ts +1 -2
- package/types/Login/core/withWechatMiniQrcode.d.ts +1 -1
- package/types/Login/core/withWechatmpQrcode.d.ts +1 -1
- package/types/Qrcode/UiQrCode.d.ts +51 -0
- package/types/Qrcode/WorkQrCode.d.ts +41 -0
- package/types/Qrcode/hooks/useImage.d.ts +4 -0
- package/types/Qrcode/hooks/usePostQrCode.d.ts +69 -0
- package/types/Qrcode/hooks/usePreQrCode.d.ts +31 -0
- package/types/Qrcode/hooks/useStatus.d.ts +7 -0
- package/types/Qrcode/index.d.ts +7 -0
- package/types/version/version.d.ts +1 -1
- package/types/AccountMerge/UserRadio.d.ts +0 -5
- package/types/AccountMerge/index.d.ts +0 -3
- package/types/AccountMerge/interface.d.ts +0 -27
- package/types/AccountMerge/utils.d.ts +0 -3
- package/types/CompleteInfo/core/components/TreeSelect.d.ts +0 -11
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@authing/react-ui-components",
|
|
3
|
-
"version": "4.0.0",
|
|
3
|
+
"version": "4.0.1-beta.0",
|
|
4
4
|
"private": false,
|
|
5
5
|
"main": "lib/index.min.js",
|
|
6
6
|
"typings": "types/index.d.ts",
|
|
@@ -12,6 +12,7 @@
|
|
|
12
12
|
"dependencies": {
|
|
13
13
|
"antd": "^4.8.0",
|
|
14
14
|
"authing-js-sdk": "4.23.35",
|
|
15
|
+
"classnames": "^2.3.1",
|
|
15
16
|
"fastclick": "^1.0.6",
|
|
16
17
|
"global": "^4.4.0",
|
|
17
18
|
"phone": "^3.1.12",
|
|
@@ -3,8 +3,7 @@ import { StoreInstance } from '../../Guard/core/hooks/useMultipleAccounts';
|
|
|
3
3
|
interface LoginWithAppQrcodeProps {
|
|
4
4
|
onLoginSuccess: any;
|
|
5
5
|
canLoop: boolean;
|
|
6
|
-
qrCodeScanOptions: any;
|
|
7
6
|
multipleInstance?: StoreInstance;
|
|
8
7
|
}
|
|
9
|
-
export declare const LoginWithAppQrcode: (props: LoginWithAppQrcodeProps) => JSX.Element;
|
|
8
|
+
export declare const LoginWithAppQrcode: (props: LoginWithAppQrcodeProps) => JSX.Element | null;
|
|
10
9
|
export {};
|
|
@@ -7,5 +7,5 @@ interface LoginWithWechatMiniQrcodeProps {
|
|
|
7
7
|
id: string;
|
|
8
8
|
multipleInstance?: StoreInstance;
|
|
9
9
|
}
|
|
10
|
-
export declare const LoginWithWechatMiniQrcode: (props: LoginWithWechatMiniQrcodeProps) => JSX.Element;
|
|
10
|
+
export declare const LoginWithWechatMiniQrcode: (props: LoginWithWechatMiniQrcodeProps) => JSX.Element | null;
|
|
11
11
|
export {};
|
|
@@ -10,5 +10,5 @@ interface LoginWithWechatmpQrcodeProps {
|
|
|
10
10
|
*/
|
|
11
11
|
multipleInstance?: StoreInstance;
|
|
12
12
|
}
|
|
13
|
-
export declare const LoginWithWechatmpQrcode: (props: LoginWithWechatmpQrcodeProps) => JSX.Element;
|
|
13
|
+
export declare const LoginWithWechatmpQrcode: (props: LoginWithWechatmpQrcodeProps) => JSX.Element | null;
|
|
14
14
|
export {};
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import './index.less';
|
|
3
|
+
import { CodeStatusDescriptions } from './WorkQrCode';
|
|
4
|
+
export declare type CodeStatus = 'loading' | 'ready' | 'already' | 'success' | 'error' | 'expired' | 'cancel' | 'MFA';
|
|
5
|
+
export declare const prefix = "refactor";
|
|
6
|
+
export interface UiQrProps {
|
|
7
|
+
/**
|
|
8
|
+
* Loading 组件
|
|
9
|
+
*/
|
|
10
|
+
loadingComponent?: React.ReactElement;
|
|
11
|
+
/**
|
|
12
|
+
* 二维码组件三种状态
|
|
13
|
+
* ready 准备状态
|
|
14
|
+
* already 已扫描状态
|
|
15
|
+
* success 扫描成功/登录成功状态
|
|
16
|
+
* error 错误状态(超时、网络错误)
|
|
17
|
+
*/
|
|
18
|
+
status: CodeStatus;
|
|
19
|
+
/**
|
|
20
|
+
* 二维码 URL
|
|
21
|
+
*/
|
|
22
|
+
src?: string;
|
|
23
|
+
/**
|
|
24
|
+
* 二维码底部内容
|
|
25
|
+
*/
|
|
26
|
+
descriptions: CodeStatusDescriptions;
|
|
27
|
+
/**
|
|
28
|
+
* 外层 container 样式
|
|
29
|
+
*/
|
|
30
|
+
containerStyle?: React.CSSProperties;
|
|
31
|
+
/**
|
|
32
|
+
* 内层 container 样式(图片)
|
|
33
|
+
*/
|
|
34
|
+
imageStyle?: React.CSSProperties;
|
|
35
|
+
/**
|
|
36
|
+
* 二维码图片准备好的回调
|
|
37
|
+
*/
|
|
38
|
+
onLoad?: () => void;
|
|
39
|
+
/**
|
|
40
|
+
* 点击遮罩中的内容区
|
|
41
|
+
* status 当前组件所处状态
|
|
42
|
+
*/
|
|
43
|
+
onClickMaskEl?: (status: CodeStatus) => void;
|
|
44
|
+
/**
|
|
45
|
+
* 点击全部遮罩区域
|
|
46
|
+
* status 当前组件所处状态
|
|
47
|
+
*/
|
|
48
|
+
onMaskContent?: (status: CodeStatus) => void;
|
|
49
|
+
}
|
|
50
|
+
declare const UiQrCode: React.NamedExoticComponent<UiQrProps>;
|
|
51
|
+
export { UiQrCode };
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { QrCodeResponse } from './hooks/usePostQrCode';
|
|
3
|
+
import { CodeStatus, UiQrProps } from './UiQrCode';
|
|
4
|
+
/**
|
|
5
|
+
* 二维码不同状态下的底部描述文字
|
|
6
|
+
*/
|
|
7
|
+
export declare type CodeStatusDescriptions = Partial<Record<Exclude<CodeStatus, 'loading'>, React.ReactNode | ((referQrCode?: () => void) => React.ReactNode)>>;
|
|
8
|
+
export interface WorkQrCodeRef {
|
|
9
|
+
referQrCode: () => Promise<{
|
|
10
|
+
random: string;
|
|
11
|
+
url: string;
|
|
12
|
+
} | undefined>;
|
|
13
|
+
}
|
|
14
|
+
interface WorkQrCodeProps extends Omit<UiQrProps, 'description' | 'status'> {
|
|
15
|
+
/**
|
|
16
|
+
* 二维码场景
|
|
17
|
+
*/
|
|
18
|
+
scene: 'WXAPP_AUTH' | 'APP_AUTH' | 'WECHATMP_AUTH';
|
|
19
|
+
/**
|
|
20
|
+
* 不同状态请求文字
|
|
21
|
+
*/
|
|
22
|
+
descriptions: CodeStatusDescriptions;
|
|
23
|
+
/**
|
|
24
|
+
* 睡眠时间 默认 1000
|
|
25
|
+
*/
|
|
26
|
+
sleepTime?: number;
|
|
27
|
+
/**
|
|
28
|
+
* 每当状态变化时,触发的 callback 。
|
|
29
|
+
*/
|
|
30
|
+
onStatusChange?: (status: CodeStatus, data: QrCodeResponse) => void;
|
|
31
|
+
/**
|
|
32
|
+
* 不同状态下点击遮罩中间区域方法
|
|
33
|
+
*/
|
|
34
|
+
onClickMaskContent?: (status: CodeStatus) => void;
|
|
35
|
+
/**
|
|
36
|
+
* 不同二维码下生成配置
|
|
37
|
+
*/
|
|
38
|
+
qrCodeScanOptions?: any;
|
|
39
|
+
}
|
|
40
|
+
declare const WorkQrCode: React.ForwardRefExoticComponent<WorkQrCodeProps & React.RefAttributes<any>>;
|
|
41
|
+
export { WorkQrCode };
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { AuthingGuardResponse, AuthingResponse } from '../../_utils/http';
|
|
3
|
+
import { CodeStatus } from '../UiQrCode';
|
|
4
|
+
import { CodeStatusDescriptions } from '../WorkQrCode';
|
|
5
|
+
import { ReducerType, RootState } from './usePreQrCode';
|
|
6
|
+
export interface QrCodeResponse {
|
|
7
|
+
/**
|
|
8
|
+
* 根据状态确定不同的流程
|
|
9
|
+
*/
|
|
10
|
+
status: number;
|
|
11
|
+
/**
|
|
12
|
+
* 返回的随机值
|
|
13
|
+
*/
|
|
14
|
+
random: number;
|
|
15
|
+
/**
|
|
16
|
+
* 返回的用户信息
|
|
17
|
+
*/
|
|
18
|
+
userInfo?: any;
|
|
19
|
+
/**
|
|
20
|
+
* 扫码成功后 Tick 换取用户信息
|
|
21
|
+
*/
|
|
22
|
+
ticket?: string;
|
|
23
|
+
/**
|
|
24
|
+
* MFA 状态下的返回
|
|
25
|
+
*/
|
|
26
|
+
scannedResult?: AuthingResponse;
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* 二维码请求相关
|
|
30
|
+
*/
|
|
31
|
+
interface QrCodeRequest {
|
|
32
|
+
genCodeRequest?: () => Promise<AuthingGuardResponse<{
|
|
33
|
+
random: string;
|
|
34
|
+
url: string;
|
|
35
|
+
}>>;
|
|
36
|
+
/**
|
|
37
|
+
* 未扫码下的请求方法
|
|
38
|
+
*/
|
|
39
|
+
readyCheckedRequest?: () => Promise<AuthingGuardResponse<QrCodeResponse>>;
|
|
40
|
+
/**
|
|
41
|
+
* 已经扫码下的请求方法(待确认)
|
|
42
|
+
*/
|
|
43
|
+
alreadyCheckedRequest?: () => Promise<AuthingGuardResponse<QrCodeResponse>>;
|
|
44
|
+
/**
|
|
45
|
+
* 使用 ticket 交换用户信息
|
|
46
|
+
*/
|
|
47
|
+
exchangeUserInfo?: (ticket: string) => Promise<any>;
|
|
48
|
+
}
|
|
49
|
+
interface QrCodeOptions {
|
|
50
|
+
state: RootState;
|
|
51
|
+
dispatch: React.Dispatch<{
|
|
52
|
+
type: ReducerType;
|
|
53
|
+
payload: Partial<RootState>;
|
|
54
|
+
}>;
|
|
55
|
+
descriptions: CodeStatusDescriptions;
|
|
56
|
+
sleepTime?: number;
|
|
57
|
+
/**
|
|
58
|
+
* 状态改变时触发事件,仅在 Server 返回的二维码状态改变时进行触发
|
|
59
|
+
*/
|
|
60
|
+
onStatusChange?: (status: CodeStatus, data: QrCodeResponse) => void;
|
|
61
|
+
}
|
|
62
|
+
/**
|
|
63
|
+
* 二维码处理阶段
|
|
64
|
+
* 二维码处理阶段分为两个主要流程
|
|
65
|
+
* 1. 同一状态下的轮询逻辑处理
|
|
66
|
+
* 2. 根据不同返回状态码进行处理
|
|
67
|
+
*/
|
|
68
|
+
export declare const useQrCode: (options: QrCodeOptions, request: QrCodeRequest) => void;
|
|
69
|
+
export {};
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { CodeStatus } from '../UiQrCode';
|
|
3
|
+
export declare type ReducerType = 'change' | 'changeStatus' | 'changeDesc';
|
|
4
|
+
export declare type RootState = {
|
|
5
|
+
/**
|
|
6
|
+
* 状态
|
|
7
|
+
*/
|
|
8
|
+
status: CodeStatus;
|
|
9
|
+
/**
|
|
10
|
+
* 底部描述
|
|
11
|
+
*/
|
|
12
|
+
/**
|
|
13
|
+
* 当前二维码 URL
|
|
14
|
+
*/
|
|
15
|
+
src?: string;
|
|
16
|
+
/**
|
|
17
|
+
* 二维码随机值
|
|
18
|
+
*/
|
|
19
|
+
random?: string;
|
|
20
|
+
};
|
|
21
|
+
/**
|
|
22
|
+
* QrCode 准备阶段 Hook
|
|
23
|
+
*/
|
|
24
|
+
declare const usePreQrCode: () => {
|
|
25
|
+
state: RootState;
|
|
26
|
+
dispatch: import("react").Dispatch<{
|
|
27
|
+
type: ReducerType;
|
|
28
|
+
payload: Partial<RootState>;
|
|
29
|
+
}>;
|
|
30
|
+
};
|
|
31
|
+
export { usePreQrCode };
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
declare const _default: "4.0.0";
|
|
1
|
+
declare const _default: "4.0.1-beta.0";
|
|
2
2
|
export default _default;
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
export interface BriefUserInfo {
|
|
2
|
-
displayName: string;
|
|
3
|
-
avatar: string;
|
|
4
|
-
phone: string;
|
|
5
|
-
email: string;
|
|
6
|
-
username: string;
|
|
7
|
-
name: string;
|
|
8
|
-
}
|
|
9
|
-
export interface GuardAccountMergeInitData {
|
|
10
|
-
currentUserInfo: BriefUserInfo;
|
|
11
|
-
existingUserInfo: BriefUserInfo;
|
|
12
|
-
mergeToken?: string;
|
|
13
|
-
}
|
|
14
|
-
export interface UserRadioProps {
|
|
15
|
-
currentUserInfo: BriefUserInfo;
|
|
16
|
-
existingUserInfo: BriefUserInfo;
|
|
17
|
-
onChange?: (value: any) => void;
|
|
18
|
-
value?: any;
|
|
19
|
-
}
|
|
20
|
-
export interface UserRadioItemProps extends BriefUserInfo {
|
|
21
|
-
value: boolean;
|
|
22
|
-
selected: boolean;
|
|
23
|
-
onClick: (value: boolean) => void;
|
|
24
|
-
}
|
|
25
|
-
export declare enum AuthFlowAction {
|
|
26
|
-
MERGE = "confirm-account-merge"
|
|
27
|
-
}
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
export declare type OptionType = {
|
|
3
|
-
id: string;
|
|
4
|
-
name: string;
|
|
5
|
-
children: OptionType[];
|
|
6
|
-
};
|
|
7
|
-
interface TreeSelectProps {
|
|
8
|
-
options: OptionType[];
|
|
9
|
-
}
|
|
10
|
-
declare const TreeSelect: React.FC<TreeSelectProps>;
|
|
11
|
-
export default TreeSelect;
|