tuikit-atomicx-vue3 3.4.2 → 4.3.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 (297) hide show
  1. package/.eslintrc.cjs +1 -0
  2. package/dist/baseComp/Modal/Modal.js +431 -23
  3. package/dist/chat/index.d.ts +18 -18
  4. package/dist/components/AudioSetting/AudioMediaControl.js +39 -41
  5. package/dist/components/AudioSetting/AudioSettingTab.js +10 -10
  6. package/dist/components/AudioSetting/MicrophoneSelect.js +8 -8
  7. package/dist/components/AudioSetting/SpeakerSelect.js +9 -9
  8. package/dist/components/AudioSettingPanel/i18n/en-US/index.d.ts +1 -0
  9. package/dist/components/AudioSettingPanel/i18n/en-US/index.js +2 -1
  10. package/dist/components/AudioSettingPanel/i18n/zh-CN/index.d.ts +1 -0
  11. package/dist/components/AudioSettingPanel/i18n/zh-CN/index.js +2 -1
  12. package/dist/components/AudioSettingPanel/index.js +81 -73
  13. package/dist/components/BarrageInput/BarrageInputH5.js +9 -9
  14. package/dist/components/BarrageInput/EmojiPicker/EmojiPicker.js +3 -3
  15. package/dist/components/BarrageInput/MessageInputState.d.ts +28 -0
  16. package/dist/components/BarrageInput/MessageInputState.js +82 -0
  17. package/dist/components/BarrageInput/TextEditor/CharacterCountExtension.js +1 -1
  18. package/dist/components/BarrageInput/TextEditor/EditorCore.js +2 -2
  19. package/dist/components/BarrageInput/TextEditor/index.js +7 -7
  20. package/dist/components/BarrageInput/type.d.ts +17 -0
  21. package/dist/components/BarrageInput/type.js +4 -0
  22. package/dist/components/BarrageInput/utils.d.ts +30 -0
  23. package/dist/components/BarrageInput/utils.js +41 -0
  24. package/dist/components/BarrageList/BarrageList.js +80 -110
  25. package/dist/components/BarrageList/BarrageList.vue.d.ts +0 -29
  26. package/dist/components/BarrageList/BarrageListH5.js +95 -122
  27. package/dist/components/BarrageList/BarrageListH5.vue.d.ts +0 -29
  28. package/dist/components/BarrageList/BarrageListState.d.ts +58 -0
  29. package/dist/components/BarrageList/BarrageListState.js +106 -0
  30. package/dist/components/BarrageList/Message/MessageLayout/MessageBubble/MessageBubble.js +16 -24
  31. package/dist/components/BarrageList/Message/MessageLayout/MessageBubble/MessageBubble.vue.d.ts +5 -5
  32. package/dist/components/BarrageList/Message/MessageLayout/MessageLayout.js +48 -73
  33. package/dist/components/BarrageList/Message/MessageLayout/MessageLayout.vue.d.ts +5 -7
  34. package/dist/components/BarrageList/Message/TextMessage/TextMessage.js +70 -76
  35. package/dist/components/BarrageList/Message/TextMessage/TextMessage.vue.d.ts +6 -6
  36. package/dist/components/BarrageList/Message/TextMessage/emoji.d.ts +5 -0
  37. package/dist/components/BarrageList/Message/TextMessage/emoji.js +134 -0
  38. package/dist/components/BarrageList/index.d.ts +0 -36
  39. package/dist/components/CameraButton/index.js +18 -19
  40. package/dist/components/CoGuestPanel/CoGuestPanel.js +60 -60
  41. package/dist/components/CoHostPanel/BattlePanel.js +11 -11
  42. package/dist/components/CoHostPanel/CoHostPanel.js +10 -10
  43. package/dist/components/CoHostPanel/ConfigSettingPanel.js +49 -55
  44. package/dist/components/CoHostPanel/ConnectionPanel.js +132 -123
  45. package/dist/components/CoHostPanel/RecommendHostList.js +39 -36
  46. package/dist/components/CoHostPanel/constants.d.ts +3 -0
  47. package/dist/components/CoHostPanel/constants.js +6 -0
  48. package/dist/components/CoHostPanel/i18n/en-US/index.d.ts +1 -0
  49. package/dist/components/CoHostPanel/i18n/en-US/index.js +2 -1
  50. package/dist/components/CoHostPanel/i18n/zh-CN/index.d.ts +1 -0
  51. package/dist/components/CoHostPanel/i18n/zh-CN/index.js +3 -2
  52. package/dist/components/LiveAudienceList/LiveAudienceList.js +44 -45
  53. package/dist/components/LiveAudienceList/LiveAudienceListH5.js +7 -7
  54. package/dist/components/LiveAudienceList/UserActionMenu.js +57 -64
  55. package/dist/components/LiveList/LiveList.js +23 -23
  56. package/dist/components/LiveList/LiveListH5.js +38 -38
  57. package/dist/components/LiveScenePanel/CameraSettingDialog.js +10 -10
  58. package/dist/components/LiveScenePanel/MaterialItem.js +15 -15
  59. package/dist/components/LiveScenePanel/index.js +4 -4
  60. package/dist/components/LiveView/CoreViewDecorate/BattleDecorate.js +58 -58
  61. package/dist/components/LiveView/CoreViewDecorate/BattleUserDecorate.js +6 -6
  62. package/dist/components/LiveView/CoreViewDecorate/CoHostDecorate.js +5 -5
  63. package/dist/components/LiveView/DefaultStreamViewUI.js +44 -41
  64. package/dist/components/LiveView/PlayerControl/AudioControl.js +20 -20
  65. package/dist/components/LiveView/PlayerControl/MultiResolution.js +49 -48
  66. package/dist/components/LiveView/PlayerControl/MultiResolution.vue.d.ts +7 -1
  67. package/dist/components/LiveView/PlayerControl/PlayerControl.js +90 -86
  68. package/dist/components/LiveView/PlayerControl/PlayerControlState.js +127 -131
  69. package/dist/components/LiveView/PlayerControl/utils/domHelpers.d.ts +6 -0
  70. package/dist/components/LiveView/PlayerControl/utils/domHelpers.js +54 -22
  71. package/dist/components/LiveView/i18n/en-US/index.d.ts +2 -2
  72. package/dist/components/LiveView/i18n/en-US/index.js +2 -2
  73. package/dist/components/LiveView/i18n/zh-CN/index.d.ts +2 -2
  74. package/dist/components/LiveView/i18n/zh-CN/index.js +2 -2
  75. package/dist/components/LiveView/index.js +17 -17
  76. package/dist/components/MessageInput/TextEditor/EditorCore.js +2 -2
  77. package/dist/components/MessageList/MessageList.vue.d.ts +2 -2
  78. package/dist/components/MessageList/index.d.ts +18 -18
  79. package/dist/components/MicButton/index.js +11 -11
  80. package/dist/components/StreamMixer/LocalMixer/MixerControl.js +12 -12
  81. package/dist/components/StreamMixer/LocalMixer/index.js +66 -63
  82. package/dist/components/StreamView/Layout/CustomLayout.js +8 -8
  83. package/dist/components/StreamView/Layout/FloatLayout.js +124 -127
  84. package/dist/components/StreamView/Layout/GridLayout.js +5 -5
  85. package/dist/components/StreamView/index.js +25 -33
  86. package/dist/components/StreamView/manager/mediaManager.js +54 -60
  87. package/dist/components/VideoSetting/CameraSelect.js +8 -8
  88. package/dist/components/VideoSetting/VideoMediaControl.js +10 -10
  89. package/dist/components/VideoSetting/VideoPreview.js +9 -9
  90. package/dist/components/VideoSetting/VideoProfile.js +6 -6
  91. package/dist/components/VideoSetting/VideoSettingTab.js +40 -39
  92. package/dist/components/VideoSettingPanel/CameraSelect.js +8 -8
  93. package/dist/components/VideoSettingPanel/VideoPreview.js +1 -1
  94. package/dist/components/VideoSettingPanel/VideoProfile.js +18 -18
  95. package/dist/hooks/useRoomEngine.js +6 -6
  96. package/dist/{index-D2OVtqc8.js → index-BfIEeWMg.js} +191 -181
  97. package/dist/{index-Bm-QfV5o.js → index-DTi1fL-x.js} +460 -457
  98. package/dist/index.js +162 -144
  99. package/dist/report/MetricsKey.d.ts +16 -0
  100. package/dist/report/MetricsKey.js +4 -0
  101. package/dist/report/dataReport.d.ts +12 -0
  102. package/dist/report/dataReport.js +45 -0
  103. package/dist/report/index.d.ts +4 -0
  104. package/dist/report/index.js +6 -0
  105. package/dist/rtc/index.d.ts +5 -43
  106. package/dist/rtc/index.js +48 -48
  107. package/dist/states/BarrageState/BarrageState.d.ts +74 -0
  108. package/dist/states/BarrageState/BarrageState.js +80 -0
  109. package/dist/states/BarrageState/index.d.ts +1 -0
  110. package/dist/states/BarrageState/index.js +5 -0
  111. package/dist/states/{BattleState.d.ts → BattleState/BattleState.d.ts} +10 -11
  112. package/dist/states/BattleState/BattleState.js +203 -0
  113. package/dist/states/BattleState/index.d.ts +1 -0
  114. package/dist/states/BattleState/index.js +4 -0
  115. package/dist/states/CoGuestState.d.ts +24 -94
  116. package/dist/states/CoGuestState.js +297 -189
  117. package/dist/states/CoHostState/CoHostState.d.ts +2 -2
  118. package/dist/states/CoHostState/CoHostState.js +135 -131
  119. package/dist/states/{DeviceState.d.ts → DeviceState/DeviceState.d.ts} +25 -13
  120. package/dist/states/DeviceState/DeviceState.js +314 -0
  121. package/dist/states/DeviceState/index.d.ts +1 -0
  122. package/dist/states/DeviceState/index.js +4 -0
  123. package/dist/states/LiveAudienceState.d.ts +3 -1
  124. package/dist/states/LiveAudienceState.js +106 -63
  125. package/dist/states/{LiveState/index.d.ts → LiveListState/LiveListState.d.ts} +13 -8
  126. package/dist/states/LiveListState/LiveListState.js +285 -0
  127. package/dist/states/LiveListState/index.d.ts +1 -0
  128. package/dist/states/LiveListState/index.js +4 -0
  129. package/dist/states/LiveMonitorState/api/http.js +147 -129
  130. package/dist/states/LiveMonitorState/index.js +67 -62
  131. package/dist/states/LiveSeatState/index.d.ts +46 -11
  132. package/dist/states/LiveSeatState/index.js +34 -15
  133. package/dist/states/LiveSeatState/seatEventManager.d.ts +2 -0
  134. package/dist/states/LiveSeatState/seatEventManager.js +63 -42
  135. package/dist/states/LiveSeatState/seatManager.d.ts +34 -5
  136. package/dist/states/LiveSeatState/seatManager.js +131 -29
  137. package/dist/states/LiveSeatState/store.d.ts +5 -5
  138. package/dist/states/LiveSeatState/store.js +12 -10
  139. package/dist/states/LiveSeatState/usePlayStream/RTCStreamManager.js +1 -1
  140. package/dist/states/LiveSeatState/usePlayStream/RTCStreamPlayer.js +1 -1
  141. package/dist/states/LiveSeatState/usePlayStream/index.js +30 -28
  142. package/dist/states/LoginState.js +39 -34
  143. package/dist/states/SeatStore.js +82 -83
  144. package/dist/states/{VideoMixerState.d.ts → VideoMixerState/VideoMixerState.d.ts} +1 -1
  145. package/dist/states/VideoMixerState/VideoMixerState.js +269 -0
  146. package/dist/states/VideoMixerState/index.d.ts +1 -0
  147. package/dist/states/VideoMixerState/index.js +4 -0
  148. package/dist/styles/index.css +1 -1
  149. package/dist/types/audience.d.ts +21 -0
  150. package/dist/types/audience.js +4 -1
  151. package/dist/types/battle.d.ts +75 -3
  152. package/dist/types/battle.js +5 -1
  153. package/dist/types/coGuest.d.ts +72 -5
  154. package/dist/types/coGuest.js +4 -2
  155. package/dist/types/device.d.ts +38 -17
  156. package/dist/types/device.js +10 -8
  157. package/dist/types/index.d.ts +2 -2
  158. package/dist/types/index.js +96 -80
  159. package/dist/types/live.d.ts +36 -21
  160. package/dist/types/live.js +6 -4
  161. package/dist/types/seat.d.ts +23 -4
  162. package/dist/types/seat.js +7 -1
  163. package/dist/utils/eventCenter.d.ts +88 -0
  164. package/dist/utils/eventCenter.js +161 -0
  165. package/package.json +3 -3
  166. package/src/components/AudioSetting/AudioMediaControl.vue +1 -3
  167. package/src/components/AudioSetting/AudioSettingTab.vue +1 -2
  168. package/src/components/AudioSetting/MicrophoneSelect.vue +1 -2
  169. package/src/components/AudioSetting/SpeakerSelect.vue +1 -2
  170. package/src/components/AudioSettingPanel/i18n/en-US/index.ts +1 -0
  171. package/src/components/AudioSettingPanel/i18n/zh-CN/index.ts +1 -0
  172. package/src/components/AudioSettingPanel/index.vue +4 -2
  173. package/src/components/BarrageInput/BarrageInputH5.vue +1 -1
  174. package/src/components/BarrageInput/EmojiPicker/EmojiPicker.vue +1 -1
  175. package/src/components/BarrageInput/MessageInputState.ts +160 -0
  176. package/src/components/BarrageInput/TextEditor/TextEditor.vue +1 -1
  177. package/src/components/BarrageInput/type.ts +26 -0
  178. package/src/components/BarrageInput/utils.ts +45 -0
  179. package/src/components/BarrageList/BarrageList.vue +61 -117
  180. package/src/components/BarrageList/BarrageListH5.vue +75 -159
  181. package/src/components/BarrageList/BarrageListState.ts +223 -0
  182. package/src/components/BarrageList/Message/MessageLayout/MessageBubble/MessageBubble.vue +8 -55
  183. package/src/components/BarrageList/Message/MessageLayout/MessageLayout.vue +19 -44
  184. package/src/components/BarrageList/Message/TextMessage/TextMessage.vue +69 -96
  185. package/src/components/BarrageList/Message/TextMessage/emoji.ts +132 -0
  186. package/src/components/CameraButton/index.vue +0 -1
  187. package/src/components/CoGuestPanel/CoGuestPanel.vue +16 -91
  188. package/src/components/CoHostPanel/BattlePanel.vue +1 -4
  189. package/src/components/CoHostPanel/ConfigSettingPanel.vue +2 -8
  190. package/src/components/CoHostPanel/ConnectionPanel.vue +37 -33
  191. package/src/components/CoHostPanel/RecommendHostList.vue +12 -13
  192. package/src/components/CoHostPanel/constants.ts +3 -0
  193. package/src/components/CoHostPanel/i18n/en-US/index.ts +1 -0
  194. package/src/components/CoHostPanel/i18n/zh-CN/index.ts +2 -1
  195. package/src/components/LiveAudienceList/LiveAudienceList.vue +4 -5
  196. package/src/components/LiveAudienceList/LiveAudienceListH5.vue +2 -2
  197. package/src/components/LiveAudienceList/UserActionMenu.vue +7 -48
  198. package/src/components/LiveList/LiveList.vue +5 -5
  199. package/src/components/LiveList/LiveListH5.vue +6 -6
  200. package/src/components/LiveScenePanel/index.vue +2 -2
  201. package/src/components/LiveView/CoreViewDecorate/BattleDecorate.vue +10 -15
  202. package/src/components/LiveView/CoreViewDecorate/BattleUserDecorate.vue +2 -2
  203. package/src/components/LiveView/DefaultStreamViewUI.vue +5 -3
  204. package/src/components/LiveView/PlayerControl/AudioControl.vue +1 -1
  205. package/src/components/LiveView/PlayerControl/MultiResolution.vue +9 -3
  206. package/src/components/LiveView/PlayerControl/PlayerControl.vue +10 -2
  207. package/src/components/LiveView/PlayerControl/PlayerControlState.ts +233 -259
  208. package/src/components/LiveView/PlayerControl/utils/domHelpers.ts +64 -0
  209. package/src/components/LiveView/i18n/en-US/index.ts +2 -2
  210. package/src/components/LiveView/i18n/zh-CN/index.ts +2 -2
  211. package/src/components/LiveView/index.vue +2 -2
  212. package/src/components/MicButton/index.vue +3 -3
  213. package/src/components/StreamMixer/LocalMixer/index.vue +6 -8
  214. package/src/components/StreamView/Layout/CustomLayout.vue +2 -2
  215. package/src/components/StreamView/Layout/FloatLayout.vue +88 -83
  216. package/src/components/StreamView/index.vue +28 -14
  217. package/src/components/StreamView/manager/mediaManager.ts +38 -42
  218. package/src/components/VideoSetting/CameraSelect.vue +1 -2
  219. package/src/components/VideoSetting/VideoMediaControl.vue +1 -1
  220. package/src/components/VideoSetting/VideoPreview.vue +1 -2
  221. package/src/components/VideoSetting/VideoProfile.vue +1 -1
  222. package/src/components/VideoSetting/VideoSettingTab.vue +9 -5
  223. package/src/components/VideoSettingPanel/CameraSelect.vue +1 -2
  224. package/src/components/VideoSettingPanel/VideoProfile.vue +7 -7
  225. package/src/hooks/useRoomEngine.ts +1 -1
  226. package/src/report/MetricsKey.ts +16 -0
  227. package/src/report/dataReport.ts +55 -0
  228. package/src/report/index.ts +7 -0
  229. package/src/rtc/index.ts +7 -9
  230. package/src/types/audience.ts +27 -1
  231. package/src/types/battle.ts +87 -4
  232. package/src/types/coGuest.ts +87 -5
  233. package/src/types/device.ts +41 -16
  234. package/src/types/index.ts +2 -2
  235. package/src/types/live.ts +41 -22
  236. package/src/types/seat.ts +28 -4
  237. package/src/utils/eventCenter.ts +249 -0
  238. package/dist/DialogPortal-CvJcEAsn.js +0 -417
  239. package/dist/components/BarrageList/Message/FaceMessage/FaceMessage.js +0 -23
  240. package/dist/components/BarrageList/Message/FaceMessage/FaceMessage.vue.d.ts +0 -30
  241. package/dist/components/BarrageList/Message/FaceMessage/index.d.ts +0 -3
  242. package/dist/components/BarrageList/Message/FaceMessage/index.js +0 -4
  243. package/dist/components/BarrageList/Message/GroupTipMessage/GroupTipMessage.js +0 -4
  244. package/dist/components/BarrageList/Message/GroupTipMessage/GroupTipMessage.vue.d.ts +0 -16
  245. package/dist/components/BarrageList/Message/GroupTipMessage/index.d.ts +0 -3
  246. package/dist/components/BarrageList/Message/GroupTipMessage/index.js +0 -25
  247. package/dist/components/BarrageList/Message/ImageMessage/ImageMessage.js +0 -71
  248. package/dist/components/BarrageList/Message/ImageMessage/ImageMessage.vue.d.ts +0 -34
  249. package/dist/components/BarrageList/Message/ImageMessage/index.d.ts +0 -3
  250. package/dist/components/BarrageList/Message/ImageMessage/index.js +0 -4
  251. package/dist/components/BarrageList/Message/MergerMessage/MergerMessage.js +0 -9
  252. package/dist/components/BarrageList/Message/MergerMessage/MergerMessage.vue.d.ts +0 -2
  253. package/dist/components/BarrageList/Message/MergerMessage/index.d.ts +0 -3
  254. package/dist/components/BarrageList/Message/MergerMessage/index.js +0 -4
  255. package/dist/components/BarrageList/Message/MessageLayout/MessageMeta/MessageMeta.js +0 -40
  256. package/dist/components/BarrageList/Message/MessageLayout/MessageMeta/MessageMeta.vue.d.ts +0 -54
  257. package/dist/components/BarrageList/Message/MessageLayout/MessageMeta/MessageStatusIcon.js +0 -26
  258. package/dist/components/BarrageList/Message/MessageLayout/MessageMeta/MessageStatusIcon.vue.d.ts +0 -15
  259. package/dist/components/BarrageList/Message/MessageLayout/MessageMeta/index.d.ts +0 -3
  260. package/dist/components/BarrageList/Message/MessageLayout/MessageMeta/index.js +0 -4
  261. package/dist/components/BarrageList/Message/RecalledMessage/RecalledMessage.js +0 -41
  262. package/dist/components/BarrageList/Message/RecalledMessage/RecalledMessage.vue.d.ts +0 -35
  263. package/dist/components/BarrageList/Message/RecalledMessage/index.d.ts +0 -3
  264. package/dist/components/BarrageList/Message/RecalledMessage/index.js +0 -4
  265. package/dist/components/BarrageList/MessageForward/ForwardListItem.js +0 -45
  266. package/dist/components/BarrageList/MessageForward/ForwardListItem.vue.d.ts +0 -17
  267. package/dist/components/BarrageList/MessageForward/MessageForward.js +0 -203
  268. package/dist/components/BarrageList/MessageForward/MessageForward.vue.d.ts +0 -2
  269. package/dist/components/BarrageList/MessageForward/index.d.ts +0 -3
  270. package/dist/components/BarrageList/MessageForward/index.js +0 -4
  271. package/dist/components/StreamView/Layout/MixLayout.js +0 -89
  272. package/dist/components/StreamView/Layout/MixLayout.vue.d.ts +0 -31
  273. package/dist/states/BarrageListState/BarrageListState.d.ts +0 -26
  274. package/dist/states/BarrageListState/BarrageListState.js +0 -122
  275. package/dist/states/BarrageListState/index.d.ts +0 -1
  276. package/dist/states/BarrageListState/index.js +0 -4
  277. package/dist/states/BattleState.js +0 -117
  278. package/dist/states/DeviceState.js +0 -296
  279. package/dist/states/LiveState/index.js +0 -254
  280. package/dist/states/VideoMixerState.js +0 -260
  281. package/src/components/BarrageList/Message/FaceMessage/FaceMessage.vue +0 -43
  282. package/src/components/BarrageList/Message/FaceMessage/index.ts +0 -3
  283. package/src/components/BarrageList/Message/GroupTipMessage/GroupTipMessage.vue +0 -55
  284. package/src/components/BarrageList/Message/GroupTipMessage/index.ts +0 -3
  285. package/src/components/BarrageList/Message/ImageMessage/ImageMessage.vue +0 -181
  286. package/src/components/BarrageList/Message/ImageMessage/index.ts +0 -3
  287. package/src/components/BarrageList/Message/MergerMessage/MergerMessage.vue +0 -6
  288. package/src/components/BarrageList/Message/MergerMessage/index.ts +0 -3
  289. package/src/components/BarrageList/Message/MessageLayout/MessageMeta/MessageMeta.vue +0 -70
  290. package/src/components/BarrageList/Message/MessageLayout/MessageMeta/MessageStatusIcon.vue +0 -40
  291. package/src/components/BarrageList/Message/MessageLayout/MessageMeta/index.ts +0 -3
  292. package/src/components/BarrageList/Message/RecalledMessage/RecalledMessage.vue +0 -82
  293. package/src/components/BarrageList/Message/RecalledMessage/index.ts +0 -3
  294. package/src/components/BarrageList/MessageForward/ForwardListItem.vue +0 -67
  295. package/src/components/BarrageList/MessageForward/MessageForward.vue +0 -388
  296. package/src/components/BarrageList/MessageForward/index.ts +0 -3
  297. package/src/components/StreamView/Layout/MixLayout.vue +0 -144
@@ -1,229 +1,337 @@
1
- import { ref as I, computed as m, watch as A } from "vue";
2
- import $, { TUIRoomEvents as S, TUIRequestAction as q, TUIMediaDevice as U } from "@tencentcloud/tuiroom-engine-js";
3
- import { useRoomEngine as h } from "../hooks/useRoomEngine.js";
4
- import { useLiveAudienceState as D } from "./LiveAudienceState.js";
5
- import { useLiveState as O } from "./LiveState/index.js";
6
- import { useLoginState as T } from "./LoginState.js";
7
- import { useSeatStore as M } from "./SeatStore.js";
8
- import { CoGuestStatus as k } from "../types/coGuest.js";
9
- import { LiveStatus as b } from "../types/live.js";
10
- const i = h(), { loginUserInfo: d } = T(), { audienceList: x } = D(), { localLiveStatus: E } = O(), {
11
- sentDeviceRequestMap: C,
12
- receivedDeviceRequestMap: y,
13
- seatList: p,
14
- liveOwnerUserId: v,
15
- localUserId: g,
16
- userInfoMap: R,
17
- getUserInfo: w
18
- } = M(), G = I(null), l = I(/* @__PURE__ */ new Map()), c = I(/* @__PURE__ */ new Map()), B = m(() => {
1
+ import { ref as k, computed as g, watch as h } from "vue";
2
+ import b, { TUIRoomEvents as q, TUIRequestAction as R, TUIRequestCallbackType as d } from "@tencentcloud/tuiroom-engine-js";
3
+ import { useRoomEngine as S } from "../hooks/useRoomEngine.js";
4
+ import { dataReport as w } from "../report/dataReport.js";
5
+ import { MetricsKey as E } from "../report/MetricsKey.js";
6
+ import { useLoginState as C } from "./LoginState.js";
7
+ import { useSeatStore as O } from "./SeatStore.js";
8
+ import { useLiveListState as G } from "./LiveListState/LiveListState.js";
9
+ import { NoResponseReason as T, HostEvent as v, GuestEvent as p } from "../types/coGuest.js";
10
+ const i = S(), { loginUserInfo: _ } = C(), { currentLive: H } = G(), {
11
+ seatList: L,
12
+ localUserId: A,
13
+ userInfoMap: N,
14
+ getUserInfo: y
15
+ } = O(), n = k(/* @__PURE__ */ new Map()), c = k(/* @__PURE__ */ new Map()), m = /* @__PURE__ */ new Map(), M = (e, t) => {
19
16
  var s;
20
- const e = p.value.some((a) => {
21
- var u, o;
22
- return ((u = a.userInfo) == null ? void 0 : u.userId) === ((o = d.value) == null ? void 0 : o.userId);
23
- }), t = l.value.has(((s = d.value) == null ? void 0 : s.userId) || ""), n = c.value.has(v.value);
24
- return e ? k.Connected : t ? k.UserApplying : n ? k.AdminInviting : k.Disconnected;
25
- }), P = m(() => Array.from(c.value.keys()).map((e) => {
26
- const t = R.value.get(e);
27
- return t || console.error("[CoGuestState receivedCoGuestUserList] userInfo not found", e), t;
28
- })), j = m(() => Array.from(l.value.keys()).filter((e) => !e.startsWith("owner-")).map((e) => {
29
- const t = R.value.get(e);
30
- return t || console.error("[CoGuestState sentCoGuestUserList] userInfo not found", e), t;
31
- })), V = m(() => p.value.filter((e) => !!e.userInfo).map((e) => e.userInfo)), W = m(() => x.value.filter((e) => {
32
- var u;
33
- const t = e.userId === ((u = d.value) == null ? void 0 : u.userId), n = p.value.some((o) => {
34
- var r;
35
- return ((r = o.userInfo) == null ? void 0 : r.userId) === e.userId;
36
- }), s = l.value.has(e.userId), a = c.value.has(e.userId);
37
- return !t && !n && !s && !a;
38
- })), z = I(null), F = I(null), H = I(null), J = I(null), K = async (e) => {
39
- var o, r;
40
- const { seatIndex: t = -1, timeout: n = 30, userId: s = "", requestCallback: a } = e || {};
41
- if (!s) {
42
- const f = await ((o = i.instance) == null ? void 0 : o.takeSeat({
43
- seatIndex: t,
44
- timeout: n,
45
- requestCallback: (L) => {
46
- l.value.delete(g.value), a == null || a(L);
47
- }
48
- }));
49
- f && l.value.set(g.value, f);
50
- return;
51
- }
52
- const u = await ((r = i.instance) == null ? void 0 : r.takeUserOnSeatByAdmin({
53
- seatIndex: t,
54
- timeout: n,
55
- userId: s,
56
- requestCallback: (f) => {
57
- l.value.delete(s), a == null || a(f);
17
+ m.has(e) || m.set(e, []), (s = m.get(e)) == null || s.push(t);
18
+ }, K = (e, t) => {
19
+ const s = m.get(e);
20
+ s && (s.splice(s.indexOf(t), 1), s.length === 0 && m.delete(e));
21
+ }, u = (e, t) => {
22
+ const s = m.get(e);
23
+ s && s.forEach((a) => {
24
+ try {
25
+ a(t);
26
+ } catch (o) {
27
+ console.error(`Error in event callback for ${e}:`, o);
28
+ }
29
+ });
30
+ }, j = g(() => L.value.filter((e) => !!e.userInfo).map((e) => e.userInfo)), x = g(() => Array.from(c.value.keys()).map((e) => {
31
+ const t = c.value.get(e);
32
+ return {
33
+ userId: t.userId,
34
+ userName: t.userName,
35
+ avatarUrl: t.avatarUrl
36
+ };
37
+ })), P = g(() => Array.from(n.value.keys()).map((e) => {
38
+ const t = n.value.get(e);
39
+ return {
40
+ userId: t.userId,
41
+ userName: t.userName,
42
+ avatarUrl: t.avatarUrl
43
+ };
44
+ })), B = k([]), F = async (e) => {
45
+ var I;
46
+ const t = E.T_METRICS_STATE_API_CO_GUEST_REQUEST_CONNECTION_COUNT;
47
+ w.reportCount(t);
48
+ const { seatIndex: s, timeout: a } = e, o = await ((I = i.instance) == null ? void 0 : I.takeSeat({
49
+ seatIndex: s,
50
+ timeout: a,
51
+ requestCallback: async (f) => {
52
+ n.value.delete(A.value);
53
+ const { requestCallbackType: U, userId: r } = f, l = await y(r);
54
+ if (N.value.set(r, l), !!l)
55
+ switch (U) {
56
+ case d.kRequestAccepted:
57
+ u(
58
+ p.onGuestApplicationResponded,
59
+ {
60
+ isAccept: !0,
61
+ hostUser: {
62
+ userId: l.userId,
63
+ userName: l.userName,
64
+ avatarUrl: l.avatarUrl
65
+ }
66
+ }
67
+ );
68
+ break;
69
+ case d.kRequestRejected:
70
+ u(
71
+ p.onGuestApplicationResponded,
72
+ {
73
+ isAccept: !1,
74
+ hostUser: {
75
+ userId: l.userId,
76
+ userName: l.userName,
77
+ avatarUrl: l.avatarUrl
78
+ }
79
+ }
80
+ );
81
+ break;
82
+ case d.kRequestTimeout:
83
+ u(
84
+ p.onGuestApplicationNoResponse,
85
+ {
86
+ reason: T.timeout
87
+ }
88
+ );
89
+ break;
90
+ }
58
91
  }
59
92
  }));
60
- if (u) {
61
- const f = await w(s);
62
- l.value.set(s, u), R.value.set(s, f);
63
- }
64
- }, N = async (e) => {
93
+ o && n.value.set(A.value, o);
94
+ }, Q = async () => {
65
95
  var s, a;
66
- const { userId: t = ((s = d.value) == null ? void 0 : s.userId) || "" } = e, n = l.value.get(t);
67
- n && (await ((a = i.instance) == null ? void 0 : a.cancelRequest({
68
- requestId: n.requestId
69
- })), l.value.delete(t));
70
- }, Q = async (e) => {
71
- var s;
72
- const { userId: t = v.value } = e, n = c.value.get(t);
73
- n && (await ((s = i.instance) == null ? void 0 : s.responseRemoteRequest({
74
- requestId: n.requestId,
75
- agree: !0
76
- })), c.value.delete(t));
77
- }, X = async (e) => {
78
- var s;
79
- const { userId: t = v.value } = e, n = c.value.get(t);
80
- n && (await ((s = i.instance) == null ? void 0 : s.responseRemoteRequest({
81
- requestId: n.requestId,
82
- agree: !1
83
- })), c.value.delete(t));
84
- }, Y = async (e) => {
85
- var n, s, a, u;
96
+ const e = (s = _.value) == null ? void 0 : s.userId;
86
97
  if (!e)
87
- return (n = i.instance) == null ? void 0 : n.leaveSeat();
88
- const t = ((a = (s = p.value) == null ? void 0 : s.find((o) => {
89
- var r;
90
- return ((r = o.userInfo) == null ? void 0 : r.userId) === e;
91
- })) == null ? void 0 : a.index) || -1;
92
- if (t === -1) {
93
- console.error("[CoGuestState disconnect] seatIndex not found", e);
94
98
  return;
95
- }
96
- return (u = i.instance) == null ? void 0 : u.kickUserOffSeatByAdmin({
97
- userId: e,
98
- seatIndex: t
99
- });
100
- }, Z = async (e) => {
101
- var o;
102
- const { type: t, timeout: n = 30, userId: s, requestCallback: a } = e, u = await ((o = i.instance) == null ? void 0 : o.openRemoteDeviceByAdmin({
103
- device: t,
104
- timeout: n,
105
- userId: s,
106
- requestCallback: (r) => {
107
- C.value.delete(`${s}-${t}`), a == null || a(r);
99
+ const t = n.value.get(e);
100
+ t && (await ((a = i.instance) == null ? void 0 : a.cancelRequest({
101
+ requestId: t.requestId
102
+ })), n.value.delete(e));
103
+ }, $ = async (e) => {
104
+ var a;
105
+ const { userId: t } = e, s = n.value.get(t);
106
+ s && (await ((a = i.instance) == null ? void 0 : a.responseRemoteRequest({
107
+ requestId: s.requestId,
108
+ agree: !0
109
+ })), n.value.delete(t));
110
+ }, z = async (e) => {
111
+ var a;
112
+ const { userId: t } = e, s = n.value.get(t);
113
+ s && (await ((a = i.instance) == null ? void 0 : a.responseRemoteRequest({
114
+ requestId: s.requestId,
115
+ agree: !1
116
+ })), n.value.delete(t));
117
+ }, D = async (e) => {
118
+ var I;
119
+ const { userId: t, seatIndex: s, timeout: a } = e, o = await ((I = i.instance) == null ? void 0 : I.takeUserOnSeatByAdmin({
120
+ userId: t,
121
+ seatIndex: s,
122
+ timeout: a,
123
+ requestCallback: async (f) => {
124
+ c.value.delete(t);
125
+ const { requestCallbackType: U } = f, r = await y(t);
126
+ if (N.value.set(t, r), !!r)
127
+ switch (U) {
128
+ case d.kRequestAccepted:
129
+ u(
130
+ v.onHostInvitationResponded,
131
+ {
132
+ isAccept: !0,
133
+ guestUser: {
134
+ userId: r.userId,
135
+ userName: r.userName,
136
+ avatarUrl: r.avatarUrl
137
+ }
138
+ }
139
+ );
140
+ break;
141
+ case d.kRequestRejected:
142
+ u(
143
+ v.onHostInvitationResponded,
144
+ {
145
+ isAccept: !1,
146
+ guestUser: {
147
+ userId: r.userId,
148
+ userName: r.userName,
149
+ avatarUrl: r.avatarUrl
150
+ }
151
+ }
152
+ );
153
+ break;
154
+ case d.kRequestTimeout:
155
+ u(
156
+ v.onHostInvitationNoResponse,
157
+ {
158
+ guestUser: {
159
+ userId: r.userId,
160
+ userName: r.userName,
161
+ avatarUrl: r.avatarUrl
162
+ },
163
+ reason: T.timeout
164
+ }
165
+ );
166
+ break;
167
+ }
108
168
  }
109
169
  }));
110
- u && C.value.set(`${s}-${t}`, u);
111
- }, _ = async (e) => {
170
+ o && c.value.set(t, o);
171
+ }, J = async (e) => {
112
172
  var a;
113
- const { type: t, userId: n } = e, s = C.value.get(`${n}-${t}`);
173
+ const { inviteeId: t } = e, s = c.value.get(t);
114
174
  s && (await ((a = i.instance) == null ? void 0 : a.cancelRequest({
115
175
  requestId: s.requestId
116
- })), C.value.delete(`${n}-${t}`));
117
- }, ee = async (e) => {
118
- var s;
119
- const { type: t } = e, n = y.value.get(`${v.value}-${t}`);
120
- n && (await ((s = i.instance) == null ? void 0 : s.responseRemoteRequest({
121
- requestId: n.requestId,
176
+ })), c.value.delete(t));
177
+ }, V = async (e) => {
178
+ var a;
179
+ const { inviterId: t } = e, s = c.value.get(t);
180
+ s && (await ((a = i.instance) == null ? void 0 : a.responseRemoteRequest({
181
+ requestId: s.requestId,
122
182
  agree: !0
123
- })), y.value.delete(`${v.value}-${t}`));
124
- }, te = async (e) => {
125
- var s;
126
- const { type: t } = e, n = y.value.get(`${v.value}-${t}`);
127
- n && (await ((s = i.instance) == null ? void 0 : s.responseRemoteRequest({
128
- requestId: n.requestId,
183
+ })), c.value.delete(t));
184
+ }, W = async (e) => {
185
+ var a;
186
+ const { inviterId: t } = e, s = c.value.get(t);
187
+ s && (await ((a = i.instance) == null ? void 0 : a.responseRemoteRequest({
188
+ requestId: s.requestId,
129
189
  agree: !1
130
- })), y.value.delete(`${v.value}-${t}`));
131
- }, se = async (e) => {
132
- var a, u;
133
- const { type: t, userId: n } = e, s = (a = p.value) == null ? void 0 : a.find((o) => {
134
- var r;
135
- return ((r = o.userInfo) == null ? void 0 : r.userId) === n;
136
- });
137
- s && await ((u = i.instance) == null ? void 0 : u.lockSeatByAdmin({
138
- seatIndex: s.index,
139
- lockParams: {
140
- lockSeat: s.isLocked,
141
- lockVideo: t === U.kCamera || s.isVideoLocked,
142
- lockAudio: t === U.kMicrophone || s.isAudioLocked
143
- }
144
- }));
145
- }, ne = async ({ request: e }) => {
146
- const { userId: t, requestAction: n } = e;
147
- switch (R.value.set(t, await w(t)), n) {
148
- case q.kRequestToTakeSeat:
149
- c.value.set(t, e);
190
+ })), c.value.delete(t));
191
+ }, X = async () => {
192
+ var e;
193
+ return (e = i.instance) == null ? void 0 : e.leaveSeat();
194
+ }, Y = async ({ request: e }) => {
195
+ const { userId: t, requestAction: s, userName: a, avatarUrl: o } = e;
196
+ switch (N.value.set(t, await y(t)), s) {
197
+ case R.kRequestToTakeSeat:
198
+ u(
199
+ v.onGuestApplicationReceived,
200
+ {
201
+ guestUser: {
202
+ userId: t,
203
+ userName: a,
204
+ avatarUrl: o
205
+ }
206
+ }
207
+ ), n.value.set(t, e);
150
208
  break;
151
- case q.kRequestRemoteUserOnSeat:
152
- c.value.set(v.value, e);
209
+ case R.kRequestRemoteUserOnSeat:
210
+ u(
211
+ p.onHostInvitationReceived,
212
+ {
213
+ hostUser: {
214
+ userId: t,
215
+ userName: a,
216
+ avatarUrl: o
217
+ }
218
+ }
219
+ ), c.value.set(t, e);
153
220
  break;
154
221
  }
155
- }, ae = ({
156
- userId: e,
222
+ }, Z = ({
223
+ userInfo: e,
157
224
  request: t
158
225
  }) => {
159
- const { requestAction: n } = t;
160
- switch (n) {
161
- case q.kRequestToTakeSeat:
162
- c.value.delete(e);
163
- break;
164
- case q.kRequestRemoteUserOnSeat:
165
- c.value.delete(v.value);
226
+ const { requestAction: s } = t;
227
+ switch (s) {
228
+ case R.kRequestToTakeSeat:
229
+ u(
230
+ v.onGuestApplicationProcessedByOtherHost,
231
+ {
232
+ guestUser: {
233
+ userId: t.userId,
234
+ userName: t.userName,
235
+ avatarUrl: t.avatarUrl
236
+ },
237
+ hostUser: {
238
+ userId: e.userId,
239
+ userName: e.userName,
240
+ avatarUrl: e.avatarUrl
241
+ }
242
+ }
243
+ ), n.value.delete(t.userId);
166
244
  break;
167
245
  }
168
- }, ue = ({
246
+ }, ee = ({
169
247
  userId: e,
170
248
  request: t
171
249
  }) => {
172
- const { requestAction: n } = t;
173
- switch (n) {
174
- case q.kRequestToTakeSeat:
175
- c.value.delete(e);
250
+ const { requestAction: s, userName: a, avatarUrl: o } = t;
251
+ switch (s) {
252
+ case R.kRequestToTakeSeat:
253
+ u(
254
+ v.onGuestApplicationCancelled,
255
+ {
256
+ guestUser: {
257
+ userId: e,
258
+ userName: a,
259
+ avatarUrl: o
260
+ }
261
+ }
262
+ ), n.value.delete(e);
176
263
  break;
177
- case q.kRequestRemoteUserOnSeat:
178
- c.value.delete(v.value);
264
+ case R.kRequestRemoteUserOnSeat:
265
+ u(
266
+ p.onHostInvitationCancelled,
267
+ {
268
+ hostUser: {
269
+ userId: e,
270
+ userName: a,
271
+ avatarUrl: o
272
+ }
273
+ }
274
+ ), c.value.delete(e);
179
275
  break;
180
276
  }
181
- }, oe = [
182
- { event: S.onRequestReceived, handler: ne },
183
- { event: S.onRequestProcessed, handler: ae },
184
- { event: S.onRequestCancelled, handler: ue }
185
- ], ce = () => {
186
- oe.forEach(({ event: e, handler: t }) => {
187
- var n;
188
- (n = i.instance) == null || n.on(e, t);
277
+ }, te = ({ seatIndex: e, userInfo: t }) => {
278
+ u(
279
+ p.onKickedOffSeat,
280
+ {
281
+ seatIndex: e,
282
+ hostUser: {
283
+ userId: t.userId,
284
+ userName: t.userName,
285
+ avatarUrl: t.avatarUrl
286
+ }
287
+ }
288
+ );
289
+ }, se = [
290
+ { event: q.onRequestReceived, handler: Y },
291
+ { event: q.onRequestProcessed, handler: Z },
292
+ { event: q.onRequestCancelled, handler: ee },
293
+ { event: q.onKickedOffSeat, handler: te }
294
+ ], ae = () => {
295
+ se.forEach(({ event: e, handler: t }) => {
296
+ var s;
297
+ (s = i.instance) == null || s.on(e, t);
189
298
  });
190
299
  };
191
- $.once("ready", () => {
192
- ce();
300
+ b.once("ready", () => {
301
+ ae();
193
302
  });
194
- A(
195
- E,
303
+ h(
304
+ () => {
305
+ var e;
306
+ return (e = H.value) == null ? void 0 : e.liveId;
307
+ },
196
308
  async (e) => {
197
- var t;
198
- e === b.Live ? (t = d.value) != null && t.userId && (G.value = await w(d.value.userId), R.value.set(d.value.userId, G.value)) : (l.value.clear(), c.value.clear(), R.value.clear(), G.value = null);
309
+ e || (n.value.clear(), c.value.clear());
199
310
  },
200
311
  { immediate: !0 }
201
312
  );
202
- function me() {
313
+ function pe() {
203
314
  return {
204
315
  // state
205
- localCoGuestStatus: B,
206
- userListInCoGuest: V,
207
- receivedCoGuestUserList: P,
208
- availableCoGuestUserList: W,
209
- sentCoGuestUserList: j,
210
- latestReceivedCoGuestRequest: z,
211
- latestCancelledCoGuestRequest: F,
212
- latestAcceptedCoGuestRequest: H,
213
- latestRejectedCoGuestRequest: J,
316
+ connected: j,
317
+ invitees: x,
318
+ applicants: P,
319
+ candidates: B,
214
320
  // action
215
- sendCoGuestRequest: K,
216
- cancelCoGuestRequest: N,
217
- acceptCoGuestRequest: Q,
218
- rejectCoGuestRequest: X,
219
- disconnect: Y,
220
- sendOpenDeviceRequest: Z,
221
- cancelOpenDeviceRequest: _,
222
- acceptOpenDeviceRequest: ee,
223
- rejectOpenDeviceRequest: te,
224
- closeRemoteDevice: se
321
+ applyForSeat: F,
322
+ cancelApplication: Q,
323
+ acceptApplication: $,
324
+ rejectApplication: z,
325
+ inviteToSeat: D,
326
+ cancelInvitation: J,
327
+ acceptInvitation: V,
328
+ rejectInvitation: W,
329
+ disConnect: X,
330
+ // event
331
+ subscribeEvent: M,
332
+ unsubscribeEvent: K
225
333
  };
226
334
  }
227
335
  export {
228
- me as useCoGuestState
336
+ pe as useCoGuestState
229
337
  };
@@ -1,12 +1,12 @@
1
1
  import { Ref } from 'vue';
2
2
  import { TUIConnectionCode } from '@tencentcloud/tuiroom-engine-js';
3
- import { SeatUserInfo, CoHostStatus, CoHostEvent, CoHostLayoutTemplate } from '../../types';
3
+ import { CoHostStatus, CoHostEvent, SeatUserInfo, CoHostLayoutTemplate } from '../../types';
4
4
 
5
5
  export type CoHostEventCallback = (eventInfo: any) => void;
6
6
  export declare function useCoHostState(): {
7
7
  coHostStatus: import('vue').ComputedRef<CoHostStatus>;
8
8
  connected: Ref<SeatUserInfo[], SeatUserInfo[]>;
9
- applicants: Ref<SeatUserInfo[], SeatUserInfo[]>;
9
+ applicant: Ref<SeatUserInfo | null, SeatUserInfo | null>;
10
10
  invitees: Ref<SeatUserInfo[], SeatUserInfo[]>;
11
11
  candidates: import('vue').ComputedRef<SeatUserInfo[]>;
12
12
  requestHostConnection: (params: {