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

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