@webex/plugin-meetings 3.7.0-wxcc.1 → 3.8.0-next.1

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 (52) hide show
  1. package/dist/breakouts/breakout.js +1 -1
  2. package/dist/breakouts/index.js +1 -1
  3. package/dist/constants.js +15 -3
  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/locus-info/selfUtils.js +5 -0
  8. package/dist/locus-info/selfUtils.js.map +1 -1
  9. package/dist/media/MediaConnectionAwaiter.js +1 -0
  10. package/dist/media/MediaConnectionAwaiter.js.map +1 -1
  11. package/dist/media/properties.js +30 -16
  12. package/dist/media/properties.js.map +1 -1
  13. package/dist/meeting/brbState.js +167 -0
  14. package/dist/meeting/brbState.js.map +1 -0
  15. package/dist/meeting/index.js +367 -296
  16. package/dist/meeting/index.js.map +1 -1
  17. package/dist/meeting/muteState.js +1 -6
  18. package/dist/meeting/muteState.js.map +1 -1
  19. package/dist/meeting-info/meeting-info-v2.js +19 -12
  20. package/dist/meeting-info/meeting-info-v2.js.map +1 -1
  21. package/dist/meeting-info/utilv2.js +5 -1
  22. package/dist/meeting-info/utilv2.js.map +1 -1
  23. package/dist/metrics/constants.js +2 -0
  24. package/dist/metrics/constants.js.map +1 -1
  25. package/dist/reachability/index.js +31 -3
  26. package/dist/reachability/index.js.map +1 -1
  27. package/dist/types/constants.d.ts +9 -2
  28. package/dist/types/meeting/brbState.d.ts +54 -0
  29. package/dist/types/meeting/index.d.ts +23 -0
  30. package/dist/types/meeting-info/meeting-info-v2.d.ts +3 -1
  31. package/dist/types/metrics/constants.d.ts +2 -0
  32. package/dist/types/reachability/index.d.ts +9 -1
  33. package/dist/webinar/index.js +1 -1
  34. package/package.json +23 -23
  35. package/src/constants.ts +10 -2
  36. package/src/locus-info/selfUtils.ts +5 -0
  37. package/src/media/MediaConnectionAwaiter.ts +2 -0
  38. package/src/media/properties.ts +34 -13
  39. package/src/meeting/brbState.ts +169 -0
  40. package/src/meeting/index.ts +120 -27
  41. package/src/meeting/muteState.ts +1 -6
  42. package/src/meeting-info/meeting-info-v2.ts +9 -1
  43. package/src/meeting-info/utilv2.ts +14 -2
  44. package/src/metrics/constants.ts +2 -0
  45. package/src/reachability/index.ts +29 -1
  46. package/test/unit/spec/locus-info/selfUtils.js +10 -0
  47. package/test/unit/spec/media/properties.ts +15 -0
  48. package/test/unit/spec/meeting/brbState.ts +114 -0
  49. package/test/unit/spec/meeting/index.js +101 -33
  50. package/test/unit/spec/meeting/muteState.js +0 -24
  51. package/test/unit/spec/meeting-info/utilv2.js +9 -0
  52. package/test/unit/spec/reachability/index.ts +120 -10
@@ -1050,6 +1050,7 @@ describe('gatherReachability', () => {
1050
1050
 
1051
1051
  // the metrics related to ipver and trigger are not tested in these tests and are all the same, so setting them up here
1052
1052
  const expectedMetricsFull = {
1053
+ aborted: false,
1053
1054
  ...expectedMetrics,
1054
1055
  ipver_firstIpV4: -1,
1055
1056
  ipver_firstIpV6: -1,
@@ -1238,6 +1239,7 @@ describe('gatherReachability', () => {
1238
1239
 
1239
1240
  // finally, check the metrics - they should contain values from ipNetworkDetector
1240
1241
  assert.calledWith(Metrics.sendBehavioralMetric, 'js_sdk_reachability_completed', {
1242
+ aborted: false,
1241
1243
  vmn_udp_min: -1,
1242
1244
  vmn_udp_max: -1,
1243
1245
  vmn_udp_average: -1,
@@ -1622,14 +1624,14 @@ describe('gatherReachability', () => {
1622
1624
  const reachability = new Reachability(webex);
1623
1625
 
1624
1626
  let getClustersCallCount = 0;
1625
-
1627
+
1626
1628
  reachability.reachabilityRequest.getClusters = sinon.stub().callsFake(() => {
1627
1629
  getClustersCallCount++;
1628
1630
 
1629
1631
  if (getClustersCallCount == 1) {
1630
1632
  throw new Error('fake error');
1631
1633
  }
1632
-
1634
+
1633
1635
  return getClustersResult;
1634
1636
  });
1635
1637
 
@@ -1637,7 +1639,7 @@ describe('gatherReachability', () => {
1637
1639
 
1638
1640
  await simulateTimeout();
1639
1641
  await promise;
1640
-
1642
+
1641
1643
  assert.equal(getClustersCallCount, 2);
1642
1644
 
1643
1645
  assert.calledOnce(clusterReachabilityCtorStub);
@@ -1647,7 +1649,7 @@ describe('gatherReachability', () => {
1647
1649
  const reachability = new Reachability(webex);
1648
1650
 
1649
1651
  let getClustersCallCount = 0;
1650
-
1652
+
1651
1653
  reachability.reachabilityRequest.getClusters = sinon.stub().callsFake(() => {
1652
1654
  getClustersCallCount++;
1653
1655
 
@@ -1657,9 +1659,9 @@ describe('gatherReachability', () => {
1657
1659
  const promise = reachability.gatherReachability('test');
1658
1660
 
1659
1661
  await simulateTimeout();
1660
-
1662
+
1661
1663
  await promise;
1662
-
1664
+
1663
1665
  assert.equal(getClustersCallCount, 2);
1664
1666
 
1665
1667
  assert.neverCalledWith(clusterReachabilityCtorStub);
@@ -1927,7 +1929,86 @@ describe('gatherReachability', () => {
1927
1929
  });
1928
1930
  });
1929
1931
 
1930
-
1932
+ describe('stopReachability', () => {
1933
+ let reachability;
1934
+ let receivedEvents;
1935
+ let sendMetricSpy;
1936
+
1937
+ beforeEach(() => {
1938
+ reachability = new Reachability(webex);
1939
+
1940
+ receivedEvents = {};
1941
+
1942
+ sendMetricSpy = sinon.stub(reachability, 'sendMetric').resolves();
1943
+ });
1944
+
1945
+ const setListener = (event) => {
1946
+ reachability.on(event, () => {
1947
+ receivedEvents[event] = receivedEvents[event] + 1 || 1;
1948
+ });
1949
+ };
1950
+ it('works as expected', async () => {
1951
+ setListener('reachability:stopped');
1952
+ setListener('reachability:done');
1953
+ setListener('reachability:firstResultAvailable');
1954
+
1955
+ const mockGetClustersResult = {
1956
+ clusters: {
1957
+ clusterA: {
1958
+ udp: ['udp-urlA'],
1959
+ tcp: ['tcp-urlA'],
1960
+ xtls: ['xtls-urlA'],
1961
+ isVideoMesh: false,
1962
+ },
1963
+ clusterB: {
1964
+ udp: ['udp-urlB'],
1965
+ tcp: ['tcp-urlB'],
1966
+ xtls: ['xtls-urlB'],
1967
+ isVideoMesh: false,
1968
+ },
1969
+ },
1970
+ joinCookie: {id: 'id'},
1971
+ };
1972
+
1973
+ reachability.reachabilityRequest.getClusters = sinon.stub().returns(mockGetClustersResult);
1974
+
1975
+ const gatherReachabilityFallbackSpy = sinon.spy(reachability, 'gatherReachabilityFallback');
1976
+
1977
+ const resultPromise = reachability.gatherReachability('test');
1978
+
1979
+ await testUtils.flushPromises();
1980
+
1981
+ reachability.stopReachability();
1982
+
1983
+ await resultPromise;
1984
+
1985
+ // simulate a lot of time passing to check that all timers were stopped and nothing else happens
1986
+ clock.tick(99000);
1987
+
1988
+ assert.calledOnceWithExactly(mockClusterReachabilityInstances['clusterA'].abort);
1989
+ assert.calledOnceWithExactly(mockClusterReachabilityInstances['clusterB'].abort);
1990
+
1991
+ assert.calledOnceWithExactly(sendMetricSpy, true);
1992
+
1993
+ assert.equal(receivedEvents['reachability:stopped'], 1);
1994
+ assert.equal(receivedEvents['reachability:done'], undefined);
1995
+ assert.equal(receivedEvents['reachability:firstResultAvailable'], undefined);
1996
+
1997
+ assert.notCalled(gatherReachabilityFallbackSpy);
1998
+ });
1999
+
2000
+ it('does nothing if called without reachability being started', async () => {
2001
+ const reachability = new Reachability(webex);
2002
+
2003
+ reachability.stopReachability();
2004
+
2005
+ assert.notCalled(sendMetricSpy);
2006
+
2007
+ assert.equal(receivedEvents['reachability:stopped'], undefined);
2008
+ assert.equal(receivedEvents['reachability:done'], undefined);
2009
+ assert.equal(receivedEvents['reachability:firstResultAvailable'], undefined);
2010
+ });
2011
+ });
1931
2012
  });
1932
2013
 
1933
2014
  describe('getReachabilityResults', () => {
@@ -2489,19 +2570,18 @@ describe('getStatistics', () => {
2489
2570
  describe('sendMetric', () => {
2490
2571
  let webex;
2491
2572
  let reachability;
2573
+ let getStatisticsStub;
2492
2574
 
2493
2575
  beforeEach(() => {
2494
2576
  webex = new MockWebex();
2495
2577
  reachability = new TestReachability(webex);
2496
2578
 
2497
2579
  sinon.stub(Metrics, 'sendBehavioralMetric');
2498
- });
2499
2580
 
2500
- it('works as expected', async () => {
2501
2581
  // setup stub for getStatistics to return values that show what parameters it was called with,
2502
2582
  // this way we can verify that the correct results of calls to getStatistics are placed
2503
2583
  // in correct data fields when sendBehavioralMetric() is called
2504
- const getStatisticsStub = sinon
2584
+ getStatisticsStub = sinon
2505
2585
  .stub(reachability, 'getStatistics')
2506
2586
  .callsFake((results, protocol, isVideoMesh) => {
2507
2587
  return {result: 'fake', protocol, isVideoMesh};
@@ -2522,7 +2602,13 @@ describe('sendMetric', () => {
2522
2602
  isVideoMesh: false,
2523
2603
  },
2524
2604
  });
2605
+ });
2606
+
2607
+ afterEach(() => {
2608
+ sinon.restore();
2609
+ });
2525
2610
 
2611
+ it('works as expected', async () => {
2526
2612
  await reachability.sendMetric();
2527
2613
 
2528
2614
  // each call to getStatistics should be made with all the results from all fake clusterReachability:
@@ -2546,6 +2632,30 @@ describe('sendMetric', () => {
2546
2632
  assert.alwaysCalledWith(getStatisticsStub, expectedResults, sinon.match.any, sinon.match.any);
2547
2633
 
2548
2634
  assert.calledWith(Metrics.sendBehavioralMetric, 'js_sdk_reachability_completed', {
2635
+ aborted: false,
2636
+ vmn_udp_result: 'fake',
2637
+ vmn_udp_protocol: 'udp',
2638
+ vmn_udp_isVideoMesh: true,
2639
+
2640
+ public_udp_result: 'fake',
2641
+ public_udp_protocol: 'udp',
2642
+ public_udp_isVideoMesh: false,
2643
+
2644
+ public_tcp_result: 'fake',
2645
+ public_tcp_protocol: 'tcp',
2646
+ public_tcp_isVideoMesh: false,
2647
+
2648
+ public_xtls_result: 'fake',
2649
+ public_xtls_protocol: 'xtls',
2650
+ public_xtls_isVideoMesh: false,
2651
+ });
2652
+ });
2653
+
2654
+ it('sends metric with "aborted:true" if called with aborted=true arg', async () => {
2655
+ await reachability.sendMetric(true);
2656
+
2657
+ assert.calledWith(Metrics.sendBehavioralMetric, 'js_sdk_reachability_completed', {
2658
+ aborted: true,
2549
2659
  vmn_udp_result: 'fake',
2550
2660
  vmn_udp_protocol: 'udp',
2551
2661
  vmn_udp_isVideoMesh: true,