@webex/plugin-meetings 2.60.0-next.1 → 2.60.0-next.3

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 (62) hide show
  1. package/dist/breakouts/breakout.js +1 -1
  2. package/dist/breakouts/index.js +1 -1
  3. package/dist/constants.js +1 -1
  4. package/dist/constants.js.map +1 -1
  5. package/dist/controls-options-manager/enums.js +2 -1
  6. package/dist/controls-options-manager/enums.js.map +1 -1
  7. package/dist/interpretation/index.js +1 -1
  8. package/dist/interpretation/siLanguage.js +1 -1
  9. package/dist/locus-info/parser.js +5 -5
  10. package/dist/locus-info/parser.js.map +1 -1
  11. package/dist/media/index.js +6 -5
  12. package/dist/media/index.js.map +1 -1
  13. package/dist/meeting/in-meeting-actions.js +4 -0
  14. package/dist/meeting/in-meeting-actions.js.map +1 -1
  15. package/dist/meeting/index.js +276 -150
  16. package/dist/meeting/index.js.map +1 -1
  17. package/dist/meeting-info/meeting-info-v2.js +3 -0
  18. package/dist/meeting-info/meeting-info-v2.js.map +1 -1
  19. package/dist/meeting-info/utilv2.js +14 -29
  20. package/dist/meeting-info/utilv2.js.map +1 -1
  21. package/dist/meetings/collection.js +17 -0
  22. package/dist/meetings/collection.js.map +1 -1
  23. package/dist/meetings/index.js +30 -9
  24. package/dist/meetings/index.js.map +1 -1
  25. package/dist/metrics/constants.js +3 -0
  26. package/dist/metrics/constants.js.map +1 -1
  27. package/dist/reconnection-manager/index.js +27 -28
  28. package/dist/reconnection-manager/index.js.map +1 -1
  29. package/dist/rtcMetrics/index.js +25 -0
  30. package/dist/rtcMetrics/index.js.map +1 -1
  31. package/dist/statsAnalyzer/index.js +21 -1
  32. package/dist/statsAnalyzer/index.js.map +1 -1
  33. package/dist/statsAnalyzer/mqaUtil.js +16 -16
  34. package/dist/statsAnalyzer/mqaUtil.js.map +1 -1
  35. package/dist/webinar/index.js +1 -1
  36. package/package.json +21 -22
  37. package/src/constants.ts +10 -4
  38. package/src/controls-options-manager/enums.ts +2 -0
  39. package/src/locus-info/parser.ts +6 -6
  40. package/src/media/index.ts +5 -5
  41. package/src/meeting/in-meeting-actions.ts +8 -0
  42. package/src/meeting/index.ts +249 -120
  43. package/src/meeting-info/meeting-info-v2.ts +4 -0
  44. package/src/meeting-info/utilv2.ts +6 -19
  45. package/src/meetings/collection.ts +13 -0
  46. package/src/meetings/index.ts +28 -10
  47. package/src/metrics/constants.ts +3 -0
  48. package/src/reconnection-manager/index.ts +63 -68
  49. package/src/rtcMetrics/index.ts +24 -0
  50. package/src/statsAnalyzer/index.ts +30 -1
  51. package/src/statsAnalyzer/mqaUtil.ts +17 -14
  52. package/test/unit/spec/media/index.ts +20 -4
  53. package/test/unit/spec/meeting/in-meeting-actions.ts +4 -0
  54. package/test/unit/spec/meeting/index.js +1253 -157
  55. package/test/unit/spec/meeting/muteState.js +2 -1
  56. package/test/unit/spec/meeting-info/meetinginfov2.js +28 -0
  57. package/test/unit/spec/meetings/collection.js +12 -0
  58. package/test/unit/spec/meetings/index.js +382 -118
  59. package/test/unit/spec/member/util.js +0 -31
  60. package/test/unit/spec/reconnection-manager/index.js +42 -12
  61. package/test/unit/spec/rtcMetrics/index.ts +20 -0
  62. package/test/unit/spec/stats-analyzer/index.js +12 -2
@@ -372,7 +372,7 @@ var Meeting = exports.default = /*#__PURE__*/function (_StatelessWebexPlugin) {
372
372
  * @memberof Meeting
373
373
  */
374
374
  function Meeting(attrs, _options) {
375
- var _this$locusInfo, _this$locusInfo$links, _this$locusInfo$links2, _this$locusInfo$links3, _this$locusInfo2, _this$locusInfo2$full, _this$locusInfo3, _this$locusInfo4;
375
+ var _attrs$callStateForMe, _this$locusInfo, _this$locusInfo$links, _this$locusInfo$links2, _this$locusInfo$links3, _this$locusInfo2, _this$locusInfo2$full, _this$locusInfo3, _this$locusInfo4;
376
376
  var _this;
377
377
  (0, _classCallCheck2.default)(this, Meeting);
378
378
  _this = _super.call(this, {}, _options);
@@ -390,7 +390,7 @@ var Meeting = exports.default = /*#__PURE__*/function (_StatelessWebexPlugin) {
390
390
  (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "annotation", void 0);
391
391
  (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "webinar", void 0);
392
392
  (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "conversationUrl", void 0);
393
- (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "correlationId", void 0);
393
+ (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "callStateForMetrics", void 0);
394
394
  (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "destination", void 0);
395
395
  (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "destinationType", void 0);
396
396
  (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "deviceUrl", void 0);
@@ -453,6 +453,7 @@ var Meeting = exports.default = /*#__PURE__*/function (_StatelessWebexPlugin) {
453
453
  (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "requiredCaptcha", void 0);
454
454
  (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "receiveSlotManager", void 0);
455
455
  (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "selfUserPolicies", void 0);
456
+ (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "enforceVBGImagesURL", void 0);
456
457
  (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "shareStatus", void 0);
457
458
  (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "screenShareFloorState", void 0);
458
459
  (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "statsAnalyzer", void 0);
@@ -493,6 +494,7 @@ var Meeting = exports.default = /*#__PURE__*/function (_StatelessWebexPlugin) {
493
494
  (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "deferSDPAnswer", void 0);
494
495
  // used for waiting for a response
495
496
  (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "sdpResponseTimer", void 0);
497
+ (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "hasMediaConnectionConnectedAtLeastOnce", void 0);
496
498
  /**
497
499
  * Callback called when a relay event is received from meeting LLM Connection
498
500
  * @param {RelayEvent} e Event object coming from LLM Connection
@@ -784,36 +786,24 @@ var Meeting = exports.default = /*#__PURE__*/function (_StatelessWebexPlugin) {
784
786
  });
785
787
  _this.mediaProperties.webrtcMediaConnection.on(_internalMediaCore.Event.CONNECTION_STATE_CHANGED, function (event) {
786
788
  var connectionFailed = function connectionFailed() {
787
- // we know the media connection failed and browser will not attempt to recover it any more
788
- // so reset the timer as it's not needed anymore, we want to reconnect immediately
789
- _this.reconnectionManager.resetReconnectionTimer();
790
- _this.reconnect({
791
- networkDisconnect: true
792
- });
793
- // @ts-ignore
794
- _this.webex.internal.newMetrics.submitClientEvent({
795
- name: 'client.ice.end',
796
- payload: {
797
- canProceed: false,
798
- icePhase: 'IN_MEETING',
799
- errors: [
800
- // @ts-ignore
801
- _this.webex.internal.newMetrics.callDiagnosticMetrics.getErrorPayloadForClientErrorCode({
802
- clientErrorCode: _internalPluginMetrics.CALL_DIAGNOSTIC_CONFIG.ICE_FAILURE_CLIENT_CODE
803
- })]
804
- },
805
- options: {
806
- meetingId: _this.id
807
- }
808
- });
809
- _this.uploadLogs({
810
- file: 'peer-connection-manager/index',
811
- function: 'connectionFailed'
812
- });
813
789
  _metrics.default.sendBehavioralMetric(_constants2.default.CONNECTION_FAILURE, {
814
790
  correlation_id: _this.correlationId,
815
- locus_id: _this.locusId
791
+ locus_id: _this.locusId,
792
+ networkStatus: _this.networkStatus,
793
+ hasMediaConnectionConnectedAtLeastOnce: _this.hasMediaConnectionConnectedAtLeastOnce
816
794
  });
795
+ if (_this.hasMediaConnectionConnectedAtLeastOnce) {
796
+ // we know the media connection failed and browser will not attempt to recover it any more
797
+ // so reset the timer as it's not needed anymore, we want to reconnect immediately
798
+ _this.reconnectionManager.resetReconnectionTimer();
799
+ _this.reconnect({
800
+ networkDisconnect: true
801
+ });
802
+ _this.uploadLogs({
803
+ file: 'peer-connection-manager/index',
804
+ function: 'connectionFailed'
805
+ });
806
+ }
817
807
  };
818
808
  _loggerProxy.default.logger.info("Meeting:index#setupMediaConnectionListeners --> correlationId=".concat(_this.correlationId, " connection state changed to ").concat(event.state));
819
809
 
@@ -821,22 +811,32 @@ var Meeting = exports.default = /*#__PURE__*/function (_StatelessWebexPlugin) {
821
811
  var cdl = _this.webex.internal.newMetrics.callDiagnosticLatencies;
822
812
  switch (event.state) {
823
813
  case _internalMediaCore.ConnectionState.Connecting:
824
- // @ts-ignore
825
- _this.webex.internal.newMetrics.submitClientEvent({
826
- name: 'client.ice.start',
827
- options: {
828
- meetingId: _this.id
829
- }
830
- });
814
+ if (!_this.hasMediaConnectionConnectedAtLeastOnce) {
815
+ // Only send CA event for join flow if we haven't successfully connected media yet
816
+ // @ts-ignore
817
+ _this.webex.internal.newMetrics.submitClientEvent({
818
+ name: 'client.ice.start',
819
+ options: {
820
+ meetingId: _this.id
821
+ }
822
+ });
823
+ }
831
824
  break;
832
825
  case _internalMediaCore.ConnectionState.Connected:
833
- // @ts-ignore
834
- _this.webex.internal.newMetrics.submitClientEvent({
835
- name: 'client.ice.end',
836
- options: {
837
- meetingId: _this.id
838
- }
839
- });
826
+ if (!_this.hasMediaConnectionConnectedAtLeastOnce) {
827
+ // Only send CA event for join flow if we haven't successfully connected media yet
828
+ // @ts-ignore
829
+ _this.webex.internal.newMetrics.submitClientEvent({
830
+ name: 'client.ice.end',
831
+ payload: {
832
+ canProceed: true,
833
+ icePhase: 'JOIN_MEETING_FINAL'
834
+ },
835
+ options: {
836
+ meetingId: _this.id
837
+ }
838
+ });
839
+ }
840
840
  _metrics.default.sendBehavioralMetric(_constants2.default.CONNECTION_SUCCESS, {
841
841
  correlation_id: _this.correlationId,
842
842
  locus_id: _this.locusId,
@@ -845,6 +845,7 @@ var Meeting = exports.default = /*#__PURE__*/function (_StatelessWebexPlugin) {
845
845
  _this.setNetworkStatus(_constants.NETWORK_STATUS.CONNECTED);
846
846
  _this.reconnectionManager.iceReconnected();
847
847
  _this.statsAnalyzer.startAnalyzer(_this.mediaProperties.webrtcMediaConnection);
848
+ _this.hasMediaConnectionConnectedAtLeastOnce = true;
848
849
  break;
849
850
  case _internalMediaCore.ConnectionState.Disconnected:
850
851
  _this.setNetworkStatus(_constants.NETWORK_STATUS.DISCONNECTED);
@@ -1105,6 +1106,20 @@ var Meeting = exports.default = /*#__PURE__*/function (_StatelessWebexPlugin) {
1105
1106
  }
1106
1107
  }, _callee2, null, [[4, 9]]);
1107
1108
  })));
1109
+ /**
1110
+ * Functionality for when a share video is muted or unmuted.
1111
+ * @private
1112
+ * @memberof Meeting
1113
+ * @param {boolean} muted
1114
+ * @returns {undefined}
1115
+ */
1116
+ (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "handleShareVideoStreamMuteStateChange", function (muted) {
1117
+ _loggerProxy.default.logger.log("Meeting:index#handleShareVideoStreamMuteStateChange --> Share video stream mute state changed to muted ".concat(muted));
1118
+ _metrics.default.sendBehavioralMetric(_constants2.default.MEETING_SHARE_VIDEO_MUTE_STATE_CHANGE, {
1119
+ correlationId: _this.correlationId,
1120
+ muted: muted
1121
+ });
1122
+ });
1108
1123
  /**
1109
1124
  * Functionality for when a share video is ended.
1110
1125
  * @private
@@ -1246,18 +1261,20 @@ var Meeting = exports.default = /*#__PURE__*/function (_StatelessWebexPlugin) {
1246
1261
  */
1247
1262
  _this.id = _uuid.default.v4();
1248
1263
  /**
1249
- * Correlation ID used for network tracking of meeting
1264
+ * Call state used for metrics
1250
1265
  * @instance
1251
- * @type {String}
1266
+ * @type {CallStateForMetrics}
1252
1267
  * @readonly
1253
1268
  * @public
1254
1269
  * @memberof Meeting
1255
1270
  */
1256
- if (attrs.correlationId) {
1257
- _loggerProxy.default.logger.log("Meetings:index#constructor --> Initializing the meeting object with correlation id from app ".concat(_this.correlationId));
1258
- _this.correlationId = attrs.correlationId;
1271
+ _this.callStateForMetrics = attrs.callStateForMetrics || {};
1272
+ var _correlationId = attrs.correlationId || ((_attrs$callStateForMe = attrs.callStateForMetrics) === null || _attrs$callStateForMe === void 0 ? void 0 : _attrs$callStateForMe.correlationId);
1273
+ if (_correlationId) {
1274
+ _loggerProxy.default.logger.log("Meetings:index#constructor --> Initializing the meeting object with correlation id from app ".concat(_correlationId));
1275
+ _this.callStateForMetrics.correlationId = _correlationId;
1259
1276
  } else {
1260
- _this.correlationId = _this.id;
1277
+ _this.callStateForMetrics.correlationId = _this.id;
1261
1278
  }
1262
1279
  /**
1263
1280
  * @instance
@@ -1702,13 +1719,14 @@ var Meeting = exports.default = /*#__PURE__*/function (_StatelessWebexPlugin) {
1702
1719
  */
1703
1720
  _this.networkQualityMonitor = null;
1704
1721
  /**
1722
+ * Indicates network status of the webrtc media connection
1705
1723
  * @instance
1706
1724
  * @type {String}
1707
1725
  * @readonly
1708
1726
  * @public
1709
1727
  * @memberof Meeting
1710
1728
  */
1711
- _this.networkStatus = null;
1729
+ _this.networkStatus = undefined;
1712
1730
  /**
1713
1731
  * Passing only info as we send basic info for meeting added event
1714
1732
  * @instance
@@ -1925,6 +1943,15 @@ var Meeting = exports.default = /*#__PURE__*/function (_StatelessWebexPlugin) {
1925
1943
  * @memberof Meeting
1926
1944
  */
1927
1945
  _this.retriedWithTurnServer = false;
1946
+
1947
+ /**
1948
+ * Whether or not the media connection has ever successfully connected.
1949
+ * @instance
1950
+ * @type {boolean}
1951
+ * @private
1952
+ * @memberof Meeting
1953
+ */
1954
+ _this.hasMediaConnectionConnectedAtLeastOnce = false;
1928
1955
  return _this;
1929
1956
  }
1930
1957
 
@@ -1965,6 +1992,24 @@ var Meeting = exports.default = /*#__PURE__*/function (_StatelessWebexPlugin) {
1965
1992
  return this.type === 'CALL';
1966
1993
  }
1967
1994
 
1995
+ /**
1996
+ * Getter - Returns callStateForMetrics.correlationId
1997
+ * @returns {string}
1998
+ */
1999
+ }, {
2000
+ key: "correlationId",
2001
+ get: function get() {
2002
+ return this.callStateForMetrics.correlationId;
2003
+ }
2004
+
2005
+ /**
2006
+ * Setter - sets callStateForMetrics.correlationId
2007
+ * @param {string} correlationId
2008
+ */,
2009
+ set: function set(correlationId) {
2010
+ this.callStateForMetrics.correlationId = correlationId;
2011
+ }
2012
+
1968
2013
  /**
1969
2014
  * Internal method for fetching meeting info
1970
2015
  *
@@ -2088,7 +2133,7 @@ var Meeting = exports.default = /*#__PURE__*/function (_StatelessWebexPlugin) {
2088
2133
  value: (function () {
2089
2134
  var _refreshPermissionToken = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee5(reason) {
2090
2135
  var _this$meetingInfo;
2091
- var isStartingSpaceInstantV2Meeting, destination, destinationType, timeLeft;
2136
+ var isStartingSpaceInstantV2Meeting, destination, destinationType, permissionTokenExpiryInfo, timeLeft, expiryTime, currentTime;
2092
2137
  return _regenerator.default.wrap(function _callee5$(_context5) {
2093
2138
  while (1) switch (_context5.prev = _context5.next) {
2094
2139
  case 0:
@@ -2106,16 +2151,21 @@ var Meeting = exports.default = /*#__PURE__*/function (_StatelessWebexPlugin) {
2106
2151
  this.webex.meetings.preferredWebexSite;
2107
2152
  destination = isStartingSpaceInstantV2Meeting ? this.meetingInfo.meetingJoinUrl : this.destination;
2108
2153
  destinationType = isStartingSpaceInstantV2Meeting ? _constants._MEETING_LINK_ : this.destinationType;
2109
- timeLeft = this.getPermissionTokenTimeLeftInSec();
2110
- _loggerProxy.default.logger.info("Meeting:index#refreshPermissionToken --> refreshing permission token, destinationType=".concat(destinationType, ", timeLeft=").concat(timeLeft, ", reason=").concat(reason));
2154
+ permissionTokenExpiryInfo = this.getPermissionTokenExpiryInfo();
2155
+ timeLeft = permissionTokenExpiryInfo === null || permissionTokenExpiryInfo === void 0 ? void 0 : permissionTokenExpiryInfo.timeLeft;
2156
+ expiryTime = permissionTokenExpiryInfo === null || permissionTokenExpiryInfo === void 0 ? void 0 : permissionTokenExpiryInfo.expiryTime;
2157
+ currentTime = permissionTokenExpiryInfo === null || permissionTokenExpiryInfo === void 0 ? void 0 : permissionTokenExpiryInfo.currentTime;
2158
+ _loggerProxy.default.logger.info("Meeting:index#refreshPermissionToken --> refreshing permission token, destinationType=".concat(destinationType, ", timeLeft=").concat(timeLeft, ", permissionTokenExpiry=").concat(expiryTime, ", currentTimestamp=").concat(currentTime, ",reason=").concat(reason));
2111
2159
  _metrics.default.sendBehavioralMetric(_constants2.default.PERMISSION_TOKEN_REFRESH, {
2112
2160
  correlationId: this.correlationId,
2113
2161
  timeLeft: timeLeft,
2162
+ expiryTime: expiryTime,
2163
+ currentTime: currentTime,
2114
2164
  reason: reason,
2115
2165
  destinationType: destinationType
2116
2166
  });
2117
- _context5.prev = 9;
2118
- _context5.next = 12;
2167
+ _context5.prev = 12;
2168
+ _context5.next = 15;
2119
2169
  return this.fetchMeetingInfoInternal({
2120
2170
  destination: destination,
2121
2171
  destinationType: destinationType,
@@ -2124,12 +2174,12 @@ var Meeting = exports.default = /*#__PURE__*/function (_StatelessWebexPlugin) {
2124
2174
  }),
2125
2175
  sendCAevents: true // because if we're refreshing the permissionToken, it means that user is intending to join that meeting, so we want CA events
2126
2176
  });
2127
- case 12:
2128
- _context5.next = 19;
2177
+ case 15:
2178
+ _context5.next = 22;
2129
2179
  break;
2130
- case 14:
2131
- _context5.prev = 14;
2132
- _context5.t0 = _context5["catch"](9);
2180
+ case 17:
2181
+ _context5.prev = 17;
2182
+ _context5.t0 = _context5["catch"](12);
2133
2183
  _loggerProxy.default.logger.info('Meeting:index#refreshPermissionToken --> failed to refresh the permission token:', _context5.t0);
2134
2184
  _metrics.default.sendBehavioralMetric(_constants2.default.PERMISSION_TOKEN_REFRESH_ERROR, {
2135
2185
  correlationId: this.correlationId,
@@ -2137,11 +2187,11 @@ var Meeting = exports.default = /*#__PURE__*/function (_StatelessWebexPlugin) {
2137
2187
  stack: _context5.t0.stack
2138
2188
  });
2139
2189
  throw _context5.t0;
2140
- case 19:
2190
+ case 22:
2141
2191
  case "end":
2142
2192
  return _context5.stop();
2143
2193
  }
2144
- }, _callee5, this, [[9, 14]]);
2194
+ }, _callee5, this, [[12, 17]]);
2145
2195
  }));
2146
2196
  function refreshPermissionToken(_x3) {
2147
2197
  return _refreshPermissionToken.apply(this, arguments);
@@ -2494,7 +2544,7 @@ var Meeting = exports.default = /*#__PURE__*/function (_StatelessWebexPlugin) {
2494
2544
 
2495
2545
  /**
2496
2546
  * sets the network status on meeting object
2497
- * @param {String} networkStatus
2547
+ * @param {NETWORK_STATUS} networkStatus
2498
2548
  * @private
2499
2549
  * @returns {undefined}
2500
2550
  * @memberof Meeting
@@ -3697,6 +3747,10 @@ var Meeting = exports.default = /*#__PURE__*/function (_StatelessWebexPlugin) {
3697
3747
  requiredPolicies: [_constants.SELF_POLICY.SUPPORT_HDV],
3698
3748
  policies: this.selfUserPolicies
3699
3749
  }) && ((_this$meetingInfo4 = this.meetingInfo) === null || _this$meetingInfo4 === void 0 ? void 0 : (_this$meetingInfo4$vi = _this$meetingInfo4.video) === null || _this$meetingInfo4$vi === void 0 ? void 0 : _this$meetingInfo4$vi.supportHDV) || !this.arePolicyRestrictionsSupported(),
3750
+ enforceVirtualBackground: _util4.default.hasPolicies({
3751
+ requiredPolicies: [_constants.SELF_POLICY.ENFORCE_VIRTUAL_BACKGROUND],
3752
+ policies: this.selfUserPolicies
3753
+ }) && this.arePolicyRestrictionsSupported(),
3700
3754
  supportHQV: _util4.default.hasPolicies({
3701
3755
  requiredPolicies: [_constants.SELF_POLICY.SUPPORT_HQV],
3702
3756
  policies: this.selfUserPolicies
@@ -3820,6 +3874,10 @@ var Meeting = exports.default = /*#__PURE__*/function (_StatelessWebexPlugin) {
3820
3874
  requiredPolicies: [_constants.SELF_POLICY.SUPPORT_FILE_TRANSFER],
3821
3875
  policies: this.selfUserPolicies
3822
3876
  }),
3877
+ canChat: _util4.default.hasPolicies({
3878
+ requiredPolicies: [_constants.SELF_POLICY.SUPPORT_CHAT],
3879
+ policies: this.selfUserPolicies
3880
+ }),
3823
3881
  canShareApplication: _util4.default.hasHints({
3824
3882
  requiredHints: [_constants.DISPLAY_HINTS.SHARE_APPLICATION],
3825
3883
  displayHints: this.userDisplayHints
@@ -3866,8 +3924,9 @@ var Meeting = exports.default = /*#__PURE__*/function (_StatelessWebexPlugin) {
3866
3924
  }, {
3867
3925
  key: "setSelfUserPolicies",
3868
3926
  value: function setSelfUserPolicies() {
3869
- var _this$permissionToken, _this$permissionToken2;
3927
+ var _this$permissionToken, _this$permissionToken2, _this$permissionToken3, _this$permissionToken4;
3870
3928
  this.selfUserPolicies = (_this$permissionToken = this.permissionTokenPayload) === null || _this$permissionToken === void 0 ? void 0 : (_this$permissionToken2 = _this$permissionToken.permission) === null || _this$permissionToken2 === void 0 ? void 0 : _this$permissionToken2.userPolicies;
3929
+ this.enforceVBGImagesURL = (_this$permissionToken3 = this.permissionTokenPayload) === null || _this$permissionToken3 === void 0 ? void 0 : (_this$permissionToken4 = _this$permissionToken3.permission) === null || _this$permissionToken4 === void 0 ? void 0 : _this$permissionToken4.enforceVBGImagesURL;
3871
3930
  }
3872
3931
 
3873
3932
  /**
@@ -3981,8 +4040,7 @@ var Meeting = exports.default = /*#__PURE__*/function (_StatelessWebexPlugin) {
3981
4040
  var _this$mediaProperties4 = this.mediaProperties,
3982
4041
  remoteAudioStream = _this$mediaProperties4.remoteAudioStream,
3983
4042
  remoteVideoStream = _this$mediaProperties4.remoteVideoStream,
3984
- remoteShareStream = _this$mediaProperties4.remoteShareStream,
3985
- shareAudioStream = _this$mediaProperties4.shareAudioStream;
4043
+ remoteShareStream = _this$mediaProperties4.remoteShareStream;
3986
4044
 
3987
4045
  /**
3988
4046
  * Triggers an event to the developer
@@ -4013,7 +4071,7 @@ var Meeting = exports.default = /*#__PURE__*/function (_StatelessWebexPlugin) {
4013
4071
  triggerMediaStoppedEvent(type);
4014
4072
  });
4015
4073
  };
4016
- return _promise.default.all([stopStream(remoteAudioStream, _constants.EVENT_TYPES.REMOTE_AUDIO), stopStream(remoteVideoStream, _constants.EVENT_TYPES.REMOTE_VIDEO), stopStream(remoteShareStream, _constants.EVENT_TYPES.REMOTE_SHARE), stopStream(shareAudioStream, _constants.EVENT_TYPES.REMOTE_SHARE_AUDIO)]);
4074
+ return _promise.default.all([stopStream(remoteAudioStream, _constants.EVENT_TYPES.REMOTE_AUDIO), stopStream(remoteVideoStream, _constants.EVENT_TYPES.REMOTE_VIDEO), stopStream(remoteShareStream, _constants.EVENT_TYPES.REMOTE_SHARE)]);
4017
4075
  }
4018
4076
 
4019
4077
  /**
@@ -4123,22 +4181,24 @@ var Meeting = exports.default = /*#__PURE__*/function (_StatelessWebexPlugin) {
4123
4181
  while (1) switch (_context12.prev = _context12.next) {
4124
4182
  case 0:
4125
4183
  oldStream = this.mediaProperties.shareVideoStream;
4184
+ oldStream === null || oldStream === void 0 ? void 0 : oldStream.off(_mediaHelpers.StreamEventNames.MuteStateChange, this.handleShareVideoStreamMuteStateChange);
4126
4185
  oldStream === null || oldStream === void 0 ? void 0 : oldStream.off(_mediaHelpers.StreamEventNames.Ended, this.handleShareVideoStreamEnded);
4127
4186
  oldStream === null || oldStream === void 0 ? void 0 : oldStream.off(_mediaHelpers.LocalStreamEventNames.OutputTrackChange, this.localOutputTrackChangeHandler);
4128
4187
  this.mediaProperties.setLocalShareVideoStream(localDisplayStream);
4188
+ localDisplayStream === null || localDisplayStream === void 0 ? void 0 : localDisplayStream.on(_mediaHelpers.StreamEventNames.MuteStateChange, this.handleShareVideoStreamMuteStateChange);
4129
4189
  localDisplayStream === null || localDisplayStream === void 0 ? void 0 : localDisplayStream.on(_mediaHelpers.StreamEventNames.Ended, this.handleShareVideoStreamEnded);
4130
4190
  localDisplayStream === null || localDisplayStream === void 0 ? void 0 : localDisplayStream.on(_mediaHelpers.LocalStreamEventNames.OutputTrackChange, this.localOutputTrackChangeHandler);
4131
4191
  this.mediaProperties.mediaDirection.sendShare = this.mediaProperties.hasLocalShareStream();
4132
4192
  if (!(!this.isMultistream || !localDisplayStream)) {
4133
- _context12.next = 10;
4193
+ _context12.next = 12;
4134
4194
  break;
4135
4195
  }
4136
- _context12.next = 10;
4137
- return this.unpublishStream(_internalMediaCore.MediaType.VideoSlides, oldStream);
4138
- case 10:
4139
4196
  _context12.next = 12;
4140
- return this.publishStream(_internalMediaCore.MediaType.VideoSlides, this.mediaProperties.shareVideoStream);
4197
+ return this.unpublishStream(_internalMediaCore.MediaType.VideoSlides, oldStream);
4141
4198
  case 12:
4199
+ _context12.next = 14;
4200
+ return this.publishStream(_internalMediaCore.MediaType.VideoSlides, this.mediaProperties.shareVideoStream);
4201
+ case 14:
4142
4202
  case "end":
4143
4203
  return _context12.stop();
4144
4204
  }
@@ -4235,9 +4295,10 @@ var Meeting = exports.default = /*#__PURE__*/function (_StatelessWebexPlugin) {
4235
4295
  audioStream === null || audioStream === void 0 ? void 0 : audioStream.off(_mediaHelpers.LocalStreamEventNames.OutputTrackChange, this.localOutputTrackChangeHandler);
4236
4296
  videoStream === null || videoStream === void 0 ? void 0 : videoStream.off(_mediaHelpers.StreamEventNames.MuteStateChange, this.localVideoStreamMuteStateHandler);
4237
4297
  videoStream === null || videoStream === void 0 ? void 0 : videoStream.off(_mediaHelpers.LocalStreamEventNames.OutputTrackChange, this.localOutputTrackChangeHandler);
4238
- shareAudioStream === null || shareAudioStream === void 0 ? void 0 : shareAudioStream.off(_mediaHelpers.StreamEventNames.MuteStateChange, this.handleShareAudioStreamEnded);
4298
+ shareAudioStream === null || shareAudioStream === void 0 ? void 0 : shareAudioStream.off(_mediaHelpers.StreamEventNames.Ended, this.handleShareAudioStreamEnded);
4239
4299
  shareAudioStream === null || shareAudioStream === void 0 ? void 0 : shareAudioStream.off(_mediaHelpers.LocalStreamEventNames.OutputTrackChange, this.localOutputTrackChangeHandler);
4240
- shareVideoStream === null || shareVideoStream === void 0 ? void 0 : shareVideoStream.off(_mediaHelpers.StreamEventNames.MuteStateChange, this.handleShareVideoStreamEnded);
4300
+ shareVideoStream === null || shareVideoStream === void 0 ? void 0 : shareVideoStream.off(_mediaHelpers.StreamEventNames.MuteStateChange, this.handleShareVideoStreamMuteStateChange);
4301
+ shareVideoStream === null || shareVideoStream === void 0 ? void 0 : shareVideoStream.off(_mediaHelpers.StreamEventNames.Ended, this.handleShareVideoStreamEnded);
4241
4302
  shareVideoStream === null || shareVideoStream === void 0 ? void 0 : shareVideoStream.off(_mediaHelpers.LocalStreamEventNames.OutputTrackChange, this.localOutputTrackChangeHandler);
4242
4303
  this.mediaProperties.setLocalAudioStream(undefined);
4243
4304
  this.mediaProperties.setLocalVideoStream(undefined);
@@ -4351,6 +4412,7 @@ var Meeting = exports.default = /*#__PURE__*/function (_StatelessWebexPlugin) {
4351
4412
  this.receiveSlotManager.reset();
4352
4413
  this.mediaProperties.webrtcMediaConnection.close();
4353
4414
  this.sendSlotManager.reset();
4415
+ this.setNetworkStatus(undefined);
4354
4416
  }
4355
4417
  this.audio = null;
4356
4418
  this.video = null;
@@ -4378,8 +4440,8 @@ var Meeting = exports.default = /*#__PURE__*/function (_StatelessWebexPlugin) {
4378
4440
  }
4379
4441
 
4380
4442
  /**
4381
- * Convenience method to set the correlation id for the Meeting
4382
- * @param {String} id correlation id to set on the class
4443
+ * Convenience method to set the correlation id for the callStateForMetrics
4444
+ * @param {String} id correlation id to set on the callStateForMetrics
4383
4445
  * @returns {undefined}
4384
4446
  * @public
4385
4447
  * @memberof Meeting
@@ -4387,7 +4449,20 @@ var Meeting = exports.default = /*#__PURE__*/function (_StatelessWebexPlugin) {
4387
4449
  }, {
4388
4450
  key: "setCorrelationId",
4389
4451
  value: function setCorrelationId(id) {
4390
- this.correlationId = id;
4452
+ this.callStateForMetrics.correlationId = id;
4453
+ }
4454
+
4455
+ /**
4456
+ * Update the callStateForMetrics
4457
+ * @param {CallStateForMetrics} callStateForMetrics updated values for callStateForMetrics
4458
+ * @returns {undefined}
4459
+ * @public
4460
+ * @memberof Meeting
4461
+ */
4462
+ }, {
4463
+ key: "updateCallStateForMetrics",
4464
+ value: function updateCallStateForMetrics(callStateForMetrics) {
4465
+ this.callStateForMetrics = _objectSpread(_objectSpread({}, this.callStateForMetrics), callStateForMetrics);
4391
4466
  }
4392
4467
 
4393
4468
  /**
@@ -4682,11 +4757,27 @@ var Meeting = exports.default = /*#__PURE__*/function (_StatelessWebexPlugin) {
4682
4757
  function: 'reconnect'
4683
4758
  }, _constants.EVENT_TRIGGERS.MEETING_RECONNECTION_STARTING);
4684
4759
  return this.reconnectionManager.reconnect(options).then(function () {
4760
+ return _this29.waitForRemoteSDPAnswer();
4761
+ }).then(function () {
4762
+ return _this29.waitForMediaConnectionConnected();
4763
+ }).then(function () {
4685
4764
  _triggerProxy.default.trigger(_this29, {
4686
4765
  file: 'meeting/index',
4687
4766
  function: 'reconnect'
4688
4767
  }, _constants.EVENT_TRIGGERS.MEETING_RECONNECTION_SUCCESS);
4689
4768
  _loggerProxy.default.logger.log('Meeting:index#reconnect --> Meeting reconnect success');
4769
+
4770
+ // @ts-ignore
4771
+ _this29.webex.internal.newMetrics.submitClientEvent({
4772
+ name: 'client.media.recovered',
4773
+ payload: {
4774
+ recoveredBy: 'new'
4775
+ },
4776
+ options: {
4777
+ meetingId: _this29.id
4778
+ }
4779
+ });
4780
+ _this29.reconnectionManager.setStatus(_constants.RECONNECTION.STATE.COMPLETE);
4690
4781
  }).catch(function (error) {
4691
4782
  _triggerProxy.default.trigger(_this29, {
4692
4783
  file: 'meeting/index',
@@ -4937,8 +5028,9 @@ var Meeting = exports.default = /*#__PURE__*/function (_StatelessWebexPlugin) {
4937
5028
  this.webex.internal.newMetrics.submitClientEvent({
4938
5029
  name: 'client.call.initiated',
4939
5030
  payload: {
4940
- trigger: 'user-interaction',
4941
- isRoapCallEnabled: true
5031
+ trigger: this.callStateForMetrics.joinTrigger || 'user-interaction',
5032
+ isRoapCallEnabled: true,
5033
+ pstnAudioType: options === null || options === void 0 ? void 0 : options.pstnAudioType
4942
5034
  },
4943
5035
  options: {
4944
5036
  meetingId: this.id
@@ -5085,7 +5177,7 @@ var Meeting = exports.default = /*#__PURE__*/function (_StatelessWebexPlugin) {
5085
5177
  }).then(function (join) {
5086
5178
  if (isBrowser) {
5087
5179
  // @ts-ignore - config coming from registerPlugin
5088
- if (_this32.config.receiveTranscription || _this32.receiveTranscription) {
5180
+ if (_this32.config.receiveTranscription || options.receiveTranscription) {
5089
5181
  if (_this32.isTranscriptionSupported()) {
5090
5182
  _loggerProxy.default.logger.info('Meeting:index#join --> Attempting to enabled to receive transcription!');
5091
5183
  _this32.startTranscription().catch(function (error) {
@@ -5639,27 +5731,30 @@ var Meeting = exports.default = /*#__PURE__*/function (_StatelessWebexPlugin) {
5639
5731
  case 5:
5640
5732
  _context20.prev = 5;
5641
5733
  _context20.t0 = _context20["catch"](0);
5642
- // @ts-ignore
5643
- this.webex.internal.newMetrics.submitClientEvent({
5644
- name: 'client.ice.end',
5645
- payload: {
5646
- canProceed: !this.turnServerUsed,
5647
- // If we haven't done turn tls retry yet we will proceed with join attempt
5648
- icePhase: this.turnServerUsed ? 'JOIN_MEETING_FINAL' : 'JOIN_MEETING_RETRY',
5649
- errors: [
5650
- // @ts-ignore
5651
- this.webex.internal.newMetrics.callDiagnosticMetrics.getErrorPayloadForClientErrorCode({
5652
- clientErrorCode: _internalPluginMetrics.CallDiagnosticUtils.generateClientErrorCodeForIceFailure({
5653
- signalingState: ((_this$mediaProperties6 = this.mediaProperties.webrtcMediaConnection) === null || _this$mediaProperties6 === void 0 ? void 0 : (_this$mediaProperties7 = _this$mediaProperties6.multistreamConnection) === null || _this$mediaProperties7 === void 0 ? void 0 : (_this$mediaProperties8 = _this$mediaProperties7.pc) === null || _this$mediaProperties8 === void 0 ? void 0 : (_this$mediaProperties9 = _this$mediaProperties8.pc) === null || _this$mediaProperties9 === void 0 ? void 0 : _this$mediaProperties9.signalingState) || ((_this$mediaProperties10 = this.mediaProperties.webrtcMediaConnection) === null || _this$mediaProperties10 === void 0 ? void 0 : (_this$mediaProperties11 = _this$mediaProperties10.mediaConnection) === null || _this$mediaProperties11 === void 0 ? void 0 : (_this$mediaProperties12 = _this$mediaProperties11.pc) === null || _this$mediaProperties12 === void 0 ? void 0 : _this$mediaProperties12.signalingState) || 'unknown',
5654
- iceConnectionState: ((_this$mediaProperties13 = this.mediaProperties.webrtcMediaConnection) === null || _this$mediaProperties13 === void 0 ? void 0 : (_this$mediaProperties14 = _this$mediaProperties13.multistreamConnection) === null || _this$mediaProperties14 === void 0 ? void 0 : (_this$mediaProperties15 = _this$mediaProperties14.pc) === null || _this$mediaProperties15 === void 0 ? void 0 : (_this$mediaProperties16 = _this$mediaProperties15.pc) === null || _this$mediaProperties16 === void 0 ? void 0 : _this$mediaProperties16.iceConnectionState) || ((_this$mediaProperties17 = this.mediaProperties.webrtcMediaConnection) === null || _this$mediaProperties17 === void 0 ? void 0 : (_this$mediaProperties18 = _this$mediaProperties17.mediaConnection) === null || _this$mediaProperties18 === void 0 ? void 0 : (_this$mediaProperties19 = _this$mediaProperties18.pc) === null || _this$mediaProperties19 === void 0 ? void 0 : _this$mediaProperties19.iceConnectionState) || 'unknown',
5655
- turnServerUsed: this.turnServerUsed
5656
- })
5657
- })]
5658
- },
5659
- options: {
5660
- meetingId: this.id
5661
- }
5662
- });
5734
+ if (!this.hasMediaConnectionConnectedAtLeastOnce) {
5735
+ // Only send CA event for join flow if we haven't successfully connected media yet
5736
+ // @ts-ignore
5737
+ this.webex.internal.newMetrics.submitClientEvent({
5738
+ name: 'client.ice.end',
5739
+ payload: {
5740
+ canProceed: !this.turnServerUsed,
5741
+ // If we haven't done turn tls retry yet we will proceed with join attempt
5742
+ icePhase: this.turnServerUsed ? 'JOIN_MEETING_FINAL' : 'JOIN_MEETING_RETRY',
5743
+ errors: [
5744
+ // @ts-ignore
5745
+ this.webex.internal.newMetrics.callDiagnosticMetrics.getErrorPayloadForClientErrorCode({
5746
+ clientErrorCode: _internalPluginMetrics.CallDiagnosticUtils.generateClientErrorCodeForIceFailure({
5747
+ signalingState: ((_this$mediaProperties6 = this.mediaProperties.webrtcMediaConnection) === null || _this$mediaProperties6 === void 0 ? void 0 : (_this$mediaProperties7 = _this$mediaProperties6.multistreamConnection) === null || _this$mediaProperties7 === void 0 ? void 0 : (_this$mediaProperties8 = _this$mediaProperties7.pc) === null || _this$mediaProperties8 === void 0 ? void 0 : (_this$mediaProperties9 = _this$mediaProperties8.pc) === null || _this$mediaProperties9 === void 0 ? void 0 : _this$mediaProperties9.signalingState) || ((_this$mediaProperties10 = this.mediaProperties.webrtcMediaConnection) === null || _this$mediaProperties10 === void 0 ? void 0 : (_this$mediaProperties11 = _this$mediaProperties10.mediaConnection) === null || _this$mediaProperties11 === void 0 ? void 0 : (_this$mediaProperties12 = _this$mediaProperties11.pc) === null || _this$mediaProperties12 === void 0 ? void 0 : _this$mediaProperties12.signalingState) || 'unknown',
5748
+ iceConnectionState: ((_this$mediaProperties13 = this.mediaProperties.webrtcMediaConnection) === null || _this$mediaProperties13 === void 0 ? void 0 : (_this$mediaProperties14 = _this$mediaProperties13.multistreamConnection) === null || _this$mediaProperties14 === void 0 ? void 0 : (_this$mediaProperties15 = _this$mediaProperties14.pc) === null || _this$mediaProperties15 === void 0 ? void 0 : (_this$mediaProperties16 = _this$mediaProperties15.pc) === null || _this$mediaProperties16 === void 0 ? void 0 : _this$mediaProperties16.iceConnectionState) || ((_this$mediaProperties17 = this.mediaProperties.webrtcMediaConnection) === null || _this$mediaProperties17 === void 0 ? void 0 : (_this$mediaProperties18 = _this$mediaProperties17.mediaConnection) === null || _this$mediaProperties18 === void 0 ? void 0 : (_this$mediaProperties19 = _this$mediaProperties18.pc) === null || _this$mediaProperties19 === void 0 ? void 0 : _this$mediaProperties19.iceConnectionState) || 'unknown',
5749
+ turnServerUsed: this.turnServerUsed
5750
+ })
5751
+ })]
5752
+ },
5753
+ options: {
5754
+ meetingId: this.id
5755
+ }
5756
+ });
5757
+ }
5663
5758
  throw new Error("Timed out waiting for media connection to be connected, correlationId=".concat(this.correlationId));
5664
5759
  case 9:
5665
5760
  case "end":
@@ -5800,16 +5895,34 @@ var Meeting = exports.default = /*#__PURE__*/function (_StatelessWebexPlugin) {
5800
5895
  key: "retryWithForcedTurnDiscovery",
5801
5896
  value: (function () {
5802
5897
  var _retryWithForcedTurnDiscovery = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee23(remoteMediaManagerConfig, bundlePolicy) {
5898
+ var LOG_HEADER;
5803
5899
  return _regenerator.default.wrap(function _callee23$(_context23) {
5804
5900
  while (1) switch (_context23.prev = _context23.next) {
5805
5901
  case 0:
5806
5902
  this.retriedWithTurnServer = true;
5807
- _context23.next = 3;
5903
+ LOG_HEADER = 'Meeting:index#addMedia():retryWithForcedTurnDiscovery -->';
5904
+ _context23.next = 4;
5808
5905
  return this.cleanUpBeforeRetryWithTurnServer();
5809
- case 3:
5810
- _context23.next = 5;
5906
+ case 4:
5907
+ _metrics.default.sendBehavioralMetric(_constants2.default.ADD_MEDIA_RETRY, {
5908
+ correlation_id: this.correlationId,
5909
+ state: this.state,
5910
+ meetingState: this.meetingState,
5911
+ reason: 'forcingTurnTls'
5912
+ });
5913
+ if (!(this.state === _constants.MEETING_STATE.STATES.LEFT)) {
5914
+ _context23.next = 9;
5915
+ break;
5916
+ }
5917
+ _loggerProxy.default.logger.info("".concat(LOG_HEADER, " meeting state was LEFT after first attempt to establish media connection. Attempting to rejoin. "));
5918
+ _context23.next = 9;
5919
+ return this.join({
5920
+ rejoin: true
5921
+ });
5922
+ case 9:
5923
+ _context23.next = 11;
5811
5924
  return this.retryEstablishMediaConnectionWithForcedTurnDiscovery(remoteMediaManagerConfig, bundlePolicy);
5812
- case 5:
5925
+ case 11:
5813
5926
  case "end":
5814
5927
  return _context23.stop();
5815
5928
  }
@@ -6112,31 +6225,32 @@ var Meeting = exports.default = /*#__PURE__*/function (_StatelessWebexPlugin) {
6112
6225
  case 0:
6113
6226
  options = _args28.length > 0 && _args28[0] !== undefined ? _args28[0] : {};
6114
6227
  this.retriedWithTurnServer = false;
6228
+ this.hasMediaConnectionConnectedAtLeastOnce = false;
6115
6229
  LOG_HEADER = 'Meeting:index#addMedia -->';
6116
6230
  _loggerProxy.default.logger.info("".concat(LOG_HEADER, " called with: ").concat((0, _stringify.default)(options)));
6117
- if (!(this.meetingState !== _constants.FULL_STATE.ACTIVE)) {
6118
- _context28.next = 6;
6231
+ if (!(options.allowMediaInLobby !== true && this.meetingState !== _constants.FULL_STATE.ACTIVE)) {
6232
+ _context28.next = 7;
6119
6233
  break;
6120
6234
  }
6121
6235
  throw new _webexErrors.MeetingNotActiveError();
6122
- case 6:
6236
+ case 7:
6123
6237
  if (!_util.default.isUserInLeftState(this.locusInfo)) {
6124
- _context28.next = 8;
6238
+ _context28.next = 9;
6125
6239
  break;
6126
6240
  }
6127
6241
  throw new _webexErrors.UserNotJoinedError();
6128
- case 8:
6242
+ case 9:
6129
6243
  localStreams = options.localStreams, _options$audioEnabled = options.audioEnabled, audioEnabled = _options$audioEnabled === void 0 ? true : _options$audioEnabled, _options$videoEnabled = options.videoEnabled, videoEnabled = _options$videoEnabled === void 0 ? true : _options$videoEnabled, _options$shareAudioEn = options.shareAudioEnabled, shareAudioEnabled = _options$shareAudioEn === void 0 ? true : _options$shareAudioEn, _options$shareVideoEn = options.shareVideoEnabled, shareVideoEnabled = _options$shareVideoEn === void 0 ? true : _options$shareVideoEn, remoteMediaManagerConfig = options.remoteMediaManagerConfig, bundlePolicy = options.bundlePolicy, allowMediaInLobby = options.allowMediaInLobby;
6130
6244
  this.allowMediaInLobby = options === null || options === void 0 ? void 0 : options.allowMediaInLobby;
6131
6245
 
6132
6246
  // If the user is unjoined or guest waiting in lobby dont allow the user to addMedia
6133
6247
  // @ts-ignore - isUserUnadmitted coming from SelfUtil
6134
6248
  if (!(this.isUserUnadmitted && !this.wirelessShare && !allowMediaInLobby)) {
6135
- _context28.next = 12;
6249
+ _context28.next = 13;
6136
6250
  break;
6137
6251
  }
6138
6252
  throw new _webexErrors.UserInLobbyError();
6139
- case 12:
6253
+ case 13:
6140
6254
  // @ts-ignore
6141
6255
  this.webex.internal.newMetrics.submitClientEvent({
6142
6256
  name: 'client.media.capabilities',
@@ -6191,32 +6305,32 @@ var Meeting = exports.default = /*#__PURE__*/function (_StatelessWebexPlugin) {
6191
6305
  });
6192
6306
  this.audio = (0, _muteState.createMuteState)(_constants.AUDIO, this, audioEnabled);
6193
6307
  this.video = (0, _muteState.createMuteState)(_constants.VIDEO, this, videoEnabled);
6194
- _context28.prev = 17;
6195
- _context28.next = 20;
6308
+ _context28.prev = 18;
6309
+ _context28.next = 21;
6196
6310
  return this.setUpLocalStreamReferences(localStreams);
6197
- case 20:
6311
+ case 21:
6198
6312
  this.setMercuryListener();
6199
6313
  this.createStatsAnalyzer();
6200
- _context28.next = 24;
6314
+ _context28.next = 25;
6201
6315
  return this.establishMediaConnection(remoteMediaManagerConfig, bundlePolicy, false);
6202
- case 24:
6203
- _context28.next = 26;
6316
+ case 25:
6317
+ _context28.next = 27;
6204
6318
  return Meeting.handleDeviceLogging();
6205
- case 26:
6319
+ case 27:
6206
6320
  if (!this.mediaProperties.hasLocalShareStream()) {
6207
- _context28.next = 29;
6321
+ _context28.next = 30;
6208
6322
  break;
6209
6323
  }
6210
- _context28.next = 29;
6324
+ _context28.next = 30;
6211
6325
  return this.enqueueScreenShareFloorRequest();
6212
- case 29:
6213
- _context28.next = 31;
6326
+ case 30:
6327
+ _context28.next = 32;
6214
6328
  return this.mediaProperties.getCurrentConnectionType();
6215
- case 31:
6329
+ case 32:
6216
6330
  connectionType = _context28.sent;
6217
- _context28.next = 34;
6331
+ _context28.next = 35;
6218
6332
  return this.webex.meetings.reachability.getReachabilityMetrics();
6219
- case 34:
6333
+ case 35:
6220
6334
  reachabilityStats = _context28.sent;
6221
6335
  _metrics.default.sendBehavioralMetric(_constants2.default.ADD_MEDIA_SUCCESS, _objectSpread({
6222
6336
  correlation_id: this.correlationId,
@@ -6236,17 +6350,17 @@ var Meeting = exports.default = /*#__PURE__*/function (_StatelessWebexPlugin) {
6236
6350
 
6237
6351
  // We can log ReceiveSlot SSRCs only after the SDP exchange, so doing it here:
6238
6352
  (_this$remoteMediaMana = this.remoteMediaManager) === null || _this$remoteMediaMana === void 0 ? void 0 : _this$remoteMediaMana.logAllReceiveSlots();
6239
- _context28.next = 53;
6353
+ _context28.next = 54;
6240
6354
  break;
6241
- case 41:
6242
- _context28.prev = 41;
6243
- _context28.t0 = _context28["catch"](17);
6355
+ case 42:
6356
+ _context28.prev = 42;
6357
+ _context28.t0 = _context28["catch"](18);
6244
6358
  _loggerProxy.default.logger.error("".concat(LOG_HEADER, " failed to establish media connection: "), _context28.t0);
6245
6359
 
6246
6360
  // @ts-ignore
6247
- _context28.next = 46;
6361
+ _context28.next = 47;
6248
6362
  return this.webex.meetings.reachability.getReachabilityMetrics();
6249
- case 46:
6363
+ case 47:
6250
6364
  reachabilityMetrics = _context28.sent;
6251
6365
  _metrics.default.sendBehavioralMetric(_constants2.default.ADD_MEDIA_FAILURE, _objectSpread({
6252
6366
  correlation_id: this.correlationId,
@@ -6262,9 +6376,9 @@ var Meeting = exports.default = /*#__PURE__*/function (_StatelessWebexPlugin) {
6262
6376
  connectionState: ((_this$mediaProperties27 = this.mediaProperties.webrtcMediaConnection) === null || _this$mediaProperties27 === void 0 ? void 0 : (_this$mediaProperties28 = _this$mediaProperties27.multistreamConnection) === null || _this$mediaProperties28 === void 0 ? void 0 : (_this$mediaProperties29 = _this$mediaProperties28.pc) === null || _this$mediaProperties29 === void 0 ? void 0 : (_this$mediaProperties30 = _this$mediaProperties29.pc) === null || _this$mediaProperties30 === void 0 ? void 0 : _this$mediaProperties30.connectionState) || ((_this$mediaProperties31 = this.mediaProperties.webrtcMediaConnection) === null || _this$mediaProperties31 === void 0 ? void 0 : (_this$mediaProperties32 = _this$mediaProperties31.mediaConnection) === null || _this$mediaProperties32 === void 0 ? void 0 : (_this$mediaProperties33 = _this$mediaProperties32.pc) === null || _this$mediaProperties33 === void 0 ? void 0 : _this$mediaProperties33.connectionState) || 'unknown',
6263
6377
  iceConnectionState: ((_this$mediaProperties34 = this.mediaProperties.webrtcMediaConnection) === null || _this$mediaProperties34 === void 0 ? void 0 : (_this$mediaProperties35 = _this$mediaProperties34.multistreamConnection) === null || _this$mediaProperties35 === void 0 ? void 0 : (_this$mediaProperties36 = _this$mediaProperties35.pc) === null || _this$mediaProperties36 === void 0 ? void 0 : (_this$mediaProperties37 = _this$mediaProperties36.pc) === null || _this$mediaProperties37 === void 0 ? void 0 : _this$mediaProperties37.iceConnectionState) || ((_this$mediaProperties38 = this.mediaProperties.webrtcMediaConnection) === null || _this$mediaProperties38 === void 0 ? void 0 : (_this$mediaProperties39 = _this$mediaProperties38.mediaConnection) === null || _this$mediaProperties39 === void 0 ? void 0 : (_this$mediaProperties40 = _this$mediaProperties39.pc) === null || _this$mediaProperties40 === void 0 ? void 0 : _this$mediaProperties40.iceConnectionState) || 'unknown'
6264
6378
  }, reachabilityMetrics));
6265
- _context28.next = 50;
6379
+ _context28.next = 51;
6266
6380
  return this.cleanUpOnAddMediaFailure();
6267
- case 50:
6381
+ case 51:
6268
6382
  // Upload logs on error while adding media
6269
6383
  _triggerProxy.default.trigger(this, {
6270
6384
  file: 'meeting/index',
@@ -6276,11 +6390,11 @@ var Meeting = exports.default = /*#__PURE__*/function (_StatelessWebexPlugin) {
6276
6390
  });
6277
6391
  }
6278
6392
  throw _context28.t0;
6279
- case 53:
6393
+ case 54:
6280
6394
  case "end":
6281
6395
  return _context28.stop();
6282
6396
  }
6283
- }, _callee28, this, [[17, 41]]);
6397
+ }, _callee28, this, [[18, 42]]);
6284
6398
  }));
6285
6399
  function addMedia() {
6286
6400
  return _addMedia.apply(this, arguments);
@@ -6700,9 +6814,7 @@ var Meeting = exports.default = /*#__PURE__*/function (_StatelessWebexPlugin) {
6700
6814
  uri: whiteboard.url
6701
6815
  }).catch(function (error) {
6702
6816
  _loggerProxy.default.logger.error('Meeting:index#stopWhiteboardShare --> Error ', error);
6703
- _metrics.default.sendBehavioralMetric(
6704
- // @ts-ignore - check if STOP_WHITEBOARD_SHARE_FAILURE exists
6705
- _constants2.default.STOP_WHITEBOARD_SHARE_FAILURE, {
6817
+ _metrics.default.sendBehavioralMetric(_constants2.default.MEETING_STOP_WHITEBOARD_SHARE_FAILURE, {
6706
6818
  correlation_id: _this45.correlationId,
6707
6819
  locus_id: _this45.locusUrl.split('/').pop(),
6708
6820
  reason: error.message,
@@ -6756,6 +6868,10 @@ var Meeting = exports.default = /*#__PURE__*/function (_StatelessWebexPlugin) {
6756
6868
  resourceUrl: this.resourceUrl
6757
6869
  }).then(function () {
6758
6870
  _this46.screenShareFloorState = ScreenShareFloorStatus.GRANTED;
6871
+ _metrics.default.sendBehavioralMetric(_constants2.default.MEETING_SHARE_SUCCESS, {
6872
+ correlation_id: _this46.correlationId,
6873
+ locus_id: _this46.locusUrl.split('/').pop()
6874
+ });
6759
6875
  return _promise.default.resolve();
6760
6876
  }).catch(function (error) {
6761
6877
  _loggerProxy.default.logger.error('Meeting:index#share --> Error ', error);
@@ -7359,6 +7475,10 @@ var Meeting = exports.default = /*#__PURE__*/function (_StatelessWebexPlugin) {
7359
7475
  _this$mediaProperties44,
7360
7476
  _this$mediaProperties45,
7361
7477
  _this$mediaProperties46,
7478
+ _this$mediaProperties47,
7479
+ _this$mediaProperties48,
7480
+ _this$mediaProperties49,
7481
+ _this$mediaProperties50,
7362
7482
  _this51 = this;
7363
7483
  var LOG_HEADER = 'Meeting:index#updateTranscodedMediaConnection -->';
7364
7484
  _loggerProxy.default.logger.info("".concat(LOG_HEADER, " starting"));
@@ -7368,10 +7488,10 @@ var Meeting = exports.default = /*#__PURE__*/function (_StatelessWebexPlugin) {
7368
7488
  return this.mediaProperties.webrtcMediaConnection.update({
7369
7489
  // TODO: RoapMediaConnection is not ready to use stream classes yet, so we pass the raw MediaStreamTrack for now
7370
7490
  localTracks: {
7371
- audio: ((_this$mediaProperties43 = this.mediaProperties.audioStream) === null || _this$mediaProperties43 === void 0 ? void 0 : _this$mediaProperties43.outputTrack) || null,
7372
- video: ((_this$mediaProperties44 = this.mediaProperties.videoStream) === null || _this$mediaProperties44 === void 0 ? void 0 : _this$mediaProperties44.outputTrack) || null,
7373
- screenShareVideo: ((_this$mediaProperties45 = this.mediaProperties.shareVideoStream) === null || _this$mediaProperties45 === void 0 ? void 0 : _this$mediaProperties45.outputTrack) || null,
7374
- screenShareAudio: ((_this$mediaProperties46 = this.mediaProperties.shareAudioStream) === null || _this$mediaProperties46 === void 0 ? void 0 : _this$mediaProperties46.outputTrack) || null
7491
+ audio: ((_this$mediaProperties43 = this.mediaProperties.audioStream) === null || _this$mediaProperties43 === void 0 ? void 0 : (_this$mediaProperties44 = _this$mediaProperties43.outputStream) === null || _this$mediaProperties44 === void 0 ? void 0 : _this$mediaProperties44.getTracks()[0]) || null,
7492
+ video: ((_this$mediaProperties45 = this.mediaProperties.videoStream) === null || _this$mediaProperties45 === void 0 ? void 0 : (_this$mediaProperties46 = _this$mediaProperties45.outputStream) === null || _this$mediaProperties46 === void 0 ? void 0 : _this$mediaProperties46.getTracks()[0]) || null,
7493
+ screenShareVideo: ((_this$mediaProperties47 = this.mediaProperties.shareVideoStream) === null || _this$mediaProperties47 === void 0 ? void 0 : (_this$mediaProperties48 = _this$mediaProperties47.outputStream) === null || _this$mediaProperties48 === void 0 ? void 0 : _this$mediaProperties48.getTracks()[0]) || null,
7494
+ screenShareAudio: ((_this$mediaProperties49 = this.mediaProperties.shareAudioStream) === null || _this$mediaProperties49 === void 0 ? void 0 : (_this$mediaProperties50 = _this$mediaProperties49.outputStream) === null || _this$mediaProperties50 === void 0 ? void 0 : _this$mediaProperties50.getTracks()[0]) || null
7375
7495
  },
7376
7496
  direction: {
7377
7497
  audio: _media.default.getDirection(true, this.mediaProperties.mediaDirection.receiveAudio, this.mediaProperties.mediaDirection.sendAudio),
@@ -7635,15 +7755,15 @@ var Meeting = exports.default = /*#__PURE__*/function (_StatelessWebexPlugin) {
7635
7755
  return unpublishStreams;
7636
7756
  }()
7637
7757
  /**
7638
- * Gets the time left in seconds till the permission token expires
7758
+ * Gets permission token expiry information including timeLeft, expiryTime, currentTime
7639
7759
  * (from the time the function has been fired)
7640
7760
  *
7641
- * @returns {number} time left in seconds
7761
+ * @returns {object} containing timeLeft, expiryTime, currentTime
7642
7762
  */
7643
7763
  )
7644
7764
  }, {
7645
- key: "getPermissionTokenTimeLeftInSec",
7646
- value: function getPermissionTokenTimeLeftInSec() {
7765
+ key: "getPermissionTokenExpiryInfo",
7766
+ value: function getPermissionTokenExpiryInfo() {
7647
7767
  if (!this.permissionTokenPayload) {
7648
7768
  return undefined;
7649
7769
  }
@@ -7655,7 +7775,12 @@ var Meeting = exports.default = /*#__PURE__*/function (_StatelessWebexPlugin) {
7655
7775
 
7656
7776
  // substract current time from the permissionTokenExp
7657
7777
  // (permissionTokenExp is a epoch timestamp, not a time to live duration)
7658
- return (permissionTokenExpValue - now) / 1000;
7778
+ var timeLeft = (permissionTokenExpValue - now) / 1000;
7779
+ return {
7780
+ timeLeft: timeLeft,
7781
+ expiryTime: permissionTokenExpValue,
7782
+ currentTime: now
7783
+ };
7659
7784
  }
7660
7785
 
7661
7786
  /**
@@ -7669,8 +7794,9 @@ var Meeting = exports.default = /*#__PURE__*/function (_StatelessWebexPlugin) {
7669
7794
  }, {
7670
7795
  key: "checkAndRefreshPermissionToken",
7671
7796
  value: function checkAndRefreshPermissionToken(threshold, reason) {
7672
- var permissionTokenTimeLeft = this.getPermissionTokenTimeLeftInSec();
7673
- if (permissionTokenTimeLeft !== undefined && permissionTokenTimeLeft <= threshold) {
7797
+ var _this$getPermissionTo;
7798
+ var timeLeft = (_this$getPermissionTo = this.getPermissionTokenExpiryInfo()) === null || _this$getPermissionTo === void 0 ? void 0 : _this$getPermissionTo.timeLeft;
7799
+ if (timeLeft !== undefined && timeLeft <= threshold) {
7674
7800
  return this.refreshPermissionToken(reason);
7675
7801
  }
7676
7802
  return _promise.default.resolve();