tuikit-atomicx-vue3 4.5.1 → 4.5.3

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 (122) hide show
  1. package/dist/{MessageInput.vue_vue_type_script_setup_true_lang-jPzZ5INK.js → MessageInput.vue_vue_type_script_setup_true_lang-3RVYOdkv.js} +38 -38
  2. package/dist/{PopoverPortal-DghpKKm8.js → PopoverPortal-DV6zFXcf.js} +3 -3
  3. package/dist/{PopoverTrigger-BajjNkGO.js → PopoverTrigger-DIjW4PKa.js} +4 -4
  4. package/dist/{PopperContent-SLoFuK7k.js → PopperContent-D__dbwpA.js} +1 -1
  5. package/dist/{Teleport-DFrneqLM.js → Teleport-98QrIYDI.js} +278 -268
  6. package/dist/baseComp/Modal/Modal.js +3 -3
  7. package/dist/components/AudioSettingPanel/index.js +14 -14
  8. package/dist/components/BarrageInput/EmojiPicker/EmojiPicker.js +2 -2
  9. package/dist/components/BarrageInput/TextEditor/CharacterCountExtension.js +1 -1
  10. package/dist/components/BarrageInput/TextEditor/EditorCore.js +4 -4
  11. package/dist/components/ConversationList/ConversationActions/ConversationActions.js +53 -50
  12. package/dist/components/ConversationList/ConversationActions/ConversationActions.vue.d.ts +2 -0
  13. package/dist/components/ConversationList/ConversationCreate/ConversationCreate.js +25 -25
  14. package/dist/components/ConversationList/ConversationList.vue.d.ts +16 -0
  15. package/dist/components/ConversationList/ConversationPreview/ConversationPreview.vue.d.ts +16 -0
  16. package/dist/components/ConversationList/ConversationPreview/ConversationPreviewAbstract.js +18 -18
  17. package/dist/components/ConversationList/ConversationPreview/ConversationPreviewTimestamp.js +13 -13
  18. package/dist/components/ConversationList/ConversationPreview/ConversationPreviewTitle.js +11 -11
  19. package/dist/components/ConversationList/ConversationPreview/ConversationPreviewUI.js +84 -75
  20. package/dist/components/ConversationList/ConversationPreview/ConversationPreviewUI.vue.d.ts +4 -0
  21. package/dist/components/ConversationList/ConversationPreview/ConversationPreviewUnread.js +14 -14
  22. package/dist/components/ConversationList/i18n/en-US.d.ts +1 -0
  23. package/dist/components/ConversationList/i18n/en-US.js +2 -1
  24. package/dist/components/ConversationList/i18n/zh-CN.d.ts +1 -0
  25. package/dist/components/ConversationList/i18n/zh-CN.js +2 -1
  26. package/dist/components/ConversationList/index.d.ts +48 -0
  27. package/dist/components/LiveScenePanel/index.js +9 -10
  28. package/dist/components/MessageInput/AttachmentPicker/index.js +2 -2
  29. package/dist/components/MessageInput/EmojiPicker/EmojiPicker.js +2 -2
  30. package/dist/components/MessageInput/MessageInput.js +1 -1
  31. package/dist/components/MessageInput/TextEditor/EditorCore.js +1 -1
  32. package/dist/components/MessageInput/TextEditor/extensions/MentionSuggestion.js +3 -3
  33. package/dist/components/MessageInput/TextEditor/extensions/characterCountExtension.js +1 -1
  34. package/dist/components/MessageInput/TextEditor/extensions/emojiExtension.js +1 -1
  35. package/dist/components/MessageInput/TextEditor/extensions/enterKeyExtension.js +1 -1
  36. package/dist/components/MessageInput/TextEditor/extensions/imageExtension.js +2 -2
  37. package/dist/components/MessageInput/TextEditor/extensions/mentionExtension.js +2 -2
  38. package/dist/components/MessageInput/TextEditor/index.js +1 -1
  39. package/dist/components/MessageInput/index.js +1 -1
  40. package/dist/components/MessageList/Message/MessageLayout/MessageActionDropdown/MessageActionDropdown.js +3 -3
  41. package/dist/components/MessageList/Message/MessageLayout/MessageMeta/MessageMeta.js +37 -28
  42. package/dist/components/MessageList/MessageList.js +77 -67
  43. package/dist/components/ScheduleRoomPanel/RoomDetail.js +22 -22
  44. package/dist/components/ScheduleRoomPanel/RoomEdit.js +1 -1
  45. package/dist/components/ScheduleRoomPanel/RoomShare.js +4 -4
  46. package/dist/components/ScheduleRoomPanel/ScheduleRoomPanel.js +1 -1
  47. package/dist/components/ScheduleRoomPanel/ScheduledRoomList.js +1 -1
  48. package/dist/components/UIKitModal/chatErrorModal/chatErrorModal.d.ts +72 -0
  49. package/dist/components/UIKitModal/chatErrorModal/chatErrorModal.js +95 -0
  50. package/dist/components/UIKitModal/chatErrorModal/i18n/en-US/index.d.ts +40 -0
  51. package/dist/components/UIKitModal/chatErrorModal/i18n/en-US/index.js +51 -0
  52. package/dist/components/UIKitModal/chatErrorModal/i18n/index.d.ts +4 -0
  53. package/dist/components/UIKitModal/chatErrorModal/i18n/index.js +6 -0
  54. package/dist/components/UIKitModal/chatErrorModal/i18n/zh-CN/index.d.ts +40 -0
  55. package/dist/components/UIKitModal/chatErrorModal/i18n/zh-CN/index.js +51 -0
  56. package/dist/components/UIKitModal/chatErrorModal/index.d.ts +3 -0
  57. package/dist/components/UIKitModal/chatErrorModal/index.js +11 -0
  58. package/dist/components/VideoSettingPanel/index.js +1 -1
  59. package/dist/hooks/useReadReceipt/useReadReceipt.js +44 -41
  60. package/dist/index-CTthrJb2.js +1461 -0
  61. package/dist/{index-CzCDLp99.js → index-DXC5bPY4.js} +32 -32
  62. package/dist/{index-C8Jw_xE4.js → index-DuAffztD.js} +1731 -1648
  63. package/dist/{index-CiYL_XsE.js → index-hHVD-MG2.js} +1 -1
  64. package/dist/index.js +59 -58
  65. package/dist/states/GroupSettingState/GroupSettingState.js +109 -102
  66. package/dist/states/LoginState.js +43 -43
  67. package/dist/states/MessageInputState/MessageInputState.js +75 -78
  68. package/dist/states/MessageListState/MessageListState.js +26 -23
  69. package/dist/states/RoomParticipantState/index.js +83 -24
  70. package/dist/states/RoomParticipantState/participantEventManager.d.ts +2 -2
  71. package/dist/states/RoomParticipantState/participantEventManager.js +217 -205
  72. package/dist/states/RoomParticipantState/participantManager.d.ts +4 -0
  73. package/dist/states/RoomParticipantState/participantManager.js +159 -127
  74. package/dist/states/RoomState/callManager.d.ts +3 -3
  75. package/dist/states/RoomState/callManager.js +20 -20
  76. package/dist/states/RoomState/common.d.ts +3 -2
  77. package/dist/states/RoomState/common.js +34 -24
  78. package/dist/states/RoomState/roomManager.d.ts +1 -1
  79. package/dist/states/RoomState/roomManager.js +37 -34
  80. package/dist/states/RoomState/scheduleManager.js +21 -27
  81. package/dist/styles/index.css +1 -1
  82. package/dist/subEntry/chat/chat.d.ts +48 -0
  83. package/dist/subEntry/live/index.js +46 -45
  84. package/dist/subEntry/room/index.js +39 -38
  85. package/dist/types/beauty.d.ts +20 -0
  86. package/dist/types/index.js +37 -36
  87. package/dist/types/participant.d.ts +2 -0
  88. package/dist/types/room.d.ts +45 -1
  89. package/dist/types/room.js +4 -3
  90. package/dist/{useId-D5WE76CM.js → useId-B1VwPJLm.js} +1 -1
  91. package/dist/utils/call.js +77 -71
  92. package/dist/{utils-CttDpxqz.js → utils-BU8IkP_V.js} +1 -1
  93. package/package.json +5 -6
  94. package/src/components/AudioSettingPanel/index.vue +4 -5
  95. package/src/components/ConversationList/ConversationActions/ConversationActions.vue +7 -1
  96. package/src/components/ConversationList/ConversationCreate/ConversationCreate.vue +5 -1
  97. package/src/components/ConversationList/ConversationList.vue +0 -1
  98. package/src/components/ConversationList/ConversationPreview/ConversationPreview.scss +2 -2
  99. package/src/components/ConversationList/ConversationPreview/ConversationPreviewUI.vue +15 -0
  100. package/src/components/ConversationList/i18n/en-US.ts +1 -0
  101. package/src/components/ConversationList/i18n/zh-CN.ts +1 -0
  102. package/src/components/LiveScenePanel/index.vue +0 -1
  103. package/src/components/MessageInput/MessageInput.module.scss +1 -0
  104. package/src/components/MessageList/Message/MessageLayout/MessageMeta/MessageMeta.vue +12 -3
  105. package/src/components/MessageList/MessageList.vue +14 -0
  106. package/src/components/ScheduleRoomPanel/RoomDetail.vue +1 -0
  107. package/src/components/ScheduleRoomPanel/RoomEdit.vue +2 -1
  108. package/src/components/ScheduleRoomPanel/RoomShare.vue +1 -0
  109. package/src/components/ScheduleRoomPanel/ScheduleRoomPanel.vue +1 -0
  110. package/src/components/ScheduleRoomPanel/ScheduledRoomList.vue +1 -0
  111. package/src/components/UIKitModal/chatErrorModal/chatErrorModal.ts +205 -0
  112. package/src/components/UIKitModal/chatErrorModal/i18n/en-US/index.ts +56 -0
  113. package/src/components/UIKitModal/chatErrorModal/i18n/index.ts +4 -0
  114. package/src/components/UIKitModal/chatErrorModal/i18n/zh-CN/index.ts +56 -0
  115. package/src/components/UIKitModal/chatErrorModal/index.ts +16 -0
  116. package/src/components/VideoSettingPanel/index.vue +1 -0
  117. package/src/hooks/useReadReceipt/useReadReceipt.ts +5 -4
  118. package/src/types/beauty.ts +20 -0
  119. package/src/types/participant.ts +3 -0
  120. package/src/types/room.ts +49 -1
  121. package/src/utils/call.ts +8 -0
  122. package/dist/index-BvFYOUyz.js +0 -2936
@@ -1,24 +1,24 @@
1
- var L = Object.defineProperty;
2
- var U = (m, e, t) => e in m ? L(m, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : m[e] = t;
3
- var k = (m, e, t) => U(m, typeof e != "symbol" ? e + "" : e, t);
4
- import M, { TUIRole as h, TUIMediaDevice as f, TUIRequestCallbackType as v, TUIRequestAction as c, TUIRoomEvents as q } from "@tencentcloud/tuiroom-engine-js";
5
- import { useRoomEngine as O } from "../../hooks/useRoomEngine.js";
6
- import { eventCenter as R } from "../../utils/eventCenter.js";
7
- import { useRoomState as S } from "../RoomState/index.js";
8
- import { participantTransfer as I } from "./common.js";
9
- import { useRoomParticipantStore as P } from "./store.js";
10
- import { DeviceStatus as $, DeviceType as s } from "../../types/device.js";
11
- import { RoomParticipantEvent as T } from "../../types/participant.js";
12
- const { currentRoom: b } = S(), {
13
- participantListCursor: _,
14
- localParticipant: g,
15
- sentRequestMap: l,
1
+ var M = Object.defineProperty;
2
+ var O = (R, e, t) => e in R ? M(R, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : R[e] = t;
3
+ var C = (R, e, t) => O(R, typeof e != "symbol" ? e + "" : e, t);
4
+ import S, { TUIRole as h, TUIMediaDevice as k, TUIRequestCallbackType as l, TUIRequestAction as o, TUIRoomEvents as $ } from "@tencentcloud/tuiroom-engine-js";
5
+ import { useRoomEngine as P } from "../../hooks/useRoomEngine.js";
6
+ import { eventCenter as m } from "../../utils/eventCenter.js";
7
+ import { useRoomState as _ } from "../RoomState/index.js";
8
+ import { participantTransfer as p } from "./common.js";
9
+ import { useRoomParticipantStore as E } from "./store.js";
10
+ import { DeviceStatus as y, DeviceType as i } from "../../types/device.js";
11
+ import { RoomParticipantEvent as I } from "../../types/participant.js";
12
+ const { currentRoom: T } = _(), {
13
+ participantListCursor: N,
14
+ localParticipant: f,
15
+ sentRequestMap: v,
16
16
  receivedRequestMap: n,
17
- addParticipantInfo: D,
18
- getParticipantInfo: C,
19
- updateParticipantInfo: y,
20
- addPendingParticipantInfo: w
21
- } = P(), i = O(), p = class p {
17
+ addParticipantInfo: w,
18
+ getParticipantInfo: A,
19
+ updateParticipantInfo: g,
20
+ addPendingParticipantInfo: U
21
+ } = E(), s = P(), q = class q {
22
22
  /**
23
23
  * 构造函数
24
24
  * @memberof ParticipantManager
@@ -30,38 +30,38 @@ const { currentRoom: b } = S(), {
30
30
  * ```
31
31
  */
32
32
  constructor() {
33
- p.instance || (p.instance = this), this.onRequestReceived = this.onRequestReceived.bind(this), this.onRequestCancelled = this.onRequestCancelled.bind(this), this.onRequestProcessed = this.onRequestProcessed.bind(this), this.bindRoomEngineEvents();
33
+ q.instance || (q.instance = this), this.onRequestReceived = this.onRequestReceived.bind(this), this.onRequestCancelled = this.onRequestCancelled.bind(this), this.onRequestProcessed = this.onRequestProcessed.bind(this), this.bindRoomEngineEvents();
34
34
  }
35
35
  async getScheduledParticipantList() {
36
36
  var a, r;
37
- const e = (a = i.instance) == null ? void 0 : a.getConferenceListManager();
38
- if (!i.instance || !e)
37
+ const e = (a = s.instance) == null ? void 0 : a.getConferenceListManager();
38
+ if (!s.instance || !e)
39
39
  throw new Error("please login firstly by useLoginState");
40
40
  (await e.fetchAttendeeList({
41
- roomId: ((r = b.value) == null ? void 0 : r.roomId) || "",
41
+ roomId: ((r = T.value) == null ? void 0 : r.roomId) || "",
42
42
  cursor: "",
43
43
  count: 300
44
- })).attendeeList.forEach((d) => {
45
- const o = I.transformTUIUserInfoToParticipantInfo(d);
46
- C({ userId: o.userId }) || w(o);
44
+ })).attendeeList.forEach((u) => {
45
+ const c = p.transformTUIUserInfoToParticipantInfo(u);
46
+ A({ userId: c.userId }) || U(c);
47
47
  });
48
48
  }
49
49
  async getCallingParticipantList() {
50
50
  var a, r;
51
- const e = (a = i.instance) == null ? void 0 : a.getConferenceInvitationManager();
52
- if (!i.instance || !e)
51
+ const e = (a = s.instance) == null ? void 0 : a.getConferenceInvitationManager();
52
+ if (!s.instance || !e)
53
53
  throw new Error("please login firstly by useLoginState");
54
54
  (await e.getInvitationList({
55
- roomId: ((r = b.value) == null ? void 0 : r.roomId) || "",
55
+ roomId: ((r = T.value) == null ? void 0 : r.roomId) || "",
56
56
  cursor: "",
57
57
  count: 100
58
- })).invitationList.forEach((d) => {
59
- const o = I.transformTUIInvitationToParticipantInfo(d);
60
- C({ userId: o.userId }) || w(o);
58
+ })).invitationList.forEach((u) => {
59
+ const c = p.transformTUIInvitationToParticipantInfo(u);
60
+ A({ userId: c.userId }) || U(c);
61
61
  });
62
62
  }
63
63
  async getPendingParticipantList() {
64
- if (!i.instance)
64
+ if (!s.instance)
65
65
  throw new Error("please login firstly by useLoginState");
66
66
  await this.getScheduledParticipantList(), await this.getCallingParticipantList();
67
67
  }
@@ -69,26 +69,26 @@ const { currentRoom: b } = S(), {
69
69
  return e > 0 ? e.toString() : "";
70
70
  }
71
71
  async getParticipantList(e) {
72
- if (!i.instance)
72
+ if (!s.instance)
73
73
  return { participantList: [], cursor: "" };
74
74
  const { cursor: t = "" } = e, a = [];
75
75
  let r = t;
76
76
  if (t === "")
77
77
  do {
78
- const d = await i.instance.getUserList({ nextSequence: Number(r) });
79
- d.userInfoList.forEach((o) => {
80
- const u = I.transformTUIUserInfoToParticipantInfo(o);
81
- D(u), a.push(u);
82
- }), r = this.getUserListCursor(d.nextSequence);
78
+ const u = await s.instance.getUserList({ nextSequence: Number(r) });
79
+ u.userInfoList.forEach((c) => {
80
+ const d = p.transformTUIUserInfoToParticipantInfo(c);
81
+ w(d), a.push(d);
82
+ }), r = this.getUserListCursor(u.nextSequence);
83
83
  } while (r !== "" && a.length < 300);
84
84
  else {
85
- const d = await i.instance.getUserList({ nextSequence: Number(r) });
86
- d.userInfoList.forEach((o) => {
87
- const u = I.transformTUIUserInfoToParticipantInfo(o);
88
- D(u), a.push(u);
89
- }), r = this.getUserListCursor(d.nextSequence);
85
+ const u = await s.instance.getUserList({ nextSequence: Number(r) });
86
+ u.userInfoList.forEach((c) => {
87
+ const d = p.transformTUIUserInfoToParticipantInfo(c);
88
+ w(d), a.push(d);
89
+ }), r = this.getUserListCursor(u.nextSequence);
90
90
  }
91
- return _.value = r, t === "" && this.getPendingParticipantList(), { participantList: a, cursor: r };
91
+ return N.value = r, t === "" && this.getPendingParticipantList(), { participantList: a, cursor: r };
92
92
  }
93
93
  /**
94
94
  * 转移房间所有者权限
@@ -113,7 +113,7 @@ const { currentRoom: b } = S(), {
113
113
  */
114
114
  async transferOwner(e) {
115
115
  var t;
116
- await ((t = i.instance) == null ? void 0 : t.changeUserRole({
116
+ await ((t = s.instance) == null ? void 0 : t.changeUserRole({
117
117
  userId: e.userId,
118
118
  userRole: h.kRoomOwner
119
119
  }));
@@ -141,7 +141,7 @@ const { currentRoom: b } = S(), {
141
141
  */
142
142
  async setAdmin(e) {
143
143
  var t;
144
- await ((t = i.instance) == null ? void 0 : t.changeUserRole({ userId: e.userId, userRole: h.kAdministrator }));
144
+ await ((t = s.instance) == null ? void 0 : t.changeUserRole({ userId: e.userId, userRole: h.kAdministrator }));
145
145
  }
146
146
  /**
147
147
  * 撤销用户管理员权限
@@ -166,7 +166,7 @@ const { currentRoom: b } = S(), {
166
166
  */
167
167
  async revokeAdmin(e) {
168
168
  var t;
169
- await ((t = i.instance) == null ? void 0 : t.changeUserRole({ userId: e.userId, userRole: h.kGeneralUser }));
169
+ await ((t = s.instance) == null ? void 0 : t.changeUserRole({ userId: e.userId, userRole: h.kGeneralUser }));
170
170
  }
171
171
  /**
172
172
  * 踢出参与者
@@ -191,34 +191,34 @@ const { currentRoom: b } = S(), {
191
191
  */
192
192
  async kickParticipant(e) {
193
193
  var t;
194
- await ((t = i.instance) == null ? void 0 : t.kickRemoteUserOutOfRoom({
194
+ await ((t = s.instance) == null ? void 0 : t.kickRemoteUserOutOfRoom({
195
195
  userId: e.userId
196
196
  }));
197
197
  }
198
198
  async updateParticipantNameCard(e) {
199
199
  var t;
200
- await ((t = i.instance) == null ? void 0 : t.changeUserNameCard({
200
+ await ((t = s.instance) == null ? void 0 : t.changeUserNameCard({
201
201
  userId: e.userId,
202
202
  nameCard: e.nameCard
203
203
  }));
204
204
  }
205
205
  async updateParticipantMetaData(e) {
206
206
  var t;
207
- await ((t = i.instance) == null ? void 0 : t.setCustomInfoForUser({
207
+ await ((t = s.instance) == null ? void 0 : t.setCustomInfoForUser({
208
208
  userId: e.userId,
209
209
  customInfo: e.metaData
210
210
  }));
211
211
  }
212
212
  async closeParticipantDevice(e) {
213
213
  var t;
214
- await ((t = i.instance) == null ? void 0 : t.closeRemoteDeviceByAdmin({
214
+ await ((t = s.instance) == null ? void 0 : t.closeRemoteDeviceByAdmin({
215
215
  userId: e.userId,
216
216
  device: this.transformDeviceTypeToTUIMediaDevice(e.deviceType)
217
- })), y({ userId: e.userId, [e.deviceType]: { status: $.Off } });
217
+ })), g({ userId: e.userId, [e.deviceType]: { status: y.Off } });
218
218
  }
219
219
  async muteParticipantMessage(e) {
220
220
  var t;
221
- await ((t = i.instance) == null ? void 0 : t.disableSendingMessageByAdmin({
221
+ await ((t = s.instance) == null ? void 0 : t.disableSendingMessageByAdmin({
222
222
  userId: e.userId,
223
223
  isDisable: e.mute
224
224
  }));
@@ -226,116 +226,148 @@ const { currentRoom: b } = S(), {
226
226
  async disableAllDevices(e) {
227
227
  var a;
228
228
  const t = this.transformDeviceTypeToTUIMediaDevice(e.deviceType);
229
- await ((a = i.instance) == null ? void 0 : a.disableDeviceForAllUserByAdmin({
229
+ await ((a = s.instance) == null ? void 0 : a.disableDeviceForAllUserByAdmin({
230
230
  device: t,
231
231
  isDisable: e.disable
232
232
  }));
233
233
  }
234
234
  async disableAllMessages(e) {
235
235
  var t;
236
- await ((t = i.instance) == null ? void 0 : t.disableSendingMessageByAdmin({
236
+ await ((t = s.instance) == null ? void 0 : t.disableSendingMessageByAdmin({
237
237
  userId: "",
238
238
  isDisable: e.disable
239
239
  }));
240
240
  }
241
241
  transformDeviceTypeToTUIMediaDevice(e) {
242
242
  return {
243
- [s.Camera]: f.kCamera,
244
- [s.Microphone]: f.kMicrophone,
245
- [s.ScreenShare]: f.kScreen
243
+ [i.Camera]: k.kCamera,
244
+ [i.Microphone]: k.kMicrophone,
245
+ [i.ScreenShare]: k.kScreen
246
246
  }[e];
247
247
  }
248
248
  async requestToOpenDevice(e) {
249
249
  var a;
250
- const t = await ((a = i.instance) == null ? void 0 : a.applyToAdminToOpenLocalDevice({
250
+ const t = await ((a = s.instance) == null ? void 0 : a.applyToAdminToOpenLocalDevice({
251
251
  device: this.transformDeviceTypeToTUIMediaDevice(e.device),
252
- timeout: e.timeout || 60
252
+ timeout: e.timeout || 60,
253
+ requestCallback: (r) => {
254
+ var b, D;
255
+ const { requestCallbackType: u } = r, c = v.get(`${e.device}_${f.value.userId}`);
256
+ if (!c)
257
+ return;
258
+ const d = p.transformTUIRequestCallbackToDeviceRequestInfo(c);
259
+ switch (u) {
260
+ case l.kRequestAccepted:
261
+ m.emit(I.onDeviceRequestApproved, { request: d, operator: ((b = T.value) == null ? void 0 : b.roomOwner) || { userId: "", userName: "", avatarUrl: "" } });
262
+ break;
263
+ case l.kRequestRejected:
264
+ m.emit(I.onDeviceRequestRejected, { request: d, operator: ((D = T.value) == null ? void 0 : D.roomOwner) || { userId: "", userName: "", avatarUrl: "" } });
265
+ break;
266
+ case l.kRequestCancelled:
267
+ m.emit(I.onDeviceRequestCancelled, { request: d });
268
+ break;
269
+ case l.kRequestTimeout:
270
+ m.emit(I.onDeviceRequestTimeout, { request: d });
271
+ break;
272
+ }
273
+ }
253
274
  }));
254
- t && l.set(`${e.device}_${g.value.userId}`, t);
275
+ t && v.set(`${e.device}_${f.value.userId}`, t);
255
276
  }
256
277
  async cancelOpenDeviceRequest(e) {
257
278
  var t, a;
258
- await ((a = i.instance) == null ? void 0 : a.cancelRequest({
259
- requestId: ((t = l.get(`${e.device}_${g.value.userId}`)) == null ? void 0 : t.requestId) || ""
260
- })), l.delete(`${e.device}_${g.value.userId}`);
279
+ await ((a = s.instance) == null ? void 0 : a.cancelRequest({
280
+ requestId: ((t = v.get(`${e.device}_${f.value.userId}`)) == null ? void 0 : t.requestId) || ""
281
+ })), v.delete(`${e.device}_${f.value.userId}`);
261
282
  }
262
283
  async approveOpenDeviceRequest(e) {
263
284
  var t, a;
264
- await ((a = i.instance) == null ? void 0 : a.responseRemoteRequest({
285
+ await ((a = s.instance) == null ? void 0 : a.responseRemoteRequest({
265
286
  requestId: ((t = n.get(`${e.device}_${e.userId}`)) == null ? void 0 : t.requestId) || "",
266
287
  agree: !0
267
- })), y({ userId: e.userId, [e.device]: { status: $.On } }), n.delete(`${e.device}_${e.userId}`);
288
+ })), g({ userId: e.userId, [e.device]: { status: y.On } }), n.delete(`${e.device}_${e.userId}`);
268
289
  }
269
290
  async rejectOpenDeviceRequest(e) {
270
291
  var t, a;
271
- await ((a = i.instance) == null ? void 0 : a.responseRemoteRequest({
292
+ await ((a = s.instance) == null ? void 0 : a.responseRemoteRequest({
272
293
  requestId: ((t = n.get(`${e.device}_${e.userId}`)) == null ? void 0 : t.requestId) || "",
273
294
  agree: !1
274
295
  })), n.delete(`${e.device}_${e.userId}`);
275
296
  }
276
297
  async inviteToOpenDevice(e) {
277
298
  var a;
278
- const t = await ((a = i.instance) == null ? void 0 : a.openRemoteDeviceByAdmin({
299
+ const t = await ((a = s.instance) == null ? void 0 : a.openRemoteDeviceByAdmin({
279
300
  userId: e.userId,
280
301
  device: this.transformDeviceTypeToTUIMediaDevice(e.device),
281
302
  timeout: e.timeout || 0,
282
303
  requestCallback: (r) => {
283
- const d = l.get(`${e.device}_${e.userId}`), o = I.transformTUIRequestCallbackToDeviceRequestInfo(d), { requestCallbackType: u } = r;
284
- switch (u) {
285
- case v.kRequestAccepted:
286
- R.emit(T.onDeviceInvitationAccepted, { invitation: o });
304
+ const u = v.get(`${e.device}_${e.userId}`);
305
+ if (!u)
306
+ return;
307
+ const c = p.transformTUIRequestCallbackToDeviceRequestInfo(u), { requestCallbackType: d } = r;
308
+ switch (d) {
309
+ case l.kRequestAccepted:
310
+ m.emit(I.onDeviceInvitationAccepted, { invitation: c, operator: { userId: e.userId, userName: "", avatarUrl: "" } });
287
311
  break;
288
- case v.kRequestRejected:
289
- R.emit(T.onDeviceInvitationDeclined, { invitation: o });
312
+ case l.kRequestRejected:
313
+ m.emit(I.onDeviceInvitationDeclined, { invitation: c, operator: { userId: e.userId, userName: "", avatarUrl: "" } });
290
314
  break;
291
- case v.kRequestCancelled:
292
- R.emit(T.onDeviceInvitationCancelled, { invitation: o });
315
+ case l.kRequestCancelled:
316
+ m.emit(I.onDeviceInvitationCancelled, { invitation: c });
293
317
  break;
294
- case v.kRequestTimeout:
295
- R.emit(T.onDeviceInvitationTimeout, { invitation: o });
318
+ case l.kRequestTimeout:
319
+ m.emit(I.onDeviceInvitationTimeout, { invitation: c });
296
320
  break;
297
321
  }
298
322
  }
299
323
  }));
300
- t && l.set(`${e.device}_${e.userId}`, t);
324
+ t && v.set(`${e.device}_${e.userId}`, t);
301
325
  }
302
326
  async cancelOpenDeviceInvitation(e) {
303
327
  var t, a;
304
- await ((a = i.instance) == null ? void 0 : a.cancelRequest({
305
- requestId: ((t = l.get(`${e.device}_${e.userId}`)) == null ? void 0 : t.requestId) || ""
306
- })), l.delete(`${e.device}_${e.userId}`);
328
+ await ((a = s.instance) == null ? void 0 : a.cancelRequest({
329
+ requestId: ((t = v.get(`${e.device}_${e.userId}`)) == null ? void 0 : t.requestId) || ""
330
+ })), v.delete(`${e.device}_${e.userId}`);
307
331
  }
308
332
  async acceptOpenDeviceInvitation(e) {
309
333
  var t, a;
310
- await ((a = i.instance) == null ? void 0 : a.responseRemoteRequest({
334
+ await ((a = s.instance) == null ? void 0 : a.responseRemoteRequest({
311
335
  requestId: ((t = n.get(`${e.device}_${e.userId}`)) == null ? void 0 : t.requestId) || "",
312
336
  agree: !0
313
- })), y({ userId: e.userId, [e.device]: { status: $.On } }), n.delete(`${e.device}_${e.userId}`);
337
+ })), g({ userId: e.userId, [e.device]: { status: y.On } }), n.delete(`${e.device}_${e.userId}`);
314
338
  }
315
339
  async declineOpenDeviceInvitation(e) {
316
340
  var t, a;
317
- await ((a = i.instance) == null ? void 0 : a.responseRemoteRequest({
341
+ await ((a = s.instance) == null ? void 0 : a.responseRemoteRequest({
318
342
  requestId: ((t = n.get(`${e.device}_${e.userId}`)) == null ? void 0 : t.requestId) || "",
319
343
  agree: !1
320
344
  })), n.delete(`${e.device}_${e.userId}`);
321
345
  }
346
+ async muteMicrophone() {
347
+ var e;
348
+ await ((e = s.instance) == null ? void 0 : e.muteLocalAudio());
349
+ }
350
+ async unmuteMicrophone() {
351
+ var e;
352
+ await ((e = s.instance) == null ? void 0 : e.unmuteLocalAudio());
353
+ }
322
354
  onRequestReceived({ request: e }) {
323
355
  const { userId: t, requestAction: a } = e;
324
356
  switch (a) {
325
- case c.kRequestToOpenRemoteCamera:
326
- n.set(`${s.Camera}_${t}`, e);
357
+ case o.kRequestToOpenRemoteCamera:
358
+ n.set(`${i.Camera}_${t}`, e);
327
359
  break;
328
- case c.kRequestToOpenRemoteMicrophone:
329
- n.set(`${s.Microphone}_${t}`, e);
360
+ case o.kRequestToOpenRemoteMicrophone:
361
+ n.set(`${i.Microphone}_${t}`, e);
330
362
  break;
331
- case c.kApplyToAdminToOpenLocalCamera:
332
- n.set(`${s.Camera}_${t}`, e);
363
+ case o.kApplyToAdminToOpenLocalCamera:
364
+ n.set(`${i.Camera}_${t}`, e);
333
365
  break;
334
- case c.kApplyToAdminToOpenLocalMicrophone:
335
- n.set(`${s.Microphone}_${t}`, e);
366
+ case o.kApplyToAdminToOpenLocalMicrophone:
367
+ n.set(`${i.Microphone}_${t}`, e);
336
368
  break;
337
- case c.kApplyToAdminToOpenLocalScreenShare:
338
- n.set(`${s.ScreenShare}_${t}`, e);
369
+ case o.kApplyToAdminToOpenLocalScreenShare:
370
+ n.set(`${i.ScreenShare}_${t}`, e);
339
371
  break;
340
372
  }
341
373
  }
@@ -355,20 +387,20 @@ const { currentRoom: b } = S(), {
355
387
  onRequestCancelled(e) {
356
388
  const { userId: t, requestAction: a } = e.request;
357
389
  switch (a) {
358
- case c.kRequestToOpenRemoteCamera:
359
- n.delete(`${s.Camera}_${t}`);
390
+ case o.kRequestToOpenRemoteCamera:
391
+ n.delete(`${i.Camera}_${t}`);
360
392
  break;
361
- case c.kRequestToOpenRemoteMicrophone:
362
- n.delete(`${s.Microphone}_${t}`);
393
+ case o.kRequestToOpenRemoteMicrophone:
394
+ n.delete(`${i.Microphone}_${t}`);
363
395
  break;
364
- case c.kApplyToAdminToOpenLocalCamera:
365
- n.delete(`${s.Camera}_${t}`);
396
+ case o.kApplyToAdminToOpenLocalCamera:
397
+ n.delete(`${i.Camera}_${t}`);
366
398
  break;
367
- case c.kApplyToAdminToOpenLocalMicrophone:
368
- n.delete(`${s.Microphone}_${t}`);
399
+ case o.kApplyToAdminToOpenLocalMicrophone:
400
+ n.delete(`${i.Microphone}_${t}`);
369
401
  break;
370
- case c.kApplyToAdminToOpenLocalScreenShare:
371
- n.delete(`${s.ScreenShare}_${t}`);
402
+ case o.kApplyToAdminToOpenLocalScreenShare:
403
+ n.delete(`${i.ScreenShare}_${t}`);
372
404
  break;
373
405
  }
374
406
  }
@@ -389,20 +421,20 @@ const { currentRoom: b } = S(), {
389
421
  onRequestProcessed(e) {
390
422
  const { requestAction: t, userId: a } = e.request;
391
423
  switch (t) {
392
- case c.kRequestToOpenRemoteCamera:
393
- n.delete(`${s.Camera}_${a}`);
424
+ case o.kRequestToOpenRemoteCamera:
425
+ n.delete(`${i.Camera}_${a}`);
394
426
  break;
395
- case c.kRequestToOpenRemoteMicrophone:
396
- n.delete(`${s.Microphone}_${a}`);
427
+ case o.kRequestToOpenRemoteMicrophone:
428
+ n.delete(`${i.Microphone}_${a}`);
397
429
  break;
398
- case c.kApplyToAdminToOpenLocalCamera:
399
- n.delete(`${s.Camera}_${a}`);
430
+ case o.kApplyToAdminToOpenLocalCamera:
431
+ n.delete(`${i.Camera}_${a}`);
400
432
  break;
401
- case c.kApplyToAdminToOpenLocalMicrophone:
402
- n.delete(`${s.Microphone}_${a}`);
433
+ case o.kApplyToAdminToOpenLocalMicrophone:
434
+ n.delete(`${i.Microphone}_${a}`);
403
435
  break;
404
- case c.kApplyToAdminToOpenLocalScreenShare:
405
- n.delete(`${s.ScreenShare}_${a}`);
436
+ case o.kApplyToAdminToOpenLocalScreenShare:
437
+ n.delete(`${i.ScreenShare}_${a}`);
406
438
  break;
407
439
  }
408
440
  }
@@ -418,23 +450,23 @@ const { currentRoom: b } = S(), {
418
450
  * ```
419
451
  */
420
452
  bindRoomEngineEvents() {
421
- M.once("ready", () => {
453
+ S.once("ready", () => {
422
454
  var e, t, a;
423
- (e = i.instance) == null || e.on(
424
- q.onRequestReceived,
455
+ (e = s.instance) == null || e.on(
456
+ $.onRequestReceived,
425
457
  this.onRequestReceived
426
- ), (t = i.instance) == null || t.on(
427
- q.onRequestCancelled,
458
+ ), (t = s.instance) == null || t.on(
459
+ $.onRequestCancelled,
428
460
  this.onRequestCancelled
429
- ), (a = i.instance) == null || a.on(
430
- q.onRequestProcessed,
461
+ ), (a = s.instance) == null || a.on(
462
+ $.onRequestProcessed,
431
463
  this.onRequestProcessed
432
464
  );
433
465
  });
434
466
  }
435
467
  };
436
- k(p, "instance");
437
- let A = p;
468
+ C(q, "instance");
469
+ let L = q;
438
470
  export {
439
- A as default
471
+ L as default
440
472
  };
@@ -1,4 +1,4 @@
1
- import { RoomCall, RoomCallResult } from '../../types';
1
+ import { CallRejectReason, RoomCall, RoomCallResult } from '../../types';
2
2
 
3
3
  declare class CallManager {
4
4
  static instance: CallManager;
@@ -24,9 +24,9 @@ declare class CallManager {
24
24
  acceptCall({ roomId }: {
25
25
  roomId: string;
26
26
  }): Promise<void>;
27
- rejectCall({ roomId, extensionInfo }: {
27
+ rejectCall({ roomId, reason }: {
28
28
  roomId: string;
29
- extensionInfo?: string;
29
+ reason?: CallRejectReason;
30
30
  }): Promise<void>;
31
31
  private onReceiveInvitation;
32
32
  private onInvitationHandledByOtherDevice;
@@ -1,12 +1,12 @@
1
- var T = Object.defineProperty;
2
- var C = (u, t, e) => t in u ? T(u, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : u[t] = e;
1
+ var f = Object.defineProperty;
2
+ var C = (u, t, e) => t in u ? f(u, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : u[t] = e;
3
3
  var r = (u, t, e) => C(u, typeof t != "symbol" ? t + "" : t, e);
4
4
  import N, { TUIConferenceInvitationManagerEvents as i } from "@tencentcloud/tuiroom-engine-js";
5
5
  import { useRoomEngine as p } from "../../hooks/useRoomEngine.js";
6
6
  import { eventCenter as l } from "../../utils/eventCenter.js";
7
- import { transferTUIInvitationCodeToRoomCallResult as y, roomInfoTransfer as s } from "./common.js";
8
- import { RoomEvent as d } from "../../types/room.js";
9
- const m = p(), v = class v {
7
+ import { transferTUIInvitationCodeToRoomCallResult as y, roomInfoTransfer as s, transferTUIInvitationRejectedReasonToCallRejectReason as A } from "./common.js";
8
+ import { CallRejectReason as j, RoomEvent as d } from "../../types/room.js";
9
+ const m = p(), I = class I {
10
10
  constructor() {
11
11
  r(this, "onInvitationHandledByOtherDevice", ({ roomInfo: t, accepted: e }) => {
12
12
  l.emit(d.onCallHandledByOtherDevice, {
@@ -49,7 +49,7 @@ const m = p(), v = class v {
49
49
  call: o
50
50
  });
51
51
  });
52
- r(this, "onInvitationRejected", ({ roomInfo: t, invitation: e, extensionInfo: o }) => {
52
+ r(this, "onInvitationRejected", ({ roomInfo: t, invitation: e, reason: o }) => {
53
53
  const n = {
54
54
  caller: {
55
55
  userId: e.inviter.userId,
@@ -65,7 +65,7 @@ const m = p(), v = class v {
65
65
  l.emit(d.onCallRejected, {
66
66
  roomInfo: s.transferTUIRoomInfoToRoomInfo(t),
67
67
  call: n,
68
- extensionInfo: o
68
+ reason: A(o)
69
69
  });
70
70
  });
71
71
  r(this, "onInvitationRevokedByAdmin", ({ roomInfo: t, invitation: e, operateUser: o }) => {
@@ -96,19 +96,19 @@ const m = p(), v = class v {
96
96
  this.onReceiveInvitation = this.onReceiveInvitation.bind(this), this.onInvitationHandledByOtherDevice = this.onInvitationHandledByOtherDevice.bind(this), this.onInvitationTimeout = this.onInvitationTimeout.bind(this), this.onInvitationCancelled = this.onInvitationCancelled.bind(this), this.onInvitationAccepted = this.onInvitationAccepted.bind(this), this.onInvitationRejected = this.onInvitationRejected.bind(this), this.onInvitationRevokedByAdmin = this.onInvitationRevokedByAdmin.bind(this), this.bindEvent();
97
97
  }
98
98
  static getInstance() {
99
- return v.instance || (v.instance = new v()), v.instance;
99
+ return I.instance || (I.instance = new I()), I.instance;
100
100
  }
101
101
  async callUserToRoom({ roomId: t, userIdList: e, timeout: o, extensionInfo: n }) {
102
102
  var a;
103
- const U = (a = m.instance) == null ? void 0 : a.getConferenceInvitationManager(), c = await (U == null ? void 0 : U.inviteUsers({
103
+ const R = (a = m.instance) == null ? void 0 : a.getConferenceInvitationManager(), c = await (R == null ? void 0 : R.inviteUsers({
104
104
  roomId: t,
105
105
  userIdList: e,
106
106
  timeout: o || 0,
107
107
  extensionInfo: n
108
- })), I = /* @__PURE__ */ new Map();
109
- return c && c.forEach((h, f) => {
110
- I.set(f, y(h));
111
- }), I;
108
+ })), v = /* @__PURE__ */ new Map();
109
+ return c && c.forEach((h, T) => {
110
+ v.set(T, y(h));
111
+ }), v;
112
112
  }
113
113
  async cancelCall({ roomId: t, userIdList: e }) {
114
114
  var n;
@@ -119,14 +119,14 @@ const m = p(), v = class v {
119
119
  }));
120
120
  }
121
121
  async getPendingCalls({ roomId: t, cursor: e }) {
122
- var c, I;
122
+ var c, v;
123
123
  const o = (c = m.instance) == null ? void 0 : c.getConferenceInvitationManager(), n = await (o == null ? void 0 : o.getInvitationList({
124
124
  roomId: t,
125
125
  cursor: e,
126
126
  count: 50
127
127
  }));
128
128
  return {
129
- calls: ((I = n == null ? void 0 : n.invitationList) == null ? void 0 : I.map((a) => ({
129
+ calls: ((v = n == null ? void 0 : n.invitationList) == null ? void 0 : v.map((a) => ({
130
130
  caller: {
131
131
  userId: a.inviter.userId,
132
132
  userName: a.inviter.userName,
@@ -149,12 +149,12 @@ const m = p(), v = class v {
149
149
  roomId: t
150
150
  }));
151
151
  }
152
- async rejectCall({ roomId: t, extensionInfo: e }) {
152
+ async rejectCall({ roomId: t, reason: e = j.Rejected }) {
153
153
  var n;
154
154
  const o = (n = m.instance) == null ? void 0 : n.getConferenceInvitationManager();
155
155
  await (o == null ? void 0 : o.reject({
156
156
  roomId: t,
157
- extensionInfo: e
157
+ reason: e
158
158
  }));
159
159
  }
160
160
  onReceiveInvitation({ roomInfo: t, invitation: e, extensionInfo: o }) {
@@ -201,8 +201,8 @@ const m = p(), v = class v {
201
201
  });
202
202
  }
203
203
  };
204
- r(v, "instance");
205
- let R = v;
204
+ r(I, "instance");
205
+ let U = I;
206
206
  export {
207
- R as default
207
+ U as default
208
208
  };
@@ -1,5 +1,5 @@
1
- import { TUIConferenceStatus, TUIInvitationCode, TUIInvitationStatus, TUIConferenceInfo, TUIRoomInfo, TUIUserInfo } from '@tencentcloud/tuiroom-engine-js';
2
- import { RoomCallResult, RoomCallStatus, RoomStatus, RoomInfo, RoomUser } from '../../types/room';
1
+ import { TUIConferenceStatus, TUIInvitationCode, TUIInvitationStatus, TUIInvitationRejectedReason, TUIConferenceInfo, TUIRoomInfo, TUIUserInfo } from '@tencentcloud/tuiroom-engine-js';
2
+ import { CallRejectReason, RoomCallResult, RoomCallStatus, RoomStatus, RoomInfo, RoomUser } from '../../types/room';
3
3
 
4
4
  /**
5
5
  * 将 TUIConferenceInfo 转换为 RoomInfo
@@ -23,3 +23,4 @@ export declare const roomInfoTransfer: {
23
23
  transferTUIInvitationStatusToRoomCallStatus: typeof transferTUIInvitationStatusToRoomCallStatus;
24
24
  };
25
25
  export declare const transferTUIInvitationCodeToRoomCallResult: (code: TUIInvitationCode) => RoomCallResult;
26
+ export declare const transferTUIInvitationRejectedReasonToCallRejectReason: (reason: TUIInvitationRejectedReason) => CallRejectReason;