@webex/internal-plugin-metrics 3.0.0-beta.319 → 3.0.0-beta.320

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.
@@ -19,7 +19,7 @@ const userAgent = `webex-js-sdk/test-webex-version client=Cantina; (os=${getOSNa
19
19
  getOSVersion().split('.')[0]
20
20
  })`;
21
21
 
22
- describe('internal-plugin-metrics', () => {
22
+ describe.only('internal-plugin-metrics', () => {
23
23
  describe('CallDiagnosticMetrics', () => {
24
24
  var now = new Date();
25
25
 
@@ -51,7 +51,7 @@ describe('internal-plugin-metrics', () => {
51
51
  },
52
52
  metrics: {
53
53
  submitClientMetrics: sinon.stub(),
54
- config: {...CONFIG.metrics}
54
+ config: {...CONFIG.metrics},
55
55
  },
56
56
  newMetrics: {
57
57
  postPreLoginMetric: sinon.stub(),
@@ -67,7 +67,7 @@ describe('internal-plugin-metrics', () => {
67
67
  metrics: {
68
68
  clientType: 'TEAMS_CLIENT',
69
69
  subClientType: 'WEB_APP',
70
- clientName: 'Cantina'
70
+ clientName: 'Cantina',
71
71
  },
72
72
  },
73
73
  meetingCollection: {
@@ -143,7 +143,12 @@ describe('internal-plugin-metrics', () => {
143
143
 
144
144
  //@ts-ignore
145
145
  const res = cd.getOrigin(
146
- {subClientType: 'WEB_APP', clientType: 'TEAMS_CLIENT', newEnvironment: 'test-new-env', clientLaunchMethod: 'url-handler'},
146
+ {
147
+ subClientType: 'WEB_APP',
148
+ clientType: 'TEAMS_CLIENT',
149
+ newEnvironment: 'test-new-env',
150
+ clientLaunchMethod: 'url-handler',
151
+ },
147
152
  fakeMeeting.id
148
153
  );
149
154
 
@@ -172,7 +177,12 @@ describe('internal-plugin-metrics', () => {
172
177
 
173
178
  //@ts-ignore
174
179
  const res = cd.getOrigin(
175
- {subClientType: 'WEB_APP', clientType: 'TEAMS_CLIENT', clientLaunchMethod: 'url-handler', environment: 'test-env'},
180
+ {
181
+ subClientType: 'WEB_APP',
182
+ clientType: 'TEAMS_CLIENT',
183
+ clientLaunchMethod: 'url-handler',
184
+ environment: 'test-env',
185
+ },
176
186
  fakeMeeting.id
177
187
  );
178
188
 
@@ -186,7 +196,7 @@ describe('internal-plugin-metrics', () => {
186
196
  os: getOSNameInternal(),
187
197
  osVersion: getOSVersion(),
188
198
  subClientType: 'WEB_APP',
189
- clientLaunchMethod: 'url-handler'
199
+ clientLaunchMethod: 'url-handler',
190
200
  },
191
201
  environment: 'test-env',
192
202
  name: 'endpoint',
@@ -277,7 +287,14 @@ describe('internal-plugin-metrics', () => {
277
287
  ],
278
288
  webexConferenceIdStr: 'webexConferenceIdStr',
279
289
  globalMeetingId: 'globalMeetingId',
280
- meeting: {...fakeMeeting, meetingInfo: {...fakeMeeting.meetingInfo, confID: 'webexConferenceIdStr1', meetingId: 'globalMeetingId1'}},
290
+ meeting: {
291
+ ...fakeMeeting,
292
+ meetingInfo: {
293
+ ...fakeMeeting.meetingInfo,
294
+ confID: 'webexConferenceIdStr1',
295
+ meetingId: 'globalMeetingId1',
296
+ },
297
+ },
281
298
  });
282
299
 
283
300
  assert.deepEqual(res, {
@@ -302,7 +319,14 @@ describe('internal-plugin-metrics', () => {
302
319
  ],
303
320
  webexConferenceIdStr: 'webexConferenceIdStr',
304
321
  globalMeetingId: 'globalMeetingId',
305
- meeting: {...fakeMeeting, meetingInfo: {...fakeMeeting.meetingInfo, confIdStr: 'webexConferenceIdStr1', meetingId: 'globalMeetingId1'}},
322
+ meeting: {
323
+ ...fakeMeeting,
324
+ meetingInfo: {
325
+ ...fakeMeeting.meetingInfo,
326
+ confIdStr: 'webexConferenceIdStr1',
327
+ meetingId: 'globalMeetingId1',
328
+ },
329
+ },
306
330
  });
307
331
 
308
332
  assert.deepEqual(res, {
@@ -327,7 +351,15 @@ describe('internal-plugin-metrics', () => {
327
351
  ],
328
352
  webexConferenceIdStr: 'webexConferenceIdStr',
329
353
  globalMeetingId: 'globalMeetingId',
330
- meeting: {...fakeMeeting, meetingInfo: {...fakeMeeting.meetingInfo, confIdStr: 'webexConferenceIdStr1', meetingId: 'globalMeetingId1', siteName: 'siteName1'}},
354
+ meeting: {
355
+ ...fakeMeeting,
356
+ meetingInfo: {
357
+ ...fakeMeeting.meetingInfo,
358
+ confIdStr: 'webexConferenceIdStr1',
359
+ meetingId: 'globalMeetingId1',
360
+ siteName: 'siteName1',
361
+ },
362
+ },
331
363
  });
332
364
 
333
365
  assert.deepEqual(res, {
@@ -360,7 +392,7 @@ describe('internal-plugin-metrics', () => {
360
392
  orgId: 'orgId',
361
393
  userId: 'userId',
362
394
  });
363
- })
395
+ });
364
396
 
365
397
  it('should build identifiers correctly given globalMeetingId', () => {
366
398
  const res = cd.getIdentifiers({
@@ -412,13 +444,13 @@ describe('internal-plugin-metrics', () => {
412
444
  });
413
445
 
414
446
  assert.deepEqual(res, {
415
- correlationId: "correlationId",
416
- locusUrl: "locus-url",
447
+ correlationId: 'correlationId',
448
+ locusUrl: 'locus-url',
417
449
  deviceId: 'deviceUrl',
418
450
  orgId: 'orgId',
419
451
  userId: 'preLoginId',
420
452
  });
421
- })
453
+ });
422
454
  });
423
455
 
424
456
  it('should prepare diagnostic event successfully', () => {
@@ -429,7 +461,11 @@ describe('internal-plugin-metrics', () => {
429
461
  const res = cd.prepareDiagnosticEvent(
430
462
  {
431
463
  canProceed: false,
432
- identifiers: {correlationId: 'id', webexConferenceIdStr: 'webexConferenceIdStr1', globalMeetingId: 'globalMeetingId1'},
464
+ identifiers: {
465
+ correlationId: 'id',
466
+ webexConferenceIdStr: 'webexConferenceIdStr1',
467
+ globalMeetingId: 'globalMeetingId1',
468
+ },
433
469
  name: 'client.alert.displayed',
434
470
  },
435
471
  options
@@ -546,40 +582,43 @@ describe('internal-plugin-metrics', () => {
546
582
  senderCountryCode: 'UK',
547
583
  version: 1,
548
584
  });
549
- assert.calledWith(validatorSpy, {type: 'ce', event: {
585
+ assert.calledWith(validatorSpy, {
586
+ type: 'ce',
550
587
  event: {
551
- canProceed: true,
552
- eventData: {
553
- webClientDomain: 'whatever',
588
+ event: {
589
+ canProceed: true,
590
+ eventData: {
591
+ webClientDomain: 'whatever',
592
+ },
593
+ identifiers: {
594
+ correlationId: 'correlationId',
595
+ deviceId: 'deviceUrl',
596
+ locusId: 'url',
597
+ locusStartTime: 'lastActive',
598
+ locusUrl: 'locus/url',
599
+ mediaAgentAlias: 'alias',
600
+ mediaAgentGroupId: '1',
601
+ orgId: 'orgId',
602
+ userId: 'userId',
603
+ },
604
+ loginType: 'login-ci',
605
+ name: 'client.alert.displayed',
606
+ userType: 'host',
607
+ isConvergedArchitectureEnabled: undefined,
608
+ webexSubServiceType: undefined,
554
609
  },
555
- identifiers: {
556
- correlationId: 'correlationId',
557
- deviceId: 'deviceUrl',
558
- locusId: 'url',
559
- locusStartTime: 'lastActive',
560
- locusUrl: 'locus/url',
561
- mediaAgentAlias: 'alias',
562
- mediaAgentGroupId: '1',
563
- orgId: 'orgId',
564
- userId: 'userId',
610
+ eventId: 'my-fake-id',
611
+ origin: {
612
+ origin: 'fake-origin',
565
613
  },
566
- loginType: 'login-ci',
567
- name: 'client.alert.displayed',
568
- userType: 'host',
569
- isConvergedArchitectureEnabled: undefined,
570
- webexSubServiceType: undefined,
571
- },
572
- eventId: 'my-fake-id',
573
- origin: {
574
- origin: 'fake-origin',
575
- },
576
- originTime: {
577
- sent: 'not_defined_yet',
578
- triggered: now.toISOString(),
614
+ originTime: {
615
+ sent: 'not_defined_yet',
616
+ triggered: now.toISOString(),
617
+ },
618
+ senderCountryCode: 'UK',
619
+ version: 1,
579
620
  },
580
- senderCountryCode: 'UK',
581
- version: 1,
582
- }})
621
+ });
583
622
 
584
623
  const webexLoggerLogCalls = webex.logger.log.getCalls();
585
624
  assert.deepEqual(webexLoggerLogCalls[0].args, [
@@ -673,7 +712,6 @@ describe('internal-plugin-metrics', () => {
673
712
  'CallDiagnosticMetrics: @submitClientEvent. Submit Client Event CA event.',
674
713
  `name: client.alert.displayed`,
675
714
  ]);
676
-
677
715
  });
678
716
 
679
717
  it('should submit client event successfully with preLoginId', () => {
@@ -690,7 +728,7 @@ describe('internal-plugin-metrics', () => {
690
728
  correlationId: 'correlationId',
691
729
  webexConferenceIdStr: 'webexConferenceIdStr1',
692
730
  globalMeetingId: 'globalMeetingId1',
693
- preLoginId: 'myPreLoginId'
731
+ preLoginId: 'myPreLoginId',
694
732
  };
695
733
 
696
734
  cd.submitClientEvent({
@@ -747,15 +785,15 @@ describe('internal-plugin-metrics', () => {
747
785
  name: 'client.alert.displayed',
748
786
  },
749
787
  eventId: 'my-fake-id',
750
- origin: { buildType: 'test', networkType: 'unknown', origin: 'fake-origin' },
788
+ origin: {buildType: 'test', networkType: 'unknown', origin: 'fake-origin'},
751
789
  originTime: {
752
790
  triggered: now.toISOString(),
753
- sent: now.toISOString()
791
+ sent: now.toISOString(),
754
792
  },
755
793
  senderCountryCode: 'UK',
756
794
  version: 1,
757
795
  });
758
- })
796
+ });
759
797
 
760
798
  it('it should include errors if provided with meetingId', () => {
761
799
  sinon.stub(cd, 'getOrigin').returns({origin: 'fake-origin'});
@@ -806,6 +844,7 @@ describe('internal-plugin-metrics', () => {
806
844
  shownToUser: false,
807
845
  serviceErrorCode: 2409005,
808
846
  errorCode: 4029,
847
+ rawErrorMessage: undefined,
809
848
  },
810
849
  ],
811
850
  loginType: 'login-ci',
@@ -831,14 +870,13 @@ describe('internal-plugin-metrics', () => {
831
870
  'call-diagnostic-events -> ',
832
871
  'CallDiagnosticMetrics: @submitClientEvent. Submit Client Event CA event.',
833
872
  `name: client.alert.displayed`,
834
-
835
873
  ]);
836
874
 
837
875
  assert.deepEqual(webexLoggerLogCalls[1].args, [
838
876
  'call-diagnostic-events -> ',
839
877
  'CallDiagnosticMetrics: @prepareClientEvent. Generated errors:',
840
- `generatedError: {"fatal":true,"shownToUser":false,"name":"other","category":"expected","errorCode":4029,"serviceErrorCode":2409005,"errorDescription":"StartRecordingFailed"}`
841
- ])
878
+ `generatedError: {"fatal":true,"shownToUser":false,"name":"other","category":"expected","errorCode":4029,"serviceErrorCode":2409005,"errorDescription":"StartRecordingFailed"}`,
879
+ ]);
842
880
  });
843
881
 
844
882
  it('it send the raw error message if meetingId provided', () => {
@@ -848,7 +886,7 @@ describe('internal-plugin-metrics', () => {
848
886
  const options = {
849
887
  meetingId: fakeMeeting.id,
850
888
  mediaConnections: [{mediaAgentAlias: 'alias', mediaAgentGroupId: '1'}],
851
- rawError: new Error('bad times')
889
+ rawError: new Error('bad times'),
852
890
  };
853
891
 
854
892
  cd.submitClientEvent({
@@ -856,14 +894,13 @@ describe('internal-plugin-metrics', () => {
856
894
  options,
857
895
  });
858
896
 
859
- console.log(submitToCallDiagnosticsSpy.getCalls()[0].args[0].event.errors)
897
+ console.log(submitToCallDiagnosticsSpy.getCalls()[0].args[0].event.errors);
860
898
 
861
899
  assert.calledWith(submitToCallDiagnosticsSpy, {
862
900
  event: {
863
901
  canProceed: true,
864
902
  eventData: {
865
903
  webClientDomain: 'whatever',
866
- rawErrorMessage: 'bad times',
867
904
  },
868
905
  identifiers: {
869
906
  correlationId: 'correlationId',
@@ -885,6 +922,7 @@ describe('internal-plugin-metrics', () => {
885
922
  errorCode: 9999,
886
923
  serviceErrorCode: 9999,
887
924
  errorDescription: 'UnknownError',
925
+ rawErrorMessage: 'bad times',
888
926
  },
889
927
  ],
890
928
  loginType: 'login-ci',
@@ -915,11 +953,11 @@ describe('internal-plugin-metrics', () => {
915
953
  assert.deepEqual(webexLoggerLogCalls[1].args, [
916
954
  'call-diagnostic-events -> ',
917
955
  'CallDiagnosticMetrics: @prepareClientEvent. Generated errors:',
918
- `generatedError: {"fatal":true,"shownToUser":false,"name":"other","category":"other","errorCode":9999,"serviceErrorCode":9999,"errorDescription":"UnknownError"}`,
956
+ `generatedError: {"fatal":true,"shownToUser":false,"name":"other","category":"other","errorCode":9999,"serviceErrorCode":9999,"rawErrorMessage":"bad times","errorDescription":"UnknownError"}`,
919
957
  ]);
920
958
  });
921
959
 
922
- it('it should include errors if provided with correlationId', () => {
960
+ it('it should send the raw error message if provided with correlationId', () => {
923
961
  sinon.stub(cd, 'getOrigin').returns({origin: 'fake-origin'});
924
962
  const submitToCallDiagnosticsSpy = sinon.spy(cd, 'submitToCallDiagnostics');
925
963
 
@@ -938,7 +976,6 @@ describe('internal-plugin-metrics', () => {
938
976
  canProceed: true,
939
977
  eventData: {
940
978
  webClientDomain: 'whatever',
941
- rawErrorMessage: 'bad times',
942
979
  },
943
980
  identifiers: {
944
981
  correlationId: 'correlationId',
@@ -956,6 +993,7 @@ describe('internal-plugin-metrics', () => {
956
993
  errorCode: 9999,
957
994
  serviceErrorCode: 9999,
958
995
  errorDescription: 'UnknownError',
996
+ rawErrorMessage: 'bad times',
959
997
  },
960
998
  ],
961
999
  loginType: 'login-ci',
@@ -981,16 +1019,14 @@ describe('internal-plugin-metrics', () => {
981
1019
  `name: client.alert.displayed`,
982
1020
  ]);
983
1021
 
984
-
985
1022
  assert.deepEqual(webexLoggerLogCalls[1].args, [
986
1023
  'call-diagnostic-events -> ',
987
1024
  'CallDiagnosticMetrics: @prepareClientEvent. Generated errors:',
988
- `generatedError: {"fatal":true,"shownToUser":false,"name":"other","category":"other","errorCode":9999,"serviceErrorCode":9999,"errorDescription":"UnknownError"}`,
1025
+ `generatedError: {"fatal":true,"shownToUser":false,"name":"other","category":"other","errorCode":9999,"serviceErrorCode":9999,"rawErrorMessage":"bad times","errorDescription":"UnknownError"}`,
989
1026
  ]);
990
-
991
1027
  });
992
1028
 
993
- it('it should send the raw error message if provided with correlationId', () => {
1029
+ it('it should include errors if provided with correlationId', () => {
994
1030
  sinon.stub(cd, 'getOrigin').returns({origin: 'fake-origin'});
995
1031
  const submitToCallDiagnosticsSpy = sinon.spy(cd, 'submitToCallDiagnostics');
996
1032
 
@@ -1030,6 +1066,7 @@ describe('internal-plugin-metrics', () => {
1030
1066
  shownToUser: false,
1031
1067
  serviceErrorCode: 2409005,
1032
1068
  errorCode: 4029,
1069
+ rawErrorMessage: undefined,
1033
1070
  },
1034
1071
  ],
1035
1072
  loginType: 'login-ci',
@@ -1060,7 +1097,6 @@ describe('internal-plugin-metrics', () => {
1060
1097
  'CallDiagnosticMetrics: @prepareClientEvent. Generated errors:',
1061
1098
  `generatedError: {"fatal":true,"shownToUser":false,"name":"other","category":"expected","errorCode":4029,"serviceErrorCode":2409005,"errorDescription":"StartRecordingFailed"}`,
1062
1099
  ]);
1063
-
1064
1100
  });
1065
1101
 
1066
1102
  it('should include errors in payload if provided via payload', () => {
@@ -1246,37 +1282,40 @@ describe('internal-plugin-metrics', () => {
1246
1282
  options
1247
1283
  );
1248
1284
 
1249
- assert.calledWith(validatorSpy, {type: 'mqe', event: {
1250
- eventId: 'my-fake-id',
1251
- version: 1,
1252
- origin: {origin: 'fake-origin'},
1253
- originTime: {triggered: now.toISOString(), sent: 'not_defined_yet'},
1254
- senderCountryCode: 'UK',
1285
+ assert.calledWith(validatorSpy, {
1286
+ type: 'mqe',
1255
1287
  event: {
1256
- name: 'client.mediaquality.event',
1257
- canProceed: true,
1258
- identifiers: {
1259
- correlationId: 'correlationId',
1260
- webexConferenceIdStr: 'webexConferenceIdStr1',
1261
- globalMeetingId: 'globalMeetingId1',
1262
- userId: 'userId',
1263
- deviceId: 'deviceUrl',
1264
- orgId: 'orgId',
1265
- locusUrl: 'locus/url',
1266
- locusId: 'url',
1267
- locusStartTime: 'lastActive',
1268
- },
1269
- eventData: {webClientDomain: 'whatever'},
1270
- intervals: [{}],
1271
- sourceMetadata: {
1272
- applicationSoftwareType: 'webex-js-sdk',
1273
- applicationSoftwareVersion: 'webex-version',
1274
- mediaEngineSoftwareType: 'browser',
1275
- mediaEngineSoftwareVersion: getOSVersion(),
1276
- startTime: now.toISOString(),
1288
+ eventId: 'my-fake-id',
1289
+ version: 1,
1290
+ origin: {origin: 'fake-origin'},
1291
+ originTime: {triggered: now.toISOString(), sent: 'not_defined_yet'},
1292
+ senderCountryCode: 'UK',
1293
+ event: {
1294
+ name: 'client.mediaquality.event',
1295
+ canProceed: true,
1296
+ identifiers: {
1297
+ correlationId: 'correlationId',
1298
+ webexConferenceIdStr: 'webexConferenceIdStr1',
1299
+ globalMeetingId: 'globalMeetingId1',
1300
+ userId: 'userId',
1301
+ deviceId: 'deviceUrl',
1302
+ orgId: 'orgId',
1303
+ locusUrl: 'locus/url',
1304
+ locusId: 'url',
1305
+ locusStartTime: 'lastActive',
1306
+ },
1307
+ eventData: {webClientDomain: 'whatever'},
1308
+ intervals: [{}],
1309
+ sourceMetadata: {
1310
+ applicationSoftwareType: 'webex-js-sdk',
1311
+ applicationSoftwareVersion: 'webex-version',
1312
+ mediaEngineSoftwareType: 'browser',
1313
+ mediaEngineSoftwareVersion: getOSVersion(),
1314
+ startTime: now.toISOString(),
1315
+ },
1277
1316
  },
1278
1317
  },
1279
- }});
1318
+ });
1280
1319
 
1281
1320
  assert.calledWith(submitToCallDiagnosticsSpy, {
1282
1321
  eventId: 'my-fake-id',
@@ -1359,6 +1398,25 @@ describe('internal-plugin-metrics', () => {
1359
1398
  shownToUser: false,
1360
1399
  errorCode: 4008,
1361
1400
  serviceErrorCode: 10000,
1401
+ rawErrorMessage: undefined,
1402
+ });
1403
+ });
1404
+
1405
+ it('should include rawErrorMessage if provided', () => {
1406
+ const res = cd.getErrorPayloadForClientErrorCode({
1407
+ clientErrorCode: 4008,
1408
+ serviceErrorCode: 10000,
1409
+ rawErrorMessage: 'bad times',
1410
+ });
1411
+ assert.deepEqual(res, {
1412
+ category: 'signaling',
1413
+ errorDescription: 'NewLocusError',
1414
+ fatal: true,
1415
+ name: 'other',
1416
+ shownToUser: false,
1417
+ errorCode: 4008,
1418
+ serviceErrorCode: 10000,
1419
+ rawErrorMessage: 'bad times',
1362
1420
  });
1363
1421
  });
1364
1422
 
@@ -1375,8 +1433,9 @@ describe('internal-plugin-metrics', () => {
1375
1433
  shownToUser: false,
1376
1434
  errorCode: 4009,
1377
1435
  serviceErrorCode: undefined,
1436
+ rawErrorMessage: undefined,
1378
1437
  });
1379
- })
1438
+ });
1380
1439
 
1381
1440
  it('it should return undefined if trying to get payload for client error code that doesnt exist', () => {
1382
1441
  const res = cd.getErrorPayloadForClientErrorCode({
@@ -1396,6 +1455,7 @@ describe('internal-plugin-metrics', () => {
1396
1455
  shownToUser: false,
1397
1456
  errorCode: 4029,
1398
1457
  serviceErrorCode: 2409005,
1458
+ rawErrorMessage: 'bad times',
1399
1459
  };
1400
1460
 
1401
1461
  const checkNameError = (payload: any, isExpectedToBeCalled: boolean) => {
@@ -1409,6 +1469,7 @@ describe('internal-plugin-metrics', () => {
1409
1469
  serviceErrorCode: undefined,
1410
1470
  errorCode: 4032,
1411
1471
  errorData: {errorName: payload.name},
1472
+ rawErrorMessage: payload.message,
1412
1473
  };
1413
1474
 
1414
1475
  if (isExpectedToBeCalled) {
@@ -1419,11 +1480,11 @@ describe('internal-plugin-metrics', () => {
1419
1480
  };
1420
1481
 
1421
1482
  it('should generate media event error payload if rawError has a media error name', () => {
1422
- checkNameError({name: 'PermissionDeniedError'}, true);
1483
+ checkNameError({name: 'PermissionDeniedError', message: 'bad times'}, true);
1423
1484
  });
1424
1485
 
1425
1486
  it('should not generate media event error payload if rawError has a name that is not recognized', () => {
1426
- checkNameError({name: 'SomeRandomError'}, false);
1487
+ checkNameError({name: 'SomeRandomError', message: 'bad times'}, false);
1427
1488
  });
1428
1489
 
1429
1490
  const checkCodeError = (payload: any, expetedRes: any) => {
@@ -1431,19 +1492,25 @@ describe('internal-plugin-metrics', () => {
1431
1492
  assert.deepEqual(res, expetedRes);
1432
1493
  };
1433
1494
  it('should generate event error payload correctly', () => {
1434
- checkCodeError({body: {errorCode: 2409005}}, defaultExpectedRes);
1495
+ checkCodeError({body: {errorCode: 2409005}, message: 'bad times'}, defaultExpectedRes);
1435
1496
  });
1436
1497
 
1437
1498
  it('should generate event error payload correctly if rawError has body.code', () => {
1438
- checkCodeError({body: {code: 2409005}}, defaultExpectedRes);
1499
+ checkCodeError({body: {code: 2409005}, message: 'bad times'}, defaultExpectedRes);
1439
1500
  });
1440
1501
 
1441
1502
  it('should generate event error payload correctly if rawError has body.reason.reasonCode', () => {
1442
- checkCodeError({body: {reason: {reasonCode: 2409005}}}, defaultExpectedRes);
1503
+ checkCodeError(
1504
+ {body: {reason: {reasonCode: 2409005}}, message: 'bad times'},
1505
+ defaultExpectedRes
1506
+ );
1443
1507
  });
1444
1508
 
1445
1509
  it('should generate event error payload correctly if rawError has error.body.errorCode', () => {
1446
- checkCodeError({error: {body: {errorCode: 2409005}}}, defaultExpectedRes);
1510
+ checkCodeError(
1511
+ {error: {body: {errorCode: 2409005}}, message: 'bad times'},
1512
+ defaultExpectedRes
1513
+ );
1447
1514
  });
1448
1515
 
1449
1516
  const checkLocusError = (payload: any, isExpectedToBeCalled: boolean) => {
@@ -1456,6 +1523,7 @@ describe('internal-plugin-metrics', () => {
1456
1523
  shownToUser: false,
1457
1524
  serviceErrorCode: 2400000,
1458
1525
  errorCode: 4008,
1526
+ rawErrorMessage: 'bad times',
1459
1527
  };
1460
1528
 
1461
1529
  if (isExpectedToBeCalled) {
@@ -1466,11 +1534,11 @@ describe('internal-plugin-metrics', () => {
1466
1534
  };
1467
1535
 
1468
1536
  it('should return default new locus event error payload correctly if locus error is recognized', () => {
1469
- checkLocusError({body: {errorCode: 2400000}}, true);
1537
+ checkLocusError({body: {errorCode: 2400000}, message: 'bad times'}, true);
1470
1538
  });
1471
1539
 
1472
1540
  it('should not return default new locus event error payload correctly if locus is not recognized', () => {
1473
- checkLocusError({body: {errorCode: 1400000}}, false);
1541
+ checkLocusError({body: {errorCode: 1400000}, message: 'bad times'}, false);
1474
1542
  });
1475
1543
 
1476
1544
  const checkMeetingInfoError = (payload: any, isExpectedToBeCalled: boolean) => {
@@ -1483,6 +1551,7 @@ describe('internal-plugin-metrics', () => {
1483
1551
  shownToUser: false,
1484
1552
  serviceErrorCode: undefined,
1485
1553
  errorCode: 4100,
1554
+ rawErrorMessage: 'bad times',
1486
1555
  };
1487
1556
 
1488
1557
  if (isExpectedToBeCalled) {
@@ -1493,15 +1562,24 @@ describe('internal-plugin-metrics', () => {
1493
1562
  };
1494
1563
 
1495
1564
  it('should return default meeting info lookup error payload if data.meetingInfo was found on error body', () => {
1496
- checkMeetingInfoError({body: {data: {meetingInfo: 'something'}}}, true);
1565
+ checkMeetingInfoError(
1566
+ {body: {data: {meetingInfo: 'something'}}, message: 'bad times'},
1567
+ true
1568
+ );
1497
1569
  });
1498
1570
 
1499
1571
  it('should return default meeting info lookup error payload if body.url contains wbxappapi', () => {
1500
- checkMeetingInfoError({body: {url: '1234567-wbxappapiabcdefg'}}, true);
1572
+ checkMeetingInfoError(
1573
+ {body: {url: '1234567-wbxappapiabcdefg'}, message: 'bad times'},
1574
+ true
1575
+ );
1501
1576
  });
1502
1577
 
1503
1578
  it('should not return default meeting info lookup error payload if body.url does not contain wbxappapi and data.meetingInfo was not found on error body', () => {
1504
- checkMeetingInfoError({body: {data: '1234567-wbxappapiabcdefg'}}, false);
1579
+ checkMeetingInfoError(
1580
+ {body: {data: '1234567-wbxappapiabcdefg'}, message: 'bad times'},
1581
+ false
1582
+ );
1505
1583
  });
1506
1584
 
1507
1585
  it('should return NetworkError code for a NetworkOrCORSERror', () => {
@@ -1515,12 +1593,13 @@ describe('internal-plugin-metrics', () => {
1515
1593
  );
1516
1594
  assert.deepEqual(res, {
1517
1595
  category: 'network',
1518
- errorDescription: '{}\nundefined https://example.com\nWEBEX_TRACKING_ID: undefined\n',
1596
+ errorDescription: 'NetworkError',
1519
1597
  fatal: true,
1520
1598
  name: 'other',
1521
1599
  shownToUser: false,
1522
1600
  serviceErrorCode: undefined,
1523
1601
  errorCode: 1026,
1602
+ rawErrorMessage: '{}\nundefined https://example.com\nWEBEX_TRACKING_ID: undefined\n',
1524
1603
  });
1525
1604
  });
1526
1605
 
@@ -1534,20 +1613,19 @@ describe('internal-plugin-metrics', () => {
1534
1613
 
1535
1614
  error.payloadOverrides = {
1536
1615
  shownToUser: true,
1537
- category: 'expected'
1616
+ category: 'expected',
1538
1617
  };
1539
1618
 
1540
- const res = cd.generateClientEventErrorPayload(
1541
- error
1542
- );
1619
+ const res = cd.generateClientEventErrorPayload(error);
1543
1620
  assert.deepEqual(res, {
1544
1621
  category: 'expected',
1545
- errorDescription: '{}\nundefined https://example.com\nWEBEX_TRACKING_ID: undefined\n',
1622
+ errorDescription: 'NetworkError',
1546
1623
  fatal: true,
1547
1624
  name: 'other',
1548
1625
  shownToUser: true,
1549
1626
  serviceErrorCode: undefined,
1550
1627
  errorCode: 1026,
1628
+ rawErrorMessage: '{}\nundefined https://example.com\nWEBEX_TRACKING_ID: undefined\n',
1551
1629
  });
1552
1630
  });
1553
1631
 
@@ -1562,12 +1640,13 @@ describe('internal-plugin-metrics', () => {
1562
1640
  );
1563
1641
  assert.deepEqual(res, {
1564
1642
  category: 'network',
1565
- errorDescription: '{}\nundefined https://example.com\nWEBEX_TRACKING_ID: undefined\n',
1643
+ errorDescription: 'AuthenticationFailed',
1566
1644
  fatal: true,
1567
1645
  name: 'other',
1568
1646
  shownToUser: false,
1569
1647
  serviceErrorCode: undefined,
1570
1648
  errorCode: 1010,
1649
+ rawErrorMessage: '{}\nundefined https://example.com\nWEBEX_TRACKING_ID: undefined\n',
1571
1650
  });
1572
1651
  });
1573
1652
 
@@ -1581,25 +1660,24 @@ describe('internal-plugin-metrics', () => {
1581
1660
 
1582
1661
  error.payloadOverrides = {
1583
1662
  shownToUser: true,
1584
- category: 'expected'
1663
+ category: 'expected',
1585
1664
  };
1586
1665
 
1587
- const res = cd.generateClientEventErrorPayload(
1588
- error
1589
- );
1666
+ const res = cd.generateClientEventErrorPayload(error);
1590
1667
  assert.deepEqual(res, {
1591
1668
  category: 'expected',
1592
- errorDescription: '{}\nundefined https://example.com\nWEBEX_TRACKING_ID: undefined\n',
1669
+ errorDescription: 'AuthenticationFailed',
1593
1670
  fatal: true,
1594
1671
  name: 'other',
1595
1672
  shownToUser: true,
1596
1673
  serviceErrorCode: undefined,
1597
1674
  errorCode: 1010,
1675
+ rawErrorMessage: '{}\nundefined https://example.com\nWEBEX_TRACKING_ID: undefined\n',
1598
1676
  });
1599
1677
  });
1600
1678
 
1601
1679
  it('should return unknown error otherwise', () => {
1602
- const res = cd.generateClientEventErrorPayload({somethgin: 'new'});
1680
+ const res = cd.generateClientEventErrorPayload({somethgin: 'new', message: 'bad times'});
1603
1681
  assert.deepEqual(res, {
1604
1682
  category: 'other',
1605
1683
  errorDescription: 'UnknownError',
@@ -1608,11 +1686,15 @@ describe('internal-plugin-metrics', () => {
1608
1686
  shownToUser: false,
1609
1687
  serviceErrorCode: 9999,
1610
1688
  errorCode: 9999,
1689
+ rawErrorMessage: 'bad times',
1611
1690
  });
1612
1691
  });
1613
1692
 
1614
1693
  it('should generate event error payload correctly for locus error 2423012', () => {
1615
- const res = cd.generateClientEventErrorPayload({body: {errorCode: 2423012}});
1694
+ const res = cd.generateClientEventErrorPayload({
1695
+ body: {errorCode: 2423012},
1696
+ message: 'bad times',
1697
+ });
1616
1698
  assert.deepEqual(res, {
1617
1699
  category: 'expected',
1618
1700
  errorDescription: 'FraudDetection',
@@ -1621,10 +1703,14 @@ describe('internal-plugin-metrics', () => {
1621
1703
  shownToUser: true,
1622
1704
  serviceErrorCode: 2423012,
1623
1705
  errorCode: 12000,
1706
+ rawErrorMessage: 'bad times',
1624
1707
  });
1625
1708
  });
1626
1709
  it('should generate event error payload correctly for locus error 2409062', () => {
1627
- const res = cd.generateClientEventErrorPayload({body: {errorCode: 2409062}});
1710
+ const res = cd.generateClientEventErrorPayload({
1711
+ body: {errorCode: 2409062},
1712
+ message: 'bad times',
1713
+ });
1628
1714
  assert.deepEqual(res, {
1629
1715
  category: 'expected',
1630
1716
  errorDescription: 'E2EENotSupported',
@@ -1633,12 +1719,15 @@ describe('internal-plugin-metrics', () => {
1633
1719
  shownToUser: true,
1634
1720
  serviceErrorCode: 2409062,
1635
1721
  errorCode: 12002,
1722
+ rawErrorMessage: 'bad times',
1636
1723
  });
1637
1724
  });
1638
1725
 
1639
-
1640
1726
  it('should generate event error payload correctly for locus error 2423021', () => {
1641
- const res = cd.generateClientEventErrorPayload({body: {errorCode: 2423021}});
1727
+ const res = cd.generateClientEventErrorPayload({
1728
+ body: {errorCode: 2423021},
1729
+ message: 'bad times',
1730
+ });
1642
1731
  assert.deepEqual(res, {
1643
1732
  category: 'expected',
1644
1733
  errorDescription: 'LocusLobbyFullCMR',
@@ -1647,6 +1736,7 @@ describe('internal-plugin-metrics', () => {
1647
1736
  shownToUser: true,
1648
1737
  serviceErrorCode: 2423021,
1649
1738
  errorCode: 12001,
1739
+ rawErrorMessage: 'bad times',
1650
1740
  });
1651
1741
  });
1652
1742
  });
@@ -1664,37 +1754,36 @@ describe('internal-plugin-metrics', () => {
1664
1754
 
1665
1755
  describe('#getSubServiceType', () => {
1666
1756
  it('returns subServicetype as PMR when PMR meeting', () => {
1667
- fakeMeeting.meetingInfo ={
1757
+ fakeMeeting.meetingInfo = {
1668
1758
  webexScheduled: false,
1669
1759
  pmr: true,
1670
1760
  enableEvent: false,
1671
- }
1761
+ };
1672
1762
  assert.deepEqual(cd.getSubServiceType(fakeMeeting), 'PMR');
1673
1763
  });
1674
1764
 
1675
1765
  it('returns subServicetype as ScheduledMeeting when regular meeting', () => {
1676
- fakeMeeting.meetingInfo ={
1677
- webexScheduled: true,
1678
- pmr: false,
1679
- enableEvent: false,
1680
- }
1681
- assert.deepEqual(cd.getSubServiceType(fakeMeeting), 'ScheduledMeeting');
1682
- });
1683
-
1684
- it('returns subServicetype as Webinar when meeting is Webinar', () => {
1685
- fakeMeeting.meetingInfo ={
1686
- webexScheduled: true,
1687
- pmr: false,
1688
- enableEvent: true,
1689
- }
1690
- assert.deepEqual(cd.getSubServiceType(fakeMeeting), 'Webinar');
1691
- });
1692
-
1693
- it('returns subServicetype as undefined when correct parameters are not found', () => {
1694
- fakeMeeting.meetingInfo ={}
1695
- assert.deepEqual(cd.getSubServiceType(fakeMeeting), undefined);
1696
- });
1766
+ fakeMeeting.meetingInfo = {
1767
+ webexScheduled: true,
1768
+ pmr: false,
1769
+ enableEvent: false,
1770
+ };
1771
+ assert.deepEqual(cd.getSubServiceType(fakeMeeting), 'ScheduledMeeting');
1772
+ });
1773
+
1774
+ it('returns subServicetype as Webinar when meeting is Webinar', () => {
1775
+ fakeMeeting.meetingInfo = {
1776
+ webexScheduled: true,
1777
+ pmr: false,
1778
+ enableEvent: true,
1779
+ };
1780
+ assert.deepEqual(cd.getSubServiceType(fakeMeeting), 'Webinar');
1781
+ });
1697
1782
 
1783
+ it('returns subServicetype as undefined when correct parameters are not found', () => {
1784
+ fakeMeeting.meetingInfo = {};
1785
+ assert.deepEqual(cd.getSubServiceType(fakeMeeting), undefined);
1786
+ });
1698
1787
  });
1699
1788
 
1700
1789
  describe('#getIsConvergedArchitectureEnabled', () => {
@@ -1720,69 +1809,69 @@ describe('internal-plugin-metrics', () => {
1720
1809
  it('returns expected options without preLoginId', async () => {
1721
1810
  const options = {
1722
1811
  meetingId: fakeMeeting.id,
1723
- preLoginId
1812
+ preLoginId,
1724
1813
  };
1725
1814
 
1726
1815
  const triggered = new Date();
1727
1816
  const fetchOptions = await cd.buildClientEventFetchRequestOptions({
1728
1817
  name: 'client.exit.app',
1729
- payload: { trigger: 'user-interaction', canProceed: false },
1818
+ payload: {trigger: 'user-interaction', canProceed: false},
1730
1819
  options,
1731
1820
  });
1732
1821
 
1733
1822
  assert.deepEqual(fetchOptions.body, {
1734
- metrics: [
1735
- {
1736
- eventPayload: {
1737
- event: {
1738
- canProceed: false,
1739
- eventData: {
1740
- webClientDomain: 'whatever',
1741
- },
1742
- identifiers: {
1743
- correlationId: 'correlationId',
1744
- deviceId: 'deviceUrl',
1745
- locusId: 'url',
1746
- locusStartTime: 'lastActive',
1747
- locusUrl: 'locus/url',
1748
- orgId: 'orgId',
1749
- userId: 'userId',
1750
- },
1751
- loginType: 'login-ci',
1752
- name: 'client.exit.app',
1753
- trigger: 'user-interaction',
1754
- userType: 'host',
1755
- isConvergedArchitectureEnabled: undefined,
1756
- webexSubServiceType: undefined,
1823
+ metrics: [
1824
+ {
1825
+ eventPayload: {
1826
+ event: {
1827
+ canProceed: false,
1828
+ eventData: {
1829
+ webClientDomain: 'whatever',
1757
1830
  },
1758
- eventId: 'my-fake-id',
1759
- origin: {
1760
- buildType: 'test',
1761
- clientInfo: {
1762
- clientType: 'TEAMS_CLIENT',
1763
- clientVersion: 'webex-js-sdk/webex-version',
1764
- localNetworkPrefix:
1765
- Utils.anonymizeIPAddress(webex.meetings.geoHintInfo?.clientAddress) ||
1766
- undefined,
1767
- os: getOSNameInternal() || 'unknown',
1768
- osVersion: getOSVersion(),
1769
- subClientType: 'WEB_APP',
1770
- },
1771
- environment: 'meeting_evn',
1772
- name: 'endpoint',
1773
- networkType: 'unknown',
1774
- userAgent,
1831
+ identifiers: {
1832
+ correlationId: 'correlationId',
1833
+ deviceId: 'deviceUrl',
1834
+ locusId: 'url',
1835
+ locusStartTime: 'lastActive',
1836
+ locusUrl: 'locus/url',
1837
+ orgId: 'orgId',
1838
+ userId: 'userId',
1775
1839
  },
1776
- originTime: {
1777
- sent: 'not_defined_yet',
1778
- triggered: triggered.toISOString(),
1840
+ loginType: 'login-ci',
1841
+ name: 'client.exit.app',
1842
+ trigger: 'user-interaction',
1843
+ userType: 'host',
1844
+ isConvergedArchitectureEnabled: undefined,
1845
+ webexSubServiceType: undefined,
1846
+ },
1847
+ eventId: 'my-fake-id',
1848
+ origin: {
1849
+ buildType: 'test',
1850
+ clientInfo: {
1851
+ clientType: 'TEAMS_CLIENT',
1852
+ clientVersion: 'webex-js-sdk/webex-version',
1853
+ localNetworkPrefix:
1854
+ Utils.anonymizeIPAddress(webex.meetings.geoHintInfo?.clientAddress) ||
1855
+ undefined,
1856
+ os: getOSNameInternal() || 'unknown',
1857
+ osVersion: getOSVersion(),
1858
+ subClientType: 'WEB_APP',
1779
1859
  },
1780
- senderCountryCode: webex.meetings.geoHintInfo?.countryCode,
1781
- version: 1,
1860
+ environment: 'meeting_evn',
1861
+ name: 'endpoint',
1862
+ networkType: 'unknown',
1863
+ userAgent,
1782
1864
  },
1783
- type: ['diagnostic-event'],
1865
+ originTime: {
1866
+ sent: 'not_defined_yet',
1867
+ triggered: triggered.toISOString(),
1868
+ },
1869
+ senderCountryCode: webex.meetings.geoHintInfo?.countryCode,
1870
+ version: 1,
1784
1871
  },
1785
- ],
1872
+ type: ['diagnostic-event'],
1873
+ },
1874
+ ],
1786
1875
  });
1787
1876
 
1788
1877
  const rest = omit(fetchOptions, 'body');
@@ -1797,8 +1886,8 @@ describe('internal-plugin-metrics', () => {
1797
1886
  headers: {
1798
1887
  authorization: false,
1799
1888
  'x-prelogin-userid': preLoginId,
1800
- }
1801
- })
1889
+ },
1890
+ });
1802
1891
  } else {
1803
1892
  assert.deepEqual(rest, {
1804
1893
  foo: 'bar',
@@ -1807,7 +1896,7 @@ describe('internal-plugin-metrics', () => {
1807
1896
  service: 'metrics',
1808
1897
  headers: {},
1809
1898
  waitForServiceTimeout: CONFIG.metrics.waitForServiceTimeout,
1810
- })
1899
+ });
1811
1900
  }
1812
1901
 
1813
1902
  const webexLoggerLogCalls = webex.logger.log.getCalls();