@webex/plugin-meetings 3.12.0-next.5 → 3.12.0-next.50

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 (136) 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 +6 -2
  5. package/dist/breakouts/breakout.js.map +1 -1
  6. package/dist/breakouts/index.js +1 -1
  7. package/dist/config.js +1 -0
  8. package/dist/config.js.map +1 -1
  9. package/dist/constants.js +6 -3
  10. package/dist/constants.js.map +1 -1
  11. package/dist/controls-options-manager/constants.js +11 -1
  12. package/dist/controls-options-manager/constants.js.map +1 -1
  13. package/dist/controls-options-manager/index.js +38 -24
  14. package/dist/controls-options-manager/index.js.map +1 -1
  15. package/dist/controls-options-manager/util.js +91 -0
  16. package/dist/controls-options-manager/util.js.map +1 -1
  17. package/dist/hashTree/constants.js +10 -1
  18. package/dist/hashTree/constants.js.map +1 -1
  19. package/dist/hashTree/hashTreeParser.js +593 -358
  20. package/dist/hashTree/hashTreeParser.js.map +1 -1
  21. package/dist/hashTree/utils.js +22 -0
  22. package/dist/hashTree/utils.js.map +1 -1
  23. package/dist/index.js +7 -0
  24. package/dist/index.js.map +1 -1
  25. package/dist/interceptors/locusRetry.js +23 -8
  26. package/dist/interceptors/locusRetry.js.map +1 -1
  27. package/dist/interpretation/index.js +10 -1
  28. package/dist/interpretation/index.js.map +1 -1
  29. package/dist/interpretation/siLanguage.js +1 -1
  30. package/dist/locus-info/controlsUtils.js +4 -1
  31. package/dist/locus-info/controlsUtils.js.map +1 -1
  32. package/dist/locus-info/index.js +277 -86
  33. package/dist/locus-info/index.js.map +1 -1
  34. package/dist/locus-info/types.js +16 -0
  35. package/dist/locus-info/types.js.map +1 -1
  36. package/dist/media/properties.js +1 -0
  37. package/dist/media/properties.js.map +1 -1
  38. package/dist/meeting/in-meeting-actions.js +3 -1
  39. package/dist/meeting/in-meeting-actions.js.map +1 -1
  40. package/dist/meeting/index.js +842 -521
  41. package/dist/meeting/index.js.map +1 -1
  42. package/dist/meeting/util.js +19 -2
  43. package/dist/meeting/util.js.map +1 -1
  44. package/dist/meetings/index.js +199 -77
  45. package/dist/meetings/index.js.map +1 -1
  46. package/dist/meetings/meetings.types.js +6 -1
  47. package/dist/meetings/meetings.types.js.map +1 -1
  48. package/dist/meetings/request.js +39 -0
  49. package/dist/meetings/request.js.map +1 -1
  50. package/dist/meetings/util.js +67 -5
  51. package/dist/meetings/util.js.map +1 -1
  52. package/dist/member/index.js +10 -0
  53. package/dist/member/index.js.map +1 -1
  54. package/dist/member/types.js.map +1 -1
  55. package/dist/member/util.js +3 -0
  56. package/dist/member/util.js.map +1 -1
  57. package/dist/metrics/constants.js +2 -1
  58. package/dist/metrics/constants.js.map +1 -1
  59. package/dist/recording-controller/index.js +1 -3
  60. package/dist/recording-controller/index.js.map +1 -1
  61. package/dist/types/config.d.ts +1 -0
  62. package/dist/types/constants.d.ts +2 -0
  63. package/dist/types/controls-options-manager/constants.d.ts +6 -1
  64. package/dist/types/controls-options-manager/index.d.ts +10 -0
  65. package/dist/types/hashTree/constants.d.ts +1 -0
  66. package/dist/types/hashTree/hashTreeParser.d.ts +61 -15
  67. package/dist/types/hashTree/utils.d.ts +11 -0
  68. package/dist/types/index.d.ts +2 -0
  69. package/dist/types/interceptors/locusRetry.d.ts +4 -4
  70. package/dist/types/locus-info/index.d.ts +46 -6
  71. package/dist/types/locus-info/types.d.ts +17 -1
  72. package/dist/types/media/properties.d.ts +1 -0
  73. package/dist/types/meeting/in-meeting-actions.d.ts +2 -0
  74. package/dist/types/meeting/index.d.ts +70 -1
  75. package/dist/types/meeting/util.d.ts +8 -0
  76. package/dist/types/meetings/index.d.ts +18 -1
  77. package/dist/types/meetings/meetings.types.d.ts +15 -0
  78. package/dist/types/meetings/request.d.ts +14 -0
  79. package/dist/types/member/index.d.ts +1 -0
  80. package/dist/types/member/types.d.ts +1 -0
  81. package/dist/types/member/util.d.ts +1 -0
  82. package/dist/types/metrics/constants.d.ts +1 -0
  83. package/dist/webinar/index.js +361 -235
  84. package/dist/webinar/index.js.map +1 -1
  85. package/package.json +22 -22
  86. package/src/aiEnableRequest/index.ts +16 -0
  87. package/src/breakouts/breakout.ts +2 -1
  88. package/src/config.ts +1 -0
  89. package/src/constants.ts +5 -1
  90. package/src/controls-options-manager/constants.ts +14 -1
  91. package/src/controls-options-manager/index.ts +47 -24
  92. package/src/controls-options-manager/util.ts +81 -1
  93. package/src/hashTree/constants.ts +9 -0
  94. package/src/hashTree/hashTreeParser.ts +306 -160
  95. package/src/hashTree/utils.ts +17 -0
  96. package/src/index.ts +5 -0
  97. package/src/interceptors/locusRetry.ts +25 -4
  98. package/src/interpretation/index.ts +25 -8
  99. package/src/locus-info/controlsUtils.ts +3 -1
  100. package/src/locus-info/index.ts +276 -93
  101. package/src/locus-info/types.ts +19 -1
  102. package/src/media/properties.ts +1 -0
  103. package/src/meeting/in-meeting-actions.ts +4 -0
  104. package/src/meeting/index.ts +315 -26
  105. package/src/meeting/util.ts +20 -2
  106. package/src/meetings/index.ts +104 -43
  107. package/src/meetings/meetings.types.ts +19 -0
  108. package/src/meetings/request.ts +43 -0
  109. package/src/meetings/util.ts +80 -1
  110. package/src/member/index.ts +10 -0
  111. package/src/member/types.ts +1 -0
  112. package/src/member/util.ts +3 -0
  113. package/src/metrics/constants.ts +1 -0
  114. package/src/recording-controller/index.ts +1 -2
  115. package/src/webinar/index.ts +162 -21
  116. package/test/unit/spec/aiEnableRequest/index.ts +86 -0
  117. package/test/unit/spec/breakouts/breakout.ts +7 -3
  118. package/test/unit/spec/controls-options-manager/index.js +140 -29
  119. package/test/unit/spec/controls-options-manager/util.js +165 -0
  120. package/test/unit/spec/hashTree/hashTreeParser.ts +1294 -191
  121. package/test/unit/spec/hashTree/utils.ts +88 -1
  122. package/test/unit/spec/interceptors/locusRetry.ts +205 -4
  123. package/test/unit/spec/interpretation/index.ts +26 -4
  124. package/test/unit/spec/locus-info/controlsUtils.js +172 -57
  125. package/test/unit/spec/locus-info/index.js +443 -81
  126. package/test/unit/spec/meeting/in-meeting-actions.ts +2 -0
  127. package/test/unit/spec/meeting/index.js +836 -41
  128. package/test/unit/spec/meeting/muteState.js +3 -0
  129. package/test/unit/spec/meeting/utils.js +33 -0
  130. package/test/unit/spec/meetings/index.js +275 -10
  131. package/test/unit/spec/meetings/request.js +141 -0
  132. package/test/unit/spec/meetings/utils.js +161 -0
  133. package/test/unit/spec/member/index.js +7 -0
  134. package/test/unit/spec/member/util.js +24 -0
  135. package/test/unit/spec/recording-controller/index.js +9 -8
  136. package/test/unit/spec/webinar/index.ts +141 -16
@@ -64,7 +64,7 @@ var _noMeetingInfo = _interopRequireDefault(require("../common/errors/no-meeting
64
64
  var _joinForbiddenError = _interopRequireDefault(require("../common/errors/join-forbidden-error"));
65
65
  var _utils = require("../hashTree/utils");
66
66
  var _locusInfo = require("../locus-info");
67
- 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); }
67
+ 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 _t4 in e) "default" !== _t4 && {}.hasOwnProperty.call(e, _t4) && ((i = (o = _Object$defineProperty) && _Object$getOwnPropertyDescriptor(e, _t4)) && (i.get || i.set) ? o(f, _t4, i) : f[_t4] = e[_t4]); return f; })(e, t); }
68
68
  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; }
69
69
  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; }
70
70
  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)); }
@@ -354,11 +354,11 @@ var Meetings = exports.default = /*#__PURE__*/function (_WebexPlugin) {
354
354
  return (0, _createClass2.default)(Meetings, [{
355
355
  key: "isNeedHandleMainLocus",
356
356
  value: function isNeedHandleMainLocus(meeting, newLocus) {
357
- var _newLocus$controls, _newLocus$controls$br, _newLocus$self, _newLocus$self2, _newLocus$self3, _breakoutLocus$joined, _newLocus$self4;
357
+ var _newLocus$controls, _newLocus$controls$br, _newLocus$self, _breakoutLocus$joined, _newLocus$self2;
358
358
  var breakoutUrl = (_newLocus$controls = newLocus.controls) === null || _newLocus$controls === void 0 ? void 0 : (_newLocus$controls$br = _newLocus$controls.breakout) === null || _newLocus$controls$br === void 0 ? void 0 : _newLocus$controls$br.url;
359
359
  var breakoutLocus = this.meetingCollection.getActiveBreakoutLocus(breakoutUrl);
360
360
  var isSelfJoined = (newLocus === null || newLocus === void 0 ? void 0 : (_newLocus$self = newLocus.self) === null || _newLocus$self === void 0 ? void 0 : _newLocus$self.state) === _constants._JOINED_;
361
- var isSelfMoved = (newLocus === null || newLocus === void 0 ? void 0 : (_newLocus$self2 = newLocus.self) === null || _newLocus$self2 === void 0 ? void 0 : _newLocus$self2.state) === _constants._LEFT_ && (newLocus === null || newLocus === void 0 ? void 0 : (_newLocus$self3 = newLocus.self) === null || _newLocus$self3 === void 0 ? void 0 : _newLocus$self3.reason) === _constants._MOVED_;
361
+ var isSelfMoved = _util2.default.isSelfMovedOrBreakoutEnded(newLocus);
362
362
  // @ts-ignore
363
363
  var deviceFromNewLocus = _util2.default.getThisDevice(newLocus, this.webex.internal.device.url);
364
364
  var isResourceMovedOnThisDevice = (deviceFromNewLocus === null || deviceFromNewLocus === void 0 ? void 0 : deviceFromNewLocus.state) === _constants._LEFT_ && (deviceFromNewLocus === null || deviceFromNewLocus === void 0 ? void 0 : deviceFromNewLocus.reason) === _constants._MOVED_;
@@ -383,7 +383,7 @@ var Meetings = exports.default = /*#__PURE__*/function (_WebexPlugin) {
383
383
  _loggerProxy.default.logger.log("Meetings:index#isNeedHandleMainLocus --> there is active breakout session and joined on this device, and don't need to handle main session: ".concat(breakoutUrl));
384
384
  return false;
385
385
  }
386
- if (isSelfMoved && (newLocus !== null && newLocus !== void 0 && (_newLocus$self4 = newLocus.self) !== null && _newLocus$self4 !== void 0 && _newLocus$self4.removed || isResourceMovedOnThisDevice)) {
386
+ if (isSelfMoved && (newLocus !== null && newLocus !== void 0 && (_newLocus$self2 = newLocus.self) !== null && _newLocus$self2 !== void 0 && _newLocus$self2.removed || isResourceMovedOnThisDevice)) {
387
387
  _loggerProxy.default.logger.log('Meetings:index#isNeedHandleMainLocus --> self moved main locus with self removed status or with device resource moved, not need to handle');
388
388
  return false;
389
389
  }
@@ -407,15 +407,15 @@ var Meetings = exports.default = /*#__PURE__*/function (_WebexPlugin) {
407
407
  key: "isNeedHandleLocusDTO",
408
408
  value: function isNeedHandleLocusDTO(meeting, newLocus) {
409
409
  if (newLocus) {
410
- var _newLocus$self5, _newLocus$self6, _newLocus$self7, _newLocus$self7$devic, _newLocus$self7$devic2, _newLocus$self8, _newLocus$self8$devic, _newLocus$self8$devic2;
410
+ var _newLocus$self3, _newLocus$self3$devic, _newLocus$self3$devic2, _newLocus$self4, _newLocus$self4$devic, _newLocus$self4$devic2;
411
411
  var isNewLocusAsBreakout = _util2.default.isBreakoutLocusDTO(newLocus);
412
- var isSelfMoved = (newLocus === null || newLocus === void 0 ? void 0 : (_newLocus$self5 = newLocus.self) === null || _newLocus$self5 === void 0 ? void 0 : _newLocus$self5.state) === _constants._LEFT_ && (newLocus === null || newLocus === void 0 ? void 0 : (_newLocus$self6 = newLocus.self) === null || _newLocus$self6 === void 0 ? void 0 : _newLocus$self6.reason) === _constants._MOVED_;
413
- var isSelfMovedToLobby = (newLocus === null || newLocus === void 0 ? void 0 : (_newLocus$self7 = newLocus.self) === null || _newLocus$self7 === void 0 ? void 0 : (_newLocus$self7$devic = _newLocus$self7.devices[0]) === null || _newLocus$self7$devic === void 0 ? void 0 : (_newLocus$self7$devic2 = _newLocus$self7$devic.intent) === null || _newLocus$self7$devic2 === void 0 ? void 0 : _newLocus$self7$devic2.reason) === _constants._ON_HOLD_LOBBY_ && (newLocus === null || newLocus === void 0 ? void 0 : (_newLocus$self8 = newLocus.self) === null || _newLocus$self8 === void 0 ? void 0 : (_newLocus$self8$devic = _newLocus$self8.devices[0]) === null || _newLocus$self8$devic === void 0 ? void 0 : (_newLocus$self8$devic2 = _newLocus$self8$devic.intent) === null || _newLocus$self8$devic2 === void 0 ? void 0 : _newLocus$self8$devic2.type) === _constants._WAIT_;
412
+ var isSelfMoved = _util2.default.isSelfMovedOrBreakoutEnded(newLocus);
413
+ var isSelfMovedToLobby = (newLocus === null || newLocus === void 0 ? void 0 : (_newLocus$self3 = newLocus.self) === null || _newLocus$self3 === void 0 ? void 0 : (_newLocus$self3$devic = _newLocus$self3.devices[0]) === null || _newLocus$self3$devic === void 0 ? void 0 : (_newLocus$self3$devic2 = _newLocus$self3$devic.intent) === null || _newLocus$self3$devic2 === void 0 ? void 0 : _newLocus$self3$devic2.reason) === _constants._ON_HOLD_LOBBY_ && (newLocus === null || newLocus === void 0 ? void 0 : (_newLocus$self4 = newLocus.self) === null || _newLocus$self4 === void 0 ? void 0 : (_newLocus$self4$devic = _newLocus$self4.devices[0]) === null || _newLocus$self4$devic === void 0 ? void 0 : (_newLocus$self4$devic2 = _newLocus$self4$devic.intent) === null || _newLocus$self4$devic2 === void 0 ? void 0 : _newLocus$self4$devic2.type) === _constants._WAIT_;
414
414
  if (!meeting) {
415
415
  if (isNewLocusAsBreakout) {
416
- var _newLocus$fullState, _newLocus$self9;
416
+ var _newLocus$fullState, _newLocus$self5;
417
417
  _loggerProxy.default.logger.log("Meetings:index#isNeedHandleLocusDTO --> the first breakout session locusDTO active status: ".concat((_newLocus$fullState = newLocus.fullState) === null || _newLocus$fullState === void 0 ? void 0 : _newLocus$fullState.active));
418
- return ((_newLocus$self9 = newLocus.self) === null || _newLocus$self9 === void 0 ? void 0 : _newLocus$self9.state) === _constants._JOINED_;
418
+ return ((_newLocus$self5 = newLocus.self) === null || _newLocus$self5 === void 0 ? void 0 : _newLocus$self5.state) === _constants._JOINED_;
419
419
  }
420
420
  return this.isNeedHandleMainLocus(meeting, newLocus);
421
421
  }
@@ -451,9 +451,7 @@ var Meetings = exports.default = /*#__PURE__*/function (_WebexPlugin) {
451
451
  }
452
452
  if (data.eventType === _constants.LOCUSEVENT.HASH_TREE_DATA_UPDATED) {
453
453
  // need to check if maybe this event indicates a move to/from breakout
454
- var meetingForHashTreeMessage = (0, _locusInfo.findMeetingForHashTreeMessage)(data.stateElementsMessage, this.meetingCollection,
455
- // @ts-ignore
456
- this.webex.internal.device.url);
454
+ var meetingForHashTreeMessage = (0, _locusInfo.findMeetingForHashTreeMessage)(data === null || data === void 0 ? void 0 : data.stateElementsMessage, this.meetingCollection);
457
455
  if (meetingForHashTreeMessage) {
458
456
  return meetingForHashTreeMessage;
459
457
  }
@@ -493,7 +491,6 @@ var Meetings = exports.default = /*#__PURE__*/function (_WebexPlugin) {
493
491
  var _this2 = this;
494
492
  var useRandomDelayForInfo = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
495
493
  var meeting = this.getCorrespondingMeetingByLocus(data);
496
-
497
494
  // @ts-ignore
498
495
  if (this.config.experimental.storeLocusHashTreeEventsForDebugging) {
499
496
  (0, _meeting.storeEventForDebugging)('mercury', data);
@@ -573,6 +570,8 @@ var Meetings = exports.default = /*#__PURE__*/function (_WebexPlugin) {
573
570
  trigger: data.eventType === _constants.LOCUSEVENT.SDK_LOCUS_FROM_SYNC_MEETINGS ? 'get-loci-response' : 'locus-message',
574
571
  locus: data.locus,
575
572
  hashTreeMessage: data.stateElementsMessage
573
+ }, function (locus) {
574
+ meeting.finalizeMeetingAfterInitialLocusSetup(locus);
576
575
  });
577
576
  case 2:
578
577
  _context3.next = 4;
@@ -1275,6 +1274,31 @@ var Meetings = exports.default = /*#__PURE__*/function (_WebexPlugin) {
1275
1274
  return this.personalMeetingRoom;
1276
1275
  }
1277
1276
 
1277
+ /**
1278
+ * Fetches site preferences for the provided Webex site, or the preferred Webex site.
1279
+ * This is used to determine capabilities of the site, such as whether scheduling a webinar is supported.
1280
+ *
1281
+ * @param {object} [options]
1282
+ * @param {string} [options.siteUrl] - Webex site URL. Defaults to preferredWebexSite, for example "cisco.webex.com".
1283
+ * @param {string} [options.siteName] - Site name query override. Defaults to the site name derived from siteUrl, for example "cisco" for "cisco.webex.com".
1284
+ * @param {SitePreferenceSelectOption[]} [options.selectOptions] - Preference sections to fetch. Defaults to 'scheduling'.
1285
+ * @returns {Promise<SitePreferencesResponse>} site preferences response body
1286
+ * @throws {ParameterError}
1287
+ * @public
1288
+ * @memberof Meetings
1289
+ * @example
1290
+ * const preferences = await webex.meetings.fetchSitePreferencesMeViaSite();
1291
+ * const supportScheduleWebinar = preferences?.scheduling?.supportScheduleWebinar;
1292
+ */
1293
+ }, {
1294
+ key: "fetchSitePreferencesMeViaSite",
1295
+ value: function fetchSitePreferencesMeViaSite() {
1296
+ var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
1297
+ return this.request.fetchSitePreferencesMeViaSite(_objectSpread(_objectSpread({}, options), {}, {
1298
+ siteUrl: options.siteUrl || this.preferredWebexSite
1299
+ }));
1300
+ }
1301
+
1278
1302
  /**
1279
1303
  * Returns basic information about a meeting that exists or
1280
1304
  * used to exist in the MeetingCollection
@@ -1567,6 +1591,7 @@ var Meetings = exports.default = /*#__PURE__*/function (_WebexPlugin) {
1567
1591
  isMeetingActive,
1568
1592
  enableUnifiedMeetings,
1569
1593
  meetingInfoOptions,
1594
+ shouldDeferMeetingInfoFetch,
1570
1595
  meetingAddedType,
1571
1596
  _args4 = arguments,
1572
1597
  _t2;
@@ -1621,16 +1646,17 @@ var Meetings = exports.default = /*#__PURE__*/function (_WebexPlugin) {
1621
1646
  extraParams: infoExtraParams,
1622
1647
  sendCAevents: !!(callStateForMetrics !== null && callStateForMetrics !== void 0 && callStateForMetrics.correlationId) // if client sends correlation id as argument of public create(), then it means that this meeting creation is part of a pre-join intent from user
1623
1648
  };
1649
+ shouldDeferMeetingInfoFetch = type === _constants.DESTINATION_TYPE.LOCUS_ID && !(destination !== null && destination !== void 0 && destination.info);
1624
1650
  if (!meetingInfo) {
1625
1651
  _context4.next = 2;
1626
1652
  break;
1627
1653
  }
1628
1654
  meeting.injectMeetingInfo(meetingInfo, meetingInfoOptions, meetingLookupUrl);
1629
- _context4.next = 4;
1655
+ _context4.next = 6;
1630
1656
  break;
1631
1657
  case 2:
1632
1658
  if (!(type !== _constants.DESTINATION_TYPE.ONE_ON_ONE_CALL)) {
1633
- _context4.next = 4;
1659
+ _context4.next = 6;
1634
1660
  break;
1635
1661
  }
1636
1662
  if (!(enableUnifiedMeetings && !isMeetingActive && useRandomDelayForInfo && waitingTime > 0)) {
@@ -1641,41 +1667,54 @@ var Meetings = exports.default = /*#__PURE__*/function (_WebexPlugin) {
1641
1667
  return meeting.fetchMeetingInfo(meetingInfoOptions);
1642
1668
  }, waitingTime);
1643
1669
  meeting.parseMeetingInfo(undefined, destination);
1644
- _context4.next = 4;
1670
+ _context4.next = 6;
1645
1671
  break;
1646
1672
  case 3:
1673
+ if (shouldDeferMeetingInfoFetch) {
1674
+ _context4.next = 5;
1675
+ break;
1676
+ }
1647
1677
  _context4.next = 4;
1648
1678
  return meeting.fetchMeetingInfo(meetingInfoOptions);
1649
1679
  case 4:
1650
- _context4.next = 8;
1680
+ _context4.next = 6;
1651
1681
  break;
1652
1682
  case 5:
1653
- _context4.prev = 5;
1683
+ _loggerProxy.default.logger.info('Meetings:index#createMeeting --> defer fetchMeetingInfo for incomplete locus, will do it after locus initialSetup');
1684
+ case 6:
1685
+ _context4.next = 10;
1686
+ break;
1687
+ case 7:
1688
+ _context4.prev = 7;
1654
1689
  _t2 = _context4["catch"](1);
1655
1690
  if (!(!(_t2 instanceof _captchaError.default) && !(_t2 instanceof _passwordError.default) && !(_t2 instanceof _permission.default) && !(_t2 instanceof _joinWebinarError.default) && !(_t2 instanceof _joinForbiddenError.default))) {
1656
- _context4.next = 7;
1691
+ _context4.next = 9;
1657
1692
  break;
1658
1693
  }
1659
1694
  _loggerProxy.default.logger.info("Meetings:index#createMeeting --> Info Unable to fetch meeting info for ".concat(destination, "."));
1660
1695
  if (!failOnMissingMeetingInfo) {
1661
- _context4.next = 6;
1696
+ _context4.next = 8;
1662
1697
  break;
1663
1698
  }
1664
1699
  _loggerProxy.default.logger.info("Meetings:index#createMeeting --> Destroying meeting due to missing meeting info.");
1665
1700
  // @ts-ignore
1666
1701
  this.destroy(meeting, _constants.MEETING_REMOVED_REASON.MISSING_MEETING_INFO);
1667
1702
  throw new _noMeetingInfo.default();
1668
- case 6:
1703
+ case 8:
1669
1704
  // if there is no meeting info and no error should be thrown then we assume its a 1:1 call or wireless share
1670
1705
  _loggerProxy.default.logger.info('Meetings:index#createMeeting --> Info assuming this destination is a 1:1 or wireless share');
1671
- case 7:
1706
+ case 9:
1672
1707
  _loggerProxy.default.logger.debug("Meetings:index#createMeeting --> Debug ".concat(_t2, " fetching /meetingInfo for creation."));
1673
- case 8:
1674
- _context4.prev = 8;
1708
+ case 10:
1709
+ _context4.prev = 10;
1675
1710
  // For type LOCUS_ID we need to parse the locus object to get the information
1676
1711
  // about the caller and callee
1677
1712
  // Meeting Added event will be created in `handleLocusEvent`
1678
- if (type !== _constants.DESTINATION_TYPE.LOCUS_ID) {
1713
+ // Only emit MEETING_ADDED if the meeting still exists in the collection.
1714
+ // If fetchMeetingInfo failed and the meeting was destroyed in the catch block,
1715
+ // skip emitting to prevent orphaned meeting references on the consumer side.
1716
+ // @ts-ignore - getMeetingByType types value as object but accepts strings (same as handleLocusEvent)
1717
+ if (type !== _constants.DESTINATION_TYPE.LOCUS_ID && this.getMeetingByType(_constants._ID_, meeting.id)) {
1679
1718
  if (!meeting.sipUri) {
1680
1719
  meeting.setSipUri(destination);
1681
1720
  }
@@ -1691,14 +1730,14 @@ var Meetings = exports.default = /*#__PURE__*/function (_WebexPlugin) {
1691
1730
  type: meetingAddedType
1692
1731
  });
1693
1732
  }
1694
- return _context4.finish(8);
1695
- case 9:
1733
+ return _context4.finish(10);
1734
+ case 11:
1696
1735
  return _context4.abrupt("return", meeting);
1697
- case 10:
1736
+ case 12:
1698
1737
  case "end":
1699
1738
  return _context4.stop();
1700
1739
  }
1701
- }, _callee4, this, [[1, 5, 8, 9]]);
1740
+ }, _callee4, this, [[1, 7, 10, 11]]);
1702
1741
  }));
1703
1742
  function createMeeting(_x4) {
1704
1743
  return _createMeeting.apply(this, arguments);
@@ -1741,51 +1780,135 @@ var Meetings = exports.default = /*#__PURE__*/function (_WebexPlugin) {
1741
1780
  */
1742
1781
  }, {
1743
1782
  key: "syncMeetings",
1744
- value: function syncMeetings() {
1745
- var _this11 = this;
1746
- var _ref4 = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
1747
- _ref4$keepOnlyLocusMe = _ref4.keepOnlyLocusMeetings,
1748
- keepOnlyLocusMeetings = _ref4$keepOnlyLocusMe === void 0 ? true : _ref4$keepOnlyLocusMe;
1749
- // @ts-ignore
1750
- if (this.webex.credentials.isUnverifiedGuest) {
1751
- _loggerProxy.default.logger.info('Meetings:index#syncMeetings --> skipping meeting sync as unverified guest');
1752
- return _promise.default.resolve();
1753
- }
1754
- return this.request.getActiveMeetings().then(function (locusArray) {
1755
- var activeLocusUrl = [];
1756
- if (locusArray !== null && locusArray !== void 0 && locusArray.loci && locusArray.loci.length > 0) {
1757
- var lociToUpdate = _this11.sortLocusArrayToUpdate(locusArray.loci);
1758
- lociToUpdate.forEach(function (locus) {
1759
- activeLocusUrl.push(locus.url);
1760
- _this11.handleLocusEvent({
1761
- eventType: _constants.LOCUSEVENT.SDK_LOCUS_FROM_SYNC_MEETINGS,
1762
- locus: locus,
1763
- locusUrl: locus.url
1764
- });
1765
- });
1766
- }
1767
- var meetingsCollection = _this11.meetingCollection.getAll();
1768
- if ((0, _keys.default)(meetingsCollection).length > 0) {
1769
- // Sometimes the mercury events are lost after mercury reconnect
1770
- // Remove any Locus meetings that are not returned by Locus
1771
- // (they had a locusUrl previously but are no longer active) in the sync
1772
- for (var _i = 0, _Object$values = (0, _values.default)(meetingsCollection); _i < _Object$values.length; _i++) {
1773
- var meeting = _Object$values[_i];
1774
- // @ts-ignore
1775
- var locusUrl = meeting.locusUrl;
1776
- if ((keepOnlyLocusMeetings || locusUrl) && !activeLocusUrl.includes(locusUrl)) {
1777
- // destroy function also uploads logs
1778
- // @ts-ignore
1779
- _this11.destroy(meeting, _constants.MEETING_REMOVED_REASON.NO_MEETINGS_TO_SYNC);
1780
- }
1783
+ value: (function () {
1784
+ var _syncMeetings = (0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee5() {
1785
+ var _this11 = this;
1786
+ var _ref4,
1787
+ _ref4$keepOnlyLocusMe,
1788
+ keepOnlyLocusMeetings,
1789
+ locusArray,
1790
+ activeLocusUrl,
1791
+ lociToUpdate,
1792
+ meetingsCollection,
1793
+ _loop,
1794
+ _i,
1795
+ _Object$values,
1796
+ remainingMeetings,
1797
+ syncPromises,
1798
+ _i2,
1799
+ _arr,
1800
+ meeting,
1801
+ _args6 = arguments,
1802
+ _t3;
1803
+ return _regenerator.default.wrap(function (_context6) {
1804
+ while (1) switch (_context6.prev = _context6.next) {
1805
+ case 0:
1806
+ _ref4 = _args6.length > 0 && _args6[0] !== undefined ? _args6[0] : {}, _ref4$keepOnlyLocusMe = _ref4.keepOnlyLocusMeetings, keepOnlyLocusMeetings = _ref4$keepOnlyLocusMe === void 0 ? true : _ref4$keepOnlyLocusMe;
1807
+ if (!this.webex.credentials.isUnverifiedGuest) {
1808
+ _context6.next = 1;
1809
+ break;
1810
+ }
1811
+ _loggerProxy.default.logger.info('Meetings:index#syncMeetings --> user is unverified guest, skipping calling Locus for meeting sync');
1812
+ _context6.next = 7;
1813
+ break;
1814
+ case 1:
1815
+ _context6.prev = 1;
1816
+ _context6.next = 2;
1817
+ return this.request.getActiveMeetings();
1818
+ case 2:
1819
+ locusArray = _context6.sent;
1820
+ activeLocusUrl = [];
1821
+ if (locusArray !== null && locusArray !== void 0 && locusArray.loci && locusArray.loci.length > 0) {
1822
+ lociToUpdate = this.sortLocusArrayToUpdate(locusArray.loci);
1823
+ lociToUpdate.forEach(function (locus) {
1824
+ activeLocusUrl.push(locus.url);
1825
+ _this11.handleLocusEvent({
1826
+ eventType: _constants.LOCUSEVENT.SDK_LOCUS_FROM_SYNC_MEETINGS,
1827
+ locus: locus,
1828
+ locusUrl: locus.url
1829
+ });
1830
+ });
1831
+ }
1832
+ meetingsCollection = this.meetingCollection.getAll();
1833
+ if (!((0, _keys.default)(meetingsCollection).length > 0)) {
1834
+ _context6.next = 5;
1835
+ break;
1836
+ }
1837
+ _loop = /*#__PURE__*/_regenerator.default.mark(function _loop() {
1838
+ var meeting, locusUrl, locusInfo, _locusInfo$info, _locusArray$loci, globalMeetingId;
1839
+ return _regenerator.default.wrap(function (_context5) {
1840
+ while (1) switch (_context5.prev = _context5.next) {
1841
+ case 0:
1842
+ meeting = _Object$values[_i];
1843
+ // @ts-ignore
1844
+ locusUrl = meeting.locusUrl, locusInfo = meeting.locusInfo;
1845
+ if ((keepOnlyLocusMeetings || locusUrl) && !activeLocusUrl.includes(locusUrl)) {
1846
+ globalMeetingId = locusInfo === null || locusInfo === void 0 ? void 0 : (_locusInfo$info = locusInfo.info) === null || _locusInfo$info === void 0 ? void 0 : _locusInfo$info.globalMeetingId;
1847
+ if (globalMeetingId && locusArray !== null && locusArray !== void 0 && (_locusArray$loci = locusArray.loci) !== null && _locusArray$loci !== void 0 && _locusArray$loci.some(function (locus) {
1848
+ var _locus$info;
1849
+ return ((_locus$info = locus.info) === null || _locus$info === void 0 ? void 0 : _locus$info.globalMeetingId) === globalMeetingId;
1850
+ })) {
1851
+ // don't destroy the meeting as Locus API still returned some Locus that shares
1852
+ // the same globalMeetingId - that happens for example if a webinar user (who hasn't scheduled it)
1853
+ // is in a breakout and gets moved to a different breakout while we were offline
1854
+ } else {
1855
+ // destroy function also uploads logs
1856
+ // @ts-ignore
1857
+ _this11.destroy(meeting, _constants.MEETING_REMOVED_REASON.NO_MEETINGS_TO_SYNC);
1858
+ }
1859
+ }
1860
+ case 1:
1861
+ case "end":
1862
+ return _context5.stop();
1863
+ }
1864
+ }, _loop);
1865
+ });
1866
+ _i = 0, _Object$values = (0, _values.default)(meetingsCollection);
1867
+ case 3:
1868
+ if (!(_i < _Object$values.length)) {
1869
+ _context6.next = 5;
1870
+ break;
1871
+ }
1872
+ return _context6.delegateYield(_loop(), "t0", 4);
1873
+ case 4:
1874
+ _i++;
1875
+ _context6.next = 3;
1876
+ break;
1877
+ case 5:
1878
+ _context6.next = 7;
1879
+ break;
1880
+ case 6:
1881
+ _context6.prev = 6;
1882
+ _t3 = _context6["catch"](1);
1883
+ _loggerProxy.default.logger.error("Meetings:index#syncMeetings --> failed to sync meetings, ".concat(_t3));
1884
+ throw _t3;
1885
+ case 7:
1886
+ // Trigger hash tree syncs for all remaining meetings
1887
+ remainingMeetings = this.meetingCollection.getAll();
1888
+ syncPromises = [];
1889
+ for (_i2 = 0, _arr = (0, _values.default)(remainingMeetings); _i2 < _arr.length; _i2++) {
1890
+ meeting = _arr[_i2];
1891
+ if (meeting.locusInfo) {
1892
+ syncPromises.push(meeting.locusInfo.syncAllHashTreeDatasets());
1893
+ }
1894
+ }
1895
+ if (!(syncPromises.length > 0)) {
1896
+ _context6.next = 8;
1897
+ break;
1898
+ }
1899
+ _context6.next = 8;
1900
+ return _promise.default.all(syncPromises);
1901
+ case 8:
1902
+ case "end":
1903
+ return _context6.stop();
1781
1904
  }
1782
- }
1783
- }).catch(function (error) {
1784
- _loggerProxy.default.logger.error("Meetings:index#syncMeetings --> failed to sync meetings, ".concat(error));
1785
- throw new Error(error);
1786
- });
1787
- }
1788
-
1905
+ }, _callee5, this, [[1, 6]]);
1906
+ }));
1907
+ function syncMeetings() {
1908
+ return _syncMeetings.apply(this, arguments);
1909
+ }
1910
+ return syncMeetings;
1911
+ }()
1789
1912
  /**
1790
1913
  * sort out locus array for initial creating
1791
1914
  * @param {Array} loci original locus array
@@ -1793,6 +1916,7 @@ var Meetings = exports.default = /*#__PURE__*/function (_WebexPlugin) {
1793
1916
  * @public
1794
1917
  * @memberof Meetings
1795
1918
  */
1919
+ )
1796
1920
  }, {
1797
1921
  key: "sortLocusArrayToUpdate",
1798
1922
  value: function sortLocusArrayToUpdate(loci) {
@@ -1807,8 +1931,7 @@ var Meetings = exports.default = /*#__PURE__*/function (_WebexPlugin) {
1807
1931
  var lociToUpdate = (0, _toConsumableArray2.default)(mainLoci);
1808
1932
  breakoutLoci.forEach(function (breakoutLocus) {
1809
1933
  var associateMainLocus = mainLoci.find(function (mainLocus) {
1810
- var _mainLocus$controls, _mainLocus$controls$b, _breakoutLocus$contro, _breakoutLocus$contro2;
1811
- return ((_mainLocus$controls = mainLocus.controls) === null || _mainLocus$controls === void 0 ? void 0 : (_mainLocus$controls$b = _mainLocus$controls.breakout) === null || _mainLocus$controls$b === void 0 ? void 0 : _mainLocus$controls$b.url) === ((_breakoutLocus$contro = breakoutLocus.controls) === null || _breakoutLocus$contro === void 0 ? void 0 : (_breakoutLocus$contro2 = _breakoutLocus$contro.breakout) === null || _breakoutLocus$contro2 === void 0 ? void 0 : _breakoutLocus$contro2.url);
1934
+ return _util2.default.isMainAssociatedWithBreakout(mainLocus, breakoutLocus);
1812
1935
  });
1813
1936
  var existCorrespondingMeeting = _this12.getCorrespondingMeetingByLocus({
1814
1937
  eventType: _constants.LOCUSEVENT.SDK_NO_EVENT,
@@ -1844,8 +1967,7 @@ var Meetings = exports.default = /*#__PURE__*/function (_WebexPlugin) {
1844
1967
  return;
1845
1968
  }
1846
1969
  var existIndex = this.breakoutLocusForHandleLater.findIndex(function (breakoutLocus) {
1847
- var _breakoutLocus$contro3, _breakoutLocus$contro4, _newCreatedLocus$cont, _newCreatedLocus$cont2;
1848
- return ((_breakoutLocus$contro3 = breakoutLocus.controls) === null || _breakoutLocus$contro3 === void 0 ? void 0 : (_breakoutLocus$contro4 = _breakoutLocus$contro3.breakout) === null || _breakoutLocus$contro4 === void 0 ? void 0 : _breakoutLocus$contro4.url) === ((_newCreatedLocus$cont = newCreatedLocus.controls) === null || _newCreatedLocus$cont === void 0 ? void 0 : (_newCreatedLocus$cont2 = _newCreatedLocus$cont.breakout) === null || _newCreatedLocus$cont2 === void 0 ? void 0 : _newCreatedLocus$cont2.url);
1970
+ return _util2.default.isMainAssociatedWithBreakout(newCreatedLocus, breakoutLocus);
1849
1971
  });
1850
1972
  if (existIndex < 0) {
1851
1973
  return;