@webex/plugin-meetings 3.0.0-beta.236 → 3.0.0-beta.238

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 (41) hide show
  1. package/dist/breakouts/breakout.js +1 -1
  2. package/dist/breakouts/index.js +1 -1
  3. package/dist/constants.js +2 -0
  4. package/dist/constants.js.map +1 -1
  5. package/dist/interpretation/index.js +1 -1
  6. package/dist/interpretation/siLanguage.js +1 -1
  7. package/dist/meeting/request.js.map +1 -1
  8. package/dist/meeting/util.js +30 -1
  9. package/dist/meeting/util.js.map +1 -1
  10. package/dist/meetings/index.js +3 -4
  11. package/dist/meetings/index.js.map +1 -1
  12. package/dist/metrics/constants.js +1 -0
  13. package/dist/metrics/constants.js.map +1 -1
  14. package/dist/reachability/index.js +2 -11
  15. package/dist/reachability/index.js.map +1 -1
  16. package/dist/reachability/request.js.map +1 -1
  17. package/dist/roap/index.js +2 -1
  18. package/dist/roap/index.js.map +1 -1
  19. package/dist/roap/turnDiscovery.js +2 -1
  20. package/dist/roap/turnDiscovery.js.map +1 -1
  21. package/dist/types/meeting/request.d.ts +1 -1
  22. package/dist/types/meeting/util.d.ts +9 -1
  23. package/dist/types/metrics/constants.d.ts +1 -0
  24. package/dist/types/reachability/index.d.ts +0 -6
  25. package/dist/types/reachability/request.d.ts +1 -1
  26. package/package.json +19 -19
  27. package/src/constants.ts +2 -2
  28. package/src/meeting/request.ts +1 -1
  29. package/src/meeting/util.ts +35 -1
  30. package/src/meetings/index.ts +2 -2
  31. package/src/metrics/constants.ts +1 -0
  32. package/src/reachability/index.ts +4 -10
  33. package/src/reachability/request.ts +1 -1
  34. package/src/roap/index.ts +2 -1
  35. package/src/roap/turnDiscovery.ts +2 -1
  36. package/test/unit/spec/meeting/index.js +3 -1
  37. package/test/unit/spec/meeting/utils.js +53 -3
  38. package/test/unit/spec/meetings/index.js +66 -1
  39. package/test/unit/spec/reachability/index.ts +8 -8
  40. package/test/unit/spec/roap/index.ts +5 -1
  41. package/test/unit/spec/roap/turnDiscovery.ts +2 -1
@@ -7,7 +7,9 @@
7
7
  import _ from 'lodash';
8
8
 
9
9
  import LoggerProxy from '../common/logs/logger-proxy';
10
- import {ICE_GATHERING_STATE, CONNECTION_STATE, REACHABILITY, IP_VERSION} from '../constants';
10
+ import MeetingUtil from '../meeting/util';
11
+
12
+ import {ICE_GATHERING_STATE, CONNECTION_STATE, REACHABILITY} from '../constants';
11
13
 
12
14
  import ReachabilityRequest from './request';
13
15
 
@@ -71,7 +73,7 @@ export default class Reachability {
71
73
  // Fetch clusters and measure latency
72
74
  try {
73
75
  const {clusters, joinCookie} = await this.reachabilityRequest.getClusters(
74
- this.getIpVersion()
76
+ MeetingUtil.getIpVersion(this.webex)
75
77
  );
76
78
 
77
79
  // Perform Reachability Check
@@ -134,14 +136,6 @@ export default class Reachability {
134
136
  return reachable;
135
137
  }
136
138
 
137
- /**
138
- * Returns what we know about the IP version of the networks we're connected to.
139
- * @returns {IP_VERSION}
140
- */
141
- getIpVersion(): IP_VERSION {
142
- return IP_VERSION.unknown;
143
- }
144
-
145
139
  /**
146
140
  * Generate peerConnection config settings
147
141
  * @param {object} cluster
@@ -33,7 +33,7 @@ class ReachabilityRequest {
33
33
  * @param {IP_VERSION} ipVersion information about current ip network we're on
34
34
  * @returns {Promise}
35
35
  */
36
- getClusters = (ipVersion: IP_VERSION): Promise<{clusters: ClusterList; joinCookie: any}> =>
36
+ getClusters = (ipVersion?: IP_VERSION): Promise<{clusters: ClusterList; joinCookie: any}> =>
37
37
  this.webex
38
38
  .request({
39
39
  method: HTTP_VERBS.GET,
package/src/roap/index.ts CHANGED
@@ -7,6 +7,7 @@ import LoggerProxy from '../common/logs/logger-proxy';
7
7
  import RoapRequest from './request';
8
8
  import TurnDiscovery from './turnDiscovery';
9
9
  import Meeting from '../meeting';
10
+ import MeetingUtil from '../meeting/util';
10
11
 
11
12
  /**
12
13
  * Roap options
@@ -201,7 +202,7 @@ export default class Roap extends StatelessWebexPlugin {
201
202
  meetingId: meeting.id,
202
203
  preferTranscoding: !meeting.isMultistream,
203
204
  locusMediaRequest: meeting.locusMediaRequest,
204
- ipVersion: meeting.webex.meetings.reachability.getIpVersion(),
205
+ ipVersion: MeetingUtil.getIpVersion(meeting.webex),
205
206
  })
206
207
  .then(({locus, mediaConnections}) => {
207
208
  if (mediaConnections) {
@@ -8,6 +8,7 @@ import {ROAP} from '../constants';
8
8
 
9
9
  import RoapRequest from './request';
10
10
  import Meeting from '../meeting';
11
+ import MeetingUtil from '../meeting/util';
11
12
 
12
13
  const TURN_DISCOVERY_TIMEOUT = 10; // in seconds
13
14
 
@@ -183,7 +184,7 @@ export default class TurnDiscovery {
183
184
  meetingId: meeting.id,
184
185
  locusMediaRequest: meeting.locusMediaRequest,
185
186
  // @ts-ignore - because of meeting.webex
186
- ipVersion: meeting.webex.meetings.reachability.getIpVersion(),
187
+ ipVersion: MeetingUtil.getIpVersion(meeting.webex),
187
188
  })
188
189
  .then(({mediaConnections}) => {
189
190
  if (mediaConnections) {
@@ -1649,6 +1649,8 @@ describe('plugin-meetings', () => {
1649
1649
  beforeEach(() => {
1650
1650
  clock = sinon.useFakeTimers();
1651
1651
 
1652
+ sinon.stub(MeetingUtil, 'getIpVersion').returns(IP_VERSION.unknown);
1653
+
1652
1654
  meeting.deviceUrl = 'deviceUrl';
1653
1655
  meeting.config.deviceType = 'web';
1654
1656
  meeting.isMultistream = isMultistream;
@@ -1662,7 +1664,6 @@ describe('plugin-meetings', () => {
1662
1664
  meeting.webex.meetings.geoHintInfo = {regionCode: 'EU', countryCode: 'UK'};
1663
1665
  meeting.webex.meetings.reachability = {
1664
1666
  isAnyClusterReachable: sinon.stub().resolves(true),
1665
- getIpVersion: () => IP_VERSION.unknown,
1666
1667
  };
1667
1668
  meeting.roap.doTurnDiscovery = sinon
1668
1669
  .stub()
@@ -1739,6 +1740,7 @@ describe('plugin-meetings', () => {
1739
1740
 
1740
1741
  afterEach(() => {
1741
1742
  clock.restore();
1743
+ sinon.restore();
1742
1744
  });
1743
1745
 
1744
1746
  // helper function that waits until all promises are resolved and any queued up /media requests to Locus are sent out
@@ -4,10 +4,9 @@ import Meetings from '@webex/plugin-meetings';
4
4
  import MeetingUtil from '@webex/plugin-meetings/src/meeting/util';
5
5
  import LoggerProxy from '@webex/plugin-meetings/src/common/logs/logger-proxy';
6
6
  import LoggerConfig from '@webex/plugin-meetings/src/common/logs/logger-config';
7
- import Metrics from '@webex/plugin-meetings/src/metrics/index';
8
- import {SELF_POLICY} from '@webex/plugin-meetings/src/constants';
9
- import {DISPLAY_HINTS} from '@webex/plugin-meetings/src/constants';
7
+ import {SELF_POLICY, IP_VERSION} from '@webex/plugin-meetings/src/constants';
10
8
  import MockWebex from '@webex/test-helper-mock-webex';
9
+ import * as BrowserDetectionModule from '@webex/plugin-meetings/src/common/browser-detection';
11
10
 
12
11
  describe('plugin-meetings', () => {
13
12
  let webex;
@@ -984,5 +983,56 @@ describe('plugin-meetings', () => {
984
983
  assert.equal(result, input);
985
984
  });
986
985
  });
986
+
987
+ describe('getIpVersion', () => {
988
+ let isBrowserStub;
989
+ beforeEach(() => {
990
+ isBrowserStub = sinon.stub().returns(false);
991
+
992
+ sinon.stub(BrowserDetectionModule, 'default').returns({
993
+ isBrowser: isBrowserStub,
994
+ });
995
+ });
996
+
997
+ afterEach(() => {
998
+ sinon.restore();
999
+ });
1000
+
1001
+ [
1002
+ {supportsIpV4: undefined, supportsIpV6: undefined, expectedOutput: IP_VERSION.unknown},
1003
+ {supportsIpV4: undefined, supportsIpV6: true, expectedOutput: IP_VERSION.only_ipv6},
1004
+ {supportsIpV4: undefined, supportsIpV6: false, expectedOutput: IP_VERSION.unknown},
1005
+ {supportsIpV4: true, supportsIpV6: undefined, expectedOutput: IP_VERSION.only_ipv4},
1006
+ {supportsIpV4: true, supportsIpV6: true, expectedOutput: IP_VERSION.ipv4_and_ipv6},
1007
+ {supportsIpV4: true, supportsIpV6: false, expectedOutput: IP_VERSION.only_ipv4},
1008
+ {supportsIpV4: false, supportsIpV6: undefined, expectedOutput: IP_VERSION.unknown},
1009
+ {supportsIpV4: false, supportsIpV6: true, expectedOutput: IP_VERSION.only_ipv6},
1010
+ {supportsIpV4: false, supportsIpV6: false, expectedOutput: IP_VERSION.unknown},
1011
+ ].forEach(({supportsIpV4, supportsIpV6, expectedOutput}) => {
1012
+ it(`returns ${expectedOutput} when supportsIpV4=${supportsIpV4} and supportsIpV6=${supportsIpV6}`, () => {
1013
+ sinon
1014
+ .stub(webex.internal.device.ipNetworkDetector, 'supportsIpV4')
1015
+ .get(() => supportsIpV4);
1016
+ sinon
1017
+ .stub(webex.internal.device.ipNetworkDetector, 'supportsIpV6')
1018
+ .get(() => supportsIpV6);
1019
+
1020
+ assert.equal(MeetingUtil.getIpVersion(webex), expectedOutput);
1021
+ });
1022
+
1023
+ it(`returns undefined when supportsIpV4=${supportsIpV4} and supportsIpV6=${supportsIpV6} and browser is firefox`, () => {
1024
+ sinon
1025
+ .stub(webex.internal.device.ipNetworkDetector, 'supportsIpV4')
1026
+ .get(() => supportsIpV4);
1027
+ sinon
1028
+ .stub(webex.internal.device.ipNetworkDetector, 'supportsIpV6')
1029
+ .get(() => supportsIpV6);
1030
+
1031
+ isBrowserStub.callsFake((name) => name === 'firefox');
1032
+
1033
+ assert.equal(MeetingUtil.getIpVersion(webex), undefined);
1034
+ });
1035
+ });
1036
+ });
987
1037
  });
988
1038
  });
@@ -20,6 +20,7 @@ import MeetingCollection from '@webex/plugin-meetings/src/meetings/collection';
20
20
  import MeetingsUtil from '@webex/plugin-meetings/src/meetings/util';
21
21
  import PersonalMeetingRoom from '@webex/plugin-meetings/src/personal-meeting-room';
22
22
  import Reachability from '@webex/plugin-meetings/src/reachability';
23
+ import Metrics from '@webex/plugin-meetings/src/metrics';
23
24
 
24
25
  import testUtils from '../../../utils/testUtils';
25
26
  import {
@@ -46,6 +47,8 @@ describe('plugin-meetings', () => {
46
47
  debug: () => {},
47
48
  };
48
49
 
50
+ let triggerProxyStub;
51
+
49
52
  beforeEach(() => {
50
53
  StaticConfig.set({
51
54
  bandwidth: {
@@ -57,7 +60,7 @@ describe('plugin-meetings', () => {
57
60
  verboseEvents: true,
58
61
  enable: false,
59
62
  });
60
- sinon.stub(TriggerProxy, 'trigger').returns(true);
63
+ triggerProxyStub = sinon.stub(TriggerProxy, 'trigger').returns(true);
61
64
  });
62
65
 
63
66
  let webex;
@@ -2092,5 +2095,67 @@ describe('plugin-meetings', () => {
2092
2095
  assert.calledWith(webex.meetings.handleLocusEvent, {locus: breakoutLocus, locusUrl: breakoutLocus.url});
2093
2096
  });
2094
2097
  });
2098
+
2099
+ describe('uploading of logs', () => {
2100
+ let metricsSpy;
2101
+ let meeting;
2102
+
2103
+ beforeEach(async () => {
2104
+ webex.meetings.config.autoUploadLogs = true;
2105
+ webex.meetings.loggerRequest.uploadLogs = sinon.stub().resolves();
2106
+
2107
+ sinon.stub(webex.meetings.meetingInfo, 'fetchInfoOptions').resolves({});
2108
+ sinon.stub(webex.meetings.meetingInfo, 'fetchMeetingInfo').resolves({});
2109
+
2110
+ triggerProxyStub.restore();
2111
+
2112
+ metricsSpy = sinon.stub(Metrics, 'sendBehavioralMetric');
2113
+
2114
+ meeting = await webex.meetings.create('test');
2115
+
2116
+ meeting.locusId = 'locus id';
2117
+ meeting.correlationId = 'correlation id';
2118
+ meeting.locusInfo = {
2119
+ fullState: { lastActive: 'last active'},
2120
+ info: { webExMeetingId: 'meeting id'}
2121
+ }
2122
+ });
2123
+
2124
+ afterEach(() => {
2125
+ sinon.restore();
2126
+ })
2127
+
2128
+ it('sends metrics on success', async () => {
2129
+
2130
+ await meeting.uploadLogs();
2131
+
2132
+ await testUtils.flushPromises();
2133
+
2134
+ assert.calledOnceWithExactly(metricsSpy, 'js_sdk_upload_logs_success', {
2135
+ callStart: 'last active',
2136
+ correlationId: 'correlation id',
2137
+ feedbackId: 'correlation id',
2138
+ locusId: 'locus id',
2139
+ meetingId: 'meeting id',
2140
+ });
2141
+ });
2142
+
2143
+ it('sends metrics on failure', async () => {
2144
+ webex.meetings.loggerRequest.uploadLogs.rejects(new Error('fake error'));
2145
+
2146
+ await meeting.uploadLogs();
2147
+
2148
+ await testUtils.flushPromises();
2149
+
2150
+ assert.calledOnceWithExactly(metricsSpy, 'js_sdk_upload_logs_failure', sinon.match({
2151
+ callStart: 'last active',
2152
+ correlationId: 'correlation id',
2153
+ feedbackId: 'correlation id',
2154
+ locusId: 'locus id',
2155
+ meetingId: 'meeting id',
2156
+ reason: 'fake error',
2157
+ }));
2158
+ });
2159
+ });
2095
2160
  });
2096
2161
  });
@@ -2,6 +2,8 @@ import {assert} from '@webex/test-helper-chai';
2
2
  import MockWebex from '@webex/test-helper-mock-webex';
3
3
  import sinon from 'sinon';
4
4
  import Reachability, {ICECandidateResult} from '@webex/plugin-meetings/src/reachability/';
5
+ import MeetingUtil from '@webex/plugin-meetings/src/meeting/util';
6
+
5
7
  import { IP_VERSION } from '@webex/plugin-meetings/src/constants';
6
8
 
7
9
  describe('isAnyClusterReachable', () => {
@@ -9,6 +11,12 @@ describe('isAnyClusterReachable', () => {
9
11
 
10
12
  beforeEach(() => {
11
13
  webex = new MockWebex();
14
+
15
+ sinon.stub(MeetingUtil, 'getIpVersion').returns(IP_VERSION.unknown);
16
+ });
17
+
18
+ afterEach(() => {
19
+ sinon.restore();
12
20
  });
13
21
 
14
22
  const checkIsClusterReachable = async (mockStorage: any, expectedValue: boolean) => {
@@ -251,12 +259,4 @@ describe('gatherReachability', () => {
251
259
  });
252
260
  });
253
261
  });
254
-
255
- describe('getIpVersion', () => {
256
- it('returns unknown', () => {
257
- const reachability = new Reachability(webex);
258
-
259
- assert.equal(reachability.getIpVersion(), IP_VERSION.unknown);
260
- })
261
- })
262
262
  });
@@ -6,6 +6,8 @@ import MockWebex from '@webex/test-helper-mock-webex';
6
6
  import RoapRequest from '@webex/plugin-meetings/src/roap/request';
7
7
  import Roap from '@webex/plugin-meetings/src/roap/';
8
8
  import Meeting from '@webex/plugin-meetings/src/meeting';
9
+ import MeetingUtil from '@webex/plugin-meetings/src/meeting/util';
10
+
9
11
  import { IP_VERSION } from '../../../../src/constants';
10
12
 
11
13
  describe('Roap', () => {
@@ -62,9 +64,11 @@ describe('Roap', () => {
62
64
  setRoapSeq: sinon.stub(),
63
65
  config: {experimental: {enableTurnDiscovery: false}},
64
66
  locusMediaRequest: {fake: true},
65
- webex: { meetings: { reachability: { isAnyClusterReachable: () => true, getIpVersion: () => IP_VERSION.unknown}}},
67
+ webex: { meetings: { reachability: { isAnyClusterReachable: () => true}}},
66
68
  };
67
69
 
70
+ sinon.stub(MeetingUtil, 'getIpVersion').returns(IP_VERSION.unknown);
71
+
68
72
  sendRoapStub = sinon.stub(RoapRequest.prototype, 'sendRoap').resolves({});
69
73
  meeting.setRoapSeq.resetHistory();
70
74
  });
@@ -5,6 +5,7 @@ import TurnDiscovery from '@webex/plugin-meetings/src/roap/turnDiscovery';
5
5
  import Metrics from '@webex/plugin-meetings/src/metrics';
6
6
  import BEHAVIORAL_METRICS from '@webex/plugin-meetings/src/metrics/constants';
7
7
  import RoapRequest from '@webex/plugin-meetings/src/roap/request';
8
+ import MeetingUtil from '@webex/plugin-meetings/src/meeting/util';
8
9
 
9
10
  import testUtils from '../../../utils/testUtils';
10
11
  import { IP_VERSION } from '../../../../src/constants';
@@ -24,6 +25,7 @@ describe('TurnDiscovery', () => {
24
25
  clock = sinon.useFakeTimers();
25
26
 
26
27
  sinon.stub(Metrics, 'sendBehavioralMetric');
28
+ sinon.stub(MeetingUtil, 'getIpVersion').returns(IP_VERSION.unknown);
27
29
 
28
30
  mockRoapRequest = {
29
31
  sendRoap: sinon.fake.resolves({mediaConnections: FAKE_MEDIA_CONNECTIONS_FROM_LOCUS}),
@@ -53,7 +55,6 @@ describe('TurnDiscovery', () => {
53
55
  updateMediaConnections: sinon.stub(),
54
56
  webex: {meetings: {reachability: {
55
57
  isAnyClusterReachable: () => Promise.resolve(false),
56
- getIpVersion: () => IP_VERSION.unknown,
57
58
  }}},
58
59
  isMultistream: false,
59
60
  locusMediaRequest: { fake: true },