@webex/plugin-meetings 3.12.0-next.9 → 3.12.0-next.90

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 (213) hide show
  1. package/AGENTS.md +9 -0
  2. package/dist/aiEnableRequest/index.js +15 -2
  3. package/dist/aiEnableRequest/index.js.map +1 -1
  4. package/dist/breakouts/breakout.js +8 -3
  5. package/dist/breakouts/breakout.js.map +1 -1
  6. package/dist/breakouts/index.js +26 -2
  7. package/dist/breakouts/index.js.map +1 -1
  8. package/dist/config.js +2 -2
  9. package/dist/config.js.map +1 -1
  10. package/dist/constants.js +35 -9
  11. package/dist/constants.js.map +1 -1
  12. package/dist/controls-options-manager/constants.js +11 -1
  13. package/dist/controls-options-manager/constants.js.map +1 -1
  14. package/dist/controls-options-manager/index.js +67 -29
  15. package/dist/controls-options-manager/index.js.map +1 -1
  16. package/dist/controls-options-manager/util.js +91 -0
  17. package/dist/controls-options-manager/util.js.map +1 -1
  18. package/dist/hashTree/constants.js +13 -1
  19. package/dist/hashTree/constants.js.map +1 -1
  20. package/dist/hashTree/hashTreeParser.js +880 -382
  21. package/dist/hashTree/hashTreeParser.js.map +1 -1
  22. package/dist/hashTree/utils.js +42 -0
  23. package/dist/hashTree/utils.js.map +1 -1
  24. package/dist/index.js +7 -0
  25. package/dist/index.js.map +1 -1
  26. package/dist/interceptors/dataChannelAuthToken.js +75 -15
  27. package/dist/interceptors/dataChannelAuthToken.js.map +1 -1
  28. package/dist/interceptors/locusRetry.js +23 -8
  29. package/dist/interceptors/locusRetry.js.map +1 -1
  30. package/dist/interpretation/index.js +10 -1
  31. package/dist/interpretation/index.js.map +1 -1
  32. package/dist/interpretation/interpretation.types.js +7 -0
  33. package/dist/interpretation/interpretation.types.js.map +1 -0
  34. package/dist/interpretation/siLanguage.js +1 -1
  35. package/dist/locus-info/controlsUtils.js +4 -1
  36. package/dist/locus-info/controlsUtils.js.map +1 -1
  37. package/dist/locus-info/index.js +303 -88
  38. package/dist/locus-info/index.js.map +1 -1
  39. package/dist/locus-info/infoUtils.js +36 -5
  40. package/dist/locus-info/infoUtils.js.map +1 -1
  41. package/dist/locus-info/types.js +19 -0
  42. package/dist/locus-info/types.js.map +1 -1
  43. package/dist/media/index.js +3 -1
  44. package/dist/media/index.js.map +1 -1
  45. package/dist/media/properties.js +1 -0
  46. package/dist/media/properties.js.map +1 -1
  47. package/dist/meeting/in-meeting-actions.js +5 -1
  48. package/dist/meeting/in-meeting-actions.js.map +1 -1
  49. package/dist/meeting/index.js +1233 -793
  50. package/dist/meeting/index.js.map +1 -1
  51. package/dist/meeting/locusMediaRequest.js +229 -82
  52. package/dist/meeting/locusMediaRequest.js.map +1 -1
  53. package/dist/meeting/muteState.js +10 -1
  54. package/dist/meeting/muteState.js.map +1 -1
  55. package/dist/meeting/request.js +5 -2
  56. package/dist/meeting/request.js.map +1 -1
  57. package/dist/meeting/util.js +35 -2
  58. package/dist/meeting/util.js.map +1 -1
  59. package/dist/meeting-info/meeting-info-v2.js +2 -2
  60. package/dist/meeting-info/meeting-info-v2.js.map +1 -1
  61. package/dist/meetings/index.js +231 -118
  62. package/dist/meetings/index.js.map +1 -1
  63. package/dist/meetings/meetings.types.js +6 -1
  64. package/dist/meetings/meetings.types.js.map +1 -1
  65. package/dist/meetings/request.js +39 -0
  66. package/dist/meetings/request.js.map +1 -1
  67. package/dist/meetings/util.js +79 -5
  68. package/dist/meetings/util.js.map +1 -1
  69. package/dist/member/index.js +10 -0
  70. package/dist/member/index.js.map +1 -1
  71. package/dist/member/types.js.map +1 -1
  72. package/dist/member/util.js +30 -0
  73. package/dist/member/util.js.map +1 -1
  74. package/dist/members/index.js +101 -43
  75. package/dist/members/index.js.map +1 -1
  76. package/dist/members/util.js +8 -1
  77. package/dist/members/util.js.map +1 -1
  78. package/dist/metrics/constants.js +5 -1
  79. package/dist/metrics/constants.js.map +1 -1
  80. package/dist/multistream/codec/constants.js +63 -0
  81. package/dist/multistream/codec/constants.js.map +1 -0
  82. package/dist/multistream/mediaRequestManager.js +62 -15
  83. package/dist/multistream/mediaRequestManager.js.map +1 -1
  84. package/dist/multistream/receiveSlot.js +9 -0
  85. package/dist/multistream/receiveSlot.js.map +1 -1
  86. package/dist/reachability/index.js +10 -13
  87. package/dist/reachability/index.js.map +1 -1
  88. package/dist/reachability/reachability.types.js +2 -0
  89. package/dist/reachability/reachability.types.js.map +1 -1
  90. package/dist/reachability/util.js +45 -0
  91. package/dist/reachability/util.js.map +1 -1
  92. package/dist/reactions/reactions.type.js.map +1 -1
  93. package/dist/recording-controller/index.js +1 -3
  94. package/dist/recording-controller/index.js.map +1 -1
  95. package/dist/types/config.d.ts +2 -2
  96. package/dist/types/constants.d.ts +12 -1
  97. package/dist/types/controls-options-manager/constants.d.ts +6 -1
  98. package/dist/types/controls-options-manager/index.d.ts +16 -0
  99. package/dist/types/hashTree/constants.d.ts +2 -0
  100. package/dist/types/hashTree/hashTreeParser.d.ts +146 -17
  101. package/dist/types/hashTree/utils.d.ts +18 -0
  102. package/dist/types/index.d.ts +3 -0
  103. package/dist/types/interceptors/locusRetry.d.ts +4 -4
  104. package/dist/types/interpretation/interpretation.types.d.ts +10 -0
  105. package/dist/types/locus-info/index.d.ts +50 -6
  106. package/dist/types/locus-info/infoUtils.d.ts +8 -0
  107. package/dist/types/locus-info/types.d.ts +21 -1
  108. package/dist/types/media/properties.d.ts +1 -0
  109. package/dist/types/meeting/in-meeting-actions.d.ts +4 -0
  110. package/dist/types/meeting/index.d.ts +94 -7
  111. package/dist/types/meeting/locusMediaRequest.d.ts +12 -0
  112. package/dist/types/meeting/request.d.ts +1 -0
  113. package/dist/types/meeting/util.d.ts +9 -0
  114. package/dist/types/meetings/index.d.ts +30 -18
  115. package/dist/types/meetings/meetings.types.d.ts +15 -0
  116. package/dist/types/meetings/request.d.ts +14 -0
  117. package/dist/types/member/index.d.ts +1 -0
  118. package/dist/types/member/types.d.ts +1 -0
  119. package/dist/types/member/util.d.ts +9 -0
  120. package/dist/types/members/index.d.ts +15 -2
  121. package/dist/types/members/util.d.ts +1 -5
  122. package/dist/types/metrics/constants.d.ts +4 -0
  123. package/dist/types/multistream/codec/constants.d.ts +7 -0
  124. package/dist/types/multistream/mediaRequestManager.d.ts +22 -5
  125. package/dist/types/reachability/index.d.ts +1 -1
  126. package/dist/types/reachability/reachability.types.d.ts +7 -0
  127. package/dist/types/reachability/util.d.ts +17 -0
  128. package/dist/types/reactions/reactions.type.d.ts +3 -0
  129. package/dist/webinar/index.js +305 -159
  130. package/dist/webinar/index.js.map +1 -1
  131. package/package.json +22 -22
  132. package/src/aiEnableRequest/index.ts +16 -0
  133. package/src/breakouts/breakout.ts +3 -1
  134. package/src/breakouts/index.ts +31 -0
  135. package/src/config.ts +2 -2
  136. package/src/constants.ts +20 -3
  137. package/src/controls-options-manager/constants.ts +14 -1
  138. package/src/controls-options-manager/index.ts +87 -28
  139. package/src/controls-options-manager/util.ts +81 -1
  140. package/src/hashTree/constants.ts +16 -0
  141. package/src/hashTree/hashTreeParser.ts +580 -196
  142. package/src/hashTree/utils.ts +36 -0
  143. package/src/index.ts +6 -0
  144. package/src/interceptors/dataChannelAuthToken.ts +88 -12
  145. package/src/interceptors/locusRetry.ts +25 -4
  146. package/src/interpretation/index.ts +27 -9
  147. package/src/interpretation/interpretation.types.ts +11 -0
  148. package/src/locus-info/controlsUtils.ts +3 -1
  149. package/src/locus-info/index.ts +304 -100
  150. package/src/locus-info/infoUtils.ts +41 -6
  151. package/src/locus-info/types.ts +25 -1
  152. package/src/media/index.ts +3 -0
  153. package/src/media/properties.ts +1 -0
  154. package/src/meeting/in-meeting-actions.ts +8 -0
  155. package/src/meeting/index.ts +494 -67
  156. package/src/meeting/locusMediaRequest.ts +106 -6
  157. package/src/meeting/muteState.ts +10 -1
  158. package/src/meeting/request.ts +11 -0
  159. package/src/meeting/util.ts +47 -5
  160. package/src/meeting-info/meeting-info-v2.ts +4 -2
  161. package/src/meetings/index.ts +133 -78
  162. package/src/meetings/meetings.types.ts +19 -0
  163. package/src/meetings/request.ts +43 -0
  164. package/src/meetings/util.ts +97 -1
  165. package/src/member/index.ts +10 -0
  166. package/src/member/types.ts +1 -0
  167. package/src/member/util.ts +29 -0
  168. package/src/members/index.ts +70 -7
  169. package/src/members/util.ts +12 -4
  170. package/src/metrics/constants.ts +4 -0
  171. package/src/multistream/codec/constants.ts +58 -0
  172. package/src/multistream/mediaRequestManager.ts +119 -28
  173. package/src/multistream/receiveSlot.ts +18 -0
  174. package/src/reachability/index.ts +19 -15
  175. package/src/reachability/reachability.types.ts +11 -0
  176. package/src/reachability/util.ts +36 -0
  177. package/src/reactions/reactions.type.ts +3 -0
  178. package/src/recording-controller/index.ts +1 -2
  179. package/src/webinar/index.ts +214 -36
  180. package/test/unit/spec/aiEnableRequest/index.ts +86 -0
  181. package/test/unit/spec/breakouts/breakout.ts +9 -3
  182. package/test/unit/spec/breakouts/index.ts +49 -0
  183. package/test/unit/spec/controls-options-manager/index.js +244 -29
  184. package/test/unit/spec/controls-options-manager/util.js +165 -0
  185. package/test/unit/spec/hashTree/hashTreeParser.ts +1838 -180
  186. package/test/unit/spec/hashTree/utils.ts +125 -1
  187. package/test/unit/spec/interceptors/dataChannelAuthToken.ts +196 -0
  188. package/test/unit/spec/interceptors/locusRetry.ts +205 -4
  189. package/test/unit/spec/interpretation/index.ts +26 -4
  190. package/test/unit/spec/locus-info/controlsUtils.js +172 -57
  191. package/test/unit/spec/locus-info/index.js +499 -81
  192. package/test/unit/spec/locus-info/infoUtils.js +184 -1
  193. package/test/unit/spec/media/index.ts +31 -0
  194. package/test/unit/spec/meeting/in-meeting-actions.ts +4 -0
  195. package/test/unit/spec/meeting/index.js +1615 -42
  196. package/test/unit/spec/meeting/locusMediaRequest.ts +302 -4
  197. package/test/unit/spec/meeting/muteState.js +81 -0
  198. package/test/unit/spec/meeting/request.js +12 -0
  199. package/test/unit/spec/meeting/utils.js +157 -1
  200. package/test/unit/spec/meeting-info/meetinginfov2.js +19 -10
  201. package/test/unit/spec/meetings/index.js +363 -36
  202. package/test/unit/spec/meetings/request.js +141 -0
  203. package/test/unit/spec/meetings/utils.js +189 -0
  204. package/test/unit/spec/member/index.js +7 -0
  205. package/test/unit/spec/member/util.js +89 -0
  206. package/test/unit/spec/members/index.js +216 -0
  207. package/test/unit/spec/members/request.js +37 -1
  208. package/test/unit/spec/members/utils.js +63 -0
  209. package/test/unit/spec/multistream/mediaRequestManager.ts +501 -37
  210. package/test/unit/spec/reachability/index.ts +59 -46
  211. package/test/unit/spec/reachability/util.ts +31 -0
  212. package/test/unit/spec/recording-controller/index.js +9 -8
  213. package/test/unit/spec/webinar/index.ts +329 -28
@@ -32,9 +32,9 @@ var _defineProperty2 = _interopRequireDefault(require("@babel/runtime-corejs2/he
32
32
  var _values = _interopRequireDefault(require("@babel/runtime-corejs2/core-js/object/values"));
33
33
  var _assign = _interopRequireDefault(require("@babel/runtime-corejs2/core-js/object/assign"));
34
34
  var _map = _interopRequireDefault(require("@babel/runtime-corejs2/core-js/map"));
35
+ var _isArray = _interopRequireDefault(require("@babel/runtime-corejs2/core-js/array/is-array"));
35
36
  var _keys = _interopRequireDefault(require("@babel/runtime-corejs2/core-js/object/keys"));
36
37
  var _stringify = _interopRequireDefault(require("@babel/runtime-corejs2/core-js/json/stringify"));
37
- var _isArray = _interopRequireDefault(require("@babel/runtime-corejs2/core-js/array/is-array"));
38
38
  var _lodash = require("lodash");
39
39
  var _loggerProxy = _interopRequireDefault(require("../common/logs/logger-proxy"));
40
40
  var _eventsScope = _interopRequireDefault(require("../common/events/events-scope"));
@@ -53,7 +53,7 @@ var _hashTreeParser2 = _interopRequireWildcard(require("../hashTree/hashTreePars
53
53
  var _types = require("../hashTree/types");
54
54
  var _utils = require("../hashTree/utils");
55
55
  var _util = _interopRequireDefault(require("../meetings/util"));
56
- 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); }
56
+ 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); }
57
57
  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)); }
58
58
  function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(_Reflect$construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); }
59
59
  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; }
@@ -76,7 +76,7 @@ var LocusObjectStateAfterUpdates = {
76
76
  * Gets the replacement information
77
77
  *
78
78
  * @param {any} self - "self" object from Locus DTO
79
- * @param {string} deviceUrl - The URL of the user's device
79
+ * @param {string} deviceUrl - The URL of the specified device
80
80
  * @returns {any} The replace information if available, otherwise undefined
81
81
  */
82
82
  function getReplaceInfoFromSelf(self, deviceUrl) {
@@ -115,11 +115,13 @@ function findLocusUrlInAnyHashTreeParser(meetingCollection, locusUrl) {
115
115
  *
116
116
  * @param {HashTreeMessage} message - The hash tree message to find the meeting for
117
117
  * @param {MeetingCollection} meetingCollection - The collection of meetings to search
118
- * @param {string} deviceUrl - The URL of the user's device
119
118
  * @returns {any} The meeting if found, otherwise undefined
120
119
  */
121
- function findMeetingForHashTreeMessage(message, meetingCollection, deviceUrl) {
120
+ function findMeetingForHashTreeMessage(message, meetingCollection) {
122
121
  var _message$locusStateEl, _message$locusStateEl2;
122
+ if (!message) {
123
+ return undefined;
124
+ }
123
125
  var foundMeeting = findLocusUrlInAnyHashTreeParser(meetingCollection, message.locusUrl);
124
126
  if (foundMeeting) {
125
127
  return foundMeeting;
@@ -130,7 +132,7 @@ function findMeetingForHashTreeMessage(message, meetingCollection, deviceUrl) {
130
132
  var self = (_message$locusStateEl = message.locusStateElements) === null || _message$locusStateEl === void 0 ? void 0 : (_message$locusStateEl2 = _message$locusStateEl.find(function (el) {
131
133
  return (0, _utils.isSelf)(el);
132
134
  })) === null || _message$locusStateEl2 === void 0 ? void 0 : _message$locusStateEl2.data;
133
- var replaces = getReplaceInfoFromSelf(self, deviceUrl);
135
+ var replaces = getReplaceInfoFromSelf(self, self === null || self === void 0 ? void 0 : self.deviceUrl);
134
136
  if (replaces !== null && replaces !== void 0 && replaces.locusUrl) {
135
137
  foundMeeting = findLocusUrlInAnyHashTreeParser(meetingCollection, replaces.locusUrl);
136
138
  return foundMeeting;
@@ -511,7 +513,7 @@ var LocusInfo = exports.default = /*#__PURE__*/function (_EventsScope) {
511
513
  }, {
512
514
  key: "createHashTreeParser",
513
515
  value: function createHashTreeParser(_ref) {
514
- var _this$webex$config$me;
516
+ var _locusUrl$split, _locusUrl$split$pop, _this$webex$config$me;
515
517
  var locusUrl = _ref.locusUrl,
516
518
  initialLocus = _ref.initialLocus,
517
519
  metadata = _ref.metadata,
@@ -521,7 +523,7 @@ var LocusInfo = exports.default = /*#__PURE__*/function (_EventsScope) {
521
523
  metadata: metadata,
522
524
  webexRequest: this.webex.request.bind(this.webex),
523
525
  locusInfoUpdateCallback: this.updateFromHashTree.bind(this, locusUrl),
524
- debugId: "HT-".concat(locusUrl.split('/').pop().substring(0, 4)),
526
+ 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)),
525
527
  excludedDataSets: (_this$webex$config$me = this.webex.config.meetings.locus) === null || _this$webex$config$me === void 0 ? void 0 : _this$webex$config$me.excludedDataSets
526
528
  });
527
529
 
@@ -558,18 +560,20 @@ var LocusInfo = exports.default = /*#__PURE__*/function (_EventsScope) {
558
560
 
559
561
  /**
560
562
  * @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
563
+ * @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)
561
564
  * @returns {undefined}
562
565
  * @memberof LocusInfo
563
566
  */
564
567
  }, {
565
568
  key: "initialSetup",
566
569
  value: (function () {
567
- var _initialSetup = (0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee(data) {
570
+ var _initialSetup = (0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee(data, onLocusSynced) {
568
571
  var _data$locus, _data$locus$links, _data$locus$links$res, _data$locus$links$res2;
569
- var _data$hashTreeMessage, _metadataObject$data, metadataObject, hashTreeParser, _hashTreeParser, _t;
572
+ var initialFullLocus, _data$hashTreeMessage, _metadataObject$data, metadataObject, hashTreeParser, _hashTreeParser, _t;
570
573
  return _regenerator.default.wrap(function (_context) {
571
574
  while (1) switch (_context.prev = _context.next) {
572
575
  case 0:
576
+ initialFullLocus = null;
573
577
  _t = data.trigger;
574
578
  _context.next = _t === 'locus-message' ? 1 : _t === 'join-response' ? 6 : _t === 'get-loci-response' ? 7 : 10;
575
579
  break;
@@ -621,6 +625,7 @@ var LocusInfo = exports.default = /*#__PURE__*/function (_EventsScope) {
621
625
  case 6:
622
626
  this.updateLocusCache(data.locus);
623
627
  this.onFullLocus('join response', data.locus, undefined, data.dataSets, data.metadata);
628
+ initialFullLocus = data.locus;
624
629
  return _context.abrupt("continue", 10);
625
630
  case 7:
626
631
  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)) {
@@ -646,7 +651,16 @@ var LocusInfo = exports.default = /*#__PURE__*/function (_EventsScope) {
646
651
  // "classic" Locus case, no hash trees involved
647
652
  this.updateLocusCache(data.locus);
648
653
  this.onFullLocus('classic get-loci-response', data.locus, undefined);
654
+ initialFullLocus = data.locus || null;
649
655
  case 10:
656
+ if (onLocusSynced) {
657
+ try {
658
+ onLocusSynced(initialFullLocus || this.getCurrentLocusSnapshot());
659
+ } catch (error) {
660
+ _loggerProxy.default.logger.warn("Locus-info:index#initialSetup --> onLocusSynced callback failed: ".concat(error));
661
+ }
662
+ }
663
+
650
664
  // Change it to true after it receives it first locus object
651
665
  this.emitChange = true;
652
666
  case 11:
@@ -655,18 +669,40 @@ var LocusInfo = exports.default = /*#__PURE__*/function (_EventsScope) {
655
669
  }
656
670
  }, _callee, this);
657
671
  }));
658
- function initialSetup(_x) {
672
+ function initialSetup(_x, _x2) {
659
673
  return _initialSetup.apply(this, arguments);
660
674
  }
661
675
  return initialSetup;
662
676
  }()
677
+ /**
678
+ * Builds a full locus DTO snapshot from current internal locus state.
679
+ *
680
+ * @returns {LocusDTO}
681
+ */
682
+ )
683
+ }, {
684
+ key: "getCurrentLocusSnapshot",
685
+ value: function getCurrentLocusSnapshot() {
686
+ var _this4 = this;
687
+ var locus = {};
688
+ LocusDtoTopLevelKeys.forEach(function (key) {
689
+ var value = _this4[key];
690
+ if (value !== undefined && value !== null) {
691
+ locus[key] = (0, _lodash.cloneDeep)(value);
692
+ }
693
+ });
694
+ if (!(0, _isArray.default)(locus.participants)) {
695
+ locus.participants = [];
696
+ }
697
+ return locus;
698
+ }
699
+
663
700
  /**
664
701
  * Handles HTTP response from Locus API call.
665
702
  * @param {Meeting} meeting meeting object
666
703
  * @param {LocusApiResponseBody} responseBody body of the http response from Locus API call
667
704
  * @returns {void}
668
705
  */
669
- )
670
706
  }, {
671
707
  key: "handleLocusAPIResponse",
672
708
  value: function handleLocusAPIResponse(meeting, responseBody) {
@@ -674,29 +710,38 @@ var LocusInfo = exports.default = /*#__PURE__*/function (_EventsScope) {
674
710
  var isWrapped = 'locus' in responseBody;
675
711
  var locusUrl = isWrapped ? (_responseBody$locus = responseBody.locus) === null || _responseBody$locus === void 0 ? void 0 : _responseBody$locus.url : responseBody.url;
676
712
  var hashTreeParserEntry = locusUrl && this.hashTreeParsers.get(locusUrl);
677
- if (hashTreeParserEntry) {
678
- if (isWrapped) {
679
- if (!responseBody.dataSets) {
680
- this.sendClassicVsHashTreeMismatchMetric(meeting, "expected hash tree dataSets in API response but they are missing");
681
- // continuing as we can still manage without responseBody.dataSets, but this is very suspicious
713
+ var locus = isWrapped ? responseBody.locus : responseBody;
714
+ if (this.hashTreeParsers.size > 0) {
715
+ // We are in hash tree mode. Check if we need to create/reactivate a parser for this locusUrl.
716
+ if (!hashTreeParserEntry || hashTreeParserEntry.parser.state === 'stopped') {
717
+ if (!locusUrl) {
718
+ _loggerProxy.default.logger.warn('Locus-info:index#handleLocusAPIResponse --> API response has no locusUrl, cannot handle hash tree parser switch');
719
+ return;
682
720
  }
683
- _loggerProxy.default.logger.info('Locus-info:index#handleLocusAPIResponse --> passing Locus API response to HashTreeParser: ', responseBody);
721
+ this.handleHashTreeParserSwitchForAPIResponse(locusUrl, locus);
722
+ return;
723
+ }
724
+
725
+ // Active parser found - pass the API response to it
726
+ if (isWrapped) {
684
727
  // update the data in our hash trees
685
728
  hashTreeParserEntry.parser.handleLocusUpdate(responseBody);
686
729
  } else {
687
- // LocusDTO without wrapper - pass it through as if it had no dataSets
730
+ // LocusDTO without wrapper - pass it through as if it had no dataSets nor metadata
688
731
  hashTreeParserEntry.parser.handleLocusUpdate({
689
732
  locus: responseBody
690
733
  });
691
734
  }
692
- } else {
693
- if (isWrapped && responseBody.dataSets) {
694
- this.sendClassicVsHashTreeMismatchMetric(meeting, "unexpected hash tree dataSets in API response");
695
- }
696
- // classic Locus delta
697
- var locus = isWrapped ? responseBody.locus : responseBody;
698
- this.handleLocusDelta(locus, meeting);
735
+ return;
736
+ }
737
+
738
+ // No hash tree parsers - classic Locus mode
739
+ if (isWrapped && responseBody.dataSets) {
740
+ this.sendClassicVsHashTreeMismatchMetric(meeting, "unexpected hash tree dataSets in API response");
699
741
  }
742
+
743
+ // classic Locus delta
744
+ this.handleLocusDelta(locus, meeting);
700
745
  }
701
746
 
702
747
  /**
@@ -707,7 +752,7 @@ var LocusInfo = exports.default = /*#__PURE__*/function (_EventsScope) {
707
752
  }, {
708
753
  key: "updateLocusFromHashTreeObject",
709
754
  value: function updateLocusFromHashTreeObject(object, locus) {
710
- var _this4 = this,
755
+ var _this5 = this,
711
756
  _locus$self;
712
757
  var type = object.htMeta.elementId.type.toLowerCase();
713
758
  var addParticipantObject = function addParticipantObject(obj) {
@@ -715,7 +760,7 @@ var LocusInfo = exports.default = /*#__PURE__*/function (_EventsScope) {
715
760
  locus.participants = [];
716
761
  }
717
762
  locus.participants.push(obj.data);
718
- _this4.hashTreeObjectId2ParticipantId.set(obj.htMeta.elementId.id, obj.data.id);
763
+ _this5.hashTreeObjectId2ParticipantId.set(obj.htMeta.elementId.id, obj.data.id);
719
764
  };
720
765
  switch (type) {
721
766
  case _types.ObjectType.locus:
@@ -826,10 +871,14 @@ var LocusInfo = exports.default = /*#__PURE__*/function (_EventsScope) {
826
871
  if (!object.data) {
827
872
  // self without data is handled inside HashTreeParser and results in LocusInfoUpdateType.MEETING_ENDED, so we should never get here
828
873
  // all other types info, fullstate, etc - Locus should never send them without data
829
- _loggerProxy.default.logger.warn("Locus-info:index#updateLocusFromHashTreeObject --> received ".concat(type, " object without data, this is not expected! version=").concat(object.htMeta.elementId.version));
874
+ // but we end up with this method being called without the data for them when the main dataset is removed from visible datasets list
875
+ _loggerProxy.default.logger.info("Locus-info:index#updateLocusFromHashTreeObject --> received ".concat(type, " object without data, version=").concat(object.htMeta.elementId.version));
830
876
  } else {
831
877
  var _locus$info, _object$data$controls, _object$data$controls2, _object$data$controls3;
832
878
  _loggerProxy.default.logger.info("Locus-info:index#updateLocusFromHashTreeObject --> ".concat(type, " object updated to version ").concat(object.htMeta.elementId.version));
879
+ if (type === _types.ObjectType.self) {
880
+ _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));
881
+ }
833
882
  var locusDtoKey = _types.ObjectTypeToLocusKeyMap[type];
834
883
  locus[locusDtoKey] = object.data;
835
884
 
@@ -879,6 +928,81 @@ var LocusInfo = exports.default = /*#__PURE__*/function (_EventsScope) {
879
928
  }
880
929
  }
881
930
 
931
+ /**
932
+ * Helper that handles the common logic for reactivating a stopped HashTreeParser when
933
+ * a newer "replaces" is detected. Used by both the message and API response parser switch methods.
934
+ *
935
+ * @param {string} callerName - name of the calling method, used in log messages
936
+ * @param {string} locusUrl - the locus URL of the stopped parser
937
+ * @param {HashTreeParserEntry} stoppedEntry - the stopped parser entry
938
+ * @param {ReplacesInfo} replaces - replacement info extracted from self
939
+ * @param {Function} resumeCallback - callback to invoke after reactivation to resume the parser
940
+ * @returns {void}
941
+ */
942
+ }, {
943
+ key: "resumeStoppedParser",
944
+ value: function resumeStoppedParser(callerName, locusUrl, stoppedEntry, replaces, resumeCallback) {
945
+ // this check is just for typescript, it should never happen, replaces should always be defined
946
+ if (!replaces) {
947
+ _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"));
948
+ return;
949
+ }
950
+ if (replaces.replacedAt <= (stoppedEntry.replacedAt || '')) {
951
+ _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"));
952
+ return;
953
+ }
954
+ _loggerProxy.default.logger.info("Locus-info:index#".concat(callerName, " --> reactivating HashTreeParser for locusUrl=").concat(locusUrl, ", which replaces ").concat(replaces.locusUrl));
955
+ var replacedEntry = this.hashTreeParsers.get(replaces.locusUrl);
956
+ if (replacedEntry) {
957
+ replacedEntry.replacedAt = replaces.replacedAt;
958
+ replacedEntry.parser.stop();
959
+ } else {
960
+ _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));
961
+ }
962
+ stoppedEntry.initializedFromHashTree = false;
963
+ this.hashTreeObjectId2ParticipantId.clear();
964
+ resumeCallback();
965
+ }
966
+
967
+ /**
968
+ * Handles an API response whose locusUrl doesn't match any active HashTreeParser
969
+ * (either no entry exists, or the existing entry is stopped).
970
+ * Creates a new parser or reactivates a stopped one using initializeFromGetLociResponse.
971
+ *
972
+ * @param {string} locusUrl - the locus URL from the API response
973
+ * @param {LocusDTO} locus - the locus DTO from the API response
974
+ * @returns {void}
975
+ */
976
+ }, {
977
+ key: "handleHashTreeParserSwitchForAPIResponse",
978
+ value: function handleHashTreeParserSwitchForAPIResponse(locusUrl, locus) {
979
+ var entry = this.hashTreeParsers.get(locusUrl);
980
+ var replaces = getReplaceInfoFromSelf(locus.self,
981
+ // @ts-ignore
982
+ this.webex.internal.device.url);
983
+ if (!entry) {
984
+ _loggerProxy.default.logger.info("Locus-info:index#handleHashTreeParserSwitchForAPIResponse --> no parser for locusUrl ".concat(locusUrl, ", creating a new one"));
985
+ var parser = this.createHashTreeParser({
986
+ locusUrl: locusUrl,
987
+ initialLocus: {
988
+ locus: null,
989
+ dataSets: []
990
+ },
991
+ metadata: null,
992
+ replacedAt: replaces === null || replaces === void 0 ? void 0 : replaces.replacedAt
993
+ });
994
+ parser.initializeFromGetLociResponse(locus);
995
+ return;
996
+ }
997
+ if (entry.parser.state !== 'stopped') {
998
+ _loggerProxy.default.logger.warn("Locus-info:index#handleHashTreeParserSwitchForAPIResponse --> unexpected parser state \"".concat(entry.parser.state, "\" for locusUrl ").concat(locusUrl));
999
+ return;
1000
+ }
1001
+ this.resumeStoppedParser('handleHashTreeParserSwitchForAPIResponse', locusUrl, entry, replaces, function () {
1002
+ return entry.parser.resumeFromApiResponse(locus);
1003
+ });
1004
+ }
1005
+
882
1006
  /**
883
1007
  * Checks if the hash tree message should trigger a switch to a different HashTreeParser
884
1008
  *
@@ -903,7 +1027,7 @@ var LocusInfo = exports.default = /*#__PURE__*/function (_EventsScope) {
903
1027
  var metadata = (_message$locusStateEl5 = message.locusStateElements) === null || _message$locusStateEl5 === void 0 ? void 0 : _message$locusStateEl5.find(function (el) {
904
1028
  return (0, _utils.isMetadata)(el);
905
1029
  });
906
- if ((metadata === null || metadata === void 0 ? void 0 : (_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) {
1030
+ 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) {
907
1031
  _loggerProxy.default.logger.info("Locus-info:index#handleHashTreeParserSwitch --> no hash tree parser found for locusUrl ".concat(message.locusUrl, ", creating a new one"));
908
1032
  var parser = this.createHashTreeParser({
909
1033
  locusUrl: message.locusUrl,
@@ -926,25 +1050,9 @@ var LocusInfo = exports.default = /*#__PURE__*/function (_EventsScope) {
926
1050
  if (entry.parser.state === 'stopped') {
927
1051
  // 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
928
1052
  // this happens when you move from breakout A -> breakout B -> back to breakout A
929
- if (replaces) {
930
- if (replaces.replacedAt > (entry.replacedAt || '')) {
931
- _loggerProxy.default.logger.info("Locus-info:index#handleHashTreeParserSwitch --> resuming a HashTreeParser for locusUrl=".concat(message.locusUrl, ", which replaces ").concat(replaces.locusUrl));
932
- var replacedEntry = this.hashTreeParsers.get(replaces.locusUrl);
933
- if (replacedEntry) {
934
- replacedEntry.replacedAt = replaces.replacedAt;
935
- entry.initializedFromHashTree = false;
936
- this.hashTreeObjectId2ParticipantId.clear();
937
- replacedEntry.parser.stop();
938
- entry.parser.resume(message);
939
- } else {
940
- _loggerProxy.default.logger.warn("Locus-info:index#handleHashTreeParserSwitch --> the parser that is supposed to be replaced with the currently resumed parser is not found, locusUrl=".concat(replaces.locusUrl));
941
- }
942
- } else {
943
- _loggerProxy.default.logger.info("Locus-info:index#handleHashTreeParserSwitch --> received message for stopped HashTreeParser with locusUrl ".concat(message.locusUrl, ", but replaces info provided is not newer, so not re-activating the parser"));
944
- }
945
- return true;
946
- }
947
- _loggerProxy.default.logger.info("Locus-info:index#handleHashTreeParserSwitch --> received message for stopped HashTreeParser with locusUrl ".concat(message.locusUrl, ", but no replaces info provided, so not re-activating the parser"));
1053
+ this.resumeStoppedParser('handleHashTreeParserSwitch', message.locusUrl, entry, replaces, function () {
1054
+ return entry.parser.resumeFromMessage(message);
1055
+ });
948
1056
  return true;
949
1057
  }
950
1058
  return false;
@@ -970,23 +1078,90 @@ var LocusInfo = exports.default = /*#__PURE__*/function (_EventsScope) {
970
1078
  return;
971
1079
  }
972
1080
  var entry = this.hashTreeParsers.get(message.locusUrl);
973
- entry.parser.handleMessage(message);
1081
+
1082
+ // the check is just for typescript, the case of no entry in hashTreeParsers is handled in handleHashTreeParserSwitch() above
1083
+ if (entry) {
1084
+ entry.parser.handleMessage(message);
1085
+ }
974
1086
  }
975
1087
 
1088
+ /**
1089
+ * Triggers a sync of all hash tree datasets for all hash tree parsers associated with this meeting.
1090
+ * The syncs are executed sequentially within each parser.
1091
+ *
1092
+ * @param {Object} [options={}] - Options for syncing
1093
+ * @param {boolean} [options.onlyLLM=false] - Whether to sync only LLM based data sets
1094
+ * @returns {Promise<void>}
1095
+ */
1096
+ }, {
1097
+ key: "syncAllHashTreeDatasets",
1098
+ value: (function () {
1099
+ var _syncAllHashTreeDatasets = (0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee2() {
1100
+ var options,
1101
+ _iterator3,
1102
+ _step3,
1103
+ _step3$value,
1104
+ entry,
1105
+ _args2 = arguments,
1106
+ _t2;
1107
+ return _regenerator.default.wrap(function (_context2) {
1108
+ while (1) switch (_context2.prev = _context2.next) {
1109
+ case 0:
1110
+ options = _args2.length > 0 && _args2[0] !== undefined ? _args2[0] : {};
1111
+ _iterator3 = _createForOfIteratorHelper(this.hashTreeParsers);
1112
+ _context2.prev = 1;
1113
+ _iterator3.s();
1114
+ case 2:
1115
+ if ((_step3 = _iterator3.n()).done) {
1116
+ _context2.next = 4;
1117
+ break;
1118
+ }
1119
+ _step3$value = (0, _slicedToArray2.default)(_step3.value, 2), entry = _step3$value[1];
1120
+ if (!entry.parser) {
1121
+ _context2.next = 3;
1122
+ break;
1123
+ }
1124
+ _context2.next = 3;
1125
+ return entry.parser.syncAllDatasets(options);
1126
+ case 3:
1127
+ _context2.next = 2;
1128
+ break;
1129
+ case 4:
1130
+ _context2.next = 6;
1131
+ break;
1132
+ case 5:
1133
+ _context2.prev = 5;
1134
+ _t2 = _context2["catch"](1);
1135
+ _iterator3.e(_t2);
1136
+ case 6:
1137
+ _context2.prev = 6;
1138
+ _iterator3.f();
1139
+ return _context2.finish(6);
1140
+ case 7:
1141
+ case "end":
1142
+ return _context2.stop();
1143
+ }
1144
+ }, _callee2, this, [[1, 5, 6, 7]]);
1145
+ }));
1146
+ function syncAllHashTreeDatasets() {
1147
+ return _syncAllHashTreeDatasets.apply(this, arguments);
1148
+ }
1149
+ return syncAllHashTreeDatasets;
1150
+ }()
976
1151
  /**
977
1152
  * Callback registered with HashTreeParser to receive locus info updates.
978
1153
  * Updates our locus info based on the data parsed by the hash tree parser.
979
1154
  *
980
1155
  * @param {string} locusUrl - the locus URL for which the update is received
981
- * @param {LocusInfoUpdateType} updateType - The type of update received.
982
- * @param {Object} [data] - Additional data for the update, if applicable.
1156
+ * @param {LocusInfoUpdate} update - Details about the update.
983
1157
  * @returns {void}
984
1158
  */
1159
+ )
985
1160
  }, {
986
1161
  key: "updateFromHashTree",
987
- value: function updateFromHashTree(locusUrl, updateType, data) {
988
- var _this5 = this;
989
- switch (updateType) {
1162
+ value: function updateFromHashTree(locusUrl, update) {
1163
+ var _this6 = this;
1164
+ switch (update.updateType) {
990
1165
  case _hashTreeParser2.LocusInfoUpdateType.OBJECTS_UPDATED:
991
1166
  {
992
1167
  // initialize our new locus
@@ -1000,7 +1175,7 @@ var LocusInfo = exports.default = /*#__PURE__*/function (_EventsScope) {
1000
1175
 
1001
1176
  // first go over all the updates and check what happens with the main locus object
1002
1177
  var locusObjectStateAfterUpdates = LocusObjectStateAfterUpdates.unchanged;
1003
- data.updatedObjects.forEach(function (object) {
1178
+ update.updatedObjects.forEach(function (object) {
1004
1179
  if (object.htMeta.elementId.type.toLowerCase() === _types.ObjectType.locus) {
1005
1180
  if (locusObjectStateAfterUpdates === LocusObjectStateAfterUpdates.updated) {
1006
1181
  var _object$data;
@@ -1009,7 +1184,7 @@ var LocusInfo = exports.default = /*#__PURE__*/function (_EventsScope) {
1009
1184
  // but these should never happen
1010
1185
  _loggerProxy.default.logger.warn("Locus-info:index#updateFromHashTree --> received multiple LOCUS objects in one update, this is unexpected!");
1011
1186
  _metrics.default.sendBehavioralMetric(_constants2.default.LOCUS_HASH_TREE_UNSUPPORTED_OPERATION, {
1012
- locusUrl: ((_object$data = object.data) === null || _object$data === void 0 ? void 0 : _object$data.url) || _this5.url,
1187
+ locusUrl: ((_object$data = object.data) === null || _object$data === void 0 ? void 0 : _object$data.url) || _this6.url,
1013
1188
  message: object.data ? 'multiple LOCUS object updates' : 'LOCUS object update followed by removal'
1014
1189
  });
1015
1190
  }
@@ -1021,12 +1196,17 @@ var LocusInfo = exports.default = /*#__PURE__*/function (_EventsScope) {
1021
1196
  }
1022
1197
  });
1023
1198
  var hashTreeParserEntry = this.hashTreeParsers.get(locusUrl);
1199
+ if (!hashTreeParserEntry) {
1200
+ _loggerProxy.default.logger.warn("Locus-info:index#updateFromHashTree --> no HashTreeParser found for locusUrl ".concat(locusUrl, " when trying to apply updates from hash tree"));
1201
+ return;
1202
+ }
1024
1203
  if (!hashTreeParserEntry.initializedFromHashTree) {
1025
1204
  // this is the first time we're getting an update for this locusUrl,
1026
1205
  // so it's probably a move to/from breakout. We need to start from a clean state,
1027
1206
  // so empty locus and we rely on Locus giving us sufficient data in the updates to populate it.
1028
1207
  _loggerProxy.default.logger.info("Locus-info:index#updateFromHashTree --> first INITIAL update for locusUrl ".concat(locusUrl, ", starting from empty state"));
1029
1208
  hashTreeParserEntry.initializedFromHashTree = true;
1209
+ // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
1030
1210
  locus.jsSdkMeta.forceReplaceMembers = true;
1031
1211
  } else if (
1032
1212
  // if Locus object is unchanged or removed, we need to keep using the existing locus
@@ -1038,7 +1218,7 @@ var LocusInfo = exports.default = /*#__PURE__*/function (_EventsScope) {
1038
1218
  // copy over all of existing locus except participants
1039
1219
  LocusDtoTopLevelKeys.forEach(function (key) {
1040
1220
  if (key !== 'participants') {
1041
- locus[key] = (0, _lodash.cloneDeep)(_this5[key]);
1221
+ locus[key] = (0, _lodash.cloneDeep)(_this6[key]);
1042
1222
  }
1043
1223
  });
1044
1224
  } else {
@@ -1046,11 +1226,11 @@ var LocusInfo = exports.default = /*#__PURE__*/function (_EventsScope) {
1046
1226
  // (except participants, which need to stay empty - that means "no participant changes")
1047
1227
  (0, _values.default)(_types.ObjectTypeToLocusKeyMap).forEach(function (locusDtoKey) {
1048
1228
  if (locusDtoKey !== 'participants') {
1049
- locus[locusDtoKey] = (0, _lodash.cloneDeep)(_this5[locusDtoKey]);
1229
+ locus[locusDtoKey] = (0, _lodash.cloneDeep)(_this6[locusDtoKey]);
1050
1230
  }
1051
1231
  });
1052
1232
  }
1053
- _loggerProxy.default.logger.info("Locus-info:index#updateFromHashTree --> LOCUS object is ".concat(locusObjectStateAfterUpdates, ", all updates: ").concat((0, _stringify.default)(data.updatedObjects.map(function (o) {
1233
+ _loggerProxy.default.logger.info("Locus-info:index#updateFromHashTree --> LOCUS object is ".concat(locusObjectStateAfterUpdates, ", all updates: ").concat((0, _stringify.default)(update.updatedObjects.map(function (o) {
1054
1234
  return {
1055
1235
  type: o.htMeta.elementId.type,
1056
1236
  id: o.htMeta.elementId.id,
@@ -1058,8 +1238,8 @@ var LocusInfo = exports.default = /*#__PURE__*/function (_EventsScope) {
1058
1238
  };
1059
1239
  }))));
1060
1240
  // now apply all the updates from the hash tree onto the locus
1061
- data.updatedObjects.forEach(function (object) {
1062
- locus = _this5.updateLocusFromHashTreeObject(object, locus);
1241
+ update.updatedObjects.forEach(function (object) {
1242
+ locus = _this6.updateLocusFromHashTreeObject(object, locus);
1063
1243
  });
1064
1244
 
1065
1245
  // update our locus info with the new locus
@@ -1073,6 +1253,18 @@ var LocusInfo = exports.default = /*#__PURE__*/function (_EventsScope) {
1073
1253
  _loggerProxy.default.logger.info("Locus-info:index#updateFromHashTree --> received signal that meeting ended, destroying meeting ".concat(this.meetingId));
1074
1254
  this.webex.meetings.destroy(meeting, _constants.MEETING_REMOVED_REASON.SELF_REMOVED);
1075
1255
  }
1256
+ break;
1257
+ }
1258
+ case _hashTreeParser2.LocusInfoUpdateType.LOCUS_NOT_FOUND:
1259
+ {
1260
+ _loggerProxy.default.logger.info("Locus-info:index#updateFromHashTree --> received LOCUS_NOT_FOUND for ".concat(locusUrl, ", triggering syncMeetings"));
1261
+ this.webex.meetings.syncMeetings({
1262
+ keepOnlyLocusMeetings: false,
1263
+ skipHashTreeSync: true
1264
+ }).catch(function (syncError) {
1265
+ _loggerProxy.default.logger.error("Locus-info:index#updateFromHashTree --> syncMeetings failed after LOCUS_NOT_FOUND: ".concat(syncError));
1266
+ });
1267
+ break;
1076
1268
  }
1077
1269
  }
1078
1270
  }
@@ -1087,7 +1279,13 @@ var LocusInfo = exports.default = /*#__PURE__*/function (_EventsScope) {
1087
1279
  key: "parse",
1088
1280
  value: function parse(meeting, data) {
1089
1281
  if (this.hashTreeParsers.size > 0) {
1090
- this.handleHashTreeMessage(meeting, data.eventType, data.stateElementsMessage);
1282
+ if (data.eventType === _constants.LOCUSEVENT.SDK_LOCUS_FROM_SYNC_MEETINGS) {
1283
+ // sync meetings response follows the format of "not wrapped" locus API responses,
1284
+ // so has no dataSets nor Metadata
1285
+ this.handleLocusAPIResponse(meeting, _objectSpread({}, data.locus));
1286
+ } else {
1287
+ this.handleHashTreeMessage(meeting, data.eventType, data.stateElementsMessage);
1288
+ }
1091
1289
  } else {
1092
1290
  var eventType = data.eventType;
1093
1291
  if (eventType === _constants.LOCUSEVENT.HASH_TREE_DATA_UPDATED) {
@@ -1148,13 +1346,13 @@ var LocusInfo = exports.default = /*#__PURE__*/function (_EventsScope) {
1148
1346
  * @param {string} debugText string explaining the trigger for this call, added to logs for debugging purposes
1149
1347
  * @param {object} locus locus object
1150
1348
  * @param {object} metadata locus hash trees metadata
1151
- * @param {string} eventType locus event
1152
1349
  * @param {DataSet[]} dataSets
1350
+ * @param {string} eventType locus event
1153
1351
  * @returns {void}
1154
1352
  */
1155
1353
  }, {
1156
1354
  key: "onFullLocusWithHashTrees",
1157
- value: function onFullLocusWithHashTrees(debugText, locus, metadata, eventType, dataSets) {
1355
+ value: function onFullLocusWithHashTrees(debugText, locus, metadata, dataSets, eventType) {
1158
1356
  if (!this.hashTreeParsers.has(locus.url)) {
1159
1357
  _loggerProxy.default.logger.info("Locus-info:index#onFullLocus (".concat(debugText, ") --> creating hash tree parser for locusUrl=").concat(locus.url));
1160
1358
  _loggerProxy.default.logger.info("Locus-info:index#onFullLocus (".concat(debugText, ") --> dataSets:"), dataSets, ' and locus:', locus, ' and metadata:', metadata);
@@ -1167,6 +1365,7 @@ var LocusInfo = exports.default = /*#__PURE__*/function (_EventsScope) {
1167
1365
  metadata: metadata
1168
1366
  });
1169
1367
  // we have a full locus to start with, so we consider Locus info to be "initialized"
1368
+ // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
1170
1369
  this.hashTreeParsers.get(locus.url).initializedFromHashTree = true;
1171
1370
  this.onFullLocusCommon(locus, eventType);
1172
1371
  } else {
@@ -1221,7 +1420,7 @@ var LocusInfo = exports.default = /*#__PURE__*/function (_EventsScope) {
1221
1420
  throw new Error("Locus-info:index#onFullLocus (".concat(debugText, ") --> hash tree metadata is missing with full Locus"));
1222
1421
  }
1223
1422
  // this is the new hashmap Locus DTO format (only applicable to webinars for now)
1224
- this.onFullLocusWithHashTrees(debugText, locus, metadata, eventType, dataSets);
1423
+ this.onFullLocusWithHashTrees(debugText, locus, metadata, dataSets, eventType);
1225
1424
  } else {
1226
1425
  this.onFullLocusClassic(debugText, locus, eventType);
1227
1426
  }
@@ -1237,7 +1436,7 @@ var LocusInfo = exports.default = /*#__PURE__*/function (_EventsScope) {
1237
1436
  key: "onFullLocusCommon",
1238
1437
  value: function onFullLocusCommon(locus, eventType) {
1239
1438
  var _this$participants,
1240
- _this6 = this,
1439
+ _this7 = this,
1241
1440
  _locus$jsSdkMeta;
1242
1441
  this.scheduledMeeting = locus.meeting || null;
1243
1442
  this.participants = locus.participants;
@@ -1245,7 +1444,7 @@ var LocusInfo = exports.default = /*#__PURE__*/function (_EventsScope) {
1245
1444
  var _participant$htMeta;
1246
1445
  // participant.htMeta is set only for hash tree based locus
1247
1446
  if (typeof ((_participant$htMeta = participant.htMeta) === null || _participant$htMeta === void 0 ? void 0 : _participant$htMeta.elementId.id) === 'number') {
1248
- _this6.hashTreeObjectId2ParticipantId.set(participant.htMeta.elementId.id, participant.id);
1447
+ _this7.hashTreeObjectId2ParticipantId.set(participant.htMeta.elementId.id, participant.id);
1249
1448
  }
1250
1449
  });
1251
1450
  var isReplaceMembers = _controlsUtils.default.isNeedReplaceMembers(this.controls, locus.controls);
@@ -1353,8 +1552,7 @@ var LocusInfo = exports.default = /*#__PURE__*/function (_EventsScope) {
1353
1552
  }, {
1354
1553
  key: "updateLocusInfo",
1355
1554
  value: function updateLocusInfo(locus) {
1356
- var _locus$self2, _locus$self3;
1357
- if (((_locus$self2 = locus.self) === null || _locus$self2 === void 0 ? void 0 : _locus$self2.reason) === 'MOVED' && ((_locus$self3 = locus.self) === null || _locus$self3 === void 0 ? void 0 : _locus$self3.state) === 'LEFT') {
1555
+ if (_util.default.isSelfMovedOrBreakoutEnded(locus)) {
1358
1556
  // When moved to a breakout session locus sends a message for the previous locus
1359
1557
  // indicating that we have been moved. It isn't helpful to continue parsing this
1360
1558
  // as it gets interpreted as if we have left the call
@@ -1474,10 +1672,8 @@ var LocusInfo = exports.default = /*#__PURE__*/function (_EventsScope) {
1474
1672
  });
1475
1673
  }
1476
1674
  } else if (((_this$parsedLocus$ful6 = this.parsedLocus.fullState) === null || _this$parsedLocus$ful6 === void 0 ? void 0 : _this$parsedLocus$ful6.type) === _constants._MEETING_) {
1477
- if (this.fullState && (this.fullState.state === _constants.LOCUS.STATE.INACTIVE ||
1478
- // @ts-ignore
1479
- this.fullState.state === _constants.LOCUS.STATE.TERMINATING)) {
1480
- _loggerProxy.default.logger.warn('Locus-info:index#isMeetingActive --> Meeting is ending due to inactive or terminating');
1675
+ if (this.fullState && _util.default.isWholeMeetingEnded(this.fullState)) {
1676
+ _loggerProxy.default.logger.warn('Locus-info:index#isMeetingActive --> Meeting is ending due to inactive');
1481
1677
 
1482
1678
  // @ts-ignore
1483
1679
  this.webex.internal.newMetrics.submitClientEvent({
@@ -1579,11 +1775,11 @@ var LocusInfo = exports.default = /*#__PURE__*/function (_EventsScope) {
1579
1775
  isReplace: isReplace
1580
1776
  });
1581
1777
  if (participants && (0, _isArray.default)(participants) && participants.length > 0) {
1582
- var _iterator3 = _createForOfIteratorHelper(participants),
1583
- _step3;
1778
+ var _iterator4 = _createForOfIteratorHelper(participants),
1779
+ _step4;
1584
1780
  try {
1585
- for (_iterator3.s(); !(_step3 = _iterator3.n()).done;) {
1586
- var participant = _step3.value;
1781
+ for (_iterator4.s(); !(_step4 = _iterator4.n()).done;) {
1782
+ var participant = _step4.value;
1587
1783
  if (participant && (participant === null || participant === void 0 ? void 0 : participant.reason) === 'FAILURE') {
1588
1784
  var _participant$person;
1589
1785
  this.emitScoped({
@@ -1595,9 +1791,9 @@ var LocusInfo = exports.default = /*#__PURE__*/function (_EventsScope) {
1595
1791
  }
1596
1792
  }
1597
1793
  } catch (err) {
1598
- _iterator3.e(err);
1794
+ _iterator4.e(err);
1599
1795
  } finally {
1600
- _iterator3.f();
1796
+ _iterator4.f();
1601
1797
  }
1602
1798
  }
1603
1799
  }
@@ -1718,7 +1914,9 @@ var LocusInfo = exports.default = /*#__PURE__*/function (_EventsScope) {
1718
1914
  }, _constants.LOCUSINFO.EVENTS.CONTROLS_RECORDING_UPDATED, {
1719
1915
  state: state,
1720
1916
  modifiedBy: current.record.modifiedBy,
1721
- lastModified: current.record.lastModified
1917
+ lastModified: current.record.lastModified,
1918
+ modifiedByServiceAppName: current.record.modifiedByServiceAppName,
1919
+ modifiedByServiceAppId: current.record.modifiedByServiceAppId
1722
1920
  });
1723
1921
  }
1724
1922
  if (hasMeetingContainerChanged) {
@@ -2243,12 +2441,14 @@ var LocusInfo = exports.default = /*#__PURE__*/function (_EventsScope) {
2243
2441
  });
2244
2442
  }
2245
2443
  if (parsedSelves.updates.isMutedByOthersChanged) {
2444
+ var _parsedSelves$current2;
2246
2445
  this.emitScoped({
2247
2446
  file: 'locus-info',
2248
2447
  function: 'updateSelf'
2249
2448
  }, _constants.LOCUSINFO.EVENTS.SELF_REMOTE_MUTE_STATUS_UPDATED, {
2250
2449
  muted: parsedSelves.current.remoteMuted,
2251
- unmuteAllowed: parsedSelves.current.unmuteAllowed
2450
+ unmuteAllowed: parsedSelves.current.unmuteAllowed,
2451
+ modifiedBy: (_parsedSelves$current2 = parsedSelves.current.modifiedBy) !== null && _parsedSelves$current2 !== void 0 ? _parsedSelves$current2 : null
2252
2452
  });
2253
2453
  }
2254
2454
  if (parsedSelves.updates.localAudioUnmuteRequestedByServer) {
@@ -2278,14 +2478,14 @@ var LocusInfo = exports.default = /*#__PURE__*/function (_EventsScope) {
2278
2478
  _constants.LOCUSINFO.EVENTS.MEDIA_INACTIVITY, _selfUtils.default.getMediaStatus(self.mediaSessions));
2279
2479
  }
2280
2480
  if (parsedSelves.updates.audioStateChange || parsedSelves.updates.videoStateChange || parsedSelves.updates.shareStateChange) {
2281
- var _parsedSelves$current2, _parsedSelves$current3, _parsedSelves$current4;
2481
+ var _parsedSelves$current3, _parsedSelves$current4, _parsedSelves$current5;
2282
2482
  this.emitScoped({
2283
2483
  file: 'locus-info',
2284
2484
  function: 'updateSelf'
2285
2485
  }, _constants.LOCUSINFO.EVENTS.MEDIA_STATUS_CHANGE, {
2286
- audioStatus: (_parsedSelves$current2 = parsedSelves.current.currentMediaStatus) === null || _parsedSelves$current2 === void 0 ? void 0 : _parsedSelves$current2.audio,
2287
- videoStatus: (_parsedSelves$current3 = parsedSelves.current.currentMediaStatus) === null || _parsedSelves$current3 === void 0 ? void 0 : _parsedSelves$current3.video,
2288
- shareStatus: (_parsedSelves$current4 = parsedSelves.current.currentMediaStatus) === null || _parsedSelves$current4 === void 0 ? void 0 : _parsedSelves$current4.share
2486
+ audioStatus: (_parsedSelves$current3 = parsedSelves.current.currentMediaStatus) === null || _parsedSelves$current3 === void 0 ? void 0 : _parsedSelves$current3.audio,
2487
+ videoStatus: (_parsedSelves$current4 = parsedSelves.current.currentMediaStatus) === null || _parsedSelves$current4 === void 0 ? void 0 : _parsedSelves$current4.video,
2488
+ shareStatus: (_parsedSelves$current5 = parsedSelves.current.currentMediaStatus) === null || _parsedSelves$current5 === void 0 ? void 0 : _parsedSelves$current5.share
2289
2489
  });
2290
2490
  }
2291
2491
  if (parsedSelves.updates.isUserObserving) {
@@ -2467,7 +2667,7 @@ var LocusInfo = exports.default = /*#__PURE__*/function (_EventsScope) {
2467
2667
  }, {
2468
2668
  key: "updateMainSessionLocusCache",
2469
2669
  value: function updateMainSessionLocusCache(mainLocus) {
2470
- var _this7 = this;
2670
+ var _this8 = this;
2471
2671
  if (!mainLocus) {
2472
2672
  return;
2473
2673
  }
@@ -2476,7 +2676,7 @@ var LocusInfo = exports.default = /*#__PURE__*/function (_EventsScope) {
2476
2676
  // shallow merge and do special merge for participants
2477
2677
  (0, _lodash.assignWith)(this.mainSessionLocusCache, locusClone, function (objValue, srcValue, key) {
2478
2678
  if (key === 'participants') {
2479
- return _this7.mergeParticipants(objValue, srcValue);
2679
+ return _this8.mergeParticipants(objValue, srcValue);
2480
2680
  }
2481
2681
  return srcValue || objValue;
2482
2682
  });
@@ -2495,6 +2695,21 @@ var LocusInfo = exports.default = /*#__PURE__*/function (_EventsScope) {
2495
2695
  value: function clearMainSessionLocusCache() {
2496
2696
  this.mainSessionLocusCache = null;
2497
2697
  }
2698
+
2699
+ /**
2700
+ * Cleans up all hash tree parsers and clears internal maps.
2701
+ * @returns {void}
2702
+ * @memberof LocusInfo
2703
+ */
2704
+ }, {
2705
+ key: "cleanUp",
2706
+ value: function cleanUp() {
2707
+ this.hashTreeParsers.forEach(function (entry) {
2708
+ entry.parser.cleanUp();
2709
+ });
2710
+ this.hashTreeParsers.clear();
2711
+ this.hashTreeObjectId2ParticipantId.clear();
2712
+ }
2498
2713
  }]);
2499
2714
  }(_eventsScope.default);
2500
2715
  //# sourceMappingURL=index.js.map