@webex/plugin-meetings 3.10.0-next.3 → 3.10.0-next.30

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 (274) hide show
  1. package/dist/annotation/annotation.types.js.map +1 -1
  2. package/dist/annotation/constants.js.map +1 -1
  3. package/dist/annotation/index.js +19 -22
  4. package/dist/annotation/index.js.map +1 -1
  5. package/dist/breakouts/breakout.js +6 -6
  6. package/dist/breakouts/breakout.js.map +1 -1
  7. package/dist/breakouts/collection.js.map +1 -1
  8. package/dist/breakouts/edit-lock-error.js +9 -11
  9. package/dist/breakouts/edit-lock-error.js.map +1 -1
  10. package/dist/breakouts/events.js.map +1 -1
  11. package/dist/breakouts/index.js +126 -127
  12. package/dist/breakouts/index.js.map +1 -1
  13. package/dist/breakouts/request.js +6 -8
  14. package/dist/breakouts/request.js.map +1 -1
  15. package/dist/breakouts/utils.js.map +1 -1
  16. package/dist/common/browser-detection.js.map +1 -1
  17. package/dist/common/collection.js +1 -2
  18. package/dist/common/collection.js.map +1 -1
  19. package/dist/common/config.js.map +1 -1
  20. package/dist/common/errors/captcha-error.js +9 -11
  21. package/dist/common/errors/captcha-error.js.map +1 -1
  22. package/dist/common/errors/intent-to-join.js +10 -12
  23. package/dist/common/errors/intent-to-join.js.map +1 -1
  24. package/dist/common/errors/join-forbidden-error.js +10 -12
  25. package/dist/common/errors/join-forbidden-error.js.map +1 -1
  26. package/dist/common/errors/join-meeting.js +10 -12
  27. package/dist/common/errors/join-meeting.js.map +1 -1
  28. package/dist/common/errors/join-webinar-error.js +9 -11
  29. package/dist/common/errors/join-webinar-error.js.map +1 -1
  30. package/dist/common/errors/media.js +9 -11
  31. package/dist/common/errors/media.js.map +1 -1
  32. package/dist/common/errors/multistream-not-supported-error.js +9 -11
  33. package/dist/common/errors/multistream-not-supported-error.js.map +1 -1
  34. package/dist/common/errors/no-meeting-info.js +9 -11
  35. package/dist/common/errors/no-meeting-info.js.map +1 -1
  36. package/dist/common/errors/parameter.js +11 -14
  37. package/dist/common/errors/parameter.js.map +1 -1
  38. package/dist/common/errors/password-error.js +9 -11
  39. package/dist/common/errors/password-error.js.map +1 -1
  40. package/dist/common/errors/permission.js +9 -11
  41. package/dist/common/errors/permission.js.map +1 -1
  42. package/dist/common/errors/reclaim-host-role-errors.js +32 -38
  43. package/dist/common/errors/reclaim-host-role-errors.js.map +1 -1
  44. package/dist/common/errors/reconnection-not-started.js +5 -6
  45. package/dist/common/errors/reconnection-not-started.js.map +1 -1
  46. package/dist/common/errors/reconnection.js +9 -11
  47. package/dist/common/errors/reconnection.js.map +1 -1
  48. package/dist/common/errors/stats.js +9 -11
  49. package/dist/common/errors/stats.js.map +1 -1
  50. package/dist/common/errors/webex-errors.js +20 -29
  51. package/dist/common/errors/webex-errors.js.map +1 -1
  52. package/dist/common/errors/webex-meetings-error.js +9 -12
  53. package/dist/common/errors/webex-meetings-error.js.map +1 -1
  54. package/dist/common/events/events-scope.js +9 -10
  55. package/dist/common/events/events-scope.js.map +1 -1
  56. package/dist/common/events/events.js +9 -10
  57. package/dist/common/events/events.js.map +1 -1
  58. package/dist/common/events/trigger-proxy.js.map +1 -1
  59. package/dist/common/events/util.js.map +1 -1
  60. package/dist/common/logs/logger-config.js.map +1 -1
  61. package/dist/common/logs/logger-proxy.js.map +1 -1
  62. package/dist/common/logs/request.js +17 -17
  63. package/dist/common/logs/request.js.map +1 -1
  64. package/dist/common/queue.js +1 -2
  65. package/dist/common/queue.js.map +1 -1
  66. package/dist/config.js +2 -2
  67. package/dist/config.js.map +1 -1
  68. package/dist/constants.js +11 -8
  69. package/dist/constants.js.map +1 -1
  70. package/dist/controls-options-manager/constants.js.map +1 -1
  71. package/dist/controls-options-manager/enums.js.map +1 -1
  72. package/dist/controls-options-manager/index.js +1 -2
  73. package/dist/controls-options-manager/index.js.map +1 -1
  74. package/dist/controls-options-manager/types.js.map +1 -1
  75. package/dist/controls-options-manager/util.js +1 -2
  76. package/dist/controls-options-manager/util.js.map +1 -1
  77. package/dist/hashTree/constants.js +20 -0
  78. package/dist/hashTree/constants.js.map +1 -0
  79. package/dist/hashTree/hashTree.js +515 -0
  80. package/dist/hashTree/hashTree.js.map +1 -0
  81. package/dist/hashTree/hashTreeParser.js +1250 -0
  82. package/dist/hashTree/hashTreeParser.js.map +1 -0
  83. package/dist/hashTree/types.js +23 -0
  84. package/dist/hashTree/types.js.map +1 -0
  85. package/dist/hashTree/utils.js +59 -0
  86. package/dist/hashTree/utils.js.map +1 -0
  87. package/dist/index.js +1 -2
  88. package/dist/index.js.map +1 -1
  89. package/dist/interceptors/index.js.map +1 -1
  90. package/dist/interceptors/locusRetry.js +6 -8
  91. package/dist/interceptors/locusRetry.js.map +1 -1
  92. package/dist/interceptors/locusRouteToken.js +26 -12
  93. package/dist/interceptors/locusRouteToken.js.map +1 -1
  94. package/dist/interpretation/collection.js.map +1 -1
  95. package/dist/interpretation/index.js +1 -2
  96. package/dist/interpretation/index.js.map +1 -1
  97. package/dist/interpretation/siLanguage.js +1 -1
  98. package/dist/interpretation/siLanguage.js.map +1 -1
  99. package/dist/locus-info/controlsUtils.js.map +1 -1
  100. package/dist/locus-info/embeddedAppsUtils.js.map +1 -1
  101. package/dist/locus-info/fullState.js.map +1 -1
  102. package/dist/locus-info/hostUtils.js.map +1 -1
  103. package/dist/locus-info/index.js +609 -177
  104. package/dist/locus-info/index.js.map +1 -1
  105. package/dist/locus-info/infoUtils.js.map +1 -1
  106. package/dist/locus-info/mediaSharesUtils.js.map +1 -1
  107. package/dist/locus-info/parser.js +3 -4
  108. package/dist/locus-info/parser.js.map +1 -1
  109. package/dist/locus-info/selfUtils.js.map +1 -1
  110. package/dist/locus-info/types.js +7 -0
  111. package/dist/locus-info/types.js.map +1 -0
  112. package/dist/media/MediaConnectionAwaiter.js +1 -2
  113. package/dist/media/MediaConnectionAwaiter.js.map +1 -1
  114. package/dist/media/index.js +0 -2
  115. package/dist/media/index.js.map +1 -1
  116. package/dist/media/properties.js +15 -17
  117. package/dist/media/properties.js.map +1 -1
  118. package/dist/media/util.js.map +1 -1
  119. package/dist/meeting/brbState.js +8 -9
  120. package/dist/meeting/brbState.js.map +1 -1
  121. package/dist/meeting/connectionStateHandler.js +10 -13
  122. package/dist/meeting/connectionStateHandler.js.map +1 -1
  123. package/dist/meeting/in-meeting-actions.js.map +1 -1
  124. package/dist/meeting/index.js +1576 -1533
  125. package/dist/meeting/index.js.map +1 -1
  126. package/dist/meeting/locusMediaRequest.js +13 -17
  127. package/dist/meeting/locusMediaRequest.js.map +1 -1
  128. package/dist/meeting/muteState.js +11 -12
  129. package/dist/meeting/muteState.js.map +1 -1
  130. package/dist/meeting/request.js +101 -104
  131. package/dist/meeting/request.js.map +1 -1
  132. package/dist/meeting/request.type.js.map +1 -1
  133. package/dist/meeting/state.js.map +1 -1
  134. package/dist/meeting/type.js.map +1 -1
  135. package/dist/meeting/util.js +24 -23
  136. package/dist/meeting/util.js.map +1 -1
  137. package/dist/meeting/voicea-meeting.js +3 -3
  138. package/dist/meeting/voicea-meeting.js.map +1 -1
  139. package/dist/meeting-info/collection.js +7 -10
  140. package/dist/meeting-info/collection.js.map +1 -1
  141. package/dist/meeting-info/index.js +1 -2
  142. package/dist/meeting-info/index.js.map +1 -1
  143. package/dist/meeting-info/meeting-info-v2.js +135 -146
  144. package/dist/meeting-info/meeting-info-v2.js.map +1 -1
  145. package/dist/meeting-info/request.js +1 -2
  146. package/dist/meeting-info/request.js.map +1 -1
  147. package/dist/meeting-info/util.js +36 -37
  148. package/dist/meeting-info/util.js.map +1 -1
  149. package/dist/meeting-info/utilv2.js +30 -31
  150. package/dist/meeting-info/utilv2.js.map +1 -1
  151. package/dist/meetings/collection.js +6 -8
  152. package/dist/meetings/collection.js.map +1 -1
  153. package/dist/meetings/index.js +200 -148
  154. package/dist/meetings/index.js.map +1 -1
  155. package/dist/meetings/meetings.types.js.map +1 -1
  156. package/dist/meetings/request.js +6 -8
  157. package/dist/meetings/request.js.map +1 -1
  158. package/dist/meetings/util.js +36 -30
  159. package/dist/meetings/util.js.map +1 -1
  160. package/dist/member/index.js +1 -2
  161. package/dist/member/index.js.map +1 -1
  162. package/dist/member/types.js +6 -3
  163. package/dist/member/types.js.map +1 -1
  164. package/dist/member/util.js.map +1 -1
  165. package/dist/members/collection.js +1 -2
  166. package/dist/members/collection.js.map +1 -1
  167. package/dist/members/index.js +18 -21
  168. package/dist/members/index.js.map +1 -1
  169. package/dist/members/request.js +8 -11
  170. package/dist/members/request.js.map +1 -1
  171. package/dist/members/types.js.map +1 -1
  172. package/dist/members/util.js.map +1 -1
  173. package/dist/metrics/constants.js +3 -1
  174. package/dist/metrics/constants.js.map +1 -1
  175. package/dist/metrics/index.js +3 -4
  176. package/dist/metrics/index.js.map +1 -1
  177. package/dist/multistream/mediaRequestManager.js +1 -2
  178. package/dist/multistream/mediaRequestManager.js.map +1 -1
  179. package/dist/multistream/receiveSlot.js +34 -45
  180. package/dist/multistream/receiveSlot.js.map +1 -1
  181. package/dist/multistream/receiveSlotManager.js +8 -9
  182. package/dist/multistream/receiveSlotManager.js.map +1 -1
  183. package/dist/multistream/remoteMedia.js +12 -15
  184. package/dist/multistream/remoteMedia.js.map +1 -1
  185. package/dist/multistream/remoteMediaGroup.js +1 -2
  186. package/dist/multistream/remoteMediaGroup.js.map +1 -1
  187. package/dist/multistream/remoteMediaManager.js +122 -123
  188. package/dist/multistream/remoteMediaManager.js.map +1 -1
  189. package/dist/multistream/sendSlotManager.js +29 -30
  190. package/dist/multistream/sendSlotManager.js.map +1 -1
  191. package/dist/personal-meeting-room/index.js +16 -19
  192. package/dist/personal-meeting-room/index.js.map +1 -1
  193. package/dist/personal-meeting-room/request.js +7 -10
  194. package/dist/personal-meeting-room/request.js.map +1 -1
  195. package/dist/personal-meeting-room/util.js.map +1 -1
  196. package/dist/reachability/clusterReachability.js +188 -352
  197. package/dist/reachability/clusterReachability.js.map +1 -1
  198. package/dist/reachability/index.js +206 -206
  199. package/dist/reachability/index.js.map +1 -1
  200. package/dist/reachability/reachability.types.js +14 -1
  201. package/dist/reachability/reachability.types.js.map +1 -1
  202. package/dist/reachability/reachabilityPeerConnection.js +445 -0
  203. package/dist/reachability/reachabilityPeerConnection.js.map +1 -0
  204. package/dist/reachability/request.js.map +1 -1
  205. package/dist/reachability/util.js.map +1 -1
  206. package/dist/reactions/constants.js.map +1 -1
  207. package/dist/reactions/reactions.js.map +1 -1
  208. package/dist/reactions/reactions.type.js.map +1 -1
  209. package/dist/reconnection-manager/index.js +178 -176
  210. package/dist/reconnection-manager/index.js.map +1 -1
  211. package/dist/recording-controller/enums.js.map +1 -1
  212. package/dist/recording-controller/index.js +1 -2
  213. package/dist/recording-controller/index.js.map +1 -1
  214. package/dist/recording-controller/util.js.map +1 -1
  215. package/dist/roap/index.js +12 -15
  216. package/dist/roap/index.js.map +1 -1
  217. package/dist/roap/request.js +24 -26
  218. package/dist/roap/request.js.map +1 -1
  219. package/dist/roap/turnDiscovery.js +75 -76
  220. package/dist/roap/turnDiscovery.js.map +1 -1
  221. package/dist/roap/types.js.map +1 -1
  222. package/dist/transcription/index.js +4 -5
  223. package/dist/transcription/index.js.map +1 -1
  224. package/dist/types/config.d.ts +1 -0
  225. package/dist/types/constants.d.ts +26 -21
  226. package/dist/types/hashTree/constants.d.ts +8 -0
  227. package/dist/types/hashTree/hashTree.d.ts +129 -0
  228. package/dist/types/hashTree/hashTreeParser.d.ts +250 -0
  229. package/dist/types/hashTree/types.d.ts +33 -0
  230. package/dist/types/hashTree/utils.d.ts +16 -0
  231. package/dist/types/interceptors/locusRouteToken.d.ts +1 -0
  232. package/dist/types/locus-info/index.d.ts +98 -80
  233. package/dist/types/locus-info/types.d.ts +54 -0
  234. package/dist/types/meeting/index.d.ts +22 -9
  235. package/dist/types/meetings/index.d.ts +9 -2
  236. package/dist/types/metrics/constants.d.ts +2 -0
  237. package/dist/types/reachability/clusterReachability.d.ts +33 -84
  238. package/dist/types/reachability/reachability.types.d.ts +12 -1
  239. package/dist/types/reachability/reachabilityPeerConnection.d.ts +111 -0
  240. package/dist/webinar/collection.js +1 -2
  241. package/dist/webinar/collection.js.map +1 -1
  242. package/dist/webinar/index.js +148 -158
  243. package/dist/webinar/index.js.map +1 -1
  244. package/package.json +23 -22
  245. package/src/config.ts +1 -0
  246. package/src/constants.ts +13 -1
  247. package/src/hashTree/constants.ts +9 -0
  248. package/src/hashTree/hashTree.ts +463 -0
  249. package/src/hashTree/hashTreeParser.ts +1143 -0
  250. package/src/hashTree/types.ts +39 -0
  251. package/src/hashTree/utils.ts +53 -0
  252. package/src/interceptors/locusRouteToken.ts +16 -4
  253. package/src/locus-info/index.ts +625 -164
  254. package/src/locus-info/types.ts +53 -0
  255. package/src/meeting/index.ts +78 -27
  256. package/src/meeting/util.ts +1 -0
  257. package/src/meetings/index.ts +119 -59
  258. package/src/meetings/util.ts +10 -9
  259. package/src/metrics/constants.ts +2 -0
  260. package/src/reachability/clusterReachability.ts +159 -330
  261. package/src/reachability/index.ts +6 -1
  262. package/src/reachability/reachability.types.ts +15 -1
  263. package/src/reachability/reachabilityPeerConnection.ts +418 -0
  264. package/test/unit/spec/hashTree/hashTree.ts +655 -0
  265. package/test/unit/spec/hashTree/hashTreeParser.ts +1524 -0
  266. package/test/unit/spec/hashTree/utils.ts +140 -0
  267. package/test/unit/spec/interceptors/locusRouteToken.ts +27 -0
  268. package/test/unit/spec/locus-info/index.js +851 -16
  269. package/test/unit/spec/meeting/index.js +120 -20
  270. package/test/unit/spec/meeting/utils.js +77 -0
  271. package/test/unit/spec/meetings/index.js +263 -27
  272. package/test/unit/spec/meetings/utils.js +51 -1
  273. package/test/unit/spec/reachability/clusterReachability.ts +404 -137
  274. package/test/unit/spec/reachability/index.ts +3 -3
@@ -1,23 +1,36 @@
1
1
  "use strict";
2
2
 
3
+ var _typeof = require("@babel/runtime-corejs2/helpers/typeof");
3
4
  var _Reflect$construct = require("@babel/runtime-corejs2/core-js/reflect/construct");
5
+ var _Object$keys2 = require("@babel/runtime-corejs2/core-js/object/keys");
6
+ var _Object$getOwnPropertySymbols = require("@babel/runtime-corejs2/core-js/object/get-own-property-symbols");
7
+ var _Object$getOwnPropertyDescriptor = require("@babel/runtime-corejs2/core-js/object/get-own-property-descriptor");
8
+ var _Object$getOwnPropertyDescriptors = require("@babel/runtime-corejs2/core-js/object/get-own-property-descriptors");
9
+ var _Object$defineProperties = require("@babel/runtime-corejs2/core-js/object/define-properties");
10
+ var _Object$defineProperty = require("@babel/runtime-corejs2/core-js/object/define-property");
4
11
  var _Array$from = require("@babel/runtime-corejs2/core-js/array/from");
5
12
  var _Symbol = require("@babel/runtime-corejs2/core-js/symbol");
6
13
  var _Symbol$iterator = require("@babel/runtime-corejs2/core-js/symbol/iterator");
7
14
  var _Array$isArray2 = require("@babel/runtime-corejs2/core-js/array/is-array");
8
- var _Object$defineProperty = require("@babel/runtime-corejs2/core-js/object/define-property");
15
+ var _WeakMap = require("@babel/runtime-corejs2/core-js/weak-map");
9
16
  var _interopRequireDefault = require("@babel/runtime-corejs2/helpers/interopRequireDefault");
10
17
  _Object$defineProperty(exports, "__esModule", {
11
18
  value: true
12
19
  });
13
20
  exports.default = void 0;
21
+ 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"));
14
27
  var _isArray = _interopRequireDefault(require("@babel/runtime-corejs2/core-js/array/is-array"));
28
+ var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime-corejs2/helpers/asyncToGenerator"));
15
29
  var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime-corejs2/helpers/classCallCheck"));
16
30
  var _createClass2 = _interopRequireDefault(require("@babel/runtime-corejs2/helpers/createClass"));
17
- var _assertThisInitialized2 = _interopRequireDefault(require("@babel/runtime-corejs2/helpers/assertThisInitialized"));
18
- var _inherits2 = _interopRequireDefault(require("@babel/runtime-corejs2/helpers/inherits"));
19
31
  var _possibleConstructorReturn2 = _interopRequireDefault(require("@babel/runtime-corejs2/helpers/possibleConstructorReturn"));
20
32
  var _getPrototypeOf2 = _interopRequireDefault(require("@babel/runtime-corejs2/helpers/getPrototypeOf"));
33
+ var _inherits2 = _interopRequireDefault(require("@babel/runtime-corejs2/helpers/inherits"));
21
34
  var _defineProperty2 = _interopRequireDefault(require("@babel/runtime-corejs2/helpers/defineProperty"));
22
35
  var _lodash = require("lodash");
23
36
  var _loggerProxy = _interopRequireDefault(require("../common/logs/logger-proxy"));
@@ -33,11 +46,26 @@ var _mediaSharesUtils = _interopRequireDefault(require("./mediaSharesUtils"));
33
46
  var _parser = _interopRequireDefault(require("./parser"));
34
47
  var _metrics = _interopRequireDefault(require("../metrics"));
35
48
  var _constants2 = _interopRequireDefault(require("../metrics/constants"));
36
- function _createForOfIteratorHelper(o, allowArrayLike) { var it = typeof _Symbol !== "undefined" && o[_Symbol$iterator] || o["@@iterator"]; if (!it) { if (_Array$isArray2(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, 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 normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it.return != null) it.return(); } finally { if (didErr) throw err; } } }; }
37
- function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return _Array$from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
38
- function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
39
- function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = (0, _getPrototypeOf2.default)(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = (0, _getPrototypeOf2.default)(this).constructor; result = _Reflect$construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return (0, _possibleConstructorReturn2.default)(this, result); }; }
40
- function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !_Reflect$construct) return false; if (_Reflect$construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(_Reflect$construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
49
+ var _hashTreeParser = _interopRequireWildcard(require("../hashTree/hashTreeParser"));
50
+ var _types = require("../hashTree/types");
51
+ 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); }
53
+ 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
+ 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
+ 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
+ // list of top level keys in Locus DTO relevant for Hash Tree DTOs processing
61
+ // 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
63
+ ];
64
+ var LocusObjectStateAfterUpdates = {
65
+ unchanged: 'unchanged',
66
+ removed: 'removed',
67
+ updated: 'updated'
68
+ };
41
69
  /**
42
70
  * @description LocusInfo extends ChildEmitter to convert locusInfo info a private emitter to parent object
43
71
  * @export
@@ -45,8 +73,6 @@ function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !_R
45
73
  * @class LocusInfo
46
74
  */
47
75
  var LocusInfo = exports.default = /*#__PURE__*/function (_EventsScope) {
48
- (0, _inherits2.default)(LocusInfo, _EventsScope);
49
- var _super = _createSuper(LocusInfo);
50
76
  /**
51
77
  * Constructor
52
78
  * @param {function} updateMeeting callback to update the meeting object from an object
@@ -57,38 +83,37 @@ var LocusInfo = exports.default = /*#__PURE__*/function (_EventsScope) {
57
83
  function LocusInfo(updateMeeting, webex, meetingId) {
58
84
  var _this;
59
85
  (0, _classCallCheck2.default)(this, LocusInfo);
60
- _this = _super.call(this);
61
- (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "compareAndUpdateFlags", void 0);
62
- (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "emitChange", void 0);
63
- (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "locusParser", void 0);
64
- (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "meetingId", void 0);
65
- (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "parsedLocus", void 0);
66
- (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "updateMeeting", void 0);
67
- (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "webex", void 0);
68
- (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "aclUrl", void 0);
69
- (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "baseSequence", void 0);
70
- (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "created", void 0);
71
- (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "identities", void 0);
72
- (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "membership", void 0);
73
- (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "participants", void 0);
74
- (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "participantsUrl", void 0);
75
- (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "replaces", void 0);
76
- (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "scheduledMeeting", void 0);
77
- (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "sequence", void 0);
78
- (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "controls", void 0);
79
- (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "conversationUrl", void 0);
80
- (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "embeddedApps", void 0);
81
- (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "fullState", void 0);
82
- (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "host", void 0);
83
- (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "info", void 0);
84
- (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "roles", void 0);
85
- (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "mediaShares", void 0);
86
- (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "replace", void 0);
87
- (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "url", void 0);
88
- (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "services", void 0);
89
- (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "resources", void 0);
90
- (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "mainSessionLocusCache", void 0);
91
- (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "self", void 0);
86
+ _this = _callSuper(this, LocusInfo);
87
+ (0, _defineProperty2.default)(_this, "compareAndUpdateFlags", void 0);
88
+ (0, _defineProperty2.default)(_this, "emitChange", void 0);
89
+ (0, _defineProperty2.default)(_this, "locusParser", void 0);
90
+ (0, _defineProperty2.default)(_this, "meetingId", void 0);
91
+ (0, _defineProperty2.default)(_this, "parsedLocus", void 0);
92
+ (0, _defineProperty2.default)(_this, "updateMeeting", void 0);
93
+ (0, _defineProperty2.default)(_this, "webex", void 0);
94
+ (0, _defineProperty2.default)(_this, "aclUrl", void 0);
95
+ (0, _defineProperty2.default)(_this, "baseSequence", void 0);
96
+ (0, _defineProperty2.default)(_this, "created", void 0);
97
+ (0, _defineProperty2.default)(_this, "participants", void 0);
98
+ (0, _defineProperty2.default)(_this, "replaces", void 0);
99
+ (0, _defineProperty2.default)(_this, "scheduledMeeting", void 0);
100
+ (0, _defineProperty2.default)(_this, "sequence", void 0);
101
+ (0, _defineProperty2.default)(_this, "controls", void 0);
102
+ (0, _defineProperty2.default)(_this, "conversationUrl", void 0);
103
+ (0, _defineProperty2.default)(_this, "embeddedApps", void 0);
104
+ (0, _defineProperty2.default)(_this, "fullState", void 0);
105
+ (0, _defineProperty2.default)(_this, "host", void 0);
106
+ (0, _defineProperty2.default)(_this, "info", void 0);
107
+ (0, _defineProperty2.default)(_this, "roles", void 0);
108
+ (0, _defineProperty2.default)(_this, "mediaShares", void 0);
109
+ (0, _defineProperty2.default)(_this, "url", void 0);
110
+ (0, _defineProperty2.default)(_this, "links", void 0);
111
+ (0, _defineProperty2.default)(_this, "mainSessionLocusCache", void 0);
112
+ (0, _defineProperty2.default)(_this, "self", void 0);
113
+ (0, _defineProperty2.default)(_this, "hashTreeParser", void 0);
114
+ (0, _defineProperty2.default)(_this, "hashTreeObjectId2ParticipantId", void 0);
115
+ // mapping of hash tree object ids to participant ids
116
+ (0, _defineProperty2.default)(_this, "classicVsHashTreeMismatchMetricCounter", 0);
92
117
  _this.parsedLocus = {
93
118
  states: []
94
119
  };
@@ -98,18 +123,21 @@ var LocusInfo = exports.default = /*#__PURE__*/function (_EventsScope) {
98
123
  _this.meetingId = meetingId;
99
124
  _this.updateMeeting = updateMeeting;
100
125
  _this.locusParser = new _parser.default();
126
+ _this.hashTreeObjectId2ParticipantId = new _map.default();
101
127
  return _this;
102
128
  }
103
129
 
104
130
  /**
105
131
  * Does a Locus sync. It tries to get the latest delta DTO or if it can't, it falls back to getting the full Locus DTO.
132
+ * WARNING: This function must not be used for hash tree based Locus meetings.
106
133
  *
107
134
  * @param {Meeting} meeting
108
135
  * @param {boolean} isLocusUrlChanged
109
136
  * @param {Locus} locus
110
137
  * @returns {undefined}
111
138
  */
112
- (0, _createClass2.default)(LocusInfo, [{
139
+ (0, _inherits2.default)(LocusInfo, _EventsScope);
140
+ return (0, _createClass2.default)(LocusInfo, [{
113
141
  key: "doLocusSync",
114
142
  value: function doLocusSync(meeting, isLocusUrlChanged, locus) {
115
143
  var _this$locusParser$wor,
@@ -268,17 +296,13 @@ var LocusInfo = exports.default = /*#__PURE__*/function (_EventsScope) {
268
296
  }, {
269
297
  key: "init",
270
298
  value: function init() {
271
- var _locus$links, _locus$links2;
272
299
  var locus = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
273
300
  this.created = locus.created || null;
274
301
  this.scheduledMeeting = locus.meeting || null;
275
- this.participantsUrl = locus.participantsUrl || null;
276
302
  this.replaces = locus.replaces || null;
277
303
  this.aclUrl = locus.aclUrl || null;
278
304
  this.baseSequence = locus.baseSequence || null;
279
305
  this.sequence = locus.sequence || null;
280
- this.membership = locus.membership || null;
281
- this.identities = locus.identities || null;
282
306
  this.participants = locus.participants || null;
283
307
 
284
308
  /**
@@ -304,35 +328,413 @@ var LocusInfo = exports.default = /*#__PURE__*/function (_EventsScope) {
304
328
  this.updateSelf(locus.self);
305
329
  this.updateHostInfo(locus.host);
306
330
  this.updateMediaShares(locus.mediaShares);
307
- this.updateServices((_locus$links = locus.links) === null || _locus$links === void 0 ? void 0 : _locus$links.services);
308
- this.updateResources((_locus$links2 = locus.links) === null || _locus$links2 === void 0 ? void 0 : _locus$links2.resources);
331
+ this.updateLinks(locus.links);
309
332
  }
310
333
 
311
334
  /**
312
- * @param {Object} locus
335
+ * Creates the HashTreeParser instance.
336
+ * @param {Object} initial locus data
337
+ * @returns {void}
338
+ */
339
+ }, {
340
+ key: "createHashTreeParser",
341
+ value: function createHashTreeParser(_ref) {
342
+ var initialLocus = _ref.initialLocus;
343
+ return new _hashTreeParser.default({
344
+ initialLocus: initialLocus,
345
+ webexRequest: this.webex.request.bind(this.webex),
346
+ locusInfoUpdateCallback: this.updateFromHashTree.bind(this),
347
+ debugId: "HT-".concat(this.meetingId.substring(0, 4))
348
+ });
349
+ }
350
+
351
+ /**
352
+ * @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
313
353
  * @returns {undefined}
314
354
  * @memberof LocusInfo
315
355
  */
316
356
  }, {
317
357
  key: "initialSetup",
318
- value: function initialSetup(locus) {
319
- this.updateLocusCache(locus);
320
- this.onFullLocus(locus);
358
+ value: (function () {
359
+ var _initialSetup = (0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee(data) {
360
+ 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;
362
+ return _regenerator.default.wrap(function (_context) {
363
+ while (1) switch (_context.prev = _context.next) {
364
+ case 0:
365
+ _t = data.trigger;
366
+ _context.next = _t === 'locus-message' ? 1 : _t === 'join-response' ? 6 : _t === 'get-loci-response' ? 7 : 10;
367
+ break;
368
+ case 1:
369
+ if (!data.hashTreeMessage) {
370
+ _context.next = 4;
371
+ break;
372
+ }
373
+ // we need the SELF object to be in the received message, because it contains visibleDataSets
374
+ // 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);
377
+ });
378
+ if (selfObject !== null && selfObject !== void 0 && (_selfObject$data = selfObject.data) !== null && _selfObject$data !== void 0 && _selfObject$data.visibleDataSets) {
379
+ _context.next = 2;
380
+ break;
381
+ }
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');
384
+ case 2:
385
+ _loggerProxy.default.logger.info('Locus-info:index#initialSetup --> creating HashTreeParser from message');
386
+ // 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({
389
+ 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,
396
+ }
397
+ });
321
398
 
322
- // Change it to true after it receives it first locus object
323
- this.emitChange = true;
324
- }
399
+ // now handle the message - that should populate all the visible datasets
400
+ _context.next = 3;
401
+ return this.hashTreeParser.initializeFromMessage(data.hashTreeMessage);
402
+ case 3:
403
+ _context.next = 5;
404
+ break;
405
+ case 4:
406
+ // "classic" Locus case, no hash trees involved
407
+ this.updateLocusCache(data.locus);
408
+ this.onFullLocus(data.locus, undefined);
409
+ case 5:
410
+ return _context.abrupt("continue", 10);
411
+ case 6:
412
+ this.updateLocusCache(data.locus);
413
+ this.onFullLocus(data.locus, undefined, data.dataSets);
414
+ return _context.abrupt("continue", 10);
415
+ case 7:
416
+ 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)) {
417
+ _context.next = 9;
418
+ break;
419
+ }
420
+ _loggerProxy.default.logger.info('Locus-info:index#initialSetup --> creating HashTreeParser from get-loci-response');
421
+ // 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({
424
+ 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
+ },
430
+ dataSets: [] // empty, because we don't have them yet
431
+ }
432
+ });
325
433
 
434
+ // now initialize all the data
435
+ _context.next = 8;
436
+ return this.hashTreeParser.initializeFromGetLociResponse(data.locus);
437
+ case 8:
438
+ _context.next = 10;
439
+ break;
440
+ case 9:
441
+ // "classic" Locus case, no hash trees involved
442
+ this.updateLocusCache(data.locus);
443
+ this.onFullLocus(data.locus, undefined);
444
+ case 10:
445
+ // Change it to true after it receives it first locus object
446
+ this.emitChange = true;
447
+ case 11:
448
+ case "end":
449
+ return _context.stop();
450
+ }
451
+ }, _callee, this);
452
+ }));
453
+ function initialSetup(_x) {
454
+ return _initialSetup.apply(this, arguments);
455
+ }
456
+ return initialSetup;
457
+ }()
326
458
  /**
327
459
  * Handles HTTP response from Locus API call.
328
460
  * @param {Meeting} meeting meeting object
329
461
  * @param {LocusApiResponseBody} responseBody body of the http response from Locus API call
330
462
  * @returns {void}
331
463
  */
464
+ )
332
465
  }, {
333
466
  key: "handleLocusAPIResponse",
334
467
  value: function handleLocusAPIResponse(meeting, responseBody) {
335
- this.handleLocusDelta(responseBody.locus, meeting);
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");
479
+ }
480
+ // classic Locus delta
481
+ this.handleLocusDelta(responseBody.locus, meeting);
482
+ }
483
+ }
484
+
485
+ /**
486
+ *
487
+ * @param {HashTreeObject} object data set object
488
+ * @param {any} locus
489
+ * @returns {void}
490
+ */
491
+ }, {
492
+ key: "updateLocusFromHashTreeObject",
493
+ value: function updateLocusFromHashTreeObject(object, locus) {
494
+ var _this4 = this;
495
+ var type = object.htMeta.elementId.type.toLowerCase();
496
+ var addParticipantObject = function addParticipantObject(obj) {
497
+ if (!locus.participants) {
498
+ locus.participants = [];
499
+ }
500
+ locus.participants.push(obj.data);
501
+ _this4.hashTreeObjectId2ParticipantId.set(obj.htMeta.elementId.id, obj.data.id);
502
+ };
503
+ switch (type) {
504
+ case _types.ObjectType.locus:
505
+ {
506
+ if (!object.data) {
507
+ // not doing anything here, as we need Locus to always be there (at least some fields)
508
+ // and that's already taken care of in updateFromHashTree()
509
+ _loggerProxy.default.logger.info("Locus-info:index#updateLocusFromHashTreeObject --> LOCUS object removed, version=".concat(object.htMeta.elementId.version));
510
+ return locus;
511
+ }
512
+ // replace the main locus
513
+
514
+ // The Locus object we receive from backend has empty participants array,
515
+ // and may have (although it shouldn't) other fields that are managed by other ObjectTypes
516
+ // like "fullState" or "info", so we're making sure to delete them here
517
+ var locusObjectFromData = object.data;
518
+ (0, _values.default)(_types.ObjectTypeToLocusKeyMap).forEach(function (locusDtoKey) {
519
+ delete locusObjectFromData[locusDtoKey];
520
+ });
521
+ locus = _objectSpread(_objectSpread({}, locus), locusObjectFromData);
522
+ _loggerProxy.default.logger.info("Locus-info:index#updateLocusFromHashTreeObject --> LOCUS object updated to version=".concat(object.htMeta.elementId.version));
523
+ break;
524
+ }
525
+ case _types.ObjectType.mediaShare:
526
+ if (object.data) {
527
+ var _object$data$floor, _object$data$floor2, _object$data$floor2$b, _locus$mediaShares;
528
+ _loggerProxy.default.logger.info("Locus-info:index#updateLocusFromHashTreeObject --> mediaShare id=".concat(object.htMeta.elementId.id, " name='").concat(object.data.name, "' updated ").concat(object.data.name === 'content' ? "floor=".concat((_object$data$floor = object.data.floor) === null || _object$data$floor === void 0 ? void 0 : _object$data$floor.disposition, ", ").concat((_object$data$floor2 = object.data.floor) === null || _object$data$floor2 === void 0 ? void 0 : (_object$data$floor2$b = _object$data$floor2.beneficiary) === null || _object$data$floor2$b === void 0 ? void 0 : _object$data$floor2$b.id) : '', " version=").concat(object.htMeta.elementId.version));
529
+ var existingMediaShare = (_locus$mediaShares = locus.mediaShares) === null || _locus$mediaShares === void 0 ? void 0 : _locus$mediaShares.find(function (ms) {
530
+ return ms.htMeta.elementId.id === object.htMeta.elementId.id;
531
+ });
532
+ if (existingMediaShare) {
533
+ (0, _assign.default)(existingMediaShare, object.data);
534
+ } else {
535
+ locus.mediaShares = locus.mediaShares || [];
536
+ locus.mediaShares.push(object.data);
537
+ }
538
+ } else {
539
+ var _locus$mediaShares2;
540
+ _loggerProxy.default.logger.info("Locus-info:index#updateLocusFromHashTreeObject --> mediaShare id=".concat(object.htMeta.elementId.id, " removed, version=").concat(object.htMeta.elementId.version));
541
+ locus.mediaShares = (_locus$mediaShares2 = locus.mediaShares) === null || _locus$mediaShares2 === void 0 ? void 0 : _locus$mediaShares2.filter(function (ms) {
542
+ return ms.htMeta.elementId.id !== object.htMeta.elementId.id;
543
+ });
544
+ }
545
+ break;
546
+ case _types.ObjectType.participant:
547
+ _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
+ if (object.data) {
549
+ addParticipantObject(object);
550
+ } else {
551
+ var participantId = this.hashTreeObjectId2ParticipantId.get(object.htMeta.elementId.id);
552
+ if (!locus.jsSdkMeta) {
553
+ locus.jsSdkMeta = {
554
+ removedParticipantIds: []
555
+ };
556
+ }
557
+ locus.jsSdkMeta.removedParticipantIds.push(participantId);
558
+ this.hashTreeObjectId2ParticipantId.delete(object.htMeta.elementId.id);
559
+ }
560
+ break;
561
+ case _types.ObjectType.control:
562
+ if (object.data) {
563
+ (0, _keys.default)(object.data).forEach(function (controlKey) {
564
+ _loggerProxy.default.logger.info("Locus-info:index#updateLocusFromHashTreeObject --> control ".concat(controlKey, " updated:"), object.data[controlKey]);
565
+ if (!locus.controls) {
566
+ locus.controls = {};
567
+ }
568
+ locus.controls[controlKey] = object.data[controlKey];
569
+ });
570
+ } else {
571
+ _loggerProxy.default.logger.warn("Locus-info:index#updateLocusFromHashTreeObject --> control object update without data - this is not expected!");
572
+ }
573
+ break;
574
+ case _types.ObjectType.links:
575
+ case _types.ObjectType.info:
576
+ case _types.ObjectType.fullState:
577
+ case _types.ObjectType.self:
578
+ if (!object.data) {
579
+ // self without data is handled inside HashTreeParser and results in LocusInfoUpdateType.MEETING_ENDED, so we should never get here
580
+ // 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));
582
+ } else {
583
+ var _locus$info, _object$data$controls, _object$data$controls2, _object$data$controls3;
584
+ _loggerProxy.default.logger.info("Locus-info:index#updateLocusFromHashTreeObject --> ".concat(type, " object updated to version ").concat(object.htMeta.elementId.version));
585
+ var locusDtoKey = _types.ObjectTypeToLocusKeyMap[type];
586
+ locus[locusDtoKey] = object.data;
587
+
588
+ /* Hash tree based webinar attendees don't receive a Participant object for themselves from Locus,
589
+ but a lot of existing code in SDK and web app expects a member object for self to exist,
590
+ so whenever SELF changes for a webinar attendee, we copy it into a participant object.
591
+ We can do it, because SELF has always all the same properties as a participant object.
592
+ */
593
+ if (type === _types.ObjectType.self && (_locus$info = locus.info) !== null && _locus$info !== void 0 && _locus$info.isWebinar && (_object$data$controls = object.data.controls) !== null && _object$data$controls !== void 0 && (_object$data$controls2 = _object$data$controls.role) !== null && _object$data$controls2 !== void 0 && (_object$data$controls3 = _object$data$controls2.roles) !== null && _object$data$controls3 !== void 0 && _object$data$controls3.find(function (r) {
594
+ return r.type === _constants.SELF_ROLES.ATTENDEE && r.hasRole;
595
+ })) {
596
+ _loggerProxy.default.logger.info("Locus-info:index#updateLocusFromHashTreeObject --> webinar attendee: creating participant object from self");
597
+ addParticipantObject(object);
598
+ }
599
+ }
600
+ break;
601
+ default:
602
+ _loggerProxy.default.logger.warn("Locus-info:index#updateLocusFromHashTreeObject --> received unsupported object type ".concat(type));
603
+ break;
604
+ }
605
+ return locus;
606
+ }
607
+
608
+ /**
609
+ * Sends a metric when we receive something from Locus that uses hash trees while we
610
+ * expect classic deltas or the other way around.
611
+ * @param {Meeting} meeting
612
+ * @param {string} message
613
+ * @returns {void}
614
+ */
615
+ }, {
616
+ key: "sendClassicVsHashTreeMismatchMetric",
617
+ value: function sendClassicVsHashTreeMismatchMetric(meeting, message) {
618
+ _loggerProxy.default.logger.warn("Locus-info:index#sendClassicVsHashTreeMismatchMetric --> classic vs hash tree mismatch! ".concat(message));
619
+
620
+ // we don't want to flood the metrics system
621
+ if (this.classicVsHashTreeMismatchMetricCounter < 5) {
622
+ _metrics.default.sendBehavioralMetric(_constants2.default.LOCUS_CLASSIC_VS_HASH_TREE_MISMATCH, {
623
+ correlationId: meeting.correlationId,
624
+ message: message
625
+ });
626
+ this.classicVsHashTreeMismatchMetricCounter += 1;
627
+ }
628
+ }
629
+
630
+ /**
631
+ * Handles a hash tree message received from Locus.
632
+ *
633
+ * @param {Meeting} meeting - The meeting object
634
+ * @param {eventType} eventType - The event type
635
+ * @param {HashTreeMessage} message incoming hash tree message
636
+ * @returns {void}
637
+ */
638
+ }, {
639
+ key: "handleHashTreeMessage",
640
+ value: function handleHashTreeMessage(meeting, eventType, message) {
641
+ if (eventType !== _constants.LOCUSEVENT.HASH_TREE_DATA_UPDATED) {
642
+ this.sendClassicVsHashTreeMismatchMetric(meeting, "got ".concat(eventType, ", expected ").concat(_constants.LOCUSEVENT.HASH_TREE_DATA_UPDATED));
643
+ return;
644
+ }
645
+ this.hashTreeParser.handleMessage(message);
646
+ }
647
+
648
+ /**
649
+ * Callback registered with HashTreeParser to receive locus info updates.
650
+ * Updates our locus info based on the data parsed by the hash tree parser.
651
+ *
652
+ * @param {LocusInfoUpdateType} updateType - The type of update received.
653
+ * @param {Object} [data] - Additional data for the update, if applicable.
654
+ * @returns {void}
655
+ */
656
+ }, {
657
+ key: "updateFromHashTree",
658
+ value: function updateFromHashTree(updateType, data) {
659
+ var _this5 = this;
660
+ switch (updateType) {
661
+ case _hashTreeParser.LocusInfoUpdateType.OBJECTS_UPDATED:
662
+ {
663
+ // initialize our new locus
664
+ var locus = {
665
+ participants: [],
666
+ jsSdkMeta: {
667
+ removedParticipantIds: []
668
+ }
669
+ };
670
+
671
+ // first go over all the updates and check what happens with the main locus object
672
+ var locusObjectStateAfterUpdates = LocusObjectStateAfterUpdates.unchanged;
673
+ data.updatedObjects.forEach(function (object) {
674
+ if (object.htMeta.elementId.type.toLowerCase() === _types.ObjectType.locus) {
675
+ if (locusObjectStateAfterUpdates === LocusObjectStateAfterUpdates.updated) {
676
+ var _object$data;
677
+ // this code doesn't supported it right now,
678
+ // cases for "updated" followed by "removed", or multiple "updated" would need more handling
679
+ // but these should never happen
680
+ _loggerProxy.default.logger.warn("Locus-info:index#updateFromHashTree --> received multiple LOCUS objects in one update, this is unexpected!");
681
+ _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,
683
+ message: object.data ? 'multiple LOCUS object updates' : 'LOCUS object update followed by removal'
684
+ });
685
+ }
686
+ if (object.data) {
687
+ locusObjectStateAfterUpdates = LocusObjectStateAfterUpdates.updated;
688
+ } else {
689
+ locusObjectStateAfterUpdates = LocusObjectStateAfterUpdates.removed;
690
+ }
691
+ }
692
+ });
693
+
694
+ // if Locus object is unchanged or removed, we need to keep using the existing locus
695
+ // because the rest of the locusInfo code expects locus to always be present (with at least some of the fields)
696
+ // if it gets updated, we only need to have the fields that are not part of "locus" object (like "info" or "mediaShares")
697
+ // so that when Locus object gets updated, if the new one is missing some field, that field will
698
+ // be removed from our locusInfo
699
+ if (locusObjectStateAfterUpdates === LocusObjectStateAfterUpdates.unchanged || locusObjectStateAfterUpdates === LocusObjectStateAfterUpdates.removed) {
700
+ // copy over all of existing locus except participants
701
+ LocusDtoTopLevelKeys.forEach(function (key) {
702
+ if (key !== 'participants') {
703
+ locus[key] = (0, _lodash.cloneDeep)(_this5[key]);
704
+ }
705
+ });
706
+ } else {
707
+ // initialize only the fields that are not part of main "Locus" object
708
+ // (except participants, which need to stay empty - that means "no participant changes")
709
+ (0, _values.default)(_types.ObjectTypeToLocusKeyMap).forEach(function (locusDtoKey) {
710
+ if (locusDtoKey !== 'participants') {
711
+ locus[locusDtoKey] = (0, _lodash.cloneDeep)(_this5[locusDtoKey]);
712
+ }
713
+ });
714
+ }
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) {
716
+ return {
717
+ type: o.htMeta.elementId.type,
718
+ id: o.htMeta.elementId.id,
719
+ hasData: !!o.data
720
+ };
721
+ }))));
722
+ // now apply all the updates from the hash tree onto the locus
723
+ data.updatedObjects.forEach(function (object) {
724
+ locus = _this5.updateLocusFromHashTreeObject(object, locus);
725
+ });
726
+
727
+ // update our locus info with the new locus
728
+ this.onDeltaLocus(locus);
729
+ break;
730
+ }
731
+ case _hashTreeParser.LocusInfoUpdateType.MEETING_ENDED:
732
+ {
733
+ _loggerProxy.default.logger.info("Locus-info:index#updateFromHashTree --> received signal that meeting ended, destroying meeting ".concat(this.meetingId));
734
+ var meeting = this.webex.meetings.meetingCollection.get(this.meetingId);
735
+ this.webex.meetings.destroy(meeting, _constants.MEETING_REMOVED_REASON.SELF_REMOVED);
736
+ }
737
+ }
336
738
  }
337
739
 
338
740
  /**
@@ -344,37 +746,44 @@ var LocusInfo = exports.default = /*#__PURE__*/function (_EventsScope) {
344
746
  }, {
345
747
  key: "parse",
346
748
  value: function parse(meeting, data) {
347
- // eslint-disable-next-line @typescript-eslint/no-shadow
348
- var eventType = data.eventType;
349
- var locus = this.getTheLocusToUpdate(data.locus);
350
- _loggerProxy.default.logger.info("Locus-info:index#parse --> received locus data: ".concat(eventType));
351
- locus.jsSdkMeta = {
352
- removedParticipantIds: []
353
- };
354
- switch (eventType) {
355
- case _constants.LOCUSEVENT.PARTICIPANT_JOIN:
356
- case _constants.LOCUSEVENT.PARTICIPANT_LEFT:
357
- case _constants.LOCUSEVENT.CONTROLS_UPDATED:
358
- case _constants.LOCUSEVENT.PARTICIPANT_AUDIO_MUTED:
359
- case _constants.LOCUSEVENT.PARTICIPANT_AUDIO_UNMUTED:
360
- case _constants.LOCUSEVENT.PARTICIPANT_VIDEO_MUTED:
361
- case _constants.LOCUSEVENT.PARTICIPANT_VIDEO_UNMUTED:
362
- case _constants.LOCUSEVENT.SELF_CHANGED:
363
- case _constants.LOCUSEVENT.PARTICIPANT_UPDATED:
364
- case _constants.LOCUSEVENT.PARTICIPANT_CONTROLS_UPDATED:
365
- case _constants.LOCUSEVENT.PARTICIPANT_ROLES_UPDATED:
366
- case _constants.LOCUSEVENT.PARTICIPANT_DECLINED:
367
- case _constants.LOCUSEVENT.FLOOR_GRANTED:
368
- case _constants.LOCUSEVENT.FLOOR_RELEASED:
369
- this.onFullLocus(locus, eventType);
370
- break;
371
- case _constants.LOCUSEVENT.DIFFERENCE:
372
- this.handleLocusDelta(locus, meeting);
373
- break;
374
- default:
375
- // Why will there be a event with no eventType ????
376
- // we may not need this, we can get full locus
377
- this.handleLocusDelta(locus, meeting);
749
+ if (this.hashTreeParser) {
750
+ this.handleHashTreeMessage(meeting, data.eventType, data.stateElementsMessage);
751
+ } else {
752
+ // eslint-disable-next-line @typescript-eslint/no-shadow
753
+ var eventType = data.eventType;
754
+ var locus = this.getTheLocusToUpdate(data.locus);
755
+ _loggerProxy.default.logger.info("Locus-info:index#parse --> received locus data: ".concat(eventType));
756
+ locus.jsSdkMeta = {
757
+ removedParticipantIds: []
758
+ };
759
+ switch (eventType) {
760
+ case _constants.LOCUSEVENT.PARTICIPANT_JOIN:
761
+ case _constants.LOCUSEVENT.PARTICIPANT_LEFT:
762
+ case _constants.LOCUSEVENT.CONTROLS_UPDATED:
763
+ case _constants.LOCUSEVENT.PARTICIPANT_AUDIO_MUTED:
764
+ case _constants.LOCUSEVENT.PARTICIPANT_AUDIO_UNMUTED:
765
+ case _constants.LOCUSEVENT.PARTICIPANT_VIDEO_MUTED:
766
+ case _constants.LOCUSEVENT.PARTICIPANT_VIDEO_UNMUTED:
767
+ case _constants.LOCUSEVENT.SELF_CHANGED:
768
+ case _constants.LOCUSEVENT.PARTICIPANT_UPDATED:
769
+ case _constants.LOCUSEVENT.PARTICIPANT_CONTROLS_UPDATED:
770
+ case _constants.LOCUSEVENT.PARTICIPANT_ROLES_UPDATED:
771
+ case _constants.LOCUSEVENT.PARTICIPANT_DECLINED:
772
+ case _constants.LOCUSEVENT.FLOOR_GRANTED:
773
+ case _constants.LOCUSEVENT.FLOOR_RELEASED:
774
+ this.onFullLocus(locus, eventType);
775
+ break;
776
+ case _constants.LOCUSEVENT.DIFFERENCE:
777
+ this.handleLocusDelta(locus, meeting);
778
+ break;
779
+ case _constants.LOCUSEVENT.HASH_TREE_DATA_UPDATED:
780
+ this.sendClassicVsHashTreeMismatchMetric(meeting, "got ".concat(eventType, ", expected classic events"));
781
+ break;
782
+ default:
783
+ // Why will there be a event with no eventType ????
784
+ // we may not need this, we can get full locus
785
+ this.handleLocusDelta(locus, meeting);
786
+ }
378
787
  }
379
788
  }
380
789
 
@@ -391,26 +800,99 @@ var LocusInfo = exports.default = /*#__PURE__*/function (_EventsScope) {
391
800
  return this.emit(scope, eventName, args);
392
801
  }
393
802
 
803
+ /**
804
+ * Function for handling full locus when it's using hash trees (so not the "classic" one).
805
+ *
806
+ * @param {object} locus locus object
807
+ * @param {string} eventType locus event
808
+ * @param {DataSet[]} dataSets
809
+ * @returns {void}
810
+ */
811
+ }, {
812
+ 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({
818
+ initialLocus: {
819
+ locus: locus,
820
+ dataSets: dataSets
821
+ }
822
+ });
823
+ this.onFullLocusCommon(locus, eventType);
824
+ } else {
825
+ // in this case the Locus we're getting is not necessarily the full one
826
+ // so treat it like if we just got it in any api response
827
+
828
+ _loggerProxy.default.logger.info('Locus-info:index#onFullLocus --> hash tree parser already exists, handling it like a normal API response');
829
+ this.handleLocusAPIResponse(undefined, {
830
+ dataSets: dataSets,
831
+ locus: locus
832
+ });
833
+ }
834
+ }
835
+
836
+ /**
837
+ * Function for handling full locus when it's the "classic" one (not hash trees)
838
+ *
839
+ * @param {object} locus locus object
840
+ * @param {string} eventType locus event
841
+ * @returns {void}
842
+ */
843
+ }, {
844
+ key: "onFullLocusClassic",
845
+ value: function onFullLocusClassic(locus, eventType) {
846
+ if (!this.locusParser.isNewFullLocus(locus)) {
847
+ _loggerProxy.default.logger.info("Locus-info:index#onFullLocus --> ignoring old full locus DTO, eventType=".concat(eventType));
848
+ return;
849
+ }
850
+ this.onFullLocusCommon(locus, eventType);
851
+ }
852
+
394
853
  /**
395
854
  * updates the locus with full locus object
396
855
  * @param {object} locus locus object
397
- * @param {string} eventType particulat locus event
856
+ * @param {string} eventType locus event
857
+ * @param {DataSet[]} dataSets
398
858
  * @returns {object} null
399
859
  * @memberof LocusInfo
400
860
  */
401
861
  }, {
402
862
  key: "onFullLocus",
403
- value: function onFullLocus(locus, eventType) {
404
- var _locus$jsSdkMeta;
863
+ value: function onFullLocus(locus, eventType, dataSets) {
405
864
  if (!locus) {
406
865
  _loggerProxy.default.logger.error('Locus-info:index#onFullLocus --> object passed as argument was invalid, continuing.');
407
866
  }
408
- if (!this.locusParser.isNewFullLocus(locus)) {
409
- _loggerProxy.default.logger.info("Locus-info:index#onFullLocus --> ignoring old full locus DTO, eventType=".concat(eventType));
410
- return;
867
+ if (dataSets) {
868
+ // this is the new hashmap Locus DTO format (only applicable to webinars for now)
869
+ this.onFullLocusWithHashTrees(locus, eventType, dataSets);
870
+ } else {
871
+ this.onFullLocusClassic(locus, eventType);
411
872
  }
873
+ }
874
+
875
+ /**
876
+ * Common part of handling full locus, used by both classic and hash tree based locus handling
877
+ * @param {object} locus locus object
878
+ * @param {string} eventType locus event
879
+ * @returns {void}
880
+ */
881
+ }, {
882
+ key: "onFullLocusCommon",
883
+ value: function onFullLocusCommon(locus, eventType) {
884
+ var _this$participants,
885
+ _this6 = this,
886
+ _locus$jsSdkMeta;
412
887
  this.scheduledMeeting = locus.meeting || null;
413
888
  this.participants = locus.participants;
889
+ (_this$participants = this.participants) === null || _this$participants === void 0 ? void 0 : _this$participants.forEach(function (participant) {
890
+ var _participant$htMeta;
891
+ // 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);
894
+ }
895
+ });
414
896
  var isReplaceMembers = _controlsUtils.default.isNeedReplaceMembers(this.controls, locus.controls);
415
897
  this.updateLocusInfo(locus);
416
898
  this.updateParticipants(locus.participants, (_locus$jsSdkMeta = locus.jsSdkMeta) === null || _locus$jsSdkMeta === void 0 ? void 0 : _locus$jsSdkMeta.removedParticipantIds, isReplaceMembers);
@@ -431,7 +913,8 @@ var LocusInfo = exports.default = /*#__PURE__*/function (_EventsScope) {
431
913
  }, {
432
914
  key: "handleOneOnOneEvent",
433
915
  value: function handleOneOnOneEvent(eventType) {
434
- if (this.parsedLocus.fullState.type === _constants._CALL_ || this.parsedLocus.fullState.type === _constants._SIP_BRIDGE_) {
916
+ var _this$parsedLocus$ful, _this$parsedLocus$ful2;
917
+ if (((_this$parsedLocus$ful = this.parsedLocus.fullState) === null || _this$parsedLocus$ful === void 0 ? void 0 : _this$parsedLocus$ful.type) === _constants._CALL_ || ((_this$parsedLocus$ful2 = this.parsedLocus.fullState) === null || _this$parsedLocus$ful2 === void 0 ? void 0 : _this$parsedLocus$ful2.type) === _constants._SIP_BRIDGE_) {
435
918
  // for 1:1 bob calls alice and alice declines, notify the meeting state
436
919
  if (eventType === _constants.LOCUSEVENT.PARTICIPANT_DECLINED) {
437
920
  // trigger the event for stop ringing
@@ -481,7 +964,7 @@ var LocusInfo = exports.default = /*#__PURE__*/function (_EventsScope) {
481
964
  }, {
482
965
  key: "updateLocusInfo",
483
966
  value: function updateLocusInfo(locus) {
484
- var _locus$self, _locus$self2, _locus$links3, _locus$links4;
967
+ var _locus$self, _locus$self2;
485
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') {
486
969
  // When moved to a breakout session locus sends a message for the previous locus
487
970
  // indicating that we have been moved. It isn't helpful to continue parsing this
@@ -496,17 +979,13 @@ var LocusInfo = exports.default = /*#__PURE__*/function (_EventsScope) {
496
979
  this.updateLocusUrl(locus.url, _controlsUtils.default.isMainSessionDTO(locus));
497
980
  this.updateMeetingInfo(locus.info, locus.self);
498
981
  this.updateMediaShares(locus.mediaShares);
499
- this.updateParticipantsUrl(locus.participantsUrl);
500
- this.updateReplace(locus.replace);
982
+ this.updateReplaces(locus.replaces);
501
983
  this.updateSelf(locus.self);
502
984
  this.updateAclUrl(locus.aclUrl);
503
985
  this.updateBasequence(locus.baseSequence);
504
986
  this.updateSequence(locus.sequence);
505
- this.updateMemberShip(locus.membership);
506
- this.updateIdentifiers(locus.identities);
507
987
  this.updateEmbeddedApps(locus.embeddedApps);
508
- this.updateServices((_locus$links3 = locus.links) === null || _locus$links3 === void 0 ? void 0 : _locus$links3.services);
509
- this.updateResources((_locus$links4 = locus.links) === null || _locus$links4 === void 0 ? void 0 : _locus$links4.resources);
988
+ this.updateLinks(locus.links);
510
989
  this.compareAndUpdate();
511
990
  // update which required to compare different objects from locus
512
991
  }
@@ -538,7 +1017,8 @@ var LocusInfo = exports.default = /*#__PURE__*/function (_EventsScope) {
538
1017
  }, {
539
1018
  key: "isMeetingActive",
540
1019
  value: function isMeetingActive() {
541
- if (this.parsedLocus.fullState.type === _constants._CALL_ || this.parsedLocus.fullState.type === _constants._SIP_BRIDGE_ || this.parsedLocus.fullState.type === _constants._SPACE_SHARE_) {
1020
+ var _this$parsedLocus$ful3, _this$parsedLocus$ful4, _this$parsedLocus$ful5, _this$parsedLocus$ful6;
1021
+ 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_) {
542
1022
  // @ts-ignore
543
1023
  var partner = this.getLocusPartner(this.participants, this.self);
544
1024
  this.updateMeeting({
@@ -602,7 +1082,7 @@ var LocusInfo = exports.default = /*#__PURE__*/function (_EventsScope) {
602
1082
  shouldLeave: false
603
1083
  });
604
1084
  }
605
- } else if (this.parsedLocus.fullState.type === _constants._MEETING_) {
1085
+ } else if (((_this$parsedLocus$ful6 = this.parsedLocus.fullState) === null || _this$parsedLocus$ful6 === void 0 ? void 0 : _this$parsedLocus$ful6.type) === _constants._MEETING_) {
606
1086
  if (this.fullState && (this.fullState.state === _constants.LOCUS.STATE.INACTIVE ||
607
1087
  // @ts-ignore
608
1088
  this.fullState.state === _constants.LOCUS.STATE.TERMINATING)) {
@@ -683,7 +1163,7 @@ var LocusInfo = exports.default = /*#__PURE__*/function (_EventsScope) {
683
1163
  value: function compareSelfAndHost() {
684
1164
  var _this$parsedLocus$hos;
685
1165
  // In some cases the host info is not present but the moderator values changes from null to false so it triggers an update
686
- if (this.parsedLocus.self.selfIdentity === ((_this$parsedLocus$hos = this.parsedLocus.host) === null || _this$parsedLocus$hos === void 0 ? void 0 : _this$parsedLocus$hos.hostId) && this.parsedLocus.self.moderator) {
1166
+ if (this.parsedLocus.self && this.parsedLocus.self.selfIdentity === ((_this$parsedLocus$hos = this.parsedLocus.host) === null || _this$parsedLocus$hos === void 0 ? void 0 : _this$parsedLocus$hos.hostId) && this.parsedLocus.self.moderator) {
687
1167
  this.emitScoped({
688
1168
  file: 'locus-info',
689
1169
  function: 'compareSelfAndHost'
@@ -1055,41 +1535,35 @@ var LocusInfo = exports.default = /*#__PURE__*/function (_EventsScope) {
1055
1535
  }
1056
1536
 
1057
1537
  /**
1058
- * @param {Object} services
1538
+ * Updates links and emits appropriate events if services or resources have changed
1539
+ * @param {Object} links
1059
1540
  * @returns {undefined}
1060
1541
  * @memberof LocusInfo
1061
1542
  */
1062
1543
  }, {
1063
- key: "updateServices",
1064
- value: function updateServices(services) {
1065
- if (services && !(0, _lodash.isEqual)(this.services, services)) {
1066
- this.services = services;
1544
+ key: "updateLinks",
1545
+ value: function updateLinks(links) {
1546
+ var _this$links, _this$links2;
1547
+ var _ref2 = links || {},
1548
+ services = _ref2.services,
1549
+ resources = _ref2.resources;
1550
+ if (services && !(0, _lodash.isEqual)((_this$links = this.links) === null || _this$links === void 0 ? void 0 : _this$links.services, services)) {
1067
1551
  this.emitScoped({
1068
1552
  file: 'locus-info',
1069
- function: 'updateServices'
1553
+ function: 'updateLinks'
1070
1554
  }, _constants.LOCUSINFO.EVENTS.LINKS_SERVICES, {
1071
1555
  services: services
1072
1556
  });
1073
1557
  }
1074
- }
1075
-
1076
- /**
1077
- * @param {Object} resources
1078
- * @returns {undefined}
1079
- * @memberof LocusInfo
1080
- */
1081
- }, {
1082
- key: "updateResources",
1083
- value: function updateResources(resources) {
1084
- if (resources && !(0, _lodash.isEqual)(this.resources, resources)) {
1085
- this.resources = resources;
1558
+ if (resources && !(0, _lodash.isEqual)((_this$links2 = this.links) === null || _this$links2 === void 0 ? void 0 : _this$links2.resources, resources)) {
1086
1559
  this.emitScoped({
1087
1560
  file: 'locus-info',
1088
- function: 'updateResources'
1561
+ function: 'updateLinks'
1089
1562
  }, _constants.LOCUSINFO.EVENTS.LINKS_RESOURCES, {
1090
1563
  resources: resources
1091
1564
  });
1092
1565
  }
1566
+ this.links = links;
1093
1567
  }
1094
1568
 
1095
1569
  /**
@@ -1192,7 +1666,6 @@ var LocusInfo = exports.default = /*#__PURE__*/function (_EventsScope) {
1192
1666
  isInitializing: !self // if self is undefined, then the update is caused by locus init
1193
1667
  });
1194
1668
  }
1195
-
1196
1669
  this.roles = roles;
1197
1670
  }
1198
1671
 
@@ -1248,28 +1721,15 @@ var LocusInfo = exports.default = /*#__PURE__*/function (_EventsScope) {
1248
1721
  }
1249
1722
 
1250
1723
  /**
1251
- * @param {String} participantsUrl
1252
- * @returns {undefined}
1253
- * @memberof LocusInfo
1254
- */
1255
- }, {
1256
- key: "updateParticipantsUrl",
1257
- value: function updateParticipantsUrl(participantsUrl) {
1258
- if (participantsUrl && !(0, _lodash.isEqual)(this.participantsUrl, participantsUrl)) {
1259
- this.participantsUrl = participantsUrl;
1260
- }
1261
- }
1262
-
1263
- /**
1264
- * @param {Object} replace
1724
+ * @param {Object} replaces
1265
1725
  * @returns {undefined}
1266
1726
  * @memberof LocusInfo
1267
1727
  */
1268
1728
  }, {
1269
- key: "updateReplace",
1270
- value: function updateReplace(replace) {
1271
- if (replace && !(0, _lodash.isEqual)(this.replace, replace)) {
1272
- this.replace = replace;
1729
+ key: "updateReplaces",
1730
+ value: function updateReplaces(replaces) {
1731
+ if (replaces && !(0, _lodash.isEqual)(this.replaces, replaces)) {
1732
+ this.replaces = replaces;
1273
1733
  }
1274
1734
  }
1275
1735
 
@@ -1284,10 +1744,10 @@ var LocusInfo = exports.default = /*#__PURE__*/function (_EventsScope) {
1284
1744
  key: "updateSelf",
1285
1745
  value: function updateSelf(self) {
1286
1746
  if (self) {
1747
+ var _this$parsedLocus$ful7, _this$parsedLocus$inf;
1287
1748
  // @ts-ignore
1288
1749
  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
1289
1750
  );
1290
-
1291
1751
  this.updateMeeting(parsedSelves.current);
1292
1752
  this.parsedLocus.self = parsedSelves.current;
1293
1753
  var element = this.parsedLocus.states[this.parsedLocus.states.length - 1];
@@ -1296,9 +1756,9 @@ var LocusInfo = exports.default = /*#__PURE__*/function (_EventsScope) {
1296
1756
  }
1297
1757
 
1298
1758
  // TODO: check if we need to save the sipUri here as well
1299
- // this.emit(LOCUSINFO.EVENTS.MEETING_UPDATE, SelfUtils.getSipUrl(this.getLocusPartner(participants, self), this.parsedLocus.fullState.type, this.parsedLocus.info.sipUri));
1300
- var result = _selfUtils.default.getSipUrl(this.getLocusPartner(this.participants, self), this.parsedLocus.fullState.type, this.parsedLocus.info.sipUri);
1301
- if (result.sipUri) {
1759
+ // this.emit(LOCUSINFO.EVENTS.MEETING_UPDATE, SelfUtils.getSipUrl(this.getLocusPartner(participants, self), this.parsedLocus.fullState?.type, this.parsedLocus.info?.sipUri));
1760
+ 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);
1761
+ if (result !== null && result !== void 0 && result.sipUri) {
1302
1762
  this.updateMeeting(result);
1303
1763
  }
1304
1764
  if (parsedSelves.updates.moderatorChanged) {
@@ -1372,7 +1832,6 @@ var LocusInfo = exports.default = /*#__PURE__*/function (_EventsScope) {
1372
1832
  // unmuteAllowed: not part of .self
1373
1833
  });
1374
1834
  }
1375
-
1376
1835
  if (parsedSelves.updates.localAudioUnmuteRequiredByServer) {
1377
1836
  this.emitScoped({
1378
1837
  file: 'locus-info',
@@ -1530,32 +1989,6 @@ var LocusInfo = exports.default = /*#__PURE__*/function (_EventsScope) {
1530
1989
  }
1531
1990
  }
1532
1991
 
1533
- /**
1534
- * @param {Object} membership
1535
- * @returns {undefined}
1536
- * @memberof LocusInfo
1537
- */
1538
- }, {
1539
- key: "updateMemberShip",
1540
- value: function updateMemberShip(membership) {
1541
- if (membership && !(0, _lodash.isEqual)(this.membership, membership)) {
1542
- this.membership = membership;
1543
- }
1544
- }
1545
-
1546
- /**
1547
- * @param {Array} identities
1548
- * @returns {undefined}
1549
- * @memberof LocusInfo
1550
- */
1551
- }, {
1552
- key: "updateIdentifiers",
1553
- value: function updateIdentifiers(identities) {
1554
- if (identities && !(0, _lodash.isEqual)(this.identities, identities)) {
1555
- this.identities = identities;
1556
- }
1557
- }
1558
-
1559
1992
  /**
1560
1993
  * check the locus is main session's one or not, if is main session's, update main session cache
1561
1994
  * @param {Object} locus
@@ -1633,7 +2066,7 @@ var LocusInfo = exports.default = /*#__PURE__*/function (_EventsScope) {
1633
2066
  }, {
1634
2067
  key: "updateMainSessionLocusCache",
1635
2068
  value: function updateMainSessionLocusCache(mainLocus) {
1636
- var _this4 = this;
2069
+ var _this7 = this;
1637
2070
  if (!mainLocus) {
1638
2071
  return;
1639
2072
  }
@@ -1642,7 +2075,7 @@ var LocusInfo = exports.default = /*#__PURE__*/function (_EventsScope) {
1642
2075
  // shallow merge and do special merge for participants
1643
2076
  (0, _lodash.assignWith)(this.mainSessionLocusCache, locusClone, function (objValue, srcValue, key) {
1644
2077
  if (key === 'participants') {
1645
- return _this4.mergeParticipants(objValue, srcValue);
2078
+ return _this7.mergeParticipants(objValue, srcValue);
1646
2079
  }
1647
2080
  return srcValue || objValue;
1648
2081
  });
@@ -1662,6 +2095,5 @@ var LocusInfo = exports.default = /*#__PURE__*/function (_EventsScope) {
1662
2095
  this.mainSessionLocusCache = null;
1663
2096
  }
1664
2097
  }]);
1665
- return LocusInfo;
1666
2098
  }(_eventsScope.default);
1667
2099
  //# sourceMappingURL=index.js.map