@webex/plugin-meetings 3.0.0-beta.20 → 3.0.0-beta.201

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 (424) hide show
  1. package/README.md +45 -7
  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 +114 -14
  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 +841 -19
  15. package/dist/breakouts/index.js.map +1 -1
  16. package/dist/breakouts/request.js +78 -0
  17. package/dist/breakouts/request.js.map +1 -0
  18. package/dist/breakouts/utils.js +67 -0
  19. package/dist/breakouts/utils.js.map +1 -0
  20. package/dist/common/errors/webex-errors.js +3 -2
  21. package/dist/common/errors/webex-errors.js.map +1 -1
  22. package/dist/common/logs/logger-proxy.js +1 -1
  23. package/dist/common/logs/logger-proxy.js.map +1 -1
  24. package/dist/common/queue.js +24 -9
  25. package/dist/common/queue.js.map +1 -1
  26. package/dist/config.js +3 -8
  27. package/dist/config.js.map +1 -1
  28. package/dist/constants.js +172 -30
  29. package/dist/constants.js.map +1 -1
  30. package/dist/controls-options-manager/constants.js +14 -0
  31. package/dist/controls-options-manager/constants.js.map +1 -0
  32. package/dist/controls-options-manager/enums.js +27 -0
  33. package/dist/controls-options-manager/enums.js.map +1 -0
  34. package/dist/controls-options-manager/index.js +297 -0
  35. package/dist/controls-options-manager/index.js.map +1 -0
  36. package/dist/controls-options-manager/types.js +7 -0
  37. package/dist/controls-options-manager/types.js.map +1 -0
  38. package/dist/controls-options-manager/util.js +319 -0
  39. package/dist/controls-options-manager/util.js.map +1 -0
  40. package/dist/index.js +107 -0
  41. package/dist/index.js.map +1 -1
  42. package/dist/interpretation/collection.js +23 -0
  43. package/dist/interpretation/collection.js.map +1 -0
  44. package/dist/interpretation/index.js +366 -0
  45. package/dist/interpretation/index.js.map +1 -0
  46. package/dist/interpretation/siLanguage.js +25 -0
  47. package/dist/interpretation/siLanguage.js.map +1 -0
  48. package/dist/locus-info/controlsUtils.js +91 -2
  49. package/dist/locus-info/controlsUtils.js.map +1 -1
  50. package/dist/locus-info/index.js +355 -57
  51. package/dist/locus-info/index.js.map +1 -1
  52. package/dist/locus-info/mediaSharesUtils.js +43 -1
  53. package/dist/locus-info/mediaSharesUtils.js.map +1 -1
  54. package/dist/locus-info/parser.js +219 -63
  55. package/dist/locus-info/parser.js.map +1 -1
  56. package/dist/locus-info/selfUtils.js +89 -14
  57. package/dist/locus-info/selfUtils.js.map +1 -1
  58. package/dist/media/index.js +48 -135
  59. package/dist/media/index.js.map +1 -1
  60. package/dist/media/properties.js +29 -90
  61. package/dist/media/properties.js.map +1 -1
  62. package/dist/mediaQualityMetrics/config.js +505 -493
  63. package/dist/mediaQualityMetrics/config.js.map +1 -1
  64. package/dist/meeting/in-meeting-actions.js +80 -2
  65. package/dist/meeting/in-meeting-actions.js.map +1 -1
  66. package/dist/meeting/index.js +2692 -2544
  67. package/dist/meeting/index.js.map +1 -1
  68. package/dist/meeting/locusMediaRequest.js +291 -0
  69. package/dist/meeting/locusMediaRequest.js.map +1 -0
  70. package/dist/meeting/muteState.js +229 -124
  71. package/dist/meeting/muteState.js.map +1 -1
  72. package/dist/meeting/request.js +196 -190
  73. package/dist/meeting/request.js.map +1 -1
  74. package/dist/meeting/util.js +529 -414
  75. package/dist/meeting/util.js.map +1 -1
  76. package/dist/meeting-info/index.js +48 -7
  77. package/dist/meeting-info/index.js.map +1 -1
  78. package/dist/meeting-info/meeting-info-v2.js +171 -51
  79. package/dist/meeting-info/meeting-info-v2.js.map +1 -1
  80. package/dist/meeting-info/utilv2.js +20 -5
  81. package/dist/meeting-info/utilv2.js.map +1 -1
  82. package/dist/meetings/collection.js +22 -0
  83. package/dist/meetings/collection.js.map +1 -1
  84. package/dist/meetings/index.js +357 -66
  85. package/dist/meetings/index.js.map +1 -1
  86. package/dist/meetings/meetings.types.js +7 -0
  87. package/dist/meetings/meetings.types.js.map +1 -0
  88. package/dist/meetings/request.js +2 -0
  89. package/dist/meetings/request.js.map +1 -1
  90. package/dist/meetings/util.js +88 -1
  91. package/dist/meetings/util.js.map +1 -1
  92. package/dist/member/index.js +49 -0
  93. package/dist/member/index.js.map +1 -1
  94. package/dist/member/types.js +25 -0
  95. package/dist/member/types.js.map +1 -0
  96. package/dist/member/util.js +121 -25
  97. package/dist/member/util.js.map +1 -1
  98. package/dist/members/collection.js +10 -0
  99. package/dist/members/collection.js.map +1 -1
  100. package/dist/members/index.js +86 -5
  101. package/dist/members/index.js.map +1 -1
  102. package/dist/members/request.js +106 -38
  103. package/dist/members/request.js.map +1 -1
  104. package/dist/members/types.js +15 -0
  105. package/dist/members/types.js.map +1 -0
  106. package/dist/members/util.js +316 -233
  107. package/dist/members/util.js.map +1 -1
  108. package/dist/metrics/constants.js +3 -5
  109. package/dist/metrics/constants.js.map +1 -1
  110. package/dist/metrics/index.js +1 -468
  111. package/dist/metrics/index.js.map +1 -1
  112. package/dist/multistream/mediaRequestManager.js +238 -49
  113. package/dist/multistream/mediaRequestManager.js.map +1 -1
  114. package/dist/multistream/receiveSlot.js +49 -16
  115. package/dist/multistream/receiveSlot.js.map +1 -1
  116. package/dist/multistream/receiveSlotManager.js +52 -34
  117. package/dist/multistream/receiveSlotManager.js.map +1 -1
  118. package/dist/multistream/remoteMedia.js +44 -18
  119. package/dist/multistream/remoteMedia.js.map +1 -1
  120. package/dist/multistream/remoteMediaGroup.js +60 -3
  121. package/dist/multistream/remoteMediaGroup.js.map +1 -1
  122. package/dist/multistream/remoteMediaManager.js +173 -59
  123. package/dist/multistream/remoteMediaManager.js.map +1 -1
  124. package/dist/networkQualityMonitor/index.js +4 -2
  125. package/dist/networkQualityMonitor/index.js.map +1 -1
  126. package/dist/reachability/index.js +72 -27
  127. package/dist/reachability/index.js.map +1 -1
  128. package/dist/reachability/request.js +12 -5
  129. package/dist/reachability/request.js.map +1 -1
  130. package/dist/reactions/reactions.js +2 -2
  131. package/dist/reactions/reactions.js.map +1 -1
  132. package/dist/reactions/reactions.type.js +18 -18
  133. package/dist/reactions/reactions.type.js.map +1 -1
  134. package/dist/reconnection-manager/index.js +196 -155
  135. package/dist/reconnection-manager/index.js.map +1 -1
  136. package/dist/recording-controller/index.js +21 -1
  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 +21 -29
  141. package/dist/roap/index.js.map +1 -1
  142. package/dist/roap/request.js +110 -89
  143. package/dist/roap/request.js.map +1 -1
  144. package/dist/roap/turnDiscovery.js +93 -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 +115 -0
  149. package/dist/rtcMetrics/index.js.map +1 -0
  150. package/dist/statsAnalyzer/global.js +1 -93
  151. package/dist/statsAnalyzer/global.js.map +1 -1
  152. package/dist/statsAnalyzer/index.js +326 -311
  153. package/dist/statsAnalyzer/index.js.map +1 -1
  154. package/dist/statsAnalyzer/mqaUtil.js +90 -53
  155. package/dist/statsAnalyzer/mqaUtil.js.map +1 -1
  156. package/dist/types/annotation/annotation.types.d.ts +42 -0
  157. package/dist/types/annotation/constants.d.ts +31 -0
  158. package/dist/types/annotation/index.d.ts +117 -0
  159. package/dist/types/breakouts/breakout.d.ts +8 -0
  160. package/dist/types/breakouts/collection.d.ts +5 -0
  161. package/dist/types/breakouts/edit-lock-error.d.ts +15 -0
  162. package/dist/types/breakouts/events.d.ts +8 -0
  163. package/dist/types/breakouts/index.d.ts +5 -0
  164. package/dist/types/breakouts/request.d.ts +22 -0
  165. package/dist/types/breakouts/utils.d.ts +15 -0
  166. package/dist/types/common/browser-detection.d.ts +9 -0
  167. package/dist/types/common/collection.d.ts +48 -0
  168. package/dist/types/common/config.d.ts +2 -0
  169. package/dist/types/common/errors/captcha-error.d.ts +15 -0
  170. package/dist/types/common/errors/intent-to-join.d.ts +16 -0
  171. package/dist/types/common/errors/join-meeting.d.ts +17 -0
  172. package/dist/types/common/errors/media.d.ts +15 -0
  173. package/dist/types/common/errors/parameter.d.ts +15 -0
  174. package/dist/types/common/errors/password-error.d.ts +15 -0
  175. package/dist/types/common/errors/permission.d.ts +14 -0
  176. package/dist/types/common/errors/reconnection-in-progress.d.ts +9 -0
  177. package/dist/types/common/errors/reconnection.d.ts +15 -0
  178. package/dist/types/common/errors/stats.d.ts +15 -0
  179. package/dist/types/common/errors/webex-errors.d.ts +69 -0
  180. package/dist/types/common/errors/webex-meetings-error.d.ts +20 -0
  181. package/dist/types/common/events/events-scope.d.ts +17 -0
  182. package/dist/types/common/events/events.d.ts +12 -0
  183. package/dist/types/common/events/trigger-proxy.d.ts +2 -0
  184. package/dist/types/common/events/util.d.ts +2 -0
  185. package/dist/types/common/logs/logger-config.d.ts +2 -0
  186. package/dist/types/common/logs/logger-proxy.d.ts +2 -0
  187. package/dist/types/common/logs/request.d.ts +34 -0
  188. package/dist/types/common/queue.d.ts +34 -0
  189. package/dist/types/config.d.ts +72 -0
  190. package/dist/types/constants.d.ts +1016 -0
  191. package/dist/types/controls-options-manager/constants.d.ts +4 -0
  192. package/dist/types/controls-options-manager/enums.d.ts +15 -0
  193. package/dist/types/controls-options-manager/index.d.ts +136 -0
  194. package/dist/types/controls-options-manager/types.d.ts +43 -0
  195. package/dist/types/controls-options-manager/util.d.ts +1 -0
  196. package/dist/types/index.d.ts +7 -0
  197. package/dist/types/interpretation/collection.d.ts +5 -0
  198. package/dist/types/interpretation/index.d.ts +5 -0
  199. package/dist/types/interpretation/siLanguage.d.ts +5 -0
  200. package/dist/types/locus-info/controlsUtils.d.ts +2 -0
  201. package/dist/types/locus-info/embeddedAppsUtils.d.ts +2 -0
  202. package/dist/types/locus-info/fullState.d.ts +2 -0
  203. package/dist/types/locus-info/hostUtils.d.ts +2 -0
  204. package/dist/types/locus-info/index.d.ts +322 -0
  205. package/dist/types/locus-info/infoUtils.d.ts +2 -0
  206. package/dist/types/locus-info/mediaSharesUtils.d.ts +2 -0
  207. package/dist/types/locus-info/parser.d.ts +271 -0
  208. package/dist/types/locus-info/selfUtils.d.ts +2 -0
  209. package/dist/types/media/index.d.ts +34 -0
  210. package/dist/types/media/properties.d.ts +93 -0
  211. package/dist/types/media/util.d.ts +2 -0
  212. package/dist/types/mediaQualityMetrics/config.d.ts +365 -0
  213. package/dist/types/meeting/in-meeting-actions.d.ts +153 -0
  214. package/dist/types/meeting/index.d.ts +1471 -0
  215. package/dist/types/meeting/locusMediaRequest.d.ts +70 -0
  216. package/dist/types/meeting/muteState.d.ts +184 -0
  217. package/dist/types/meeting/request.d.ts +257 -0
  218. package/dist/types/meeting/request.type.d.ts +11 -0
  219. package/dist/types/meeting/state.d.ts +9 -0
  220. package/dist/types/meeting/util.d.ts +78 -0
  221. package/dist/types/meeting-info/collection.d.ts +20 -0
  222. package/dist/types/meeting-info/index.d.ts +62 -0
  223. package/dist/types/meeting-info/meeting-info-v2.d.ts +122 -0
  224. package/dist/types/meeting-info/request.d.ts +22 -0
  225. package/dist/types/meeting-info/util.d.ts +2 -0
  226. package/dist/types/meeting-info/utilv2.d.ts +2 -0
  227. package/dist/types/meetings/collection.d.ts +31 -0
  228. package/dist/types/meetings/index.d.ts +367 -0
  229. package/dist/types/meetings/meetings.types.d.ts +4 -0
  230. package/dist/types/meetings/request.d.ts +27 -0
  231. package/dist/types/meetings/util.d.ts +18 -0
  232. package/dist/types/member/index.d.ts +159 -0
  233. package/dist/types/member/types.d.ts +32 -0
  234. package/dist/types/member/util.d.ts +2 -0
  235. package/dist/types/members/collection.d.ts +29 -0
  236. package/dist/types/members/index.d.ts +353 -0
  237. package/dist/types/members/request.d.ts +114 -0
  238. package/dist/types/members/types.d.ts +24 -0
  239. package/dist/types/members/util.d.ts +210 -0
  240. package/dist/types/metrics/constants.d.ts +55 -0
  241. package/dist/types/metrics/index.d.ts +45 -0
  242. package/dist/types/multistream/mediaRequestManager.d.ts +118 -0
  243. package/dist/types/multistream/receiveSlot.d.ts +68 -0
  244. package/dist/types/multistream/receiveSlotManager.d.ts +56 -0
  245. package/dist/types/multistream/remoteMedia.d.ts +72 -0
  246. package/dist/types/multistream/remoteMediaGroup.d.ts +47 -0
  247. package/dist/types/multistream/remoteMediaManager.d.ts +277 -0
  248. package/dist/types/networkQualityMonitor/index.d.ts +70 -0
  249. package/dist/types/personal-meeting-room/index.d.ts +47 -0
  250. package/dist/types/personal-meeting-room/request.d.ts +14 -0
  251. package/dist/types/personal-meeting-room/util.d.ts +2 -0
  252. package/dist/types/reachability/index.d.ts +152 -0
  253. package/dist/types/reachability/request.d.ts +37 -0
  254. package/dist/types/reactions/constants.d.ts +3 -0
  255. package/dist/types/reactions/reactions.d.ts +4 -0
  256. package/dist/types/reactions/reactions.type.d.ts +52 -0
  257. package/dist/types/reconnection-manager/index.d.ts +126 -0
  258. package/dist/types/recording-controller/enums.d.ts +7 -0
  259. package/dist/types/recording-controller/index.d.ts +208 -0
  260. package/dist/types/recording-controller/util.d.ts +14 -0
  261. package/dist/types/roap/index.d.ts +77 -0
  262. package/dist/types/roap/request.d.ts +36 -0
  263. package/dist/types/roap/turnDiscovery.d.ts +91 -0
  264. package/dist/types/rtcMetrics/constants.d.ts +4 -0
  265. package/dist/types/rtcMetrics/index.d.ts +46 -0
  266. package/dist/types/statsAnalyzer/global.d.ts +36 -0
  267. package/dist/types/statsAnalyzer/index.d.ts +200 -0
  268. package/dist/types/statsAnalyzer/mqaUtil.d.ts +24 -0
  269. package/dist/types/transcription/index.d.ts +64 -0
  270. package/package.json +25 -22
  271. package/src/annotation/annotation.types.ts +50 -0
  272. package/src/annotation/constants.ts +36 -0
  273. package/src/annotation/index.ts +328 -0
  274. package/src/breakouts/README.md +44 -14
  275. package/src/breakouts/breakout.ts +87 -9
  276. package/src/breakouts/edit-lock-error.ts +25 -0
  277. package/src/breakouts/events.ts +56 -0
  278. package/src/breakouts/index.ts +710 -10
  279. package/src/breakouts/request.ts +55 -0
  280. package/src/breakouts/utils.ts +57 -0
  281. package/src/common/errors/webex-errors.ts +6 -2
  282. package/src/common/logs/logger-proxy.ts +1 -1
  283. package/src/common/queue.ts +22 -8
  284. package/src/config.ts +2 -7
  285. package/src/constants.ts +157 -21
  286. package/src/controls-options-manager/constants.ts +5 -0
  287. package/src/controls-options-manager/enums.ts +18 -0
  288. package/src/controls-options-manager/index.ts +278 -0
  289. package/src/controls-options-manager/types.ts +59 -0
  290. package/src/controls-options-manager/util.ts +300 -0
  291. package/src/index.ts +39 -0
  292. package/src/interpretation/README.md +60 -0
  293. package/src/interpretation/collection.ts +19 -0
  294. package/src/interpretation/index.ts +332 -0
  295. package/src/interpretation/siLanguage.ts +18 -0
  296. package/src/locus-info/controlsUtils.ts +108 -0
  297. package/src/locus-info/index.ts +375 -52
  298. package/src/locus-info/mediaSharesUtils.ts +48 -0
  299. package/src/locus-info/parser.ts +224 -39
  300. package/src/locus-info/selfUtils.ts +81 -5
  301. package/src/media/index.ts +87 -140
  302. package/src/media/properties.ts +49 -90
  303. package/src/mediaQualityMetrics/config.ts +379 -377
  304. package/src/meeting/in-meeting-actions.ts +159 -3
  305. package/src/meeting/index.ts +1980 -2030
  306. package/src/meeting/locusMediaRequest.ts +309 -0
  307. package/src/meeting/muteState.ts +228 -132
  308. package/src/meeting/request.ts +102 -112
  309. package/src/meeting/util.ts +509 -397
  310. package/src/meeting-info/index.ts +54 -8
  311. package/src/meeting-info/meeting-info-v2.ts +148 -14
  312. package/src/meeting-info/utilv2.ts +13 -3
  313. package/src/meetings/collection.ts +20 -0
  314. package/src/meetings/index.ts +392 -84
  315. package/src/meetings/meetings.types.ts +12 -0
  316. package/src/meetings/request.ts +2 -0
  317. package/src/meetings/util.ts +103 -4
  318. package/src/member/index.ts +49 -0
  319. package/src/member/types.ts +38 -0
  320. package/src/member/util.ts +127 -25
  321. package/src/members/collection.ts +8 -0
  322. package/src/members/index.ts +107 -6
  323. package/src/members/request.ts +97 -17
  324. package/src/members/types.ts +28 -0
  325. package/src/members/util.ts +319 -240
  326. package/src/metrics/constants.ts +2 -4
  327. package/src/metrics/index.ts +1 -490
  328. package/src/multistream/mediaRequestManager.ts +289 -79
  329. package/src/multistream/receiveSlot.ts +55 -18
  330. package/src/multistream/receiveSlotManager.ts +46 -24
  331. package/src/multistream/remoteMedia.ts +27 -2
  332. package/src/multistream/remoteMediaGroup.ts +59 -0
  333. package/src/multistream/remoteMediaManager.ts +113 -32
  334. package/src/networkQualityMonitor/index.ts +6 -6
  335. package/src/reachability/index.ts +62 -15
  336. package/src/reachability/request.ts +10 -5
  337. package/src/reactions/reactions.ts +4 -4
  338. package/src/reactions/reactions.type.ts +3 -3
  339. package/src/reconnection-manager/index.ts +68 -43
  340. package/src/recording-controller/index.ts +20 -2
  341. package/src/recording-controller/util.ts +26 -9
  342. package/src/roap/index.ts +21 -30
  343. package/src/roap/request.ts +101 -95
  344. package/src/roap/turnDiscovery.ts +47 -25
  345. package/src/rtcMetrics/constants.ts +3 -0
  346. package/src/rtcMetrics/index.ts +96 -0
  347. package/src/statsAnalyzer/global.ts +1 -94
  348. package/src/statsAnalyzer/index.ts +376 -386
  349. package/src/statsAnalyzer/mqaUtil.ts +100 -99
  350. package/test/integration/spec/converged-space-meetings.js +233 -0
  351. package/test/integration/spec/journey.js +336 -259
  352. package/test/integration/spec/space-meeting.js +77 -4
  353. package/test/unit/spec/annotation/index.ts +418 -0
  354. package/test/unit/spec/breakouts/breakout.ts +142 -24
  355. package/test/unit/spec/breakouts/edit-lock-error.ts +30 -0
  356. package/test/unit/spec/breakouts/events.ts +89 -0
  357. package/test/unit/spec/breakouts/index.ts +1545 -48
  358. package/test/unit/spec/breakouts/request.ts +104 -0
  359. package/test/unit/spec/breakouts/utils.js +72 -0
  360. package/test/unit/spec/common/queue.js +31 -2
  361. package/test/unit/spec/controls-options-manager/index.js +287 -0
  362. package/test/unit/spec/controls-options-manager/util.js +582 -0
  363. package/test/unit/spec/fixture/locus.js +1 -0
  364. package/test/unit/spec/interpretation/collection.ts +15 -0
  365. package/test/unit/spec/interpretation/index.ts +589 -0
  366. package/test/unit/spec/interpretation/siLanguage.ts +28 -0
  367. package/test/unit/spec/locus-info/controlsUtils.js +316 -43
  368. package/test/unit/spec/locus-info/index.js +1094 -38
  369. package/test/unit/spec/locus-info/mediaSharesUtils.ts +22 -0
  370. package/test/unit/spec/locus-info/parser.js +62 -22
  371. package/test/unit/spec/locus-info/selfConstant.js +27 -4
  372. package/test/unit/spec/locus-info/selfUtils.js +208 -17
  373. package/test/unit/spec/media/index.ts +138 -28
  374. package/test/unit/spec/meeting/in-meeting-actions.ts +79 -3
  375. package/test/unit/spec/meeting/index.js +3092 -1571
  376. package/test/unit/spec/meeting/locusMediaRequest.ts +436 -0
  377. package/test/unit/spec/meeting/muteState.js +370 -208
  378. package/test/unit/spec/meeting/request.js +338 -43
  379. package/test/unit/spec/meeting/utils.js +449 -53
  380. package/test/unit/spec/meeting-info/index.js +181 -0
  381. package/test/unit/spec/meeting-info/meetinginfov2.js +383 -5
  382. package/test/unit/spec/meeting-info/utilv2.js +21 -0
  383. package/test/unit/spec/meetings/collection.js +14 -0
  384. package/test/unit/spec/meetings/index.js +866 -124
  385. package/test/unit/spec/meetings/utils.js +206 -2
  386. package/test/unit/spec/member/index.js +58 -4
  387. package/test/unit/spec/member/util.js +479 -35
  388. package/test/unit/spec/members/index.js +319 -1
  389. package/test/unit/spec/members/request.js +206 -27
  390. package/test/unit/spec/members/utils.js +184 -0
  391. package/test/unit/spec/metrics/index.js +1 -50
  392. package/test/unit/spec/multistream/mediaRequestManager.ts +803 -162
  393. package/test/unit/spec/multistream/receiveSlot.ts +72 -13
  394. package/test/unit/spec/multistream/receiveSlotManager.ts +58 -28
  395. package/test/unit/spec/multistream/remoteMedia.ts +30 -0
  396. package/test/unit/spec/multistream/remoteMediaGroup.ts +266 -0
  397. package/test/unit/spec/multistream/remoteMediaManager.ts +318 -0
  398. package/test/unit/spec/networkQualityMonitor/index.js +4 -4
  399. package/test/unit/spec/reachability/index.ts +125 -8
  400. package/test/unit/spec/reachability/request.js +66 -0
  401. package/test/unit/spec/reconnection-manager/index.js +59 -6
  402. package/test/unit/spec/recording-controller/index.js +294 -218
  403. package/test/unit/spec/recording-controller/util.js +223 -96
  404. package/test/unit/spec/roap/index.ts +26 -51
  405. package/test/unit/spec/roap/request.ts +196 -85
  406. package/test/unit/spec/roap/turnDiscovery.ts +30 -7
  407. package/test/unit/spec/rtcMetrics/index.ts +60 -0
  408. package/test/unit/spec/stats-analyzer/index.js +92 -41
  409. package/test/utils/constants.js +9 -0
  410. package/test/utils/integrationTestUtils.js +46 -0
  411. package/test/utils/testUtils.js +0 -45
  412. package/test/utils/webex-config.js +4 -0
  413. package/test/utils/webex-test-users.js +6 -3
  414. package/dist/meeting/effectsState.js +0 -262
  415. package/dist/meeting/effectsState.js.map +0 -1
  416. package/dist/metrics/config.js +0 -299
  417. package/dist/metrics/config.js.map +0 -1
  418. package/dist/multistream/multistreamMedia.js +0 -110
  419. package/dist/multistream/multistreamMedia.js.map +0 -1
  420. package/src/index.js +0 -15
  421. package/src/meeting/effectsState.ts +0 -211
  422. package/src/metrics/config.ts +0 -495
  423. package/src/multistream/multistreamMedia.ts +0 -97
  424. package/test/unit/spec/meeting/effectsState.js +0 -285
@@ -3,6 +3,7 @@ import sinon from 'sinon';
3
3
  import {cloneDeep} from 'lodash';
4
4
  import {assert} from '@webex/test-helper-chai';
5
5
  import MockWebex from '@webex/test-helper-mock-webex';
6
+ import testUtils from '../../../utils/testUtils';
6
7
  import Meetings from '@webex/plugin-meetings';
7
8
  import LocusInfo from '@webex/plugin-meetings/src/locus-info';
8
9
  import SelfUtils from '@webex/plugin-meetings/src/locus-info/selfUtils';
@@ -16,9 +17,14 @@ import {
16
17
  LOCUSEVENT,
17
18
  EVENTS,
18
19
  DISPLAY_HINTS,
20
+ _CALL_,
21
+ LOCUS,
22
+ MEETING_STATE,
23
+ _MEETING_,
19
24
  } from '../../../../src/constants';
20
25
 
21
26
  import {self, selfWithInactivity} from './selfConstant';
27
+ import uuid from 'uuid';
22
28
 
23
29
  describe('plugin-meetings', () => {
24
30
  describe('LocusInfo index', () => {
@@ -66,8 +72,12 @@ describe('plugin-meetings', () => {
66
72
 
67
73
  beforeEach('setup new controls', () => {
68
74
  newControls = {
75
+ disallowUnmute: {enabled: true},
69
76
  lock: {},
70
77
  meetingFull: {},
78
+ muteOnEntry: {enabled: true},
79
+ raiseHand: {enabled: true},
80
+ reactions: {enabled: true, showDisplayNameWithReactions: true},
71
81
  record: {
72
82
  recording: false,
73
83
  paused: false,
@@ -76,12 +86,14 @@ describe('plugin-meetings', () => {
76
86
  modifiedBy: 'George Kittle',
77
87
  },
78
88
  },
79
- shareControl: {},
89
+ shareControl: {control: 'example-value'},
80
90
  transcribe: {},
91
+ viewTheParticipantList: {enabled: true},
81
92
  meetingContainer: {
82
93
  meetingContainerUrl: 'http://new-url.com',
83
94
  },
84
95
  entryExitTone: {enabled: true, mode: 'foo'},
96
+ video: {enabled: true},
85
97
  };
86
98
  });
87
99
 
@@ -95,6 +107,97 @@ describe('plugin-meetings', () => {
95
107
  assert.equal(locusInfo.controls, newControls);
96
108
  });
97
109
 
110
+ it('should trigger the CONTROLS_MUTE_ON_ENTRY_CHANGED event when necessary', () => {
111
+ locusInfo.controls = {};
112
+ locusInfo.emitScoped = sinon.stub();
113
+ locusInfo.updateControls(newControls);
114
+
115
+ assert.calledWith(
116
+ locusInfo.emitScoped,
117
+ {file: 'locus-info', function: 'updateControls'},
118
+ LOCUSINFO.EVENTS.CONTROLS_MUTE_ON_ENTRY_CHANGED,
119
+ {state: newControls.muteOnEntry}
120
+ );
121
+ });
122
+
123
+ it('should trigger the CONTROLS_SHARE_CONTROL_CHANGED event when necessary', () => {
124
+ locusInfo.controls = {};
125
+ locusInfo.emitScoped = sinon.stub();
126
+ locusInfo.updateControls(newControls);
127
+
128
+ assert.calledWith(
129
+ locusInfo.emitScoped,
130
+ {file: 'locus-info', function: 'updateControls'},
131
+ LOCUSINFO.EVENTS.CONTROLS_SHARE_CONTROL_CHANGED,
132
+ {state: newControls.shareControl}
133
+ );
134
+ });
135
+
136
+ it('should trigger the CONTROLS_DISALLOW_UNMUTE_CHANGED event when necessary', () => {
137
+ locusInfo.controls = {};
138
+ locusInfo.emitScoped = sinon.stub();
139
+ locusInfo.updateControls(newControls);
140
+
141
+ assert.calledWith(
142
+ locusInfo.emitScoped,
143
+ {file: 'locus-info', function: 'updateControls'},
144
+ LOCUSINFO.EVENTS.CONTROLS_DISALLOW_UNMUTE_CHANGED,
145
+ {state: newControls.disallowUnmute}
146
+ );
147
+ });
148
+
149
+ it('should trigger the CONTROLS_REACTIONS_CHANGED event when necessary', () => {
150
+ locusInfo.controls = {};
151
+ locusInfo.emitScoped = sinon.stub();
152
+ locusInfo.updateControls(newControls);
153
+
154
+ assert.calledWith(
155
+ locusInfo.emitScoped,
156
+ {file: 'locus-info', function: 'updateControls'},
157
+ LOCUSINFO.EVENTS.CONTROLS_REACTIONS_CHANGED,
158
+ {state: newControls.reactions}
159
+ );
160
+ });
161
+
162
+ it('should trigger the CONTROLS_VIEW_THE_PARTICIPANTS_LIST_CHANGED event when necessary', () => {
163
+ locusInfo.controls = {};
164
+ locusInfo.emitScoped = sinon.stub();
165
+ locusInfo.updateControls(newControls);
166
+
167
+ assert.calledWith(
168
+ locusInfo.emitScoped,
169
+ {file: 'locus-info', function: 'updateControls'},
170
+ LOCUSINFO.EVENTS.CONTROLS_VIEW_THE_PARTICIPANTS_LIST_CHANGED,
171
+ {state: newControls.viewTheParticipantList}
172
+ );
173
+ });
174
+
175
+ it('should trigger the CONTROLS_RAISE_HAND_CHANGED event when necessary', () => {
176
+ locusInfo.controls = {};
177
+ locusInfo.emitScoped = sinon.stub();
178
+ locusInfo.updateControls(newControls);
179
+
180
+ assert.calledWith(
181
+ locusInfo.emitScoped,
182
+ {file: 'locus-info', function: 'updateControls'},
183
+ LOCUSINFO.EVENTS.CONTROLS_RAISE_HAND_CHANGED,
184
+ {state: newControls.raiseHand}
185
+ );
186
+ });
187
+
188
+ it('should trigger the CONTROLS_VIDEO_CHANGED event when necessary', () => {
189
+ locusInfo.controls = {};
190
+ locusInfo.emitScoped = sinon.stub();
191
+ locusInfo.updateControls(newControls);
192
+
193
+ assert.calledWith(
194
+ locusInfo.emitScoped,
195
+ {file: 'locus-info', function: 'updateControls'},
196
+ LOCUSINFO.EVENTS.CONTROLS_VIDEO_CHANGED,
197
+ {state: newControls.video}
198
+ );
199
+ });
200
+
98
201
  it('should not trigger the CONTROLS_RECORDING_UPDATED event', () => {
99
202
  locusInfo.controls = {};
100
203
  locusInfo.emitScoped = sinon.stub();
@@ -279,9 +382,11 @@ describe('plugin-meetings', () => {
279
382
 
280
383
  it('should update the breakout state', () => {
281
384
  locusInfo.emitScoped = sinon.stub();
282
- newControls.breakout = 'new breakout';
385
+ let tmpStub = sinon.stub(SelfUtils, 'getReplacedBreakoutMoveId').returns('breakoutMoveId');
386
+ newControls.breakout = {breakout: {}};
387
+ let selfInfo = {};
283
388
 
284
- locusInfo.updateControls(newControls);
389
+ locusInfo.updateControls(newControls, selfInfo);
285
390
 
286
391
  assert.calledWith(
287
392
  locusInfo.emitScoped,
@@ -291,7 +396,28 @@ describe('plugin-meetings', () => {
291
396
  },
292
397
  LOCUSINFO.EVENTS.CONTROLS_MEETING_BREAKOUT_UPDATED,
293
398
  {
294
- breakout: 'new breakout'
399
+ breakout: newControls.breakout,
400
+ }
401
+ );
402
+ tmpStub.restore();
403
+ });
404
+
405
+ it('should update the interpretation state', () => {
406
+ locusInfo.emitScoped = sinon.stub();
407
+ newControls.interpretation = {siLanguages: [{languageCode: 20, languageName: 'en'}]};
408
+ let selfInfo = {};
409
+
410
+ locusInfo.updateControls(newControls, selfInfo);
411
+
412
+ assert.calledWith(
413
+ locusInfo.emitScoped,
414
+ {
415
+ file: 'locus-info',
416
+ function: 'updateControls',
417
+ },
418
+ LOCUSINFO.EVENTS.CONTROLS_MEETING_INTERPRETATION_UPDATED,
419
+ {
420
+ interpretation: newControls.interpretation,
295
421
  }
296
422
  );
297
423
  });
@@ -417,6 +543,39 @@ describe('plugin-meetings', () => {
417
543
  assert.notEqual(x.args[1], LOCUSINFO.EVENTS.CONTROLS_ENTRY_EXIT_TONE_UPDATED);
418
544
  });
419
545
  });
546
+
547
+ it('should update videoEnabled when changed', () => {
548
+ locusInfo.controls = {};
549
+
550
+ locusInfo.emitScoped = sinon.stub();
551
+ locusInfo.updateControls(newControls);
552
+
553
+ assert.calledWith(
554
+ locusInfo.emitScoped,
555
+ {
556
+ file: 'locus-info',
557
+ function: 'updateControls',
558
+ },
559
+ LOCUSINFO.EVENTS.SELF_REMOTE_VIDEO_MUTE_STATUS_UPDATED,
560
+ {unmuteAllowed: true}
561
+ );
562
+
563
+ assert.equal(mockMeeting.unmuteVideoAllowed, true);
564
+ });
565
+
566
+ it('should not update videoEnabled when unchanged', () => {
567
+ locusInfo.controls = {videoEnabled: true};
568
+
569
+ locusInfo.emitScoped = sinon.stub();
570
+ locusInfo.updateControls(newControls);
571
+
572
+ locusInfo.emitScoped.getCalls().forEach((x) => {
573
+ // check that no calls in emitScoped are for SELF_REMOTE_VIDEO_MUTE_STATUS_UPDATED
574
+ assert.notEqual(x.args[1], LOCUSINFO.EVENTS.SELF_REMOTE_VIDEO_MUTE_STATUS_UPDATED);
575
+ });
576
+
577
+ assert.equal(mockMeeting.unmuteVideoAllowed, undefined);
578
+ });
420
579
  });
421
580
 
422
581
  describe('#updateParticipants()', () => {
@@ -470,6 +629,7 @@ describe('plugin-meetings', () => {
470
629
  selfIdentity: '123',
471
630
  selfId: '2',
472
631
  hostId: '3',
632
+ isReplace: undefined,
473
633
  }
474
634
  );
475
635
  // note: in a real use case, recordingId, selfId, and hostId would all be the same
@@ -477,6 +637,43 @@ describe('plugin-meetings', () => {
477
637
  // are being correctly grabbed from locusInfo.parsedLocus within updateParticipants
478
638
  });
479
639
 
640
+ it('should call with breakout control info', () => {
641
+ locusInfo.parsedLocus = {
642
+ controls: {
643
+ record: {
644
+ modifiedBy: '1',
645
+ },
646
+ },
647
+ self: {
648
+ selfIdentity: '123',
649
+ selfId: '2',
650
+ },
651
+ host: {
652
+ hostId: '3',
653
+ },
654
+ };
655
+
656
+ locusInfo.emitScoped = sinon.stub();
657
+ locusInfo.updateParticipants({}, true);
658
+
659
+ assert.calledWith(
660
+ locusInfo.emitScoped,
661
+ {
662
+ file: 'locus-info',
663
+ function: 'updateParticipants',
664
+ },
665
+ EVENTS.LOCUS_INFO_UPDATE_PARTICIPANTS,
666
+ {
667
+ participants: {},
668
+ recordingId: '1',
669
+ selfIdentity: '123',
670
+ selfId: '2',
671
+ hostId: '3',
672
+ isReplace: true,
673
+ }
674
+ );
675
+ });
676
+
480
677
  it('should update the deltaParticipants object', () => {
481
678
  const prev = locusInfo.deltaParticipants;
482
679
 
@@ -683,6 +880,83 @@ describe('plugin-meetings', () => {
683
880
  );
684
881
  });
685
882
 
883
+ describe('SELF_REMOTE_VIDEO_MUTE_STATUS_UPDATED', () => {
884
+ it('should emit event when video muted on entry', () => {
885
+ // usually "previous self" is just undefined when we get first self from locus
886
+ locusInfo.self = undefined;
887
+ const selfWithMutedByOthers = cloneDeep(self);
888
+
889
+ // remoteVideoMuted
890
+ selfWithMutedByOthers.controls.video.muted = true;
891
+
892
+ locusInfo.webex.internal.device.url = self.deviceUrl;
893
+ locusInfo.emitScoped = sinon.stub();
894
+ locusInfo.updateSelf(selfWithMutedByOthers, []);
895
+
896
+ assert.calledWith(
897
+ locusInfo.emitScoped,
898
+ {
899
+ file: 'locus-info',
900
+ function: 'updateSelf',
901
+ },
902
+ LOCUSINFO.EVENTS.SELF_REMOTE_VIDEO_MUTE_STATUS_UPDATED,
903
+ {muted: true}
904
+ );
905
+
906
+ // but sometimes "previous self" is defined, but without controls.audio.muted, so we test this here:
907
+ locusInfo.self = cloneDeep(self);
908
+ locusInfo.self.controls.video = {};
909
+
910
+ locusInfo.updateSelf(selfWithMutedByOthers, []);
911
+ assert.calledWith(
912
+ locusInfo.emitScoped,
913
+ {
914
+ file: 'locus-info',
915
+ function: 'updateSelf',
916
+ },
917
+ LOCUSINFO.EVENTS.SELF_REMOTE_VIDEO_MUTE_STATUS_UPDATED,
918
+ {muted: true}
919
+ );
920
+ });
921
+
922
+ it('should not emit event when not muted on entry', () => {
923
+ locusInfo.self = undefined;
924
+ const selfWithMutedByOthersFalse = cloneDeep(self);
925
+
926
+ selfWithMutedByOthersFalse.controls.video.muted = false;
927
+
928
+ locusInfo.webex.internal.device.url = self.deviceUrl;
929
+ locusInfo.emitScoped = sinon.stub();
930
+ locusInfo.updateSelf(selfWithMutedByOthersFalse, []);
931
+
932
+ // we might get some calls to emitScoped, but we need to check that none of them are for SELF_REMOTE_VIDEO_MUTE_STATUS_UPDATED
933
+ locusInfo.emitScoped.getCalls().forEach((x) => {
934
+ assert.notEqual(x.args[1], LOCUSINFO.EVENTS.SELF_REMOTE_VIDEO_MUTE_STATUS_UPDATED);
935
+ });
936
+ });
937
+
938
+ it('should emit event when remoteVideoMuted changed', () => {
939
+ locusInfo.self = self;
940
+ const selfWithMutedByOthers = cloneDeep(self);
941
+
942
+ selfWithMutedByOthers.controls.video.muted = true;
943
+
944
+ locusInfo.webex.internal.device.url = self.deviceUrl;
945
+ locusInfo.emitScoped = sinon.stub();
946
+ locusInfo.updateSelf(selfWithMutedByOthers, []);
947
+
948
+ assert.calledWith(
949
+ locusInfo.emitScoped,
950
+ {
951
+ file: 'locus-info',
952
+ function: 'updateSelf',
953
+ },
954
+ LOCUSINFO.EVENTS.SELF_REMOTE_VIDEO_MUTE_STATUS_UPDATED,
955
+ {muted: true}
956
+ );
957
+ });
958
+ });
959
+
686
960
  it('should trigger SELF_MEETING_BREAKOUTS_CHANGED when breakouts changed', () => {
687
961
  locusInfo.self = self;
688
962
  const selfWithBreakoutsChanged = cloneDeep(self);
@@ -701,19 +975,23 @@ describe('plugin-meetings', () => {
701
975
  LOCUSINFO.EVENTS.SELF_MEETING_BREAKOUTS_CHANGED,
702
976
  {
703
977
  breakoutSessions: {
704
- active: [{
705
- name: 'new name',
706
- groupId: '0e73abb8-5584-49d8-be8d-806d2a8247ca',
707
- sessionId: '1cf41ab1-2e57-4d95-b7e9-5613acddfb0f',
708
- sessionType: 'BREAKOUT'
709
- }],
710
- allowed: [{
711
- name: 'Breakout session 2',
712
- groupId: '0e73abb8-5584-49d8-be8d-806d2a8247ca',
713
- sessionId: '1cf41ab1-2e57-4d95-b7e9-5613acddfb0f',
714
- sessionType: 'BREAKOUT'
715
- }]
716
- }
978
+ active: [
979
+ {
980
+ name: 'new name',
981
+ groupId: '0e73abb8-5584-49d8-be8d-806d2a8247ca',
982
+ sessionId: '1cf41ab1-2e57-4d95-b7e9-5613acddfb0f',
983
+ sessionType: 'BREAKOUT',
984
+ },
985
+ ],
986
+ allowed: [
987
+ {
988
+ name: 'Breakout session 2',
989
+ groupId: '0e73abb8-5584-49d8-be8d-806d2a8247ca',
990
+ sessionId: '1cf41ab1-2e57-4d95-b7e9-5613acddfb0f',
991
+ sessionType: 'BREAKOUT',
992
+ },
993
+ ],
994
+ },
717
995
  }
718
996
  );
719
997
  });
@@ -789,6 +1067,8 @@ describe('plugin-meetings', () => {
789
1067
  const selfWithRequestedToUnmute = cloneDeep(self);
790
1068
 
791
1069
  selfWithRequestedToUnmute.controls.audio.requestedToUnmute = true;
1070
+ selfWithRequestedToUnmute.controls.audio.lastModifiedRequestedToUnmute =
1071
+ '2023-06-16T19:25:04.369Z';
792
1072
 
793
1073
  locusInfo.webex.internal.device.url = self.deviceUrl;
794
1074
  locusInfo.emitScoped = sinon.stub();
@@ -943,6 +1223,88 @@ describe('plugin-meetings', () => {
943
1223
  {isSharingBlocked: true}
944
1224
  );
945
1225
  });
1226
+
1227
+ it('should trigger SELF_ROLES_CHANGED if self roles changed', () => {
1228
+ locusInfo.self = self;
1229
+ locusInfo.emitScoped = sinon.stub();
1230
+ const sampleNewSelf = cloneDeep(self);
1231
+ sampleNewSelf.controls.role.roles = [{type: 'COHOST', hasRole: true}];
1232
+
1233
+ locusInfo.updateSelf(sampleNewSelf, []);
1234
+
1235
+ assert.calledWith(
1236
+ locusInfo.emitScoped,
1237
+ {
1238
+ file: 'locus-info',
1239
+ function: 'updateSelf',
1240
+ },
1241
+ LOCUSINFO.EVENTS.SELF_ROLES_CHANGED,
1242
+ {oldRoles: ['PRESENTER'], newRoles: ['COHOST']}
1243
+ );
1244
+ });
1245
+
1246
+ it('should not trigger SELF_ROLES_CHANGED if self roles not changed', () => {
1247
+ locusInfo.self = self;
1248
+ locusInfo.emitScoped = sinon.stub();
1249
+ const sampleNewSelf = cloneDeep(self);
1250
+ sampleNewSelf.controls.role.roles = [{type: 'PRESENTER', hasRole: true}];
1251
+
1252
+ locusInfo.updateSelf(sampleNewSelf, []);
1253
+
1254
+ assert.neverCalledWith(
1255
+ locusInfo.emitScoped,
1256
+ {
1257
+ file: 'locus-info',
1258
+ function: 'updateSelf',
1259
+ },
1260
+ LOCUSINFO.EVENTS.SELF_ROLES_CHANGED,
1261
+ {oldRoles: ['PRESENTER'], newRoles: ['PRESENTER']}
1262
+ );
1263
+ });
1264
+
1265
+ it('should trigger SELF_MEETING_INTERPRETATION_CHANGED if self interpretation info changed', () => {
1266
+ locusInfo.self = self;
1267
+ locusInfo.emitScoped = sinon.stub();
1268
+ const sampleNewSelf = cloneDeep(self);
1269
+ sampleNewSelf.controls.interpretation.targetLanguage = 'it';
1270
+
1271
+ locusInfo.updateSelf(sampleNewSelf, []);
1272
+
1273
+ assert.calledWith(
1274
+ locusInfo.emitScoped,
1275
+ {
1276
+ file: 'locus-info',
1277
+ function: 'updateSelf',
1278
+ },
1279
+ LOCUSINFO.EVENTS.SELF_MEETING_INTERPRETATION_CHANGED,
1280
+ {
1281
+ interpretation: sampleNewSelf.controls.interpretation,
1282
+ selfParticipantId: self.id,
1283
+ }
1284
+ );
1285
+ });
1286
+
1287
+ it('should not trigger SELF_MEETING_INTERPRETATION_CHANGED if self interpretation info not changed', () => {
1288
+ locusInfo.self = self;
1289
+ locusInfo.emitScoped = sinon.stub();
1290
+ const sampleNewSelf = cloneDeep(self);
1291
+ sampleNewSelf.controls.interpretation.targetLanguage = 'cn'; // same with previous one
1292
+
1293
+ locusInfo.updateSelf(sampleNewSelf, []);
1294
+
1295
+ assert.neverCalledWith(
1296
+ locusInfo.emitScoped,
1297
+ {
1298
+ file: 'locus-info',
1299
+ function: 'updateSelf',
1300
+ },
1301
+ LOCUSINFO.EVENTS.SELF_MEETING_INTERPRETATION_CHANGED,
1302
+ {
1303
+ interpretation: sampleNewSelf.controls.interpretation,
1304
+ selfParticipantId: self.id,
1305
+ }
1306
+ );
1307
+ });
946
1308
  });
947
1309
 
948
1310
  describe('#updateMeetingInfo', () => {
@@ -1027,6 +1389,24 @@ describe('plugin-meetings', () => {
1027
1389
  locusInfo.emitScoped.resetHistory();
1028
1390
  };
1029
1391
 
1392
+ const checkMeetingInfoUpdatedCalledForRoles = (expected) => {
1393
+ const expectedArgs = [
1394
+ locusInfo.emitScoped,
1395
+ {
1396
+ file: 'locus-info',
1397
+ function: 'updateMeetingInfo',
1398
+ },
1399
+ LOCUSINFO.EVENTS.MEETING_INFO_UPDATED,
1400
+ ];
1401
+
1402
+ if (expected) {
1403
+ assert.calledWith(...expectedArgs);
1404
+ } else {
1405
+ assert.neverCalledWith(...expectedArgs);
1406
+ }
1407
+ locusInfo.emitScoped.resetHistory();
1408
+ };
1409
+
1030
1410
  it('emits MEETING_INFO_UPDATED if the info changes', () => {
1031
1411
  const initialInfo = cloneDeep(meetingInfo);
1032
1412
 
@@ -1052,6 +1432,16 @@ describe('plugin-meetings', () => {
1052
1432
 
1053
1433
  // since the info is the same it should not call trigger the event
1054
1434
  checkMeetingInfoUpdatedCalled(false);
1435
+
1436
+ // update it with the same info, but roles changed
1437
+ const updateSelf = cloneDeep(self);
1438
+ updateSelf?.controls?.role?.roles.push({
1439
+ type: 'COHOST',
1440
+ hasRole: true,
1441
+ });
1442
+ locusInfo.updateMeetingInfo(newInfo, updateSelf);
1443
+ // since the info is the same but roles changed, it should call trigger the event
1444
+ checkMeetingInfoUpdatedCalledForRoles(true);
1055
1445
  });
1056
1446
 
1057
1447
  it('gets roles from self if available', () => {
@@ -1157,6 +1547,8 @@ describe('plugin-meetings', () => {
1157
1547
  fakeLocus = {
1158
1548
  meeting: true,
1159
1549
  participants: true,
1550
+ url: 'newLocusUrl',
1551
+ syncUrl: 'newSyncUrl',
1160
1552
  };
1161
1553
  });
1162
1554
 
@@ -1205,8 +1597,8 @@ describe('plugin-meetings', () => {
1205
1597
  const newLocus = {
1206
1598
  self: {
1207
1599
  reason: 'MOVED',
1208
- state: 'LEFT'
1209
- }
1600
+ state: 'LEFT',
1601
+ },
1210
1602
  };
1211
1603
 
1212
1604
  locusInfo.updateControls = sinon.stub();
@@ -1258,12 +1650,39 @@ describe('plugin-meetings', () => {
1258
1650
  sandbox.stub(locusInfo, 'updateParticipants');
1259
1651
  sandbox.stub(locusInfo, 'isMeetingActive');
1260
1652
  sandbox.stub(locusInfo, 'handleOneOnOneEvent');
1653
+ sandbox.stub(locusParser, 'isNewFullLocus').returns(true);
1261
1654
 
1262
1655
  locusInfo.onFullLocus(fakeLocus, eventType);
1263
1656
 
1264
1657
  assert.equal(fakeLocus, locusParser.workingCopy);
1265
1658
  });
1266
1659
 
1660
+ it('onFullLocus() does not do anything if the incoming full locus DTO is old', () => {
1661
+ const eventType = 'fakeEvent';
1662
+
1663
+ locusParser.workingCopy = {};
1664
+
1665
+ const oldWorkingCopy = locusParser.workingCopy;
1666
+
1667
+ const spies = [
1668
+ sandbox.stub(locusInfo, 'updateParticipantDeltas'),
1669
+ sandbox.stub(locusInfo, 'updateLocusInfo'),
1670
+ sandbox.stub(locusInfo, 'updateParticipants'),
1671
+ sandbox.stub(locusInfo, 'isMeetingActive'),
1672
+ sandbox.stub(locusInfo, 'handleOneOnOneEvent'),
1673
+ ];
1674
+
1675
+ sandbox.stub(locusParser, 'isNewFullLocus').returns(false);
1676
+
1677
+ locusInfo.onFullLocus(fakeLocus, eventType);
1678
+
1679
+ spies.forEach((spy) => {
1680
+ assert.notCalled(spy);
1681
+ });
1682
+
1683
+ assert.equal(oldWorkingCopy, locusParser.workingCopy);
1684
+ });
1685
+
1267
1686
  it('onDeltaAction applies locus delta data to meeting', () => {
1268
1687
  const action = 'fake action';
1269
1688
  const parsedLoci = 'fake loci';
@@ -1290,34 +1709,83 @@ describe('plugin-meetings', () => {
1290
1709
  assert.calledWith(meeting.locusInfo.onDeltaLocus, fakeLocus);
1291
1710
  });
1292
1711
 
1293
- it('applyLocusDeltaData gets full locus on DESYNC action', () => {
1712
+ it('applyLocusDeltaData gets delta locus on DESYNC action if we have a syncUrl', () => {
1294
1713
  const {DESYNC} = LocusDeltaParser.loci;
1714
+ const fakeDeltaLocus = {id: 'fake delta locus'};
1295
1715
  const meeting = {
1296
1716
  meetingRequest: {
1297
- getFullLocus: sandbox.stub().resolves(true),
1717
+ getLocusDTO: sandbox.stub().resolves({body: fakeDeltaLocus}),
1298
1718
  },
1299
1719
  locusInfo: {
1300
- onFullLocus: sandbox.stub(),
1720
+ handleLocusDelta: sandbox.stub(),
1301
1721
  },
1722
+ locusUrl: 'oldLocusUrl',
1302
1723
  };
1303
1724
 
1304
- locusInfo.locusParser.resume = sandbox.stub();
1305
- locusInfo.applyLocusDeltaData(DESYNC, fakeLocus, meeting);
1306
-
1307
- assert.calledOnce(meeting.meetingRequest.getFullLocus);
1308
- });
1309
-
1310
- it('getFullLocus handles DESYNC action correctly', () => {
1311
- const {DESYNC} = LocusDeltaParser.loci;
1312
- const meeting = {
1313
- meetingRequest: {
1314
- getFullLocus: sandbox.stub().resolves({body: true}),
1315
- },
1316
- locusInfo,
1725
+ locusInfo.locusParser.workingCopy = {
1726
+ syncUrl: 'oldSyncUrl',
1317
1727
  };
1318
1728
 
1319
- locusInfo.onFullLocus = sandbox.stub();
1320
-
1729
+ // Since we have a promise inside a function we want to test that's not returned,
1730
+ // we will wait and stub it's last function to resolve this waiting promise.
1731
+ // Also ensures .handleLocusDelta() is called before .resume()
1732
+ return new Promise((resolve) => {
1733
+ locusInfo.locusParser.resume = sandbox.stub().callsFake(() => resolve());
1734
+ locusInfo.applyLocusDeltaData(DESYNC, fakeLocus, meeting);
1735
+ }).then(() => {
1736
+ assert.calledOnceWithExactly(meeting.meetingRequest.getLocusDTO, {url: 'oldSyncUrl'});
1737
+
1738
+ assert.calledOnceWithExactly(meeting.locusInfo.handleLocusDelta, fakeDeltaLocus, meeting);
1739
+ assert.calledOnce(locusInfo.locusParser.resume);
1740
+ });
1741
+ });
1742
+
1743
+ it('applyLocusDeltaData gets delta locus on DESYNC action if we have a syncUrl (empty response body)', () => {
1744
+ const {DESYNC} = LocusDeltaParser.loci;
1745
+ const meeting = {
1746
+ meetingRequest: {
1747
+ getLocusDTO: sandbox.stub().resolves({body: {}}),
1748
+ },
1749
+ locusInfo: {
1750
+ handleLocusDelta: sandbox.stub(),
1751
+ onFullLocus: sandbox.stub(),
1752
+ },
1753
+ locusUrl: 'oldLocusUrl',
1754
+ };
1755
+
1756
+ locusInfo.locusParser.workingCopy = {
1757
+ syncUrl: 'oldSyncUrl',
1758
+ };
1759
+
1760
+ // Since we have a promise inside a function we want to test that's not returned,
1761
+ // we will wait and stub it's last function to resolve this waiting promise.
1762
+ return new Promise((resolve) => {
1763
+ locusInfo.locusParser.resume = sandbox.stub().callsFake(() => resolve());
1764
+ locusInfo.applyLocusDeltaData(DESYNC, fakeLocus, meeting);
1765
+ }).then(() => {
1766
+ assert.calledOnceWithExactly(meeting.meetingRequest.getLocusDTO, {url: 'oldSyncUrl'});
1767
+
1768
+ assert.notCalled(meeting.locusInfo.handleLocusDelta);
1769
+ assert.notCalled(meeting.locusInfo.onFullLocus);
1770
+ assert.calledOnce(locusInfo.locusParser.resume);
1771
+ });
1772
+ });
1773
+
1774
+ it('applyLocusDeltaData gets full locus on DESYNC action if we do not have a syncUrl', () => {
1775
+ const {DESYNC} = LocusDeltaParser.loci;
1776
+ const fakeFullLocusDto = {id: 'fake full locus dto'};
1777
+ const meeting = {
1778
+ meetingRequest: {
1779
+ getLocusDTO: sandbox.stub().resolves({body: fakeFullLocusDto}),
1780
+ },
1781
+ locusInfo: {
1782
+ onFullLocus: sandbox.stub(),
1783
+ },
1784
+ locusUrl: 'oldLocusUrl',
1785
+ };
1786
+
1787
+ locusInfo.locusParser.workingCopy = {}; // no syncUrl
1788
+
1321
1789
  // Since we have a promise inside a function we want to test that's not returned,
1322
1790
  // we will wait and stub it's last function to resolve this waiting promise.
1323
1791
  // Also ensures .onFullLocus() is called before .resume()
@@ -1325,10 +1793,201 @@ describe('plugin-meetings', () => {
1325
1793
  locusInfo.locusParser.resume = sandbox.stub().callsFake(() => resolve());
1326
1794
  locusInfo.applyLocusDeltaData(DESYNC, fakeLocus, meeting);
1327
1795
  }).then(() => {
1328
- assert.calledOnce(meeting.locusInfo.onFullLocus);
1796
+ assert.calledOnceWithExactly(meeting.meetingRequest.getLocusDTO, {url: 'oldLocusUrl'});
1797
+
1798
+ assert.calledOnceWithExactly(meeting.locusInfo.onFullLocus, fakeFullLocusDto);
1329
1799
  assert.calledOnce(locusInfo.locusParser.resume);
1330
1800
  });
1331
1801
  });
1802
+
1803
+ it('onDeltaLocus handle delta data', () => {
1804
+ fakeLocus.participants = {};
1805
+ const fakeBreakout = {
1806
+ sessionId: 'sessionId',
1807
+ groupId: 'groupId',
1808
+ };
1809
+
1810
+ fakeLocus.controls = {
1811
+ breakout: fakeBreakout,
1812
+ };
1813
+ locusInfo.controls = {
1814
+ breakout: {
1815
+ sessionId: 'sessionId',
1816
+ groupId: 'groupId',
1817
+ },
1818
+ };
1819
+ locusInfo.updateParticipants = sinon.stub();
1820
+ locusInfo.onDeltaLocus(fakeLocus);
1821
+ assert.calledWith(locusInfo.updateParticipants, {}, false);
1822
+
1823
+ fakeLocus.controls.breakout.sessionId = 'sessionId2';
1824
+ locusInfo.onDeltaLocus(fakeLocus);
1825
+ assert.calledWith(locusInfo.updateParticipants, {}, true);
1826
+ });
1827
+ });
1828
+
1829
+ describe('#updateLocusCache', () => {
1830
+ it('cache it if income locus is main session locus', () => {
1831
+ const locus = {url: 'url'};
1832
+ locusInfo.mainSessionLocusCache = null;
1833
+ locusInfo.updateLocusCache(locus);
1834
+
1835
+ assert.deepEqual(locusInfo.mainSessionLocusCache, locus);
1836
+ });
1837
+
1838
+ it('not cache it if income locus is breakout session locus', () => {
1839
+ const locus = {url: 'url', controls: {breakout: {sessionType: 'BREAKOUT'}}};
1840
+ locusInfo.mainSessionLocusCache = null;
1841
+ locusInfo.updateLocusCache(locus);
1842
+
1843
+ assert.isNull(locusInfo.mainSessionLocusCache);
1844
+ });
1845
+ });
1846
+
1847
+ describe('#getTheLocusToUpdate', () => {
1848
+ it('return the cache locus if return to main session', () => {
1849
+ locusInfo.mainSessionLocusCache = {url: 'url'};
1850
+ locusInfo.controls = {
1851
+ breakout: {
1852
+ sessionType: 'BREAKOUT',
1853
+ },
1854
+ };
1855
+ const newLocus = {
1856
+ controls: {
1857
+ breakout: {
1858
+ sessionType: 'MAIN',
1859
+ },
1860
+ },
1861
+ };
1862
+
1863
+ assert.deepEqual(locusInfo.getTheLocusToUpdate(newLocus), {url: 'url'});
1864
+ });
1865
+
1866
+ it('return the new locus if return to main session but no cache', () => {
1867
+ locusInfo.mainSessionLocusCache = null;
1868
+ locusInfo.controls = {
1869
+ breakout: {
1870
+ sessionType: 'BREAKOUT',
1871
+ },
1872
+ };
1873
+ const newLocus = {
1874
+ controls: {
1875
+ breakout: {
1876
+ sessionType: 'MAIN',
1877
+ },
1878
+ },
1879
+ };
1880
+
1881
+ assert.deepEqual(locusInfo.getTheLocusToUpdate(newLocus), newLocus);
1882
+ });
1883
+
1884
+ it('return the new locus if not return to main session', () => {
1885
+ locusInfo.mainSessionLocusCache = {url: 'url'};
1886
+ locusInfo.controls = {
1887
+ breakout: {
1888
+ sessionType: 'MAIN',
1889
+ },
1890
+ };
1891
+ const newLocus = {
1892
+ controls: {
1893
+ breakout: {
1894
+ sessionType: 'BREAKOUT',
1895
+ },
1896
+ },
1897
+ };
1898
+
1899
+ assert.deepEqual(locusInfo.getTheLocusToUpdate(newLocus), newLocus);
1900
+ });
1901
+ });
1902
+
1903
+ describe('#mergeParticipants', () => {
1904
+ let participants;
1905
+ let sourceParticipants;
1906
+ beforeEach(() => {
1907
+ participants = [{id: '111', status: 'JOINED'}, {id: '222'}];
1908
+ sourceParticipants = [{id: '111', status: 'LEFT'}, {id: '333'}];
1909
+ });
1910
+
1911
+ it('merge the participants, replace it by id if exist in old array', () => {
1912
+ const result = locusInfo.mergeParticipants(participants, sourceParticipants);
1913
+ assert.deepEqual(result, [{id: '111', status: 'LEFT'}, {id: '222'}, {id: '333'}]);
1914
+ });
1915
+
1916
+ it('return new participants if previous participants is empty', () => {
1917
+ const result = locusInfo.mergeParticipants([], sourceParticipants);
1918
+ assert.deepEqual(result, sourceParticipants);
1919
+ });
1920
+
1921
+ it('return new participants if previous participants is null/undefined', () => {
1922
+ let result = locusInfo.mergeParticipants(null, sourceParticipants);
1923
+ assert.deepEqual(result, sourceParticipants);
1924
+
1925
+ result = locusInfo.mergeParticipants(undefined, sourceParticipants);
1926
+ assert.deepEqual(result, sourceParticipants);
1927
+ });
1928
+
1929
+ it('return previous participants if new participants is empty', () => {
1930
+ const result = locusInfo.mergeParticipants(participants, []);
1931
+ assert.deepEqual(result, participants);
1932
+ });
1933
+
1934
+ it('return previous participants if new participants is null/undefined', () => {
1935
+ let result = locusInfo.mergeParticipants(participants, null);
1936
+ assert.deepEqual(result, participants);
1937
+
1938
+ result = locusInfo.mergeParticipants(participants, undefined);
1939
+ assert.deepEqual(result, participants);
1940
+ });
1941
+ });
1942
+
1943
+ describe('#updateMainSessionLocusCache', () => {
1944
+ let cachedLocus;
1945
+ let newLocus;
1946
+ beforeEach(() => {
1947
+ cachedLocus = {
1948
+ controls: {},
1949
+ participants: [],
1950
+ info: {webExMeetingId: 'testId1', topic: 'test'},
1951
+ };
1952
+ newLocus = {
1953
+ self: {},
1954
+ participants: [{id: '111'}],
1955
+ info: {testId: 'testId2', webExMeetingName: 'hello'},
1956
+ };
1957
+ });
1958
+ it('shallow merge new locus into cache', () => {
1959
+ locusInfo.mainSessionLocusCache = cachedLocus;
1960
+ locusInfo.updateMainSessionLocusCache(newLocus);
1961
+
1962
+ assert.deepEqual(locusInfo.mainSessionLocusCache, {
1963
+ controls: {},
1964
+ participants: [{id: '111'}],
1965
+ info: {testId: 'testId2', webExMeetingName: 'hello'},
1966
+ self: {},
1967
+ });
1968
+ });
1969
+
1970
+ it('cache new locus if no cache before', () => {
1971
+ locusInfo.mainSessionLocusCache = null;
1972
+ locusInfo.updateMainSessionLocusCache(newLocus);
1973
+
1974
+ assert.deepEqual(locusInfo.mainSessionLocusCache, newLocus);
1975
+ });
1976
+
1977
+ it('do nothing if new locus is null', () => {
1978
+ locusInfo.mainSessionLocusCache = cachedLocus;
1979
+ locusInfo.updateMainSessionLocusCache(null);
1980
+
1981
+ assert.deepEqual(locusInfo.mainSessionLocusCache, cachedLocus);
1982
+ });
1983
+ });
1984
+
1985
+ describe('#clearMainSessionLocusCache', () => {
1986
+ it('clear main session locus cache', () => {
1987
+ locusInfo.mainSessionLocusCache = {controls: {}};
1988
+ locusInfo.clearMainSessionLocusCache();
1989
+ assert.isNull(locusInfo.mainSessionLocusCache);
1990
+ });
1332
1991
  });
1333
1992
 
1334
1993
  describe('#handleOneonOneEvent', () => {
@@ -1371,5 +2030,402 @@ describe('plugin-meetings', () => {
1371
2030
  );
1372
2031
  });
1373
2032
  });
2033
+
2034
+ describe('#isMeetingActive', () => {
2035
+ it('sends client event correctly for state = inactive', () => {
2036
+ locusInfo.parsedLocus = {
2037
+ fullState: {
2038
+ type: _CALL_,
2039
+ },
2040
+ };
2041
+
2042
+ locusInfo.fullState = {
2043
+ state: LOCUS.STATE.INACTIVE,
2044
+ };
2045
+
2046
+ locusInfo.isMeetingActive();
2047
+
2048
+ assert.calledWith(webex.internal.newMetrics.submitClientEvent, {
2049
+ name: 'client.call.remote-ended',
2050
+ options: {
2051
+ meetingId: locusInfo.meetingId,
2052
+ },
2053
+ });
2054
+ });
2055
+
2056
+ it('sends client event correctly for state = PARTNER_LEFT', () => {
2057
+ locusInfo.getLocusPartner = sinon.stub().returns({state: MEETING_STATE.STATES.LEFT});
2058
+ locusInfo.parsedLocus = {
2059
+ fullState: {
2060
+ type: _CALL_,
2061
+ },
2062
+ self: {
2063
+ state: MEETING_STATE.STATES.DECLINED,
2064
+ },
2065
+ };
2066
+ locusInfo.isMeetingActive();
2067
+
2068
+ assert.calledWith(webex.internal.newMetrics.submitClientEvent, {
2069
+ name: 'client.call.remote-ended',
2070
+ options: {
2071
+ meetingId: locusInfo.meetingId,
2072
+ },
2073
+ });
2074
+ });
2075
+
2076
+ it('sends client event correctly for state = SELF_LEFT', () => {
2077
+ locusInfo.getLocusPartner = sinon.stub().returns({state: MEETING_STATE.STATES.LEFT});
2078
+ locusInfo.parsedLocus = {
2079
+ fullState: {
2080
+ type: _CALL_,
2081
+ },
2082
+ self: {
2083
+ state: MEETING_STATE.STATES.LEFT,
2084
+ },
2085
+ };
2086
+
2087
+ locusInfo.isMeetingActive();
2088
+
2089
+ assert.calledWith(webex.internal.newMetrics.submitClientEvent, {
2090
+ name: 'client.call.remote-ended',
2091
+ options: {
2092
+ meetingId: locusInfo.meetingId,
2093
+ },
2094
+ });
2095
+ });
2096
+
2097
+ it('sends client event correctly for state = MEETING_INACTIVE_TERMINATING', () => {
2098
+ locusInfo.getLocusPartner = sinon.stub().returns({state: MEETING_STATE.STATES.LEFT});
2099
+ locusInfo.parsedLocus = {
2100
+ fullState: {
2101
+ type: _MEETING_,
2102
+ },
2103
+ };
2104
+
2105
+ locusInfo.fullState = {
2106
+ state: LOCUS.STATE.INACTIVE,
2107
+ };
2108
+
2109
+ locusInfo.isMeetingActive();
2110
+
2111
+ assert.calledWith(webex.internal.newMetrics.submitClientEvent, {
2112
+ name: 'client.call.remote-ended',
2113
+ options: {
2114
+ meetingId: locusInfo.meetingId,
2115
+ },
2116
+ });
2117
+ });
2118
+
2119
+ it('sends client event correctly for state = FULLSTATE_REMOVED', () => {
2120
+ locusInfo.getLocusPartner = sinon.stub().returns({state: MEETING_STATE.STATES.LEFT});
2121
+ locusInfo.parsedLocus = {
2122
+ fullState: {
2123
+ type: _MEETING_,
2124
+ },
2125
+ };
2126
+
2127
+ locusInfo.fullState = {
2128
+ removed: true,
2129
+ };
2130
+
2131
+ locusInfo.isMeetingActive();
2132
+
2133
+ assert.calledWith(webex.internal.newMetrics.submitClientEvent, {
2134
+ name: 'client.call.remote-ended',
2135
+ options: {
2136
+ meetingId: locusInfo.meetingId,
2137
+ },
2138
+ });
2139
+ });
2140
+ });
2141
+
2142
+ // semi-integration tests that use real LocusInfo with real Parser
2143
+ // and test various scenarios related to handling out-of-order Locus delta events
2144
+ describe('handling of out-of-order Locus delta events', () => {
2145
+ let clock;
2146
+
2147
+ const generateDeltaEvent = (base, sequence) => {
2148
+ return {
2149
+ baseSequence: {
2150
+ rangeStart: 0,
2151
+ rangeEnd: 0,
2152
+ entries: [base],
2153
+ },
2154
+ sequence: {
2155
+ rangeStart: 0,
2156
+ rangeEnd: 0,
2157
+ entries: [sequence],
2158
+ },
2159
+ syncUrl: `fake sync url for sequence ${sequence}`,
2160
+ self: {
2161
+ person: {
2162
+ id: 'test person id',
2163
+ },
2164
+ },
2165
+ };
2166
+ };
2167
+
2168
+ // a list of example delta events, sorted by time and each event is based on the previous one
2169
+ const deltaEvents = [
2170
+ generateDeltaEvent(10, 20), // 0
2171
+ generateDeltaEvent(20, 30), // 1
2172
+ generateDeltaEvent(30, 40), // 2
2173
+ generateDeltaEvent(40, 50), // 3
2174
+ generateDeltaEvent(50, 60), // 4
2175
+ generateDeltaEvent(60, 70), // 5
2176
+ generateDeltaEvent(70, 80), // 6
2177
+ generateDeltaEvent(80, 90), // 7
2178
+ generateDeltaEvent(90, 100), // 8
2179
+ ];
2180
+
2181
+ let updateLocusInfoStub; // we use this stub to verify that an event has been fully processed
2182
+ let syncRequestStub;
2183
+
2184
+ beforeEach(() => {
2185
+ clock = sinon.useFakeTimers();
2186
+
2187
+ sinon.stub(locusInfo, 'updateParticipantDeltas');
2188
+ sinon.stub(locusInfo, 'updateParticipants');
2189
+ sinon.stub(locusInfo, 'isMeetingActive'),
2190
+ sinon.stub(locusInfo, 'handleOneOnOneEvent'),
2191
+ (updateLocusInfoStub = sinon.stub(locusInfo, 'updateLocusInfo'));
2192
+ syncRequestStub = sinon.stub().resolves({body: {}});
2193
+
2194
+ mockMeeting.locusInfo = locusInfo;
2195
+ mockMeeting.locusUrl = 'fake locus url';
2196
+ mockMeeting.meetingRequest = {
2197
+ getLocusDTO: syncRequestStub,
2198
+ };
2199
+
2200
+ locusInfo.onFullLocus({
2201
+ sequence: {
2202
+ rangeStart: 0,
2203
+ rangeEnd: 0,
2204
+ entries: [10],
2205
+ },
2206
+ self: {
2207
+ person: {
2208
+ id: 'test person id',
2209
+ },
2210
+ },
2211
+ });
2212
+
2213
+ updateLocusInfoStub.resetHistory();
2214
+ });
2215
+
2216
+ afterEach(() => {
2217
+ clock.restore();
2218
+ });
2219
+
2220
+ it('queues out-of-order deltas until it receives a correct delta', () => {
2221
+ // send some out-of-order deltas
2222
+ locusInfo.handleLocusDelta(deltaEvents[1], mockMeeting);
2223
+ locusInfo.handleLocusDelta(deltaEvents[4], mockMeeting);
2224
+
2225
+ // they should be queued and not processed
2226
+ assert.notCalled(updateLocusInfoStub);
2227
+
2228
+ // now one of the missing ones, but not the one SDK is really waiting for
2229
+ locusInfo.handleLocusDelta(deltaEvents[2], mockMeeting);
2230
+
2231
+ // still nothing should be processed
2232
+ assert.notCalled(updateLocusInfoStub);
2233
+
2234
+ // now send the one SDK is waiting for
2235
+ locusInfo.handleLocusDelta(deltaEvents[0], mockMeeting);
2236
+
2237
+ // so deltaEvents with indexes 1,2,3 can be processed, but 5 still not, because 4 is missing
2238
+ assert.callCount(updateLocusInfoStub, 3);
2239
+ assert.calledWith(updateLocusInfoStub.getCall(0), deltaEvents[0]);
2240
+ assert.calledWith(updateLocusInfoStub.getCall(1), deltaEvents[1]);
2241
+ assert.calledWith(updateLocusInfoStub.getCall(2), deltaEvents[2]);
2242
+
2243
+ updateLocusInfoStub.resetHistory();
2244
+
2245
+ // now send deltaEvents[4]
2246
+ locusInfo.handleLocusDelta(deltaEvents[3], mockMeeting);
2247
+
2248
+ // and verify deltaEvents[4] and deltaEvents[5] have been processed
2249
+ assert.callCount(updateLocusInfoStub, 2);
2250
+ assert.calledWith(updateLocusInfoStub.getCall(0), deltaEvents[3]);
2251
+ assert.calledWith(updateLocusInfoStub.getCall(1), deltaEvents[4]);
2252
+ });
2253
+
2254
+ it('handles out-of-order deltas correctly even if all arrive in reverse order', () => {
2255
+ // send a bunch deltas in reverse order
2256
+ for (let i = 4; i >= 0; i--) {
2257
+ locusInfo.handleLocusDelta(deltaEvents[i], mockMeeting);
2258
+ }
2259
+
2260
+ // they should be queued and then processed in correct order
2261
+ assert.callCount(updateLocusInfoStub, 5);
2262
+ assert.calledWith(updateLocusInfoStub.getCall(0), deltaEvents[0]);
2263
+ assert.calledWith(updateLocusInfoStub.getCall(1), deltaEvents[1]);
2264
+ assert.calledWith(updateLocusInfoStub.getCall(2), deltaEvents[2]);
2265
+ assert.calledWith(updateLocusInfoStub.getCall(3), deltaEvents[3]);
2266
+ assert.calledWith(updateLocusInfoStub.getCall(4), deltaEvents[4]);
2267
+ });
2268
+
2269
+ it('sends a sync request using syncUrl if it receives at least 1 delta event and processes later deltas after sync correctly', async () => {
2270
+ // the test first sends an initial "good" delta
2271
+ const initialDeltaIdx = 0;
2272
+ const initialDelta = deltaEvents[initialDeltaIdx];
2273
+
2274
+ // then it sends a bunch of out-of-order deltas (at least 6 to trigger a sync), last one being lastOooDelta
2275
+ const firstOooDeltaIdx = 2;
2276
+ const lastOooDeltaIdx = 7;
2277
+ const lastOooDelta = deltaEvents[lastOooDeltaIdx];
2278
+
2279
+ // and finally, after the sync it sends another "good" delta
2280
+ const goodDeltaAfterSync = deltaEvents[8];
2281
+
2282
+ const deltaLocusFromSyncResponse = {
2283
+ baseSequence: {
2284
+ rangeStart: 0,
2285
+ rangeEnd: 0,
2286
+ entries: [initialDelta.sequence.entries[0]],
2287
+ },
2288
+ sequence: {
2289
+ rangeStart: 0,
2290
+ rangeEnd: 0,
2291
+ entries: [lastOooDelta.sequence.entries[0]],
2292
+ },
2293
+ syncUrl: `fake sync url for sequence ${lastOooDelta.sequence.entries[0]}`,
2294
+ self: {
2295
+ person: {
2296
+ id: 'test person id',
2297
+ },
2298
+ },
2299
+ };
2300
+
2301
+ syncRequestStub.resolves({
2302
+ body: deltaLocusFromSyncResponse,
2303
+ });
2304
+
2305
+ // send one correct delta so that SDK has the syncUrl
2306
+ locusInfo.handleLocusDelta(initialDelta, mockMeeting);
2307
+
2308
+ updateLocusInfoStub.resetHistory();
2309
+
2310
+ // send 6 out-of-order deltas to trigger a sync (we're skipping deltaEvents[1])
2311
+ for (let i = firstOooDeltaIdx; i <= lastOooDeltaIdx; i++) {
2312
+ locusInfo.handleLocusDelta(deltaEvents[i], mockMeeting);
2313
+ }
2314
+
2315
+ await testUtils.flushPromises();
2316
+
2317
+ // check that sync was done using the correct syncUrl
2318
+ assert.calledOnceWithExactly(syncRequestStub, {url: initialDelta.syncUrl});
2319
+ assert.calledOnceWithExactly(updateLocusInfoStub, deltaLocusFromSyncResponse);
2320
+
2321
+ updateLocusInfoStub.resetHistory();
2322
+
2323
+ // now send another delta - a good one, it should be processed as normal
2324
+ locusInfo.handleLocusDelta(goodDeltaAfterSync, mockMeeting);
2325
+
2326
+ assert.calledOnceWithExactly(updateLocusInfoStub, goodDeltaAfterSync);
2327
+ });
2328
+
2329
+ it('does a sync if blocked on out-of-order deltas for too long', async () => {
2330
+ // stub random so that the timer fires after 12500 ms
2331
+ sinon.stub(Math, 'random').returns(0.5);
2332
+
2333
+ const oooDelta = deltaEvents[3];
2334
+
2335
+ // setup the stubs so that the sync request receives a full DTO with the sequence equal to the out-of-order delta we simulate
2336
+ const fullLocus = {
2337
+ sequence: oooDelta.sequence,
2338
+ };
2339
+ syncRequestStub.resolves({
2340
+ body: fullLocus,
2341
+ });
2342
+
2343
+ // send an out-of-order delta
2344
+ locusInfo.handleLocusDelta(oooDelta, mockMeeting);
2345
+
2346
+ await clock.tickAsync(12499);
2347
+ await testUtils.flushPromises();
2348
+ assert.notCalled(syncRequestStub);
2349
+ assert.notCalled(updateLocusInfoStub);
2350
+
2351
+ await clock.tickAsync(1);
2352
+ await testUtils.flushPromises();
2353
+
2354
+ assert.calledOnceWithExactly(syncRequestStub, {url: mockMeeting.locusUrl});
2355
+ assert.calledOnceWithExactly(updateLocusInfoStub, fullLocus);
2356
+ });
2357
+
2358
+ it('does a sync if out-of-order deltas queue becomes too big', async () => {
2359
+ // setup the stubs so that the sync request receives a full DTO with the sequence equal to the out-of-order delta we simulate
2360
+ const fullLocus = {
2361
+ sequence: deltaEvents[6].sequence,
2362
+ };
2363
+ syncRequestStub.resolves({
2364
+ body: fullLocus,
2365
+ });
2366
+
2367
+ // send 5 deltas, starting from deltaEvents[1] so that SDK is blocked waiting for deltaEvents[0]
2368
+ for (let i = 0; i < 5; i++) {
2369
+ locusInfo.handleLocusDelta(deltaEvents[i + 1], mockMeeting);
2370
+ }
2371
+
2372
+ // nothing should happen, SDK should still be waiting for deltaEvents[0]
2373
+ assert.notCalled(syncRequestStub);
2374
+ assert.notCalled(updateLocusInfoStub);
2375
+
2376
+ // now send one more out-of-order delta to trigger a sync request
2377
+ locusInfo.handleLocusDelta(deltaEvents[6], mockMeeting);
2378
+
2379
+ await testUtils.flushPromises();
2380
+
2381
+ // check sync was done
2382
+ assert.calledOnceWithExactly(syncRequestStub, {url: mockMeeting.locusUrl});
2383
+ assert.calledOnceWithExactly(updateLocusInfoStub, fullLocus);
2384
+ });
2385
+
2386
+ it('processes delta events that are not included in sync response', async () => {
2387
+ // this test sends a bunch of out-of-order deltas, this triggers a sync
2388
+ // but the full locus response doesn't include the last 2 deltas received, so
2389
+ // we check that these 2 deltas are also processed after sync response
2390
+ const fullLocusFromSyncResponse = {
2391
+ baseSequence: {
2392
+ rangeStart: 0,
2393
+ rangeEnd: 0,
2394
+ entries: [deltaEvents[0].sequence.entries[0]],
2395
+ },
2396
+ sequence: {
2397
+ rangeStart: 0,
2398
+ rangeEnd: 0,
2399
+ entries: [deltaEvents[5].sequence.entries[0]],
2400
+ },
2401
+ syncUrl: `fake sync url for sequence ${deltaEvents[5].sequence.entries[0]}`,
2402
+ self: {
2403
+ person: {
2404
+ id: 'test person id',
2405
+ },
2406
+ },
2407
+ };
2408
+
2409
+ syncRequestStub.resolves({
2410
+ body: fullLocusFromSyncResponse,
2411
+ });
2412
+
2413
+ // send at least 6 out-of-order deltas to trigger a sync (we're skipping deltaEvents[0])
2414
+ for (let i = 1; i <= 7; i++) {
2415
+ locusInfo.handleLocusDelta(deltaEvents[i], mockMeeting);
2416
+ }
2417
+
2418
+ await testUtils.flushPromises();
2419
+
2420
+ // check that sync was done
2421
+ assert.calledOnceWithExactly(syncRequestStub, {url: mockMeeting.locusUrl});
2422
+
2423
+ // and that remaining deltas from the queue that were not included in full Locus were also processed
2424
+ assert.callCount(updateLocusInfoStub, 3);
2425
+ assert.calledWith(updateLocusInfoStub.getCall(0), fullLocusFromSyncResponse);
2426
+ assert.calledWith(updateLocusInfoStub.getCall(1), deltaEvents[6]);
2427
+ assert.calledWith(updateLocusInfoStub.getCall(2), deltaEvents[7]);
2428
+ });
2429
+ });
1374
2430
  });
1375
2431
  });