@webex/plugin-meetings 3.0.0-beta.1 → 3.0.0-beta.104

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 (548) 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 +919 -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 +10 -24
  30. package/dist/common/errors/captcha-error.js.map +1 -1
  31. package/dist/common/errors/intent-to-join.js +11 -24
  32. package/dist/common/errors/intent-to-join.js.map +1 -1
  33. package/dist/common/errors/join-meeting.js +12 -25
  34. package/dist/common/errors/join-meeting.js.map +1 -1
  35. package/dist/common/errors/media.js +10 -24
  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 +10 -24
  40. package/dist/common/errors/password-error.js.map +1 -1
  41. package/dist/common/errors/permission.js +9 -23
  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 +10 -24
  46. package/dist/common/errors/reconnection.js.map +1 -1
  47. package/dist/common/errors/stats.js +10 -24
  48. package/dist/common/errors/stats.js.map +1 -1
  49. package/dist/common/errors/webex-errors.js +10 -69
  50. package/dist/common/errors/webex-errors.js.map +1 -1
  51. package/dist/common/errors/webex-meetings-error.js +5 -25
  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 +37 -60
  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 +7 -6
  70. package/dist/config.js.map +1 -1
  71. package/dist/constants.js +184 -122
  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 +25 -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 +250 -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 +56 -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 +362 -208
  94. package/dist/locus-info/index.js.map +1 -1
  95. package/dist/locus-info/infoUtils.js +3 -37
  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 +92 -118
  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 +113 -337
  104. package/dist/media/index.js.map +1 -1
  105. package/dist/media/properties.js +96 -135
  106. package/dist/media/properties.js.map +1 -1
  107. package/dist/media/util.js +1 -35
  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 +59 -14
  112. package/dist/meeting/in-meeting-actions.js.map +1 -1
  113. package/dist/meeting/index.js +2909 -2398
  114. package/dist/meeting/index.js.map +1 -1
  115. package/dist/meeting/muteState.js +257 -112
  116. package/dist/meeting/muteState.js.map +1 -1
  117. package/dist/meeting/request.js +330 -264
  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 +63 -261
  124. package/dist/meeting/util.js.map +1 -1
  125. package/dist/meeting-info/collection.js +6 -25
  126. package/dist/meeting-info/collection.js.map +1 -1
  127. package/dist/meeting-info/index.js +14 -32
  128. package/dist/meeting-info/index.js.map +1 -1
  129. package/dist/meeting-info/meeting-info-v2.js +273 -280
  130. package/dist/meeting-info/meeting-info-v2.js.map +1 -1
  131. package/dist/meeting-info/request.js +3 -15
  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 +26 -19
  138. package/dist/meetings/collection.js.map +1 -1
  139. package/dist/meetings/index.js +741 -548
  140. package/dist/meetings/index.js.map +1 -1
  141. package/dist/meetings/request.js +26 -41
  142. package/dist/meetings/request.js.map +1 -1
  143. package/dist/meetings/util.js +194 -149
  144. package/dist/meetings/util.js.map +1 -1
  145. package/dist/member/index.js +100 -85
  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 +90 -68
  150. package/dist/member/util.js.map +1 -1
  151. package/dist/members/collection.js +13 -12
  152. package/dist/members/collection.js.map +1 -1
  153. package/dist/members/index.js +227 -188
  154. package/dist/members/index.js.map +1 -1
  155. package/dist/members/request.js +54 -39
  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 +5 -14
  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 +67 -159
  166. package/dist/metrics/index.js.map +1 -1
  167. package/dist/multistream/mediaRequestManager.js +250 -0
  168. package/dist/multistream/mediaRequestManager.js.map +1 -0
  169. package/dist/multistream/receiveSlot.js +202 -0
  170. package/dist/multistream/receiveSlot.js.map +1 -0
  171. package/dist/multistream/receiveSlotManager.js +176 -0
  172. package/dist/multistream/receiveSlotManager.js.map +1 -0
  173. package/dist/multistream/remoteMedia.js +270 -0
  174. package/dist/multistream/remoteMedia.js.map +1 -0
  175. package/dist/multistream/remoteMediaGroup.js +209 -0
  176. package/dist/multistream/remoteMediaGroup.js.map +1 -0
  177. package/dist/multistream/remoteMediaManager.js +1137 -0
  178. package/dist/multistream/remoteMediaManager.js.map +1 -0
  179. package/dist/networkQualityMonitor/index.js +40 -59
  180. package/dist/networkQualityMonitor/index.js.map +1 -1
  181. package/dist/personal-meeting-room/index.js +21 -45
  182. package/dist/personal-meeting-room/index.js.map +1 -1
  183. package/dist/personal-meeting-room/request.js +1 -31
  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 +192 -191
  188. package/dist/reachability/index.js.map +1 -1
  189. package/dist/reachability/request.js +15 -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 +109 -0
  194. package/dist/reactions/reactions.js.map +1 -0
  195. package/dist/reactions/reactions.type.js +36 -0
  196. package/dist/reactions/reactions.type.js.map +1 -0
  197. package/dist/reconnection-manager/index.js +386 -527
  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 +84 -286
  206. package/dist/roap/index.js.map +1 -1
  207. package/dist/roap/request.js +138 -238
  208. package/dist/roap/request.js.map +1 -1
  209. package/dist/roap/turnDiscovery.js +164 -102
  210. package/dist/roap/turnDiscovery.js.map +1 -1
  211. package/dist/statsAnalyzer/global.js +1 -93
  212. package/dist/statsAnalyzer/global.js.map +1 -1
  213. package/dist/statsAnalyzer/index.js +399 -470
  214. package/dist/statsAnalyzer/index.js.map +1 -1
  215. package/dist/statsAnalyzer/mqaUtil.js +143 -87
  216. package/dist/statsAnalyzer/mqaUtil.js.map +1 -1
  217. package/dist/transcription/index.js +22 -47
  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 +968 -0
  254. package/dist/types/controls-options-manager/constants.d.ts +4 -0
  255. package/dist/types/controls-options-manager/enums.d.ts +13 -0
  256. package/dist/types/controls-options-manager/index.d.ts +136 -0
  257. package/dist/types/controls-options-manager/types.d.ts +37 -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 +129 -0
  274. package/dist/types/meeting/index.d.ts +1748 -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 +112 -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 +156 -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 +172 -0
  299. package/dist/types/metrics/constants.d.ts +54 -0
  300. package/dist/types/metrics/index.d.ts +152 -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 +29 -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 +823 -0
  338. package/src/breakouts/request.ts +55 -0
  339. package/src/breakouts/utils.ts +57 -0
  340. package/src/common/{browser-detection.js → browser-detection.ts} +9 -6
  341. package/src/common/collection.ts +9 -7
  342. package/src/common/{config.js → config.ts} +1 -1
  343. package/src/common/errors/{captcha-error.js → captcha-error.ts} +11 -7
  344. package/src/common/errors/{intent-to-join.js → intent-to-join.ts} +12 -7
  345. package/src/common/errors/{join-meeting.js → join-meeting.ts} +17 -8
  346. package/src/common/errors/{media.js → media.ts} +11 -7
  347. package/src/common/errors/parameter.ts +11 -7
  348. package/src/common/errors/{password-error.js → password-error.ts} +11 -7
  349. package/src/common/errors/{permission.js → permission.ts} +10 -6
  350. package/src/common/errors/{reconnection.js → reconnection.ts} +11 -7
  351. package/src/common/errors/{stats.js → stats.ts} +11 -7
  352. package/src/common/errors/{webex-errors.js → webex-errors.ts} +8 -25
  353. package/src/common/errors/{webex-meetings-error.js → webex-meetings-error.ts} +4 -2
  354. package/src/common/events/{events-scope.js → events-scope.ts} +6 -2
  355. package/src/common/events/{events.js → events.ts} +5 -1
  356. package/src/common/events/{trigger-proxy.js → trigger-proxy.ts} +9 -5
  357. package/src/common/events/{util.js → util.ts} +2 -3
  358. package/src/common/logs/{logger-config.js → logger-config.ts} +1 -2
  359. package/src/common/logs/logger-proxy.ts +44 -0
  360. package/src/common/logs/{request.js → request.ts} +22 -9
  361. package/src/common/queue.ts +1 -2
  362. package/src/{config.js → config.ts} +18 -12
  363. package/src/constants.ts +256 -183
  364. package/src/controls-options-manager/constants.ts +5 -0
  365. package/src/controls-options-manager/enums.ts +16 -0
  366. package/src/controls-options-manager/index.ts +278 -0
  367. package/src/controls-options-manager/types.ts +49 -0
  368. package/src/controls-options-manager/util.ts +229 -0
  369. package/src/index.ts +33 -0
  370. package/src/locus-info/controlsUtils.ts +169 -0
  371. package/src/locus-info/{embeddedAppsUtils.js → embeddedAppsUtils.ts} +5 -6
  372. package/src/locus-info/{fullState.js → fullState.ts} +16 -12
  373. package/src/locus-info/{hostUtils.js → hostUtils.ts} +9 -8
  374. package/src/locus-info/{index.js → index.ts} +331 -80
  375. package/src/locus-info/{infoUtils.js → infoUtils.ts} +19 -8
  376. package/src/locus-info/{mediaSharesUtils.js → mediaSharesUtils.ts} +17 -17
  377. package/src/locus-info/{parser.js → parser.ts} +67 -79
  378. package/src/locus-info/{selfUtils.js → selfUtils.ts} +196 -67
  379. package/src/media/index.ts +488 -0
  380. package/src/media/{properties.js → properties.ts} +67 -54
  381. package/src/media/util.ts +16 -0
  382. package/src/mediaQualityMetrics/config.ts +384 -0
  383. package/src/meeting/in-meeting-actions.ts +123 -3
  384. package/src/meeting/{index.js → index.ts} +3334 -1775
  385. package/src/meeting/muteState.ts +526 -0
  386. package/src/meeting/{request.js → request.ts} +350 -142
  387. package/src/meeting/request.type.ts +13 -0
  388. package/src/meeting/{state.js → state.ts} +50 -35
  389. package/src/meeting/{util.js → util.ts} +126 -159
  390. package/src/meeting-info/{collection.js → collection.ts} +6 -2
  391. package/src/meeting-info/{index.js → index.ts} +42 -36
  392. package/src/meeting-info/meeting-info-v2.ts +345 -0
  393. package/src/meeting-info/{request.js → request.ts} +14 -4
  394. package/src/meeting-info/{util.js → util.ts} +60 -51
  395. package/src/meeting-info/{utilv2.js → utilv2.ts} +76 -60
  396. package/src/meetings/{collection.js → collection.ts} +26 -3
  397. package/src/meetings/index.ts +1394 -0
  398. package/src/meetings/{request.js → request.ts} +34 -25
  399. package/src/meetings/util.ts +288 -0
  400. package/src/member/{index.js → index.ts} +124 -56
  401. package/src/member/types.ts +24 -0
  402. package/src/member/{util.js → util.ts} +105 -25
  403. package/src/members/{collection.js → collection.ts} +10 -2
  404. package/src/members/{index.js → index.ts} +359 -139
  405. package/src/members/request.ts +215 -0
  406. package/src/members/types.ts +28 -0
  407. package/src/members/{util.js → util.ts} +145 -54
  408. package/src/metrics/{config.js → config.ts} +256 -92
  409. package/src/metrics/{constants.js → constants.ts} +1 -6
  410. package/src/metrics/{index.js → index.ts} +116 -97
  411. package/src/multistream/mediaRequestManager.ts +324 -0
  412. package/src/multistream/receiveSlot.ts +184 -0
  413. package/src/multistream/receiveSlotManager.ts +166 -0
  414. package/src/multistream/remoteMedia.ts +254 -0
  415. package/src/multistream/remoteMediaGroup.ts +225 -0
  416. package/src/multistream/remoteMediaManager.ts +1075 -0
  417. package/src/networkQualityMonitor/{index.js → index.ts} +41 -29
  418. package/src/personal-meeting-room/{index.js → index.ts} +28 -19
  419. package/src/personal-meeting-room/{request.js → request.ts} +13 -4
  420. package/src/personal-meeting-room/{util.js → util.ts} +4 -4
  421. package/src/reachability/{index.js → index.ts} +157 -94
  422. package/src/reachability/request.ts +46 -35
  423. package/src/reactions/constants.ts +4 -0
  424. package/src/reactions/reactions.ts +104 -0
  425. package/src/reactions/reactions.type.ts +62 -0
  426. package/src/reconnection-manager/{index.js → index.ts} +261 -163
  427. package/src/recording-controller/enums.ts +8 -0
  428. package/src/recording-controller/index.ts +315 -0
  429. package/src/recording-controller/util.ts +58 -0
  430. package/src/roap/index.ts +241 -0
  431. package/src/roap/request.ts +172 -0
  432. package/src/roap/turnDiscovery.ts +127 -53
  433. package/src/statsAnalyzer/global.ts +37 -0
  434. package/src/statsAnalyzer/index.ts +1273 -0
  435. package/src/statsAnalyzer/mqaUtil.ts +291 -0
  436. package/src/transcription/{index.js → index.ts} +46 -39
  437. package/test/integration/spec/converged-space-meetings.js +177 -0
  438. package/test/integration/spec/journey.js +666 -464
  439. package/test/integration/spec/space-meeting.js +321 -206
  440. package/test/integration/spec/transcription.js +7 -8
  441. package/test/unit/spec/annotation/index.ts +435 -0
  442. package/test/unit/spec/breakouts/breakout.ts +184 -0
  443. package/test/unit/spec/breakouts/collection.ts +15 -0
  444. package/test/unit/spec/breakouts/edit-lock-error.ts +30 -0
  445. package/test/unit/spec/breakouts/events.ts +77 -0
  446. package/test/unit/spec/breakouts/index.ts +1504 -0
  447. package/test/unit/spec/breakouts/request.ts +104 -0
  448. package/test/unit/spec/breakouts/utils.js +72 -0
  449. package/test/unit/spec/common/browser-detection.js +9 -28
  450. package/test/unit/spec/controls-options-manager/index.js +287 -0
  451. package/test/unit/spec/controls-options-manager/util.js +403 -0
  452. package/test/unit/spec/fixture/locus.js +92 -90
  453. package/test/unit/spec/locus-info/controlsUtils.js +177 -32
  454. package/test/unit/spec/locus-info/embeddedAppsUtils.js +8 -6
  455. package/test/unit/spec/locus-info/index.js +493 -3
  456. package/test/unit/spec/locus-info/infoUtils.js +41 -32
  457. package/test/unit/spec/locus-info/lib/BasicSeqCmp.json +88 -430
  458. package/test/unit/spec/locus-info/lib/SeqCmp.json +513 -685
  459. package/test/unit/spec/locus-info/parser.js +3 -9
  460. package/test/unit/spec/locus-info/selfConstant.js +110 -103
  461. package/test/unit/spec/locus-info/selfUtils.js +236 -12
  462. package/test/unit/spec/media/index.ts +303 -0
  463. package/test/unit/spec/media/properties.ts +73 -82
  464. package/test/unit/spec/meeting/in-meeting-actions.ts +58 -3
  465. package/test/unit/spec/meeting/index.js +3127 -975
  466. package/test/unit/spec/meeting/muteState.js +375 -70
  467. package/test/unit/spec/meeting/request.js +217 -43
  468. package/test/unit/spec/meeting/utils.js +205 -163
  469. package/test/unit/spec/meeting-info/meetinginfov2.js +268 -74
  470. package/test/unit/spec/meeting-info/request.js +7 -9
  471. package/test/unit/spec/meeting-info/util.js +11 -12
  472. package/test/unit/spec/meeting-info/utilv2.js +131 -74
  473. package/test/unit/spec/meetings/collection.js +15 -1
  474. package/test/unit/spec/meetings/index.js +1052 -333
  475. package/test/unit/spec/meetings/utils.js +163 -14
  476. package/test/unit/spec/member/index.js +24 -1
  477. package/test/unit/spec/member/util.js +359 -32
  478. package/test/unit/spec/members/index.js +547 -37
  479. package/test/unit/spec/members/request.js +76 -20
  480. package/test/unit/spec/members/utils.js +191 -4
  481. package/test/unit/spec/metrics/index.js +46 -20
  482. package/test/unit/spec/multistream/mediaRequestManager.ts +1060 -0
  483. package/test/unit/spec/multistream/receiveSlot.ts +163 -0
  484. package/test/unit/spec/multistream/receiveSlotManager.ts +203 -0
  485. package/test/unit/spec/multistream/remoteMedia.ts +255 -0
  486. package/test/unit/spec/multistream/remoteMediaGroup.ts +396 -0
  487. package/test/unit/spec/multistream/remoteMediaManager.ts +1793 -0
  488. package/test/unit/spec/networkQualityMonitor/index.js +24 -18
  489. package/test/unit/spec/personal-meeting-room/personal-meeting-room.js +2 -7
  490. package/test/unit/spec/reachability/index.ts +176 -27
  491. package/test/unit/spec/reachability/request.js +66 -0
  492. package/test/unit/spec/reconnection-manager/index.js +106 -9
  493. package/test/unit/spec/recording-controller/index.js +231 -0
  494. package/test/unit/spec/recording-controller/util.js +102 -0
  495. package/test/unit/spec/roap/index.ts +78 -45
  496. package/test/unit/spec/roap/request.ts +217 -0
  497. package/test/unit/spec/roap/turnDiscovery.ts +93 -49
  498. package/test/unit/spec/stats-analyzer/index.js +118 -65
  499. package/test/utils/cmr.js +44 -42
  500. package/test/utils/constants.js +9 -0
  501. package/test/utils/integrationTestUtils.js +64 -0
  502. package/test/utils/testUtils.js +63 -99
  503. package/test/utils/webex-config.js +22 -18
  504. package/test/utils/webex-test-users.js +57 -50
  505. package/tsconfig.json +6 -0
  506. package/dist/meeting/effectsState.js +0 -327
  507. package/dist/meeting/effectsState.js.map +0 -1
  508. package/dist/peer-connection-manager/index.js +0 -794
  509. package/dist/peer-connection-manager/index.js.map +0 -1
  510. package/dist/peer-connection-manager/util.js +0 -124
  511. package/dist/peer-connection-manager/util.js.map +0 -1
  512. package/dist/roap/collection.js +0 -73
  513. package/dist/roap/collection.js.map +0 -1
  514. package/dist/roap/handler.js +0 -337
  515. package/dist/roap/handler.js.map +0 -1
  516. package/dist/roap/state.js +0 -164
  517. package/dist/roap/state.js.map +0 -1
  518. package/dist/roap/util.js +0 -102
  519. package/dist/roap/util.js.map +0 -1
  520. package/src/common/logs/logger-proxy.js +0 -33
  521. package/src/index.js +0 -15
  522. package/src/locus-info/controlsUtils.js +0 -102
  523. package/src/media/index.js +0 -593
  524. package/src/media/util.js +0 -38
  525. package/src/mediaQualityMetrics/config.js +0 -382
  526. package/src/meeting/effectsState.js +0 -205
  527. package/src/meeting/muteState.js +0 -318
  528. package/src/meeting-info/meeting-info-v2.js +0 -255
  529. package/src/meetings/index.js +0 -986
  530. package/src/meetings/util.js +0 -176
  531. package/src/members/request.js +0 -131
  532. package/src/peer-connection-manager/index.js +0 -723
  533. package/src/peer-connection-manager/util.ts +0 -117
  534. package/src/roap/collection.js +0 -63
  535. package/src/roap/handler.js +0 -252
  536. package/src/roap/index.js +0 -380
  537. package/src/roap/request.js +0 -198
  538. package/src/roap/state.js +0 -149
  539. package/src/roap/util.js +0 -93
  540. package/src/statsAnalyzer/global.js +0 -131
  541. package/src/statsAnalyzer/index.js +0 -1020
  542. package/src/statsAnalyzer/mqaUtil.js +0 -173
  543. package/test/unit/spec/meeting/effectsState.js +0 -293
  544. package/test/unit/spec/peerconnection-manager/index.js +0 -188
  545. package/test/unit/spec/peerconnection-manager/utils.js +0 -48
  546. package/test/unit/spec/peerconnection-manager/utils.test-fixtures.ts +0 -389
  547. package/test/unit/spec/roap/util.js +0 -30
  548. /package/src/common/errors/{reconnection-in-progress.js → reconnection-in-progress.ts} +0 -0
@@ -0,0 +1,1504 @@
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('throw error if missing id in params', async () => {
727
+ const params = {
728
+ sessions: [{name: 'Session 1'}],
729
+ };
730
+ await breakouts.update(params).catch((error) => {
731
+ assert.equal(error.toString(), 'Error: Missing breakout group id');
732
+ });
733
+ });
734
+ it('rejects when edit lock token mismatch', async () => {
735
+ webex.request.returns(
736
+ Promise.reject({
737
+ body: {
738
+ errorCode: BREAKOUTS.ERROR_CODE.EDIT_LOCK_TOKEN_MISMATCH,
739
+ message: 'Edit lock token mismatch',
740
+ },
741
+ })
742
+ );
743
+ LoggerProxy.logger.info = sinon.stub();
744
+
745
+ const params = {
746
+ id: 'groupId',
747
+ sessions: [{name: 'Session 1'}],
748
+ };
749
+
750
+ await assert.isRejected(
751
+ breakouts.update(params),
752
+ BreakoutEditLockedError,
753
+ 'Edit lock token mismatch'
754
+ );
755
+ assert.calledOnceWithExactly(
756
+ LoggerProxy.logger.info,
757
+ 'Breakouts#update --> Edit lock token mismatch'
758
+ );
759
+ });
760
+
761
+ it('rejects when edit not authorized', async () => {
762
+ webex.request.returns(
763
+ Promise.reject({
764
+ body: {
765
+ errorCode: BREAKOUTS.ERROR_CODE.EDIT_NOT_AUTHORIZED,
766
+ },
767
+ })
768
+ );
769
+ LoggerProxy.logger.info = sinon.stub();
770
+
771
+ const params = {
772
+ id: 'groupId',
773
+ sessions: [{name: 'Session 1'}],
774
+ };
775
+
776
+ await assert.isRejected(
777
+ breakouts.update(params),
778
+ BreakoutEditLockedError,
779
+ 'Not authorized to interact with edit lock'
780
+ );
781
+
782
+ assert.calledOnceWithExactly(
783
+ LoggerProxy.logger.info,
784
+ 'Breakouts#update --> Not authorized to interact with edit lock'
785
+ );
786
+ });
787
+
788
+ it('rejects when other unknow error', async () => {
789
+ const mockError = new Error('something wrong');
790
+ webex.request.returns(Promise.reject(mockError));
791
+ LoggerProxy.logger.info = sinon.stub();
792
+
793
+ const params = {
794
+ id: 'groupId',
795
+ sessions: [{name: 'Session 1'}],
796
+ };
797
+
798
+ await assert.isRejected(breakouts.update(params), mockError, 'something wrong');
799
+
800
+ assert.calledOnceWithExactly(
801
+ LoggerProxy.logger.info,
802
+ 'Breakouts#update --> something wrong'
803
+ );
804
+ });
805
+ });
806
+
807
+ describe('#start', () => {
808
+ it('should start breakout sessions', async () => {
809
+ webex.request.returns(
810
+ Promise.resolve({
811
+ body: getBOResponse('OPEN'),
812
+ })
813
+ );
814
+
815
+ breakouts.set('url', 'url');
816
+ await breakouts.getBreakout();
817
+
818
+ const result = await breakouts.start();
819
+ await breakouts.start({id: 'id', someOtherParam: 'someOtherParam'});
820
+
821
+ const arg = webex.request.getCall(1).args[0];
822
+ const argObj1 = arg.body.groups[0];
823
+ const argObj2 = webex.request.getCall(2).args[0].body.groups[0];
824
+
825
+ assert.equal(arg.uri, 'url');
826
+ assert.equal(arg.method, 'PUT');
827
+ assert.deepEqual(argObj1, {
828
+ id: 'groupId',
829
+ action: 'START',
830
+ allowBackToMain: false,
831
+ allowToJoinLater: false,
832
+ duration: BREAKOUTS.DEFAULT_DURATION,
833
+ });
834
+ assert.deepEqual(argObj2, {
835
+ id: 'id',
836
+ action: 'START',
837
+ allowBackToMain: false,
838
+ allowToJoinLater: false,
839
+ someOtherParam: 'someOtherParam',
840
+ duration: BREAKOUTS.DEFAULT_DURATION,
841
+ });
842
+ assert.deepEqual(result, {body: getBOResponse('OPEN')});
843
+ });
844
+
845
+ it('rejects when edit lock token mismatch', async () => {
846
+ webex.request.returns(
847
+ Promise.reject({
848
+ body: {
849
+ errorCode: BREAKOUTS.ERROR_CODE.EDIT_LOCK_TOKEN_MISMATCH,
850
+ message: 'Edit lock token mismatch',
851
+ },
852
+ })
853
+ );
854
+
855
+ await assert.isRejected(
856
+ breakouts.start(),
857
+ BreakoutEditLockedError,
858
+ 'Edit lock token mismatch'
859
+ );
860
+ });
861
+ });
862
+
863
+ describe('#end', () => {
864
+ it('should end breakout sessions', async () => {
865
+ webex.request.returns(
866
+ Promise.resolve({
867
+ body: getBOResponse('CLOSING'),
868
+ })
869
+ );
870
+
871
+ breakouts.set('url', 'url');
872
+ breakouts.set('delayCloseTime', 60);
873
+ await breakouts.getBreakout();
874
+
875
+ const result = await breakouts.end();
876
+ await breakouts.end({id: 'id', someOtherParam: 'someOtherParam'});
877
+ const arg = webex.request.getCall(1).args[0];
878
+ const argObj1 = arg.body.groups[0];
879
+ const argObj2 = webex.request.getCall(2).args[0].body.groups[0];
880
+
881
+ assert.equal(arg.uri, 'url');
882
+ assert.equal(arg.method, 'PUT');
883
+ assert.deepEqual(argObj1, {id: 'groupId', action: 'CLOSE', delayCloseTime: 60});
884
+ assert.deepEqual(argObj2, {
885
+ id: 'id',
886
+ action: 'CLOSE',
887
+ delayCloseTime: 60,
888
+ someOtherParam: 'someOtherParam',
889
+ });
890
+ assert.deepEqual(result, {body: getBOResponse('CLOSING')});
891
+ });
892
+
893
+ it('rejects when edit lock token mismatch', async () => {
894
+ webex.request.returns(
895
+ Promise.reject({
896
+ body: {
897
+ errorCode: BREAKOUTS.ERROR_CODE.EDIT_LOCK_TOKEN_MISMATCH,
898
+ message: 'Edit lock token mismatch',
899
+ },
900
+ })
901
+ );
902
+
903
+ await assert.isRejected(
904
+ breakouts.end(),
905
+ BreakoutEditLockedError,
906
+ 'Edit lock token mismatch'
907
+ );
908
+ });
909
+ });
910
+
911
+ describe('#getBreakout', () => {
912
+ it('should get breakout sessions', async () => {
913
+ webex.request.returns(
914
+ Promise.resolve({
915
+ body: getBOResponse('PENDING'),
916
+ })
917
+ );
918
+
919
+ breakouts.set('url', 'url');
920
+ const result = await breakouts.getBreakout();
921
+ await breakouts.getBreakout(true);
922
+ const arg1 = webex.request.getCall(0).args[0];
923
+ const arg2 = webex.request.getCall(1).args[0];
924
+
925
+ assert.equal(arg1.uri, 'url');
926
+ assert.equal(arg2.uri, 'url?editlock=true');
927
+ assert.equal(arg1.method, 'GET');
928
+ assert.deepEqual(result, {body: getBOResponse('PENDING')});
929
+ assert.deepEqual(breakouts.groups, result.body.groups);
930
+ assert.equal(breakouts.breakoutGroupId, 'groupId');
931
+ });
932
+
933
+ it('breakoutGroupId should be empty if it is CLOSED group', async () => {
934
+ webex.request.returns(
935
+ Promise.resolve({
936
+ body: getBOResponse('CLOSED'),
937
+ })
938
+ );
939
+
940
+ breakouts.set('url', 'url');
941
+ await breakouts.getBreakout();
942
+
943
+ assert.equal(breakouts.breakoutGroupId, '');
944
+ });
945
+
946
+ it('should call keep alive when response with edit lock info', async () => {
947
+ webex.request.returns(
948
+ Promise.resolve({
949
+ body: getBOResponseWithEditLockInfo('PENDING'),
950
+ })
951
+ );
952
+
953
+ breakouts.set('url', 'url');
954
+ breakouts.keepEditLockAlive = sinon.stub().resolves();
955
+ const result = await breakouts.getBreakout();
956
+ await breakouts.getBreakout(true);
957
+
958
+ assert.calledOnceWithExactly(breakouts.keepEditLockAlive);
959
+ });
960
+ it('not call keep alive when response with no edit lock token', async () => {
961
+ webex.request.returns(
962
+ Promise.resolve({
963
+ body: getBOResponseWithEditLockInfo('PENDING', true),
964
+ })
965
+ );
966
+
967
+ breakouts.set('url', 'url');
968
+ breakouts.keepEditLockAlive = sinon.stub().resolves();
969
+ const result = await breakouts.getBreakout();
970
+ await breakouts.getBreakout(true);
971
+
972
+ assert.notCalled(breakouts.keepEditLockAlive);
973
+ });
974
+ });
975
+
976
+ describe('doToggleBreakout', () => {
977
+ it('makes the request as expected', async () => {
978
+ breakouts.set('editLock', {
979
+ ttl: 30,
980
+ token: 'editToken',
981
+ state: 'UNLOCKED',
982
+ });
983
+ const result = await breakouts.doToggleBreakout(true);
984
+ assert.calledOnceWithExactly(webex.request, {
985
+ method: 'PUT',
986
+ uri: 'url',
987
+ body: {
988
+ editlock: {
989
+ token: 'editToken',
990
+ },
991
+ enableBreakoutSession: true,
992
+ },
993
+ });
994
+
995
+ assert.equal(result, 'REQUEST_RETURN_VALUE');
996
+ });
997
+ });
998
+
999
+ describe('delete', () => {
1000
+ it('makes the request as expected', async () => {
1001
+ webex.request.returns(
1002
+ Promise.resolve({
1003
+ body: {
1004
+ groups: [
1005
+ {
1006
+ id: '455556a4-37cd-4baa-89bc-8730581a1cc0',
1007
+ status: 'CLOSE',
1008
+ type: 'BREAKOUT',
1009
+ },
1010
+ ],
1011
+ },
1012
+ })
1013
+ );
1014
+
1015
+ const result = await breakouts.clearSessions();
1016
+ assert.calledOnceWithExactly(webex.request, {
1017
+ method: 'PUT',
1018
+ uri: 'url',
1019
+ body: {
1020
+ groups: [
1021
+ {
1022
+ action: BREAKOUTS.ACTION.DELETE,
1023
+ },
1024
+ ],
1025
+ },
1026
+ });
1027
+
1028
+ assert.equal(breakouts.groups[0].status, 'CLOSE');
1029
+ });
1030
+
1031
+ it('rejects when edit lock token mismatch', async () => {
1032
+ webex.request.returns(
1033
+ Promise.reject({
1034
+ body: {
1035
+ errorCode: BREAKOUTS.ERROR_CODE.EDIT_LOCK_TOKEN_MISMATCH,
1036
+ message: 'Edit lock token mismatch',
1037
+ },
1038
+ })
1039
+ );
1040
+
1041
+ await assert.isRejected(
1042
+ breakouts.clearSessions(),
1043
+ BreakoutEditLockedError,
1044
+ 'Edit lock token mismatch'
1045
+ );
1046
+ });
1047
+ });
1048
+
1049
+ describe('create', () => {
1050
+ it('response not include groups info', async () => {
1051
+ const sessions = [{name: 'session1', anyoneCanJoin: true}];
1052
+ const result = await breakouts.create({sessions});
1053
+
1054
+ assert.equal(result, 'REQUEST_RETURN_VALUE');
1055
+ });
1056
+
1057
+ it('response include groups info', async () => {
1058
+ const sessions = [{name: 'session1', anyoneCanJoin: true}];
1059
+
1060
+ webex.request.returns(
1061
+ Promise.resolve({
1062
+ body: {
1063
+ groups: [
1064
+ {
1065
+ id: '455556a4-37cd-4baa-89bc-8730581a1cc0',
1066
+ status: 'PENDING',
1067
+ type: 'BREAKOUT',
1068
+ },
1069
+ ],
1070
+ },
1071
+ })
1072
+ );
1073
+
1074
+ const result = await breakouts.create({sessions});
1075
+
1076
+ assert.equal(breakouts.groups[0].id, '455556a4-37cd-4baa-89bc-8730581a1cc0');
1077
+ });
1078
+
1079
+ it('rejects when edit lock token mismatch', async () => {
1080
+ const sessions = [{name: 'session1', anyoneCanJoin: true}];
1081
+
1082
+ webex.request.returns(
1083
+ Promise.reject({
1084
+ body: {
1085
+ errorCode: BREAKOUTS.ERROR_CODE.EDIT_LOCK_TOKEN_MISMATCH,
1086
+ message: 'Edit lock token mismatch',
1087
+ },
1088
+ })
1089
+ );
1090
+
1091
+ await assert.isRejected(
1092
+ breakouts.create({sessions}),
1093
+ BreakoutEditLockedError,
1094
+ 'Edit lock token mismatch'
1095
+ );
1096
+ });
1097
+ });
1098
+
1099
+ describe('enableAndLockBreakout', () => {
1100
+ it('enableBreakoutSession is true', async () => {
1101
+ breakouts.enableBreakoutSession = true;
1102
+
1103
+ breakouts.lockBreakout = sinon.stub().resolves();
1104
+
1105
+ breakouts.enableAndLockBreakout();
1106
+
1107
+ assert.calledOnceWithExactly(breakouts.lockBreakout);
1108
+ });
1109
+
1110
+ it('enableBreakoutSession is false', async () => {
1111
+ breakouts.enableBreakoutSession = false;
1112
+
1113
+ breakouts.enableBreakouts = sinon.stub().resolves();
1114
+
1115
+ breakouts.enableAndLockBreakout();
1116
+
1117
+ assert.calledOnceWithExactly(breakouts.enableBreakouts);
1118
+ });
1119
+ });
1120
+
1121
+ describe('lockBreakout', () => {
1122
+ it('lock breakout is true', async () => {
1123
+ breakouts.editLock = {
1124
+ ttl: 30,
1125
+ token: 'token',
1126
+ state: 'UNLOCKED',
1127
+ };
1128
+
1129
+ breakouts.keepEditLockAlive = sinon.stub().resolves();
1130
+
1131
+ breakouts.lockBreakout();
1132
+
1133
+ assert.calledOnceWithExactly(breakouts.keepEditLockAlive);
1134
+ });
1135
+
1136
+ it('lock breakout throw error', async () => {
1137
+ breakouts.editLock = {
1138
+ ttl: 30,
1139
+ token: '2ad57140-01b5-4bd0-a5a7-4dccdc06904c',
1140
+ state: 'LOCKED',
1141
+ };
1142
+
1143
+ await expect(breakouts.lockBreakout()).to.be.rejectedWith('Breakout already locked');
1144
+ });
1145
+
1146
+ it('lock breakout without editLock', async () => {
1147
+ breakouts.getBreakout = sinon.stub().resolves();
1148
+
1149
+ breakouts.lockBreakout();
1150
+
1151
+ assert.calledOnceWithExactly(breakouts.getBreakout, true);
1152
+ });
1153
+ });
1154
+
1155
+ describe('unLockEditBreakout', () => {
1156
+ it('unLock edit breakout request as expected', async () => {
1157
+ breakouts.set('editLock', {
1158
+ ttl: 30,
1159
+ token: '2ad57140-01b5-4bd0-a5a7-4dccdc06904c',
1160
+ state: 'LOCKED',
1161
+ });
1162
+
1163
+ breakouts.unLockEditBreakout();
1164
+ assert.calledOnceWithExactly(webex.request, {
1165
+ method: 'DELETE',
1166
+ uri: 'url/editlock/2ad57140-01b5-4bd0-a5a7-4dccdc06904c',
1167
+ });
1168
+ });
1169
+
1170
+ it('do not call unLock if edit lock info not exist ', async () => {
1171
+ breakouts.unLockEditBreakout();
1172
+ assert.notCalled(webex.request);
1173
+ });
1174
+ });
1175
+
1176
+ describe('keepEditLockAlive', () => {
1177
+ it('keep edit lock', () => {
1178
+ const clock = sinon.useFakeTimers();
1179
+
1180
+ breakouts.set('editLock', {
1181
+ ttl: 30,
1182
+ token: 'token',
1183
+ state: 'UNLOCKED',
1184
+ });
1185
+
1186
+ breakouts.keepEditLockAlive();
1187
+ clock.tick(15001);
1188
+
1189
+ assert.calledOnceWithExactly(webex.request, {
1190
+ method: 'PUT',
1191
+ uri: 'url/editlock/token',
1192
+ });
1193
+
1194
+ clock.restore();
1195
+ });
1196
+
1197
+ it('keep edit lock, ttl < 30, also using 30', () => {
1198
+ const clock = sinon.useFakeTimers();
1199
+
1200
+ breakouts.set('editLock', {
1201
+ ttl: 20,
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, using the ttl', () => {
1218
+ const clock = sinon.useFakeTimers();
1219
+
1220
+ breakouts.set('editLock', {
1221
+ ttl: 50,
1222
+ token: 'token',
1223
+ state: 'UNLOCKED',
1224
+ });
1225
+
1226
+ breakouts.keepEditLockAlive();
1227
+ clock.tick(24099);
1228
+
1229
+ assert.notCalled(webex.request);
1230
+
1231
+ clock.restore();
1232
+ });
1233
+
1234
+ it('keep edit lock, throw error, clearInterval', async () => {
1235
+ breakouts._clearEditLockInfo = sinon.stub();
1236
+
1237
+ const error = new Error('something went wrong');
1238
+ webex.request.rejects(error);
1239
+
1240
+ const clock = sinon.useFakeTimers();
1241
+
1242
+ breakouts.set('editLock', {
1243
+ ttl: 30,
1244
+ token: 'token',
1245
+ state: 'UNLOCKED',
1246
+ });
1247
+
1248
+ breakouts.keepEditLockAlive();
1249
+ clock.tick(15001);
1250
+
1251
+ await testUtils.flushPromises();
1252
+
1253
+ assert.calledOnceWithExactly(breakouts._clearEditLockInfo);
1254
+
1255
+ clock.restore();
1256
+ });
1257
+
1258
+ it('keep edit lock, do not call until reached ttl', () => {
1259
+ const clock = sinon.useFakeTimers();
1260
+
1261
+ breakouts.set('editLock', {
1262
+ ttl: 30,
1263
+ token: 'token',
1264
+ state: 'UNLOCKED',
1265
+ });
1266
+
1267
+ breakouts.keepEditLockAlive();
1268
+ clock.tick(14999);
1269
+
1270
+ assert.notCalled(webex.request);
1271
+
1272
+ clock.tick(1);
1273
+ assert.calledOnceWithExactly(webex.request, {
1274
+ method: 'PUT',
1275
+ uri: 'url/editlock/token',
1276
+ });
1277
+
1278
+ clock.restore();
1279
+ });
1280
+
1281
+ it('clear interval first if previous one is in work', () => {
1282
+ breakouts.set('editLock', {
1283
+ ttl: 30,
1284
+ token: 'token',
1285
+ });
1286
+ const clock = sinon.useFakeTimers();
1287
+ window.clearInterval = sinon.stub();
1288
+ breakouts.keepEditLockAlive();
1289
+ const firstIntervalID = breakouts.intervalID;
1290
+ breakouts.keepEditLockAlive();
1291
+
1292
+ assert.calledWithExactly(window.clearInterval, firstIntervalID);
1293
+ clock.restore();
1294
+ });
1295
+ });
1296
+
1297
+ describe('#assign', () => {
1298
+ it('assign members and emails to a breakout session', async () => {
1299
+ breakouts.assign = sinon.stub().returns(Promise.resolve('ASSIGN_RETURN_VALUE'));
1300
+ const params = [
1301
+ {id: 'sessionId', memberIds: ['111'], emails: ['111@cisco.com'], anyone: true},
1302
+ ];
1303
+ const result = await breakouts.assign(params);
1304
+ assert.calledOnceWithExactly(breakouts.assign, params);
1305
+ assert.equal(result, 'ASSIGN_RETURN_VALUE');
1306
+ });
1307
+ it('assign only members to a breakout session', async () => {
1308
+ breakouts.assign = sinon.stub().returns(Promise.resolve('ASSIGN_RETURN_VALUE'));
1309
+ const params = [{id: 'sessionId', memberIds: ['111']}];
1310
+ const result = await breakouts.assign(params);
1311
+ assert.calledOnceWithExactly(breakouts.assign, params);
1312
+ assert.equal(result, 'ASSIGN_RETURN_VALUE');
1313
+ });
1314
+ it('assign only emails to a breakout session', async () => {
1315
+ breakouts.assign = sinon.stub().returns(Promise.resolve('ASSIGN_RETURN_VALUE'));
1316
+ const params = [{id: 'sessionId', emails: ['111@cisco.com']}];
1317
+ const result = await breakouts.assign(params);
1318
+ assert.calledOnceWithExactly(breakouts.assign, params);
1319
+ assert.equal(result, 'ASSIGN_RETURN_VALUE');
1320
+ });
1321
+
1322
+ it('called with editlock', async () => {
1323
+ breakouts.request = sinon.stub().returns(Promise.resolve('ASSIGN_RETURN_VALUE'));
1324
+ breakouts.editLock = {
1325
+ token: 'token1',
1326
+ };
1327
+ const params = [{id: 'sessionId', emails: ['111@cisco.com'], memberIds: []}];
1328
+ await breakouts.assign(params);
1329
+ const args = breakouts.request.getCall(0).args[0];
1330
+ expect(args).to.be.an('object', {
1331
+ method: 'PUT',
1332
+ uri: 'url',
1333
+ body: {
1334
+ editlock: {token: 'token1', refresh: true},
1335
+ groups: {
1336
+ id: 'sessionId',
1337
+ sessions: [
1338
+ {
1339
+ id: 'sessionId',
1340
+ assigned: [],
1341
+ assignedEmails: ['111@cisco.com'],
1342
+ anyoneCanJoin: false,
1343
+ },
1344
+ ],
1345
+ },
1346
+ },
1347
+ });
1348
+ });
1349
+ });
1350
+
1351
+ describe('queryPreAssignments', () => {
1352
+ it('makes the expected query', async () => {
1353
+ webex.request.returns(
1354
+ Promise.resolve({
1355
+ body: {
1356
+ groups: [
1357
+ {
1358
+ sessions: [
1359
+ {
1360
+ name: 'Breakout session 1',
1361
+ assignedEmails: ['a@a.com', 'b@b.com', 'jial2@cisco.com'],
1362
+ anyoneCanJoin: false,
1363
+ },
1364
+ {
1365
+ name: 'Breakout session 2',
1366
+ anyoneCanJoin: false,
1367
+ },
1368
+ {
1369
+ name: 'Breakout session 3',
1370
+ assignedEmails: ['c@c.com'],
1371
+ anyoneCanJoin: false,
1372
+ },
1373
+ ],
1374
+ unassignedInvitees: {
1375
+ emails: ['d@d.com'],
1376
+ },
1377
+ type: 'BREAKOUT',
1378
+ },
1379
+ ],
1380
+ },
1381
+ })
1382
+ );
1383
+ breakouts.shouldFetchPreassignments = false;
1384
+ const result = await breakouts.queryPreAssignments({enableBreakoutSession: true, hasBreakoutPreAssignments: true});
1385
+ const arg = webex.request.getCall(0).args[0];
1386
+ assert.equal(arg.uri, 'url/preassignments');
1387
+ assert.equal(breakouts.preAssignments[0].unassignedInvitees.emails[0], 'd@d.com');
1388
+ assert.equal(breakouts.preAssignments[0].sessions[0].name, 'Breakout session 1');
1389
+ assert.equal(breakouts.preAssignments[0].sessions[0].anyoneCanJoin, false);
1390
+ assert.equal(
1391
+ breakouts.preAssignments[0].sessions[0].assignedEmails.toString(),
1392
+ ['a@a.com', 'b@b.com', 'jial2@cisco.com'].toString()
1393
+ );
1394
+ assert.equal(breakouts.preAssignments[0].sessions[1].name, 'Breakout session 2');
1395
+ assert.equal(breakouts.preAssignments[0].sessions[1].anyoneCanJoin, false);
1396
+ assert.equal(breakouts.preAssignments[0].sessions[1].assignedEmails, undefined);
1397
+ assert.equal(breakouts.preAssignments[0].sessions[2].name, 'Breakout session 3');
1398
+ assert.equal(breakouts.preAssignments[0].sessions[2].anyoneCanJoin, false);
1399
+ assert.equal(breakouts.preAssignments[0].sessions[2].assignedEmails[0], 'c@c.com');
1400
+ assert.equal(breakouts.preAssignments[0].unassignedInvitees.emails[0], 'd@d.com');
1401
+ assert.equal(breakouts.preAssignments[0].type, 'BREAKOUT');
1402
+ assert.equal(breakouts.shouldFetchPreassignments, true);
1403
+ });
1404
+
1405
+ it('rejects when no pre-assignments created for this meeting', async () => {
1406
+ const response = {
1407
+ statusCode: 404,
1408
+ body: {
1409
+ errorCode: 201404004,
1410
+ message: 'No pre-assignments created for this meeting',
1411
+ },
1412
+ };
1413
+ webex.request.rejects(response);
1414
+ LoggerProxy.logger.error = sinon.stub();
1415
+ const result = await breakouts.queryPreAssignments({enableBreakoutSession: true, hasBreakoutPreAssignments: true});
1416
+ await testUtils.flushPromises();
1417
+ assert.calledOnceWithExactly(
1418
+ LoggerProxy.logger.error,
1419
+ 'Meeting:breakouts#queryPreAssignments failed',
1420
+ response
1421
+ );
1422
+ });
1423
+
1424
+ it('fail when no correct params', () => {
1425
+
1426
+ assert.deepEqual(breakouts.queryPreAssignments(undefined), undefined);
1427
+
1428
+ assert.deepEqual(breakouts.queryPreAssignments({}), undefined);
1429
+
1430
+ assert.deepEqual(breakouts.queryPreAssignments({ enableBreakoutSession: true, hasBreakoutPreAssignments: false }), undefined);
1431
+
1432
+ assert.deepEqual(breakouts.queryPreAssignments({ enableBreakoutSession: false, hasBreakoutPreAssignments: true }), undefined);
1433
+
1434
+ assert.deepEqual(breakouts.queryPreAssignments({ enableBreakoutSession: false, hasBreakoutPreAssignments: false }), undefined);
1435
+
1436
+ });
1437
+
1438
+ });
1439
+
1440
+ describe('#dynamicAssign', () => {
1441
+ it('should make a PUT request with correct body and return the result', async () => {
1442
+ breakouts.dynamicAssign = sinon.stub().returns(Promise.resolve('REQUEST_RETURN_VALUE'));
1443
+
1444
+ const expectedBody = {
1445
+ groups: [
1446
+ {
1447
+ id: 'breakoutGroup1',
1448
+ sessions: [
1449
+ {
1450
+ id: 'session1',
1451
+ participants: ['participant1', 'participant2'],
1452
+ targetState: 'JOINED',
1453
+ },
1454
+ ],
1455
+ },
1456
+ ],
1457
+ editlock: {
1458
+ token: 'abcdefg',
1459
+ },
1460
+ };
1461
+
1462
+ const result = await breakouts.dynamicAssign(expectedBody);
1463
+
1464
+ assert.calledOnceWithExactly(breakouts.dynamicAssign, expectedBody);
1465
+ assert.equal(result, 'REQUEST_RETURN_VALUE');
1466
+ });
1467
+ });
1468
+
1469
+ describe('#triggerReturnToMainEvent', () => {
1470
+ const checkTrigger = ({breakout, shouldTrigger}) => {
1471
+ breakouts.trigger = sinon.stub();
1472
+ breakouts.triggerReturnToMainEvent(breakout);
1473
+ if (shouldTrigger) {
1474
+ assert.calledOnceWithExactly(breakouts.trigger, BREAKOUTS.EVENTS.ASK_RETURN_TO_MAIN);
1475
+ } else {
1476
+ assert.notCalled(breakouts.trigger);
1477
+ }
1478
+ }
1479
+ it('should trigger ASK_RETURN_TO_MAIN event correctly', () => {
1480
+ const breakout = {
1481
+ isMain: true,
1482
+ requested: true
1483
+ };
1484
+ checkTrigger({breakout, shouldTrigger: true})
1485
+ });
1486
+
1487
+ it('should not trigger ASK_RETURN_TO_MAIN event when sessionType is not MAIN', () => {
1488
+ const breakout = {
1489
+ isMain: false,
1490
+ requested: true
1491
+ };
1492
+ checkTrigger({breakout, shouldTrigger: false});
1493
+ });
1494
+
1495
+ it('should not trigger ASK_RETURN_TO_MAIN event when session is not requested', () => {
1496
+ const breakout = {
1497
+ isMain: true,
1498
+ requested: false
1499
+ };
1500
+ checkTrigger({breakout, shouldTrigger: false})
1501
+ });
1502
+ });
1503
+ });
1504
+ });