@webex/plugin-meetings 3.11.0 → 3.12.0-llmrefactor.1

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 (294) hide show
  1. package/AGENTS.md +9 -0
  2. package/dist/aiEnableRequest/index.js +197 -0
  3. package/dist/aiEnableRequest/index.js.map +1 -0
  4. package/dist/aiEnableRequest/utils.js +36 -0
  5. package/dist/aiEnableRequest/utils.js.map +1 -0
  6. package/dist/annotation/index.js +58 -13
  7. package/dist/annotation/index.js.map +1 -1
  8. package/dist/breakouts/breakout.js +8 -3
  9. package/dist/breakouts/breakout.js.map +1 -1
  10. package/dist/breakouts/events.js +29 -14
  11. package/dist/breakouts/events.js.map +1 -1
  12. package/dist/breakouts/index.js +124 -7
  13. package/dist/breakouts/index.js.map +1 -1
  14. package/dist/common/errors/webex-errors.js +49 -5
  15. package/dist/common/errors/webex-errors.js.map +1 -1
  16. package/dist/config.js +8 -3
  17. package/dist/config.js.map +1 -1
  18. package/dist/constants.js +60 -11
  19. package/dist/constants.js.map +1 -1
  20. package/dist/controls-options-manager/constants.js +11 -1
  21. package/dist/controls-options-manager/constants.js.map +1 -1
  22. package/dist/controls-options-manager/index.js +67 -29
  23. package/dist/controls-options-manager/index.js.map +1 -1
  24. package/dist/controls-options-manager/util.js +91 -0
  25. package/dist/controls-options-manager/util.js.map +1 -1
  26. package/dist/hashTree/constants.js +16 -2
  27. package/dist/hashTree/constants.js.map +1 -1
  28. package/dist/hashTree/hashTree.js +18 -0
  29. package/dist/hashTree/hashTree.js.map +1 -1
  30. package/dist/hashTree/hashTreeParser.js +1655 -538
  31. package/dist/hashTree/hashTreeParser.js.map +1 -1
  32. package/dist/hashTree/types.js +4 -2
  33. package/dist/hashTree/types.js.map +1 -1
  34. package/dist/hashTree/utils.js +52 -0
  35. package/dist/hashTree/utils.js.map +1 -1
  36. package/dist/index.js +18 -2
  37. package/dist/index.js.map +1 -1
  38. package/dist/interceptors/constant.js +12 -0
  39. package/dist/interceptors/constant.js.map +1 -0
  40. package/dist/interceptors/dataChannelAuthToken.js +332 -0
  41. package/dist/interceptors/dataChannelAuthToken.js.map +1 -0
  42. package/dist/interceptors/index.js +7 -0
  43. package/dist/interceptors/index.js.map +1 -1
  44. package/dist/interceptors/locusRetry.js +23 -8
  45. package/dist/interceptors/locusRetry.js.map +1 -1
  46. package/dist/interceptors/utils.js +27 -0
  47. package/dist/interceptors/utils.js.map +1 -0
  48. package/dist/interpretation/index.js +11 -2
  49. package/dist/interpretation/index.js.map +1 -1
  50. package/dist/interpretation/interpretation.types.js +7 -0
  51. package/dist/interpretation/interpretation.types.js.map +1 -0
  52. package/dist/interpretation/siLanguage.js +1 -1
  53. package/dist/locus-info/controlsUtils.js +9 -4
  54. package/dist/locus-info/controlsUtils.js.map +1 -1
  55. package/dist/locus-info/index.js +914 -212
  56. package/dist/locus-info/index.js.map +1 -1
  57. package/dist/locus-info/infoUtils.js +36 -5
  58. package/dist/locus-info/infoUtils.js.map +1 -1
  59. package/dist/locus-info/selfUtils.js +1 -0
  60. package/dist/locus-info/selfUtils.js.map +1 -1
  61. package/dist/locus-info/types.js +19 -0
  62. package/dist/locus-info/types.js.map +1 -1
  63. package/dist/media/MediaConnectionAwaiter.js +72 -3
  64. package/dist/media/MediaConnectionAwaiter.js.map +1 -1
  65. package/dist/media/index.js +8 -2
  66. package/dist/media/index.js.map +1 -1
  67. package/dist/media/properties.js +8 -7
  68. package/dist/media/properties.js.map +1 -1
  69. package/dist/meeting/in-meeting-actions.js +11 -1
  70. package/dist/meeting/in-meeting-actions.js.map +1 -1
  71. package/dist/meeting/index.js +2287 -1118
  72. package/dist/meeting/index.js.map +1 -1
  73. package/dist/meeting/locusMediaRequest.js +229 -82
  74. package/dist/meeting/locusMediaRequest.js.map +1 -1
  75. package/dist/meeting/muteState.js +10 -1
  76. package/dist/meeting/muteState.js.map +1 -1
  77. package/dist/meeting/request.js +55 -2
  78. package/dist/meeting/request.js.map +1 -1
  79. package/dist/meeting/request.type.js.map +1 -1
  80. package/dist/meeting/util.js +168 -5
  81. package/dist/meeting/util.js.map +1 -1
  82. package/dist/meeting-info/meeting-info-v2.js +2 -2
  83. package/dist/meeting-info/meeting-info-v2.js.map +1 -1
  84. package/dist/meetings/index.js +369 -162
  85. package/dist/meetings/index.js.map +1 -1
  86. package/dist/meetings/meetings.types.js +6 -1
  87. package/dist/meetings/meetings.types.js.map +1 -1
  88. package/dist/meetings/request.js +39 -0
  89. package/dist/meetings/request.js.map +1 -1
  90. package/dist/meetings/util.js +116 -18
  91. package/dist/meetings/util.js.map +1 -1
  92. package/dist/member/index.js +20 -0
  93. package/dist/member/index.js.map +1 -1
  94. package/dist/member/types.js.map +1 -1
  95. package/dist/member/util.js +40 -0
  96. package/dist/member/util.js.map +1 -1
  97. package/dist/members/index.js +101 -43
  98. package/dist/members/index.js.map +1 -1
  99. package/dist/members/util.js +8 -1
  100. package/dist/members/util.js.map +1 -1
  101. package/dist/metrics/constants.js +12 -1
  102. package/dist/metrics/constants.js.map +1 -1
  103. package/dist/multistream/codec/constants.js +63 -0
  104. package/dist/multistream/codec/constants.js.map +1 -0
  105. package/dist/multistream/mediaRequestManager.js +64 -68
  106. package/dist/multistream/mediaRequestManager.js.map +1 -1
  107. package/dist/multistream/receiveSlot.js +9 -0
  108. package/dist/multistream/receiveSlot.js.map +1 -1
  109. package/dist/multistream/remoteMediaManager.js +11 -0
  110. package/dist/multistream/remoteMediaManager.js.map +1 -1
  111. package/dist/multistream/sendSlotManager.js +116 -2
  112. package/dist/multistream/sendSlotManager.js.map +1 -1
  113. package/dist/reachability/clusterReachability.js.map +1 -1
  114. package/dist/reachability/index.js +139 -93
  115. package/dist/reachability/index.js.map +1 -1
  116. package/dist/reachability/reachability.types.js +2 -0
  117. package/dist/reachability/reachability.types.js.map +1 -1
  118. package/dist/reachability/util.js +45 -0
  119. package/dist/reachability/util.js.map +1 -1
  120. package/dist/reactions/reactions.type.js.map +1 -1
  121. package/dist/reconnection-manager/index.js +0 -1
  122. package/dist/reconnection-manager/index.js.map +1 -1
  123. package/dist/recording-controller/index.js +1 -3
  124. package/dist/recording-controller/index.js.map +1 -1
  125. package/dist/roap/turnDiscovery.js +8 -1
  126. package/dist/roap/turnDiscovery.js.map +1 -1
  127. package/dist/types/aiEnableRequest/index.d.ts +5 -0
  128. package/dist/types/aiEnableRequest/utils.d.ts +2 -0
  129. package/dist/types/annotation/index.d.ts +19 -0
  130. package/dist/types/common/errors/webex-errors.d.ts +32 -2
  131. package/dist/types/config.d.ts +6 -2
  132. package/dist/types/constants.d.ts +35 -1
  133. package/dist/types/controls-options-manager/constants.d.ts +6 -1
  134. package/dist/types/controls-options-manager/index.d.ts +16 -0
  135. package/dist/types/hashTree/constants.d.ts +3 -0
  136. package/dist/types/hashTree/hashTree.d.ts +7 -0
  137. package/dist/types/hashTree/hashTreeParser.d.ts +315 -30
  138. package/dist/types/hashTree/types.d.ts +3 -0
  139. package/dist/types/hashTree/utils.d.ts +24 -0
  140. package/dist/types/index.d.ts +4 -0
  141. package/dist/types/interceptors/constant.d.ts +5 -0
  142. package/dist/types/interceptors/dataChannelAuthToken.d.ts +43 -0
  143. package/dist/types/interceptors/index.d.ts +2 -1
  144. package/dist/types/interceptors/locusRetry.d.ts +4 -4
  145. package/dist/types/interceptors/utils.d.ts +1 -0
  146. package/dist/types/interpretation/interpretation.types.d.ts +10 -0
  147. package/dist/types/locus-info/index.d.ts +126 -15
  148. package/dist/types/locus-info/infoUtils.d.ts +8 -0
  149. package/dist/types/locus-info/types.d.ts +28 -1
  150. package/dist/types/media/MediaConnectionAwaiter.d.ts +20 -2
  151. package/dist/types/media/properties.d.ts +8 -3
  152. package/dist/types/meeting/in-meeting-actions.d.ts +10 -0
  153. package/dist/types/meeting/index.d.ts +271 -16
  154. package/dist/types/meeting/locusMediaRequest.d.ts +12 -0
  155. package/dist/types/meeting/request.d.ts +17 -1
  156. package/dist/types/meeting/request.type.d.ts +5 -0
  157. package/dist/types/meeting/util.d.ts +40 -0
  158. package/dist/types/meetings/index.d.ts +42 -20
  159. package/dist/types/meetings/meetings.types.d.ts +15 -0
  160. package/dist/types/meetings/request.d.ts +14 -0
  161. package/dist/types/member/index.d.ts +2 -0
  162. package/dist/types/member/types.d.ts +1 -0
  163. package/dist/types/member/util.d.ts +14 -0
  164. package/dist/types/members/index.d.ts +15 -2
  165. package/dist/types/members/util.d.ts +1 -5
  166. package/dist/types/metrics/constants.d.ts +11 -0
  167. package/dist/types/multistream/codec/constants.d.ts +7 -0
  168. package/dist/types/multistream/mediaRequestManager.d.ts +20 -26
  169. package/dist/types/multistream/sendSlotManager.d.ts +23 -1
  170. package/dist/types/reachability/clusterReachability.d.ts +3 -3
  171. package/dist/types/reachability/index.d.ts +10 -3
  172. package/dist/types/reachability/reachability.types.d.ts +7 -0
  173. package/dist/types/reachability/util.d.ts +17 -0
  174. package/dist/types/reactions/reactions.type.d.ts +4 -0
  175. package/dist/types/webinar/utils.d.ts +6 -0
  176. package/dist/webinar/index.js +611 -164
  177. package/dist/webinar/index.js.map +1 -1
  178. package/dist/webinar/utils.js +25 -0
  179. package/dist/webinar/utils.js.map +1 -0
  180. package/package.json +24 -23
  181. package/src/aiEnableRequest/README.md +84 -0
  182. package/src/aiEnableRequest/index.ts +186 -0
  183. package/src/aiEnableRequest/utils.ts +25 -0
  184. package/src/annotation/index.ts +62 -12
  185. package/src/breakouts/breakout.ts +3 -1
  186. package/src/breakouts/events.ts +33 -11
  187. package/src/breakouts/index.ts +143 -3
  188. package/src/common/errors/webex-errors.ts +50 -3
  189. package/src/config.ts +6 -2
  190. package/src/constants.ts +49 -3
  191. package/src/controls-options-manager/constants.ts +14 -1
  192. package/src/controls-options-manager/index.ts +87 -28
  193. package/src/controls-options-manager/util.ts +81 -1
  194. package/src/hashTree/constants.ts +17 -0
  195. package/src/hashTree/hashTree.ts +17 -0
  196. package/src/hashTree/hashTreeParser.ts +1482 -361
  197. package/src/hashTree/types.ts +4 -0
  198. package/src/hashTree/utils.ts +45 -0
  199. package/src/index.ts +14 -1
  200. package/src/interceptors/constant.ts +6 -0
  201. package/src/interceptors/dataChannelAuthToken.ts +217 -0
  202. package/src/interceptors/index.ts +2 -1
  203. package/src/interceptors/locusRetry.ts +25 -4
  204. package/src/interceptors/utils.ts +16 -0
  205. package/src/interpretation/index.ts +29 -11
  206. package/src/interpretation/interpretation.types.ts +11 -0
  207. package/src/locus-info/controlsUtils.ts +14 -1
  208. package/src/locus-info/index.ts +976 -203
  209. package/src/locus-info/infoUtils.ts +41 -6
  210. package/src/locus-info/selfUtils.ts +1 -0
  211. package/src/locus-info/types.ts +33 -1
  212. package/src/media/MediaConnectionAwaiter.ts +62 -5
  213. package/src/media/index.ts +10 -1
  214. package/src/media/properties.ts +11 -4
  215. package/src/meeting/in-meeting-actions.ts +20 -0
  216. package/src/meeting/index.ts +1258 -222
  217. package/src/meeting/locusMediaRequest.ts +106 -6
  218. package/src/meeting/muteState.ts +10 -1
  219. package/src/meeting/request.ts +53 -0
  220. package/src/meeting/request.type.ts +6 -0
  221. package/src/meeting/util.ts +207 -7
  222. package/src/meeting-info/meeting-info-v2.ts +4 -2
  223. package/src/meetings/index.ts +319 -117
  224. package/src/meetings/meetings.types.ts +19 -0
  225. package/src/meetings/request.ts +43 -0
  226. package/src/meetings/util.ts +117 -4
  227. package/src/member/index.ts +20 -0
  228. package/src/member/types.ts +1 -0
  229. package/src/member/util.ts +41 -0
  230. package/src/members/index.ts +70 -7
  231. package/src/members/util.ts +12 -4
  232. package/src/metrics/constants.ts +12 -0
  233. package/src/multistream/codec/constants.ts +58 -0
  234. package/src/multistream/mediaRequestManager.ts +117 -76
  235. package/src/multistream/receiveSlot.ts +18 -0
  236. package/src/multistream/remoteMediaManager.ts +13 -0
  237. package/src/multistream/sendSlotManager.ts +97 -3
  238. package/src/reachability/clusterReachability.ts +3 -2
  239. package/src/reachability/index.ts +56 -16
  240. package/src/reachability/reachability.types.ts +11 -0
  241. package/src/reachability/util.ts +36 -0
  242. package/src/reactions/reactions.type.ts +4 -0
  243. package/src/reconnection-manager/index.ts +0 -1
  244. package/src/recording-controller/index.ts +1 -2
  245. package/src/roap/turnDiscovery.ts +9 -1
  246. package/src/webinar/index.ts +415 -11
  247. package/src/webinar/utils.ts +16 -0
  248. package/test/unit/spec/aiEnableRequest/index.ts +1067 -0
  249. package/test/unit/spec/aiEnableRequest/utils.ts +130 -0
  250. package/test/unit/spec/annotation/index.ts +228 -134
  251. package/test/unit/spec/breakouts/breakout.ts +9 -3
  252. package/test/unit/spec/breakouts/events.ts +120 -2
  253. package/test/unit/spec/breakouts/index.ts +305 -18
  254. package/test/unit/spec/common/errors/webex-errors.ts +78 -0
  255. package/test/unit/spec/controls-options-manager/index.js +244 -29
  256. package/test/unit/spec/controls-options-manager/util.js +165 -0
  257. package/test/unit/spec/hashTree/hashTree.ts +66 -0
  258. package/test/unit/spec/hashTree/hashTreeParser.ts +4528 -171
  259. package/test/unit/spec/hashTree/utils.ts +125 -1
  260. package/test/unit/spec/interceptors/dataChannelAuthToken.ts +388 -0
  261. package/test/unit/spec/interceptors/locusRetry.ts +205 -4
  262. package/test/unit/spec/interceptors/utils.ts +75 -0
  263. package/test/unit/spec/interpretation/index.ts +26 -4
  264. package/test/unit/spec/locus-info/controlsUtils.js +200 -56
  265. package/test/unit/spec/locus-info/index.js +1861 -149
  266. package/test/unit/spec/locus-info/infoUtils.js +184 -1
  267. package/test/unit/spec/media/MediaConnectionAwaiter.ts +96 -1
  268. package/test/unit/spec/media/index.ts +92 -0
  269. package/test/unit/spec/media/properties.ts +35 -26
  270. package/test/unit/spec/meeting/in-meeting-actions.ts +12 -2
  271. package/test/unit/spec/meeting/index.js +3694 -450
  272. package/test/unit/spec/meeting/locusMediaRequest.ts +406 -4
  273. package/test/unit/spec/meeting/muteState.js +81 -0
  274. package/test/unit/spec/meeting/request.js +82 -0
  275. package/test/unit/spec/meeting/utils.js +595 -27
  276. package/test/unit/spec/meeting-info/meetinginfov2.js +19 -10
  277. package/test/unit/spec/meetings/index.js +1138 -86
  278. package/test/unit/spec/meetings/request.js +141 -0
  279. package/test/unit/spec/meetings/utils.js +402 -51
  280. package/test/unit/spec/member/index.js +35 -4
  281. package/test/unit/spec/member/util.js +154 -27
  282. package/test/unit/spec/members/index.js +216 -0
  283. package/test/unit/spec/members/request.js +37 -1
  284. package/test/unit/spec/members/utils.js +63 -0
  285. package/test/unit/spec/multistream/mediaRequestManager.ts +503 -122
  286. package/test/unit/spec/multistream/remoteMediaManager.ts +30 -0
  287. package/test/unit/spec/multistream/sendSlotManager.ts +135 -36
  288. package/test/unit/spec/reachability/index.ts +151 -46
  289. package/test/unit/spec/reachability/util.ts +31 -0
  290. package/test/unit/spec/reconnection-manager/index.js +4 -8
  291. package/test/unit/spec/recording-controller/index.js +9 -8
  292. package/test/unit/spec/roap/turnDiscovery.ts +20 -0
  293. package/test/unit/spec/webinar/index.ts +1087 -167
  294. package/test/unit/spec/webinar/utils.ts +39 -0
@@ -1,5 +1,6 @@
1
1
  /* eslint no-shadow: ["error", { "allow": ["eventType"] }] */
2
- import {cloneDeep, clone, set} from 'lodash';
2
+ import {cloneDeep, clone, set, once} from 'lodash';
3
+ import {WasmRuntimeProbe} from '@webex/web-capabilities';
3
4
  import '@webex/internal-plugin-mercury';
4
5
  import '@webex/internal-plugin-conversation';
5
6
  import '@webex/internal-plugin-metrics';
@@ -47,7 +48,7 @@ import {
47
48
  import BEHAVIORAL_METRICS from '../metrics/constants';
48
49
  import MeetingInfo from '../meeting-info';
49
50
  import MeetingInfoV2 from '../meeting-info/meeting-info-v2';
50
- import Meeting, {CallStateForMetrics} from '../meeting';
51
+ import Meeting, {CallStateForMetrics, storeEventForDebugging} from '../meeting';
51
52
  import PersonalMeetingRoom from '../personal-meeting-room';
52
53
  import Reachability from '../reachability';
53
54
  import Request from './request';
@@ -55,10 +56,12 @@ import PasswordError from '../common/errors/password-error';
55
56
  import CaptchaError from '../common/errors/captcha-error';
56
57
  import MeetingCollection from './collection';
57
58
  import {
59
+ FetchSitePreferencesMeViaSiteOptions,
58
60
  MEETING_KEY,
59
61
  INoiseReductionEffect,
60
62
  IVirtualBackgroundEffect,
61
63
  MeetingRegistrationStatus,
64
+ SitePreferencesResponse,
62
65
  } from './meetings.types';
63
66
  import MeetingsUtil from './util';
64
67
  import PermissionError from '../common/errors/permission';
@@ -70,6 +73,9 @@ import {HashTreeMessage} from '../hashTree/hashTreeParser';
70
73
  import {HashTreeObject} from '../hashTree/types';
71
74
  import {isSelf} from '../hashTree/utils';
72
75
 
76
+ import {createLocusFromHashTreeMessage, findMeetingForHashTreeMessage} from '../locus-info';
77
+ import {LocusDTO} from '../locus-info/types';
78
+
73
79
  let mediaLogger;
74
80
 
75
81
  class MediaLogger {
@@ -195,6 +201,8 @@ export default class Meetings extends WebexPlugin {
195
201
  preferredWebexSite: any;
196
202
  reachability: Reachability;
197
203
  registered: any;
204
+ registrationPromise: Promise<void>;
205
+ unregistrationPromise: Promise<void>;
198
206
  request: any;
199
207
  geoHintInfo: any;
200
208
  meetingInfo: any;
@@ -203,6 +211,37 @@ export default class Meetings extends WebexPlugin {
203
211
  namespace = MEETINGS;
204
212
  registrationStatus: MeetingRegistrationStatus;
205
213
 
214
+ /**
215
+ * Emits a metric describing how well this browser runs WebAssembly, used to spot browsers
216
+ * where real-time WASM effects (e.g. background noise removal) run poorly.
217
+ *
218
+ * @param {string} correlationId - correlation id to report the result against
219
+ * @returns {void}
220
+ */
221
+ private emitWasmRuntimePerformance = once((correlationId: string): void => {
222
+ // This check is designed to swallow any probe/metrics failure so it can never break meeting
223
+ // creation, while still reporting the status so we can track browsers with WASM issues.
224
+ WasmRuntimeProbe.check()
225
+ .then((result) => {
226
+ LoggerProxy.logger.log(
227
+ `Meetings:index#emitWasmRuntimePerformance --> WASM runtime performance status: ${result.status}, ratio: ${result.ratio}, wasmMs: ${result.wasmMs}, jsMs: ${result.jsMs}`
228
+ );
229
+
230
+ return Metrics.sendBehavioralMetric(BEHAVIORAL_METRICS.WASM_RUNTIME_PERFORMANCE, {
231
+ status: result.status,
232
+ ratio: result.ratio,
233
+ wasmMs: result.wasmMs,
234
+ jsMs: result.jsMs,
235
+ correlation_id: correlationId,
236
+ });
237
+ })
238
+ .catch((error) => {
239
+ LoggerProxy.logger.error(
240
+ `Meetings:index#emitWasmRuntimePerformance --> ERROR, failed to probe or report WASM runtime performance: ${error.message}`
241
+ );
242
+ });
243
+ });
244
+
206
245
  /**
207
246
  * Initializes the Meetings Plugin
208
247
  * @constructor
@@ -310,7 +349,7 @@ export default class Meetings extends WebexPlugin {
310
349
  const breakoutLocus = this.meetingCollection.getActiveBreakoutLocus(breakoutUrl);
311
350
 
312
351
  const isSelfJoined = newLocus?.self?.state === _JOINED_;
313
- const isSelfMoved = newLocus?.self?.state === _LEFT_ && newLocus?.self?.reason === _MOVED_;
352
+ const isSelfMoved = MeetingsUtil.isSelfMovedOrBreakoutEnded(newLocus);
314
353
  // @ts-ignore
315
354
  const deviceFromNewLocus = MeetingsUtil.getThisDevice(newLocus, this.webex.internal.device.url);
316
355
  const isResourceMovedOnThisDevice =
@@ -387,7 +426,7 @@ export default class Meetings extends WebexPlugin {
387
426
  private isNeedHandleLocusDTO(meeting: any, newLocus: any) {
388
427
  if (newLocus) {
389
428
  const isNewLocusAsBreakout = MeetingsUtil.isBreakoutLocusDTO(newLocus);
390
- const isSelfMoved = newLocus?.self?.state === _LEFT_ && newLocus?.self?.reason === _MOVED_;
429
+ const isSelfMoved = MeetingsUtil.isSelfMovedOrBreakoutEnded(newLocus);
391
430
  const isSelfMovedToLobby =
392
431
  newLocus?.self?.devices[0]?.intent?.reason === _ON_HOLD_LOBBY_ &&
393
432
  newLocus?.self?.devices[0]?.intent?.type === _WAIT_;
@@ -432,6 +471,17 @@ export default class Meetings extends WebexPlugin {
432
471
  if (existingMeeting) {
433
472
  return existingMeeting;
434
473
  }
474
+ if (data.eventType === LOCUSEVENT.HASH_TREE_DATA_UPDATED) {
475
+ // need to check if maybe this event indicates a move to/from breakout
476
+ const meetingForHashTreeMessage = findMeetingForHashTreeMessage(
477
+ data?.stateElementsMessage,
478
+ this.meetingCollection
479
+ );
480
+
481
+ if (meetingForHashTreeMessage) {
482
+ return meetingForHashTreeMessage;
483
+ }
484
+ }
435
485
 
436
486
  // if that didn't work, fallback to other fields like correlationId, sipUri, etc
437
487
 
@@ -475,6 +525,10 @@ export default class Meetings extends WebexPlugin {
475
525
  */
476
526
  private handleLocusEvent(data: LocusEvent, useRandomDelayForInfo = false) {
477
527
  let meeting = this.getCorrespondingMeetingByLocus(data);
528
+ // @ts-ignore
529
+ if (this.config.experimental.storeLocusHashTreeEventsForDebugging) {
530
+ storeEventForDebugging('mercury', data);
531
+ }
478
532
 
479
533
  // Special case when locus has got replaced, This only happend once if a replace locus exists
480
534
  // https://sqbu-github.cisco.com/WebExSquared/locus/wiki/Locus-changing-mid-call
@@ -489,8 +543,9 @@ export default class Meetings extends WebexPlugin {
489
543
  }
490
544
 
491
545
  if (meeting && !MeetingsUtil.isBreakoutLocusDTO(data.locus)) {
492
- meeting.locusInfo.updateMainSessionLocusCache(data.locus);
546
+ meeting.locusInfo.updateMainSessionLocusCache(data.locus); // here data.locus will never be a complete locus
493
547
  }
548
+
494
549
  if (!this.isNeedHandleLocusDTO(meeting, data.locus)) {
495
550
  LoggerProxy.logger.log(
496
551
  `Meetings:index#handleLocusEvent --> doesn't need to process locus event`
@@ -520,57 +575,65 @@ export default class Meetings extends WebexPlugin {
520
575
  // };
521
576
  // rather then locus object change to locus url
522
577
 
523
- if (data.eventType !== LOCUSEVENT.HASH_TREE_DATA_UPDATED) {
524
- if (
525
- data.locus &&
526
- data.locus.fullState &&
527
- data.locus.fullState.state === LOCUS.STATE.INACTIVE
528
- ) {
529
- // just ignore the event as its already ended and not active
530
- LoggerProxy.logger.warn(
531
- 'Meetings:index#handleLocusEvent --> Locus event received for meeting, after it was ended.'
532
- );
533
-
534
- return;
535
- }
578
+ if (data.eventType === LOCUSEVENT.HASH_TREE_DATA_UPDATED) {
579
+ // We're about to create a new meeting object from this hash tree message.
580
+ // There is some existing (pre-hash trees) SDK logic here that requires a locus object
581
+ // (at the very minimum we need locus.url to be set)
582
+ // so we try to create locus from the received hash tree message
583
+ // it will not be complete, in most cases it will only have the self part, but that's still better than nothing
584
+ const {locus} = createLocusFromHashTreeMessage(data.stateElementsMessage);
585
+
586
+ data.locus = locus;
587
+ }
536
588
 
537
- // When its wireless share or guest and user leaves the meeting we dont have to keep the meeting object
538
- // Any future events will be neglected
539
-
540
- if (
541
- data.locus &&
542
- data.locus.self &&
543
- data.locus.self.state === _LEFT_ &&
544
- data.locus.self.removed === true
545
- ) {
546
- // just ignore the event as its already ended and not active
547
- LoggerProxy.logger.warn(
548
- 'Meetings:index#handleLocusEvent --> Locus event received for meeting, after it was ended.'
549
- );
589
+ if (
590
+ data.locus &&
591
+ data.locus.fullState &&
592
+ data.locus.fullState.state === LOCUS.STATE.INACTIVE
593
+ ) {
594
+ // just ignore the event as its already ended and not active
595
+ LoggerProxy.logger.warn(
596
+ 'Meetings:index#handleLocusEvent --> Locus event received for meeting, after it was ended.'
597
+ );
550
598
 
551
- return;
552
- }
599
+ return;
553
600
  }
554
601
 
555
- if (data.eventType === LOCUSEVENT.HASH_TREE_DATA_UPDATED) {
556
- // in hash tree messages we don't ge the locus object, but the meeting constructor needs at least locus.url
557
- set(data, 'locus.url', data.stateElementsMessage.locusUrl);
602
+ // When its wireless share or guest and user leaves the meeting we dont have to keep the meeting object
603
+ // Any future events will be neglected
604
+
605
+ if (
606
+ data.locus &&
607
+ data.locus.self &&
608
+ data.locus.self.state === _LEFT_ &&
609
+ data.locus.self.removed === true
610
+ ) {
611
+ // just ignore the event as its already ended and not active
612
+ LoggerProxy.logger.warn(
613
+ 'Meetings:index#handleLocusEvent --> Locus event received for meeting, after it was ended.'
614
+ );
615
+
616
+ return;
558
617
  }
559
618
 
560
619
  this.create(data.locus, DESTINATION_TYPE.LOCUS_ID, useRandomDelayForInfo)
561
620
  .then(async (newMeeting) => {
562
621
  meeting = newMeeting;
563
-
564
622
  try {
565
623
  // It's a new meeting so initialize the locus data
566
- await meeting.locusInfo.initialSetup({
567
- trigger:
568
- data.eventType === LOCUSEVENT.SDK_LOCUS_FROM_SYNC_MEETINGS
569
- ? 'get-loci-response'
570
- : 'locus-message',
571
- locus: data.locus,
572
- hashTreeMessage: data.stateElementsMessage,
573
- });
624
+ await meeting.locusInfo.initialSetup(
625
+ {
626
+ trigger:
627
+ data.eventType === LOCUSEVENT.SDK_LOCUS_FROM_SYNC_MEETINGS
628
+ ? 'get-loci-response'
629
+ : 'locus-message',
630
+ locus: data.locus,
631
+ hashTreeMessage: data.stateElementsMessage,
632
+ },
633
+ (locus: LocusDTO) => {
634
+ meeting.finalizeMeetingAfterInitialLocusSetup(locus);
635
+ }
636
+ );
574
637
  } catch (error) {
575
638
  LoggerProxy.logger.warn(
576
639
  `Meetings:index#handleLocusEvent --> Error initializing locus data: ${error.message}`
@@ -624,7 +687,7 @@ export default class Meetings extends WebexPlugin {
624
687
  }
625
688
 
626
689
  /**
627
- * handles locus events through mercury that are not roap
690
+ * handles locus events through mercury that are not roap or approval request events
628
691
  * @param {Object} envelope
629
692
  * @param {Object} envelope.data
630
693
  * @param {String} envelope.data.eventType
@@ -637,7 +700,11 @@ export default class Meetings extends WebexPlugin {
637
700
  // eslint-disable-next-line @typescript-eslint/no-shadow
638
701
  const {eventType} = data;
639
702
 
640
- if (eventType && eventType !== LOCUSEVENT.MESSAGE_ROAP) {
703
+ if (
704
+ eventType &&
705
+ eventType !== LOCUSEVENT.MESSAGE_ROAP &&
706
+ eventType !== LOCUSEVENT.APPROVAL_REQUEST
707
+ ) {
641
708
  this.handleLocusEvent(data, true);
642
709
  }
643
710
  }
@@ -807,97 +874,82 @@ export default class Meetings extends WebexPlugin {
807
874
  }
808
875
 
809
876
  /**
810
- * API to toggle TCP reachability, needs to be called before webex.meetings.register()
811
- * @param {Boolean} newValue
812
- * @private
813
- * @memberof Meetings
814
- * @returns {undefined}
815
- */
816
- private _toggleTcpReachability(newValue: boolean) {
817
- if (typeof newValue !== 'boolean') {
818
- return;
819
- }
820
- // @ts-ignore
821
- if (this.config.experimental.enableTcpReachability !== newValue) {
822
- // @ts-ignore
823
- this.config.experimental.enableTcpReachability = newValue;
824
- }
825
- }
826
-
827
- /**
828
- * API to toggle TLS reachability, needs to be called before webex.meetings.register()
877
+ * API to toggle backend ipv6 native support config, needs to be called before webex.meetings.register()
878
+ *
829
879
  * @param {Boolean} newValue
830
880
  * @private
831
881
  * @memberof Meetings
832
882
  * @returns {undefined}
833
883
  */
834
- private _toggleTlsReachability(newValue: boolean) {
884
+ private _toggleIpv6BackendNativeSupport(newValue: boolean) {
835
885
  if (typeof newValue !== 'boolean') {
836
886
  return;
837
887
  }
838
888
  // @ts-ignore
839
- if (this.config.experimental.enableTlsReachability !== newValue) {
889
+ if (this.config.backendIpv6NativeSupport !== newValue) {
840
890
  // @ts-ignore
841
- this.config.experimental.enableTlsReachability = newValue;
891
+ this.config.backendIpv6NativeSupport = newValue;
842
892
  }
843
893
  }
844
894
 
845
895
  /**
846
- * API to toggle backend ipv6 native support config, needs to be called before webex.meetings.register()
896
+ * API to toggle usage of audio main DTX, needs to be called before webex.meetings.register()
847
897
  *
848
898
  * @param {Boolean} newValue
849
899
  * @private
850
900
  * @memberof Meetings
851
901
  * @returns {undefined}
852
902
  */
853
- private _toggleIpv6BackendNativeSupport(newValue: boolean) {
903
+ private _toggleDisableAudioMainDtx(newValue: boolean) {
854
904
  if (typeof newValue !== 'boolean') {
855
905
  return;
856
906
  }
907
+
857
908
  // @ts-ignore
858
- if (this.config.backendIpv6NativeSupport !== newValue) {
909
+ if (this.config.experimental.disableAudioMainDtx !== newValue) {
859
910
  // @ts-ignore
860
- this.config.backendIpv6NativeSupport = newValue;
911
+ this.config.experimental.disableAudioMainDtx = newValue;
861
912
  }
862
913
  }
863
914
 
864
915
  /**
865
- * API to toggle usage of audio main DTX, needs to be called before webex.meetings.register()
916
+ * API to toggle usage of audio twcc support
866
917
  *
867
918
  * @param {Boolean} newValue
868
919
  * @private
869
920
  * @memberof Meetings
870
921
  * @returns {undefined}
871
922
  */
872
- private _toggleDisableAudioMainDtx(newValue: boolean) {
923
+ private _toggleEnableAudioTwccForMultistream(newValue: boolean) {
873
924
  if (typeof newValue !== 'boolean') {
874
925
  return;
875
926
  }
876
927
 
877
928
  // @ts-ignore
878
- if (this.config.experimental.disableAudioMainDtx !== newValue) {
929
+ if (this.config.enableAudioTwccForMultistream !== newValue) {
879
930
  // @ts-ignore
880
- this.config.experimental.disableAudioMainDtx = newValue;
931
+ this.config.enableAudioTwccForMultistream = newValue;
881
932
  }
882
933
  }
883
934
 
884
935
  /**
885
- * API to toggle usage of audio twcc support
936
+ * API to toggle AV1 codec support for video slides in multistream,
937
+ * needs to be called before webex.meetings.joinWithMedia()
886
938
  *
887
939
  * @param {Boolean} newValue
888
940
  * @private
889
941
  * @memberof Meetings
890
942
  * @returns {undefined}
891
943
  */
892
- private _toggleEnableAudioTwccForMultistream(newValue: boolean) {
944
+ private _toggleEnableAv1SlidesSupport(newValue: boolean) {
893
945
  if (typeof newValue !== 'boolean') {
894
946
  return;
895
947
  }
896
948
 
897
949
  // @ts-ignore
898
- if (this.config.enableAudioTwccForMultistream !== newValue) {
950
+ if (this.config.enableAv1SlidesSupport !== newValue) {
899
951
  // @ts-ignore
900
- this.config.enableAudioTwccForMultistream = newValue;
952
+ this.config.enableAv1SlidesSupport = newValue;
901
953
  }
902
954
  }
903
955
 
@@ -929,9 +981,20 @@ export default class Meetings extends WebexPlugin {
929
981
  * @returns {Promise} A promise that resolves when the step is completed.
930
982
  */
931
983
  executeRegistrationStep(step: () => Promise<any>, stepName: string) {
932
- return step().then(() => {
933
- this.registrationStatus[stepName] = true;
934
- });
984
+ return step()
985
+ .then(() => {
986
+ LoggerProxy.logger.info(
987
+ `Meetings:index#executeRegistrationStep --> INFO, ${stepName} completed`
988
+ );
989
+ this.registrationStatus[stepName] = true;
990
+ })
991
+ .catch((error) => {
992
+ LoggerProxy.logger.error(
993
+ `Meetings:index#executeRegistrationStep --> ERROR, ${stepName} failed: ${error.message}`
994
+ );
995
+
996
+ return Promise.reject(error);
997
+ });
935
998
  }
936
999
 
937
1000
  /**
@@ -944,7 +1007,33 @@ export default class Meetings extends WebexPlugin {
944
1007
  * @memberof Meetings
945
1008
  */
946
1009
  public register(deviceRegistrationOptions?: DeviceRegistrationOptions): Promise<any> {
947
- this.registrationStatus = clone(INITIAL_REGISTRATION_STATUS);
1010
+ if (this.unregistrationPromise) {
1011
+ LoggerProxy.logger.info(
1012
+ 'Meetings:index#register --> INFO, Meetings plugin unregistration in progress, waiting to register'
1013
+ );
1014
+
1015
+ this.registrationPromise = this.unregistrationPromise
1016
+ .catch(() => {}) // It doesn't matter what happened during unregistration
1017
+ .finally(() => {
1018
+ LoggerProxy.logger.info(
1019
+ 'Meetings:index#register --> INFO, Meetings plugin unregistration completed, proceeding to register'
1020
+ );
1021
+
1022
+ this.registrationPromise = null;
1023
+
1024
+ return this.register(deviceRegistrationOptions);
1025
+ });
1026
+
1027
+ return this.registrationPromise;
1028
+ }
1029
+
1030
+ if (this.registrationPromise) {
1031
+ LoggerProxy.logger.info(
1032
+ 'Meetings:index#register --> INFO, Meetings plugin registration in progress, returning existing promise'
1033
+ );
1034
+
1035
+ return this.registrationPromise;
1036
+ }
948
1037
 
949
1038
  // @ts-ignore
950
1039
  if (!this.webex.canAuthorize) {
@@ -963,7 +1052,11 @@ export default class Meetings extends WebexPlugin {
963
1052
  return Promise.resolve();
964
1053
  }
965
1054
 
966
- return Promise.all([
1055
+ LoggerProxy.logger.info('Meetings:index#register --> INFO, Registering Meetings plugin');
1056
+
1057
+ this.registrationStatus = clone(INITIAL_REGISTRATION_STATUS);
1058
+
1059
+ this.registrationPromise = Promise.all([
967
1060
  this.executeRegistrationStep(() => this.fetchUserPreferredWebexSite(), 'fetchWebexSite'),
968
1061
  this.executeRegistrationStep(() => this.getGeoHint(), 'getGeoHint'),
969
1062
  this.executeRegistrationStep(
@@ -1022,7 +1115,12 @@ export default class Meetings extends WebexPlugin {
1022
1115
  });
1023
1116
 
1024
1117
  return Promise.reject(error);
1118
+ })
1119
+ .finally(() => {
1120
+ this.registrationPromise = null;
1025
1121
  });
1122
+
1123
+ return this.registrationPromise;
1026
1124
  }
1027
1125
 
1028
1126
  /**
@@ -1034,6 +1132,35 @@ export default class Meetings extends WebexPlugin {
1034
1132
  * @memberof Meetings
1035
1133
  */
1036
1134
  unregister() {
1135
+ if (this.unregistrationPromise) {
1136
+ LoggerProxy.logger.info(
1137
+ 'Meetings:index#unregister --> INFO, Meetings plugin unregistration in progress, returning existing promise'
1138
+ );
1139
+
1140
+ return this.unregistrationPromise;
1141
+ }
1142
+
1143
+ if (this.registrationPromise) {
1144
+ LoggerProxy.logger.info(
1145
+ 'Meetings:index#unregister --> INFO, Meetings plugin registration in progress, waiting to unregister'
1146
+ );
1147
+
1148
+ // Wait for registration to complete (success or failure), then call unregister again
1149
+ this.unregistrationPromise = this.registrationPromise
1150
+ .catch(() => {}) // It doesn't matter what happened during registration
1151
+ .finally(() => {
1152
+ LoggerProxy.logger.info(
1153
+ 'Meetings:index#unregister --> INFO, Meetings plugin registration completed, proceeding to unregister'
1154
+ );
1155
+
1156
+ this.unregistrationPromise = null;
1157
+
1158
+ return this.unregister();
1159
+ });
1160
+
1161
+ return this.unregistrationPromise;
1162
+ }
1163
+
1037
1164
  if (!this.registered) {
1038
1165
  LoggerProxy.logger.info(
1039
1166
  'Meetings:index#unregister --> INFO, Meetings plugin already unregistered'
@@ -1044,10 +1171,14 @@ export default class Meetings extends WebexPlugin {
1044
1171
 
1045
1172
  this.stopListeningForEvents();
1046
1173
 
1047
- return (
1174
+ this.unregistrationPromise =
1048
1175
  // @ts-ignore
1049
1176
  this.webex.internal.mercury
1050
- .disconnect()
1177
+ // Use code 3050 with a non-reconnecting reason to prevent Mercury auto-reconnect
1178
+ // during unregister. Without this, disconnect() defaults to code 1000/"Done" which
1179
+ // force-closes as "Done (forced)" - a normalReconnectReason that triggers auto-reconnect,
1180
+ // causing a race condition with device.unregister().
1181
+ .disconnect({code: 3050, reason: 'meetings unregister'})
1051
1182
  // @ts-ignore
1052
1183
  .then(() => this.webex.internal.device.unregister())
1053
1184
  .catch((error) => {
@@ -1077,7 +1208,11 @@ export default class Meetings extends WebexPlugin {
1077
1208
  this.registered = false;
1078
1209
  this.registrationStatus = clone(INITIAL_REGISTRATION_STATUS);
1079
1210
  })
1080
- );
1211
+ .finally(() => {
1212
+ this.unregistrationPromise = null;
1213
+ });
1214
+
1215
+ return this.unregistrationPromise;
1081
1216
  }
1082
1217
 
1083
1218
  /**
@@ -1290,6 +1425,31 @@ export default class Meetings extends WebexPlugin {
1290
1425
  return this.personalMeetingRoom;
1291
1426
  }
1292
1427
 
1428
+ /**
1429
+ * Fetches site preferences for the provided Webex site, or the preferred Webex site.
1430
+ * This is used to determine capabilities of the site, such as whether scheduling a webinar is supported.
1431
+ *
1432
+ * @param {object} [options]
1433
+ * @param {string} [options.siteUrl] - Webex site URL. Defaults to preferredWebexSite, for example "cisco.webex.com".
1434
+ * @param {string} [options.siteName] - Site name query override. Defaults to the site name derived from siteUrl, for example "cisco" for "cisco.webex.com".
1435
+ * @param {SitePreferenceSelectOption[]} [options.selectOptions] - Preference sections to fetch. Defaults to 'scheduling'.
1436
+ * @returns {Promise<SitePreferencesResponse>} site preferences response body
1437
+ * @throws {ParameterError}
1438
+ * @public
1439
+ * @memberof Meetings
1440
+ * @example
1441
+ * const preferences = await webex.meetings.fetchSitePreferencesMeViaSite();
1442
+ * const supportScheduleWebinar = preferences?.scheduling?.supportScheduleWebinar;
1443
+ */
1444
+ public fetchSitePreferencesMeViaSite(
1445
+ options: FetchSitePreferencesMeViaSiteOptions = {}
1446
+ ): Promise<SitePreferencesResponse> {
1447
+ return this.request.fetchSitePreferencesMeViaSite({
1448
+ ...options,
1449
+ siteUrl: options.siteUrl || this.preferredWebexSite,
1450
+ });
1451
+ }
1452
+
1293
1453
  /**
1294
1454
  * Returns basic information about a meeting that exists or
1295
1455
  * used to exist in the MeetingCollection
@@ -1507,6 +1667,8 @@ export default class Meetings extends WebexPlugin {
1507
1667
  });
1508
1668
  }
1509
1669
  });
1670
+
1671
+ this.emitWasmRuntimePerformance(createdMeeting.correlationId);
1510
1672
  } else {
1511
1673
  LoggerProxy.logger.error(
1512
1674
  `Meetings:index#create --> ERROR, meeting does not have on method, will not be destroyed, meeting cleanup impossible for meeting: ${meeting}`
@@ -1652,10 +1814,14 @@ export default class Meetings extends WebexPlugin {
1652
1814
  extraParams: infoExtraParams,
1653
1815
  sendCAevents: !!callStateForMetrics?.correlationId, // if client sends correlation id as argument of public create(), then it means that this meeting creation is part of a pre-join intent from user
1654
1816
  };
1817
+ const shouldDeferMeetingInfoFetch = type === DESTINATION_TYPE.LOCUS_ID && !destination?.info;
1818
+
1819
+ const isOneOnOneCallLocus =
1820
+ type === DESTINATION_TYPE.LOCUS_ID && MeetingsUtil.isOneOnOneCall(destination);
1655
1821
 
1656
1822
  if (meetingInfo) {
1657
1823
  meeting.injectMeetingInfo(meetingInfo, meetingInfoOptions, meetingLookupUrl);
1658
- } else if (type !== DESTINATION_TYPE.ONE_ON_ONE_CALL) {
1824
+ } else if (type !== DESTINATION_TYPE.ONE_ON_ONE_CALL && !isOneOnOneCallLocus) {
1659
1825
  // ignore fetchMeetingInfo for 1:1 meetings
1660
1826
  if (enableUnifiedMeetings && !isMeetingActive && useRandomDelayForInfo && waitingTime > 0) {
1661
1827
  meeting.fetchMeetingInfoTimeoutId = setTimeout(
@@ -1663,8 +1829,12 @@ export default class Meetings extends WebexPlugin {
1663
1829
  waitingTime
1664
1830
  );
1665
1831
  meeting.parseMeetingInfo(undefined, destination);
1666
- } else {
1832
+ } else if (!shouldDeferMeetingInfoFetch) {
1667
1833
  await meeting.fetchMeetingInfo(meetingInfoOptions);
1834
+ } else {
1835
+ LoggerProxy.logger.info(
1836
+ 'Meetings:index#createMeeting --> defer fetchMeetingInfo for incomplete locus, will do it after locus initialSetup'
1837
+ );
1668
1838
  }
1669
1839
  }
1670
1840
  } catch (err) {
@@ -1698,7 +1868,11 @@ export default class Meetings extends WebexPlugin {
1698
1868
  // For type LOCUS_ID we need to parse the locus object to get the information
1699
1869
  // about the caller and callee
1700
1870
  // Meeting Added event will be created in `handleLocusEvent`
1701
- if (type !== DESTINATION_TYPE.LOCUS_ID) {
1871
+ // Only emit MEETING_ADDED if the meeting still exists in the collection.
1872
+ // If fetchMeetingInfo failed and the meeting was destroyed in the catch block,
1873
+ // skip emitting to prevent orphaned meeting references on the consumer side.
1874
+ // @ts-ignore - getMeetingByType types value as object but accepts strings (same as handleLocusEvent)
1875
+ if (type !== DESTINATION_TYPE.LOCUS_ID && this.getMeetingByType(_ID_, meeting.id)) {
1702
1876
  if (!meeting.sipUri) {
1703
1877
  meeting.setSipUri(destination);
1704
1878
  }
@@ -1773,23 +1947,23 @@ export default class Meetings extends WebexPlugin {
1773
1947
  * @public
1774
1948
  * @memberof Meetings
1775
1949
  */
1776
- public syncMeetings({keepOnlyLocusMeetings = true} = {}): Promise<void> {
1950
+ public async syncMeetings({
1951
+ keepOnlyLocusMeetings = true,
1952
+ skipHashTreeSync = false,
1953
+ } = {}): Promise<void> {
1777
1954
  // @ts-ignore
1778
1955
  if (this.webex.credentials.isUnverifiedGuest) {
1779
1956
  LoggerProxy.logger.info(
1780
- 'Meetings:index#syncMeetings --> skipping meeting sync as unverified guest'
1957
+ 'Meetings:index#syncMeetings --> user is unverified guest, skipping calling Locus for meeting sync'
1781
1958
  );
1782
-
1783
- return Promise.resolve();
1784
- }
1785
-
1786
- return this.request
1787
- .getActiveMeetings()
1788
- .then((locusArray) => {
1789
- const activeLocusUrl = [];
1959
+ } else {
1960
+ try {
1961
+ const locusArray = await this.request.getActiveMeetings();
1962
+ const activeLocusUrl: string[] = [];
1790
1963
 
1791
1964
  if (locusArray?.loci && locusArray.loci.length > 0) {
1792
1965
  const lociToUpdate = this.sortLocusArrayToUpdate(locusArray.loci);
1966
+
1793
1967
  lociToUpdate.forEach((locus) => {
1794
1968
  activeLocusUrl.push(locus.url);
1795
1969
  this.handleLocusEvent({
@@ -1807,21 +1981,50 @@ export default class Meetings extends WebexPlugin {
1807
1981
  // (they had a locusUrl previously but are no longer active) in the sync
1808
1982
  for (const meeting of Object.values(meetingsCollection)) {
1809
1983
  // @ts-ignore
1810
- const {locusUrl} = meeting;
1984
+ const {locusUrl, locusInfo} = meeting;
1811
1985
  if ((keepOnlyLocusMeetings || locusUrl) && !activeLocusUrl.includes(locusUrl)) {
1812
- // destroy function also uploads logs
1813
- // @ts-ignore
1814
- this.destroy(meeting, MEETING_REMOVED_REASON.NO_MEETINGS_TO_SYNC);
1986
+ const globalMeetingId = locusInfo?.info?.globalMeetingId;
1987
+
1988
+ if (
1989
+ globalMeetingId &&
1990
+ locusArray?.loci?.some(
1991
+ (locus: LocusDTO) => locus.info?.globalMeetingId === globalMeetingId
1992
+ )
1993
+ ) {
1994
+ // don't destroy the meeting as Locus API still returned some Locus that shares
1995
+ // the same globalMeetingId - that happens for example if a webinar user (who hasn't scheduled it)
1996
+ // is in a breakout and gets moved to a different breakout while we were offline
1997
+ } else {
1998
+ // destroy function also uploads logs
1999
+ // @ts-ignore
2000
+ this.destroy(meeting, MEETING_REMOVED_REASON.NO_MEETINGS_TO_SYNC);
2001
+ }
1815
2002
  }
1816
2003
  }
1817
2004
  }
1818
- })
1819
- .catch((error) => {
2005
+ } catch (error) {
1820
2006
  LoggerProxy.logger.error(
1821
2007
  `Meetings:index#syncMeetings --> failed to sync meetings, ${error}`
1822
2008
  );
1823
- throw new Error(error);
1824
- });
2009
+ throw error;
2010
+ }
2011
+ }
2012
+
2013
+ if (!skipHashTreeSync) {
2014
+ // Trigger hash tree syncs for all remaining meetings
2015
+ const remainingMeetings = this.meetingCollection.getAll();
2016
+ const syncPromises = [];
2017
+
2018
+ for (const meeting of Object.values(remainingMeetings) as any[]) {
2019
+ if (meeting.locusInfo) {
2020
+ syncPromises.push(meeting.locusInfo.syncAllHashTreeDatasets());
2021
+ }
2022
+ }
2023
+
2024
+ if (syncPromises.length > 0) {
2025
+ await Promise.all(syncPromises);
2026
+ }
2027
+ }
1825
2028
  }
1826
2029
 
1827
2030
  /**
@@ -1837,8 +2040,8 @@ export default class Meetings extends WebexPlugin {
1837
2040
  this.breakoutLocusForHandleLater = [];
1838
2041
  const lociToUpdate = [...mainLoci];
1839
2042
  breakoutLoci.forEach((breakoutLocus) => {
1840
- const associateMainLocus = mainLoci.find(
1841
- (mainLocus) => mainLocus.controls?.breakout?.url === breakoutLocus.controls?.breakout?.url
2043
+ const associateMainLocus = mainLoci.find((mainLocus) =>
2044
+ MeetingsUtil.isMainAssociatedWithBreakout(mainLocus, breakoutLocus)
1842
2045
  );
1843
2046
  const existCorrespondingMeeting = this.getCorrespondingMeetingByLocus({
1844
2047
  eventType: LOCUSEVENT.SDK_NO_EVENT,
@@ -1866,7 +2069,7 @@ export default class Meetings extends WebexPlugin {
1866
2069
  * @public
1867
2070
  * @memberof Meetings
1868
2071
  */
1869
- checkHandleBreakoutLocus(newCreatedLocus) {
2072
+ checkHandleBreakoutLocus(newCreatedLocus: any) {
1870
2073
  if (
1871
2074
  !newCreatedLocus ||
1872
2075
  !this.breakoutLocusForHandleLater ||
@@ -1877,9 +2080,8 @@ export default class Meetings extends WebexPlugin {
1877
2080
  if (MeetingsUtil.isBreakoutLocusDTO(newCreatedLocus)) {
1878
2081
  return;
1879
2082
  }
1880
- const existIndex = this.breakoutLocusForHandleLater.findIndex(
1881
- (breakoutLocus) =>
1882
- breakoutLocus.controls?.breakout?.url === newCreatedLocus.controls?.breakout?.url
2083
+ const existIndex = this.breakoutLocusForHandleLater.findIndex((breakoutLocus: any) =>
2084
+ MeetingsUtil.isMainAssociatedWithBreakout(newCreatedLocus, breakoutLocus)
1883
2085
  );
1884
2086
 
1885
2087
  if (existIndex < 0) {
@@ -1888,7 +2090,7 @@ export default class Meetings extends WebexPlugin {
1888
2090
 
1889
2091
  const associateBreakoutLocus = this.breakoutLocusForHandleLater[existIndex];
1890
2092
  this.handleLocusEvent({
1891
- eventType: LOCUSEVENT.SDK_NO_EVENT,
2093
+ eventType: LOCUSEVENT.SDK_LOCUS_FROM_SYNC_MEETINGS,
1892
2094
  locus: associateBreakoutLocus,
1893
2095
  locusUrl: associateBreakoutLocus.url,
1894
2096
  });