@trtc/calls-uikit-react 4.4.0 → 4.4.3-beta.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/README-zh_CN.md +6 -0
- package/README.md +6 -0
- package/package.json +3 -4
- package/src/TUICallService/CallService/UIKitModal.ts +76 -0
- package/src/TUICallService/CallService/index.ts +7 -1
- package/src/TUICallService/const/index.ts +1 -0
- package/src/TUICallService/locales/en.ts +11 -0
- package/src/TUICallService/locales/ja_JP.ts +11 -0
- package/src/TUICallService/locales/zh-cn.ts +11 -0
- package/src/TUICallService/utils/validate/validateStatus.ts +26 -0
- package/src/index.ts +1 -1
- package/tuicall-uikit-react.es.js +1941 -1846
- package/tuicall-uikit-react.umd.js +12 -12
- package/types/TUICallService/CallService/UIKitModal.d.ts +1 -0
- package/types/TUICallService/locales/en.d.ts +10 -0
- package/types/TUICallService/locales/ja_JP.d.ts +10 -0
- package/types/TUICallService/locales/zh-cn.d.ts +10 -0
- package/types/TUICallService/utils/validate/validateStatus.d.ts +5 -0
package/README-zh_CN.md
CHANGED
|
@@ -54,6 +54,12 @@ TUICallKit 支持市面上主流浏览器,详情参考:[浏览器支持情
|
|
|
54
54
|
| 56+ | 80+ | 56+ | 11+ | 11+ | 46+ |
|
|
55
55
|
|
|
56
56
|
|
|
57
|
+
## 推荐使用更高效的 AI 集成助手
|
|
58
|
+
我们为您提供了全新的 AI 集成方式,如果您不需要完整的 Demo 工程, 只想快速开始集成,推荐您使用更高效的 AI 集成助手,只需要简单描述您的需求,即可自动生成集成代码,大幅提升开发效率。
|
|
59
|
+
|
|
60
|
+
点击这里,立即体验 [AI 集成](https://cloud.tencent.com/document/product/647/125504)。
|
|
61
|
+
|
|
62
|
+
|
|
57
63
|
## 安装
|
|
58
64
|
使用 npm:
|
|
59
65
|
```
|
package/README.md
CHANGED
|
@@ -56,6 +56,12 @@ Please be sure to use HTTPS protocol or localhost to deploy your Web App, otherw
|
|
|
56
56
|
| 56+ | 80+ | 56+ | 11+ | 11+ | 46+ |
|
|
57
57
|
|
|
58
58
|
|
|
59
|
+
## Recommend Using the More Efficient AI Integration Assistant
|
|
60
|
+
|
|
61
|
+
We offer you a brand new method for AI integration. If you don't need the complete demo project and just want to get started with integration quickly, we recommend using the more efficient AI Integration Assistant. Simply describe your requirements, and it will automatically generate the integration code, significantly boosting development efficiency.
|
|
62
|
+
|
|
63
|
+
Click here to experience [AI integration]((https://cloud.tencent.com/document/product/647/125504)) now!
|
|
64
|
+
|
|
59
65
|
|
|
60
66
|
## Install
|
|
61
67
|
npm:
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@trtc/calls-uikit-react",
|
|
3
|
-
"version": "4.4.
|
|
3
|
+
"version": "4.4.3-beta.1",
|
|
4
4
|
"main": "./tuicall-uikit-react.umd.js",
|
|
5
5
|
"module": "./tuicall-uikit-react.es.js",
|
|
6
6
|
"types": "./types/index.d.ts",
|
|
@@ -14,9 +14,8 @@
|
|
|
14
14
|
},
|
|
15
15
|
"dependencies": {
|
|
16
16
|
"@tencentcloud/tui-core-lite": "1.0.0",
|
|
17
|
-
"@trtc/call-engine-lite-js": "
|
|
18
|
-
"@tencentcloud/lite-chat": "^1.6.3"
|
|
19
|
-
"@trtc/call-engine-lite-wx": "~3.4.7"
|
|
17
|
+
"@trtc/call-engine-lite-js": "3.5.3-beta.1",
|
|
18
|
+
"@tencentcloud/lite-chat": "^1.6.3"
|
|
20
19
|
},
|
|
21
20
|
"bugs": {
|
|
22
21
|
"url": "https://github.com/tencentyun/TUICallKit/issues"
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
import TuiStore from '../TUIStore/tuiStore';
|
|
2
|
+
import { StoreName } from '../const/call';
|
|
3
|
+
import { NAME } from '../const/index';
|
|
4
|
+
import { t } from '../locales'
|
|
5
|
+
const TUIStore = TuiStore.getInstance();
|
|
6
|
+
|
|
7
|
+
const MODAL_ERROR_CODES = [
|
|
8
|
+
-1001,
|
|
9
|
+
-1002,
|
|
10
|
+
-1101,
|
|
11
|
+
60003,
|
|
12
|
+
60004,
|
|
13
|
+
60006,
|
|
14
|
+
-1201,
|
|
15
|
+
30000,
|
|
16
|
+
20007,
|
|
17
|
+
];
|
|
18
|
+
|
|
19
|
+
const MODAL_ERROR_MAP = {
|
|
20
|
+
'-1001': {
|
|
21
|
+
id: 10001,
|
|
22
|
+
key: 'error.10001'
|
|
23
|
+
},
|
|
24
|
+
'-1002': {
|
|
25
|
+
id: 10002,
|
|
26
|
+
key: 'error.10002'
|
|
27
|
+
},
|
|
28
|
+
'-1101': {
|
|
29
|
+
id: 10004,
|
|
30
|
+
key: 'error.10004'
|
|
31
|
+
},
|
|
32
|
+
'60003': {
|
|
33
|
+
id: 10005,
|
|
34
|
+
key: 'error.10005'
|
|
35
|
+
},
|
|
36
|
+
'60004': {
|
|
37
|
+
id: 10006,
|
|
38
|
+
key: 'error.10006'
|
|
39
|
+
},
|
|
40
|
+
'60006': {
|
|
41
|
+
id: 10007,
|
|
42
|
+
key: 'error.10007'
|
|
43
|
+
},
|
|
44
|
+
'-1201': {
|
|
45
|
+
id: 10008,
|
|
46
|
+
key: 'error.10008'
|
|
47
|
+
},
|
|
48
|
+
'30000': {
|
|
49
|
+
id: 10012,
|
|
50
|
+
key: 'error.10012'
|
|
51
|
+
},
|
|
52
|
+
'20007': {
|
|
53
|
+
id: 10013,
|
|
54
|
+
key: 'error.10013'
|
|
55
|
+
}
|
|
56
|
+
};
|
|
57
|
+
|
|
58
|
+
export function handleModalError(error) {
|
|
59
|
+
if (!error || !error?.code) {
|
|
60
|
+
return;
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
if (!MODAL_ERROR_CODES.includes(error.code)) {
|
|
64
|
+
return;
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
const errorInfo = MODAL_ERROR_MAP[error.code.toString()];
|
|
68
|
+
if (errorInfo) {
|
|
69
|
+
let content = t(errorInfo.key);
|
|
70
|
+
TUIStore.update(StoreName.CALL, NAME.MODAL_ERROR, {
|
|
71
|
+
id: errorInfo.id,
|
|
72
|
+
content: content,
|
|
73
|
+
title: t('error')
|
|
74
|
+
});
|
|
75
|
+
}
|
|
76
|
+
}
|
|
@@ -9,6 +9,7 @@ import {
|
|
|
9
9
|
// @ts-ignore
|
|
10
10
|
import { TUICallEngine } from '@trtc/call-engine-lite-js';
|
|
11
11
|
import { checkLocalMP3FileExists } from '../utils/index';
|
|
12
|
+
import { handleModalError } from './UIKitModal';
|
|
12
13
|
import { CallTips, t } from '../locales/index';
|
|
13
14
|
import { BellContext } from './bellContext';
|
|
14
15
|
import { avoidRepeatedCall } from '../utils/validate/index';
|
|
@@ -28,7 +29,7 @@ const TUIStore: ITUIStore = TuiStore.getInstance();
|
|
|
28
29
|
const uiDesign = UIDesign.getInstance();
|
|
29
30
|
uiDesign.setTUIStore(TUIStore);
|
|
30
31
|
const aiAssistant = AIAssistant.getInstance();
|
|
31
|
-
const version = '4.4.
|
|
32
|
+
const version = '4.4.3-beta.1';
|
|
32
33
|
const frameWork = 'react';
|
|
33
34
|
export { TUIGlobal, TUIStore, uiDesign };
|
|
34
35
|
|
|
@@ -195,6 +196,7 @@ export default class TUICallService {
|
|
|
195
196
|
const response = await this._tuiCallEngine.calls(callsParams);
|
|
196
197
|
await this._updateCallStoreAfterCall(userIDList, response);
|
|
197
198
|
} catch (error: any) {
|
|
199
|
+
handleModalError(error);
|
|
198
200
|
this._handleCallError(error, 'calls');
|
|
199
201
|
}
|
|
200
202
|
}
|
|
@@ -229,6 +231,7 @@ export default class TUICallService {
|
|
|
229
231
|
// setLocalUserInfoAudioVideoAvailable(true, NAME.VIDEO);
|
|
230
232
|
// }
|
|
231
233
|
} catch (error) {
|
|
234
|
+
handleModalError(error);
|
|
232
235
|
this._handleCallError(error, 'join');
|
|
233
236
|
}
|
|
234
237
|
}
|
|
@@ -360,6 +363,7 @@ export default class TUICallService {
|
|
|
360
363
|
error,
|
|
361
364
|
});
|
|
362
365
|
if (handleRepeatedCallError(error)) return;
|
|
366
|
+
handleModalError(error);
|
|
363
367
|
noDevicePermissionToast(error, CallMediaType.AUDIO, this._tuiCallEngine);
|
|
364
368
|
this._resetCallStore();
|
|
365
369
|
}
|
|
@@ -375,6 +379,7 @@ export default class TUICallService {
|
|
|
375
379
|
}
|
|
376
380
|
});
|
|
377
381
|
} catch (error) {
|
|
382
|
+
handleModalError(error);
|
|
378
383
|
console.debug(error);
|
|
379
384
|
}
|
|
380
385
|
this._resetCallStore();
|
|
@@ -388,6 +393,7 @@ export default class TUICallService {
|
|
|
388
393
|
this._chatCombine?.callTUIService({ message: response?.data?.message });
|
|
389
394
|
}
|
|
390
395
|
} catch (error) {
|
|
396
|
+
handleModalError(error);
|
|
391
397
|
console.debug(error);
|
|
392
398
|
}
|
|
393
399
|
this._resetCallStore();
|
|
@@ -134,4 +134,15 @@ export const en = {
|
|
|
134
134
|
'accept-error': 'Accept failed',
|
|
135
135
|
'accept-device-error': 'Accept failed, unable to auth calling device',
|
|
136
136
|
'call-error': 'Start call failed',
|
|
137
|
+
// 错误提示
|
|
138
|
+
'error.10001': "Your application has not enabled audio/video call (TUICallKit) capability. You can go to the <a href='https://console.cloud.tencent.com/im/detail'>console</a> to apply for a free trial or purchase call capability packages: <a href='https://buy.cloud.tencent.com/avc?addRavLicense=1&position=1600110000&ravLicenseType=1®ionId=1'>Purchase Page</a>",
|
|
139
|
+
'error.10002': "You do not currently support using this capability. Please go to the <a href='https://buy.cloud.tencent.com/avc?addRavLicense=1&position=1600110000&ravLicenseType=1®ionId=1'>purchase page</a> to buy and activate it",
|
|
140
|
+
'error.10004': "Camera/microphone permission was denied. Please check browser settings to ensure camera and microphone access is allowed. If you have confirmed permission is granted, please go to <a href='https://web.sdk.qcloud.com/trtc/webrtc/demo/detect/index.html'>Audio/Video Capability Detection</a> to check if your device and environment support calls",
|
|
141
|
+
'error.10005': "No microphone device detected. Please ensure your device has a microphone connected and check if the microphone is available in system or browser settings.",
|
|
142
|
+
'error.10006': "No camera device detected. Please ensure your camera is connected and check if the camera is available in system or browser settings.",
|
|
143
|
+
'error.10007': "Current browser environment does not support WebRTC functionality. Please go to <a href='https://web.sdk.qcloud.com/trtc/webrtc/demo/detect/index.html'>Audio/Video Capability Detection</a> to check your device and environment compatibility",
|
|
144
|
+
'error.10008': "TUICallEngine has not completed initialization or login. Please ensure you have successfully executed init or login operations before calling this function. Solution: <a href='https://cloud.tencent.com/document/product/647/78769#3a61f42b-e06f-49af-88bf-362d40025887'>View Documentation</a>",
|
|
145
|
+
'error.10012': "Detected that the current page is under HTTP protocol. To ensure smooth access and full functionality of TUICallEngine SDK for production environment users, please use HTTPS protocol (or localhost) to access the audio/video application page. For details, please visit: <a href='https://web.sdk.qcloud.com/trtc/webrtc/v5/doc/zh-cn/tutorial-05-info-browser.html#h2-3'>View Documentation</a>",
|
|
146
|
+
'error.10013': "Call failed: You have been blocked by the other party or you have blocked the other party",
|
|
147
|
+
'error': 'Error',
|
|
137
148
|
};
|
|
@@ -133,4 +133,15 @@ export const ja_JP = {
|
|
|
133
133
|
'accept-error': '接続できませんでした',
|
|
134
134
|
'accept-device-error': '接続できませんでした。発信側デバイスを認証できません',
|
|
135
135
|
'call-error': '通話が開始できませんでした',
|
|
136
|
+
// 错误提示
|
|
137
|
+
'error.10001': "あなたのアプリケーションは音声・ビデオ通話(TUICallKit)機能を有効にしていません。<a href='https://console.cloud.tencent.com/im/detail'>コンソール</a>で無料体験を申請するか、通話機能パッケージを購入してください:<a href='https://buy.cloud.tencent.com/avc?addRavLicense=1&position=1600110000&ravLicenseType=1®ionId=1'>購入ページ</a>",
|
|
138
|
+
'error.10002': "現在この機能を使用することはできません。<a href='https://buy.cloud.tencent.com/avc?addRavLicense=1&position=1600110000&ravLicenseType=1®ionId=1'>購入ページ</a>で購入して有効にしてください",
|
|
139
|
+
'error.10004': "カメラ/マイクのアクセス許可が拒否されました。ブラウザ設定を確認し、カメラとマイクの使用が許可されていることを確認してください。許可されている場合は、<a href='https://web.sdk.qcloud.com/trtc/webrtc/demo/detect/index.html'>音声・ビデオ機能検出</a>にアクセスして、お使いのデバイスと環境が通話をサポートしているか確認してください",
|
|
140
|
+
'error.10005': "マイクデバイスが検出されませんでした。デバイスにマイクが接続されていることを確認し、システムまたはブラウザ設定でマイクが利用可能かどうかを確認してください。",
|
|
141
|
+
'error.10006': "カメラデバイスが検出されませんでした。カメラが接続されていることを確認し、システムまたはブラウザ設定でカメラが利用可能かどうかを確認してください。",
|
|
142
|
+
'error.10007': "現在のブラウザ環境はWebRTC機能をサポートしていません。<a href='https://web.sdk.qcloud.com/trtc/webrtc/demo/detect/index.html'>音声・ビデオ機能検出</a>にアクセスして、お使いのデバイスと環境の互換性を確認してください",
|
|
143
|
+
'error.10008': "TUICallEngineが初期化またはログインを完了していません。この機能を呼び出す前に、initまたはlogin操作が正常に実行されていることを確認してください。解決策:<a href='https://cloud.tencent.com/document/product/647/78769#3a61f42b-e06f-49af-88bf-362d40025887'>ドキュメントを確認</a>",
|
|
144
|
+
'error.10012': "現在のページがHTTPプロトコル下にあることが検出されました。本番環境のユーザーがTUICallEngine SDKの全機能をスムーズに利用できるようにするため、音声・ビデオアプリケーションページにはHTTPSプロトコル(またはlocalhost)を使用してアクセスしてください。詳細については、<a href='https://web.sdk.qcloud.com/trtc/webrtc/v5/doc/zh-cn/tutorial-05-info-browser.html#h2-3'>ドキュメントを確認</a>してください",
|
|
145
|
+
'error.10013': "通話失敗:相手にブロックされているか、または相手をブロックしています",
|
|
146
|
+
'error': 'エラー',
|
|
136
147
|
};
|
|
@@ -129,4 +129,15 @@ export const zh = {
|
|
|
129
129
|
'accept-error': '接通失败',
|
|
130
130
|
'accept-device-error': '接通失败,通话设备获取失败',
|
|
131
131
|
'call-error': '发起通话失败',
|
|
132
|
+
// 错误提示
|
|
133
|
+
'error.10001': "您的应用还未开通音视频通话(TUICallKit)能力,您可以去<a href='https://console.cloud.tencent.com/im/detail'>控制台</a>申请免费体验,或购买通话能力套餐包:<a href='https://buy.cloud.tencent.com/avc?addRavLicense=1&position=1600110000&ravLicenseType=1®ionId=1'>购买页面</a>",
|
|
134
|
+
'error.10002': "您暂不支持使用该能力,请前往<a href='https://buy.cloud.tencent.com/avc?addRavLicense=1&position=1600110000&ravLicenseType=1®ionId=1'>购买页</a>购买开通",
|
|
135
|
+
'error.10004': "摄像头/麦克风权限被拒绝,请检查浏览器设置,确保已允许使用您的摄像头和麦克风。如果您确认已授予权限,请前往<a href='https://web.sdk.qcloud.com/trtc/webrtc/demo/detect/index.html'>音视频能力检测</a>检查您的设备和环境是否支持通话",
|
|
136
|
+
'error.10005': "未检测到麦克风设备。请确保您的设备已连接麦克风,并检查系统或浏览器设置中麦克风是否可用。",
|
|
137
|
+
'error.10006': "未检测到摄像头设备。请确保您的摄像头已连接,并检查系统或浏览器设置中摄像头是否可用。",
|
|
138
|
+
'error.10007': "当前浏览器环境不支持 WebRTC 功能。请前往<a href='https://web.sdk.qcloud.com/trtc/webrtc/demo/detect/index.html'>音视频能力检测</a>检查您的设备和环境兼容性",
|
|
139
|
+
'error.10008': "TUICallEngine 尚未完成初始化或登录。请确保在调用此功能前,已成功执行 init 或 login 操作。解决方案:<a href='https://cloud.tencent.com/document/product/647/78769#3a61f42b-e06f-49af-88bf-362d40025887'>查看文档</a>",
|
|
140
|
+
'error.10012': "检测到当前页面正处于 http 协议下,为确保生产环境用户顺畅接入和体验 TUICallEngine SDK 的全部功能,请使用 https 协议(或 localhost)访问音视频应用页面。详情请前往:<a href='https://web.sdk.qcloud.com/trtc/webrtc/v5/doc/zh-cn/tutorial-05-info-browser.html#h2-3'>查看文档</a>",
|
|
141
|
+
'error.10013': "呼叫失败:您已被对方拉黑或您拉黑了对方",
|
|
142
|
+
'error': '错误',
|
|
132
143
|
};
|
|
@@ -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
|
+
|