@webex/plugin-meetings 3.0.0-beta.31 → 3.0.0-beta.310

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 (378) hide show
  1. package/README.md +46 -8
  2. package/dist/annotation/annotation.types.js +7 -0
  3. package/dist/annotation/annotation.types.js.map +1 -0
  4. package/dist/annotation/constants.js +49 -0
  5. package/dist/annotation/constants.js.map +1 -0
  6. package/dist/annotation/index.js +342 -0
  7. package/dist/annotation/index.js.map +1 -0
  8. package/dist/breakouts/breakout.js +94 -15
  9. package/dist/breakouts/breakout.js.map +1 -1
  10. package/dist/breakouts/edit-lock-error.js +52 -0
  11. package/dist/breakouts/edit-lock-error.js.map +1 -0
  12. package/dist/breakouts/events.js +45 -0
  13. package/dist/breakouts/events.js.map +1 -0
  14. package/dist/breakouts/index.js +709 -35
  15. package/dist/breakouts/index.js.map +1 -1
  16. package/dist/breakouts/utils.js +45 -1
  17. package/dist/breakouts/utils.js.map +1 -1
  18. package/dist/common/errors/no-meeting-info.js +51 -0
  19. package/dist/common/errors/no-meeting-info.js.map +1 -0
  20. package/dist/common/errors/reclaim-host-role-errors.js +158 -0
  21. package/dist/common/errors/reclaim-host-role-errors.js.map +1 -0
  22. package/dist/common/errors/webex-errors.js +48 -7
  23. package/dist/common/errors/webex-errors.js.map +1 -1
  24. package/dist/common/logs/logger-proxy.js +1 -1
  25. package/dist/common/logs/logger-proxy.js.map +1 -1
  26. package/dist/common/logs/request.js +5 -1
  27. package/dist/common/logs/request.js.map +1 -1
  28. package/dist/common/queue.js +24 -9
  29. package/dist/common/queue.js.map +1 -1
  30. package/dist/config.js +5 -11
  31. package/dist/config.js.map +1 -1
  32. package/dist/constants.js +233 -29
  33. package/dist/constants.js.map +1 -1
  34. package/dist/controls-options-manager/enums.js +14 -2
  35. package/dist/controls-options-manager/enums.js.map +1 -1
  36. package/dist/controls-options-manager/index.js +109 -15
  37. package/dist/controls-options-manager/index.js.map +1 -1
  38. package/dist/controls-options-manager/types.js +7 -0
  39. package/dist/controls-options-manager/types.js.map +1 -0
  40. package/dist/controls-options-manager/util.js +309 -18
  41. package/dist/controls-options-manager/util.js.map +1 -1
  42. package/dist/index.js +112 -1
  43. package/dist/index.js.map +1 -1
  44. package/dist/interpretation/collection.js +23 -0
  45. package/dist/interpretation/collection.js.map +1 -0
  46. package/dist/interpretation/index.js +366 -0
  47. package/dist/interpretation/index.js.map +1 -0
  48. package/dist/interpretation/siLanguage.js +25 -0
  49. package/dist/interpretation/siLanguage.js.map +1 -0
  50. package/dist/locus-info/controlsUtils.js +91 -2
  51. package/dist/locus-info/controlsUtils.js.map +1 -1
  52. package/dist/locus-info/index.js +383 -62
  53. package/dist/locus-info/index.js.map +1 -1
  54. package/dist/locus-info/infoUtils.js +7 -1
  55. package/dist/locus-info/infoUtils.js.map +1 -1
  56. package/dist/locus-info/mediaSharesUtils.js +57 -1
  57. package/dist/locus-info/mediaSharesUtils.js.map +1 -1
  58. package/dist/locus-info/parser.js +249 -72
  59. package/dist/locus-info/parser.js.map +1 -1
  60. package/dist/locus-info/selfUtils.js +89 -14
  61. package/dist/locus-info/selfUtils.js.map +1 -1
  62. package/dist/media/index.js +61 -116
  63. package/dist/media/index.js.map +1 -1
  64. package/dist/media/properties.js +73 -124
  65. package/dist/media/properties.js.map +1 -1
  66. package/dist/meeting/in-meeting-actions.js +82 -2
  67. package/dist/meeting/in-meeting-actions.js.map +1 -1
  68. package/dist/meeting/index.js +3777 -2929
  69. package/dist/meeting/index.js.map +1 -1
  70. package/dist/meeting/locusMediaRequest.js +292 -0
  71. package/dist/meeting/locusMediaRequest.js.map +1 -0
  72. package/dist/meeting/muteState.js +230 -124
  73. package/dist/meeting/muteState.js.map +1 -1
  74. package/dist/meeting/request.js +260 -196
  75. package/dist/meeting/request.js.map +1 -1
  76. package/dist/meeting/util.js +601 -417
  77. package/dist/meeting/util.js.map +1 -1
  78. package/dist/meeting-info/index.js +73 -7
  79. package/dist/meeting-info/index.js.map +1 -1
  80. package/dist/meeting-info/meeting-info-v2.js +192 -51
  81. package/dist/meeting-info/meeting-info-v2.js.map +1 -1
  82. package/dist/meeting-info/util.js +1 -1
  83. package/dist/meeting-info/util.js.map +1 -1
  84. package/dist/meeting-info/utilv2.js +36 -36
  85. package/dist/meeting-info/utilv2.js.map +1 -1
  86. package/dist/meetings/collection.js +39 -0
  87. package/dist/meetings/collection.js.map +1 -1
  88. package/dist/meetings/index.js +415 -115
  89. package/dist/meetings/index.js.map +1 -1
  90. package/dist/meetings/meetings.types.js +7 -0
  91. package/dist/meetings/meetings.types.js.map +1 -0
  92. package/dist/meetings/request.js +2 -0
  93. package/dist/meetings/request.js.map +1 -1
  94. package/dist/meetings/util.js +72 -6
  95. package/dist/meetings/util.js.map +1 -1
  96. package/dist/member/index.js +58 -0
  97. package/dist/member/index.js.map +1 -1
  98. package/dist/member/types.js +25 -0
  99. package/dist/member/types.js.map +1 -0
  100. package/dist/member/util.js +132 -25
  101. package/dist/member/util.js.map +1 -1
  102. package/dist/members/collection.js +10 -0
  103. package/dist/members/collection.js.map +1 -1
  104. package/dist/members/index.js +102 -6
  105. package/dist/members/index.js.map +1 -1
  106. package/dist/members/request.js +106 -38
  107. package/dist/members/request.js.map +1 -1
  108. package/dist/members/types.js +15 -0
  109. package/dist/members/types.js.map +1 -0
  110. package/dist/members/util.js +326 -232
  111. package/dist/members/util.js.map +1 -1
  112. package/dist/metrics/constants.js +13 -5
  113. package/dist/metrics/constants.js.map +1 -1
  114. package/dist/metrics/index.js +1 -468
  115. package/dist/metrics/index.js.map +1 -1
  116. package/dist/multistream/mediaRequestManager.js +238 -49
  117. package/dist/multistream/mediaRequestManager.js.map +1 -1
  118. package/dist/multistream/receiveSlot.js +29 -16
  119. package/dist/multistream/receiveSlot.js.map +1 -1
  120. package/dist/multistream/receiveSlotManager.js +39 -36
  121. package/dist/multistream/receiveSlotManager.js.map +1 -1
  122. package/dist/multistream/remoteMedia.js +44 -18
  123. package/dist/multistream/remoteMedia.js.map +1 -1
  124. package/dist/multistream/remoteMediaGroup.js +60 -3
  125. package/dist/multistream/remoteMediaGroup.js.map +1 -1
  126. package/dist/multistream/remoteMediaManager.js +209 -59
  127. package/dist/multistream/remoteMediaManager.js.map +1 -1
  128. package/dist/multistream/sendSlotManager.js +233 -0
  129. package/dist/multistream/sendSlotManager.js.map +1 -0
  130. package/dist/reachability/index.js +225 -59
  131. package/dist/reachability/index.js.map +1 -1
  132. package/dist/reachability/request.js +17 -8
  133. package/dist/reachability/request.js.map +1 -1
  134. package/dist/reconnection-manager/index.js +201 -156
  135. package/dist/reconnection-manager/index.js.map +1 -1
  136. package/dist/recording-controller/index.js +21 -2
  137. package/dist/recording-controller/index.js.map +1 -1
  138. package/dist/recording-controller/util.js +9 -8
  139. package/dist/recording-controller/util.js.map +1 -1
  140. package/dist/roap/index.js +62 -32
  141. package/dist/roap/index.js.map +1 -1
  142. package/dist/roap/request.js +112 -97
  143. package/dist/roap/request.js.map +1 -1
  144. package/dist/roap/turnDiscovery.js +95 -36
  145. package/dist/roap/turnDiscovery.js.map +1 -1
  146. package/dist/rtcMetrics/constants.js +12 -0
  147. package/dist/rtcMetrics/constants.js.map +1 -0
  148. package/dist/rtcMetrics/index.js +117 -0
  149. package/dist/rtcMetrics/index.js.map +1 -0
  150. package/dist/statsAnalyzer/index.js +86 -78
  151. package/dist/statsAnalyzer/index.js.map +1 -1
  152. package/dist/statsAnalyzer/mqaUtil.js +11 -10
  153. package/dist/statsAnalyzer/mqaUtil.js.map +1 -1
  154. package/dist/types/annotation/annotation.types.d.ts +42 -0
  155. package/dist/types/annotation/constants.d.ts +31 -0
  156. package/dist/types/annotation/index.d.ts +117 -0
  157. package/dist/types/breakouts/edit-lock-error.d.ts +15 -0
  158. package/dist/types/breakouts/events.d.ts +8 -0
  159. package/dist/types/breakouts/utils.d.ts +14 -0
  160. package/dist/types/common/errors/no-meeting-info.d.ts +14 -0
  161. package/dist/types/common/errors/reclaim-host-role-errors.d.ts +60 -0
  162. package/dist/types/common/errors/webex-errors.d.ts +25 -1
  163. package/dist/types/common/logs/request.d.ts +2 -0
  164. package/dist/types/common/queue.d.ts +9 -7
  165. package/dist/types/config.d.ts +1 -7
  166. package/dist/types/constants.d.ts +194 -24
  167. package/dist/types/controls-options-manager/enums.d.ts +11 -1
  168. package/dist/types/controls-options-manager/index.d.ts +17 -1
  169. package/dist/types/controls-options-manager/types.d.ts +43 -0
  170. package/dist/types/controls-options-manager/util.d.ts +1 -7
  171. package/dist/types/index.d.ts +6 -4
  172. package/dist/types/interpretation/collection.d.ts +5 -0
  173. package/dist/types/interpretation/index.d.ts +5 -0
  174. package/dist/types/interpretation/siLanguage.d.ts +5 -0
  175. package/dist/types/locus-info/index.d.ts +57 -4
  176. package/dist/types/locus-info/parser.d.ts +67 -6
  177. package/dist/types/media/index.d.ts +2 -0
  178. package/dist/types/media/properties.d.ts +34 -48
  179. package/dist/types/meeting/in-meeting-actions.d.ts +82 -2
  180. package/dist/types/meeting/index.d.ts +463 -510
  181. package/dist/types/meeting/locusMediaRequest.d.ts +74 -0
  182. package/dist/types/meeting/muteState.d.ts +99 -23
  183. package/dist/types/meeting/request.d.ts +72 -43
  184. package/dist/types/meeting/util.d.ts +101 -1
  185. package/dist/types/meeting-info/index.d.ts +13 -1
  186. package/dist/types/meeting-info/meeting-info-v2.d.ts +31 -1
  187. package/dist/types/meetings/collection.d.ts +17 -0
  188. package/dist/types/meetings/index.d.ts +98 -20
  189. package/dist/types/meetings/meetings.types.d.ts +4 -0
  190. package/dist/types/member/index.d.ts +14 -0
  191. package/dist/types/member/types.d.ts +32 -0
  192. package/dist/types/members/collection.d.ts +5 -0
  193. package/dist/types/members/index.d.ts +35 -2
  194. package/dist/types/members/request.d.ts +73 -9
  195. package/dist/types/members/types.d.ts +25 -0
  196. package/dist/types/members/util.d.ts +214 -1
  197. package/dist/types/metrics/constants.d.ts +12 -4
  198. package/dist/types/metrics/index.d.ts +4 -119
  199. package/dist/types/multistream/mediaRequestManager.d.ts +73 -5
  200. package/dist/types/multistream/receiveSlot.d.ts +13 -11
  201. package/dist/types/multistream/receiveSlotManager.d.ts +14 -4
  202. package/dist/types/multistream/remoteMedia.d.ts +8 -29
  203. package/dist/types/multistream/remoteMediaGroup.d.ts +0 -9
  204. package/dist/types/multistream/remoteMediaManager.d.ts +46 -2
  205. package/dist/types/multistream/sendSlotManager.d.ts +61 -0
  206. package/dist/types/reachability/index.d.ts +61 -7
  207. package/dist/types/reachability/request.d.ts +7 -3
  208. package/dist/types/reconnection-manager/index.d.ts +9 -0
  209. package/dist/types/recording-controller/index.d.ts +15 -1
  210. package/dist/types/recording-controller/util.d.ts +5 -4
  211. package/dist/types/roap/index.d.ts +2 -1
  212. package/dist/types/roap/request.d.ts +15 -11
  213. package/dist/types/roap/turnDiscovery.d.ts +21 -3
  214. package/dist/types/rtcMetrics/constants.d.ts +4 -0
  215. package/dist/types/rtcMetrics/index.d.ts +47 -0
  216. package/dist/types/statsAnalyzer/index.d.ts +7 -1
  217. package/dist/types/webinar/collection.d.ts +16 -0
  218. package/dist/types/webinar/index.d.ts +5 -0
  219. package/dist/webinar/collection.js +44 -0
  220. package/dist/webinar/collection.js.map +1 -0
  221. package/dist/webinar/index.js +69 -0
  222. package/dist/webinar/index.js.map +1 -0
  223. package/package.json +23 -20
  224. package/src/annotation/annotation.types.ts +50 -0
  225. package/src/annotation/constants.ts +36 -0
  226. package/src/annotation/index.ts +328 -0
  227. package/src/breakouts/README.md +42 -12
  228. package/src/breakouts/breakout.ts +67 -9
  229. package/src/breakouts/edit-lock-error.ts +25 -0
  230. package/src/breakouts/events.ts +56 -0
  231. package/src/breakouts/index.ts +592 -20
  232. package/src/breakouts/utils.ts +42 -0
  233. package/src/common/errors/no-meeting-info.ts +24 -0
  234. package/src/common/errors/reclaim-host-role-errors.ts +134 -0
  235. package/src/common/errors/webex-errors.ts +44 -2
  236. package/src/common/logs/logger-proxy.ts +1 -1
  237. package/src/common/logs/request.ts +5 -1
  238. package/src/common/queue.ts +22 -8
  239. package/src/config.ts +4 -10
  240. package/src/constants.ts +221 -19
  241. package/src/controls-options-manager/enums.ts +12 -0
  242. package/src/controls-options-manager/index.ts +116 -21
  243. package/src/controls-options-manager/types.ts +59 -0
  244. package/src/controls-options-manager/util.ts +294 -14
  245. package/src/index.ts +40 -0
  246. package/src/interpretation/README.md +60 -0
  247. package/src/interpretation/collection.ts +19 -0
  248. package/src/interpretation/index.ts +332 -0
  249. package/src/interpretation/siLanguage.ts +18 -0
  250. package/src/locus-info/controlsUtils.ts +108 -0
  251. package/src/locus-info/index.ts +413 -59
  252. package/src/locus-info/infoUtils.ts +10 -2
  253. package/src/locus-info/mediaSharesUtils.ts +64 -0
  254. package/src/locus-info/parser.ts +258 -47
  255. package/src/locus-info/selfUtils.ts +81 -5
  256. package/src/media/index.ts +102 -122
  257. package/src/media/properties.ts +87 -110
  258. package/src/meeting/in-meeting-actions.ts +163 -3
  259. package/src/meeting/index.ts +3132 -2541
  260. package/src/meeting/locusMediaRequest.ts +313 -0
  261. package/src/meeting/muteState.ts +229 -131
  262. package/src/meeting/request.ts +177 -121
  263. package/src/meeting/util.ts +588 -394
  264. package/src/meeting-info/index.ts +81 -8
  265. package/src/meeting-info/meeting-info-v2.ts +170 -14
  266. package/src/meeting-info/util.ts +1 -1
  267. package/src/meeting-info/utilv2.ts +23 -23
  268. package/src/meetings/collection.ts +33 -0
  269. package/src/meetings/index.ts +445 -123
  270. package/src/meetings/meetings.types.ts +12 -0
  271. package/src/meetings/request.ts +2 -0
  272. package/src/meetings/util.ts +80 -11
  273. package/src/member/index.ts +58 -0
  274. package/src/member/types.ts +38 -0
  275. package/src/member/util.ts +141 -25
  276. package/src/members/collection.ts +8 -0
  277. package/src/members/index.ts +134 -8
  278. package/src/members/request.ts +97 -17
  279. package/src/members/types.ts +29 -0
  280. package/src/members/util.ts +333 -240
  281. package/src/metrics/constants.ts +12 -4
  282. package/src/metrics/index.ts +1 -490
  283. package/src/multistream/mediaRequestManager.ts +289 -79
  284. package/src/multistream/receiveSlot.ts +31 -17
  285. package/src/multistream/receiveSlotManager.ts +34 -24
  286. package/src/multistream/remoteMedia.ts +27 -2
  287. package/src/multistream/remoteMediaGroup.ts +59 -0
  288. package/src/multistream/remoteMediaManager.ts +148 -30
  289. package/src/multistream/sendSlotManager.ts +170 -0
  290. package/src/reachability/index.ts +228 -37
  291. package/src/reachability/request.ts +17 -8
  292. package/src/reconnection-manager/index.ts +83 -56
  293. package/src/recording-controller/index.ts +20 -3
  294. package/src/recording-controller/util.ts +26 -9
  295. package/src/roap/index.ts +63 -32
  296. package/src/roap/request.ts +100 -104
  297. package/src/roap/turnDiscovery.ts +48 -26
  298. package/src/rtcMetrics/constants.ts +3 -0
  299. package/src/rtcMetrics/index.ts +100 -0
  300. package/src/statsAnalyzer/index.ts +105 -91
  301. package/src/statsAnalyzer/mqaUtil.ts +13 -14
  302. package/src/webinar/collection.ts +31 -0
  303. package/src/webinar/index.ts +62 -0
  304. package/test/integration/spec/converged-space-meetings.js +60 -3
  305. package/test/integration/spec/journey.js +320 -261
  306. package/test/integration/spec/space-meeting.js +76 -3
  307. package/test/unit/spec/annotation/index.ts +418 -0
  308. package/test/unit/spec/breakouts/breakout.ts +118 -28
  309. package/test/unit/spec/breakouts/edit-lock-error.ts +30 -0
  310. package/test/unit/spec/breakouts/events.ts +89 -0
  311. package/test/unit/spec/breakouts/index.ts +1395 -69
  312. package/test/unit/spec/breakouts/utils.js +52 -1
  313. package/test/unit/spec/common/queue.js +31 -2
  314. package/test/unit/spec/controls-options-manager/index.js +163 -0
  315. package/test/unit/spec/controls-options-manager/util.js +576 -60
  316. package/test/unit/spec/fixture/locus.js +1 -0
  317. package/test/unit/spec/interpretation/collection.ts +15 -0
  318. package/test/unit/spec/interpretation/index.ts +589 -0
  319. package/test/unit/spec/interpretation/siLanguage.ts +28 -0
  320. package/test/unit/spec/locus-info/controlsUtils.js +316 -43
  321. package/test/unit/spec/locus-info/index.js +1304 -33
  322. package/test/unit/spec/locus-info/infoUtils.js +37 -15
  323. package/test/unit/spec/locus-info/lib/SeqCmp.json +16 -0
  324. package/test/unit/spec/locus-info/mediaSharesUtils.ts +32 -0
  325. package/test/unit/spec/locus-info/parser.js +116 -35
  326. package/test/unit/spec/locus-info/selfConstant.js +27 -4
  327. package/test/unit/spec/locus-info/selfUtils.js +208 -17
  328. package/test/unit/spec/media/index.ts +104 -37
  329. package/test/unit/spec/media/properties.ts +2 -2
  330. package/test/unit/spec/meeting/in-meeting-actions.ts +81 -3
  331. package/test/unit/spec/meeting/index.js +5216 -1956
  332. package/test/unit/spec/meeting/locusMediaRequest.ts +442 -0
  333. package/test/unit/spec/meeting/muteState.js +408 -208
  334. package/test/unit/spec/meeting/request.js +483 -49
  335. package/test/unit/spec/meeting/utils.js +679 -64
  336. package/test/unit/spec/meeting-info/index.js +300 -0
  337. package/test/unit/spec/meeting-info/meetinginfov2.js +526 -5
  338. package/test/unit/spec/meeting-info/utilv2.js +21 -0
  339. package/test/unit/spec/meetings/collection.js +26 -0
  340. package/test/unit/spec/meetings/index.js +1011 -205
  341. package/test/unit/spec/meetings/utils.js +202 -2
  342. package/test/unit/spec/member/index.js +61 -6
  343. package/test/unit/spec/member/util.js +510 -34
  344. package/test/unit/spec/members/index.js +432 -1
  345. package/test/unit/spec/members/request.js +206 -27
  346. package/test/unit/spec/members/utils.js +210 -0
  347. package/test/unit/spec/metrics/index.js +1 -50
  348. package/test/unit/spec/multistream/mediaRequestManager.ts +803 -162
  349. package/test/unit/spec/multistream/receiveSlot.ts +28 -20
  350. package/test/unit/spec/multistream/receiveSlotManager.ts +32 -30
  351. package/test/unit/spec/multistream/remoteMedia.ts +30 -0
  352. package/test/unit/spec/multistream/remoteMediaGroup.ts +266 -0
  353. package/test/unit/spec/multistream/remoteMediaManager.ts +326 -0
  354. package/test/unit/spec/multistream/sendSlotManager.ts +242 -0
  355. package/test/unit/spec/reachability/index.ts +549 -9
  356. package/test/unit/spec/reachability/request.js +68 -0
  357. package/test/unit/spec/reconnection-manager/index.js +85 -9
  358. package/test/unit/spec/recording-controller/index.js +294 -218
  359. package/test/unit/spec/recording-controller/util.js +223 -96
  360. package/test/unit/spec/roap/index.ts +178 -64
  361. package/test/unit/spec/roap/request.ts +203 -85
  362. package/test/unit/spec/roap/turnDiscovery.ts +82 -36
  363. package/test/unit/spec/rtcMetrics/index.ts +73 -0
  364. package/test/unit/spec/stats-analyzer/index.js +136 -2
  365. package/test/unit/spec/webinar/collection.ts +13 -0
  366. package/test/unit/spec/webinar/index.ts +60 -0
  367. package/test/utils/integrationTestUtils.js +46 -0
  368. package/test/utils/testUtils.js +0 -52
  369. package/dist/meeting/effectsState.js +0 -262
  370. package/dist/meeting/effectsState.js.map +0 -1
  371. package/dist/metrics/config.js +0 -299
  372. package/dist/metrics/config.js.map +0 -1
  373. package/dist/types/meeting/effectsState.d.ts +0 -42
  374. package/dist/types/metrics/config.d.ts +0 -178
  375. package/src/index.js +0 -16
  376. package/src/meeting/effectsState.ts +0 -211
  377. package/src/metrics/config.ts +0 -495
  378. package/test/unit/spec/meeting/effectsState.js +0 -285
@@ -11,6 +11,7 @@ import sinon from 'sinon';
11
11
  import uuid from 'uuid';
12
12
  import StaticConfig from '@webex/plugin-meetings/src/common/config';
13
13
  import TriggerProxy from '@webex/plugin-meetings/src/common/events/trigger-proxy';
14
+ import LoggerProxy from '@webex/plugin-meetings/src/common/logs/logger-proxy';
14
15
  import LoggerConfig from '@webex/plugin-meetings/src/common/logs/logger-config';
15
16
  import Meeting from '@webex/plugin-meetings/src/meeting';
16
17
  import MeetingUtil from '@webex/plugin-meetings/src/meeting/util';
@@ -19,6 +20,7 @@ import MeetingCollection from '@webex/plugin-meetings/src/meetings/collection';
19
20
  import MeetingsUtil from '@webex/plugin-meetings/src/meetings/util';
20
21
  import PersonalMeetingRoom from '@webex/plugin-meetings/src/personal-meeting-room';
21
22
  import Reachability from '@webex/plugin-meetings/src/reachability';
23
+ import Metrics from '@webex/plugin-meetings/src/metrics';
22
24
 
23
25
  import testUtils from '../../../utils/testUtils';
24
26
  import {
@@ -29,6 +31,12 @@ import {
29
31
  LOCUSINFO,
30
32
  EVENT_TRIGGERS,
31
33
  } from '../../../../src/constants';
34
+ import CaptchaError from '@webex/plugin-meetings/src/common/errors/captcha-error';
35
+ import { forEach } from 'lodash';
36
+ import PasswordError from '@webex/plugin-meetings/src/common/errors/password-error';
37
+ import PermissionError from '@webex/plugin-meetings/src/common/errors/permission';
38
+ import {NoiseReductionEffect,VirtualBackgroundEffect} from '@webex/media-helpers';
39
+ import NoMeetingInfoError from '../../../../src/common/errors/no-meeting-info';
32
40
 
33
41
  describe('plugin-meetings', () => {
34
42
  const logger = {
@@ -40,6 +48,8 @@ describe('plugin-meetings', () => {
40
48
  debug: () => {},
41
49
  };
42
50
 
51
+ let triggerProxyStub;
52
+
43
53
  beforeEach(() => {
44
54
  StaticConfig.set({
45
55
  bandwidth: {
@@ -51,7 +61,7 @@ describe('plugin-meetings', () => {
51
61
  verboseEvents: true,
52
62
  enable: false,
53
63
  });
54
- TriggerProxy.trigger = sinon.stub().returns(true);
64
+ triggerProxyStub = sinon.stub(TriggerProxy, 'trigger').returns(true);
55
65
  });
56
66
 
57
67
  let webex;
@@ -60,15 +70,20 @@ describe('plugin-meetings', () => {
60
70
  let url1;
61
71
  let test1;
62
72
  let test2;
73
+ let locusInfo;
63
74
 
64
75
  describe('meetings index', () => {
65
76
  beforeEach(() => {
66
77
  MeetingsUtil.checkH264Support = sinon.stub();
67
- uuid1 = uuid.v4();
78
+ uuid1 = uuid.v4();
68
79
  url1 = `https://example.com/${uuid.v4()}`;
69
80
  uri1 = `test-${uuid.v4()}@example.com`;
70
81
  test1 = `test-${uuid.v4()}`;
71
82
  test2 = `test2-${uuid.v4()}`;
83
+ locusInfo = {
84
+ parse: sinon.stub().returns(true),
85
+ updateMainSessionLocusCache: sinon.stub(),
86
+ };
72
87
  webex = new MockWebex({
73
88
  children: {
74
89
  device: Device,
@@ -151,6 +166,10 @@ describe('plugin-meetings', () => {
151
166
  webex.emit('ready');
152
167
  });
153
168
 
169
+ afterEach(() => {
170
+ sinon.restore();
171
+ });
172
+
154
173
  it('has a webex instance with a meetings property', () => {
155
174
  assert.exists(webex, 'webex was initialized with children');
156
175
  assert.exists(webex.meetings, 'meetings child was set up on the webex instance');
@@ -217,34 +236,6 @@ describe('plugin-meetings', () => {
217
236
  });
218
237
  });
219
238
 
220
- describe('#_toggleTurnDiscovery', () => {
221
- it('should have toggleAdhocMeetings', () => {
222
- assert.equal(typeof webex.meetings._toggleTurnDiscovery, 'function');
223
- });
224
-
225
- describe('success', () => {
226
- it('should update meetings to do TURN discovery', () => {
227
- webex.meetings._toggleTurnDiscovery(true);
228
- assert.equal(webex.meetings.config.experimental.enableTurnDiscovery, true);
229
-
230
- webex.meetings._toggleTurnDiscovery(false);
231
- assert.equal(webex.meetings.config.experimental.enableTurnDiscovery, false);
232
- });
233
- });
234
-
235
- describe('failure', () => {
236
- it('should not accept non boolean input', () => {
237
- const currentEnableTurnDiscovery = webex.meetings.config.experimental.enableTurnDiscovery;
238
-
239
- webex.meetings._toggleTurnDiscovery('test');
240
- assert.equal(
241
- webex.meetings.config.experimental.enableAdhocMeetings,
242
- currentEnableTurnDiscovery
243
- );
244
- });
245
- });
246
- });
247
-
248
239
  describe('Public API Contracts', () => {
249
240
  describe('#register', () => {
250
241
  it('emits an event and resolves when register succeeds', async () => {
@@ -338,37 +329,113 @@ describe('plugin-meetings', () => {
338
329
  });
339
330
  });
340
331
 
332
+ describe('virtual background effect', () => {
333
+ beforeEach(() => {
334
+ webex.credentials = {
335
+ supertoken: {
336
+ access_token: "fake_token"
337
+ }
338
+ };
339
+ })
340
+
341
+ it('creates background effect', async () => {
342
+ const result = await webex.meetings.createVirtualBackgroundEffect();
343
+
344
+ assert.exists(result);
345
+ assert.instanceOf(result, VirtualBackgroundEffect);
346
+ assert.containsAllKeys(result, ['loadModel', 'isEnabled', 'options']);
347
+ assert.deepEqual(result.options, {
348
+ mode: 'BLUR',
349
+ blurStrength: 'STRONG',
350
+ generator: 'worker',
351
+ quality: 'LOW',
352
+ authToken: 'fake_token',
353
+ mirror: false
354
+ });
355
+ assert.exists(result.enable);
356
+ assert.exists(result.disable);
357
+ assert.exists(result.dispose);
358
+ });
359
+
360
+ it('creates background effect with custom options passed', async () => {
361
+ const effectOptions = {
362
+ generator: "local",
363
+ frameRate: 45,
364
+ mode: "IMAGE",
365
+ mirror: false,
366
+ quality: "HIGH",
367
+ blurStrength: "STRONG",
368
+ bgImageUrl: "https://test.webex.com/landscape.5a535788.jpg",
369
+ };
370
+
371
+ const result = await webex.meetings.createVirtualBackgroundEffect(effectOptions);
372
+
373
+ assert.exists(result);
374
+ assert.instanceOf(result, VirtualBackgroundEffect);
375
+ assert.containsAllKeys(result, ['loadModel', 'isEnabled', 'options']);
376
+ assert.deepEqual(result.options, {...effectOptions, authToken: "fake_token"});
377
+ assert.exists(result.enable);
378
+ assert.exists(result.disable);
379
+ assert.exists(result.dispose);
380
+ });
381
+ })
382
+
383
+ describe('noise reduction effect', () => {
384
+ beforeEach(() => {
385
+ webex.credentials = {
386
+ supertoken: {
387
+ access_token: "fake_token"
388
+ }
389
+ };
390
+ })
391
+
392
+ it('creates noise reduction effect', async () => {
393
+ const result = await webex.meetings.createNoiseReductionEffect({audioContext: {}});
394
+
395
+ assert.exists(result);
396
+ assert.instanceOf(result, NoiseReductionEffect);
397
+ assert.containsAllKeys(result, ['audioContext', 'isEnabled', 'isReady', 'options']);
398
+ assert.deepEqual(result.options, {
399
+ authToken: 'fake_token',
400
+ audioContext: {}
401
+ });
402
+ assert.exists(result.enable);
403
+ assert.exists(result.disable);
404
+ assert.exists(result.dispose);
405
+ });
406
+
407
+ it('creates noise reduction effect with custom options passed', async () => {
408
+ const effectOptions = {
409
+ audioContext: {},
410
+ mode: "WORKLET",
411
+ env: "prod"
412
+ };
413
+
414
+ const result = await webex.meetings.createNoiseReductionEffect(effectOptions);
415
+
416
+ assert.exists(result);
417
+ assert.instanceOf(result, NoiseReductionEffect);
418
+ assert.containsAllKeys(result, ['audioContext', 'isEnabled', 'isReady', 'options']);
419
+ assert.deepEqual(result.options, {...effectOptions, authToken: "fake_token"});
420
+ assert.exists(result.enable);
421
+ assert.exists(result.disable);
422
+ assert.exists(result.dispose);
423
+ });
424
+ })
425
+
341
426
  describe('gets', () => {
342
427
  describe('#getReachability', () => {
343
428
  it('should have #getReachability', () => {
344
429
  assert.exists(webex.meetings.getReachability);
345
430
  });
346
- describe('before #setReachability', () => {
347
- it('does not get a reachability instance', () => {
348
- const reachability = webex.meetings.getReachability();
349
-
350
- assert.notExists(
351
- reachability,
352
- 'reachability is undefined because #setReachability has not been called'
353
- );
354
- });
355
- });
356
- describe('after #setReachability', () => {
357
- beforeEach(() => {
358
- webex.meetings.setReachability();
359
- const reachabilityMocker = webex.meetings.getReachability();
360
-
361
- sinon.stub(reachabilityMocker, 'gatherReachability').returns(true);
362
- });
363
- it('gets the reachability data instance from webex.meetings', () => {
364
- const reachability = webex.meetings.getReachability();
431
+ it('gets the reachability data instance from webex.meetings', () => {
432
+ const reachability = webex.meetings.getReachability();
365
433
 
366
- assert.exists(
367
- reachability,
368
- 'reachability is defined because #setReachability has been called'
369
- );
370
- assert.instanceOf(reachability, Reachability, 'should be a reachability instance');
371
- });
434
+ assert.exists(
435
+ reachability,
436
+ 'reachability is defined'
437
+ );
438
+ assert.instanceOf(reachability, Reachability, 'should be a reachability instance');
372
439
  });
373
440
  });
374
441
  describe('#getPersonalMeetingRoom', () => {
@@ -443,21 +510,17 @@ describe('plugin-meetings', () => {
443
510
  );
444
511
  });
445
512
  describe('when meeting is returned', () => {
446
- let parse;
447
513
 
448
514
  beforeEach(() => {
449
- parse = sinon.stub().returns(true);
450
515
  webex.meetings.meetingCollection.getByKey = sinon.stub().returns({
451
- locusInfo: {
452
- parse,
453
- },
516
+ locusInfo,
454
517
  });
455
518
  });
456
519
  it('tests the sync meeting calls for existing meeting', async () => {
457
520
  await webex.meetings.syncMeetings();
458
521
  assert.calledOnce(webex.meetings.request.getActiveMeetings);
459
522
  assert.calledOnce(webex.meetings.meetingCollection.getByKey);
460
- assert.calledOnce(parse);
523
+ assert.calledOnce(locusInfo.parse);
461
524
  assert.calledWith(webex.meetings.meetingCollection.getByKey, 'locusUrl', url1);
462
525
  });
463
526
  });
@@ -470,6 +533,7 @@ describe('plugin-meetings', () => {
470
533
  webex.meetings.create = sinon.stub().returns(
471
534
  Promise.resolve({
472
535
  locusInfo: {
536
+ ...locusInfo,
473
537
  initialSetup,
474
538
  },
475
539
  })
@@ -478,7 +542,7 @@ describe('plugin-meetings', () => {
478
542
  it('tests the sync meeting calls for not existing meeting', async () => {
479
543
  await webex.meetings.syncMeetings();
480
544
  assert.calledOnce(webex.meetings.request.getActiveMeetings);
481
- assert.callCount(webex.meetings.meetingCollection.getByKey, 4);
545
+ assert.callCount(webex.meetings.meetingCollection.getByKey, 5);
482
546
  assert.calledOnce(initialSetup);
483
547
  assert.calledOnce(webex.meetings.create);
484
548
  assert.calledWith(webex.meetings.request.getActiveMeetings);
@@ -502,12 +566,9 @@ describe('plugin-meetings', () => {
502
566
 
503
567
  beforeEach(() => {
504
568
  destroySpy = sinon.spy(webex.meetings, 'destroy');
505
- parse = sinon.stub().returns(true);
506
569
  initialSetup = sinon.stub().returns(true);
507
570
  webex.meetings.meetingCollection.getByKey = sinon.stub().returns({
508
- locusInfo: {
509
- parse,
510
- },
571
+ locusInfo,
511
572
  sendCallAnalyzerMetrics: sinon.stub(),
512
573
  });
513
574
  webex.meetings.meetingCollection.getAll = sinon.stub().returns({
@@ -574,14 +635,41 @@ describe('plugin-meetings', () => {
574
635
  });
575
636
  });
576
637
 
638
+ const FAKE_USE_RANDOM_DELAY = true;
639
+ const correlationId = 'my-correlationId';
640
+
641
+ const checkCallCreateMeeting = async (createParameters, createMeetingParameters) => {
642
+ const create = webex.meetings.create(...createParameters);
643
+
644
+ assert.exists(create.then);
645
+ await create;
646
+ assert.calledOnce(webex.meetings.createMeeting);
647
+ assert.calledWith(webex.meetings.createMeeting, ...createMeetingParameters);
648
+ }
649
+
577
650
  it('calls createMeeting and returns its promise', async () => {
578
- const FAKE_USE_RANDOM_DELAY = true;
579
- const create = webex.meetings.create(test1, test2, FAKE_USE_RANDOM_DELAY);
651
+ checkCallCreateMeeting([test1, test2, FAKE_USE_RANDOM_DELAY, {}, correlationId, true], [test1, test2, FAKE_USE_RANDOM_DELAY, {}, correlationId, true]);
652
+ });
653
+
654
+ it('calls createMeeting when failOnMissingMeetinginfo is undefined and returns its promise', async () => {
655
+ checkCallCreateMeeting([test1, test2, FAKE_USE_RANDOM_DELAY, {}, correlationId, undefined], [test1, test2, FAKE_USE_RANDOM_DELAY, {}, correlationId, false]);
656
+ });
657
+
658
+ it('calls createMeeting when failOnMissingMeetinginfo is false and returns its promise', async () => {
659
+ checkCallCreateMeeting([test1, test2, FAKE_USE_RANDOM_DELAY, {}, correlationId, false], [test1, test2, FAKE_USE_RANDOM_DELAY, {}, correlationId, false]);
660
+ });
661
+
662
+ it('calls createMeeting with extra info params and returns its promise', async () => {
663
+ const FAKE_USE_RANDOM_DELAY = false;
664
+ const correlationId = 'my-correlationId';
665
+
666
+ const FAKE_INFO_EXTRA_PARAMS = {mtid: 'm9fe0afd8c435e892afcce9ea25b97046', joinTXId: 'TSmrX61wNF'};
667
+ const create = webex.meetings.create(test1, test2, FAKE_USE_RANDOM_DELAY, FAKE_INFO_EXTRA_PARAMS, correlationId);
580
668
 
581
669
  assert.exists(create.then);
582
670
  await create;
583
671
  assert.calledOnce(webex.meetings.createMeeting);
584
- assert.calledWith(webex.meetings.createMeeting, test1, test2, FAKE_USE_RANDOM_DELAY);
672
+ assert.calledWith(webex.meetings.createMeeting, test1, test2, FAKE_USE_RANDOM_DELAY, FAKE_INFO_EXTRA_PARAMS, correlationId);
585
673
  });
586
674
 
587
675
  it('creates a new meeting when a scheduled meeting exists in the conversation', async () => {
@@ -677,45 +765,52 @@ describe('plugin-meetings', () => {
677
765
  });
678
766
  describe('#handleLocusEvent', () => {
679
767
  describe('there was a meeting', () => {
680
- let parse;
681
768
 
682
769
  beforeEach(() => {
683
- parse = sinon.stub().returns(true);
684
770
  webex.meetings.meetingCollection.getByKey = sinon.stub().returns({
685
- locusInfo: {
686
- parse,
687
- },
771
+ locusInfo,
688
772
  });
689
773
  });
690
- it('should parse the meeting info', () => {
774
+ it('should parse the meeting info and update main session locus cache', () => {
775
+ sinon.stub(MeetingsUtil, 'isBreakoutLocusDTO').returns(false);
691
776
  webex.meetings.handleLocusEvent({
692
777
  locusUrl: url1,
693
778
  });
694
779
  assert.calledOnce(webex.meetings.meetingCollection.getByKey);
695
780
  assert.calledWith(webex.meetings.meetingCollection.getByKey, 'locusUrl', url1);
696
- assert.calledOnce(parse);
781
+ assert.calledOnce(locusInfo.parse);
782
+ assert.calledOnce(locusInfo.updateMainSessionLocusCache);
697
783
  assert.calledWith(
698
- parse,
784
+ locusInfo.parse,
699
785
  {
700
- locusInfo: {
701
- parse,
702
- },
786
+ locusInfo,
703
787
  },
704
788
  {
705
789
  locusUrl: url1,
706
790
  }
707
791
  );
708
792
  });
793
+
794
+ it('should not update main session locus cache', () => {
795
+ sinon.stub(MeetingsUtil, 'isBreakoutLocusDTO').returns(true);
796
+ webex.meetings.handleLocusEvent({
797
+ locusUrl: url1,
798
+ });
799
+ assert.notCalled(locusInfo.updateMainSessionLocusCache);
800
+ });
709
801
  });
710
802
  describe('there was not a meeting', () => {
711
803
  let initialSetup;
804
+ const webExMeetingId = '123456';
712
805
 
713
806
  beforeEach(() => {
714
807
  initialSetup = sinon.stub().returns(true);
715
808
  webex.meetings.meetingCollection.getByKey = sinon.stub().returns(undefined);
716
809
  webex.meetings.create = sinon.stub().returns(
717
810
  Promise.resolve({
811
+ id: 'meeting-id',
718
812
  locusInfo: {
813
+ ...locusInfo,
719
814
  initialSetup,
720
815
  },
721
816
  })
@@ -735,12 +830,16 @@ describe('plugin-meetings', () => {
735
830
  callbackAddress: uri1,
736
831
  },
737
832
  },
833
+ info: {
834
+ webExMeetingId
835
+ },
738
836
  },
739
837
  eventType: 'locus.difference',
740
838
  locusUrl: url1,
741
839
  });
742
- assert.callCount(webex.meetings.meetingCollection.getByKey, 5);
840
+ assert.callCount(webex.meetings.meetingCollection.getByKey, 6);
743
841
  assert.calledWith(webex.meetings.meetingCollection.getByKey, 'locusUrl', url1);
842
+ assert.calledWith(webex.meetings.meetingCollection.getByKey, 'meetingNumber', webExMeetingId);
744
843
  assert.calledOnce(initialSetup);
745
844
  assert.calledWith(initialSetup, {
746
845
  id: uuid1,
@@ -754,6 +853,9 @@ describe('plugin-meetings', () => {
754
853
  callbackAddress: uri1,
755
854
  },
756
855
  },
856
+ info: {
857
+ webExMeetingId
858
+ },
757
859
  });
758
860
  });
759
861
  it('should setup the meeting by difference event without replaces', async () => {
@@ -765,12 +867,16 @@ describe('plugin-meetings', () => {
765
867
  callbackAddress: uri1,
766
868
  },
767
869
  },
870
+ info: {
871
+ webExMeetingId
872
+ },
768
873
  },
769
874
  eventType: 'locus.difference',
770
875
  locusUrl: url1,
771
876
  });
772
- assert.callCount(webex.meetings.meetingCollection.getByKey, 4);
877
+ assert.callCount(webex.meetings.meetingCollection.getByKey, 5);
773
878
  assert.calledWith(webex.meetings.meetingCollection.getByKey, 'locusUrl', url1);
879
+ assert.calledWith(webex.meetings.meetingCollection.getByKey, 'meetingNumber', webExMeetingId);
774
880
  assert.calledOnce(initialSetup);
775
881
  assert.calledWith(initialSetup, {
776
882
  id: uuid1,
@@ -779,8 +885,44 @@ describe('plugin-meetings', () => {
779
885
  callbackAddress: uri1,
780
886
  },
781
887
  },
888
+ info: {
889
+ webExMeetingId
890
+ },
782
891
  });
783
892
  });
893
+
894
+ it('sends client event correctly on finally', async () => {
895
+ webex.meetings.getMeetingByType = sinon.stub().returns(true);
896
+
897
+ await webex.meetings.handleLocusEvent({
898
+ locus: {
899
+ id: uuid1,
900
+ self: {
901
+ callBackInfo: {
902
+ callbackAddress: uri1,
903
+ },
904
+ },
905
+ info: {
906
+ webExMeetingId,
907
+ },
908
+ },
909
+ eventType: 'locus.difference',
910
+ locusUrl: url1,
911
+ });
912
+
913
+ await testUtils.flushPromises();
914
+
915
+ assert.calledWith(webex.internal.newMetrics.submitClientEvent, {
916
+ name: 'client.call.remote-started',
917
+ payload: {
918
+ trigger: 'mercury-event',
919
+ },
920
+ options: {
921
+ meetingId: 'meeting-id',
922
+ },
923
+ });
924
+ });
925
+
784
926
  it('should setup the meeting by a not difference event', async () => {
785
927
  await webex.meetings.handleLocusEvent({
786
928
  locus: {
@@ -790,12 +932,16 @@ describe('plugin-meetings', () => {
790
932
  callbackAddress: uri1,
791
933
  },
792
934
  },
935
+ info: {
936
+ webExMeetingId
937
+ },
793
938
  },
794
939
  eventType: test1,
795
940
  locusUrl: url1,
796
941
  });
797
- assert.callCount(webex.meetings.meetingCollection.getByKey, 4);
942
+ assert.callCount(webex.meetings.meetingCollection.getByKey, 5);
798
943
  assert.calledWith(webex.meetings.meetingCollection.getByKey, 'locusUrl', url1);
944
+ assert.calledWith(webex.meetings.meetingCollection.getByKey, 'meetingNumber', webExMeetingId);
799
945
  assert.calledOnce(initialSetup);
800
946
  assert.calledWith(initialSetup, {
801
947
  id: uuid1,
@@ -804,6 +950,9 @@ describe('plugin-meetings', () => {
804
950
  callbackAddress: uri1,
805
951
  },
806
952
  },
953
+ info: {
954
+ webExMeetingId
955
+ },
807
956
  });
808
957
  });
809
958
 
@@ -826,7 +975,7 @@ describe('plugin-meetings', () => {
826
975
 
827
976
  it('should not try to match USM meetings by conversation url', async () => {
828
977
  await webex.meetings.handleLocusEvent(generateFakeLocusData(true));
829
- assert.callCount(webex.meetings.meetingCollection.getByKey, 3);
978
+ assert.callCount(webex.meetings.meetingCollection.getByKey, 4);
830
979
  assert.deepEqual(webex.meetings.meetingCollection.getByKey.getCall(0).args, [
831
980
  'locusUrl',
832
981
  url1,
@@ -843,7 +992,7 @@ describe('plugin-meetings', () => {
843
992
  });
844
993
  it('should try to match non-USM meetings by conversation url', async () => {
845
994
  await webex.meetings.handleLocusEvent(generateFakeLocusData(false));
846
- assert.callCount(webex.meetings.meetingCollection.getByKey, 4);
995
+ assert.callCount(webex.meetings.meetingCollection.getByKey, 5);
847
996
  assert.deepEqual(webex.meetings.meetingCollection.getByKey.getCall(0).args, [
848
997
  'locusUrl',
849
998
  url1,
@@ -874,6 +1023,7 @@ describe('plugin-meetings', () => {
874
1023
  });
875
1024
  describe('successful MeetingInfo.#fetchMeetingInfo', () => {
876
1025
  let clock, setTimeoutSpy, fakeMeetingStartTimeString, FAKE_TIME_TO_START;
1026
+ const FAKE_INFO_EXTRA_PARAMS = {mtid: 'm9fe0afd8c435e892afcce9ea25b97046', joinTXId: 'TSmrX61wNF'};
877
1027
 
878
1028
  beforeEach(() => {
879
1029
  clock = sinon.useFakeTimers();
@@ -903,13 +1053,15 @@ describe('plugin-meetings', () => {
903
1053
  meeting,
904
1054
  destination,
905
1055
  type,
906
- expectedMeetingData = {}
1056
+ extraParams = {},
1057
+ expectedMeetingData = {},
1058
+ sendCAevents = false,
907
1059
  ) => {
908
1060
  assert.calledOnce(webex.meetings.meetingInfo.fetchMeetingInfo);
909
1061
  assert.calledOnce(MeetingsUtil.getMeetingAddedType);
910
1062
  assert.notCalled(setTimeoutSpy);
911
- assert.calledThrice(TriggerProxy.trigger);
912
- assert.calledWith(webex.meetings.meetingInfo.fetchMeetingInfo, destination, type);
1063
+ assert.callCount(TriggerProxy.trigger, 5);
1064
+ assert.calledWith(webex.meetings.meetingInfo.fetchMeetingInfo, destination, type, null, null, undefined, undefined, extraParams, {meetingId: meeting.id, sendCAevents});
913
1065
  assert.calledWith(MeetingsUtil.getMeetingAddedType, 'test type');
914
1066
 
915
1067
  if (expectedMeetingData.permissionToken) {
@@ -918,6 +1070,9 @@ describe('plugin-meetings', () => {
918
1070
  if (expectedMeetingData.meetingJoinUrl) {
919
1071
  assert.equal(meeting.meetingJoinUrl, expectedMeetingData.meetingJoinUrl);
920
1072
  }
1073
+ if(expectedMeetingData.correlationId) {
1074
+ assert.equal(meeting.correlationId, expectedMeetingData.correlationId);
1075
+ }
921
1076
  assert.equal(meeting.destination, destination);
922
1077
  assert.equal(meeting.destinationType, type);
923
1078
  assert.calledWith(
@@ -947,108 +1102,119 @@ describe('plugin-meetings', () => {
947
1102
  const expectedMeetingData = {
948
1103
  permissionToken: 'PT',
949
1104
  meetingJoinUrl: 'meetingJoinUrl',
1105
+ correlationId: meeting.id,
950
1106
  };
951
1107
 
952
- checkCreateWithoutDelay(meeting, 'test destination', 'test type', expectedMeetingData);
1108
+ checkCreateWithoutDelay(meeting, 'test destination', 'test type', {}, expectedMeetingData);
953
1109
  });
954
1110
 
955
- it('creates the meeting from a successful meeting info fetch meeting resolve testing', async () => {
956
- const meeting = await webex.meetings.createMeeting('test destination', 'test type');
957
- const expectedMeetingData = {
958
- permissionToken: 'PT',
959
- meetingJoinUrl: 'meetingJoinUrl',
960
- };
1111
+ [undefined, FAKE_INFO_EXTRA_PARAMS].forEach((infoExtraParams) => {
1112
+ const infoExtraParamsProvided = infoExtraParams !== undefined;
961
1113
 
962
- assert.instanceOf(
963
- meeting,
964
- Meeting,
965
- 'createMeeting should eventually resolve to a Meeting Object'
966
- );
967
- checkCreateWithoutDelay(meeting, 'test destination', 'test type', expectedMeetingData);
968
- });
1114
+ it(`creates the meeting from a successful meeting info fetch meeting resolve testing${infoExtraParamsProvided ? ' with infoExtraParams' : ''}`, async () => {
1115
+ const meeting = await webex.meetings.createMeeting('test destination', 'test type', false, infoExtraParams);
1116
+ const expectedMeetingData = {
1117
+ permissionToken: 'PT',
1118
+ meetingJoinUrl: 'meetingJoinUrl',
1119
+ };
969
1120
 
970
- it('creates the meeting from a successful meeting info fetch with random delay', async () => {
971
- const FAKE_LOCUS_MEETING = {
972
- conversationUrl: 'locusConvURL',
973
- url: 'locusUrl',
974
- info: {
975
- webExMeetingId: 'locusMeetingId',
976
- sipUri: 'locusSipUri',
977
- owner: 'locusOwner',
978
- },
979
- meeting: {
980
- startTime: fakeMeetingStartTimeString,
981
- },
982
- fullState: {
983
- active: false,
984
- },
985
- };
1121
+ assert.instanceOf(
1122
+ meeting,
1123
+ Meeting,
1124
+ 'createMeeting should eventually resolve to a Meeting Object'
1125
+ );
1126
+ checkCreateWithoutDelay(meeting, 'test destination', 'test type', infoExtraParamsProvided ? infoExtraParams : {}, expectedMeetingData);
1127
+ });
986
1128
 
987
- const meeting = await webex.meetings.createMeeting(
988
- FAKE_LOCUS_MEETING,
989
- 'test type',
990
- true
991
- );
1129
+ it(`creates the meeting from a successful meeting info fetch with random delay${infoExtraParamsProvided ? ' with infoExtraParams' : ''}`, async () => {
1130
+ const FAKE_LOCUS_MEETING = {
1131
+ conversationUrl: 'locusConvURL',
1132
+ url: 'locusUrl',
1133
+ info: {
1134
+ webExMeetingId: 'locusMeetingId',
1135
+ sipUri: 'locusSipUri',
1136
+ owner: 'locusOwner',
1137
+ },
1138
+ meeting: {
1139
+ startTime: fakeMeetingStartTimeString,
1140
+ },
1141
+ fullState: {
1142
+ active: false,
1143
+ },
1144
+ };
992
1145
 
993
- assert.instanceOf(
994
- meeting,
995
- Meeting,
996
- 'createMeeting should eventually resolve to a Meeting Object'
997
- );
998
- assert.notCalled(webex.meetings.meetingInfo.fetchMeetingInfo);
999
- assert.calledOnce(setTimeoutSpy);
1000
-
1001
- // Parse meeting info with locus object
1002
- assert.equal(meeting.conversationUrl, 'locusConvURL');
1003
- assert.equal(meeting.locusUrl, 'locusUrl');
1004
- assert.equal(meeting.sipUri, 'locusSipUri');
1005
- assert.equal(meeting.meetingNumber, 'locusMeetingId');
1006
- assert.isUndefined(meeting.meetingJoinUrl);
1007
- assert.equal(meeting.owner, 'locusOwner');
1008
- assert.isUndefined(meeting.permissionToken);
1009
-
1010
- // Add meeting and send trigger
1011
- assert.calledWith(MeetingsUtil.getMeetingAddedType, 'test type');
1012
- assert.calledTwice(TriggerProxy.trigger);
1013
- assert.calledWith(
1014
- TriggerProxy.trigger,
1015
- sinon.match.instanceOf(Meetings),
1016
- {
1017
- file: 'meetings',
1018
- function: 'createMeeting',
1019
- },
1020
- 'meeting:added',
1021
- {
1022
- meeting: sinon.match.instanceOf(Meeting),
1023
- type: 'test meeting added type',
1024
- }
1025
- );
1146
+ const meeting = await webex.meetings.createMeeting(
1147
+ FAKE_LOCUS_MEETING,
1148
+ 'test type',
1149
+ true,
1150
+ infoExtraParams
1151
+ );
1026
1152
 
1027
- // When timer expires
1028
- clock.tick(FAKE_TIME_TO_START);
1029
- assert.calledWith(
1030
- webex.meetings.meetingInfo.fetchMeetingInfo,
1031
- FAKE_LOCUS_MEETING,
1032
- 'test type'
1033
- );
1153
+ assert.instanceOf(
1154
+ meeting,
1155
+ Meeting,
1156
+ 'createMeeting should eventually resolve to a Meeting Object'
1157
+ );
1158
+ assert.notCalled(webex.meetings.meetingInfo.fetchMeetingInfo);
1159
+ assert.calledOnce(setTimeoutSpy);
1160
+
1161
+ // Parse meeting info with locus object
1162
+ assert.equal(meeting.conversationUrl, 'locusConvURL');
1163
+ assert.equal(meeting.locusUrl, 'locusUrl');
1164
+ assert.equal(meeting.sipUri, 'locusSipUri');
1165
+ assert.equal(meeting.meetingNumber, 'locusMeetingId');
1166
+ assert.isUndefined(meeting.meetingJoinUrl);
1167
+ assert.equal(meeting.owner, 'locusOwner');
1168
+ assert.isUndefined(meeting.permissionToken);
1169
+
1170
+ // Add meeting and send trigger
1171
+ assert.calledWith(MeetingsUtil.getMeetingAddedType, 'test type');
1172
+ assert.calledTwice(TriggerProxy.trigger);
1173
+ assert.calledWith(
1174
+ TriggerProxy.trigger,
1175
+ sinon.match.instanceOf(Meetings),
1176
+ {
1177
+ file: 'meetings',
1178
+ function: 'createMeeting',
1179
+ },
1180
+ 'meeting:added',
1181
+ {
1182
+ meeting: sinon.match.instanceOf(Meeting),
1183
+ type: 'test meeting added type',
1184
+ }
1185
+ );
1034
1186
 
1035
- // Parse meeting info is called again with new meeting info
1036
- await testUtils.flushPromises();
1037
- assert.equal(meeting.conversationUrl, 'locusConvURL');
1038
- assert.equal(meeting.locusUrl, 'locusUrl');
1039
- assert.equal(meeting.sipUri, 'locusSipUri');
1040
- assert.equal(meeting.meetingNumber, 'locusMeetingId');
1041
- assert.equal(meeting.meetingJoinUrl, 'meetingJoinUrl');
1042
- assert.equal(meeting.owner, 'locusOwner');
1043
- assert.equal(meeting.permissionToken, 'PT');
1187
+ // When timer expires
1188
+ clock.tick(FAKE_TIME_TO_START);
1189
+ assert.calledWith(
1190
+ webex.meetings.meetingInfo.fetchMeetingInfo,
1191
+ FAKE_LOCUS_MEETING,
1192
+ 'test type',
1193
+ null,
1194
+ null,
1195
+ undefined,
1196
+ undefined,
1197
+ infoExtraParamsProvided ? infoExtraParams : {}
1198
+ );
1044
1199
 
1045
- assert.calledWith(
1046
- TriggerProxy.trigger,
1047
- meeting,
1048
- {file: 'meetings', function: 'fetchMeetingInfo'},
1049
- 'meeting:meetingInfoAvailable'
1050
- );
1051
- });
1200
+ // Parse meeting info is called again with new meeting info
1201
+ await testUtils.flushPromises();
1202
+ assert.equal(meeting.conversationUrl, 'locusConvURL');
1203
+ assert.equal(meeting.locusUrl, 'locusUrl');
1204
+ assert.equal(meeting.sipUri, 'locusSipUri');
1205
+ assert.equal(meeting.meetingNumber, 'locusMeetingId');
1206
+ assert.equal(meeting.meetingJoinUrl, 'meetingJoinUrl');
1207
+ assert.equal(meeting.owner, 'locusOwner');
1208
+ assert.equal(meeting.permissionToken, 'PT');
1209
+
1210
+ assert.calledWith(
1211
+ TriggerProxy.trigger,
1212
+ meeting,
1213
+ {file: 'meetings', function: 'fetchMeetingInfo'},
1214
+ 'meeting:meetingInfoAvailable'
1215
+ );
1216
+ });
1217
+ })
1052
1218
 
1053
1219
  it('creates the meeting from a successful meeting info fetch that has no random delay because it is active', async () => {
1054
1220
  const FAKE_LOCUS_MEETING = {
@@ -1147,6 +1313,16 @@ describe('plugin-meetings', () => {
1147
1313
  );
1148
1314
  checkCreateWithoutDelay(meeting, FAKE_LOCUS_MEETING, 'test type');
1149
1315
  });
1316
+
1317
+ it('creates meeting with the correlationId provided', async () => {
1318
+ const meeting = await webex.meetings.createMeeting('test destination', 'test type', false, {}, 'my-correlationId');
1319
+
1320
+ const expectedMeetingData = {
1321
+ correlationId: 'my-correlationId',
1322
+ };
1323
+
1324
+ checkCreateWithoutDelay(meeting, 'test destination', 'test type', {}, expectedMeetingData, true);
1325
+ })
1150
1326
  });
1151
1327
 
1152
1328
  describe('rejected MeetingInfo.#fetchMeetingInfo', () => {
@@ -1156,38 +1332,121 @@ describe('plugin-meetings', () => {
1156
1332
  webex.meetings.meetingInfo.fetchMeetingInfo = sinon
1157
1333
  .stub()
1158
1334
  .returns(Promise.reject(new Error('test')));
1335
+ webex.meetings.destroy = sinon
1336
+ .stub()
1337
+ .returns(Promise.resolve());
1338
+ webex.meetings.createMeeting = sinon.spy(webex.meetings.createMeeting);
1159
1339
  });
1340
+
1341
+ const checkCreateMeetingWithNoMeetingInfo = async (failOnMissingMeetingInfo, destroy) => {
1342
+ try {
1343
+ const meeting = await webex.meetings.createMeeting('test destination', 'test type', undefined, undefined, undefined, failOnMissingMeetingInfo);
1344
+
1345
+ assert.instanceOf(
1346
+ meeting,
1347
+ Meeting,
1348
+ 'createMeeting should eventually resolve to a Meeting Object'
1349
+ );
1350
+ assert.calledOnce(webex.meetings.meetingInfo.fetchMeetingInfo);
1351
+ assert.calledOnce(MeetingsUtil.getMeetingAddedType);
1352
+ assert.calledThrice(TriggerProxy.trigger);
1353
+ assert.calledWith(
1354
+ webex.meetings.meetingInfo.fetchMeetingInfo,
1355
+ 'test destination',
1356
+ 'test type'
1357
+ );
1358
+
1359
+ if (destroy) {
1360
+ assert.calledWith(webex.meetings.destroy, sinon.match.instanceOf(Meeting), 'MISSING_MEETING_INFO')
1361
+ assert.notCalled(MeetingsUtil.getMeetingAddedType);
1362
+ assert.notCalled(TriggerProxy.trigger);
1363
+ assert.throw(webex.meetings.createMeeting, 'meeting information not found');
1364
+ } else {
1365
+ assert.notCalled(webex.meetings.destroy);
1366
+ assert.calledWith(MeetingsUtil.getMeetingAddedType, 'test type');
1367
+ assert.calledWith(
1368
+ TriggerProxy.trigger,
1369
+ sinon.match.instanceOf(Meetings),
1370
+ {
1371
+ file: 'meetings',
1372
+ function: 'createMeeting',
1373
+ },
1374
+ 'meeting:added',
1375
+ {
1376
+ meeting: sinon.match.instanceOf(Meeting),
1377
+ type: 'test meeting added type',
1378
+ }
1379
+ );
1380
+ }
1381
+ } catch (err) {
1382
+ assert.instanceOf(err, NoMeetingInfoError);
1383
+ }
1384
+ }
1385
+
1160
1386
  it('creates the meeting from a rejected meeting info fetch', async () => {
1161
- const meeting = await webex.meetings.createMeeting('test destination', 'test type');
1387
+ checkCreateMeetingWithNoMeetingInfo(false, false);
1388
+ });
1162
1389
 
1163
- assert.instanceOf(
1164
- meeting,
1165
- Meeting,
1166
- 'createMeeting should eventually resolve to a Meeting Object'
1167
- );
1168
- assert.calledOnce(webex.meetings.meetingInfo.fetchMeetingInfo);
1169
- assert.calledOnce(MeetingsUtil.getMeetingAddedType);
1170
- assert.calledTwice(TriggerProxy.trigger);
1171
- assert.calledWith(
1172
- webex.meetings.meetingInfo.fetchMeetingInfo,
1173
- 'test destination',
1174
- 'test type'
1175
- );
1176
- assert.calledWith(MeetingsUtil.getMeetingAddedType, 'test type');
1177
- assert.calledWith(
1178
- TriggerProxy.trigger,
1179
- sinon.match.instanceOf(Meetings),
1390
+ it('creates the meeting from a rejected meeting info fetch and destroys it if failOnMissingMeetingInfo', async () => {
1391
+ checkCreateMeetingWithNoMeetingInfo(true, true);
1392
+ });
1393
+ });
1394
+
1395
+ describe('rejected MeetingInfo.#fetchMeetingInfo - does not log for known Error types', () => {
1396
+ forEach(
1397
+ [
1180
1398
  {
1181
- file: 'meetings',
1182
- function: 'createMeeting',
1399
+ error: new CaptchaError(),
1400
+ debugLogMessage:
1401
+ 'Meetings:index#createMeeting --> Debug CaptchaError: Captcha is required. fetching /meetingInfo for creation.',
1183
1402
  },
1184
- 'meeting:added',
1185
1403
  {
1186
- meeting: sinon.match.instanceOf(Meeting),
1187
- type: 'test meeting added type',
1188
- }
1189
- );
1190
- });
1404
+ error: new PasswordError(),
1405
+ debugLogMessage:
1406
+ 'Meetings:index#createMeeting --> Debug PasswordError: Password is required, please use verifyPassword() fetching /meetingInfo for creation.',
1407
+ },
1408
+ {
1409
+ error: new PermissionError(),
1410
+ debugLogMessage:
1411
+ 'Meetings:index#createMeeting --> Debug PermissionError: Not allowed to execute the function, some properties on server, or local client state do not allow you to complete this action. fetching /meetingInfo for creation.',
1412
+ },
1413
+ {
1414
+ error: new Error(),
1415
+ infoLogMessage: true,
1416
+ debugLogMessage:
1417
+ 'Meetings:index#createMeeting --> Debug Error fetching /meetingInfo for creation.',
1418
+ },
1419
+ ],
1420
+ ({error, debugLogMessage, infoLogMessage}) => {
1421
+ it('creates the meeting from a rejected meeting info fetch', async () => {
1422
+ webex.meetings.meetingInfo.fetchMeetingInfo = sinon
1423
+ .stub()
1424
+ .returns(Promise.reject(error));
1425
+
1426
+ LoggerProxy.logger.debug = sinon.stub();
1427
+ LoggerProxy.logger.info = sinon.stub();
1428
+
1429
+ const meeting = await webex.meetings.createMeeting('test destination', 'test type');
1430
+
1431
+ assert.instanceOf(
1432
+ meeting,
1433
+ Meeting,
1434
+ 'createMeeting should eventually resolve to a Meeting Object'
1435
+ );
1436
+
1437
+ assert.calledWith(LoggerProxy.logger.debug, debugLogMessage);
1438
+
1439
+ if (infoLogMessage) {
1440
+ assert.calledWith(
1441
+ LoggerProxy.logger.info,
1442
+ 'Meetings:index#createMeeting --> Info Unable to fetch meeting info for test destination.'
1443
+ );
1444
+ } else {
1445
+ assert.notCalled(LoggerProxy.logger.info);
1446
+ }
1447
+ });
1448
+ }
1449
+ );
1191
1450
  });
1192
1451
  });
1193
1452
  });
@@ -1267,6 +1526,9 @@ describe('plugin-meetings', () => {
1267
1526
  });
1268
1527
 
1269
1528
  describe('#fetchUserPreferredWebexSite', () => {
1529
+
1530
+ let loggerProxySpy;
1531
+
1270
1532
  it('should call request.getMeetingPreferences to get the preferred webex site ', async () => {
1271
1533
  assert.isDefined(webex.meetings.preferredWebexSite);
1272
1534
  await webex.meetings.fetchUserPreferredWebexSite();
@@ -1274,7 +1536,24 @@ describe('plugin-meetings', () => {
1274
1536
  assert.equal(webex.meetings.preferredWebexSite, 'go.webex.com');
1275
1537
  });
1276
1538
 
1539
+ const setup = ({user} = {}) => {
1540
+ loggerProxySpy = sinon.spy(LoggerProxy.logger, 'error');
1541
+
1542
+ Object.assign(webex.internal, {
1543
+ services: {
1544
+ getMeetingPreferences: sinon.stub().returns(Promise.resolve({})),
1545
+ },
1546
+ user: {
1547
+ get: sinon.stub().returns(
1548
+ Promise.resolve(user)
1549
+ ),
1550
+ },
1551
+ });
1552
+ }
1553
+
1277
1554
  it('should not fail if UserPreferred info is not fetched ', async () => {
1555
+ setup();
1556
+
1278
1557
  Object.assign(webex.internal, {
1279
1558
  services: {
1280
1559
  getMeetingPreferences: sinon.stub().returns(Promise.resolve({})),
@@ -1284,7 +1563,62 @@ describe('plugin-meetings', () => {
1284
1563
  await webex.meetings.fetchUserPreferredWebexSite().then(() => {
1285
1564
  assert.equal(webex.meetings.preferredWebexSite, '');
1286
1565
  });
1566
+ assert.calledOnceWithExactly(
1567
+ loggerProxySpy,
1568
+ 'Failed to fetch preferred site from user - no site will be set'
1569
+ );
1570
+ });
1571
+
1572
+ it('should fall back to fetching the site from the user', async () => {
1573
+ setup({
1574
+ user: {
1575
+ userPreferences: {
1576
+ userPreferencesItems: {
1577
+ preferredWebExSite: 'site.webex.com',
1578
+ },
1579
+ },
1580
+ },
1581
+ });
1582
+
1583
+ await webex.meetings.fetchUserPreferredWebexSite();
1584
+
1585
+ assert.equal(webex.meetings.preferredWebexSite, 'site.webex.com');
1586
+ assert.notCalled(loggerProxySpy);
1587
+ });
1588
+
1589
+ forEach([
1590
+ {user: undefined},
1591
+ {user: {userPreferences: {}}},
1592
+ {user: {userPreferences: {userPreferencesItems: {}}}},
1593
+ {user: {userPreferences: {userPreferencesItems: {preferredWebExSite: undefined}}}},
1594
+ ], ({user}) => {
1595
+ it(`should handle invalid user data ${user}`, async () => {
1596
+ setup({user});
1597
+
1598
+ await webex.meetings.fetchUserPreferredWebexSite();
1599
+
1600
+ assert.equal(webex.meetings.preferredWebexSite, '');
1601
+ assert.calledOnceWithExactly(
1602
+ loggerProxySpy,
1603
+ 'Failed to fetch preferred site from user - no site will be set'
1604
+ );
1605
+ });
1606
+ });
1607
+
1608
+ it('should handle a get user failure', async () => {
1609
+ setup();
1610
+
1611
+ webex.internal.user.get.rejects(new Error());
1612
+
1613
+ await webex.meetings.fetchUserPreferredWebexSite();
1614
+
1615
+ assert.equal(webex.meetings.preferredWebexSite, '');
1616
+ assert.calledOnceWithExactly(
1617
+ loggerProxySpy,
1618
+ 'Failed to fetch preferred site from user - no site will be set'
1619
+ );
1287
1620
  });
1621
+
1288
1622
  });
1289
1623
  });
1290
1624
 
@@ -1368,5 +1702,477 @@ describe('plugin-meetings', () => {
1368
1702
  );
1369
1703
  });
1370
1704
  });
1705
+
1706
+ describe('#isNeedHandleMainLocus', () => {
1707
+ let meeting;
1708
+ let newLocus;
1709
+ beforeEach(() => {
1710
+ meeting = {
1711
+ controls: {},
1712
+ self: {},
1713
+ };
1714
+ newLocus = {
1715
+ controls: {},
1716
+ self: {},
1717
+ }
1718
+ });
1719
+ afterEach(() => {
1720
+ sinon.restore();
1721
+ });
1722
+ it('check normal case will return true', () => {
1723
+ sinon.stub(webex.meetings.meetingCollection, 'getActiveBreakoutLocus').returns(null);
1724
+ LoggerProxy.logger.log = sinon.stub();
1725
+ const result = webex.meetings.isNeedHandleMainLocus(meeting, newLocus);
1726
+ assert.equal(result, true);
1727
+ assert.calledWith(
1728
+ LoggerProxy.logger.log,
1729
+ 'Meetings:index#isNeedHandleMainLocus --> this is a normal main session locusDTO update case'
1730
+ );
1731
+ });
1732
+
1733
+ it('check self joined and joined on this device, return true', () => {
1734
+ sinon.stub(webex.meetings.meetingCollection, 'getActiveBreakoutLocus').returns(null);
1735
+ newLocus.self.state = 'JOINED';
1736
+ sinon.stub(MeetingsUtil, 'joinedOnThisDevice').returns(true);
1737
+
1738
+ LoggerProxy.logger.log = sinon.stub();
1739
+ const result = webex.meetings.isNeedHandleMainLocus(meeting, newLocus);
1740
+ assert.equal(result, true);
1741
+ assert.calledWith(
1742
+ LoggerProxy.logger.log,
1743
+ 'Meetings:index#isNeedHandleMainLocus --> self this device shown as JOINED in the main session'
1744
+ );
1745
+ });
1746
+
1747
+ it('if newLocus replaceAt time is expired, then return false', () => {
1748
+ sinon.stub(webex.meetings.meetingCollection, 'getActiveBreakoutLocus').returns({joinedWith: {replaces: [{
1749
+ replaceAt: '2023-03-27T02:17:02.506Z',
1750
+ }]}});
1751
+ newLocus.self.state = 'JOINED';
1752
+ sinon.stub(MeetingsUtil, 'joinedOnThisDevice').returns(true);
1753
+ sinon.stub(MeetingsUtil, 'getThisDevice').returns({
1754
+ replaces: [{
1755
+ replaceAt: '2023-03-27T02:17:01.506Z'
1756
+ }]
1757
+ })
1758
+
1759
+ LoggerProxy.logger.log = sinon.stub();
1760
+ const result = webex.meetings.isNeedHandleMainLocus(meeting, newLocus);
1761
+ assert.equal(result, false);
1762
+ assert.calledWith(
1763
+ LoggerProxy.logger.log,
1764
+ `Meetings:index#isNeedHandleMainLocus --> this is expired main joined status locus_dto replacedAt 2023-03-27T02:17:01.506Z bo replacedAt 2023-03-27T02:17:02.506Z`
1765
+ );
1766
+ });
1767
+
1768
+ it('check current is in breakout join with this device, return false', () => {
1769
+ sinon.stub(webex.meetings.meetingCollection, 'getActiveBreakoutLocus').returns({
1770
+ joinedWith: {
1771
+ correlationId: '111',
1772
+ },
1773
+ });
1774
+ newLocus.controls.breakout = {url: 'url'};
1775
+ meeting.correlationId = '111';
1776
+
1777
+ LoggerProxy.logger.log = sinon.stub();
1778
+ const result = webex.meetings.isNeedHandleMainLocus(meeting, newLocus);
1779
+ assert.equal(result, false);
1780
+ assert.calledWith(
1781
+ LoggerProxy.logger.log,
1782
+ `Meetings:index#isNeedHandleMainLocus --> there is active breakout session and joined on this device, and don't need to handle main session: url`
1783
+ );
1784
+ });
1785
+
1786
+ it('check self is moved and removed, return false', () => {
1787
+ webex.meetings.meetingCollection.getActiveBreakoutLocus = sinon.stub().returns(null);
1788
+ newLocus.self.state = 'LEFT';
1789
+ newLocus.self.reason = 'MOVED';
1790
+ newLocus.self.removed = true;
1791
+ LoggerProxy.logger.log = sinon.stub();
1792
+ const result = webex.meetings.isNeedHandleMainLocus(meeting, newLocus);
1793
+ assert.equal(result, false);
1794
+ assert.calledWith(
1795
+ LoggerProxy.logger.log,
1796
+ 'Meetings:index#isNeedHandleMainLocus --> self moved main locus with self removed status or with device resource moved, not need to handle'
1797
+ );
1798
+ });
1799
+
1800
+ it('check self is moved and device resource removed, return false', () => {
1801
+ webex.meetings.meetingCollection.getActiveBreakoutLocus = sinon.stub().returns(null);
1802
+ newLocus.self.state = 'LEFT';
1803
+ newLocus.self.reason = 'MOVED';
1804
+ sinon.stub(MeetingsUtil, 'getThisDevice').returns({
1805
+ state: 'LEFT',
1806
+ reason: 'MOVED',
1807
+ });
1808
+ LoggerProxy.logger.log = sinon.stub();
1809
+ const result = webex.meetings.isNeedHandleMainLocus(meeting, newLocus);
1810
+ assert.equal(result, false);
1811
+ assert.calledWith(
1812
+ LoggerProxy.logger.log,
1813
+ 'Meetings:index#isNeedHandleMainLocus --> self moved main locus with self removed status or with device resource moved, not need to handle'
1814
+ );
1815
+ });
1816
+
1817
+ it('check self is joined but device resource removed, return false', () => {
1818
+ webex.meetings.meetingCollection.getActiveBreakoutLocus = sinon.stub().returns(null);
1819
+ sinon.stub(MeetingsUtil, 'joinedOnThisDevice').returns(false);
1820
+ newLocus.self.state = 'JOINED';
1821
+ sinon.stub(MeetingsUtil, 'getThisDevice').returns({
1822
+ state: 'LEFT',
1823
+ reason: 'MOVED',
1824
+ });
1825
+ LoggerProxy.logger.log = sinon.stub();
1826
+ const result = webex.meetings.isNeedHandleMainLocus(meeting, newLocus);
1827
+ assert.equal(result, false);
1828
+ assert.calledWith(
1829
+ LoggerProxy.logger.log,
1830
+ 'Meetings:index#isNeedHandleMainLocus --> self device left&moved in main locus with self joined status, not need to handle'
1831
+ );
1832
+ });
1833
+ });
1834
+
1835
+ describe('#isNeedHandleLocusDTO', () => {
1836
+ let meeting;
1837
+ let newLocus;
1838
+ beforeEach(() => {
1839
+ meeting = {
1840
+ controls: {},
1841
+ self: {},
1842
+ };
1843
+ newLocus = {
1844
+ controls: {},
1845
+ self: {},
1846
+ }
1847
+ });
1848
+ afterEach(() => {
1849
+ sinon.restore();
1850
+ });
1851
+ it('initial DTO , joined breakout session, return true', () => {
1852
+ newLocus.controls.breakout = {
1853
+ sessionType: 'BREAKOUT',
1854
+ };
1855
+ newLocus.self.state = 'JOINED';
1856
+ newLocus.fullState = {
1857
+ active: true,
1858
+ };
1859
+ LoggerProxy.logger.log = sinon.stub();
1860
+ const result = webex.meetings.isNeedHandleLocusDTO(null, newLocus);
1861
+ assert.equal(result, true);
1862
+ assert.calledWith(
1863
+ LoggerProxy.logger.log,
1864
+ `Meetings:index#isNeedHandleLocusDTO --> the first breakout session locusDTO active status: true`
1865
+ );
1866
+ });
1867
+ it('others go to check isNeedHandleMainLocus', () => {
1868
+ newLocus.controls.breakout = {
1869
+ sessionType: 'MAIN',
1870
+ };
1871
+ newLocus.self.state = 'JOINED';
1872
+
1873
+ LoggerProxy.logger.log = sinon.stub();
1874
+ const result = webex.meetings.isNeedHandleLocusDTO(meeting, newLocus);
1875
+ assert.equal(result, true);
1876
+ assert.calledWith(
1877
+ LoggerProxy.logger.log,
1878
+ 'Meetings:index#isNeedHandleMainLocus --> this is a normal main session locusDTO update case'
1879
+ );
1880
+ });
1881
+ it('joined breakout session, self status is moved, return false', () => {
1882
+ newLocus.controls.breakout = {
1883
+ sessionType: 'BREAKOUT',
1884
+ };
1885
+ newLocus.self.state = 'LEFT';
1886
+ newLocus.self.reason = 'MOVED';
1887
+
1888
+ LoggerProxy.logger.log = sinon.stub();
1889
+ const result = webex.meetings.isNeedHandleLocusDTO(meeting, newLocus);
1890
+ assert.equal(result, false);
1891
+ });
1892
+ });
1893
+
1894
+ describe('#getCorrespondingMeetingByLocus', () => {
1895
+ let locus;
1896
+ let mockReturnMeeting = {meeting: 'meeting1'};
1897
+ const mockGetByKey = (keyWillReturnMeeting) => {
1898
+ webex.meetings.meetingCollection.getByKey = sinon.stub().callsFake((key) => {
1899
+ if (key === keyWillReturnMeeting) {
1900
+ return mockReturnMeeting;
1901
+ }
1902
+ return null;
1903
+ });
1904
+ };
1905
+
1906
+ beforeEach(() => {
1907
+ locus = {
1908
+ controls: {},
1909
+ self: {
1910
+ callbackInfo: {
1911
+ callbackAddress: 'address1',
1912
+ }
1913
+ },
1914
+ info: {
1915
+ webExMeetingId: '123456',
1916
+ isUnifiedSpaceMeeting: false,
1917
+ },
1918
+ conversationUrl: 'conversationUrl1'
1919
+ };
1920
+
1921
+ sinon.stub(MeetingsUtil, 'checkForCorrelationId').returns('correlationId1');
1922
+ });
1923
+ afterEach(() => {
1924
+ sinon.restore();
1925
+ });
1926
+ it('check the calls when no meeting found in meetingCollection', () => {
1927
+ mockGetByKey();
1928
+ const result = webex.meetings.getCorrespondingMeetingByLocus({locus, locusUrl: url1});
1929
+ assert.isNull(result);
1930
+ assert.callCount(webex.meetings.meetingCollection.getByKey, 5);
1931
+ assert.calledWith(webex.meetings.meetingCollection.getByKey, 'locusUrl', url1);
1932
+ assert.calledWith(webex.meetings.meetingCollection.getByKey, 'correlationId', 'correlationId1');
1933
+ assert.calledWith(webex.meetings.meetingCollection.getByKey, 'sipUri', 'address1');
1934
+ assert.calledWith(webex.meetings.meetingCollection.getByKey, 'conversationUrl', 'conversationUrl1');
1935
+ assert.calledWith(webex.meetings.meetingCollection.getByKey, 'meetingNumber', '123456');
1936
+ });
1937
+
1938
+ it('not try getByKey "conversationUrl" when isUnifiedSpaceMeeting is true', () => {
1939
+ mockGetByKey();
1940
+ locus.info.isUnifiedSpaceMeeting = true;
1941
+ const result = webex.meetings.getCorrespondingMeetingByLocus({locus, locusUrl: url1});
1942
+ assert.isNull(result);
1943
+ assert.callCount(webex.meetings.meetingCollection.getByKey, 4);
1944
+ })
1945
+
1946
+ it('check the calls when meeting found by key: locusUrl', () => {
1947
+ mockGetByKey('locusUrl');
1948
+ const result = webex.meetings.getCorrespondingMeetingByLocus({locus, locusUrl: url1});
1949
+ assert.deepEqual(result, mockReturnMeeting);
1950
+ assert.callCount(webex.meetings.meetingCollection.getByKey, 1);
1951
+ assert.calledWith(webex.meetings.meetingCollection.getByKey, 'locusUrl', url1);
1952
+ });
1953
+
1954
+ it('check the calls when meeting found by key: correlationId', () => {
1955
+ mockGetByKey('correlationId');
1956
+ const result = webex.meetings.getCorrespondingMeetingByLocus({locus, locusUrl: url1});
1957
+ assert.deepEqual(result, mockReturnMeeting);
1958
+ assert.callCount(webex.meetings.meetingCollection.getByKey, 2);
1959
+ assert.calledWith(webex.meetings.meetingCollection.getByKey, 'locusUrl', url1);
1960
+ assert.calledWith(webex.meetings.meetingCollection.getByKey, 'correlationId', 'correlationId1');
1961
+ });
1962
+
1963
+ it('check the calls when meeting found by key: sipUri', () => {
1964
+ mockGetByKey('sipUri');
1965
+ const result = webex.meetings.getCorrespondingMeetingByLocus({locus, locusUrl: url1});
1966
+ assert.deepEqual(result, mockReturnMeeting);
1967
+ assert.callCount(webex.meetings.meetingCollection.getByKey, 3);
1968
+ assert.calledWith(webex.meetings.meetingCollection.getByKey, 'locusUrl', url1);
1969
+ assert.calledWith(webex.meetings.meetingCollection.getByKey, 'correlationId', 'correlationId1');
1970
+ assert.calledWith(webex.meetings.meetingCollection.getByKey, 'sipUri', 'address1');
1971
+ });
1972
+
1973
+ it('check the calls when meeting found by key: conversationUrl', () => {
1974
+ mockGetByKey('conversationUrl');
1975
+ const result = webex.meetings.getCorrespondingMeetingByLocus({locus, locusUrl: url1});
1976
+ assert.deepEqual(result, mockReturnMeeting);
1977
+ assert.callCount(webex.meetings.meetingCollection.getByKey, 4);
1978
+ assert.calledWith(webex.meetings.meetingCollection.getByKey, 'locusUrl', url1);
1979
+ assert.calledWith(webex.meetings.meetingCollection.getByKey, 'correlationId', 'correlationId1');
1980
+ assert.calledWith(webex.meetings.meetingCollection.getByKey, 'sipUri', 'address1');
1981
+ assert.calledWith(webex.meetings.meetingCollection.getByKey, 'conversationUrl', 'conversationUrl1');
1982
+ });
1983
+
1984
+ it('check the calls when meeting found by key: meetingNumber', () => {
1985
+ mockGetByKey('meetingNumber');
1986
+ const result = webex.meetings.getCorrespondingMeetingByLocus({locus, locusUrl: url1});
1987
+ assert.deepEqual(result, mockReturnMeeting);
1988
+ assert.callCount(webex.meetings.meetingCollection.getByKey, 5);
1989
+ assert.calledWith(webex.meetings.meetingCollection.getByKey, 'locusUrl', url1);
1990
+ assert.calledWith(webex.meetings.meetingCollection.getByKey, 'correlationId', 'correlationId1');
1991
+ assert.calledWith(webex.meetings.meetingCollection.getByKey, 'sipUri', 'address1');
1992
+ assert.calledWith(webex.meetings.meetingCollection.getByKey, 'conversationUrl', 'conversationUrl1');
1993
+ assert.calledWith(webex.meetings.meetingCollection.getByKey, 'meetingNumber', '123456');
1994
+ });
1995
+ });
1996
+
1997
+ describe('#sortLocusArrayToUpdate', () => {
1998
+ let lociArray;
1999
+ let mainLocus;
2000
+ let breakoutLocus;
2001
+ beforeEach(() => {
2002
+ mainLocus = {
2003
+ url: 'mainUrl1',
2004
+ controls: {
2005
+ breakout: {
2006
+ sessionType: 'MAIN',
2007
+ url: 'breakoutUnifiedUrl1'
2008
+ }
2009
+ }
2010
+ };
2011
+ breakoutLocus = {
2012
+ url: 'breakoutUrl1',
2013
+ controls: {
2014
+ breakout: {
2015
+ sessionType: 'BREAKOUT',
2016
+ url: 'breakoutUnifiedUrl1'
2017
+ }
2018
+ }
2019
+ };
2020
+ lociArray = [mainLocus, breakoutLocus];
2021
+
2022
+ sinon.stub(MeetingsUtil, 'isValidBreakoutLocus').callsFake((locus) => {
2023
+ return locus.url === 'breakoutUrl1';
2024
+ });
2025
+ });
2026
+ afterEach(() => {
2027
+ sinon.restore();
2028
+ });
2029
+
2030
+ it('if both main and breakout locus is in array for non-exist meeting, return main locus to create first', () => {
2031
+ webex.meetings.meetingCollection.getByKey = sinon.stub().returns(undefined);
2032
+ const result = webex.meetings.sortLocusArrayToUpdate(lociArray);
2033
+ assert.deepEqual(result, [mainLocus]);
2034
+ assert.deepEqual(webex.meetings.breakoutLocusForHandleLater, [breakoutLocus]);
2035
+ });
2036
+
2037
+ it('if both main and breakout locus is in array for an exist meeting, return all locus', () => {
2038
+ webex.meetings.meetingCollection.getByKey = sinon.stub().returns({});
2039
+ const result = webex.meetings.sortLocusArrayToUpdate(lociArray);
2040
+ assert.deepEqual(result, [mainLocus, breakoutLocus]);
2041
+ assert.deepEqual(webex.meetings.breakoutLocusForHandleLater, []);
2042
+ });
2043
+
2044
+ it('if the breakout locus has no associated main locus, return all', () => {
2045
+ webex.meetings.meetingCollection.getByKey = sinon.stub().returns({});
2046
+ breakoutLocus.controls.breakout.url = 'testUrl';
2047
+ const result = webex.meetings.sortLocusArrayToUpdate(lociArray);
2048
+ assert.deepEqual(result, [mainLocus, breakoutLocus]);
2049
+ });
2050
+ });
2051
+
2052
+ describe('#checkHandleBreakoutLocus', () => {
2053
+ let breakoutLocus;
2054
+ beforeEach(() => {
2055
+ breakoutLocus = {
2056
+ url: 'breakoutUrl1',
2057
+ controls: {
2058
+ breakout: {
2059
+ sessionType: 'BREAKOUT',
2060
+ url: 'breakoutUnifiedUrl1',
2061
+ }
2062
+ }
2063
+ };
2064
+
2065
+ webex.meetings.handleLocusEvent = sinon.stub();
2066
+ });
2067
+ afterEach(() => {
2068
+ sinon.restore();
2069
+ });
2070
+ it('do nothing if new created locus is null/no cached breakouts for updating', () => {
2071
+ webex.meetings.checkHandleBreakoutLocus(null);
2072
+ webex.meetings.breakoutLocusForHandleLater = null;
2073
+ webex.meetings.checkHandleBreakoutLocus({});
2074
+ webex.meetings.breakoutLocusForHandleLater = [];
2075
+ webex.meetings.checkHandleBreakoutLocus({});
2076
+ assert.notCalled(webex.meetings.handleLocusEvent);
2077
+ });
2078
+
2079
+ it('do nothing if new created locus is breakout locus', () => {
2080
+ webex.meetings.breakoutLocusForHandleLater = [breakoutLocus];
2081
+ webex.meetings.checkHandleBreakoutLocus(breakoutLocus);
2082
+ assert.notCalled(webex.meetings.handleLocusEvent);
2083
+ });
2084
+
2085
+ it('do nothing if no cached locus is associated with the new created locus', () => {
2086
+ webex.meetings.breakoutLocusForHandleLater = [breakoutLocus];
2087
+ webex.meetings.checkHandleBreakoutLocus({
2088
+ controls: {
2089
+ breakout: {
2090
+ sessionType: 'MAIN',
2091
+ url: 'breakoutUnifiedUrl2',
2092
+ }
2093
+ }
2094
+ });
2095
+ assert.notCalled(webex.meetings.handleLocusEvent);
2096
+ });
2097
+
2098
+ it('update the cached breakout locus which associate the new created locus', () => {
2099
+ webex.meetings.breakoutLocusForHandleLater = [breakoutLocus];
2100
+ webex.meetings.checkHandleBreakoutLocus({
2101
+ controls: {
2102
+ breakout: {
2103
+ sessionType: 'MAIN',
2104
+ url: 'breakoutUnifiedUrl1',
2105
+ }
2106
+ }
2107
+ });
2108
+ assert.calledWith(webex.meetings.handleLocusEvent, {locus: breakoutLocus, locusUrl: breakoutLocus.url});
2109
+ });
2110
+ });
2111
+
2112
+ describe('uploading of logs', () => {
2113
+ let metricsSpy;
2114
+ let meeting;
2115
+
2116
+ beforeEach(async () => {
2117
+ webex.meetings.config.autoUploadLogs = true;
2118
+ webex.meetings.loggerRequest.uploadLogs = sinon.stub().resolves();
2119
+
2120
+ sinon.stub(webex.meetings.meetingInfo, 'fetchInfoOptions').resolves({});
2121
+ sinon.stub(webex.meetings.meetingInfo, 'fetchMeetingInfo').resolves({});
2122
+
2123
+ triggerProxyStub.restore();
2124
+
2125
+ metricsSpy = sinon.stub(Metrics, 'sendBehavioralMetric');
2126
+
2127
+ meeting = await webex.meetings.create('test');
2128
+
2129
+ meeting.locusId = 'locus id';
2130
+ meeting.correlationId = 'correlation id';
2131
+ meeting.locusInfo = {
2132
+ fullState: { lastActive: 'last active', sessionId: 'locus session id'},
2133
+ info: { webExMeetingId: 'meeting id'}
2134
+ }
2135
+ });
2136
+
2137
+ afterEach(() => {
2138
+ sinon.restore();
2139
+ })
2140
+
2141
+ it('sends metrics on success', async () => {
2142
+
2143
+ await meeting.uploadLogs();
2144
+
2145
+ await testUtils.flushPromises();
2146
+
2147
+ assert.calledOnceWithExactly(metricsSpy, 'js_sdk_upload_logs_success', {
2148
+ callStart: 'last active',
2149
+ correlationId: 'correlation id',
2150
+ feedbackId: 'correlation id',
2151
+ locusId: 'locus id',
2152
+ meetingId: 'meeting id',
2153
+ autoupload: true,
2154
+ locussessionid: 'locus session id',
2155
+ });
2156
+ });
2157
+
2158
+ it('sends metrics on failure', async () => {
2159
+ webex.meetings.loggerRequest.uploadLogs.rejects(new Error('fake error'));
2160
+
2161
+ await meeting.uploadLogs();
2162
+
2163
+ await testUtils.flushPromises();
2164
+
2165
+ assert.calledOnceWithExactly(metricsSpy, 'js_sdk_upload_logs_failure', sinon.match({
2166
+ callStart: 'last active',
2167
+ correlationId: 'correlation id',
2168
+ feedbackId: 'correlation id',
2169
+ locusId: 'locus id',
2170
+ meetingId: 'meeting id',
2171
+ reason: 'fake error',
2172
+ autoupload: true,
2173
+ locussessionid: 'locus session id',
2174
+ }));
2175
+ });
2176
+ });
1371
2177
  });
1372
2178
  });