@webex/plugin-meetings 3.12.0 → 3.13.0-next.10

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 (354) hide show
  1. package/.sdd/manifest.json +1312 -0
  2. package/.sdd/templates/.source.json +30 -0
  3. package/.sdd/templates/component-repo/module-docs/module-spec-quality.md +111 -0
  4. package/.sdd/templates/component-repo/module-docs/module-spec.template.md +321 -0
  5. package/.sdd/templates/component-repo/reference-docs/adr/_adr-example.md +59 -0
  6. package/.sdd/templates/component-repo/reference-docs/patterns/_pattern-example.md +49 -0
  7. package/.sdd/templates/component-repo/reference-docs/rules/_rule-example.md +42 -0
  8. package/.sdd/templates/component-repo/standing-docs/AGENTS.template.md +120 -0
  9. package/.sdd/templates/component-repo/standing-docs/ARCHITECTURE.template.md +206 -0
  10. package/.sdd/templates/component-repo/standing-docs/CONTRACTS.template.md +90 -0
  11. package/.sdd/templates/component-repo/standing-docs/DATA_MODEL.template.md +68 -0
  12. package/.sdd/templates/component-repo/standing-docs/GETTING_STARTED.template.md +111 -0
  13. package/.sdd/templates/component-repo/standing-docs/GLOSSARY.template.md +57 -0
  14. package/.sdd/templates/component-repo/standing-docs/REVIEW_CHECKLIST.template.md +69 -0
  15. package/.sdd/templates/component-repo/standing-docs/RULES.template.md +96 -0
  16. package/.sdd/templates/component-repo/standing-docs/SECURITY.template.md +84 -0
  17. package/.sdd/templates/component-repo/standing-docs/SERVICE_STATE.template.md +82 -0
  18. package/.sdd/templates/component-repo/standing-docs/SPEC_INDEX.template.md +94 -0
  19. package/.sdd/templates/component-repo/standing-docs/TEST_INDEX.template.md +64 -0
  20. package/.sdd/templates/component-repo/template-map.json +112 -0
  21. package/AGENTS.md +135 -0
  22. package/ai-docs/ARCHITECTURE.md +208 -0
  23. package/ai-docs/CONTRACTS.md +267 -0
  24. package/ai-docs/DATA_MODEL.md +64 -0
  25. package/ai-docs/GETTING_STARTED.md +73 -0
  26. package/ai-docs/GLOSSARY.md +56 -0
  27. package/ai-docs/REVIEW_CHECKLIST.md +45 -0
  28. package/ai-docs/RULES.md +79 -0
  29. package/ai-docs/SECURITY.md +74 -0
  30. package/ai-docs/SERVICE_STATE.md +59 -0
  31. package/ai-docs/SPEC_INDEX.md +85 -0
  32. package/ai-docs/TEST_INDEX.md +45 -0
  33. package/ai-docs/adr/0001-migrate-existing-docs-into-sdd.md +61 -0
  34. package/ai-docs/patterns/defensive-error-propagation.md +55 -0
  35. package/ai-docs/patterns/event-scope-emission.md +46 -0
  36. package/ai-docs/patterns/source-to-test-path-mirroring.md +45 -0
  37. package/ai-docs/patterns/stateless-plugin-request-classes.md +53 -0
  38. package/ai-docs/patterns/typed-constants-and-enum-values.md +47 -0
  39. package/assets/README.md +28 -0
  40. package/assets/e2ee-0.0.1.js +2 -0
  41. package/assets/e2ee-0.0.1.wasm +0 -0
  42. package/babel.config.js +17 -1
  43. package/dist/aiEnableRequest/index.js +15 -2
  44. package/dist/aiEnableRequest/index.js.map +1 -1
  45. package/dist/annotation/index.js +55 -19
  46. package/dist/annotation/index.js.map +1 -1
  47. package/dist/assets/e2ee-0.0.1.js +2 -0
  48. package/dist/assets/e2ee-0.0.1.wasm +0 -0
  49. package/dist/breakouts/breakout.js +8 -3
  50. package/dist/breakouts/breakout.js.map +1 -1
  51. package/dist/breakouts/events.js +29 -14
  52. package/dist/breakouts/events.js.map +1 -1
  53. package/dist/breakouts/index.js +128 -7
  54. package/dist/breakouts/index.js.map +1 -1
  55. package/dist/common/errors/webex-errors.js +54 -5
  56. package/dist/common/errors/webex-errors.js.map +1 -1
  57. package/dist/common/wasm-loader.js +174 -0
  58. package/dist/common/wasm-loader.js.map +1 -0
  59. package/dist/config.js +5 -2
  60. package/dist/config.js.map +1 -1
  61. package/dist/constants.js +39 -11
  62. package/dist/constants.js.map +1 -1
  63. package/dist/controls-options-manager/constants.js +11 -1
  64. package/dist/controls-options-manager/constants.js.map +1 -1
  65. package/dist/controls-options-manager/index.js +67 -29
  66. package/dist/controls-options-manager/index.js.map +1 -1
  67. package/dist/controls-options-manager/util.js +91 -0
  68. package/dist/controls-options-manager/util.js.map +1 -1
  69. package/dist/e2ee/E2eeManager.js +91 -0
  70. package/dist/e2ee/E2eeManager.js.map +1 -0
  71. package/dist/e2ee/E2eeSignaling.js +200 -0
  72. package/dist/e2ee/E2eeSignaling.js.map +1 -0
  73. package/dist/e2ee/MediaEncryptionService.js +75 -0
  74. package/dist/e2ee/MediaEncryptionService.js.map +1 -0
  75. package/dist/e2ee/mls.js +558 -0
  76. package/dist/e2ee/mls.js.map +1 -0
  77. package/dist/e2ee/types.js +59 -0
  78. package/dist/e2ee/types.js.map +1 -0
  79. package/dist/e2ee/wasm.d.js +7 -0
  80. package/dist/e2ee/wasm.d.js.map +1 -0
  81. package/dist/hashTree/constants.js +13 -1
  82. package/dist/hashTree/constants.js.map +1 -1
  83. package/dist/hashTree/hashTreeParser.js +1245 -404
  84. package/dist/hashTree/hashTreeParser.js.map +1 -1
  85. package/dist/hashTree/utils.js +42 -0
  86. package/dist/hashTree/utils.js.map +1 -1
  87. package/dist/index.js +8 -0
  88. package/dist/index.js.map +1 -1
  89. package/dist/interceptors/dataChannelAuthToken.js +58 -16
  90. package/dist/interceptors/dataChannelAuthToken.js.map +1 -1
  91. package/dist/interceptors/locusRetry.js +24 -9
  92. package/dist/interceptors/locusRetry.js.map +1 -1
  93. package/dist/interpretation/index.js +55 -12
  94. package/dist/interpretation/index.js.map +1 -1
  95. package/dist/interpretation/interpretation.types.js +7 -0
  96. package/dist/interpretation/interpretation.types.js.map +1 -0
  97. package/dist/interpretation/siLanguage.js +1 -1
  98. package/dist/locus-info/controlsUtils.js +4 -1
  99. package/dist/locus-info/controlsUtils.js.map +1 -1
  100. package/dist/locus-info/index.js +914 -196
  101. package/dist/locus-info/index.js.map +1 -1
  102. package/dist/locus-info/infoUtils.js +36 -5
  103. package/dist/locus-info/infoUtils.js.map +1 -1
  104. package/dist/locus-info/types.js +20 -0
  105. package/dist/locus-info/types.js.map +1 -1
  106. package/dist/media/MediaConnectionAwaiter.js +229 -166
  107. package/dist/media/MediaConnectionAwaiter.js.map +1 -1
  108. package/dist/media/index.js +8 -2
  109. package/dist/media/index.js.map +1 -1
  110. package/dist/media/properties.js +4 -5
  111. package/dist/media/properties.js.map +1 -1
  112. package/dist/meeting/in-meeting-actions.js +5 -1
  113. package/dist/meeting/in-meeting-actions.js.map +1 -1
  114. package/dist/meeting/index.js +1931 -887
  115. package/dist/meeting/index.js.map +1 -1
  116. package/dist/meeting/locusMediaRequest.js +229 -82
  117. package/dist/meeting/locusMediaRequest.js.map +1 -1
  118. package/dist/meeting/muteState.js +10 -1
  119. package/dist/meeting/muteState.js.map +1 -1
  120. package/dist/meeting/request.js +5 -2
  121. package/dist/meeting/request.js.map +1 -1
  122. package/dist/meeting/util.js +42 -3
  123. package/dist/meeting/util.js.map +1 -1
  124. package/dist/meeting/voicea-meeting.js +2 -1
  125. package/dist/meeting/voicea-meeting.js.map +1 -1
  126. package/dist/meeting-info/meeting-info-v2.js +12 -5
  127. package/dist/meeting-info/meeting-info-v2.js.map +1 -1
  128. package/dist/meetings/index.js +342 -129
  129. package/dist/meetings/index.js.map +1 -1
  130. package/dist/meetings/meetings.types.js +6 -1
  131. package/dist/meetings/meetings.types.js.map +1 -1
  132. package/dist/meetings/request.js +39 -0
  133. package/dist/meetings/request.js.map +1 -1
  134. package/dist/meetings/util.js +116 -18
  135. package/dist/meetings/util.js.map +1 -1
  136. package/dist/member/index.js +10 -0
  137. package/dist/member/index.js.map +1 -1
  138. package/dist/member/types.js.map +1 -1
  139. package/dist/member/util.js +30 -0
  140. package/dist/member/util.js.map +1 -1
  141. package/dist/members/index.js +101 -43
  142. package/dist/members/index.js.map +1 -1
  143. package/dist/members/util.js +8 -1
  144. package/dist/members/util.js.map +1 -1
  145. package/dist/metrics/constants.js +11 -1
  146. package/dist/metrics/constants.js.map +1 -1
  147. package/dist/multistream/codec/constants.js +63 -0
  148. package/dist/multistream/codec/constants.js.map +1 -0
  149. package/dist/multistream/mediaRequestManager.js +62 -15
  150. package/dist/multistream/mediaRequestManager.js.map +1 -1
  151. package/dist/multistream/receiveSlot.js +9 -0
  152. package/dist/multistream/receiveSlot.js.map +1 -1
  153. package/dist/multistream/remoteMediaManager.js +32 -4
  154. package/dist/multistream/remoteMediaManager.js.map +1 -1
  155. package/dist/multistream/sendSlotManager.js +127 -3
  156. package/dist/multistream/sendSlotManager.js.map +1 -1
  157. package/dist/reachability/clusterReachability.js.map +1 -1
  158. package/dist/reachability/index.js +121 -83
  159. package/dist/reachability/index.js.map +1 -1
  160. package/dist/reachability/reachability.types.js +2 -0
  161. package/dist/reachability/reachability.types.js.map +1 -1
  162. package/dist/reachability/util.js +45 -0
  163. package/dist/reachability/util.js.map +1 -1
  164. package/dist/reactions/reactions.type.js.map +1 -1
  165. package/dist/recording-controller/index.js +1 -3
  166. package/dist/recording-controller/index.js.map +1 -1
  167. package/dist/roap/turnDiscovery.js +8 -1
  168. package/dist/roap/turnDiscovery.js.map +1 -1
  169. package/dist/types/annotation/index.d.ts +19 -0
  170. package/dist/types/common/errors/webex-errors.d.ts +36 -2
  171. package/dist/types/common/wasm-loader.d.ts +55 -0
  172. package/dist/types/config.d.ts +5 -2
  173. package/dist/types/constants.d.ts +15 -2
  174. package/dist/types/controls-options-manager/constants.d.ts +6 -1
  175. package/dist/types/controls-options-manager/index.d.ts +16 -0
  176. package/dist/types/e2ee/E2eeManager.d.ts +23 -0
  177. package/dist/types/e2ee/E2eeSignaling.d.ts +94 -0
  178. package/dist/types/e2ee/MediaEncryptionService.d.ts +27 -0
  179. package/dist/types/e2ee/mls.d.ts +191 -0
  180. package/dist/types/e2ee/types.d.ts +104 -0
  181. package/dist/types/hashTree/constants.d.ts +2 -0
  182. package/dist/types/hashTree/hashTreeParser.d.ts +230 -18
  183. package/dist/types/hashTree/utils.d.ts +18 -0
  184. package/dist/types/index.d.ts +4 -0
  185. package/dist/types/interceptors/locusRetry.d.ts +4 -4
  186. package/dist/types/interpretation/interpretation.types.d.ts +10 -0
  187. package/dist/types/locus-info/index.d.ts +151 -15
  188. package/dist/types/locus-info/infoUtils.d.ts +8 -0
  189. package/dist/types/locus-info/types.d.ts +28 -1
  190. package/dist/types/media/MediaConnectionAwaiter.d.ts +66 -49
  191. package/dist/types/media/properties.d.ts +6 -2
  192. package/dist/types/meeting/in-meeting-actions.d.ts +4 -0
  193. package/dist/types/meeting/index.d.ts +247 -13
  194. package/dist/types/meeting/locusMediaRequest.d.ts +12 -0
  195. package/dist/types/meeting/request.d.ts +1 -0
  196. package/dist/types/meeting/util.d.ts +12 -1
  197. package/dist/types/meeting-info/meeting-info-v2.d.ts +1 -0
  198. package/dist/types/meetings/index.d.ts +44 -19
  199. package/dist/types/meetings/meetings.types.d.ts +15 -0
  200. package/dist/types/meetings/request.d.ts +14 -0
  201. package/dist/types/member/index.d.ts +1 -0
  202. package/dist/types/member/types.d.ts +1 -0
  203. package/dist/types/member/util.d.ts +9 -0
  204. package/dist/types/members/index.d.ts +15 -2
  205. package/dist/types/members/util.d.ts +1 -5
  206. package/dist/types/metrics/constants.d.ts +10 -0
  207. package/dist/types/multistream/codec/constants.d.ts +7 -0
  208. package/dist/types/multistream/mediaRequestManager.d.ts +22 -5
  209. package/dist/types/multistream/remoteMediaManager.d.ts +18 -0
  210. package/dist/types/multistream/sendSlotManager.d.ts +28 -2
  211. package/dist/types/reachability/clusterReachability.d.ts +3 -3
  212. package/dist/types/reachability/index.d.ts +10 -3
  213. package/dist/types/reachability/reachability.types.d.ts +7 -0
  214. package/dist/types/reachability/util.d.ts +17 -0
  215. package/dist/types/reactions/reactions.type.d.ts +3 -0
  216. package/dist/webinar/index.js +539 -245
  217. package/dist/webinar/index.js.map +1 -1
  218. package/package.json +26 -24
  219. package/src/aiEnableRequest/ai-docs/ai-enable-request-spec.md +223 -0
  220. package/src/aiEnableRequest/index.ts +16 -0
  221. package/src/annotation/ai-docs/annotation-spec.md +236 -0
  222. package/src/annotation/index.ts +61 -29
  223. package/src/breakouts/ai-docs/breakouts-spec.md +324 -0
  224. package/src/breakouts/breakout.ts +3 -1
  225. package/src/breakouts/events.ts +33 -11
  226. package/src/breakouts/index.ts +145 -3
  227. package/src/common/errors/webex-errors.ts +56 -3
  228. package/src/common/wasm-loader.ts +124 -0
  229. package/src/config.ts +9 -3
  230. package/src/constants.ts +23 -4
  231. package/src/controls-options-manager/ai-docs/controls-options-manager-spec.md +243 -0
  232. package/src/controls-options-manager/constants.ts +14 -1
  233. package/src/controls-options-manager/index.ts +87 -28
  234. package/src/controls-options-manager/util.ts +81 -1
  235. package/src/e2ee/E2eeManager.ts +58 -0
  236. package/src/e2ee/E2eeSignaling.ts +215 -0
  237. package/src/e2ee/MediaEncryptionService.ts +41 -0
  238. package/src/e2ee/mls.ts +548 -0
  239. package/src/e2ee/types.ts +114 -0
  240. package/src/e2ee/wasm.d.ts +153 -0
  241. package/src/hashTree/ai-docs/hash-tree-spec.md +267 -0
  242. package/src/hashTree/constants.ts +16 -0
  243. package/src/hashTree/hashTreeParser.ts +1021 -214
  244. package/src/hashTree/utils.ts +36 -0
  245. package/src/index.ts +7 -0
  246. package/src/interceptors/ai-docs/interceptors-spec.md +247 -0
  247. package/src/interceptors/dataChannelAuthToken.ts +59 -12
  248. package/src/interceptors/locusRetry.ts +26 -5
  249. package/src/interpretation/ai-docs/interpretation-spec.md +256 -0
  250. package/src/interpretation/index.ts +65 -10
  251. package/src/interpretation/interpretation.types.ts +11 -0
  252. package/src/locus-info/ai-docs/locus-info-spec.md +293 -0
  253. package/src/locus-info/controlsUtils.ts +3 -1
  254. package/src/locus-info/index.ts +907 -184
  255. package/src/locus-info/infoUtils.ts +41 -6
  256. package/src/locus-info/types.ts +33 -1
  257. package/src/media/MediaConnectionAwaiter.ts +229 -196
  258. package/src/media/ai-docs/media-spec.md +267 -0
  259. package/src/media/index.ts +10 -1
  260. package/src/media/properties.ts +8 -3
  261. package/src/meeting/ai-docs/meeting-spec.md +404 -0
  262. package/src/meeting/in-meeting-actions.ts +8 -0
  263. package/src/meeting/index.ts +1237 -254
  264. package/src/meeting/locusMediaRequest.ts +106 -6
  265. package/src/meeting/muteState.ts +10 -1
  266. package/src/meeting/request.ts +11 -0
  267. package/src/meeting/util.ts +53 -8
  268. package/src/meeting/voicea-meeting.ts +1 -1
  269. package/src/meeting-info/ai-docs/meeting-info-spec.md +261 -0
  270. package/src/meeting-info/meeting-info-v2.ts +11 -4
  271. package/src/meetings/ai-docs/meetings-spec.md +298 -0
  272. package/src/meetings/index.ts +242 -80
  273. package/src/meetings/meetings.types.ts +19 -0
  274. package/src/meetings/request.ts +43 -0
  275. package/src/meetings/util.ts +117 -4
  276. package/src/member/ai-docs/member-spec.md +196 -0
  277. package/src/member/index.ts +10 -0
  278. package/src/member/types.ts +1 -0
  279. package/src/member/util.ts +29 -0
  280. package/src/members/ai-docs/members-spec.md +256 -0
  281. package/src/members/index.ts +70 -7
  282. package/src/members/util.ts +12 -4
  283. package/src/metrics/ai-docs/metrics-spec.md +185 -0
  284. package/src/metrics/constants.ts +11 -0
  285. package/src/multistream/ai-docs/multistream-spec.md +295 -0
  286. package/src/multistream/codec/constants.ts +58 -0
  287. package/src/multistream/mediaRequestManager.ts +119 -28
  288. package/src/multistream/receiveSlot.ts +18 -0
  289. package/src/multistream/remoteMediaManager.ts +23 -1
  290. package/src/multistream/sendSlotManager.ts +112 -4
  291. package/src/personal-meeting-room/ai-docs/personal-meeting-room-spec.md +234 -0
  292. package/src/reachability/ai-docs/reachability-spec.md +261 -0
  293. package/src/reachability/clusterReachability.ts +3 -2
  294. package/src/reachability/index.ts +47 -16
  295. package/src/reachability/reachability.types.ts +11 -0
  296. package/src/reachability/util.ts +36 -0
  297. package/src/reactions/ai-docs/reactions-spec.md +198 -0
  298. package/src/reactions/reactions.type.ts +3 -0
  299. package/src/reconnection-manager/ai-docs/reconnection-manager-spec.md +272 -0
  300. package/src/recording-controller/ai-docs/recording-controller-spec.md +223 -0
  301. package/src/recording-controller/index.ts +1 -2
  302. package/src/roap/ai-docs/roap-spec.md +241 -0
  303. package/src/roap/turnDiscovery.ts +9 -1
  304. package/src/webinar/ai-docs/webinar-spec.md +243 -0
  305. package/src/webinar/index.ts +333 -73
  306. package/test/unit/spec/aiEnableRequest/index.ts +86 -0
  307. package/test/unit/spec/annotation/index.ts +214 -182
  308. package/test/unit/spec/breakouts/breakout.ts +9 -3
  309. package/test/unit/spec/breakouts/events.ts +120 -2
  310. package/test/unit/spec/breakouts/index.ts +336 -15
  311. package/test/unit/spec/common/errors/webex-errors.ts +78 -0
  312. package/test/unit/spec/common/wasm-loader.ts +171 -0
  313. package/test/unit/spec/controls-options-manager/index.js +244 -29
  314. package/test/unit/spec/controls-options-manager/util.js +165 -0
  315. package/test/unit/spec/e2ee/E2eeManager.ts +82 -0
  316. package/test/unit/spec/e2ee/E2eeSignaling.ts +172 -0
  317. package/test/unit/spec/e2ee/MediaEncryptionService.ts +43 -0
  318. package/test/unit/spec/e2ee/mls.ts +765 -0
  319. package/test/unit/spec/hashTree/hashTreeParser.ts +3126 -238
  320. package/test/unit/spec/hashTree/utils.ts +125 -1
  321. package/test/unit/spec/interceptors/dataChannelAuthToken.ts +179 -1
  322. package/test/unit/spec/interceptors/locusRetry.ts +234 -5
  323. package/test/unit/spec/interpretation/index.ts +119 -4
  324. package/test/unit/spec/locus-info/controlsUtils.js +172 -57
  325. package/test/unit/spec/locus-info/index.js +1880 -136
  326. package/test/unit/spec/locus-info/infoUtils.js +184 -1
  327. package/test/unit/spec/media/MediaConnectionAwaiter.ts +479 -17
  328. package/test/unit/spec/media/index.ts +92 -0
  329. package/test/unit/spec/media/properties.ts +26 -26
  330. package/test/unit/spec/meeting/in-meeting-actions.ts +4 -0
  331. package/test/unit/spec/meeting/index.js +3697 -501
  332. package/test/unit/spec/meeting/locusMediaRequest.ts +406 -4
  333. package/test/unit/spec/meeting/muteState.js +81 -0
  334. package/test/unit/spec/meeting/request.js +12 -0
  335. package/test/unit/spec/meeting/utils.js +206 -16
  336. package/test/unit/spec/meeting/voicea-meeting.ts +85 -1
  337. package/test/unit/spec/meeting-info/index.js +2 -3
  338. package/test/unit/spec/meeting-info/meetinginfov2.js +88 -11
  339. package/test/unit/spec/meetings/index.js +606 -53
  340. package/test/unit/spec/meetings/request.js +141 -0
  341. package/test/unit/spec/meetings/utils.js +402 -51
  342. package/test/unit/spec/member/index.js +7 -0
  343. package/test/unit/spec/member/util.js +89 -0
  344. package/test/unit/spec/members/index.js +216 -0
  345. package/test/unit/spec/members/request.js +37 -1
  346. package/test/unit/spec/members/utils.js +63 -0
  347. package/test/unit/spec/multistream/mediaRequestManager.ts +501 -37
  348. package/test/unit/spec/multistream/remoteMediaManager.ts +46 -0
  349. package/test/unit/spec/multistream/sendSlotManager.ts +165 -38
  350. package/test/unit/spec/reachability/index.ts +128 -46
  351. package/test/unit/spec/reachability/util.ts +31 -0
  352. package/test/unit/spec/recording-controller/index.js +9 -8
  353. package/test/unit/spec/roap/turnDiscovery.ts +20 -0
  354. package/test/unit/spec/webinar/index.ts +982 -328
@@ -19,13 +19,10 @@ _Object$defineProperty(exports, "__esModule", {
19
19
  });
20
20
  exports.createLocusFromHashTreeMessage = createLocusFromHashTreeMessage;
21
21
  exports.default = void 0;
22
+ exports.findMeetingForHashTreeMessage = findMeetingForHashTreeMessage;
22
23
  var _regenerator = _interopRequireDefault(require("@babel/runtime-corejs2/regenerator"));
23
- var _values = _interopRequireDefault(require("@babel/runtime-corejs2/core-js/object/values"));
24
- var _assign = _interopRequireDefault(require("@babel/runtime-corejs2/core-js/object/assign"));
25
- var _map = _interopRequireDefault(require("@babel/runtime-corejs2/core-js/map"));
26
- var _keys = _interopRequireDefault(require("@babel/runtime-corejs2/core-js/object/keys"));
27
- var _stringify = _interopRequireDefault(require("@babel/runtime-corejs2/core-js/json/stringify"));
28
- var _isArray = _interopRequireDefault(require("@babel/runtime-corejs2/core-js/array/is-array"));
24
+ var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime-corejs2/helpers/slicedToArray"));
25
+ var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime-corejs2/helpers/toConsumableArray"));
29
26
  var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime-corejs2/helpers/asyncToGenerator"));
30
27
  var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime-corejs2/helpers/classCallCheck"));
31
28
  var _createClass2 = _interopRequireDefault(require("@babel/runtime-corejs2/helpers/createClass"));
@@ -33,7 +30,15 @@ var _possibleConstructorReturn2 = _interopRequireDefault(require("@babel/runtime
33
30
  var _getPrototypeOf2 = _interopRequireDefault(require("@babel/runtime-corejs2/helpers/getPrototypeOf"));
34
31
  var _inherits2 = _interopRequireDefault(require("@babel/runtime-corejs2/helpers/inherits"));
35
32
  var _defineProperty2 = _interopRequireDefault(require("@babel/runtime-corejs2/helpers/defineProperty"));
33
+ var _values = _interopRequireDefault(require("@babel/runtime-corejs2/core-js/object/values"));
34
+ var _assign = _interopRequireDefault(require("@babel/runtime-corejs2/core-js/object/assign"));
35
+ var _map = _interopRequireDefault(require("@babel/runtime-corejs2/core-js/map"));
36
+ var _isArray = _interopRequireDefault(require("@babel/runtime-corejs2/core-js/array/is-array"));
37
+ var _keys = _interopRequireDefault(require("@babel/runtime-corejs2/core-js/object/keys"));
38
+ var _stringify = _interopRequireDefault(require("@babel/runtime-corejs2/core-js/json/stringify"));
36
39
  var _lodash = require("lodash");
40
+ var _uuid = _interopRequireDefault(require("uuid"));
41
+ var _webexCore = require("@webex/webex-core");
37
42
  var _loggerProxy = _interopRequireDefault(require("../common/logs/logger-proxy"));
38
43
  var _eventsScope = _interopRequireDefault(require("../common/events/events-scope"));
39
44
  var _constants = require("../constants");
@@ -47,10 +52,11 @@ var _mediaSharesUtils = _interopRequireDefault(require("./mediaSharesUtils"));
47
52
  var _parser = _interopRequireDefault(require("./parser"));
48
53
  var _metrics = _interopRequireDefault(require("../metrics"));
49
54
  var _constants2 = _interopRequireDefault(require("../metrics/constants"));
50
- var _hashTreeParser = _interopRequireWildcard(require("../hashTree/hashTreeParser"));
55
+ var _hashTreeParser2 = _interopRequireWildcard(require("../hashTree/hashTreeParser"));
51
56
  var _types = require("../hashTree/types");
52
57
  var _utils = require("../hashTree/utils");
53
- function _interopRequireWildcard(e, t) { if ("function" == typeof _WeakMap) var r = new _WeakMap(), n = new _WeakMap(); return (_interopRequireWildcard = function _interopRequireWildcard(e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != _typeof(e) && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (var _t2 in e) "default" !== _t2 && {}.hasOwnProperty.call(e, _t2) && ((i = (o = _Object$defineProperty) && _Object$getOwnPropertyDescriptor(e, _t2)) && (i.get || i.set) ? o(f, _t2, i) : f[_t2] = e[_t2]); return f; })(e, t); }
58
+ var _util = _interopRequireDefault(require("../meetings/util"));
59
+ function _interopRequireWildcard(e, t) { if ("function" == typeof _WeakMap) var r = new _WeakMap(), n = new _WeakMap(); return (_interopRequireWildcard = function _interopRequireWildcard(e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != _typeof(e) && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (var _t3 in e) "default" !== _t3 && {}.hasOwnProperty.call(e, _t3) && ((i = (o = _Object$defineProperty) && _Object$getOwnPropertyDescriptor(e, _t3)) && (i.get || i.set) ? o(f, _t3, i) : f[_t3] = e[_t3]); return f; })(e, t); }
54
60
  function _callSuper(t, o, e) { return o = (0, _getPrototypeOf2.default)(o), (0, _possibleConstructorReturn2.default)(t, _isNativeReflectConstruct() ? _Reflect$construct(o, e || [], (0, _getPrototypeOf2.default)(t).constructor) : o.apply(t, e)); }
55
61
  function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(_Reflect$construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); }
56
62
  function ownKeys(e, r) { var t = _Object$keys2(e); if (_Object$getOwnPropertySymbols) { var o = _Object$getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return _Object$getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
@@ -62,11 +68,81 @@ function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length)
62
68
  // it does not contain fields specific to classic Locus DTOs like sequence or baseSequence
63
69
  var LocusDtoTopLevelKeys = ['controls', 'fullState', 'embeddedApps', 'host', 'info', 'links', 'mediaShares', 'meetings', 'participants', 'replaces', 'self', 'sequence', 'syncUrl', 'url', 'htMeta' // only exists when hash trees are used
64
70
  ];
71
+ // when we invoke APIs on the whole Locus like "mute all" backend returns the whole Locus in the response like this
72
+
65
73
  var LocusObjectStateAfterUpdates = {
66
74
  unchanged: 'unchanged',
67
75
  removed: 'removed',
68
76
  updated: 'updated'
69
77
  };
78
+ /**
79
+ * Gets the replacement information
80
+ *
81
+ * @param {any} self - "self" object from Locus DTO
82
+ * @param {string} deviceUrl - The URL of the specified device
83
+ * @returns {any} The replace information if available, otherwise undefined
84
+ */
85
+ function getReplaceInfoFromSelf(self, deviceUrl) {
86
+ if (self) {
87
+ var _device$replaces;
88
+ var device = _util.default.getThisDevice({
89
+ self: self
90
+ }, deviceUrl);
91
+ if ((device === null || device === void 0 ? void 0 : (_device$replaces = device.replaces) === null || _device$replaces === void 0 ? void 0 : _device$replaces.length) > 0) {
92
+ return device.replaces[0];
93
+ }
94
+ }
95
+ return undefined;
96
+ }
97
+
98
+ /**
99
+ * Finds a meeting by its locus URL in meeting collection. It checks all HashTreeParsers of all meetings in the collection.
100
+ *
101
+ * @param {MeetingCollection} meetingCollection - The collection of meetings to search
102
+ * @param {string} locusUrl - The locus URL to search for
103
+ * @returns {any} The meeting if found, otherwise undefined
104
+ */
105
+ function findLocusUrlInAnyHashTreeParser(meetingCollection, locusUrl) {
106
+ for (var _i = 0, _arr = (0, _values.default)(meetingCollection.getAll()); _i < _arr.length; _i++) {
107
+ var _meeting$locusInfo, _meeting$locusInfo$ha;
108
+ var meeting = _arr[_i];
109
+ if (meeting !== null && meeting !== void 0 && (_meeting$locusInfo = meeting.locusInfo) !== null && _meeting$locusInfo !== void 0 && (_meeting$locusInfo$ha = _meeting$locusInfo.hashTreeParsers) !== null && _meeting$locusInfo$ha !== void 0 && _meeting$locusInfo$ha.has(locusUrl)) {
110
+ return meeting;
111
+ }
112
+ }
113
+ return undefined;
114
+ }
115
+
116
+ /**
117
+ * Finds a meeting for a given hash tree message.
118
+ *
119
+ * @param {HashTreeMessage} message - The hash tree message to find the meeting for
120
+ * @param {MeetingCollection} meetingCollection - The collection of meetings to search
121
+ * @returns {any} The meeting if found, otherwise undefined
122
+ */
123
+ function findMeetingForHashTreeMessage(message, meetingCollection) {
124
+ var _message$locusStateEl, _message$locusStateEl2;
125
+ if (!message) {
126
+ return undefined;
127
+ }
128
+ var foundMeeting = findLocusUrlInAnyHashTreeParser(meetingCollection, message.locusUrl);
129
+ if (foundMeeting) {
130
+ return foundMeeting;
131
+ }
132
+
133
+ // if we haven't found anything, it may mean that message has a new locusUrl
134
+ // check if it indicates that it replaces some existing current locusUrl (this is indicated in "self")
135
+ var self = (_message$locusStateEl = message.locusStateElements) === null || _message$locusStateEl === void 0 ? void 0 : (_message$locusStateEl2 = _message$locusStateEl.find(function (el) {
136
+ return (0, _utils.isSelf)(el);
137
+ })) === null || _message$locusStateEl2 === void 0 ? void 0 : _message$locusStateEl2.data;
138
+ var replaces = getReplaceInfoFromSelf(self, self === null || self === void 0 ? void 0 : self.deviceUrl);
139
+ if (replaces !== null && replaces !== void 0 && replaces.locusUrl) {
140
+ foundMeeting = findLocusUrlInAnyHashTreeParser(meetingCollection, replaces.locusUrl);
141
+ return foundMeeting;
142
+ }
143
+ return undefined;
144
+ }
145
+
70
146
  /**
71
147
  * Creates a locus object from the objects received in a hash tree message. It usually will be
72
148
  * incomplete, because hash tree messages only contain the parts of locus that have changed,
@@ -171,12 +247,13 @@ function createLocusFromHashTreeMessage(message) {
171
247
  var LocusInfo = exports.default = /*#__PURE__*/function (_EventsScope) {
172
248
  /**
173
249
  * Constructor
174
- * @param {function} updateMeeting callback to update the meeting object from an object
250
+ * @param {Object} callbacks callbacks used by LocusInfo
251
+ * @param {function} callbacks.updateMeeting callback to update the meeting object from an object
175
252
  * @param {object} webex
176
253
  * @param {string} meetingId
177
254
  * @returns {undefined}
178
255
  */
179
- function LocusInfo(updateMeeting, webex, meetingId) {
256
+ function LocusInfo(callbacks, webex, meetingId) {
180
257
  var _this;
181
258
  (0, _classCallCheck2.default)(this, LocusInfo);
182
259
  _this = _callSuper(this, LocusInfo);
@@ -185,7 +262,6 @@ var LocusInfo = exports.default = /*#__PURE__*/function (_EventsScope) {
185
262
  (0, _defineProperty2.default)(_this, "locusParser", void 0);
186
263
  (0, _defineProperty2.default)(_this, "meetingId", void 0);
187
264
  (0, _defineProperty2.default)(_this, "parsedLocus", void 0);
188
- (0, _defineProperty2.default)(_this, "updateMeeting", void 0);
189
265
  (0, _defineProperty2.default)(_this, "webex", void 0);
190
266
  (0, _defineProperty2.default)(_this, "aclUrl", void 0);
191
267
  (0, _defineProperty2.default)(_this, "baseSequence", void 0);
@@ -206,41 +282,67 @@ var LocusInfo = exports.default = /*#__PURE__*/function (_EventsScope) {
206
282
  (0, _defineProperty2.default)(_this, "links", void 0);
207
283
  (0, _defineProperty2.default)(_this, "mainSessionLocusCache", void 0);
208
284
  (0, _defineProperty2.default)(_this, "self", void 0);
209
- (0, _defineProperty2.default)(_this, "hashTreeParser", void 0);
285
+ (0, _defineProperty2.default)(_this, "hashTreeParsers", void 0);
210
286
  (0, _defineProperty2.default)(_this, "hashTreeObjectId2ParticipantId", void 0);
211
287
  // mapping of hash tree object ids to participant ids
212
288
  (0, _defineProperty2.default)(_this, "classicVsHashTreeMismatchMetricCounter", 0);
289
+ (0, _defineProperty2.default)(_this, "callbacks", void 0);
290
+ (0, _defineProperty2.default)(_this, "destroyMeetingSuspended", false);
213
291
  _this.parsedLocus = {
214
292
  states: []
215
293
  };
294
+ _this.callbacks = callbacks;
216
295
  _this.webex = webex;
217
296
  _this.emitChange = false;
218
297
  _this.compareAndUpdateFlags = {};
219
298
  _this.meetingId = meetingId;
220
- _this.updateMeeting = updateMeeting;
221
299
  _this.locusParser = new _parser.default();
300
+ _this.hashTreeParsers = new _map.default();
222
301
  _this.hashTreeObjectId2ParticipantId = new _map.default();
223
302
  return _this;
224
303
  }
225
304
 
226
305
  /**
227
- * Does a Locus sync. It tries to get the latest delta DTO or if it can't, it falls back to getting the full Locus DTO.
228
- * WARNING: This function must not be used for hash tree based Locus meetings.
306
+ * Whether this meeting uses hash tree based Locus (as opposed to a classic, delta based Locus).
229
307
  *
230
- * @param {Meeting} meeting
231
- * @param {boolean} isLocusUrlChanged
232
- * @param {Locus} locus
233
- * @returns {undefined}
308
+ * @returns {boolean}
234
309
  */
235
310
  (0, _inherits2.default)(LocusInfo, _EventsScope);
236
311
  return (0, _createClass2.default)(LocusInfo, [{
312
+ key: "isUsingHashTrees",
313
+ value: function isUsingHashTrees() {
314
+ return this.hashTreeParsers.size > 0;
315
+ }
316
+
317
+ /**
318
+ * Does a Locus sync. It tries to get the latest delta DTO or if it can't, it falls back to getting the full Locus DTO.
319
+ * WARNING: This function must not be used for hash tree based Locus meetings.
320
+ *
321
+ * @param {Meeting} meeting
322
+ * @param {boolean} isLocusUrlChanged
323
+ * @param {Locus} locus
324
+ * @param {Object} [options]
325
+ * @param {boolean} [options.destroyOnTransientFailure=true] controls what happens on a *transient*
326
+ * sync failure (a terminal failure, e.g. a 403 meaning the meeting has ended, always destroys
327
+ * the meeting regardless of this flag). When true, a transient failure destroys the meeting and
328
+ * the returned promise still resolves. When false, the meeting is preserved and the returned
329
+ * promise rejects so the caller can retry.
330
+ * @returns {Promise} resolves once the fetched DTO has been applied; see destroyOnTransientFailure
331
+ * for the failure behavior
332
+ */
333
+ }, {
237
334
  key: "doLocusSync",
238
335
  value: function doLocusSync(meeting, isLocusUrlChanged, locus) {
239
336
  var _this$locusParser$wor,
240
337
  _this2 = this;
338
+ var _ref = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {},
339
+ _ref$destroyOnTransie = _ref.destroyOnTransientFailure,
340
+ destroyOnTransientFailure = _ref$destroyOnTransie === void 0 ? true : _ref$destroyOnTransie;
241
341
  var url;
242
342
  var isDelta = false;
243
343
  var meetingDestroyed = false;
344
+ // whether the DTO fetch itself failed (as opposed to applying a successfully fetched DTO)
345
+ var fetchFailed = false;
244
346
  if (isLocusUrlChanged) {
245
347
  // for the locus url changed case from breakout to main session, we should always do a full sync, in this case, the url from locus is always on main session,
246
348
  // so use the main session locus url to get the full locus(full participants list in the response).
@@ -255,8 +357,28 @@ var LocusInfo = exports.default = /*#__PURE__*/function (_EventsScope) {
255
357
  }
256
358
  _loggerProxy.default.logger.info("Locus-info:index#doLocusSync --> doing Locus sync (getting ".concat(isDelta ? 'delta' : 'full', " DTO)"));
257
359
 
258
- // return value ignored on purpose
259
- meeting.meetingRequest.getLocusDTO({
360
+ // Called once the DTO fetch (delta plus any full-sync fallback) has failed and we're giving up.
361
+ // The meeting is destroyed when either the delta-processing path asked for it, or the failure is
362
+ // terminal (e.g. a 403 meaning the meeting has ended) - in both cases there's nothing left to
363
+ // sync or retry, so the trailing catch below swallows the rejection whenever meetingDestroyed is
364
+ // set. On the caller-driven reconnection path a non-terminal failure preserves the meeting and
365
+ // lets the rejection propagate so the caller can retry.
366
+ var onFetchFailure = function onFetchFailure(error, logMessage) {
367
+ var _ref2 = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {},
368
+ _ref2$terminal = _ref2.terminal,
369
+ terminal = _ref2$terminal === void 0 ? false : _ref2$terminal;
370
+ // terminal failures always destroy the meeting; destroyOnTransientFailure only controls the
371
+ // non-terminal case
372
+ var destroyMeeting = terminal || destroyOnTransientFailure;
373
+ _loggerProxy.default.logger.info("Locus-info:index#doLocusSync --> ".concat(logMessage).concat(destroyMeeting ? ', destroying the meeting' : ''));
374
+ fetchFailed = true;
375
+ if (destroyMeeting) {
376
+ _this2.webex.meetings.destroy(meeting, _constants.MEETING_REMOVED_REASON.LOCUS_DTO_SYNC_FAILED);
377
+ meetingDestroyed = true;
378
+ }
379
+ throw error;
380
+ };
381
+ return meeting.meetingRequest.getLocusDTO({
260
382
  url: url
261
383
  }).catch(function (e) {
262
384
  if (isDelta) {
@@ -276,19 +398,25 @@ var LocusInfo = exports.default = /*#__PURE__*/function (_EventsScope) {
276
398
  return meeting.meetingRequest.getLocusDTO({
277
399
  url: meeting.locusUrl
278
400
  }).catch(function (err) {
279
- _loggerProxy.default.logger.info('Locus-info:index#doLocusSync --> fallback full sync failed, destroying the meeting');
280
- _this2.webex.meetings.destroy(meeting, _constants.MEETING_REMOVED_REASON.LOCUS_DTO_SYNC_FAILED);
281
- meetingDestroyed = true;
282
- throw err;
401
+ return (
402
+ // A 403 from the fallback full sync is also terminal (meeting has ended), so remove the
403
+ // meeting even on the reconnection path instead of preserving it and rejecting.
404
+ onFetchFailure(err, 'fallback full sync failed', {
405
+ terminal: err.statusCode === 403
406
+ })
407
+ );
283
408
  });
284
409
  }
285
- _loggerProxy.default.logger.info('Locus-info:index#doLocusSync --> got 403 from Locus, skipping fallback to full sync, destroying the meeting');
286
- } else {
287
- _loggerProxy.default.logger.info('Locus-info:index#doLocusSync --> fallback full sync failed, destroying the meeting');
410
+
411
+ // A 403 means the meeting has ended - this is terminal, so remove the meeting even on the
412
+ // reconnection path (there's nothing to retry) instead of preserving it and rejecting.
413
+ return onFetchFailure(e, 'got 403 from Locus, skipping fallback to full sync', {
414
+ terminal: true
415
+ });
288
416
  }
289
- _this2.webex.meetings.destroy(meeting, _constants.MEETING_REMOVED_REASON.LOCUS_DTO_SYNC_FAILED);
290
- meetingDestroyed = true;
291
- throw e;
417
+ return onFetchFailure(e, 'full sync failed', {
418
+ terminal: e.statusCode === 403
419
+ });
292
420
  }).then(function (res) {
293
421
  if ((0, _lodash.isEmpty)(res.body)) {
294
422
  if (isDelta) {
@@ -308,15 +436,27 @@ var LocusInfo = exports.default = /*#__PURE__*/function (_EventsScope) {
308
436
  }
309
437
  meeting.locusInfo.onFullLocus('classic Locus sync', res.body);
310
438
  }).catch(function (e) {
311
- _loggerProxy.default.logger.info("Locus-info:index#doLocusSync --> getLocusDTO succeeded but failed to handle result, locus parser will resume but not all data may be synced (".concat(e.toString(), ")"));
312
- _metrics.default.sendBehavioralMetric(_constants2.default.LOCUS_SYNC_HANDLING_FAILED, {
313
- correlationId: meeting.correlationId,
314
- url: url,
315
- reason: e.message,
316
- errorName: e.name,
317
- stack: e.stack,
318
- code: e.code
319
- });
439
+ if (!fetchFailed) {
440
+ // The DTO was fetched successfully but applying it failed. Retrying wouldn't help - it
441
+ // would re-fetch and re-apply the same unprocessable DTO and fail identically - so log and
442
+ // resume (swallow the error) instead of propagating it. Propagating here would make the
443
+ // reconnection flow (which treats a rejection as retryable) retry indefinitely.
444
+ _loggerProxy.default.logger.info("Locus-info:index#doLocusSync --> getLocusDTO succeeded but failed to handle result, locus parser will resume but not all data may be synced (".concat(e.toString(), ")"));
445
+ _metrics.default.sendBehavioralMetric(_constants2.default.LOCUS_SYNC_HANDLING_FAILED, {
446
+ correlationId: meeting.correlationId,
447
+ url: url,
448
+ reason: e.message,
449
+ errorName: e.name,
450
+ stack: e.stack,
451
+ code: e.code
452
+ });
453
+ return;
454
+ }
455
+ if (!destroyOnTransientFailure && !meetingDestroyed) {
456
+ // caller-driven sync (e.g. reconnection): propagate a transient fetch failure so it can be
457
+ // retried. If the meeting was destroyed (terminal failure), there's nothing to retry.
458
+ throw e;
459
+ }
320
460
  }).finally(function () {
321
461
  if (!meetingDestroyed) {
322
462
  // Notify parser to resume processing delta events.
@@ -326,6 +466,73 @@ var LocusInfo = exports.default = /*#__PURE__*/function (_EventsScope) {
326
466
  });
327
467
  }
328
468
 
469
+ /**
470
+ * Syncs this meeting's Locus state (e.g. after a network reconnection), routing to whichever
471
+ * mechanism the meeting uses (a meeting only ever uses one): hash tree datasets via
472
+ * syncAllHashTreeDatasets() or a standalone Locus DTO fetch for classic meetings.
473
+ * A transient failure preserves the meeting (so the caller can retry); only a terminal failure
474
+ * (e.g. a 403 meaning the meeting has ended) destroys it.
475
+ *
476
+ * The classic path is only needed when Meetings#syncMeetings() can't do its usual
477
+ * getActiveMeetings() fetch (e.g. unverified guests, for whom Locus rejects that call); signed-in
478
+ * users resync classic meetings via getActiveMeetings() and pass canSyncClassicLocus as false.
479
+ *
480
+ * @param {Meeting} meeting
481
+ * @param {Object} options
482
+ * @param {boolean} options.canSyncClassicLocus - whether this sync is allowed to fetch a
483
+ * standalone Locus DTO for classic meetings
484
+ * @param {boolean} options.canSyncHashTree - whether this sync is allowed to sync hash tree
485
+ * datasets for hash tree based meetings
486
+ * @returns {Promise<void>} resolves once the sync (hash tree or classic) completes; for the
487
+ * classic path it rejects only on a transient failure, so the caller can retry (a terminal
488
+ * failure destroys the meeting and resolves)
489
+ */
490
+ }, {
491
+ key: "sync",
492
+ value: (function () {
493
+ var _sync = (0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee(meeting, _ref3) {
494
+ var canSyncClassicLocus, canSyncHashTree;
495
+ return _regenerator.default.wrap(function (_context) {
496
+ while (1) switch (_context.prev = _context.next) {
497
+ case 0:
498
+ canSyncClassicLocus = _ref3.canSyncClassicLocus, canSyncHashTree = _ref3.canSyncHashTree;
499
+ if (!this.isUsingHashTrees()) {
500
+ _context.next = 2;
501
+ break;
502
+ }
503
+ if (!canSyncHashTree) {
504
+ _context.next = 1;
505
+ break;
506
+ }
507
+ _context.next = 1;
508
+ return this.syncAllHashTreeDatasets();
509
+ case 1:
510
+ return _context.abrupt("return");
511
+ case 2:
512
+ if (!(canSyncClassicLocus && meeting.locusUrl)) {
513
+ _context.next = 3;
514
+ break;
515
+ }
516
+ // Pause the parser so in-flight deltas don't race the DTO fetch; doLocusSync() resumes it.
517
+ this.locusParser.pause();
518
+ // destroyOnTransientFailure: false so a transient failure preserves the meeting and rejects,
519
+ // letting the reconnection flow retry instead of tearing the meeting down. A terminal failure
520
+ // (e.g. a 403 meaning the meeting has ended) still destroys the meeting.
521
+ _context.next = 3;
522
+ return this.doLocusSync(meeting, false, undefined, {
523
+ destroyOnTransientFailure: false
524
+ });
525
+ case 3:
526
+ case "end":
527
+ return _context.stop();
528
+ }
529
+ }, _callee, this);
530
+ }));
531
+ function sync(_x, _x2) {
532
+ return _sync.apply(this, arguments);
533
+ }
534
+ return sync;
535
+ }()
329
536
  /**
330
537
  * Apply locus delta data to meeting
331
538
  * @param {string} action Locus delta action
@@ -333,6 +540,7 @@ var LocusInfo = exports.default = /*#__PURE__*/function (_EventsScope) {
333
540
  * @param {Meeting} meeting
334
541
  * @returns {undefined}
335
542
  */
543
+ )
336
544
  }, {
337
545
  key: "applyLocusDeltaData",
338
546
  value: function applyLocusDeltaData(action, locus, meeting) {
@@ -418,7 +626,7 @@ var LocusInfo = exports.default = /*#__PURE__*/function (_EventsScope) {
418
626
  this.updateControls(locus.controls, locus.self);
419
627
  this.updateLocusUrl(locus.url, _controlsUtils.default.isMainSessionDTO(locus));
420
628
  this.updateFullState(locus.fullState);
421
- this.updateMeetingInfo(locus.info);
629
+ this.updateMeetingInfo(locus.info, locus.self);
422
630
  this.updateEmbeddedApps(locus.embeddedApps);
423
631
  // self and participants generate sipUrl for 1:1 meeting
424
632
  this.updateSelf(locus.self);
@@ -428,46 +636,118 @@ var LocusInfo = exports.default = /*#__PURE__*/function (_EventsScope) {
428
636
  }
429
637
 
430
638
  /**
431
- * Creates the HashTreeParser instance.
432
- * @param {Object} initial locus data
433
- * @returns {void}
639
+ * Whether we expect to receive updates over the LLM connection. This is used by hash tree parsers
640
+ * to decide whether to arm heartbeat watchdog timers for LLM data sets.
641
+ * @returns {boolean}
642
+ */
643
+ }, {
644
+ key: "isLlmExpected",
645
+ value: function isLlmExpected() {
646
+ var _this$parsedLocus$sel, _this$parsedLocus$sel2;
647
+ return ((_this$parsedLocus$sel = this.parsedLocus.self) === null || _this$parsedLocus$sel === void 0 ? void 0 : (_this$parsedLocus$sel2 = _this$parsedLocus$sel.joinedWith) === null || _this$parsedLocus$sel2 === void 0 ? void 0 : _this$parsedLocus$sel2.state) === 'JOINED';
648
+ }
649
+
650
+ /**
651
+ * Creates a HashTreeParser instance for a given locusUrl and stores it in the map.
652
+ * @param {Object} params
653
+ * @param {string} params.locusUrl - the locus URL used as the map key
654
+ * @param {Object} params.initialLocus - initial locus data
655
+ * @param {Object} params.metadata - hash tree metadata
656
+ * @param {string} params.replacedAt - timestamp from Locus indicating when the replacement happened
657
+ * @returns {HashTreeParser} the newly created parser
434
658
  */
435
659
  }, {
436
660
  key: "createHashTreeParser",
437
- value: function createHashTreeParser(_ref) {
438
- var _this$webex$config$me;
439
- var initialLocus = _ref.initialLocus,
440
- metadata = _ref.metadata;
441
- return new _hashTreeParser.default({
661
+ value: function createHashTreeParser(_ref4) {
662
+ var _this4 = this,
663
+ _locusUrl$split,
664
+ _locusUrl$split$pop,
665
+ _this$webex$config$me;
666
+ var locusUrl = _ref4.locusUrl,
667
+ initialLocus = _ref4.initialLocus,
668
+ metadata = _ref4.metadata,
669
+ replacedAt = _ref4.replacedAt;
670
+ var parser = new _hashTreeParser2.default({
442
671
  initialLocus: initialLocus,
443
672
  metadata: metadata,
444
673
  webexRequest: this.webex.request.bind(this.webex),
445
- locusInfoUpdateCallback: this.updateFromHashTree.bind(this),
446
- debugId: "HT-".concat(this.meetingId.substring(0, 4)),
447
- excludedDataSets: (_this$webex$config$me = this.webex.config.meetings.locus) === null || _this$webex$config$me === void 0 ? void 0 : _this$webex$config$me.excludedDataSets
674
+ callbacks: {
675
+ locusInfoUpdateCallback: this.updateFromHashTree.bind(this, locusUrl),
676
+ syncLatencyTracker: this.callbacks.syncLatencyTracker,
677
+ isLlmExpected: function isLlmExpected() {
678
+ return _this4.isLlmExpected();
679
+ },
680
+ // Reuse webex-core's tracking-id interceptor sequence (exposed publicly via
681
+ // webexTrackingIdSequenceNumbers) so Locus requests share the client's unified
682
+ // ${sessionId}_${sequence} tracking id space instead of minting an unrelated id. Fall
683
+ // back to a uuid on the rare chance the interceptor hasn't issued any request yet (and so
684
+ // isn't in the map). The value is opaque to the metrics layer and is forced onto the
685
+ // /hashtree and /sync request headers.
686
+ generateTrackingId: function generateTrackingId() {
687
+ var interceptor = (0, _toConsumableArray2.default)(_webexCore.webexTrackingIdSequenceNumbers.keys()).find(function (candidate) {
688
+ return (candidate === null || candidate === void 0 ? void 0 : candidate.webex) === _this4.webex;
689
+ });
690
+ return "".concat(_this4.webex.sessionId, "_").concat(interceptor ? interceptor.sequence : _uuid.default.v4());
691
+ }
692
+ },
693
+ debugId: "HT-".concat((_locusUrl$split = locusUrl.split('/')) === null || _locusUrl$split === void 0 ? void 0 : (_locusUrl$split$pop = _locusUrl$split.pop()) === null || _locusUrl$split$pop === void 0 ? void 0 : _locusUrl$split$pop.substring(0, 4)),
694
+ excludedDataSets: (_this$webex$config$me = this.webex.config.meetings.locus) === null || _this$webex$config$me === void 0 ? void 0 : _this$webex$config$me.excludedDataSets,
695
+ syncLatencyMeetingId: this.meetingId
448
696
  });
697
+
698
+ // When a new HashTreeParser is created, previous one should be stopped.
699
+ // Locus will only be sending us updates for the current one.
700
+ var _iterator2 = _createForOfIteratorHelper(this.hashTreeParsers),
701
+ _step2;
702
+ try {
703
+ for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {
704
+ var _step2$value = (0, _slicedToArray2.default)(_step2.value, 2),
705
+ existingLocusUrl = _step2$value[0],
706
+ existingEntry = _step2$value[1];
707
+ if (existingEntry.parser.state !== 'stopped') {
708
+ existingEntry.parser.stop();
709
+ if (replacedAt) {
710
+ existingEntry.replacedAt = replacedAt;
711
+ } else {
712
+ _loggerProxy.default.logger.warn("Locus-info:index#createHashTreeParser --> no replacedAt timestamp provided for new HashTreeParser with locusUrl ".concat(locusUrl, ", replacing ").concat(existingLocusUrl));
713
+ }
714
+ }
715
+ }
716
+ } catch (err) {
717
+ _iterator2.e(err);
718
+ } finally {
719
+ _iterator2.f();
720
+ }
721
+ this.hashTreeParsers.set(locusUrl, {
722
+ parser: parser,
723
+ initializedFromHashTree: false
724
+ });
725
+ this.hashTreeObjectId2ParticipantId.clear();
726
+ return parser;
449
727
  }
450
728
 
451
729
  /**
452
730
  * @param {Object} data - data to initialize locus info with. It may be from a join or GET /loci response or from a Mercury event that triggers a creation of meeting object
731
+ * @param {Function} [onLocusSynced] - optional callback that will be called at the end of initial setup, when locus info is fully synced. It will be called with the full locus snapshot as an argument (which may be null if we haven't received any full locus DTOs during the initial setup, for example in case we receive only hash tree messages without full locus DTOs)
453
732
  * @returns {undefined}
454
733
  * @memberof LocusInfo
455
734
  */
456
735
  }, {
457
736
  key: "initialSetup",
458
737
  value: (function () {
459
- var _initialSetup = (0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee(data) {
738
+ var _initialSetup = (0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee2(data, onLocusSynced) {
460
739
  var _data$locus, _data$locus$links, _data$locus$links$res, _data$locus$links$res2;
461
- var _data$hashTreeMessage, _metadataObject$data, metadataObject, _t;
462
- return _regenerator.default.wrap(function (_context) {
463
- while (1) switch (_context.prev = _context.next) {
740
+ var initialFullLocus, _data$hashTreeMessage, _metadataObject$data, metadataObject, hashTreeParser, _hashTreeParser, _t;
741
+ return _regenerator.default.wrap(function (_context2) {
742
+ while (1) switch (_context2.prev = _context2.next) {
464
743
  case 0:
744
+ initialFullLocus = null;
465
745
  _t = data.trigger;
466
- _context.next = _t === 'locus-message' ? 1 : _t === 'join-response' ? 6 : _t === 'get-loci-response' ? 7 : 10;
746
+ _context2.next = _t === 'locus-message' ? 1 : _t === 'join-response' ? 6 : _t === 'get-loci-response' ? 7 : 10;
467
747
  break;
468
748
  case 1:
469
749
  if (!data.hashTreeMessage) {
470
- _context.next = 4;
750
+ _context2.next = 4;
471
751
  break;
472
752
  }
473
753
  // we need the Metadata object to be in the received message, because it contains visibleDataSets
@@ -476,7 +756,7 @@ var LocusInfo = exports.default = /*#__PURE__*/function (_EventsScope) {
476
756
  return (0, _utils.isMetadata)(el);
477
757
  });
478
758
  if (metadataObject !== null && metadataObject !== void 0 && (_metadataObject$data = metadataObject.data) !== null && _metadataObject$data !== void 0 && _metadataObject$data.visibleDataSets) {
479
- _context.next = 2;
759
+ _context2.next = 2;
480
760
  break;
481
761
  }
482
762
  // this is a common case (not an error)
@@ -488,101 +768,151 @@ var LocusInfo = exports.default = /*#__PURE__*/function (_EventsScope) {
488
768
  case 2:
489
769
  _loggerProxy.default.logger.info('Locus-info:index#initialSetup --> creating HashTreeParser from message');
490
770
  // first create the HashTreeParser, but don't initialize it with any data yet
491
- this.hashTreeParser = this.createHashTreeParser({
771
+ hashTreeParser = this.createHashTreeParser({
772
+ locusUrl: data.hashTreeMessage.locusUrl,
492
773
  initialLocus: {
493
774
  locus: null,
494
- dataSets: [] // empty, because they will be populated in initializeFromMessage() call // dataSets: data.hashTreeMessage.dataSets,
775
+ dataSets: data.hashTreeMessage.dataSets
495
776
  },
496
777
  metadata: {
497
778
  htMeta: metadataObject.htMeta,
498
779
  visibleDataSets: metadataObject.data.visibleDataSets
499
780
  }
500
- });
501
-
502
- // now handle the message - that should populate all the visible datasets
503
- _context.next = 3;
504
- return this.hashTreeParser.initializeFromMessage(data.hashTreeMessage);
781
+ }); // now handle the message - that should populate all the visible datasets
782
+ _context2.next = 3;
783
+ return hashTreeParser.initializeFromMessage(data.hashTreeMessage);
505
784
  case 3:
506
- _context.next = 5;
785
+ _context2.next = 5;
507
786
  break;
508
787
  case 4:
509
788
  // "classic" Locus case, no hash trees involved
510
789
  this.updateLocusCache(data.locus);
511
790
  this.onFullLocus('classic locus message', data.locus, undefined);
512
791
  case 5:
513
- return _context.abrupt("continue", 10);
792
+ return _context2.abrupt("continue", 10);
514
793
  case 6:
515
794
  this.updateLocusCache(data.locus);
516
795
  this.onFullLocus('join response', data.locus, undefined, data.dataSets, data.metadata);
517
- return _context.abrupt("continue", 10);
796
+ initialFullLocus = data.locus;
797
+ return _context2.abrupt("continue", 10);
518
798
  case 7:
519
799
  if (!((_data$locus = data.locus) !== null && _data$locus !== void 0 && (_data$locus$links = _data$locus.links) !== null && _data$locus$links !== void 0 && (_data$locus$links$res = _data$locus$links.resources) !== null && _data$locus$links$res !== void 0 && (_data$locus$links$res2 = _data$locus$links$res.visibleDataSets) !== null && _data$locus$links$res2 !== void 0 && _data$locus$links$res2.url)) {
520
- _context.next = 9;
800
+ _context2.next = 9;
521
801
  break;
522
802
  }
523
803
  _loggerProxy.default.logger.info('Locus-info:index#initialSetup --> creating HashTreeParser from get-loci-response');
524
804
  // first create the HashTreeParser, but don't initialize it with any data yet
525
- this.hashTreeParser = this.createHashTreeParser({
805
+ _hashTreeParser = this.createHashTreeParser({
806
+ locusUrl: data.locus.url,
526
807
  initialLocus: {
527
808
  locus: null,
528
809
  dataSets: [] // empty, because we don't have them yet
529
810
  },
530
811
  metadata: null // get-loci-response doesn't contain Metadata object
531
- });
532
-
533
- // now initialize all the data
534
- _context.next = 8;
535
- return this.hashTreeParser.initializeFromGetLociResponse(data.locus);
812
+ }); // now initialize all the data
813
+ _context2.next = 8;
814
+ return _hashTreeParser.initializeFromGetLociResponse(data.locus);
536
815
  case 8:
537
- _context.next = 10;
816
+ _context2.next = 10;
538
817
  break;
539
818
  case 9:
540
819
  // "classic" Locus case, no hash trees involved
541
820
  this.updateLocusCache(data.locus);
542
821
  this.onFullLocus('classic get-loci-response', data.locus, undefined);
822
+ initialFullLocus = data.locus || null;
543
823
  case 10:
824
+ if (onLocusSynced) {
825
+ try {
826
+ onLocusSynced(initialFullLocus || this.getCurrentLocusSnapshot());
827
+ } catch (error) {
828
+ _loggerProxy.default.logger.warn("Locus-info:index#initialSetup --> onLocusSynced callback failed: ".concat(error));
829
+ }
830
+ }
831
+
544
832
  // Change it to true after it receives it first locus object
545
833
  this.emitChange = true;
546
834
  case 11:
547
835
  case "end":
548
- return _context.stop();
836
+ return _context2.stop();
549
837
  }
550
- }, _callee, this);
838
+ }, _callee2, this);
551
839
  }));
552
- function initialSetup(_x) {
840
+ function initialSetup(_x3, _x4) {
553
841
  return _initialSetup.apply(this, arguments);
554
842
  }
555
843
  return initialSetup;
556
844
  }()
845
+ /**
846
+ * Builds a full locus DTO snapshot from current internal locus state.
847
+ *
848
+ * @returns {LocusDTO}
849
+ */
850
+ )
851
+ }, {
852
+ key: "getCurrentLocusSnapshot",
853
+ value: function getCurrentLocusSnapshot() {
854
+ var _this5 = this;
855
+ var locus = {};
856
+ LocusDtoTopLevelKeys.forEach(function (key) {
857
+ var value = _this5[key];
858
+ if (value !== undefined && value !== null) {
859
+ locus[key] = (0, _lodash.cloneDeep)(value);
860
+ }
861
+ });
862
+ if (!(0, _isArray.default)(locus.participants)) {
863
+ locus.participants = [];
864
+ }
865
+ return locus;
866
+ }
867
+
557
868
  /**
558
869
  * Handles HTTP response from Locus API call.
559
870
  * @param {Meeting} meeting meeting object
560
871
  * @param {LocusApiResponseBody} responseBody body of the http response from Locus API call
561
872
  * @returns {void}
562
873
  */
563
- )
564
874
  }, {
565
875
  key: "handleLocusAPIResponse",
566
876
  value: function handleLocusAPIResponse(meeting, responseBody) {
567
- if (this.hashTreeParser) {
568
- if (!responseBody.dataSets) {
569
- this.sendClassicVsHashTreeMismatchMetric(meeting, "expected hash tree dataSets in API response but they are missing");
570
- // continuing as we can still manage without responseBody.dataSets, but this is very suspicious
571
- }
572
- _loggerProxy.default.logger.info('Locus-info:index#handleLocusAPIResponse --> passing Locus API response to HashTreeParser: ', responseBody);
573
- // update the data in our hash trees
574
- this.hashTreeParser.handleLocusUpdate(responseBody);
575
- } else {
576
- if (responseBody.dataSets) {
577
- this.sendClassicVsHashTreeMismatchMetric(meeting, "unexpected hash tree dataSets in API response");
877
+ var _responseBody$locus;
878
+ var isWrapped = 'locus' in responseBody;
879
+ var locusUrl = isWrapped ? (_responseBody$locus = responseBody.locus) === null || _responseBody$locus === void 0 ? void 0 : _responseBody$locus.url : responseBody.url;
880
+ var hashTreeParserEntry = locusUrl && this.hashTreeParsers.get(locusUrl);
881
+ var locus = isWrapped ? responseBody.locus : responseBody;
882
+ if (this.isUsingHashTrees()) {
883
+ // We are in hash tree mode. Check if we need to create/reactivate a parser for this locusUrl.
884
+ if (!hashTreeParserEntry || hashTreeParserEntry.parser.state === 'stopped') {
885
+ if (!locusUrl) {
886
+ _loggerProxy.default.logger.warn('Locus-info:index#handleLocusAPIResponse --> API response has no locusUrl, cannot handle hash tree parser switch');
887
+ return;
888
+ }
889
+ this.handleHashTreeParserSwitchForAPIResponse(locusUrl, locus);
890
+ return;
891
+ }
892
+
893
+ // Active parser found - pass the API response to it
894
+ if (isWrapped) {
895
+ // update the data in our hash trees
896
+ hashTreeParserEntry.parser.handleLocusUpdate(responseBody);
897
+ } else {
898
+ // LocusDTO without wrapper - pass it through as if it had no dataSets nor metadata
899
+ hashTreeParserEntry.parser.handleLocusUpdate({
900
+ locus: responseBody
901
+ });
578
902
  }
579
- // classic Locus delta
580
- this.handleLocusDelta(responseBody.locus, meeting);
903
+ return;
581
904
  }
905
+
906
+ // No hash tree parsers - classic Locus mode
907
+ if (isWrapped && responseBody.dataSets) {
908
+ this.sendClassicVsHashTreeMismatchMetric(meeting, "unexpected hash tree dataSets in API response");
909
+ }
910
+
911
+ // classic Locus delta
912
+ this.handleLocusDelta(locus, meeting);
582
913
  }
583
914
 
584
915
  /**
585
- *
586
916
  * @param {HashTreeObject} object data set object
587
917
  * @param {any} locus
588
918
  * @returns {void}
@@ -590,14 +920,15 @@ var LocusInfo = exports.default = /*#__PURE__*/function (_EventsScope) {
590
920
  }, {
591
921
  key: "updateLocusFromHashTreeObject",
592
922
  value: function updateLocusFromHashTreeObject(object, locus) {
593
- var _this4 = this;
923
+ var _this6 = this,
924
+ _locus$self;
594
925
  var type = object.htMeta.elementId.type.toLowerCase();
595
926
  var addParticipantObject = function addParticipantObject(obj) {
596
927
  if (!locus.participants) {
597
928
  locus.participants = [];
598
929
  }
599
930
  locus.participants.push(obj.data);
600
- _this4.hashTreeObjectId2ParticipantId.set(obj.htMeta.elementId.id, obj.data.id);
931
+ _this6.hashTreeObjectId2ParticipantId.set(obj.htMeta.elementId.id, obj.data.id);
601
932
  };
602
933
  switch (type) {
603
934
  case _types.ObjectType.locus:
@@ -677,6 +1008,16 @@ var LocusInfo = exports.default = /*#__PURE__*/function (_EventsScope) {
677
1008
  locus.jsSdkMeta.removedParticipantIds.push(participantId);
678
1009
  this.hashTreeObjectId2ParticipantId.delete(object.htMeta.elementId.id);
679
1010
  }
1011
+ // Create self from the participant if it matches self identity and is being moved.
1012
+ // We need this, because participant update comes in LLM message often before the self update from Mercury.
1013
+ // Other parts of the code detect move only by looking at self, while some other parts of the SDK/webapp code
1014
+ // look at participant for roles etc, so if participant is updated but not self, then it looks like we our lost roles temporarily
1015
+ // (until self is updated)
1016
+ // This will be fixed properly in SPARK-790239
1017
+ if (object.data && object.data.identity === ((_locus$self = locus.self) === null || _locus$self === void 0 ? void 0 : _locus$self.identity) && object.data.state === 'LEFT' && object.data.reason === 'MOVED') {
1018
+ _loggerProxy.default.logger.info("Locus-info:index#updateLocusFromHashTreeObject --> FOUND a match for MOVED self in participant object ".concat(object.htMeta.elementId.id));
1019
+ (0, _assign.default)(locus[_types.ObjectTypeToLocusKeyMap[_types.ObjectType.self]], object.data);
1020
+ }
680
1021
  break;
681
1022
  case _types.ObjectType.control:
682
1023
  if (object.data) {
@@ -698,10 +1039,14 @@ var LocusInfo = exports.default = /*#__PURE__*/function (_EventsScope) {
698
1039
  if (!object.data) {
699
1040
  // self without data is handled inside HashTreeParser and results in LocusInfoUpdateType.MEETING_ENDED, so we should never get here
700
1041
  // all other types info, fullstate, etc - Locus should never send them without data
701
- _loggerProxy.default.logger.warn("Locus-info:index#updateLocusFromHashTreeObject --> received ".concat(type, " object without data, this is not expected! version=").concat(object.htMeta.elementId.version));
1042
+ // but we end up with this method being called without the data for them when the main dataset is removed from visible datasets list
1043
+ _loggerProxy.default.logger.info("Locus-info:index#updateLocusFromHashTreeObject --> received ".concat(type, " object without data, version=").concat(object.htMeta.elementId.version));
702
1044
  } else {
703
1045
  var _locus$info, _object$data$controls, _object$data$controls2, _object$data$controls3;
704
1046
  _loggerProxy.default.logger.info("Locus-info:index#updateLocusFromHashTreeObject --> ".concat(type, " object updated to version ").concat(object.htMeta.elementId.version));
1047
+ if (type === _types.ObjectType.self) {
1048
+ _loggerProxy.default.logger.info("Locus-info:index#updateLocusFromHashTreeObject --> self data: removed=".concat(object.data.removed, " state=").concat(object.data.state, " reason=").concat(object.data.reason));
1049
+ }
705
1050
  var locusDtoKey = _types.ObjectTypeToLocusKeyMap[type];
706
1051
  locus[locusDtoKey] = object.data;
707
1052
 
@@ -751,6 +1096,136 @@ var LocusInfo = exports.default = /*#__PURE__*/function (_EventsScope) {
751
1096
  }
752
1097
  }
753
1098
 
1099
+ /**
1100
+ * Helper that handles the common logic for reactivating a stopped HashTreeParser when
1101
+ * a newer "replaces" is detected. Used by both the message and API response parser switch methods.
1102
+ *
1103
+ * @param {string} callerName - name of the calling method, used in log messages
1104
+ * @param {string} locusUrl - the locus URL of the stopped parser
1105
+ * @param {HashTreeParserEntry} stoppedEntry - the stopped parser entry
1106
+ * @param {ReplacesInfo} replaces - replacement info extracted from self
1107
+ * @param {Function} resumeCallback - callback to invoke after reactivation to resume the parser
1108
+ * @returns {void}
1109
+ */
1110
+ }, {
1111
+ key: "resumeStoppedParser",
1112
+ value: function resumeStoppedParser(callerName, locusUrl, stoppedEntry, replaces, resumeCallback) {
1113
+ // this check is just for typescript, it should never happen, replaces should always be defined
1114
+ if (!replaces) {
1115
+ _loggerProxy.default.logger.info("Locus-info:index#".concat(callerName, " --> received data for stopped HashTreeParser with locusUrl ").concat(locusUrl, ", but no replaces info provided, so not re-activating the parser"));
1116
+ return;
1117
+ }
1118
+ if (replaces.replacedAt <= (stoppedEntry.replacedAt || '')) {
1119
+ _loggerProxy.default.logger.info("Locus-info:index#".concat(callerName, " --> received data for stopped HashTreeParser with locusUrl ").concat(locusUrl, ", but replaces info provided is not newer, so not re-activating the parser"));
1120
+ return;
1121
+ }
1122
+ _loggerProxy.default.logger.info("Locus-info:index#".concat(callerName, " --> reactivating HashTreeParser for locusUrl=").concat(locusUrl, ", which replaces ").concat(replaces.locusUrl));
1123
+ var replacedEntry = this.hashTreeParsers.get(replaces.locusUrl);
1124
+ if (replacedEntry) {
1125
+ replacedEntry.replacedAt = replaces.replacedAt;
1126
+ replacedEntry.parser.stop();
1127
+ } else {
1128
+ _loggerProxy.default.logger.warn("Locus-info:index#".concat(callerName, " --> the parser that is supposed to be replaced with the currently reactivated parser is not found, locusUrl=").concat(replaces.locusUrl));
1129
+ }
1130
+ stoppedEntry.initializedFromHashTree = false;
1131
+ this.hashTreeObjectId2ParticipantId.clear();
1132
+ resumeCallback();
1133
+ }
1134
+
1135
+ /**
1136
+ * Handles an API response whose locusUrl doesn't match any active HashTreeParser
1137
+ * (either no entry exists, or the existing entry is stopped).
1138
+ * Creates a new parser or reactivates a stopped one using initializeFromGetLociResponse.
1139
+ *
1140
+ * @param {string} locusUrl - the locus URL from the API response
1141
+ * @param {LocusDTO} locus - the locus DTO from the API response
1142
+ * @returns {void}
1143
+ */
1144
+ }, {
1145
+ key: "handleHashTreeParserSwitchForAPIResponse",
1146
+ value: function handleHashTreeParserSwitchForAPIResponse(locusUrl, locus) {
1147
+ var entry = this.hashTreeParsers.get(locusUrl);
1148
+ var replaces = getReplaceInfoFromSelf(locus.self,
1149
+ // @ts-ignore
1150
+ this.webex.internal.device.url);
1151
+ if (!entry) {
1152
+ _loggerProxy.default.logger.info("Locus-info:index#handleHashTreeParserSwitchForAPIResponse --> no parser for locusUrl ".concat(locusUrl, ", creating a new one"));
1153
+ var parser = this.createHashTreeParser({
1154
+ locusUrl: locusUrl,
1155
+ initialLocus: {
1156
+ locus: null,
1157
+ dataSets: []
1158
+ },
1159
+ metadata: null,
1160
+ replacedAt: replaces === null || replaces === void 0 ? void 0 : replaces.replacedAt
1161
+ });
1162
+ parser.initializeFromGetLociResponse(locus);
1163
+ return;
1164
+ }
1165
+ if (entry.parser.state !== 'stopped') {
1166
+ _loggerProxy.default.logger.warn("Locus-info:index#handleHashTreeParserSwitchForAPIResponse --> unexpected parser state \"".concat(entry.parser.state, "\" for locusUrl ").concat(locusUrl));
1167
+ return;
1168
+ }
1169
+ this.resumeStoppedParser('handleHashTreeParserSwitchForAPIResponse', locusUrl, entry, replaces, function () {
1170
+ return entry.parser.resumeFromApiResponse(locus);
1171
+ });
1172
+ }
1173
+
1174
+ /**
1175
+ * Checks if the hash tree message should trigger a switch to a different HashTreeParser
1176
+ *
1177
+ * @param {HashTreeMessage} message incoming hash tree message
1178
+ * @returns {boolean} true if the message was handled as a parser switch, false otherwise
1179
+ */
1180
+ }, {
1181
+ key: "handleHashTreeParserSwitch",
1182
+ value: function handleHashTreeParserSwitch(message) {
1183
+ var _message$locusStateEl3, _message$locusStateEl4;
1184
+ var entry = this.hashTreeParsers.get(message.locusUrl);
1185
+ var self = (_message$locusStateEl3 = message.locusStateElements) === null || _message$locusStateEl3 === void 0 ? void 0 : (_message$locusStateEl4 = _message$locusStateEl3.find(function (el) {
1186
+ return (0, _utils.isSelf)(el);
1187
+ })) === null || _message$locusStateEl4 === void 0 ? void 0 : _message$locusStateEl4.data;
1188
+ var replaces = getReplaceInfoFromSelf(self,
1189
+ // @ts-ignore
1190
+ this.webex.internal.device.url);
1191
+ if (!entry) {
1192
+ var _message$locusStateEl5, _metadata$data, _metadata$data$visibl;
1193
+ // Metadata object that contains information about visible datasets is needed to initialize the HashTreeParser,
1194
+ // but it's buried inside the message, we need to find it and pass it to HashTreeParser constructor
1195
+ var metadata = (_message$locusStateEl5 = message.locusStateElements) === null || _message$locusStateEl5 === void 0 ? void 0 : _message$locusStateEl5.find(function (el) {
1196
+ return (0, _utils.isMetadata)(el);
1197
+ });
1198
+ if (metadata && ((_metadata$data = metadata.data) === null || _metadata$data === void 0 ? void 0 : (_metadata$data$visibl = _metadata$data.visibleDataSets) === null || _metadata$data$visibl === void 0 ? void 0 : _metadata$data$visibl.length) > 0) {
1199
+ _loggerProxy.default.logger.info("Locus-info:index#handleHashTreeParserSwitch --> no hash tree parser found for locusUrl ".concat(message.locusUrl, ", creating a new one"));
1200
+ var parser = this.createHashTreeParser({
1201
+ locusUrl: message.locusUrl,
1202
+ initialLocus: {
1203
+ locus: null,
1204
+ dataSets: message.dataSets
1205
+ },
1206
+ metadata: {
1207
+ htMeta: metadata.htMeta,
1208
+ visibleDataSets: metadata.data.visibleDataSets
1209
+ },
1210
+ replacedAt: replaces === null || replaces === void 0 ? void 0 : replaces.replacedAt
1211
+ });
1212
+
1213
+ // handle the message with the new parser
1214
+ parser.handleMessage(message);
1215
+ }
1216
+ return true;
1217
+ }
1218
+ if (entry.parser.state === 'stopped') {
1219
+ // the message matches a stopped parser, we need to check if maybe this is a new "replacement" and we need to re-activate the parser
1220
+ // this happens when you move from breakout A -> breakout B -> back to breakout A
1221
+ this.resumeStoppedParser('handleHashTreeParserSwitch', message.locusUrl, entry, replaces, function () {
1222
+ return entry.parser.resumeFromMessage(message);
1223
+ });
1224
+ return true;
1225
+ }
1226
+ return false;
1227
+ }
1228
+
754
1229
  /**
755
1230
  * Handles a hash tree message received from Locus.
756
1231
  *
@@ -766,35 +1241,109 @@ var LocusInfo = exports.default = /*#__PURE__*/function (_EventsScope) {
766
1241
  this.sendClassicVsHashTreeMismatchMetric(meeting, "got ".concat(eventType, ", expected ").concat(_constants.LOCUSEVENT.HASH_TREE_DATA_UPDATED));
767
1242
  return;
768
1243
  }
769
- this.hashTreeParser.handleMessage(message);
1244
+ var parserSwitched = this.handleHashTreeParserSwitch(message);
1245
+ if (parserSwitched) {
1246
+ return;
1247
+ }
1248
+ var entry = this.hashTreeParsers.get(message.locusUrl);
1249
+
1250
+ // the check is just for typescript, the case of no entry in hashTreeParsers is handled in handleHashTreeParserSwitch() above
1251
+ if (entry) {
1252
+ entry.parser.handleMessage(message);
1253
+ }
770
1254
  }
771
1255
 
1256
+ /**
1257
+ * Triggers a sync of all hash tree datasets for all hash tree parsers associated with this meeting.
1258
+ * The syncs are executed sequentially within each parser.
1259
+ *
1260
+ * @param {Object} [options={}] - Options for syncing
1261
+ * @param {boolean} [options.onlyLLM=false] - Whether to sync only LLM based data sets
1262
+ * @returns {Promise<void>}
1263
+ */
1264
+ }, {
1265
+ key: "syncAllHashTreeDatasets",
1266
+ value: (function () {
1267
+ var _syncAllHashTreeDatasets = (0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee3() {
1268
+ var options,
1269
+ _iterator3,
1270
+ _step3,
1271
+ _step3$value,
1272
+ entry,
1273
+ _args3 = arguments,
1274
+ _t2;
1275
+ return _regenerator.default.wrap(function (_context3) {
1276
+ while (1) switch (_context3.prev = _context3.next) {
1277
+ case 0:
1278
+ options = _args3.length > 0 && _args3[0] !== undefined ? _args3[0] : {};
1279
+ _iterator3 = _createForOfIteratorHelper(this.hashTreeParsers);
1280
+ _context3.prev = 1;
1281
+ _iterator3.s();
1282
+ case 2:
1283
+ if ((_step3 = _iterator3.n()).done) {
1284
+ _context3.next = 4;
1285
+ break;
1286
+ }
1287
+ _step3$value = (0, _slicedToArray2.default)(_step3.value, 2), entry = _step3$value[1];
1288
+ if (!entry.parser) {
1289
+ _context3.next = 3;
1290
+ break;
1291
+ }
1292
+ _context3.next = 3;
1293
+ return entry.parser.syncAllDatasets(options);
1294
+ case 3:
1295
+ _context3.next = 2;
1296
+ break;
1297
+ case 4:
1298
+ _context3.next = 6;
1299
+ break;
1300
+ case 5:
1301
+ _context3.prev = 5;
1302
+ _t2 = _context3["catch"](1);
1303
+ _iterator3.e(_t2);
1304
+ case 6:
1305
+ _context3.prev = 6;
1306
+ _iterator3.f();
1307
+ return _context3.finish(6);
1308
+ case 7:
1309
+ case "end":
1310
+ return _context3.stop();
1311
+ }
1312
+ }, _callee3, this, [[1, 5, 6, 7]]);
1313
+ }));
1314
+ function syncAllHashTreeDatasets() {
1315
+ return _syncAllHashTreeDatasets.apply(this, arguments);
1316
+ }
1317
+ return syncAllHashTreeDatasets;
1318
+ }()
772
1319
  /**
773
1320
  * Callback registered with HashTreeParser to receive locus info updates.
774
1321
  * Updates our locus info based on the data parsed by the hash tree parser.
775
1322
  *
776
- * @param {LocusInfoUpdateType} updateType - The type of update received.
777
- * @param {Object} [data] - Additional data for the update, if applicable.
1323
+ * @param {string} locusUrl - the locus URL for which the update is received
1324
+ * @param {LocusInfoUpdate} update - Details about the update.
778
1325
  * @returns {void}
779
1326
  */
1327
+ )
780
1328
  }, {
781
1329
  key: "updateFromHashTree",
782
- value: function updateFromHashTree(updateType, data) {
783
- var _this5 = this;
784
- switch (updateType) {
785
- case _hashTreeParser.LocusInfoUpdateType.OBJECTS_UPDATED:
1330
+ value: function updateFromHashTree(locusUrl, update) {
1331
+ var _this7 = this;
1332
+ switch (update.updateType) {
1333
+ case _hashTreeParser2.LocusInfoUpdateType.OBJECTS_UPDATED:
786
1334
  {
787
1335
  // initialize our new locus
788
1336
  var locus = {
789
1337
  participants: [],
790
1338
  jsSdkMeta: {
791
- removedParticipantIds: []
1339
+ removedParticipantIds: [],
1340
+ forceReplaceMembers: false
792
1341
  }
793
1342
  };
794
1343
 
795
1344
  // first go over all the updates and check what happens with the main locus object
796
1345
  var locusObjectStateAfterUpdates = LocusObjectStateAfterUpdates.unchanged;
797
- data.updatedObjects.forEach(function (object) {
1346
+ update.updatedObjects.forEach(function (object) {
798
1347
  if (object.htMeta.elementId.type.toLowerCase() === _types.ObjectType.locus) {
799
1348
  if (locusObjectStateAfterUpdates === LocusObjectStateAfterUpdates.updated) {
800
1349
  var _object$data;
@@ -803,7 +1352,7 @@ var LocusInfo = exports.default = /*#__PURE__*/function (_EventsScope) {
803
1352
  // but these should never happen
804
1353
  _loggerProxy.default.logger.warn("Locus-info:index#updateFromHashTree --> received multiple LOCUS objects in one update, this is unexpected!");
805
1354
  _metrics.default.sendBehavioralMetric(_constants2.default.LOCUS_HASH_TREE_UNSUPPORTED_OPERATION, {
806
- locusUrl: ((_object$data = object.data) === null || _object$data === void 0 ? void 0 : _object$data.url) || _this5.url,
1355
+ locusUrl: ((_object$data = object.data) === null || _object$data === void 0 ? void 0 : _object$data.url) || _this7.url,
807
1356
  message: object.data ? 'multiple LOCUS object updates' : 'LOCUS object update followed by removal'
808
1357
  });
809
1358
  }
@@ -814,17 +1363,30 @@ var LocusInfo = exports.default = /*#__PURE__*/function (_EventsScope) {
814
1363
  }
815
1364
  }
816
1365
  });
817
-
1366
+ var hashTreeParserEntry = this.hashTreeParsers.get(locusUrl);
1367
+ if (!hashTreeParserEntry) {
1368
+ _loggerProxy.default.logger.warn("Locus-info:index#updateFromHashTree --> no HashTreeParser found for locusUrl ".concat(locusUrl, " when trying to apply updates from hash tree"));
1369
+ return;
1370
+ }
1371
+ if (!hashTreeParserEntry.initializedFromHashTree) {
1372
+ // this is the first time we're getting an update for this locusUrl,
1373
+ // so it's probably a move to/from breakout. We need to start from a clean state,
1374
+ // so empty locus and we rely on Locus giving us sufficient data in the updates to populate it.
1375
+ _loggerProxy.default.logger.info("Locus-info:index#updateFromHashTree --> first INITIAL update for locusUrl ".concat(locusUrl, ", starting from empty state"));
1376
+ hashTreeParserEntry.initializedFromHashTree = true;
1377
+ // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
1378
+ locus.jsSdkMeta.forceReplaceMembers = true;
1379
+ } else if (
818
1380
  // if Locus object is unchanged or removed, we need to keep using the existing locus
819
1381
  // because the rest of the locusInfo code expects locus to always be present (with at least some of the fields)
820
1382
  // if it gets updated, we only need to have the fields that are not part of "locus" object (like "info" or "mediaShares")
821
1383
  // so that when Locus object gets updated, if the new one is missing some field, that field will
822
1384
  // be removed from our locusInfo
823
- if (locusObjectStateAfterUpdates === LocusObjectStateAfterUpdates.unchanged || locusObjectStateAfterUpdates === LocusObjectStateAfterUpdates.removed) {
1385
+ locusObjectStateAfterUpdates === LocusObjectStateAfterUpdates.unchanged || locusObjectStateAfterUpdates === LocusObjectStateAfterUpdates.removed) {
824
1386
  // copy over all of existing locus except participants
825
1387
  LocusDtoTopLevelKeys.forEach(function (key) {
826
1388
  if (key !== 'participants') {
827
- locus[key] = (0, _lodash.cloneDeep)(_this5[key]);
1389
+ locus[key] = (0, _lodash.cloneDeep)(_this7[key]);
828
1390
  }
829
1391
  });
830
1392
  } else {
@@ -832,11 +1394,11 @@ var LocusInfo = exports.default = /*#__PURE__*/function (_EventsScope) {
832
1394
  // (except participants, which need to stay empty - that means "no participant changes")
833
1395
  (0, _values.default)(_types.ObjectTypeToLocusKeyMap).forEach(function (locusDtoKey) {
834
1396
  if (locusDtoKey !== 'participants') {
835
- locus[locusDtoKey] = (0, _lodash.cloneDeep)(_this5[locusDtoKey]);
1397
+ locus[locusDtoKey] = (0, _lodash.cloneDeep)(_this7[locusDtoKey]);
836
1398
  }
837
1399
  });
838
1400
  }
839
- _loggerProxy.default.logger.info("Locus-info:index#updateFromHashTree --> LOCUS object is ".concat(locusObjectStateAfterUpdates, ", all updates: ").concat((0, _stringify.default)(data.updatedObjects.map(function (o) {
1401
+ _loggerProxy.default.logger.info("Locus-info:index#updateFromHashTree --> LOCUS object is ".concat(locusObjectStateAfterUpdates, ", all updates: ").concat((0, _stringify.default)(update.updatedObjects.map(function (o) {
840
1402
  return {
841
1403
  type: o.htMeta.elementId.type,
842
1404
  id: o.htMeta.elementId.id,
@@ -844,21 +1406,33 @@ var LocusInfo = exports.default = /*#__PURE__*/function (_EventsScope) {
844
1406
  };
845
1407
  }))));
846
1408
  // now apply all the updates from the hash tree onto the locus
847
- data.updatedObjects.forEach(function (object) {
848
- locus = _this5.updateLocusFromHashTreeObject(object, locus);
1409
+ update.updatedObjects.forEach(function (object) {
1410
+ locus = _this7.updateLocusFromHashTreeObject(object, locus);
849
1411
  });
850
1412
 
851
1413
  // update our locus info with the new locus
852
1414
  this.onDeltaLocus(locus);
853
1415
  break;
854
1416
  }
855
- case _hashTreeParser.LocusInfoUpdateType.MEETING_ENDED:
1417
+ case _hashTreeParser2.LocusInfoUpdateType.MEETING_ENDED:
856
1418
  {
857
1419
  var meeting = this.webex.meetings.meetingCollection.get(this.meetingId);
858
1420
  if (meeting) {
859
1421
  _loggerProxy.default.logger.info("Locus-info:index#updateFromHashTree --> received signal that meeting ended, destroying meeting ".concat(this.meetingId));
860
1422
  this.webex.meetings.destroy(meeting, _constants.MEETING_REMOVED_REASON.SELF_REMOVED);
861
1423
  }
1424
+ break;
1425
+ }
1426
+ case _hashTreeParser2.LocusInfoUpdateType.LOCUS_NOT_FOUND:
1427
+ {
1428
+ _loggerProxy.default.logger.info("Locus-info:index#updateFromHashTree --> received LOCUS_NOT_FOUND for ".concat(locusUrl, ", triggering syncMeetings"));
1429
+ this.webex.meetings.syncMeetings({
1430
+ keepOnlyLocusMeetings: false,
1431
+ skipHashTreeSync: true
1432
+ }).catch(function (syncError) {
1433
+ _loggerProxy.default.logger.error("Locus-info:index#updateFromHashTree --> syncMeetings failed after LOCUS_NOT_FOUND: ".concat(syncError));
1434
+ });
1435
+ break;
862
1436
  }
863
1437
  }
864
1438
  }
@@ -872,8 +1446,14 @@ var LocusInfo = exports.default = /*#__PURE__*/function (_EventsScope) {
872
1446
  }, {
873
1447
  key: "parse",
874
1448
  value: function parse(meeting, data) {
875
- if (this.hashTreeParser) {
876
- this.handleHashTreeMessage(meeting, data.eventType, data.stateElementsMessage);
1449
+ if (this.isUsingHashTrees()) {
1450
+ if (data.eventType === _constants.LOCUSEVENT.SDK_LOCUS_FROM_SYNC_MEETINGS) {
1451
+ // sync meetings response follows the format of "not wrapped" locus API responses,
1452
+ // so has no dataSets nor Metadata
1453
+ this.handleLocusAPIResponse(meeting, _objectSpread({}, data.locus));
1454
+ } else {
1455
+ this.handleHashTreeMessage(meeting, data.eventType, data.stateElementsMessage);
1456
+ }
877
1457
  } else {
878
1458
  var eventType = data.eventType;
879
1459
  if (eventType === _constants.LOCUSEVENT.HASH_TREE_DATA_UPDATED) {
@@ -934,23 +1514,27 @@ var LocusInfo = exports.default = /*#__PURE__*/function (_EventsScope) {
934
1514
  * @param {string} debugText string explaining the trigger for this call, added to logs for debugging purposes
935
1515
  * @param {object} locus locus object
936
1516
  * @param {object} metadata locus hash trees metadata
937
- * @param {string} eventType locus event
938
1517
  * @param {DataSet[]} dataSets
1518
+ * @param {string} eventType locus event
939
1519
  * @returns {void}
940
1520
  */
941
1521
  }, {
942
1522
  key: "onFullLocusWithHashTrees",
943
- value: function onFullLocusWithHashTrees(debugText, locus, metadata, eventType, dataSets) {
944
- if (!this.hashTreeParser) {
945
- _loggerProxy.default.logger.info("Locus-info:index#onFullLocus (".concat(debugText, ") --> creating hash tree parser"));
1523
+ value: function onFullLocusWithHashTrees(debugText, locus, metadata, dataSets, eventType) {
1524
+ if (!this.hashTreeParsers.has(locus.url)) {
1525
+ _loggerProxy.default.logger.info("Locus-info:index#onFullLocus (".concat(debugText, ") --> creating hash tree parser for locusUrl=").concat(locus.url));
946
1526
  _loggerProxy.default.logger.info("Locus-info:index#onFullLocus (".concat(debugText, ") --> dataSets:"), dataSets, ' and locus:', locus, ' and metadata:', metadata);
947
- this.hashTreeParser = this.createHashTreeParser({
1527
+ this.createHashTreeParser({
1528
+ locusUrl: locus.url,
948
1529
  initialLocus: {
949
1530
  locus: locus,
950
1531
  dataSets: dataSets
951
1532
  },
952
1533
  metadata: metadata
953
1534
  });
1535
+ // we have a full locus to start with, so we consider Locus info to be "initialized"
1536
+ // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
1537
+ this.hashTreeParsers.get(locus.url).initializedFromHashTree = true;
954
1538
  this.onFullLocusCommon(locus, eventType);
955
1539
  } else {
956
1540
  // in this case the Locus we're getting is not necessarily the full one
@@ -1004,7 +1588,7 @@ var LocusInfo = exports.default = /*#__PURE__*/function (_EventsScope) {
1004
1588
  throw new Error("Locus-info:index#onFullLocus (".concat(debugText, ") --> hash tree metadata is missing with full Locus"));
1005
1589
  }
1006
1590
  // this is the new hashmap Locus DTO format (only applicable to webinars for now)
1007
- this.onFullLocusWithHashTrees(debugText, locus, metadata, eventType, dataSets);
1591
+ this.onFullLocusWithHashTrees(debugText, locus, metadata, dataSets, eventType);
1008
1592
  } else {
1009
1593
  this.onFullLocusClassic(debugText, locus, eventType);
1010
1594
  }
@@ -1020,15 +1604,15 @@ var LocusInfo = exports.default = /*#__PURE__*/function (_EventsScope) {
1020
1604
  key: "onFullLocusCommon",
1021
1605
  value: function onFullLocusCommon(locus, eventType) {
1022
1606
  var _this$participants,
1023
- _this6 = this,
1607
+ _this8 = this,
1024
1608
  _locus$jsSdkMeta;
1025
1609
  this.scheduledMeeting = locus.meeting || null;
1026
1610
  this.participants = locus.participants;
1027
1611
  (_this$participants = this.participants) === null || _this$participants === void 0 ? void 0 : _this$participants.forEach(function (participant) {
1028
1612
  var _participant$htMeta;
1029
1613
  // participant.htMeta is set only for hash tree based locus
1030
- if ((_participant$htMeta = participant.htMeta) !== null && _participant$htMeta !== void 0 && _participant$htMeta.elementId.id) {
1031
- _this6.hashTreeObjectId2ParticipantId.set(participant.htMeta.elementId.id, participant.id);
1614
+ if (typeof ((_participant$htMeta = participant.htMeta) === null || _participant$htMeta === void 0 ? void 0 : _participant$htMeta.elementId.id) === 'number') {
1615
+ _this8.hashTreeObjectId2ParticipantId.set(participant.htMeta.elementId.id, participant.id);
1032
1616
  }
1033
1617
  });
1034
1618
  var isReplaceMembers = _controlsUtils.default.isNeedReplaceMembers(this.controls, locus.controls);
@@ -1078,6 +1662,30 @@ var LocusInfo = exports.default = /*#__PURE__*/function (_EventsScope) {
1078
1662
  }
1079
1663
  }
1080
1664
 
1665
+ /**
1666
+ * Makes sure that passed in locus object has a participant object for self.
1667
+ *
1668
+ * @param {LocusDTO} locus The locus object to check and modify if needed
1669
+ * @returns {void}
1670
+ */
1671
+ }, {
1672
+ key: "ensureSelfParticipantExists",
1673
+ value: function ensureSelfParticipantExists(locus) {
1674
+ var self = locus.self;
1675
+
1676
+ // sanity check, this should never fail
1677
+ if (!(self !== null && self !== void 0 && self.identity) || !(0, _isArray.default)(locus.participants)) {
1678
+ _loggerProxy.default.logger.warn("Locus-info:index#ensureSelfParticipantExists --> locus object is missing required fields, cannot ensure self participant exists. self?.identity=\"".concat(self === null || self === void 0 ? void 0 : self.identity, "\""));
1679
+ return;
1680
+ }
1681
+ var selfExists = locus.participants.some(function (participant) {
1682
+ return participant.identity === self.identity;
1683
+ });
1684
+ if (!selfExists) {
1685
+ locus.participants.push(_objectSpread({}, self));
1686
+ }
1687
+ }
1688
+
1081
1689
  /**
1082
1690
  * @param {Object} locus
1083
1691
  * @returns {undefined}
@@ -1087,10 +1695,20 @@ var LocusInfo = exports.default = /*#__PURE__*/function (_EventsScope) {
1087
1695
  key: "onDeltaLocus",
1088
1696
  value: function onDeltaLocus(locus) {
1089
1697
  var _locus$jsSdkMeta2;
1090
- var isReplaceMembers = _controlsUtils.default.isNeedReplaceMembers(this.controls, locus.controls);
1698
+ var isReplaceMembers = ((_locus$jsSdkMeta2 = locus.jsSdkMeta) === null || _locus$jsSdkMeta2 === void 0 ? void 0 : _locus$jsSdkMeta2.forceReplaceMembers) !== undefined ? locus.jsSdkMeta.forceReplaceMembers : _controlsUtils.default.isNeedReplaceMembers(this.controls, locus.controls);
1699
+ if (isReplaceMembers) {
1700
+ // when we're moving between breakouts, Locus sometimes doesn't send us
1701
+ // any participants at all for a few seconds
1702
+ // Web app relies on having at least the self participant always there
1703
+ // so we copy self into participants if it's not there.
1704
+ this.ensureSelfParticipantExists(locus);
1705
+ }
1091
1706
  this.mergeParticipants(this.participants, locus.participants);
1092
- this.updateLocusInfo(locus);
1093
- this.updateParticipants(locus.participants, (_locus$jsSdkMeta2 = locus.jsSdkMeta) === null || _locus$jsSdkMeta2 === void 0 ? void 0 : _locus$jsSdkMeta2.removedParticipantIds, isReplaceMembers);
1707
+ var updatesApplied = this.updateLocusInfo(locus);
1708
+ if (updatesApplied) {
1709
+ var _locus$jsSdkMeta3;
1710
+ this.updateParticipants(locus.participants, (_locus$jsSdkMeta3 = locus.jsSdkMeta) === null || _locus$jsSdkMeta3 === void 0 ? void 0 : _locus$jsSdkMeta3.removedParticipantIds, isReplaceMembers);
1711
+ }
1094
1712
  this.isMeetingActive();
1095
1713
  }
1096
1714
 
@@ -1102,12 +1720,11 @@ var LocusInfo = exports.default = /*#__PURE__*/function (_EventsScope) {
1102
1720
  }, {
1103
1721
  key: "updateLocusInfo",
1104
1722
  value: function updateLocusInfo(locus) {
1105
- var _locus$self, _locus$self2;
1106
- if (((_locus$self = locus.self) === null || _locus$self === void 0 ? void 0 : _locus$self.reason) === 'MOVED' && ((_locus$self2 = locus.self) === null || _locus$self2 === void 0 ? void 0 : _locus$self2.state) === 'LEFT') {
1723
+ if (_util.default.isSelfMovedOrBreakoutEnded(locus)) {
1107
1724
  // When moved to a breakout session locus sends a message for the previous locus
1108
1725
  // indicating that we have been moved. It isn't helpful to continue parsing this
1109
1726
  // as it gets interpreted as if we have left the call
1110
- return;
1727
+ return false;
1111
1728
  }
1112
1729
  this.updateControls(locus.controls, locus.self);
1113
1730
  this.updateConversationUrl(locus.conversationUrl, locus.info);
@@ -1126,6 +1743,8 @@ var LocusInfo = exports.default = /*#__PURE__*/function (_EventsScope) {
1126
1743
  this.updateLinks(locus.links);
1127
1744
  this.compareAndUpdate();
1128
1745
  // update which required to compare different objects from locus
1746
+
1747
+ return true;
1129
1748
  }
1130
1749
 
1131
1750
  /**
@@ -1159,7 +1778,7 @@ var LocusInfo = exports.default = /*#__PURE__*/function (_EventsScope) {
1159
1778
  if (((_this$parsedLocus$ful3 = this.parsedLocus.fullState) === null || _this$parsedLocus$ful3 === void 0 ? void 0 : _this$parsedLocus$ful3.type) === _constants._CALL_ || ((_this$parsedLocus$ful4 = this.parsedLocus.fullState) === null || _this$parsedLocus$ful4 === void 0 ? void 0 : _this$parsedLocus$ful4.type) === _constants._SIP_BRIDGE_ || ((_this$parsedLocus$ful5 = this.parsedLocus.fullState) === null || _this$parsedLocus$ful5 === void 0 ? void 0 : _this$parsedLocus$ful5.type) === _constants._SPACE_SHARE_) {
1160
1779
  // @ts-ignore
1161
1780
  var partner = this.getLocusPartner(this.participants, this.self);
1162
- this.updateMeeting({
1781
+ this.callbacks.updateMeeting({
1163
1782
  partner: partner
1164
1783
  });
1165
1784
 
@@ -1179,8 +1798,19 @@ var LocusInfo = exports.default = /*#__PURE__*/function (_EventsScope) {
1179
1798
  name: 'client.call.remote-ended',
1180
1799
  options: {
1181
1800
  meetingId: this.meetingId
1801
+ },
1802
+ payload: {
1803
+ eventData: {
1804
+ joinInProgress: this.destroyMeetingSuspended
1805
+ }
1182
1806
  }
1183
1807
  });
1808
+ if (this.destroyMeetingSuspended) {
1809
+ _metrics.default.sendBehavioralMetric(_constants2.default.DESTROY_MEETING_WHILE_SUSPENDED, {
1810
+ meetingId: this.meetingId,
1811
+ reason: 'CALL_INACTIVE'
1812
+ });
1813
+ }
1184
1814
  this.emitScoped({
1185
1815
  file: 'locus-info',
1186
1816
  function: 'isMeetingActive'
@@ -1194,8 +1824,19 @@ var LocusInfo = exports.default = /*#__PURE__*/function (_EventsScope) {
1194
1824
  name: 'client.call.remote-ended',
1195
1825
  options: {
1196
1826
  meetingId: this.meetingId
1827
+ },
1828
+ payload: {
1829
+ eventData: {
1830
+ joinInProgress: this.destroyMeetingSuspended
1831
+ }
1197
1832
  }
1198
1833
  });
1834
+ if (this.destroyMeetingSuspended) {
1835
+ _metrics.default.sendBehavioralMetric(_constants2.default.DESTROY_MEETING_WHILE_SUSPENDED, {
1836
+ meetingId: this.meetingId,
1837
+ reason: 'PARTNER_LEFT'
1838
+ });
1839
+ }
1199
1840
  this.emitScoped({
1200
1841
  file: 'locus-info',
1201
1842
  function: 'isMeetingActive'
@@ -1210,8 +1851,19 @@ var LocusInfo = exports.default = /*#__PURE__*/function (_EventsScope) {
1210
1851
  name: 'client.call.remote-ended',
1211
1852
  options: {
1212
1853
  meetingId: this.meetingId
1854
+ },
1855
+ payload: {
1856
+ eventData: {
1857
+ joinInProgress: this.destroyMeetingSuspended
1858
+ }
1213
1859
  }
1214
1860
  });
1861
+ if (this.destroyMeetingSuspended) {
1862
+ _metrics.default.sendBehavioralMetric(_constants2.default.DESTROY_MEETING_WHILE_SUSPENDED, {
1863
+ meetingId: this.meetingId,
1864
+ reason: 'SELF_LEFT'
1865
+ });
1866
+ }
1215
1867
  this.emitScoped({
1216
1868
  file: 'locus-info',
1217
1869
  function: 'isMeetingActive'
@@ -1221,43 +1873,69 @@ var LocusInfo = exports.default = /*#__PURE__*/function (_EventsScope) {
1221
1873
  });
1222
1874
  }
1223
1875
  } else if (((_this$parsedLocus$ful6 = this.parsedLocus.fullState) === null || _this$parsedLocus$ful6 === void 0 ? void 0 : _this$parsedLocus$ful6.type) === _constants._MEETING_) {
1224
- if (this.fullState && (this.fullState.state === _constants.LOCUS.STATE.INACTIVE ||
1225
- // @ts-ignore
1226
- this.fullState.state === _constants.LOCUS.STATE.TERMINATING)) {
1227
- _loggerProxy.default.logger.warn('Locus-info:index#isMeetingActive --> Meeting is ending due to inactive or terminating');
1876
+ if (this.fullState && _util.default.isWholeMeetingEnded(this.fullState)) {
1877
+ if (this.destroyMeetingSuspended) {
1878
+ _loggerProxy.default.logger.info('Locus-info:index#isMeetingActive --> suppressing DESTROY_MEETING (MEETING_INACTIVE_TERMINATING) because destroyMeeting is suspended');
1879
+ _metrics.default.sendBehavioralMetric(_constants2.default.DESTROY_MEETING_WHILE_SUSPENDED, {
1880
+ meetingId: this.meetingId,
1881
+ reason: 'MEETING_INACTIVE_TERMINATING'
1882
+ });
1883
+ } else {
1884
+ _loggerProxy.default.logger.warn('Locus-info:index#isMeetingActive --> Meeting is ending due to inactive');
1228
1885
 
1229
- // @ts-ignore
1230
- this.webex.internal.newMetrics.submitClientEvent({
1231
- name: 'client.call.remote-ended',
1232
- options: {
1233
- meetingId: this.meetingId
1234
- }
1235
- });
1236
- this.emitScoped({
1237
- file: 'locus-info',
1238
- function: 'isMeetingActive'
1239
- }, _constants.EVENTS.DESTROY_MEETING, {
1240
- reason: _constants.MEETING_REMOVED_REASON.MEETING_INACTIVE_TERMINATING,
1241
- shouldLeave: false
1242
- });
1886
+ // @ts-ignore
1887
+ this.webex.internal.newMetrics.submitClientEvent({
1888
+ name: 'client.call.remote-ended',
1889
+ options: {
1890
+ meetingId: this.meetingId
1891
+ }
1892
+ });
1893
+ this.emitScoped({
1894
+ file: 'locus-info',
1895
+ function: 'isMeetingActive'
1896
+ }, _constants.EVENTS.DESTROY_MEETING, {
1897
+ reason: _constants.MEETING_REMOVED_REASON.MEETING_INACTIVE_TERMINATING,
1898
+ shouldLeave: false
1899
+ });
1900
+ }
1243
1901
  }
1244
1902
  // If you are guest and you are removed from the meeting
1245
1903
  // You wont get any further events
1246
1904
  else if (this.parsedLocus.self && this.parsedLocus.self.removed) {
1247
- // Check if we need to send an event
1248
- this.emitScoped({
1249
- file: 'locus-info',
1250
- function: 'isMeetingActive'
1251
- }, _constants.EVENTS.DESTROY_MEETING, {
1252
- reason: _constants.MEETING_REMOVED_REASON.SELF_REMOVED,
1253
- shouldLeave: false
1254
- });
1905
+ if (this.destroyMeetingSuspended) {
1906
+ _loggerProxy.default.logger.info('Locus-info:index#isMeetingActive --> suppressing DESTROY_MEETING (SELF_REMOVED) because destroyMeeting is suspended');
1907
+ _metrics.default.sendBehavioralMetric(_constants2.default.DESTROY_MEETING_WHILE_SUSPENDED, {
1908
+ meetingId: this.meetingId,
1909
+ reason: 'SELF_REMOVED'
1910
+ });
1911
+ } else {
1912
+ this.emitScoped({
1913
+ file: 'locus-info',
1914
+ function: 'isMeetingActive'
1915
+ }, _constants.EVENTS.DESTROY_MEETING, {
1916
+ reason: _constants.MEETING_REMOVED_REASON.SELF_REMOVED,
1917
+ shouldLeave: false
1918
+ });
1919
+ }
1255
1920
  }
1256
1921
  } else {
1257
1922
  _loggerProxy.default.logger.warn('Locus-info:index#isMeetingActive --> Meeting Type is unknown.');
1258
1923
  }
1259
1924
  }
1260
1925
 
1926
+ /**
1927
+ * Suspends or resumes the emission of DESTROY_MEETING events in certain situations.
1928
+ * Used by joinWithMedia to prevent meeting destruction during retry flows.
1929
+ * @param {boolean} suspend - true to suppress, false to resume
1930
+ * @returns {undefined}
1931
+ * @memberof LocusInfo
1932
+ */
1933
+ }, {
1934
+ key: "suspendDestroyMeeting",
1935
+ value: function suspendDestroyMeeting(suspend) {
1936
+ this.destroyMeetingSuspended = suspend;
1937
+ }
1938
+
1261
1939
  /**
1262
1940
  * checks if the host permissions have changed while in the meeting
1263
1941
  * This would be the case if your role as host or moderator has been updated
@@ -1326,11 +2004,11 @@ var LocusInfo = exports.default = /*#__PURE__*/function (_EventsScope) {
1326
2004
  isReplace: isReplace
1327
2005
  });
1328
2006
  if (participants && (0, _isArray.default)(participants) && participants.length > 0) {
1329
- var _iterator2 = _createForOfIteratorHelper(participants),
1330
- _step2;
2007
+ var _iterator4 = _createForOfIteratorHelper(participants),
2008
+ _step4;
1331
2009
  try {
1332
- for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {
1333
- var participant = _step2.value;
2010
+ for (_iterator4.s(); !(_step4 = _iterator4.n()).done;) {
2011
+ var participant = _step4.value;
1334
2012
  if (participant && (participant === null || participant === void 0 ? void 0 : participant.reason) === 'FAILURE') {
1335
2013
  var _participant$person;
1336
2014
  this.emitScoped({
@@ -1342,9 +2020,9 @@ var LocusInfo = exports.default = /*#__PURE__*/function (_EventsScope) {
1342
2020
  }
1343
2021
  }
1344
2022
  } catch (err) {
1345
- _iterator2.e(err);
2023
+ _iterator4.e(err);
1346
2024
  } finally {
1347
- _iterator2.f();
2025
+ _iterator4.f();
1348
2026
  }
1349
2027
  }
1350
2028
  }
@@ -1465,7 +2143,9 @@ var LocusInfo = exports.default = /*#__PURE__*/function (_EventsScope) {
1465
2143
  }, _constants.LOCUSINFO.EVENTS.CONTROLS_RECORDING_UPDATED, {
1466
2144
  state: state,
1467
2145
  modifiedBy: current.record.modifiedBy,
1468
- lastModified: current.record.lastModified
2146
+ lastModified: current.record.lastModified,
2147
+ modifiedByServiceAppName: current.record.modifiedByServiceAppName,
2148
+ modifiedByServiceAppId: current.record.modifiedByServiceAppId
1469
2149
  });
1470
2150
  }
1471
2151
  if (hasMeetingContainerChanged) {
@@ -1545,7 +2225,7 @@ var LocusInfo = exports.default = /*#__PURE__*/function (_EventsScope) {
1545
2225
  }
1546
2226
  if (hasEntryExitToneChanged) {
1547
2227
  var entryExitTone = current.entryExitTone;
1548
- this.updateMeeting({
2228
+ this.callbacks.updateMeeting({
1549
2229
  entryExitTone: entryExitTone
1550
2230
  });
1551
2231
  this.emitScoped({
@@ -1560,7 +2240,7 @@ var LocusInfo = exports.default = /*#__PURE__*/function (_EventsScope) {
1560
2240
  // to fit with audio mute status logic
1561
2241
  if (hasVideoEnabledChanged) {
1562
2242
  var videoEnabled = current.videoEnabled;
1563
- this.updateMeeting({
2243
+ this.callbacks.updateMeeting({
1564
2244
  unmuteVideoAllowed: videoEnabled
1565
2245
  });
1566
2246
  this.emitScoped({
@@ -1650,12 +2330,12 @@ var LocusInfo = exports.default = /*#__PURE__*/function (_EventsScope) {
1650
2330
  value: function updateConversationUrl(conversationUrl, info) {
1651
2331
  if (conversationUrl && !(0, _lodash.isEqual)(this.conversationUrl, conversationUrl)) {
1652
2332
  this.conversationUrl = conversationUrl;
1653
- this.updateMeeting({
2333
+ this.callbacks.updateMeeting({
1654
2334
  conversationUrl: conversationUrl
1655
2335
  });
1656
2336
  } else if (info && info.conversationUrl && !(0, _lodash.isEqual)(this.conversationUrl, info.conversationUrl)) {
1657
2337
  this.conversationUrl = info.conversationUrl;
1658
- this.updateMeeting({
2338
+ this.callbacks.updateMeeting({
1659
2339
  conversationUrl: info.conversationUrl
1660
2340
  });
1661
2341
  }
@@ -1684,9 +2364,9 @@ var LocusInfo = exports.default = /*#__PURE__*/function (_EventsScope) {
1684
2364
  key: "updateLinks",
1685
2365
  value: function updateLinks(links) {
1686
2366
  var _this$links, _this$links2;
1687
- var _ref2 = links || {},
1688
- services = _ref2.services,
1689
- resources = _ref2.resources;
2367
+ var _ref5 = links || {},
2368
+ services = _ref5.services,
2369
+ resources = _ref5.resources;
1690
2370
  if (services && !(0, _lodash.isEqual)((_this$links = this.links) === null || _this$links === void 0 ? void 0 : _this$links.services, services)) {
1691
2371
  this.emitScoped({
1692
2372
  file: 'locus-info',
@@ -1716,7 +2396,7 @@ var LocusInfo = exports.default = /*#__PURE__*/function (_EventsScope) {
1716
2396
  value: function updateFullState(fullState) {
1717
2397
  if (fullState && !(0, _lodash.isEqual)(this.fullState, fullState)) {
1718
2398
  var result = _fullState.default.getFullState(this.fullState, fullState);
1719
- this.updateMeeting(result.current);
2399
+ this.callbacks.updateMeeting(result.current);
1720
2400
  if (result.updates.meetingStateChangedTo) {
1721
2401
  this.emitScoped({
1722
2402
  file: 'locus-info',
@@ -1751,7 +2431,7 @@ var LocusInfo = exports.default = /*#__PURE__*/function (_EventsScope) {
1751
2431
  value: function updateHostInfo(host) {
1752
2432
  if (host && !(0, _lodash.isEqual)(this.host, host)) {
1753
2433
  var parsedHosts = _hostUtils.default.getHosts(this.host, host);
1754
- this.updateMeeting(parsedHosts.current);
2434
+ this.callbacks.updateMeeting(parsedHosts.current);
1755
2435
  this.parsedLocus.host = parsedHosts.current;
1756
2436
  if (parsedHosts.updates.isNewHost) {
1757
2437
  this.compareAndUpdateFlags.compareSelfAndHost = true;
@@ -1778,11 +2458,20 @@ var LocusInfo = exports.default = /*#__PURE__*/function (_EventsScope) {
1778
2458
  }, {
1779
2459
  key: "updateMeetingInfo",
1780
2460
  value: function updateMeetingInfo(info, self) {
1781
- var _this$parsedLocus$sel;
1782
- var roles = self ? _selfUtils.default.getRoles(self) : ((_this$parsedLocus$sel = this.parsedLocus.self) === null || _this$parsedLocus$sel === void 0 ? void 0 : _this$parsedLocus$sel.roles) || [];
1783
- if (info && !(0, _lodash.isEqual)(this.info, info) || !(0, _lodash.isEqual)(this.roles, roles) && info) {
1784
- var isJoined = _selfUtils.default.isJoined(self || this.parsedLocus.self);
1785
- var parsedInfo = _infoUtils.default.getInfos(this.parsedLocus.info, info, roles, isJoined);
2461
+ var _this$parsedLocus$sel3;
2462
+ var roles = self ? _selfUtils.default.getRoles(self) : ((_this$parsedLocus$sel3 = this.parsedLocus.self) === null || _this$parsedLocus$sel3 === void 0 ? void 0 : _this$parsedLocus$sel3.roles) || [];
2463
+ var isJoined = _selfUtils.default.isJoined(self || this.parsedLocus.self);
2464
+
2465
+ // The parsed userDisplayHints depend on info, roles and isJoined, so we must recompute
2466
+ // whenever any of them changes. A common case is self transitioning to JOINED via a delta
2467
+ // that doesn't carry an info section - in that case we fall back to the previously stored
2468
+ // info so the hints get reparsed with the new joined state (e.g. VIEW_THE_PARTICIPANT_LIST).
2469
+ var infoToParse = info || this.info;
2470
+ var infoChanged = info && !(0, _lodash.isEqual)(this.info, info);
2471
+ var rolesChanged = !(0, _lodash.isEqual)(this.roles, roles);
2472
+ var isJoinedChanged = _selfUtils.default.isJoined(this.parsedLocus.self) !== isJoined;
2473
+ if (infoToParse && (infoChanged || rolesChanged || isJoinedChanged)) {
2474
+ var parsedInfo = _infoUtils.default.getInfos(this.parsedLocus.info, infoToParse, roles, isJoined);
1786
2475
  if (parsedInfo.updates.isLocked) {
1787
2476
  this.emitScoped({
1788
2477
  file: 'locus-info',
@@ -1795,10 +2484,10 @@ var LocusInfo = exports.default = /*#__PURE__*/function (_EventsScope) {
1795
2484
  function: 'updateMeetingInfo'
1796
2485
  }, _constants.LOCUSINFO.EVENTS.MEETING_UNLOCKED, info);
1797
2486
  }
1798
- this.info = info;
2487
+ this.info = infoToParse;
1799
2488
  this.parsedLocus.info = parsedInfo.current;
1800
2489
  // Parses the info and adds necessary values
1801
- this.updateMeeting(parsedInfo.current);
2490
+ this.callbacks.updateMeeting(parsedInfo.current);
1802
2491
  this.emitScoped({
1803
2492
  file: 'locus-info',
1804
2493
  function: 'updateMeetingInfo'
@@ -1822,7 +2511,7 @@ var LocusInfo = exports.default = /*#__PURE__*/function (_EventsScope) {
1822
2511
  return;
1823
2512
  }
1824
2513
  var parsedEmbeddedApps = _embeddedAppsUtils.default.parse(embeddedApps);
1825
- this.updateMeeting({
2514
+ this.callbacks.updateMeeting({
1826
2515
  embeddedApps: parsedEmbeddedApps
1827
2516
  });
1828
2517
  this.emitScoped({
@@ -1846,7 +2535,7 @@ var LocusInfo = exports.default = /*#__PURE__*/function (_EventsScope) {
1846
2535
  var forceUpdate = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
1847
2536
  if (mediaShares && (!(0, _lodash.isEqual)(this.mediaShares, mediaShares) || forceUpdate)) {
1848
2537
  var parsedMediaShares = _mediaSharesUtils.default.getMediaShares(this.mediaShares, mediaShares);
1849
- this.updateMeeting(parsedMediaShares.current);
2538
+ this.callbacks.updateMeeting(parsedMediaShares.current);
1850
2539
  this.parsedLocus.mediaShares = parsedMediaShares.current;
1851
2540
  this.mediaShares = mediaShares;
1852
2541
  this.emitScoped({
@@ -1885,10 +2574,11 @@ var LocusInfo = exports.default = /*#__PURE__*/function (_EventsScope) {
1885
2574
  value: function updateSelf(self) {
1886
2575
  if (self) {
1887
2576
  var _this$parsedLocus$ful7, _this$parsedLocus$inf;
2577
+ var wasLlmExpected = this.isLlmExpected();
1888
2578
  // @ts-ignore
1889
2579
  var parsedSelves = _selfUtils.default.getSelves(this.parsedLocus.self, self, this.webex.internal.device.url, this.participants // using this.participants instead of locus.participants here, because with delta DTOs locus.participants will only contain a small subset of participants
1890
2580
  );
1891
- this.updateMeeting(parsedSelves.current);
2581
+ this.callbacks.updateMeeting(parsedSelves.current);
1892
2582
  this.parsedLocus.self = parsedSelves.current;
1893
2583
  var element = this.parsedLocus.states[this.parsedLocus.states.length - 1];
1894
2584
  if (element !== parsedSelves.current.state) {
@@ -1899,7 +2589,7 @@ var LocusInfo = exports.default = /*#__PURE__*/function (_EventsScope) {
1899
2589
  // this.emit(LOCUSINFO.EVENTS.MEETING_UPDATE, SelfUtils.getSipUrl(this.getLocusPartner(participants, self), this.parsedLocus.fullState?.type, this.parsedLocus.info?.sipUri));
1900
2590
  var result = _selfUtils.default.getSipUrl(this.getLocusPartner(this.participants, self), (_this$parsedLocus$ful7 = this.parsedLocus.fullState) === null || _this$parsedLocus$ful7 === void 0 ? void 0 : _this$parsedLocus$ful7.type, (_this$parsedLocus$inf = this.parsedLocus.info) === null || _this$parsedLocus$inf === void 0 ? void 0 : _this$parsedLocus$inf.sipUri);
1901
2591
  if (result !== null && result !== void 0 && result.sipUri) {
1902
- this.updateMeeting(result);
2592
+ this.callbacks.updateMeeting(result);
1903
2593
  }
1904
2594
  if (parsedSelves.updates.moderatorChanged) {
1905
2595
  this.compareAndUpdateFlags.compareHostAndSelf = true;
@@ -1981,21 +2671,25 @@ var LocusInfo = exports.default = /*#__PURE__*/function (_EventsScope) {
1981
2671
  });
1982
2672
  }
1983
2673
  if (parsedSelves.updates.localAudioUnmuteRequiredByServer) {
2674
+ var _parsedSelves$current2;
1984
2675
  this.emitScoped({
1985
2676
  file: 'locus-info',
1986
2677
  function: 'updateSelf'
1987
2678
  }, _constants.LOCUSINFO.EVENTS.LOCAL_UNMUTE_REQUIRED, {
1988
2679
  muted: parsedSelves.current.remoteMuted,
1989
- unmuteAllowed: parsedSelves.current.unmuteAllowed
2680
+ unmuteAllowed: parsedSelves.current.unmuteAllowed,
2681
+ modifiedBy: (_parsedSelves$current2 = parsedSelves.current.modifiedBy) !== null && _parsedSelves$current2 !== void 0 ? _parsedSelves$current2 : null
1990
2682
  });
1991
2683
  }
1992
2684
  if (parsedSelves.updates.isMutedByOthersChanged) {
2685
+ var _parsedSelves$current3;
1993
2686
  this.emitScoped({
1994
2687
  file: 'locus-info',
1995
2688
  function: 'updateSelf'
1996
2689
  }, _constants.LOCUSINFO.EVENTS.SELF_REMOTE_MUTE_STATUS_UPDATED, {
1997
2690
  muted: parsedSelves.current.remoteMuted,
1998
- unmuteAllowed: parsedSelves.current.unmuteAllowed
2691
+ unmuteAllowed: parsedSelves.current.unmuteAllowed,
2692
+ modifiedBy: (_parsedSelves$current3 = parsedSelves.current.modifiedBy) !== null && _parsedSelves$current3 !== void 0 ? _parsedSelves$current3 : null
1999
2693
  });
2000
2694
  }
2001
2695
  if (parsedSelves.updates.localAudioUnmuteRequestedByServer) {
@@ -2025,14 +2719,14 @@ var LocusInfo = exports.default = /*#__PURE__*/function (_EventsScope) {
2025
2719
  _constants.LOCUSINFO.EVENTS.MEDIA_INACTIVITY, _selfUtils.default.getMediaStatus(self.mediaSessions));
2026
2720
  }
2027
2721
  if (parsedSelves.updates.audioStateChange || parsedSelves.updates.videoStateChange || parsedSelves.updates.shareStateChange) {
2028
- var _parsedSelves$current2, _parsedSelves$current3, _parsedSelves$current4;
2722
+ var _parsedSelves$current4, _parsedSelves$current5, _parsedSelves$current6;
2029
2723
  this.emitScoped({
2030
2724
  file: 'locus-info',
2031
2725
  function: 'updateSelf'
2032
2726
  }, _constants.LOCUSINFO.EVENTS.MEDIA_STATUS_CHANGE, {
2033
- audioStatus: (_parsedSelves$current2 = parsedSelves.current.currentMediaStatus) === null || _parsedSelves$current2 === void 0 ? void 0 : _parsedSelves$current2.audio,
2034
- videoStatus: (_parsedSelves$current3 = parsedSelves.current.currentMediaStatus) === null || _parsedSelves$current3 === void 0 ? void 0 : _parsedSelves$current3.video,
2035
- shareStatus: (_parsedSelves$current4 = parsedSelves.current.currentMediaStatus) === null || _parsedSelves$current4 === void 0 ? void 0 : _parsedSelves$current4.share
2727
+ audioStatus: (_parsedSelves$current4 = parsedSelves.current.currentMediaStatus) === null || _parsedSelves$current4 === void 0 ? void 0 : _parsedSelves$current4.audio,
2728
+ videoStatus: (_parsedSelves$current5 = parsedSelves.current.currentMediaStatus) === null || _parsedSelves$current5 === void 0 ? void 0 : _parsedSelves$current5.video,
2729
+ shareStatus: (_parsedSelves$current6 = parsedSelves.current.currentMediaStatus) === null || _parsedSelves$current6 === void 0 ? void 0 : _parsedSelves$current6.share
2036
2730
  });
2037
2731
  }
2038
2732
  if (parsedSelves.updates.isUserObserving) {
@@ -2067,6 +2761,15 @@ var LocusInfo = exports.default = /*#__PURE__*/function (_EventsScope) {
2067
2761
  this.parsedLocus.self = parsedSelves.current;
2068
2762
  // @ts-ignore
2069
2763
  this.self = self;
2764
+
2765
+ // If LLM just became expected (self reported JOINED), some hash tree parsers may have skipped
2766
+ // arming heartbeat watchdog timers for LLM data sets whose messages arrived before this
2767
+ // update. Re-evaluate them now so those watchdogs get armed.
2768
+ if (!wasLlmExpected && this.isLlmExpected()) {
2769
+ this.hashTreeParsers.forEach(function (entry) {
2770
+ entry.parser.reevaluateLlmWatchdogs();
2771
+ });
2772
+ }
2070
2773
  } else {
2071
2774
  this.compareAndUpdateFlags.compareHostAndSelf = false;
2072
2775
  }
@@ -2085,7 +2788,7 @@ var LocusInfo = exports.default = /*#__PURE__*/function (_EventsScope) {
2085
2788
  var isMainLocus = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;
2086
2789
  if (url && this.url !== url) {
2087
2790
  this.url = url;
2088
- this.updateMeeting({
2791
+ this.callbacks.updateMeeting({
2089
2792
  locusUrl: url
2090
2793
  });
2091
2794
  this.emitScoped({
@@ -2214,7 +2917,7 @@ var LocusInfo = exports.default = /*#__PURE__*/function (_EventsScope) {
2214
2917
  }, {
2215
2918
  key: "updateMainSessionLocusCache",
2216
2919
  value: function updateMainSessionLocusCache(mainLocus) {
2217
- var _this7 = this;
2920
+ var _this9 = this;
2218
2921
  if (!mainLocus) {
2219
2922
  return;
2220
2923
  }
@@ -2223,7 +2926,7 @@ var LocusInfo = exports.default = /*#__PURE__*/function (_EventsScope) {
2223
2926
  // shallow merge and do special merge for participants
2224
2927
  (0, _lodash.assignWith)(this.mainSessionLocusCache, locusClone, function (objValue, srcValue, key) {
2225
2928
  if (key === 'participants') {
2226
- return _this7.mergeParticipants(objValue, srcValue);
2929
+ return _this9.mergeParticipants(objValue, srcValue);
2227
2930
  }
2228
2931
  return srcValue || objValue;
2229
2932
  });
@@ -2242,6 +2945,21 @@ var LocusInfo = exports.default = /*#__PURE__*/function (_EventsScope) {
2242
2945
  value: function clearMainSessionLocusCache() {
2243
2946
  this.mainSessionLocusCache = null;
2244
2947
  }
2948
+
2949
+ /**
2950
+ * Cleans up all hash tree parsers and clears internal maps.
2951
+ * @returns {void}
2952
+ * @memberof LocusInfo
2953
+ */
2954
+ }, {
2955
+ key: "cleanUp",
2956
+ value: function cleanUp() {
2957
+ this.hashTreeParsers.forEach(function (entry) {
2958
+ entry.parser.cleanUp();
2959
+ });
2960
+ this.hashTreeParsers.clear();
2961
+ this.hashTreeObjectId2ParticipantId.clear();
2962
+ }
2245
2963
  }]);
2246
2964
  }(_eventsScope.default);
2247
2965
  //# sourceMappingURL=index.js.map