@webex/plugin-meetings 3.12.0-next.3 → 3.12.0-next.31

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 (90) hide show
  1. package/AGENTS.md +9 -0
  2. package/dist/aiEnableRequest/index.js +1 -1
  3. package/dist/breakouts/breakout.js +1 -1
  4. package/dist/breakouts/index.js +1 -1
  5. package/dist/constants.js +3 -1
  6. package/dist/constants.js.map +1 -1
  7. package/dist/controls-options-manager/constants.js +11 -1
  8. package/dist/controls-options-manager/constants.js.map +1 -1
  9. package/dist/controls-options-manager/index.js +23 -21
  10. package/dist/controls-options-manager/index.js.map +1 -1
  11. package/dist/controls-options-manager/util.js +91 -0
  12. package/dist/controls-options-manager/util.js.map +1 -1
  13. package/dist/hashTree/constants.js +10 -1
  14. package/dist/hashTree/constants.js.map +1 -1
  15. package/dist/hashTree/hashTreeParser.js +550 -346
  16. package/dist/hashTree/hashTreeParser.js.map +1 -1
  17. package/dist/hashTree/utils.js +22 -0
  18. package/dist/hashTree/utils.js.map +1 -1
  19. package/dist/interceptors/locusRetry.js +23 -8
  20. package/dist/interceptors/locusRetry.js.map +1 -1
  21. package/dist/interpretation/index.js +1 -1
  22. package/dist/interpretation/siLanguage.js +1 -1
  23. package/dist/locus-info/index.js +222 -61
  24. package/dist/locus-info/index.js.map +1 -1
  25. package/dist/meeting/index.js +372 -292
  26. package/dist/meeting/index.js.map +1 -1
  27. package/dist/meeting/util.js +1 -0
  28. package/dist/meeting/util.js.map +1 -1
  29. package/dist/meetings/index.js +146 -62
  30. package/dist/meetings/index.js.map +1 -1
  31. package/dist/meetings/util.js +39 -5
  32. package/dist/meetings/util.js.map +1 -1
  33. package/dist/member/index.js +10 -0
  34. package/dist/member/index.js.map +1 -1
  35. package/dist/member/types.js.map +1 -1
  36. package/dist/member/util.js +3 -0
  37. package/dist/member/util.js.map +1 -1
  38. package/dist/metrics/constants.js +5 -1
  39. package/dist/metrics/constants.js.map +1 -1
  40. package/dist/multistream/sendSlotManager.js +116 -2
  41. package/dist/multistream/sendSlotManager.js.map +1 -1
  42. package/dist/types/constants.d.ts +1 -0
  43. package/dist/types/controls-options-manager/constants.d.ts +6 -1
  44. package/dist/types/hashTree/constants.d.ts +1 -0
  45. package/dist/types/hashTree/hashTreeParser.d.ts +53 -15
  46. package/dist/types/hashTree/utils.d.ts +11 -0
  47. package/dist/types/interceptors/locusRetry.d.ts +4 -4
  48. package/dist/types/locus-info/index.d.ts +38 -5
  49. package/dist/types/meeting/index.d.ts +11 -0
  50. package/dist/types/member/index.d.ts +1 -0
  51. package/dist/types/member/types.d.ts +1 -0
  52. package/dist/types/member/util.d.ts +1 -0
  53. package/dist/types/metrics/constants.d.ts +4 -0
  54. package/dist/types/multistream/sendSlotManager.d.ts +23 -1
  55. package/dist/webinar/index.js +301 -226
  56. package/dist/webinar/index.js.map +1 -1
  57. package/package.json +16 -16
  58. package/src/constants.ts +1 -0
  59. package/src/controls-options-manager/constants.ts +14 -1
  60. package/src/controls-options-manager/index.ts +26 -19
  61. package/src/controls-options-manager/util.ts +81 -1
  62. package/src/hashTree/constants.ts +9 -0
  63. package/src/hashTree/hashTreeParser.ts +273 -154
  64. package/src/hashTree/utils.ts +17 -0
  65. package/src/interceptors/locusRetry.ts +25 -4
  66. package/src/locus-info/index.ts +233 -79
  67. package/src/meeting/index.ts +98 -11
  68. package/src/meeting/util.ts +1 -0
  69. package/src/meetings/index.ts +58 -34
  70. package/src/meetings/util.ts +44 -1
  71. package/src/member/index.ts +10 -0
  72. package/src/member/types.ts +1 -0
  73. package/src/member/util.ts +3 -0
  74. package/src/metrics/constants.ts +5 -0
  75. package/src/multistream/sendSlotManager.ts +97 -3
  76. package/src/webinar/index.ts +75 -1
  77. package/test/unit/spec/controls-options-manager/index.js +114 -6
  78. package/test/unit/spec/controls-options-manager/util.js +165 -0
  79. package/test/unit/spec/hashTree/hashTreeParser.ts +839 -37
  80. package/test/unit/spec/hashTree/utils.ts +88 -1
  81. package/test/unit/spec/interceptors/locusRetry.ts +205 -4
  82. package/test/unit/spec/locus-info/index.js +262 -64
  83. package/test/unit/spec/meeting/index.js +54 -36
  84. package/test/unit/spec/meeting/utils.js +4 -0
  85. package/test/unit/spec/meetings/index.js +190 -8
  86. package/test/unit/spec/meetings/utils.js +124 -0
  87. package/test/unit/spec/member/index.js +7 -0
  88. package/test/unit/spec/member/util.js +24 -0
  89. package/test/unit/spec/multistream/sendSlotManager.ts +135 -36
  90. package/test/unit/spec/webinar/index.ts +60 -0
@@ -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
 
@@ -674,7 +676,19 @@ var LocusInfo = exports.default = /*#__PURE__*/function (_EventsScope) {
674
676
  var isWrapped = 'locus' in responseBody;
675
677
  var locusUrl = isWrapped ? (_responseBody$locus = responseBody.locus) === null || _responseBody$locus === void 0 ? void 0 : _responseBody$locus.url : responseBody.url;
676
678
  var hashTreeParserEntry = locusUrl && this.hashTreeParsers.get(locusUrl);
677
- if (hashTreeParserEntry) {
679
+ var locus = isWrapped ? responseBody.locus : responseBody;
680
+ if (this.hashTreeParsers.size > 0) {
681
+ // We are in hash tree mode. Check if we need to create/reactivate a parser for this locusUrl.
682
+ if (!hashTreeParserEntry || hashTreeParserEntry.parser.state === 'stopped') {
683
+ if (!locusUrl) {
684
+ _loggerProxy.default.logger.warn('Locus-info:index#handleLocusAPIResponse --> API response has no locusUrl, cannot handle hash tree parser switch');
685
+ return;
686
+ }
687
+ this.handleHashTreeParserSwitchForAPIResponse(locusUrl, locus);
688
+ return;
689
+ }
690
+
691
+ // Active parser found - pass the API response to it
678
692
  if (isWrapped) {
679
693
  if (!responseBody.dataSets) {
680
694
  this.sendClassicVsHashTreeMismatchMetric(meeting, "expected hash tree dataSets in API response but they are missing");
@@ -684,19 +698,21 @@ var LocusInfo = exports.default = /*#__PURE__*/function (_EventsScope) {
684
698
  // update the data in our hash trees
685
699
  hashTreeParserEntry.parser.handleLocusUpdate(responseBody);
686
700
  } else {
687
- // LocusDTO without wrapper - pass it through as if it had no dataSets
701
+ // LocusDTO without wrapper - pass it through as if it had no dataSets nor metadata
688
702
  hashTreeParserEntry.parser.handleLocusUpdate({
689
703
  locus: responseBody
690
704
  });
691
705
  }
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);
706
+ return;
707
+ }
708
+
709
+ // No hash tree parsers - classic Locus mode
710
+ if (isWrapped && responseBody.dataSets) {
711
+ this.sendClassicVsHashTreeMismatchMetric(meeting, "unexpected hash tree dataSets in API response");
699
712
  }
713
+
714
+ // classic Locus delta
715
+ this.handleLocusDelta(locus, meeting);
700
716
  }
701
717
 
702
718
  /**
@@ -879,6 +895,81 @@ var LocusInfo = exports.default = /*#__PURE__*/function (_EventsScope) {
879
895
  }
880
896
  }
881
897
 
898
+ /**
899
+ * Helper that handles the common logic for reactivating a stopped HashTreeParser when
900
+ * a newer "replaces" is detected. Used by both the message and API response parser switch methods.
901
+ *
902
+ * @param {string} callerName - name of the calling method, used in log messages
903
+ * @param {string} locusUrl - the locus URL of the stopped parser
904
+ * @param {HashTreeParserEntry} stoppedEntry - the stopped parser entry
905
+ * @param {ReplacesInfo} replaces - replacement info extracted from self
906
+ * @param {Function} resumeCallback - callback to invoke after reactivation to resume the parser
907
+ * @returns {void}
908
+ */
909
+ }, {
910
+ key: "resumeStoppedParser",
911
+ value: function resumeStoppedParser(callerName, locusUrl, stoppedEntry, replaces, resumeCallback) {
912
+ // this check is just for typescript, it should never happen, replaces should always be defined
913
+ if (!replaces) {
914
+ _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"));
915
+ return;
916
+ }
917
+ if (replaces.replacedAt <= (stoppedEntry.replacedAt || '')) {
918
+ _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"));
919
+ return;
920
+ }
921
+ _loggerProxy.default.logger.info("Locus-info:index#".concat(callerName, " --> reactivating HashTreeParser for locusUrl=").concat(locusUrl, ", which replaces ").concat(replaces.locusUrl));
922
+ var replacedEntry = this.hashTreeParsers.get(replaces.locusUrl);
923
+ if (replacedEntry) {
924
+ replacedEntry.replacedAt = replaces.replacedAt;
925
+ replacedEntry.parser.stop();
926
+ } else {
927
+ _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));
928
+ }
929
+ stoppedEntry.initializedFromHashTree = false;
930
+ this.hashTreeObjectId2ParticipantId.clear();
931
+ resumeCallback();
932
+ }
933
+
934
+ /**
935
+ * Handles an API response whose locusUrl doesn't match any active HashTreeParser
936
+ * (either no entry exists, or the existing entry is stopped).
937
+ * Creates a new parser or reactivates a stopped one using initializeFromGetLociResponse.
938
+ *
939
+ * @param {string} locusUrl - the locus URL from the API response
940
+ * @param {LocusDTO} locus - the locus DTO from the API response
941
+ * @returns {void}
942
+ */
943
+ }, {
944
+ key: "handleHashTreeParserSwitchForAPIResponse",
945
+ value: function handleHashTreeParserSwitchForAPIResponse(locusUrl, locus) {
946
+ var entry = this.hashTreeParsers.get(locusUrl);
947
+ var replaces = getReplaceInfoFromSelf(locus.self,
948
+ // @ts-ignore
949
+ this.webex.internal.device.url);
950
+ if (!entry) {
951
+ _loggerProxy.default.logger.info("Locus-info:index#handleHashTreeParserSwitchForAPIResponse --> no parser for locusUrl ".concat(locusUrl, ", creating a new one"));
952
+ var parser = this.createHashTreeParser({
953
+ locusUrl: locusUrl,
954
+ initialLocus: {
955
+ locus: null,
956
+ dataSets: []
957
+ },
958
+ metadata: null,
959
+ replacedAt: replaces === null || replaces === void 0 ? void 0 : replaces.replacedAt
960
+ });
961
+ parser.initializeFromGetLociResponse(locus);
962
+ return;
963
+ }
964
+ if (entry.parser.state !== 'stopped') {
965
+ _loggerProxy.default.logger.warn("Locus-info:index#handleHashTreeParserSwitchForAPIResponse --> unexpected parser state \"".concat(entry.parser.state, "\" for locusUrl ").concat(locusUrl));
966
+ return;
967
+ }
968
+ this.resumeStoppedParser('handleHashTreeParserSwitchForAPIResponse', locusUrl, entry, replaces, function () {
969
+ return entry.parser.resumeFromApiResponse(locus);
970
+ });
971
+ }
972
+
882
973
  /**
883
974
  * Checks if the hash tree message should trigger a switch to a different HashTreeParser
884
975
  *
@@ -903,7 +994,7 @@ var LocusInfo = exports.default = /*#__PURE__*/function (_EventsScope) {
903
994
  var metadata = (_message$locusStateEl5 = message.locusStateElements) === null || _message$locusStateEl5 === void 0 ? void 0 : _message$locusStateEl5.find(function (el) {
904
995
  return (0, _utils.isMetadata)(el);
905
996
  });
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) {
997
+ 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
998
  _loggerProxy.default.logger.info("Locus-info:index#handleHashTreeParserSwitch --> no hash tree parser found for locusUrl ".concat(message.locusUrl, ", creating a new one"));
908
999
  var parser = this.createHashTreeParser({
909
1000
  locusUrl: message.locusUrl,
@@ -926,25 +1017,9 @@ var LocusInfo = exports.default = /*#__PURE__*/function (_EventsScope) {
926
1017
  if (entry.parser.state === 'stopped') {
927
1018
  // 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
1019
  // 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"));
1020
+ this.resumeStoppedParser('handleHashTreeParserSwitch', message.locusUrl, entry, replaces, function () {
1021
+ return entry.parser.resumeFromMessage(message);
1022
+ });
948
1023
  return true;
949
1024
  }
950
1025
  return false;
@@ -970,23 +1045,81 @@ var LocusInfo = exports.default = /*#__PURE__*/function (_EventsScope) {
970
1045
  return;
971
1046
  }
972
1047
  var entry = this.hashTreeParsers.get(message.locusUrl);
973
- entry.parser.handleMessage(message);
1048
+
1049
+ // the check is just for typescript, the case of no entry in hashTreeParsers is handled in handleHashTreeParserSwitch() above
1050
+ if (entry) {
1051
+ entry.parser.handleMessage(message);
1052
+ }
974
1053
  }
975
1054
 
1055
+ /**
1056
+ * Triggers a sync of all hash tree datasets for all hash tree parsers associated with this meeting.
1057
+ * The syncs are executed sequentially within each parser.
1058
+ *
1059
+ * @returns {Promise<void>}
1060
+ */
1061
+ }, {
1062
+ key: "syncAllHashTreeDatasets",
1063
+ value: (function () {
1064
+ var _syncAllHashTreeDatasets = (0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee2() {
1065
+ var _iterator3, _step3, _step3$value, entry, _t2;
1066
+ return _regenerator.default.wrap(function (_context2) {
1067
+ while (1) switch (_context2.prev = _context2.next) {
1068
+ case 0:
1069
+ _iterator3 = _createForOfIteratorHelper(this.hashTreeParsers);
1070
+ _context2.prev = 1;
1071
+ _iterator3.s();
1072
+ case 2:
1073
+ if ((_step3 = _iterator3.n()).done) {
1074
+ _context2.next = 4;
1075
+ break;
1076
+ }
1077
+ _step3$value = (0, _slicedToArray2.default)(_step3.value, 2), entry = _step3$value[1];
1078
+ if (!entry.parser) {
1079
+ _context2.next = 3;
1080
+ break;
1081
+ }
1082
+ _context2.next = 3;
1083
+ return entry.parser.syncAllDatasets();
1084
+ case 3:
1085
+ _context2.next = 2;
1086
+ break;
1087
+ case 4:
1088
+ _context2.next = 6;
1089
+ break;
1090
+ case 5:
1091
+ _context2.prev = 5;
1092
+ _t2 = _context2["catch"](1);
1093
+ _iterator3.e(_t2);
1094
+ case 6:
1095
+ _context2.prev = 6;
1096
+ _iterator3.f();
1097
+ return _context2.finish(6);
1098
+ case 7:
1099
+ case "end":
1100
+ return _context2.stop();
1101
+ }
1102
+ }, _callee2, this, [[1, 5, 6, 7]]);
1103
+ }));
1104
+ function syncAllHashTreeDatasets() {
1105
+ return _syncAllHashTreeDatasets.apply(this, arguments);
1106
+ }
1107
+ return syncAllHashTreeDatasets;
1108
+ }()
976
1109
  /**
977
1110
  * Callback registered with HashTreeParser to receive locus info updates.
978
1111
  * Updates our locus info based on the data parsed by the hash tree parser.
979
1112
  *
980
1113
  * @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.
1114
+ * @param {LocusInfoUpdate} update - Details about the update.
983
1115
  * @returns {void}
984
1116
  */
1117
+ )
985
1118
  }, {
986
1119
  key: "updateFromHashTree",
987
- value: function updateFromHashTree(locusUrl, updateType, data) {
1120
+ value: function updateFromHashTree(locusUrl, update) {
988
1121
  var _this5 = this;
989
- switch (updateType) {
1122
+ switch (update.updateType) {
990
1123
  case _hashTreeParser2.LocusInfoUpdateType.OBJECTS_UPDATED:
991
1124
  {
992
1125
  // initialize our new locus
@@ -1000,7 +1133,7 @@ var LocusInfo = exports.default = /*#__PURE__*/function (_EventsScope) {
1000
1133
 
1001
1134
  // first go over all the updates and check what happens with the main locus object
1002
1135
  var locusObjectStateAfterUpdates = LocusObjectStateAfterUpdates.unchanged;
1003
- data.updatedObjects.forEach(function (object) {
1136
+ update.updatedObjects.forEach(function (object) {
1004
1137
  if (object.htMeta.elementId.type.toLowerCase() === _types.ObjectType.locus) {
1005
1138
  if (locusObjectStateAfterUpdates === LocusObjectStateAfterUpdates.updated) {
1006
1139
  var _object$data;
@@ -1021,12 +1154,17 @@ var LocusInfo = exports.default = /*#__PURE__*/function (_EventsScope) {
1021
1154
  }
1022
1155
  });
1023
1156
  var hashTreeParserEntry = this.hashTreeParsers.get(locusUrl);
1157
+ if (!hashTreeParserEntry) {
1158
+ _loggerProxy.default.logger.warn("Locus-info:index#updateFromHashTree --> no HashTreeParser found for locusUrl ".concat(locusUrl, " when trying to apply updates from hash tree"));
1159
+ return;
1160
+ }
1024
1161
  if (!hashTreeParserEntry.initializedFromHashTree) {
1025
1162
  // this is the first time we're getting an update for this locusUrl,
1026
1163
  // so it's probably a move to/from breakout. We need to start from a clean state,
1027
1164
  // so empty locus and we rely on Locus giving us sufficient data in the updates to populate it.
1028
1165
  _loggerProxy.default.logger.info("Locus-info:index#updateFromHashTree --> first INITIAL update for locusUrl ".concat(locusUrl, ", starting from empty state"));
1029
1166
  hashTreeParserEntry.initializedFromHashTree = true;
1167
+ // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
1030
1168
  locus.jsSdkMeta.forceReplaceMembers = true;
1031
1169
  } else if (
1032
1170
  // if Locus object is unchanged or removed, we need to keep using the existing locus
@@ -1050,7 +1188,7 @@ var LocusInfo = exports.default = /*#__PURE__*/function (_EventsScope) {
1050
1188
  }
1051
1189
  });
1052
1190
  }
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) {
1191
+ _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
1192
  return {
1055
1193
  type: o.htMeta.elementId.type,
1056
1194
  id: o.htMeta.elementId.id,
@@ -1058,7 +1196,7 @@ var LocusInfo = exports.default = /*#__PURE__*/function (_EventsScope) {
1058
1196
  };
1059
1197
  }))));
1060
1198
  // now apply all the updates from the hash tree onto the locus
1061
- data.updatedObjects.forEach(function (object) {
1199
+ update.updatedObjects.forEach(function (object) {
1062
1200
  locus = _this5.updateLocusFromHashTreeObject(object, locus);
1063
1201
  });
1064
1202
 
@@ -1087,7 +1225,13 @@ var LocusInfo = exports.default = /*#__PURE__*/function (_EventsScope) {
1087
1225
  key: "parse",
1088
1226
  value: function parse(meeting, data) {
1089
1227
  if (this.hashTreeParsers.size > 0) {
1090
- this.handleHashTreeMessage(meeting, data.eventType, data.stateElementsMessage);
1228
+ if (data.eventType === _constants.LOCUSEVENT.SDK_LOCUS_FROM_SYNC_MEETINGS) {
1229
+ // sync meetings response follows the format of "not wrapped" locus API responses,
1230
+ // so has no dataSets nor Metadata
1231
+ this.handleLocusAPIResponse(meeting, _objectSpread({}, data.locus));
1232
+ } else {
1233
+ this.handleHashTreeMessage(meeting, data.eventType, data.stateElementsMessage);
1234
+ }
1091
1235
  } else {
1092
1236
  var eventType = data.eventType;
1093
1237
  if (eventType === _constants.LOCUSEVENT.HASH_TREE_DATA_UPDATED) {
@@ -1148,13 +1292,13 @@ var LocusInfo = exports.default = /*#__PURE__*/function (_EventsScope) {
1148
1292
  * @param {string} debugText string explaining the trigger for this call, added to logs for debugging purposes
1149
1293
  * @param {object} locus locus object
1150
1294
  * @param {object} metadata locus hash trees metadata
1151
- * @param {string} eventType locus event
1152
1295
  * @param {DataSet[]} dataSets
1296
+ * @param {string} eventType locus event
1153
1297
  * @returns {void}
1154
1298
  */
1155
1299
  }, {
1156
1300
  key: "onFullLocusWithHashTrees",
1157
- value: function onFullLocusWithHashTrees(debugText, locus, metadata, eventType, dataSets) {
1301
+ value: function onFullLocusWithHashTrees(debugText, locus, metadata, dataSets, eventType) {
1158
1302
  if (!this.hashTreeParsers.has(locus.url)) {
1159
1303
  _loggerProxy.default.logger.info("Locus-info:index#onFullLocus (".concat(debugText, ") --> creating hash tree parser for locusUrl=").concat(locus.url));
1160
1304
  _loggerProxy.default.logger.info("Locus-info:index#onFullLocus (".concat(debugText, ") --> dataSets:"), dataSets, ' and locus:', locus, ' and metadata:', metadata);
@@ -1167,6 +1311,7 @@ var LocusInfo = exports.default = /*#__PURE__*/function (_EventsScope) {
1167
1311
  metadata: metadata
1168
1312
  });
1169
1313
  // we have a full locus to start with, so we consider Locus info to be "initialized"
1314
+ // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
1170
1315
  this.hashTreeParsers.get(locus.url).initializedFromHashTree = true;
1171
1316
  this.onFullLocusCommon(locus, eventType);
1172
1317
  } else {
@@ -1221,7 +1366,7 @@ var LocusInfo = exports.default = /*#__PURE__*/function (_EventsScope) {
1221
1366
  throw new Error("Locus-info:index#onFullLocus (".concat(debugText, ") --> hash tree metadata is missing with full Locus"));
1222
1367
  }
1223
1368
  // this is the new hashmap Locus DTO format (only applicable to webinars for now)
1224
- this.onFullLocusWithHashTrees(debugText, locus, metadata, eventType, dataSets);
1369
+ this.onFullLocusWithHashTrees(debugText, locus, metadata, dataSets, eventType);
1225
1370
  } else {
1226
1371
  this.onFullLocusClassic(debugText, locus, eventType);
1227
1372
  }
@@ -1353,8 +1498,7 @@ var LocusInfo = exports.default = /*#__PURE__*/function (_EventsScope) {
1353
1498
  }, {
1354
1499
  key: "updateLocusInfo",
1355
1500
  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') {
1501
+ if (_util.default.isSelfMovedOrBreakoutEnded(locus)) {
1358
1502
  // When moved to a breakout session locus sends a message for the previous locus
1359
1503
  // indicating that we have been moved. It isn't helpful to continue parsing this
1360
1504
  // as it gets interpreted as if we have left the call
@@ -1579,11 +1723,11 @@ var LocusInfo = exports.default = /*#__PURE__*/function (_EventsScope) {
1579
1723
  isReplace: isReplace
1580
1724
  });
1581
1725
  if (participants && (0, _isArray.default)(participants) && participants.length > 0) {
1582
- var _iterator3 = _createForOfIteratorHelper(participants),
1583
- _step3;
1726
+ var _iterator4 = _createForOfIteratorHelper(participants),
1727
+ _step4;
1584
1728
  try {
1585
- for (_iterator3.s(); !(_step3 = _iterator3.n()).done;) {
1586
- var participant = _step3.value;
1729
+ for (_iterator4.s(); !(_step4 = _iterator4.n()).done;) {
1730
+ var participant = _step4.value;
1587
1731
  if (participant && (participant === null || participant === void 0 ? void 0 : participant.reason) === 'FAILURE') {
1588
1732
  var _participant$person;
1589
1733
  this.emitScoped({
@@ -1595,9 +1739,9 @@ var LocusInfo = exports.default = /*#__PURE__*/function (_EventsScope) {
1595
1739
  }
1596
1740
  }
1597
1741
  } catch (err) {
1598
- _iterator3.e(err);
1742
+ _iterator4.e(err);
1599
1743
  } finally {
1600
- _iterator3.f();
1744
+ _iterator4.f();
1601
1745
  }
1602
1746
  }
1603
1747
  }
@@ -2243,12 +2387,14 @@ var LocusInfo = exports.default = /*#__PURE__*/function (_EventsScope) {
2243
2387
  });
2244
2388
  }
2245
2389
  if (parsedSelves.updates.isMutedByOthersChanged) {
2390
+ var _parsedSelves$current2;
2246
2391
  this.emitScoped({
2247
2392
  file: 'locus-info',
2248
2393
  function: 'updateSelf'
2249
2394
  }, _constants.LOCUSINFO.EVENTS.SELF_REMOTE_MUTE_STATUS_UPDATED, {
2250
2395
  muted: parsedSelves.current.remoteMuted,
2251
- unmuteAllowed: parsedSelves.current.unmuteAllowed
2396
+ unmuteAllowed: parsedSelves.current.unmuteAllowed,
2397
+ modifiedBy: (_parsedSelves$current2 = parsedSelves.current.modifiedBy) !== null && _parsedSelves$current2 !== void 0 ? _parsedSelves$current2 : null
2252
2398
  });
2253
2399
  }
2254
2400
  if (parsedSelves.updates.localAudioUnmuteRequestedByServer) {
@@ -2278,14 +2424,14 @@ var LocusInfo = exports.default = /*#__PURE__*/function (_EventsScope) {
2278
2424
  _constants.LOCUSINFO.EVENTS.MEDIA_INACTIVITY, _selfUtils.default.getMediaStatus(self.mediaSessions));
2279
2425
  }
2280
2426
  if (parsedSelves.updates.audioStateChange || parsedSelves.updates.videoStateChange || parsedSelves.updates.shareStateChange) {
2281
- var _parsedSelves$current2, _parsedSelves$current3, _parsedSelves$current4;
2427
+ var _parsedSelves$current3, _parsedSelves$current4, _parsedSelves$current5;
2282
2428
  this.emitScoped({
2283
2429
  file: 'locus-info',
2284
2430
  function: 'updateSelf'
2285
2431
  }, _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
2432
+ audioStatus: (_parsedSelves$current3 = parsedSelves.current.currentMediaStatus) === null || _parsedSelves$current3 === void 0 ? void 0 : _parsedSelves$current3.audio,
2433
+ videoStatus: (_parsedSelves$current4 = parsedSelves.current.currentMediaStatus) === null || _parsedSelves$current4 === void 0 ? void 0 : _parsedSelves$current4.video,
2434
+ shareStatus: (_parsedSelves$current5 = parsedSelves.current.currentMediaStatus) === null || _parsedSelves$current5 === void 0 ? void 0 : _parsedSelves$current5.share
2289
2435
  });
2290
2436
  }
2291
2437
  if (parsedSelves.updates.isUserObserving) {
@@ -2495,6 +2641,21 @@ var LocusInfo = exports.default = /*#__PURE__*/function (_EventsScope) {
2495
2641
  value: function clearMainSessionLocusCache() {
2496
2642
  this.mainSessionLocusCache = null;
2497
2643
  }
2644
+
2645
+ /**
2646
+ * Cleans up all hash tree parsers and clears internal maps.
2647
+ * @returns {void}
2648
+ * @memberof LocusInfo
2649
+ */
2650
+ }, {
2651
+ key: "cleanUp",
2652
+ value: function cleanUp() {
2653
+ this.hashTreeParsers.forEach(function (entry) {
2654
+ entry.parser.cleanUp();
2655
+ });
2656
+ this.hashTreeParsers.clear();
2657
+ this.hashTreeObjectId2ParticipantId.clear();
2658
+ }
2498
2659
  }]);
2499
2660
  }(_eventsScope.default);
2500
2661
  //# sourceMappingURL=index.js.map