@beaver-im/js-sdk 1.0.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/README.md +275 -0
- package/dist/api/auth.d.ts +4 -0
- package/dist/api/localClient.d.ts +4 -0
- package/dist/api/qrcode.d.ts +8 -0
- package/dist/beaver-sdk.es.js +9028 -0
- package/dist/beaver-sdk.umd.js +32 -0
- package/dist/config/index.d.ts +10 -0
- package/dist/index.d.ts +11 -0
- package/dist/index.vue.d.ts +110 -0
- package/dist/types/api/auth.d.ts +26 -0
- package/dist/types/api/localClient.d.ts +13 -0
- package/dist/types/api/oauth.d.ts +20 -0
- package/dist/types/api/qrcode.d.ts +17 -0
- package/dist/utils/request/index.d.ts +23 -0
- package/dist/view/password-login/index.vue.d.ts +25 -0
- package/dist/view/qrcode-login/index.vue.d.ts +37 -0
- package/package.json +41 -0
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 扫码登录 API
|
|
3
|
+
*/
|
|
4
|
+
export interface IGenerateQrCodeReq {
|
|
5
|
+
appId: string;
|
|
6
|
+
}
|
|
7
|
+
export interface IGenerateQrCodeRes {
|
|
8
|
+
sceneId: string;
|
|
9
|
+
expireIn: number;
|
|
10
|
+
}
|
|
11
|
+
export interface ICheckQrCodeStatusReq {
|
|
12
|
+
sceneId: string;
|
|
13
|
+
}
|
|
14
|
+
export interface ICheckQrCodeStatusRes {
|
|
15
|
+
status: string;
|
|
16
|
+
code?: string;
|
|
17
|
+
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { AxiosRequestConfig } from 'axios';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* 统一的响应数据结构
|
|
5
|
+
*/
|
|
6
|
+
export interface IResponseSuccessData<T> {
|
|
7
|
+
code: number;
|
|
8
|
+
msg: string;
|
|
9
|
+
result: T;
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* 请求头配置
|
|
13
|
+
*/
|
|
14
|
+
export interface HeaderRequest {
|
|
15
|
+
[key: string]: string | number;
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* 统一的请求方法
|
|
19
|
+
* @param config axios请求配置
|
|
20
|
+
* @returns 返回统一格式的数据
|
|
21
|
+
*/
|
|
22
|
+
declare function ajax<T>(config: AxiosRequestConfig): Promise<IResponseSuccessData<T>>;
|
|
23
|
+
export { ajax };
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
declare const _default: import('vue').DefineComponent<import('vue').ExtractPropTypes<{
|
|
2
|
+
appId: {
|
|
3
|
+
type: StringConstructor;
|
|
4
|
+
required: true;
|
|
5
|
+
};
|
|
6
|
+
}>, {
|
|
7
|
+
account: import('vue').Ref<string, string>;
|
|
8
|
+
password: import('vue').Ref<string, string>;
|
|
9
|
+
showPassword: import('vue').Ref<boolean, boolean>;
|
|
10
|
+
accountError: import('vue').Ref<string, string>;
|
|
11
|
+
passwordError: import('vue').Ref<string, string>;
|
|
12
|
+
validateAccount: () => boolean;
|
|
13
|
+
validatePassword: () => boolean;
|
|
14
|
+
handleLogin: () => Promise<void>;
|
|
15
|
+
eyeIcon: string;
|
|
16
|
+
eyeOffIcon: string;
|
|
17
|
+
}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, "login-success"[], "login-success", import('vue').PublicProps, Readonly<import('vue').ExtractPropTypes<{
|
|
18
|
+
appId: {
|
|
19
|
+
type: StringConstructor;
|
|
20
|
+
required: true;
|
|
21
|
+
};
|
|
22
|
+
}>> & Readonly<{
|
|
23
|
+
"onLogin-success"?: ((...args: any[]) => any) | undefined;
|
|
24
|
+
}>, {}, {}, {}, {}, string, import('vue').ComponentProvideOptions, true, {}, any>;
|
|
25
|
+
export default _default;
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
declare const _default: import('vue').DefineComponent<import('vue').ExtractPropTypes<{
|
|
2
|
+
appId: {
|
|
3
|
+
type: StringConstructor;
|
|
4
|
+
required: true;
|
|
5
|
+
};
|
|
6
|
+
}>, {
|
|
7
|
+
qrCodeDataUrl: import('vue').Ref<string, string>;
|
|
8
|
+
error: import('vue').Ref<string, string>;
|
|
9
|
+
scanStatus: import('vue').Ref<"waiting" | "scanned" | "confirmed", "waiting" | "scanned" | "confirmed">;
|
|
10
|
+
countdown: import('vue').Ref<number, number>;
|
|
11
|
+
localUserInfo: import('vue').Ref<{
|
|
12
|
+
userId: string;
|
|
13
|
+
nickname: string;
|
|
14
|
+
avatar: string;
|
|
15
|
+
authCode: string;
|
|
16
|
+
} | null, {
|
|
17
|
+
userId: string;
|
|
18
|
+
nickname: string;
|
|
19
|
+
avatar: string;
|
|
20
|
+
authCode: string;
|
|
21
|
+
} | {
|
|
22
|
+
userId: string;
|
|
23
|
+
nickname: string;
|
|
24
|
+
avatar: string;
|
|
25
|
+
authCode: string;
|
|
26
|
+
} | null>;
|
|
27
|
+
initQrCode: () => Promise<void>;
|
|
28
|
+
handleLocalLogin: () => void;
|
|
29
|
+
}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, "login-success"[], "login-success", import('vue').PublicProps, Readonly<import('vue').ExtractPropTypes<{
|
|
30
|
+
appId: {
|
|
31
|
+
type: StringConstructor;
|
|
32
|
+
required: true;
|
|
33
|
+
};
|
|
34
|
+
}>> & Readonly<{
|
|
35
|
+
"onLogin-success"?: ((...args: any[]) => any) | undefined;
|
|
36
|
+
}>, {}, {}, {}, {}, string, import('vue').ComponentProvideOptions, true, {}, any>;
|
|
37
|
+
export default _default;
|
package/package.json
ADDED
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@beaver-im/js-sdk",
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"description": "Beaver SDK Web Components 版本",
|
|
5
|
+
"main": "dist/beaver-sdk.umd.js",
|
|
6
|
+
"module": "dist/beaver-sdk.es.js",
|
|
7
|
+
"types": "dist/index.d.ts",
|
|
8
|
+
"files": [
|
|
9
|
+
"dist"
|
|
10
|
+
],
|
|
11
|
+
"scripts": {
|
|
12
|
+
"dev": "vite",
|
|
13
|
+
"build": "vite build"
|
|
14
|
+
},
|
|
15
|
+
"keywords": [
|
|
16
|
+
"beaver",
|
|
17
|
+
"web-components",
|
|
18
|
+
"login",
|
|
19
|
+
"oauth",
|
|
20
|
+
"sdk"
|
|
21
|
+
],
|
|
22
|
+
"author": "Beaver SDK Team",
|
|
23
|
+
"license": "MIT",
|
|
24
|
+
"dependencies": {
|
|
25
|
+
"axios": "^1.16.0",
|
|
26
|
+
"crypto-js": "^4.2.0",
|
|
27
|
+
"qrcode": "^1.5.4",
|
|
28
|
+
"vue": "^3.3.0"
|
|
29
|
+
},
|
|
30
|
+
"devDependencies": {
|
|
31
|
+
"@types/crypto-js": "^4.2.2",
|
|
32
|
+
"@types/node": "^20.0.0",
|
|
33
|
+
"@types/qrcode": "^1.5.6",
|
|
34
|
+
"@vitejs/plugin-vue": "^4.0.0",
|
|
35
|
+
"less": "^4.6.4",
|
|
36
|
+
"typescript": "~5.0.0",
|
|
37
|
+
"vite": "^4.0.0",
|
|
38
|
+
"vite-plugin-dts": "^3.0.0",
|
|
39
|
+
"vue-tsc": "^1.0.0"
|
|
40
|
+
}
|
|
41
|
+
}
|