@trtc/calls-uikit-vue2 4.4.7 → 4.4.8
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/package.json +2 -3
- package/src/TUICallService/CallService/index.ts +2 -2
- package/src/TUICallService/utils/validate/validateConfig.ts +203 -0
- package/src/TUICallService/utils/validate/validateParams.ts +88 -0
- package/src/TUICallService/utils/validate/validateStatus.ts +26 -0
- package/src/index.ts +1 -1
- package/tuicall-uikit-vue2.es.js +2291 -2219
- package/tuicall-uikit-vue2.umd.js +3 -3
- package/types/TUICallService/utils/validate/validateConfig.d.ts +188 -0
- package/types/TUICallService/utils/validate/validateParams.d.ts +1 -0
- package/types/TUICallService/utils/validate/validateStatus.d.ts +5 -0
- package/types/tsconfig.tsbuildinfo +1 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@trtc/calls-uikit-vue2",
|
|
3
|
-
"version": "4.4.
|
|
3
|
+
"version": "4.4.8",
|
|
4
4
|
"main": "./tuicall-uikit-vue2.umd.js",
|
|
5
5
|
"module": "./tuicall-uikit-vue2.es.js",
|
|
6
6
|
"types": "./types/index.d.ts",
|
|
@@ -15,8 +15,7 @@
|
|
|
15
15
|
"dependencies": {
|
|
16
16
|
"@tencentcloud/tui-core-lite": "1.0.0",
|
|
17
17
|
"@trtc/call-engine-lite-js": "~3.5.8",
|
|
18
|
-
"@tencentcloud/lite-chat": "^1.6.3"
|
|
19
|
-
"@trtc/call-engine-lite-wx": "~3.4.8"
|
|
18
|
+
"@tencentcloud/lite-chat": "^1.6.3"
|
|
20
19
|
},
|
|
21
20
|
"bugs": {
|
|
22
21
|
"url": "https://github.com/tencentyun/TUICallKit/issues"
|
|
@@ -27,7 +27,7 @@ const TUIGlobal: ITUIGlobal = TuiGlobal.getInstance();
|
|
|
27
27
|
const TUIStore: ITUIStore = TuiStore.getInstance();
|
|
28
28
|
const uiDesign = UIDesign.getInstance();
|
|
29
29
|
uiDesign.setTUIStore(TUIStore);
|
|
30
|
-
const version = '4.4.
|
|
30
|
+
const version = '4.4.8';
|
|
31
31
|
import AIAssistant from './AIAssistant'; // 仅 web 支持 AI 实时字幕
|
|
32
32
|
const frameWork = 'vue2.7';
|
|
33
33
|
export { TUIGlobal, TUIStore, uiDesign };
|
|
@@ -83,7 +83,7 @@ export default class TUICallService {
|
|
|
83
83
|
await this._wasmReadyPromise;
|
|
84
84
|
|
|
85
85
|
if (!this._isInitialized) {
|
|
86
|
-
this._doInit(params);
|
|
86
|
+
await this._doInit(params);
|
|
87
87
|
this._isInitialized = true;
|
|
88
88
|
}
|
|
89
89
|
}
|
|
@@ -0,0 +1,203 @@
|
|
|
1
|
+
import { NAME, MAX_NUMBER_ROOM_ID, VideoResolution, VideoDisplayMode } from "../../const/index";
|
|
2
|
+
|
|
3
|
+
export const VALIDATE_PARAMS = {
|
|
4
|
+
init: {
|
|
5
|
+
SDKAppID: {
|
|
6
|
+
required: true,
|
|
7
|
+
rules: [NAME.NUMBER],
|
|
8
|
+
allowEmpty: false,
|
|
9
|
+
},
|
|
10
|
+
userID: {
|
|
11
|
+
required: true,
|
|
12
|
+
rules: [NAME.STRING],
|
|
13
|
+
allowEmpty: false,
|
|
14
|
+
},
|
|
15
|
+
userSig: {
|
|
16
|
+
required: true,
|
|
17
|
+
rules: [NAME.STRING],
|
|
18
|
+
allowEmpty: false,
|
|
19
|
+
},
|
|
20
|
+
tim: {
|
|
21
|
+
required: false,
|
|
22
|
+
rules: [NAME.OBJECT],
|
|
23
|
+
},
|
|
24
|
+
},
|
|
25
|
+
call: {
|
|
26
|
+
userID: {
|
|
27
|
+
required: true,
|
|
28
|
+
rules: [NAME.STRING],
|
|
29
|
+
allowEmpty: false
|
|
30
|
+
},
|
|
31
|
+
type: {
|
|
32
|
+
required: true,
|
|
33
|
+
rules: [NAME.NUMBER],
|
|
34
|
+
range: [1, 2],
|
|
35
|
+
allowEmpty: false
|
|
36
|
+
},
|
|
37
|
+
roomID: {
|
|
38
|
+
required: false,
|
|
39
|
+
rules: [NAME.NUMBER], // 仅支持数字房间号, 后续会支持字符串房间号
|
|
40
|
+
range: `0~${MAX_NUMBER_ROOM_ID}`,
|
|
41
|
+
allowEmpty: false,
|
|
42
|
+
},
|
|
43
|
+
strRoomID: {
|
|
44
|
+
required: false,
|
|
45
|
+
rules: [NAME.STRING],
|
|
46
|
+
allowEmpty: true,
|
|
47
|
+
},
|
|
48
|
+
userData: {
|
|
49
|
+
required: false,
|
|
50
|
+
rules: [NAME.STRING],
|
|
51
|
+
allowEmpty: false,
|
|
52
|
+
},
|
|
53
|
+
timeout: {
|
|
54
|
+
required: false,
|
|
55
|
+
rules: [NAME.NUMBER],
|
|
56
|
+
allowEmpty: false
|
|
57
|
+
}
|
|
58
|
+
},
|
|
59
|
+
groupCall: {
|
|
60
|
+
userIDList: {
|
|
61
|
+
required: true,
|
|
62
|
+
rules: [NAME.ARRAY],
|
|
63
|
+
allowEmpty: false
|
|
64
|
+
},
|
|
65
|
+
type: {
|
|
66
|
+
required: true,
|
|
67
|
+
rules: [NAME.NUMBER],
|
|
68
|
+
range: [1, 2],
|
|
69
|
+
allowEmpty: false
|
|
70
|
+
},
|
|
71
|
+
groupID: {
|
|
72
|
+
required: true,
|
|
73
|
+
rules: [NAME.STRING],
|
|
74
|
+
allowEmpty: false
|
|
75
|
+
},
|
|
76
|
+
roomID: {
|
|
77
|
+
required: false,
|
|
78
|
+
rules: [NAME.NUMBER], // 仅支持数字房间号, 后续会支持字符串房间号
|
|
79
|
+
range: `0~${MAX_NUMBER_ROOM_ID}`,
|
|
80
|
+
allowEmpty: false
|
|
81
|
+
},
|
|
82
|
+
strRoomID: {
|
|
83
|
+
required: false,
|
|
84
|
+
rules: [NAME.STRING],
|
|
85
|
+
allowEmpty: true,
|
|
86
|
+
},
|
|
87
|
+
timeout: {
|
|
88
|
+
required: false,
|
|
89
|
+
rules: [NAME.NUMBER],
|
|
90
|
+
allowEmpty: false
|
|
91
|
+
},
|
|
92
|
+
userData: {
|
|
93
|
+
required: false,
|
|
94
|
+
rules: [NAME.STRING],
|
|
95
|
+
allowEmpty: false,
|
|
96
|
+
},
|
|
97
|
+
offlinePushInfo: {
|
|
98
|
+
required: false,
|
|
99
|
+
rules: [NAME.OBJECT],
|
|
100
|
+
allowEmpty: false,
|
|
101
|
+
},
|
|
102
|
+
},
|
|
103
|
+
joinInGroupCall: {
|
|
104
|
+
type: {
|
|
105
|
+
required: true,
|
|
106
|
+
rules: [NAME.NUMBER],
|
|
107
|
+
range: [1, 2],
|
|
108
|
+
allowEmpty: false
|
|
109
|
+
},
|
|
110
|
+
groupID: {
|
|
111
|
+
required: true,
|
|
112
|
+
rules: [NAME.STRING],
|
|
113
|
+
allowEmpty: false
|
|
114
|
+
},
|
|
115
|
+
roomID: {
|
|
116
|
+
required: true,
|
|
117
|
+
rules: [NAME.NUMBER],
|
|
118
|
+
allowEmpty: false,
|
|
119
|
+
},
|
|
120
|
+
strRoomID: {
|
|
121
|
+
required: false,
|
|
122
|
+
rules: [NAME.STRING],
|
|
123
|
+
allowEmpty: true,
|
|
124
|
+
},
|
|
125
|
+
},
|
|
126
|
+
inviteUser: {
|
|
127
|
+
userIDList: {
|
|
128
|
+
required: true,
|
|
129
|
+
rules: [NAME.ARRAY],
|
|
130
|
+
allowEmpty: false
|
|
131
|
+
},
|
|
132
|
+
},
|
|
133
|
+
setSelfInfo: {
|
|
134
|
+
nickName: {
|
|
135
|
+
required: false,
|
|
136
|
+
rules: [NAME.STRING],
|
|
137
|
+
allowEmpty: false,
|
|
138
|
+
},
|
|
139
|
+
avatar: {
|
|
140
|
+
required: false,
|
|
141
|
+
rules: [NAME.STRING],
|
|
142
|
+
allowEmpty: false,
|
|
143
|
+
}
|
|
144
|
+
},
|
|
145
|
+
enableFloatWindow: [
|
|
146
|
+
{
|
|
147
|
+
key: "enable",
|
|
148
|
+
required: false,
|
|
149
|
+
rules: [NAME.BOOLEAN],
|
|
150
|
+
allowEmpty: false,
|
|
151
|
+
}
|
|
152
|
+
],
|
|
153
|
+
enableAIVoice: [
|
|
154
|
+
{
|
|
155
|
+
key: "enable",
|
|
156
|
+
required: true,
|
|
157
|
+
rules: [NAME.BOOLEAN],
|
|
158
|
+
allowEmpty: false,
|
|
159
|
+
}
|
|
160
|
+
],
|
|
161
|
+
enableMuteMode: [
|
|
162
|
+
{
|
|
163
|
+
key: "enable",
|
|
164
|
+
required: true,
|
|
165
|
+
rules: [NAME.BOOLEAN],
|
|
166
|
+
allowEmpty: false,
|
|
167
|
+
}
|
|
168
|
+
],
|
|
169
|
+
setCallingBell: [
|
|
170
|
+
{
|
|
171
|
+
key: "filePath",
|
|
172
|
+
required: false,
|
|
173
|
+
rules: [NAME.STRING],
|
|
174
|
+
allowEmpty: true,
|
|
175
|
+
}
|
|
176
|
+
],
|
|
177
|
+
setLanguage: [
|
|
178
|
+
{
|
|
179
|
+
key: "language",
|
|
180
|
+
required: true,
|
|
181
|
+
rules: [NAME.STRING],
|
|
182
|
+
allowEmpty: false
|
|
183
|
+
}
|
|
184
|
+
],
|
|
185
|
+
setVideoDisplayMode: [
|
|
186
|
+
{
|
|
187
|
+
key: "displayMode",
|
|
188
|
+
required: true,
|
|
189
|
+
rules: [NAME.STRING],
|
|
190
|
+
range: [VideoDisplayMode.CONTAIN, VideoDisplayMode.COVER, VideoDisplayMode.FILL],
|
|
191
|
+
allowEmpty: false
|
|
192
|
+
}
|
|
193
|
+
],
|
|
194
|
+
setVideoResolution: [
|
|
195
|
+
{
|
|
196
|
+
key: "resolution",
|
|
197
|
+
required: true,
|
|
198
|
+
rules: [NAME.STRING],
|
|
199
|
+
range: [VideoResolution.RESOLUTION_1080P, VideoResolution.RESOLUTION_480P, VideoResolution.RESOLUTION_720P],
|
|
200
|
+
allowEmpty: false
|
|
201
|
+
}
|
|
202
|
+
]
|
|
203
|
+
};
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
import { getType, isArray, isString, isUndefined, isNumber, modifyObjectKey } from "../common-utils";
|
|
2
|
+
import { NAME } from "../../const/index";
|
|
3
|
+
const PREFIX = NAME.PREFIX + "API";
|
|
4
|
+
|
|
5
|
+
export function paramValidate (config: any) {
|
|
6
|
+
return function (target, propertyName: string, descriptor: PropertyDescriptor) {
|
|
7
|
+
let method = descriptor.value;
|
|
8
|
+
descriptor.value = function (...args) {
|
|
9
|
+
doValidate.call(this, config, args, propertyName);
|
|
10
|
+
return method.apply(this, args);
|
|
11
|
+
};
|
|
12
|
+
return descriptor;
|
|
13
|
+
};
|
|
14
|
+
}
|
|
15
|
+
function doValidate(config, args, name) {
|
|
16
|
+
try {
|
|
17
|
+
// 兼容 init 方法中: SDKAppID sdkAppID 两种写法的参数校验判断
|
|
18
|
+
if (!args[0].SDKAppID) {
|
|
19
|
+
config = modifyObjectKey(config, "SDKAppID", "sdkAppID");
|
|
20
|
+
}
|
|
21
|
+
if (isArray(config)) {
|
|
22
|
+
for (let i = 0; i < config.length; i++) {
|
|
23
|
+
check.call(this, {
|
|
24
|
+
...config[i],
|
|
25
|
+
value: args[i],
|
|
26
|
+
name,
|
|
27
|
+
});
|
|
28
|
+
}
|
|
29
|
+
} else {
|
|
30
|
+
for (const key in config) {
|
|
31
|
+
if (config.hasOwnProperty(key)) {
|
|
32
|
+
check.call(this, {
|
|
33
|
+
...config[key],
|
|
34
|
+
value: args[0][key],
|
|
35
|
+
name,
|
|
36
|
+
key,
|
|
37
|
+
});
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
} catch (error) {
|
|
42
|
+
console.error(error);
|
|
43
|
+
throw error;
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
function check({ required, rules, range, value, allowEmpty, name, key }) {
|
|
47
|
+
// 用户没传指定参数
|
|
48
|
+
if (isUndefined(value)) {
|
|
49
|
+
// 检查必填参数, 若配置是必填则报错
|
|
50
|
+
if (required) {
|
|
51
|
+
throw new Error(`${PREFIX}<${name}>: ${key} is required.`);
|
|
52
|
+
} else {
|
|
53
|
+
return;
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
// 判断参数类型是否正确
|
|
57
|
+
const result = rules.some((item)=>item === getType(value));
|
|
58
|
+
let type = '';
|
|
59
|
+
if (!result) {
|
|
60
|
+
for (let i = 0; i < rules.length; i++) {
|
|
61
|
+
let str = rules[i];
|
|
62
|
+
str = str.replace(str[0], str[0].toUpperCase());
|
|
63
|
+
type += `${str}/`;
|
|
64
|
+
}
|
|
65
|
+
type = type.substring(0, type.length - 1);
|
|
66
|
+
throw new Error(`${PREFIX}<${name}>: ${key} must be ${type}, current ${key} is ${typeof value}.`);
|
|
67
|
+
}
|
|
68
|
+
// 不允许传空值, 例如: '', ' '
|
|
69
|
+
if (allowEmpty === false) {
|
|
70
|
+
const isEmptyString = isString(value) && value.trim() === '';
|
|
71
|
+
if (isEmptyString) {
|
|
72
|
+
throw new Error(`${PREFIX}<${name}>: ${key} is blank.`);
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
// 判断是否符合限制条件
|
|
76
|
+
if (isArray(range)) {
|
|
77
|
+
if (range && range.indexOf(value) === -1) {
|
|
78
|
+
throw new Error(`${PREFIX}<${name}>: ${key} error, only be ${range}, current ${key} is ${value}.`);
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
// 取值范围, 前闭后闭
|
|
82
|
+
if (isString(range) && range.indexOf('~') !== -1) {
|
|
83
|
+
const valueList = range.split('~');
|
|
84
|
+
if (value < +valueList[0] || value > +valueList[1] || (isNumber(value) && Number.isNaN(value))) {
|
|
85
|
+
throw new Error(`${PREFIX}<${name}>: ${key} error, only be ${range}, current ${key} is ${value}.`);
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { NAME } from "../../const/index";
|
|
2
|
+
import { t } from '../../locales/index';
|
|
3
|
+
|
|
4
|
+
interface IStatusValidateParams {
|
|
5
|
+
engineInstance?: boolean;
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
export function statusValidate (config: IStatusValidateParams) {
|
|
9
|
+
return function (target, propertyName: string, descriptor: PropertyDescriptor) {
|
|
10
|
+
let method = descriptor.value;
|
|
11
|
+
descriptor.value = function (...args: Array<any>) {
|
|
12
|
+
doValidate.call(this, config, args, propertyName);
|
|
13
|
+
return method.apply(this, args);
|
|
14
|
+
};
|
|
15
|
+
return descriptor;
|
|
16
|
+
};
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
function doValidate(config) {
|
|
20
|
+
if (config?.engineInstance && !this._tuiCallEngine) {
|
|
21
|
+
const error = `${NAME.PREFIX} ${t('TUICallKit init is not complete')}`;
|
|
22
|
+
console.error(error);
|
|
23
|
+
throw error;
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
|