@webex/plugin-meetings 3.0.0-beta.14 → 3.0.0-beta.141

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 (519) hide show
  1. package/README.md +45 -1
  2. package/UPGRADING.md +9 -9
  3. package/browsers.js +19 -24
  4. package/dist/annotation/annotation.types.js +7 -0
  5. package/dist/annotation/annotation.types.js.map +1 -0
  6. package/dist/annotation/constants.js +48 -0
  7. package/dist/annotation/constants.js.map +1 -0
  8. package/dist/annotation/index.js +355 -0
  9. package/dist/annotation/index.js.map +1 -0
  10. package/dist/breakouts/breakout.js +193 -0
  11. package/dist/breakouts/breakout.js.map +1 -0
  12. package/dist/breakouts/collection.js +23 -0
  13. package/dist/breakouts/collection.js.map +1 -0
  14. package/dist/breakouts/edit-lock-error.js +52 -0
  15. package/dist/breakouts/edit-lock-error.js.map +1 -0
  16. package/dist/breakouts/events.js +43 -0
  17. package/dist/breakouts/events.js.map +1 -0
  18. package/dist/breakouts/index.js +1012 -0
  19. package/dist/breakouts/index.js.map +1 -0
  20. package/dist/breakouts/request.js +78 -0
  21. package/dist/breakouts/request.js.map +1 -0
  22. package/dist/breakouts/utils.js +67 -0
  23. package/dist/breakouts/utils.js.map +1 -0
  24. package/dist/common/browser-detection.js +1 -20
  25. package/dist/common/browser-detection.js.map +1 -1
  26. package/dist/common/collection.js +5 -20
  27. package/dist/common/collection.js.map +1 -1
  28. package/dist/common/config.js +0 -7
  29. package/dist/common/config.js.map +1 -1
  30. package/dist/common/errors/captcha-error.js +5 -26
  31. package/dist/common/errors/captcha-error.js.map +1 -1
  32. package/dist/common/errors/intent-to-join.js +5 -26
  33. package/dist/common/errors/intent-to-join.js.map +1 -1
  34. package/dist/common/errors/join-meeting.js +6 -27
  35. package/dist/common/errors/join-meeting.js.map +1 -1
  36. package/dist/common/errors/media.js +5 -26
  37. package/dist/common/errors/media.js.map +1 -1
  38. package/dist/common/errors/parameter.js +5 -33
  39. package/dist/common/errors/parameter.js.map +1 -1
  40. package/dist/common/errors/password-error.js +5 -26
  41. package/dist/common/errors/password-error.js.map +1 -1
  42. package/dist/common/errors/permission.js +4 -25
  43. package/dist/common/errors/permission.js.map +1 -1
  44. package/dist/common/errors/reconnection-in-progress.js +0 -17
  45. package/dist/common/errors/reconnection-in-progress.js.map +1 -1
  46. package/dist/common/errors/reconnection.js +5 -26
  47. package/dist/common/errors/reconnection.js.map +1 -1
  48. package/dist/common/errors/stats.js +5 -26
  49. package/dist/common/errors/stats.js.map +1 -1
  50. package/dist/common/errors/webex-errors.js +6 -41
  51. package/dist/common/errors/webex-errors.js.map +1 -1
  52. package/dist/common/errors/webex-meetings-error.js +1 -24
  53. package/dist/common/errors/webex-meetings-error.js.map +1 -1
  54. package/dist/common/events/events-scope.js +0 -22
  55. package/dist/common/events/events-scope.js.map +1 -1
  56. package/dist/common/events/events.js +0 -23
  57. package/dist/common/events/events.js.map +1 -1
  58. package/dist/common/events/trigger-proxy.js +0 -12
  59. package/dist/common/events/trigger-proxy.js.map +1 -1
  60. package/dist/common/events/util.js +0 -15
  61. package/dist/common/events/util.js.map +1 -1
  62. package/dist/common/logs/logger-config.js +0 -4
  63. package/dist/common/logs/logger-config.js.map +1 -1
  64. package/dist/common/logs/logger-proxy.js +1 -8
  65. package/dist/common/logs/logger-proxy.js.map +1 -1
  66. package/dist/common/logs/request.js +35 -61
  67. package/dist/common/logs/request.js.map +1 -1
  68. package/dist/common/queue.js +4 -14
  69. package/dist/common/queue.js.map +1 -1
  70. package/dist/config.js +6 -6
  71. package/dist/config.js.map +1 -1
  72. package/dist/constants.js +204 -53
  73. package/dist/constants.js.map +1 -1
  74. package/dist/controls-options-manager/constants.js +14 -0
  75. package/dist/controls-options-manager/constants.js.map +1 -0
  76. package/dist/controls-options-manager/enums.js +27 -0
  77. package/dist/controls-options-manager/enums.js.map +1 -0
  78. package/dist/controls-options-manager/index.js +297 -0
  79. package/dist/controls-options-manager/index.js.map +1 -0
  80. package/dist/controls-options-manager/types.js +7 -0
  81. package/dist/controls-options-manager/types.js.map +1 -0
  82. package/dist/controls-options-manager/util.js +300 -0
  83. package/dist/controls-options-manager/util.js.map +1 -0
  84. package/dist/index.js +72 -17
  85. package/dist/index.js.map +1 -1
  86. package/dist/locus-info/controlsUtils.js +100 -29
  87. package/dist/locus-info/controlsUtils.js.map +1 -1
  88. package/dist/locus-info/embeddedAppsUtils.js +3 -26
  89. package/dist/locus-info/embeddedAppsUtils.js.map +1 -1
  90. package/dist/locus-info/fullState.js +0 -15
  91. package/dist/locus-info/fullState.js.map +1 -1
  92. package/dist/locus-info/hostUtils.js +4 -12
  93. package/dist/locus-info/hostUtils.js.map +1 -1
  94. package/dist/locus-info/index.js +398 -216
  95. package/dist/locus-info/index.js.map +1 -1
  96. package/dist/locus-info/infoUtils.js +0 -38
  97. package/dist/locus-info/infoUtils.js.map +1 -1
  98. package/dist/locus-info/mediaSharesUtils.js +54 -38
  99. package/dist/locus-info/mediaSharesUtils.js.map +1 -1
  100. package/dist/locus-info/parser.js +89 -124
  101. package/dist/locus-info/parser.js.map +1 -1
  102. package/dist/locus-info/selfUtils.js +94 -92
  103. package/dist/locus-info/selfUtils.js.map +1 -1
  104. package/dist/media/index.js +55 -165
  105. package/dist/media/index.js.map +1 -1
  106. package/dist/media/properties.js +71 -117
  107. package/dist/media/properties.js.map +1 -1
  108. package/dist/media/util.js +2 -9
  109. package/dist/media/util.js.map +1 -1
  110. package/dist/mediaQualityMetrics/config.js +505 -495
  111. package/dist/mediaQualityMetrics/config.js.map +1 -1
  112. package/dist/meeting/in-meeting-actions.js +77 -14
  113. package/dist/meeting/in-meeting-actions.js.map +1 -1
  114. package/dist/meeting/index.js +2576 -2455
  115. package/dist/meeting/index.js.map +1 -1
  116. package/dist/meeting/locusMediaRequest.js +291 -0
  117. package/dist/meeting/locusMediaRequest.js.map +1 -0
  118. package/dist/meeting/muteState.js +292 -138
  119. package/dist/meeting/muteState.js.map +1 -1
  120. package/dist/meeting/request.js +296 -342
  121. package/dist/meeting/request.js.map +1 -1
  122. package/dist/meeting/request.type.js +0 -1
  123. package/dist/meeting/request.type.js.map +1 -1
  124. package/dist/meeting/state.js +21 -31
  125. package/dist/meeting/state.js.map +1 -1
  126. package/dist/meeting/util.js +463 -583
  127. package/dist/meeting/util.js.map +1 -1
  128. package/dist/meeting-info/collection.js +3 -25
  129. package/dist/meeting-info/collection.js.map +1 -1
  130. package/dist/meeting-info/index.js +10 -33
  131. package/dist/meeting-info/index.js.map +1 -1
  132. package/dist/meeting-info/meeting-info-v2.js +305 -286
  133. package/dist/meeting-info/meeting-info-v2.js.map +1 -1
  134. package/dist/meeting-info/request.js +1 -16
  135. package/dist/meeting-info/request.js.map +1 -1
  136. package/dist/meeting-info/util.js +98 -183
  137. package/dist/meeting-info/util.js.map +1 -1
  138. package/dist/meeting-info/utilv2.js +156 -232
  139. package/dist/meeting-info/utilv2.js.map +1 -1
  140. package/dist/meetings/collection.js +24 -20
  141. package/dist/meetings/collection.js.map +1 -1
  142. package/dist/meetings/index.js +692 -593
  143. package/dist/meetings/index.js.map +1 -1
  144. package/dist/meetings/request.js +23 -42
  145. package/dist/meetings/request.js.map +1 -1
  146. package/dist/meetings/util.js +186 -155
  147. package/dist/meetings/util.js.map +1 -1
  148. package/dist/member/index.js +89 -88
  149. package/dist/member/index.js.map +1 -1
  150. package/dist/member/types.js +15 -0
  151. package/dist/member/types.js.map +1 -0
  152. package/dist/member/util.js +101 -69
  153. package/dist/member/util.js.map +1 -1
  154. package/dist/members/collection.js +12 -12
  155. package/dist/members/collection.js.map +1 -1
  156. package/dist/members/index.js +166 -205
  157. package/dist/members/index.js.map +1 -1
  158. package/dist/members/request.js +120 -85
  159. package/dist/members/request.js.map +1 -1
  160. package/dist/members/types.js +15 -0
  161. package/dist/members/types.js.map +1 -0
  162. package/dist/members/util.js +314 -260
  163. package/dist/members/util.js.map +1 -1
  164. package/dist/metrics/config.js +50 -16
  165. package/dist/metrics/config.js.map +1 -1
  166. package/dist/metrics/constants.js +4 -7
  167. package/dist/metrics/constants.js.map +1 -1
  168. package/dist/metrics/index.js +93 -162
  169. package/dist/metrics/index.js.map +1 -1
  170. package/dist/multistream/mediaRequestManager.js +170 -50
  171. package/dist/multistream/mediaRequestManager.js.map +1 -1
  172. package/dist/multistream/receiveSlot.js +58 -65
  173. package/dist/multistream/receiveSlot.js.map +1 -1
  174. package/dist/multistream/receiveSlotManager.js +74 -93
  175. package/dist/multistream/receiveSlotManager.js.map +1 -1
  176. package/dist/multistream/remoteMedia.js +55 -74
  177. package/dist/multistream/remoteMedia.js.map +1 -1
  178. package/dist/multistream/remoteMediaGroup.js +14 -40
  179. package/dist/multistream/remoteMediaGroup.js.map +1 -1
  180. package/dist/multistream/remoteMediaManager.js +481 -442
  181. package/dist/multistream/remoteMediaManager.js.map +1 -1
  182. package/dist/networkQualityMonitor/index.js +32 -59
  183. package/dist/networkQualityMonitor/index.js.map +1 -1
  184. package/dist/personal-meeting-room/index.js +10 -45
  185. package/dist/personal-meeting-room/index.js.map +1 -1
  186. package/dist/personal-meeting-room/request.js +2 -33
  187. package/dist/personal-meeting-room/request.js.map +1 -1
  188. package/dist/personal-meeting-room/util.js +0 -13
  189. package/dist/personal-meeting-room/util.js.map +1 -1
  190. package/dist/reachability/index.js +190 -199
  191. package/dist/reachability/index.js.map +1 -1
  192. package/dist/reachability/request.js +14 -23
  193. package/dist/reachability/request.js.map +1 -1
  194. package/dist/reactions/constants.js +13 -0
  195. package/dist/reactions/constants.js.map +1 -0
  196. package/dist/reactions/reactions.js +2 -4
  197. package/dist/reactions/reactions.js.map +1 -1
  198. package/dist/reactions/reactions.type.js +19 -23
  199. package/dist/reactions/reactions.type.js.map +1 -1
  200. package/dist/reconnection-manager/index.js +326 -465
  201. package/dist/reconnection-manager/index.js.map +1 -1
  202. package/dist/recording-controller/enums.js +17 -0
  203. package/dist/recording-controller/enums.js.map +1 -0
  204. package/dist/recording-controller/index.js +343 -0
  205. package/dist/recording-controller/index.js.map +1 -0
  206. package/dist/recording-controller/util.js +63 -0
  207. package/dist/recording-controller/util.js.map +1 -0
  208. package/dist/roap/index.js +31 -75
  209. package/dist/roap/index.js.map +1 -1
  210. package/dist/roap/request.js +129 -136
  211. package/dist/roap/request.js.map +1 -1
  212. package/dist/roap/turnDiscovery.js +143 -103
  213. package/dist/roap/turnDiscovery.js.map +1 -1
  214. package/dist/statsAnalyzer/global.js +1 -95
  215. package/dist/statsAnalyzer/global.js.map +1 -1
  216. package/dist/statsAnalyzer/index.js +369 -462
  217. package/dist/statsAnalyzer/index.js.map +1 -1
  218. package/dist/statsAnalyzer/mqaUtil.js +144 -94
  219. package/dist/statsAnalyzer/mqaUtil.js.map +1 -1
  220. package/dist/transcription/index.js +13 -45
  221. package/dist/transcription/index.js.map +1 -1
  222. package/dist/types/annotation/annotation.types.d.ts +35 -0
  223. package/dist/types/annotation/constants.d.ts +31 -0
  224. package/dist/types/annotation/index.d.ts +124 -0
  225. package/dist/types/breakouts/breakout.d.ts +8 -0
  226. package/dist/types/breakouts/collection.d.ts +5 -0
  227. package/dist/types/breakouts/edit-lock-error.d.ts +15 -0
  228. package/dist/types/breakouts/events.d.ts +2 -0
  229. package/dist/types/breakouts/index.d.ts +5 -0
  230. package/dist/types/breakouts/request.d.ts +22 -0
  231. package/dist/types/breakouts/utils.d.ts +15 -0
  232. package/dist/types/common/browser-detection.d.ts +9 -0
  233. package/dist/types/common/collection.d.ts +48 -0
  234. package/dist/types/common/config.d.ts +2 -0
  235. package/dist/types/common/errors/captcha-error.d.ts +15 -0
  236. package/dist/types/common/errors/intent-to-join.d.ts +16 -0
  237. package/dist/types/common/errors/join-meeting.d.ts +17 -0
  238. package/dist/types/common/errors/media.d.ts +15 -0
  239. package/dist/types/common/errors/parameter.d.ts +15 -0
  240. package/dist/types/common/errors/password-error.d.ts +15 -0
  241. package/dist/types/common/errors/permission.d.ts +14 -0
  242. package/dist/types/common/errors/reconnection-in-progress.d.ts +9 -0
  243. package/dist/types/common/errors/reconnection.d.ts +15 -0
  244. package/dist/types/common/errors/stats.d.ts +15 -0
  245. package/dist/types/common/errors/webex-errors.d.ts +69 -0
  246. package/dist/types/common/errors/webex-meetings-error.d.ts +20 -0
  247. package/dist/types/common/events/events-scope.d.ts +17 -0
  248. package/dist/types/common/events/events.d.ts +12 -0
  249. package/dist/types/common/events/trigger-proxy.d.ts +2 -0
  250. package/dist/types/common/events/util.d.ts +2 -0
  251. package/dist/types/common/logs/logger-config.d.ts +2 -0
  252. package/dist/types/common/logs/logger-proxy.d.ts +2 -0
  253. package/dist/types/common/logs/request.d.ts +34 -0
  254. package/dist/types/common/queue.d.ts +32 -0
  255. package/dist/types/config.d.ts +78 -0
  256. package/dist/types/constants.d.ts +994 -0
  257. package/dist/types/controls-options-manager/constants.d.ts +4 -0
  258. package/dist/types/controls-options-manager/enums.d.ts +15 -0
  259. package/dist/types/controls-options-manager/index.d.ts +136 -0
  260. package/dist/types/controls-options-manager/types.d.ts +43 -0
  261. package/dist/types/controls-options-manager/util.d.ts +1 -0
  262. package/dist/types/index.d.ts +7 -0
  263. package/dist/types/locus-info/controlsUtils.d.ts +2 -0
  264. package/dist/types/locus-info/embeddedAppsUtils.d.ts +2 -0
  265. package/dist/types/locus-info/fullState.d.ts +2 -0
  266. package/dist/types/locus-info/hostUtils.d.ts +2 -0
  267. package/dist/types/locus-info/index.d.ts +315 -0
  268. package/dist/types/locus-info/infoUtils.d.ts +2 -0
  269. package/dist/types/locus-info/mediaSharesUtils.d.ts +2 -0
  270. package/dist/types/locus-info/parser.d.ts +212 -0
  271. package/dist/types/locus-info/selfUtils.d.ts +2 -0
  272. package/dist/types/media/index.d.ts +34 -0
  273. package/dist/types/media/properties.d.ts +108 -0
  274. package/dist/types/media/util.d.ts +2 -0
  275. package/dist/types/mediaQualityMetrics/config.d.ts +365 -0
  276. package/dist/types/meeting/in-meeting-actions.d.ts +147 -0
  277. package/dist/types/meeting/index.d.ts +1762 -0
  278. package/dist/types/meeting/locusMediaRequest.d.ts +70 -0
  279. package/dist/types/meeting/muteState.d.ts +186 -0
  280. package/dist/types/meeting/request.d.ts +269 -0
  281. package/dist/types/meeting/request.type.d.ts +11 -0
  282. package/dist/types/meeting/state.d.ts +9 -0
  283. package/dist/types/meeting/util.d.ts +76 -0
  284. package/dist/types/meeting-info/collection.d.ts +20 -0
  285. package/dist/types/meeting-info/index.d.ts +57 -0
  286. package/dist/types/meeting-info/meeting-info-v2.d.ts +122 -0
  287. package/dist/types/meeting-info/request.d.ts +22 -0
  288. package/dist/types/meeting-info/util.d.ts +2 -0
  289. package/dist/types/meeting-info/utilv2.d.ts +2 -0
  290. package/dist/types/meetings/collection.d.ts +31 -0
  291. package/dist/types/meetings/index.d.ts +345 -0
  292. package/dist/types/meetings/request.d.ts +27 -0
  293. package/dist/types/meetings/util.d.ts +18 -0
  294. package/dist/types/member/index.d.ts +157 -0
  295. package/dist/types/member/types.d.ts +21 -0
  296. package/dist/types/member/util.d.ts +2 -0
  297. package/dist/types/members/collection.d.ts +29 -0
  298. package/dist/types/members/index.d.ts +353 -0
  299. package/dist/types/members/request.d.ts +114 -0
  300. package/dist/types/members/types.d.ts +24 -0
  301. package/dist/types/members/util.d.ts +210 -0
  302. package/dist/types/metrics/config.d.ts +195 -0
  303. package/dist/types/metrics/constants.d.ts +55 -0
  304. package/dist/types/metrics/index.d.ts +169 -0
  305. package/dist/types/multistream/mediaRequestManager.d.ts +104 -0
  306. package/dist/types/multistream/receiveSlot.d.ts +68 -0
  307. package/dist/types/multistream/receiveSlotManager.d.ts +56 -0
  308. package/dist/types/multistream/remoteMedia.d.ts +72 -0
  309. package/dist/types/multistream/remoteMediaGroup.d.ts +48 -0
  310. package/dist/types/multistream/remoteMediaManager.d.ts +267 -0
  311. package/dist/types/networkQualityMonitor/index.d.ts +70 -0
  312. package/dist/types/personal-meeting-room/index.d.ts +47 -0
  313. package/dist/types/personal-meeting-room/request.d.ts +14 -0
  314. package/dist/types/personal-meeting-room/util.d.ts +2 -0
  315. package/dist/types/reachability/index.d.ts +152 -0
  316. package/dist/types/reachability/request.d.ts +37 -0
  317. package/dist/types/reactions/constants.d.ts +3 -0
  318. package/dist/types/reactions/reactions.d.ts +4 -0
  319. package/dist/types/reactions/reactions.type.d.ts +52 -0
  320. package/dist/types/reconnection-manager/index.d.ts +126 -0
  321. package/dist/types/recording-controller/enums.d.ts +7 -0
  322. package/dist/types/recording-controller/index.d.ts +193 -0
  323. package/dist/types/recording-controller/util.d.ts +13 -0
  324. package/dist/types/roap/index.d.ts +77 -0
  325. package/dist/types/roap/request.d.ts +36 -0
  326. package/dist/types/roap/turnDiscovery.d.ts +91 -0
  327. package/dist/types/statsAnalyzer/global.d.ts +36 -0
  328. package/dist/types/statsAnalyzer/index.d.ts +200 -0
  329. package/dist/types/statsAnalyzer/mqaUtil.d.ts +24 -0
  330. package/dist/types/transcription/index.d.ts +64 -0
  331. package/internal-README.md +7 -6
  332. package/package.json +28 -21
  333. package/src/annotation/annotation.types.ts +42 -0
  334. package/src/annotation/constants.ts +36 -0
  335. package/src/annotation/index.ts +339 -0
  336. package/src/breakouts/README.md +220 -0
  337. package/src/breakouts/breakout.ts +163 -0
  338. package/src/breakouts/collection.ts +19 -0
  339. package/src/breakouts/edit-lock-error.ts +25 -0
  340. package/src/breakouts/events.ts +37 -0
  341. package/src/breakouts/index.ts +888 -0
  342. package/src/breakouts/request.ts +55 -0
  343. package/src/breakouts/utils.ts +57 -0
  344. package/src/common/browser-detection.ts +9 -6
  345. package/src/common/collection.ts +3 -1
  346. package/src/common/errors/captcha-error.ts +6 -6
  347. package/src/common/errors/intent-to-join.ts +6 -6
  348. package/src/common/errors/join-meeting.ts +12 -8
  349. package/src/common/errors/media.ts +6 -6
  350. package/src/common/errors/parameter.ts +9 -6
  351. package/src/common/errors/password-error.ts +6 -6
  352. package/src/common/errors/permission.ts +5 -5
  353. package/src/common/errors/reconnection.ts +6 -6
  354. package/src/common/errors/stats.ts +6 -6
  355. package/src/common/errors/webex-errors.ts +7 -5
  356. package/src/common/errors/webex-meetings-error.ts +1 -1
  357. package/src/common/events/events-scope.ts +5 -1
  358. package/src/common/events/events.ts +5 -1
  359. package/src/common/events/trigger-proxy.ts +8 -3
  360. package/src/common/events/util.ts +1 -2
  361. package/src/common/logs/logger-proxy.ts +22 -11
  362. package/src/common/logs/request.ts +11 -8
  363. package/src/config.ts +16 -12
  364. package/src/constants.ts +154 -7
  365. package/src/controls-options-manager/constants.ts +5 -0
  366. package/src/controls-options-manager/enums.ts +18 -0
  367. package/src/controls-options-manager/index.ts +278 -0
  368. package/src/controls-options-manager/types.ts +59 -0
  369. package/src/controls-options-manager/util.ts +286 -0
  370. package/src/index.ts +33 -0
  371. package/src/locus-info/controlsUtils.ts +142 -24
  372. package/src/locus-info/fullState.ts +15 -11
  373. package/src/locus-info/hostUtils.ts +4 -3
  374. package/src/locus-info/index.ts +335 -55
  375. package/src/locus-info/infoUtils.ts +12 -4
  376. package/src/locus-info/mediaSharesUtils.ts +52 -4
  377. package/src/locus-info/parser.ts +47 -69
  378. package/src/locus-info/selfUtils.ts +175 -56
  379. package/src/media/index.ts +139 -196
  380. package/src/media/properties.ts +43 -36
  381. package/src/media/util.ts +1 -1
  382. package/src/mediaQualityMetrics/config.ts +380 -378
  383. package/src/meeting/in-meeting-actions.ts +159 -3
  384. package/src/meeting/index.ts +2809 -1589
  385. package/src/meeting/locusMediaRequest.ts +309 -0
  386. package/src/meeting/muteState.ts +290 -72
  387. package/src/meeting/request.ts +229 -182
  388. package/src/meeting/request.type.ts +10 -8
  389. package/src/meeting/state.ts +45 -30
  390. package/src/meeting/util.ts +445 -395
  391. package/src/meeting-info/collection.ts +2 -1
  392. package/src/meeting-info/index.ts +32 -30
  393. package/src/meeting-info/meeting-info-v2.ts +235 -116
  394. package/src/meeting-info/request.ts +9 -3
  395. package/src/meeting-info/util.ts +54 -46
  396. package/src/meeting-info/utilv2.ts +71 -55
  397. package/src/meetings/collection.ts +21 -1
  398. package/src/meetings/index.ts +771 -437
  399. package/src/meetings/request.ts +29 -25
  400. package/src/meetings/util.ts +132 -33
  401. package/src/member/index.ts +95 -49
  402. package/src/member/types.ts +24 -0
  403. package/src/member/util.ts +106 -13
  404. package/src/members/collection.ts +8 -1
  405. package/src/members/index.ts +288 -130
  406. package/src/members/request.ts +144 -31
  407. package/src/members/types.ts +28 -0
  408. package/src/members/util.ts +316 -235
  409. package/src/metrics/config.ts +302 -90
  410. package/src/metrics/constants.ts +2 -6
  411. package/src/metrics/index.ts +124 -95
  412. package/src/multistream/mediaRequestManager.ts +210 -45
  413. package/src/multistream/receiveSlot.ts +69 -26
  414. package/src/multistream/receiveSlotManager.ts +62 -38
  415. package/src/multistream/remoteMedia.ts +30 -4
  416. package/src/multistream/remoteMediaGroup.ts +11 -3
  417. package/src/multistream/remoteMediaManager.ts +245 -66
  418. package/src/networkQualityMonitor/index.ts +24 -27
  419. package/src/personal-meeting-room/index.ts +12 -16
  420. package/src/personal-meeting-room/request.ts +10 -3
  421. package/src/personal-meeting-room/util.ts +3 -3
  422. package/src/reachability/index.ts +131 -79
  423. package/src/reachability/request.ts +43 -34
  424. package/src/reactions/constants.ts +4 -0
  425. package/src/reactions/reactions.ts +8 -8
  426. package/src/reactions/reactions.type.ts +31 -5
  427. package/src/reconnection-manager/index.ts +193 -112
  428. package/src/recording-controller/enums.ts +8 -0
  429. package/src/recording-controller/index.ts +315 -0
  430. package/src/recording-controller/util.ts +58 -0
  431. package/src/roap/index.ts +53 -53
  432. package/src/roap/request.ts +77 -65
  433. package/src/roap/turnDiscovery.ts +101 -48
  434. package/src/statsAnalyzer/global.ts +8 -104
  435. package/src/statsAnalyzer/index.ts +624 -377
  436. package/src/statsAnalyzer/mqaUtil.ts +203 -90
  437. package/src/transcription/index.ts +34 -32
  438. package/test/integration/spec/converged-space-meetings.js +177 -0
  439. package/test/integration/spec/journey.js +670 -466
  440. package/test/integration/spec/space-meeting.js +320 -204
  441. package/test/integration/spec/transcription.js +7 -8
  442. package/test/unit/spec/annotation/index.ts +433 -0
  443. package/test/unit/spec/breakouts/breakout.ts +203 -0
  444. package/test/unit/spec/breakouts/collection.ts +15 -0
  445. package/test/unit/spec/breakouts/edit-lock-error.ts +30 -0
  446. package/test/unit/spec/breakouts/events.ts +77 -0
  447. package/test/unit/spec/breakouts/index.ts +1685 -0
  448. package/test/unit/spec/breakouts/request.ts +104 -0
  449. package/test/unit/spec/breakouts/utils.js +72 -0
  450. package/test/unit/spec/common/browser-detection.js +9 -28
  451. package/test/unit/spec/controls-options-manager/index.js +287 -0
  452. package/test/unit/spec/controls-options-manager/util.js +518 -0
  453. package/test/unit/spec/fixture/locus.js +93 -90
  454. package/test/unit/spec/locus-info/controlsUtils.js +305 -32
  455. package/test/unit/spec/locus-info/embeddedAppsUtils.js +8 -6
  456. package/test/unit/spec/locus-info/index.js +615 -5
  457. package/test/unit/spec/locus-info/infoUtils.js +26 -33
  458. package/test/unit/spec/locus-info/lib/BasicSeqCmp.json +88 -430
  459. package/test/unit/spec/locus-info/lib/SeqCmp.json +513 -685
  460. package/test/unit/spec/locus-info/mediaSharesUtils.ts +22 -0
  461. package/test/unit/spec/locus-info/parser.js +3 -9
  462. package/test/unit/spec/locus-info/selfConstant.js +110 -103
  463. package/test/unit/spec/locus-info/selfUtils.js +221 -12
  464. package/test/unit/spec/media/index.ts +104 -8
  465. package/test/unit/spec/media/properties.ts +9 -9
  466. package/test/unit/spec/meeting/in-meeting-actions.ts +76 -3
  467. package/test/unit/spec/meeting/index.js +3077 -923
  468. package/test/unit/spec/meeting/locusMediaRequest.ts +436 -0
  469. package/test/unit/spec/meeting/muteState.js +421 -94
  470. package/test/unit/spec/meeting/request.js +408 -85
  471. package/test/unit/spec/meeting/utils.js +326 -189
  472. package/test/unit/spec/meeting-info/meetinginfov2.js +481 -76
  473. package/test/unit/spec/meeting-info/request.js +7 -9
  474. package/test/unit/spec/meeting-info/util.js +11 -12
  475. package/test/unit/spec/meeting-info/utilv2.js +131 -74
  476. package/test/unit/spec/meetings/collection.js +15 -1
  477. package/test/unit/spec/meetings/index.js +1126 -328
  478. package/test/unit/spec/meetings/utils.js +220 -14
  479. package/test/unit/spec/member/index.js +24 -1
  480. package/test/unit/spec/member/util.js +383 -32
  481. package/test/unit/spec/members/index.js +424 -55
  482. package/test/unit/spec/members/request.js +228 -40
  483. package/test/unit/spec/members/utils.js +191 -4
  484. package/test/unit/spec/metrics/index.js +113 -20
  485. package/test/unit/spec/multistream/mediaRequestManager.ts +676 -105
  486. package/test/unit/spec/multistream/receiveSlot.ts +76 -17
  487. package/test/unit/spec/multistream/receiveSlotManager.ts +69 -39
  488. package/test/unit/spec/multistream/remoteMedia.ts +32 -2
  489. package/test/unit/spec/multistream/remoteMediaGroup.ts +52 -5
  490. package/test/unit/spec/multistream/remoteMediaManager.ts +585 -65
  491. package/test/unit/spec/networkQualityMonitor/index.js +24 -18
  492. package/test/unit/spec/personal-meeting-room/personal-meeting-room.js +2 -7
  493. package/test/unit/spec/reachability/index.ts +176 -27
  494. package/test/unit/spec/reachability/request.js +66 -0
  495. package/test/unit/spec/reconnection-manager/index.js +62 -31
  496. package/test/unit/spec/recording-controller/index.js +231 -0
  497. package/test/unit/spec/recording-controller/util.js +102 -0
  498. package/test/unit/spec/roap/index.ts +19 -49
  499. package/test/unit/spec/roap/request.ts +187 -0
  500. package/test/unit/spec/roap/turnDiscovery.ts +92 -50
  501. package/test/unit/spec/stats-analyzer/index.js +116 -60
  502. package/test/utils/cmr.js +44 -42
  503. package/test/utils/constants.js +9 -0
  504. package/test/utils/integrationTestUtils.js +64 -0
  505. package/test/utils/testUtils.js +63 -99
  506. package/test/utils/webex-config.js +22 -18
  507. package/test/utils/webex-test-users.js +57 -50
  508. package/tsconfig.json +6 -0
  509. package/dist/media/internal-media-core-wrapper.js +0 -22
  510. package/dist/media/internal-media-core-wrapper.js.map +0 -1
  511. package/dist/meeting/effectsState.js +0 -334
  512. package/dist/meeting/effectsState.js.map +0 -1
  513. package/dist/multistream/multistreamMedia.js +0 -116
  514. package/dist/multistream/multistreamMedia.js.map +0 -1
  515. package/src/index.js +0 -15
  516. package/src/media/internal-media-core-wrapper.ts +0 -9
  517. package/src/meeting/effectsState.ts +0 -211
  518. package/src/multistream/multistreamMedia.ts +0 -92
  519. package/test/unit/spec/meeting/effectsState.js +0 -291
@@ -0,0 +1,1685 @@
1
+ import {assert, expect} from '@webex/test-helper-chai';
2
+ import Breakouts from '@webex/plugin-meetings/src/breakouts';
3
+ import LoggerProxy from '@webex/plugin-meetings/src/common/logs/logger-proxy';
4
+ import {BREAKOUTS} from '@webex/plugin-meetings/src/constants';
5
+ import sinon from 'sinon';
6
+ import MockWebex from '@webex/test-helper-mock-webex';
7
+ import testUtils from '../../../utils/testUtils';
8
+ import BreakoutEditLockedError from '@webex/plugin-meetings/src/breakouts/edit-lock-error';
9
+ import breakoutEvent from '../../../../src/breakouts/events';
10
+
11
+ const getBOResponse = (status: string) => {
12
+ return {
13
+ url: 'url',
14
+ locusUrl: 'locusUrl',
15
+ mainGroupId: 'mainGroupId',
16
+ mainSessionId: 'mainSessionId',
17
+ groups: [
18
+ {
19
+ id: 'groupId',
20
+ type: 'BREAKOUT',
21
+ status,
22
+ duration: 60000,
23
+ durationSetting: 60000,
24
+ delayCloseTime: 60,
25
+ allowBackToMain: true,
26
+ allowToJoinLater: true,
27
+ startTime: '2023-02-01T23:08:43.200Z',
28
+ sessions: [
29
+ {
30
+ name: 'Breakout Session 1',
31
+ subConfId: 1,
32
+ anyoneCanJoin: false,
33
+ locusUrl: 'locusUrl',
34
+ venueUrl: 'venueUrl',
35
+ allowed: ['allowed id1', 'allowed id2'],
36
+ id: 'sessionId1',
37
+ },
38
+ {
39
+ name: 'Breakout Session 2',
40
+ anyoneCanJoin: true,
41
+ locusUrl: 'locusUrl',
42
+ allowed: ['allowed id3', 'allowed id4'],
43
+ id: 'sessionId2',
44
+ },
45
+ ],
46
+ },
47
+ ],
48
+ };
49
+ };
50
+
51
+ const getBOResponseWithEditLockInfo = (status: string, withOutToken?: boolean) => {
52
+ return {
53
+ url: 'url',
54
+ locusUrl: 'locusUrl',
55
+ mainGroupId: 'mainGroupId',
56
+ mainSessionId: 'mainSessionId',
57
+ editlock: {
58
+ state: 'LOCKED',
59
+ ttl: 30,
60
+ userId: 'cc5d452f-04b6-4876-a4c3-28ca21982c6a',
61
+ token: withOutToken ? '' : 'token1',
62
+ },
63
+ groups: [
64
+ {
65
+ sessions: [
66
+ {
67
+ name: 'Breakout Session 1',
68
+ subConfId: 1,
69
+ anyoneCanJoin: false,
70
+ locusUrl: 'locusUrl',
71
+ venueUrl: 'venueUrl',
72
+ allowed: ['allowed id1', 'allowed id2'],
73
+ id: 'sessionId1',
74
+ },
75
+ ],
76
+ },
77
+ ],
78
+ };
79
+ };
80
+
81
+ describe('plugin-meetings', () => {
82
+ describe('Breakouts', () => {
83
+ let webex;
84
+ let breakouts;
85
+
86
+ beforeEach(() => {
87
+ // @ts-ignore
88
+ webex = new MockWebex({});
89
+ webex.internal.llm.on = sinon.stub();
90
+ webex.internal.mercury.on = sinon.stub();
91
+ breakouts = new Breakouts({}, {parent: webex});
92
+ breakouts.groupId = 'groupId';
93
+ breakouts.sessionId = 'sessionId';
94
+ breakouts.url = 'url';
95
+ breakouts.locusUrl = 'locusUrl';
96
+ breakouts.breakoutServiceUrl = 'breakoutServiceUrl';
97
+ webex.request = sinon.stub().returns(Promise.resolve('REQUEST_RETURN_VALUE'));
98
+ webex.meetings = {};
99
+ webex.meetings.getMeetingByType = sinon.stub();
100
+ });
101
+
102
+ describe('#initialize', () => {
103
+ it('creates Breakouts as expected', () => {
104
+ assert.equal(breakouts.namespace, 'Meetings');
105
+ });
106
+
107
+ it('emits BREAKOUTS_CLOSING event when the breakoutStatus is CLOSING', () => {
108
+ const checkIsCalled = (deps) => {
109
+ let called = false;
110
+ breakouts.listenTo(breakouts, BREAKOUTS.EVENTS.BREAKOUTS_CLOSING, () => {
111
+ called = true;
112
+ });
113
+ assert.isFalse(called);
114
+ breakouts.set(deps);
115
+ assert.isTrue(called);
116
+ }
117
+
118
+ checkIsCalled({
119
+ sessionType: BREAKOUTS.SESSION_TYPES.MAIN,
120
+ groups: [{status: BREAKOUTS.STATUS.CLOSING}],
121
+ status: undefined
122
+ });
123
+
124
+ checkIsCalled({
125
+ sessionType: BREAKOUTS.SESSION_TYPES.BREAKOUT,
126
+ groups: undefined,
127
+ status: BREAKOUTS.STATUS.CLOSING
128
+ });
129
+
130
+ });
131
+
132
+ it('debounces querying rosters on add', () => {
133
+ breakouts.debouncedQueryRosters = sinon.stub();
134
+ breakouts.breakouts.add({sessionType: 'MAIN'});
135
+
136
+ assert.calledOnceWithExactly(breakouts.debouncedQueryRosters);
137
+ });
138
+
139
+ it('call triggerReturnToMainEvent correctly when requested breakout add', () => {
140
+ breakouts.triggerReturnToMainEvent = sinon.stub();
141
+ breakouts.breakouts.add({sessionId: 'session1', sessionType: 'MAIN'});
142
+ assert.calledOnceWithExactly(breakouts.triggerReturnToMainEvent, breakouts.breakouts.get('session1'));
143
+ });
144
+
145
+ it('call triggerReturnToMainEvent correctly when breakout requestedLastModifiedTime change', () => {
146
+ breakouts.breakouts.add({sessionId: 'session1', sessionType: 'MAIN'});
147
+ breakouts.triggerReturnToMainEvent = sinon.stub();
148
+ breakouts.breakouts.get('session1').set({requestedLastModifiedTime: "2023-05-09T17:16:01.000Z"});
149
+ assert.calledOnceWithExactly(breakouts.triggerReturnToMainEvent, breakouts.breakouts.get('session1'));
150
+ });
151
+
152
+ it('call queryPreAssignments correctly when should query preAssignments is true', () => {
153
+ breakouts.queryPreAssignments = sinon.stub();
154
+ breakouts.set({
155
+ canManageBreakouts: true,
156
+ enableBreakoutSession: true,
157
+ hasBreakoutPreAssignments: true,
158
+ });
159
+ assert.calledThrice(breakouts.queryPreAssignments);
160
+ });
161
+ });
162
+
163
+ describe('#listenToCurrentSessionTypeChange', () => {
164
+ it('triggers leave breakout event when sessionType changed from SESSION to MAIN', () => {
165
+ const handler = sinon.stub();
166
+ breakouts.currentBreakoutSession.set({sessionType: BREAKOUTS.SESSION_TYPES.BREAKOUT})
167
+ breakouts.listenTo(breakouts, BREAKOUTS.EVENTS.LEAVE_BREAKOUT, handler);
168
+ breakouts.currentBreakoutSession.set({sessionType: BREAKOUTS.SESSION_TYPES.MAIN});
169
+
170
+ assert.calledOnceWithExactly(handler);
171
+
172
+ breakouts.stopListening(breakouts, BREAKOUTS.EVENTS.LEAVE_BREAKOUT, handler);
173
+ });
174
+
175
+ it('should not triggers leave breakout event when sessionType changed from undefined to MAIN', () => {
176
+ const handler = sinon.stub();
177
+ breakouts.currentBreakoutSession.set({sessionType: undefined})
178
+ breakouts.listenTo(breakouts, BREAKOUTS.EVENTS.LEAVE_BREAKOUT, handler);
179
+ breakouts.currentBreakoutSession.set({sessionType: BREAKOUTS.SESSION_TYPES.MAIN});
180
+
181
+ assert.notCalled(handler);
182
+
183
+ breakouts.stopListening(breakouts, BREAKOUTS.EVENTS.LEAVE_BREAKOUT, handler);
184
+ });
185
+
186
+ it('should not triggers leave breakout event when sessionType changed from MAIN to SESSION', () => {
187
+ const handler = sinon.stub();
188
+ breakouts.currentBreakoutSession.set({sessionType: BREAKOUTS.SESSION_TYPES.MAIN})
189
+ breakouts.listenTo(breakouts, BREAKOUTS.EVENTS.LEAVE_BREAKOUT, handler);
190
+ breakouts.currentBreakoutSession.set({sessionType: BREAKOUTS.SESSION_TYPES.BREAKOUT});
191
+
192
+ assert.notCalled(handler);
193
+
194
+ breakouts.stopListening(breakouts, BREAKOUTS.EVENTS.LEAVE_BREAKOUT, handler);
195
+ });
196
+ });
197
+
198
+ describe('#listenToBroadcastMessages', () => {
199
+ it('triggers message event when a message received', () => {
200
+ const call = webex.internal.llm.on.getCall(0);
201
+ const callback = call.args[1];
202
+
203
+ assert.equal(call.args[0], 'event:breakout.message');
204
+
205
+ let message;
206
+
207
+ breakouts.listenTo(breakouts, BREAKOUTS.EVENTS.MESSAGE, (event) => {
208
+ message = event;
209
+ });
210
+
211
+ breakouts.currentBreakoutSession.sessionId = 'sessionId';
212
+
213
+ callback({
214
+ data: {
215
+ senderUserId: 'senderUserId',
216
+ sentTime: 'sentTime',
217
+ message: 'message',
218
+ },
219
+ });
220
+
221
+ assert.deepEqual(message, {
222
+ senderUserId: 'senderUserId',
223
+ sentTime: 'sentTime',
224
+ message: 'message',
225
+ sessionId: 'sessionId',
226
+ });
227
+ });
228
+ });
229
+
230
+ describe('#listenToBreakoutRosters', () => {
231
+ it('triggers member update event when a roster received', () => {
232
+ const call = webex.internal.mercury.on.getCall(0);
233
+ const callback = call.args[1];
234
+
235
+ assert.equal(call.args[0], 'event:breakout.roster');
236
+
237
+ let called = false;
238
+
239
+ breakouts.listenTo(breakouts, BREAKOUTS.EVENTS.MEMBERS_UPDATE, () => {
240
+ called = true;
241
+ });
242
+ breakouts.handleRosterUpdate = sinon.stub();
243
+
244
+ callback({
245
+ data: {
246
+ locus: 'locus',
247
+ },
248
+ });
249
+
250
+ assert.isTrue(called);
251
+ assert.calledOnceWithExactly(breakouts.handleRosterUpdate, 'locus');
252
+ });
253
+ });
254
+
255
+ describe('#listenToBreakoutHelp', () => {
256
+ it('triggers ask for help event when a help received', () => {
257
+ const call = webex.internal.mercury.on.getCall(1);
258
+ const callback = call.args[1];
259
+
260
+ assert.equal(call.args[0], 'event:breakout.help');
261
+
262
+ let data;
263
+
264
+ breakouts.listenTo(breakouts, BREAKOUTS.EVENTS.ASK_FOR_HELP, (eventData) => {
265
+ data = eventData;
266
+ });
267
+
268
+ callback({
269
+ data: {
270
+ participant: 'participant',
271
+ sessionId: 'sessionId'
272
+ },
273
+ });
274
+
275
+ assert.deepEqual(data, {
276
+ participant: 'participant',
277
+ sessionId: 'sessionId',
278
+ });
279
+ });
280
+ });
281
+
282
+ describe('#updateBreakout', () => {
283
+ it('updates the current breakout session', () => {
284
+ breakouts.updateBreakout({
285
+ sessionId: 'sessionId',
286
+ groupId: 'groupId',
287
+ sessionType: 'sessionType',
288
+ url: 'url',
289
+ name: 'name',
290
+ allowBackToMain: true,
291
+ delayCloseTime: 10,
292
+ enableBreakoutSession: true,
293
+ startTime: 'startTime',
294
+ status: 'active',
295
+ locusUrl: 'locusUrl',
296
+ });
297
+
298
+ assert.equal(breakouts.allowBackToMain, true);
299
+ assert.equal(breakouts.delayCloseTime, 10);
300
+ assert.equal(breakouts.enableBreakoutSession, true);
301
+ assert.equal(breakouts.groupId, 'groupId');
302
+ assert.equal(breakouts.name, 'name');
303
+ assert.equal(breakouts.sessionId, 'sessionId');
304
+ assert.equal(breakouts.startTime, 'startTime');
305
+ assert.equal(breakouts.status, 'active');
306
+ assert.equal(breakouts.url, 'url');
307
+ assert.equal(breakouts.locusUrl, 'locusUrl');
308
+
309
+ assert.equal(breakouts.currentBreakoutSession.sessionId, 'sessionId');
310
+ assert.equal(breakouts.currentBreakoutSession.groupId, 'groupId');
311
+ assert.equal(breakouts.currentBreakoutSession.name, 'name');
312
+ assert.equal(breakouts.currentBreakoutSession.current, true);
313
+ assert.equal(breakouts.currentBreakoutSession.sessionType, 'sessionType');
314
+ assert.equal(breakouts.currentBreakoutSession.url, 'url');
315
+ assert.equal(breakouts.currentBreakoutSession.active, false);
316
+ assert.equal(breakouts.currentBreakoutSession.allowed, false);
317
+ assert.equal(breakouts.currentBreakoutSession.assigned, false);
318
+ assert.equal(breakouts.currentBreakoutSession.assignedCurrent, false);
319
+ assert.equal(breakouts.currentBreakoutSession.requested, false);
320
+ });
321
+
322
+ it('update the startTime correctly when no attribute startTime exists on params', () => {
323
+ breakouts.updateBreakout({
324
+ startTime: "startTime"
325
+ })
326
+ assert.equal(breakouts.startTime, 'startTime');
327
+
328
+ breakouts.updateBreakout({})
329
+ assert.equal(breakouts.startTime, undefined);
330
+ });
331
+
332
+ it('update the status correctly when no attribute status exists on params', () => {
333
+ breakouts.updateBreakout({
334
+ status: 'CLOSING'
335
+ })
336
+ assert.equal(breakouts.status, 'CLOSING');
337
+
338
+ breakouts.updateBreakout({})
339
+ assert.equal(breakouts.status, undefined);
340
+ })
341
+
342
+ it('updates the current breakout session, call onBreakoutJoinResponse when session changed', () => {
343
+ breakouts.webex.meetings = {
344
+ getMeetingByType: sinon.stub().returns({
345
+ id: 'meeting-id'
346
+ })
347
+ };
348
+ breakoutEvent.onBreakoutJoinResponse = sinon.stub();
349
+ breakouts.currentBreakoutSession.sessionId = "sessionId-old";
350
+ breakouts.updateBreakout({
351
+ sessionId: 'sessionId-new',
352
+ groupId: 'groupId',
353
+ sessionType: 'sessionType',
354
+ url: 'url',
355
+ name: 'name',
356
+ allowBackToMain: true,
357
+ delayCloseTime: 10,
358
+ enableBreakoutSession: true,
359
+ startTime: 'startTime',
360
+ status: 'active',
361
+ locusUrl: 'locusUrl',
362
+ breakoutMoveId: 'breakoutMoveId',
363
+ });
364
+
365
+ assert.calledOnce(breakoutEvent.onBreakoutJoinResponse);
366
+
367
+ });
368
+
369
+ it('updates the current breakout session, not call onBreakoutJoinResponse when session no changed', () => {
370
+ breakouts.webex.meetings = {
371
+ getMeetingByType: sinon.stub().returns({
372
+ id: 'meeting-id'
373
+ })
374
+ };
375
+ breakoutEvent.onBreakoutJoinResponse = sinon.stub();
376
+ breakouts.currentBreakoutSession.sessionId = "sessionId";
377
+ breakouts.currentBreakoutSession.groupId = "groupId";
378
+ breakouts.updateBreakout({
379
+ sessionId: 'sessionId',
380
+ groupId: 'groupId',
381
+ sessionType: 'sessionType',
382
+ url: 'url',
383
+ name: 'name',
384
+ allowBackToMain: true,
385
+ delayCloseTime: 10,
386
+ enableBreakoutSession: true,
387
+ startTime: 'startTime',
388
+ status: 'active',
389
+ locusUrl: 'locusUrl',
390
+ breakoutMoveId: 'breakoutMoveId',
391
+ });
392
+
393
+ assert.notCalled(breakoutEvent.onBreakoutJoinResponse);
394
+
395
+ });
396
+ });
397
+
398
+ describe('#updateBreakoutSessions', () => {
399
+ const checkBreakout = (breakout, sessionId, state) => {
400
+ assert.deepEqual(breakout.attributes, {
401
+ active: false,
402
+ allowed: false,
403
+ assigned: false,
404
+ assignedCurrent: false,
405
+ current: false,
406
+ ready: true,
407
+ requested: false,
408
+ url: 'url',
409
+ sessionId,
410
+ ...{[state]: true},
411
+ });
412
+ };
413
+
414
+ it('works', () => {
415
+ breakouts.set('url', 'url');
416
+ breakouts.set('sessionType', BREAKOUTS.SESSION_TYPES.MAIN);
417
+ const payload = {
418
+ breakoutSessions: {
419
+ active: [{sessionId: 'sessionId1'}],
420
+ assigned: [{sessionId: 'sessionId2'}],
421
+ allowed: [{sessionId: 'sessionId3'}],
422
+ assignedCurrent: [{sessionId: 'sessionId4'}],
423
+ requested: [{sessionId: 'sessionId5'}],
424
+ },
425
+ };
426
+
427
+ breakouts.updateBreakoutSessions(payload);
428
+
429
+ checkBreakout(breakouts.breakouts.get('sessionId1'), 'sessionId1', 'active');
430
+ checkBreakout(breakouts.breakouts.get('sessionId2'), 'sessionId2', 'assigned');
431
+ checkBreakout(breakouts.breakouts.get('sessionId3'), 'sessionId3', 'allowed');
432
+ checkBreakout(breakouts.breakouts.get('sessionId4'), 'sessionId4', 'assignedCurrent');
433
+ checkBreakout(breakouts.breakouts.get('sessionId5'), 'sessionId5', 'requested');
434
+ });
435
+
436
+ it('set requestedLastModifiedTime correctly', () => {
437
+ const payload = {
438
+ breakoutSessions: {
439
+ assigned: [{sessionId: 'sessionId1'}],
440
+ requested: [{sessionId: 'sessionId2', modifiedAt: "2023-05-09T17:16:01.000Z"}],
441
+ },
442
+ };
443
+
444
+ breakouts.updateBreakoutSessions(payload);
445
+ assert.equal(breakouts.breakouts.get('sessionId1').requestedLastModifiedTime, undefined)
446
+ assert.equal(breakouts.breakouts.get('sessionId2').requestedLastModifiedTime, "2023-05-09T17:16:01.000Z")
447
+ });
448
+
449
+ });
450
+
451
+ describe('#locusUrlUpdate', () => {
452
+ it('sets the locus url', () => {
453
+ breakouts.locusUrlUpdate('newUrl');
454
+
455
+ assert.equal(breakouts.locusUrl, 'newUrl');
456
+ });
457
+ });
458
+
459
+ describe('#updateCanManageBreakouts', () => {
460
+ it('update canManageBreakouts', () => {
461
+ breakouts.updateCanManageBreakouts(true);
462
+
463
+ assert.equal(breakouts.canManageBreakouts, true);
464
+
465
+ breakouts.updateCanManageBreakouts(false);
466
+
467
+ assert.equal(breakouts.canManageBreakouts, false);
468
+ });
469
+ });
470
+
471
+ describe('#cleanUp', () => {
472
+ it('stops listening', () => {
473
+ breakouts.stopListening = sinon.stub();
474
+
475
+ breakouts.cleanUp();
476
+
477
+ assert.calledOnceWithExactly(breakouts.stopListening);
478
+ });
479
+ });
480
+
481
+ describe('#handleRosterUpdate', () => {
482
+ it('does not break if it cannot find the session', () => {
483
+ breakouts.handleRosterUpdate({controls: {breakout: {sessionId: 'sessionId'}}});
484
+ });
485
+
486
+ it('calls parse roster if it can find the session', () => {
487
+ breakouts.breakouts.add({sessionId: 'sessionId'});
488
+
489
+ const breakout = breakouts.breakouts.models[0];
490
+ breakout.parseRoster = sinon.stub();
491
+
492
+ const locus = {controls: {breakout: {sessionId: 'sessionId'}}};
493
+
494
+ breakouts.handleRosterUpdate(locus);
495
+ assert.calledOnceWithExactly(breakout.parseRoster, locus);
496
+ });
497
+ });
498
+
499
+ describe('#isActiveBreakout', () => {
500
+ it('return is current is breakout with active status', () => {
501
+ assert.equal(breakouts.isActiveBreakout, false);
502
+ breakouts.set('sessionType', BREAKOUTS.SESSION_TYPES.BREAKOUT);
503
+ assert.equal(breakouts.isActiveBreakout, false);
504
+ breakouts.set('status', BREAKOUTS.STATUS.OPEN);
505
+ assert.equal(breakouts.isActiveBreakout, true);
506
+ });
507
+ });
508
+
509
+ describe('#breakoutGroupId', () => {
510
+ it('return empty breakout group id for managing breakouts if no data', () => {
511
+ assert.equal(breakouts.breakoutGroupId, '');
512
+ breakouts.set('manageGroups', []);
513
+ assert.equal(breakouts.breakoutGroupId, '');
514
+ breakouts.set('manageGroups', [{name: 'test'}]);
515
+ assert.equal(breakouts.breakoutGroupId, undefined);
516
+ });
517
+ it('return the group id if has id in manageGroups', () => {
518
+ breakouts.set('manageGroups', [{id: 'groupId1'}]);
519
+ assert.equal(breakouts.breakoutGroupId, 'groupId1');
520
+ });
521
+ it('return empty group id if group status is CLOSED', () => {
522
+ breakouts.set('manageGroups', [{id: 'groupId1', status: 'CLOSED'}]);
523
+ assert.equal(breakouts.breakoutGroupId, '');
524
+ });
525
+ });
526
+
527
+ describe('#shouldQueryPreAssignments', () => {
528
+ it('returns should query preAssignments depends on status', () => {
529
+ assert.equal(breakouts.shouldQueryPreAssignments, false);
530
+ breakouts.set('canManageBreakouts', true);
531
+ assert.equal(breakouts.shouldQueryPreAssignments, false);
532
+ breakouts.set('enableBreakoutSession', true);
533
+ assert.equal(breakouts.shouldQueryPreAssignments, false);
534
+ breakouts.set('hasBreakoutPreAssignments', true);
535
+ assert.equal(breakouts.shouldQueryPreAssignments, true);
536
+ });
537
+ });
538
+
539
+ describe('#breakoutStatus', () => {
540
+ it('return status from groups with session type', () => {
541
+ breakouts.set('groups', [{status: "OPEN"}]);
542
+ breakouts.set('status', "CLOSED");
543
+ breakouts.set('sessionType', BREAKOUTS.SESSION_TYPES.MAIN);
544
+
545
+ assert.equal(breakouts.breakoutStatus, "OPEN")
546
+
547
+ breakouts.set('sessionType', BREAKOUTS.SESSION_TYPES.BREAKOUT);
548
+
549
+ assert.equal(breakouts.breakoutStatus, "CLOSED")
550
+ });
551
+ });
552
+
553
+ describe('#_setManageGroups', () => {
554
+ it('do nothing if breakout info is empty', () => {
555
+ breakouts._setManageGroups();
556
+ assert.equal(breakouts.manageGroups, undefined);
557
+ breakouts._setManageGroups({body: null});
558
+ assert.equal(breakouts.manageGroups, undefined);
559
+ breakouts._setManageGroups({body: {groups: null}});
560
+ assert.equal(breakouts.manageGroups, undefined);
561
+ });
562
+ it('set the groups into manageGroups if has groups in side breakout info', () => {
563
+ breakouts._setManageGroups({body: {groups: [{id: 'groupId1'}]}});
564
+ assert.deepEqual(breakouts.manageGroups, [{id: 'groupId1'}]);
565
+ });
566
+ });
567
+
568
+ describe('#queryRosters', () => {
569
+ it('makes the expected query', async () => {
570
+ webex.request.returns(
571
+ Promise.resolve({
572
+ body: {
573
+ rosters: [
574
+ {
575
+ locus: 'locus1',
576
+ },
577
+ {
578
+ locus: 'locus2',
579
+ },
580
+ ],
581
+ },
582
+ })
583
+ );
584
+
585
+ breakouts.set('url', 'url');
586
+ breakouts.set('locusUrl', 'test');
587
+
588
+ breakouts.handleRosterUpdate = sinon.stub();
589
+
590
+ const result = await breakouts.queryRosters();
591
+
592
+ assert.calledOnceWithExactly(webex.request, {
593
+ uri: 'url/roster',
594
+ qs: {locusUrl: 'dGVzdA=='},
595
+ });
596
+ assert.calledTwice(breakouts.handleRosterUpdate);
597
+
598
+ assert.deepEqual(breakouts.handleRosterUpdate.getCall(0).args, ['locus1']);
599
+ assert.deepEqual(breakouts.handleRosterUpdate.getCall(1).args, ['locus2']);
600
+ });
601
+
602
+ it('logs the error if the query fails', async () => {
603
+ const error = new Error('something went wrong');
604
+ webex.request.rejects(error);
605
+ LoggerProxy.logger.error = sinon.stub();
606
+
607
+ breakouts.set('url', 'url');
608
+ breakouts.set('locusUrl', 'test');
609
+
610
+ breakouts.handleRosterUpdate = sinon.stub();
611
+
612
+ const result = await breakouts.queryRosters();
613
+ await testUtils.flushPromises();
614
+
615
+ assert.calledOnceWithExactly(webex.request, {
616
+ uri: 'url/roster',
617
+ qs: {locusUrl: 'dGVzdA=='},
618
+ });
619
+ assert.calledOnceWithExactly(
620
+ LoggerProxy.logger.error,
621
+ 'Meeting:breakouts#queryRosters failed',
622
+ error
623
+ );
624
+ });
625
+ });
626
+
627
+ describe('isInMainSession', () => {
628
+ it('returns true when sessionType is MAIN', () => {
629
+ assert.equal(breakouts.isInMainSession, false);
630
+ breakouts.set('sessionType', BREAKOUTS.SESSION_TYPES.MAIN);
631
+ assert.equal(breakouts.isInMainSession, true);
632
+ });
633
+ });
634
+
635
+ describe('#getMainSession', () => {
636
+ it('returns main session as expect', () => {
637
+ breakouts.updateBreakout({
638
+ sessionId: 'sessionId',
639
+ groupId: 'groupId',
640
+ sessionType: 'sessionType',
641
+ url: 'url',
642
+ name: 'name',
643
+ allowBackToMain: true,
644
+ delayCloseTime: 10,
645
+ enableBreakoutSession: true,
646
+ startTime: 'startTime',
647
+ status: 'active',
648
+ locusUrl: 'locusUrl',
649
+ });
650
+ const payload = {
651
+ breakoutSessions: {
652
+ active: [{sessionId: 'sessionId1'}],
653
+ },
654
+ };
655
+
656
+ breakouts.set('sessionType', BREAKOUTS.SESSION_TYPES.MAIN);
657
+ breakouts.updateBreakoutSessions(payload);
658
+ let result = breakouts.getMainSession();
659
+ assert.equal(result.sessionId, 'sessionId');
660
+
661
+ const payload2 = {
662
+ breakoutSessions: {
663
+ active: [{sessionId: 'sessionId1', sessionType: BREAKOUTS.SESSION_TYPES.MAIN}],
664
+ },
665
+ };
666
+ breakouts.updateBreakoutSessions(payload2);
667
+ breakouts.set('sessionType', 'BREAKOUT');
668
+ result = breakouts.getMainSession();
669
+ assert.equal(result.sessionId, 'sessionId1');
670
+ });
671
+ it('throw error if cannot find main session', () => {
672
+ const fn = () => {
673
+ breakouts.getMainSession();
674
+ };
675
+ expect(fn).to.throw(/no main session found/);
676
+ });
677
+ });
678
+
679
+ describe('#askAllToReturn', () => {
680
+ it('makes the request as expected', async () => {
681
+ breakouts.set('sessionType', BREAKOUTS.SESSION_TYPES.MAIN);
682
+ breakouts.currentBreakoutSession.sessionId = 'sessionId';
683
+ breakouts.currentBreakoutSession.groupId = 'groupId';
684
+ const result = await breakouts.askAllToReturn();
685
+ assert.calledOnceWithExactly(webex.request, {
686
+ method: 'POST',
687
+ uri: 'url/requestMove',
688
+ body: {
689
+ groupId: 'groupId',
690
+ sessionId: 'sessionId',
691
+ },
692
+ });
693
+ });
694
+ });
695
+
696
+ describe('#breakoutServiceUrlUpdate', () => {
697
+ it('sets the breakoutService url', () => {
698
+ breakouts.breakoutServiceUrlUpdate('newBreakoutServiceUrl');
699
+ assert.equal(breakouts.breakoutServiceUrl, 'newBreakoutServiceUrl/breakout/');
700
+ });
701
+ });
702
+
703
+ describe('#toggleBreakout', () => {
704
+ const mockEnableResponse = {
705
+ body: {
706
+ sessionId: 'sessionId',
707
+ groupId: 'groupId',
708
+ name: 'name',
709
+ current: true,
710
+ sessionType: 'sessionType',
711
+ url: 'url',
712
+ },
713
+ };
714
+ it('enableBreakoutSession is undefined, run enableBreakouts then toggleBreakout', async () => {
715
+ breakouts.enableBreakoutSession = undefined;
716
+ breakouts.enableBreakouts = sinon.stub().resolves(mockEnableResponse);
717
+ breakouts.updateBreakout = sinon.stub().resolves();
718
+ breakouts.doToggleBreakout = sinon.stub().resolves();
719
+
720
+ await breakouts.toggleBreakout(false);
721
+ assert.calledOnceWithExactly(breakouts.enableBreakouts);
722
+ assert.calledOnceWithExactly(breakouts.updateBreakout, {
723
+ sessionId: 'sessionId',
724
+ groupId: 'groupId',
725
+ name: 'name',
726
+ current: true,
727
+ sessionType: 'sessionType',
728
+ url: 'url',
729
+ });
730
+ assert.calledOnceWithExactly(breakouts.doToggleBreakout, false);
731
+ });
732
+
733
+ it('first time enable breakouts, call updateBreakout to set initial params', async () => {
734
+ breakouts.enableBreakoutSession = undefined;
735
+ breakouts.enableBreakouts = sinon.stub().resolves(mockEnableResponse);
736
+ breakouts.updateBreakout = sinon.stub().resolves();
737
+ breakouts.doToggleBreakout = sinon.stub();
738
+
739
+ await breakouts.toggleBreakout(true);
740
+ assert.calledOnceWithExactly(breakouts.updateBreakout, {
741
+ sessionId: 'sessionId',
742
+ groupId: 'groupId',
743
+ name: 'name',
744
+ current: true,
745
+ sessionType: 'sessionType',
746
+ url: 'url',
747
+ });
748
+
749
+ assert.notCalled(breakouts.doToggleBreakout);
750
+ });
751
+
752
+ it('enableBreakoutSession is exist, run toggleBreakout', async () => {
753
+ breakouts.enableBreakoutSession = true;
754
+ breakouts.doToggleBreakout = sinon.stub().resolves();
755
+ await breakouts.toggleBreakout(true);
756
+ assert.calledOnceWithExactly(breakouts.doToggleBreakout, true);
757
+ });
758
+ });
759
+
760
+ describe('enableBreakouts', () => {
761
+ it('makes the request as expected', async () => {
762
+ const result = await breakouts.enableBreakouts();
763
+ breakouts.set('breakoutServiceUrl', 'breakoutServiceUrl');
764
+ assert.calledOnceWithExactly(webex.request, {
765
+ method: 'POST',
766
+ uri: 'breakoutServiceUrl',
767
+ body: {
768
+ locusUrl: 'locusUrl',
769
+ },
770
+ });
771
+
772
+ assert.equal(result, 'REQUEST_RETURN_VALUE');
773
+ });
774
+ });
775
+
776
+ describe('#broadcast', () => {
777
+ it('makes the request as expected', async () => {
778
+ breakouts.breakoutRequest.broadcast = sinon
779
+ .stub()
780
+ .returns(Promise.resolve('REQUEST_RETURN_VALUE'));
781
+ webex.request.returns(
782
+ Promise.resolve({
783
+ body: getBOResponse('OPEN'),
784
+ })
785
+ );
786
+ await breakouts.getBreakout();
787
+ let result = await breakouts.broadcast('hello');
788
+ assert.calledWithExactly(breakouts.breakoutRequest.broadcast, {
789
+ url: 'url',
790
+ message: 'hello',
791
+ options: undefined,
792
+ groupId: 'groupId',
793
+ });
794
+
795
+ assert.equal(result, 'REQUEST_RETURN_VALUE');
796
+
797
+ result = await breakouts.broadcast('hello', {presenters: true, cohosts: true});
798
+ assert.calledWithExactly(breakouts.breakoutRequest.broadcast, {
799
+ url: 'url',
800
+ groupId: 'groupId',
801
+ message: 'hello',
802
+ options: {presenters: true, cohosts: true},
803
+ });
804
+ assert.equal(result, 'REQUEST_RETURN_VALUE');
805
+ });
806
+
807
+ it('throw error if no breakout group id found', () => {
808
+ breakouts.set('sessionType', BREAKOUTS.SESSION_TYPES.MAIN);
809
+ const fn = () => {
810
+ breakouts.broadcast('hello');
811
+ };
812
+ expect(fn).to.throw(/no breakout session found/);
813
+ });
814
+ });
815
+
816
+ describe('#update', () => {
817
+ it('makes the request as expected', async () => {
818
+ const mockedReturnBody = getBOResponse('OPEN');
819
+ webex.request.returns(
820
+ Promise.resolve({
821
+ body: mockedReturnBody,
822
+ })
823
+ );
824
+ breakouts.editLock = {
825
+ token: 'token1',
826
+ };
827
+ const params = {
828
+ id: 'groupId',
829
+ sessions: [{name: 'Session 1'}],
830
+ };
831
+ breakouts._setManageGroups = sinon.stub();
832
+ const result = await breakouts.update(params);
833
+ assert.calledOnceWithExactly(webex.request, {
834
+ method: 'PUT',
835
+ uri: 'url',
836
+ body: {
837
+ editlock: {token: 'token1', refresh: true},
838
+ groups: [params],
839
+ },
840
+ });
841
+ assert.calledOnceWithExactly(breakouts._setManageGroups, {
842
+ body: mockedReturnBody,
843
+ });
844
+ });
845
+ it('makes the request as expected when unlockEdit is true', async () => {
846
+ breakouts.editLock = {
847
+ token: 'token1',
848
+ };
849
+ const params = {
850
+ id: 'groupId',
851
+ sessions: [{name: 'Session 1'}],
852
+ };
853
+ breakouts._clearEditLockInfo = sinon.stub();
854
+ const result = await breakouts.update(params, true);
855
+ assert.calledOnceWithExactly(webex.request, {
856
+ method: 'PUT',
857
+ uri: 'url',
858
+ body: {
859
+ editlock: {token: 'token1', refresh: false},
860
+ groups: [params],
861
+ },
862
+ });
863
+ assert.calledOnceWithExactly(breakouts._clearEditLockInfo);
864
+ });
865
+ it('throw error if missing id in params', async () => {
866
+ const params = {
867
+ sessions: [{name: 'Session 1'}],
868
+ };
869
+ await breakouts.update(params).catch((error) => {
870
+ assert.equal(error.toString(), 'Error: Missing breakout group id');
871
+ });
872
+ });
873
+ it('rejects when edit lock token mismatch', async () => {
874
+ webex.request.returns(
875
+ Promise.reject({
876
+ body: {
877
+ errorCode: BREAKOUTS.ERROR_CODE.EDIT_LOCK_TOKEN_MISMATCH,
878
+ message: 'Edit lock token mismatch',
879
+ },
880
+ })
881
+ );
882
+ LoggerProxy.logger.info = sinon.stub();
883
+
884
+ const params = {
885
+ id: 'groupId',
886
+ sessions: [{name: 'Session 1'}],
887
+ };
888
+
889
+ await assert.isRejected(
890
+ breakouts.update(params),
891
+ BreakoutEditLockedError,
892
+ 'Edit lock token mismatch'
893
+ );
894
+ assert.calledOnceWithExactly(
895
+ LoggerProxy.logger.info,
896
+ 'Breakouts#update --> Edit lock token mismatch'
897
+ );
898
+ });
899
+
900
+ it('rejects when edit not authorized', async () => {
901
+ webex.request.returns(
902
+ Promise.reject({
903
+ body: {
904
+ errorCode: BREAKOUTS.ERROR_CODE.EDIT_NOT_AUTHORIZED,
905
+ },
906
+ })
907
+ );
908
+ LoggerProxy.logger.info = sinon.stub();
909
+
910
+ const params = {
911
+ id: 'groupId',
912
+ sessions: [{name: 'Session 1'}],
913
+ };
914
+
915
+ await assert.isRejected(
916
+ breakouts.update(params),
917
+ BreakoutEditLockedError,
918
+ 'Not authorized to interact with edit lock'
919
+ );
920
+
921
+ assert.calledOnceWithExactly(
922
+ LoggerProxy.logger.info,
923
+ 'Breakouts#update --> Not authorized to interact with edit lock'
924
+ );
925
+ });
926
+
927
+ it('rejects when other unknow error', async () => {
928
+ const mockError = new Error('something wrong');
929
+ webex.request.returns(Promise.reject(mockError));
930
+ LoggerProxy.logger.info = sinon.stub();
931
+
932
+ const params = {
933
+ id: 'groupId',
934
+ sessions: [{name: 'Session 1'}],
935
+ };
936
+
937
+ await assert.isRejected(breakouts.update(params), mockError, 'something wrong');
938
+
939
+ assert.calledOnceWithExactly(
940
+ LoggerProxy.logger.info,
941
+ 'Breakouts#update --> something wrong'
942
+ );
943
+ });
944
+ });
945
+
946
+ describe('#start', () => {
947
+ it('should start breakout sessions', async () => {
948
+ const mockedReturnBody = getBOResponse('OPEN');
949
+ webex.request.returns(
950
+ Promise.resolve({
951
+ body: mockedReturnBody,
952
+ })
953
+ );
954
+
955
+ breakouts.set('url', 'url');
956
+ await breakouts.getBreakout();
957
+
958
+ const result = await breakouts.start();
959
+ breakouts._setManageGroups = sinon.stub();
960
+ await breakouts.start({id: 'id', someOtherParam: 'someOtherParam'});
961
+
962
+ const arg = webex.request.getCall(1).args[0];
963
+ const argObj1 = arg.body.groups[0];
964
+ const argObj2 = webex.request.getCall(2).args[0].body.groups[0];
965
+
966
+ assert.equal(arg.uri, 'url');
967
+ assert.equal(arg.method, 'PUT');
968
+ assert.deepEqual(argObj1, {
969
+ id: 'groupId',
970
+ action: 'START',
971
+ allowBackToMain: false,
972
+ allowToJoinLater: false,
973
+ });
974
+ assert.deepEqual(argObj2, {
975
+ id: 'id',
976
+ action: 'START',
977
+ allowBackToMain: false,
978
+ allowToJoinLater: false,
979
+ someOtherParam: 'someOtherParam',
980
+ });
981
+ assert.deepEqual(result, {body: mockedReturnBody});
982
+ assert.calledWithExactly(breakouts._setManageGroups, {body: mockedReturnBody})
983
+ });
984
+
985
+ it('rejects when edit lock token mismatch', async () => {
986
+ webex.request.returns(
987
+ Promise.reject({
988
+ body: {
989
+ errorCode: BREAKOUTS.ERROR_CODE.EDIT_LOCK_TOKEN_MISMATCH,
990
+ message: 'Edit lock token mismatch',
991
+ },
992
+ })
993
+ );
994
+
995
+ await assert.isRejected(
996
+ breakouts.start(),
997
+ BreakoutEditLockedError,
998
+ 'Edit lock token mismatch'
999
+ );
1000
+ });
1001
+ });
1002
+
1003
+ describe('#end', () => {
1004
+ it('should end breakout sessions', async () => {
1005
+ webex.request.returns(
1006
+ Promise.resolve({
1007
+ body: getBOResponse('CLOSING'),
1008
+ })
1009
+ );
1010
+
1011
+ breakouts.set('url', 'url');
1012
+ breakouts.set('delayCloseTime', 60);
1013
+ await breakouts.getBreakout();
1014
+
1015
+ const result = await breakouts.end();
1016
+
1017
+ breakouts._setManageGroups = sinon.stub();
1018
+ await breakouts.end({id: 'id', someOtherParam: 'someOtherParam'});
1019
+ const arg = webex.request.getCall(1).args[0];
1020
+ const argObj1 = arg.body.groups[0];
1021
+ const argObj2 = webex.request.getCall(2).args[0].body.groups[0];
1022
+
1023
+ assert.equal(arg.uri, 'url');
1024
+ assert.equal(arg.method, 'PUT');
1025
+ assert.deepEqual(argObj1, {id: 'groupId', action: 'CLOSE', delayCloseTime: 60});
1026
+ assert.deepEqual(argObj2, {
1027
+ id: 'id',
1028
+ action: 'CLOSE',
1029
+ delayCloseTime: 60,
1030
+ someOtherParam: 'someOtherParam',
1031
+ });
1032
+ assert.deepEqual(result, {body: getBOResponse('CLOSING')});
1033
+ assert.calledOnceWithExactly(breakouts._setManageGroups, {body: getBOResponse('CLOSING')});
1034
+ });
1035
+
1036
+ it('rejects when edit lock token mismatch', async () => {
1037
+ webex.request.returns(
1038
+ Promise.reject({
1039
+ body: {
1040
+ errorCode: BREAKOUTS.ERROR_CODE.EDIT_LOCK_TOKEN_MISMATCH,
1041
+ message: 'Edit lock token mismatch',
1042
+ },
1043
+ })
1044
+ );
1045
+
1046
+ await assert.isRejected(
1047
+ breakouts.end(),
1048
+ BreakoutEditLockedError,
1049
+ 'Edit lock token mismatch'
1050
+ );
1051
+ });
1052
+ });
1053
+
1054
+ describe('#getBreakout', () => {
1055
+ it('should get breakout sessions', async () => {
1056
+ webex.request.returns(
1057
+ Promise.resolve({
1058
+ body: getBOResponse('PENDING'),
1059
+ })
1060
+ );
1061
+
1062
+ breakouts.set('url', 'url');
1063
+ const result = await breakouts.getBreakout();
1064
+
1065
+ breakouts._setManageGroups = sinon.stub();
1066
+ await breakouts.getBreakout(true);
1067
+ const arg1 = webex.request.getCall(0).args[0];
1068
+ const arg2 = webex.request.getCall(1).args[0];
1069
+
1070
+ assert.equal(arg1.uri, 'url');
1071
+ assert.equal(arg2.uri, 'url?editlock=true');
1072
+ assert.equal(arg1.method, 'GET');
1073
+ assert.deepEqual(result, {body: getBOResponse('PENDING')});
1074
+ assert.deepEqual(breakouts.manageGroups, result.body.groups);
1075
+ assert.equal(breakouts.breakoutGroupId, 'groupId');
1076
+ assert.calledOnceWithExactly(breakouts._setManageGroups, {body: getBOResponse('PENDING')});
1077
+ });
1078
+
1079
+ it('breakoutGroupId should be empty if it is CLOSED group', async () => {
1080
+ webex.request.returns(
1081
+ Promise.resolve({
1082
+ body: getBOResponse('CLOSED'),
1083
+ })
1084
+ );
1085
+
1086
+ breakouts.set('url', 'url');
1087
+ await breakouts.getBreakout();
1088
+
1089
+ assert.equal(breakouts.breakoutGroupId, '');
1090
+ });
1091
+
1092
+ it('should call keep alive when response with edit lock info', async () => {
1093
+ webex.request.returns(
1094
+ Promise.resolve({
1095
+ body: getBOResponseWithEditLockInfo('PENDING'),
1096
+ })
1097
+ );
1098
+
1099
+ breakouts.set('url', 'url');
1100
+ breakouts.keepEditLockAlive = sinon.stub().resolves();
1101
+ const result = await breakouts.getBreakout();
1102
+ await breakouts.getBreakout(true);
1103
+
1104
+ assert.calledOnceWithExactly(breakouts.keepEditLockAlive);
1105
+ });
1106
+ it('not call keep alive when response with no edit lock token', async () => {
1107
+ webex.request.returns(
1108
+ Promise.resolve({
1109
+ body: getBOResponseWithEditLockInfo('PENDING', true),
1110
+ })
1111
+ );
1112
+
1113
+ breakouts.set('url', 'url');
1114
+ breakouts.keepEditLockAlive = sinon.stub().resolves();
1115
+ const result = await breakouts.getBreakout();
1116
+ await breakouts.getBreakout(true);
1117
+
1118
+ assert.notCalled(breakouts.keepEditLockAlive);
1119
+ });
1120
+ });
1121
+
1122
+ describe('doToggleBreakout', () => {
1123
+ it('makes the request as expected', async () => {
1124
+ breakouts.set('editLock', {
1125
+ ttl: 30,
1126
+ token: 'editToken',
1127
+ state: 'UNLOCKED',
1128
+ });
1129
+ const result = await breakouts.doToggleBreakout(true);
1130
+ assert.calledOnceWithExactly(webex.request, {
1131
+ method: 'PUT',
1132
+ uri: 'url',
1133
+ body: {
1134
+ editlock: {
1135
+ token: 'editToken',
1136
+ },
1137
+ enableBreakoutSession: true,
1138
+ },
1139
+ });
1140
+
1141
+ assert.equal(result, 'REQUEST_RETURN_VALUE');
1142
+ });
1143
+ });
1144
+
1145
+ describe('delete', () => {
1146
+ it('makes the request as expected', async () => {
1147
+ webex.request.returns(
1148
+ Promise.resolve({
1149
+ body: {
1150
+ groups: [
1151
+ {
1152
+ id: '455556a4-37cd-4baa-89bc-8730581a1cc0',
1153
+ status: 'CLOSE',
1154
+ type: 'BREAKOUT',
1155
+ },
1156
+ ],
1157
+ },
1158
+ })
1159
+ );
1160
+
1161
+ breakouts._setManageGroups = sinon.stub();
1162
+ const result = await breakouts.clearSessions();
1163
+ assert.calledOnceWithExactly(webex.request, {
1164
+ method: 'PUT',
1165
+ uri: 'url',
1166
+ body: {
1167
+ groups: [
1168
+ {
1169
+ action: BREAKOUTS.ACTION.DELETE,
1170
+ },
1171
+ ],
1172
+ },
1173
+ });
1174
+
1175
+ assert.calledOnceWithExactly(breakouts._setManageGroups, {
1176
+ body: {
1177
+ groups: [
1178
+ {
1179
+ id: '455556a4-37cd-4baa-89bc-8730581a1cc0',
1180
+ status: 'CLOSE',
1181
+ type: 'BREAKOUT',
1182
+ },
1183
+ ],
1184
+ },
1185
+ });
1186
+ });
1187
+
1188
+ it('rejects when edit lock token mismatch', async () => {
1189
+ webex.request.returns(
1190
+ Promise.reject({
1191
+ body: {
1192
+ errorCode: BREAKOUTS.ERROR_CODE.EDIT_LOCK_TOKEN_MISMATCH,
1193
+ message: 'Edit lock token mismatch',
1194
+ },
1195
+ })
1196
+ );
1197
+
1198
+ await assert.isRejected(
1199
+ breakouts.clearSessions(),
1200
+ BreakoutEditLockedError,
1201
+ 'Edit lock token mismatch'
1202
+ );
1203
+ });
1204
+ });
1205
+
1206
+ describe('create', () => {
1207
+ it('response not include groups info', async () => {
1208
+ const sessions = [{name: 'session1', anyoneCanJoin: true}];
1209
+ const result = await breakouts.create({sessions});
1210
+
1211
+ assert.equal(result, 'REQUEST_RETURN_VALUE');
1212
+ });
1213
+
1214
+ it('response include groups info', async () => {
1215
+ const sessions = [{name: 'session1', anyoneCanJoin: true}];
1216
+
1217
+ webex.request.returns(
1218
+ Promise.resolve({
1219
+ body: {
1220
+ groups: [
1221
+ {
1222
+ id: '455556a4-37cd-4baa-89bc-8730581a1cc0',
1223
+ status: 'PENDING',
1224
+ type: 'BREAKOUT',
1225
+ },
1226
+ ],
1227
+ },
1228
+ })
1229
+ );
1230
+
1231
+ const result = await breakouts.create({sessions});
1232
+
1233
+ assert.equal(breakouts.manageGroups[0].id, '455556a4-37cd-4baa-89bc-8730581a1cc0');
1234
+ });
1235
+
1236
+ it('rejects when edit lock token mismatch', async () => {
1237
+ const sessions = [{name: 'session1', anyoneCanJoin: true}];
1238
+
1239
+ webex.request.returns(
1240
+ Promise.reject({
1241
+ body: {
1242
+ errorCode: BREAKOUTS.ERROR_CODE.EDIT_LOCK_TOKEN_MISMATCH,
1243
+ message: 'Edit lock token mismatch',
1244
+ },
1245
+ })
1246
+ );
1247
+
1248
+ await assert.isRejected(
1249
+ breakouts.create({sessions}),
1250
+ BreakoutEditLockedError,
1251
+ 'Edit lock token mismatch'
1252
+ );
1253
+ });
1254
+ });
1255
+
1256
+ describe('enableAndLockBreakout', () => {
1257
+ it('enableBreakoutSession is true', async () => {
1258
+ breakouts.enableBreakoutSession = true;
1259
+
1260
+ breakouts.lockBreakout = sinon.stub().resolves();
1261
+
1262
+ breakouts.enableAndLockBreakout();
1263
+
1264
+ assert.calledOnceWithExactly(breakouts.lockBreakout);
1265
+ });
1266
+
1267
+ it('enableBreakoutSession is false', async () => {
1268
+ breakouts.enableBreakoutSession = false;
1269
+
1270
+ breakouts.enableBreakouts = sinon.stub().resolves();
1271
+
1272
+ breakouts.enableAndLockBreakout();
1273
+
1274
+ assert.calledOnceWithExactly(breakouts.enableBreakouts);
1275
+ });
1276
+ });
1277
+
1278
+ describe('hasBreakoutLocked', () => {
1279
+ it('has breakout locked is true', async () => {
1280
+ breakouts.editLock = {
1281
+ ttl: 30,
1282
+ token: 'token',
1283
+ state: 'LOCKED',
1284
+ };
1285
+
1286
+ assert.equal(breakouts.hasBreakoutLocked(), true);
1287
+ });
1288
+
1289
+ it('breakout locked by others', async () => {
1290
+ breakouts.editLock = {
1291
+ ttl: 30,
1292
+ token: '',
1293
+ state: 'LOCKED',
1294
+ };
1295
+
1296
+ assert.equal(breakouts.hasBreakoutLocked(), false);
1297
+ });
1298
+
1299
+ it('breakout not locked', async () => {
1300
+ breakouts.editLock = {
1301
+ ttl: 30,
1302
+ token: '',
1303
+ state: 'UNLOCKED',
1304
+ };
1305
+
1306
+ assert.equal(breakouts.hasBreakoutLocked(), false);
1307
+ });
1308
+ });
1309
+
1310
+ describe('lockBreakout', () => {
1311
+ it('lock breakout is true', async () => {
1312
+ breakouts.editLock = {
1313
+ ttl: 30,
1314
+ token: 'token',
1315
+ state: 'UNLOCKED',
1316
+ };
1317
+
1318
+ breakouts.keepEditLockAlive = sinon.stub().resolves();
1319
+
1320
+ breakouts.lockBreakout();
1321
+
1322
+ assert.calledOnceWithExactly(breakouts.keepEditLockAlive);
1323
+ });
1324
+
1325
+ it('lock breakout throw error', async () => {
1326
+ breakouts.editLock = {
1327
+ ttl: 30,
1328
+ token: '2ad57140-01b5-4bd0-a5a7-4dccdc06904c',
1329
+ state: 'LOCKED',
1330
+ };
1331
+
1332
+ await expect(breakouts.lockBreakout()).to.be.rejectedWith('Breakout already locked');
1333
+ });
1334
+
1335
+ it('lock breakout without editLock', async () => {
1336
+ breakouts.getBreakout = sinon.stub().resolves();
1337
+
1338
+ breakouts.lockBreakout();
1339
+
1340
+ assert.calledOnceWithExactly(breakouts.getBreakout, true);
1341
+ });
1342
+ });
1343
+
1344
+ describe('unLockEditBreakout', () => {
1345
+ it('unLock edit breakout request as expected', async () => {
1346
+ breakouts.set('editLock', {
1347
+ ttl: 30,
1348
+ token: '2ad57140-01b5-4bd0-a5a7-4dccdc06904c',
1349
+ state: 'LOCKED',
1350
+ });
1351
+
1352
+ breakouts.unLockEditBreakout();
1353
+ assert.calledOnceWithExactly(webex.request, {
1354
+ method: 'DELETE',
1355
+ uri: 'url/editlock/2ad57140-01b5-4bd0-a5a7-4dccdc06904c',
1356
+ });
1357
+ });
1358
+
1359
+ it('do not call unLock if edit lock info not exist ', async () => {
1360
+ breakouts.unLockEditBreakout();
1361
+ assert.notCalled(webex.request);
1362
+ });
1363
+ });
1364
+
1365
+ describe('keepEditLockAlive', () => {
1366
+ it('keep edit lock', () => {
1367
+ const clock = sinon.useFakeTimers();
1368
+
1369
+ breakouts.set('editLock', {
1370
+ ttl: 30,
1371
+ token: 'token',
1372
+ state: 'UNLOCKED',
1373
+ });
1374
+
1375
+ breakouts.keepEditLockAlive();
1376
+ clock.tick(15001);
1377
+
1378
+ assert.calledOnceWithExactly(webex.request, {
1379
+ method: 'PUT',
1380
+ uri: 'url/editlock/token',
1381
+ });
1382
+
1383
+ clock.restore();
1384
+ });
1385
+
1386
+ it('keep edit lock, ttl < 30, also using 30', () => {
1387
+ const clock = sinon.useFakeTimers();
1388
+
1389
+ breakouts.set('editLock', {
1390
+ ttl: 20,
1391
+ token: 'token',
1392
+ state: 'UNLOCKED',
1393
+ });
1394
+
1395
+ breakouts.keepEditLockAlive();
1396
+ clock.tick(15001);
1397
+
1398
+ assert.calledOnceWithExactly(webex.request, {
1399
+ method: 'PUT',
1400
+ uri: 'url/editlock/token',
1401
+ });
1402
+
1403
+ clock.restore();
1404
+ });
1405
+
1406
+ it('keep edit lock, ttl > 30, using the ttl', () => {
1407
+ const clock = sinon.useFakeTimers();
1408
+
1409
+ breakouts.set('editLock', {
1410
+ ttl: 50,
1411
+ token: 'token',
1412
+ state: 'UNLOCKED',
1413
+ });
1414
+
1415
+ breakouts.keepEditLockAlive();
1416
+ clock.tick(24099);
1417
+
1418
+ assert.notCalled(webex.request);
1419
+
1420
+ clock.restore();
1421
+ });
1422
+
1423
+ it('keep edit lock, throw error, clearInterval', async () => {
1424
+ breakouts._clearEditLockInfo = sinon.stub();
1425
+
1426
+ const error = new Error('something went wrong');
1427
+ webex.request.rejects(error);
1428
+
1429
+ const clock = sinon.useFakeTimers();
1430
+
1431
+ breakouts.set('editLock', {
1432
+ ttl: 30,
1433
+ token: 'token',
1434
+ state: 'UNLOCKED',
1435
+ });
1436
+
1437
+ breakouts.keepEditLockAlive();
1438
+ clock.tick(15001);
1439
+
1440
+ await testUtils.flushPromises();
1441
+
1442
+ assert.calledOnceWithExactly(breakouts._clearEditLockInfo);
1443
+
1444
+ clock.restore();
1445
+ });
1446
+
1447
+ it('keep edit lock, do not call until reached ttl', () => {
1448
+ const clock = sinon.useFakeTimers();
1449
+
1450
+ breakouts.set('editLock', {
1451
+ ttl: 30,
1452
+ token: 'token',
1453
+ state: 'UNLOCKED',
1454
+ });
1455
+
1456
+ breakouts.keepEditLockAlive();
1457
+ clock.tick(14999);
1458
+
1459
+ assert.notCalled(webex.request);
1460
+
1461
+ clock.tick(1);
1462
+ assert.calledOnceWithExactly(webex.request, {
1463
+ method: 'PUT',
1464
+ uri: 'url/editlock/token',
1465
+ });
1466
+
1467
+ clock.restore();
1468
+ });
1469
+
1470
+ it('clear interval first if previous one is in work', () => {
1471
+ breakouts.set('editLock', {
1472
+ ttl: 30,
1473
+ token: 'token',
1474
+ });
1475
+ const clock = sinon.useFakeTimers();
1476
+ window.clearInterval = sinon.stub();
1477
+ breakouts.keepEditLockAlive();
1478
+ const firstIntervalID = breakouts.intervalID;
1479
+ breakouts.keepEditLockAlive();
1480
+
1481
+ assert.calledWithExactly(window.clearInterval, firstIntervalID);
1482
+ clock.restore();
1483
+ });
1484
+ });
1485
+
1486
+ describe('#assign', () => {
1487
+ it('assign members and emails to a breakout session', async () => {
1488
+ breakouts.assign = sinon.stub().returns(Promise.resolve('ASSIGN_RETURN_VALUE'));
1489
+ const params = [
1490
+ {id: 'sessionId', memberIds: ['111'], emails: ['111@cisco.com'], anyone: true},
1491
+ ];
1492
+ const result = await breakouts.assign(params);
1493
+ assert.calledOnceWithExactly(breakouts.assign, params);
1494
+ assert.equal(result, 'ASSIGN_RETURN_VALUE');
1495
+ });
1496
+ it('assign only members to a breakout session', async () => {
1497
+ breakouts.assign = sinon.stub().returns(Promise.resolve('ASSIGN_RETURN_VALUE'));
1498
+ const params = [{id: 'sessionId', memberIds: ['111']}];
1499
+ const result = await breakouts.assign(params);
1500
+ assert.calledOnceWithExactly(breakouts.assign, params);
1501
+ assert.equal(result, 'ASSIGN_RETURN_VALUE');
1502
+ });
1503
+ it('assign only emails to a breakout session', async () => {
1504
+ breakouts.assign = sinon.stub().returns(Promise.resolve('ASSIGN_RETURN_VALUE'));
1505
+ const params = [{id: 'sessionId', emails: ['111@cisco.com']}];
1506
+ const result = await breakouts.assign(params);
1507
+ assert.calledOnceWithExactly(breakouts.assign, params);
1508
+ assert.equal(result, 'ASSIGN_RETURN_VALUE');
1509
+ });
1510
+
1511
+ it('called with editlock', async () => {
1512
+ breakouts.request = sinon.stub().returns(Promise.resolve('ASSIGN_RETURN_VALUE'));
1513
+ breakouts.editLock = {
1514
+ token: 'token1',
1515
+ };
1516
+ const params = [{id: 'sessionId', emails: ['111@cisco.com'], memberIds: []}];
1517
+ await breakouts.assign(params);
1518
+ const args = breakouts.request.getCall(0).args[0];
1519
+ expect(args).to.be.an('object', {
1520
+ method: 'PUT',
1521
+ uri: 'url',
1522
+ body: {
1523
+ editlock: {token: 'token1', refresh: true},
1524
+ groups: {
1525
+ id: 'sessionId',
1526
+ sessions: [
1527
+ {
1528
+ id: 'sessionId',
1529
+ assigned: [],
1530
+ assignedEmails: ['111@cisco.com'],
1531
+ anyoneCanJoin: false,
1532
+ },
1533
+ ],
1534
+ },
1535
+ },
1536
+ });
1537
+ });
1538
+ });
1539
+
1540
+ describe('#queryPreAssignments', () => {
1541
+ it('makes the expected query', async () => {
1542
+ const mockPreAssignments = [
1543
+ {
1544
+ sessions: [
1545
+ {
1546
+ name: 'Breakout session 1',
1547
+ assignedEmails: ['aa@aa.com', 'bb@bb.com', 'cc@cc.com'],
1548
+ anyoneCanJoin: false,
1549
+ },
1550
+ {
1551
+ name: 'Breakout session 2',
1552
+ anyoneCanJoin: false,
1553
+ },
1554
+ {
1555
+ name: 'Breakout session 3',
1556
+ assignedEmails: ['cc@cc.com'],
1557
+ anyoneCanJoin: false,
1558
+ },
1559
+ ],
1560
+ unassignedInvitees: {
1561
+ emails: ['dd@dd.com'],
1562
+ },
1563
+ type: 'BREAKOUT',
1564
+ },
1565
+ ];
1566
+ webex.request.returns(
1567
+ Promise.resolve({
1568
+ body: {
1569
+ groups: mockPreAssignments,
1570
+ },
1571
+ })
1572
+ );
1573
+ breakouts.set('locusUrl', 'test');
1574
+
1575
+ await breakouts.queryPreAssignments();
1576
+ assert.calledOnceWithExactly(webex.request, {
1577
+ uri: 'url/preassignments',
1578
+ qs: {
1579
+ locusUrl: 'dGVzdA==',
1580
+ }
1581
+ });
1582
+
1583
+ assert.deepEqual(breakouts.preAssignments, mockPreAssignments);
1584
+ });
1585
+
1586
+ it('rejects when no pre-assignments created for this meeting', async () => {
1587
+ const response = {
1588
+ statusCode: 404,
1589
+ body: {
1590
+ errorCode: 201404004,
1591
+ message: 'No pre-assignments created for this meeting',
1592
+ },
1593
+ };
1594
+ webex.request.rejects(response);
1595
+ LoggerProxy.logger.error = sinon.stub();
1596
+ const result = await breakouts.queryPreAssignments({enableBreakoutSession: true, hasBreakoutPreAssignments: true});
1597
+ await testUtils.flushPromises();
1598
+ assert.calledOnceWithExactly(
1599
+ LoggerProxy.logger.error,
1600
+ 'Meeting:breakouts#queryPreAssignments failed',
1601
+ response
1602
+ );
1603
+ });
1604
+
1605
+ it('fail when no correct params', () => {
1606
+
1607
+ assert.deepEqual(breakouts.queryPreAssignments(undefined), undefined);
1608
+
1609
+ assert.deepEqual(breakouts.queryPreAssignments({}), undefined);
1610
+
1611
+ assert.deepEqual(breakouts.queryPreAssignments({ enableBreakoutSession: true, hasBreakoutPreAssignments: false }), undefined);
1612
+
1613
+ assert.deepEqual(breakouts.queryPreAssignments({ enableBreakoutSession: false, hasBreakoutPreAssignments: true }), undefined);
1614
+
1615
+ assert.deepEqual(breakouts.queryPreAssignments({ enableBreakoutSession: false, hasBreakoutPreAssignments: false }), undefined);
1616
+
1617
+ });
1618
+
1619
+ });
1620
+
1621
+ describe('#dynamicAssign', () => {
1622
+ it('should make a PUT request with correct body and return the result', async () => {
1623
+ breakouts.dynamicAssign = sinon.stub().returns(Promise.resolve('REQUEST_RETURN_VALUE'));
1624
+
1625
+ const expectedBody = {
1626
+ groups: [
1627
+ {
1628
+ id: 'breakoutGroup1',
1629
+ sessions: [
1630
+ {
1631
+ id: 'session1',
1632
+ participants: ['participant1', 'participant2'],
1633
+ targetState: 'JOINED',
1634
+ },
1635
+ ],
1636
+ },
1637
+ ],
1638
+ editlock: {
1639
+ token: 'abcdefg',
1640
+ },
1641
+ };
1642
+
1643
+ const result = await breakouts.dynamicAssign(expectedBody);
1644
+
1645
+ assert.calledOnceWithExactly(breakouts.dynamicAssign, expectedBody);
1646
+ assert.equal(result, 'REQUEST_RETURN_VALUE');
1647
+ });
1648
+ });
1649
+
1650
+ describe('#triggerReturnToMainEvent', () => {
1651
+ const checkTrigger = ({breakout, shouldTrigger}) => {
1652
+ breakouts.trigger = sinon.stub();
1653
+ breakouts.triggerReturnToMainEvent(breakout);
1654
+ if (shouldTrigger) {
1655
+ assert.calledOnceWithExactly(breakouts.trigger, BREAKOUTS.EVENTS.ASK_RETURN_TO_MAIN);
1656
+ } else {
1657
+ assert.notCalled(breakouts.trigger);
1658
+ }
1659
+ }
1660
+ it('should trigger ASK_RETURN_TO_MAIN event correctly', () => {
1661
+ const breakout = {
1662
+ isMain: true,
1663
+ requested: true
1664
+ };
1665
+ checkTrigger({breakout, shouldTrigger: true})
1666
+ });
1667
+
1668
+ it('should not trigger ASK_RETURN_TO_MAIN event when sessionType is not MAIN', () => {
1669
+ const breakout = {
1670
+ isMain: false,
1671
+ requested: true
1672
+ };
1673
+ checkTrigger({breakout, shouldTrigger: false});
1674
+ });
1675
+
1676
+ it('should not trigger ASK_RETURN_TO_MAIN event when session is not requested', () => {
1677
+ const breakout = {
1678
+ isMain: true,
1679
+ requested: false
1680
+ };
1681
+ checkTrigger({breakout, shouldTrigger: false})
1682
+ });
1683
+ });
1684
+ });
1685
+ });