@trtc/calls-uikit-react 4.5.1 → 4.5.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.
Files changed (81) hide show
  1. package/package.json +3 -4
  2. package/src/Components/components/base/Message/Message.tsx +2 -1
  3. package/src/Components/components/base/Message/MessagePlugin.tsx +17 -9
  4. package/src/Components/components/base/Popup/Popup.tsx +2 -1
  5. package/src/Components/components/common/FloatingWindow/FloatingWindow.tsx +2 -1
  6. package/src/Components/components/common/UIKitModal/UIKitModal.tsx +3 -1
  7. package/src/TUICallService/CallService/index.ts +16 -1
  8. package/src/TUICallService/TUIStore/callStore.ts +1 -0
  9. package/src/TUICallService/const/index.ts +1 -0
  10. package/src/TUICallService/interface/ICallStore.ts +1 -0
  11. package/src/index.ts +1 -1
  12. package/tuicall-uikit-react.es.js +1734 -1712
  13. package/tuicall-uikit-react.umd.js +4 -4
  14. package/types/Components/TUICallKit/TUICallKit.d.ts +2 -2
  15. package/types/Components/components/GroupCall/GroupCall.d.ts +2 -1
  16. package/types/Components/components/GroupCall/MediaContainer/AudioStream/AudioStream.d.ts +2 -1
  17. package/types/Components/components/GroupCall/MediaContainer/MediaContainer.d.ts +2 -1
  18. package/types/Components/components/GroupCall/MediaContainer/StreamLoading/StreamLoading.d.ts +1 -1
  19. package/types/Components/components/GroupCall/Waiting/Waiting.d.ts +2 -1
  20. package/types/Components/components/SingleCall/MediaContainer/AudioStream/AudioStream.d.ts +2 -1
  21. package/types/Components/components/SingleCall/MediaContainer/MediaContainer.d.ts +2 -1
  22. package/types/Components/components/SingleCall/SingleCall.d.ts +1 -1
  23. package/types/Components/components/SingleCall/Waiting/Waiting.d.ts +2 -1
  24. package/types/Components/components/base/Avatar/Avatar.d.ts +2 -2
  25. package/types/Components/components/base/Drag/Drag.d.ts +2 -2
  26. package/types/Components/components/base/Grid/Col/Col.d.ts +2 -2
  27. package/types/Components/components/base/Grid/Row/Row.d.ts +1 -1
  28. package/types/Components/components/base/GridLayout/GridLayout.d.ts +2 -1
  29. package/types/Components/components/base/GridLayout/GridPlusItem/GridPlusItem.d.ts +2 -2
  30. package/types/Components/components/base/Icon/Icon.d.ts +2 -2
  31. package/types/Components/components/base/Loading/Circle/Cilrcle.d.ts +2 -1
  32. package/types/Components/components/base/Loading/Dot/Dot.d.ts +2 -1
  33. package/types/Components/components/base/Loading/Loading.d.ts +2 -2
  34. package/types/Components/components/base/Message/Message.d.ts +2 -2
  35. package/types/Components/components/base/Message/MessageIcon/Error.d.ts +1 -1
  36. package/types/Components/components/base/Message/MessageIcon/Info.d.ts +1 -1
  37. package/types/Components/components/base/Message/MessageIcon/Success.d.ts +1 -1
  38. package/types/Components/components/base/Message/MessageIcon/Warning.d.ts +1 -1
  39. package/types/Components/components/base/Overlayer/Overlayer.d.ts +2 -2
  40. package/types/Components/components/base/Text/Text.d.ts +2 -1
  41. package/types/Components/components/base/Time/Time.d.ts +2 -1
  42. package/types/Components/components/base/ToggleWindow/ToggleWindow.d.ts +1 -1
  43. package/types/Components/components/base/ToggleWindow/ToggleWindowItem/ToggleWindowItem.d.ts +2 -1
  44. package/types/Components/components/common/ButtonPanel/ButtonPanel.d.ts +2 -1
  45. package/types/Components/components/common/ButtonPanel/ButtonPanelH5/ButtonPanelH5.d.ts +2 -2
  46. package/types/Components/components/common/ButtonPanel/ButtonPanelPC/ButtonPanelPC.d.ts +2 -1
  47. package/types/Components/components/common/ButtonPanel/button/Accept/Accept.d.ts +2 -1
  48. package/types/Components/components/common/ButtonPanel/button/BackgroundBlur/BackgroundBlur.d.ts +2 -1
  49. package/types/Components/components/common/ButtonPanel/button/Camera.d.ts +2 -1
  50. package/types/Components/components/common/ButtonPanel/button/FullScreen/FullScreen.d.ts +2 -1
  51. package/types/Components/components/common/ButtonPanel/button/Hangup/Hangup.d.ts +2 -1
  52. package/types/Components/components/common/ButtonPanel/button/Microphone.d.ts +2 -1
  53. package/types/Components/components/common/ButtonPanel/button/Minimize/Minimize.d.ts +2 -1
  54. package/types/Components/components/common/ButtonPanel/button/Reject/Reject.d.ts +2 -1
  55. package/types/Components/components/common/ButtonPanel/button/Speaker.d.ts +2 -1
  56. package/types/Components/components/common/ButtonPanel/button/SwitchAudioCall.d.ts +2 -1
  57. package/types/Components/components/common/ButtonPanel/button/SwitchCamera.d.ts +2 -1
  58. package/types/Components/components/common/CallMessage/CallMessage.d.ts +1 -1
  59. package/types/Components/components/common/CallMessage/CallMessageC2C/CallMessageC2C.d.ts +2 -1
  60. package/types/Components/components/common/CallMessage/CallMessageGroup/CallMessageGroup.d.ts +2 -1
  61. package/types/Components/components/common/DeviceSelector/DeviceSelector.d.ts +2 -1
  62. package/types/Components/components/common/FloatingWindow/FloatingWindow.d.ts +2 -2
  63. package/types/Components/components/common/FloatingWindow/FloatingWindowGroupCall/FloatingWindowGroupCall.d.ts +2 -2
  64. package/types/Components/components/common/FloatingWindow/FloatingWindowSingleCall/FloatingWindowSingleCall.d.ts +2 -2
  65. package/types/Components/components/common/MicrophoneVolumn/MicrophoneVolumn.d.ts +2 -2
  66. package/types/Components/components/common/OverlayStream/OverlayStream.d.ts +2 -2
  67. package/types/Components/components/common/Player/Player.d.ts +2 -2
  68. package/types/Components/components/common/Pusher/Pusher.d.ts +1 -1
  69. package/types/Components/components/common/StreamInfo/StreamInfo.d.ts +2 -1
  70. package/types/Components/components/common/StreamInfo/StreamInfoH5/StreamInfoH5.d.ts +2 -1
  71. package/types/Components/components/common/StreamInfo/StreamInfoPC/StreamInfoPC.d.ts +2 -1
  72. package/types/Components/components/common/Tip/Tip.d.ts +2 -2
  73. package/types/Components/components/common/TopBar/TopBar.d.ts +2 -1
  74. package/types/Components/components/common/TopBar/h5/TopBarH5.d.ts +2 -1
  75. package/types/Components/components/common/TopBar/pc/TopBarPC.d.ts +2 -1
  76. package/types/TUICallService/CallService/index.d.ts +1 -0
  77. package/types/TUICallService/interface/ICallStore.d.ts +1 -0
  78. package/src/TUICallService/utils/validate/validateConfig.ts +0 -188
  79. package/src/TUICallService/utils/validate/validateParams.ts +0 -88
  80. package/types/TUICallService/utils/validate/validateConfig.d.ts +0 -173
  81. package/types/TUICallService/utils/validate/validateParams.d.ts +0 -1
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@trtc/calls-uikit-react",
3
- "version": "4.5.1",
3
+ "version": "4.5.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.1",
17
- "@trtc/call-engine-lite-js": "~4.0.1",
18
- "@tencentcloud/lite-chat": "^1.6.3",
19
- "@trtc/call-engine-lite-wx": "~4.0.0"
17
+ "@trtc/call-engine-lite-js": "4.0.5-beta.1",
18
+ "@tencentcloud/lite-chat": "^1.6.3"
20
19
  },
21
20
  "bugs": {
22
21
  "url": "https://github.com/tencentyun/TUICallKit/issues"
@@ -46,7 +46,8 @@ export function Message(props: IMessageProps) {
46
46
  plaintext = false,
47
47
  onClose = () => null,
48
48
  } = props;
49
- const timer = useRef<any>();
49
+ // React 19's useRef removed the no-argument overload; pass undefined explicitly.
50
+ const timer = useRef<any>(undefined);
50
51
  const classnames = classNames([
51
52
  className,
52
53
  `${classPrefix}-message-container`,
@@ -1,4 +1,4 @@
1
- import { render, unmountComponentAtNode } from 'react-dom';
1
+ import { createRoot, type Root } from 'react-dom/client';
2
2
  import React, { CSSProperties, useEffect } from 'react';
3
3
  import { IMessageProps, Message } from './Message';
4
4
  import { noop } from '../../../../TUICallService/utils/common-utils';
@@ -46,7 +46,9 @@ function createContainer(): Promise<Element> {
46
46
  const container = Array.from(mountedDom.querySelectorAll(`#${containerId}`));
47
47
  if (container.length < 1) {
48
48
  const div = document.createElement('div');
49
- render(
49
+ // Use React 18+ createRoot API; legacy ReactDOM.render was removed in React 19.
50
+ const root = createRoot(div);
51
+ root.render(
50
52
  <MessageContainer
51
53
  id={containerId}
52
54
  zIndex={1}
@@ -56,7 +58,6 @@ function createContainer(): Promise<Element> {
56
58
  resolve(containers[0]);
57
59
  }}
58
60
  />,
59
- div,
60
61
  );
61
62
  } else {
62
63
  resolve(container[0]);
@@ -73,9 +74,18 @@ async function createMessage(theme, config): Promise<any> {
73
74
 
74
75
  keyIndex += 1;
75
76
 
77
+ // Persist the React root so it can be unmounted explicitly in close().
78
+ let root: Root | null = null;
76
79
  const message = {
77
80
  close: () => {
78
- unmountComponentAtNode(div);
81
+ if (root) {
82
+ // Defer unmount to the next tick to avoid React's "synchronously unmount
83
+ // a root while React is already rendering" warning when the close is
84
+ // triggered from inside a render-phase callback.
85
+ const targetRoot = root;
86
+ root = null;
87
+ Promise.resolve().then(() => targetRoot.unmount());
88
+ }
79
89
  div.remove();
80
90
  message.closed = true;
81
91
  },
@@ -95,10 +105,9 @@ async function createMessage(theme, config): Promise<any> {
95
105
  }
96
106
 
97
107
  return new Promise((resolve) => {
98
- // TODO
99
- // ReactDOM.render is no longer supported in React 18. Use createRoot instead. Until you switch to the new API, your app will behave as if it's running React 17. Learn more: https://reactjs.org/link/switch-to-createroot
100
- // Renders the component.
101
- render(
108
+ // Use React 18+ createRoot API; legacy ReactDOM.render was removed in React 19.
109
+ root = createRoot(div);
110
+ root.render(
102
111
  <Message
103
112
  key={keyIndex}
104
113
  {...config}
@@ -111,7 +120,6 @@ async function createMessage(theme, config): Promise<any> {
111
120
  >
112
121
  {content}
113
122
  </Message>,
114
- div,
115
123
  );
116
124
 
117
125
  // Mounts the current rendered message to the specified container.
@@ -29,7 +29,8 @@ const Popup = forwardRef((props: IPopupProps, ref: any) => {
29
29
  const [popperElement, setPopperElement] = useState(null);
30
30
  const [arrowElement, setArrowElement] = useState(null);
31
31
  const contentRef = useRef(null); // The content section.
32
- const updateTimeRef = useRef<any>();
32
+ // React 19's useRef removed the no-argument overload; pass undefined explicitly.
33
+ const updateTimeRef = useRef<any>(undefined);
33
34
  const popupRef = useRef(null);
34
35
  const { styles } = usePopper(referenceElement, popperElement, {
35
36
  modifiers: [{ name: 'arrow', options: { element: arrowElement } }],
@@ -14,7 +14,8 @@ interface IFloatingWindowProps {
14
14
 
15
15
  export default function FloatingWindow(props: IFloatingWindowProps) {
16
16
  const { isGroupCall } = useContext(CallInfoContext);
17
- const nodeRef = useRef<any>();
17
+ // React 19's useRef removed the no-argument overload; pass undefined explicitly.
18
+ const nodeRef = useRef<any>(undefined);
18
19
  const [clickable, setClickable] = useState(true);
19
20
  const visibility: any = props.show ? '' : 'hidden';
20
21
 
@@ -50,7 +50,9 @@ function processAnchorTags(content: string): string {
50
50
  return doc.body.innerHTML;
51
51
  }
52
52
 
53
- const TypeIcons: Record<string, () => JSX.Element> = {
53
+ // React 19 narrows component return types; use ReactNode instead of JSX.Element
54
+ // so each entry can be rendered as <TypeIcon />.
55
+ const TypeIcons: Record<string, () => ReactNode> = {
54
56
  success: () => <span style={{ color: 'green', marginRight: '6px' }}>✓</span>,
55
57
  info: () => <span style={{ color: '#1890ff', marginRight: '6px' }}>ℹ</span>,
56
58
  error: () => <span style={{ color: 'red', marginRight: '6px' }}>✕</span>,
@@ -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.1';
30
+ const version = '4.5.3-beta.1';
31
31
  import AIAssistant from './AIAssistant'; // 仅 web 支持 AI 实时字幕
32
32
  const frameWork = 'react';
33
33
  export { TUIGlobal, TUIStore, uiDesign };
@@ -51,6 +51,13 @@ export default class TUICallService {
51
51
  private _wasmReadyPromise;
52
52
  private _wasmReadyResolve;
53
53
  private _isInitialized = false;
54
+ // Use an arrow function to keep the `this` binding when registering/unregistering the listener.
55
+ private _handleAutoPlayFailed = () => {
56
+ this._tuiCallEngine?.reportLog?.({
57
+ name: 'TUICallkit.onAutoPlayFailed',
58
+ });
59
+ TUIStore.update(StoreName.CALL, NAME.IS_SHOW_AUTO_PLAY_DIALOG, true);
60
+ };
54
61
 
55
62
  constructor() {
56
63
  console.log(`${NAME.PREFIX}version: ${version}`);
@@ -132,6 +139,9 @@ export default class TUICallService {
132
139
  trtcCloudInstance?.callExperimentalAPI(JSON.stringify(
133
140
  { "api": "enableAutoPlayDialog","params": { "enable": 0 } }
134
141
  ));
142
+ // Register the auto play failed listener at initialization time, otherwise the event may
143
+ // be fired before the AutoPlayDialog component is mounted and the listener would miss it.
144
+ trtcCloudInstance?.on?.('onAutoPlayFailed', this._handleAutoPlayFailed);
135
145
  this._tuiCallEngine?.reportLog?.({
136
146
  name: 'TUICallkit.init',
137
147
  data: {
@@ -153,6 +163,8 @@ export default class TUICallService {
153
163
  }
154
164
  if (this._tuiCallEngine) {
155
165
  this._removeListenTuiCallEngineEvent();
166
+ const trtcCloudInstance = this._tuiCallEngine?.getTRTCCloudInstance?.();
167
+ trtcCloudInstance?.off?.('onAutoPlayFailed', this._handleAutoPlayFailed);
156
168
  await this._tuiCallEngine.destroyInstance();
157
169
  this._tuiCallEngine = null;
158
170
  }
@@ -338,6 +350,9 @@ export default class TUICallService {
338
350
  const { enable } = params;
339
351
  TUIStore.update(StoreName.CALL, NAME.IS_FORCE_USE_V2_API, !!enable);
340
352
  break;
353
+ case 'setWaterMark':
354
+ this._tuiCallEngine?.callExperimentalAPI?.(jsonStr);
355
+ break;
341
356
  default:
342
357
  break;
343
358
  }
@@ -27,6 +27,7 @@ export default class CallStore {
27
27
  showPermissionTip: false,
28
28
  netWorkQualityList: [], // 显示网络状态差的提示
29
29
  isMuteSpeaker: false,
30
+ isShowAutoPlayDialog: false, // 是否显示自动播放失败弹窗, 默认: false
30
31
  callID: '', // callEngine 3.1 support
31
32
  groupID: '',
32
33
  roomID: 0,
@@ -26,6 +26,7 @@ export const CALL_DATA_KEY: any = {
26
26
  PLAYER: 'player',
27
27
  IS_EAR_PHONE: 'isEarPhone',
28
28
  IS_MUTE_SPEAKER: 'isMuteSpeaker',
29
+ IS_SHOW_AUTO_PLAY_DIALOG: 'isShowAutoPlayDialog',
29
30
  SHOW_PERMISSION_TIP: 'SHOW_PERMISSION_TIP',
30
31
  NETWORK_STATUS: 'NetWorkStatus',
31
32
  CALL_ID: 'callID',
@@ -34,6 +34,7 @@ export interface ICallStore {
34
34
  roomIdType: number;
35
35
  cameraPosition: CameraPosition; // 前置或后置,值为front, back
36
36
  isMuteSpeaker: boolean;
37
+ isShowAutoPlayDialog: boolean; // 是否显示自动播放失败弹窗, 默认: false
37
38
  groupCallMembers: IUserInfo[]; // chat 群会话中在通话的成员
38
39
  // TUICallKit 组件上的属性
39
40
  displayMode: VideoDisplayMode; // 设置预览远端的画面显示模式, 默认: VideoDisplayMode.COVER
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.1'; // basic-demo 原来上报使用
38
+ const Version = '4.5.3-beta.1'; // basic-demo 原来上报使用
39
39
 
40
40
  // 输出产物
41
41
  export {