@webex/plugin-meetings 3.0.0-beta.11 → 3.0.0-beta.110

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