@webex/plugin-meetings 3.0.0-beta.15 → 3.0.0-beta.151

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 (480) hide show
  1. package/README.md +45 -1
  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 +359 -0
  7. package/dist/annotation/index.js.map +1 -0
  8. package/dist/breakouts/breakout.js +193 -0
  9. package/dist/breakouts/breakout.js.map +1 -0
  10. package/dist/breakouts/collection.js +23 -0
  11. package/dist/breakouts/collection.js.map +1 -0
  12. package/dist/breakouts/edit-lock-error.js +52 -0
  13. package/dist/breakouts/edit-lock-error.js.map +1 -0
  14. package/dist/breakouts/events.js +43 -0
  15. package/dist/breakouts/events.js.map +1 -0
  16. package/dist/breakouts/index.js +1046 -0
  17. package/dist/breakouts/index.js.map +1 -0
  18. package/dist/breakouts/request.js +78 -0
  19. package/dist/breakouts/request.js.map +1 -0
  20. package/dist/breakouts/utils.js +67 -0
  21. package/dist/breakouts/utils.js.map +1 -0
  22. package/dist/common/browser-detection.js +1 -21
  23. package/dist/common/browser-detection.js.map +1 -1
  24. package/dist/common/collection.js +5 -20
  25. package/dist/common/collection.js.map +1 -1
  26. package/dist/common/config.js +0 -7
  27. package/dist/common/config.js.map +1 -1
  28. package/dist/common/errors/captcha-error.js +0 -21
  29. package/dist/common/errors/captcha-error.js.map +1 -1
  30. package/dist/common/errors/intent-to-join.js +0 -21
  31. package/dist/common/errors/intent-to-join.js.map +1 -1
  32. package/dist/common/errors/join-meeting.js +0 -21
  33. package/dist/common/errors/join-meeting.js.map +1 -1
  34. package/dist/common/errors/media.js +0 -21
  35. package/dist/common/errors/media.js.map +1 -1
  36. package/dist/common/errors/parameter.js +0 -28
  37. package/dist/common/errors/parameter.js.map +1 -1
  38. package/dist/common/errors/password-error.js +0 -21
  39. package/dist/common/errors/password-error.js.map +1 -1
  40. package/dist/common/errors/permission.js +0 -21
  41. package/dist/common/errors/permission.js.map +1 -1
  42. package/dist/common/errors/reconnection-in-progress.js +0 -17
  43. package/dist/common/errors/reconnection-in-progress.js.map +1 -1
  44. package/dist/common/errors/reconnection.js +0 -21
  45. package/dist/common/errors/reconnection.js.map +1 -1
  46. package/dist/common/errors/stats.js +0 -21
  47. package/dist/common/errors/stats.js.map +1 -1
  48. package/dist/common/errors/webex-errors.js +9 -43
  49. package/dist/common/errors/webex-errors.js.map +1 -1
  50. package/dist/common/errors/webex-meetings-error.js +1 -24
  51. package/dist/common/errors/webex-meetings-error.js.map +1 -1
  52. package/dist/common/events/events-scope.js +0 -22
  53. package/dist/common/events/events-scope.js.map +1 -1
  54. package/dist/common/events/events.js +0 -23
  55. package/dist/common/events/events.js.map +1 -1
  56. package/dist/common/events/trigger-proxy.js +0 -12
  57. package/dist/common/events/trigger-proxy.js.map +1 -1
  58. package/dist/common/events/util.js +0 -15
  59. package/dist/common/events/util.js.map +1 -1
  60. package/dist/common/logs/logger-config.js +0 -4
  61. package/dist/common/logs/logger-config.js.map +1 -1
  62. package/dist/common/logs/logger-proxy.js +1 -8
  63. package/dist/common/logs/logger-proxy.js.map +1 -1
  64. package/dist/common/logs/request.js +35 -61
  65. package/dist/common/logs/request.js.map +1 -1
  66. package/dist/common/queue.js +4 -14
  67. package/dist/common/queue.js.map +1 -1
  68. package/dist/config.js +7 -13
  69. package/dist/config.js.map +1 -1
  70. package/dist/constants.js +208 -64
  71. package/dist/constants.js.map +1 -1
  72. package/dist/controls-options-manager/constants.js +14 -0
  73. package/dist/controls-options-manager/constants.js.map +1 -0
  74. package/dist/controls-options-manager/enums.js +27 -0
  75. package/dist/controls-options-manager/enums.js.map +1 -0
  76. package/dist/controls-options-manager/index.js +297 -0
  77. package/dist/controls-options-manager/index.js.map +1 -0
  78. package/dist/controls-options-manager/types.js +7 -0
  79. package/dist/controls-options-manager/types.js.map +1 -0
  80. package/dist/controls-options-manager/util.js +300 -0
  81. package/dist/controls-options-manager/util.js.map +1 -0
  82. package/dist/index.js +78 -17
  83. package/dist/index.js.map +1 -1
  84. package/dist/locus-info/controlsUtils.js +100 -29
  85. package/dist/locus-info/controlsUtils.js.map +1 -1
  86. package/dist/locus-info/embeddedAppsUtils.js +3 -26
  87. package/dist/locus-info/embeddedAppsUtils.js.map +1 -1
  88. package/dist/locus-info/fullState.js +0 -15
  89. package/dist/locus-info/fullState.js.map +1 -1
  90. package/dist/locus-info/hostUtils.js +4 -12
  91. package/dist/locus-info/hostUtils.js.map +1 -1
  92. package/dist/locus-info/index.js +387 -208
  93. package/dist/locus-info/index.js.map +1 -1
  94. package/dist/locus-info/infoUtils.js +0 -38
  95. package/dist/locus-info/infoUtils.js.map +1 -1
  96. package/dist/locus-info/mediaSharesUtils.js +54 -38
  97. package/dist/locus-info/mediaSharesUtils.js.map +1 -1
  98. package/dist/locus-info/parser.js +90 -126
  99. package/dist/locus-info/parser.js.map +1 -1
  100. package/dist/locus-info/selfUtils.js +93 -92
  101. package/dist/locus-info/selfUtils.js.map +1 -1
  102. package/dist/media/index.js +70 -219
  103. package/dist/media/index.js.map +1 -1
  104. package/dist/media/properties.js +74 -198
  105. package/dist/media/properties.js.map +1 -1
  106. package/dist/media/util.js +1 -8
  107. package/dist/media/util.js.map +1 -1
  108. package/dist/mediaQualityMetrics/config.js +505 -495
  109. package/dist/mediaQualityMetrics/config.js.map +1 -1
  110. package/dist/meeting/in-meeting-actions.js +79 -14
  111. package/dist/meeting/in-meeting-actions.js.map +1 -1
  112. package/dist/meeting/index.js +2685 -3324
  113. package/dist/meeting/index.js.map +1 -1
  114. package/dist/meeting/locusMediaRequest.js +291 -0
  115. package/dist/meeting/locusMediaRequest.js.map +1 -0
  116. package/dist/meeting/muteState.js +243 -185
  117. package/dist/meeting/muteState.js.map +1 -1
  118. package/dist/meeting/request.js +296 -342
  119. package/dist/meeting/request.js.map +1 -1
  120. package/dist/meeting/request.type.js +0 -1
  121. package/dist/meeting/request.type.js.map +1 -1
  122. package/dist/meeting/state.js +16 -26
  123. package/dist/meeting/state.js.map +1 -1
  124. package/dist/meeting/util.js +446 -585
  125. package/dist/meeting/util.js.map +1 -1
  126. package/dist/meeting-info/collection.js +3 -25
  127. package/dist/meeting-info/collection.js.map +1 -1
  128. package/dist/meeting-info/index.js +8 -31
  129. package/dist/meeting-info/index.js.map +1 -1
  130. package/dist/meeting-info/meeting-info-v2.js +261 -242
  131. package/dist/meeting-info/meeting-info-v2.js.map +1 -1
  132. package/dist/meeting-info/request.js +1 -16
  133. package/dist/meeting-info/request.js.map +1 -1
  134. package/dist/meeting-info/util.js +98 -183
  135. package/dist/meeting-info/util.js.map +1 -1
  136. package/dist/meeting-info/utilv2.js +156 -232
  137. package/dist/meeting-info/utilv2.js.map +1 -1
  138. package/dist/meetings/collection.js +24 -20
  139. package/dist/meetings/collection.js.map +1 -1
  140. package/dist/meetings/index.js +526 -372
  141. package/dist/meetings/index.js.map +1 -1
  142. package/dist/meetings/meetings.types.js +7 -0
  143. package/dist/meetings/meetings.types.js.map +1 -0
  144. package/dist/meetings/request.js +21 -40
  145. package/dist/meetings/request.js.map +1 -1
  146. package/dist/meetings/util.js +172 -141
  147. package/dist/meetings/util.js.map +1 -1
  148. package/dist/member/index.js +58 -57
  149. package/dist/member/index.js.map +1 -1
  150. package/dist/member/types.js +15 -0
  151. package/dist/member/types.js.map +1 -0
  152. package/dist/member/util.js +101 -69
  153. package/dist/member/util.js.map +1 -1
  154. package/dist/members/collection.js +12 -12
  155. package/dist/members/collection.js.map +1 -1
  156. package/dist/members/index.js +123 -162
  157. package/dist/members/index.js.map +1 -1
  158. package/dist/members/request.js +120 -85
  159. package/dist/members/request.js.map +1 -1
  160. package/dist/members/types.js +15 -0
  161. package/dist/members/types.js.map +1 -0
  162. package/dist/members/util.js +314 -260
  163. package/dist/members/util.js.map +1 -1
  164. package/dist/metrics/config.js +50 -16
  165. package/dist/metrics/config.js.map +1 -1
  166. package/dist/metrics/constants.js +4 -7
  167. package/dist/metrics/constants.js.map +1 -1
  168. package/dist/metrics/index.js +75 -147
  169. package/dist/metrics/index.js.map +1 -1
  170. package/dist/multistream/mediaRequestManager.js +170 -50
  171. package/dist/multistream/mediaRequestManager.js.map +1 -1
  172. package/dist/multistream/receiveSlot.js +58 -65
  173. package/dist/multistream/receiveSlot.js.map +1 -1
  174. package/dist/multistream/receiveSlotManager.js +73 -94
  175. package/dist/multistream/receiveSlotManager.js.map +1 -1
  176. package/dist/multistream/remoteMedia.js +55 -74
  177. package/dist/multistream/remoteMedia.js.map +1 -1
  178. package/dist/multistream/remoteMediaGroup.js +66 -43
  179. package/dist/multistream/remoteMediaGroup.js.map +1 -1
  180. package/dist/multistream/remoteMediaManager.js +502 -442
  181. package/dist/multistream/remoteMediaManager.js.map +1 -1
  182. package/dist/networkQualityMonitor/index.js +24 -51
  183. package/dist/networkQualityMonitor/index.js.map +1 -1
  184. package/dist/personal-meeting-room/index.js +3 -38
  185. package/dist/personal-meeting-room/index.js.map +1 -1
  186. package/dist/personal-meeting-room/request.js +2 -33
  187. package/dist/personal-meeting-room/request.js.map +1 -1
  188. package/dist/personal-meeting-room/util.js +0 -13
  189. package/dist/personal-meeting-room/util.js.map +1 -1
  190. package/dist/reachability/index.js +190 -199
  191. package/dist/reachability/index.js.map +1 -1
  192. package/dist/reachability/request.js +14 -23
  193. package/dist/reachability/request.js.map +1 -1
  194. package/dist/reactions/constants.js +13 -0
  195. package/dist/reactions/constants.js.map +1 -0
  196. package/dist/reactions/reactions.js +2 -4
  197. package/dist/reactions/reactions.js.map +1 -1
  198. package/dist/reactions/reactions.type.js +18 -24
  199. package/dist/reactions/reactions.type.js.map +1 -1
  200. package/dist/reconnection-manager/index.js +356 -476
  201. package/dist/reconnection-manager/index.js.map +1 -1
  202. package/dist/recording-controller/enums.js +17 -0
  203. package/dist/recording-controller/enums.js.map +1 -0
  204. package/dist/recording-controller/index.js +343 -0
  205. package/dist/recording-controller/index.js.map +1 -0
  206. package/dist/recording-controller/util.js +63 -0
  207. package/dist/recording-controller/util.js.map +1 -0
  208. package/dist/roap/index.js +32 -75
  209. package/dist/roap/index.js.map +1 -1
  210. package/dist/roap/request.js +129 -136
  211. package/dist/roap/request.js.map +1 -1
  212. package/dist/roap/turnDiscovery.js +143 -103
  213. package/dist/roap/turnDiscovery.js.map +1 -1
  214. package/dist/statsAnalyzer/global.js +1 -95
  215. package/dist/statsAnalyzer/global.js.map +1 -1
  216. package/dist/statsAnalyzer/index.js +369 -462
  217. package/dist/statsAnalyzer/index.js.map +1 -1
  218. package/dist/statsAnalyzer/mqaUtil.js +144 -94
  219. package/dist/statsAnalyzer/mqaUtil.js.map +1 -1
  220. package/dist/transcription/index.js +9 -44
  221. package/dist/transcription/index.js.map +1 -1
  222. package/dist/types/annotation/annotation.types.d.ts +43 -0
  223. package/dist/types/annotation/constants.d.ts +31 -0
  224. package/dist/types/annotation/index.d.ts +124 -0
  225. package/dist/types/breakouts/breakout.d.ts +8 -0
  226. package/dist/types/breakouts/collection.d.ts +5 -0
  227. package/dist/types/breakouts/edit-lock-error.d.ts +15 -0
  228. package/dist/types/breakouts/events.d.ts +2 -0
  229. package/dist/types/breakouts/index.d.ts +5 -0
  230. package/dist/types/breakouts/request.d.ts +22 -0
  231. package/dist/types/breakouts/utils.d.ts +15 -0
  232. package/dist/types/common/browser-detection.d.ts +9 -0
  233. package/dist/types/common/collection.d.ts +48 -0
  234. package/dist/types/common/config.d.ts +2 -0
  235. package/dist/types/common/errors/captcha-error.d.ts +15 -0
  236. package/dist/types/common/errors/intent-to-join.d.ts +16 -0
  237. package/dist/types/common/errors/join-meeting.d.ts +17 -0
  238. package/dist/types/common/errors/media.d.ts +15 -0
  239. package/dist/types/common/errors/parameter.d.ts +15 -0
  240. package/dist/types/common/errors/password-error.d.ts +15 -0
  241. package/dist/types/common/errors/permission.d.ts +14 -0
  242. package/dist/types/common/errors/reconnection-in-progress.d.ts +9 -0
  243. package/dist/types/common/errors/reconnection.d.ts +15 -0
  244. package/dist/types/common/errors/stats.d.ts +15 -0
  245. package/dist/types/common/errors/webex-errors.d.ts +69 -0
  246. package/dist/types/common/errors/webex-meetings-error.d.ts +20 -0
  247. package/dist/types/common/events/events-scope.d.ts +17 -0
  248. package/dist/types/common/events/events.d.ts +12 -0
  249. package/dist/types/common/events/trigger-proxy.d.ts +2 -0
  250. package/dist/types/common/events/util.d.ts +2 -0
  251. package/dist/types/common/logs/logger-config.d.ts +2 -0
  252. package/dist/types/common/logs/logger-proxy.d.ts +2 -0
  253. package/dist/types/common/logs/request.d.ts +34 -0
  254. package/dist/types/common/queue.d.ts +32 -0
  255. package/dist/types/config.d.ts +72 -0
  256. package/dist/types/constants.d.ts +978 -0
  257. package/dist/types/controls-options-manager/constants.d.ts +4 -0
  258. package/dist/types/controls-options-manager/enums.d.ts +15 -0
  259. package/dist/types/controls-options-manager/index.d.ts +136 -0
  260. package/dist/types/controls-options-manager/types.d.ts +43 -0
  261. package/dist/types/controls-options-manager/util.d.ts +1 -0
  262. package/dist/types/index.d.ts +7 -0
  263. package/dist/types/locus-info/controlsUtils.d.ts +2 -0
  264. package/dist/types/locus-info/embeddedAppsUtils.d.ts +2 -0
  265. package/dist/types/locus-info/fullState.d.ts +2 -0
  266. package/dist/types/locus-info/hostUtils.d.ts +2 -0
  267. package/dist/types/locus-info/index.d.ts +315 -0
  268. package/dist/types/locus-info/infoUtils.d.ts +2 -0
  269. package/dist/types/locus-info/mediaSharesUtils.d.ts +2 -0
  270. package/dist/types/locus-info/parser.d.ts +212 -0
  271. package/dist/types/locus-info/selfUtils.d.ts +2 -0
  272. package/dist/types/media/index.d.ts +34 -0
  273. package/dist/types/media/properties.d.ts +86 -0
  274. package/dist/types/media/util.d.ts +2 -0
  275. package/dist/types/mediaQualityMetrics/config.d.ts +365 -0
  276. package/dist/types/meeting/in-meeting-actions.d.ts +149 -0
  277. package/dist/types/meeting/index.d.ts +1509 -0
  278. package/dist/types/meeting/locusMediaRequest.d.ts +70 -0
  279. package/dist/types/meeting/muteState.d.ts +184 -0
  280. package/dist/types/meeting/request.d.ts +270 -0
  281. package/dist/types/meeting/request.type.d.ts +11 -0
  282. package/dist/types/meeting/state.d.ts +9 -0
  283. package/dist/types/meeting/util.d.ts +75 -0
  284. package/dist/types/meeting-info/collection.d.ts +20 -0
  285. package/dist/types/meeting-info/index.d.ts +57 -0
  286. package/dist/types/meeting-info/meeting-info-v2.d.ts +122 -0
  287. package/dist/types/meeting-info/request.d.ts +22 -0
  288. package/dist/types/meeting-info/util.d.ts +2 -0
  289. package/dist/types/meeting-info/utilv2.d.ts +2 -0
  290. package/dist/types/meetings/collection.d.ts +31 -0
  291. package/dist/types/meetings/index.d.ts +364 -0
  292. package/dist/types/meetings/meetings.types.d.ts +4 -0
  293. package/dist/types/meetings/request.d.ts +27 -0
  294. package/dist/types/meetings/util.d.ts +18 -0
  295. package/dist/types/member/index.d.ts +157 -0
  296. package/dist/types/member/types.d.ts +21 -0
  297. package/dist/types/member/util.d.ts +2 -0
  298. package/dist/types/members/collection.d.ts +29 -0
  299. package/dist/types/members/index.d.ts +353 -0
  300. package/dist/types/members/request.d.ts +114 -0
  301. package/dist/types/members/types.d.ts +24 -0
  302. package/dist/types/members/util.d.ts +210 -0
  303. package/dist/types/metrics/config.d.ts +195 -0
  304. package/dist/types/metrics/constants.d.ts +55 -0
  305. package/dist/types/metrics/index.d.ts +169 -0
  306. package/dist/types/multistream/mediaRequestManager.d.ts +104 -0
  307. package/dist/types/multistream/receiveSlot.d.ts +68 -0
  308. package/dist/types/multistream/receiveSlotManager.d.ts +56 -0
  309. package/dist/types/multistream/remoteMedia.d.ts +72 -0
  310. package/dist/types/multistream/remoteMediaGroup.d.ts +47 -0
  311. package/dist/types/multistream/remoteMediaManager.d.ts +277 -0
  312. package/dist/types/networkQualityMonitor/index.d.ts +70 -0
  313. package/dist/types/personal-meeting-room/index.d.ts +47 -0
  314. package/dist/types/personal-meeting-room/request.d.ts +14 -0
  315. package/dist/types/personal-meeting-room/util.d.ts +2 -0
  316. package/dist/types/reachability/index.d.ts +152 -0
  317. package/dist/types/reachability/request.d.ts +37 -0
  318. package/dist/types/reactions/constants.d.ts +3 -0
  319. package/dist/types/reactions/reactions.d.ts +4 -0
  320. package/dist/types/reactions/reactions.type.d.ts +52 -0
  321. package/dist/types/reconnection-manager/index.d.ts +126 -0
  322. package/dist/types/recording-controller/enums.d.ts +7 -0
  323. package/dist/types/recording-controller/index.d.ts +193 -0
  324. package/dist/types/recording-controller/util.d.ts +13 -0
  325. package/dist/types/roap/index.d.ts +77 -0
  326. package/dist/types/roap/request.d.ts +36 -0
  327. package/dist/types/roap/turnDiscovery.d.ts +91 -0
  328. package/dist/types/statsAnalyzer/global.d.ts +36 -0
  329. package/dist/types/statsAnalyzer/index.d.ts +200 -0
  330. package/dist/types/statsAnalyzer/mqaUtil.d.ts +24 -0
  331. package/dist/types/transcription/index.d.ts +64 -0
  332. package/package.json +28 -21
  333. package/src/annotation/annotation.types.ts +52 -0
  334. package/src/annotation/constants.ts +36 -0
  335. package/src/annotation/index.ts +343 -0
  336. package/src/breakouts/README.md +220 -0
  337. package/src/breakouts/breakout.ts +163 -0
  338. package/src/breakouts/collection.ts +19 -0
  339. package/src/breakouts/edit-lock-error.ts +25 -0
  340. package/src/breakouts/events.ts +37 -0
  341. package/src/breakouts/index.ts +921 -0
  342. package/src/breakouts/request.ts +55 -0
  343. package/src/breakouts/utils.ts +57 -0
  344. package/src/common/errors/webex-errors.ts +6 -2
  345. package/src/common/logs/logger-proxy.ts +1 -1
  346. package/src/config.ts +5 -7
  347. package/src/constants.ts +155 -20
  348. package/src/controls-options-manager/constants.ts +5 -0
  349. package/src/controls-options-manager/enums.ts +18 -0
  350. package/src/controls-options-manager/index.ts +278 -0
  351. package/src/controls-options-manager/types.ts +59 -0
  352. package/src/controls-options-manager/util.ts +286 -0
  353. package/src/index.ts +34 -0
  354. package/src/locus-info/controlsUtils.ts +108 -0
  355. package/src/locus-info/index.ts +310 -21
  356. package/src/locus-info/mediaSharesUtils.ts +48 -0
  357. package/src/locus-info/parser.ts +2 -1
  358. package/src/locus-info/selfUtils.ts +71 -1
  359. package/src/media/index.ts +70 -142
  360. package/src/media/properties.ts +41 -104
  361. package/src/mediaQualityMetrics/config.ts +379 -377
  362. package/src/meeting/in-meeting-actions.ts +156 -0
  363. package/src/meeting/index.ts +1730 -1768
  364. package/src/meeting/locusMediaRequest.ts +309 -0
  365. package/src/meeting/muteState.ts +228 -132
  366. package/src/meeting/request.ts +100 -91
  367. package/src/meeting/request.type.ts +2 -0
  368. package/src/meeting/util.ts +421 -421
  369. package/src/meeting-info/meeting-info-v2.ts +134 -13
  370. package/src/meeting-info/utilv2.ts +13 -3
  371. package/src/meetings/collection.ts +20 -0
  372. package/src/meetings/index.ts +375 -83
  373. package/src/meetings/meetings.types.ts +9 -0
  374. package/src/meetings/request.ts +3 -1
  375. package/src/meetings/util.ts +103 -4
  376. package/src/member/index.ts +40 -0
  377. package/src/member/types.ts +24 -0
  378. package/src/member/util.ts +81 -1
  379. package/src/members/collection.ts +8 -0
  380. package/src/members/index.ts +108 -6
  381. package/src/members/request.ts +98 -17
  382. package/src/members/types.ts +28 -0
  383. package/src/members/util.ts +319 -240
  384. package/src/metrics/config.ts +49 -10
  385. package/src/metrics/constants.ts +2 -4
  386. package/src/metrics/index.ts +43 -27
  387. package/src/multistream/mediaRequestManager.ts +210 -45
  388. package/src/multistream/receiveSlot.ts +68 -26
  389. package/src/multistream/receiveSlotManager.ts +61 -38
  390. package/src/multistream/remoteMedia.ts +29 -3
  391. package/src/multistream/remoteMediaGroup.ts +61 -2
  392. package/src/multistream/remoteMediaManager.ts +260 -66
  393. package/src/networkQualityMonitor/index.ts +6 -6
  394. package/src/reachability/index.ts +75 -25
  395. package/src/reachability/request.ts +10 -5
  396. package/src/reactions/constants.ts +4 -0
  397. package/src/reactions/reactions.ts +4 -4
  398. package/src/reactions/reactions.type.ts +28 -3
  399. package/src/reconnection-manager/index.ts +53 -32
  400. package/src/recording-controller/enums.ts +8 -0
  401. package/src/recording-controller/index.ts +315 -0
  402. package/src/recording-controller/util.ts +58 -0
  403. package/src/roap/index.ts +21 -30
  404. package/src/roap/request.ts +51 -52
  405. package/src/roap/turnDiscovery.ts +51 -27
  406. package/src/statsAnalyzer/global.ts +1 -94
  407. package/src/statsAnalyzer/index.ts +380 -390
  408. package/src/statsAnalyzer/mqaUtil.ts +106 -99
  409. package/test/integration/spec/converged-space-meetings.js +233 -0
  410. package/test/integration/spec/journey.js +332 -255
  411. package/test/integration/spec/space-meeting.js +78 -5
  412. package/test/integration/spec/transcription.js +1 -1
  413. package/test/unit/spec/annotation/index.ts +436 -0
  414. package/test/unit/spec/breakouts/breakout.ts +203 -0
  415. package/test/unit/spec/breakouts/collection.ts +15 -0
  416. package/test/unit/spec/breakouts/edit-lock-error.ts +30 -0
  417. package/test/unit/spec/breakouts/events.ts +77 -0
  418. package/test/unit/spec/breakouts/index.ts +1790 -0
  419. package/test/unit/spec/breakouts/request.ts +104 -0
  420. package/test/unit/spec/breakouts/utils.js +72 -0
  421. package/test/unit/spec/controls-options-manager/index.js +287 -0
  422. package/test/unit/spec/controls-options-manager/util.js +518 -0
  423. package/test/unit/spec/fixture/locus.js +1 -0
  424. package/test/unit/spec/locus-info/controlsUtils.js +303 -30
  425. package/test/unit/spec/locus-info/index.js +615 -4
  426. package/test/unit/spec/locus-info/mediaSharesUtils.ts +22 -0
  427. package/test/unit/spec/locus-info/selfConstant.js +38 -0
  428. package/test/unit/spec/locus-info/selfUtils.js +200 -0
  429. package/test/unit/spec/media/index.ts +118 -22
  430. package/test/unit/spec/media/properties.ts +9 -9
  431. package/test/unit/spec/meeting/in-meeting-actions.ts +76 -0
  432. package/test/unit/spec/meeting/index.js +2394 -1381
  433. package/test/unit/spec/meeting/locusMediaRequest.ts +436 -0
  434. package/test/unit/spec/meeting/muteState.js +370 -208
  435. package/test/unit/spec/meeting/request.js +354 -42
  436. package/test/unit/spec/meeting/utils.js +268 -156
  437. package/test/unit/spec/meeting-info/meetinginfov2.js +383 -5
  438. package/test/unit/spec/meeting-info/utilv2.js +21 -0
  439. package/test/unit/spec/meetings/collection.js +14 -0
  440. package/test/unit/spec/meetings/index.js +842 -128
  441. package/test/unit/spec/meetings/utils.js +206 -2
  442. package/test/unit/spec/member/index.js +24 -0
  443. package/test/unit/spec/member/util.js +384 -32
  444. package/test/unit/spec/members/index.js +320 -1
  445. package/test/unit/spec/members/request.js +206 -27
  446. package/test/unit/spec/members/utils.js +184 -0
  447. package/test/unit/spec/metrics/index.js +98 -0
  448. package/test/unit/spec/multistream/mediaRequestManager.ts +676 -105
  449. package/test/unit/spec/multistream/receiveSlot.ts +77 -18
  450. package/test/unit/spec/multistream/receiveSlotManager.ts +69 -39
  451. package/test/unit/spec/multistream/remoteMedia.ts +32 -2
  452. package/test/unit/spec/multistream/remoteMediaGroup.ts +271 -5
  453. package/test/unit/spec/multistream/remoteMediaManager.ts +672 -65
  454. package/test/unit/spec/networkQualityMonitor/index.js +4 -4
  455. package/test/unit/spec/reachability/index.ts +176 -25
  456. package/test/unit/spec/reachability/request.js +66 -0
  457. package/test/unit/spec/reconnection-manager/index.js +46 -13
  458. package/test/unit/spec/recording-controller/index.js +231 -0
  459. package/test/unit/spec/recording-controller/util.js +102 -0
  460. package/test/unit/spec/roap/index.ts +21 -51
  461. package/test/unit/spec/roap/request.ts +187 -0
  462. package/test/unit/spec/roap/turnDiscovery.ts +73 -34
  463. package/test/unit/spec/stats-analyzer/index.js +94 -43
  464. package/test/utils/constants.js +9 -0
  465. package/test/utils/integrationTestUtils.js +46 -0
  466. package/test/utils/testUtils.js +0 -45
  467. package/test/utils/webex-config.js +4 -0
  468. package/test/utils/webex-test-users.js +7 -3
  469. package/tsconfig.json +6 -0
  470. package/dist/media/internal-media-core-wrapper.js +0 -22
  471. package/dist/media/internal-media-core-wrapper.js.map +0 -1
  472. package/dist/meeting/effectsState.js +0 -334
  473. package/dist/meeting/effectsState.js.map +0 -1
  474. package/dist/multistream/multistreamMedia.js +0 -117
  475. package/dist/multistream/multistreamMedia.js.map +0 -1
  476. package/src/index.js +0 -15
  477. package/src/media/internal-media-core-wrapper.ts +0 -9
  478. package/src/meeting/effectsState.ts +0 -211
  479. package/src/multistream/multistreamMedia.ts +0 -93
  480. package/test/unit/spec/meeting/effectsState.js +0 -281
@@ -1,146 +1,106 @@
1
1
  "use strict";
2
2
 
3
+ var _typeof = require("@babel/runtime-corejs2/helpers/typeof");
3
4
  var _Reflect$construct = require("@babel/runtime-corejs2/core-js/reflect/construct");
4
-
5
+ var _Object$keys2 = require("@babel/runtime-corejs2/core-js/object/keys");
6
+ var _Object$getOwnPropertySymbols = require("@babel/runtime-corejs2/core-js/object/get-own-property-symbols");
7
+ var _Object$getOwnPropertyDescriptor = require("@babel/runtime-corejs2/core-js/object/get-own-property-descriptor");
8
+ var _Object$getOwnPropertyDescriptors = require("@babel/runtime-corejs2/core-js/object/get-own-property-descriptors");
9
+ var _Object$defineProperties = require("@babel/runtime-corejs2/core-js/object/define-properties");
5
10
  var _Object$defineProperty = require("@babel/runtime-corejs2/core-js/object/define-property");
6
-
11
+ var _WeakMap = require("@babel/runtime-corejs2/core-js/weak-map");
7
12
  var _interopRequireDefault = require("@babel/runtime-corejs2/helpers/interopRequireDefault");
8
-
9
13
  _Object$defineProperty(exports, "__esModule", {
10
14
  value: true
11
15
  });
12
-
13
16
  exports.default = void 0;
14
-
15
- var _regenerator = _interopRequireDefault(require("@babel/runtime-corejs2/regenerator"));
16
-
17
17
  var _promise = _interopRequireDefault(require("@babel/runtime-corejs2/core-js/promise"));
18
-
19
18
  var _now = _interopRequireDefault(require("@babel/runtime-corejs2/core-js/date/now"));
20
-
21
19
  var _keys = _interopRequireDefault(require("@babel/runtime-corejs2/core-js/object/keys"));
22
-
23
20
  var _values = _interopRequireDefault(require("@babel/runtime-corejs2/core-js/object/values"));
24
-
21
+ var _regenerator = _interopRequireDefault(require("@babel/runtime-corejs2/regenerator"));
22
+ var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime-corejs2/helpers/toConsumableArray"));
25
23
  var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime-corejs2/helpers/asyncToGenerator"));
26
-
27
24
  var _assertThisInitialized2 = _interopRequireDefault(require("@babel/runtime-corejs2/helpers/assertThisInitialized"));
28
-
29
25
  var _inherits2 = _interopRequireDefault(require("@babel/runtime-corejs2/helpers/inherits"));
30
-
31
26
  var _possibleConstructorReturn2 = _interopRequireDefault(require("@babel/runtime-corejs2/helpers/possibleConstructorReturn"));
32
-
33
27
  var _getPrototypeOf2 = _interopRequireDefault(require("@babel/runtime-corejs2/helpers/getPrototypeOf"));
34
-
35
28
  var _defineProperty2 = _interopRequireDefault(require("@babel/runtime-corejs2/helpers/defineProperty"));
36
-
37
29
  var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime-corejs2/helpers/classCallCheck"));
38
-
39
30
  var _createClass2 = _interopRequireDefault(require("@babel/runtime-corejs2/helpers/createClass"));
40
-
41
31
  require("@webex/internal-plugin-mercury");
42
-
43
32
  require("@webex/internal-plugin-conversation");
44
-
45
33
  var _webexCore = require("@webex/webex-core");
46
-
47
34
  var _internalMediaCore = require("@webex/internal-media-core");
48
-
35
+ var mediaHelpersModule = _interopRequireWildcard(require("@webex/media-helpers"));
49
36
  require("webrtc-adapter");
50
-
51
37
  var _metrics = _interopRequireDefault(require("../metrics"));
52
-
53
38
  var _config = require("../metrics/config");
54
-
55
39
  var _loggerConfig = _interopRequireDefault(require("../common/logs/logger-config"));
56
-
57
40
  var _config2 = _interopRequireDefault(require("../common/config"));
58
-
59
41
  var _loggerProxy = _interopRequireDefault(require("../common/logs/logger-proxy"));
60
-
61
42
  var _request = _interopRequireDefault(require("../common/logs/request"));
62
-
63
43
  var _triggerProxy = _interopRequireDefault(require("../common/events/trigger-proxy"));
64
-
65
44
  var _media = _interopRequireDefault(require("../media"));
66
-
67
45
  var _util = _interopRequireDefault(require("../meeting/util"));
68
-
69
46
  var _constants = require("../constants");
70
-
71
47
  var _constants2 = _interopRequireDefault(require("../metrics/constants"));
72
-
73
48
  var _meetingInfo = _interopRequireDefault(require("../meeting-info"));
74
-
75
49
  var _meetingInfoV = _interopRequireDefault(require("../meeting-info/meeting-info-v2"));
76
-
77
50
  var _meeting = _interopRequireDefault(require("../meeting"));
78
-
79
51
  var _personalMeetingRoom = _interopRequireDefault(require("../personal-meeting-room"));
80
-
81
52
  var _reachability = _interopRequireDefault(require("../reachability"));
82
-
83
53
  var _request2 = _interopRequireDefault(require("./request"));
84
-
85
54
  var _passwordError = _interopRequireDefault(require("../common/errors/password-error"));
86
-
87
55
  var _captchaError = _interopRequireDefault(require("../common/errors/captcha-error"));
88
-
89
56
  var _collection = _interopRequireDefault(require("./collection"));
90
-
91
57
  var _util2 = _interopRequireDefault(require("./util"));
92
-
58
+ var _permission = _interopRequireDefault(require("../common/errors/permission"));
59
+ function _getRequireWildcardCache(nodeInterop) { if (typeof _WeakMap !== "function") return null; var cacheBabelInterop = new _WeakMap(); var cacheNodeInterop = new _WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
60
+ function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = _Object$defineProperty && _Object$getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? _Object$getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { _Object$defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
61
+ function ownKeys(object, enumerableOnly) { var keys = _Object$keys2(object); if (_Object$getOwnPropertySymbols) { var symbols = _Object$getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return _Object$getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
62
+ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { (0, _defineProperty2.default)(target, key, source[key]); }) : _Object$getOwnPropertyDescriptors ? _Object$defineProperties(target, _Object$getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { _Object$defineProperty(target, key, _Object$getOwnPropertyDescriptor(source, key)); }); } return target; }
93
63
  function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = (0, _getPrototypeOf2.default)(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = (0, _getPrototypeOf2.default)(this).constructor; result = _Reflect$construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return (0, _possibleConstructorReturn2.default)(this, result); }; }
94
-
95
64
  function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !_Reflect$construct) return false; if (_Reflect$construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(_Reflect$construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
96
-
97
65
  var mediaLogger;
98
-
99
66
  var MediaLogger = /*#__PURE__*/function () {
100
67
  function MediaLogger() {
101
68
  (0, _classCallCheck2.default)(this, MediaLogger);
102
69
  }
103
-
104
70
  (0, _createClass2.default)(MediaLogger, [{
105
71
  key: "info",
106
72
  value: function info() {
107
73
  var _LoggerProxy$logger;
108
-
109
74
  (_LoggerProxy$logger = _loggerProxy.default.logger).info.apply(_LoggerProxy$logger, arguments);
110
75
  }
111
76
  }, {
112
77
  key: "log",
113
78
  value: function log() {
114
79
  var _LoggerProxy$logger2;
115
-
116
80
  (_LoggerProxy$logger2 = _loggerProxy.default.logger).log.apply(_LoggerProxy$logger2, arguments);
117
81
  }
118
82
  }, {
119
83
  key: "error",
120
84
  value: function error() {
121
85
  var _LoggerProxy$logger3;
122
-
123
86
  (_LoggerProxy$logger3 = _loggerProxy.default.logger).error.apply(_LoggerProxy$logger3, arguments);
124
87
  }
125
88
  }, {
126
89
  key: "warn",
127
90
  value: function warn() {
128
91
  var _LoggerProxy$logger4;
129
-
130
92
  (_LoggerProxy$logger4 = _loggerProxy.default.logger).warn.apply(_LoggerProxy$logger4, arguments);
131
93
  }
132
94
  }, {
133
95
  key: "trace",
134
96
  value: function trace() {
135
97
  var _LoggerProxy$logger5;
136
-
137
98
  (_LoggerProxy$logger5 = _loggerProxy.default.logger).trace.apply(_LoggerProxy$logger5, arguments);
138
99
  }
139
100
  }, {
140
101
  key: "debug",
141
102
  value: function debug() {
142
103
  var _LoggerProxy$logger6;
143
-
144
104
  (_LoggerProxy$logger6 = _loggerProxy.default.logger).debug.apply(_LoggerProxy$logger6, arguments);
145
105
  }
146
106
  }]);
@@ -153,7 +113,6 @@ var MediaLogger = /*#__PURE__*/function () {
153
113
  * @instance
154
114
  * @memberof Meetings
155
115
  */
156
-
157
116
  /**
158
117
  * Meetings Network Disconnected Event
159
118
  * Emitted when the meetings instance is disconnected from
@@ -162,7 +121,6 @@ var MediaLogger = /*#__PURE__*/function () {
162
121
  * @instance
163
122
  * @memberof Meetings
164
123
  */
165
-
166
124
  /**
167
125
  * Meetings Registered Event
168
126
  * Emitted when the meetings instance has been registered and listening
@@ -170,7 +128,6 @@ var MediaLogger = /*#__PURE__*/function () {
170
128
  * @instance
171
129
  * @memberof Meetings
172
130
  */
173
-
174
131
  /**
175
132
  * Meeting Removed Event
176
133
  * Emitted when a meeting was removed from the cache of meetings
@@ -182,7 +139,6 @@ var MediaLogger = /*#__PURE__*/function () {
182
139
  * @property {String} type what type of meeting it was
183
140
  * @memberof Meetings
184
141
  */
185
-
186
142
  /**
187
143
  * Meeting Added Event
188
144
  * Emitted when a meeting was added to the cache of meetings
@@ -193,18 +149,13 @@ var MediaLogger = /*#__PURE__*/function () {
193
149
  * @property {String} type what type of meeting it was
194
150
  * @memberof Meetings
195
151
  */
196
-
197
152
  /**
198
153
  * Maintain a cache of meetings and sync with services.
199
154
  * @class
200
155
  */
201
-
202
-
203
156
  var Meetings = /*#__PURE__*/function (_WebexPlugin) {
204
157
  (0, _inherits2.default)(Meetings, _WebexPlugin);
205
-
206
158
  var _super = _createSuper(Meetings);
207
-
208
159
  /**
209
160
  * Initializes the Meetings Plugin
210
161
  * @constructor
@@ -213,23 +164,21 @@ var Meetings = /*#__PURE__*/function (_WebexPlugin) {
213
164
  */
214
165
  function Meetings() {
215
166
  var _this;
216
-
217
167
  (0, _classCallCheck2.default)(this, Meetings);
218
-
219
168
  for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
220
169
  args[_key] = arguments[_key];
221
170
  }
222
-
223
171
  _this = _super.call.apply(_super, [this].concat(args));
172
+
224
173
  /**
225
- * The Meetings request to interact with server
174
+ * The webrtc-core media helpers. This is a temporary solution required for the SDK sample app
175
+ * to be able to call media helper functions.
176
+ *
226
177
  * @instance
227
178
  * @type {Object}
228
179
  * @private
229
180
  * @memberof Meetings
230
181
  */
231
- // @ts-ignore
232
-
233
182
  (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "loggerRequest", void 0);
234
183
  (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "media", void 0);
235
184
  (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "meetingCollection", void 0);
@@ -240,7 +189,61 @@ var Meetings = /*#__PURE__*/function (_WebexPlugin) {
240
189
  (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "request", void 0);
241
190
  (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "geoHintInfo", void 0);
242
191
  (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "meetingInfo", void 0);
192
+ (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "mediaHelpers", void 0);
193
+ (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "breakoutLocusForHandleLater", void 0);
243
194
  (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "namespace", _constants.MEETINGS);
195
+ (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "createNoiseReductionEffect", /*#__PURE__*/function () {
196
+ var _ref = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee(options) {
197
+ var authToken;
198
+ return _regenerator.default.wrap(function _callee$(_context) {
199
+ while (1) switch (_context.prev = _context.next) {
200
+ case 0:
201
+ // @ts-ignore
202
+ authToken = _this.webex.credentials.supertoken.access_token;
203
+ return _context.abrupt("return", new mediaHelpersModule.NoiseReductionEffect(_objectSpread({
204
+ authToken: authToken
205
+ }, options)));
206
+ case 2:
207
+ case "end":
208
+ return _context.stop();
209
+ }
210
+ }, _callee);
211
+ }));
212
+ return function (_x) {
213
+ return _ref.apply(this, arguments);
214
+ };
215
+ }());
216
+ (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "createVirtualBackgroundEffect", /*#__PURE__*/function () {
217
+ var _ref2 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee2(options) {
218
+ var authToken;
219
+ return _regenerator.default.wrap(function _callee2$(_context2) {
220
+ while (1) switch (_context2.prev = _context2.next) {
221
+ case 0:
222
+ // @ts-ignore
223
+ authToken = _this.webex.credentials.supertoken.access_token;
224
+ return _context2.abrupt("return", new mediaHelpersModule.VirtualBackgroundEffect(_objectSpread({
225
+ authToken: authToken
226
+ }, options)));
227
+ case 2:
228
+ case "end":
229
+ return _context2.stop();
230
+ }
231
+ }, _callee2);
232
+ }));
233
+ return function (_x2) {
234
+ return _ref2.apply(this, arguments);
235
+ };
236
+ }());
237
+ _this.mediaHelpers = mediaHelpersModule;
238
+
239
+ /**
240
+ * The Meetings request to interact with server
241
+ * @instance
242
+ * @type {Object}
243
+ * @private
244
+ * @memberof Meetings
245
+ */
246
+ // @ts-ignore
244
247
  _this.request = new _request2.default({}, {
245
248
  parent: _this.webex
246
249
  });
@@ -252,7 +255,6 @@ var Meetings = /*#__PURE__*/function (_WebexPlugin) {
252
255
  * @memberof Meetings
253
256
  */
254
257
  // @ts-ignore
255
-
256
258
  _this.loggerRequest = new _request.default({
257
259
  webex: _this.webex
258
260
  });
@@ -264,7 +266,6 @@ var Meetings = /*#__PURE__*/function (_WebexPlugin) {
264
266
  * @public
265
267
  * @memberof Meetings
266
268
  */
267
-
268
269
  _this.personalMeetingRoom = null;
269
270
  /**
270
271
  * The Reachability object to interact with server, starts as null until {@link Meeting#setReachability} is called
@@ -274,8 +275,8 @@ var Meetings = /*#__PURE__*/function (_WebexPlugin) {
274
275
  * @private
275
276
  * @memberof Meetings
276
277
  */
277
-
278
278
  _this.reachability = null;
279
+
279
280
  /**
280
281
  * If the meetings plugin has been registered and listening via {@link Meetings#register}
281
282
  * @instance
@@ -283,8 +284,8 @@ var Meetings = /*#__PURE__*/function (_WebexPlugin) {
283
284
  * @public
284
285
  * @memberof Meetings
285
286
  */
286
-
287
287
  _this.registered = false;
288
+
288
289
  /**
289
290
  * This values indicates the preferred webex site the user will start there meeting, getsits value from {@link Meetings#register}
290
291
  * @instance
@@ -292,8 +293,8 @@ var Meetings = /*#__PURE__*/function (_WebexPlugin) {
292
293
  * @private
293
294
  * @memberof Meetings
294
295
  */
295
-
296
296
  _this.preferredWebexSite = '';
297
+
297
298
  /**
298
299
  * The public interface for the internal Media util files. These are helpful to expose outside the context
299
300
  * of a meeting so that a user can access media without creating a meeting instance.
@@ -302,92 +303,194 @@ var Meetings = /*#__PURE__*/function (_WebexPlugin) {
302
303
  * @private
303
304
  * @memberof Meetings
304
305
  */
305
-
306
306
  _this.media = {
307
- getUserMedia: _media.default.getUserMedia,
308
- getSupportedDevice: _media.default.getSupportedDevice
307
+ getUserMedia: _media.default.getUserMedia
309
308
  };
310
-
311
309
  _this.onReady();
312
-
313
310
  return _this;
314
311
  }
312
+
315
313
  /**
316
- * handle locus events and takes meeting actions with them as they come in
317
- * @param {Object} data a locus event
318
- * @param {String} data.locusUrl
319
- * @param {Object} data.locus
320
- * @param {Boolean} useRandomDelayForInfo whether a random delay should be added to fetching meeting info
321
- * @param {String} data.eventType
322
- * @returns {undefined}
314
+ * check whether you need to handle this main session's locus data or not
315
+ * @param {Object} meeting current meeting data
316
+ * @param {Object} newLocus new locus data
317
+ * @returns {boolean}
323
318
  * @private
324
319
  * @memberof Meetings
325
320
  */
321
+ (0, _createClass2.default)(Meetings, [{
322
+ key: "isNeedHandleMainLocus",
323
+ value: function isNeedHandleMainLocus(meeting, newLocus) {
324
+ var _newLocus$controls, _newLocus$controls$br, _newLocus$self, _newLocus$self2, _newLocus$self3, _breakoutLocus$joined, _newLocus$self4;
325
+ var breakoutUrl = (_newLocus$controls = newLocus.controls) === null || _newLocus$controls === void 0 ? void 0 : (_newLocus$controls$br = _newLocus$controls.breakout) === null || _newLocus$controls$br === void 0 ? void 0 : _newLocus$controls$br.url;
326
+ var breakoutLocus = this.meetingCollection.getActiveBreakoutLocus(breakoutUrl);
327
+ var isSelfJoined = (newLocus === null || newLocus === void 0 ? void 0 : (_newLocus$self = newLocus.self) === null || _newLocus$self === void 0 ? void 0 : _newLocus$self.state) === _constants._JOINED_;
328
+ var isSelfMoved = (newLocus === null || newLocus === void 0 ? void 0 : (_newLocus$self2 = newLocus.self) === null || _newLocus$self2 === void 0 ? void 0 : _newLocus$self2.state) === _constants._LEFT_ && (newLocus === null || newLocus === void 0 ? void 0 : (_newLocus$self3 = newLocus.self) === null || _newLocus$self3 === void 0 ? void 0 : _newLocus$self3.reason) === _constants._MOVED_;
329
+ // @ts-ignore
330
+ var deviceFromNewLocus = _util2.default.getThisDevice(newLocus, this.webex.internal.device.url);
331
+ var isNewLocusJoinThisDevice = _util2.default.joinedOnThisDevice(meeting, newLocus,
332
+ // @ts-ignore
333
+ this.webex.internal.device.url);
334
+ var isBreakoutLocusJoinThisDevice = (breakoutLocus === null || breakoutLocus === void 0 ? void 0 : (_breakoutLocus$joined = breakoutLocus.joinedWith) === null || _breakoutLocus$joined === void 0 ? void 0 : _breakoutLocus$joined.correlationId) && breakoutLocus.joinedWith.correlationId === (meeting === null || meeting === void 0 ? void 0 : meeting.correlationId);
335
+ if (isSelfJoined && isNewLocusJoinThisDevice) {
336
+ _loggerProxy.default.logger.log('Meetings:index#isNeedHandleMainLocus --> self this device shown as JOINED in the main session');
337
+ if (breakoutLocus !== null && breakoutLocus !== void 0 && breakoutLocus.joinedWith && deviceFromNewLocus) {
338
+ var _breakoutLocus$joined2, _deviceFromNewLocus$r;
339
+ var breakoutReplaceAt = ((_breakoutLocus$joined2 = breakoutLocus.joinedWith.replaces) === null || _breakoutLocus$joined2 === void 0 ? void 0 : _breakoutLocus$joined2.length) > 0 ? breakoutLocus.joinedWith.replaces[0].replaceAt : '';
340
+ var newLocusReplaceAt = ((_deviceFromNewLocus$r = deviceFromNewLocus.replaces) === null || _deviceFromNewLocus$r === void 0 ? void 0 : _deviceFromNewLocus$r.length) > 0 ? deviceFromNewLocus.replaces[0].replaceAt : '';
341
+ if (breakoutReplaceAt && newLocusReplaceAt && breakoutReplaceAt > newLocusReplaceAt) {
342
+ _loggerProxy.default.logger.log("Meetings:index#isNeedHandleMainLocus --> this is expired main joined status locus_dto replacedAt ".concat(newLocusReplaceAt, " bo replacedAt ").concat(breakoutReplaceAt));
343
+ return false;
344
+ }
345
+ }
346
+ return true;
347
+ }
348
+ if (isBreakoutLocusJoinThisDevice) {
349
+ _loggerProxy.default.logger.log("Meetings:index#isNeedHandleMainLocus --> there is active breakout session and joined on this device, and don't need to handle main session: ".concat(breakoutUrl));
350
+ return false;
351
+ }
352
+ if (isSelfMoved && newLocus !== null && newLocus !== void 0 && (_newLocus$self4 = newLocus.self) !== null && _newLocus$self4 !== void 0 && _newLocus$self4.removed) {
353
+ _loggerProxy.default.logger.log('Meetings:index#isNeedHandleMainLocus --> self moved main locus with self removed status, not need to handle');
354
+ return false;
355
+ }
356
+ _loggerProxy.default.logger.log('Meetings:index#isNeedHandleMainLocus --> this is a normal main session locusDTO update case');
357
+ return true;
358
+ }
326
359
 
360
+ /**
361
+ * check whether you need to handle this locus data or not
362
+ * @param {Object} meeting old locus data
363
+ * @param {Object} newLocus new locus data
364
+ * @returns {boolean}
365
+ * @private
366
+ * @memberof Meetings
367
+ */
368
+ }, {
369
+ key: "isNeedHandleLocusDTO",
370
+ value: function isNeedHandleLocusDTO(meeting, newLocus) {
371
+ if (newLocus) {
372
+ var _newLocus$self5, _newLocus$self6;
373
+ var isNewLocusAsBreakout = _util2.default.isBreakoutLocusDTO(newLocus);
374
+ var isSelfMoved = (newLocus === null || newLocus === void 0 ? void 0 : (_newLocus$self5 = newLocus.self) === null || _newLocus$self5 === void 0 ? void 0 : _newLocus$self5.state) === _constants._LEFT_ && (newLocus === null || newLocus === void 0 ? void 0 : (_newLocus$self6 = newLocus.self) === null || _newLocus$self6 === void 0 ? void 0 : _newLocus$self6.reason) === _constants._MOVED_;
375
+ if (!meeting) {
376
+ if (isNewLocusAsBreakout) {
377
+ var _newLocus$fullState, _newLocus$self7;
378
+ _loggerProxy.default.logger.log("Meetings:index#isNeedHandleLocusDTO --> the first breakout session locusDTO active status: ".concat((_newLocus$fullState = newLocus.fullState) === null || _newLocus$fullState === void 0 ? void 0 : _newLocus$fullState.active));
379
+ return ((_newLocus$self7 = newLocus.self) === null || _newLocus$self7 === void 0 ? void 0 : _newLocus$self7.state) === _constants._JOINED_;
380
+ }
381
+ return this.isNeedHandleMainLocus(meeting, newLocus);
382
+ }
383
+ if (!isNewLocusAsBreakout) {
384
+ return this.isNeedHandleMainLocus(meeting, newLocus);
385
+ }
386
+ return !isSelfMoved;
387
+ }
388
+ return true;
389
+ }
327
390
 
328
- (0, _createClass2.default)(Meetings, [{
391
+ /**
392
+ * get corresponding meeting object by locus data
393
+ * @param {Object} data a locus event
394
+ * @param {String} data.locusUrl
395
+ * @param {Object} data.locus
396
+ * @returns {Object}
397
+ * @private
398
+ * @memberof Meetings
399
+ */
400
+ }, {
401
+ key: "getCorrespondingMeetingByLocus",
402
+ value: function getCorrespondingMeetingByLocus(data) {
403
+ var _data$locus$info, _data$locus, _data$locus$info2;
404
+ // getting meeting by correlationId. This will happen for the new event
405
+ // Either the locus
406
+ // TODO : Add check for the callBack Address
407
+ return this.meetingCollection.getByKey(_constants.LOCUS_URL, data.locusUrl) ||
408
+ // @ts-ignore
409
+ this.meetingCollection.getByKey(_constants.CORRELATION_ID,
410
+ // @ts-ignore
411
+ _util2.default.checkForCorrelationId(this.webex.internal.device.url, data.locus)) || this.meetingCollection.getByKey(_constants.SIP_URI, data.locus.self && data.locus.self.callbackInfo && data.locus.self.callbackInfo.callbackAddress) || ((_data$locus$info = data.locus.info) !== null && _data$locus$info !== void 0 && _data$locus$info.isUnifiedSpaceMeeting ? undefined : this.meetingCollection.getByKey(_constants.CONVERSATION_URL, data.locus.conversationUrl)) || this.meetingCollection.getByKey(_constants.MEETINGNUMBER, (_data$locus = data.locus) === null || _data$locus === void 0 ? void 0 : (_data$locus$info2 = _data$locus.info) === null || _data$locus$info2 === void 0 ? void 0 : _data$locus$info2.webExMeetingId);
412
+ }
413
+
414
+ /**
415
+ * handle locus events and takes meeting actions with them as they come in
416
+ * @param {Object} data a locus event
417
+ * @param {String} data.locusUrl
418
+ * @param {Object} data.locus
419
+ * @param {Boolean} useRandomDelayForInfo whether a random delay should be added to fetching meeting info
420
+ * @param {String} data.eventType
421
+ * @returns {undefined}
422
+ * @private
423
+ * @memberof Meetings
424
+ */
425
+ }, {
329
426
  key: "handleLocusEvent",
330
427
  value: function handleLocusEvent(data) {
331
- var _data$locus$info,
332
- _data$locus,
333
- _data$locus$replaces,
334
- _this2 = this;
335
-
428
+ var _data$locus2,
429
+ _data$locus2$replaces,
430
+ _this2 = this;
336
431
  var useRandomDelayForInfo = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
337
- var meeting = null; // getting meeting by correlationId. This will happen for the new event
338
- // Either the locus
339
- // TODO : Add check for the callBack Address
432
+ var meeting = this.getCorrespondingMeetingByLocus(data);
340
433
 
341
- meeting = this.meetingCollection.getByKey(_constants.LOCUS_URL, data.locusUrl) || // @ts-ignore
342
- this.meetingCollection.getByKey(_constants.CORRELATION_ID, _util2.default.checkForCorrelationId(this.webex.internal.device.url, data.locus)) || this.meetingCollection.getByKey(_constants.SIP_URI, data.locus.self && data.locus.self.callbackInfo && data.locus.self.callbackInfo.callbackAddress) || ((_data$locus$info = data.locus.info) !== null && _data$locus$info !== void 0 && _data$locus$info.isUnifiedSpaceMeeting ? undefined : this.meetingCollection.getByKey(_constants.CONVERSATION_URL, data.locus.conversationUrl)); // Special case when locus has got replaced, This only happend once if a replace locus exists
434
+ // Special case when locus has got replaced, This only happend once if a replace locus exists
343
435
  // https://sqbu-github.cisco.com/WebExSquared/locus/wiki/Locus-changing-mid-call
344
436
 
345
- if (!meeting && ((_data$locus = data.locus) === null || _data$locus === void 0 ? void 0 : (_data$locus$replaces = _data$locus.replaces) === null || _data$locus$replaces === void 0 ? void 0 : _data$locus$replaces.length) > 0) {
437
+ if (!meeting && ((_data$locus2 = data.locus) === null || _data$locus2 === void 0 ? void 0 : (_data$locus2$replaces = _data$locus2.replaces) === null || _data$locus2$replaces === void 0 ? void 0 : _data$locus2$replaces.length) > 0) {
346
438
  // Always the last element in the replace is the active one
347
439
  meeting = this.meetingCollection.getByKey(_constants.LOCUS_URL, data.locus.replaces[data.locus.replaces.length - 1].locusUrl);
348
440
  }
349
-
441
+ if (meeting && !_util2.default.isBreakoutLocusDTO(data.locus)) {
442
+ meeting.locusInfo.updateMainSessionLocusCache(data.locus);
443
+ }
444
+ if (!this.isNeedHandleLocusDTO(meeting, data.locus)) {
445
+ _loggerProxy.default.logger.log("Meetings:index#handleLocusEvent --> doesn't need to process locus event");
446
+ return;
447
+ }
350
448
  if (!meeting) {
351
449
  // TODO: create meeting when we get a meeting object
352
450
  // const checkForEnded = (locus) => {
353
451
  // TODO: you already ended the meeting but you got an event later
354
452
  // Mainly for 1:1 Callsor meeting
355
453
  // Happens mainly after refresh
454
+
356
455
  // 1:1 Meeting
357
456
  // 1) You ended a call before but you got a mercury event
358
457
  // Make sure end the call and cleanup the meeting only if the mercury
359
458
  // event says so
360
459
  // 2) Maintain lastSync time in the meetings object which helps to compare
361
460
  // If the meeting came befor or after the sync . ANy meeting start time before the sync time is invalid
461
+
362
462
  // For space Meeting
363
463
  // Check the locus object and see who has joined
464
+
364
465
  // };
365
466
  // rather then locus object change to locus url
467
+
366
468
  if (data.locus && data.locus.fullState && data.locus.fullState.state === _constants.LOCUS.STATE.INACTIVE) {
367
469
  // just ignore the event as its already ended and not active
368
470
  _loggerProxy.default.logger.warn('Meetings:index#handleLocusEvent --> Locus event received for meeting, after it was ended.');
369
-
370
471
  return;
371
- } // When its wireless share or guest and user leaves the meeting we dont have to keep the meeting object
372
- // Any future events will be neglected
472
+ }
373
473
 
474
+ // When its wireless share or guest and user leaves the meeting we dont have to keep the meeting object
475
+ // Any future events will be neglected
374
476
 
375
477
  if (data.locus && data.locus.self && data.locus.self.state === _constants._LEFT_ && data.locus.self.removed === true) {
376
478
  // just ignore the event as its already ended and not active
377
479
  _loggerProxy.default.logger.warn('Meetings:index#handleLocusEvent --> Locus event received for meeting, after it was ended.');
378
-
379
480
  return;
380
481
  }
381
-
382
482
  this.create(data.locus, _constants._LOCUS_ID_, useRandomDelayForInfo).then(function (newMeeting) {
383
- meeting = newMeeting; // It's a new meeting so initialize the locus data
483
+ meeting = newMeeting;
384
484
 
485
+ // It's a new meeting so initialize the locus data
385
486
  meeting.locusInfo.initialSetup(data.locus);
487
+ _this2.checkHandleBreakoutLocus(data.locus);
386
488
  }).catch(function (e) {
387
489
  _loggerProxy.default.logger.error(e);
388
490
  }).finally(function () {
389
491
  // There will be cases where locus event comes in gets created and deleted because its a 1:1 and meeting gets deleted
390
492
  // because the other user left so before sending 'added' event make sure it exists in the collection
493
+
391
494
  if (_this2.getMeetingByType(_constants._ID_, meeting.id)) {
392
495
  _metrics.default.postEvent({
393
496
  event: _config.eventType.REMOTE_STARTED,
@@ -396,7 +499,6 @@ var Meetings = /*#__PURE__*/function (_WebexPlugin) {
396
499
  trigger: _config.trigger.MERCURY_EVENT
397
500
  }
398
501
  });
399
-
400
502
  _triggerProxy.default.trigger(_this2, {
401
503
  file: 'meetings',
402
504
  function: 'handleLocusEvent'
@@ -413,6 +515,7 @@ var Meetings = /*#__PURE__*/function (_WebexPlugin) {
413
515
  meeting.locusInfo.parse(meeting, data);
414
516
  }
415
517
  }
518
+
416
519
  /**
417
520
  * handles locus events through mercury that are not roap
418
521
  * @param {Object} envelope
@@ -422,25 +525,23 @@ var Meetings = /*#__PURE__*/function (_WebexPlugin) {
422
525
  * @private
423
526
  * @memberof Meetings
424
527
  */
425
-
426
528
  }, {
427
529
  key: "handleLocusMercury",
428
530
  value: function handleLocusMercury(envelope) {
429
- var data = envelope.data; // eslint-disable-next-line @typescript-eslint/no-shadow
430
-
531
+ var data = envelope.data;
532
+ // eslint-disable-next-line @typescript-eslint/no-shadow
431
533
  var eventType = data.eventType;
432
-
433
534
  if (eventType && eventType !== _constants.LOCUSEVENT.MESSAGE_ROAP) {
434
535
  this.handleLocusEvent(data, true);
435
536
  }
436
537
  }
538
+
437
539
  /**
438
540
  * handles mecury offline event
439
541
  * @returns {undefined}
440
542
  * @private
441
543
  * @memberof Meetings
442
544
  */
443
-
444
545
  }, {
445
546
  key: "handleMercuryOffline",
446
547
  value: function handleMercuryOffline() {
@@ -449,77 +550,74 @@ var Meetings = /*#__PURE__*/function (_WebexPlugin) {
449
550
  function: 'handleMercuryOffline'
450
551
  }, _constants.EVENT_TRIGGERS.MEETINGS_NETWORK_DISCONNECTED);
451
552
  }
553
+
452
554
  /**
453
555
  * registers for locus and roap mercury events
454
556
  * @returns {undefined}
455
557
  * @private
456
558
  * @memberof Meetings
457
559
  */
458
-
459
560
  }, {
460
561
  key: "listenForEvents",
461
562
  value: function listenForEvents() {
462
563
  var _this3 = this;
463
-
464
564
  // @ts-ignore
465
565
  this.webex.internal.mercury.on(_constants.LOCUSEVENT.LOCUS_MERCURY, function (envelope) {
466
566
  _this3.handleLocusMercury(envelope);
467
- }); // @ts-ignore
468
-
567
+ });
568
+ // @ts-ignore
469
569
  this.webex.internal.mercury.on(_constants.ROAP.ROAP_MERCURY, function (envelope) {
470
570
  _util2.default.handleRoapMercury(envelope, _this3.meetingCollection);
471
- }); // @ts-ignore
571
+ });
472
572
 
573
+ // @ts-ignore
473
574
  this.webex.internal.mercury.on(_constants.ONLINE, function () {
474
575
  _this3.syncMeetings();
475
- }); // @ts-ignore
576
+ });
476
577
 
578
+ // @ts-ignore
477
579
  this.webex.internal.mercury.on(_constants.OFFLINE, function () {
478
580
  _this3.handleMercuryOffline();
479
581
  });
480
582
  }
583
+
481
584
  /**
482
585
  * stops listening for locus and roap mercury events
483
586
  * @returns {undefined}
484
587
  * @private
485
588
  * @memberof Meetings
486
589
  */
487
-
488
590
  }, {
489
591
  key: "stopListeningForEvents",
490
592
  value: function stopListeningForEvents() {
491
593
  // @ts-ignore
492
- this.webex.internal.mercury.off(_constants.LOCUSEVENT.LOCUS_MERCURY); // @ts-ignore
493
-
494
- this.webex.internal.mercury.off(_constants.ROAP.ROAP_MERCURY); // @ts-ignore
495
-
594
+ this.webex.internal.mercury.off(_constants.LOCUSEVENT.LOCUS_MERCURY);
595
+ // @ts-ignore
596
+ this.webex.internal.mercury.off(_constants.ROAP.ROAP_MERCURY);
597
+ // @ts-ignore
496
598
  this.webex.internal.mercury.off(_constants.ONLINE);
497
599
  }
600
+
498
601
  /**
499
602
  * @returns {undefined}
500
603
  * @private
501
604
  * @memberof Meetings
502
605
  */
503
-
504
606
  }, {
505
607
  key: "onReady",
506
608
  value: function onReady() {
507
609
  var _this4 = this;
508
-
509
610
  // @ts-ignore
510
611
  this.webex.once(_constants.READY, function () {
511
612
  // @ts-ignore
512
- _config2.default.set(_this4.config); // @ts-ignore
513
-
514
-
515
- _loggerConfig.default.set(_this4.config.logging); // @ts-ignore
516
-
517
-
613
+ _config2.default.set(_this4.config);
614
+ // @ts-ignore
615
+ _loggerConfig.default.set(_this4.config.logging);
616
+ // @ts-ignore
518
617
  _loggerProxy.default.set(_this4.webex.logger);
519
-
520
618
  mediaLogger = new MediaLogger();
619
+ (0, _internalMediaCore.setLogger)(mediaLogger);
521
620
 
522
- _internalMediaCore.MediaConnection.setLogger(mediaLogger);
523
621
  /**
524
622
  * The MeetingInfo object to interact with server
525
623
  * @instance
@@ -528,29 +626,31 @@ var Meetings = /*#__PURE__*/function (_WebexPlugin) {
528
626
  * @memberof Meetings
529
627
  */
530
628
  // @ts-ignore
531
-
532
-
533
- _this4.meetingInfo = _this4.config.experimental.enableUnifiedMeetings ? new _meetingInfoV.default(_this4.webex) : new _meetingInfo.default(_this4.webex); // @ts-ignore
534
-
629
+ _this4.meetingInfo = _this4.config.experimental.enableUnifiedMeetings ?
630
+ // @ts-ignore
631
+ new _meetingInfoV.default(_this4.webex) :
632
+ // @ts-ignore
633
+ new _meetingInfo.default(_this4.webex);
634
+ // @ts-ignore
535
635
  _this4.personalMeetingRoom = new _personalMeetingRoom.default({
536
636
  meetingInfo: _this4.meetingInfo
537
- }, {
637
+ },
638
+ // @ts-ignore
639
+ {
538
640
  parent: _this4.webex
539
641
  });
540
-
541
642
  _triggerProxy.default.trigger(_this4, {
542
643
  file: 'meetings',
543
644
  function: 'onReady'
544
645
  }, _constants.EVENT_TRIGGERS.MEETINGS_READY);
545
-
546
646
  _util2.default.checkH264Support({
547
647
  disableNotifications: true
548
- }); // @ts-ignore
549
-
550
-
648
+ });
649
+ // @ts-ignore
551
650
  _metrics.default.initialSetup(_this4.meetingCollection, _this4.webex);
552
651
  });
553
652
  }
653
+
554
654
  /**
555
655
  * API to toggle unified meetings
556
656
  * @param {Boolean} changeState
@@ -558,24 +658,22 @@ var Meetings = /*#__PURE__*/function (_WebexPlugin) {
558
658
  * @memberof Meetings
559
659
  * @returns {undefined}
560
660
  */
561
-
562
661
  }, {
563
662
  key: "_toggleUnifiedMeetings",
564
663
  value: function _toggleUnifiedMeetings(changeState) {
565
664
  var _this$config, _this$config$experime;
566
-
567
665
  if (typeof changeState !== 'boolean') {
568
666
  return;
569
- } // @ts-ignore
570
-
571
-
667
+ }
668
+ // @ts-ignore
572
669
  if (((_this$config = this.config) === null || _this$config === void 0 ? void 0 : (_this$config$experime = _this$config.experimental) === null || _this$config$experime === void 0 ? void 0 : _this$config$experime.enableUnifiedMeetings) !== changeState) {
573
670
  // @ts-ignore
574
- this.config.experimental.enableUnifiedMeetings = changeState; // @ts-ignore
575
-
671
+ this.config.experimental.enableUnifiedMeetings = changeState;
672
+ // @ts-ignore
576
673
  this.meetingInfo = changeState ? new _meetingInfoV.default(this.webex) : new _meetingInfo.default(this.webex);
577
674
  }
578
675
  }
676
+
579
677
  /**
580
678
  * API to enable or disable TURN discovery
581
679
  * @param {Boolean} enable
@@ -583,17 +681,16 @@ var Meetings = /*#__PURE__*/function (_WebexPlugin) {
583
681
  * @memberof Meetings
584
682
  * @returns {undefined}
585
683
  */
586
-
587
684
  }, {
588
685
  key: "_toggleTurnDiscovery",
589
686
  value: function _toggleTurnDiscovery(enable) {
590
687
  if (typeof enable !== 'boolean') {
591
688
  return;
592
- } // @ts-ignore
593
-
594
-
689
+ }
690
+ // @ts-ignore
595
691
  this.config.experimental.enableTurnDiscovery = enable;
596
692
  }
693
+
597
694
  /**
598
695
  * API to toggle starting adhoc meeting
599
696
  * @param {Boolean} changeState
@@ -601,22 +698,20 @@ var Meetings = /*#__PURE__*/function (_WebexPlugin) {
601
698
  * @memberof Meetings
602
699
  * @returns {undefined}
603
700
  */
604
-
605
701
  }, {
606
702
  key: "_toggleAdhocMeetings",
607
703
  value: function _toggleAdhocMeetings(changeState) {
608
704
  var _this$config2, _this$config2$experim;
609
-
610
705
  if (typeof changeState !== 'boolean') {
611
706
  return;
612
- } // @ts-ignore
613
-
614
-
707
+ }
708
+ // @ts-ignore
615
709
  if (((_this$config2 = this.config) === null || _this$config2 === void 0 ? void 0 : (_this$config2$experim = _this$config2.experimental) === null || _this$config2$experim === void 0 ? void 0 : _this$config2$experim.enableAdhocMeetings) !== changeState) {
616
710
  // @ts-ignore
617
711
  this.config.experimental.enableAdhocMeetings = changeState;
618
712
  }
619
713
  }
714
+
620
715
  /**
621
716
  * Explicitly sets up the meetings plugin by registering
622
717
  * the device, connecting to mercury, and listening for locus events.
@@ -625,56 +720,50 @@ var Meetings = /*#__PURE__*/function (_WebexPlugin) {
625
720
  * @public
626
721
  * @memberof Meetings
627
722
  */
628
-
629
723
  }, {
630
724
  key: "register",
631
725
  value: function register() {
632
726
  var _this5 = this;
633
-
634
727
  // @ts-ignore
635
728
  if (!this.webex.canAuthorize) {
636
729
  _loggerProxy.default.logger.error('Meetings:index#register --> ERROR, Unable to register, SDK cannot authorize');
637
-
638
730
  return _promise.default.reject(new Error('SDK cannot authorize'));
639
731
  }
640
-
641
732
  if (this.registered) {
642
733
  _loggerProxy.default.logger.info('Meetings:index#register --> INFO, Meetings plugin already registered');
643
-
644
734
  return _promise.default.resolve();
645
735
  }
646
-
647
736
  return _promise.default.all([this.fetchUserPreferredWebexSite(), this.getGeoHint(), this.startReachability().catch(function (error) {
648
737
  _loggerProxy.default.logger.error("Meetings:index#register --> GDM error, ".concat(error.message));
649
- }), // @ts-ignore
650
- this.webex.internal.device.register() // @ts-ignore
738
+ }),
739
+ // @ts-ignore
740
+ this.webex.internal.device.register()
741
+ // @ts-ignore
651
742
  .then(function () {
652
- return _loggerProxy.default.logger.info("Meetings:index#register --> INFO, Device registered ".concat(_this5.webex.internal.device.url));
653
- }) // @ts-ignore
743
+ return _loggerProxy.default.logger.info( // @ts-ignore
744
+ "Meetings:index#register --> INFO, Device registered ".concat(_this5.webex.internal.device.url));
745
+ })
746
+ // @ts-ignore
654
747
  .then(function () {
655
748
  return _this5.webex.internal.mercury.connect();
656
749
  }), _util2.default.checkH264Support.call(this)]).then(function () {
657
750
  _this5.listenForEvents();
658
-
659
751
  _triggerProxy.default.trigger(_this5, {
660
752
  file: 'meetings',
661
753
  function: 'register'
662
754
  }, _constants.EVENT_TRIGGERS.MEETINGS_REGISTERED);
663
-
664
755
  _this5.registered = true;
665
-
666
756
  _metrics.default.sendBehavioralMetric(_constants2.default.MEETINGS_REGISTRATION_SUCCESS);
667
757
  }).catch(function (error) {
668
758
  _loggerProxy.default.logger.error("Meetings:index#register --> ERROR, Unable to register, ".concat(error.message));
669
-
670
759
  _metrics.default.sendBehavioralMetric(_constants2.default.MEETINGS_REGISTRATION_FAILED, {
671
760
  reason: error.message,
672
761
  stack: error.stack
673
762
  });
674
-
675
763
  return _promise.default.reject(error);
676
764
  });
677
765
  }
766
+
678
767
  /**
679
768
  * Explicitly tears down the meetings plugin by deregistering
680
769
  * the device, disconnecting from mercury, and stops listening to locus events
@@ -683,32 +772,42 @@ var Meetings = /*#__PURE__*/function (_WebexPlugin) {
683
772
  * @public
684
773
  * @memberof Meetings
685
774
  */
686
-
687
775
  }, {
688
776
  key: "unregister",
689
777
  value: function unregister() {
690
778
  var _this6 = this;
691
-
692
779
  if (!this.registered) {
693
780
  _loggerProxy.default.logger.info('Meetings:index#unregister --> INFO, Meetings plugin already unregistered');
694
-
695
781
  return _promise.default.resolve();
696
782
  }
697
-
698
- this.stopListeningForEvents(); // @ts-ignore
699
-
700
- return this.webex.internal.mercury.disconnect() // @ts-ignore
701
- .then(function () {
702
- return _this6.webex.internal.device.unregister();
703
- }).then(function () {
704
- _triggerProxy.default.trigger(_this6, {
705
- file: 'meetings',
706
- function: 'unregister'
707
- }, _constants.EVENT_TRIGGERS.MEETINGS_UNREGISTERED);
708
-
709
- _this6.registered = false;
710
- });
783
+ this.stopListeningForEvents();
784
+ return (
785
+ // @ts-ignore
786
+ this.webex.internal.mercury.disconnect()
787
+ // @ts-ignore
788
+ .then(function () {
789
+ return _this6.webex.internal.device.unregister();
790
+ }).then(function () {
791
+ _triggerProxy.default.trigger(_this6, {
792
+ file: 'meetings',
793
+ function: 'unregister'
794
+ }, _constants.EVENT_TRIGGERS.MEETINGS_UNREGISTERED);
795
+ _this6.registered = false;
796
+ })
797
+ );
711
798
  }
799
+
800
+ /**
801
+ * Creates a noise reduction effect
802
+ *
803
+ * @param {INoiseReductionEffect} options optional custom effect options
804
+ * @returns {Promise<effect>} noise reduction effect.
805
+ * @public
806
+ * @memberof Meetings
807
+ */
808
+ }, {
809
+ key: "uploadLogs",
810
+ value:
712
811
  /**
713
812
  * Uploads logs to the webex services for tracking
714
813
  * @param {Object} [options={}]
@@ -721,19 +820,12 @@ var Meetings = /*#__PURE__*/function (_WebexPlugin) {
721
820
  * @param {String} [options.orgId] org id
722
821
  * @returns {String} feedback ID logs were submitted under
723
822
  */
724
-
725
- }, {
726
- key: "uploadLogs",
727
- value: function uploadLogs() {
823
+ function uploadLogs() {
728
824
  var _this7 = this;
729
-
730
825
  var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
731
-
732
826
  _loggerProxy.default.logger.info('Meetings:index#uploadLogs --> uploading logs');
733
-
734
827
  return this.loggerRequest.uploadLogs(options).then(function (uploadResult) {
735
828
  _loggerProxy.default.logger.info('Meetings:index#uploadLogs --> Upload logs for meeting completed.', uploadResult);
736
-
737
829
  _triggerProxy.default.trigger(_this7, {
738
830
  file: 'meetings',
739
831
  function: 'uploadLogs'
@@ -741,11 +833,9 @@ var Meetings = /*#__PURE__*/function (_WebexPlugin) {
741
833
  meetingId: options.meetingId,
742
834
  details: uploadResult
743
835
  });
744
-
745
836
  return uploadResult;
746
837
  }).catch(function (uploadError) {
747
838
  _loggerProxy.default.logger.error('Meetings:index#uploadLogs --> Unable to upload logs for meeting', uploadError);
748
-
749
839
  _triggerProxy.default.trigger(_this7, {
750
840
  file: 'meetings',
751
841
  function: 'uploadLogs'
@@ -753,7 +843,6 @@ var Meetings = /*#__PURE__*/function (_WebexPlugin) {
753
843
  meetingId: options.meetingId,
754
844
  reason: uploadError
755
845
  });
756
-
757
846
  _metrics.default.sendBehavioralMetric(_constants2.default.UPLOAD_LOGS_FAILURE, {
758
847
  // @ts-ignore - seems like typo
759
848
  meetingId: options.meetingsId,
@@ -763,63 +852,62 @@ var Meetings = /*#__PURE__*/function (_WebexPlugin) {
763
852
  });
764
853
  });
765
854
  }
855
+
766
856
  /**
767
857
  * initializes the reachability instance for Meetings
768
858
  * @returns {undefined}
769
859
  * @public
770
860
  * @memberof Meetings
771
861
  */
772
-
773
862
  }, {
774
863
  key: "setReachability",
775
864
  value: function setReachability() {
776
865
  // @ts-ignore
777
866
  this.reachability = new _reachability.default(this.webex);
778
867
  }
868
+
779
869
  /**
780
870
  * gets the reachability instance for Meetings
781
871
  * @returns {Reachability}
782
872
  * @public
783
873
  * @memberof Meetings
784
874
  */
785
-
786
875
  }, {
787
876
  key: "getReachability",
788
877
  value: function getReachability() {
789
878
  return this.reachability;
790
879
  }
880
+
791
881
  /**
792
882
  * initializes and starts gathering reachability for Meetings
793
883
  * @returns {Promise}
794
884
  * @public
795
885
  * @memberof Meetings
796
886
  */
797
-
798
887
  }, {
799
888
  key: "startReachability",
800
889
  value: function startReachability() {
801
890
  if (!this.reachability) {
802
891
  this.setReachability();
803
892
  }
804
-
805
893
  return this.getReachability().gatherReachability();
806
894
  }
895
+
807
896
  /**
808
897
  * Get geoHint for info for meetings
809
898
  * @returns {Promise}
810
899
  * @private
811
900
  * @memberof Meetings
812
901
  */
813
-
814
902
  }, {
815
903
  key: "getGeoHint",
816
904
  value: function getGeoHint() {
817
905
  var _this8 = this;
818
-
819
906
  return this.request.fetchGeoHint().then(function (res) {
820
907
  _this8.geoHintInfo = res;
821
908
  });
822
909
  }
910
+
823
911
  /**
824
912
  * Fetch user preferred webex site information
825
913
  * This also has other infomation about the user
@@ -827,30 +915,46 @@ var Meetings = /*#__PURE__*/function (_WebexPlugin) {
827
915
  * @private
828
916
  * @memberof Meetings
829
917
  */
830
-
831
918
  }, {
832
919
  key: "fetchUserPreferredWebexSite",
833
920
  value: function fetchUserPreferredWebexSite() {
834
921
  var _this9 = this;
835
-
836
922
  return this.request.getMeetingPreferences().then(function (res) {
837
923
  if (res) {
838
924
  _this9.preferredWebexSite = _util2.default.parseDefaultSiteFromMeetingPreferences(res);
839
925
  }
926
+
927
+ // fall back to getting the preferred site from the user information
928
+ if (!_this9.preferredWebexSite) {
929
+ // @ts-ignore
930
+ return _this9.webex.internal.user.get().then(function (user) {
931
+ var _user$userPreferences, _user$userPreferences2;
932
+ var preferredWebexSite = user === null || user === void 0 ? void 0 : (_user$userPreferences = user.userPreferences) === null || _user$userPreferences === void 0 ? void 0 : (_user$userPreferences2 = _user$userPreferences.userPreferencesItems) === null || _user$userPreferences2 === void 0 ? void 0 : _user$userPreferences2.preferredWebExSite;
933
+ if (preferredWebexSite) {
934
+ _this9.preferredWebexSite = preferredWebexSite;
935
+ } else {
936
+ throw new Error('site not found');
937
+ }
938
+ }).catch(function () {
939
+ _loggerProxy.default.logger.error('Failed to fetch preferred site from user - no site will be set');
940
+ });
941
+ }
942
+ return _promise.default.resolve();
840
943
  });
841
944
  }
945
+
842
946
  /**
843
947
  * gets the personal meeting room instance, for saved PMR values for this user
844
948
  * @returns {PersonalMeetingRoom}
845
949
  * @public
846
950
  * @memberof Meetings
847
951
  */
848
-
849
952
  }, {
850
953
  key: "getPersonalMeetingRoom",
851
954
  value: function getPersonalMeetingRoom() {
852
955
  return this.personalMeetingRoom;
853
956
  }
957
+
854
958
  /**
855
959
  * @param {Meeting} meeting
856
960
  * @param {Object} reason
@@ -859,14 +963,11 @@ var Meetings = /*#__PURE__*/function (_WebexPlugin) {
859
963
  * @private
860
964
  * @memberof Meetings
861
965
  */
862
-
863
966
  }, {
864
967
  key: "destroy",
865
968
  value: function destroy(meeting, reason) {
866
969
  _util.default.cleanUp(meeting);
867
-
868
970
  this.meetingCollection.delete(meeting.id);
869
-
870
971
  _triggerProxy.default.trigger(this, {
871
972
  file: 'meetings',
872
973
  function: 'destroy'
@@ -875,60 +976,63 @@ var Meetings = /*#__PURE__*/function (_WebexPlugin) {
875
976
  reason: reason
876
977
  });
877
978
  }
979
+
878
980
  /**
879
981
  * Create a meeting.
880
982
  * @param {string} destination - sipURL, spaceId, phonenumber, or locus object}
881
983
  * @param {string} [type] - the optional specified type, such as locusId
882
984
  * @param {Boolean} useRandomDelayForInfo - whether a random delay should be added to fetching meeting info
985
+ * @param {Object} infoExtraParams extra parameters to be provided when fetching meeting info
883
986
  * @returns {Promise<Meeting>} A new Meeting.
884
987
  * @public
885
988
  * @memberof Meetings
886
989
  */
887
-
888
990
  }, {
889
991
  key: "create",
890
992
  value: function create(destination) {
891
993
  var _this10 = this;
892
-
893
994
  var type = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null;
894
995
  var useRandomDelayForInfo = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
996
+ var infoExtraParams = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {};
895
997
  // TODO: type should be from a dictionary
998
+
896
999
  // Validate meeting information based on the provided destination and
897
1000
  // type. This must be performed prior to determining if the meeting is
898
1001
  // found in the collection, as we mutate the destination for hydra person
899
1002
  // id values.
900
- return this.meetingInfo.fetchInfoOptions(destination, type) // Catch a failure to fetch info options.
1003
+ return this.meetingInfo.fetchInfoOptions(destination, type)
1004
+ // Catch a failure to fetch info options.
901
1005
  .catch(function (error) {
902
1006
  _loggerProxy.default.logger.info("Meetings:index#create --> INFO, unable to determine info options: ".concat(error.message));
903
1007
  }).then(function () {
904
1008
  var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
905
1009
  // Normalize the destination.
906
- var targetDest = options.destination || destination; // check for the conversation URL then sip Url
1010
+ var targetDest = options.destination || destination;
907
1011
 
1012
+ // check for the conversation URL then sip Url
908
1013
  var meeting = null;
909
-
910
1014
  if (type === _constants._CONVERSATION_URL_ || options.type === _constants._CONVERSATION_URL_) {
911
1015
  var foundMeeting = _this10.meetingCollection.getByKey(_constants.CONVERSATION_URL, targetDest);
912
-
913
1016
  if (foundMeeting) {
914
- var foundMeetingIsNotCalendarMeeting = !foundMeeting.locusInfo.scheduledMeeting; // If the found meeting is not a calendar meeting, return that meeting.
915
- // This allows for the creation of instant-meetings when calendar meetings are present.
1017
+ var foundMeetingIsNotCalendarMeeting = !foundMeeting.locusInfo.scheduledMeeting;
916
1018
 
1019
+ // If the found meeting is not a calendar meeting, return that meeting.
1020
+ // This allows for the creation of instant-meetings when calendar meetings are present.
917
1021
  if (foundMeetingIsNotCalendarMeeting) {
918
1022
  meeting = foundMeeting;
919
1023
  }
920
1024
  }
921
- } // Attempt to collect the meeting if it exists.
922
-
1025
+ }
923
1026
 
1027
+ // Attempt to collect the meeting if it exists.
924
1028
  if (!meeting) {
925
1029
  meeting = _this10.meetingCollection.getByKey(_constants.SIP_URI, targetDest);
926
- } // Validate if a meeting was found.
927
-
1030
+ }
928
1031
 
1032
+ // Validate if a meeting was found.
929
1033
  if (!meeting) {
930
1034
  // Create a meeting based on the normalized destination and type.
931
- return _this10.createMeeting(targetDest, type, useRandomDelayForInfo).then(function (createdMeeting) {
1035
+ return _this10.createMeeting(targetDest, type, useRandomDelayForInfo, infoExtraParams).then(function (createdMeeting) {
932
1036
  // If the meeting was successfully created.
933
1037
  if (createdMeeting && createdMeeting.on) {
934
1038
  // Create a destruction event for the meeting.
@@ -936,7 +1040,6 @@ var Meetings = /*#__PURE__*/function (_WebexPlugin) {
936
1040
  // @ts-ignore
937
1041
  if (_this10.config.autoUploadLogs) {
938
1042
  var _createdMeeting$locus, _createdMeeting$locus2, _createdMeeting$locus3, _createdMeeting$locus4;
939
-
940
1043
  _this10.uploadLogs({
941
1044
  callStart: (_createdMeeting$locus = createdMeeting.locusInfo) === null || _createdMeeting$locus === void 0 ? void 0 : (_createdMeeting$locus2 = _createdMeeting$locus.fullState) === null || _createdMeeting$locus2 === void 0 ? void 0 : _createdMeeting$locus2.lastActive,
942
1045
  correlationId: createdMeeting.correlationId,
@@ -954,7 +1057,6 @@ var Meetings = /*#__PURE__*/function (_WebexPlugin) {
954
1057
  // @ts-ignore
955
1058
  if (_this10.config.autoUploadLogs) {
956
1059
  var _meetingInstance$locu, _meetingInstance$locu2, _meetingInstance$locu3, _meetingInstance$locu4;
957
-
958
1060
  _this10.uploadLogs({
959
1061
  callStart: meetingInstance === null || meetingInstance === void 0 ? void 0 : (_meetingInstance$locu = meetingInstance.locusInfo) === null || _meetingInstance$locu === void 0 ? void 0 : (_meetingInstance$locu2 = _meetingInstance$locu.fullState) === null || _meetingInstance$locu2 === void 0 ? void 0 : _meetingInstance$locu2.lastActive,
960
1062
  correlationId: meetingInstance.correlationId,
@@ -966,162 +1068,147 @@ var Meetings = /*#__PURE__*/function (_WebexPlugin) {
966
1068
  });
967
1069
  } else {
968
1070
  _loggerProxy.default.logger.error("Meetings:index#create --> ERROR, meeting does not have on method, will not be destroyed, meeting cleanup impossible for meeting: ".concat(meeting));
969
- } // Return the newly created meeting.
970
-
1071
+ }
971
1072
 
1073
+ // Return the newly created meeting.
972
1074
  return _promise.default.resolve(createdMeeting);
973
1075
  });
974
- } // Return the existing meeting.
975
-
1076
+ }
976
1077
 
1078
+ // Return the existing meeting.
977
1079
  return _promise.default.resolve(meeting);
978
1080
  });
979
1081
  }
1082
+
980
1083
  /**
981
1084
  * @param {String} destination see create()
982
1085
  * @param {String} type see create()
983
1086
  * @param {Boolean} useRandomDelayForInfo whether a random delay should be added to fetching meeting info
1087
+ * @param {Object} infoExtraParams extra parameters to be provided when fetching meeting info
984
1088
  * @returns {Promise} a new meeting instance complete with meeting info and destination
985
1089
  * @private
986
1090
  * @memberof Meetings
987
1091
  */
988
-
989
1092
  }, {
990
1093
  key: "createMeeting",
991
1094
  value: function () {
992
- var _createMeeting = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee(destination) {
1095
+ var _createMeeting = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee3(destination) {
993
1096
  var type,
994
- useRandomDelayForInfo,
995
- meeting,
996
- _destination$fullStat,
997
- waitingTime,
998
- startTime,
999
- startTimeDate,
1000
- startTimeDatestamp,
1001
- timeToStart,
1002
- maxWaitingTime,
1003
- isMeetingActive,
1004
- enableUnifiedMeetings,
1005
- meetingAddedType,
1006
- _args = arguments;
1007
-
1008
- return _regenerator.default.wrap(function _callee$(_context) {
1009
- while (1) {
1010
- switch (_context.prev = _context.next) {
1011
- case 0:
1012
- type = _args.length > 1 && _args[1] !== undefined ? _args[1] : null;
1013
- useRandomDelayForInfo = _args.length > 2 && _args[2] !== undefined ? _args[2] : false;
1014
- meeting = new _meeting.default({
1015
- // @ts-ignore
1016
- userId: this.webex.internal.device.userId,
1017
- // @ts-ignore
1018
- deviceUrl: this.webex.internal.device.url,
1019
- // @ts-ignore
1020
- orgId: this.webex.internal.device.orgId,
1021
- locus: type === _constants._LOCUS_ID_ ? destination : null,
1022
- // pass the locus object if present
1023
- meetingInfoProvider: this.meetingInfo,
1024
- destination: destination,
1025
- destinationType: type
1026
- }, {
1027
- // @ts-ignore
1028
- parent: this.webex
1029
- });
1030
- this.meetingCollection.set(meeting);
1031
- _context.prev = 4;
1032
- // if no participant has joined the scheduled meeting (meaning meeting is not active) and we get a locusEvent,
1033
- // it means the meeting will start in 5-6 min. In that case, we want to fetchMeetingInfo
1034
- // between 5 and 2 min (random between 3 minutes) before the meeting starts
1035
- // to avoid a spike in traffic to the wbxappi service
1036
- waitingTime = 0;
1037
-
1038
- if (destination.meeting) {
1039
- startTime = destination.meeting.startTime;
1040
- startTimeDate = new Date(startTime);
1041
- startTimeDatestamp = startTimeDate.getTime();
1042
- timeToStart = startTimeDatestamp - (0, _now.default)();
1043
- maxWaitingTime = Math.max(Math.min(timeToStart, _constants.MAX_RANDOM_DELAY_FOR_MEETING_INFO), 0);
1044
- waitingTime = Math.round(Math.random() * maxWaitingTime);
1045
- }
1046
-
1047
- isMeetingActive = !!((_destination$fullStat = destination.fullState) !== null && _destination$fullStat !== void 0 && _destination$fullStat.active); // @ts-ignore
1048
-
1049
- enableUnifiedMeetings = this.config.experimental.enableUnifiedMeetings;
1050
-
1051
- if (!(enableUnifiedMeetings && !isMeetingActive && useRandomDelayForInfo && waitingTime > 0)) {
1052
- _context.next = 14;
1053
- break;
1054
- }
1055
-
1056
- meeting.fetchMeetingInfoTimeoutId = setTimeout(function () {
1057
- return meeting.fetchMeetingInfo({});
1058
- }, waitingTime);
1059
- meeting.parseMeetingInfo(undefined, destination);
1060
- _context.next = 16;
1061
- break;
1062
-
1063
- case 14:
1064
- _context.next = 16;
1065
- return meeting.fetchMeetingInfo({});
1066
-
1067
- case 16:
1068
- _context.next = 22;
1097
+ useRandomDelayForInfo,
1098
+ infoExtraParams,
1099
+ meeting,
1100
+ _destination$fullStat,
1101
+ waitingTime,
1102
+ startTime,
1103
+ startTimeDate,
1104
+ startTimeDatestamp,
1105
+ timeToStart,
1106
+ maxWaitingTime,
1107
+ isMeetingActive,
1108
+ enableUnifiedMeetings,
1109
+ meetingAddedType,
1110
+ _args3 = arguments;
1111
+ return _regenerator.default.wrap(function _callee3$(_context3) {
1112
+ while (1) switch (_context3.prev = _context3.next) {
1113
+ case 0:
1114
+ type = _args3.length > 1 && _args3[1] !== undefined ? _args3[1] : null;
1115
+ useRandomDelayForInfo = _args3.length > 2 && _args3[2] !== undefined ? _args3[2] : false;
1116
+ infoExtraParams = _args3.length > 3 && _args3[3] !== undefined ? _args3[3] : {};
1117
+ meeting = new _meeting.default({
1118
+ // @ts-ignore
1119
+ userId: this.webex.internal.device.userId,
1120
+ // @ts-ignore
1121
+ deviceUrl: this.webex.internal.device.url,
1122
+ // @ts-ignore
1123
+ orgId: this.webex.internal.device.orgId,
1124
+ locus: type === _constants._LOCUS_ID_ ? destination : null,
1125
+ // pass the locus object if present
1126
+ meetingInfoProvider: this.meetingInfo,
1127
+ destination: destination,
1128
+ destinationType: type
1129
+ }, {
1130
+ // @ts-ignore
1131
+ parent: this.webex
1132
+ });
1133
+ this.meetingCollection.set(meeting);
1134
+ _context3.prev = 5;
1135
+ // if no participant has joined the scheduled meeting (meaning meeting is not active) and we get a locusEvent,
1136
+ // it means the meeting will start in 5-6 min. In that case, we want to fetchMeetingInfo
1137
+ // between 5 and 2 min (random between 3 minutes) before the meeting starts
1138
+ // to avoid a spike in traffic to the wbxappi service
1139
+ waitingTime = 0;
1140
+ if (destination.meeting) {
1141
+ startTime = destination.meeting.startTime;
1142
+ startTimeDate = new Date(startTime);
1143
+ startTimeDatestamp = startTimeDate.getTime();
1144
+ timeToStart = startTimeDatestamp - (0, _now.default)();
1145
+ maxWaitingTime = Math.max(Math.min(timeToStart, _constants.MAX_RANDOM_DELAY_FOR_MEETING_INFO), 0);
1146
+ waitingTime = Math.round(Math.random() * maxWaitingTime);
1147
+ }
1148
+ isMeetingActive = !!((_destination$fullStat = destination.fullState) !== null && _destination$fullStat !== void 0 && _destination$fullStat.active); // @ts-ignore
1149
+ enableUnifiedMeetings = this.config.experimental.enableUnifiedMeetings;
1150
+ if (!(enableUnifiedMeetings && !isMeetingActive && useRandomDelayForInfo && waitingTime > 0)) {
1151
+ _context3.next = 15;
1069
1152
  break;
1070
-
1071
- case 18:
1072
- _context.prev = 18;
1073
- _context.t0 = _context["catch"](4);
1074
-
1075
- if (!(_context.t0 instanceof _captchaError.default) && !(_context.t0 instanceof _passwordError.default)) {
1076
- // if there is no meeting info we assume its a 1:1 call or wireless share
1077
- _loggerProxy.default.logger.info("Meetings:index#createMeeting --> Info Unable to fetch meeting info for ".concat(destination, "."));
1078
-
1079
- _loggerProxy.default.logger.info('Meetings:index#createMeeting --> Info assuming this destination is a 1:1 or wireless share');
1080
- }
1081
-
1082
- _loggerProxy.default.logger.debug("Meetings:index#createMeeting --> Debug ".concat(_context.t0, " fetching /meetingInfo for creation."));
1083
-
1084
- case 22:
1085
- _context.prev = 22;
1086
-
1087
- // For type LOCUS_ID we need to parse the locus object to get the information
1088
- // about the caller and callee
1089
- // Meeting Added event will be created in `handleLocusEvent`
1090
- if (type !== _constants._LOCUS_ID_) {
1091
- if (!meeting.sipUri) {
1092
- meeting.setSipUri(destination);
1093
- } // TODO: check if we have to move this to parser
1094
-
1095
-
1096
- meetingAddedType = _util2.default.getMeetingAddedType(type); // We typically shouldn't need to trigger both and event and return a promise.
1097
- // Is this a special case? We want to make the public API usage as simple as possible.
1098
-
1099
- _triggerProxy.default.trigger(this, {
1100
- file: 'meetings',
1101
- function: 'createMeeting'
1102
- }, _constants.EVENT_TRIGGERS.MEETING_ADDED, {
1103
- meeting: meeting,
1104
- type: meetingAddedType
1105
- });
1153
+ }
1154
+ meeting.fetchMeetingInfoTimeoutId = setTimeout(function () {
1155
+ return meeting.fetchMeetingInfo({
1156
+ extraParams: infoExtraParams
1157
+ });
1158
+ }, waitingTime);
1159
+ meeting.parseMeetingInfo(undefined, destination);
1160
+ _context3.next = 17;
1161
+ break;
1162
+ case 15:
1163
+ _context3.next = 17;
1164
+ return meeting.fetchMeetingInfo({
1165
+ extraParams: infoExtraParams
1166
+ });
1167
+ case 17:
1168
+ _context3.next = 23;
1169
+ break;
1170
+ case 19:
1171
+ _context3.prev = 19;
1172
+ _context3.t0 = _context3["catch"](5);
1173
+ if (!(_context3.t0 instanceof _captchaError.default) && !(_context3.t0 instanceof _passwordError.default) && !(_context3.t0 instanceof _permission.default)) {
1174
+ // if there is no meeting info we assume its a 1:1 call or wireless share
1175
+ _loggerProxy.default.logger.info("Meetings:index#createMeeting --> Info Unable to fetch meeting info for ".concat(destination, "."));
1176
+ _loggerProxy.default.logger.info('Meetings:index#createMeeting --> Info assuming this destination is a 1:1 or wireless share');
1177
+ }
1178
+ _loggerProxy.default.logger.debug("Meetings:index#createMeeting --> Debug ".concat(_context3.t0, " fetching /meetingInfo for creation."));
1179
+ case 23:
1180
+ _context3.prev = 23;
1181
+ // For type LOCUS_ID we need to parse the locus object to get the information
1182
+ // about the caller and callee
1183
+ // Meeting Added event will be created in `handleLocusEvent`
1184
+ if (type !== _constants._LOCUS_ID_) {
1185
+ if (!meeting.sipUri) {
1186
+ meeting.setSipUri(destination);
1106
1187
  }
1107
1188
 
1108
- return _context.finish(22);
1109
-
1110
- case 25:
1111
- return _context.abrupt("return", meeting);
1112
-
1113
- case 26:
1114
- case "end":
1115
- return _context.stop();
1116
- }
1189
+ // TODO: check if we have to move this to parser
1190
+ meetingAddedType = _util2.default.getMeetingAddedType(type); // We typically shouldn't need to trigger both and event and return a promise.
1191
+ // Is this a special case? We want to make the public API usage as simple as possible.
1192
+ _triggerProxy.default.trigger(this, {
1193
+ file: 'meetings',
1194
+ function: 'createMeeting'
1195
+ }, _constants.EVENT_TRIGGERS.MEETING_ADDED, {
1196
+ meeting: meeting,
1197
+ type: meetingAddedType
1198
+ });
1199
+ }
1200
+ return _context3.finish(23);
1201
+ case 26:
1202
+ return _context3.abrupt("return", meeting);
1203
+ case 27:
1204
+ case "end":
1205
+ return _context3.stop();
1117
1206
  }
1118
- }, _callee, this, [[4, 18, 22, 25]]);
1207
+ }, _callee3, this, [[5, 19, 23, 26]]);
1119
1208
  }));
1120
-
1121
- function createMeeting(_x) {
1209
+ function createMeeting(_x3) {
1122
1210
  return _createMeeting.apply(this, arguments);
1123
1211
  }
1124
-
1125
1212
  return createMeeting;
1126
1213
  }()
1127
1214
  /**
@@ -1132,12 +1219,12 @@ var Meetings = /*#__PURE__*/function (_WebexPlugin) {
1132
1219
  * @public
1133
1220
  * @memberof Meetings
1134
1221
  */
1135
-
1136
1222
  }, {
1137
1223
  key: "getMeetingByType",
1138
1224
  value: function getMeetingByType(type, value) {
1139
1225
  return this.meetingCollection.getByKey(type, value);
1140
1226
  }
1227
+
1141
1228
  /**
1142
1229
  * Get all meetings.
1143
1230
  * @param {object} options
@@ -1147,7 +1234,6 @@ var Meetings = /*#__PURE__*/function (_WebexPlugin) {
1147
1234
  * @public
1148
1235
  * @memberof Meetings
1149
1236
  */
1150
-
1151
1237
  }, {
1152
1238
  key: "getAllMeetings",
1153
1239
  value: function getAllMeetings() {
@@ -1156,40 +1242,35 @@ var Meetings = /*#__PURE__*/function (_WebexPlugin) {
1156
1242
  // of meetings.
1157
1243
  return this.meetingCollection.getAll(options);
1158
1244
  }
1245
+
1159
1246
  /**
1160
1247
  * syncs all the meeting from server
1161
1248
  * @returns {undefined}
1162
1249
  * @public
1163
1250
  * @memberof Meetings
1164
1251
  */
1165
-
1166
1252
  }, {
1167
1253
  key: "syncMeetings",
1168
1254
  value: function syncMeetings() {
1169
1255
  var _this11 = this;
1170
-
1171
1256
  return this.request.getActiveMeetings().then(function (locusArray) {
1172
1257
  var activeLocusUrl = [];
1173
-
1174
1258
  if (locusArray !== null && locusArray !== void 0 && locusArray.loci && locusArray.loci.length > 0) {
1175
- locusArray.loci.forEach(function (locus) {
1259
+ var lociToUpdate = _this11.sortLocusArrayToUpdate(locusArray.loci);
1260
+ lociToUpdate.forEach(function (locus) {
1176
1261
  activeLocusUrl.push(locus.url);
1177
-
1178
1262
  _this11.handleLocusEvent({
1179
1263
  locus: locus,
1180
1264
  locusUrl: locus.url
1181
1265
  });
1182
1266
  });
1183
1267
  }
1184
-
1185
1268
  var meetingsCollection = _this11.meetingCollection.getAll();
1186
-
1187
1269
  if ((0, _keys.default)(meetingsCollection).length > 0) {
1188
1270
  // Some time the mercury event is missed after mercury reconnect
1189
1271
  // if sync returns no locus then clear all the meetings
1190
1272
  for (var _i = 0, _Object$values = (0, _values.default)(meetingsCollection); _i < _Object$values.length; _i++) {
1191
1273
  var meeting = _Object$values[_i];
1192
-
1193
1274
  // @ts-ignore
1194
1275
  if (!activeLocusUrl.includes(meeting.locusUrl)) {
1195
1276
  // destroy function also uploads logs
@@ -1198,8 +1279,83 @@ var Meetings = /*#__PURE__*/function (_WebexPlugin) {
1198
1279
  }
1199
1280
  }
1200
1281
  }
1282
+ }).catch(function (error) {
1283
+ _loggerProxy.default.logger.error("Meetings:index#syncMeetings --> failed to sync meetings, ".concat(error));
1284
+ throw new Error(error);
1285
+ });
1286
+ }
1287
+
1288
+ /**
1289
+ * sort out locus array for initial creating
1290
+ * @param {Array} loci original locus array
1291
+ * @returns {undefined}
1292
+ * @public
1293
+ * @memberof Meetings
1294
+ */
1295
+ }, {
1296
+ key: "sortLocusArrayToUpdate",
1297
+ value: function sortLocusArrayToUpdate(loci) {
1298
+ var _this12 = this;
1299
+ var mainLoci = loci.filter(function (locus) {
1300
+ return !_util2.default.isBreakoutLocusDTO(locus);
1301
+ });
1302
+ var breakoutLoci = loci.filter(function (locus) {
1303
+ return _util2.default.isValidBreakoutLocus(locus);
1304
+ });
1305
+ this.breakoutLocusForHandleLater = [];
1306
+ var lociToUpdate = (0, _toConsumableArray2.default)(mainLoci);
1307
+ breakoutLoci.forEach(function (breakoutLocus) {
1308
+ var associateMainLocus = mainLoci.find(function (mainLocus) {
1309
+ var _mainLocus$controls, _mainLocus$controls$b, _breakoutLocus$contro, _breakoutLocus$contro2;
1310
+ return ((_mainLocus$controls = mainLocus.controls) === null || _mainLocus$controls === void 0 ? void 0 : (_mainLocus$controls$b = _mainLocus$controls.breakout) === null || _mainLocus$controls$b === void 0 ? void 0 : _mainLocus$controls$b.url) === ((_breakoutLocus$contro = breakoutLocus.controls) === null || _breakoutLocus$contro === void 0 ? void 0 : (_breakoutLocus$contro2 = _breakoutLocus$contro.breakout) === null || _breakoutLocus$contro2 === void 0 ? void 0 : _breakoutLocus$contro2.url);
1311
+ });
1312
+ var existCorrespondingMeeting = _this12.getCorrespondingMeetingByLocus({
1313
+ locus: breakoutLocus,
1314
+ locusUrl: breakoutLocus.url
1315
+ });
1316
+ if (associateMainLocus && !existCorrespondingMeeting) {
1317
+ // if exists both main session and breakout session locus of the same non-exist meeting, handle main locus first,
1318
+ // after meeting create with main locus, then handle the associate breakout locus.
1319
+ // if only handle breakout locus, will miss some date
1320
+ _this12.breakoutLocusForHandleLater.push(breakoutLocus);
1321
+ } else {
1322
+ lociToUpdate.push(breakoutLocus);
1323
+ }
1201
1324
  });
1325
+ return lociToUpdate;
1202
1326
  }
1327
+
1328
+ /**
1329
+ * check breakout locus which waiting for main locus's meeting to be created, then handle the breakout locus
1330
+ * @param {Object} newCreatedLocus the locus which just create meeting object of it
1331
+ * @returns {undefined}
1332
+ * @public
1333
+ * @memberof Meetings
1334
+ */
1335
+ }, {
1336
+ key: "checkHandleBreakoutLocus",
1337
+ value: function checkHandleBreakoutLocus(newCreatedLocus) {
1338
+ if (!newCreatedLocus || !this.breakoutLocusForHandleLater || !this.breakoutLocusForHandleLater.length) {
1339
+ return;
1340
+ }
1341
+ if (_util2.default.isBreakoutLocusDTO(newCreatedLocus)) {
1342
+ return;
1343
+ }
1344
+ var existIndex = this.breakoutLocusForHandleLater.findIndex(function (breakoutLocus) {
1345
+ var _breakoutLocus$contro3, _breakoutLocus$contro4, _newCreatedLocus$cont, _newCreatedLocus$cont2;
1346
+ return ((_breakoutLocus$contro3 = breakoutLocus.controls) === null || _breakoutLocus$contro3 === void 0 ? void 0 : (_breakoutLocus$contro4 = _breakoutLocus$contro3.breakout) === null || _breakoutLocus$contro4 === void 0 ? void 0 : _breakoutLocus$contro4.url) === ((_newCreatedLocus$cont = newCreatedLocus.controls) === null || _newCreatedLocus$cont === void 0 ? void 0 : (_newCreatedLocus$cont2 = _newCreatedLocus$cont.breakout) === null || _newCreatedLocus$cont2 === void 0 ? void 0 : _newCreatedLocus$cont2.url);
1347
+ });
1348
+ if (existIndex < 0) {
1349
+ return;
1350
+ }
1351
+ var associateBreakoutLocus = this.breakoutLocusForHandleLater[existIndex];
1352
+ this.handleLocusEvent({
1353
+ locus: associateBreakoutLocus,
1354
+ locusUrl: associateBreakoutLocus.url
1355
+ });
1356
+ this.breakoutLocusForHandleLater.splice(existIndex, 1);
1357
+ }
1358
+
1203
1359
  /**
1204
1360
  * Get all scheduled meetings.
1205
1361
  * @param {object} options
@@ -1208,7 +1364,6 @@ var Meetings = /*#__PURE__*/function (_WebexPlugin) {
1208
1364
  * @returns {Object} All scheduled meetings.
1209
1365
  * @memberof Meetings
1210
1366
  */
1211
-
1212
1367
  }, {
1213
1368
  key: "getScheduledMeetings",
1214
1369
  value: function getScheduledMeetings() {
@@ -1216,11 +1371,11 @@ var Meetings = /*#__PURE__*/function (_WebexPlugin) {
1216
1371
  scheduled: true
1217
1372
  });
1218
1373
  }
1374
+
1219
1375
  /**
1220
1376
  * Get the logger instance for plugin-meetings
1221
1377
  * @returns {Logger}
1222
1378
  */
1223
-
1224
1379
  }, {
1225
1380
  key: "getLogger",
1226
1381
  value: function getLogger() {
@@ -1229,6 +1384,5 @@ var Meetings = /*#__PURE__*/function (_WebexPlugin) {
1229
1384
  }]);
1230
1385
  return Meetings;
1231
1386
  }(_webexCore.WebexPlugin);
1232
-
1233
1387
  exports.default = Meetings;
1234
1388
  //# sourceMappingURL=index.js.map