@trtc/calls-uikit-react 4.5.7 → 4.5.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 -2
- package/src/Components/TUICallKit/TUICallKit.tsx +17 -0
- package/src/TUICallService/CallService/UIKitModal.ts +44 -9
- package/src/TUICallService/CallService/engineEventHandler.ts +2 -2
- package/src/TUICallService/CallService/index.ts +10 -10
- package/src/TUICallService/locales/en.ts +3 -0
- package/src/TUICallService/locales/ja_JP.ts +4 -2
- package/src/TUICallService/locales/zh-cn.ts +3 -0
- package/src/index.ts +1 -1
- package/tuicall-uikit-react.es.js +3432 -3140
- package/tuicall-uikit-react.umd.js +4 -4
- package/types/TUICallService/CallService/UIKitModal.d.ts +1 -1
- package/types/TUICallService/locales/en.d.ts +3 -0
- package/types/TUICallService/locales/ja_JP.d.ts +2 -0
- package/types/TUICallService/locales/zh-cn.d.ts +3 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@trtc/calls-uikit-react",
|
|
3
|
-
"version": "4.5.
|
|
3
|
+
"version": "4.5.8",
|
|
4
4
|
"main": "./tuicall-uikit-react.umd.js",
|
|
5
5
|
"module": "./tuicall-uikit-react.es.js",
|
|
6
6
|
"types": "./types/index.d.ts",
|
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
},
|
|
15
15
|
"dependencies": {
|
|
16
16
|
"@tencentcloud/tui-core-lite": "~1.0.1",
|
|
17
|
-
"@trtc/call-engine-lite-js": "~4.0.
|
|
17
|
+
"@trtc/call-engine-lite-js": "~4.0.9",
|
|
18
18
|
"@tencentcloud/lite-chat": "^1.6.3",
|
|
19
19
|
"@trtc/call-engine-lite-wx": "~5.0.6"
|
|
20
20
|
},
|
|
@@ -26,6 +26,7 @@ import {
|
|
|
26
26
|
} from '../context';
|
|
27
27
|
import { MessagePlugin } from '../components/base/Message/MessagePlugin';
|
|
28
28
|
import FloatingWindow from '../components/common/FloatingWindow';
|
|
29
|
+
import { UIKitModal } from '../components/common/UIKitModal';
|
|
29
30
|
import useGetSpeakers from '../hooks/useGetSpeakers';
|
|
30
31
|
import TUICallKitStyle from './TUICallKit.module.scss';
|
|
31
32
|
import Portal from '../components/base/Portal/Portal';
|
|
@@ -177,6 +178,21 @@ export default function TUICallKit(props: ITUICallKitProps) {
|
|
|
177
178
|
setTranslateContextValue({ t: value });
|
|
178
179
|
}
|
|
179
180
|
|
|
181
|
+
// Consume the MODAL_ERROR store written by handleModalError (e.g. package errors
|
|
182
|
+
// -1001/-1002, no camera/microphone 60003/60004). UIKitModal.openModal is imperative
|
|
183
|
+
// and mounts its own portal on document.body, so it works even when callStatus is IDLE
|
|
184
|
+
// and the component tree below returns null.
|
|
185
|
+
const handleModalErrorChange = (value) => {
|
|
186
|
+
if (value) {
|
|
187
|
+
UIKitModal.openModal({
|
|
188
|
+
id: value?.id,
|
|
189
|
+
title: value?.title,
|
|
190
|
+
content: value?.content,
|
|
191
|
+
type: 'error',
|
|
192
|
+
});
|
|
193
|
+
}
|
|
194
|
+
};
|
|
195
|
+
|
|
180
196
|
const watchOptions = {
|
|
181
197
|
[NAME.CALL_STATUS]: handleCallStatusChange,
|
|
182
198
|
[NAME.IS_GROUP]: handleIsGroupChange,
|
|
@@ -192,6 +208,7 @@ export default function TUICallKit(props: ITUICallKitProps) {
|
|
|
192
208
|
[NAME.IS_SHOW_ENABLE_VIRTUAL_BACKGROUND]: handleIsShowEnableVirtualBackgroundChange,
|
|
193
209
|
[NAME.IS_MUTE_SPEAKER]: handleMuteSpeakerChange,
|
|
194
210
|
[NAME.TRANSLATE]: handleTranslateChange,
|
|
211
|
+
[NAME.MODAL_ERROR]: handleModalErrorChange,
|
|
195
212
|
};
|
|
196
213
|
|
|
197
214
|
useLayoutEffect(() => {
|
|
@@ -25,16 +25,18 @@ const WEB_MODAL_ERROR_CODES = [
|
|
|
25
25
|
30000,
|
|
26
26
|
20007,
|
|
27
27
|
101002,
|
|
28
|
+
101011,
|
|
29
|
+
-3301,
|
|
28
30
|
];
|
|
29
31
|
|
|
30
32
|
const WEB_MODAL_ERROR_MAP = {
|
|
31
33
|
'-1001': {
|
|
32
34
|
id: 10001,
|
|
33
|
-
key: 'error.10001'
|
|
35
|
+
key: 'error.10001',
|
|
34
36
|
},
|
|
35
37
|
'-1002': {
|
|
36
38
|
id: 10002,
|
|
37
|
-
key: 'error.10002'
|
|
39
|
+
key: 'error.10002',
|
|
38
40
|
},
|
|
39
41
|
'-1101': {
|
|
40
42
|
id: 10004,
|
|
@@ -67,6 +69,18 @@ const WEB_MODAL_ERROR_MAP = {
|
|
|
67
69
|
'101002': {
|
|
68
70
|
id: 10014,
|
|
69
71
|
key: 'error.10014'
|
|
72
|
+
},
|
|
73
|
+
// 101011: package ability not supported, needs an upgrade on the console.
|
|
74
|
+
// Message references the engine's ERROR_PACKAGE_NOT_SUPPORTED wording.
|
|
75
|
+
'101011': {
|
|
76
|
+
id: 10016,
|
|
77
|
+
key: 'error.10016'
|
|
78
|
+
},
|
|
79
|
+
'-3301': {
|
|
80
|
+
id: 10015,
|
|
81
|
+
key: 'error.10015',
|
|
82
|
+
// Message shown when the call is initiated from the Chat + TUICallKit integrated scenario.
|
|
83
|
+
chatKey: 'error.10015.chat'
|
|
70
84
|
}
|
|
71
85
|
};
|
|
72
86
|
// @endif
|
|
@@ -76,6 +90,8 @@ const MINI_MODAL_ERROR_CODES = [
|
|
|
76
90
|
-1001,
|
|
77
91
|
-1002,
|
|
78
92
|
101002,
|
|
93
|
+
101011,
|
|
94
|
+
-3301,
|
|
79
95
|
];
|
|
80
96
|
|
|
81
97
|
const MINI_MODAL_ERROR_MAP = {
|
|
@@ -90,33 +106,50 @@ const MINI_MODAL_ERROR_MAP = {
|
|
|
90
106
|
'101002': {
|
|
91
107
|
id: 10014,
|
|
92
108
|
content: '发起通话失败,用户 ID 无效,请确认该用户已注册'
|
|
109
|
+
},
|
|
110
|
+
// 101011: package ability not supported, needs an upgrade on the console.
|
|
111
|
+
// Content references the engine's ERROR_PACKAGE_NOT_SUPPORTED wording.
|
|
112
|
+
'101011': {
|
|
113
|
+
id: 10016,
|
|
114
|
+
content: '您的应用还未开通音视频通话(TUICallKit)能力,您可以去控制台申请免费体验:https://console.cloud.tencent.com/im/detail 或购买通话能力套餐包:https://buy.cloud.tencent.com/avc 有疑问请参考:https://cloud.tencent.com/document/product/647/104662'
|
|
115
|
+
},
|
|
116
|
+
'-3301': {
|
|
117
|
+
id: 10015,
|
|
118
|
+
content: '未开通 TRTC 服务导致进房失败,请到控制台为您的应用开通 TRTC 服务',
|
|
119
|
+
// Content shown when the call is initiated from the Chat + TUICallKit integrated scenario.
|
|
120
|
+
chatContent: '当前为 Chat 融合场景,未开通 TRTC 服务导致进房失败,请到 IM 控制台为您的应用开通 TRTC 服务'
|
|
93
121
|
}
|
|
94
122
|
}
|
|
95
123
|
// @endif
|
|
96
124
|
|
|
97
|
-
|
|
125
|
+
// `isFromChat` marks whether the current call is initiated from the Chat + TUICallKit
|
|
126
|
+
// integrated scenario (true) or from standalone TUICallKit (false), so the modal can
|
|
127
|
+
// show source-specific guidance for package errors such as -1001 / -1002.
|
|
128
|
+
export function handleModalError(error, isFromChat = false) {
|
|
98
129
|
if (!error || !error?.code) {
|
|
99
130
|
return;
|
|
100
131
|
}
|
|
101
132
|
|
|
102
133
|
// @if process.env.BUILD_TARGET!='MINI'
|
|
103
|
-
handleWebModalError(error);
|
|
134
|
+
handleWebModalError(error, isFromChat);
|
|
104
135
|
// @endif
|
|
105
136
|
|
|
106
137
|
// @if process.env.BUILD_TARGET='MINI'
|
|
107
|
-
handleMiniModalError(error);
|
|
138
|
+
handleMiniModalError(error, isFromChat);
|
|
108
139
|
// @endif
|
|
109
140
|
}
|
|
110
141
|
|
|
111
142
|
// @if process.env.BUILD_TARGET!='MINI'
|
|
112
|
-
function handleWebModalError(error) {
|
|
143
|
+
function handleWebModalError(error, isFromChat = false) {
|
|
113
144
|
if (!WEB_MODAL_ERROR_CODES.includes(error.code)) {
|
|
114
145
|
return;
|
|
115
146
|
}
|
|
116
147
|
|
|
117
148
|
const errorInfo = WEB_MODAL_ERROR_MAP[error.code.toString()];
|
|
118
149
|
if (errorInfo) {
|
|
119
|
-
|
|
150
|
+
// Prefer the Chat-integrated message when available and the call comes from Chat.
|
|
151
|
+
const messageKey = isFromChat && errorInfo.chatKey ? errorInfo.chatKey : errorInfo.key;
|
|
152
|
+
let content = t(messageKey);
|
|
120
153
|
TUIStore.update(StoreName.CALL, NAME.MODAL_ERROR, {
|
|
121
154
|
id: errorInfo.id,
|
|
122
155
|
content: content,
|
|
@@ -127,16 +160,18 @@ function handleWebModalError(error) {
|
|
|
127
160
|
// @endif
|
|
128
161
|
|
|
129
162
|
// @if process.env.BUILD_TARGET='MINI'
|
|
130
|
-
function handleMiniModalError(error) {
|
|
163
|
+
function handleMiniModalError(error, isFromChat = false) {
|
|
131
164
|
if (!MINI_MODAL_ERROR_CODES.includes(error.code)) {
|
|
132
165
|
return;
|
|
133
166
|
}
|
|
134
167
|
|
|
135
168
|
const errorInfo = MINI_MODAL_ERROR_MAP[error.code.toString()];
|
|
136
169
|
if (errorInfo) {
|
|
170
|
+
// Prefer the Chat-integrated content when available and the call comes from Chat.
|
|
171
|
+
const content = isFromChat && errorInfo.chatContent ? errorInfo.chatContent : errorInfo.content;
|
|
137
172
|
UIKitModal.openModal({
|
|
138
173
|
id: errorInfo.id,
|
|
139
|
-
content:
|
|
174
|
+
content: content,
|
|
140
175
|
title: '错误',
|
|
141
176
|
type: 'error'
|
|
142
177
|
});
|
|
@@ -344,7 +344,7 @@ export default class EngineEventHandler {
|
|
|
344
344
|
private async _handleUserVideoAvailable(event: any): Promise<any> {
|
|
345
345
|
const { userID: userId, isVideoAvailable } = analyzeEventData(event);
|
|
346
346
|
console.log(`${NAME.PREFIX}_handleUserVideoAvailable event data: ${JSON.stringify(event)}.`);
|
|
347
|
-
|
|
347
|
+
|
|
348
348
|
this._setRemoteUserInfoAudioVideoAvailable(isVideoAvailable, NAME.VIDEO, userId);
|
|
349
349
|
try {
|
|
350
350
|
isVideoAvailable && await this._startRemoteView(userId);
|
|
@@ -395,7 +395,7 @@ export default class EngineEventHandler {
|
|
|
395
395
|
remoteUserInfoList.push({ userId });
|
|
396
396
|
TUIStore.update(StoreName.CALL, NAME.REMOTE_USER_INFO_LIST, remoteUserInfoList);
|
|
397
397
|
TUIStore.update(StoreName.CALL, NAME.REMOTE_USER_INFO_EXCLUDE_VOLUMN_LIST, remoteUserInfoList);
|
|
398
|
-
|
|
398
|
+
|
|
399
399
|
const [userInfo] = await getRemoteUserProfile([userId], this._callService?.getTim());
|
|
400
400
|
remoteUserInfoList = TUIStore.getData(StoreName.CALL, NAME.REMOTE_USER_INFO_LIST);
|
|
401
401
|
remoteUserInfoList.forEach((obj) => {
|
|
@@ -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.5.
|
|
30
|
+
const version = '4.5.8';
|
|
31
31
|
import AIAssistant from './AIAssistant'; // 仅 web 支持 AI 实时字幕
|
|
32
32
|
const frameWork = 'react';
|
|
33
33
|
export { TUIGlobal, TUIStore, uiDesign };
|
|
@@ -65,8 +65,8 @@ export default class TUICallService {
|
|
|
65
65
|
console.log(`${NAME.PREFIX}version: ${version}`);
|
|
66
66
|
this._wasmReadyPromise = new Promise(resolve => {
|
|
67
67
|
this._wasmReadyResolve = resolve;
|
|
68
|
-
});
|
|
69
|
-
this._loadWasm();
|
|
68
|
+
});
|
|
69
|
+
this._loadWasm();
|
|
70
70
|
this._watchTUIStore();
|
|
71
71
|
this._engineEventHandler = EngineEventHandler.getInstance({ callService: this });
|
|
72
72
|
|
|
@@ -90,7 +90,7 @@ export default class TUICallService {
|
|
|
90
90
|
return;
|
|
91
91
|
}
|
|
92
92
|
await this._wasmReadyPromise;
|
|
93
|
-
|
|
93
|
+
|
|
94
94
|
if (!this._isInitialized) {
|
|
95
95
|
await this._doInit(params);
|
|
96
96
|
this._isInitialized = true;
|
|
@@ -215,7 +215,7 @@ export default class TUICallService {
|
|
|
215
215
|
const response = await this._tuiCallEngine.calls(callsParams);
|
|
216
216
|
await this._updateCallStoreAfterCall(userIDList, response);
|
|
217
217
|
} catch (error: any) {
|
|
218
|
-
handleModalError(error);
|
|
218
|
+
handleModalError(error, this._isFromChat);
|
|
219
219
|
this._handleCallError(error, 'calls');
|
|
220
220
|
}
|
|
221
221
|
}
|
|
@@ -251,7 +251,7 @@ export default class TUICallService {
|
|
|
251
251
|
// setLocalUserInfoAudioVideoAvailable(true, NAME.VIDEO);
|
|
252
252
|
// }
|
|
253
253
|
} catch (error) {
|
|
254
|
-
handleModalError(error);
|
|
254
|
+
handleModalError(error, this._isFromChat);
|
|
255
255
|
this._handleCallError(error, 'join');
|
|
256
256
|
}
|
|
257
257
|
}
|
|
@@ -381,7 +381,7 @@ export default class TUICallService {
|
|
|
381
381
|
error,
|
|
382
382
|
});
|
|
383
383
|
if (handleRepeatedCallError(error)) return;
|
|
384
|
-
handleModalError(error);
|
|
384
|
+
handleModalError(error, this._isFromChat);
|
|
385
385
|
noDevicePermissionToast(error, CallMediaType.AUDIO, this._tuiCallEngine);
|
|
386
386
|
this._resetCallStore();
|
|
387
387
|
}
|
|
@@ -412,7 +412,7 @@ export default class TUICallService {
|
|
|
412
412
|
}
|
|
413
413
|
});
|
|
414
414
|
} catch (error) {
|
|
415
|
-
handleModalError(error);
|
|
415
|
+
handleModalError(error, this._isFromChat);
|
|
416
416
|
console.debug(error);
|
|
417
417
|
}
|
|
418
418
|
this._resetCallStore();
|
|
@@ -426,7 +426,7 @@ export default class TUICallService {
|
|
|
426
426
|
this._chatCombine?.callTUIService({ message: response?.data?.message });
|
|
427
427
|
}
|
|
428
428
|
} catch (error) {
|
|
429
|
-
handleModalError(error);
|
|
429
|
+
handleModalError(error, this._isFromChat);
|
|
430
430
|
console.debug(error);
|
|
431
431
|
}
|
|
432
432
|
this._resetCallStore();
|
|
@@ -759,7 +759,7 @@ export default class TUICallService {
|
|
|
759
759
|
private _resetCallStore() {
|
|
760
760
|
this._cleanupAvoidRepeatCallState();
|
|
761
761
|
this._bellContext?.stop();
|
|
762
|
-
|
|
762
|
+
|
|
763
763
|
const oldStatusStr = generateStatusChangeText();
|
|
764
764
|
this._stopTimer();
|
|
765
765
|
// localUserInfo, language 在通话结束后不需要清除
|
|
@@ -145,6 +145,9 @@ export const en = {
|
|
|
145
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
146
|
'error.10013': "Call failed: You have been blocked by the other party or you have blocked the other party",
|
|
147
147
|
'error.10014': "Call initiation failed. User ID is invalid. Please confirm that the user is registered.",
|
|
148
|
+
'error.10015': "Failed to enter the room because the TRTC service is not activated. Please go to the <a href='https://console.cloud.tencent.com/trtc'>console</a> to activate the TRTC service for your application",
|
|
149
|
+
'error.10015.chat': "You are currently in the Chat + TUICallKit integrated scenario. Failed to enter the room because the TRTC service is not activated. Please go to the <a href='https://console.cloud.tencent.com/im/rtc-config'>IM console</a> to activate the TRTC service for your application",
|
|
150
|
+
'error.10016': "Your application has not enabled the audio and video call (TUICallKit) capability. You can apply for a free trial in the <a href='https://console.cloud.tencent.com/im/detail'>console</a>, or purchase the <a href='https://buy.cloud.tencent.com/avc'>call capability package</a>. If you have any questions, please refer to the <a href='https://cloud.tencent.com/document/product/647/104662'>documentation</a>",
|
|
148
151
|
'error': 'Error',
|
|
149
152
|
// AI Subtitle Settings
|
|
150
153
|
'ai-subtitle': 'AI Subtitle',
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export const ja_JP = {
|
|
2
|
-
// 按钮文案
|
|
2
|
+
// 按钮文案
|
|
3
3
|
'hangup': '通話終了',
|
|
4
4
|
'reject': '拒否',
|
|
5
5
|
'accept': '応答',
|
|
@@ -55,7 +55,7 @@ export const ja_JP = {
|
|
|
55
55
|
'open camera': 'オープンカメラ',
|
|
56
56
|
'close camera': 'カメラを閉じる',
|
|
57
57
|
'open microphone': 'オープンマイク',
|
|
58
|
-
'close microphone': 'マイクを閉じる',
|
|
58
|
+
'close microphone': 'マイクを閉じる',
|
|
59
59
|
'camera enabled': 'カメラオン',
|
|
60
60
|
'camera disabled': 'カメラオフ',
|
|
61
61
|
'microphone enabled': 'マイクオン',
|
|
@@ -144,6 +144,8 @@ export const ja_JP = {
|
|
|
144
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
145
|
'error.10013': "通話失敗:相手にブロックされているか、または相手をブロックしています",
|
|
146
146
|
'error.10014': "通話の開始に失敗しました。ユーザーIDが無効です。ユーザーが登録されていることを確認してください。",
|
|
147
|
+
'error.10015.chat': "現在は Chat と TUICallKit の統合シナリオです。TRTC サービスが有効化されていないため、ルームへの入室に失敗しました。<a href='https://console.cloud.tencent.com/im/rtc-config'>IM コンソール</a>でアプリケーションの TRTC サービスを有効化してください",
|
|
148
|
+
'error.10016': "あなたのアプリケーションは音声・ビデオ通話(TUICallKit)機能を有効にしていません。<a href='https://console.cloud.tencent.com/im/detail'>コンソール</a>で無料体験を申請するか、<a href='https://buy.cloud.tencent.com/avc'>通話機能パッケージ</a>を購入してください。ご不明な点がある場合は、<a href='https://cloud.tencent.com/document/product/647/104662'>ドキュメント</a>をご参照ください",
|
|
147
149
|
'error': 'エラー',
|
|
148
150
|
// AI Subtitle Settings
|
|
149
151
|
'ai-subtitle': 'AI字幕',
|
|
@@ -140,6 +140,9 @@ export const zh = {
|
|
|
140
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
141
|
'error.10013': "呼叫失败:您已被对方拉黑或您拉黑了对方",
|
|
142
142
|
'error.10014': "发起通话失败,用户 ID 无效,请确认该用户已注册。",
|
|
143
|
+
'error.10015': "未开通 TRTC 服务导致进房失败,请前往<a href='https://console.cloud.tencent.com/trtc'>控制台</a>为您的应用开通 TRTC 服务",
|
|
144
|
+
'error.10015.chat': "当前为 Chat 与 TUICallKit 融合场景,未开通 TRTC 服务导致进房失败,请前往 <a href='https://console.cloud.tencent.com/im/rtc-config'>IM 控制台</a>为您的应用开通 TRTC 服务",
|
|
145
|
+
'error.10016': "您的应用还未开通音视频通话(TUICallKit)能力,您可以去<a href='https://console.cloud.tencent.com/im/detail'>控制台</a>申请免费体验,或购买<a href='https://buy.cloud.tencent.com/avc'>通话能力套餐包</a>,有疑问请参考<a href='https://cloud.tencent.com/document/product/647/104662'>相关文档</a>",
|
|
143
146
|
'error': '错误',
|
|
144
147
|
// AI Subtitle Settings
|
|
145
148
|
'ai-subtitle': 'AI 字幕',
|