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

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 (55) 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/meeting/in-meeting-actions.js +2 -0
  10. package/dist/meeting/in-meeting-actions.js.map +1 -1
  11. package/dist/meeting/index.js +155 -103
  12. package/dist/meeting/index.js.map +1 -1
  13. package/dist/meeting-info/meeting-info-v2.js +3 -0
  14. package/dist/meeting-info/meeting-info-v2.js.map +1 -1
  15. package/dist/meeting-info/utilv2.js +14 -29
  16. package/dist/meeting-info/utilv2.js.map +1 -1
  17. package/dist/meetings/collection.js +17 -0
  18. package/dist/meetings/collection.js.map +1 -1
  19. package/dist/meetings/index.js +13 -0
  20. package/dist/meetings/index.js.map +1 -1
  21. package/dist/metrics/constants.js +1 -0
  22. package/dist/metrics/constants.js.map +1 -1
  23. package/dist/reconnection-manager/index.js +26 -26
  24. package/dist/reconnection-manager/index.js.map +1 -1
  25. package/dist/rtcMetrics/index.js +25 -0
  26. package/dist/rtcMetrics/index.js.map +1 -1
  27. package/dist/statsAnalyzer/index.js +21 -1
  28. package/dist/statsAnalyzer/index.js.map +1 -1
  29. package/dist/statsAnalyzer/mqaUtil.js +16 -16
  30. package/dist/statsAnalyzer/mqaUtil.js.map +1 -1
  31. package/dist/webinar/index.js +1 -1
  32. package/package.json +21 -22
  33. package/src/constants.ts +10 -4
  34. package/src/controls-options-manager/enums.ts +2 -0
  35. package/src/meeting/in-meeting-actions.ts +4 -0
  36. package/src/meeting/index.ts +140 -92
  37. package/src/meeting-info/meeting-info-v2.ts +4 -0
  38. package/src/meeting-info/utilv2.ts +6 -19
  39. package/src/meetings/collection.ts +13 -0
  40. package/src/meetings/index.ts +11 -0
  41. package/src/metrics/constants.ts +1 -0
  42. package/src/reconnection-manager/index.ts +62 -66
  43. package/src/rtcMetrics/index.ts +24 -0
  44. package/src/statsAnalyzer/index.ts +30 -1
  45. package/src/statsAnalyzer/mqaUtil.ts +17 -14
  46. package/test/unit/spec/meeting/in-meeting-actions.ts +2 -0
  47. package/test/unit/spec/meeting/index.js +1058 -158
  48. package/test/unit/spec/meeting/muteState.js +2 -1
  49. package/test/unit/spec/meeting-info/meetinginfov2.js +28 -0
  50. package/test/unit/spec/meetings/collection.js +12 -0
  51. package/test/unit/spec/meetings/index.js +306 -118
  52. package/test/unit/spec/member/util.js +0 -31
  53. package/test/unit/spec/reconnection-manager/index.js +25 -10
  54. package/test/unit/spec/rtcMetrics/index.ts +20 -0
  55. package/test/unit/spec/stats-analyzer/index.js +12 -2
@@ -3,6 +3,10 @@
3
3
  */
4
4
  import 'jsdom-global/register';
5
5
 
6
+ // Polyfill for crypto: https://github.com/jsdom/jsdom/issues/1612#issuecomment-663210638
7
+ import {Crypto} from '@peculiar/webcrypto';
8
+ global.crypto = new Crypto();
9
+
6
10
  import Device from '@webex/internal-plugin-device';
7
11
  import Mercury from '@webex/internal-plugin-mercury';
8
12
  import {assert} from '@webex/test-helper-chai';
@@ -32,10 +36,10 @@ import {
32
36
  EVENT_TRIGGERS,
33
37
  } from '../../../../src/constants';
34
38
  import CaptchaError from '@webex/plugin-meetings/src/common/errors/captcha-error';
35
- import { forEach } from 'lodash';
39
+ import {forEach} from 'lodash';
36
40
  import PasswordError from '@webex/plugin-meetings/src/common/errors/password-error';
37
41
  import PermissionError from '@webex/plugin-meetings/src/common/errors/permission';
38
- import {NoiseReductionEffect,VirtualBackgroundEffect} from '@webex/media-helpers';
42
+ import {NoiseReductionEffect, VirtualBackgroundEffect} from '@webex/media-helpers';
39
43
  import NoMeetingInfoError from '../../../../src/common/errors/no-meeting-info';
40
44
 
41
45
  describe('plugin-meetings', () => {
@@ -333,10 +337,10 @@ describe('plugin-meetings', () => {
333
337
  beforeEach(() => {
334
338
  webex.credentials = {
335
339
  supertoken: {
336
- access_token: "fake_token"
337
- }
340
+ access_token: 'fake_token',
341
+ },
338
342
  };
339
- })
343
+ });
340
344
 
341
345
  it('creates background effect', async () => {
342
346
  const result = await webex.meetings.createVirtualBackgroundEffect();
@@ -350,7 +354,7 @@ describe('plugin-meetings', () => {
350
354
  generator: 'worker',
351
355
  quality: 'LOW',
352
356
  authToken: 'fake_token',
353
- mirror: false
357
+ mirror: false,
354
358
  });
355
359
  assert.exists(result.enable);
356
360
  assert.exists(result.disable);
@@ -359,13 +363,13 @@ describe('plugin-meetings', () => {
359
363
 
360
364
  it('creates background effect with custom options passed', async () => {
361
365
  const effectOptions = {
362
- generator: "local",
366
+ generator: 'local',
363
367
  frameRate: 45,
364
- mode: "IMAGE",
368
+ mode: 'IMAGE',
365
369
  mirror: false,
366
- quality: "HIGH",
367
- blurStrength: "STRONG",
368
- bgImageUrl: "https://test.webex.com/landscape.5a535788.jpg",
370
+ quality: 'HIGH',
371
+ blurStrength: 'STRONG',
372
+ bgImageUrl: 'https://test.webex.com/landscape.5a535788.jpg',
369
373
  };
370
374
 
371
375
  const result = await webex.meetings.createVirtualBackgroundEffect(effectOptions);
@@ -373,21 +377,21 @@ describe('plugin-meetings', () => {
373
377
  assert.exists(result);
374
378
  assert.instanceOf(result, VirtualBackgroundEffect);
375
379
  assert.containsAllKeys(result, ['loadModel', 'isEnabled', 'options']);
376
- assert.deepEqual(result.options, {...effectOptions, authToken: "fake_token"});
380
+ assert.deepEqual(result.options, {...effectOptions, authToken: 'fake_token'});
377
381
  assert.exists(result.enable);
378
382
  assert.exists(result.disable);
379
383
  assert.exists(result.dispose);
380
384
  });
381
- })
385
+ });
382
386
 
383
387
  describe('noise reduction effect', () => {
384
388
  beforeEach(() => {
385
389
  webex.credentials = {
386
390
  supertoken: {
387
- access_token: "fake_token"
388
- }
391
+ access_token: 'fake_token',
392
+ },
389
393
  };
390
- })
394
+ });
391
395
 
392
396
  it('creates noise reduction effect', async () => {
393
397
  const result = await webex.meetings.createNoiseReductionEffect({audioContext: {}});
@@ -397,7 +401,7 @@ describe('plugin-meetings', () => {
397
401
  assert.containsAllKeys(result, ['audioContext', 'isEnabled', 'isReady', 'options']);
398
402
  assert.deepEqual(result.options, {
399
403
  authToken: 'fake_token',
400
- audioContext: {}
404
+ audioContext: {},
401
405
  });
402
406
  assert.exists(result.enable);
403
407
  assert.exists(result.disable);
@@ -407,8 +411,8 @@ describe('plugin-meetings', () => {
407
411
  it('creates noise reduction effect with custom options passed', async () => {
408
412
  const effectOptions = {
409
413
  audioContext: {},
410
- mode: "WORKLET",
411
- env: "prod"
414
+ mode: 'WORKLET',
415
+ env: 'prod',
412
416
  };
413
417
 
414
418
  const result = await webex.meetings.createNoiseReductionEffect(effectOptions);
@@ -416,12 +420,12 @@ describe('plugin-meetings', () => {
416
420
  assert.exists(result);
417
421
  assert.instanceOf(result, NoiseReductionEffect);
418
422
  assert.containsAllKeys(result, ['audioContext', 'isEnabled', 'isReady', 'options']);
419
- assert.deepEqual(result.options, {...effectOptions, authToken: "fake_token"});
423
+ assert.deepEqual(result.options, {...effectOptions, authToken: 'fake_token'});
420
424
  assert.exists(result.enable);
421
425
  assert.exists(result.disable);
422
426
  assert.exists(result.dispose);
423
427
  });
424
- })
428
+ });
425
429
 
426
430
  describe('gets', () => {
427
431
  describe('#getReachability', () => {
@@ -431,10 +435,7 @@ describe('plugin-meetings', () => {
431
435
  it('gets the reachability data instance from webex.meetings', () => {
432
436
  const reachability = webex.meetings.getReachability();
433
437
 
434
- assert.exists(
435
- reachability,
436
- 'reachability is defined'
437
- );
438
+ assert.exists(reachability, 'reachability is defined');
438
439
  assert.instanceOf(reachability, Reachability, 'should be a reachability instance');
439
440
  });
440
441
  });
@@ -510,7 +511,6 @@ describe('plugin-meetings', () => {
510
511
  );
511
512
  });
512
513
  describe('when meeting is returned', () => {
513
-
514
514
  beforeEach(() => {
515
515
  webex.meetings.meetingCollection.getByKey = sinon.stub().returns({
516
516
  locusInfo,
@@ -645,31 +645,56 @@ describe('plugin-meetings', () => {
645
645
  await create;
646
646
  assert.calledOnce(webex.meetings.createMeeting);
647
647
  assert.calledWith(webex.meetings.createMeeting, ...createMeetingParameters);
648
- }
648
+ };
649
649
 
650
650
  it('calls createMeeting and returns its promise', async () => {
651
- checkCallCreateMeeting([test1, test2, FAKE_USE_RANDOM_DELAY, {}, correlationId, true], [test1, test2, FAKE_USE_RANDOM_DELAY, {}, correlationId, true]);
651
+ checkCallCreateMeeting(
652
+ [test1, test2, FAKE_USE_RANDOM_DELAY, {}, correlationId, true],
653
+ [test1, test2, FAKE_USE_RANDOM_DELAY, {}, correlationId, true]
654
+ );
652
655
  });
653
656
 
654
657
  it('calls createMeeting when failOnMissingMeetinginfo is undefined and returns its promise', async () => {
655
- checkCallCreateMeeting([test1, test2, FAKE_USE_RANDOM_DELAY, {}, correlationId, undefined], [test1, test2, FAKE_USE_RANDOM_DELAY, {}, correlationId, false]);
658
+ checkCallCreateMeeting(
659
+ [test1, test2, FAKE_USE_RANDOM_DELAY, {}, correlationId, undefined],
660
+ [test1, test2, FAKE_USE_RANDOM_DELAY, {}, correlationId, false]
661
+ );
656
662
  });
657
663
 
658
664
  it('calls createMeeting when failOnMissingMeetinginfo is false and returns its promise', async () => {
659
- checkCallCreateMeeting([test1, test2, FAKE_USE_RANDOM_DELAY, {}, correlationId, false], [test1, test2, FAKE_USE_RANDOM_DELAY, {}, correlationId, false]);
665
+ checkCallCreateMeeting(
666
+ [test1, test2, FAKE_USE_RANDOM_DELAY, {}, correlationId, false],
667
+ [test1, test2, FAKE_USE_RANDOM_DELAY, {}, correlationId, false]
668
+ );
660
669
  });
661
670
 
662
671
  it('calls createMeeting with extra info params and returns its promise', async () => {
663
672
  const FAKE_USE_RANDOM_DELAY = false;
664
673
  const correlationId = 'my-correlationId';
665
674
 
666
- const FAKE_INFO_EXTRA_PARAMS = {mtid: 'm9fe0afd8c435e892afcce9ea25b97046', joinTXId: 'TSmrX61wNF'};
667
- const create = webex.meetings.create(test1, test2, FAKE_USE_RANDOM_DELAY, FAKE_INFO_EXTRA_PARAMS, correlationId);
675
+ const FAKE_INFO_EXTRA_PARAMS = {
676
+ mtid: 'm9fe0afd8c435e892afcce9ea25b97046',
677
+ joinTXId: 'TSmrX61wNF',
678
+ };
679
+ const create = webex.meetings.create(
680
+ test1,
681
+ test2,
682
+ FAKE_USE_RANDOM_DELAY,
683
+ FAKE_INFO_EXTRA_PARAMS,
684
+ correlationId
685
+ );
668
686
 
669
687
  assert.exists(create.then);
670
688
  await create;
671
689
  assert.calledOnce(webex.meetings.createMeeting);
672
- assert.calledWith(webex.meetings.createMeeting, test1, test2, FAKE_USE_RANDOM_DELAY, FAKE_INFO_EXTRA_PARAMS, correlationId);
690
+ assert.calledWith(
691
+ webex.meetings.createMeeting,
692
+ test1,
693
+ test2,
694
+ FAKE_USE_RANDOM_DELAY,
695
+ FAKE_INFO_EXTRA_PARAMS,
696
+ correlationId
697
+ );
673
698
  });
674
699
 
675
700
  it('creates a new meeting when a scheduled meeting exists in the conversation', async () => {
@@ -765,7 +790,6 @@ describe('plugin-meetings', () => {
765
790
  });
766
791
  describe('#handleLocusEvent', () => {
767
792
  describe('there was a meeting', () => {
768
-
769
793
  beforeEach(() => {
770
794
  webex.meetings.meetingCollection.getByKey = sinon.stub().returns({
771
795
  locusInfo,
@@ -831,7 +855,7 @@ describe('plugin-meetings', () => {
831
855
  },
832
856
  },
833
857
  info: {
834
- webExMeetingId
858
+ webExMeetingId,
835
859
  },
836
860
  },
837
861
  eventType: 'locus.difference',
@@ -839,7 +863,11 @@ describe('plugin-meetings', () => {
839
863
  });
840
864
  assert.callCount(webex.meetings.meetingCollection.getByKey, 6);
841
865
  assert.calledWith(webex.meetings.meetingCollection.getByKey, 'locusUrl', url1);
842
- assert.calledWith(webex.meetings.meetingCollection.getByKey, 'meetingNumber', webExMeetingId);
866
+ assert.calledWith(
867
+ webex.meetings.meetingCollection.getByKey,
868
+ 'meetingNumber',
869
+ webExMeetingId
870
+ );
843
871
  assert.calledOnce(initialSetup);
844
872
  assert.calledWith(initialSetup, {
845
873
  id: uuid1,
@@ -854,7 +882,7 @@ describe('plugin-meetings', () => {
854
882
  },
855
883
  },
856
884
  info: {
857
- webExMeetingId
885
+ webExMeetingId,
858
886
  },
859
887
  });
860
888
  });
@@ -868,7 +896,7 @@ describe('plugin-meetings', () => {
868
896
  },
869
897
  },
870
898
  info: {
871
- webExMeetingId
899
+ webExMeetingId,
872
900
  },
873
901
  },
874
902
  eventType: 'locus.difference',
@@ -876,7 +904,11 @@ describe('plugin-meetings', () => {
876
904
  });
877
905
  assert.callCount(webex.meetings.meetingCollection.getByKey, 5);
878
906
  assert.calledWith(webex.meetings.meetingCollection.getByKey, 'locusUrl', url1);
879
- assert.calledWith(webex.meetings.meetingCollection.getByKey, 'meetingNumber', webExMeetingId);
907
+ assert.calledWith(
908
+ webex.meetings.meetingCollection.getByKey,
909
+ 'meetingNumber',
910
+ webExMeetingId
911
+ );
880
912
  assert.calledOnce(initialSetup);
881
913
  assert.calledWith(initialSetup, {
882
914
  id: uuid1,
@@ -886,7 +918,7 @@ describe('plugin-meetings', () => {
886
918
  },
887
919
  },
888
920
  info: {
889
- webExMeetingId
921
+ webExMeetingId,
890
922
  },
891
923
  });
892
924
  });
@@ -933,7 +965,7 @@ describe('plugin-meetings', () => {
933
965
  },
934
966
  },
935
967
  info: {
936
- webExMeetingId
968
+ webExMeetingId,
937
969
  },
938
970
  },
939
971
  eventType: test1,
@@ -941,7 +973,11 @@ describe('plugin-meetings', () => {
941
973
  });
942
974
  assert.callCount(webex.meetings.meetingCollection.getByKey, 5);
943
975
  assert.calledWith(webex.meetings.meetingCollection.getByKey, 'locusUrl', url1);
944
- assert.calledWith(webex.meetings.meetingCollection.getByKey, 'meetingNumber', webExMeetingId);
976
+ assert.calledWith(
977
+ webex.meetings.meetingCollection.getByKey,
978
+ 'meetingNumber',
979
+ webExMeetingId
980
+ );
945
981
  assert.calledOnce(initialSetup);
946
982
  assert.calledWith(initialSetup, {
947
983
  id: uuid1,
@@ -951,7 +987,7 @@ describe('plugin-meetings', () => {
951
987
  },
952
988
  },
953
989
  info: {
954
- webExMeetingId
990
+ webExMeetingId,
955
991
  },
956
992
  });
957
993
  });
@@ -1023,7 +1059,10 @@ describe('plugin-meetings', () => {
1023
1059
  });
1024
1060
  describe('successful MeetingInfo.#fetchMeetingInfo', () => {
1025
1061
  let clock, setTimeoutSpy, fakeMeetingStartTimeString, FAKE_TIME_TO_START;
1026
- const FAKE_INFO_EXTRA_PARAMS = {mtid: 'm9fe0afd8c435e892afcce9ea25b97046', joinTXId: 'TSmrX61wNF'};
1062
+ const FAKE_INFO_EXTRA_PARAMS = {
1063
+ mtid: 'm9fe0afd8c435e892afcce9ea25b97046',
1064
+ joinTXId: 'TSmrX61wNF',
1065
+ };
1027
1066
 
1028
1067
  beforeEach(() => {
1029
1068
  clock = sinon.useFakeTimers();
@@ -1055,13 +1094,23 @@ describe('plugin-meetings', () => {
1055
1094
  type,
1056
1095
  extraParams = {},
1057
1096
  expectedMeetingData = {},
1058
- sendCAevents = false,
1097
+ sendCAevents = false
1059
1098
  ) => {
1060
1099
  assert.calledOnce(webex.meetings.meetingInfo.fetchMeetingInfo);
1061
1100
  assert.calledOnce(MeetingsUtil.getMeetingAddedType);
1062
1101
  assert.notCalled(setTimeoutSpy);
1063
1102
  assert.callCount(TriggerProxy.trigger, 5);
1064
- assert.calledWith(webex.meetings.meetingInfo.fetchMeetingInfo, destination, type, null, null, undefined, undefined, extraParams, {meetingId: meeting.id, sendCAevents});
1103
+ assert.calledWith(
1104
+ webex.meetings.meetingInfo.fetchMeetingInfo,
1105
+ destination,
1106
+ type,
1107
+ null,
1108
+ null,
1109
+ undefined,
1110
+ undefined,
1111
+ extraParams,
1112
+ {meetingId: meeting.id, sendCAevents}
1113
+ );
1065
1114
  assert.calledWith(MeetingsUtil.getMeetingAddedType, 'test type');
1066
1115
 
1067
1116
  if (expectedMeetingData.permissionToken) {
@@ -1070,7 +1119,7 @@ describe('plugin-meetings', () => {
1070
1119
  if (expectedMeetingData.meetingJoinUrl) {
1071
1120
  assert.equal(meeting.meetingJoinUrl, expectedMeetingData.meetingJoinUrl);
1072
1121
  }
1073
- if(expectedMeetingData.correlationId) {
1122
+ if (expectedMeetingData.correlationId) {
1074
1123
  assert.equal(meeting.correlationId, expectedMeetingData.correlationId);
1075
1124
  }
1076
1125
  assert.equal(meeting.destination, destination);
@@ -1105,14 +1154,27 @@ describe('plugin-meetings', () => {
1105
1154
  correlationId: meeting.id,
1106
1155
  };
1107
1156
 
1108
- checkCreateWithoutDelay(meeting, 'test destination', 'test type', {}, expectedMeetingData);
1157
+ checkCreateWithoutDelay(
1158
+ meeting,
1159
+ 'test destination',
1160
+ 'test type',
1161
+ {},
1162
+ expectedMeetingData
1163
+ );
1109
1164
  });
1110
1165
 
1111
1166
  [undefined, FAKE_INFO_EXTRA_PARAMS].forEach((infoExtraParams) => {
1112
1167
  const infoExtraParamsProvided = infoExtraParams !== undefined;
1113
1168
 
1114
- it(`creates the meeting from a successful meeting info fetch meeting resolve testing${infoExtraParamsProvided ? ' with infoExtraParams' : ''}`, async () => {
1115
- const meeting = await webex.meetings.createMeeting('test destination', 'test type', false, infoExtraParams);
1169
+ it(`creates the meeting from a successful meeting info fetch meeting resolve testing${
1170
+ infoExtraParamsProvided ? ' with infoExtraParams' : ''
1171
+ }`, async () => {
1172
+ const meeting = await webex.meetings.createMeeting(
1173
+ 'test destination',
1174
+ 'test type',
1175
+ false,
1176
+ infoExtraParams
1177
+ );
1116
1178
  const expectedMeetingData = {
1117
1179
  permissionToken: 'PT',
1118
1180
  meetingJoinUrl: 'meetingJoinUrl',
@@ -1123,10 +1185,18 @@ describe('plugin-meetings', () => {
1123
1185
  Meeting,
1124
1186
  'createMeeting should eventually resolve to a Meeting Object'
1125
1187
  );
1126
- checkCreateWithoutDelay(meeting, 'test destination', 'test type', infoExtraParamsProvided ? infoExtraParams : {}, expectedMeetingData);
1188
+ checkCreateWithoutDelay(
1189
+ meeting,
1190
+ 'test destination',
1191
+ 'test type',
1192
+ infoExtraParamsProvided ? infoExtraParams : {},
1193
+ expectedMeetingData
1194
+ );
1127
1195
  });
1128
1196
 
1129
- it(`creates the meeting from a successful meeting info fetch with random delay${infoExtraParamsProvided ? ' with infoExtraParams' : ''}`, async () => {
1197
+ it(`creates the meeting from a successful meeting info fetch with random delay${
1198
+ infoExtraParamsProvided ? ' with infoExtraParams' : ''
1199
+ }`, async () => {
1130
1200
  const FAKE_LOCUS_MEETING = {
1131
1201
  conversationUrl: 'locusConvURL',
1132
1202
  url: 'locusUrl',
@@ -1214,7 +1284,7 @@ describe('plugin-meetings', () => {
1214
1284
  'meeting:meetingInfoAvailable'
1215
1285
  );
1216
1286
  });
1217
- })
1287
+ });
1218
1288
 
1219
1289
  it('creates the meeting from a successful meeting info fetch that has no random delay because it is active', async () => {
1220
1290
  const FAKE_LOCUS_MEETING = {
@@ -1315,14 +1385,27 @@ describe('plugin-meetings', () => {
1315
1385
  });
1316
1386
 
1317
1387
  it('creates meeting with the correlationId provided', async () => {
1318
- const meeting = await webex.meetings.createMeeting('test destination', 'test type', false, {}, 'my-correlationId');
1388
+ const meeting = await webex.meetings.createMeeting(
1389
+ 'test destination',
1390
+ 'test type',
1391
+ false,
1392
+ {},
1393
+ 'my-correlationId'
1394
+ );
1319
1395
 
1320
1396
  const expectedMeetingData = {
1321
1397
  correlationId: 'my-correlationId',
1322
1398
  };
1323
1399
 
1324
- checkCreateWithoutDelay(meeting, 'test destination', 'test type', {}, expectedMeetingData, true);
1325
- })
1400
+ checkCreateWithoutDelay(
1401
+ meeting,
1402
+ 'test destination',
1403
+ 'test type',
1404
+ {},
1405
+ expectedMeetingData,
1406
+ true
1407
+ );
1408
+ });
1326
1409
  });
1327
1410
 
1328
1411
  describe('rejected MeetingInfo.#fetchMeetingInfo', () => {
@@ -1332,16 +1415,21 @@ describe('plugin-meetings', () => {
1332
1415
  webex.meetings.meetingInfo.fetchMeetingInfo = sinon
1333
1416
  .stub()
1334
1417
  .returns(Promise.reject(new Error('test')));
1335
- webex.meetings.destroy = sinon
1336
- .stub()
1337
- .returns(Promise.resolve());
1418
+ webex.meetings.destroy = sinon.stub().returns(Promise.resolve());
1338
1419
  webex.meetings.createMeeting = sinon.spy(webex.meetings.createMeeting);
1339
1420
  });
1340
1421
 
1341
1422
  const checkCreateMeetingWithNoMeetingInfo = async (failOnMissingMeetingInfo, destroy) => {
1342
1423
  try {
1343
- const meeting = await webex.meetings.createMeeting('test destination', 'test type', undefined, undefined, undefined, failOnMissingMeetingInfo);
1344
-
1424
+ const meeting = await webex.meetings.createMeeting(
1425
+ 'test destination',
1426
+ 'test type',
1427
+ undefined,
1428
+ undefined,
1429
+ undefined,
1430
+ failOnMissingMeetingInfo
1431
+ );
1432
+
1345
1433
  assert.instanceOf(
1346
1434
  meeting,
1347
1435
  Meeting,
@@ -1355,9 +1443,13 @@ describe('plugin-meetings', () => {
1355
1443
  'test destination',
1356
1444
  'test type'
1357
1445
  );
1358
-
1446
+
1359
1447
  if (destroy) {
1360
- assert.calledWith(webex.meetings.destroy, sinon.match.instanceOf(Meeting), 'MISSING_MEETING_INFO')
1448
+ assert.calledWith(
1449
+ webex.meetings.destroy,
1450
+ sinon.match.instanceOf(Meeting),
1451
+ 'MISSING_MEETING_INFO'
1452
+ );
1361
1453
  assert.notCalled(MeetingsUtil.getMeetingAddedType);
1362
1454
  assert.notCalled(TriggerProxy.trigger);
1363
1455
  assert.throw(webex.meetings.createMeeting, 'meeting information not found');
@@ -1378,10 +1470,10 @@ describe('plugin-meetings', () => {
1378
1470
  }
1379
1471
  );
1380
1472
  }
1381
- } catch (err) {
1473
+ } catch (err) {
1382
1474
  assert.instanceOf(err, NoMeetingInfoError);
1383
1475
  }
1384
- }
1476
+ };
1385
1477
 
1386
1478
  it('creates the meeting from a rejected meeting info fetch', async () => {
1387
1479
  checkCreateMeetingWithNoMeetingInfo(false, false);
@@ -1526,7 +1618,6 @@ describe('plugin-meetings', () => {
1526
1618
  });
1527
1619
 
1528
1620
  describe('#fetchUserPreferredWebexSite', () => {
1529
-
1530
1621
  let loggerProxySpy;
1531
1622
 
1532
1623
  it('should call request.getMeetingPreferences to get the preferred webex site ', async () => {
@@ -1544,12 +1635,10 @@ describe('plugin-meetings', () => {
1544
1635
  getMeetingPreferences: sinon.stub().returns(Promise.resolve({})),
1545
1636
  },
1546
1637
  user: {
1547
- get: sinon.stub().returns(
1548
- Promise.resolve(user)
1549
- ),
1638
+ get: sinon.stub().returns(Promise.resolve(user)),
1550
1639
  },
1551
1640
  });
1552
- }
1641
+ };
1553
1642
 
1554
1643
  it('should not fail if UserPreferred info is not fetched ', async () => {
1555
1644
  setup();
@@ -1586,6 +1675,59 @@ describe('plugin-meetings', () => {
1586
1675
  assert.notCalled(loggerProxySpy);
1587
1676
  });
1588
1677
 
1678
+ forEach(
1679
+ [
1680
+ {user: undefined},
1681
+ {user: {userPreferences: {}}},
1682
+ {user: {userPreferences: {userPreferencesItems: {}}}},
1683
+ {user: {userPreferences: {userPreferencesItems: {preferredWebExSite: undefined}}}},
1684
+ ],
1685
+ ({user}) => {
1686
+ it(`should handle invalid user data ${user}`, async () => {
1687
+ setup({user});
1688
+
1689
+ await webex.meetings.fetchUserPreferredWebexSite();
1690
+
1691
+ assert.equal(webex.meetings.preferredWebexSite, '');
1692
+ assert.calledOnceWithExactly(
1693
+ loggerProxySpy,
1694
+ 'Failed to fetch preferred site from user - no site will be set'
1695
+ );
1696
+ });
1697
+ }
1698
+ );
1699
+
1700
+ it('should handle a get user failure', async () => {
1701
+ setup();
1702
+
1703
+ webex.internal.user.get.rejects(new Error());
1704
+
1705
+ await webex.meetings.fetchUserPreferredWebexSite();
1706
+
1707
+ assert.equal(webex.meetings.preferredWebexSite, '');
1708
+ assert.calledOnceWithExactly(
1709
+ loggerProxySpy,
1710
+ 'Failed to fetch preferred site from user - no site will be set'
1711
+ );
1712
+ });
1713
+
1714
+ it('should fall back to fetching the site from the user', async () => {
1715
+ setup({
1716
+ user: {
1717
+ userPreferences: {
1718
+ userPreferencesItems: {
1719
+ preferredWebExSite: 'site.webex.com',
1720
+ },
1721
+ },
1722
+ },
1723
+ });
1724
+
1725
+ await webex.meetings.fetchUserPreferredWebexSite();
1726
+
1727
+ assert.equal(webex.meetings.preferredWebexSite, 'site.webex.com');
1728
+ assert.notCalled(loggerProxySpy);
1729
+ });
1730
+
1589
1731
  forEach([
1590
1732
  {user: undefined},
1591
1733
  {user: {userPreferences: {}}},
@@ -1714,7 +1856,7 @@ describe('plugin-meetings', () => {
1714
1856
  newLocus = {
1715
1857
  controls: {},
1716
1858
  self: {},
1717
- }
1859
+ };
1718
1860
  });
1719
1861
  afterEach(() => {
1720
1862
  sinon.restore();
@@ -1745,16 +1887,24 @@ describe('plugin-meetings', () => {
1745
1887
  });
1746
1888
 
1747
1889
  it('if newLocus replaceAt time is expired, then return false', () => {
1748
- sinon.stub(webex.meetings.meetingCollection, 'getActiveBreakoutLocus').returns({joinedWith: {replaces: [{
1749
- replaceAt: '2023-03-27T02:17:02.506Z',
1750
- }]}});
1890
+ sinon.stub(webex.meetings.meetingCollection, 'getActiveBreakoutLocus').returns({
1891
+ joinedWith: {
1892
+ replaces: [
1893
+ {
1894
+ replaceAt: '2023-03-27T02:17:02.506Z',
1895
+ },
1896
+ ],
1897
+ },
1898
+ });
1751
1899
  newLocus.self.state = 'JOINED';
1752
1900
  sinon.stub(MeetingsUtil, 'joinedOnThisDevice').returns(true);
1753
1901
  sinon.stub(MeetingsUtil, 'getThisDevice').returns({
1754
- replaces: [{
1755
- replaceAt: '2023-03-27T02:17:01.506Z'
1756
- }]
1757
- })
1902
+ replaces: [
1903
+ {
1904
+ replaceAt: '2023-03-27T02:17:01.506Z',
1905
+ },
1906
+ ],
1907
+ });
1758
1908
 
1759
1909
  LoggerProxy.logger.log = sinon.stub();
1760
1910
  const result = webex.meetings.isNeedHandleMainLocus(meeting, newLocus);
@@ -1843,7 +1993,7 @@ describe('plugin-meetings', () => {
1843
1993
  newLocus = {
1844
1994
  controls: {},
1845
1995
  self: {},
1846
- }
1996
+ };
1847
1997
  });
1848
1998
  afterEach(() => {
1849
1999
  sinon.restore();
@@ -1909,13 +2059,13 @@ describe('plugin-meetings', () => {
1909
2059
  self: {
1910
2060
  callbackInfo: {
1911
2061
  callbackAddress: 'address1',
1912
- }
2062
+ },
1913
2063
  },
1914
2064
  info: {
1915
2065
  webExMeetingId: '123456',
1916
2066
  isUnifiedSpaceMeeting: false,
1917
2067
  },
1918
- conversationUrl: 'conversationUrl1'
2068
+ conversationUrl: 'conversationUrl1',
1919
2069
  };
1920
2070
 
1921
2071
  sinon.stub(MeetingsUtil, 'checkForCorrelationId').returns('correlationId1');
@@ -1929,9 +2079,17 @@ describe('plugin-meetings', () => {
1929
2079
  assert.isNull(result);
1930
2080
  assert.callCount(webex.meetings.meetingCollection.getByKey, 5);
1931
2081
  assert.calledWith(webex.meetings.meetingCollection.getByKey, 'locusUrl', url1);
1932
- assert.calledWith(webex.meetings.meetingCollection.getByKey, 'correlationId', 'correlationId1');
2082
+ assert.calledWith(
2083
+ webex.meetings.meetingCollection.getByKey,
2084
+ 'correlationId',
2085
+ 'correlationId1'
2086
+ );
1933
2087
  assert.calledWith(webex.meetings.meetingCollection.getByKey, 'sipUri', 'address1');
1934
- assert.calledWith(webex.meetings.meetingCollection.getByKey, 'conversationUrl', 'conversationUrl1');
2088
+ assert.calledWith(
2089
+ webex.meetings.meetingCollection.getByKey,
2090
+ 'conversationUrl',
2091
+ 'conversationUrl1'
2092
+ );
1935
2093
  assert.calledWith(webex.meetings.meetingCollection.getByKey, 'meetingNumber', '123456');
1936
2094
  });
1937
2095
 
@@ -1941,7 +2099,7 @@ describe('plugin-meetings', () => {
1941
2099
  const result = webex.meetings.getCorrespondingMeetingByLocus({locus, locusUrl: url1});
1942
2100
  assert.isNull(result);
1943
2101
  assert.callCount(webex.meetings.meetingCollection.getByKey, 4);
1944
- })
2102
+ });
1945
2103
 
1946
2104
  it('check the calls when meeting found by key: locusUrl', () => {
1947
2105
  mockGetByKey('locusUrl');
@@ -1957,7 +2115,11 @@ describe('plugin-meetings', () => {
1957
2115
  assert.deepEqual(result, mockReturnMeeting);
1958
2116
  assert.callCount(webex.meetings.meetingCollection.getByKey, 2);
1959
2117
  assert.calledWith(webex.meetings.meetingCollection.getByKey, 'locusUrl', url1);
1960
- assert.calledWith(webex.meetings.meetingCollection.getByKey, 'correlationId', 'correlationId1');
2118
+ assert.calledWith(
2119
+ webex.meetings.meetingCollection.getByKey,
2120
+ 'correlationId',
2121
+ 'correlationId1'
2122
+ );
1961
2123
  });
1962
2124
 
1963
2125
  it('check the calls when meeting found by key: sipUri', () => {
@@ -1966,7 +2128,11 @@ describe('plugin-meetings', () => {
1966
2128
  assert.deepEqual(result, mockReturnMeeting);
1967
2129
  assert.callCount(webex.meetings.meetingCollection.getByKey, 3);
1968
2130
  assert.calledWith(webex.meetings.meetingCollection.getByKey, 'locusUrl', url1);
1969
- assert.calledWith(webex.meetings.meetingCollection.getByKey, 'correlationId', 'correlationId1');
2131
+ assert.calledWith(
2132
+ webex.meetings.meetingCollection.getByKey,
2133
+ 'correlationId',
2134
+ 'correlationId1'
2135
+ );
1970
2136
  assert.calledWith(webex.meetings.meetingCollection.getByKey, 'sipUri', 'address1');
1971
2137
  });
1972
2138
 
@@ -1976,9 +2142,17 @@ describe('plugin-meetings', () => {
1976
2142
  assert.deepEqual(result, mockReturnMeeting);
1977
2143
  assert.callCount(webex.meetings.meetingCollection.getByKey, 4);
1978
2144
  assert.calledWith(webex.meetings.meetingCollection.getByKey, 'locusUrl', url1);
1979
- assert.calledWith(webex.meetings.meetingCollection.getByKey, 'correlationId', 'correlationId1');
2145
+ assert.calledWith(
2146
+ webex.meetings.meetingCollection.getByKey,
2147
+ 'correlationId',
2148
+ 'correlationId1'
2149
+ );
1980
2150
  assert.calledWith(webex.meetings.meetingCollection.getByKey, 'sipUri', 'address1');
1981
- assert.calledWith(webex.meetings.meetingCollection.getByKey, 'conversationUrl', 'conversationUrl1');
2151
+ assert.calledWith(
2152
+ webex.meetings.meetingCollection.getByKey,
2153
+ 'conversationUrl',
2154
+ 'conversationUrl1'
2155
+ );
1982
2156
  });
1983
2157
 
1984
2158
  it('check the calls when meeting found by key: meetingNumber', () => {
@@ -1987,9 +2161,17 @@ describe('plugin-meetings', () => {
1987
2161
  assert.deepEqual(result, mockReturnMeeting);
1988
2162
  assert.callCount(webex.meetings.meetingCollection.getByKey, 5);
1989
2163
  assert.calledWith(webex.meetings.meetingCollection.getByKey, 'locusUrl', url1);
1990
- assert.calledWith(webex.meetings.meetingCollection.getByKey, 'correlationId', 'correlationId1');
2164
+ assert.calledWith(
2165
+ webex.meetings.meetingCollection.getByKey,
2166
+ 'correlationId',
2167
+ 'correlationId1'
2168
+ );
1991
2169
  assert.calledWith(webex.meetings.meetingCollection.getByKey, 'sipUri', 'address1');
1992
- assert.calledWith(webex.meetings.meetingCollection.getByKey, 'conversationUrl', 'conversationUrl1');
2170
+ assert.calledWith(
2171
+ webex.meetings.meetingCollection.getByKey,
2172
+ 'conversationUrl',
2173
+ 'conversationUrl1'
2174
+ );
1993
2175
  assert.calledWith(webex.meetings.meetingCollection.getByKey, 'meetingNumber', '123456');
1994
2176
  });
1995
2177
  });
@@ -2004,18 +2186,18 @@ describe('plugin-meetings', () => {
2004
2186
  controls: {
2005
2187
  breakout: {
2006
2188
  sessionType: 'MAIN',
2007
- url: 'breakoutUnifiedUrl1'
2008
- }
2009
- }
2189
+ url: 'breakoutUnifiedUrl1',
2190
+ },
2191
+ },
2010
2192
  };
2011
2193
  breakoutLocus = {
2012
2194
  url: 'breakoutUrl1',
2013
2195
  controls: {
2014
2196
  breakout: {
2015
2197
  sessionType: 'BREAKOUT',
2016
- url: 'breakoutUnifiedUrl1'
2017
- }
2018
- }
2198
+ url: 'breakoutUnifiedUrl1',
2199
+ },
2200
+ },
2019
2201
  };
2020
2202
  lociArray = [mainLocus, breakoutLocus];
2021
2203
 
@@ -2058,8 +2240,8 @@ describe('plugin-meetings', () => {
2058
2240
  breakout: {
2059
2241
  sessionType: 'BREAKOUT',
2060
2242
  url: 'breakoutUnifiedUrl1',
2061
- }
2062
- }
2243
+ },
2244
+ },
2063
2245
  };
2064
2246
 
2065
2247
  webex.meetings.handleLocusEvent = sinon.stub();
@@ -2089,8 +2271,8 @@ describe('plugin-meetings', () => {
2089
2271
  breakout: {
2090
2272
  sessionType: 'MAIN',
2091
2273
  url: 'breakoutUnifiedUrl2',
2092
- }
2093
- }
2274
+ },
2275
+ },
2094
2276
  });
2095
2277
  assert.notCalled(webex.meetings.handleLocusEvent);
2096
2278
  });
@@ -2102,10 +2284,13 @@ describe('plugin-meetings', () => {
2102
2284
  breakout: {
2103
2285
  sessionType: 'MAIN',
2104
2286
  url: 'breakoutUnifiedUrl1',
2105
- }
2106
- }
2287
+ },
2288
+ },
2289
+ });
2290
+ assert.calledWith(webex.meetings.handleLocusEvent, {
2291
+ locus: breakoutLocus,
2292
+ locusUrl: breakoutLocus.url,
2107
2293
  });
2108
- assert.calledWith(webex.meetings.handleLocusEvent, {locus: breakoutLocus, locusUrl: breakoutLocus.url});
2109
2294
  });
2110
2295
  });
2111
2296
 
@@ -2129,17 +2314,16 @@ describe('plugin-meetings', () => {
2129
2314
  meeting.locusId = 'locus id';
2130
2315
  meeting.correlationId = 'correlation id';
2131
2316
  meeting.locusInfo = {
2132
- fullState: { lastActive: 'last active', sessionId: 'locus session id'},
2133
- info: { webExMeetingId: 'meeting id'}
2134
- }
2317
+ fullState: {lastActive: 'last active', sessionId: 'locus session id'},
2318
+ info: {webExMeetingId: 'meeting id'},
2319
+ };
2135
2320
  });
2136
2321
 
2137
2322
  afterEach(() => {
2138
2323
  sinon.restore();
2139
- })
2324
+ });
2140
2325
 
2141
2326
  it('sends metrics on success', async () => {
2142
-
2143
2327
  await meeting.uploadLogs();
2144
2328
 
2145
2329
  await testUtils.flushPromises();
@@ -2162,16 +2346,20 @@ describe('plugin-meetings', () => {
2162
2346
 
2163
2347
  await testUtils.flushPromises();
2164
2348
 
2165
- assert.calledOnceWithExactly(metricsSpy, 'js_sdk_upload_logs_failure', sinon.match({
2166
- callStart: 'last active',
2167
- correlationId: 'correlation id',
2168
- feedbackId: 'correlation id',
2169
- locusId: 'locus id',
2170
- meetingId: 'meeting id',
2171
- reason: 'fake error',
2172
- autoupload: true,
2173
- locussessionid: 'locus session id',
2174
- }));
2349
+ assert.calledOnceWithExactly(
2350
+ metricsSpy,
2351
+ 'js_sdk_upload_logs_failure',
2352
+ sinon.match({
2353
+ callStart: 'last active',
2354
+ correlationId: 'correlation id',
2355
+ feedbackId: 'correlation id',
2356
+ locusId: 'locus id',
2357
+ meetingId: 'meeting id',
2358
+ reason: 'fake error',
2359
+ autoupload: true,
2360
+ locussessionid: 'locus session id',
2361
+ })
2362
+ );
2175
2363
  });
2176
2364
  });
2177
2365
  });