@trtc/calls-uikit-react 4.5.8 → 4.5.9

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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@trtc/calls-uikit-react",
3
- "version": "4.5.8",
3
+ "version": "4.5.9",
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.9",
17
+ "@trtc/call-engine-lite-js": "~4.0.10",
18
18
  "@tencentcloud/lite-chat": "^1.6.3",
19
19
  "@trtc/call-engine-lite-wx": "~5.0.6"
20
20
  },
@@ -22,6 +22,7 @@ const WEB_MODAL_ERROR_CODES = [
22
22
  60004,
23
23
  60006,
24
24
  -1201,
25
+ -1202,
25
26
  30000,
26
27
  20007,
27
28
  101002,
@@ -58,6 +59,12 @@ const WEB_MODAL_ERROR_MAP = {
58
59
  id: 10008,
59
60
  key: 'error.10008'
60
61
  },
62
+ // -1202 + native message 'invitee_list cannot be null': the caller tried to
63
+ // call themselves, so the invitee list ends up empty after filtering.
64
+ '-1202': {
65
+ id: 10017,
66
+ key: 'error.10017'
67
+ },
61
68
  '30000': {
62
69
  id: 10012,
63
70
  key: 'error.10012'
@@ -70,6 +77,12 @@ const WEB_MODAL_ERROR_MAP = {
70
77
  id: 10014,
71
78
  key: 'error.10014'
72
79
  },
80
+ // Same native code 101002 is reused for the "invalid callee list length" scenario,
81
+ // distinguished by message. See handleWebModalError for the message-based selection.
82
+ '101002_CALLEE_LIST': {
83
+ id: 10018,
84
+ key: 'error.10018'
85
+ },
73
86
  // 101011: package ability not supported, needs an upgrade on the console.
74
87
  // Message references the engine's ERROR_PACKAGE_NOT_SUPPORTED wording.
75
88
  '101011': {
@@ -89,6 +102,7 @@ const WEB_MODAL_ERROR_MAP = {
89
102
  const MINI_MODAL_ERROR_CODES = [
90
103
  -1001,
91
104
  -1002,
105
+ -1202,
92
106
  101002,
93
107
  101011,
94
108
  -3301,
@@ -103,9 +117,21 @@ const MINI_MODAL_ERROR_MAP = {
103
117
  id: 10002,
104
118
  content: '您暂不支持使用该能力,请前往购买页购买开通'
105
119
  },
120
+ // -1202 + native message 'invitee_list cannot be null': the caller tried to
121
+ // call themselves, so the invitee list ends up empty after filtering.
122
+ '-1202': {
123
+ id: 10017,
124
+ content: '发起通话失败:被叫 userID 不能是当前登录用户自己,请检查传入的被叫 userID'
125
+ },
106
126
  '101002': {
107
127
  id: 10014,
108
- content: '发起通话失败,用户 ID 无效,请确认该用户已注册'
128
+ content: '发起通话失败:被叫 userID 无效,请确认该 userID 已注册并登录过 TUICallKit'
129
+ },
130
+ // Same native code 101002 is reused for the "invalid callee list length" scenario,
131
+ // distinguished by message. See handleMiniModalError for the message-based selection.
132
+ '101002_CALLEE_LIST': {
133
+ id: 10018,
134
+ content: '发起通话失败:单次呼叫的被叫用户数量需在 1 到 8 之间,请检查传入的 userIDList'
109
135
  },
110
136
  // 101011: package ability not supported, needs an upgrade on the console.
111
137
  // Content references the engine's ERROR_PACKAGE_NOT_SUPPORTED wording.
@@ -122,6 +148,21 @@ const MINI_MODAL_ERROR_MAP = {
122
148
  }
123
149
  // @endif
124
150
 
151
+ // Resolve the modal map key for an error. Code 101002 is reused by two scenarios
152
+ // (invalid userId / invalid callee list length), so it is disambiguated by message.
153
+ // Matches both the raw native message and the marker appended by the engine, so it
154
+ // works whether or not the engine has already localized the message.
155
+ function resolveModalErrorKey(error) {
156
+ if (error.code === 101002) {
157
+ const message = error?.message || '';
158
+ if (message.includes('CalleeList_Account length must be between 1 and 8')
159
+ || message.includes('ERROR_INVALID_CALLEE_LIST')) {
160
+ return '101002_CALLEE_LIST';
161
+ }
162
+ }
163
+ return error.code.toString();
164
+ }
165
+
125
166
  // `isFromChat` marks whether the current call is initiated from the Chat + TUICallKit
126
167
  // integrated scenario (true) or from standalone TUICallKit (false), so the modal can
127
168
  // show source-specific guidance for package errors such as -1001 / -1002.
@@ -145,7 +186,7 @@ function handleWebModalError(error, isFromChat = false) {
145
186
  return;
146
187
  }
147
188
 
148
- const errorInfo = WEB_MODAL_ERROR_MAP[error.code.toString()];
189
+ const errorInfo = WEB_MODAL_ERROR_MAP[resolveModalErrorKey(error)];
149
190
  if (errorInfo) {
150
191
  // Prefer the Chat-integrated message when available and the call comes from Chat.
151
192
  const messageKey = isFromChat && errorInfo.chatKey ? errorInfo.chatKey : errorInfo.key;
@@ -165,7 +206,7 @@ function handleMiniModalError(error, isFromChat = false) {
165
206
  return;
166
207
  }
167
208
 
168
- const errorInfo = MINI_MODAL_ERROR_MAP[error.code.toString()];
209
+ const errorInfo = MINI_MODAL_ERROR_MAP[resolveModalErrorKey(error)];
169
210
  if (errorInfo) {
170
211
  // Prefer the Chat-integrated content when available and the call comes from Chat.
171
212
  const content = isFromChat && errorInfo.chatContent ? errorInfo.chatContent : errorInfo.content;
@@ -275,6 +275,14 @@ export default class ChatCombine {
275
275
  */
276
276
  private async _handleTUICoreOnClick(options, type: CallMediaType) {
277
277
  try {
278
+ // Guard: block starting a new call while already busy. `calls()` returns
279
+ // silently when the status is not IDLE, so we surface a toast here to let
280
+ // the user know a call is already in progress.
281
+ if (TUIStore.getData(StoreName.CALL, NAME.CALL_STATUS) !== CallStatus.IDLE) {
282
+ TUIStore.update(StoreName.CALL, NAME.TOAST_INFO, { content: 'in-calling-cannot-start-new', type: 'info' });
283
+ return;
284
+ }
285
+
278
286
  const { groupID, userIDList = [], version = '', ...rest } = options;
279
287
 
280
288
  await this._callService?.calls({ chatGroupID: groupID, userIDList, type, ...rest });
@@ -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.8';
30
+ const version = '4.5.9';
31
31
  import AIAssistant from './AIAssistant'; // 仅 web 支持 AI 实时字幕
32
32
  const frameWork = 'react';
33
33
  export { TUIGlobal, TUIStore, uiDesign };
@@ -106,4 +106,9 @@ export enum ROOM_ID_TYPE {
106
106
  NUMBER_ROOM_ID = 1,
107
107
  // eslint-disable-next-line no-unused-vars
108
108
  STRING_ROOM_ID = 2,
109
+ };
110
+ export enum CloudRecordPolicy {
111
+ FollowConsoleConfig = 0,
112
+ Enable = 1,
113
+ Disable = 2,
109
114
  };
@@ -11,6 +11,7 @@ import {
11
11
  AudioPlayBackDevice,
12
12
  FeatureButton,
13
13
  LayoutMode,
14
+ CloudRecordPolicy,
14
15
  } from './const/index';
15
16
  import { t } from './locales/index';
16
17
 
@@ -34,4 +35,5 @@ export {
34
35
  uiDesign,
35
36
  FeatureButton,
36
37
  LayoutMode,
38
+ CloudRecordPolicy,
37
39
  };
@@ -1,4 +1,4 @@
1
- import { CallStatus, CallRole } from '../const/index';
1
+ import { CallStatus, CallRole, CloudRecordPolicy } from '../const/index';
2
2
 
3
3
  type SDKAppID = { SDKAppID: number; } | { sdkAppID: number; };
4
4
  export interface IInitParamsBase {
@@ -19,6 +19,7 @@ export interface ICallsParams {
19
19
  userData?: string;
20
20
  timeout?: number;
21
21
  offlinePushInfo?: IOfflinePushInfo;
22
+ cloudRecordPolicy?: CloudRecordPolicy;
22
23
  }
23
24
  // userInfo interface
24
25
  export interface IUserInfo {
@@ -126,6 +126,7 @@ export const en = {
126
126
  'not-supported-webrtc': 'Your current environment does not support WebRTC',
127
127
  'blacklist-user-tips': 'The identifier is in blacklist. Failed to send this message!',
128
128
  'is-already-calling': 'TUICallKit is already on a call',
129
+ 'in-calling-cannot-start-new': 'A call is in progress. You cannot start a new call.',
129
130
  'need-init': 'Before initiating a call with TUICallKit, ensure that the TUICallKitAPI.init() method has executed successfully. ',
130
131
  "can't call yourself": "Can't call yourself", // eslint-disable-line
131
132
  'Use-phone-and-computer': 'Use your mobile phone and computer to experience video calls',
@@ -144,10 +145,12 @@ export const en = {
144
145
  '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
146
  '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
147
  'error.10013': "Call failed: You have been blocked by the other party or you have blocked the other party",
147
- 'error.10014': "Call initiation failed. User ID is invalid. Please confirm that the user is registered.",
148
+ 'error.10014': "Failed to start the call: the callee userID is invalid. Please make sure the userID is registered and has logged in to TUICallKit.",
148
149
  '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
150
  '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
151
  '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>",
152
+ 'error.10017': "Failed to start the call: the callee userID cannot be the current logged-in user. Please check the callee userID you passed in.",
153
+ 'error.10018': "Failed to start the call: the number of callees in a single call must be between 1 and 8. Please check the userIDList you passed in.",
151
154
  'error': 'Error',
152
155
  // AI Subtitle Settings
153
156
  'ai-subtitle': 'AI Subtitle',
@@ -128,6 +128,7 @@ export const ja_JP = {
128
128
  'not-supported-webrtc': '現在の環境はWebRTCをサポートしていません',
129
129
  'blacklist-user-tips': 'ユーザーはブラックリストに登録され、通話が開始できませんでした',
130
130
  'is-already-calling': 'TUICallKit はすでに通話中です',
131
+ 'in-calling-cannot-start-new': '通話中のため、新しい通話を開始できません',
131
132
  'need-init': 'TUICallKitで通話を開始する前に、TUICallKitAPI.init() メソッドが正常に実行されたことを確認してください。',
132
133
  "can't call yourself": '自分に電話をかけることができません',
133
134
  'accept-error': '接続できませんでした',
@@ -143,9 +144,11 @@ export const ja_JP = {
143
144
  'error.10008': "TUICallEngineが初期化またはログインを完了していません。この機能を呼び出す前に、initまたはlogin操作が正常に実行されていることを確認してください。解決策:<a href='https://cloud.tencent.com/document/product/647/78769#3a61f42b-e06f-49af-88bf-362d40025887'>ドキュメントを確認</a>",
144
145
  '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
146
  'error.10013': "通話失敗:相手にブロックされているか、または相手をブロックしています",
146
- 'error.10014': "通話の開始に失敗しました。ユーザーIDが無効です。ユーザーが登録されていることを確認してください。",
147
+ 'error.10014': "通話の発信に失敗しました:着信側 userID が無効です。該当 userID が登録済みで、TUICallKit にログインしたことがあることを確認してください。",
147
148
  'error.10015.chat': "現在は Chat と TUICallKit の統合シナリオです。TRTC サービスが有効化されていないため、ルームへの入室に失敗しました。<a href='https://console.cloud.tencent.com/im/rtc-config'>IM コンソール</a>でアプリケーションの TRTC サービスを有効化してください",
148
149
  '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>をご参照ください",
150
+ 'error.10017': "通話の発信に失敗しました:着信側 userID を現在ログイン中のユーザー自身に指定することはできません。渡した着信側 userID を確認してください。",
151
+ 'error.10018': "通話の発信に失敗しました:1 回の通話で指定できる着信側ユーザー数は 1〜8 人である必要があります。渡した userIDList を確認してください。",
149
152
  'error': 'エラー',
150
153
  // AI Subtitle Settings
151
154
  'ai-subtitle': 'AI字幕',
@@ -124,6 +124,7 @@ export const zh = {
124
124
  'not-supported-webrtc': '当前环境不支持 WebRTC',
125
125
  'blacklist-user-tips': '发起通话失败,被对方拉入黑名单,禁止发起!',
126
126
  'is-already-calling': 'TUICallKit 已在通话状态',
127
+ 'in-calling-cannot-start-new': '正在通话中,无法发起新的通话',
127
128
  'need-init': 'TUICallKit 发起通话前需保证 TUICallKitAPI.init() 方法执行成功',
128
129
  "can't call yourself": '不能呼叫自己', // eslint-disable-line
129
130
  'accept-error': '接通失败',
@@ -139,10 +140,12 @@ export const zh = {
139
140
  'error.10008': "TUICallEngine 尚未完成初始化或登录。请确保在调用此功能前,已成功执行 init 或 login 操作。解决方案:<a href='https://cloud.tencent.com/document/product/647/78769#3a61f42b-e06f-49af-88bf-362d40025887'>查看文档</a>",
140
141
  '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
142
  'error.10013': "呼叫失败:您已被对方拉黑或您拉黑了对方",
142
- 'error.10014': "发起通话失败,用户 ID 无效,请确认该用户已注册。",
143
+ 'error.10014': "发起通话失败:被叫 userID 无效,请确认该 userID 已注册并登录过 TUICallKit。",
143
144
  'error.10015': "未开通 TRTC 服务导致进房失败,请前往<a href='https://console.cloud.tencent.com/trtc'>控制台</a>为您的应用开通 TRTC 服务",
144
145
  'error.10015.chat': "当前为 Chat 与 TUICallKit 融合场景,未开通 TRTC 服务导致进房失败,请前往 <a href='https://console.cloud.tencent.com/im/rtc-config'>IM 控制台</a>为您的应用开通 TRTC 服务",
145
146
  '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
+ 'error.10017': "发起通话失败:被叫 userID 不能是当前登录用户自己,请检查传入的被叫 userID。",
148
+ 'error.10018': "发起通话失败:单次呼叫的被叫用户数量需在 1 到 8 之间,请检查传入的 userIDList。",
146
149
  'error': '错误',
147
150
  // AI Subtitle Settings
148
151
  'ai-subtitle': 'AI 字幕',
package/src/index.ts CHANGED
@@ -35,7 +35,7 @@ const TUICallType = {
35
35
  AUDIO_CALL: 1,
36
36
  VIDEO_CALL: 2,
37
37
  };
38
- const Version = '4.5.8'; // basic-demo 原来上报使用
38
+ const Version = '4.5.9'; // basic-demo 原来上报使用
39
39
 
40
40
  // 输出产物
41
41
  export {