@webex/plugin-meetings 3.0.0-beta.7 → 3.0.0-beta.71

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