@webex/plugin-meetings 3.0.0-beta.31 → 3.0.0-beta.310

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 (378) hide show
  1. package/README.md +46 -8
  2. package/dist/annotation/annotation.types.js +7 -0
  3. package/dist/annotation/annotation.types.js.map +1 -0
  4. package/dist/annotation/constants.js +49 -0
  5. package/dist/annotation/constants.js.map +1 -0
  6. package/dist/annotation/index.js +342 -0
  7. package/dist/annotation/index.js.map +1 -0
  8. package/dist/breakouts/breakout.js +94 -15
  9. package/dist/breakouts/breakout.js.map +1 -1
  10. package/dist/breakouts/edit-lock-error.js +52 -0
  11. package/dist/breakouts/edit-lock-error.js.map +1 -0
  12. package/dist/breakouts/events.js +45 -0
  13. package/dist/breakouts/events.js.map +1 -0
  14. package/dist/breakouts/index.js +709 -35
  15. package/dist/breakouts/index.js.map +1 -1
  16. package/dist/breakouts/utils.js +45 -1
  17. package/dist/breakouts/utils.js.map +1 -1
  18. package/dist/common/errors/no-meeting-info.js +51 -0
  19. package/dist/common/errors/no-meeting-info.js.map +1 -0
  20. package/dist/common/errors/reclaim-host-role-errors.js +158 -0
  21. package/dist/common/errors/reclaim-host-role-errors.js.map +1 -0
  22. package/dist/common/errors/webex-errors.js +48 -7
  23. package/dist/common/errors/webex-errors.js.map +1 -1
  24. package/dist/common/logs/logger-proxy.js +1 -1
  25. package/dist/common/logs/logger-proxy.js.map +1 -1
  26. package/dist/common/logs/request.js +5 -1
  27. package/dist/common/logs/request.js.map +1 -1
  28. package/dist/common/queue.js +24 -9
  29. package/dist/common/queue.js.map +1 -1
  30. package/dist/config.js +5 -11
  31. package/dist/config.js.map +1 -1
  32. package/dist/constants.js +233 -29
  33. package/dist/constants.js.map +1 -1
  34. package/dist/controls-options-manager/enums.js +14 -2
  35. package/dist/controls-options-manager/enums.js.map +1 -1
  36. package/dist/controls-options-manager/index.js +109 -15
  37. package/dist/controls-options-manager/index.js.map +1 -1
  38. package/dist/controls-options-manager/types.js +7 -0
  39. package/dist/controls-options-manager/types.js.map +1 -0
  40. package/dist/controls-options-manager/util.js +309 -18
  41. package/dist/controls-options-manager/util.js.map +1 -1
  42. package/dist/index.js +112 -1
  43. package/dist/index.js.map +1 -1
  44. package/dist/interpretation/collection.js +23 -0
  45. package/dist/interpretation/collection.js.map +1 -0
  46. package/dist/interpretation/index.js +366 -0
  47. package/dist/interpretation/index.js.map +1 -0
  48. package/dist/interpretation/siLanguage.js +25 -0
  49. package/dist/interpretation/siLanguage.js.map +1 -0
  50. package/dist/locus-info/controlsUtils.js +91 -2
  51. package/dist/locus-info/controlsUtils.js.map +1 -1
  52. package/dist/locus-info/index.js +383 -62
  53. package/dist/locus-info/index.js.map +1 -1
  54. package/dist/locus-info/infoUtils.js +7 -1
  55. package/dist/locus-info/infoUtils.js.map +1 -1
  56. package/dist/locus-info/mediaSharesUtils.js +57 -1
  57. package/dist/locus-info/mediaSharesUtils.js.map +1 -1
  58. package/dist/locus-info/parser.js +249 -72
  59. package/dist/locus-info/parser.js.map +1 -1
  60. package/dist/locus-info/selfUtils.js +89 -14
  61. package/dist/locus-info/selfUtils.js.map +1 -1
  62. package/dist/media/index.js +61 -116
  63. package/dist/media/index.js.map +1 -1
  64. package/dist/media/properties.js +73 -124
  65. package/dist/media/properties.js.map +1 -1
  66. package/dist/meeting/in-meeting-actions.js +82 -2
  67. package/dist/meeting/in-meeting-actions.js.map +1 -1
  68. package/dist/meeting/index.js +3777 -2929
  69. package/dist/meeting/index.js.map +1 -1
  70. package/dist/meeting/locusMediaRequest.js +292 -0
  71. package/dist/meeting/locusMediaRequest.js.map +1 -0
  72. package/dist/meeting/muteState.js +230 -124
  73. package/dist/meeting/muteState.js.map +1 -1
  74. package/dist/meeting/request.js +260 -196
  75. package/dist/meeting/request.js.map +1 -1
  76. package/dist/meeting/util.js +601 -417
  77. package/dist/meeting/util.js.map +1 -1
  78. package/dist/meeting-info/index.js +73 -7
  79. package/dist/meeting-info/index.js.map +1 -1
  80. package/dist/meeting-info/meeting-info-v2.js +192 -51
  81. package/dist/meeting-info/meeting-info-v2.js.map +1 -1
  82. package/dist/meeting-info/util.js +1 -1
  83. package/dist/meeting-info/util.js.map +1 -1
  84. package/dist/meeting-info/utilv2.js +36 -36
  85. package/dist/meeting-info/utilv2.js.map +1 -1
  86. package/dist/meetings/collection.js +39 -0
  87. package/dist/meetings/collection.js.map +1 -1
  88. package/dist/meetings/index.js +415 -115
  89. package/dist/meetings/index.js.map +1 -1
  90. package/dist/meetings/meetings.types.js +7 -0
  91. package/dist/meetings/meetings.types.js.map +1 -0
  92. package/dist/meetings/request.js +2 -0
  93. package/dist/meetings/request.js.map +1 -1
  94. package/dist/meetings/util.js +72 -6
  95. package/dist/meetings/util.js.map +1 -1
  96. package/dist/member/index.js +58 -0
  97. package/dist/member/index.js.map +1 -1
  98. package/dist/member/types.js +25 -0
  99. package/dist/member/types.js.map +1 -0
  100. package/dist/member/util.js +132 -25
  101. package/dist/member/util.js.map +1 -1
  102. package/dist/members/collection.js +10 -0
  103. package/dist/members/collection.js.map +1 -1
  104. package/dist/members/index.js +102 -6
  105. package/dist/members/index.js.map +1 -1
  106. package/dist/members/request.js +106 -38
  107. package/dist/members/request.js.map +1 -1
  108. package/dist/members/types.js +15 -0
  109. package/dist/members/types.js.map +1 -0
  110. package/dist/members/util.js +326 -232
  111. package/dist/members/util.js.map +1 -1
  112. package/dist/metrics/constants.js +13 -5
  113. package/dist/metrics/constants.js.map +1 -1
  114. package/dist/metrics/index.js +1 -468
  115. package/dist/metrics/index.js.map +1 -1
  116. package/dist/multistream/mediaRequestManager.js +238 -49
  117. package/dist/multistream/mediaRequestManager.js.map +1 -1
  118. package/dist/multistream/receiveSlot.js +29 -16
  119. package/dist/multistream/receiveSlot.js.map +1 -1
  120. package/dist/multistream/receiveSlotManager.js +39 -36
  121. package/dist/multistream/receiveSlotManager.js.map +1 -1
  122. package/dist/multistream/remoteMedia.js +44 -18
  123. package/dist/multistream/remoteMedia.js.map +1 -1
  124. package/dist/multistream/remoteMediaGroup.js +60 -3
  125. package/dist/multistream/remoteMediaGroup.js.map +1 -1
  126. package/dist/multistream/remoteMediaManager.js +209 -59
  127. package/dist/multistream/remoteMediaManager.js.map +1 -1
  128. package/dist/multistream/sendSlotManager.js +233 -0
  129. package/dist/multistream/sendSlotManager.js.map +1 -0
  130. package/dist/reachability/index.js +225 -59
  131. package/dist/reachability/index.js.map +1 -1
  132. package/dist/reachability/request.js +17 -8
  133. package/dist/reachability/request.js.map +1 -1
  134. package/dist/reconnection-manager/index.js +201 -156
  135. package/dist/reconnection-manager/index.js.map +1 -1
  136. package/dist/recording-controller/index.js +21 -2
  137. package/dist/recording-controller/index.js.map +1 -1
  138. package/dist/recording-controller/util.js +9 -8
  139. package/dist/recording-controller/util.js.map +1 -1
  140. package/dist/roap/index.js +62 -32
  141. package/dist/roap/index.js.map +1 -1
  142. package/dist/roap/request.js +112 -97
  143. package/dist/roap/request.js.map +1 -1
  144. package/dist/roap/turnDiscovery.js +95 -36
  145. package/dist/roap/turnDiscovery.js.map +1 -1
  146. package/dist/rtcMetrics/constants.js +12 -0
  147. package/dist/rtcMetrics/constants.js.map +1 -0
  148. package/dist/rtcMetrics/index.js +117 -0
  149. package/dist/rtcMetrics/index.js.map +1 -0
  150. package/dist/statsAnalyzer/index.js +86 -78
  151. package/dist/statsAnalyzer/index.js.map +1 -1
  152. package/dist/statsAnalyzer/mqaUtil.js +11 -10
  153. package/dist/statsAnalyzer/mqaUtil.js.map +1 -1
  154. package/dist/types/annotation/annotation.types.d.ts +42 -0
  155. package/dist/types/annotation/constants.d.ts +31 -0
  156. package/dist/types/annotation/index.d.ts +117 -0
  157. package/dist/types/breakouts/edit-lock-error.d.ts +15 -0
  158. package/dist/types/breakouts/events.d.ts +8 -0
  159. package/dist/types/breakouts/utils.d.ts +14 -0
  160. package/dist/types/common/errors/no-meeting-info.d.ts +14 -0
  161. package/dist/types/common/errors/reclaim-host-role-errors.d.ts +60 -0
  162. package/dist/types/common/errors/webex-errors.d.ts +25 -1
  163. package/dist/types/common/logs/request.d.ts +2 -0
  164. package/dist/types/common/queue.d.ts +9 -7
  165. package/dist/types/config.d.ts +1 -7
  166. package/dist/types/constants.d.ts +194 -24
  167. package/dist/types/controls-options-manager/enums.d.ts +11 -1
  168. package/dist/types/controls-options-manager/index.d.ts +17 -1
  169. package/dist/types/controls-options-manager/types.d.ts +43 -0
  170. package/dist/types/controls-options-manager/util.d.ts +1 -7
  171. package/dist/types/index.d.ts +6 -4
  172. package/dist/types/interpretation/collection.d.ts +5 -0
  173. package/dist/types/interpretation/index.d.ts +5 -0
  174. package/dist/types/interpretation/siLanguage.d.ts +5 -0
  175. package/dist/types/locus-info/index.d.ts +57 -4
  176. package/dist/types/locus-info/parser.d.ts +67 -6
  177. package/dist/types/media/index.d.ts +2 -0
  178. package/dist/types/media/properties.d.ts +34 -48
  179. package/dist/types/meeting/in-meeting-actions.d.ts +82 -2
  180. package/dist/types/meeting/index.d.ts +463 -510
  181. package/dist/types/meeting/locusMediaRequest.d.ts +74 -0
  182. package/dist/types/meeting/muteState.d.ts +99 -23
  183. package/dist/types/meeting/request.d.ts +72 -43
  184. package/dist/types/meeting/util.d.ts +101 -1
  185. package/dist/types/meeting-info/index.d.ts +13 -1
  186. package/dist/types/meeting-info/meeting-info-v2.d.ts +31 -1
  187. package/dist/types/meetings/collection.d.ts +17 -0
  188. package/dist/types/meetings/index.d.ts +98 -20
  189. package/dist/types/meetings/meetings.types.d.ts +4 -0
  190. package/dist/types/member/index.d.ts +14 -0
  191. package/dist/types/member/types.d.ts +32 -0
  192. package/dist/types/members/collection.d.ts +5 -0
  193. package/dist/types/members/index.d.ts +35 -2
  194. package/dist/types/members/request.d.ts +73 -9
  195. package/dist/types/members/types.d.ts +25 -0
  196. package/dist/types/members/util.d.ts +214 -1
  197. package/dist/types/metrics/constants.d.ts +12 -4
  198. package/dist/types/metrics/index.d.ts +4 -119
  199. package/dist/types/multistream/mediaRequestManager.d.ts +73 -5
  200. package/dist/types/multistream/receiveSlot.d.ts +13 -11
  201. package/dist/types/multistream/receiveSlotManager.d.ts +14 -4
  202. package/dist/types/multistream/remoteMedia.d.ts +8 -29
  203. package/dist/types/multistream/remoteMediaGroup.d.ts +0 -9
  204. package/dist/types/multistream/remoteMediaManager.d.ts +46 -2
  205. package/dist/types/multistream/sendSlotManager.d.ts +61 -0
  206. package/dist/types/reachability/index.d.ts +61 -7
  207. package/dist/types/reachability/request.d.ts +7 -3
  208. package/dist/types/reconnection-manager/index.d.ts +9 -0
  209. package/dist/types/recording-controller/index.d.ts +15 -1
  210. package/dist/types/recording-controller/util.d.ts +5 -4
  211. package/dist/types/roap/index.d.ts +2 -1
  212. package/dist/types/roap/request.d.ts +15 -11
  213. package/dist/types/roap/turnDiscovery.d.ts +21 -3
  214. package/dist/types/rtcMetrics/constants.d.ts +4 -0
  215. package/dist/types/rtcMetrics/index.d.ts +47 -0
  216. package/dist/types/statsAnalyzer/index.d.ts +7 -1
  217. package/dist/types/webinar/collection.d.ts +16 -0
  218. package/dist/types/webinar/index.d.ts +5 -0
  219. package/dist/webinar/collection.js +44 -0
  220. package/dist/webinar/collection.js.map +1 -0
  221. package/dist/webinar/index.js +69 -0
  222. package/dist/webinar/index.js.map +1 -0
  223. package/package.json +23 -20
  224. package/src/annotation/annotation.types.ts +50 -0
  225. package/src/annotation/constants.ts +36 -0
  226. package/src/annotation/index.ts +328 -0
  227. package/src/breakouts/README.md +42 -12
  228. package/src/breakouts/breakout.ts +67 -9
  229. package/src/breakouts/edit-lock-error.ts +25 -0
  230. package/src/breakouts/events.ts +56 -0
  231. package/src/breakouts/index.ts +592 -20
  232. package/src/breakouts/utils.ts +42 -0
  233. package/src/common/errors/no-meeting-info.ts +24 -0
  234. package/src/common/errors/reclaim-host-role-errors.ts +134 -0
  235. package/src/common/errors/webex-errors.ts +44 -2
  236. package/src/common/logs/logger-proxy.ts +1 -1
  237. package/src/common/logs/request.ts +5 -1
  238. package/src/common/queue.ts +22 -8
  239. package/src/config.ts +4 -10
  240. package/src/constants.ts +221 -19
  241. package/src/controls-options-manager/enums.ts +12 -0
  242. package/src/controls-options-manager/index.ts +116 -21
  243. package/src/controls-options-manager/types.ts +59 -0
  244. package/src/controls-options-manager/util.ts +294 -14
  245. package/src/index.ts +40 -0
  246. package/src/interpretation/README.md +60 -0
  247. package/src/interpretation/collection.ts +19 -0
  248. package/src/interpretation/index.ts +332 -0
  249. package/src/interpretation/siLanguage.ts +18 -0
  250. package/src/locus-info/controlsUtils.ts +108 -0
  251. package/src/locus-info/index.ts +413 -59
  252. package/src/locus-info/infoUtils.ts +10 -2
  253. package/src/locus-info/mediaSharesUtils.ts +64 -0
  254. package/src/locus-info/parser.ts +258 -47
  255. package/src/locus-info/selfUtils.ts +81 -5
  256. package/src/media/index.ts +102 -122
  257. package/src/media/properties.ts +87 -110
  258. package/src/meeting/in-meeting-actions.ts +163 -3
  259. package/src/meeting/index.ts +3132 -2541
  260. package/src/meeting/locusMediaRequest.ts +313 -0
  261. package/src/meeting/muteState.ts +229 -131
  262. package/src/meeting/request.ts +177 -121
  263. package/src/meeting/util.ts +588 -394
  264. package/src/meeting-info/index.ts +81 -8
  265. package/src/meeting-info/meeting-info-v2.ts +170 -14
  266. package/src/meeting-info/util.ts +1 -1
  267. package/src/meeting-info/utilv2.ts +23 -23
  268. package/src/meetings/collection.ts +33 -0
  269. package/src/meetings/index.ts +445 -123
  270. package/src/meetings/meetings.types.ts +12 -0
  271. package/src/meetings/request.ts +2 -0
  272. package/src/meetings/util.ts +80 -11
  273. package/src/member/index.ts +58 -0
  274. package/src/member/types.ts +38 -0
  275. package/src/member/util.ts +141 -25
  276. package/src/members/collection.ts +8 -0
  277. package/src/members/index.ts +134 -8
  278. package/src/members/request.ts +97 -17
  279. package/src/members/types.ts +29 -0
  280. package/src/members/util.ts +333 -240
  281. package/src/metrics/constants.ts +12 -4
  282. package/src/metrics/index.ts +1 -490
  283. package/src/multistream/mediaRequestManager.ts +289 -79
  284. package/src/multistream/receiveSlot.ts +31 -17
  285. package/src/multistream/receiveSlotManager.ts +34 -24
  286. package/src/multistream/remoteMedia.ts +27 -2
  287. package/src/multistream/remoteMediaGroup.ts +59 -0
  288. package/src/multistream/remoteMediaManager.ts +148 -30
  289. package/src/multistream/sendSlotManager.ts +170 -0
  290. package/src/reachability/index.ts +228 -37
  291. package/src/reachability/request.ts +17 -8
  292. package/src/reconnection-manager/index.ts +83 -56
  293. package/src/recording-controller/index.ts +20 -3
  294. package/src/recording-controller/util.ts +26 -9
  295. package/src/roap/index.ts +63 -32
  296. package/src/roap/request.ts +100 -104
  297. package/src/roap/turnDiscovery.ts +48 -26
  298. package/src/rtcMetrics/constants.ts +3 -0
  299. package/src/rtcMetrics/index.ts +100 -0
  300. package/src/statsAnalyzer/index.ts +105 -91
  301. package/src/statsAnalyzer/mqaUtil.ts +13 -14
  302. package/src/webinar/collection.ts +31 -0
  303. package/src/webinar/index.ts +62 -0
  304. package/test/integration/spec/converged-space-meetings.js +60 -3
  305. package/test/integration/spec/journey.js +320 -261
  306. package/test/integration/spec/space-meeting.js +76 -3
  307. package/test/unit/spec/annotation/index.ts +418 -0
  308. package/test/unit/spec/breakouts/breakout.ts +118 -28
  309. package/test/unit/spec/breakouts/edit-lock-error.ts +30 -0
  310. package/test/unit/spec/breakouts/events.ts +89 -0
  311. package/test/unit/spec/breakouts/index.ts +1395 -69
  312. package/test/unit/spec/breakouts/utils.js +52 -1
  313. package/test/unit/spec/common/queue.js +31 -2
  314. package/test/unit/spec/controls-options-manager/index.js +163 -0
  315. package/test/unit/spec/controls-options-manager/util.js +576 -60
  316. package/test/unit/spec/fixture/locus.js +1 -0
  317. package/test/unit/spec/interpretation/collection.ts +15 -0
  318. package/test/unit/spec/interpretation/index.ts +589 -0
  319. package/test/unit/spec/interpretation/siLanguage.ts +28 -0
  320. package/test/unit/spec/locus-info/controlsUtils.js +316 -43
  321. package/test/unit/spec/locus-info/index.js +1304 -33
  322. package/test/unit/spec/locus-info/infoUtils.js +37 -15
  323. package/test/unit/spec/locus-info/lib/SeqCmp.json +16 -0
  324. package/test/unit/spec/locus-info/mediaSharesUtils.ts +32 -0
  325. package/test/unit/spec/locus-info/parser.js +116 -35
  326. package/test/unit/spec/locus-info/selfConstant.js +27 -4
  327. package/test/unit/spec/locus-info/selfUtils.js +208 -17
  328. package/test/unit/spec/media/index.ts +104 -37
  329. package/test/unit/spec/media/properties.ts +2 -2
  330. package/test/unit/spec/meeting/in-meeting-actions.ts +81 -3
  331. package/test/unit/spec/meeting/index.js +5216 -1956
  332. package/test/unit/spec/meeting/locusMediaRequest.ts +442 -0
  333. package/test/unit/spec/meeting/muteState.js +408 -208
  334. package/test/unit/spec/meeting/request.js +483 -49
  335. package/test/unit/spec/meeting/utils.js +679 -64
  336. package/test/unit/spec/meeting-info/index.js +300 -0
  337. package/test/unit/spec/meeting-info/meetinginfov2.js +526 -5
  338. package/test/unit/spec/meeting-info/utilv2.js +21 -0
  339. package/test/unit/spec/meetings/collection.js +26 -0
  340. package/test/unit/spec/meetings/index.js +1011 -205
  341. package/test/unit/spec/meetings/utils.js +202 -2
  342. package/test/unit/spec/member/index.js +61 -6
  343. package/test/unit/spec/member/util.js +510 -34
  344. package/test/unit/spec/members/index.js +432 -1
  345. package/test/unit/spec/members/request.js +206 -27
  346. package/test/unit/spec/members/utils.js +210 -0
  347. package/test/unit/spec/metrics/index.js +1 -50
  348. package/test/unit/spec/multistream/mediaRequestManager.ts +803 -162
  349. package/test/unit/spec/multistream/receiveSlot.ts +28 -20
  350. package/test/unit/spec/multistream/receiveSlotManager.ts +32 -30
  351. package/test/unit/spec/multistream/remoteMedia.ts +30 -0
  352. package/test/unit/spec/multistream/remoteMediaGroup.ts +266 -0
  353. package/test/unit/spec/multistream/remoteMediaManager.ts +326 -0
  354. package/test/unit/spec/multistream/sendSlotManager.ts +242 -0
  355. package/test/unit/spec/reachability/index.ts +549 -9
  356. package/test/unit/spec/reachability/request.js +68 -0
  357. package/test/unit/spec/reconnection-manager/index.js +85 -9
  358. package/test/unit/spec/recording-controller/index.js +294 -218
  359. package/test/unit/spec/recording-controller/util.js +223 -96
  360. package/test/unit/spec/roap/index.ts +178 -64
  361. package/test/unit/spec/roap/request.ts +203 -85
  362. package/test/unit/spec/roap/turnDiscovery.ts +82 -36
  363. package/test/unit/spec/rtcMetrics/index.ts +73 -0
  364. package/test/unit/spec/stats-analyzer/index.js +136 -2
  365. package/test/unit/spec/webinar/collection.ts +13 -0
  366. package/test/unit/spec/webinar/index.ts +60 -0
  367. package/test/utils/integrationTestUtils.js +46 -0
  368. package/test/utils/testUtils.js +0 -52
  369. package/dist/meeting/effectsState.js +0 -262
  370. package/dist/meeting/effectsState.js.map +0 -1
  371. package/dist/metrics/config.js +0 -299
  372. package/dist/metrics/config.js.map +0 -1
  373. package/dist/types/meeting/effectsState.d.ts +0 -42
  374. package/dist/types/metrics/config.d.ts +0 -178
  375. package/src/index.js +0 -16
  376. package/src/meeting/effectsState.ts +0 -211
  377. package/src/metrics/config.ts +0 -495
  378. package/test/unit/spec/meeting/effectsState.js +0 -285
@@ -6,6 +6,10 @@ var _Object$getOwnPropertyDescriptor = require("@babel/runtime-corejs2/core-js/o
6
6
  var _Object$getOwnPropertyDescriptors = require("@babel/runtime-corejs2/core-js/object/get-own-property-descriptors");
7
7
  var _Object$defineProperties = require("@babel/runtime-corejs2/core-js/object/define-properties");
8
8
  var _Object$defineProperty = require("@babel/runtime-corejs2/core-js/object/define-property");
9
+ var _Array$from = require("@babel/runtime-corejs2/core-js/array/from");
10
+ var _Symbol = require("@babel/runtime-corejs2/core-js/symbol");
11
+ var _Symbol$iterator = require("@babel/runtime-corejs2/core-js/symbol/iterator");
12
+ var _Array$isArray = require("@babel/runtime-corejs2/core-js/array/is-array");
9
13
  var _interopRequireDefault = require("@babel/runtime-corejs2/helpers/interopRequireDefault");
10
14
  _Object$defineProperty(exports, "__esModule", {
11
15
  value: true
@@ -15,452 +19,632 @@ var _promise = _interopRequireDefault(require("@babel/runtime-corejs2/core-js/pr
15
19
  var _stringify = _interopRequireDefault(require("@babel/runtime-corejs2/core-js/json/stringify"));
16
20
  var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime-corejs2/helpers/slicedToArray"));
17
21
  var _defineProperty2 = _interopRequireDefault(require("@babel/runtime-corejs2/helpers/defineProperty"));
18
- var _isEmpty2 = _interopRequireDefault(require("lodash/isEmpty"));
22
+ var _cloneDeep2 = _interopRequireDefault(require("lodash/cloneDeep"));
19
23
  var _webexErrors = require("../common/errors/webex-errors");
20
- var _metrics = _interopRequireDefault(require("../metrics"));
21
- var _config = require("../metrics/config");
22
- var _media = _interopRequireDefault(require("../media"));
23
24
  var _loggerProxy = _interopRequireDefault(require("../common/logs/logger-proxy"));
24
25
  var _constants = require("../constants");
26
+ var _browserDetection = _interopRequireDefault(require("../common/browser-detection"));
25
27
  var _intentToJoin = _interopRequireDefault(require("../common/errors/intent-to-join"));
26
28
  var _joinMeeting = _interopRequireDefault(require("../common/errors/join-meeting"));
27
29
  var _parameter = _interopRequireDefault(require("../common/errors/parameter"));
28
30
  var _permission = _interopRequireDefault(require("../common/errors/permission"));
29
31
  var _passwordError = _interopRequireDefault(require("../common/errors/password-error"));
30
32
  var _captchaError = _interopRequireDefault(require("../common/errors/captcha-error"));
33
+ var _triggerProxy = _interopRequireDefault(require("../common/events/trigger-proxy"));
34
+ function _createForOfIteratorHelper(o, allowArrayLike) { var it = typeof _Symbol !== "undefined" && o[_Symbol$iterator] || o["@@iterator"]; if (!it) { if (_Array$isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it.return != null) it.return(); } finally { if (didErr) throw err; } } }; }
35
+ function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return _Array$from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
36
+ function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
31
37
  function ownKeys(object, enumerableOnly) { var keys = _Object$keys(object); if (_Object$getOwnPropertySymbols) { var symbols = _Object$getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return _Object$getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
32
38
  function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { (0, _defineProperty2.default)(target, key, source[key]); }) : _Object$getOwnPropertyDescriptors ? _Object$defineProperties(target, _Object$getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { _Object$defineProperty(target, key, _Object$getOwnPropertyDescriptor(source, key)); }); } return target; }
33
- var MeetingUtil = {};
34
- MeetingUtil.parseLocusJoin = function (response) {
35
- var parsed = {};
39
+ var MeetingUtil = {
40
+ parseLocusJoin: function parseLocusJoin(response) {
41
+ var parsed = {};
36
42
 
37
- // First todo: add check for existance
38
- parsed.locus = response.body.locus;
39
- parsed.mediaConnections = response.body.mediaConnections;
40
- parsed.locusUrl = parsed.locus.url;
41
- parsed.locusId = parsed.locus.url.split('/').pop();
42
- parsed.selfId = parsed.locus.self.id;
43
+ // First todo: add check for existance
44
+ parsed.locus = response.body.locus;
45
+ parsed.mediaConnections = response.body.mediaConnections;
46
+ parsed.locusUrl = parsed.locus.url;
47
+ parsed.locusId = parsed.locus.url.split('/').pop();
48
+ parsed.selfId = parsed.locus.self.id;
43
49
 
44
- // we need mediaId before making roap calls
45
- parsed.mediaConnections.forEach(function (mediaConnection) {
46
- if (mediaConnection.mediaId) {
47
- parsed.mediaId = mediaConnection.mediaId;
48
- }
49
- });
50
- return parsed;
51
- };
52
- MeetingUtil.remoteUpdateAudioVideo = function (audioMuted, videoMuted, meeting) {
53
- if (!meeting) {
54
- return _promise.default.reject(new _parameter.default('You need a meeting object.'));
55
- }
56
- var localMedias = _media.default.generateLocalMedias(meeting.mediaId, audioMuted, videoMuted);
57
- if ((0, _isEmpty2.default)(localMedias)) {
58
- return _promise.default.reject(new _parameter.default('You need a media id on the meeting to change remote audio.'));
59
- }
60
- _metrics.default.postEvent({
61
- event: _config.eventType.MEDIA_REQUEST,
62
- meeting: meeting
63
- });
64
- return meeting.meetingRequest.remoteAudioVideoToggle({
65
- locusUrl: meeting.locusUrl,
66
- selfId: meeting.selfId,
67
- localMedias: localMedias,
68
- deviceUrl: meeting.deviceUrl,
69
- correlationId: meeting.correlationId,
70
- preferTranscoding: !meeting.isMultistream
71
- }).then(function (response) {
72
- _metrics.default.postEvent({
73
- event: _config.eventType.MEDIA_RESPONSE,
74
- meeting: meeting
50
+ // we need mediaId before making roap calls
51
+ parsed.mediaConnections.forEach(function (mediaConnection) {
52
+ if (mediaConnection.mediaId) {
53
+ parsed.mediaId = mediaConnection.mediaId;
54
+ }
75
55
  });
76
- return response.body.locus;
77
- });
78
- };
79
- MeetingUtil.hasOwner = function (info) {
80
- return info && info.owner;
81
- };
82
- MeetingUtil.isOwnerSelf = function (owner, selfId) {
83
- return owner === selfId;
84
- };
85
- MeetingUtil.isPinOrGuest = function (err) {
86
- var _err$body;
87
- return (err === null || err === void 0 ? void 0 : (_err$body = err.body) === null || _err$body === void 0 ? void 0 : _err$body.errorCode) && _constants.INTENT_TO_JOIN.includes(err.body.errorCode);
88
- };
89
- MeetingUtil.joinMeeting = function (meeting, options) {
90
- if (!meeting) {
91
- return _promise.default.reject(new _parameter.default('You need a meeting object.'));
92
- }
93
- _metrics.default.postEvent({
94
- event: _config.eventType.LOCUS_JOIN_REQUEST,
95
- meeting: meeting
96
- });
56
+ return parsed;
57
+ },
58
+ remoteUpdateAudioVideo: function remoteUpdateAudioVideo(meeting, audioMuted, videoMuted) {
59
+ var webex = meeting.getWebexObject();
60
+ if (!meeting) {
61
+ return _promise.default.reject(new _parameter.default('You need a meeting object.'));
62
+ }
63
+ if (!meeting.locusMediaRequest) {
64
+ return _promise.default.reject(new _parameter.default('You need a meeting with a media connection, call Meeting.addMedia() first.'));
65
+ }
97
66
 
98
- // eslint-disable-next-line no-warning-comments
99
- // TODO: check if the meeting is in JOINING state
100
- // if Joining state termintate the request as user might click multiple times
101
- return meeting.meetingRequest.joinMeeting({
102
- inviteeAddress: meeting.meetingJoinUrl || meeting.sipUri,
103
- meetingNumber: meeting.meetingNumber,
104
- deviceUrl: meeting.deviceUrl,
105
- locusUrl: meeting.locusUrl,
106
- correlationId: meeting.correlationId,
107
- roapMessage: options.roapMessage,
108
- permissionToken: meeting.permissionToken,
109
- resourceId: options.resourceId || null,
110
- moderator: options.moderator,
111
- pin: options.pin,
112
- moveToResource: options.moveToResource,
113
- preferTranscoding: !meeting.isMultistream,
114
- asResourceOccupant: options.asResourceOccupant,
115
- breakoutsSupported: options.breakoutsSupported
116
- }).then(function (res) {
117
- _metrics.default.postEvent({
118
- event: _config.eventType.LOCUS_JOIN_RESPONSE,
119
- meeting: meeting,
120
- data: {
121
- trigger: _config.trigger.LOCI_UPDATE,
122
- locus: res.body.locus,
123
- mediaConnections: res.body.mediaConnections,
124
- trackingId: res.headers.trackingid
67
+ // @ts-ignore
68
+ webex.internal.newMetrics.submitClientEvent({
69
+ name: 'client.locus.media.request',
70
+ options: {
71
+ meetingId: meeting.id
125
72
  }
126
73
  });
127
- return MeetingUtil.parseLocusJoin(res);
128
- });
129
- };
130
- MeetingUtil.cleanUp = function (meeting) {
131
- meeting.breakouts.cleanUp();
74
+ return meeting.locusMediaRequest.send({
75
+ type: 'LocalMute',
76
+ selfUrl: meeting.selfUrl,
77
+ mediaId: meeting.mediaId,
78
+ sequence: meeting.locusInfo.sequence,
79
+ muteOptions: {
80
+ audioMuted: audioMuted,
81
+ videoMuted: videoMuted
82
+ }
83
+ }).then(function (response) {
84
+ var _response$body;
85
+ // @ts-ignore
86
+ webex.internal.newMetrics.submitClientEvent({
87
+ name: 'client.locus.media.response',
88
+ options: {
89
+ meetingId: meeting.id
90
+ }
91
+ });
92
+ return response === null || response === void 0 ? void 0 : (_response$body = response.body) === null || _response$body === void 0 ? void 0 : _response$body.locus;
93
+ });
94
+ },
95
+ hasOwner: function hasOwner(info) {
96
+ return info && info.owner;
97
+ },
98
+ isOwnerSelf: function isOwnerSelf(owner, selfId) {
99
+ return owner === selfId;
100
+ },
101
+ isPinOrGuest: function isPinOrGuest(err) {
102
+ var _err$body;
103
+ return (err === null || err === void 0 ? void 0 : (_err$body = err.body) === null || _err$body === void 0 ? void 0 : _err$body.errorCode) && _constants.INTENT_TO_JOIN.includes(err.body.errorCode);
104
+ },
105
+ /**
106
+ * Returns the current state of knowledge about whether we are on an ipv4-only or ipv6-only or mixed (ipv4 and ipv6) network.
107
+ * The return value matches the possible values of "ipver" parameter used by the backend APIs.
108
+ *
109
+ * @param {Object} webex webex instance
110
+ * @returns {IP_VERSION|undefined} ipver value to be passed to the backend APIs or undefined if we should not pass any value to the backend
111
+ */
112
+ getIpVersion: function getIpVersion(webex) {
113
+ var _webex$internal$devic = webex.internal.device.ipNetworkDetector,
114
+ supportsIpV4 = _webex$internal$devic.supportsIpV4,
115
+ supportsIpV6 = _webex$internal$devic.supportsIpV6;
116
+ if ((0, _browserDetection.default)().isBrowser('firefox')) {
117
+ // our ipv6 solution relies on FQDN ICE candidates, but Firefox doesn't support them,
118
+ // see https://bugzilla.mozilla.org/show_bug.cgi?id=1713128
119
+ // so for Firefox we don't want the backend to activate the "ipv6 feature"
120
+ return undefined;
121
+ }
122
+ if (supportsIpV4 && supportsIpV6) {
123
+ return _constants.IP_VERSION.ipv4_and_ipv6;
124
+ }
125
+ if (supportsIpV4) {
126
+ return _constants.IP_VERSION.only_ipv4;
127
+ }
128
+ if (supportsIpV6) {
129
+ return _constants.IP_VERSION.only_ipv6;
130
+ }
131
+ return _constants.IP_VERSION.unknown;
132
+ },
133
+ joinMeeting: function joinMeeting(meeting, options) {
134
+ var _meeting$meetingInfo;
135
+ if (!meeting) {
136
+ return _promise.default.reject(new _parameter.default('You need a meeting object.'));
137
+ }
138
+ var webex = meeting.getWebexObject();
132
139
 
133
- // make sure we send last metrics before we close the peerconnection
134
- var stopStatsAnalyzer = meeting.statsAnalyzer ? meeting.statsAnalyzer.stopAnalyzer() : _promise.default.resolve();
135
- return stopStatsAnalyzer.then(function () {
136
- return meeting.closeLocalStream();
137
- }).then(function () {
138
- return meeting.closeLocalShare();
139
- }).then(function () {
140
- return meeting.closeRemoteTracks();
141
- }).then(function () {
142
- return meeting.closePeerConnections();
143
- }).then(function () {
144
- meeting.unsetLocalVideoTrack();
145
- meeting.unsetLocalShareTrack();
146
- meeting.unsetRemoteTracks();
147
- meeting.unsetPeerConnections();
148
- meeting.reconnectionManager.cleanUp();
149
- }).then(function () {
150
- return meeting.stopKeepAlive();
151
- }).then(function () {
152
- return meeting.updateLLMConnection();
153
- });
154
- };
155
- MeetingUtil.disconnectPhoneAudio = function (meeting, phoneUrl) {
156
- if (meeting.meetingState === _constants.FULL_STATE.INACTIVE) {
157
- return _promise.default.reject(new _webexErrors.MeetingNotActiveError());
158
- }
159
- var options = {
160
- locusUrl: meeting.locusUrl,
161
- selfId: meeting.selfId,
162
- correlationId: meeting.correlationId,
163
- phoneUrl: phoneUrl
164
- };
165
- return meeting.meetingRequest.disconnectPhoneAudio(options).then(function (response) {
166
- var _response$body;
167
- if (response !== null && response !== void 0 && (_response$body = response.body) !== null && _response$body !== void 0 && _response$body.locus) {
168
- meeting.locusInfo.onFullLocus(response.body.locus);
169
- }
170
- }).catch(function (err) {
171
- _loggerProxy.default.logger.error("Meeting:util#disconnectPhoneAudio --> An error occured while disconnecting phone audio in meeting ".concat(meeting.id, ", error: ").concat(err));
172
- return _promise.default.reject(err);
173
- });
174
- };
140
+ // @ts-ignore
141
+ webex.internal.newMetrics.submitClientEvent({
142
+ name: 'client.locus.join.request',
143
+ options: {
144
+ meetingId: meeting.id
145
+ }
146
+ });
175
147
 
176
- // by default will leave on meeting's resourceId
177
- // if you explicity want it not to leave on resource id, pass
178
- // {resourceId: null}
179
- // TODO: chris, you can modify this however you want
180
- MeetingUtil.leaveMeeting = function (meeting) {
181
- var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
182
- if (meeting.meetingState === _constants.FULL_STATE.INACTIVE) {
183
- // TODO: clean up if the meeting is already inactive
184
- return _promise.default.reject(new _webexErrors.MeetingNotActiveError());
185
- }
186
- if (MeetingUtil.isUserInLeftState(meeting.locusInfo)) {
187
- return _promise.default.reject(new _webexErrors.UserNotJoinedError());
188
- }
189
- var defaultOptions = {
190
- locusUrl: meeting.locusUrl,
191
- selfId: meeting.selfId,
192
- correlationId: meeting.correlationId,
193
- resourceId: meeting.resourceId,
194
- deviceUrl: meeting.deviceUrl
195
- };
196
- var leaveOptions = _objectSpread(_objectSpread({}, defaultOptions), options);
197
- return meeting.meetingRequest.leaveMeeting(leaveOptions).then(function (response) {
198
- if (response && response.body && response.body.locus) {
199
- // && !options.moveMeeting) {
200
- meeting.locusInfo.onFullLocus(response.body.locus);
201
- }
202
- return _promise.default.resolve();
203
- }).then(function () {
204
- if (options.moveMeeting) {
205
- return _promise.default.resolve();
206
- }
207
- return MeetingUtil.cleanUp(meeting);
208
- }).catch(function (err) {
209
- // TODO: If the meeting state comes as LEFT or INACTIVE as response then
210
- // 1) on leave clean up the meeting or simply do a sync on the meeting
211
- // 2) If the error says meeting is inactive then destroy the meeting object
212
- _loggerProxy.default.logger.error("Meeting:util#leaveMeeting --> An error occured while trying to leave meeting with an id of ".concat(meeting.id, ", error: ").concat(err));
213
- return _promise.default.reject(err);
214
- });
215
- };
216
- MeetingUtil.declineMeeting = function (meeting, reason) {
217
- return meeting.meetingRequest.declineMeeting({
218
- locusUrl: meeting.locusUrl,
219
- deviceUrl: meeting.deviceUrl,
220
- reason: reason
221
- });
222
- };
223
- MeetingUtil.isUserInLeftState = function (locusInfo) {
224
- var _locusInfo$parsedLocu, _locusInfo$parsedLocu2;
225
- return ((_locusInfo$parsedLocu = locusInfo.parsedLocus) === null || _locusInfo$parsedLocu === void 0 ? void 0 : (_locusInfo$parsedLocu2 = _locusInfo$parsedLocu.self) === null || _locusInfo$parsedLocu2 === void 0 ? void 0 : _locusInfo$parsedLocu2.state) === _constants._LEFT_;
226
- };
227
- MeetingUtil.isUserInIdleState = function (locusInfo) {
228
- var _locusInfo$parsedLocu3, _locusInfo$parsedLocu4;
229
- return ((_locusInfo$parsedLocu3 = locusInfo.parsedLocus) === null || _locusInfo$parsedLocu3 === void 0 ? void 0 : (_locusInfo$parsedLocu4 = _locusInfo$parsedLocu3.self) === null || _locusInfo$parsedLocu4 === void 0 ? void 0 : _locusInfo$parsedLocu4.state) === _constants._IDLE_;
230
- };
231
- MeetingUtil.isUserInJoinedState = function (locusInfo) {
232
- var _locusInfo$parsedLocu5, _locusInfo$parsedLocu6;
233
- return ((_locusInfo$parsedLocu5 = locusInfo.parsedLocus) === null || _locusInfo$parsedLocu5 === void 0 ? void 0 : (_locusInfo$parsedLocu6 = _locusInfo$parsedLocu5.self) === null || _locusInfo$parsedLocu6 === void 0 ? void 0 : _locusInfo$parsedLocu6.state) === _constants._JOINED_;
234
- };
235
- MeetingUtil.isMediaEstablished = function (currentMediaStatus) {
236
- return currentMediaStatus && (currentMediaStatus.audio || currentMediaStatus.video || currentMediaStatus.share);
237
- };
238
- MeetingUtil.joinMeetingOptions = function (meeting) {
239
- var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
240
- meeting.resourceId = meeting.resourceId || options.resourceId;
241
- if (meeting.requiredCaptcha) {
242
- return _promise.default.reject(new _captchaError.default());
243
- }
244
- if (meeting.passwordStatus === _constants.PASSWORD_STATUS.REQUIRED) {
245
- return _promise.default.reject(new _passwordError.default());
246
- }
247
- if (options.pin) {
248
- _metrics.default.postEvent({
249
- event: _config.eventType.PIN_COLLECTED,
250
- meeting: meeting
148
+ // eslint-disable-next-line no-warning-comments
149
+ // TODO: check if the meeting is in JOINING state
150
+ // if Joining state termintate the request as user might click multiple times
151
+ return meeting.meetingRequest.joinMeeting({
152
+ inviteeAddress: meeting.meetingJoinUrl || meeting.sipUri,
153
+ meetingNumber: meeting.meetingNumber,
154
+ deviceUrl: meeting.deviceUrl,
155
+ locusUrl: meeting.locusUrl,
156
+ locusClusterUrl: (_meeting$meetingInfo = meeting.meetingInfo) === null || _meeting$meetingInfo === void 0 ? void 0 : _meeting$meetingInfo.locusClusterUrl,
157
+ correlationId: meeting.correlationId,
158
+ roapMessage: options.roapMessage,
159
+ permissionToken: meeting.permissionToken,
160
+ resourceId: options.resourceId || null,
161
+ moderator: options.moderator,
162
+ pin: options.pin,
163
+ moveToResource: options.moveToResource,
164
+ preferTranscoding: !meeting.isMultistream,
165
+ asResourceOccupant: options.asResourceOccupant,
166
+ breakoutsSupported: options.breakoutsSupported,
167
+ locale: options.locale,
168
+ deviceCapabilities: options.deviceCapabilities,
169
+ liveAnnotationSupported: options.liveAnnotationSupported,
170
+ ipVersion: MeetingUtil.getIpVersion(meeting.getWebexObject())
171
+ }).then(function (res) {
172
+ // @ts-ignore
173
+ webex.internal.newMetrics.submitClientEvent({
174
+ name: 'client.locus.join.response',
175
+ payload: {
176
+ trigger: 'loci-update',
177
+ identifiers: {
178
+ trackingId: res.headers.trackingid
179
+ }
180
+ },
181
+ options: {
182
+ meetingId: meeting.id,
183
+ mediaConnections: res.body.mediaConnections
184
+ }
185
+ });
186
+ return MeetingUtil.parseLocusJoin(res);
251
187
  });
252
- }
188
+ },
189
+ cleanUp: function cleanUp(meeting) {
190
+ meeting.breakouts.cleanUp();
191
+ meeting.simultaneousInterpretation.cleanUp();
253
192
 
254
- // normal join meeting, scenario A, D
255
- return MeetingUtil.joinMeeting(meeting, options).then(function (response) {
256
- meeting.setLocus(response);
257
- return _promise.default.resolve(response);
258
- }).catch(function (err) {
259
- // joining a claimed PMR that is not my own, scenario B
260
- if (MeetingUtil.isPinOrGuest(err)) {
261
- _metrics.default.postEvent({
262
- event: _config.eventType.PIN_PROMPT,
263
- meeting: meeting
193
+ // make sure we send last metrics before we close the peerconnection
194
+ var stopStatsAnalyzer = meeting.statsAnalyzer ? meeting.statsAnalyzer.stopAnalyzer() : _promise.default.resolve();
195
+ return stopStatsAnalyzer.then(function () {
196
+ return meeting.closeRemoteStreams();
197
+ }).then(function () {
198
+ return meeting.closePeerConnections();
199
+ }).then(function () {
200
+ meeting.cleanupLocalStreams();
201
+ meeting.unsetRemoteStreams();
202
+ meeting.unsetPeerConnections();
203
+ meeting.reconnectionManager.cleanUp();
204
+ }).then(function () {
205
+ return meeting.stopKeepAlive();
206
+ }).then(function () {
207
+ return meeting.updateLLMConnection();
208
+ });
209
+ },
210
+ disconnectPhoneAudio: function disconnectPhoneAudio(meeting, phoneUrl) {
211
+ if (meeting.meetingState === _constants.FULL_STATE.INACTIVE) {
212
+ return _promise.default.reject(new _webexErrors.MeetingNotActiveError());
213
+ }
214
+ var options = {
215
+ locusUrl: meeting.locusUrl,
216
+ selfId: meeting.selfId,
217
+ correlationId: meeting.correlationId,
218
+ phoneUrl: phoneUrl
219
+ };
220
+ return meeting.meetingRequest.disconnectPhoneAudio(options).catch(function (err) {
221
+ _loggerProxy.default.logger.error("Meeting:util#disconnectPhoneAudio --> An error occured while disconnecting phone audio in meeting ".concat(meeting.id, ", error: ").concat(err));
222
+ return _promise.default.reject(err);
223
+ });
224
+ },
225
+ /**
226
+ * Returns options for leaving a meeting.
227
+ * @param {any} meeting
228
+ * @param {any} options
229
+ * @returns {any} leave options
230
+ */
231
+ prepareLeaveMeetingOptions: function prepareLeaveMeetingOptions(meeting) {
232
+ var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
233
+ var defaultOptions = {
234
+ locusUrl: meeting.locusUrl,
235
+ selfId: meeting.selfId,
236
+ correlationId: meeting.correlationId,
237
+ resourceId: meeting.resourceId,
238
+ deviceUrl: meeting.deviceUrl
239
+ };
240
+ return _objectSpread(_objectSpread({}, defaultOptions), options);
241
+ },
242
+ // by default will leave on meeting's resourceId
243
+ // if you explicity want it not to leave on resource id, pass
244
+ // {resourceId: null}
245
+ // TODO: chris, you can modify this however you want
246
+ leaveMeeting: function leaveMeeting(meeting) {
247
+ var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
248
+ if (meeting.meetingState === _constants.FULL_STATE.INACTIVE) {
249
+ // TODO: clean up if the meeting is already inactive
250
+ return _promise.default.reject(new _webexErrors.MeetingNotActiveError());
251
+ }
252
+ if (MeetingUtil.isUserInLeftState(meeting.locusInfo)) {
253
+ return _promise.default.reject(new _webexErrors.UserNotJoinedError());
254
+ }
255
+ var leaveOptions = MeetingUtil.prepareLeaveMeetingOptions(meeting, options);
256
+ return meeting.meetingRequest.leaveMeeting(leaveOptions).then(function () {
257
+ if (options.moveMeeting) {
258
+ return _promise.default.resolve();
259
+ }
260
+ return MeetingUtil.cleanUp(meeting);
261
+ }).catch(function (err) {
262
+ // TODO: If the meeting state comes as LEFT or INACTIVE as response then
263
+ // 1) on leave clean up the meeting or simply do a sync on the meeting
264
+ // 2) If the error says meeting is inactive then destroy the meeting object
265
+ _loggerProxy.default.logger.error("Meeting:util#leaveMeeting --> An error occured while trying to leave meeting with an id of ".concat(meeting.id, ", error: ").concat(err));
266
+ return _promise.default.reject(err);
267
+ });
268
+ },
269
+ declineMeeting: function declineMeeting(meeting, reason) {
270
+ return meeting.meetingRequest.declineMeeting({
271
+ locusUrl: meeting.locusUrl,
272
+ deviceUrl: meeting.deviceUrl,
273
+ reason: reason
274
+ });
275
+ },
276
+ isUserInLeftState: function isUserInLeftState(locusInfo) {
277
+ var _locusInfo$parsedLocu, _locusInfo$parsedLocu2;
278
+ return ((_locusInfo$parsedLocu = locusInfo.parsedLocus) === null || _locusInfo$parsedLocu === void 0 ? void 0 : (_locusInfo$parsedLocu2 = _locusInfo$parsedLocu.self) === null || _locusInfo$parsedLocu2 === void 0 ? void 0 : _locusInfo$parsedLocu2.state) === _constants._LEFT_;
279
+ },
280
+ isUserInIdleState: function isUserInIdleState(locusInfo) {
281
+ var _locusInfo$parsedLocu3, _locusInfo$parsedLocu4;
282
+ return ((_locusInfo$parsedLocu3 = locusInfo.parsedLocus) === null || _locusInfo$parsedLocu3 === void 0 ? void 0 : (_locusInfo$parsedLocu4 = _locusInfo$parsedLocu3.self) === null || _locusInfo$parsedLocu4 === void 0 ? void 0 : _locusInfo$parsedLocu4.state) === _constants._IDLE_;
283
+ },
284
+ isUserInJoinedState: function isUserInJoinedState(locusInfo) {
285
+ var _locusInfo$parsedLocu5, _locusInfo$parsedLocu6;
286
+ return ((_locusInfo$parsedLocu5 = locusInfo.parsedLocus) === null || _locusInfo$parsedLocu5 === void 0 ? void 0 : (_locusInfo$parsedLocu6 = _locusInfo$parsedLocu5.self) === null || _locusInfo$parsedLocu6 === void 0 ? void 0 : _locusInfo$parsedLocu6.state) === _constants._JOINED_;
287
+ },
288
+ isMediaEstablished: function isMediaEstablished(currentMediaStatus) {
289
+ return currentMediaStatus && (currentMediaStatus.audio || currentMediaStatus.video || currentMediaStatus.share);
290
+ },
291
+ joinMeetingOptions: function joinMeetingOptions(meeting) {
292
+ var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
293
+ var webex = meeting.getWebexObject();
294
+ meeting.resourceId = meeting.resourceId || options.resourceId;
295
+ if (meeting.requiredCaptcha) {
296
+ return _promise.default.reject(new _captchaError.default());
297
+ }
298
+ if (meeting.passwordStatus === _constants.PASSWORD_STATUS.REQUIRED) {
299
+ return _promise.default.reject(new _passwordError.default());
300
+ }
301
+ if (options.pin) {
302
+ // @ts-ignore
303
+ webex.internal.newMetrics.submitClientEvent({
304
+ name: 'client.pin.collected',
305
+ options: {
306
+ meetingId: meeting.id
307
+ }
264
308
  });
309
+ }
265
310
 
266
- // request host pin or non host for unclaimed PMR, start of Scenario C
267
- // see https://sqbu-github.cisco.com/WebExSquared/locus/wiki/Locus-Lobby-and--IVR-Feature
268
- return _promise.default.reject(new _intentToJoin.default('Error Joining Meeting', err));
311
+ // normal join meeting, scenario A, D
312
+ return MeetingUtil.joinMeeting(meeting, options).then(function (response) {
313
+ meeting.setLocus(response);
314
+ return _promise.default.resolve(response);
315
+ }).catch(function (err) {
316
+ // joining a claimed PMR that is not my own, scenario B
317
+ if (MeetingUtil.isPinOrGuest(err)) {
318
+ // @ts-ignore
319
+ webex.internal.newMetrics.submitClientEvent({
320
+ name: 'client.pin.prompt',
321
+ options: {
322
+ meetingId: meeting.id
323
+ }
324
+ });
325
+
326
+ // request host pin or non host for unclaimed PMR, start of Scenario C
327
+ // see https://sqbu-github.cisco.com/WebExSquared/locus/wiki/Locus-Lobby-and--IVR-Feature
328
+ return _promise.default.reject(new _intentToJoin.default('Error Joining Meeting', err));
329
+ }
330
+ _loggerProxy.default.logger.error('Meeting:util#joinMeetingOptions --> Error joining the call, ', err);
331
+ return _promise.default.reject(new _joinMeeting.default(options, 'Error Joining Meeting', err));
332
+ });
333
+ },
334
+ /**
335
+ * Returns request options for leaving a meeting.
336
+ * @param {any} meeting
337
+ * @param {any} options
338
+ * @returns {any} request options
339
+ */
340
+ buildLeaveFetchRequestOptions: function buildLeaveFetchRequestOptions(meeting) {
341
+ var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
342
+ var leaveOptions = MeetingUtil.prepareLeaveMeetingOptions(meeting, options);
343
+ return meeting.meetingRequest.buildLeaveMeetingRequestOptions(leaveOptions);
344
+ },
345
+ getTrack: function getTrack(stream) {
346
+ var audioTrack = null;
347
+ var videoTrack = null;
348
+ var audioTracks = null;
349
+ var videoTracks = null;
350
+ if (!stream) {
351
+ return {
352
+ audioTrack: null,
353
+ videoTrack: null
354
+ };
355
+ }
356
+ if (stream.getAudioTracks) {
357
+ audioTracks = stream.getAudioTracks();
358
+ }
359
+ if (stream.getVideoTracks) {
360
+ videoTracks = stream.getVideoTracks();
361
+ }
362
+ if (audioTracks && audioTracks.length > 0) {
363
+ var _audioTracks = audioTracks;
364
+ var _audioTracks2 = (0, _slicedToArray2.default)(_audioTracks, 1);
365
+ audioTrack = _audioTracks2[0];
366
+ }
367
+ if (videoTracks && videoTracks.length > 0) {
368
+ var _videoTracks = videoTracks;
369
+ var _videoTracks2 = (0, _slicedToArray2.default)(_videoTracks, 1);
370
+ videoTrack = _videoTracks2[0];
269
371
  }
270
- _loggerProxy.default.logger.error('Meeting:util#joinMeetingOptions --> Error joining the call, ', err);
271
- return _promise.default.reject(new _joinMeeting.default(options, 'Error Joining Meeting', err));
272
- });
273
- };
274
- MeetingUtil.validateOptions = function (options) {
275
- var sendVideo = options.sendVideo,
276
- sendAudio = options.sendAudio,
277
- sendShare = options.sendShare,
278
- localStream = options.localStream,
279
- localShare = options.localShare;
280
- if (sendVideo && !MeetingUtil.getTrack(localStream).videoTrack) {
281
- return _promise.default.reject(new _parameter.default('please pass valid video streams'));
282
- }
283
- if (sendAudio && !MeetingUtil.getTrack(localStream).audioTrack) {
284
- return _promise.default.reject(new _parameter.default('please pass valid audio streams'));
285
- }
286
- if (sendShare && !MeetingUtil.getTrack(localShare).videoTrack) {
287
- return _promise.default.reject(new _parameter.default('please pass valid share streams'));
288
- }
289
- return _promise.default.resolve();
290
- };
291
- MeetingUtil.getTrack = function (stream) {
292
- var audioTrack = null;
293
- var videoTrack = null;
294
- var audioTracks = null;
295
- var videoTracks = null;
296
- if (!stream) {
297
372
  return {
298
- audioTrack: null,
299
- videoTrack: null
373
+ audioTrack: audioTrack,
374
+ videoTrack: videoTrack
300
375
  };
301
- }
302
- if (stream.getAudioTracks) {
303
- audioTracks = stream.getAudioTracks();
304
- }
305
- if (stream.getVideoTracks) {
306
- videoTracks = stream.getVideoTracks();
307
- }
308
- if (audioTracks && audioTracks.length > 0) {
309
- var _audioTracks = audioTracks;
310
- var _audioTracks2 = (0, _slicedToArray2.default)(_audioTracks, 1);
311
- audioTrack = _audioTracks2[0];
312
- }
313
- if (videoTracks && videoTracks.length > 0) {
314
- var _videoTracks = videoTracks;
315
- var _videoTracks2 = (0, _slicedToArray2.default)(_videoTracks, 1);
316
- videoTrack = _videoTracks2[0];
317
- }
318
- return {
319
- audioTrack: audioTrack,
320
- videoTrack: videoTrack
321
- };
322
- };
323
- MeetingUtil.getModeratorFromLocusInfo = function (locusInfo) {
324
- return locusInfo && locusInfo.parsedLocus && locusInfo.parsedLocus.info && locusInfo.parsedLocus.info && locusInfo.parsedLocus.info.moderator;
325
- };
326
- MeetingUtil.getPolicyFromLocusInfo = function (locusInfo) {
327
- return locusInfo && locusInfo.parsedLocus && locusInfo.parsedLocus.info && locusInfo.parsedLocus.info && locusInfo.parsedLocus.info.policy;
328
- };
329
- MeetingUtil.getUserDisplayHintsFromLocusInfo = function (locusInfo) {
330
- var _locusInfo$parsedLocu7, _locusInfo$parsedLocu8;
331
- return (locusInfo === null || locusInfo === void 0 ? void 0 : (_locusInfo$parsedLocu7 = locusInfo.parsedLocus) === null || _locusInfo$parsedLocu7 === void 0 ? void 0 : (_locusInfo$parsedLocu8 = _locusInfo$parsedLocu7.info) === null || _locusInfo$parsedLocu8 === void 0 ? void 0 : _locusInfo$parsedLocu8.userDisplayHints) || [];
332
- };
333
- MeetingUtil.canInviteNewParticipants = function (displayHints) {
334
- return displayHints.includes(_constants.DISPLAY_HINTS.ADD_GUEST);
335
- };
336
- MeetingUtil.canAdmitParticipant = function (displayHints) {
337
- return displayHints.includes(_constants.DISPLAY_HINTS.ROSTER_WAITING_TO_JOIN);
338
- };
339
- MeetingUtil.canUserLock = function (displayHints) {
340
- return displayHints.includes(_constants.DISPLAY_HINTS.LOCK_CONTROL_LOCK) && displayHints.includes(_constants.DISPLAY_HINTS.LOCK_STATUS_UNLOCKED);
341
- };
342
- MeetingUtil.canUserUnlock = function (displayHints) {
343
- return displayHints.includes(_constants.DISPLAY_HINTS.LOCK_CONTROL_UNLOCK) && displayHints.includes(_constants.DISPLAY_HINTS.LOCK_STATUS_LOCKED);
344
- };
345
- MeetingUtil.canUserRaiseHand = function (displayHints) {
346
- return displayHints.includes(_constants.DISPLAY_HINTS.RAISE_HAND);
347
- };
348
- MeetingUtil.canUserLowerAllHands = function (displayHints) {
349
- return displayHints.includes(_constants.DISPLAY_HINTS.LOWER_ALL_HANDS);
350
- };
351
- MeetingUtil.canUserLowerSomeoneElsesHand = function (displayHints) {
352
- return displayHints.includes(_constants.DISPLAY_HINTS.LOWER_SOMEONE_ELSES_HAND);
353
- };
354
- MeetingUtil.bothLeaveAndEndMeetingAvailable = function (displayHints) {
355
- return displayHints.includes(_constants.DISPLAY_HINTS.LEAVE_TRANSFER_HOST_END_MEETING) || displayHints.includes(_constants.DISPLAY_HINTS.LEAVE_END_MEETING);
356
- };
357
- MeetingUtil.lockMeeting = function (actions, request, locusUrl) {
358
- if (actions && actions.canLock) {
359
- return request.lockMeeting({
360
- locusUrl: locusUrl,
361
- lock: true
376
+ },
377
+ getModeratorFromLocusInfo: function getModeratorFromLocusInfo(locusInfo) {
378
+ return locusInfo && locusInfo.parsedLocus && locusInfo.parsedLocus.info && locusInfo.parsedLocus.info && locusInfo.parsedLocus.info.moderator;
379
+ },
380
+ getPolicyFromLocusInfo: function getPolicyFromLocusInfo(locusInfo) {
381
+ return locusInfo && locusInfo.parsedLocus && locusInfo.parsedLocus.info && locusInfo.parsedLocus.info && locusInfo.parsedLocus.info.policy;
382
+ },
383
+ getUserDisplayHintsFromLocusInfo: function getUserDisplayHintsFromLocusInfo(locusInfo) {
384
+ var _locusInfo$parsedLocu7, _locusInfo$parsedLocu8;
385
+ return (locusInfo === null || locusInfo === void 0 ? void 0 : (_locusInfo$parsedLocu7 = locusInfo.parsedLocus) === null || _locusInfo$parsedLocu7 === void 0 ? void 0 : (_locusInfo$parsedLocu8 = _locusInfo$parsedLocu7.info) === null || _locusInfo$parsedLocu8 === void 0 ? void 0 : _locusInfo$parsedLocu8.userDisplayHints) || [];
386
+ },
387
+ canInviteNewParticipants: function canInviteNewParticipants(displayHints) {
388
+ return displayHints.includes(_constants.DISPLAY_HINTS.ADD_GUEST);
389
+ },
390
+ canAdmitParticipant: function canAdmitParticipant(displayHints) {
391
+ return displayHints.includes(_constants.DISPLAY_HINTS.ROSTER_WAITING_TO_JOIN);
392
+ },
393
+ canUserLock: function canUserLock(displayHints) {
394
+ return displayHints.includes(_constants.DISPLAY_HINTS.LOCK_CONTROL_LOCK) && displayHints.includes(_constants.DISPLAY_HINTS.LOCK_STATUS_UNLOCKED);
395
+ },
396
+ canUserUnlock: function canUserUnlock(displayHints) {
397
+ return displayHints.includes(_constants.DISPLAY_HINTS.LOCK_CONTROL_UNLOCK) && displayHints.includes(_constants.DISPLAY_HINTS.LOCK_STATUS_LOCKED);
398
+ },
399
+ canUserRaiseHand: function canUserRaiseHand(displayHints) {
400
+ return displayHints.includes(_constants.DISPLAY_HINTS.RAISE_HAND);
401
+ },
402
+ canUserLowerAllHands: function canUserLowerAllHands(displayHints) {
403
+ return displayHints.includes(_constants.DISPLAY_HINTS.LOWER_ALL_HANDS);
404
+ },
405
+ canUserLowerSomeoneElsesHand: function canUserLowerSomeoneElsesHand(displayHints) {
406
+ return displayHints.includes(_constants.DISPLAY_HINTS.LOWER_SOMEONE_ELSES_HAND);
407
+ },
408
+ bothLeaveAndEndMeetingAvailable: function bothLeaveAndEndMeetingAvailable(displayHints) {
409
+ return displayHints.includes(_constants.DISPLAY_HINTS.LEAVE_TRANSFER_HOST_END_MEETING) || displayHints.includes(_constants.DISPLAY_HINTS.LEAVE_END_MEETING);
410
+ },
411
+ canManageBreakout: function canManageBreakout(displayHints) {
412
+ return displayHints.includes(_constants.DISPLAY_HINTS.BREAKOUT_MANAGEMENT);
413
+ },
414
+ canBroadcastMessageToBreakout: function canBroadcastMessageToBreakout(displayHints) {
415
+ var policies = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
416
+ return displayHints.includes(_constants.DISPLAY_HINTS.BROADCAST_MESSAGE_TO_BREAKOUT) && !!policies[_constants.SELF_POLICY.SUPPORT_BROADCAST_MESSAGE];
417
+ },
418
+ isSuppressBreakoutSupport: function isSuppressBreakoutSupport(displayHints) {
419
+ return displayHints.includes(_constants.DISPLAY_HINTS.UCF_SUPPRESS_BREAKOUTS_SUPPORT);
420
+ },
421
+ canAdmitLobbyToBreakout: function canAdmitLobbyToBreakout(displayHints) {
422
+ return !displayHints.includes(_constants.DISPLAY_HINTS.DISABLE_LOBBY_TO_BREAKOUT);
423
+ },
424
+ isBreakoutPreassignmentsEnabled: function isBreakoutPreassignmentsEnabled(displayHints) {
425
+ return !displayHints.includes(_constants.DISPLAY_HINTS.DISABLE_BREAKOUT_PREASSIGNMENTS);
426
+ },
427
+ canUserAskForHelp: function canUserAskForHelp(displayHints) {
428
+ return !displayHints.includes(_constants.DISPLAY_HINTS.DISABLE_ASK_FOR_HELP);
429
+ },
430
+ lockMeeting: function lockMeeting(actions, request, locusUrl) {
431
+ if (actions && actions.canLock) {
432
+ return request.lockMeeting({
433
+ locusUrl: locusUrl,
434
+ lock: true
435
+ });
436
+ }
437
+ return _promise.default.reject(new _permission.default('Lock not allowed, due to joined property.'));
438
+ },
439
+ unlockMeeting: function unlockMeeting(actions, request, locusUrl) {
440
+ if (actions && actions.canUnlock) {
441
+ return request.lockMeeting({
442
+ locusUrl: locusUrl,
443
+ lock: false
444
+ });
445
+ }
446
+ return _promise.default.reject(new _permission.default('Unlock not allowed, due to joined property.'));
447
+ },
448
+ handleAudioLogging: function handleAudioLogging(audioStream) {
449
+ var LOG_HEADER = 'MeetingUtil#handleAudioLogging -->';
450
+ if (audioStream) {
451
+ var settings = audioStream.getSettings();
452
+ var deviceId = settings.deviceId;
453
+ _loggerProxy.default.logger.log(LOG_HEADER, "deviceId = ".concat(deviceId));
454
+ _loggerProxy.default.logger.log(LOG_HEADER, 'settings =', (0, _stringify.default)(settings));
455
+ }
456
+ },
457
+ handleVideoLogging: function handleVideoLogging(videoStream) {
458
+ var LOG_HEADER = 'MeetingUtil#handleVideoLogging -->';
459
+ if (videoStream) {
460
+ var settings = videoStream.getSettings();
461
+ var deviceId = settings.deviceId;
462
+ _loggerProxy.default.logger.log(LOG_HEADER, "deviceId = ".concat(deviceId));
463
+ _loggerProxy.default.logger.log(LOG_HEADER, 'settings =', (0, _stringify.default)(settings));
464
+ }
465
+ },
466
+ handleDeviceLogging: function handleDeviceLogging() {
467
+ var devices = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
468
+ var LOG_HEADER = 'MeetingUtil#handleDeviceLogging -->';
469
+ devices.forEach(function (device) {
470
+ _loggerProxy.default.logger.log(LOG_HEADER, "deviceId = ".concat(device.deviceId));
471
+ _loggerProxy.default.logger.log(LOG_HEADER, 'settings', (0, _stringify.default)(device));
362
472
  });
363
- }
364
- return _promise.default.reject(new _permission.default('Lock not allowed, due to joined property.'));
365
- };
366
- MeetingUtil.unlockMeeting = function (actions, request, locusUrl) {
367
- if (actions && actions.canUnlock) {
368
- return request.lockMeeting({
369
- locusUrl: locusUrl,
370
- lock: false
473
+ },
474
+ endMeetingForAll: function endMeetingForAll(meeting) {
475
+ if (meeting.meetingState === _constants.FULL_STATE.INACTIVE) {
476
+ return _promise.default.reject(new _webexErrors.MeetingNotActiveError());
477
+ }
478
+ var endOptions = {
479
+ locusUrl: meeting.locusUrl
480
+ };
481
+ return meeting.meetingRequest.endMeetingForAll(endOptions).then(function () {
482
+ return MeetingUtil.cleanUp(meeting);
483
+ }).catch(function (err) {
484
+ _loggerProxy.default.logger.error("Meeting:util#endMeetingForAll An error occured while trying to end meeting for all with an id of ".concat(meeting.id, ", error: ").concat(err));
485
+ return _promise.default.reject(err);
371
486
  });
487
+ },
488
+ canEnableClosedCaption: function canEnableClosedCaption(displayHints) {
489
+ return displayHints.includes(_constants.DISPLAY_HINTS.CAPTION_START);
490
+ },
491
+ isSaveTranscriptsEnabled: function isSaveTranscriptsEnabled(displayHints) {
492
+ return displayHints.includes(_constants.DISPLAY_HINTS.SAVE_TRANSCRIPTS_ENABLED);
493
+ },
494
+ canStartTranscribing: function canStartTranscribing(displayHints) {
495
+ return displayHints.includes(_constants.DISPLAY_HINTS.TRANSCRIPTION_CONTROL_START);
496
+ },
497
+ canStopTranscribing: function canStopTranscribing(displayHints) {
498
+ return displayHints.includes(_constants.DISPLAY_HINTS.TRANSCRIPTION_CONTROL_STOP);
499
+ },
500
+ isClosedCaptionActive: function isClosedCaptionActive(displayHints) {
501
+ return displayHints.includes(_constants.DISPLAY_HINTS.CAPTION_STATUS_ACTIVE);
502
+ },
503
+ isWebexAssistantActive: function isWebexAssistantActive(displayHints) {
504
+ return displayHints.includes(_constants.DISPLAY_HINTS.WEBEX_ASSISTANT_STATUS_ACTIVE);
505
+ },
506
+ canViewCaptionPanel: function canViewCaptionPanel(displayHints) {
507
+ return displayHints.includes(_constants.DISPLAY_HINTS.ENABLE_CAPTION_PANEL);
508
+ },
509
+ isRealTimeTranslationEnabled: function isRealTimeTranslationEnabled(displayHints) {
510
+ return displayHints.includes(_constants.DISPLAY_HINTS.DISPLAY_REAL_TIME_TRANSLATION);
511
+ },
512
+ canSelectSpokenLanguages: function canSelectSpokenLanguages(displayHints) {
513
+ return displayHints.includes(_constants.DISPLAY_HINTS.DISPLAY_NON_ENGLISH_ASR);
514
+ },
515
+ waitingForOthersToJoin: function waitingForOthersToJoin(displayHints) {
516
+ return displayHints.includes(_constants.DISPLAY_HINTS.WAITING_FOR_OTHERS);
517
+ },
518
+ canSendReactions: function canSendReactions(originalValue, displayHints) {
519
+ if (displayHints.includes(_constants.DISPLAY_HINTS.REACTIONS_ACTIVE)) {
520
+ return true;
521
+ }
522
+ if (displayHints.includes(_constants.DISPLAY_HINTS.REACTIONS_INACTIVE)) {
523
+ return false;
524
+ }
525
+ return originalValue;
526
+ },
527
+ canUserRenameSelfAndObserved: function canUserRenameSelfAndObserved(displayHints) {
528
+ return displayHints.includes(_constants.DISPLAY_HINTS.CAN_RENAME_SELF_AND_OBSERVED);
529
+ },
530
+ canUserRenameOthers: function canUserRenameOthers(displayHints) {
531
+ return displayHints.includes(_constants.DISPLAY_HINTS.CAN_RENAME_OTHERS);
532
+ },
533
+ canShareWhiteBoard: function canShareWhiteBoard(displayHints) {
534
+ return displayHints.includes(_constants.DISPLAY_HINTS.SHARE_WHITEBOARD);
535
+ },
536
+ /**
537
+ * Adds the current locus sequence information to a request body
538
+ * @param {Object} meeting The meeting object
539
+ * @param {Object} requestBody The body of a request to locus
540
+ * @returns {void}
541
+ */
542
+ addSequence: function addSequence(meeting, requestBody) {
543
+ var _meeting$locusInfo;
544
+ var sequence = meeting === null || meeting === void 0 ? void 0 : (_meeting$locusInfo = meeting.locusInfo) === null || _meeting$locusInfo === void 0 ? void 0 : _meeting$locusInfo.sequence;
545
+ if (!sequence) {
546
+ return;
547
+ }
548
+ requestBody.sequence = sequence;
549
+ },
550
+ /**
551
+ * Updates the locus info for the meeting with the delta locus
552
+ * returned from requests that include the sequence information
553
+ * Returns the original response object
554
+ * @param {Object} meeting The meeting object
555
+ * @param {Object} response The response of the http request
556
+ * @returns {Object}
557
+ */
558
+ updateLocusWithDelta: function updateLocusWithDelta(meeting, response) {
559
+ var _response$body2;
560
+ if (!meeting) {
561
+ return response;
562
+ }
563
+ var locus = response === null || response === void 0 ? void 0 : (_response$body2 = response.body) === null || _response$body2 === void 0 ? void 0 : _response$body2.locus;
564
+ if (locus) {
565
+ meeting.locusInfo.handleLocusDelta(locus, meeting);
566
+ }
567
+ return response;
568
+ },
569
+ generateBuildLocusDeltaRequestOptions: function generateBuildLocusDeltaRequestOptions(originalMeeting) {
570
+ var meetingRef = new WeakRef(originalMeeting);
571
+ var buildLocusDeltaRequestOptions = function buildLocusDeltaRequestOptions(originalOptions) {
572
+ var meeting = meetingRef.deref();
573
+ if (!meeting) {
574
+ return originalOptions;
575
+ }
576
+ var options = (0, _cloneDeep2.default)(originalOptions);
577
+ if (!options.body) {
578
+ options.body = {};
579
+ }
580
+ MeetingUtil.addSequence(meeting, options.body);
581
+ return options;
582
+ };
583
+ return buildLocusDeltaRequestOptions;
584
+ },
585
+ generateLocusDeltaRequest: function generateLocusDeltaRequest(originalMeeting) {
586
+ var meetingRef = new WeakRef(originalMeeting);
587
+ var buildLocusDeltaRequestOptions = MeetingUtil.generateBuildLocusDeltaRequestOptions(originalMeeting);
588
+ var locusDeltaRequest = function locusDeltaRequest(originalOptions) {
589
+ var meeting = meetingRef.deref();
590
+ if (!meeting) {
591
+ return _promise.default.resolve();
592
+ }
593
+ var options = buildLocusDeltaRequestOptions(originalOptions);
594
+ return meeting.request(options).then(function (response) {
595
+ return MeetingUtil.updateLocusWithDelta(meeting, response);
596
+ });
597
+ };
598
+ return locusDeltaRequest;
599
+ },
600
+ selfSupportsFeature: function selfSupportsFeature(feature, userPolicies) {
601
+ if (!userPolicies) {
602
+ return true;
603
+ }
604
+ return userPolicies[feature];
605
+ },
606
+ parseInterpretationInfo: function parseInterpretationInfo(meeting, meetingInfo) {
607
+ var _meetingInfo$meetingS;
608
+ if (!meeting || !meetingInfo) {
609
+ return;
610
+ }
611
+ var siInfo = meetingInfo.simultaneousInterpretation;
612
+ meeting.simultaneousInterpretation.updateMeetingSIEnabled(!!meetingInfo.turnOnSimultaneousInterpretation, !!(siInfo !== null && siInfo !== void 0 && siInfo.currentSIInterpreter));
613
+ var hostSIEnabled = !!(meetingInfo.turnOnSimultaneousInterpretation && meetingInfo !== null && meetingInfo !== void 0 && (_meetingInfo$meetingS = meetingInfo.meetingSiteSetting) !== null && _meetingInfo$meetingS !== void 0 && _meetingInfo$meetingS.enableHostInterpreterControlSI);
614
+ meeting.simultaneousInterpretation.updateHostSIEnabled(hostSIEnabled);
615
+ function renameKey(obj, oldKey, newKey) {
616
+ if (oldKey in obj) {
617
+ obj[newKey] = obj[oldKey];
618
+ delete obj[oldKey];
619
+ }
620
+ }
621
+ if (siInfo) {
622
+ var _meeting$simultaneous, _meeting$simultaneous2;
623
+ var lanuagesInfo = (0, _cloneDeep2.default)(siInfo.siLanguages);
624
+ var _iterator = _createForOfIteratorHelper(lanuagesInfo),
625
+ _step;
626
+ try {
627
+ for (_iterator.s(); !(_step = _iterator.n()).done;) {
628
+ var language = _step.value;
629
+ renameKey(language, 'languageCode', 'languageName');
630
+ renameKey(language, 'languageGroupId', 'languageCode');
631
+ }
632
+ } catch (err) {
633
+ _iterator.e(err);
634
+ } finally {
635
+ _iterator.f();
636
+ }
637
+ if (!((_meeting$simultaneous = meeting.simultaneousInterpretation) !== null && _meeting$simultaneous !== void 0 && (_meeting$simultaneous2 = _meeting$simultaneous.siLanguages) !== null && _meeting$simultaneous2 !== void 0 && _meeting$simultaneous2.length)) {
638
+ meeting.simultaneousInterpretation.updateInterpretation({
639
+ siLanguages: lanuagesInfo
640
+ });
641
+ }
642
+ }
643
+ _triggerProxy.default.trigger(meeting, {
644
+ file: 'meeting/util',
645
+ function: 'parseInterpretationInfo'
646
+ }, _constants.EVENT_TRIGGERS.MEETING_INTERPRETATION_UPDATE);
372
647
  }
373
- return _promise.default.reject(new _permission.default('Unlock not allowed, due to joined property.'));
374
- };
375
- MeetingUtil.handleAudioLogging = function (audioTrack) {
376
- var LOG_HEADER = 'MeetingUtil#handleAudioLogging -->';
377
- if (audioTrack) {
378
- var settings = audioTrack.getSettings();
379
- var deviceId = settings.deviceId;
380
- _loggerProxy.default.logger.log(LOG_HEADER, "deviceId = ".concat(deviceId));
381
- _loggerProxy.default.logger.log(LOG_HEADER, 'settings =', (0, _stringify.default)(settings));
382
- }
383
- };
384
- MeetingUtil.handleVideoLogging = function (videoTrack) {
385
- var LOG_HEADER = 'MeetingUtil#handleVideoLogging -->';
386
- if (videoTrack) {
387
- var settings = videoTrack.getSettings();
388
- var deviceId = settings.deviceId;
389
- _loggerProxy.default.logger.log(LOG_HEADER, "deviceId = ".concat(deviceId));
390
- _loggerProxy.default.logger.log(LOG_HEADER, 'settings =', (0, _stringify.default)(settings));
391
- }
392
- };
393
- MeetingUtil.handleDeviceLogging = function () {
394
- var devices = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
395
- var LOG_HEADER = 'MeetingUtil#handleDeviceLogging -->';
396
- devices.forEach(function (device) {
397
- _loggerProxy.default.logger.log(LOG_HEADER, "deviceId = ".concat(device.deviceId));
398
- _loggerProxy.default.logger.log(LOG_HEADER, 'settings', (0, _stringify.default)(device));
399
- });
400
- };
401
- MeetingUtil.endMeetingForAll = function (meeting) {
402
- if (meeting.meetingState === _constants.FULL_STATE.INACTIVE) {
403
- return _promise.default.reject(new _webexErrors.MeetingNotActiveError());
404
- }
405
- var endOptions = {
406
- locusUrl: meeting.locusUrl
407
- };
408
- return meeting.meetingRequest.endMeetingForAll(endOptions).then(function (response) {
409
- if (response && response.body && response.body.locus) {
410
- meeting.locusInfo.onFullLocus(response.body.locus);
411
- }
412
- return _promise.default.resolve();
413
- }).then(function () {
414
- return MeetingUtil.cleanUp(meeting);
415
- }).catch(function (err) {
416
- _loggerProxy.default.logger.error("Meeting:util#endMeetingForAll An error occured while trying to end meeting for all with an id of ".concat(meeting.id, ", error: ").concat(err));
417
- return _promise.default.reject(err);
418
- });
419
- };
420
- MeetingUtil.canEnableClosedCaption = function (displayHints) {
421
- return displayHints.includes(_constants.DISPLAY_HINTS.CAPTION_START);
422
- };
423
- MeetingUtil.canStartTranscribing = function (displayHints) {
424
- return displayHints.includes(_constants.DISPLAY_HINTS.TRANSCRIPTION_CONTROL_START);
425
- };
426
- MeetingUtil.canStopTranscribing = function (displayHints) {
427
- return displayHints.includes(_constants.DISPLAY_HINTS.TRANSCRIPTION_CONTROL_STOP);
428
- };
429
- MeetingUtil.isClosedCaptionActive = function (displayHints) {
430
- return displayHints.includes(_constants.DISPLAY_HINTS.CAPTION_STATUS_ACTIVE);
431
- };
432
- MeetingUtil.isWebexAssistantActive = function (displayHints) {
433
- return displayHints.includes(_constants.DISPLAY_HINTS.WEBEX_ASSISTANT_STATUS_ACTIVE);
434
- };
435
- MeetingUtil.canViewCaptionPanel = function (displayHints) {
436
- return displayHints.includes(_constants.DISPLAY_HINTS.ENABLE_CAPTION_PANEL);
437
- };
438
- MeetingUtil.isRealTimeTranslationEnabled = function (displayHints) {
439
- return displayHints.includes(_constants.DISPLAY_HINTS.DISPLAY_REAL_TIME_TRANSLATION);
440
- };
441
- MeetingUtil.canSelectSpokenLanguages = function (displayHints) {
442
- return displayHints.includes(_constants.DISPLAY_HINTS.DISPLAY_NON_ENGLISH_ASR);
443
- };
444
- MeetingUtil.waitingForOthersToJoin = function (displayHints) {
445
- return displayHints.includes(_constants.DISPLAY_HINTS.WAITING_FOR_OTHERS);
446
- };
447
- MeetingUtil.canEnableReactions = function (originalValue, displayHints) {
448
- if (displayHints.includes(_constants.DISPLAY_HINTS.ENABLE_REACTIONS)) {
449
- return true;
450
- }
451
- if (displayHints.includes(_constants.DISPLAY_HINTS.DISABLE_REACTIONS)) {
452
- return false;
453
- }
454
- return originalValue;
455
- };
456
- MeetingUtil.canSendReactions = function (originalValue, displayHints) {
457
- if (displayHints.includes(_constants.DISPLAY_HINTS.REACTIONS_ACTIVE)) {
458
- return true;
459
- }
460
- if (displayHints.includes(_constants.DISPLAY_HINTS.REACTIONS_INACTIVE)) {
461
- return false;
462
- }
463
- return originalValue;
464
648
  };
465
649
  var _default = MeetingUtil;
466
650
  exports.default = _default;