@webex/plugin-meetings 3.12.0-next.4 → 3.12.0-next.40

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 +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/constants.js +1 -1
  8. package/dist/constants.js.map +1 -1
  9. package/dist/controls-options-manager/constants.js +11 -1
  10. package/dist/controls-options-manager/constants.js.map +1 -1
  11. package/dist/controls-options-manager/index.js +23 -21
  12. package/dist/controls-options-manager/index.js.map +1 -1
  13. package/dist/controls-options-manager/util.js +91 -0
  14. package/dist/controls-options-manager/util.js.map +1 -1
  15. package/dist/hashTree/constants.js +10 -1
  16. package/dist/hashTree/constants.js.map +1 -1
  17. package/dist/hashTree/hashTreeParser.js +554 -350
  18. package/dist/hashTree/hashTreeParser.js.map +1 -1
  19. package/dist/hashTree/utils.js +22 -0
  20. package/dist/hashTree/utils.js.map +1 -1
  21. package/dist/interceptors/locusRetry.js +23 -8
  22. package/dist/interceptors/locusRetry.js.map +1 -1
  23. package/dist/interpretation/index.js +1 -1
  24. package/dist/interpretation/siLanguage.js +1 -1
  25. package/dist/locus-info/index.js +274 -85
  26. package/dist/locus-info/index.js.map +1 -1
  27. package/dist/locus-info/types.js +16 -0
  28. package/dist/locus-info/types.js.map +1 -1
  29. package/dist/meeting/index.js +710 -499
  30. package/dist/meeting/index.js.map +1 -1
  31. package/dist/meeting/util.js +1 -0
  32. package/dist/meeting/util.js.map +1 -1
  33. package/dist/meetings/index.js +174 -77
  34. package/dist/meetings/index.js.map +1 -1
  35. package/dist/meetings/util.js +49 -5
  36. package/dist/meetings/util.js.map +1 -1
  37. package/dist/member/index.js +10 -0
  38. package/dist/member/index.js.map +1 -1
  39. package/dist/member/types.js.map +1 -1
  40. package/dist/member/util.js +3 -0
  41. package/dist/member/util.js.map +1 -1
  42. package/dist/types/controls-options-manager/constants.d.ts +6 -1
  43. package/dist/types/hashTree/constants.d.ts +1 -0
  44. package/dist/types/hashTree/hashTreeParser.d.ts +53 -15
  45. package/dist/types/hashTree/utils.d.ts +11 -0
  46. package/dist/types/interceptors/locusRetry.d.ts +4 -4
  47. package/dist/types/locus-info/index.d.ts +46 -6
  48. package/dist/types/locus-info/types.d.ts +17 -1
  49. package/dist/types/meeting/index.d.ts +64 -1
  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/webinar/index.js +301 -226
  54. package/dist/webinar/index.js.map +1 -1
  55. package/package.json +22 -22
  56. package/src/aiEnableRequest/index.ts +16 -0
  57. package/src/breakouts/breakout.ts +2 -1
  58. package/src/constants.ts +1 -1
  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 +278 -160
  64. package/src/hashTree/utils.ts +17 -0
  65. package/src/interceptors/locusRetry.ts +25 -4
  66. package/src/locus-info/index.ts +274 -93
  67. package/src/locus-info/types.ts +19 -1
  68. package/src/meeting/index.ts +206 -22
  69. package/src/meeting/util.ts +1 -0
  70. package/src/meetings/index.ts +77 -43
  71. package/src/meetings/util.ts +56 -1
  72. package/src/member/index.ts +10 -0
  73. package/src/member/types.ts +1 -0
  74. package/src/member/util.ts +3 -0
  75. package/src/webinar/index.ts +75 -1
  76. package/test/unit/spec/aiEnableRequest/index.ts +86 -0
  77. package/test/unit/spec/breakouts/breakout.ts +7 -3
  78. package/test/unit/spec/controls-options-manager/index.js +114 -6
  79. package/test/unit/spec/controls-options-manager/util.js +165 -0
  80. package/test/unit/spec/hashTree/hashTreeParser.ts +996 -51
  81. package/test/unit/spec/hashTree/utils.ts +88 -1
  82. package/test/unit/spec/interceptors/locusRetry.ts +205 -4
  83. package/test/unit/spec/locus-info/index.js +397 -81
  84. package/test/unit/spec/meeting/index.js +271 -44
  85. package/test/unit/spec/meeting/utils.js +4 -0
  86. package/test/unit/spec/meetings/index.js +195 -13
  87. package/test/unit/spec/meetings/utils.js +137 -0
  88. package/test/unit/spec/member/index.js +7 -0
  89. package/test/unit/spec/member/util.js +24 -0
  90. package/test/unit/spec/webinar/index.ts +60 -0
@@ -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;
@@ -1567,6 +1566,7 @@ var Meetings = exports.default = /*#__PURE__*/function (_WebexPlugin) {
1567
1566
  isMeetingActive,
1568
1567
  enableUnifiedMeetings,
1569
1568
  meetingInfoOptions,
1569
+ shouldDeferMeetingInfoFetch,
1570
1570
  meetingAddedType,
1571
1571
  _args4 = arguments,
1572
1572
  _t2;
@@ -1621,16 +1621,17 @@ var Meetings = exports.default = /*#__PURE__*/function (_WebexPlugin) {
1621
1621
  extraParams: infoExtraParams,
1622
1622
  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
1623
  };
1624
+ shouldDeferMeetingInfoFetch = type === _constants.DESTINATION_TYPE.LOCUS_ID && !(destination !== null && destination !== void 0 && destination.info);
1624
1625
  if (!meetingInfo) {
1625
1626
  _context4.next = 2;
1626
1627
  break;
1627
1628
  }
1628
1629
  meeting.injectMeetingInfo(meetingInfo, meetingInfoOptions, meetingLookupUrl);
1629
- _context4.next = 4;
1630
+ _context4.next = 6;
1630
1631
  break;
1631
1632
  case 2:
1632
1633
  if (!(type !== _constants.DESTINATION_TYPE.ONE_ON_ONE_CALL)) {
1633
- _context4.next = 4;
1634
+ _context4.next = 6;
1634
1635
  break;
1635
1636
  }
1636
1637
  if (!(enableUnifiedMeetings && !isMeetingActive && useRandomDelayForInfo && waitingTime > 0)) {
@@ -1641,41 +1642,54 @@ var Meetings = exports.default = /*#__PURE__*/function (_WebexPlugin) {
1641
1642
  return meeting.fetchMeetingInfo(meetingInfoOptions);
1642
1643
  }, waitingTime);
1643
1644
  meeting.parseMeetingInfo(undefined, destination);
1644
- _context4.next = 4;
1645
+ _context4.next = 6;
1645
1646
  break;
1646
1647
  case 3:
1648
+ if (shouldDeferMeetingInfoFetch) {
1649
+ _context4.next = 5;
1650
+ break;
1651
+ }
1647
1652
  _context4.next = 4;
1648
1653
  return meeting.fetchMeetingInfo(meetingInfoOptions);
1649
1654
  case 4:
1650
- _context4.next = 8;
1655
+ _context4.next = 6;
1651
1656
  break;
1652
1657
  case 5:
1653
- _context4.prev = 5;
1658
+ _loggerProxy.default.logger.info('Meetings:index#createMeeting --> defer fetchMeetingInfo for incomplete locus, will do it after locus initialSetup');
1659
+ case 6:
1660
+ _context4.next = 10;
1661
+ break;
1662
+ case 7:
1663
+ _context4.prev = 7;
1654
1664
  _t2 = _context4["catch"](1);
1655
1665
  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;
1666
+ _context4.next = 9;
1657
1667
  break;
1658
1668
  }
1659
1669
  _loggerProxy.default.logger.info("Meetings:index#createMeeting --> Info Unable to fetch meeting info for ".concat(destination, "."));
1660
1670
  if (!failOnMissingMeetingInfo) {
1661
- _context4.next = 6;
1671
+ _context4.next = 8;
1662
1672
  break;
1663
1673
  }
1664
1674
  _loggerProxy.default.logger.info("Meetings:index#createMeeting --> Destroying meeting due to missing meeting info.");
1665
1675
  // @ts-ignore
1666
1676
  this.destroy(meeting, _constants.MEETING_REMOVED_REASON.MISSING_MEETING_INFO);
1667
1677
  throw new _noMeetingInfo.default();
1668
- case 6:
1678
+ case 8:
1669
1679
  // if there is no meeting info and no error should be thrown then we assume its a 1:1 call or wireless share
1670
1680
  _loggerProxy.default.logger.info('Meetings:index#createMeeting --> Info assuming this destination is a 1:1 or wireless share');
1671
- case 7:
1681
+ case 9:
1672
1682
  _loggerProxy.default.logger.debug("Meetings:index#createMeeting --> Debug ".concat(_t2, " fetching /meetingInfo for creation."));
1673
- case 8:
1674
- _context4.prev = 8;
1683
+ case 10:
1684
+ _context4.prev = 10;
1675
1685
  // For type LOCUS_ID we need to parse the locus object to get the information
1676
1686
  // about the caller and callee
1677
1687
  // Meeting Added event will be created in `handleLocusEvent`
1678
- if (type !== _constants.DESTINATION_TYPE.LOCUS_ID) {
1688
+ // Only emit MEETING_ADDED if the meeting still exists in the collection.
1689
+ // If fetchMeetingInfo failed and the meeting was destroyed in the catch block,
1690
+ // skip emitting to prevent orphaned meeting references on the consumer side.
1691
+ // @ts-ignore - getMeetingByType types value as object but accepts strings (same as handleLocusEvent)
1692
+ if (type !== _constants.DESTINATION_TYPE.LOCUS_ID && this.getMeetingByType(_constants._ID_, meeting.id)) {
1679
1693
  if (!meeting.sipUri) {
1680
1694
  meeting.setSipUri(destination);
1681
1695
  }
@@ -1691,14 +1705,14 @@ var Meetings = exports.default = /*#__PURE__*/function (_WebexPlugin) {
1691
1705
  type: meetingAddedType
1692
1706
  });
1693
1707
  }
1694
- return _context4.finish(8);
1695
- case 9:
1708
+ return _context4.finish(10);
1709
+ case 11:
1696
1710
  return _context4.abrupt("return", meeting);
1697
- case 10:
1711
+ case 12:
1698
1712
  case "end":
1699
1713
  return _context4.stop();
1700
1714
  }
1701
- }, _callee4, this, [[1, 5, 8, 9]]);
1715
+ }, _callee4, this, [[1, 7, 10, 11]]);
1702
1716
  }));
1703
1717
  function createMeeting(_x4) {
1704
1718
  return _createMeeting.apply(this, arguments);
@@ -1741,51 +1755,135 @@ var Meetings = exports.default = /*#__PURE__*/function (_WebexPlugin) {
1741
1755
  */
1742
1756
  }, {
1743
1757
  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
- }
1758
+ value: (function () {
1759
+ var _syncMeetings = (0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee5() {
1760
+ var _this11 = this;
1761
+ var _ref4,
1762
+ _ref4$keepOnlyLocusMe,
1763
+ keepOnlyLocusMeetings,
1764
+ locusArray,
1765
+ activeLocusUrl,
1766
+ lociToUpdate,
1767
+ meetingsCollection,
1768
+ _loop,
1769
+ _i,
1770
+ _Object$values,
1771
+ remainingMeetings,
1772
+ syncPromises,
1773
+ _i2,
1774
+ _arr,
1775
+ meeting,
1776
+ _args6 = arguments,
1777
+ _t3;
1778
+ return _regenerator.default.wrap(function (_context6) {
1779
+ while (1) switch (_context6.prev = _context6.next) {
1780
+ case 0:
1781
+ _ref4 = _args6.length > 0 && _args6[0] !== undefined ? _args6[0] : {}, _ref4$keepOnlyLocusMe = _ref4.keepOnlyLocusMeetings, keepOnlyLocusMeetings = _ref4$keepOnlyLocusMe === void 0 ? true : _ref4$keepOnlyLocusMe;
1782
+ if (!this.webex.credentials.isUnverifiedGuest) {
1783
+ _context6.next = 1;
1784
+ break;
1785
+ }
1786
+ _loggerProxy.default.logger.info('Meetings:index#syncMeetings --> user is unverified guest, skipping calling Locus for meeting sync');
1787
+ _context6.next = 7;
1788
+ break;
1789
+ case 1:
1790
+ _context6.prev = 1;
1791
+ _context6.next = 2;
1792
+ return this.request.getActiveMeetings();
1793
+ case 2:
1794
+ locusArray = _context6.sent;
1795
+ activeLocusUrl = [];
1796
+ if (locusArray !== null && locusArray !== void 0 && locusArray.loci && locusArray.loci.length > 0) {
1797
+ lociToUpdate = this.sortLocusArrayToUpdate(locusArray.loci);
1798
+ lociToUpdate.forEach(function (locus) {
1799
+ activeLocusUrl.push(locus.url);
1800
+ _this11.handleLocusEvent({
1801
+ eventType: _constants.LOCUSEVENT.SDK_LOCUS_FROM_SYNC_MEETINGS,
1802
+ locus: locus,
1803
+ locusUrl: locus.url
1804
+ });
1805
+ });
1806
+ }
1807
+ meetingsCollection = this.meetingCollection.getAll();
1808
+ if (!((0, _keys.default)(meetingsCollection).length > 0)) {
1809
+ _context6.next = 5;
1810
+ break;
1811
+ }
1812
+ _loop = /*#__PURE__*/_regenerator.default.mark(function _loop() {
1813
+ var meeting, locusUrl, locusInfo, _locusInfo$info, _locusArray$loci, globalMeetingId;
1814
+ return _regenerator.default.wrap(function (_context5) {
1815
+ while (1) switch (_context5.prev = _context5.next) {
1816
+ case 0:
1817
+ meeting = _Object$values[_i];
1818
+ // @ts-ignore
1819
+ locusUrl = meeting.locusUrl, locusInfo = meeting.locusInfo;
1820
+ if ((keepOnlyLocusMeetings || locusUrl) && !activeLocusUrl.includes(locusUrl)) {
1821
+ globalMeetingId = locusInfo === null || locusInfo === void 0 ? void 0 : (_locusInfo$info = locusInfo.info) === null || _locusInfo$info === void 0 ? void 0 : _locusInfo$info.globalMeetingId;
1822
+ if (globalMeetingId && locusArray !== null && locusArray !== void 0 && (_locusArray$loci = locusArray.loci) !== null && _locusArray$loci !== void 0 && _locusArray$loci.some(function (locus) {
1823
+ var _locus$info;
1824
+ return ((_locus$info = locus.info) === null || _locus$info === void 0 ? void 0 : _locus$info.globalMeetingId) === globalMeetingId;
1825
+ })) {
1826
+ // don't destroy the meeting as Locus API still returned some Locus that shares
1827
+ // the same globalMeetingId - that happens for example if a webinar user (who hasn't scheduled it)
1828
+ // is in a breakout and gets moved to a different breakout while we were offline
1829
+ } else {
1830
+ // destroy function also uploads logs
1831
+ // @ts-ignore
1832
+ _this11.destroy(meeting, _constants.MEETING_REMOVED_REASON.NO_MEETINGS_TO_SYNC);
1833
+ }
1834
+ }
1835
+ case 1:
1836
+ case "end":
1837
+ return _context5.stop();
1838
+ }
1839
+ }, _loop);
1840
+ });
1841
+ _i = 0, _Object$values = (0, _values.default)(meetingsCollection);
1842
+ case 3:
1843
+ if (!(_i < _Object$values.length)) {
1844
+ _context6.next = 5;
1845
+ break;
1846
+ }
1847
+ return _context6.delegateYield(_loop(), "t0", 4);
1848
+ case 4:
1849
+ _i++;
1850
+ _context6.next = 3;
1851
+ break;
1852
+ case 5:
1853
+ _context6.next = 7;
1854
+ break;
1855
+ case 6:
1856
+ _context6.prev = 6;
1857
+ _t3 = _context6["catch"](1);
1858
+ _loggerProxy.default.logger.error("Meetings:index#syncMeetings --> failed to sync meetings, ".concat(_t3));
1859
+ throw _t3;
1860
+ case 7:
1861
+ // Trigger hash tree syncs for all remaining meetings
1862
+ remainingMeetings = this.meetingCollection.getAll();
1863
+ syncPromises = [];
1864
+ for (_i2 = 0, _arr = (0, _values.default)(remainingMeetings); _i2 < _arr.length; _i2++) {
1865
+ meeting = _arr[_i2];
1866
+ if (meeting.locusInfo) {
1867
+ syncPromises.push(meeting.locusInfo.syncAllHashTreeDatasets());
1868
+ }
1869
+ }
1870
+ if (!(syncPromises.length > 0)) {
1871
+ _context6.next = 8;
1872
+ break;
1873
+ }
1874
+ _context6.next = 8;
1875
+ return _promise.default.all(syncPromises);
1876
+ case 8:
1877
+ case "end":
1878
+ return _context6.stop();
1781
1879
  }
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
-
1880
+ }, _callee5, this, [[1, 6]]);
1881
+ }));
1882
+ function syncMeetings() {
1883
+ return _syncMeetings.apply(this, arguments);
1884
+ }
1885
+ return syncMeetings;
1886
+ }()
1789
1887
  /**
1790
1888
  * sort out locus array for initial creating
1791
1889
  * @param {Array} loci original locus array
@@ -1793,6 +1891,7 @@ var Meetings = exports.default = /*#__PURE__*/function (_WebexPlugin) {
1793
1891
  * @public
1794
1892
  * @memberof Meetings
1795
1893
  */
1894
+ )
1796
1895
  }, {
1797
1896
  key: "sortLocusArrayToUpdate",
1798
1897
  value: function sortLocusArrayToUpdate(loci) {
@@ -1807,8 +1906,7 @@ var Meetings = exports.default = /*#__PURE__*/function (_WebexPlugin) {
1807
1906
  var lociToUpdate = (0, _toConsumableArray2.default)(mainLoci);
1808
1907
  breakoutLoci.forEach(function (breakoutLocus) {
1809
1908
  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);
1909
+ return _util2.default.isMainAssociatedWithBreakout(mainLocus, breakoutLocus);
1812
1910
  });
1813
1911
  var existCorrespondingMeeting = _this12.getCorrespondingMeetingByLocus({
1814
1912
  eventType: _constants.LOCUSEVENT.SDK_NO_EVENT,
@@ -1844,8 +1942,7 @@ var Meetings = exports.default = /*#__PURE__*/function (_WebexPlugin) {
1844
1942
  return;
1845
1943
  }
1846
1944
  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);
1945
+ return _util2.default.isMainAssociatedWithBreakout(newCreatedLocus, breakoutLocus);
1849
1946
  });
1850
1947
  if (existIndex < 0) {
1851
1948
  return;