@webex/internal-plugin-metrics 3.7.0 → 3.8.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 (38) hide show
  1. package/dist/business-metrics.js +74 -100
  2. package/dist/business-metrics.js.map +1 -1
  3. package/dist/call-diagnostic/call-diagnostic-metrics-latencies.js +24 -15
  4. package/dist/call-diagnostic/call-diagnostic-metrics-latencies.js.map +1 -1
  5. package/dist/call-diagnostic/call-diagnostic-metrics.js +70 -10
  6. package/dist/call-diagnostic/call-diagnostic-metrics.js.map +1 -1
  7. package/dist/call-diagnostic/config.js +19 -12
  8. package/dist/call-diagnostic/config.js.map +1 -1
  9. package/dist/generic-metrics.js +2 -2
  10. package/dist/generic-metrics.js.map +1 -1
  11. package/dist/metrics.js +1 -1
  12. package/dist/metrics.types.js.map +1 -1
  13. package/dist/new-metrics.js +28 -5
  14. package/dist/new-metrics.js.map +1 -1
  15. package/dist/types/business-metrics.d.ts +10 -28
  16. package/dist/types/call-diagnostic/call-diagnostic-metrics.d.ts +14 -1
  17. package/dist/types/call-diagnostic/config.d.ts +2 -0
  18. package/dist/types/generic-metrics.d.ts +2 -2
  19. package/dist/types/metrics.types.d.ts +13 -1
  20. package/dist/types/new-metrics.d.ts +15 -3
  21. package/package.json +12 -12
  22. package/src/business-metrics.ts +66 -76
  23. package/src/call-diagnostic/call-diagnostic-metrics-latencies.ts +36 -14
  24. package/src/call-diagnostic/call-diagnostic-metrics.ts +82 -3
  25. package/src/call-diagnostic/config.ts +8 -0
  26. package/src/generic-metrics.ts +2 -2
  27. package/src/metrics.types.ts +16 -1
  28. package/src/new-metrics.ts +32 -4
  29. package/test/unit/spec/business/business-metrics.ts +2 -2
  30. package/test/unit/spec/call-diagnostic/call-diagnostic-metrics-latencies.ts +85 -0
  31. package/test/unit/spec/call-diagnostic/call-diagnostic-metrics.ts +491 -2
  32. package/test/unit/spec/new-metrics.ts +23 -0
  33. package/dist/behavioral/behavioral-metrics.js +0 -199
  34. package/dist/behavioral/behavioral-metrics.js.map +0 -1
  35. package/dist/behavioral/config.js +0 -11
  36. package/dist/behavioral/config.js.map +0 -1
  37. package/dist/types/behavioral/behavioral-metrics.d.ts +0 -63
  38. package/dist/types/behavioral/config.d.ts +0 -1
@@ -13,6 +13,9 @@ import {
13
13
  } from '@webex/internal-plugin-metrics';
14
14
  import uuid from 'uuid';
15
15
  import {omit} from 'lodash';
16
+ import { glob } from 'glob';
17
+ import { expect } from 'chai';
18
+ import { ClientEmailInput, ClientUserNameInput } from '@webex/internal-plugin-metrics/src/metrics.types';
16
19
 
17
20
  //@ts-ignore
18
21
  global.window = {location: {hostname: 'whatever'}};
@@ -58,10 +61,20 @@ describe('internal-plugin-metrics', () => {
58
61
  sessionCorrelationId: 'sessionCorrelationId3',
59
62
  };
60
63
 
64
+ const fakeMeeting5 = {
65
+ ...fakeMeeting,
66
+ id: '5',
67
+ correlationId: 'correlationId5',
68
+ sessionCorrelationId: 'sessionCorrelationId5',
69
+ userNameInput: 'test',
70
+ emailInput: 'test@test.com'
71
+ };
72
+
61
73
  const fakeMeetings = {
62
74
  1: fakeMeeting,
63
75
  2: fakeMeeting2,
64
76
  3: fakeMeeting3,
77
+ 5: fakeMeeting5,
65
78
  };
66
79
 
67
80
  let webex;
@@ -745,6 +758,52 @@ describe('internal-plugin-metrics', () => {
745
758
  });
746
759
  });
747
760
 
761
+ it('should prepare diagnostic event successfully when triggeredTime is supplied in the options object', () => {
762
+ const options = {meetingId: fakeMeeting.id, triggeredTime: 'fake-triggered-time'};
763
+ const getOriginStub = sinon.stub(cd, 'getOrigin').returns({origin: 'fake-origin'});
764
+ const clearEmptyKeysRecursivelyStub = sinon.stub(
765
+ CallDiagnosticUtils,
766
+ 'clearEmptyKeysRecursively'
767
+ );
768
+
769
+ const res = cd.prepareDiagnosticEvent(
770
+ {
771
+ canProceed: false,
772
+ identifiers: {
773
+ correlationId: 'id',
774
+ webexConferenceIdStr: 'webexConferenceIdStr1',
775
+ globalMeetingId: 'globalMeetingId1',
776
+ },
777
+ name: 'client.alert.displayed',
778
+ },
779
+ options
780
+ );
781
+
782
+ assert.calledWith(getOriginStub, options, options.meetingId);
783
+ assert.calledOnce(clearEmptyKeysRecursivelyStub);
784
+ assert.deepEqual(res, {
785
+ event: {
786
+ canProceed: false,
787
+ identifiers: {
788
+ correlationId: 'id',
789
+ webexConferenceIdStr: 'webexConferenceIdStr1',
790
+ globalMeetingId: 'globalMeetingId1',
791
+ },
792
+ name: 'client.alert.displayed',
793
+ },
794
+ eventId: 'my-fake-id',
795
+ origin: {
796
+ origin: 'fake-origin',
797
+ },
798
+ originTime: {
799
+ sent: 'not_defined_yet',
800
+ triggered: 'fake-triggered-time',
801
+ },
802
+ senderCountryCode: 'UK',
803
+ version: 1,
804
+ });
805
+ });
806
+
748
807
  describe('#submitClientEvent', () => {
749
808
  it('should submit client event successfully with meetingId', () => {
750
809
  const prepareDiagnosticEventSpy = sinon.spy(cd, 'prepareDiagnosticEvent');
@@ -796,6 +855,7 @@ describe('internal-plugin-metrics', () => {
796
855
  userType: 'host',
797
856
  isConvergedArchitectureEnabled: undefined,
798
857
  webexSubServiceType: undefined,
858
+ webClientPreload: undefined,
799
859
  },
800
860
  options
801
861
  );
@@ -821,6 +881,7 @@ describe('internal-plugin-metrics', () => {
821
881
  userType: 'host',
822
882
  isConvergedArchitectureEnabled: undefined,
823
883
  webexSubServiceType: undefined,
884
+ webClientPreload: undefined,
824
885
  },
825
886
  eventId: 'my-fake-id',
826
887
  origin: {
@@ -857,6 +918,7 @@ describe('internal-plugin-metrics', () => {
857
918
  userType: 'host',
858
919
  isConvergedArchitectureEnabled: undefined,
859
920
  webexSubServiceType: undefined,
921
+ webClientPreload: undefined,
860
922
  },
861
923
  eventId: 'my-fake-id',
862
924
  origin: {
@@ -930,6 +992,7 @@ describe('internal-plugin-metrics', () => {
930
992
  userType: 'host',
931
993
  isConvergedArchitectureEnabled: undefined,
932
994
  webexSubServiceType: undefined,
995
+ webClientPreload: undefined,
933
996
  },
934
997
  options
935
998
  );
@@ -956,6 +1019,7 @@ describe('internal-plugin-metrics', () => {
956
1019
  userType: 'host',
957
1020
  isConvergedArchitectureEnabled: undefined,
958
1021
  webexSubServiceType: undefined,
1022
+ webClientPreload: undefined,
959
1023
  },
960
1024
  eventId: 'my-fake-id',
961
1025
  origin: {
@@ -993,6 +1057,152 @@ describe('internal-plugin-metrics', () => {
993
1057
  userType: 'host',
994
1058
  isConvergedArchitectureEnabled: undefined,
995
1059
  webexSubServiceType: undefined,
1060
+ webClientPreload: undefined,
1061
+ },
1062
+ eventId: 'my-fake-id',
1063
+ origin: {
1064
+ origin: 'fake-origin',
1065
+ },
1066
+ originTime: {
1067
+ sent: 'not_defined_yet',
1068
+ triggered: now.toISOString(),
1069
+ },
1070
+ senderCountryCode: 'UK',
1071
+ version: 1,
1072
+ },
1073
+ });
1074
+
1075
+ const webexLoggerLogCalls = webex.logger.log.getCalls();
1076
+ assert.deepEqual(webexLoggerLogCalls[1].args, [
1077
+ 'call-diagnostic-events -> ',
1078
+ 'CallDiagnosticMetrics: @submitClientEvent. Submit Client Event CA event.',
1079
+ `name: client.alert.displayed`,
1080
+ ]);
1081
+ });
1082
+
1083
+ it('should submit client event successfully with meetingId which has emailInput and userNameInput', () => {
1084
+ const prepareDiagnosticEventSpy = sinon.spy(cd, 'prepareDiagnosticEvent');
1085
+ const submitToCallDiagnosticsSpy = sinon.spy(cd, 'submitToCallDiagnostics');
1086
+ const generateClientEventErrorPayloadSpy = sinon.spy(cd, 'generateClientEventErrorPayload');
1087
+ const getIdentifiersSpy = sinon.spy(cd, 'getIdentifiers');
1088
+ const getSubServiceTypeSpy = sinon.spy(cd, 'getSubServiceType');
1089
+ sinon.stub(cd, 'getOrigin').returns({origin: 'fake-origin'});
1090
+ const validatorSpy = sinon.spy(cd, 'validator');
1091
+ const options = {
1092
+ meetingId: fakeMeeting5.id,
1093
+ mediaConnections: [{mediaAgentAlias: 'alias', mediaAgentGroupId: '1'}],
1094
+ };
1095
+
1096
+ cd.submitClientEvent({
1097
+ name: 'client.alert.displayed',
1098
+ options,
1099
+ });
1100
+
1101
+ assert.called(getIdentifiersSpy);
1102
+ assert.calledWith(getIdentifiersSpy, {
1103
+ meeting: {...fakeMeeting5, sessionCorrelationId: 'sessionCorrelationId5'},
1104
+ mediaConnections: [{mediaAgentAlias: 'alias', mediaAgentGroupId: '1'}],
1105
+ webexConferenceIdStr: undefined,
1106
+ globalMeetingId: undefined,
1107
+ sessionCorrelationId: undefined,
1108
+ });
1109
+ assert.notCalled(generateClientEventErrorPayloadSpy);
1110
+ assert.calledWith(
1111
+ prepareDiagnosticEventSpy,
1112
+ {
1113
+ canProceed: true,
1114
+ eventData: {
1115
+ webClientDomain: 'whatever',
1116
+ },
1117
+ identifiers: {
1118
+ correlationId: 'correlationId5',
1119
+ sessionCorrelationId: 'sessionCorrelationId5',
1120
+ deviceId: 'deviceUrl',
1121
+ locusId: 'url',
1122
+ locusStartTime: 'lastActive',
1123
+ locusUrl: 'locus/url',
1124
+ mediaAgentAlias: 'alias',
1125
+ mediaAgentGroupId: '1',
1126
+ orgId: 'orgId',
1127
+ userId: 'userId',
1128
+ },
1129
+ loginType: 'login-ci',
1130
+ name: 'client.alert.displayed',
1131
+ userType: 'host',
1132
+ userNameInput: 'test',
1133
+ emailInput: 'test@test.com',
1134
+ isConvergedArchitectureEnabled: undefined,
1135
+ webexSubServiceType: undefined,
1136
+ webClientPreload: undefined,
1137
+ },
1138
+ options
1139
+ );
1140
+ assert.calledWith(submitToCallDiagnosticsSpy, {
1141
+ event: {
1142
+ canProceed: true,
1143
+ eventData: {
1144
+ webClientDomain: 'whatever',
1145
+ },
1146
+ identifiers: {
1147
+ correlationId: 'correlationId5',
1148
+ sessionCorrelationId: 'sessionCorrelationId5',
1149
+ deviceId: 'deviceUrl',
1150
+ locusId: 'url',
1151
+ locusStartTime: 'lastActive',
1152
+ locusUrl: 'locus/url',
1153
+ mediaAgentAlias: 'alias',
1154
+ mediaAgentGroupId: '1',
1155
+ orgId: 'orgId',
1156
+ userId: 'userId',
1157
+ },
1158
+ loginType: 'login-ci',
1159
+ name: 'client.alert.displayed',
1160
+ userType: 'host',
1161
+ userNameInput: 'test',
1162
+ emailInput: 'test@test.com',
1163
+ isConvergedArchitectureEnabled: undefined,
1164
+ webexSubServiceType: undefined,
1165
+ webClientPreload: undefined,
1166
+ },
1167
+ eventId: 'my-fake-id',
1168
+ origin: {
1169
+ origin: 'fake-origin',
1170
+ },
1171
+ originTime: {
1172
+ sent: 'not_defined_yet',
1173
+ triggered: now.toISOString(),
1174
+ },
1175
+ senderCountryCode: 'UK',
1176
+ version: 1,
1177
+ });
1178
+ assert.calledWith(validatorSpy, {
1179
+ type: 'ce',
1180
+ event: {
1181
+ event: {
1182
+ canProceed: true,
1183
+ eventData: {
1184
+ webClientDomain: 'whatever',
1185
+ },
1186
+ identifiers: {
1187
+ correlationId: 'correlationId5',
1188
+ sessionCorrelationId: 'sessionCorrelationId5',
1189
+ deviceId: 'deviceUrl',
1190
+ locusId: 'url',
1191
+ locusStartTime: 'lastActive',
1192
+ locusUrl: 'locus/url',
1193
+ mediaAgentAlias: 'alias',
1194
+ mediaAgentGroupId: '1',
1195
+ orgId: 'orgId',
1196
+ userId: 'userId',
1197
+ },
1198
+ loginType: 'login-ci',
1199
+ name: 'client.alert.displayed',
1200
+ userType: 'host',
1201
+ userNameInput: 'test',
1202
+ emailInput: 'test@test.com',
1203
+ isConvergedArchitectureEnabled: undefined,
1204
+ webexSubServiceType: undefined,
1205
+ webClientPreload: undefined,
996
1206
  },
997
1207
  eventId: 'my-fake-id',
998
1208
  origin: {
@@ -1110,6 +1320,7 @@ describe('internal-plugin-metrics', () => {
1110
1320
  },
1111
1321
  loginType: 'login-ci',
1112
1322
  name: 'client.alert.displayed',
1323
+ webClientPreload: undefined
1113
1324
  },
1114
1325
  options
1115
1326
  );
@@ -1131,6 +1342,7 @@ describe('internal-plugin-metrics', () => {
1131
1342
  },
1132
1343
  loginType: 'login-ci',
1133
1344
  name: 'client.alert.displayed',
1345
+ webClientPreload: undefined
1134
1346
  },
1135
1347
  eventId: 'my-fake-id',
1136
1348
  origin: {
@@ -1204,6 +1416,7 @@ describe('internal-plugin-metrics', () => {
1204
1416
  },
1205
1417
  loginType: 'login-ci',
1206
1418
  name: 'client.alert.displayed',
1419
+ webClientPreload: undefined,
1207
1420
  },
1208
1421
  options
1209
1422
  );
@@ -1231,6 +1444,99 @@ describe('internal-plugin-metrics', () => {
1231
1444
  },
1232
1445
  eventData: {webClientDomain: 'whatever'},
1233
1446
  loginType: 'login-ci',
1447
+ webClientPreload: undefined,
1448
+ },
1449
+ },
1450
+ options.preLoginId
1451
+ );
1452
+ });
1453
+
1454
+ it('should submit client event successfully with emailInput and userNameInput as options', () => {
1455
+ cd.device.userId = undefined;
1456
+
1457
+ const prepareDiagnosticEventSpy = sinon.spy(cd, 'prepareDiagnosticEvent');
1458
+ const submitToCallDiagnosticsPreLoginSpy = sinon.spy(cd, 'submitToCallDiagnosticsPreLogin');
1459
+ const submitToCallDiagnosticsSpy = sinon.spy(cd, 'submitToCallDiagnostics');
1460
+ const generateClientEventErrorPayloadSpy = sinon.spy(cd, 'generateClientEventErrorPayload');
1461
+ const getIdentifiersSpy = sinon.spy(cd, 'getIdentifiers');
1462
+ sinon.stub(cd, 'getOrigin').returns({origin: 'fake-origin'});
1463
+
1464
+ const options = {
1465
+ correlationId: 'correlationId',
1466
+ webexConferenceIdStr: 'webexConferenceIdStr1',
1467
+ globalMeetingId: 'globalMeetingId1',
1468
+ preLoginId: 'myPreLoginId',
1469
+ sessionCorrelationId: 'sessionCorrelationId1',
1470
+ userNameInput: 'current' as ClientUserNameInput,
1471
+ emailInput: 'current' as ClientEmailInput,
1472
+ };
1473
+
1474
+ cd.submitClientEvent({
1475
+ name: 'client.alert.displayed',
1476
+ options,
1477
+ });
1478
+
1479
+ assert.calledWith(getIdentifiersSpy, {
1480
+ correlationId: 'correlationId',
1481
+ webexConferenceIdStr: 'webexConferenceIdStr1',
1482
+ globalMeetingId: 'globalMeetingId1',
1483
+ preLoginId: 'myPreLoginId',
1484
+ sessionCorrelationId: 'sessionCorrelationId1',
1485
+ });
1486
+
1487
+ assert.notCalled(generateClientEventErrorPayloadSpy);
1488
+ assert.calledWith(
1489
+ prepareDiagnosticEventSpy,
1490
+ {
1491
+ canProceed: true,
1492
+ eventData: {
1493
+ webClientDomain: 'whatever',
1494
+ },
1495
+ identifiers: {
1496
+ correlationId: 'correlationId',
1497
+ sessionCorrelationId: 'sessionCorrelationId1',
1498
+ webexConferenceIdStr: 'webexConferenceIdStr1',
1499
+ globalMeetingId: 'globalMeetingId1',
1500
+ deviceId: 'deviceUrl',
1501
+ locusUrl: 'locus-url',
1502
+ orgId: 'orgId',
1503
+ userId: 'myPreLoginId',
1504
+ },
1505
+ userNameInput: 'current',
1506
+ emailInput: 'current',
1507
+ loginType: 'login-ci',
1508
+ name: 'client.alert.displayed',
1509
+ webClientPreload: undefined,
1510
+ },
1511
+ options
1512
+ );
1513
+ assert.notCalled(submitToCallDiagnosticsSpy);
1514
+ assert.calledWith(
1515
+ submitToCallDiagnosticsPreLoginSpy,
1516
+ {
1517
+ eventId: 'my-fake-id',
1518
+ version: 1,
1519
+ origin: {origin: 'fake-origin'},
1520
+ originTime: {triggered: now.toISOString(), sent: 'not_defined_yet'},
1521
+ senderCountryCode: 'UK',
1522
+ event: {
1523
+ name: 'client.alert.displayed',
1524
+ canProceed: true,
1525
+ identifiers: {
1526
+ correlationId: 'correlationId',
1527
+ sessionCorrelationId: 'sessionCorrelationId1',
1528
+ userId: 'myPreLoginId',
1529
+ deviceId: 'deviceUrl',
1530
+ orgId: 'orgId',
1531
+ locusUrl: 'locus-url',
1532
+ webexConferenceIdStr: 'webexConferenceIdStr1',
1533
+ globalMeetingId: 'globalMeetingId1',
1534
+ },
1535
+ eventData: {webClientDomain: 'whatever'},
1536
+ loginType: 'login-ci',
1537
+ userNameInput: 'current',
1538
+ emailInput: 'current',
1539
+ webClientPreload: undefined,
1234
1540
  },
1235
1541
  },
1236
1542
  options.preLoginId
@@ -1273,6 +1579,7 @@ describe('internal-plugin-metrics', () => {
1273
1579
  joinFlowVersion: 'Other',
1274
1580
  isConvergedArchitectureEnabled: undefined,
1275
1581
  webexSubServiceType: undefined,
1582
+ webClientPreload: undefined,
1276
1583
  },
1277
1584
  eventId: 'my-fake-id',
1278
1585
  origin: {
@@ -1325,6 +1632,84 @@ describe('internal-plugin-metrics', () => {
1325
1632
  joinFlowVersion: 'Other',
1326
1633
  isConvergedArchitectureEnabled: undefined,
1327
1634
  webexSubServiceType: undefined,
1635
+ webClientPreload: undefined,
1636
+ },
1637
+ eventId: 'my-fake-id',
1638
+ origin: {
1639
+ origin: 'fake-origin',
1640
+ },
1641
+ originTime: {
1642
+ sent: 'not_defined_yet',
1643
+ triggered: now.toISOString(),
1644
+ },
1645
+ senderCountryCode: 'UK',
1646
+ version: 1,
1647
+ });
1648
+ });
1649
+
1650
+ it('should submit client event successfully with webClientPreload', () => {
1651
+ const prepareDiagnosticEventSpy = sinon.spy(cd, 'prepareDiagnosticEvent');
1652
+ const submitToCallDiagnosticsSpy = sinon.spy(cd, 'submitToCallDiagnostics');
1653
+ const generateClientEventErrorPayloadSpy = sinon.spy(cd, 'generateClientEventErrorPayload');
1654
+ sinon.stub(cd, 'getOrigin').returns({origin: 'fake-origin'});
1655
+
1656
+ webex.meetings.config.metrics.webClientPreload = true;
1657
+
1658
+ const options = {
1659
+ correlationId: 'correlationId',
1660
+ webexConferenceIdStr: 'webexConferenceIdStr1',
1661
+ globalMeetingId: 'globalMeetingId1',
1662
+ sessionCorrelationId: 'sessionCorrelationId1',
1663
+ };
1664
+
1665
+ cd.submitClientEvent({
1666
+ name: 'client.alert.displayed',
1667
+ options,
1668
+ });
1669
+
1670
+ assert.notCalled(generateClientEventErrorPayloadSpy);
1671
+ assert.calledWith(
1672
+ prepareDiagnosticEventSpy,
1673
+ {
1674
+ canProceed: true,
1675
+ eventData: {
1676
+ webClientDomain: 'whatever',
1677
+ },
1678
+ identifiers: {
1679
+ correlationId: 'correlationId',
1680
+ webexConferenceIdStr: 'webexConferenceIdStr1',
1681
+ sessionCorrelationId: 'sessionCorrelationId1',
1682
+ globalMeetingId: 'globalMeetingId1',
1683
+ deviceId: 'deviceUrl',
1684
+ locusUrl: 'locus-url',
1685
+ orgId: 'orgId',
1686
+ userId: 'userId',
1687
+ },
1688
+ loginType: 'login-ci',
1689
+ name: 'client.alert.displayed',
1690
+ webClientPreload: true,
1691
+ },
1692
+ options
1693
+ );
1694
+ assert.calledWith(submitToCallDiagnosticsSpy, {
1695
+ event: {
1696
+ canProceed: true,
1697
+ eventData: {
1698
+ webClientDomain: 'whatever',
1699
+ },
1700
+ identifiers: {
1701
+ correlationId: 'correlationId',
1702
+ webexConferenceIdStr: 'webexConferenceIdStr1',
1703
+ sessionCorrelationId: 'sessionCorrelationId1',
1704
+ globalMeetingId: 'globalMeetingId1',
1705
+ deviceId: 'deviceUrl',
1706
+ locusUrl: 'locus-url',
1707
+ orgId: 'orgId',
1708
+ userId: 'userId',
1709
+ },
1710
+ loginType: 'login-ci',
1711
+ name: 'client.alert.displayed',
1712
+ webClientPreload: true,
1328
1713
  },
1329
1714
  eventId: 'my-fake-id',
1330
1715
  origin: {
@@ -1396,6 +1781,7 @@ describe('internal-plugin-metrics', () => {
1396
1781
  userType: 'host',
1397
1782
  isConvergedArchitectureEnabled: undefined,
1398
1783
  webexSubServiceType: undefined,
1784
+ webClientPreload: undefined,
1399
1785
  },
1400
1786
  eventId: 'my-fake-id',
1401
1787
  origin: {
@@ -1475,6 +1861,7 @@ describe('internal-plugin-metrics', () => {
1475
1861
  userType: 'host',
1476
1862
  isConvergedArchitectureEnabled: undefined,
1477
1863
  webexSubServiceType: undefined,
1864
+ webClientPreload: undefined,
1478
1865
  },
1479
1866
  eventId: 'my-fake-id',
1480
1867
  origin: {
@@ -1546,6 +1933,7 @@ describe('internal-plugin-metrics', () => {
1546
1933
  ],
1547
1934
  loginType: 'login-ci',
1548
1935
  name: 'client.alert.displayed',
1936
+ webClientPreload: undefined,
1549
1937
  },
1550
1938
  eventId: 'my-fake-id',
1551
1939
  origin: {
@@ -1619,6 +2007,7 @@ describe('internal-plugin-metrics', () => {
1619
2007
  ],
1620
2008
  loginType: 'login-ci',
1621
2009
  name: 'client.alert.displayed',
2010
+ webClientPreload: undefined,
1622
2011
  },
1623
2012
  eventId: 'my-fake-id',
1624
2013
  origin: {
@@ -1701,6 +2090,7 @@ describe('internal-plugin-metrics', () => {
1701
2090
  userType: 'host',
1702
2091
  isConvergedArchitectureEnabled: undefined,
1703
2092
  webexSubServiceType: undefined,
2093
+ webClientPreload: undefined,
1704
2094
  },
1705
2095
  eventId: 'my-fake-id',
1706
2096
  origin: {
@@ -2626,10 +3016,21 @@ describe('internal-plugin-metrics', () => {
2626
3016
  webexScheduled: true,
2627
3017
  pmr: false,
2628
3018
  enableEvent: true,
3019
+ isConvergedWebinar: true,
2629
3020
  };
2630
3021
  assert.deepEqual(cd.getSubServiceType(fakeMeeting), 'Webinar');
2631
3022
  });
2632
3023
 
3024
+ it('returns subServicetype as Webcast when meeting is Webinar and enable webcast', () => {
3025
+ fakeMeeting.meetingInfo = {
3026
+ webexScheduled: true,
3027
+ pmr: false,
3028
+ enableEvent: true,
3029
+ isConvergedWebinarWebcast: true,
3030
+ };
3031
+ assert.deepEqual(cd.getSubServiceType(fakeMeeting), 'Webcast');
3032
+ });
3033
+
2633
3034
  it('returns subServicetype as undefined when correct parameters are not found', () => {
2634
3035
  fakeMeeting.meetingInfo = {};
2635
3036
  assert.deepEqual(cd.getSubServiceType(fakeMeeting), undefined);
@@ -2693,6 +3094,7 @@ describe('internal-plugin-metrics', () => {
2693
3094
  userType: 'host',
2694
3095
  isConvergedArchitectureEnabled: undefined,
2695
3096
  webexSubServiceType: undefined,
3097
+ webClientPreload: undefined,
2696
3098
  },
2697
3099
  eventId: 'my-fake-id',
2698
3100
  origin: {
@@ -2759,11 +3161,12 @@ describe('internal-plugin-metrics', () => {
2759
3161
  });
2760
3162
  });
2761
3163
 
2762
- it('includes expected joinFlowVersion from options when in-meeting', async () => {
3164
+ it('includes expected joinFlowVersion and meetingJoinPhase from options when in-meeting', async () => {
2763
3165
  // meetingId means in-meeting
2764
3166
  const options = {
2765
3167
  meetingId: fakeMeeting.id,
2766
3168
  joinFlowVersion: 'NewFTE',
3169
+ meetingJoinPhase: 'join',
2767
3170
  };
2768
3171
 
2769
3172
  const triggered = new Date();
@@ -2777,6 +3180,11 @@ describe('internal-plugin-metrics', () => {
2777
3180
  fetchOptions.body.metrics[0].eventPayload.event.joinFlowVersion,
2778
3181
  options.joinFlowVersion
2779
3182
  );
3183
+
3184
+ assert.equal(
3185
+ fetchOptions.body.metrics[0].eventPayload.event.meetingJoinPhase,
3186
+ options.meetingJoinPhase
3187
+ );
2780
3188
  });
2781
3189
 
2782
3190
  it('includes expected joinFlowVersion from meeting callStateForMetrics when in-meeting', async () => {
@@ -2815,12 +3223,13 @@ describe('internal-plugin-metrics', () => {
2815
3223
  );
2816
3224
  });
2817
3225
 
2818
- it('includes expected joinFlowVersion from options during prejoin', async () => {
3226
+ it('includes expected joinFlowVersion and meetingJoinPhase from options during prejoin', async () => {
2819
3227
  // correlationId and no meeting id means prejoin
2820
3228
  const options = {
2821
3229
  correlationId: 'myCorrelationId',
2822
3230
  preLoginId: 'myPreLoginId',
2823
3231
  joinFlowVersion: 'NewFTE',
3232
+ meetingJoinPhase: 'pre-join',
2824
3233
  };
2825
3234
 
2826
3235
  const triggered = new Date();
@@ -2834,6 +3243,11 @@ describe('internal-plugin-metrics', () => {
2834
3243
  fetchOptions.body.metrics[0].eventPayload.event.joinFlowVersion,
2835
3244
  options.joinFlowVersion
2836
3245
  );
3246
+
3247
+ assert.equal(
3248
+ fetchOptions.body.metrics[0].eventPayload.event.meetingJoinPhase,
3249
+ options.meetingJoinPhase
3250
+ );
2837
3251
  });
2838
3252
  });
2839
3253
 
@@ -2880,5 +3294,80 @@ describe('internal-plugin-metrics', () => {
2880
3294
  assert.deepEqual(cd.device, device);
2881
3295
  });
2882
3296
  });
3297
+
3298
+ describe('#submitDelayedClientEvents', () => {
3299
+ it('does not call submitClientEvent if there were no delayed events', () => {
3300
+ const submitClientEventSpy = sinon.spy(cd, 'submitClientEvent');
3301
+
3302
+ cd.submitDelayedClientEvents();
3303
+
3304
+ assert.notCalled(submitClientEventSpy);
3305
+ });
3306
+
3307
+ it('calls submitClientEvent for every delayed event and clears delayedClientEvents array', () => {
3308
+ const submitClientEventSpy = sinon.spy(cd, 'submitClientEvent');
3309
+ const submitToCallDiagnosticsSpy = sinon.spy(cd, 'submitToCallDiagnostics');
3310
+
3311
+ const options = {
3312
+ correlationId: 'correlationId',
3313
+ };
3314
+
3315
+ cd.submitClientEvent({
3316
+ name: 'client.alert.displayed',
3317
+ options,
3318
+ delaySubmitEvent: true,
3319
+ });
3320
+
3321
+ cd.submitClientEvent({
3322
+ name: 'client.alert.removed',
3323
+ options,
3324
+ delaySubmitEvent: true,
3325
+ });
3326
+
3327
+ cd.submitClientEvent({
3328
+ name: 'client.call.aborted',
3329
+ options,
3330
+ delaySubmitEvent: true,
3331
+ });
3332
+
3333
+ assert.notCalled(submitToCallDiagnosticsSpy);
3334
+ assert.calledThrice(submitClientEventSpy);
3335
+ submitClientEventSpy.resetHistory();
3336
+
3337
+ cd.submitDelayedClientEvents();
3338
+
3339
+ assert.calledThrice(submitClientEventSpy);
3340
+ assert.calledWith(submitClientEventSpy.firstCall, {
3341
+ name: 'client.alert.displayed',
3342
+ payload: undefined,
3343
+ options: {
3344
+ correlationId: 'correlationId',
3345
+ triggeredTime: now.toISOString(),
3346
+ },
3347
+ });
3348
+ assert.calledWith(submitClientEventSpy.secondCall, {
3349
+ name: 'client.alert.removed',
3350
+ payload: undefined,
3351
+ options: {
3352
+ correlationId: 'correlationId',
3353
+ triggeredTime: now.toISOString(),
3354
+ },
3355
+ });
3356
+ assert.calledWith(submitClientEventSpy.thirdCall, {
3357
+ name: 'client.call.aborted',
3358
+ payload: undefined,
3359
+ options: {
3360
+ correlationId: 'correlationId',
3361
+ triggeredTime: now.toISOString(),
3362
+ },
3363
+ });
3364
+ submitClientEventSpy.resetHistory();
3365
+
3366
+ cd.submitDelayedClientEvents();
3367
+
3368
+ // should not call submitClientEvent again if delayedClientEvents was cleared
3369
+ assert.notCalled(submitClientEventSpy);
3370
+ });
3371
+ });
2883
3372
  });
2884
3373
  });