@webex/plugin-meetings 3.0.0-beta.13 → 3.0.0-beta.130

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