@webex/plugin-meetings 3.11.0-webex-services-ready.1 → 3.12.0-auth-prejoin-fetch.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (294) hide show
  1. package/AGENTS.md +9 -0
  2. package/dist/aiEnableRequest/index.js +197 -0
  3. package/dist/aiEnableRequest/index.js.map +1 -0
  4. package/dist/aiEnableRequest/utils.js +36 -0
  5. package/dist/aiEnableRequest/utils.js.map +1 -0
  6. package/dist/annotation/index.js +16 -7
  7. package/dist/annotation/index.js.map +1 -1
  8. package/dist/breakouts/breakout.js +8 -3
  9. package/dist/breakouts/breakout.js.map +1 -1
  10. package/dist/breakouts/events.js +29 -14
  11. package/dist/breakouts/events.js.map +1 -1
  12. package/dist/breakouts/index.js +99 -4
  13. package/dist/breakouts/index.js.map +1 -1
  14. package/dist/common/errors/webex-errors.js +49 -5
  15. package/dist/common/errors/webex-errors.js.map +1 -1
  16. package/dist/config.js +8 -3
  17. package/dist/config.js.map +1 -1
  18. package/dist/constants.js +60 -11
  19. package/dist/constants.js.map +1 -1
  20. package/dist/controls-options-manager/constants.js +11 -1
  21. package/dist/controls-options-manager/constants.js.map +1 -1
  22. package/dist/controls-options-manager/index.js +67 -29
  23. package/dist/controls-options-manager/index.js.map +1 -1
  24. package/dist/controls-options-manager/util.js +91 -0
  25. package/dist/controls-options-manager/util.js.map +1 -1
  26. package/dist/hashTree/constants.js +16 -2
  27. package/dist/hashTree/constants.js.map +1 -1
  28. package/dist/hashTree/hashTree.js +18 -0
  29. package/dist/hashTree/hashTree.js.map +1 -1
  30. package/dist/hashTree/hashTreeParser.js +1655 -538
  31. package/dist/hashTree/hashTreeParser.js.map +1 -1
  32. package/dist/hashTree/types.js +4 -2
  33. package/dist/hashTree/types.js.map +1 -1
  34. package/dist/hashTree/utils.js +52 -0
  35. package/dist/hashTree/utils.js.map +1 -1
  36. package/dist/index.js +18 -2
  37. package/dist/index.js.map +1 -1
  38. package/dist/interceptors/constant.js +12 -0
  39. package/dist/interceptors/constant.js.map +1 -0
  40. package/dist/interceptors/dataChannelAuthToken.js +350 -0
  41. package/dist/interceptors/dataChannelAuthToken.js.map +1 -0
  42. package/dist/interceptors/index.js +7 -0
  43. package/dist/interceptors/index.js.map +1 -1
  44. package/dist/interceptors/locusRetry.js +23 -8
  45. package/dist/interceptors/locusRetry.js.map +1 -1
  46. package/dist/interceptors/utils.js +27 -0
  47. package/dist/interceptors/utils.js.map +1 -0
  48. package/dist/interpretation/index.js +11 -2
  49. package/dist/interpretation/index.js.map +1 -1
  50. package/dist/interpretation/interpretation.types.js +7 -0
  51. package/dist/interpretation/interpretation.types.js.map +1 -0
  52. package/dist/interpretation/siLanguage.js +1 -1
  53. package/dist/locus-info/controlsUtils.js +9 -4
  54. package/dist/locus-info/controlsUtils.js.map +1 -1
  55. package/dist/locus-info/index.js +914 -212
  56. package/dist/locus-info/index.js.map +1 -1
  57. package/dist/locus-info/infoUtils.js +36 -5
  58. package/dist/locus-info/infoUtils.js.map +1 -1
  59. package/dist/locus-info/selfUtils.js +1 -0
  60. package/dist/locus-info/selfUtils.js.map +1 -1
  61. package/dist/locus-info/types.js +19 -0
  62. package/dist/locus-info/types.js.map +1 -1
  63. package/dist/media/MediaConnectionAwaiter.js +72 -3
  64. package/dist/media/MediaConnectionAwaiter.js.map +1 -1
  65. package/dist/media/index.js +8 -2
  66. package/dist/media/index.js.map +1 -1
  67. package/dist/media/properties.js +8 -7
  68. package/dist/media/properties.js.map +1 -1
  69. package/dist/meeting/in-meeting-actions.js +11 -1
  70. package/dist/meeting/in-meeting-actions.js.map +1 -1
  71. package/dist/meeting/index.js +2347 -1096
  72. package/dist/meeting/index.js.map +1 -1
  73. package/dist/meeting/locusMediaRequest.js +229 -82
  74. package/dist/meeting/locusMediaRequest.js.map +1 -1
  75. package/dist/meeting/muteState.js +10 -1
  76. package/dist/meeting/muteState.js.map +1 -1
  77. package/dist/meeting/request.js +55 -2
  78. package/dist/meeting/request.js.map +1 -1
  79. package/dist/meeting/request.type.js.map +1 -1
  80. package/dist/meeting/util.js +168 -5
  81. package/dist/meeting/util.js.map +1 -1
  82. package/dist/meeting-info/meeting-info-v2.js +100 -38
  83. package/dist/meeting-info/meeting-info-v2.js.map +1 -1
  84. package/dist/meetings/index.js +466 -174
  85. package/dist/meetings/index.js.map +1 -1
  86. package/dist/meetings/meetings.types.js +6 -1
  87. package/dist/meetings/meetings.types.js.map +1 -1
  88. package/dist/meetings/request.js +39 -0
  89. package/dist/meetings/request.js.map +1 -1
  90. package/dist/meetings/util.js +116 -18
  91. package/dist/meetings/util.js.map +1 -1
  92. package/dist/member/index.js +20 -0
  93. package/dist/member/index.js.map +1 -1
  94. package/dist/member/types.js.map +1 -1
  95. package/dist/member/util.js +40 -0
  96. package/dist/member/util.js.map +1 -1
  97. package/dist/members/index.js +101 -43
  98. package/dist/members/index.js.map +1 -1
  99. package/dist/members/util.js +8 -1
  100. package/dist/members/util.js.map +1 -1
  101. package/dist/metrics/constants.js +12 -1
  102. package/dist/metrics/constants.js.map +1 -1
  103. package/dist/multistream/codec/constants.js +63 -0
  104. package/dist/multistream/codec/constants.js.map +1 -0
  105. package/dist/multistream/mediaRequestManager.js +64 -68
  106. package/dist/multistream/mediaRequestManager.js.map +1 -1
  107. package/dist/multistream/receiveSlot.js +9 -0
  108. package/dist/multistream/receiveSlot.js.map +1 -1
  109. package/dist/multistream/remoteMediaManager.js +11 -0
  110. package/dist/multistream/remoteMediaManager.js.map +1 -1
  111. package/dist/multistream/sendSlotManager.js +116 -2
  112. package/dist/multistream/sendSlotManager.js.map +1 -1
  113. package/dist/reachability/clusterReachability.js.map +1 -1
  114. package/dist/reachability/index.js +121 -83
  115. package/dist/reachability/index.js.map +1 -1
  116. package/dist/reachability/reachability.types.js +2 -0
  117. package/dist/reachability/reachability.types.js.map +1 -1
  118. package/dist/reachability/util.js +45 -0
  119. package/dist/reachability/util.js.map +1 -1
  120. package/dist/reactions/reactions.type.js.map +1 -1
  121. package/dist/reconnection-manager/index.js +0 -1
  122. package/dist/reconnection-manager/index.js.map +1 -1
  123. package/dist/recording-controller/index.js +1 -3
  124. package/dist/recording-controller/index.js.map +1 -1
  125. package/dist/roap/turnDiscovery.js +8 -1
  126. package/dist/roap/turnDiscovery.js.map +1 -1
  127. package/dist/types/aiEnableRequest/index.d.ts +5 -0
  128. package/dist/types/aiEnableRequest/utils.d.ts +2 -0
  129. package/dist/types/common/errors/webex-errors.d.ts +32 -2
  130. package/dist/types/config.d.ts +6 -2
  131. package/dist/types/constants.d.ts +35 -1
  132. package/dist/types/controls-options-manager/constants.d.ts +6 -1
  133. package/dist/types/controls-options-manager/index.d.ts +16 -0
  134. package/dist/types/hashTree/constants.d.ts +3 -0
  135. package/dist/types/hashTree/hashTree.d.ts +7 -0
  136. package/dist/types/hashTree/hashTreeParser.d.ts +315 -30
  137. package/dist/types/hashTree/types.d.ts +3 -0
  138. package/dist/types/hashTree/utils.d.ts +24 -0
  139. package/dist/types/index.d.ts +4 -0
  140. package/dist/types/interceptors/constant.d.ts +5 -0
  141. package/dist/types/interceptors/dataChannelAuthToken.d.ts +43 -0
  142. package/dist/types/interceptors/index.d.ts +2 -1
  143. package/dist/types/interceptors/locusRetry.d.ts +4 -4
  144. package/dist/types/interceptors/utils.d.ts +1 -0
  145. package/dist/types/interpretation/interpretation.types.d.ts +10 -0
  146. package/dist/types/locus-info/index.d.ts +126 -15
  147. package/dist/types/locus-info/infoUtils.d.ts +8 -0
  148. package/dist/types/locus-info/types.d.ts +28 -1
  149. package/dist/types/media/MediaConnectionAwaiter.d.ts +20 -2
  150. package/dist/types/media/properties.d.ts +8 -3
  151. package/dist/types/meeting/in-meeting-actions.d.ts +10 -0
  152. package/dist/types/meeting/index.d.ts +253 -16
  153. package/dist/types/meeting/locusMediaRequest.d.ts +12 -0
  154. package/dist/types/meeting/request.d.ts +17 -1
  155. package/dist/types/meeting/request.type.d.ts +5 -0
  156. package/dist/types/meeting/util.d.ts +40 -0
  157. package/dist/types/meeting-info/meeting-info-v2.d.ts +25 -1
  158. package/dist/types/meetings/index.d.ts +54 -21
  159. package/dist/types/meetings/meetings.types.d.ts +30 -1
  160. package/dist/types/meetings/request.d.ts +14 -0
  161. package/dist/types/member/index.d.ts +2 -0
  162. package/dist/types/member/types.d.ts +1 -0
  163. package/dist/types/member/util.d.ts +14 -0
  164. package/dist/types/members/index.d.ts +15 -2
  165. package/dist/types/members/util.d.ts +1 -5
  166. package/dist/types/metrics/constants.d.ts +11 -0
  167. package/dist/types/multistream/codec/constants.d.ts +7 -0
  168. package/dist/types/multistream/mediaRequestManager.d.ts +20 -26
  169. package/dist/types/multistream/sendSlotManager.d.ts +23 -1
  170. package/dist/types/reachability/clusterReachability.d.ts +3 -3
  171. package/dist/types/reachability/index.d.ts +10 -3
  172. package/dist/types/reachability/reachability.types.d.ts +7 -0
  173. package/dist/types/reachability/util.d.ts +17 -0
  174. package/dist/types/reactions/reactions.type.d.ts +4 -0
  175. package/dist/types/webinar/utils.d.ts +6 -0
  176. package/dist/webinar/index.js +585 -164
  177. package/dist/webinar/index.js.map +1 -1
  178. package/dist/webinar/utils.js +25 -0
  179. package/dist/webinar/utils.js.map +1 -0
  180. package/package.json +24 -23
  181. package/src/aiEnableRequest/README.md +84 -0
  182. package/src/aiEnableRequest/index.ts +186 -0
  183. package/src/aiEnableRequest/utils.ts +25 -0
  184. package/src/annotation/index.ts +32 -10
  185. package/src/breakouts/breakout.ts +3 -1
  186. package/src/breakouts/events.ts +33 -11
  187. package/src/breakouts/index.ts +122 -2
  188. package/src/common/errors/webex-errors.ts +50 -3
  189. package/src/config.ts +6 -2
  190. package/src/constants.ts +49 -3
  191. package/src/controls-options-manager/constants.ts +14 -1
  192. package/src/controls-options-manager/index.ts +87 -28
  193. package/src/controls-options-manager/util.ts +81 -1
  194. package/src/hashTree/constants.ts +17 -0
  195. package/src/hashTree/hashTree.ts +17 -0
  196. package/src/hashTree/hashTreeParser.ts +1482 -361
  197. package/src/hashTree/types.ts +4 -0
  198. package/src/hashTree/utils.ts +45 -0
  199. package/src/index.ts +14 -1
  200. package/src/interceptors/constant.ts +6 -0
  201. package/src/interceptors/dataChannelAuthToken.ts +246 -0
  202. package/src/interceptors/index.ts +2 -1
  203. package/src/interceptors/locusRetry.ts +25 -4
  204. package/src/interceptors/utils.ts +16 -0
  205. package/src/interpretation/index.ts +29 -11
  206. package/src/interpretation/interpretation.types.ts +11 -0
  207. package/src/locus-info/controlsUtils.ts +14 -1
  208. package/src/locus-info/index.ts +976 -203
  209. package/src/locus-info/infoUtils.ts +41 -6
  210. package/src/locus-info/selfUtils.ts +1 -0
  211. package/src/locus-info/types.ts +33 -1
  212. package/src/media/MediaConnectionAwaiter.ts +62 -5
  213. package/src/media/index.ts +10 -1
  214. package/src/media/properties.ts +11 -4
  215. package/src/meeting/in-meeting-actions.ts +20 -0
  216. package/src/meeting/index.ts +1300 -180
  217. package/src/meeting/locusMediaRequest.ts +106 -6
  218. package/src/meeting/muteState.ts +10 -1
  219. package/src/meeting/request.ts +53 -0
  220. package/src/meeting/request.type.ts +6 -0
  221. package/src/meeting/util.ts +207 -7
  222. package/src/meeting-info/meeting-info-v2.ts +83 -21
  223. package/src/meetings/index.ts +402 -121
  224. package/src/meetings/meetings.types.ts +36 -1
  225. package/src/meetings/request.ts +43 -0
  226. package/src/meetings/util.ts +117 -4
  227. package/src/member/index.ts +20 -0
  228. package/src/member/types.ts +1 -0
  229. package/src/member/util.ts +41 -0
  230. package/src/members/index.ts +70 -7
  231. package/src/members/util.ts +12 -4
  232. package/src/metrics/constants.ts +12 -0
  233. package/src/multistream/codec/constants.ts +58 -0
  234. package/src/multistream/mediaRequestManager.ts +117 -76
  235. package/src/multistream/receiveSlot.ts +18 -0
  236. package/src/multistream/remoteMediaManager.ts +13 -0
  237. package/src/multistream/sendSlotManager.ts +97 -3
  238. package/src/reachability/clusterReachability.ts +3 -2
  239. package/src/reachability/index.ts +47 -16
  240. package/src/reachability/reachability.types.ts +11 -0
  241. package/src/reachability/util.ts +36 -0
  242. package/src/reactions/reactions.type.ts +4 -0
  243. package/src/reconnection-manager/index.ts +0 -1
  244. package/src/recording-controller/index.ts +1 -2
  245. package/src/roap/turnDiscovery.ts +9 -1
  246. package/src/webinar/index.ts +448 -11
  247. package/src/webinar/utils.ts +16 -0
  248. package/test/unit/spec/aiEnableRequest/index.ts +1067 -0
  249. package/test/unit/spec/aiEnableRequest/utils.ts +130 -0
  250. package/test/unit/spec/annotation/index.ts +70 -8
  251. package/test/unit/spec/breakouts/breakout.ts +9 -3
  252. package/test/unit/spec/breakouts/events.ts +120 -2
  253. package/test/unit/spec/breakouts/index.ts +223 -3
  254. package/test/unit/spec/common/errors/webex-errors.ts +78 -0
  255. package/test/unit/spec/controls-options-manager/index.js +244 -29
  256. package/test/unit/spec/controls-options-manager/util.js +165 -0
  257. package/test/unit/spec/hashTree/hashTree.ts +66 -0
  258. package/test/unit/spec/hashTree/hashTreeParser.ts +4528 -171
  259. package/test/unit/spec/hashTree/utils.ts +125 -1
  260. package/test/unit/spec/interceptors/dataChannelAuthToken.ts +406 -0
  261. package/test/unit/spec/interceptors/locusRetry.ts +205 -4
  262. package/test/unit/spec/interceptors/utils.ts +75 -0
  263. package/test/unit/spec/interpretation/index.ts +26 -4
  264. package/test/unit/spec/locus-info/controlsUtils.js +200 -56
  265. package/test/unit/spec/locus-info/index.js +1861 -149
  266. package/test/unit/spec/locus-info/infoUtils.js +184 -1
  267. package/test/unit/spec/media/MediaConnectionAwaiter.ts +96 -1
  268. package/test/unit/spec/media/index.ts +92 -0
  269. package/test/unit/spec/media/properties.ts +35 -26
  270. package/test/unit/spec/meeting/in-meeting-actions.ts +12 -2
  271. package/test/unit/spec/meeting/index.js +3691 -366
  272. package/test/unit/spec/meeting/locusMediaRequest.ts +406 -4
  273. package/test/unit/spec/meeting/muteState.js +81 -0
  274. package/test/unit/spec/meeting/request.js +82 -0
  275. package/test/unit/spec/meeting/utils.js +595 -27
  276. package/test/unit/spec/meeting-info/meetinginfov2.js +286 -10
  277. package/test/unit/spec/meetings/index.js +1400 -78
  278. package/test/unit/spec/meetings/request.js +141 -0
  279. package/test/unit/spec/meetings/utils.js +402 -51
  280. package/test/unit/spec/member/index.js +35 -4
  281. package/test/unit/spec/member/util.js +154 -27
  282. package/test/unit/spec/members/index.js +216 -0
  283. package/test/unit/spec/members/request.js +37 -1
  284. package/test/unit/spec/members/utils.js +63 -0
  285. package/test/unit/spec/multistream/mediaRequestManager.ts +503 -122
  286. package/test/unit/spec/multistream/remoteMediaManager.ts +30 -0
  287. package/test/unit/spec/multistream/sendSlotManager.ts +135 -36
  288. package/test/unit/spec/reachability/index.ts +128 -46
  289. package/test/unit/spec/reachability/util.ts +31 -0
  290. package/test/unit/spec/reconnection-manager/index.js +4 -8
  291. package/test/unit/spec/recording-controller/index.js +9 -8
  292. package/test/unit/spec/roap/turnDiscovery.ts +20 -0
  293. package/test/unit/spec/webinar/index.ts +837 -39
  294. package/test/unit/spec/webinar/utils.ts +39 -0
@@ -1,38 +1,44 @@
1
1
  "use strict";
2
2
 
3
3
  var _typeof = require("@babel/runtime-corejs2/helpers/typeof");
4
- var _Reflect$construct = require("@babel/runtime-corejs2/core-js/reflect/construct");
4
+ var _Array$from = require("@babel/runtime-corejs2/core-js/array/from");
5
+ var _Symbol = require("@babel/runtime-corejs2/core-js/symbol");
6
+ var _Symbol$iterator = require("@babel/runtime-corejs2/core-js/symbol/iterator");
7
+ var _Array$isArray2 = require("@babel/runtime-corejs2/core-js/array/is-array");
5
8
  var _Object$keys2 = require("@babel/runtime-corejs2/core-js/object/keys");
6
9
  var _Object$getOwnPropertySymbols = require("@babel/runtime-corejs2/core-js/object/get-own-property-symbols");
7
10
  var _Object$getOwnPropertyDescriptor = require("@babel/runtime-corejs2/core-js/object/get-own-property-descriptor");
8
11
  var _Object$getOwnPropertyDescriptors = require("@babel/runtime-corejs2/core-js/object/get-own-property-descriptors");
9
12
  var _Object$defineProperties = require("@babel/runtime-corejs2/core-js/object/define-properties");
10
13
  var _Object$defineProperty = require("@babel/runtime-corejs2/core-js/object/define-property");
11
- var _Array$from = require("@babel/runtime-corejs2/core-js/array/from");
12
- var _Symbol = require("@babel/runtime-corejs2/core-js/symbol");
13
- var _Symbol$iterator = require("@babel/runtime-corejs2/core-js/symbol/iterator");
14
- var _Array$isArray2 = require("@babel/runtime-corejs2/core-js/array/is-array");
14
+ var _Reflect$construct = require("@babel/runtime-corejs2/core-js/reflect/construct");
15
15
  var _WeakMap = require("@babel/runtime-corejs2/core-js/weak-map");
16
16
  var _interopRequireDefault = require("@babel/runtime-corejs2/helpers/interopRequireDefault");
17
17
  _Object$defineProperty(exports, "__esModule", {
18
18
  value: true
19
19
  });
20
+ exports.createLocusFromHashTreeMessage = createLocusFromHashTreeMessage;
20
21
  exports.default = void 0;
22
+ exports.findMeetingForHashTreeMessage = findMeetingForHashTreeMessage;
21
23
  var _regenerator = _interopRequireDefault(require("@babel/runtime-corejs2/regenerator"));
22
- var _map = _interopRequireDefault(require("@babel/runtime-corejs2/core-js/map"));
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 _keys = _interopRequireDefault(require("@babel/runtime-corejs2/core-js/object/keys"));
26
- var _stringify = _interopRequireDefault(require("@babel/runtime-corejs2/core-js/json/stringify"));
27
- var _isArray = _interopRequireDefault(require("@babel/runtime-corejs2/core-js/array/is-array"));
28
24
  var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime-corejs2/helpers/asyncToGenerator"));
25
+ var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime-corejs2/helpers/slicedToArray"));
26
+ var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime-corejs2/helpers/toConsumableArray"));
29
27
  var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime-corejs2/helpers/classCallCheck"));
30
28
  var _createClass2 = _interopRequireDefault(require("@babel/runtime-corejs2/helpers/createClass"));
31
29
  var _possibleConstructorReturn2 = _interopRequireDefault(require("@babel/runtime-corejs2/helpers/possibleConstructorReturn"));
32
30
  var _getPrototypeOf2 = _interopRequireDefault(require("@babel/runtime-corejs2/helpers/getPrototypeOf"));
33
31
  var _inherits2 = _interopRequireDefault(require("@babel/runtime-corejs2/helpers/inherits"));
34
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"));
35
39
  var _lodash = require("lodash");
40
+ var _uuid = _interopRequireDefault(require("uuid"));
41
+ var _webexCore = require("@webex/webex-core");
36
42
  var _loggerProxy = _interopRequireDefault(require("../common/logs/logger-proxy"));
37
43
  var _eventsScope = _interopRequireDefault(require("../common/events/events-scope"));
38
44
  var _constants = require("../constants");
@@ -46,26 +52,192 @@ var _mediaSharesUtils = _interopRequireDefault(require("./mediaSharesUtils"));
46
52
  var _parser = _interopRequireDefault(require("./parser"));
47
53
  var _metrics = _interopRequireDefault(require("../metrics"));
48
54
  var _constants2 = _interopRequireDefault(require("../metrics/constants"));
49
- var _hashTreeParser = _interopRequireWildcard(require("../hashTree/hashTreeParser"));
55
+ var _hashTreeParser2 = _interopRequireWildcard(require("../hashTree/hashTreeParser"));
50
56
  var _types = require("../hashTree/types");
51
57
  var _utils = require("../hashTree/utils");
52
- 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); }
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)); }
61
+ function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(_Reflect$construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); }
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; }
63
+ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { (0, _defineProperty2.default)(e, r, t[r]); }) : _Object$getOwnPropertyDescriptors ? _Object$defineProperties(e, _Object$getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { _Object$defineProperty(e, r, _Object$getOwnPropertyDescriptor(t, r)); }); } return e; }
53
64
  function _createForOfIteratorHelper(r, e) { var t = "undefined" != typeof _Symbol && r[_Symbol$iterator] || r["@@iterator"]; if (!t) { if (_Array$isArray2(r) || (t = _unsupportedIterableToArray(r)) || e && r && "number" == typeof r.length) { t && (r = t); var _n = 0, F = function F() {}; return { s: F, n: function n() { return _n >= r.length ? { done: !0 } : { done: !1, value: r[_n++] }; }, e: function e(r) { throw r; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var o, a = !0, u = !1; return { s: function s() { t = t.call(r); }, n: function n() { var r = t.next(); return a = r.done, r; }, e: function e(r) { u = !0, o = r; }, f: function f() { try { a || null == t.return || t.return(); } finally { if (u) throw o; } } }; }
54
65
  function _unsupportedIterableToArray(r, a) { if (r) { if ("string" == typeof r) return _arrayLikeToArray(r, a); var t = {}.toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? _Array$from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0; } }
55
66
  function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; }
56
- 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; }
57
- function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { (0, _defineProperty2.default)(e, r, t[r]); }) : _Object$getOwnPropertyDescriptors ? _Object$defineProperties(e, _Object$getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { _Object$defineProperty(e, r, _Object$getOwnPropertyDescriptor(t, r)); }); } return e; }
58
- 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)); }
59
- function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(_Reflect$construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); }
60
67
  // list of top level keys in Locus DTO relevant for Hash Tree DTOs processing
61
68
  // it does not contain fields specific to classic Locus DTOs like sequence or baseSequence
62
- var LocusDtoTopLevelKeys = ['controls', 'fullState', 'host', 'info', 'links', 'mediaShares', 'meetings', 'participants', 'replaces', 'self', 'sequence', 'syncUrl', 'url', 'htMeta' // only exists when hash trees are used
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
63
70
  ];
71
+ // when we invoke APIs on the whole Locus like "mute all" backend returns the whole Locus in the response like this
72
+
64
73
  var LocusObjectStateAfterUpdates = {
65
74
  unchanged: 'unchanged',
66
75
  removed: 'removed',
67
76
  updated: 'updated'
68
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
+
146
+ /**
147
+ * Creates a locus object from the objects received in a hash tree message. It usually will be
148
+ * incomplete, because hash tree messages only contain the parts of locus that have changed,
149
+ * and some updates come separately over Mercury or LLM in separate messages.
150
+ *
151
+ * @param {HashTreeMessage} message hash tree message to created the locus from
152
+ * @returns {Object} the created locus object and metadata if present
153
+ */
154
+ function createLocusFromHashTreeMessage(message) {
155
+ var locus = {
156
+ participants: [],
157
+ url: message.locusUrl
158
+ };
159
+ var metadata;
160
+ if (!message.locusStateElements) {
161
+ return {
162
+ locus: locus,
163
+ metadata: metadata
164
+ };
165
+ }
166
+ var _iterator = _createForOfIteratorHelper(message.locusStateElements),
167
+ _step;
168
+ try {
169
+ var _loop = function _loop() {
170
+ var element = _step.value;
171
+ if (!element.data) {
172
+ // eslint-disable-next-line no-continue
173
+ return 1; // continue
174
+ }
175
+ var type = element.htMeta.elementId.type.toLowerCase();
176
+ switch (type) {
177
+ case _types.ObjectType.locus:
178
+ {
179
+ // spread locus object data onto the top level, but remove keys managed by other ObjectTypes
180
+ var locusObjectData = _objectSpread({}, element.data);
181
+ (0, _values.default)(_types.ObjectTypeToLocusKeyMap).forEach(function (locusDtoKey) {
182
+ delete locusObjectData[locusDtoKey];
183
+ });
184
+ (0, _assign.default)(locus, locusObjectData);
185
+ break;
186
+ }
187
+ case _types.ObjectType.participant:
188
+ locus.participants.push(element.data);
189
+ break;
190
+ case _types.ObjectType.mediaShare:
191
+ if (!locus.mediaShares) {
192
+ locus.mediaShares = [];
193
+ }
194
+ locus.mediaShares.push(element.data);
195
+ break;
196
+ case _types.ObjectType.embeddedApp:
197
+ if (!locus.embeddedApps) {
198
+ locus.embeddedApps = [];
199
+ }
200
+ locus.embeddedApps.push(element.data);
201
+ break;
202
+ case _types.ObjectType.control:
203
+ if (!locus.controls) {
204
+ locus.controls = {};
205
+ }
206
+ (0, _assign.default)(locus.controls, element.data);
207
+ break;
208
+ case _types.ObjectType.links:
209
+ case _types.ObjectType.info:
210
+ case _types.ObjectType.fullState:
211
+ case _types.ObjectType.self:
212
+ {
213
+ var locusDtoKey = _types.ObjectTypeToLocusKeyMap[type];
214
+ locus[locusDtoKey] = element.data;
215
+ break;
216
+ }
217
+ case _types.ObjectType.metadata:
218
+ // metadata is not part of Locus DTO
219
+ metadata = _objectSpread(_objectSpread({}, element.data), {}, {
220
+ htMeta: element.htMeta
221
+ });
222
+ break;
223
+ default:
224
+ break;
225
+ }
226
+ };
227
+ for (_iterator.s(); !(_step = _iterator.n()).done;) {
228
+ if (_loop()) continue;
229
+ }
230
+ } catch (err) {
231
+ _iterator.e(err);
232
+ } finally {
233
+ _iterator.f();
234
+ }
235
+ return {
236
+ locus: locus,
237
+ metadata: metadata
238
+ };
239
+ }
240
+
69
241
  /**
70
242
  * @description LocusInfo extends ChildEmitter to convert locusInfo info a private emitter to parent object
71
243
  * @export
@@ -75,12 +247,13 @@ var LocusObjectStateAfterUpdates = {
75
247
  var LocusInfo = exports.default = /*#__PURE__*/function (_EventsScope) {
76
248
  /**
77
249
  * Constructor
78
- * @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
79
252
  * @param {object} webex
80
253
  * @param {string} meetingId
81
254
  * @returns {undefined}
82
255
  */
83
- function LocusInfo(updateMeeting, webex, meetingId) {
256
+ function LocusInfo(callbacks, webex, meetingId) {
84
257
  var _this;
85
258
  (0, _classCallCheck2.default)(this, LocusInfo);
86
259
  _this = _callSuper(this, LocusInfo);
@@ -89,7 +262,6 @@ var LocusInfo = exports.default = /*#__PURE__*/function (_EventsScope) {
89
262
  (0, _defineProperty2.default)(_this, "locusParser", void 0);
90
263
  (0, _defineProperty2.default)(_this, "meetingId", void 0);
91
264
  (0, _defineProperty2.default)(_this, "parsedLocus", void 0);
92
- (0, _defineProperty2.default)(_this, "updateMeeting", void 0);
93
265
  (0, _defineProperty2.default)(_this, "webex", void 0);
94
266
  (0, _defineProperty2.default)(_this, "aclUrl", void 0);
95
267
  (0, _defineProperty2.default)(_this, "baseSequence", void 0);
@@ -110,19 +282,22 @@ var LocusInfo = exports.default = /*#__PURE__*/function (_EventsScope) {
110
282
  (0, _defineProperty2.default)(_this, "links", void 0);
111
283
  (0, _defineProperty2.default)(_this, "mainSessionLocusCache", void 0);
112
284
  (0, _defineProperty2.default)(_this, "self", void 0);
113
- (0, _defineProperty2.default)(_this, "hashTreeParser", void 0);
285
+ (0, _defineProperty2.default)(_this, "hashTreeParsers", void 0);
114
286
  (0, _defineProperty2.default)(_this, "hashTreeObjectId2ParticipantId", void 0);
115
287
  // mapping of hash tree object ids to participant ids
116
288
  (0, _defineProperty2.default)(_this, "classicVsHashTreeMismatchMetricCounter", 0);
289
+ (0, _defineProperty2.default)(_this, "callbacks", void 0);
290
+ (0, _defineProperty2.default)(_this, "destroyMeetingSuspended", false);
117
291
  _this.parsedLocus = {
118
292
  states: []
119
293
  };
294
+ _this.callbacks = callbacks;
120
295
  _this.webex = webex;
121
296
  _this.emitChange = false;
122
297
  _this.compareAndUpdateFlags = {};
123
298
  _this.meetingId = meetingId;
124
- _this.updateMeeting = updateMeeting;
125
299
  _this.locusParser = new _parser.default();
300
+ _this.hashTreeParsers = new _map.default();
126
301
  _this.hashTreeObjectId2ParticipantId = new _map.default();
127
302
  return _this;
128
303
  }
@@ -210,7 +385,7 @@ var LocusInfo = exports.default = /*#__PURE__*/function (_EventsScope) {
210
385
  // in some cases Locus might return us full DTO even when we asked for a delta
211
386
  _loggerProxy.default.logger.info('Locus-info:index#doLocusSync --> got full DTO when we asked for delta');
212
387
  }
213
- meeting.locusInfo.onFullLocus(res.body);
388
+ meeting.locusInfo.onFullLocus('classic Locus sync', res.body);
214
389
  }).catch(function (e) {
215
390
  _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(), ")"));
216
391
  _metrics.default.sendBehavioralMetric(_constants2.default.LOCUS_SYNC_HANDLING_FAILED, {
@@ -322,7 +497,7 @@ var LocusInfo = exports.default = /*#__PURE__*/function (_EventsScope) {
322
497
  this.updateControls(locus.controls, locus.self);
323
498
  this.updateLocusUrl(locus.url, _controlsUtils.default.isMainSessionDTO(locus));
324
499
  this.updateFullState(locus.fullState);
325
- this.updateMeetingInfo(locus.info);
500
+ this.updateMeetingInfo(locus.info, locus.self);
326
501
  this.updateEmbeddedApps(locus.embeddedApps);
327
502
  // self and participants generate sipUrl for 1:1 meeting
328
503
  this.updateSelf(locus.self);
@@ -332,36 +507,97 @@ var LocusInfo = exports.default = /*#__PURE__*/function (_EventsScope) {
332
507
  }
333
508
 
334
509
  /**
335
- * Creates the HashTreeParser instance.
336
- * @param {Object} initial locus data
337
- * @returns {void}
510
+ * Creates a HashTreeParser instance for a given locusUrl and stores it in the map.
511
+ * @param {Object} params
512
+ * @param {string} params.locusUrl - the locus URL used as the map key
513
+ * @param {Object} params.initialLocus - initial locus data
514
+ * @param {Object} params.metadata - hash tree metadata
515
+ * @param {string} params.replacedAt - timestamp from Locus indicating when the replacement happened
516
+ * @returns {HashTreeParser} the newly created parser
338
517
  */
339
518
  }, {
340
519
  key: "createHashTreeParser",
341
520
  value: function createHashTreeParser(_ref) {
342
- var initialLocus = _ref.initialLocus;
343
- return new _hashTreeParser.default({
521
+ var _this4 = this,
522
+ _locusUrl$split,
523
+ _locusUrl$split$pop,
524
+ _this$webex$config$me;
525
+ var locusUrl = _ref.locusUrl,
526
+ initialLocus = _ref.initialLocus,
527
+ metadata = _ref.metadata,
528
+ replacedAt = _ref.replacedAt;
529
+ var parser = new _hashTreeParser2.default({
344
530
  initialLocus: initialLocus,
531
+ metadata: metadata,
345
532
  webexRequest: this.webex.request.bind(this.webex),
346
- locusInfoUpdateCallback: this.updateFromHashTree.bind(this),
347
- debugId: "HT-".concat(this.meetingId.substring(0, 4))
533
+ callbacks: {
534
+ locusInfoUpdateCallback: this.updateFromHashTree.bind(this, locusUrl),
535
+ syncLatencyTracker: this.callbacks.syncLatencyTracker,
536
+ // Reuse webex-core's tracking-id interceptor sequence (exposed publicly via
537
+ // webexTrackingIdSequenceNumbers) so Locus requests share the client's unified
538
+ // ${sessionId}_${sequence} tracking id space instead of minting an unrelated id. Fall
539
+ // back to a uuid on the rare chance the interceptor hasn't issued any request yet (and so
540
+ // isn't in the map). The value is opaque to the metrics layer and is forced onto the
541
+ // /hashtree and /sync request headers.
542
+ generateTrackingId: function generateTrackingId() {
543
+ var interceptor = (0, _toConsumableArray2.default)(_webexCore.webexTrackingIdSequenceNumbers.keys()).find(function (candidate) {
544
+ return (candidate === null || candidate === void 0 ? void 0 : candidate.webex) === _this4.webex;
545
+ });
546
+ return "".concat(_this4.webex.sessionId, "_").concat(interceptor ? interceptor.sequence : _uuid.default.v4());
547
+ }
548
+ },
549
+ 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)),
550
+ excludedDataSets: (_this$webex$config$me = this.webex.config.meetings.locus) === null || _this$webex$config$me === void 0 ? void 0 : _this$webex$config$me.excludedDataSets,
551
+ syncLatencyMeetingId: this.meetingId
348
552
  });
553
+
554
+ // When a new HashTreeParser is created, previous one should be stopped.
555
+ // Locus will only be sending us updates for the current one.
556
+ var _iterator2 = _createForOfIteratorHelper(this.hashTreeParsers),
557
+ _step2;
558
+ try {
559
+ for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {
560
+ var _step2$value = (0, _slicedToArray2.default)(_step2.value, 2),
561
+ existingLocusUrl = _step2$value[0],
562
+ existingEntry = _step2$value[1];
563
+ if (existingEntry.parser.state !== 'stopped') {
564
+ existingEntry.parser.stop();
565
+ if (replacedAt) {
566
+ existingEntry.replacedAt = replacedAt;
567
+ } else {
568
+ _loggerProxy.default.logger.warn("Locus-info:index#createHashTreeParser --> no replacedAt timestamp provided for new HashTreeParser with locusUrl ".concat(locusUrl, ", replacing ").concat(existingLocusUrl));
569
+ }
570
+ }
571
+ }
572
+ } catch (err) {
573
+ _iterator2.e(err);
574
+ } finally {
575
+ _iterator2.f();
576
+ }
577
+ this.hashTreeParsers.set(locusUrl, {
578
+ parser: parser,
579
+ initializedFromHashTree: false
580
+ });
581
+ this.hashTreeObjectId2ParticipantId.clear();
582
+ return parser;
349
583
  }
350
584
 
351
585
  /**
352
586
  * @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
587
+ * @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)
353
588
  * @returns {undefined}
354
589
  * @memberof LocusInfo
355
590
  */
356
591
  }, {
357
592
  key: "initialSetup",
358
593
  value: (function () {
359
- var _initialSetup = (0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee(data) {
594
+ var _initialSetup = (0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee(data, onLocusSynced) {
360
595
  var _data$locus, _data$locus$links, _data$locus$links$res, _data$locus$links$res2;
361
- var _data$hashTreeMessage, _selfObject$data, selfObject, _data$locus2, _data$locus2$self, _t;
596
+ var initialFullLocus, _data$hashTreeMessage, _metadataObject$data, metadataObject, hashTreeParser, _hashTreeParser, _t;
362
597
  return _regenerator.default.wrap(function (_context) {
363
598
  while (1) switch (_context.prev = _context.next) {
364
599
  case 0:
600
+ initialFullLocus = null;
365
601
  _t = data.trigger;
366
602
  _context.next = _t === 'locus-message' ? 1 : _t === 'join-response' ? 6 : _t === 'get-loci-response' ? 7 : 10;
367
603
  break;
@@ -370,47 +606,50 @@ var LocusInfo = exports.default = /*#__PURE__*/function (_EventsScope) {
370
606
  _context.next = 4;
371
607
  break;
372
608
  }
373
- // we need the SELF object to be in the received message, because it contains visibleDataSets
609
+ // we need the Metadata object to be in the received message, because it contains visibleDataSets
374
610
  // and these are needed to initialize all the hash trees
375
- selfObject = (_data$hashTreeMessage = data.hashTreeMessage.locusStateElements) === null || _data$hashTreeMessage === void 0 ? void 0 : _data$hashTreeMessage.find(function (el) {
376
- return (0, _utils.isSelf)(el);
611
+ metadataObject = (_data$hashTreeMessage = data.hashTreeMessage.locusStateElements) === null || _data$hashTreeMessage === void 0 ? void 0 : _data$hashTreeMessage.find(function (el) {
612
+ return (0, _utils.isMetadata)(el);
377
613
  });
378
- if (selfObject !== null && selfObject !== void 0 && (_selfObject$data = selfObject.data) !== null && _selfObject$data !== void 0 && _selfObject$data.visibleDataSets) {
614
+ if (metadataObject !== null && metadataObject !== void 0 && (_metadataObject$data = metadataObject.data) !== null && _metadataObject$data !== void 0 && _metadataObject$data.visibleDataSets) {
379
615
  _context.next = 2;
380
616
  break;
381
617
  }
382
- _loggerProxy.default.logger.warn("Locus-info:index#initialSetup --> cannot initialize HashTreeParser, SELF object with visibleDataSets is missing in the message");
383
- throw new Error('SELF object with visibleDataSets is missing in the message');
618
+ // this is a common case (not an error)
619
+ // it happens for example after we leave the meeting and still get some heartbeats or delayed messages
620
+ _loggerProxy.default.logger.info("Locus-info:index#initialSetup --> cannot initialize HashTreeParser, Metadata object with visibleDataSets is missing in the message");
621
+
622
+ // throw so that handleLocusEvent() catches it and destroys the partially created meeting object
623
+ throw new Error('Metadata object with visibleDataSets is missing in the message');
384
624
  case 2:
385
625
  _loggerProxy.default.logger.info('Locus-info:index#initialSetup --> creating HashTreeParser from message');
386
626
  // first create the HashTreeParser, but don't initialize it with any data yet
387
- // pass just a fake locus that contains only the visibleDataSets
388
- this.hashTreeParser = this.createHashTreeParser({
627
+ hashTreeParser = this.createHashTreeParser({
628
+ locusUrl: data.hashTreeMessage.locusUrl,
389
629
  initialLocus: {
390
- locus: {
391
- self: {
392
- visibleDataSets: selfObject.data.visibleDataSets
393
- }
394
- },
395
- dataSets: [] // empty, because they will be populated in initializeFromMessage() call // dataSets: data.hashTreeMessage.dataSets,
630
+ locus: null,
631
+ dataSets: data.hashTreeMessage.dataSets
632
+ },
633
+ metadata: {
634
+ htMeta: metadataObject.htMeta,
635
+ visibleDataSets: metadataObject.data.visibleDataSets
396
636
  }
397
- });
398
-
399
- // now handle the message - that should populate all the visible datasets
637
+ }); // now handle the message - that should populate all the visible datasets
400
638
  _context.next = 3;
401
- return this.hashTreeParser.initializeFromMessage(data.hashTreeMessage);
639
+ return hashTreeParser.initializeFromMessage(data.hashTreeMessage);
402
640
  case 3:
403
641
  _context.next = 5;
404
642
  break;
405
643
  case 4:
406
644
  // "classic" Locus case, no hash trees involved
407
645
  this.updateLocusCache(data.locus);
408
- this.onFullLocus(data.locus, undefined);
646
+ this.onFullLocus('classic locus message', data.locus, undefined);
409
647
  case 5:
410
648
  return _context.abrupt("continue", 10);
411
649
  case 6:
412
650
  this.updateLocusCache(data.locus);
413
- this.onFullLocus(data.locus, undefined, data.dataSets);
651
+ this.onFullLocus('join response', data.locus, undefined, data.dataSets, data.metadata);
652
+ initialFullLocus = data.locus;
414
653
  return _context.abrupt("continue", 10);
415
654
  case 7:
416
655
  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)) {
@@ -419,29 +658,33 @@ var LocusInfo = exports.default = /*#__PURE__*/function (_EventsScope) {
419
658
  }
420
659
  _loggerProxy.default.logger.info('Locus-info:index#initialSetup --> creating HashTreeParser from get-loci-response');
421
660
  // first create the HashTreeParser, but don't initialize it with any data yet
422
- // pass just a fake locus that contains only the visibleDataSets
423
- this.hashTreeParser = this.createHashTreeParser({
661
+ _hashTreeParser = this.createHashTreeParser({
662
+ locusUrl: data.locus.url,
424
663
  initialLocus: {
425
- locus: {
426
- self: {
427
- visibleDataSets: (_data$locus2 = data.locus) === null || _data$locus2 === void 0 ? void 0 : (_data$locus2$self = _data$locus2.self) === null || _data$locus2$self === void 0 ? void 0 : _data$locus2$self.visibleDataSets
428
- }
429
- },
664
+ locus: null,
430
665
  dataSets: [] // empty, because we don't have them yet
431
- }
432
- });
433
-
434
- // now initialize all the data
666
+ },
667
+ metadata: null // get-loci-response doesn't contain Metadata object
668
+ }); // now initialize all the data
435
669
  _context.next = 8;
436
- return this.hashTreeParser.initializeFromGetLociResponse(data.locus);
670
+ return _hashTreeParser.initializeFromGetLociResponse(data.locus);
437
671
  case 8:
438
672
  _context.next = 10;
439
673
  break;
440
674
  case 9:
441
675
  // "classic" Locus case, no hash trees involved
442
676
  this.updateLocusCache(data.locus);
443
- this.onFullLocus(data.locus, undefined);
677
+ this.onFullLocus('classic get-loci-response', data.locus, undefined);
678
+ initialFullLocus = data.locus || null;
444
679
  case 10:
680
+ if (onLocusSynced) {
681
+ try {
682
+ onLocusSynced(initialFullLocus || this.getCurrentLocusSnapshot());
683
+ } catch (error) {
684
+ _loggerProxy.default.logger.warn("Locus-info:index#initialSetup --> onLocusSynced callback failed: ".concat(error));
685
+ }
686
+ }
687
+
445
688
  // Change it to true after it receives it first locus object
446
689
  this.emitChange = true;
447
690
  case 11:
@@ -450,40 +693,82 @@ var LocusInfo = exports.default = /*#__PURE__*/function (_EventsScope) {
450
693
  }
451
694
  }, _callee, this);
452
695
  }));
453
- function initialSetup(_x) {
696
+ function initialSetup(_x, _x2) {
454
697
  return _initialSetup.apply(this, arguments);
455
698
  }
456
699
  return initialSetup;
457
700
  }()
701
+ /**
702
+ * Builds a full locus DTO snapshot from current internal locus state.
703
+ *
704
+ * @returns {LocusDTO}
705
+ */
706
+ )
707
+ }, {
708
+ key: "getCurrentLocusSnapshot",
709
+ value: function getCurrentLocusSnapshot() {
710
+ var _this5 = this;
711
+ var locus = {};
712
+ LocusDtoTopLevelKeys.forEach(function (key) {
713
+ var value = _this5[key];
714
+ if (value !== undefined && value !== null) {
715
+ locus[key] = (0, _lodash.cloneDeep)(value);
716
+ }
717
+ });
718
+ if (!(0, _isArray.default)(locus.participants)) {
719
+ locus.participants = [];
720
+ }
721
+ return locus;
722
+ }
723
+
458
724
  /**
459
725
  * Handles HTTP response from Locus API call.
460
726
  * @param {Meeting} meeting meeting object
461
727
  * @param {LocusApiResponseBody} responseBody body of the http response from Locus API call
462
728
  * @returns {void}
463
729
  */
464
- )
465
730
  }, {
466
731
  key: "handleLocusAPIResponse",
467
732
  value: function handleLocusAPIResponse(meeting, responseBody) {
468
- if (this.hashTreeParser) {
469
- if (!responseBody.dataSets) {
470
- this.sendClassicVsHashTreeMismatchMetric(meeting, "expected hash tree dataSets in API response but they are missing");
471
- // continuing as we can still manage without responseBody.dataSets, but this is very suspicious
472
- }
473
- _loggerProxy.default.logger.info('Locus-info:index#handleLocusAPIResponse --> passing Locus API response to HashTreeParser: ', responseBody);
474
- // update the data in our hash trees
475
- this.hashTreeParser.handleLocusUpdate(responseBody);
476
- } else {
477
- if (responseBody.dataSets) {
478
- this.sendClassicVsHashTreeMismatchMetric(meeting, "unexpected hash tree dataSets in API response");
733
+ var _responseBody$locus;
734
+ var isWrapped = 'locus' in responseBody;
735
+ var locusUrl = isWrapped ? (_responseBody$locus = responseBody.locus) === null || _responseBody$locus === void 0 ? void 0 : _responseBody$locus.url : responseBody.url;
736
+ var hashTreeParserEntry = locusUrl && this.hashTreeParsers.get(locusUrl);
737
+ var locus = isWrapped ? responseBody.locus : responseBody;
738
+ if (this.hashTreeParsers.size > 0) {
739
+ // We are in hash tree mode. Check if we need to create/reactivate a parser for this locusUrl.
740
+ if (!hashTreeParserEntry || hashTreeParserEntry.parser.state === 'stopped') {
741
+ if (!locusUrl) {
742
+ _loggerProxy.default.logger.warn('Locus-info:index#handleLocusAPIResponse --> API response has no locusUrl, cannot handle hash tree parser switch');
743
+ return;
744
+ }
745
+ this.handleHashTreeParserSwitchForAPIResponse(locusUrl, locus);
746
+ return;
747
+ }
748
+
749
+ // Active parser found - pass the API response to it
750
+ if (isWrapped) {
751
+ // update the data in our hash trees
752
+ hashTreeParserEntry.parser.handleLocusUpdate(responseBody);
753
+ } else {
754
+ // LocusDTO without wrapper - pass it through as if it had no dataSets nor metadata
755
+ hashTreeParserEntry.parser.handleLocusUpdate({
756
+ locus: responseBody
757
+ });
479
758
  }
480
- // classic Locus delta
481
- this.handleLocusDelta(responseBody.locus, meeting);
759
+ return;
482
760
  }
761
+
762
+ // No hash tree parsers - classic Locus mode
763
+ if (isWrapped && responseBody.dataSets) {
764
+ this.sendClassicVsHashTreeMismatchMetric(meeting, "unexpected hash tree dataSets in API response");
765
+ }
766
+
767
+ // classic Locus delta
768
+ this.handleLocusDelta(locus, meeting);
483
769
  }
484
770
 
485
771
  /**
486
- *
487
772
  * @param {HashTreeObject} object data set object
488
773
  * @param {any} locus
489
774
  * @returns {void}
@@ -491,14 +776,15 @@ var LocusInfo = exports.default = /*#__PURE__*/function (_EventsScope) {
491
776
  }, {
492
777
  key: "updateLocusFromHashTreeObject",
493
778
  value: function updateLocusFromHashTreeObject(object, locus) {
494
- var _this4 = this;
779
+ var _this6 = this,
780
+ _locus$self;
495
781
  var type = object.htMeta.elementId.type.toLowerCase();
496
782
  var addParticipantObject = function addParticipantObject(obj) {
497
783
  if (!locus.participants) {
498
784
  locus.participants = [];
499
785
  }
500
786
  locus.participants.push(obj.data);
501
- _this4.hashTreeObjectId2ParticipantId.set(obj.htMeta.elementId.id, obj.data.id);
787
+ _this6.hashTreeObjectId2ParticipantId.set(obj.htMeta.elementId.id, obj.data.id);
502
788
  };
503
789
  switch (type) {
504
790
  case _types.ObjectType.locus:
@@ -543,6 +829,27 @@ var LocusInfo = exports.default = /*#__PURE__*/function (_EventsScope) {
543
829
  });
544
830
  }
545
831
  break;
832
+ case _types.ObjectType.embeddedApp:
833
+ if (object.data) {
834
+ var _locus$embeddedApps;
835
+ _loggerProxy.default.logger.info("Locus-info:index#updateLocusFromHashTreeObject --> embeddedApp id=".concat(object.htMeta.elementId.id, " url='").concat(object.data.url, "' updated version=").concat(object.htMeta.elementId.version, ":"), object.data);
836
+ var existingEmbeddedApp = (_locus$embeddedApps = locus.embeddedApps) === null || _locus$embeddedApps === void 0 ? void 0 : _locus$embeddedApps.find(function (ms) {
837
+ return ms.htMeta.elementId.id === object.htMeta.elementId.id;
838
+ });
839
+ if (existingEmbeddedApp) {
840
+ (0, _assign.default)(existingEmbeddedApp, object.data);
841
+ } else {
842
+ locus.embeddedApps = locus.embeddedApps || [];
843
+ locus.embeddedApps.push(object.data);
844
+ }
845
+ } else {
846
+ var _locus$embeddedApps2;
847
+ _loggerProxy.default.logger.info("Locus-info:index#updateLocusFromHashTreeObject --> embeddedApp id=".concat(object.htMeta.elementId.id, " removed, version=").concat(object.htMeta.elementId.version));
848
+ locus.embeddedApps = (_locus$embeddedApps2 = locus.embeddedApps) === null || _locus$embeddedApps2 === void 0 ? void 0 : _locus$embeddedApps2.filter(function (ms) {
849
+ return ms.htMeta.elementId.id !== object.htMeta.elementId.id;
850
+ });
851
+ }
852
+ break;
546
853
  case _types.ObjectType.participant:
547
854
  _loggerProxy.default.logger.info("Locus-info:index#updateLocusFromHashTreeObject --> participant id=".concat(object.htMeta.elementId.id, " ").concat(object.data ? 'updated' : 'removed', " version=").concat(object.htMeta.elementId.version));
548
855
  if (object.data) {
@@ -557,6 +864,16 @@ var LocusInfo = exports.default = /*#__PURE__*/function (_EventsScope) {
557
864
  locus.jsSdkMeta.removedParticipantIds.push(participantId);
558
865
  this.hashTreeObjectId2ParticipantId.delete(object.htMeta.elementId.id);
559
866
  }
867
+ // Create self from the participant if it matches self identity and is being moved.
868
+ // We need this, because participant update comes in LLM message often before the self update from Mercury.
869
+ // Other parts of the code detect move only by looking at self, while some other parts of the SDK/webapp code
870
+ // look at participant for roles etc, so if participant is updated but not self, then it looks like we our lost roles temporarily
871
+ // (until self is updated)
872
+ // This will be fixed properly in SPARK-790239
873
+ 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') {
874
+ _loggerProxy.default.logger.info("Locus-info:index#updateLocusFromHashTreeObject --> FOUND a match for MOVED self in participant object ".concat(object.htMeta.elementId.id));
875
+ (0, _assign.default)(locus[_types.ObjectTypeToLocusKeyMap[_types.ObjectType.self]], object.data);
876
+ }
560
877
  break;
561
878
  case _types.ObjectType.control:
562
879
  if (object.data) {
@@ -578,10 +895,14 @@ var LocusInfo = exports.default = /*#__PURE__*/function (_EventsScope) {
578
895
  if (!object.data) {
579
896
  // self without data is handled inside HashTreeParser and results in LocusInfoUpdateType.MEETING_ENDED, so we should never get here
580
897
  // all other types info, fullstate, etc - Locus should never send them without data
581
- _loggerProxy.default.logger.warn("Locus-info:index#updateLocusFromHashTreeObject --> received ".concat(type, " object without data, this is not expected! version=").concat(object.htMeta.elementId.version));
898
+ // but we end up with this method being called without the data for them when the main dataset is removed from visible datasets list
899
+ _loggerProxy.default.logger.info("Locus-info:index#updateLocusFromHashTreeObject --> received ".concat(type, " object without data, version=").concat(object.htMeta.elementId.version));
582
900
  } else {
583
901
  var _locus$info, _object$data$controls, _object$data$controls2, _object$data$controls3;
584
902
  _loggerProxy.default.logger.info("Locus-info:index#updateLocusFromHashTreeObject --> ".concat(type, " object updated to version ").concat(object.htMeta.elementId.version));
903
+ if (type === _types.ObjectType.self) {
904
+ _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));
905
+ }
585
906
  var locusDtoKey = _types.ObjectTypeToLocusKeyMap[type];
586
907
  locus[locusDtoKey] = object.data;
587
908
 
@@ -598,6 +919,10 @@ var LocusInfo = exports.default = /*#__PURE__*/function (_EventsScope) {
598
919
  }
599
920
  }
600
921
  break;
922
+ case _types.ObjectType.metadata:
923
+ _loggerProxy.default.logger.info("Locus-info:index#updateLocusFromHashTreeObject --> metadata object updated to version ".concat(object.htMeta.elementId.version));
924
+ // we don't use hash tree metadata right now for anything, it's mainly used internally by HashTreeParser
925
+ break;
601
926
  default:
602
927
  _loggerProxy.default.logger.warn("Locus-info:index#updateLocusFromHashTreeObject --> received unsupported object type ".concat(type));
603
928
  break;
@@ -627,6 +952,136 @@ var LocusInfo = exports.default = /*#__PURE__*/function (_EventsScope) {
627
952
  }
628
953
  }
629
954
 
955
+ /**
956
+ * Helper that handles the common logic for reactivating a stopped HashTreeParser when
957
+ * a newer "replaces" is detected. Used by both the message and API response parser switch methods.
958
+ *
959
+ * @param {string} callerName - name of the calling method, used in log messages
960
+ * @param {string} locusUrl - the locus URL of the stopped parser
961
+ * @param {HashTreeParserEntry} stoppedEntry - the stopped parser entry
962
+ * @param {ReplacesInfo} replaces - replacement info extracted from self
963
+ * @param {Function} resumeCallback - callback to invoke after reactivation to resume the parser
964
+ * @returns {void}
965
+ */
966
+ }, {
967
+ key: "resumeStoppedParser",
968
+ value: function resumeStoppedParser(callerName, locusUrl, stoppedEntry, replaces, resumeCallback) {
969
+ // this check is just for typescript, it should never happen, replaces should always be defined
970
+ if (!replaces) {
971
+ _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"));
972
+ return;
973
+ }
974
+ if (replaces.replacedAt <= (stoppedEntry.replacedAt || '')) {
975
+ _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"));
976
+ return;
977
+ }
978
+ _loggerProxy.default.logger.info("Locus-info:index#".concat(callerName, " --> reactivating HashTreeParser for locusUrl=").concat(locusUrl, ", which replaces ").concat(replaces.locusUrl));
979
+ var replacedEntry = this.hashTreeParsers.get(replaces.locusUrl);
980
+ if (replacedEntry) {
981
+ replacedEntry.replacedAt = replaces.replacedAt;
982
+ replacedEntry.parser.stop();
983
+ } else {
984
+ _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));
985
+ }
986
+ stoppedEntry.initializedFromHashTree = false;
987
+ this.hashTreeObjectId2ParticipantId.clear();
988
+ resumeCallback();
989
+ }
990
+
991
+ /**
992
+ * Handles an API response whose locusUrl doesn't match any active HashTreeParser
993
+ * (either no entry exists, or the existing entry is stopped).
994
+ * Creates a new parser or reactivates a stopped one using initializeFromGetLociResponse.
995
+ *
996
+ * @param {string} locusUrl - the locus URL from the API response
997
+ * @param {LocusDTO} locus - the locus DTO from the API response
998
+ * @returns {void}
999
+ */
1000
+ }, {
1001
+ key: "handleHashTreeParserSwitchForAPIResponse",
1002
+ value: function handleHashTreeParserSwitchForAPIResponse(locusUrl, locus) {
1003
+ var entry = this.hashTreeParsers.get(locusUrl);
1004
+ var replaces = getReplaceInfoFromSelf(locus.self,
1005
+ // @ts-ignore
1006
+ this.webex.internal.device.url);
1007
+ if (!entry) {
1008
+ _loggerProxy.default.logger.info("Locus-info:index#handleHashTreeParserSwitchForAPIResponse --> no parser for locusUrl ".concat(locusUrl, ", creating a new one"));
1009
+ var parser = this.createHashTreeParser({
1010
+ locusUrl: locusUrl,
1011
+ initialLocus: {
1012
+ locus: null,
1013
+ dataSets: []
1014
+ },
1015
+ metadata: null,
1016
+ replacedAt: replaces === null || replaces === void 0 ? void 0 : replaces.replacedAt
1017
+ });
1018
+ parser.initializeFromGetLociResponse(locus);
1019
+ return;
1020
+ }
1021
+ if (entry.parser.state !== 'stopped') {
1022
+ _loggerProxy.default.logger.warn("Locus-info:index#handleHashTreeParserSwitchForAPIResponse --> unexpected parser state \"".concat(entry.parser.state, "\" for locusUrl ").concat(locusUrl));
1023
+ return;
1024
+ }
1025
+ this.resumeStoppedParser('handleHashTreeParserSwitchForAPIResponse', locusUrl, entry, replaces, function () {
1026
+ return entry.parser.resumeFromApiResponse(locus);
1027
+ });
1028
+ }
1029
+
1030
+ /**
1031
+ * Checks if the hash tree message should trigger a switch to a different HashTreeParser
1032
+ *
1033
+ * @param {HashTreeMessage} message incoming hash tree message
1034
+ * @returns {boolean} true if the message was handled as a parser switch, false otherwise
1035
+ */
1036
+ }, {
1037
+ key: "handleHashTreeParserSwitch",
1038
+ value: function handleHashTreeParserSwitch(message) {
1039
+ var _message$locusStateEl3, _message$locusStateEl4;
1040
+ var entry = this.hashTreeParsers.get(message.locusUrl);
1041
+ var self = (_message$locusStateEl3 = message.locusStateElements) === null || _message$locusStateEl3 === void 0 ? void 0 : (_message$locusStateEl4 = _message$locusStateEl3.find(function (el) {
1042
+ return (0, _utils.isSelf)(el);
1043
+ })) === null || _message$locusStateEl4 === void 0 ? void 0 : _message$locusStateEl4.data;
1044
+ var replaces = getReplaceInfoFromSelf(self,
1045
+ // @ts-ignore
1046
+ this.webex.internal.device.url);
1047
+ if (!entry) {
1048
+ var _message$locusStateEl5, _metadata$data, _metadata$data$visibl;
1049
+ // Metadata object that contains information about visible datasets is needed to initialize the HashTreeParser,
1050
+ // but it's buried inside the message, we need to find it and pass it to HashTreeParser constructor
1051
+ var metadata = (_message$locusStateEl5 = message.locusStateElements) === null || _message$locusStateEl5 === void 0 ? void 0 : _message$locusStateEl5.find(function (el) {
1052
+ return (0, _utils.isMetadata)(el);
1053
+ });
1054
+ 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) {
1055
+ _loggerProxy.default.logger.info("Locus-info:index#handleHashTreeParserSwitch --> no hash tree parser found for locusUrl ".concat(message.locusUrl, ", creating a new one"));
1056
+ var parser = this.createHashTreeParser({
1057
+ locusUrl: message.locusUrl,
1058
+ initialLocus: {
1059
+ locus: null,
1060
+ dataSets: message.dataSets
1061
+ },
1062
+ metadata: {
1063
+ htMeta: metadata.htMeta,
1064
+ visibleDataSets: metadata.data.visibleDataSets
1065
+ },
1066
+ replacedAt: replaces === null || replaces === void 0 ? void 0 : replaces.replacedAt
1067
+ });
1068
+
1069
+ // handle the message with the new parser
1070
+ parser.handleMessage(message);
1071
+ }
1072
+ return true;
1073
+ }
1074
+ if (entry.parser.state === 'stopped') {
1075
+ // 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
1076
+ // this happens when you move from breakout A -> breakout B -> back to breakout A
1077
+ this.resumeStoppedParser('handleHashTreeParserSwitch', message.locusUrl, entry, replaces, function () {
1078
+ return entry.parser.resumeFromMessage(message);
1079
+ });
1080
+ return true;
1081
+ }
1082
+ return false;
1083
+ }
1084
+
630
1085
  /**
631
1086
  * Handles a hash tree message received from Locus.
632
1087
  *
@@ -642,35 +1097,109 @@ var LocusInfo = exports.default = /*#__PURE__*/function (_EventsScope) {
642
1097
  this.sendClassicVsHashTreeMismatchMetric(meeting, "got ".concat(eventType, ", expected ").concat(_constants.LOCUSEVENT.HASH_TREE_DATA_UPDATED));
643
1098
  return;
644
1099
  }
645
- this.hashTreeParser.handleMessage(message);
1100
+ var parserSwitched = this.handleHashTreeParserSwitch(message);
1101
+ if (parserSwitched) {
1102
+ return;
1103
+ }
1104
+ var entry = this.hashTreeParsers.get(message.locusUrl);
1105
+
1106
+ // the check is just for typescript, the case of no entry in hashTreeParsers is handled in handleHashTreeParserSwitch() above
1107
+ if (entry) {
1108
+ entry.parser.handleMessage(message);
1109
+ }
646
1110
  }
647
1111
 
1112
+ /**
1113
+ * Triggers a sync of all hash tree datasets for all hash tree parsers associated with this meeting.
1114
+ * The syncs are executed sequentially within each parser.
1115
+ *
1116
+ * @param {Object} [options={}] - Options for syncing
1117
+ * @param {boolean} [options.onlyLLM=false] - Whether to sync only LLM based data sets
1118
+ * @returns {Promise<void>}
1119
+ */
1120
+ }, {
1121
+ key: "syncAllHashTreeDatasets",
1122
+ value: (function () {
1123
+ var _syncAllHashTreeDatasets = (0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee2() {
1124
+ var options,
1125
+ _iterator3,
1126
+ _step3,
1127
+ _step3$value,
1128
+ entry,
1129
+ _args2 = arguments,
1130
+ _t2;
1131
+ return _regenerator.default.wrap(function (_context2) {
1132
+ while (1) switch (_context2.prev = _context2.next) {
1133
+ case 0:
1134
+ options = _args2.length > 0 && _args2[0] !== undefined ? _args2[0] : {};
1135
+ _iterator3 = _createForOfIteratorHelper(this.hashTreeParsers);
1136
+ _context2.prev = 1;
1137
+ _iterator3.s();
1138
+ case 2:
1139
+ if ((_step3 = _iterator3.n()).done) {
1140
+ _context2.next = 4;
1141
+ break;
1142
+ }
1143
+ _step3$value = (0, _slicedToArray2.default)(_step3.value, 2), entry = _step3$value[1];
1144
+ if (!entry.parser) {
1145
+ _context2.next = 3;
1146
+ break;
1147
+ }
1148
+ _context2.next = 3;
1149
+ return entry.parser.syncAllDatasets(options);
1150
+ case 3:
1151
+ _context2.next = 2;
1152
+ break;
1153
+ case 4:
1154
+ _context2.next = 6;
1155
+ break;
1156
+ case 5:
1157
+ _context2.prev = 5;
1158
+ _t2 = _context2["catch"](1);
1159
+ _iterator3.e(_t2);
1160
+ case 6:
1161
+ _context2.prev = 6;
1162
+ _iterator3.f();
1163
+ return _context2.finish(6);
1164
+ case 7:
1165
+ case "end":
1166
+ return _context2.stop();
1167
+ }
1168
+ }, _callee2, this, [[1, 5, 6, 7]]);
1169
+ }));
1170
+ function syncAllHashTreeDatasets() {
1171
+ return _syncAllHashTreeDatasets.apply(this, arguments);
1172
+ }
1173
+ return syncAllHashTreeDatasets;
1174
+ }()
648
1175
  /**
649
1176
  * Callback registered with HashTreeParser to receive locus info updates.
650
1177
  * Updates our locus info based on the data parsed by the hash tree parser.
651
1178
  *
652
- * @param {LocusInfoUpdateType} updateType - The type of update received.
653
- * @param {Object} [data] - Additional data for the update, if applicable.
1179
+ * @param {string} locusUrl - the locus URL for which the update is received
1180
+ * @param {LocusInfoUpdate} update - Details about the update.
654
1181
  * @returns {void}
655
1182
  */
1183
+ )
656
1184
  }, {
657
1185
  key: "updateFromHashTree",
658
- value: function updateFromHashTree(updateType, data) {
659
- var _this5 = this;
660
- switch (updateType) {
661
- case _hashTreeParser.LocusInfoUpdateType.OBJECTS_UPDATED:
1186
+ value: function updateFromHashTree(locusUrl, update) {
1187
+ var _this7 = this;
1188
+ switch (update.updateType) {
1189
+ case _hashTreeParser2.LocusInfoUpdateType.OBJECTS_UPDATED:
662
1190
  {
663
1191
  // initialize our new locus
664
1192
  var locus = {
665
1193
  participants: [],
666
1194
  jsSdkMeta: {
667
- removedParticipantIds: []
1195
+ removedParticipantIds: [],
1196
+ forceReplaceMembers: false
668
1197
  }
669
1198
  };
670
1199
 
671
1200
  // first go over all the updates and check what happens with the main locus object
672
1201
  var locusObjectStateAfterUpdates = LocusObjectStateAfterUpdates.unchanged;
673
- data.updatedObjects.forEach(function (object) {
1202
+ update.updatedObjects.forEach(function (object) {
674
1203
  if (object.htMeta.elementId.type.toLowerCase() === _types.ObjectType.locus) {
675
1204
  if (locusObjectStateAfterUpdates === LocusObjectStateAfterUpdates.updated) {
676
1205
  var _object$data;
@@ -679,7 +1208,7 @@ var LocusInfo = exports.default = /*#__PURE__*/function (_EventsScope) {
679
1208
  // but these should never happen
680
1209
  _loggerProxy.default.logger.warn("Locus-info:index#updateFromHashTree --> received multiple LOCUS objects in one update, this is unexpected!");
681
1210
  _metrics.default.sendBehavioralMetric(_constants2.default.LOCUS_HASH_TREE_UNSUPPORTED_OPERATION, {
682
- locusUrl: ((_object$data = object.data) === null || _object$data === void 0 ? void 0 : _object$data.url) || _this5.url,
1211
+ locusUrl: ((_object$data = object.data) === null || _object$data === void 0 ? void 0 : _object$data.url) || _this7.url,
683
1212
  message: object.data ? 'multiple LOCUS object updates' : 'LOCUS object update followed by removal'
684
1213
  });
685
1214
  }
@@ -690,17 +1219,30 @@ var LocusInfo = exports.default = /*#__PURE__*/function (_EventsScope) {
690
1219
  }
691
1220
  }
692
1221
  });
693
-
1222
+ var hashTreeParserEntry = this.hashTreeParsers.get(locusUrl);
1223
+ if (!hashTreeParserEntry) {
1224
+ _loggerProxy.default.logger.warn("Locus-info:index#updateFromHashTree --> no HashTreeParser found for locusUrl ".concat(locusUrl, " when trying to apply updates from hash tree"));
1225
+ return;
1226
+ }
1227
+ if (!hashTreeParserEntry.initializedFromHashTree) {
1228
+ // this is the first time we're getting an update for this locusUrl,
1229
+ // so it's probably a move to/from breakout. We need to start from a clean state,
1230
+ // so empty locus and we rely on Locus giving us sufficient data in the updates to populate it.
1231
+ _loggerProxy.default.logger.info("Locus-info:index#updateFromHashTree --> first INITIAL update for locusUrl ".concat(locusUrl, ", starting from empty state"));
1232
+ hashTreeParserEntry.initializedFromHashTree = true;
1233
+ // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
1234
+ locus.jsSdkMeta.forceReplaceMembers = true;
1235
+ } else if (
694
1236
  // if Locus object is unchanged or removed, we need to keep using the existing locus
695
1237
  // because the rest of the locusInfo code expects locus to always be present (with at least some of the fields)
696
1238
  // if it gets updated, we only need to have the fields that are not part of "locus" object (like "info" or "mediaShares")
697
1239
  // so that when Locus object gets updated, if the new one is missing some field, that field will
698
1240
  // be removed from our locusInfo
699
- if (locusObjectStateAfterUpdates === LocusObjectStateAfterUpdates.unchanged || locusObjectStateAfterUpdates === LocusObjectStateAfterUpdates.removed) {
1241
+ locusObjectStateAfterUpdates === LocusObjectStateAfterUpdates.unchanged || locusObjectStateAfterUpdates === LocusObjectStateAfterUpdates.removed) {
700
1242
  // copy over all of existing locus except participants
701
1243
  LocusDtoTopLevelKeys.forEach(function (key) {
702
1244
  if (key !== 'participants') {
703
- locus[key] = (0, _lodash.cloneDeep)(_this5[key]);
1245
+ locus[key] = (0, _lodash.cloneDeep)(_this7[key]);
704
1246
  }
705
1247
  });
706
1248
  } else {
@@ -708,11 +1250,11 @@ var LocusInfo = exports.default = /*#__PURE__*/function (_EventsScope) {
708
1250
  // (except participants, which need to stay empty - that means "no participant changes")
709
1251
  (0, _values.default)(_types.ObjectTypeToLocusKeyMap).forEach(function (locusDtoKey) {
710
1252
  if (locusDtoKey !== 'participants') {
711
- locus[locusDtoKey] = (0, _lodash.cloneDeep)(_this5[locusDtoKey]);
1253
+ locus[locusDtoKey] = (0, _lodash.cloneDeep)(_this7[locusDtoKey]);
712
1254
  }
713
1255
  });
714
1256
  }
715
- _loggerProxy.default.logger.info("Locus-info:index#updateFromHashTree --> LOCUS object is ".concat(locusObjectStateAfterUpdates, ", all updates: ").concat((0, _stringify.default)(data.updatedObjects.map(function (o) {
1257
+ _loggerProxy.default.logger.info("Locus-info:index#updateFromHashTree --> LOCUS object is ".concat(locusObjectStateAfterUpdates, ", all updates: ").concat((0, _stringify.default)(update.updatedObjects.map(function (o) {
716
1258
  return {
717
1259
  type: o.htMeta.elementId.type,
718
1260
  id: o.htMeta.elementId.id,
@@ -720,19 +1262,33 @@ var LocusInfo = exports.default = /*#__PURE__*/function (_EventsScope) {
720
1262
  };
721
1263
  }))));
722
1264
  // now apply all the updates from the hash tree onto the locus
723
- data.updatedObjects.forEach(function (object) {
724
- locus = _this5.updateLocusFromHashTreeObject(object, locus);
1265
+ update.updatedObjects.forEach(function (object) {
1266
+ locus = _this7.updateLocusFromHashTreeObject(object, locus);
725
1267
  });
726
1268
 
727
1269
  // update our locus info with the new locus
728
1270
  this.onDeltaLocus(locus);
729
1271
  break;
730
1272
  }
731
- case _hashTreeParser.LocusInfoUpdateType.MEETING_ENDED:
1273
+ case _hashTreeParser2.LocusInfoUpdateType.MEETING_ENDED:
732
1274
  {
733
- _loggerProxy.default.logger.info("Locus-info:index#updateFromHashTree --> received signal that meeting ended, destroying meeting ".concat(this.meetingId));
734
1275
  var meeting = this.webex.meetings.meetingCollection.get(this.meetingId);
735
- this.webex.meetings.destroy(meeting, _constants.MEETING_REMOVED_REASON.SELF_REMOVED);
1276
+ if (meeting) {
1277
+ _loggerProxy.default.logger.info("Locus-info:index#updateFromHashTree --> received signal that meeting ended, destroying meeting ".concat(this.meetingId));
1278
+ this.webex.meetings.destroy(meeting, _constants.MEETING_REMOVED_REASON.SELF_REMOVED);
1279
+ }
1280
+ break;
1281
+ }
1282
+ case _hashTreeParser2.LocusInfoUpdateType.LOCUS_NOT_FOUND:
1283
+ {
1284
+ _loggerProxy.default.logger.info("Locus-info:index#updateFromHashTree --> received LOCUS_NOT_FOUND for ".concat(locusUrl, ", triggering syncMeetings"));
1285
+ this.webex.meetings.syncMeetings({
1286
+ keepOnlyLocusMeetings: false,
1287
+ skipHashTreeSync: true
1288
+ }).catch(function (syncError) {
1289
+ _loggerProxy.default.logger.error("Locus-info:index#updateFromHashTree --> syncMeetings failed after LOCUS_NOT_FOUND: ".concat(syncError));
1290
+ });
1291
+ break;
736
1292
  }
737
1293
  }
738
1294
  }
@@ -746,11 +1302,22 @@ var LocusInfo = exports.default = /*#__PURE__*/function (_EventsScope) {
746
1302
  }, {
747
1303
  key: "parse",
748
1304
  value: function parse(meeting, data) {
749
- if (this.hashTreeParser) {
750
- this.handleHashTreeMessage(meeting, data.eventType, data.stateElementsMessage);
1305
+ if (this.hashTreeParsers.size > 0) {
1306
+ if (data.eventType === _constants.LOCUSEVENT.SDK_LOCUS_FROM_SYNC_MEETINGS) {
1307
+ // sync meetings response follows the format of "not wrapped" locus API responses,
1308
+ // so has no dataSets nor Metadata
1309
+ this.handleLocusAPIResponse(meeting, _objectSpread({}, data.locus));
1310
+ } else {
1311
+ this.handleHashTreeMessage(meeting, data.eventType, data.stateElementsMessage);
1312
+ }
751
1313
  } else {
752
- // eslint-disable-next-line @typescript-eslint/no-shadow
753
1314
  var eventType = data.eventType;
1315
+ if (eventType === _constants.LOCUSEVENT.HASH_TREE_DATA_UPDATED) {
1316
+ // this can happen when we get an event before join http response
1317
+ // it's OK to just ignore it
1318
+ _loggerProxy.default.logger.info("Locus-info:index#parse --> received locus hash tree event before hashTreeParser is created");
1319
+ return;
1320
+ }
754
1321
  var locus = this.getTheLocusToUpdate(data.locus);
755
1322
  _loggerProxy.default.logger.info("Locus-info:index#parse --> received locus data: ".concat(eventType));
756
1323
  locus.jsSdkMeta = {
@@ -771,14 +1338,11 @@ var LocusInfo = exports.default = /*#__PURE__*/function (_EventsScope) {
771
1338
  case _constants.LOCUSEVENT.PARTICIPANT_DECLINED:
772
1339
  case _constants.LOCUSEVENT.FLOOR_GRANTED:
773
1340
  case _constants.LOCUSEVENT.FLOOR_RELEASED:
774
- this.onFullLocus(locus, eventType);
1341
+ this.onFullLocus("classic locus event ".concat(eventType), locus, eventType);
775
1342
  break;
776
1343
  case _constants.LOCUSEVENT.DIFFERENCE:
777
1344
  this.handleLocusDelta(locus, meeting);
778
1345
  break;
779
- case _constants.LOCUSEVENT.HASH_TREE_DATA_UPDATED:
780
- this.sendClassicVsHashTreeMismatchMetric(meeting, "got ".concat(eventType, ", expected classic events"));
781
- break;
782
1346
  default:
783
1347
  // Why will there be a event with no eventType ????
784
1348
  // we may not need this, we can get full locus
@@ -803,32 +1367,40 @@ var LocusInfo = exports.default = /*#__PURE__*/function (_EventsScope) {
803
1367
  /**
804
1368
  * Function for handling full locus when it's using hash trees (so not the "classic" one).
805
1369
  *
1370
+ * @param {string} debugText string explaining the trigger for this call, added to logs for debugging purposes
806
1371
  * @param {object} locus locus object
807
- * @param {string} eventType locus event
1372
+ * @param {object} metadata locus hash trees metadata
808
1373
  * @param {DataSet[]} dataSets
1374
+ * @param {string} eventType locus event
809
1375
  * @returns {void}
810
1376
  */
811
1377
  }, {
812
1378
  key: "onFullLocusWithHashTrees",
813
- value: function onFullLocusWithHashTrees(locus, eventType, dataSets) {
814
- if (!this.hashTreeParser) {
815
- _loggerProxy.default.logger.info("Locus-info:index#onFullLocus --> creating hash tree parser");
816
- _loggerProxy.default.logger.info('Locus-info:index#onFullLocus --> dataSets:', dataSets, ' and locus:', locus);
817
- this.hashTreeParser = this.createHashTreeParser({
1379
+ value: function onFullLocusWithHashTrees(debugText, locus, metadata, dataSets, eventType) {
1380
+ if (!this.hashTreeParsers.has(locus.url)) {
1381
+ _loggerProxy.default.logger.info("Locus-info:index#onFullLocus (".concat(debugText, ") --> creating hash tree parser for locusUrl=").concat(locus.url));
1382
+ _loggerProxy.default.logger.info("Locus-info:index#onFullLocus (".concat(debugText, ") --> dataSets:"), dataSets, ' and locus:', locus, ' and metadata:', metadata);
1383
+ this.createHashTreeParser({
1384
+ locusUrl: locus.url,
818
1385
  initialLocus: {
819
1386
  locus: locus,
820
1387
  dataSets: dataSets
821
- }
1388
+ },
1389
+ metadata: metadata
822
1390
  });
1391
+ // we have a full locus to start with, so we consider Locus info to be "initialized"
1392
+ // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
1393
+ this.hashTreeParsers.get(locus.url).initializedFromHashTree = true;
823
1394
  this.onFullLocusCommon(locus, eventType);
824
1395
  } else {
825
1396
  // in this case the Locus we're getting is not necessarily the full one
826
1397
  // so treat it like if we just got it in any api response
827
1398
 
828
- _loggerProxy.default.logger.info('Locus-info:index#onFullLocus --> hash tree parser already exists, handling it like a normal API response');
1399
+ _loggerProxy.default.logger.info("Locus-info:index#onFullLocus (".concat(debugText, ") --> hash tree parser already exists, handling it like a normal API response"));
829
1400
  this.handleLocusAPIResponse(undefined, {
830
1401
  dataSets: dataSets,
831
- locus: locus
1402
+ locus: locus,
1403
+ metadata: metadata
832
1404
  });
833
1405
  }
834
1406
  }
@@ -836,15 +1408,16 @@ var LocusInfo = exports.default = /*#__PURE__*/function (_EventsScope) {
836
1408
  /**
837
1409
  * Function for handling full locus when it's the "classic" one (not hash trees)
838
1410
  *
1411
+ * @param {string} debugText string explaining the trigger for this call, added to logs for debugging purposes
839
1412
  * @param {object} locus locus object
840
1413
  * @param {string} eventType locus event
841
1414
  * @returns {void}
842
1415
  */
843
1416
  }, {
844
1417
  key: "onFullLocusClassic",
845
- value: function onFullLocusClassic(locus, eventType) {
1418
+ value: function onFullLocusClassic(debugText, locus, eventType) {
846
1419
  if (!this.locusParser.isNewFullLocus(locus)) {
847
- _loggerProxy.default.logger.info("Locus-info:index#onFullLocus --> ignoring old full locus DTO, eventType=".concat(eventType));
1420
+ _loggerProxy.default.logger.info("Locus-info:index#onFullLocus (".concat(debugText, ") --> ignoring old full locus DTO, eventType=").concat(eventType));
848
1421
  return;
849
1422
  }
850
1423
  this.onFullLocusCommon(locus, eventType);
@@ -852,23 +1425,28 @@ var LocusInfo = exports.default = /*#__PURE__*/function (_EventsScope) {
852
1425
 
853
1426
  /**
854
1427
  * updates the locus with full locus object
1428
+ * @param {string} debugText string explaining the trigger for this call, added to logs for debugging purposes
855
1429
  * @param {object} locus locus object
856
1430
  * @param {string} eventType locus event
857
1431
  * @param {DataSet[]} dataSets
1432
+ * @param {object} metadata locus hash trees metadata
858
1433
  * @returns {object} null
859
1434
  * @memberof LocusInfo
860
1435
  */
861
1436
  }, {
862
1437
  key: "onFullLocus",
863
- value: function onFullLocus(locus, eventType, dataSets) {
1438
+ value: function onFullLocus(debugText, locus, eventType, dataSets, metadata) {
864
1439
  if (!locus) {
865
- _loggerProxy.default.logger.error('Locus-info:index#onFullLocus --> object passed as argument was invalid, continuing.');
1440
+ _loggerProxy.default.logger.error("Locus-info:index#onFullLocus (".concat(debugText, ") --> object passed as argument was invalid, continuing."));
866
1441
  }
867
1442
  if (dataSets) {
1443
+ if (!metadata) {
1444
+ throw new Error("Locus-info:index#onFullLocus (".concat(debugText, ") --> hash tree metadata is missing with full Locus"));
1445
+ }
868
1446
  // this is the new hashmap Locus DTO format (only applicable to webinars for now)
869
- this.onFullLocusWithHashTrees(locus, eventType, dataSets);
1447
+ this.onFullLocusWithHashTrees(debugText, locus, metadata, dataSets, eventType);
870
1448
  } else {
871
- this.onFullLocusClassic(locus, eventType);
1449
+ this.onFullLocusClassic(debugText, locus, eventType);
872
1450
  }
873
1451
  }
874
1452
 
@@ -882,15 +1460,15 @@ var LocusInfo = exports.default = /*#__PURE__*/function (_EventsScope) {
882
1460
  key: "onFullLocusCommon",
883
1461
  value: function onFullLocusCommon(locus, eventType) {
884
1462
  var _this$participants,
885
- _this6 = this,
1463
+ _this8 = this,
886
1464
  _locus$jsSdkMeta;
887
1465
  this.scheduledMeeting = locus.meeting || null;
888
1466
  this.participants = locus.participants;
889
1467
  (_this$participants = this.participants) === null || _this$participants === void 0 ? void 0 : _this$participants.forEach(function (participant) {
890
1468
  var _participant$htMeta;
891
1469
  // participant.htMeta is set only for hash tree based locus
892
- if ((_participant$htMeta = participant.htMeta) !== null && _participant$htMeta !== void 0 && _participant$htMeta.elementId.id) {
893
- _this6.hashTreeObjectId2ParticipantId.set(participant.htMeta.elementId.id, participant.id);
1470
+ if (typeof ((_participant$htMeta = participant.htMeta) === null || _participant$htMeta === void 0 ? void 0 : _participant$htMeta.elementId.id) === 'number') {
1471
+ _this8.hashTreeObjectId2ParticipantId.set(participant.htMeta.elementId.id, participant.id);
894
1472
  }
895
1473
  });
896
1474
  var isReplaceMembers = _controlsUtils.default.isNeedReplaceMembers(this.controls, locus.controls);
@@ -940,6 +1518,30 @@ var LocusInfo = exports.default = /*#__PURE__*/function (_EventsScope) {
940
1518
  }
941
1519
  }
942
1520
 
1521
+ /**
1522
+ * Makes sure that passed in locus object has a participant object for self.
1523
+ *
1524
+ * @param {LocusDTO} locus The locus object to check and modify if needed
1525
+ * @returns {void}
1526
+ */
1527
+ }, {
1528
+ key: "ensureSelfParticipantExists",
1529
+ value: function ensureSelfParticipantExists(locus) {
1530
+ var self = locus.self;
1531
+
1532
+ // sanity check, this should never fail
1533
+ if (!(self !== null && self !== void 0 && self.identity) || !(0, _isArray.default)(locus.participants)) {
1534
+ _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, "\""));
1535
+ return;
1536
+ }
1537
+ var selfExists = locus.participants.some(function (participant) {
1538
+ return participant.identity === self.identity;
1539
+ });
1540
+ if (!selfExists) {
1541
+ locus.participants.push(_objectSpread({}, self));
1542
+ }
1543
+ }
1544
+
943
1545
  /**
944
1546
  * @param {Object} locus
945
1547
  * @returns {undefined}
@@ -949,10 +1551,20 @@ var LocusInfo = exports.default = /*#__PURE__*/function (_EventsScope) {
949
1551
  key: "onDeltaLocus",
950
1552
  value: function onDeltaLocus(locus) {
951
1553
  var _locus$jsSdkMeta2;
952
- var isReplaceMembers = _controlsUtils.default.isNeedReplaceMembers(this.controls, locus.controls);
1554
+ 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);
1555
+ if (isReplaceMembers) {
1556
+ // when we're moving between breakouts, Locus sometimes doesn't send us
1557
+ // any participants at all for a few seconds
1558
+ // Web app relies on having at least the self participant always there
1559
+ // so we copy self into participants if it's not there.
1560
+ this.ensureSelfParticipantExists(locus);
1561
+ }
953
1562
  this.mergeParticipants(this.participants, locus.participants);
954
- this.updateLocusInfo(locus);
955
- this.updateParticipants(locus.participants, (_locus$jsSdkMeta2 = locus.jsSdkMeta) === null || _locus$jsSdkMeta2 === void 0 ? void 0 : _locus$jsSdkMeta2.removedParticipantIds, isReplaceMembers);
1563
+ var updatesApplied = this.updateLocusInfo(locus);
1564
+ if (updatesApplied) {
1565
+ var _locus$jsSdkMeta3;
1566
+ this.updateParticipants(locus.participants, (_locus$jsSdkMeta3 = locus.jsSdkMeta) === null || _locus$jsSdkMeta3 === void 0 ? void 0 : _locus$jsSdkMeta3.removedParticipantIds, isReplaceMembers);
1567
+ }
956
1568
  this.isMeetingActive();
957
1569
  }
958
1570
 
@@ -964,12 +1576,11 @@ var LocusInfo = exports.default = /*#__PURE__*/function (_EventsScope) {
964
1576
  }, {
965
1577
  key: "updateLocusInfo",
966
1578
  value: function updateLocusInfo(locus) {
967
- var _locus$self, _locus$self2;
968
- 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') {
1579
+ if (_util.default.isSelfMovedOrBreakoutEnded(locus)) {
969
1580
  // When moved to a breakout session locus sends a message for the previous locus
970
1581
  // indicating that we have been moved. It isn't helpful to continue parsing this
971
1582
  // as it gets interpreted as if we have left the call
972
- return;
1583
+ return false;
973
1584
  }
974
1585
  this.updateControls(locus.controls, locus.self);
975
1586
  this.updateConversationUrl(locus.conversationUrl, locus.info);
@@ -988,6 +1599,8 @@ var LocusInfo = exports.default = /*#__PURE__*/function (_EventsScope) {
988
1599
  this.updateLinks(locus.links);
989
1600
  this.compareAndUpdate();
990
1601
  // update which required to compare different objects from locus
1602
+
1603
+ return true;
991
1604
  }
992
1605
 
993
1606
  /**
@@ -1021,7 +1634,7 @@ var LocusInfo = exports.default = /*#__PURE__*/function (_EventsScope) {
1021
1634
  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_) {
1022
1635
  // @ts-ignore
1023
1636
  var partner = this.getLocusPartner(this.participants, this.self);
1024
- this.updateMeeting({
1637
+ this.callbacks.updateMeeting({
1025
1638
  partner: partner
1026
1639
  });
1027
1640
 
@@ -1041,8 +1654,19 @@ var LocusInfo = exports.default = /*#__PURE__*/function (_EventsScope) {
1041
1654
  name: 'client.call.remote-ended',
1042
1655
  options: {
1043
1656
  meetingId: this.meetingId
1657
+ },
1658
+ payload: {
1659
+ eventData: {
1660
+ joinInProgress: this.destroyMeetingSuspended
1661
+ }
1044
1662
  }
1045
1663
  });
1664
+ if (this.destroyMeetingSuspended) {
1665
+ _metrics.default.sendBehavioralMetric(_constants2.default.DESTROY_MEETING_WHILE_SUSPENDED, {
1666
+ meetingId: this.meetingId,
1667
+ reason: 'CALL_INACTIVE'
1668
+ });
1669
+ }
1046
1670
  this.emitScoped({
1047
1671
  file: 'locus-info',
1048
1672
  function: 'isMeetingActive'
@@ -1056,8 +1680,19 @@ var LocusInfo = exports.default = /*#__PURE__*/function (_EventsScope) {
1056
1680
  name: 'client.call.remote-ended',
1057
1681
  options: {
1058
1682
  meetingId: this.meetingId
1683
+ },
1684
+ payload: {
1685
+ eventData: {
1686
+ joinInProgress: this.destroyMeetingSuspended
1687
+ }
1059
1688
  }
1060
1689
  });
1690
+ if (this.destroyMeetingSuspended) {
1691
+ _metrics.default.sendBehavioralMetric(_constants2.default.DESTROY_MEETING_WHILE_SUSPENDED, {
1692
+ meetingId: this.meetingId,
1693
+ reason: 'PARTNER_LEFT'
1694
+ });
1695
+ }
1061
1696
  this.emitScoped({
1062
1697
  file: 'locus-info',
1063
1698
  function: 'isMeetingActive'
@@ -1072,8 +1707,19 @@ var LocusInfo = exports.default = /*#__PURE__*/function (_EventsScope) {
1072
1707
  name: 'client.call.remote-ended',
1073
1708
  options: {
1074
1709
  meetingId: this.meetingId
1710
+ },
1711
+ payload: {
1712
+ eventData: {
1713
+ joinInProgress: this.destroyMeetingSuspended
1714
+ }
1075
1715
  }
1076
1716
  });
1717
+ if (this.destroyMeetingSuspended) {
1718
+ _metrics.default.sendBehavioralMetric(_constants2.default.DESTROY_MEETING_WHILE_SUSPENDED, {
1719
+ meetingId: this.meetingId,
1720
+ reason: 'SELF_LEFT'
1721
+ });
1722
+ }
1077
1723
  this.emitScoped({
1078
1724
  file: 'locus-info',
1079
1725
  function: 'isMeetingActive'
@@ -1083,60 +1729,69 @@ var LocusInfo = exports.default = /*#__PURE__*/function (_EventsScope) {
1083
1729
  });
1084
1730
  }
1085
1731
  } else if (((_this$parsedLocus$ful6 = this.parsedLocus.fullState) === null || _this$parsedLocus$ful6 === void 0 ? void 0 : _this$parsedLocus$ful6.type) === _constants._MEETING_) {
1086
- if (this.fullState && (this.fullState.state === _constants.LOCUS.STATE.INACTIVE ||
1087
- // @ts-ignore
1088
- this.fullState.state === _constants.LOCUS.STATE.TERMINATING)) {
1089
- _loggerProxy.default.logger.warn('Locus-info:index#isMeetingActive --> Meeting is ending due to inactive or terminating');
1090
-
1091
- // @ts-ignore
1092
- this.webex.internal.newMetrics.submitClientEvent({
1093
- name: 'client.call.remote-ended',
1094
- options: {
1095
- meetingId: this.meetingId
1096
- }
1097
- });
1098
- this.emitScoped({
1099
- file: 'locus-info',
1100
- function: 'isMeetingActive'
1101
- }, _constants.EVENTS.DESTROY_MEETING, {
1102
- reason: _constants.MEETING_REMOVED_REASON.MEETING_INACTIVE_TERMINATING,
1103
- shouldLeave: false
1104
- });
1105
- } else if (this.fullState && this.fullState.removed) {
1106
- // user has been dropped from a meeting
1732
+ if (this.fullState && _util.default.isWholeMeetingEnded(this.fullState)) {
1733
+ if (this.destroyMeetingSuspended) {
1734
+ _loggerProxy.default.logger.info('Locus-info:index#isMeetingActive --> suppressing DESTROY_MEETING (MEETING_INACTIVE_TERMINATING) because destroyMeeting is suspended');
1735
+ _metrics.default.sendBehavioralMetric(_constants2.default.DESTROY_MEETING_WHILE_SUSPENDED, {
1736
+ meetingId: this.meetingId,
1737
+ reason: 'MEETING_INACTIVE_TERMINATING'
1738
+ });
1739
+ } else {
1740
+ _loggerProxy.default.logger.warn('Locus-info:index#isMeetingActive --> Meeting is ending due to inactive');
1107
1741
 
1108
- // @ts-ignore
1109
- this.webex.internal.newMetrics.submitClientEvent({
1110
- name: 'client.call.remote-ended',
1111
- options: {
1112
- meetingId: this.meetingId
1113
- }
1114
- });
1115
- this.emitScoped({
1116
- file: 'locus-info',
1117
- function: 'isMeetingActive'
1118
- }, _constants.EVENTS.DESTROY_MEETING, {
1119
- reason: _constants.MEETING_REMOVED_REASON.FULLSTATE_REMOVED,
1120
- shouldLeave: false
1121
- });
1742
+ // @ts-ignore
1743
+ this.webex.internal.newMetrics.submitClientEvent({
1744
+ name: 'client.call.remote-ended',
1745
+ options: {
1746
+ meetingId: this.meetingId
1747
+ }
1748
+ });
1749
+ this.emitScoped({
1750
+ file: 'locus-info',
1751
+ function: 'isMeetingActive'
1752
+ }, _constants.EVENTS.DESTROY_MEETING, {
1753
+ reason: _constants.MEETING_REMOVED_REASON.MEETING_INACTIVE_TERMINATING,
1754
+ shouldLeave: false
1755
+ });
1756
+ }
1122
1757
  }
1123
1758
  // If you are guest and you are removed from the meeting
1124
1759
  // You wont get any further events
1125
1760
  else if (this.parsedLocus.self && this.parsedLocus.self.removed) {
1126
- // Check if we need to send an event
1127
- this.emitScoped({
1128
- file: 'locus-info',
1129
- function: 'isMeetingActive'
1130
- }, _constants.EVENTS.DESTROY_MEETING, {
1131
- reason: _constants.MEETING_REMOVED_REASON.SELF_REMOVED,
1132
- shouldLeave: false
1133
- });
1761
+ if (this.destroyMeetingSuspended) {
1762
+ _loggerProxy.default.logger.info('Locus-info:index#isMeetingActive --> suppressing DESTROY_MEETING (SELF_REMOVED) because destroyMeeting is suspended');
1763
+ _metrics.default.sendBehavioralMetric(_constants2.default.DESTROY_MEETING_WHILE_SUSPENDED, {
1764
+ meetingId: this.meetingId,
1765
+ reason: 'SELF_REMOVED'
1766
+ });
1767
+ } else {
1768
+ this.emitScoped({
1769
+ file: 'locus-info',
1770
+ function: 'isMeetingActive'
1771
+ }, _constants.EVENTS.DESTROY_MEETING, {
1772
+ reason: _constants.MEETING_REMOVED_REASON.SELF_REMOVED,
1773
+ shouldLeave: false
1774
+ });
1775
+ }
1134
1776
  }
1135
1777
  } else {
1136
1778
  _loggerProxy.default.logger.warn('Locus-info:index#isMeetingActive --> Meeting Type is unknown.');
1137
1779
  }
1138
1780
  }
1139
1781
 
1782
+ /**
1783
+ * Suspends or resumes the emission of DESTROY_MEETING events in certain situations.
1784
+ * Used by joinWithMedia to prevent meeting destruction during retry flows.
1785
+ * @param {boolean} suspend - true to suppress, false to resume
1786
+ * @returns {undefined}
1787
+ * @memberof LocusInfo
1788
+ */
1789
+ }, {
1790
+ key: "suspendDestroyMeeting",
1791
+ value: function suspendDestroyMeeting(suspend) {
1792
+ this.destroyMeetingSuspended = suspend;
1793
+ }
1794
+
1140
1795
  /**
1141
1796
  * checks if the host permissions have changed while in the meeting
1142
1797
  * This would be the case if your role as host or moderator has been updated
@@ -1205,11 +1860,11 @@ var LocusInfo = exports.default = /*#__PURE__*/function (_EventsScope) {
1205
1860
  isReplace: isReplace
1206
1861
  });
1207
1862
  if (participants && (0, _isArray.default)(participants) && participants.length > 0) {
1208
- var _iterator = _createForOfIteratorHelper(participants),
1209
- _step;
1863
+ var _iterator4 = _createForOfIteratorHelper(participants),
1864
+ _step4;
1210
1865
  try {
1211
- for (_iterator.s(); !(_step = _iterator.n()).done;) {
1212
- var participant = _step.value;
1866
+ for (_iterator4.s(); !(_step4 = _iterator4.n()).done;) {
1867
+ var participant = _step4.value;
1213
1868
  if (participant && (participant === null || participant === void 0 ? void 0 : participant.reason) === 'FAILURE') {
1214
1869
  var _participant$person;
1215
1870
  this.emitScoped({
@@ -1221,9 +1876,9 @@ var LocusInfo = exports.default = /*#__PURE__*/function (_EventsScope) {
1221
1876
  }
1222
1877
  }
1223
1878
  } catch (err) {
1224
- _iterator.e(err);
1879
+ _iterator4.e(err);
1225
1880
  } finally {
1226
- _iterator.f();
1881
+ _iterator4.f();
1227
1882
  }
1228
1883
  }
1229
1884
  }
@@ -1246,6 +1901,7 @@ var LocusInfo = exports.default = /*#__PURE__*/function (_EventsScope) {
1246
1901
  hasMeetingContainerChanged = _ControlsUtils$getCon2.hasMeetingContainerChanged,
1247
1902
  hasTranscribeChanged = _ControlsUtils$getCon2.hasTranscribeChanged,
1248
1903
  hasHesiodLLMIdChanged = _ControlsUtils$getCon2.hasHesiodLLMIdChanged,
1904
+ hasAiSummaryNotificationChanged = _ControlsUtils$getCon2.hasAiSummaryNotificationChanged,
1249
1905
  hasTranscribeSpokenLanguageChanged = _ControlsUtils$getCon2.hasTranscribeSpokenLanguageChanged,
1250
1906
  hasManualCaptionChanged = _ControlsUtils$getCon2.hasManualCaptionChanged,
1251
1907
  hasEntryExitToneChanged = _ControlsUtils$getCon2.hasEntryExitToneChanged,
@@ -1343,7 +1999,9 @@ var LocusInfo = exports.default = /*#__PURE__*/function (_EventsScope) {
1343
1999
  }, _constants.LOCUSINFO.EVENTS.CONTROLS_RECORDING_UPDATED, {
1344
2000
  state: state,
1345
2001
  modifiedBy: current.record.modifiedBy,
1346
- lastModified: current.record.lastModified
2002
+ lastModified: current.record.lastModified,
2003
+ modifiedByServiceAppName: current.record.modifiedByServiceAppName,
2004
+ modifiedByServiceAppId: current.record.modifiedByServiceAppId
1347
2005
  });
1348
2006
  }
1349
2007
  if (hasMeetingContainerChanged) {
@@ -1376,6 +2034,14 @@ var LocusInfo = exports.default = /*#__PURE__*/function (_EventsScope) {
1376
2034
  hesiodLlmId: hesiodLlmId
1377
2035
  });
1378
2036
  }
2037
+ if (hasAiSummaryNotificationChanged) {
2038
+ this.emitScoped({
2039
+ file: 'locus-info',
2040
+ function: 'updateControls'
2041
+ }, _constants.LOCUSINFO.EVENTS.CONTROLS_AI_SUMMARY_NOTIFICATION_UPDATED, {
2042
+ aiSummaryNotification: current.transcribe.aiSummaryNotification
2043
+ });
2044
+ }
1379
2045
  if (hasTranscribeSpokenLanguageChanged) {
1380
2046
  var spokenLanguage = current.transcribe.spokenLanguage;
1381
2047
  this.emitScoped({
@@ -1415,7 +2081,7 @@ var LocusInfo = exports.default = /*#__PURE__*/function (_EventsScope) {
1415
2081
  }
1416
2082
  if (hasEntryExitToneChanged) {
1417
2083
  var entryExitTone = current.entryExitTone;
1418
- this.updateMeeting({
2084
+ this.callbacks.updateMeeting({
1419
2085
  entryExitTone: entryExitTone
1420
2086
  });
1421
2087
  this.emitScoped({
@@ -1430,7 +2096,7 @@ var LocusInfo = exports.default = /*#__PURE__*/function (_EventsScope) {
1430
2096
  // to fit with audio mute status logic
1431
2097
  if (hasVideoEnabledChanged) {
1432
2098
  var videoEnabled = current.videoEnabled;
1433
- this.updateMeeting({
2099
+ this.callbacks.updateMeeting({
1434
2100
  unmuteVideoAllowed: videoEnabled
1435
2101
  });
1436
2102
  this.emitScoped({
@@ -1520,12 +2186,12 @@ var LocusInfo = exports.default = /*#__PURE__*/function (_EventsScope) {
1520
2186
  value: function updateConversationUrl(conversationUrl, info) {
1521
2187
  if (conversationUrl && !(0, _lodash.isEqual)(this.conversationUrl, conversationUrl)) {
1522
2188
  this.conversationUrl = conversationUrl;
1523
- this.updateMeeting({
2189
+ this.callbacks.updateMeeting({
1524
2190
  conversationUrl: conversationUrl
1525
2191
  });
1526
2192
  } else if (info && info.conversationUrl && !(0, _lodash.isEqual)(this.conversationUrl, info.conversationUrl)) {
1527
2193
  this.conversationUrl = info.conversationUrl;
1528
- this.updateMeeting({
2194
+ this.callbacks.updateMeeting({
1529
2195
  conversationUrl: info.conversationUrl
1530
2196
  });
1531
2197
  }
@@ -1586,7 +2252,7 @@ var LocusInfo = exports.default = /*#__PURE__*/function (_EventsScope) {
1586
2252
  value: function updateFullState(fullState) {
1587
2253
  if (fullState && !(0, _lodash.isEqual)(this.fullState, fullState)) {
1588
2254
  var result = _fullState.default.getFullState(this.fullState, fullState);
1589
- this.updateMeeting(result.current);
2255
+ this.callbacks.updateMeeting(result.current);
1590
2256
  if (result.updates.meetingStateChangedTo) {
1591
2257
  this.emitScoped({
1592
2258
  file: 'locus-info',
@@ -1621,7 +2287,7 @@ var LocusInfo = exports.default = /*#__PURE__*/function (_EventsScope) {
1621
2287
  value: function updateHostInfo(host) {
1622
2288
  if (host && !(0, _lodash.isEqual)(this.host, host)) {
1623
2289
  var parsedHosts = _hostUtils.default.getHosts(this.host, host);
1624
- this.updateMeeting(parsedHosts.current);
2290
+ this.callbacks.updateMeeting(parsedHosts.current);
1625
2291
  this.parsedLocus.host = parsedHosts.current;
1626
2292
  if (parsedHosts.updates.isNewHost) {
1627
2293
  this.compareAndUpdateFlags.compareSelfAndHost = true;
@@ -1650,9 +2316,18 @@ var LocusInfo = exports.default = /*#__PURE__*/function (_EventsScope) {
1650
2316
  value: function updateMeetingInfo(info, self) {
1651
2317
  var _this$parsedLocus$sel;
1652
2318
  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) || [];
1653
- if (info && !(0, _lodash.isEqual)(this.info, info) || !(0, _lodash.isEqual)(this.roles, roles) && info) {
1654
- var isJoined = _selfUtils.default.isJoined(self || this.parsedLocus.self);
1655
- var parsedInfo = _infoUtils.default.getInfos(this.parsedLocus.info, info, roles, isJoined);
2319
+ var isJoined = _selfUtils.default.isJoined(self || this.parsedLocus.self);
2320
+
2321
+ // The parsed userDisplayHints depend on info, roles and isJoined, so we must recompute
2322
+ // whenever any of them changes. A common case is self transitioning to JOINED via a delta
2323
+ // that doesn't carry an info section - in that case we fall back to the previously stored
2324
+ // info so the hints get reparsed with the new joined state (e.g. VIEW_THE_PARTICIPANT_LIST).
2325
+ var infoToParse = info || this.info;
2326
+ var infoChanged = info && !(0, _lodash.isEqual)(this.info, info);
2327
+ var rolesChanged = !(0, _lodash.isEqual)(this.roles, roles);
2328
+ var isJoinedChanged = _selfUtils.default.isJoined(this.parsedLocus.self) !== isJoined;
2329
+ if (infoToParse && (infoChanged || rolesChanged || isJoinedChanged)) {
2330
+ var parsedInfo = _infoUtils.default.getInfos(this.parsedLocus.info, infoToParse, roles, isJoined);
1656
2331
  if (parsedInfo.updates.isLocked) {
1657
2332
  this.emitScoped({
1658
2333
  file: 'locus-info',
@@ -1665,10 +2340,10 @@ var LocusInfo = exports.default = /*#__PURE__*/function (_EventsScope) {
1665
2340
  function: 'updateMeetingInfo'
1666
2341
  }, _constants.LOCUSINFO.EVENTS.MEETING_UNLOCKED, info);
1667
2342
  }
1668
- this.info = info;
2343
+ this.info = infoToParse;
1669
2344
  this.parsedLocus.info = parsedInfo.current;
1670
2345
  // Parses the info and adds necessary values
1671
- this.updateMeeting(parsedInfo.current);
2346
+ this.callbacks.updateMeeting(parsedInfo.current);
1672
2347
  this.emitScoped({
1673
2348
  file: 'locus-info',
1674
2349
  function: 'updateMeetingInfo'
@@ -1692,7 +2367,7 @@ var LocusInfo = exports.default = /*#__PURE__*/function (_EventsScope) {
1692
2367
  return;
1693
2368
  }
1694
2369
  var parsedEmbeddedApps = _embeddedAppsUtils.default.parse(embeddedApps);
1695
- this.updateMeeting({
2370
+ this.callbacks.updateMeeting({
1696
2371
  embeddedApps: parsedEmbeddedApps
1697
2372
  });
1698
2373
  this.emitScoped({
@@ -1716,7 +2391,7 @@ var LocusInfo = exports.default = /*#__PURE__*/function (_EventsScope) {
1716
2391
  var forceUpdate = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
1717
2392
  if (mediaShares && (!(0, _lodash.isEqual)(this.mediaShares, mediaShares) || forceUpdate)) {
1718
2393
  var parsedMediaShares = _mediaSharesUtils.default.getMediaShares(this.mediaShares, mediaShares);
1719
- this.updateMeeting(parsedMediaShares.current);
2394
+ this.callbacks.updateMeeting(parsedMediaShares.current);
1720
2395
  this.parsedLocus.mediaShares = parsedMediaShares.current;
1721
2396
  this.mediaShares = mediaShares;
1722
2397
  this.emitScoped({
@@ -1758,7 +2433,7 @@ var LocusInfo = exports.default = /*#__PURE__*/function (_EventsScope) {
1758
2433
  // @ts-ignore
1759
2434
  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
1760
2435
  );
1761
- this.updateMeeting(parsedSelves.current);
2436
+ this.callbacks.updateMeeting(parsedSelves.current);
1762
2437
  this.parsedLocus.self = parsedSelves.current;
1763
2438
  var element = this.parsedLocus.states[this.parsedLocus.states.length - 1];
1764
2439
  if (element !== parsedSelves.current.state) {
@@ -1769,7 +2444,7 @@ var LocusInfo = exports.default = /*#__PURE__*/function (_EventsScope) {
1769
2444
  // this.emit(LOCUSINFO.EVENTS.MEETING_UPDATE, SelfUtils.getSipUrl(this.getLocusPartner(participants, self), this.parsedLocus.fullState?.type, this.parsedLocus.info?.sipUri));
1770
2445
  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);
1771
2446
  if (result !== null && result !== void 0 && result.sipUri) {
1772
- this.updateMeeting(result);
2447
+ this.callbacks.updateMeeting(result);
1773
2448
  }
1774
2449
  if (parsedSelves.updates.moderatorChanged) {
1775
2450
  this.compareAndUpdateFlags.compareHostAndSelf = true;
@@ -1800,6 +2475,14 @@ var LocusInfo = exports.default = /*#__PURE__*/function (_EventsScope) {
1800
2475
  brb: parsedSelves.current.brb
1801
2476
  });
1802
2477
  }
2478
+ if (parsedSelves.updates.selfIdChanged) {
2479
+ this.emitScoped({
2480
+ file: 'locus-info',
2481
+ function: 'updateSelf'
2482
+ }, _constants.LOCUSINFO.EVENTS.SELF_ID_CHANGED, {
2483
+ selfId: parsedSelves.current.selfId
2484
+ });
2485
+ }
1803
2486
  if (parsedSelves.updates.interpretationChanged) {
1804
2487
  this.emitScoped({
1805
2488
  file: 'locus-info',
@@ -1843,21 +2526,25 @@ var LocusInfo = exports.default = /*#__PURE__*/function (_EventsScope) {
1843
2526
  });
1844
2527
  }
1845
2528
  if (parsedSelves.updates.localAudioUnmuteRequiredByServer) {
2529
+ var _parsedSelves$current2;
1846
2530
  this.emitScoped({
1847
2531
  file: 'locus-info',
1848
2532
  function: 'updateSelf'
1849
2533
  }, _constants.LOCUSINFO.EVENTS.LOCAL_UNMUTE_REQUIRED, {
1850
2534
  muted: parsedSelves.current.remoteMuted,
1851
- unmuteAllowed: parsedSelves.current.unmuteAllowed
2535
+ unmuteAllowed: parsedSelves.current.unmuteAllowed,
2536
+ modifiedBy: (_parsedSelves$current2 = parsedSelves.current.modifiedBy) !== null && _parsedSelves$current2 !== void 0 ? _parsedSelves$current2 : null
1852
2537
  });
1853
2538
  }
1854
2539
  if (parsedSelves.updates.isMutedByOthersChanged) {
2540
+ var _parsedSelves$current3;
1855
2541
  this.emitScoped({
1856
2542
  file: 'locus-info',
1857
2543
  function: 'updateSelf'
1858
2544
  }, _constants.LOCUSINFO.EVENTS.SELF_REMOTE_MUTE_STATUS_UPDATED, {
1859
2545
  muted: parsedSelves.current.remoteMuted,
1860
- unmuteAllowed: parsedSelves.current.unmuteAllowed
2546
+ unmuteAllowed: parsedSelves.current.unmuteAllowed,
2547
+ modifiedBy: (_parsedSelves$current3 = parsedSelves.current.modifiedBy) !== null && _parsedSelves$current3 !== void 0 ? _parsedSelves$current3 : null
1861
2548
  });
1862
2549
  }
1863
2550
  if (parsedSelves.updates.localAudioUnmuteRequestedByServer) {
@@ -1887,14 +2574,14 @@ var LocusInfo = exports.default = /*#__PURE__*/function (_EventsScope) {
1887
2574
  _constants.LOCUSINFO.EVENTS.MEDIA_INACTIVITY, _selfUtils.default.getMediaStatus(self.mediaSessions));
1888
2575
  }
1889
2576
  if (parsedSelves.updates.audioStateChange || parsedSelves.updates.videoStateChange || parsedSelves.updates.shareStateChange) {
1890
- var _parsedSelves$current2, _parsedSelves$current3, _parsedSelves$current4;
2577
+ var _parsedSelves$current4, _parsedSelves$current5, _parsedSelves$current6;
1891
2578
  this.emitScoped({
1892
2579
  file: 'locus-info',
1893
2580
  function: 'updateSelf'
1894
2581
  }, _constants.LOCUSINFO.EVENTS.MEDIA_STATUS_CHANGE, {
1895
- audioStatus: (_parsedSelves$current2 = parsedSelves.current.currentMediaStatus) === null || _parsedSelves$current2 === void 0 ? void 0 : _parsedSelves$current2.audio,
1896
- videoStatus: (_parsedSelves$current3 = parsedSelves.current.currentMediaStatus) === null || _parsedSelves$current3 === void 0 ? void 0 : _parsedSelves$current3.video,
1897
- shareStatus: (_parsedSelves$current4 = parsedSelves.current.currentMediaStatus) === null || _parsedSelves$current4 === void 0 ? void 0 : _parsedSelves$current4.share
2582
+ audioStatus: (_parsedSelves$current4 = parsedSelves.current.currentMediaStatus) === null || _parsedSelves$current4 === void 0 ? void 0 : _parsedSelves$current4.audio,
2583
+ videoStatus: (_parsedSelves$current5 = parsedSelves.current.currentMediaStatus) === null || _parsedSelves$current5 === void 0 ? void 0 : _parsedSelves$current5.video,
2584
+ shareStatus: (_parsedSelves$current6 = parsedSelves.current.currentMediaStatus) === null || _parsedSelves$current6 === void 0 ? void 0 : _parsedSelves$current6.share
1898
2585
  });
1899
2586
  }
1900
2587
  if (parsedSelves.updates.isUserObserving) {
@@ -1947,7 +2634,7 @@ var LocusInfo = exports.default = /*#__PURE__*/function (_EventsScope) {
1947
2634
  var isMainLocus = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;
1948
2635
  if (url && this.url !== url) {
1949
2636
  this.url = url;
1950
- this.updateMeeting({
2637
+ this.callbacks.updateMeeting({
1951
2638
  locusUrl: url
1952
2639
  });
1953
2640
  this.emitScoped({
@@ -2076,7 +2763,7 @@ var LocusInfo = exports.default = /*#__PURE__*/function (_EventsScope) {
2076
2763
  }, {
2077
2764
  key: "updateMainSessionLocusCache",
2078
2765
  value: function updateMainSessionLocusCache(mainLocus) {
2079
- var _this7 = this;
2766
+ var _this9 = this;
2080
2767
  if (!mainLocus) {
2081
2768
  return;
2082
2769
  }
@@ -2085,7 +2772,7 @@ var LocusInfo = exports.default = /*#__PURE__*/function (_EventsScope) {
2085
2772
  // shallow merge and do special merge for participants
2086
2773
  (0, _lodash.assignWith)(this.mainSessionLocusCache, locusClone, function (objValue, srcValue, key) {
2087
2774
  if (key === 'participants') {
2088
- return _this7.mergeParticipants(objValue, srcValue);
2775
+ return _this9.mergeParticipants(objValue, srcValue);
2089
2776
  }
2090
2777
  return srcValue || objValue;
2091
2778
  });
@@ -2104,6 +2791,21 @@ var LocusInfo = exports.default = /*#__PURE__*/function (_EventsScope) {
2104
2791
  value: function clearMainSessionLocusCache() {
2105
2792
  this.mainSessionLocusCache = null;
2106
2793
  }
2794
+
2795
+ /**
2796
+ * Cleans up all hash tree parsers and clears internal maps.
2797
+ * @returns {void}
2798
+ * @memberof LocusInfo
2799
+ */
2800
+ }, {
2801
+ key: "cleanUp",
2802
+ value: function cleanUp() {
2803
+ this.hashTreeParsers.forEach(function (entry) {
2804
+ entry.parser.cleanUp();
2805
+ });
2806
+ this.hashTreeParsers.clear();
2807
+ this.hashTreeObjectId2ParticipantId.clear();
2808
+ }
2107
2809
  }]);
2108
2810
  }(_eventsScope.default);
2109
2811
  //# sourceMappingURL=index.js.map