fcr-ui-scene-mobile 3.4.0

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 (281) hide show
  1. package/lib/assets/ground_glass_bg.png +0 -0
  2. package/lib/base.d.ts +11 -0
  3. package/lib/base.js +39 -0
  4. package/lib/common/device-store.d.ts +86 -0
  5. package/lib/common/device-store.js +642 -0
  6. package/lib/common/device-stream-store.d.ts +26 -0
  7. package/lib/common/device-stream-store.js +298 -0
  8. package/lib/common/event-store.d.ts +124 -0
  9. package/lib/common/event-store.js +249 -0
  10. package/lib/common/global-context.d.ts +11 -0
  11. package/lib/common/global-context.js +9 -0
  12. package/lib/common/member-list-data-source.d.ts +28 -0
  13. package/lib/common/member-list-data-source.js +305 -0
  14. package/lib/common/participant-store.d.ts +195 -0
  15. package/lib/common/participant-store.js +1577 -0
  16. package/lib/common/security-store.d.ts +119 -0
  17. package/lib/common/security-store.js +948 -0
  18. package/lib/common/setting-store.d.ts +181 -0
  19. package/lib/common/setting-store.js +797 -0
  20. package/lib/common/type.d.ts +73 -0
  21. package/lib/common/type.js +22 -0
  22. package/lib/config/default-config.d.ts +32 -0
  23. package/lib/config/default-config.js +39 -0
  24. package/lib/config/setting-config.d.ts +16 -0
  25. package/lib/config/setting-config.js +17 -0
  26. package/lib/creator.d.ts +10 -0
  27. package/lib/creator.js +49 -0
  28. package/lib/global.d.ts +8 -0
  29. package/lib/hooks/meeting-time.d.ts +15 -0
  30. package/lib/hooks/meeting-time.js +92 -0
  31. package/lib/hooks/useIsNodePresent.d.ts +4 -0
  32. package/lib/hooks/useIsNodePresent.js +53 -0
  33. package/lib/hooks/useOnRefMount.d.ts +2 -0
  34. package/lib/hooks/useOnRefMount.js +27 -0
  35. package/lib/index.d.ts +6 -0
  36. package/lib/index.js +50 -0
  37. package/lib/mobile-global.css +28 -0
  38. package/lib/modules/action-bar/bottom-icons.d.ts +17 -0
  39. package/lib/modules/action-bar/bottom-icons.js +160 -0
  40. package/lib/modules/action-bar/context.d.ts +2 -0
  41. package/lib/modules/action-bar/context.js +9 -0
  42. package/lib/modules/action-bar/index.css +33 -0
  43. package/lib/modules/action-bar/index.d.ts +27 -0
  44. package/lib/modules/action-bar/index.js +46 -0
  45. package/lib/modules/action-bar/member-list-popup/attendee/index.css +130 -0
  46. package/lib/modules/action-bar/member-list-popup/attendee/index.d.ts +19 -0
  47. package/lib/modules/action-bar/member-list-popup/attendee/index.js +252 -0
  48. package/lib/modules/action-bar/member-list-popup/attendee/list.d.ts +1 -0
  49. package/lib/modules/action-bar/member-list-popup/attendee/list.js +82 -0
  50. package/lib/modules/action-bar/member-list-popup/index.css +35 -0
  51. package/lib/modules/action-bar/member-list-popup/index.d.ts +7 -0
  52. package/lib/modules/action-bar/member-list-popup/index.js +40 -0
  53. package/lib/modules/action-bar/member-list-popup/participant-more-actions/index.css +0 -0
  54. package/lib/modules/action-bar/member-list-popup/participant-more-actions/index.d.ts +12 -0
  55. package/lib/modules/action-bar/member-list-popup/participant-more-actions/index.js +58 -0
  56. package/lib/modules/action-bar/more-popup/index.css +71 -0
  57. package/lib/modules/action-bar/more-popup/index.d.ts +2 -0
  58. package/lib/modules/action-bar/more-popup/index.js +126 -0
  59. package/lib/modules/action-bar/store.d.ts +196 -0
  60. package/lib/modules/action-bar/store.js +1425 -0
  61. package/lib/modules/action-bar/type.d.ts +6 -0
  62. package/lib/modules/action-bar/type.js +13 -0
  63. package/lib/modules/action-bar/view.d.ts +2 -0
  64. package/lib/modules/action-bar/view.js +75 -0
  65. package/lib/modules/audio-stream/ index.d.ts +19 -0
  66. package/lib/modules/audio-stream/ index.js +109 -0
  67. package/lib/modules/audio-stream/index.d.ts +25 -0
  68. package/lib/modules/audio-stream/index.js +135 -0
  69. package/lib/modules/chat/chat-bar/index.css +97 -0
  70. package/lib/modules/chat/chat-bar/index.d.ts +12 -0
  71. package/lib/modules/chat/chat-bar/index.js +129 -0
  72. package/lib/modules/chat/chat-notification/index.css +71 -0
  73. package/lib/modules/chat/chat-notification/index.d.ts +3 -0
  74. package/lib/modules/chat/chat-notification/index.js +75 -0
  75. package/lib/modules/chat/chat-select/index.css +183 -0
  76. package/lib/modules/chat/chat-select/index.d.ts +12 -0
  77. package/lib/modules/chat/chat-select/index.js +223 -0
  78. package/lib/modules/chat/contex.d.ts +2 -0
  79. package/lib/modules/chat/contex.js +9 -0
  80. package/lib/modules/chat/demo-wrapper.d.ts +1 -0
  81. package/lib/modules/chat/demo-wrapper.js +42 -0
  82. package/lib/modules/chat/index.css +108 -0
  83. package/lib/modules/chat/index.d.ts +28 -0
  84. package/lib/modules/chat/index.dev.d.ts +1 -0
  85. package/lib/modules/chat/index.dev.js +58 -0
  86. package/lib/modules/chat/index.js +208 -0
  87. package/lib/modules/chat/message-list.d.ts +22 -0
  88. package/lib/modules/chat/message-list.js +617 -0
  89. package/lib/modules/chat/mock.d.ts +2 -0
  90. package/lib/modules/chat/mock.js +283 -0
  91. package/lib/modules/chat/store.d.ts +183 -0
  92. package/lib/modules/chat/store.js +1101 -0
  93. package/lib/modules/chat/util.d.ts +6 -0
  94. package/lib/modules/chat/util.js +69 -0
  95. package/lib/modules/chat/view.d.ts +11 -0
  96. package/lib/modules/chat/view.js +414 -0
  97. package/lib/modules/layout/bottom-drawer/index.css +34 -0
  98. package/lib/modules/layout/bottom-drawer/index.d.ts +3 -0
  99. package/lib/modules/layout/bottom-drawer/index.js +129 -0
  100. package/lib/modules/layout/components/Layout.d.ts +1 -0
  101. package/lib/modules/layout/components/Layout.js +98 -0
  102. package/lib/modules/layout/components/equip-request-popup/index.css +30 -0
  103. package/lib/modules/layout/components/equip-request-popup/index.d.ts +3 -0
  104. package/lib/modules/layout/components/equip-request-popup/index.js +78 -0
  105. package/lib/modules/layout/components/index.css +78 -0
  106. package/lib/modules/layout/components/index.d.ts +2 -0
  107. package/lib/modules/layout/components/index.js +25 -0
  108. package/lib/modules/layout/context.d.ts +2 -0
  109. package/lib/modules/layout/context.js +9 -0
  110. package/lib/modules/layout/drawer-header/index.css +27 -0
  111. package/lib/modules/layout/drawer-header/index.d.ts +10 -0
  112. package/lib/modules/layout/drawer-header/index.js +54 -0
  113. package/lib/modules/layout/index.css +22 -0
  114. package/lib/modules/layout/index.d.ts +8 -0
  115. package/lib/modules/layout/index.js +47 -0
  116. package/lib/modules/layout/store.d.ts +59 -0
  117. package/lib/modules/layout/store.js +379 -0
  118. package/lib/modules/layout/type.d.ts +65 -0
  119. package/lib/modules/layout/type.js +52 -0
  120. package/lib/modules/layout/view.d.ts +2 -0
  121. package/lib/modules/layout/view.js +10 -0
  122. package/lib/modules/member-layout/context.d.ts +2 -0
  123. package/lib/modules/member-layout/context.js +9 -0
  124. package/lib/modules/member-layout/data.d.ts +2 -0
  125. package/lib/modules/member-layout/data.js +304 -0
  126. package/lib/modules/member-layout/grid/index.css +98 -0
  127. package/lib/modules/member-layout/grid/index.d.ts +21 -0
  128. package/lib/modules/member-layout/grid/index.js +316 -0
  129. package/lib/modules/member-layout/index.css +88 -0
  130. package/lib/modules/member-layout/index.d.ts +8 -0
  131. package/lib/modules/member-layout/index.js +45 -0
  132. package/lib/modules/member-layout/share-toast/index.css +30 -0
  133. package/lib/modules/member-layout/share-toast/index.d.ts +5 -0
  134. package/lib/modules/member-layout/share-toast/index.js +43 -0
  135. package/lib/modules/member-layout/speaker/index.css +30 -0
  136. package/lib/modules/member-layout/speaker/index.d.ts +9 -0
  137. package/lib/modules/member-layout/speaker/index.js +28 -0
  138. package/lib/modules/member-layout/store.d.ts +70 -0
  139. package/lib/modules/member-layout/store.js +479 -0
  140. package/lib/modules/member-layout/user/index.css +121 -0
  141. package/lib/modules/member-layout/user/index.d.ts +34 -0
  142. package/lib/modules/member-layout/user/index.js +355 -0
  143. package/lib/modules/member-layout/user/types.d.ts +16 -0
  144. package/lib/modules/member-layout/user/types.js +6 -0
  145. package/lib/modules/member-layout/view.d.ts +2 -0
  146. package/lib/modules/member-layout/view.js +225 -0
  147. package/lib/modules/state-bar/context.d.ts +2 -0
  148. package/lib/modules/state-bar/context.js +9 -0
  149. package/lib/modules/state-bar/index.css +79 -0
  150. package/lib/modules/state-bar/index.d.ts +17 -0
  151. package/lib/modules/state-bar/index.js +55 -0
  152. package/lib/modules/state-bar/leaving-room/index.css +14 -0
  153. package/lib/modules/state-bar/leaving-room/index.d.ts +7 -0
  154. package/lib/modules/state-bar/leaving-room/index.js +38 -0
  155. package/lib/modules/state-bar/meeting-detail/index.css +72 -0
  156. package/lib/modules/state-bar/meeting-detail/index.d.ts +2 -0
  157. package/lib/modules/state-bar/meeting-detail/index.js +59 -0
  158. package/lib/modules/state-bar/meeting-detail/meeting-info/copy.d.ts +4 -0
  159. package/lib/modules/state-bar/meeting-detail/meeting-info/copy.js +81 -0
  160. package/lib/modules/state-bar/meeting-detail/meeting-info/index.css +92 -0
  161. package/lib/modules/state-bar/meeting-detail/meeting-info/index.d.ts +2 -0
  162. package/lib/modules/state-bar/meeting-detail/meeting-info/index.js +188 -0
  163. package/lib/modules/state-bar/meeting-detail/net-quality/index.css +27 -0
  164. package/lib/modules/state-bar/meeting-detail/net-quality/index.d.ts +2 -0
  165. package/lib/modules/state-bar/meeting-detail/net-quality/index.js +87 -0
  166. package/lib/modules/state-bar/store.d.ts +76 -0
  167. package/lib/modules/state-bar/store.js +561 -0
  168. package/lib/modules/state-bar/view.d.ts +7 -0
  169. package/lib/modules/state-bar/view.js +215 -0
  170. package/lib/modules/whiteboard/app.d.ts +2 -0
  171. package/lib/modules/whiteboard/app.js +41 -0
  172. package/lib/modules/whiteboard/components/control-bar/index.css +53 -0
  173. package/lib/modules/whiteboard/components/control-bar/index.d.ts +2 -0
  174. package/lib/modules/whiteboard/components/control-bar/index.js +156 -0
  175. package/lib/modules/whiteboard/components/control-bar/store.d.ts +35 -0
  176. package/lib/modules/whiteboard/components/control-bar/store.js +288 -0
  177. package/lib/modules/whiteboard/components/loading/index.css +76 -0
  178. package/lib/modules/whiteboard/components/loading/index.d.ts +2 -0
  179. package/lib/modules/whiteboard/components/loading/index.js +68 -0
  180. package/lib/modules/whiteboard/components/loading/loading.png +0 -0
  181. package/lib/modules/whiteboard/components/multi-window/index.css +65 -0
  182. package/lib/modules/whiteboard/components/multi-window/index.d.ts +5 -0
  183. package/lib/modules/whiteboard/components/multi-window/index.js +39 -0
  184. package/lib/modules/whiteboard/components/pagination/index.css +228 -0
  185. package/lib/modules/whiteboard/components/pagination/index.d.ts +15 -0
  186. package/lib/modules/whiteboard/components/pagination/index.js +163 -0
  187. package/lib/modules/whiteboard/components/pagination/store.d.ts +18 -0
  188. package/lib/modules/whiteboard/components/pagination/store.js +17 -0
  189. package/lib/modules/whiteboard/components/progress/index.d.ts +5 -0
  190. package/lib/modules/whiteboard/components/progress/index.js +43 -0
  191. package/lib/modules/whiteboard/components/progress/style.css +52 -0
  192. package/lib/modules/whiteboard/components/scene-pagination.d.ts +1 -0
  193. package/lib/modules/whiteboard/components/scene-pagination.js +30 -0
  194. package/lib/modules/whiteboard/components/switch-theme/index.css +98 -0
  195. package/lib/modules/whiteboard/components/switch-theme/index.d.ts +3 -0
  196. package/lib/modules/whiteboard/components/switch-theme/index.js +89 -0
  197. package/lib/modules/whiteboard/components/switch-theme/item.d.ts +9 -0
  198. package/lib/modules/whiteboard/components/switch-theme/item.js +53 -0
  199. package/lib/modules/whiteboard/components/switch-theme/libs.d.ts +4 -0
  200. package/lib/modules/whiteboard/components/switch-theme/libs.js +29 -0
  201. package/lib/modules/whiteboard/components/toolbar/ style.css +588 -0
  202. package/lib/modules/whiteboard/components/toolbar/components/color-picker/components/color.d.ts +5 -0
  203. package/lib/modules/whiteboard/components/toolbar/components/color-picker/components/color.js +38 -0
  204. package/lib/modules/whiteboard/components/toolbar/components/color-picker/components/panel.d.ts +1 -0
  205. package/lib/modules/whiteboard/components/toolbar/components/color-picker/components/panel.js +107 -0
  206. package/lib/modules/whiteboard/components/toolbar/components/color-picker/components/picker.d.ts +1 -0
  207. package/lib/modules/whiteboard/components/toolbar/components/color-picker/components/picker.js +59 -0
  208. package/lib/modules/whiteboard/components/toolbar/components/color-picker/index.d.ts +2 -0
  209. package/lib/modules/whiteboard/components/toolbar/components/color-picker/index.js +44 -0
  210. package/lib/modules/whiteboard/components/toolbar/components/eraser-picker.d.ts +4 -0
  211. package/lib/modules/whiteboard/components/toolbar/components/eraser-picker.js +89 -0
  212. package/lib/modules/whiteboard/components/toolbar/components/extra-tool-picker.d.ts +1 -0
  213. package/lib/modules/whiteboard/components/toolbar/components/extra-tool-picker.js +63 -0
  214. package/lib/modules/whiteboard/components/toolbar/components/history.d.ts +2 -0
  215. package/lib/modules/whiteboard/components/toolbar/components/history.js +46 -0
  216. package/lib/modules/whiteboard/components/toolbar/components/icons/fold-icon.d.ts +2 -0
  217. package/lib/modules/whiteboard/components/toolbar/components/icons/fold-icon.js +39 -0
  218. package/lib/modules/whiteboard/components/toolbar/components/icons/move-icon.d.ts +1 -0
  219. package/lib/modules/whiteboard/components/toolbar/components/icons/move-icon.js +66 -0
  220. package/lib/modules/whiteboard/components/toolbar/components/move-handle.d.ts +5 -0
  221. package/lib/modules/whiteboard/components/toolbar/components/move-handle.js +134 -0
  222. package/lib/modules/whiteboard/components/toolbar/components/pen-picker.d.ts +4 -0
  223. package/lib/modules/whiteboard/components/toolbar/components/pen-picker.js +106 -0
  224. package/lib/modules/whiteboard/components/toolbar/components/shape-picker.d.ts +4 -0
  225. package/lib/modules/whiteboard/components/toolbar/components/shape-picker.js +168 -0
  226. package/lib/modules/whiteboard/components/toolbar/hooks/index.d.ts +14 -0
  227. package/lib/modules/whiteboard/components/toolbar/hooks/index.js +211 -0
  228. package/lib/modules/whiteboard/components/toolbar/index.d.ts +2 -0
  229. package/lib/modules/whiteboard/components/toolbar/index.js +183 -0
  230. package/lib/modules/whiteboard/components/toolbar/store.d.ts +51 -0
  231. package/lib/modules/whiteboard/components/toolbar/store.js +248 -0
  232. package/lib/modules/whiteboard/context.d.ts +69 -0
  233. package/lib/modules/whiteboard/context.js +36 -0
  234. package/lib/modules/whiteboard/index.d.ts +119 -0
  235. package/lib/modules/whiteboard/index.js +1134 -0
  236. package/lib/modules/whiteboard/style.css +143 -0
  237. package/lib/modules/whiteboard/type.d.ts +94 -0
  238. package/lib/modules/whiteboard/type.js +89 -0
  239. package/lib/modules/whiteboard/utils.d.ts +12 -0
  240. package/lib/modules/whiteboard/utils.js +36 -0
  241. package/lib/plugins/css-preset-plugin.d.ts +1 -0
  242. package/lib/plugins/css-preset-plugin.js +29 -0
  243. package/lib/plugins/module-dev-plugin.d.ts +12 -0
  244. package/lib/plugins/module-dev-plugin.js +183 -0
  245. package/lib/plugins/multi-lang-plugin.d.ts +1 -0
  246. package/lib/plugins/multi-lang-plugin.js +19 -0
  247. package/lib/plugins/rtm-plugin.d.ts +1 -0
  248. package/lib/plugins/rtm-plugin.js +5 -0
  249. package/lib/plugins/web-rtc-plugin.d.ts +1 -0
  250. package/lib/plugins/web-rtc-plugin.js +5 -0
  251. package/lib/translations/enUS.d.ts +1855 -0
  252. package/lib/translations/enUS.js +1895 -0
  253. package/lib/translations/zhCN.d.ts +1852 -0
  254. package/lib/translations/zhCN.js +1892 -0
  255. package/lib/type.d.ts +121 -0
  256. package/lib/type.js +46 -0
  257. package/lib/ui-manager.d.ts +32 -0
  258. package/lib/ui-manager.js +426 -0
  259. package/lib/ui-scene.d.ts +14 -0
  260. package/lib/ui-scene.js +141 -0
  261. package/lib/utilities/board-context.d.ts +4 -0
  262. package/lib/utilities/board-context.js +12 -0
  263. package/lib/utilities/constant.d.ts +286 -0
  264. package/lib/utilities/constant.js +271 -0
  265. package/lib/utilities/copyText.d.ts +2 -0
  266. package/lib/utilities/copyText.js +43 -0
  267. package/lib/utilities/extract.d.ts +5 -0
  268. package/lib/utilities/extract.js +117 -0
  269. package/lib/utilities/hooks.d.ts +14 -0
  270. package/lib/utilities/hooks.js +101 -0
  271. package/lib/utilities/mute-action.d.ts +4 -0
  272. package/lib/utilities/mute-action.js +48 -0
  273. package/lib/utilities/parameters.d.ts +7 -0
  274. package/lib/utilities/parameters.js +20 -0
  275. package/lib/utilities/regex.d.ts +1 -0
  276. package/lib/utilities/regex.js +14 -0
  277. package/lib/utilities/tools.d.ts +27 -0
  278. package/lib/utilities/tools.js +169 -0
  279. package/lib/utilities/useNamespace.d.ts +15 -0
  280. package/lib/utilities/useNamespace.js +66 -0
  281. package/package.json +63 -0
@@ -0,0 +1,1101 @@
1
+ "use strict";
2
+
3
+ require("core-js/modules/es.symbol.js");
4
+ require("core-js/modules/es.symbol.description.js");
5
+ require("core-js/modules/es.symbol.to-primitive.js");
6
+ require("core-js/modules/es.error.cause.js");
7
+ require("core-js/modules/es.error.to-string.js");
8
+ require("core-js/modules/es.array.is-array.js");
9
+ require("core-js/modules/es.date.to-primitive.js");
10
+ require("core-js/modules/es.function.name.js");
11
+ require("core-js/modules/es.number.constructor.js");
12
+ require("core-js/modules/es.object.create.js");
13
+ require("core-js/modules/es.object.define-properties.js");
14
+ require("core-js/modules/es.object.define-property.js");
15
+ require("core-js/modules/es.object.get-own-property-descriptor.js");
16
+ require("core-js/modules/es.object.get-own-property-descriptors.js");
17
+ require("core-js/modules/es.object.keys.js");
18
+ require("core-js/modules/esnext.function.metadata.js");
19
+ require("core-js/modules/esnext.symbol.metadata.js");
20
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
21
+ var _typeof = require("@babel/runtime/helpers/typeof");
22
+ Object.defineProperty(exports, "__esModule", {
23
+ value: true
24
+ });
25
+ exports["default"] = exports.allToUser = exports.USER_NONE = exports.USER_ALL = exports.ChatRoomStore = void 0;
26
+ exports.isManager = isManager;
27
+ exports.noUser = void 0;
28
+ exports.sortUsers = sortUsers;
29
+ var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
30
+ require("core-js/modules/es.array.filter.js");
31
+ require("core-js/modules/es.array.find.js");
32
+ require("core-js/modules/es.array.for-each.js");
33
+ require("core-js/modules/es.array.from.js");
34
+ require("core-js/modules/es.array.iterator.js");
35
+ require("core-js/modules/es.array.push.js");
36
+ require("core-js/modules/es.array.some.js");
37
+ require("core-js/modules/es.array.sort.js");
38
+ require("core-js/modules/es.array.splice.js");
39
+ require("core-js/modules/es.date.now.js");
40
+ require("core-js/modules/es.date.to-string.js");
41
+ require("core-js/modules/es.function.bind.js");
42
+ require("core-js/modules/es.map.js");
43
+ require("core-js/modules/es.object.entries.js");
44
+ require("core-js/modules/es.object.to-string.js");
45
+ require("core-js/modules/es.string.iterator.js");
46
+ require("core-js/modules/es.weak-map.js");
47
+ require("core-js/modules/esnext.async-iterator.filter.js");
48
+ require("core-js/modules/esnext.async-iterator.find.js");
49
+ require("core-js/modules/esnext.async-iterator.for-each.js");
50
+ require("core-js/modules/esnext.async-iterator.some.js");
51
+ require("core-js/modules/esnext.iterator.constructor.js");
52
+ require("core-js/modules/esnext.iterator.filter.js");
53
+ require("core-js/modules/esnext.iterator.find.js");
54
+ require("core-js/modules/esnext.iterator.for-each.js");
55
+ require("core-js/modules/esnext.iterator.some.js");
56
+ require("core-js/modules/esnext.map.delete-all.js");
57
+ require("core-js/modules/esnext.map.emplace.js");
58
+ require("core-js/modules/esnext.map.every.js");
59
+ require("core-js/modules/esnext.map.filter.js");
60
+ require("core-js/modules/esnext.map.find.js");
61
+ require("core-js/modules/esnext.map.find-key.js");
62
+ require("core-js/modules/esnext.map.includes.js");
63
+ require("core-js/modules/esnext.map.key-of.js");
64
+ require("core-js/modules/esnext.map.map-keys.js");
65
+ require("core-js/modules/esnext.map.map-values.js");
66
+ require("core-js/modules/esnext.map.merge.js");
67
+ require("core-js/modules/esnext.map.reduce.js");
68
+ require("core-js/modules/esnext.map.some.js");
69
+ require("core-js/modules/esnext.map.update.js");
70
+ require("core-js/modules/esnext.weak-map.delete-all.js");
71
+ require("core-js/modules/esnext.weak-map.emplace.js");
72
+ require("core-js/modules/web.dom-collections.for-each.js");
73
+ require("core-js/modules/web.dom-collections.iterator.js");
74
+ require("core-js/modules/web.timers.js");
75
+ var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
76
+ var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray"));
77
+ var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
78
+ var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
79
+ var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
80
+ var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
81
+ var _fcrCore = require("fcr-core");
82
+ var _logger = require("agora-foundation/lib/logger");
83
+ var _mobx = require("mobx");
84
+ var _type = require("fcr-core/lib/type");
85
+ var _helper = require("agora-ui-foundation/lib/components/avatar/helper");
86
+ var _decorator = require("agora-foundation/lib/decorator");
87
+ var _reactVirtualized = require("react-virtualized");
88
+ var _constant = require("../../utilities/constant");
89
+ var _i18n = require("agora-ui-foundation/lib/i18n");
90
+ var _type2 = require("fcr-core/lib/room-control/chatroom-control/type");
91
+ var _observable = require("agora-foundation/lib/utilities/observable");
92
+ var _store = require("../layout/store");
93
+ var _ChatStore, _ChatRoomStore;
94
+ var _initProto, _init_chatRoomStores, _init_activeTabIndex, _handleReceiveMessageDecs, _handlerActiveTabDecs, _handleEventDecs, _ref, _initProto2, _init__userInfo, _init_messageList, _init_readMsgIndex, _init_readIdx, _init_viewIdx, _init_historyUnreadCount, _init_hasHistoryMsg, _init_newMsgsUnReadCnt, _init_privateTargetUser, _init_chatLevel, _init_currentUserMap, _init_textMsgInfo, _init_privateTargetList, _init_chatRoomState, _init_hasNewMsg, _init_userCount, _setPrivateTargetListDecs, _setLastScrollTopDecs, _setMessageListDecs, _sendMessageDecs, _setHasNewMsgDecs, _handleTextMessageReceivedDecs, _getUserCountDecs, _onRemoteUserUpdateDecs, _setCurrentUserMapDecs, _resetCurrentUserMapDecs, _refreshUserListDecs, _handleNewMsgDecs, _updateReadMsgIndexDecs, _initReadInfoDecs, _updateHistoryUnreadCntDecs, _updateHasHistoryMsgDecs, _updateScrollInfoDecs, _updateViewIdxDecs, _updateReadIdxDecs, _updateFirstMsgIdDecs, _updateHistoryUnReadCountDecs, _updateListDecs, _updateMostRecentHeightDecs, _updateMostRecentWidthDecs, _patchHandleMsgDecs, _forceNotifyMsgsDecs, _resetComponentCacheDecs, _resetTargetUserDecs, _initChatLevelDecs, _setTargetUserDecs, _updateChatLevelDecs, _updateChatTextMsgDecs, _filterChatMemberDecs, _hasSendMessagePermissionDecs, _permitPrivateChatDecs, _handleToastDecs, _handleConnectionUpdatedDecs, _ref3;
95
+ function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
96
+ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { (0, _defineProperty2["default"])(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
97
+ function _classPrivateFieldInitSpec(e, t, a) { _checkPrivateRedeclaration(e, t), t.set(e, a); }
98
+ function _checkPrivateRedeclaration(e, t) { if (t.has(e)) throw new TypeError("Cannot initialize the same private elements twice on an object"); }
99
+ function _classPrivateFieldSet(s, a, r) { return s.set(_assertClassBrand(s, a), r), r; }
100
+ function _classPrivateFieldGet(s, a) { return s.get(_assertClassBrand(s, a)); }
101
+ function _assertClassBrand(e, t, n) { if ("function" == typeof e ? e === t : e.has(t)) return arguments.length < 3 ? t : n; throw new TypeError("Private element is not present on this object"); }
102
+ function _applyDecs(e, t, r, n, o, a) { function i(e, t, r) { return function (n, o) { return r && r(n), e[t].call(n, o); }; } function c(e, t) { for (var r = 0; r < e.length; r++) e[r].call(t); return t; } function s(e, t, r, n) { if ("function" != typeof e && (n || void 0 !== e)) throw new TypeError(t + " must " + (r || "be") + " a function" + (n ? "" : " or undefined")); return e; } function applyDec(e, t, r, n, o, a, c, u, l, f, p, d, h) { function m(e) { if (!h(e)) throw new TypeError("Attempted to access private element on non-instance"); } var y, v = t[0], g = t[3], b = !u; if (!b) { r || Array.isArray(v) || (v = [v]); var w = {}, S = [], A = 3 === o ? "get" : 4 === o || d ? "set" : "value"; f ? (p || d ? w = { get: _setFunctionName(function () { return g(this); }, n, "get"), set: function set(e) { t[4](this, e); } } : w[A] = g, p || _setFunctionName(w[A], n, 2 === o ? "" : A)) : p || (w = Object.getOwnPropertyDescriptor(e, n)); } for (var P = e, j = v.length - 1; j >= 0; j -= r ? 2 : 1) { var D = v[j], E = r ? v[j - 1] : void 0, I = {}, O = { kind: ["field", "accessor", "method", "getter", "setter", "class"][o], name: n, metadata: a, addInitializer: function (e, t) { if (e.v) throw Error("attempted to call addInitializer after decoration was finished"); s(t, "An initializer", "be", !0), c.push(t); }.bind(null, I) }; try { if (b) (y = s(D.call(E, P, O), "class decorators", "return")) && (P = y);else { var k, F; O["static"] = l, O["private"] = f, f ? 2 === o ? k = function k(e) { return m(e), w.value; } : (o < 4 && (k = i(w, "get", m)), 3 !== o && (F = i(w, "set", m))) : (k = function k(e) { return e[n]; }, (o < 2 || 4 === o) && (F = function F(e, t) { e[n] = t; })); var N = O.access = { has: f ? h.bind() : function (e) { return n in e; } }; if (k && (N.get = k), F && (N.set = F), P = D.call(E, d ? { get: w.get, set: w.set } : w[A], O), d) { if ("object" == _typeof(P) && P) (y = s(P.get, "accessor.get")) && (w.get = y), (y = s(P.set, "accessor.set")) && (w.set = y), (y = s(P.init, "accessor.init")) && S.push(y);else if (void 0 !== P) throw new TypeError("accessor decorators must return an object with get, set, or init properties or void 0"); } else s(P, (p ? "field" : "method") + " decorators", "return") && (p ? S.push(P) : w[A] = P); } } finally { I.v = !0; } } return (p || d) && u.push(function (e, t) { for (var r = S.length - 1; r >= 0; r--) t = S[r].call(e, t); return t; }), p || b || (f ? d ? u.push(i(w, "get"), i(w, "set")) : u.push(2 === o ? w[A] : i.call.bind(w[A])) : Object.defineProperty(e, n, w)), P; } function u(e, t) { return Object.defineProperty(e, Symbol.metadata || Symbol["for"]("Symbol.metadata"), { configurable: !0, enumerable: !0, value: t }); } if (arguments.length >= 6) var l = a[Symbol.metadata || Symbol["for"]("Symbol.metadata")]; var f = Object.create(null == l ? null : l), p = function (e, t, r, n) { var o, a, i = [], s = function s(t) { return _checkInRHS(t) === e; }, u = new Map(); function l(e) { e && i.push(c.bind(null, e)); } for (var f = 0; f < t.length; f++) { var p = t[f]; if (Array.isArray(p)) { var d = p[1], h = p[2], m = p.length > 3, y = 16 & d, v = !!(8 & d), g = 0 == (d &= 7), b = h + "/" + v; if (!g && !m) { var w = u.get(b); if (!0 === w || 3 === w && 4 !== d || 4 === w && 3 !== d) throw Error("Attempted to decorate a public method/accessor that has the same name as a previously decorated public method/accessor. This is not currently supported by the decorators plugin. Property name was: " + h); u.set(b, !(d > 2) || d); } applyDec(v ? e : e.prototype, p, y, m ? "#" + h : _toPropertyKey(h), d, n, v ? a = a || [] : o = o || [], i, v, m, g, 1 === d, v && m ? s : r); } } return l(o), l(a), i; }(e, t, o, f); return r.length || u(e, f), { e: p, get c() { var t = []; return r.length && [u(applyDec(e, [r], n, e.name, 5, f, t), f), c.bind(null, t, e)]; } }; }
103
+ function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; }
104
+ function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
105
+ function _setFunctionName(e, t, n) { "symbol" == _typeof(t) && (t = (t = t.description) ? "[" + t + "]" : ""); try { Object.defineProperty(e, "name", { configurable: !0, value: n ? n + " " + t : t }); } catch (e) {} return e; }
106
+ function _checkInRHS(e) { if (Object(e) !== e) throw TypeError("right-hand side of 'in' should be an object, got " + (null !== e ? _typeof(e) : "null")); return e; }
107
+ var intervalId;
108
+ var USER_ALL = exports.USER_ALL = 'All';
109
+ var USER_NONE = exports.USER_NONE = 'NONE';
110
+ var allToUser = exports.allToUser = {
111
+ userId: USER_ALL,
112
+ userName: USER_ALL,
113
+ userRole: _type.FcrUserRole.ROBOT,
114
+ connectorType: _fcrCore.FcrRoomConnectorType.NONE
115
+ };
116
+
117
+ // 没有可选的 User
118
+ var noUser = exports.noUser = {
119
+ userId: USER_NONE,
120
+ userName: (0, _i18n.transI18n)('fmt_chat_tips_selecthost'),
121
+ userRole: _type.FcrUserRole.ROBOT,
122
+ connectorType: _fcrCore.FcrRoomConnectorType.NONE
123
+ };
124
+ var _A = /*#__PURE__*/new WeakMap();
125
+ var _B = /*#__PURE__*/new WeakMap();
126
+ _ref = (_handleReceiveMessageDecs = [_mobx.action, _mobx.action.bound], _handlerActiveTabDecs = [_mobx.action, _mobx.action.bound], _handleEventDecs = [_mobx.action, _mobx.action.bound], "_observable");
127
+ var ChatStore = exports["default"] = /*#__PURE__*/function () {
128
+ function ChatStore(_ref2) {
129
+ var chatRoomControl = _ref2.chatRoomControl,
130
+ userControl = _ref2.userControl,
131
+ uiEventStore = _ref2.uiEventStore,
132
+ securityStore = _ref2.securityStore;
133
+ (0, _classCallCheck2["default"])(this, ChatStore);
134
+ (0, _defineProperty2["default"])(this, _ref, (_initProto(this), new _observable.AgoraObservable()));
135
+ (0, _defineProperty2["default"])(this, "_chatVisible", false);
136
+ (0, _defineProperty2["default"])(this, "_eventObserver", {
137
+ onEvent: this._handleEvent
138
+ });
139
+ (0, _defineProperty2["default"])(this, "_chatStoreObserver", {
140
+ onReceiveMessage: this._handleReceiveMessage.bind(this)
141
+ });
142
+ _classPrivateFieldInitSpec(this, _A, _init_chatRoomStores(this, {}));
143
+ _classPrivateFieldInitSpec(this, _B, _init_activeTabIndex(this, _constant.RoomType.MAIN_ROOM));
144
+ this._securityStore = securityStore;
145
+ this._uiEventStore = uiEventStore;
146
+ uiEventStore.addObserver(this._eventObserver);
147
+ this._observable.addObserver(this._chatStoreObserver);
148
+ this.chatRoomStores[_constant.RoomType.MAIN_ROOM] = new ChatRoomStore({
149
+ chatRoomControl: chatRoomControl,
150
+ userControl: userControl,
151
+ uiEventStore: uiEventStore,
152
+ securityStore: securityStore,
153
+ type: _constant.RoomType.MAIN_ROOM,
154
+ chatStoreObservable: this._observable
155
+ });
156
+ }
157
+ return (0, _createClass2["default"])(ChatStore, [{
158
+ key: "chatRoomStores",
159
+ get: function get() {
160
+ return _classPrivateFieldGet(_A, this);
161
+ },
162
+ set: function set(v) {
163
+ _classPrivateFieldSet(_A, this, v);
164
+ }
165
+ }, {
166
+ key: "activeTabIndex",
167
+ get: function get() {
168
+ return _classPrivateFieldGet(_B, this);
169
+ },
170
+ set: function set(v) {
171
+ _classPrivateFieldSet(_B, this, v);
172
+ }
173
+ }, {
174
+ key: "hasWaitingRoomPermission",
175
+ value: function hasWaitingRoomPermission() {
176
+ return this._securityStore.isWaitingRoomEnabled() && this._securityStore.hasWaitingRoomPermission();
177
+ }
178
+ }, {
179
+ key: "_handleReceiveMessage",
180
+ value: function _handleReceiveMessage(noitfyMsgs, type) {
181
+ var latestMessage = noitfyMsgs[noitfyMsgs.length - 1];
182
+ if ((this.activeTabIndex !== type || !this._chatVisible) && latestMessage) {
183
+ this._uiEventStore.receiveNewChatMessages({
184
+ latestMessage: latestMessage,
185
+ count: noitfyMsgs.length,
186
+ type: type
187
+ });
188
+ }
189
+ }
190
+ }, {
191
+ key: "handlerActiveTab",
192
+ value: function handlerActiveTab(key) {
193
+ this.activeTabIndex = key;
194
+ if (key === _constant.RoomType.WAITING_ROOM) {
195
+ var _this$chatRoomStores$;
196
+ (_this$chatRoomStores$ = this.chatRoomStores[_constant.RoomType.WAITING_ROOM]) === null || _this$chatRoomStores$ === void 0 || _this$chatRoomStores$.setHasNewMsg(false);
197
+ }
198
+ this._uiEventStore.sendEvent(_constant.UIAction.CHAT_ROOM_TAB_CHANGE, key);
199
+ }
200
+ }, {
201
+ key: "_handleEvent",
202
+ value: function _handleEvent(action, payload) {
203
+ if (action === _constant.UIAction.WAITING_ROOM_CREATED) {
204
+ var room = payload;
205
+ var userControl = room.getUserControl();
206
+ var chatRoomControl = room.getChatRoomControl();
207
+ this.chatRoomStores[_constant.RoomType.WAITING_ROOM] = new ChatRoomStore({
208
+ chatRoomControl: chatRoomControl,
209
+ userControl: userControl,
210
+ uiEventStore: this._uiEventStore,
211
+ securityStore: this._securityStore,
212
+ type: _constant.RoomType.WAITING_ROOM,
213
+ chatStoreObservable: this._observable
214
+ });
215
+ }
216
+ if (action === _constant.UIAction.RECEIVE_NEW_CHAT_MESSAGES_FOR_RED) {
217
+ if (this.activeTabIndex !== payload) {
218
+ var _this$chatRoomStores;
219
+ (_this$chatRoomStores = this.chatRoomStores[payload]) === null || _this$chatRoomStores === void 0 || _this$chatRoomStores.setHasNewMsg(true);
220
+ } else {
221
+ var _this$chatRoomStores2;
222
+ (_this$chatRoomStores2 = this.chatRoomStores[payload]) === null || _this$chatRoomStores2 === void 0 || _this$chatRoomStores2.setHasNewMsg(false);
223
+ }
224
+ }
225
+ if (action === _constant.UIAction.CHAT_ROOM_CLOSED) {
226
+ this.handlerActiveTab(_constant.RoomType.MAIN_ROOM);
227
+ }
228
+ if (action === _constant.UIAction.CHAT_VISIBLE) {
229
+ this._chatVisible = payload;
230
+ if (this._chatVisible) {
231
+ this._uiEventStore.sendEvent(_constant.UIAction.SET_CHAT_SLOT_TYPE, {
232
+ type: _store.SlotsType.Chat
233
+ });
234
+ }
235
+ }
236
+ if (action === _constant.UIAction.WAITING_ROOM_DESTROYED) {
237
+ var _this$chatRoomStores$2;
238
+ (_this$chatRoomStores$2 = this.chatRoomStores[_constant.RoomType.WAITING_ROOM]) === null || _this$chatRoomStores$2 === void 0 || _this$chatRoomStores$2.release();
239
+ delete this.chatRoomStores[_constant.RoomType.WAITING_ROOM];
240
+ this.handlerActiveTab(_constant.RoomType.MAIN_ROOM);
241
+ }
242
+ }
243
+ }]);
244
+ }();
245
+ _ChatStore = ChatStore;
246
+ var _applyDecs$e = (0, _slicedToArray2["default"])(_applyDecs(_ChatStore, [[_mobx.observable, 1, "chatRoomStores"], [_mobx.observable, 1, "activeTabIndex"], [_decorator.bound, 2, "hasWaitingRoomPermission"], [_handleReceiveMessageDecs, 18, "_handleReceiveMessage"], [_handlerActiveTabDecs, 18, "handlerActiveTab"], [_handleEventDecs, 18, "_handleEvent"]], []).e, 3);
247
+ _init_chatRoomStores = _applyDecs$e[0];
248
+ _init_activeTabIndex = _applyDecs$e[1];
249
+ _initProto = _applyDecs$e[2];
250
+ var _A2 = /*#__PURE__*/new WeakMap();
251
+ var _B2 = /*#__PURE__*/new WeakMap();
252
+ var _C = /*#__PURE__*/new WeakMap();
253
+ var _D = /*#__PURE__*/new WeakMap();
254
+ var _E = /*#__PURE__*/new WeakMap();
255
+ var _F = /*#__PURE__*/new WeakMap();
256
+ var _G = /*#__PURE__*/new WeakMap();
257
+ var _H = /*#__PURE__*/new WeakMap();
258
+ var _I = /*#__PURE__*/new WeakMap();
259
+ var _J = /*#__PURE__*/new WeakMap();
260
+ var _K = /*#__PURE__*/new WeakMap();
261
+ var _L = /*#__PURE__*/new WeakMap();
262
+ var _M = /*#__PURE__*/new WeakMap();
263
+ var _N = /*#__PURE__*/new WeakMap();
264
+ var _O = /*#__PURE__*/new WeakMap();
265
+ var _P = /*#__PURE__*/new WeakMap();
266
+ _ref3 = (_setPrivateTargetListDecs = [_mobx.action, _mobx.action.bound], _setLastScrollTopDecs = [_mobx.action, _mobx.action.bound], _setMessageListDecs = [_mobx.action, _mobx.action.bound], _sendMessageDecs = [_mobx.action, _mobx.action.bound], _setHasNewMsgDecs = [_mobx.action, _mobx.action.bound], _handleTextMessageReceivedDecs = [_mobx.action, _mobx.action.bound], _getUserCountDecs = [_mobx.action, _mobx.action.bound], _onRemoteUserUpdateDecs = [_mobx.action, _mobx.action.bound], _setCurrentUserMapDecs = [_mobx.action, _mobx.action.bound], _resetCurrentUserMapDecs = [_mobx.action, _mobx.action.bound], _refreshUserListDecs = [_mobx.action, _mobx.action.bound], _handleNewMsgDecs = [_mobx.action, _mobx.action.bound], _updateReadMsgIndexDecs = [_mobx.action, _mobx.action.bound], _initReadInfoDecs = [_mobx.action, _mobx.action.bound], _updateHistoryUnreadCntDecs = [_mobx.action, _mobx.action.bound], _updateHasHistoryMsgDecs = [_mobx.action, _mobx.action.bound], _updateScrollInfoDecs = [_mobx.action, _mobx.action.bound], _updateViewIdxDecs = [_mobx.action, _mobx.action.bound], _updateReadIdxDecs = [_mobx.action, _mobx.action.bound], _updateFirstMsgIdDecs = [_mobx.action, _mobx.action.bound], _updateHistoryUnReadCountDecs = [_mobx.action, _mobx.action.bound], _updateListDecs = [_mobx.action, _mobx.action.bound], _updateMostRecentHeightDecs = [_mobx.action, _mobx.action.bound], _updateMostRecentWidthDecs = [_mobx.action, _mobx.action.bound], _patchHandleMsgDecs = [_mobx.action, _mobx.action.bound], _forceNotifyMsgsDecs = [_mobx.action, _mobx.action.bound], _resetComponentCacheDecs = [_mobx.action, _mobx.action.bound], _resetTargetUserDecs = [_mobx.action, _mobx.action.bound], _initChatLevelDecs = [_mobx.action, _mobx.action.bound], _setTargetUserDecs = [_mobx.action, _mobx.action.bound], _updateChatLevelDecs = [_mobx.action, _mobx.action.bound], _updateChatTextMsgDecs = [_mobx.action, _mobx.action.bound], _filterChatMemberDecs = [_mobx.action, _mobx.action.bound], _hasSendMessagePermissionDecs = [_mobx.action, _mobx.action.bound], _permitPrivateChatDecs = [_mobx.action, _mobx.action.bound], _handleToastDecs = [_mobx.action, _mobx.action.bound], _handleConnectionUpdatedDecs = [_mobx.action, _mobx.action.bound], "needCbBottomCount");
267
+ var ChatRoomStore = exports.ChatRoomStore = /*#__PURE__*/function () {
268
+ function ChatRoomStore(_ref4) {
269
+ var _this$_chatRoomContro,
270
+ _this = this;
271
+ var chatRoomControl = _ref4.chatRoomControl,
272
+ userControl = _ref4.userControl,
273
+ uiEventStore = _ref4.uiEventStore,
274
+ securityStore = _ref4.securityStore,
275
+ type = _ref4.type,
276
+ chatStoreObservable = _ref4.chatStoreObservable;
277
+ (0, _classCallCheck2["default"])(this, ChatRoomStore);
278
+ (0, _defineProperty2["default"])(this, _ref3, (_initProto2(this), 40));
279
+ (0, _defineProperty2["default"])(this, "mostRecentHeight", 0);
280
+ (0, _defineProperty2["default"])(this, "mostRecentWidth", 0);
281
+ (0, _defineProperty2["default"])(this, "cache", new _reactVirtualized.CellMeasurerCache({}));
282
+ (0, _defineProperty2["default"])(this, "scrollHeight", 0);
283
+ (0, _defineProperty2["default"])(this, "scrollTop", 0);
284
+ (0, _defineProperty2["default"])(this, "clientHeight", 0);
285
+ (0, _defineProperty2["default"])(this, "firstMsgId", '');
286
+ (0, _defineProperty2["default"])(this, "lastReadInfo", {
287
+ index: -1,
288
+ msgId: ''
289
+ });
290
+ (0, _defineProperty2["default"])(this, "lastScrollTop", undefined);
291
+ (0, _defineProperty2["default"])(this, "logger", (0, _logger.getLogger)());
292
+ (0, _defineProperty2["default"])(this, "_maxMsgCount", 500);
293
+ (0, _defineProperty2["default"])(this, "_originalMessages", []);
294
+ (0, _defineProperty2["default"])(this, "_disposers", []);
295
+ _classPrivateFieldInitSpec(this, _A2, _init__userInfo(this));
296
+ _classPrivateFieldInitSpec(this, _B2, _init_messageList(this, []));
297
+ _classPrivateFieldInitSpec(this, _C, _init_readMsgIndex(this, {
298
+ index: -1,
299
+ msgId: ''
300
+ }));
301
+ // 读过的最后一条消息
302
+ _classPrivateFieldInitSpec(this, _D, _init_readIdx(this, 0));
303
+ _classPrivateFieldInitSpec(this, _E, _init_viewIdx(this, 0));
304
+ // 历史未读消息条数
305
+ _classPrivateFieldInitSpec(this, _F, _init_historyUnreadCount(this, 0));
306
+ _classPrivateFieldInitSpec(this, _G, _init_hasHistoryMsg(this, false));
307
+ _classPrivateFieldInitSpec(this, _H, _init_newMsgsUnReadCnt(this, 0));
308
+ _classPrivateFieldInitSpec(this, _I, _init_privateTargetUser(this, allToUser));
309
+ _classPrivateFieldInitSpec(this, _J, _init_chatLevel(this, 'everyone'));
310
+ _classPrivateFieldInitSpec(this, _K, _init_currentUserMap(this, new Map()));
311
+ _classPrivateFieldInitSpec(this, _L, _init_textMsgInfo(this, {
312
+ textMsg: '',
313
+ height: 0
314
+ }));
315
+ _classPrivateFieldInitSpec(this, _M, _init_privateTargetList(this, []));
316
+ _classPrivateFieldInitSpec(this, _N, _init_chatRoomState(this, _type2.FcrChatRoomConnectionState.Disconnected));
317
+ _classPrivateFieldInitSpec(this, _O, _init_hasNewMsg(this, false));
318
+ _classPrivateFieldInitSpec(this, _P, _init_userCount(this, 0));
319
+ (0, _defineProperty2["default"])(this, "_chatRoomObserver", {
320
+ onTextMessageReceived: this.messageReceived.bind(this),
321
+ onConnectionStateUpdated: this._handleConnectionUpdated.bind(this),
322
+ onErrorOccurred: function onErrorOccurred() {}
323
+ });
324
+ (0, _defineProperty2["default"])(this, "_userObserver", {
325
+ onRemoteUsersJoined: this._onRemoteUserUpdate.bind(this),
326
+ onRemoteUsersLeft: this._onRemoteUserUpdate.bind(this),
327
+ onUserPropertiesUpdated: this._onUserPropertiesUpdated.bind(this),
328
+ onUserPropertiesDeleted: function onUserPropertiesDeleted(_roomId, _event) {},
329
+ onUserInfoUpdated: this._onUserInfoUpdated.bind(this)
330
+ });
331
+ this._type = type;
332
+ this._uiEventStore = uiEventStore;
333
+ this._securityStore = securityStore;
334
+ this._chatStoreObservable = chatStoreObservable;
335
+ // TODO: 需要查询房间历史消息, 一期预留
336
+ this.messageList = [];
337
+ this._chatRoomControl = chatRoomControl;
338
+ this._userControl = userControl;
339
+ this.userCount = this.getUserCount();
340
+ this._userInfo = userControl.getLocalUser();
341
+ (_this$_chatRoomContro = this._chatRoomControl) === null || _this$_chatRoomContro === void 0 || _this$_chatRoomContro.addObserver(this._chatRoomObserver);
342
+ this._userControl.addObserver(this._userObserver);
343
+ this._refreshUserList();
344
+ intervalId = setInterval(this.patchHandleMsg, 500);
345
+ this._addReactions();
346
+ this._uiEventStore.addObserver({
347
+ onEvent: function onEvent(action, payload) {
348
+ if (action === _constant.UIAction.CHAT_UPDATE_TARGET) {
349
+ _this.setTargetUser(payload);
350
+ }
351
+ if (action === _constant.UIAction.CHAT_RESET_TARGET) {
352
+ // this.resetTargetUser();
353
+ }
354
+ }
355
+ });
356
+ this._setPrivateTargetList((0, _toConsumableArray2["default"])(this.remoteUsers));
357
+ this.initChatLevel();
358
+ this.resetTargetUser();
359
+ }
360
+ return (0, _createClass2["default"])(ChatRoomStore, [{
361
+ key: "_userInfo",
362
+ get: function get() {
363
+ return _classPrivateFieldGet(_A2, this);
364
+ },
365
+ set: function set(v) {
366
+ _classPrivateFieldSet(_A2, this, v);
367
+ }
368
+ }, {
369
+ key: "messageList",
370
+ get: function get() {
371
+ return _classPrivateFieldGet(_B2, this);
372
+ },
373
+ set: function set(v) {
374
+ _classPrivateFieldSet(_B2, this, v);
375
+ }
376
+ }, {
377
+ key: "readMsgIndex",
378
+ get: function get() {
379
+ return _classPrivateFieldGet(_C, this);
380
+ },
381
+ set: function set(v) {
382
+ _classPrivateFieldSet(_C, this, v);
383
+ }
384
+ }, {
385
+ key: "readIdx",
386
+ get: function get() {
387
+ return _classPrivateFieldGet(_D, this);
388
+ },
389
+ set: function set(v) {
390
+ _classPrivateFieldSet(_D, this, v);
391
+ }
392
+ }, {
393
+ key: "viewIdx",
394
+ get: function get() {
395
+ return _classPrivateFieldGet(_E, this);
396
+ },
397
+ set: function set(v) {
398
+ _classPrivateFieldSet(_E, this, v);
399
+ }
400
+ }, {
401
+ key: "historyUnreadCount",
402
+ get: function get() {
403
+ return _classPrivateFieldGet(_F, this);
404
+ },
405
+ set: function set(v) {
406
+ _classPrivateFieldSet(_F, this, v);
407
+ }
408
+ }, {
409
+ key: "hasHistoryMsg",
410
+ get: function get() {
411
+ return _classPrivateFieldGet(_G, this);
412
+ },
413
+ set: function set(v) {
414
+ _classPrivateFieldSet(_G, this, v);
415
+ }
416
+ }, {
417
+ key: "newMsgsUnReadCnt",
418
+ get: function get() {
419
+ return _classPrivateFieldGet(_H, this);
420
+ },
421
+ set: function set(v) {
422
+ _classPrivateFieldSet(_H, this, v);
423
+ }
424
+ }, {
425
+ key: "privateTargetUser",
426
+ get: function get() {
427
+ return _classPrivateFieldGet(_I, this);
428
+ },
429
+ set: function set(v) {
430
+ _classPrivateFieldSet(_I, this, v);
431
+ }
432
+ }, {
433
+ key: "chatLevel",
434
+ get: function get() {
435
+ return _classPrivateFieldGet(_J, this);
436
+ },
437
+ set: function set(v) {
438
+ _classPrivateFieldSet(_J, this, v);
439
+ }
440
+ }, {
441
+ key: "currentUserMap",
442
+ get: function get() {
443
+ return _classPrivateFieldGet(_K, this);
444
+ },
445
+ set: function set(v) {
446
+ _classPrivateFieldSet(_K, this, v);
447
+ }
448
+ }, {
449
+ key: "textMsgInfo",
450
+ get: function get() {
451
+ return _classPrivateFieldGet(_L, this);
452
+ },
453
+ set: function set(v) {
454
+ _classPrivateFieldSet(_L, this, v);
455
+ }
456
+ }, {
457
+ key: "privateTargetList",
458
+ get: function get() {
459
+ return _classPrivateFieldGet(_M, this);
460
+ },
461
+ set: function set(v) {
462
+ _classPrivateFieldSet(_M, this, v);
463
+ }
464
+ }, {
465
+ key: "chatRoomState",
466
+ get: function get() {
467
+ return _classPrivateFieldGet(_N, this);
468
+ },
469
+ set: function set(v) {
470
+ _classPrivateFieldSet(_N, this, v);
471
+ }
472
+ }, {
473
+ key: "hasNewMsg",
474
+ get: function get() {
475
+ return _classPrivateFieldGet(_O, this);
476
+ },
477
+ set: function set(v) {
478
+ _classPrivateFieldSet(_O, this, v);
479
+ }
480
+ }, {
481
+ key: "userCount",
482
+ get: function get() {
483
+ return _classPrivateFieldGet(_P, this);
484
+ },
485
+ set: function set(v) {
486
+ _classPrivateFieldSet(_P, this, v);
487
+ }
488
+ }, {
489
+ key: "_setPrivateTargetList",
490
+ value: function _setPrivateTargetList(arr) {
491
+ this.privateTargetList = arr;
492
+ }
493
+ }, {
494
+ key: "release",
495
+ value: function release() {
496
+ var _this$_chatRoomContro2, _this$_userControl;
497
+ (_this$_chatRoomContro2 = this._chatRoomControl) === null || _this$_chatRoomContro2 === void 0 || _this$_chatRoomContro2.removeObserver(this._chatRoomObserver);
498
+ (_this$_userControl = this._userControl) === null || _this$_userControl === void 0 || _this$_userControl.removeObserver(this._userObserver);
499
+ clearInterval(intervalId);
500
+ }
501
+ }, {
502
+ key: "setLastScrollTop",
503
+ value: function setLastScrollTop(value) {
504
+ this.lastScrollTop = value;
505
+ }
506
+ }, {
507
+ key: "setMessageList",
508
+ value: function setMessageList(messages) {
509
+ this.messageList = (0, _toConsumableArray2["default"])(messages).sort(function (a, b) {
510
+ return typeof a.time === 'number' && typeof b.time === 'number' ? a.time - b.time : 0;
511
+ });
512
+ }
513
+ }, {
514
+ key: "sendMessage",
515
+ value: function () {
516
+ var _sendMessage = (0, _asyncToGenerator2["default"])(/*#__PURE__*/_regenerator["default"].mark(function _callee(msg, type) {
517
+ var _this$_chatRoomContro3;
518
+ var target, isPrivate, message, resp;
519
+ return _regenerator["default"].wrap(function _callee$(_context) {
520
+ while (1) switch (_context.prev = _context.next) {
521
+ case 0:
522
+ if (!(type === _type2.FcrChatRoomMessageType.Image)) {
523
+ _context.next = 3;
524
+ break;
525
+ }
526
+ console.warn({
527
+ msg: msg
528
+ }, '图片消息发送未实现');
529
+ return _context.abrupt("return");
530
+ case 3:
531
+ target = this.privateTargetUser;
532
+ isPrivate = target.userId !== USER_ALL;
533
+ message = _objectSpread(_objectSpread({}, type === _type2.FcrChatRoomMessageType.Text ? {
534
+ content: msg
535
+ } : {
536
+ file: msg
537
+ }), {}, {
538
+ type: type,
539
+ properties: {}
540
+ }, isPrivate ? {
541
+ to: [target.userId]
542
+ } : {});
543
+ _context.next = 8;
544
+ return (_this$_chatRoomContro3 = this._chatRoomControl) === null || _this$_chatRoomContro3 === void 0 ? void 0 : _this$_chatRoomContro3.sendMessage(message);
545
+ case 8:
546
+ resp = _context.sent;
547
+ console.log({
548
+ resp: resp,
549
+ type: type
550
+ }, 'message sent');
551
+ this._handleTextMessageReceived(resp, isPrivate ? target.userName : undefined);
552
+ this.updateReadMsgIndex({
553
+ index: this.messageList.length - 1,
554
+ msgId: resp.id
555
+ });
556
+ case 12:
557
+ case "end":
558
+ return _context.stop();
559
+ }
560
+ }, _callee, this);
561
+ }));
562
+ function sendMessage(_x, _x2) {
563
+ return _sendMessage.apply(this, arguments);
564
+ }
565
+ return sendMessage;
566
+ }()
567
+ }, {
568
+ key: "messageReceived",
569
+ value: function messageReceived(_roomId, msg) {
570
+ this._originalMessages.push(msg);
571
+ this._uiEventStore.sendEvent(_constant.UIAction.RECEIVE_NEW_CHAT_MESSAGES_FOR_RED, this._type);
572
+ }
573
+ }, {
574
+ key: "setHasNewMsg",
575
+ value: function setHasNewMsg(value) {
576
+ this.hasNewMsg = value;
577
+ }
578
+ }, {
579
+ key: "_handleTextMessageReceived",
580
+ value: function _handleTextMessageReceived(message, target) {
581
+ var id = message.id,
582
+ _message$from = message.from,
583
+ userId = _message$from.userId,
584
+ userName = _message$from.userName,
585
+ userRole = _message$from.userRole,
586
+ type = message.type,
587
+ timestamp = message.timestamp,
588
+ isPrivate = message.isPrivate;
589
+ console.log({
590
+ message: message,
591
+ target: target
592
+ }, 'message received');
593
+ if (type !== _type2.FcrChatRoomMessageType.Text) {
594
+ return;
595
+ }
596
+ var color = (0, _helper.getNameColor)(userName);
597
+ var msgPublisherRole = 'participant';
598
+ switch (userRole) {
599
+ case _type.FcrUserRole.HOST:
600
+ msgPublisherRole = 'host';
601
+ break;
602
+ case _type.FcrUserRole.COHOST:
603
+ msgPublisherRole = 'union-host';
604
+ break;
605
+ case _type.FcrUserRole.PARTICIPANT:
606
+ msgPublisherRole = 'participant';
607
+ break;
608
+ }
609
+ this.handleNewMsg(_objectSpread({
610
+ id: id,
611
+ role: msgPublisherRole,
612
+ time: timestamp,
613
+ color: color,
614
+ nickName: userName,
615
+ uid: userId,
616
+ isPrivate: isPrivate,
617
+ target: target || (isPrivate ? 'Me' : 'All')
618
+ }, type === _type2.FcrChatRoomMessageType.Text ? {
619
+ msg: message.content
620
+ } : {
621
+ img: message.file
622
+ }));
623
+ }
624
+ }, {
625
+ key: "getUserCount",
626
+ value: function getUserCount() {
627
+ return this._userControl.getUserList().filter(function (user) {
628
+ return user.userRole === _type.FcrUserRole.PARTICIPANT;
629
+ }).length;
630
+ }
631
+ }, {
632
+ key: "_onRemoteUserUpdate",
633
+ value: function _onRemoteUserUpdate(_roomId, events) {
634
+ console.log({
635
+ events: events
636
+ }, 'remoteUser update');
637
+ if (this._type === _constant.RoomType.WAITING_ROOM) {
638
+ this.userCount = this.getUserCount();
639
+ if (this.userCount === 0) {
640
+ this._uiEventStore.sendEvent(_constant.UIAction.CHAT_ROOM_CLOSED, this._type);
641
+ }
642
+ }
643
+ this._refreshUserList();
644
+ }
645
+ }, {
646
+ key: "_onUserPropertiesUpdated",
647
+ value: function _onUserPropertiesUpdated(_roomId, event) {
648
+ console.log('FcrParticipant _onUserPropertiesUpdated', event);
649
+ this._refreshUserList();
650
+ }
651
+ }, {
652
+ key: "_onUserInfoUpdated",
653
+ value: function _onUserInfoUpdated(_roomId, event) {
654
+ console.log(event, 'FcrParticipant _onUserInfoUpdated');
655
+ var targetUser = event.modifiedUser;
656
+ this._setCurrentUserMap(targetUser.userId, targetUser);
657
+ this._refreshUserList();
658
+ }
659
+ }, {
660
+ key: "_setCurrentUserMap",
661
+ value: function _setCurrentUserMap(userId, userInfo) {
662
+ this.currentUserMap.set(userId, userInfo);
663
+ }
664
+ }, {
665
+ key: "_resetCurrentUserMap",
666
+ value: function _resetCurrentUserMap() {
667
+ this.currentUserMap = new Map();
668
+ }
669
+ }, {
670
+ key: "_refreshUserList",
671
+ value: function _refreshUserList() {
672
+ this._userInfo = this._userControl.getLocalUser();
673
+ var users = this._userControl.getUsers();
674
+ this._resetCurrentUserMap();
675
+ for (var _i = 0, _Object$entries = Object.entries(users); _i < _Object$entries.length; _i++) {
676
+ var _Object$entries$_i = (0, _slicedToArray2["default"])(_Object$entries[_i], 2),
677
+ userId = _Object$entries$_i[0],
678
+ user = _Object$entries$_i[1];
679
+ this._setCurrentUserMap(userId, user);
680
+ }
681
+ }
682
+ }, {
683
+ key: "handleNewMsg",
684
+ value: function handleNewMsg(msg) {
685
+ if (this.messageList.length >= this._maxMsgCount) {
686
+ this.messageList.shift();
687
+ }
688
+ this.messageList.push(msg);
689
+ this.setMessageList(this.messageList);
690
+ }
691
+ }, {
692
+ key: "updateReadMsgIndex",
693
+ value: function updateReadMsgIndex(info) {
694
+ var lastMsg = this.messageList[this.messageList.length - 1];
695
+ if (!info && lastMsg) {
696
+ this.readMsgIndex = {
697
+ index: this.messageList.length - 1,
698
+ msgId: lastMsg.id
699
+ };
700
+ this.resetComponentCache();
701
+ return;
702
+ }
703
+ if (info) {
704
+ var index = info.index,
705
+ msgId = info.msgId;
706
+ this.readMsgIndex = {
707
+ index: index,
708
+ msgId: msgId
709
+ };
710
+ }
711
+ }
712
+ }, {
713
+ key: "allowChat",
714
+ get: function get() {
715
+ return this._securityStore.allowChat();
716
+ }
717
+ }, {
718
+ key: "allowedAllChat",
719
+ get: function get() {
720
+ return this._securityStore.allowedAllChat();
721
+ }
722
+ }, {
723
+ key: "allowedPublicChatAndDisallowedPrivateChat",
724
+ get: function get() {
725
+ return this._securityStore.allowedPublicChatAndDisallowedPrivateChat();
726
+ }
727
+ }, {
728
+ key: "disallowedPublicChatAndDisallowedPrivateChatToParticipant",
729
+ get: function get() {
730
+ return this._securityStore.disallowedPublicChatAndDisallowedPrivateChatToParticipant();
731
+ }
732
+ }, {
733
+ key: "disallowedAllChat",
734
+ get: function get() {
735
+ return this._securityStore.disallowedAllChat();
736
+ }
737
+ }, {
738
+ key: "hasChatPermission",
739
+ get: function get() {
740
+ return this._securityStore.hasChatSendPublicPermission();
741
+ }
742
+ }, {
743
+ key: "hasChatSendPrivatePermission",
744
+ get: function get() {
745
+ return this._securityStore.hasPermissionToSendPrivateMessage(_type.FcrUserRole.HOST) || this._securityStore.hasPermissionToSendPrivateMessage(_type.FcrUserRole.COHOST);
746
+ }
747
+ }, {
748
+ key: "isHost",
749
+ get: function get() {
750
+ return this._userInfo.userRole === _type.FcrUserRole.HOST;
751
+ }
752
+ }, {
753
+ key: "isCohost",
754
+ get: function get() {
755
+ return this._userInfo.userRole === _type.FcrUserRole.COHOST;
756
+ }
757
+ }, {
758
+ key: "localIsManager",
759
+ get: function get() {
760
+ return this._userInfo.userRole === _type.FcrUserRole.HOST || this._userInfo.userRole === _type.FcrUserRole.COHOST;
761
+ }
762
+
763
+ // 本地添加系统消息
764
+ }, {
765
+ key: "_addReactions",
766
+ value: function _addReactions() {
767
+ var _this2 = this;
768
+ this._disposers.push((0, _mobx.reaction)(function () {
769
+ return _this2.chatLevel;
770
+ }, function (state) {
771
+ if (!_this2.localIsManager && _this2.privateTargetUser.userId === USER_ALL && (state === 'no_one' || state === 'private_to_manager')) {
772
+ _this2.setTargetUser(noUser);
773
+ }
774
+ if (!_this2.localIsManager && _this2.privateTargetUser.userId === USER_NONE && (state === 'everyone' || state === 'public')) {
775
+ _this2.setTargetUser(allToUser);
776
+ }
777
+ }), (0, _mobx.reaction)(function () {
778
+ return _this2.disallowedAllChat;
779
+ }, function (state) {
780
+ if (state) {
781
+ _this2.handleChatPermissionUpdate('no_one');
782
+ _this2.updateChatLevel('no_one');
783
+ }
784
+ }), (0, _mobx.reaction)(function () {
785
+ return _this2.disallowedPublicChatAndDisallowedPrivateChatToParticipant;
786
+ }, function (state) {
787
+ if (state) {
788
+ _this2.handleChatPermissionUpdate('private_to_manager');
789
+ _this2.updateChatLevel('private_to_manager');
790
+ }
791
+ }), (0, _mobx.reaction)(function () {
792
+ return _this2.allowedPublicChatAndDisallowedPrivateChat;
793
+ }, function (state) {
794
+ if (state) {
795
+ _this2.handleChatPermissionUpdate('public');
796
+ _this2.updateChatLevel('public');
797
+ }
798
+ }), (0, _mobx.reaction)(function () {
799
+ return _this2.allowedAllChat;
800
+ }, function (state) {
801
+ if (state) {
802
+ _this2.handleChatPermissionUpdate('everyone');
803
+ _this2.updateChatLevel('everyone');
804
+ }
805
+ }));
806
+ }
807
+ }, {
808
+ key: "initReadInfo",
809
+ value: function initReadInfo() {
810
+ this.resetComponentCache();
811
+ this.lastReadInfo = _objectSpread({}, this.readMsgIndex);
812
+ if (this.lastReadInfo.index < this.messageList.length - 1) {
813
+ this.hasHistoryMsg = true;
814
+ }
815
+ }
816
+ }, {
817
+ key: "updateHistoryUnreadCnt",
818
+ value: function updateHistoryUnreadCnt(historyUnreadCount) {
819
+ this.historyUnreadCount = historyUnreadCount;
820
+ }
821
+ }, {
822
+ key: "updateHasHistoryMsg",
823
+ value: function updateHasHistoryMsg(hasHistoryMsg) {
824
+ this.hasHistoryMsg = hasHistoryMsg;
825
+ }
826
+ }, {
827
+ key: "updateScrollInfo",
828
+ value: function updateScrollInfo(listScrollHeight, listScrollTop, listClientHeight) {
829
+ this.scrollHeight = listScrollHeight;
830
+ this.scrollTop = listScrollTop;
831
+ this.clientHeight = listClientHeight;
832
+ }
833
+ }, {
834
+ key: "updateViewIdx",
835
+ value: function updateViewIdx(viewIdx) {
836
+ this.viewIdx = viewIdx;
837
+ }
838
+ }, {
839
+ key: "updateReadIdx",
840
+ value: function updateReadIdx(readIdx) {
841
+ this.readIdx = readIdx;
842
+ }
843
+ }, {
844
+ key: "updateFirstMsgId",
845
+ value: function updateFirstMsgId(firstMsgId) {
846
+ this.firstMsgId = firstMsgId;
847
+ }
848
+ }, {
849
+ key: "updateHistoryUnReadCount",
850
+ value: function updateHistoryUnReadCount(historyUnReadCount) {
851
+ this.historyUnreadCount = historyUnReadCount;
852
+ }
853
+ }, {
854
+ key: "updateList",
855
+ value: function updateList(list) {
856
+ this.list = list;
857
+ }
858
+ }, {
859
+ key: "updateMostRecentHeight",
860
+ value: function updateMostRecentHeight(mostRecentHeight) {
861
+ this.mostRecentHeight = mostRecentHeight;
862
+ }
863
+ }, {
864
+ key: "updateMostRecentWidth",
865
+ value: function updateMostRecentWidth(mostRecentWidth) {
866
+ this.mostRecentWidth = mostRecentWidth;
867
+ }
868
+ }, {
869
+ key: "patchHandleMsg",
870
+ value: function patchHandleMsg() {
871
+ var _this3 = this;
872
+ var isBottom = this.clientHeight === 0 || this.clientHeight >= this.scrollHeight || Math.abs(this.scrollHeight - this.clientHeight - this.scrollTop) < 1;
873
+ if (!isBottom) {
874
+ this.newMsgsUnReadCnt = this._originalMessages.length;
875
+ return;
876
+ }
877
+ var notifyMsgs = this._originalMessages.splice(0, this.newMsgsUnReadCnt || 10);
878
+ // 通知列表中前10条消息
879
+ notifyMsgs.forEach(function (msg) {
880
+ _this3._handleTextMessageReceived(msg);
881
+ });
882
+ notifyMsgs.length > 0 && this._chatStoreObservable.notifyObservers('onReceiveMessage', notifyMsgs, this._type);
883
+
884
+ // TODO: 消息批量更新, 优化
885
+ }
886
+ }, {
887
+ key: "forceNotifyMsgs",
888
+ value: function forceNotifyMsgs() {
889
+ this.patchHandleMsg();
890
+ }
891
+ }, {
892
+ key: "resetComponentCache",
893
+ value: function resetComponentCache() {
894
+ this.newMsgsUnReadCnt = 0;
895
+ this.clientHeight = 0;
896
+ this.scrollTop = 0;
897
+ this.scrollHeight = 0;
898
+ this.mostRecentHeight = 0;
899
+ this.cache.clearAll();
900
+ this.list = undefined;
901
+ this.readIdx = 0;
902
+ this.viewIdx = 0;
903
+ this.firstMsgId = '';
904
+ this.historyUnreadCount = 0;
905
+ this.hasHistoryMsg = false;
906
+ this.lastReadInfo = {
907
+ index: -1,
908
+ msgId: ''
909
+ };
910
+ }
911
+ }, {
912
+ key: "resetTargetUser",
913
+ value: function resetTargetUser() {
914
+ if (this.chatLevel === 'public' || this.chatLevel === 'everyone') {
915
+ this.privateTargetUser = allToUser;
916
+ } else if (this.chatLevel === 'private_to_manager' && !this.localIsManager) {
917
+ this.privateTargetUser = noUser;
918
+ }
919
+ }
920
+ }, {
921
+ key: "initChatLevel",
922
+ value: function initChatLevel() {
923
+ if (this.allowedAllChat) {
924
+ this.updateChatLevel('everyone');
925
+ } else if (this.allowedPublicChatAndDisallowedPrivateChat) {
926
+ this.updateChatLevel('public');
927
+ } else if (this.disallowedPublicChatAndDisallowedPrivateChatToParticipant) {
928
+ this.updateChatLevel('private_to_manager');
929
+ } else if (this.disallowedAllChat) {
930
+ this.updateChatLevel('no_one');
931
+ }
932
+ }
933
+ }, {
934
+ key: "setTargetUser",
935
+ value: function setTargetUser(user) {
936
+ this.privateTargetUser = user;
937
+ }
938
+ }, {
939
+ key: "targetUserIsOnline",
940
+ get: function get() {
941
+ var _this4 = this;
942
+ if (this.privateTargetUser.userId === USER_ALL || this.privateTargetUser.userId === USER_NONE) {
943
+ return true;
944
+ }
945
+ return this.remoteUsers.some(function (remoteUser) {
946
+ return remoteUser.userId === _this4.privateTargetUser.userId;
947
+ });
948
+ }
949
+ }, {
950
+ key: "remoteUsers",
951
+ get: function get() {
952
+ var _this5 = this;
953
+ var list = Array.from(this.currentUserMap.values());
954
+ return list.filter(function (user) {
955
+ return user.userId !== _this5._userInfo.userId;
956
+ });
957
+ }
958
+ }, {
959
+ key: "handleChatPermissionUpdate",
960
+ value: function handleChatPermissionUpdate(chatLevel) {
961
+ var _this$privilegeOperat;
962
+ var _ref5 = (_this$privilegeOperat = this.privilegeOperator) !== null && _this$privilegeOperat !== void 0 ? _this$privilegeOperat : {},
963
+ userId = _ref5.userId,
964
+ userName = _ref5.userName,
965
+ userRole = _ref5.userRole;
966
+ var msg = {
967
+ id: String(new Date().getTime()),
968
+ role: userRole === _type.FcrUserRole.PARTICIPANT ? 'participant' : userRole === _type.FcrUserRole.COHOST ? 'union-host' : 'host',
969
+ time: Date.now(),
970
+ msg: '',
971
+ color: '',
972
+ nickName: userName !== null && userName !== void 0 ? userName : '',
973
+ uid: userId !== null && userId !== void 0 ? userId : '',
974
+ systemMsg: true,
975
+ chatLevel: chatLevel,
976
+ isPrivate: false
977
+ };
978
+
979
+ // 处理聊天权限变更时的系统消息
980
+ this.handleNewMsg(msg);
981
+ }
982
+ }, {
983
+ key: "updateChatLevel",
984
+ value: function updateChatLevel(chatLevel) {
985
+ this.chatLevel = chatLevel;
986
+ }
987
+ }, {
988
+ key: "privilegeOperator",
989
+ get: function get() {
990
+ return this._securityStore.privilegeOperator;
991
+ }
992
+ }, {
993
+ key: "updateChatTextMsg",
994
+ value: function updateChatTextMsg(textMsgInfo) {
995
+ this.textMsgInfo = textMsgInfo;
996
+ }
997
+ }, {
998
+ key: "filterChatMember",
999
+ value: function filterChatMember(list) {
1000
+ var _this6 = this;
1001
+ var res = list.filter(function (user) {
1002
+ return _this6._securityStore.hasChatSendPublicPermissionByTargetRole(user.userRole) || _this6._securityStore.hasPermissionToSendPrivateMessage(user.userRole);
1003
+ });
1004
+ return res;
1005
+ }
1006
+ }, {
1007
+ key: "hasSendMessagePermission",
1008
+ value: function hasSendMessagePermission() {
1009
+ return this._securityStore.hasPermissionToSendPrivateMessage(_type.FcrUserRole.HOST) || this._securityStore.hasPermissionToSendPrivateMessage(_type.FcrUserRole.COHOST) || this._securityStore.hasChatSendPublicPermissionByTargetRole(_type.FcrUserRole.PARTICIPANT) || this._securityStore.hasChatSendPublicPermissionByTargetRole(_type.FcrUserRole.HOST) || this._securityStore.hasChatSendPublicPermissionByTargetRole(_type.FcrUserRole.COHOST);
1010
+ }
1011
+ }, {
1012
+ key: "permitPrivateChat",
1013
+ value: function permitPrivateChat(userId) {
1014
+ var targetUser = this.remoteUsers.find(function (user) {
1015
+ return user.userId === userId;
1016
+ });
1017
+ if (!targetUser) {
1018
+ return;
1019
+ }
1020
+ if (!this._securityStore.permitPrivateChat(userId)) {
1021
+ return;
1022
+ }
1023
+ this.setTargetUser(targetUser);
1024
+ }
1025
+ }, {
1026
+ key: "handleToast",
1027
+ value: function handleToast(params) {
1028
+ this._uiEventStore.showChatToast(_objectSpread(_objectSpread({
1029
+ id: params.id
1030
+ }, params.toastProps), {}, {
1031
+ message: params.toastProps.content
1032
+ }));
1033
+ }
1034
+ }, {
1035
+ key: "isHostOrCoHost",
1036
+ get: function get() {
1037
+ return this._userInfo.userRole === _type.FcrUserRole.HOST || this._userInfo.userRole === _type.FcrUserRole.COHOST;
1038
+ }
1039
+ }, {
1040
+ key: "setAllowChat",
1041
+ value: function setAllowChat(allowChat) {
1042
+ this._securityStore.setAllowChat(allowChat);
1043
+ }
1044
+ }, {
1045
+ key: "setAllowChatWithPayload",
1046
+ value: function setAllowChatWithPayload(type) {
1047
+ switch (type) {
1048
+ case 'public':
1049
+ this._securityStore.setAllowedPublicChatAndDisallowedPrivateChat();
1050
+ break;
1051
+ case 'private_to_manager':
1052
+ this._securityStore.setDisallowedPublicChatAndDisallowedPrivateChatToParticipant();
1053
+ break;
1054
+ }
1055
+ }
1056
+ }, {
1057
+ key: "_handleConnectionUpdated",
1058
+ value: function _handleConnectionUpdated(_, state) {
1059
+ this.chatRoomState = state;
1060
+ }
1061
+ }]);
1062
+ }();
1063
+ _ChatRoomStore = ChatRoomStore;
1064
+ var _applyDecs$e2 = (0, _slicedToArray2["default"])(_applyDecs(_ChatRoomStore, [[_mobx.observable, 1, "_userInfo"], [_mobx.observable, 1, "messageList"], [_mobx.observable, 1, "readMsgIndex"], [_mobx.observable, 1, "readIdx"], [_mobx.observable, 1, "viewIdx"], [_mobx.observable, 1, "historyUnreadCount"], [_mobx.observable, 1, "hasHistoryMsg"], [_mobx.observable, 1, "newMsgsUnReadCnt"], [_mobx.observable, 1, "privateTargetUser"], [_mobx.observable, 1, "chatLevel"], [_mobx.observable, 1, "currentUserMap"], [_mobx.observable, 1, "textMsgInfo"], [_mobx.observable, 1, "privateTargetList"], [_mobx.observable, 1, "chatRoomState"], [_mobx.observable, 1, "hasNewMsg"], [_mobx.observable, 1, "userCount"], [_setPrivateTargetListDecs, 18, "_setPrivateTargetList"], [_setLastScrollTopDecs, 18, "setLastScrollTop"], [_setMessageListDecs, 18, "setMessageList"], [_sendMessageDecs, 18, "sendMessage"], [_setHasNewMsgDecs, 18, "setHasNewMsg"], [_handleTextMessageReceivedDecs, 18, "_handleTextMessageReceived"], [_getUserCountDecs, 18, "getUserCount"], [_onRemoteUserUpdateDecs, 18, "_onRemoteUserUpdate"], [_setCurrentUserMapDecs, 18, "_setCurrentUserMap"], [_resetCurrentUserMapDecs, 18, "_resetCurrentUserMap"], [_refreshUserListDecs, 18, "_refreshUserList"], [_handleNewMsgDecs, 18, "handleNewMsg"], [_updateReadMsgIndexDecs, 18, "updateReadMsgIndex"], [_mobx.computed, 3, "isHost"], [_mobx.computed, 3, "isCohost"], [_mobx.computed, 3, "localIsManager"], [_initReadInfoDecs, 18, "initReadInfo"], [_updateHistoryUnreadCntDecs, 18, "updateHistoryUnreadCnt"], [_updateHasHistoryMsgDecs, 18, "updateHasHistoryMsg"], [_updateScrollInfoDecs, 18, "updateScrollInfo"], [_updateViewIdxDecs, 18, "updateViewIdx"], [_updateReadIdxDecs, 18, "updateReadIdx"], [_updateFirstMsgIdDecs, 18, "updateFirstMsgId"], [_updateHistoryUnReadCountDecs, 18, "updateHistoryUnReadCount"], [_updateListDecs, 18, "updateList"], [_updateMostRecentHeightDecs, 18, "updateMostRecentHeight"], [_updateMostRecentWidthDecs, 18, "updateMostRecentWidth"], [_patchHandleMsgDecs, 18, "patchHandleMsg"], [_forceNotifyMsgsDecs, 18, "forceNotifyMsgs"], [_resetComponentCacheDecs, 18, "resetComponentCache"], [_resetTargetUserDecs, 18, "resetTargetUser"], [_initChatLevelDecs, 18, "initChatLevel"], [_setTargetUserDecs, 18, "setTargetUser"], [_mobx.computed, 3, "targetUserIsOnline"], [_mobx.computed, 3, "remoteUsers"], [_decorator.bound, 2, "handleChatPermissionUpdate"], [_updateChatLevelDecs, 18, "updateChatLevel"], [_updateChatTextMsgDecs, 18, "updateChatTextMsg"], [_filterChatMemberDecs, 18, "filterChatMember"], [_hasSendMessagePermissionDecs, 18, "hasSendMessagePermission"], [_permitPrivateChatDecs, 18, "permitPrivateChat"], [_handleToastDecs, 18, "handleToast"], [_mobx.computed, 3, "isHostOrCoHost"], [_decorator.bound, 2, "setAllowChat"], [_decorator.bound, 2, "setAllowChatWithPayload"], [_handleConnectionUpdatedDecs, 18, "_handleConnectionUpdated"]], []).e, 17);
1065
+ _init__userInfo = _applyDecs$e2[0];
1066
+ _init_messageList = _applyDecs$e2[1];
1067
+ _init_readMsgIndex = _applyDecs$e2[2];
1068
+ _init_readIdx = _applyDecs$e2[3];
1069
+ _init_viewIdx = _applyDecs$e2[4];
1070
+ _init_historyUnreadCount = _applyDecs$e2[5];
1071
+ _init_hasHistoryMsg = _applyDecs$e2[6];
1072
+ _init_newMsgsUnReadCnt = _applyDecs$e2[7];
1073
+ _init_privateTargetUser = _applyDecs$e2[8];
1074
+ _init_chatLevel = _applyDecs$e2[9];
1075
+ _init_currentUserMap = _applyDecs$e2[10];
1076
+ _init_textMsgInfo = _applyDecs$e2[11];
1077
+ _init_privateTargetList = _applyDecs$e2[12];
1078
+ _init_chatRoomState = _applyDecs$e2[13];
1079
+ _init_hasNewMsg = _applyDecs$e2[14];
1080
+ _init_userCount = _applyDecs$e2[15];
1081
+ _initProto2 = _applyDecs$e2[16];
1082
+ function isManager(role) {
1083
+ return role === _type.FcrUserRole.HOST || role === _type.FcrUserRole.COHOST;
1084
+ }
1085
+ var rolePriority = (0, _defineProperty2["default"])((0, _defineProperty2["default"])((0, _defineProperty2["default"])({}, _type.FcrUserRole.HOST, 1), _type.FcrUserRole.COHOST, 2), _type.FcrUserRole.PARTICIPANT, 3);
1086
+ function sortUsers(users) {
1087
+ return users.sort(function (a, b) {
1088
+ var userAll = allToUser.userId;
1089
+ if (a.userId === userAll && b.userId !== userAll) {
1090
+ return -1;
1091
+ } else if (a.userId !== userAll && b.userId === userAll) {
1092
+ return 1;
1093
+ }
1094
+ var userRoleA = rolePriority[a.userRole];
1095
+ var userRoleB = rolePriority[b.userRole];
1096
+ if (userRoleA && userRoleB && userRoleA !== userRoleB) {
1097
+ return userRoleA - userRoleB;
1098
+ }
1099
+ return a.userName.localeCompare(b.userName);
1100
+ });
1101
+ }