@webex/plugin-meetings 3.12.0-next.20 → 3.12.0-next.22

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.
@@ -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)); }
@@ -1742,51 +1742,135 @@ var Meetings = exports.default = /*#__PURE__*/function (_WebexPlugin) {
1742
1742
  */
1743
1743
  }, {
1744
1744
  key: "syncMeetings",
1745
- value: function syncMeetings() {
1746
- var _this11 = this;
1747
- var _ref4 = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
1748
- _ref4$keepOnlyLocusMe = _ref4.keepOnlyLocusMeetings,
1749
- keepOnlyLocusMeetings = _ref4$keepOnlyLocusMe === void 0 ? true : _ref4$keepOnlyLocusMe;
1750
- // @ts-ignore
1751
- if (this.webex.credentials.isUnverifiedGuest) {
1752
- _loggerProxy.default.logger.info('Meetings:index#syncMeetings --> skipping meeting sync as unverified guest');
1753
- return _promise.default.resolve();
1754
- }
1755
- return this.request.getActiveMeetings().then(function (locusArray) {
1756
- var activeLocusUrl = [];
1757
- if (locusArray !== null && locusArray !== void 0 && locusArray.loci && locusArray.loci.length > 0) {
1758
- var lociToUpdate = _this11.sortLocusArrayToUpdate(locusArray.loci);
1759
- lociToUpdate.forEach(function (locus) {
1760
- activeLocusUrl.push(locus.url);
1761
- _this11.handleLocusEvent({
1762
- eventType: _constants.LOCUSEVENT.SDK_LOCUS_FROM_SYNC_MEETINGS,
1763
- locus: locus,
1764
- locusUrl: locus.url
1765
- });
1766
- });
1767
- }
1768
- var meetingsCollection = _this11.meetingCollection.getAll();
1769
- if ((0, _keys.default)(meetingsCollection).length > 0) {
1770
- // Sometimes the mercury events are lost after mercury reconnect
1771
- // Remove any Locus meetings that are not returned by Locus
1772
- // (they had a locusUrl previously but are no longer active) in the sync
1773
- for (var _i = 0, _Object$values = (0, _values.default)(meetingsCollection); _i < _Object$values.length; _i++) {
1774
- var meeting = _Object$values[_i];
1775
- // @ts-ignore
1776
- var locusUrl = meeting.locusUrl;
1777
- if ((keepOnlyLocusMeetings || locusUrl) && !activeLocusUrl.includes(locusUrl)) {
1778
- // destroy function also uploads logs
1779
- // @ts-ignore
1780
- _this11.destroy(meeting, _constants.MEETING_REMOVED_REASON.NO_MEETINGS_TO_SYNC);
1781
- }
1745
+ value: (function () {
1746
+ var _syncMeetings = (0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee5() {
1747
+ var _this11 = this;
1748
+ var _ref4,
1749
+ _ref4$keepOnlyLocusMe,
1750
+ keepOnlyLocusMeetings,
1751
+ locusArray,
1752
+ activeLocusUrl,
1753
+ lociToUpdate,
1754
+ meetingsCollection,
1755
+ _loop,
1756
+ _i,
1757
+ _Object$values,
1758
+ remainingMeetings,
1759
+ syncPromises,
1760
+ _i2,
1761
+ _arr,
1762
+ meeting,
1763
+ _args6 = arguments,
1764
+ _t3;
1765
+ return _regenerator.default.wrap(function (_context6) {
1766
+ while (1) switch (_context6.prev = _context6.next) {
1767
+ case 0:
1768
+ _ref4 = _args6.length > 0 && _args6[0] !== undefined ? _args6[0] : {}, _ref4$keepOnlyLocusMe = _ref4.keepOnlyLocusMeetings, keepOnlyLocusMeetings = _ref4$keepOnlyLocusMe === void 0 ? true : _ref4$keepOnlyLocusMe;
1769
+ if (!this.webex.credentials.isUnverifiedGuest) {
1770
+ _context6.next = 1;
1771
+ break;
1772
+ }
1773
+ _loggerProxy.default.logger.info('Meetings:index#syncMeetings --> user is unverified guest, skipping calling Locus for meeting sync');
1774
+ _context6.next = 7;
1775
+ break;
1776
+ case 1:
1777
+ _context6.prev = 1;
1778
+ _context6.next = 2;
1779
+ return this.request.getActiveMeetings();
1780
+ case 2:
1781
+ locusArray = _context6.sent;
1782
+ activeLocusUrl = [];
1783
+ if (locusArray !== null && locusArray !== void 0 && locusArray.loci && locusArray.loci.length > 0) {
1784
+ lociToUpdate = this.sortLocusArrayToUpdate(locusArray.loci);
1785
+ lociToUpdate.forEach(function (locus) {
1786
+ activeLocusUrl.push(locus.url);
1787
+ _this11.handleLocusEvent({
1788
+ eventType: _constants.LOCUSEVENT.SDK_LOCUS_FROM_SYNC_MEETINGS,
1789
+ locus: locus,
1790
+ locusUrl: locus.url
1791
+ });
1792
+ });
1793
+ }
1794
+ meetingsCollection = this.meetingCollection.getAll();
1795
+ if (!((0, _keys.default)(meetingsCollection).length > 0)) {
1796
+ _context6.next = 5;
1797
+ break;
1798
+ }
1799
+ _loop = /*#__PURE__*/_regenerator.default.mark(function _loop() {
1800
+ var meeting, locusUrl, locusInfo, _locusInfo$info, _locusArray$loci, globalMeetingId;
1801
+ return _regenerator.default.wrap(function (_context5) {
1802
+ while (1) switch (_context5.prev = _context5.next) {
1803
+ case 0:
1804
+ meeting = _Object$values[_i];
1805
+ // @ts-ignore
1806
+ locusUrl = meeting.locusUrl, locusInfo = meeting.locusInfo;
1807
+ if ((keepOnlyLocusMeetings || locusUrl) && !activeLocusUrl.includes(locusUrl)) {
1808
+ globalMeetingId = locusInfo === null || locusInfo === void 0 ? void 0 : (_locusInfo$info = locusInfo.info) === null || _locusInfo$info === void 0 ? void 0 : _locusInfo$info.globalMeetingId;
1809
+ if (globalMeetingId && locusArray !== null && locusArray !== void 0 && (_locusArray$loci = locusArray.loci) !== null && _locusArray$loci !== void 0 && _locusArray$loci.some(function (locus) {
1810
+ var _locus$info;
1811
+ return ((_locus$info = locus.info) === null || _locus$info === void 0 ? void 0 : _locus$info.globalMeetingId) === globalMeetingId;
1812
+ })) {
1813
+ // don't destroy the meeting as Locus API still returned some Locus that shares
1814
+ // the same globalMeetingId - that happens for example if a webinar user (who hasn't scheduled it)
1815
+ // is in a breakout and gets moved to a different breakout while we were offline
1816
+ } else {
1817
+ // destroy function also uploads logs
1818
+ // @ts-ignore
1819
+ _this11.destroy(meeting, _constants.MEETING_REMOVED_REASON.NO_MEETINGS_TO_SYNC);
1820
+ }
1821
+ }
1822
+ case 1:
1823
+ case "end":
1824
+ return _context5.stop();
1825
+ }
1826
+ }, _loop);
1827
+ });
1828
+ _i = 0, _Object$values = (0, _values.default)(meetingsCollection);
1829
+ case 3:
1830
+ if (!(_i < _Object$values.length)) {
1831
+ _context6.next = 5;
1832
+ break;
1833
+ }
1834
+ return _context6.delegateYield(_loop(), "t0", 4);
1835
+ case 4:
1836
+ _i++;
1837
+ _context6.next = 3;
1838
+ break;
1839
+ case 5:
1840
+ _context6.next = 7;
1841
+ break;
1842
+ case 6:
1843
+ _context6.prev = 6;
1844
+ _t3 = _context6["catch"](1);
1845
+ _loggerProxy.default.logger.error("Meetings:index#syncMeetings --> failed to sync meetings, ".concat(_t3));
1846
+ throw _t3;
1847
+ case 7:
1848
+ // Trigger hash tree syncs for all remaining meetings
1849
+ remainingMeetings = this.meetingCollection.getAll();
1850
+ syncPromises = [];
1851
+ for (_i2 = 0, _arr = (0, _values.default)(remainingMeetings); _i2 < _arr.length; _i2++) {
1852
+ meeting = _arr[_i2];
1853
+ if (meeting.locusInfo) {
1854
+ syncPromises.push(meeting.locusInfo.syncAllHashTreeDatasets());
1855
+ }
1856
+ }
1857
+ if (!(syncPromises.length > 0)) {
1858
+ _context6.next = 8;
1859
+ break;
1860
+ }
1861
+ _context6.next = 8;
1862
+ return _promise.default.all(syncPromises);
1863
+ case 8:
1864
+ case "end":
1865
+ return _context6.stop();
1782
1866
  }
1783
- }
1784
- }).catch(function (error) {
1785
- _loggerProxy.default.logger.error("Meetings:index#syncMeetings --> failed to sync meetings, ".concat(error));
1786
- throw new Error(error);
1787
- });
1788
- }
1789
-
1867
+ }, _callee5, this, [[1, 6]]);
1868
+ }));
1869
+ function syncMeetings() {
1870
+ return _syncMeetings.apply(this, arguments);
1871
+ }
1872
+ return syncMeetings;
1873
+ }()
1790
1874
  /**
1791
1875
  * sort out locus array for initial creating
1792
1876
  * @param {Array} loci original locus array
@@ -1794,6 +1878,7 @@ var Meetings = exports.default = /*#__PURE__*/function (_WebexPlugin) {
1794
1878
  * @public
1795
1879
  * @memberof Meetings
1796
1880
  */
1881
+ )
1797
1882
  }, {
1798
1883
  key: "sortLocusArrayToUpdate",
1799
1884
  value: function sortLocusArrayToUpdate(loci) {