@webex/internal-plugin-metrics 3.8.0 → 3.8.1-next.10

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 (35) hide show
  1. package/dist/call-diagnostic/call-diagnostic-metrics-latencies.js +49 -0
  2. package/dist/call-diagnostic/call-diagnostic-metrics-latencies.js.map +1 -1
  3. package/dist/call-diagnostic/call-diagnostic-metrics.js +301 -81
  4. package/dist/call-diagnostic/call-diagnostic-metrics.js.map +1 -1
  5. package/dist/call-diagnostic/call-diagnostic-metrics.util.js +6 -0
  6. package/dist/call-diagnostic/call-diagnostic-metrics.util.js.map +1 -1
  7. package/dist/call-diagnostic/config.js +32 -3
  8. package/dist/call-diagnostic/config.js.map +1 -1
  9. package/dist/index.js.map +1 -1
  10. package/dist/metrics.js +1 -1
  11. package/dist/metrics.types.js.map +1 -1
  12. package/dist/new-metrics.js +58 -5
  13. package/dist/new-metrics.js.map +1 -1
  14. package/dist/types/call-diagnostic/call-diagnostic-metrics-latencies.d.ts +15 -0
  15. package/dist/types/call-diagnostic/call-diagnostic-metrics.d.ts +154 -24
  16. package/dist/types/call-diagnostic/config.d.ts +14 -0
  17. package/dist/types/index.d.ts +2 -2
  18. package/dist/types/metrics.types.d.ts +28 -7
  19. package/dist/types/new-metrics.d.ts +28 -4
  20. package/package.json +12 -12
  21. package/src/call-diagnostic/call-diagnostic-metrics-latencies.ts +58 -0
  22. package/src/call-diagnostic/call-diagnostic-metrics.ts +294 -66
  23. package/src/call-diagnostic/call-diagnostic-metrics.util.ts +6 -0
  24. package/src/call-diagnostic/config.ts +31 -0
  25. package/src/index.ts +4 -0
  26. package/src/metrics.types.ts +36 -6
  27. package/src/new-metrics.ts +73 -5
  28. package/test/unit/spec/call-diagnostic/call-diagnostic-metrics-batcher.ts +20 -1
  29. package/test/unit/spec/call-diagnostic/call-diagnostic-metrics-latencies.ts +167 -0
  30. package/test/unit/spec/call-diagnostic/call-diagnostic-metrics.ts +1054 -153
  31. package/test/unit/spec/call-diagnostic/call-diagnostic-metrics.util.ts +6 -0
  32. package/test/unit/spec/new-metrics.ts +94 -5
  33. package/test/unit/spec/prelogin-metrics-batcher.ts +1 -0
  34. package/dist/call-diagnostic-events-batcher.js +0 -59
  35. package/dist/call-diagnostic-events-batcher.js.map +0 -1
@@ -13,8 +13,12 @@ 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';
16
+ import {glob} from 'glob';
17
+ import {expect} from 'chai';
18
+ import {
19
+ ClientEmailInput,
20
+ ClientUserNameInput,
21
+ } from '@webex/internal-plugin-metrics/src/metrics.types';
18
22
 
19
23
  //@ts-ignore
20
24
  global.window = {location: {hostname: 'whatever'}};
@@ -60,10 +64,26 @@ describe('internal-plugin-metrics', () => {
60
64
  sessionCorrelationId: 'sessionCorrelationId3',
61
65
  };
62
66
 
67
+ const fakeMeeting4 = {
68
+ ...fakeMeeting,
69
+ id: '4',
70
+ isoLocalClientMeetingJoinTime: 'testTimeString',
71
+ };
72
+ const fakeMeeting5 = {
73
+ ...fakeMeeting,
74
+ id: '5',
75
+ correlationId: 'correlationId5',
76
+ sessionCorrelationId: 'sessionCorrelationId5',
77
+ userNameInput: 'test',
78
+ emailInput: 'test@test.com',
79
+ };
80
+
63
81
  const fakeMeetings = {
64
82
  1: fakeMeeting,
65
83
  2: fakeMeeting2,
66
84
  3: fakeMeeting3,
85
+ 4: fakeMeeting4,
86
+ 5: fakeMeeting5,
67
87
  };
68
88
 
69
89
  let webex;
@@ -165,7 +185,7 @@ describe('internal-plugin-metrics', () => {
165
185
  publicNetworkPrefix: '1.1.1.1',
166
186
  localNetworkPrefix: '1.1.1.1',
167
187
  os: getOSNameInternal(),
168
- osVersion: getOSVersion(),
188
+ osVersion: getOSVersion() || 'unknown',
169
189
  subClientType: 'WEB_APP',
170
190
  },
171
191
  environment: 'meeting_evn',
@@ -198,7 +218,7 @@ describe('internal-plugin-metrics', () => {
198
218
  publicNetworkPrefix: '1.1.1.1',
199
219
  localNetworkPrefix: '1.1.1.1',
200
220
  os: getOSNameInternal(),
201
- osVersion: getOSVersion(),
221
+ osVersion: getOSVersion() || 'unknown',
202
222
  subClientType: 'WEB_APP',
203
223
  clientLaunchMethod: 'url-handler',
204
224
  },
@@ -233,7 +253,7 @@ describe('internal-plugin-metrics', () => {
233
253
  publicNetworkPrefix: '1.1.1.1',
234
254
  localNetworkPrefix: '1.1.1.1',
235
255
  os: getOSNameInternal(),
236
- osVersion: getOSVersion(),
256
+ osVersion: getOSVersion() || 'unknown',
237
257
  subClientType: 'WEB_APP',
238
258
  clientLaunchMethod: 'url-handler',
239
259
  },
@@ -268,7 +288,7 @@ describe('internal-plugin-metrics', () => {
268
288
  publicNetworkPrefix: '1.1.1.1',
269
289
  localNetworkPrefix: '1.1.1.1',
270
290
  os: getOSNameInternal(),
271
- osVersion: getOSVersion(),
291
+ osVersion: getOSVersion() || 'unknown',
272
292
  subClientType: 'WEB_APP',
273
293
  clientLaunchMethod: 'url-handler',
274
294
  browserLaunchMethod: 'thinclient',
@@ -296,7 +316,7 @@ describe('internal-plugin-metrics', () => {
296
316
  publicNetworkPrefix: '1.1.1.1',
297
317
  localNetworkPrefix: '1.1.1.1',
298
318
  os: getOSNameInternal(),
299
- osVersion: getOSVersion(),
319
+ osVersion: getOSVersion() || 'unknown',
300
320
  subClientType: 'WEB_APP',
301
321
  },
302
322
  name: 'endpoint',
@@ -325,7 +345,7 @@ describe('internal-plugin-metrics', () => {
325
345
  majorVersion: 43,
326
346
  minorVersion: 9,
327
347
  os: getOSNameInternal(),
328
- osVersion: getOSVersion(),
348
+ osVersion: getOSVersion() || 'unknown',
329
349
  subClientType: 'WEB_APP',
330
350
  },
331
351
  environment: 'meeting_evn',
@@ -348,7 +368,7 @@ describe('internal-plugin-metrics', () => {
348
368
  publicNetworkPrefix: '1.3.4.0',
349
369
  localNetworkPrefix: undefined,
350
370
  os: getOSNameInternal(),
351
- osVersion: getOSVersion(),
371
+ osVersion: getOSVersion() || 'unknown',
352
372
  subClientType: 'WEB_APP',
353
373
  },
354
374
  name: 'endpoint',
@@ -806,6 +826,7 @@ describe('internal-plugin-metrics', () => {
806
826
  meetingId: fakeMeeting.id,
807
827
  mediaConnections: [{mediaAgentAlias: 'alias', mediaAgentGroupId: '1'}],
808
828
  };
829
+ cd.setMercuryConnectedStatus(true);
809
830
 
810
831
  cd.submitClientEvent({
811
832
  name: 'client.alert.displayed',
@@ -827,6 +848,7 @@ describe('internal-plugin-metrics', () => {
827
848
  canProceed: true,
828
849
  eventData: {
829
850
  webClientDomain: 'whatever',
851
+ isMercuryConnected: true,
830
852
  },
831
853
  identifiers: {
832
854
  correlationId: 'correlationId',
@@ -853,6 +875,7 @@ describe('internal-plugin-metrics', () => {
853
875
  canProceed: true,
854
876
  eventData: {
855
877
  webClientDomain: 'whatever',
878
+ isMercuryConnected: true,
856
879
  },
857
880
  identifiers: {
858
881
  correlationId: 'correlationId',
@@ -890,6 +913,7 @@ describe('internal-plugin-metrics', () => {
890
913
  canProceed: true,
891
914
  eventData: {
892
915
  webClientDomain: 'whatever',
916
+ isMercuryConnected: true,
893
917
  },
894
918
  identifiers: {
895
919
  correlationId: 'correlationId',
@@ -930,7 +954,7 @@ describe('internal-plugin-metrics', () => {
930
954
  ]);
931
955
  });
932
956
 
933
- it('should submit client event successfully with meetingId which has a sessionCorrelationId', () => {
957
+ it('should submit client event correctly when mercury is not connected', () => {
934
958
  const prepareDiagnosticEventSpy = sinon.spy(cd, 'prepareDiagnosticEvent');
935
959
  const submitToCallDiagnosticsSpy = sinon.spy(cd, 'submitToCallDiagnostics');
936
960
  const generateClientEventErrorPayloadSpy = sinon.spy(cd, 'generateClientEventErrorPayload');
@@ -939,10 +963,10 @@ describe('internal-plugin-metrics', () => {
939
963
  sinon.stub(cd, 'getOrigin').returns({origin: 'fake-origin'});
940
964
  const validatorSpy = sinon.spy(cd, 'validator');
941
965
  const options = {
942
- meetingId: fakeMeeting3.id,
966
+ meetingId: fakeMeeting.id,
943
967
  mediaConnections: [{mediaAgentAlias: 'alias', mediaAgentGroupId: '1'}],
944
968
  };
945
-
969
+ cd.setMercuryConnectedStatus(false);
946
970
  cd.submitClientEvent({
947
971
  name: 'client.alert.displayed',
948
972
  options,
@@ -950,11 +974,11 @@ describe('internal-plugin-metrics', () => {
950
974
 
951
975
  assert.called(getIdentifiersSpy);
952
976
  assert.calledWith(getIdentifiersSpy, {
953
- meeting: {...fakeMeeting3, sessionCorrelationId: 'sessionCorrelationId3'},
977
+ meeting: fakeMeeting,
954
978
  mediaConnections: [{mediaAgentAlias: 'alias', mediaAgentGroupId: '1'}],
955
979
  webexConferenceIdStr: undefined,
956
- globalMeetingId: undefined,
957
980
  sessionCorrelationId: undefined,
981
+ globalMeetingId: undefined,
958
982
  });
959
983
  assert.notCalled(generateClientEventErrorPayloadSpy);
960
984
  assert.calledWith(
@@ -963,10 +987,10 @@ describe('internal-plugin-metrics', () => {
963
987
  canProceed: true,
964
988
  eventData: {
965
989
  webClientDomain: 'whatever',
990
+ isMercuryConnected: false,
966
991
  },
967
992
  identifiers: {
968
- correlationId: 'correlationId3',
969
- sessionCorrelationId: 'sessionCorrelationId3',
993
+ correlationId: 'correlationId',
970
994
  deviceId: 'deviceUrl',
971
995
  locusId: 'url',
972
996
  locusStartTime: 'lastActive',
@@ -990,10 +1014,10 @@ describe('internal-plugin-metrics', () => {
990
1014
  canProceed: true,
991
1015
  eventData: {
992
1016
  webClientDomain: 'whatever',
1017
+ isMercuryConnected: false,
993
1018
  },
994
1019
  identifiers: {
995
- correlationId: 'correlationId3',
996
- sessionCorrelationId: 'sessionCorrelationId3',
1020
+ correlationId: 'correlationId',
997
1021
  deviceId: 'deviceUrl',
998
1022
  locusId: 'url',
999
1023
  locusStartTime: 'lastActive',
@@ -1028,10 +1052,10 @@ describe('internal-plugin-metrics', () => {
1028
1052
  canProceed: true,
1029
1053
  eventData: {
1030
1054
  webClientDomain: 'whatever',
1055
+ isMercuryConnected: false,
1031
1056
  },
1032
1057
  identifiers: {
1033
- correlationId: 'correlationId3',
1034
- sessionCorrelationId: 'sessionCorrelationId3',
1058
+ correlationId: 'correlationId',
1035
1059
  deviceId: 'deviceUrl',
1036
1060
  locusId: 'url',
1037
1061
  locusStartTime: 'lastActive',
@@ -1069,147 +1093,673 @@ describe('internal-plugin-metrics', () => {
1069
1093
  ]);
1070
1094
  });
1071
1095
 
1072
- it('should log browser data, but only for the first call diagnostic event', () => {
1096
+ it('should submit client event successfully with meetingId which has a sessionCorrelationId', () => {
1073
1097
  const prepareDiagnosticEventSpy = sinon.spy(cd, 'prepareDiagnosticEvent');
1074
1098
  const submitToCallDiagnosticsSpy = sinon.spy(cd, 'submitToCallDiagnostics');
1075
1099
  const generateClientEventErrorPayloadSpy = sinon.spy(cd, 'generateClientEventErrorPayload');
1076
1100
  const getIdentifiersSpy = sinon.spy(cd, 'getIdentifiers');
1077
1101
  const getSubServiceTypeSpy = sinon.spy(cd, 'getSubServiceType');
1102
+ sinon.stub(cd, 'getOrigin').returns({origin: 'fake-origin'});
1078
1103
  const validatorSpy = sinon.spy(cd, 'validator');
1079
- sinon.stub(window.navigator, 'userAgent').get(() => userAgent);
1080
- sinon.stub(bowser, 'getParser').returns(userAgent);
1081
-
1082
1104
  const options = {
1083
- meetingId: fakeMeeting.id,
1105
+ meetingId: fakeMeeting3.id,
1084
1106
  mediaConnections: [{mediaAgentAlias: 'alias', mediaAgentGroupId: '1'}],
1085
1107
  };
1086
-
1108
+ cd.setMercuryConnectedStatus(true);
1087
1109
  cd.submitClientEvent({
1088
1110
  name: 'client.alert.displayed',
1089
1111
  options,
1090
1112
  });
1091
1113
 
1092
- cd.submitClientEvent({
1093
- name: 'client.alert.displayed',
1094
- options,
1114
+ assert.called(getIdentifiersSpy);
1115
+ assert.calledWith(getIdentifiersSpy, {
1116
+ meeting: {...fakeMeeting3, sessionCorrelationId: 'sessionCorrelationId3'},
1117
+ mediaConnections: [{mediaAgentAlias: 'alias', mediaAgentGroupId: '1'}],
1118
+ webexConferenceIdStr: undefined,
1119
+ globalMeetingId: undefined,
1120
+ sessionCorrelationId: undefined,
1121
+ });
1122
+ assert.notCalled(generateClientEventErrorPayloadSpy);
1123
+ assert.calledWith(
1124
+ prepareDiagnosticEventSpy,
1125
+ {
1126
+ canProceed: true,
1127
+ eventData: {
1128
+ webClientDomain: 'whatever',
1129
+ isMercuryConnected: true,
1130
+ },
1131
+ identifiers: {
1132
+ correlationId: 'correlationId3',
1133
+ sessionCorrelationId: 'sessionCorrelationId3',
1134
+ deviceId: 'deviceUrl',
1135
+ locusId: 'url',
1136
+ locusStartTime: 'lastActive',
1137
+ locusUrl: 'locus/url',
1138
+ mediaAgentAlias: 'alias',
1139
+ mediaAgentGroupId: '1',
1140
+ orgId: 'orgId',
1141
+ userId: 'userId',
1142
+ },
1143
+ loginType: 'login-ci',
1144
+ name: 'client.alert.displayed',
1145
+ userType: 'host',
1146
+ isConvergedArchitectureEnabled: undefined,
1147
+ webexSubServiceType: undefined,
1148
+ webClientPreload: undefined,
1149
+ },
1150
+ options
1151
+ );
1152
+ assert.calledWith(submitToCallDiagnosticsSpy, {
1153
+ event: {
1154
+ canProceed: true,
1155
+ eventData: {
1156
+ webClientDomain: 'whatever',
1157
+ isMercuryConnected: true,
1158
+ },
1159
+ identifiers: {
1160
+ correlationId: 'correlationId3',
1161
+ sessionCorrelationId: 'sessionCorrelationId3',
1162
+ deviceId: 'deviceUrl',
1163
+ locusId: 'url',
1164
+ locusStartTime: 'lastActive',
1165
+ locusUrl: 'locus/url',
1166
+ mediaAgentAlias: 'alias',
1167
+ mediaAgentGroupId: '1',
1168
+ orgId: 'orgId',
1169
+ userId: 'userId',
1170
+ },
1171
+ loginType: 'login-ci',
1172
+ name: 'client.alert.displayed',
1173
+ userType: 'host',
1174
+ isConvergedArchitectureEnabled: undefined,
1175
+ webexSubServiceType: undefined,
1176
+ webClientPreload: undefined,
1177
+ },
1178
+ eventId: 'my-fake-id',
1179
+ origin: {
1180
+ origin: 'fake-origin',
1181
+ },
1182
+ originTime: {
1183
+ sent: 'not_defined_yet',
1184
+ triggered: now.toISOString(),
1185
+ },
1186
+ senderCountryCode: 'UK',
1187
+ version: 1,
1188
+ });
1189
+ assert.calledWith(validatorSpy, {
1190
+ type: 'ce',
1191
+ event: {
1192
+ event: {
1193
+ canProceed: true,
1194
+ eventData: {
1195
+ webClientDomain: 'whatever',
1196
+ isMercuryConnected: true,
1197
+ },
1198
+ identifiers: {
1199
+ correlationId: 'correlationId3',
1200
+ sessionCorrelationId: 'sessionCorrelationId3',
1201
+ deviceId: 'deviceUrl',
1202
+ locusId: 'url',
1203
+ locusStartTime: 'lastActive',
1204
+ locusUrl: 'locus/url',
1205
+ mediaAgentAlias: 'alias',
1206
+ mediaAgentGroupId: '1',
1207
+ orgId: 'orgId',
1208
+ userId: 'userId',
1209
+ },
1210
+ loginType: 'login-ci',
1211
+ name: 'client.alert.displayed',
1212
+ userType: 'host',
1213
+ isConvergedArchitectureEnabled: undefined,
1214
+ webexSubServiceType: undefined,
1215
+ webClientPreload: undefined,
1216
+ },
1217
+ eventId: 'my-fake-id',
1218
+ origin: {
1219
+ origin: 'fake-origin',
1220
+ },
1221
+ originTime: {
1222
+ sent: 'not_defined_yet',
1223
+ triggered: now.toISOString(),
1224
+ },
1225
+ senderCountryCode: 'UK',
1226
+ version: 1,
1227
+ },
1095
1228
  });
1096
1229
 
1097
1230
  const webexLoggerLogCalls = webex.logger.log.getCalls();
1098
-
1099
- assert.deepEqual(webexLoggerLogCalls.length, 4);
1100
-
1101
1231
  assert.deepEqual(webexLoggerLogCalls[1].args, [
1102
1232
  'call-diagnostic-events -> ',
1103
1233
  'CallDiagnosticMetrics: @submitClientEvent. Submit Client Event CA event.',
1104
1234
  `name: client.alert.displayed`,
1105
1235
  ]);
1106
-
1107
- assert.deepEqual(webexLoggerLogCalls[2].args, [
1108
- 'call-diagnostic-events -> ',
1109
- 'CallDiagnosticMetrics: @createClientEventObjectInMeeting => collected browser data',
1110
- `${JSON.stringify(userAgent)}`,
1111
- ]);
1112
-
1113
- assert.deepEqual(webexLoggerLogCalls[3].args, [
1114
- 'call-diagnostic-events -> ',
1115
- 'CallDiagnosticMetrics: @submitClientEvent. Submit Client Event CA event.',
1116
- `name: client.alert.displayed`,
1117
- ]);
1118
1236
  });
1119
1237
 
1120
- it('should submit client event successfully with correlationId, webexConferenceIdStr, sessionCorrelationId, and globalMeetingId', () => {
1238
+ it('should submit client event successfully with meetingId which has a meetingJoinedTime', () => {
1121
1239
  const prepareDiagnosticEventSpy = sinon.spy(cd, 'prepareDiagnosticEvent');
1122
1240
  const submitToCallDiagnosticsSpy = sinon.spy(cd, 'submitToCallDiagnostics');
1123
1241
  const generateClientEventErrorPayloadSpy = sinon.spy(cd, 'generateClientEventErrorPayload');
1124
1242
  const getIdentifiersSpy = sinon.spy(cd, 'getIdentifiers');
1125
1243
  sinon.stub(cd, 'getOrigin').returns({origin: 'fake-origin'});
1126
-
1244
+ const validatorSpy = sinon.spy(cd, 'validator');
1127
1245
  const options = {
1128
- correlationId: 'correlationId',
1129
- webexConferenceIdStr: 'webexConferenceIdStr1',
1130
- globalMeetingId: 'globalMeetingId1',
1131
- sessionCorrelationId: 'sessionCorrelationId1',
1246
+ meetingId: fakeMeeting4.id,
1247
+ mediaConnections: [{mediaAgentAlias: 'alias', mediaAgentGroupId: '1'}],
1132
1248
  };
1133
-
1249
+ cd.setMercuryConnectedStatus(true);
1134
1250
  cd.submitClientEvent({
1135
1251
  name: 'client.alert.displayed',
1136
1252
  options,
1137
1253
  });
1138
1254
 
1255
+ assert.called(getIdentifiersSpy);
1139
1256
  assert.calledWith(getIdentifiersSpy, {
1140
- correlationId: 'correlationId',
1141
- webexConferenceIdStr: 'webexConferenceIdStr1',
1142
- globalMeetingId: 'globalMeetingId1',
1143
- sessionCorrelationId: 'sessionCorrelationId1',
1144
- preLoginId: undefined,
1257
+ meeting: {...fakeMeeting4},
1258
+ mediaConnections: [{mediaAgentAlias: 'alias', mediaAgentGroupId: '1'}],
1259
+ webexConferenceIdStr: undefined,
1260
+ globalMeetingId: undefined,
1261
+ sessionCorrelationId: undefined,
1145
1262
  });
1146
-
1147
1263
  assert.notCalled(generateClientEventErrorPayloadSpy);
1148
1264
  assert.calledWith(
1149
1265
  prepareDiagnosticEventSpy,
1150
1266
  {
1267
+ meetingJoinedTime: fakeMeeting4.isoLocalClientMeetingJoinTime,
1151
1268
  canProceed: true,
1152
1269
  eventData: {
1153
1270
  webClientDomain: 'whatever',
1271
+ isMercuryConnected: true,
1154
1272
  },
1155
1273
  identifiers: {
1156
1274
  correlationId: 'correlationId',
1157
- webexConferenceIdStr: 'webexConferenceIdStr1',
1158
- sessionCorrelationId: 'sessionCorrelationId1',
1159
- globalMeetingId: 'globalMeetingId1',
1160
1275
  deviceId: 'deviceUrl',
1161
- locusUrl: 'locus-url',
1276
+ locusId: 'url',
1277
+ locusStartTime: 'lastActive',
1278
+ locusUrl: 'locus/url',
1279
+ mediaAgentAlias: 'alias',
1280
+ mediaAgentGroupId: '1',
1281
+ orgId: 'orgId',
1282
+ userId: 'userId',
1283
+ },
1284
+ loginType: 'login-ci',
1285
+ webClientPreload: undefined,
1286
+ name: 'client.alert.displayed',
1287
+ userType: 'host',
1288
+ isConvergedArchitectureEnabled: undefined,
1289
+ webexSubServiceType: undefined,
1290
+ },
1291
+ options
1292
+ );
1293
+ assert.calledWith(submitToCallDiagnosticsSpy, {
1294
+ event: {
1295
+ meetingJoinedTime: fakeMeeting4.isoLocalClientMeetingJoinTime,
1296
+ canProceed: true,
1297
+ eventData: {
1298
+ webClientDomain: 'whatever',
1299
+ isMercuryConnected: true,
1300
+ },
1301
+ identifiers: {
1302
+ correlationId: 'correlationId',
1303
+ deviceId: 'deviceUrl',
1304
+ locusId: 'url',
1305
+ locusStartTime: 'lastActive',
1306
+ locusUrl: 'locus/url',
1307
+ mediaAgentAlias: 'alias',
1308
+ mediaAgentGroupId: '1',
1162
1309
  orgId: 'orgId',
1163
1310
  userId: 'userId',
1164
1311
  },
1165
- loginType: 'login-ci',
1166
- name: 'client.alert.displayed',
1167
- webClientPreload: undefined
1312
+ loginType: 'login-ci',
1313
+ webClientPreload: undefined,
1314
+ name: 'client.alert.displayed',
1315
+ userType: 'host',
1316
+ isConvergedArchitectureEnabled: undefined,
1317
+ webexSubServiceType: undefined,
1318
+ },
1319
+ eventId: 'my-fake-id',
1320
+ origin: {
1321
+ origin: 'fake-origin',
1322
+ },
1323
+ originTime: {
1324
+ sent: 'not_defined_yet',
1325
+ triggered: now.toISOString(),
1326
+ },
1327
+ senderCountryCode: 'UK',
1328
+ version: 1,
1329
+ });
1330
+ assert.calledWith(validatorSpy, {
1331
+ type: 'ce',
1332
+ event: {
1333
+ event: {
1334
+ meetingJoinedTime: fakeMeeting4.isoLocalClientMeetingJoinTime,
1335
+ canProceed: true,
1336
+ eventData: {
1337
+ webClientDomain: 'whatever',
1338
+ isMercuryConnected: true,
1339
+ },
1340
+ identifiers: {
1341
+ correlationId: 'correlationId',
1342
+ deviceId: 'deviceUrl',
1343
+ locusId: 'url',
1344
+ locusStartTime: 'lastActive',
1345
+ locusUrl: 'locus/url',
1346
+ mediaAgentAlias: 'alias',
1347
+ mediaAgentGroupId: '1',
1348
+ orgId: 'orgId',
1349
+ userId: 'userId',
1350
+ },
1351
+ loginType: 'login-ci',
1352
+ webClientPreload: undefined,
1353
+ name: 'client.alert.displayed',
1354
+ userType: 'host',
1355
+ isConvergedArchitectureEnabled: undefined,
1356
+ webexSubServiceType: undefined,
1357
+ },
1358
+ eventId: 'my-fake-id',
1359
+ origin: {
1360
+ origin: 'fake-origin',
1361
+ },
1362
+ originTime: {
1363
+ sent: 'not_defined_yet',
1364
+ triggered: now.toISOString(),
1365
+ },
1366
+ senderCountryCode: 'UK',
1367
+ version: 1,
1368
+ },
1369
+ });
1370
+
1371
+ const webexLoggerLogCalls = webex.logger.log.getCalls();
1372
+ assert.deepEqual(webexLoggerLogCalls[1].args, [
1373
+ 'call-diagnostic-events -> ',
1374
+ 'CallDiagnosticMetrics: @submitClientEvent. Submit Client Event CA event.',
1375
+ `name: client.alert.displayed`,
1376
+ ]);
1377
+ });
1378
+
1379
+ it('should submit client event successfully with meetingId which has emailInput and userNameInput', () => {
1380
+ const prepareDiagnosticEventSpy = sinon.spy(cd, 'prepareDiagnosticEvent');
1381
+ const submitToCallDiagnosticsSpy = sinon.spy(cd, 'submitToCallDiagnostics');
1382
+ const generateClientEventErrorPayloadSpy = sinon.spy(cd, 'generateClientEventErrorPayload');
1383
+ const getIdentifiersSpy = sinon.spy(cd, 'getIdentifiers');
1384
+ sinon.stub(cd, 'getOrigin').returns({origin: 'fake-origin'});
1385
+ const validatorSpy = sinon.spy(cd, 'validator');
1386
+ const options = {
1387
+ meetingId: fakeMeeting5.id,
1388
+ mediaConnections: [{mediaAgentAlias: 'alias', mediaAgentGroupId: '1'}],
1389
+ };
1390
+ cd.setMercuryConnectedStatus(true);
1391
+ cd.submitClientEvent({
1392
+ name: 'client.alert.displayed',
1393
+ options,
1394
+ });
1395
+
1396
+ assert.called(getIdentifiersSpy);
1397
+ assert.calledWith(getIdentifiersSpy, {
1398
+ meeting: {...fakeMeeting5, sessionCorrelationId: 'sessionCorrelationId5'},
1399
+ mediaConnections: [{mediaAgentAlias: 'alias', mediaAgentGroupId: '1'}],
1400
+ webexConferenceIdStr: undefined,
1401
+ globalMeetingId: undefined,
1402
+ sessionCorrelationId: undefined,
1403
+ });
1404
+ assert.notCalled(generateClientEventErrorPayloadSpy);
1405
+ assert.calledWith(
1406
+ prepareDiagnosticEventSpy,
1407
+ {
1408
+ canProceed: true,
1409
+ eventData: {
1410
+ webClientDomain: 'whatever',
1411
+ isMercuryConnected: true,
1412
+ },
1413
+ identifiers: {
1414
+ correlationId: 'correlationId5',
1415
+ sessionCorrelationId: 'sessionCorrelationId5',
1416
+ deviceId: 'deviceUrl',
1417
+ locusId: 'url',
1418
+ locusStartTime: 'lastActive',
1419
+ locusUrl: 'locus/url',
1420
+ mediaAgentAlias: 'alias',
1421
+ mediaAgentGroupId: '1',
1422
+ orgId: 'orgId',
1423
+ userId: 'userId',
1424
+ },
1425
+ loginType: 'login-ci',
1426
+ name: 'client.alert.displayed',
1427
+ userType: 'host',
1428
+ userNameInput: 'test',
1429
+ emailInput: 'test@test.com',
1430
+ isConvergedArchitectureEnabled: undefined,
1431
+ webexSubServiceType: undefined,
1432
+ webClientPreload: undefined,
1433
+ },
1434
+ options
1435
+ );
1436
+ assert.calledWith(submitToCallDiagnosticsSpy, {
1437
+ event: {
1438
+ canProceed: true,
1439
+ eventData: {
1440
+ webClientDomain: 'whatever',
1441
+ isMercuryConnected: true,
1442
+ },
1443
+ identifiers: {
1444
+ correlationId: 'correlationId5',
1445
+ sessionCorrelationId: 'sessionCorrelationId5',
1446
+ deviceId: 'deviceUrl',
1447
+ locusId: 'url',
1448
+ locusStartTime: 'lastActive',
1449
+ locusUrl: 'locus/url',
1450
+ mediaAgentAlias: 'alias',
1451
+ mediaAgentGroupId: '1',
1452
+ orgId: 'orgId',
1453
+ userId: 'userId',
1454
+ },
1455
+ loginType: 'login-ci',
1456
+ name: 'client.alert.displayed',
1457
+ userType: 'host',
1458
+ userNameInput: 'test',
1459
+ emailInput: 'test@test.com',
1460
+ isConvergedArchitectureEnabled: undefined,
1461
+ webexSubServiceType: undefined,
1462
+ webClientPreload: undefined,
1463
+ },
1464
+ eventId: 'my-fake-id',
1465
+ origin: {
1466
+ origin: 'fake-origin',
1467
+ },
1468
+ originTime: {
1469
+ sent: 'not_defined_yet',
1470
+ triggered: now.toISOString(),
1471
+ },
1472
+ senderCountryCode: 'UK',
1473
+ version: 1,
1474
+ });
1475
+ assert.calledWith(validatorSpy, {
1476
+ type: 'ce',
1477
+ event: {
1478
+ event: {
1479
+ canProceed: true,
1480
+ eventData: {
1481
+ webClientDomain: 'whatever',
1482
+ isMercuryConnected: true,
1483
+ },
1484
+ identifiers: {
1485
+ correlationId: 'correlationId5',
1486
+ sessionCorrelationId: 'sessionCorrelationId5',
1487
+ deviceId: 'deviceUrl',
1488
+ locusId: 'url',
1489
+ locusStartTime: 'lastActive',
1490
+ locusUrl: 'locus/url',
1491
+ mediaAgentAlias: 'alias',
1492
+ mediaAgentGroupId: '1',
1493
+ orgId: 'orgId',
1494
+ userId: 'userId',
1495
+ },
1496
+ loginType: 'login-ci',
1497
+ name: 'client.alert.displayed',
1498
+ userType: 'host',
1499
+ userNameInput: 'test',
1500
+ emailInput: 'test@test.com',
1501
+ isConvergedArchitectureEnabled: undefined,
1502
+ webexSubServiceType: undefined,
1503
+ webClientPreload: undefined,
1504
+ },
1505
+ eventId: 'my-fake-id',
1506
+ origin: {
1507
+ origin: 'fake-origin',
1508
+ },
1509
+ originTime: {
1510
+ sent: 'not_defined_yet',
1511
+ triggered: now.toISOString(),
1512
+ },
1513
+ senderCountryCode: 'UK',
1514
+ version: 1,
1515
+ },
1516
+ });
1517
+
1518
+ const webexLoggerLogCalls = webex.logger.log.getCalls();
1519
+ assert.deepEqual(webexLoggerLogCalls[1].args, [
1520
+ 'call-diagnostic-events -> ',
1521
+ 'CallDiagnosticMetrics: @submitClientEvent. Submit Client Event CA event.',
1522
+ `name: client.alert.displayed`,
1523
+ ]);
1524
+ });
1525
+
1526
+ it('should log browser data, but only for the first call diagnostic event', () => {
1527
+ const prepareDiagnosticEventSpy = sinon.spy(cd, 'prepareDiagnosticEvent');
1528
+ const submitToCallDiagnosticsSpy = sinon.spy(cd, 'submitToCallDiagnostics');
1529
+ const generateClientEventErrorPayloadSpy = sinon.spy(cd, 'generateClientEventErrorPayload');
1530
+ const getIdentifiersSpy = sinon.spy(cd, 'getIdentifiers');
1531
+ const getSubServiceTypeSpy = sinon.spy(cd, 'getSubServiceType');
1532
+ const validatorSpy = sinon.spy(cd, 'validator');
1533
+
1534
+ Object.defineProperty(global, 'navigator', {
1535
+ value: {
1536
+ userAgent,
1537
+ },
1538
+ configurable: true,
1539
+ });
1540
+
1541
+ sinon.stub(bowser, 'getParser').returns(userAgent);
1542
+
1543
+ const options = {
1544
+ meetingId: fakeMeeting.id,
1545
+ mediaConnections: [{mediaAgentAlias: 'alias', mediaAgentGroupId: '1'}],
1546
+ };
1547
+
1548
+ cd.submitClientEvent({
1549
+ name: 'client.alert.displayed',
1550
+ options,
1551
+ });
1552
+
1553
+ cd.submitClientEvent({
1554
+ name: 'client.alert.displayed',
1555
+ options,
1556
+ });
1557
+
1558
+ const webexLoggerLogCalls = webex.logger.log.getCalls();
1559
+
1560
+ assert.deepEqual(webexLoggerLogCalls.length, 4);
1561
+
1562
+ assert.deepEqual(webexLoggerLogCalls[1].args, [
1563
+ 'call-diagnostic-events -> ',
1564
+ 'CallDiagnosticMetrics: @submitClientEvent. Submit Client Event CA event.',
1565
+ `name: client.alert.displayed`,
1566
+ ]);
1567
+
1568
+ assert.deepEqual(webexLoggerLogCalls[2].args, [
1569
+ 'call-diagnostic-events -> ',
1570
+ 'CallDiagnosticMetrics: @createClientEventObjectInMeeting => collected browser data',
1571
+ `${JSON.stringify(userAgent)}`,
1572
+ ]);
1573
+
1574
+ assert.deepEqual(webexLoggerLogCalls[3].args, [
1575
+ 'call-diagnostic-events -> ',
1576
+ 'CallDiagnosticMetrics: @submitClientEvent. Submit Client Event CA event.',
1577
+ `name: client.alert.displayed`,
1578
+ ]);
1579
+ });
1580
+
1581
+ it('should submit client event successfully with correlationId, webexConferenceIdStr, sessionCorrelationId, and globalMeetingId', () => {
1582
+ const prepareDiagnosticEventSpy = sinon.spy(cd, 'prepareDiagnosticEvent');
1583
+ const submitToCallDiagnosticsSpy = sinon.spy(cd, 'submitToCallDiagnostics');
1584
+ const generateClientEventErrorPayloadSpy = sinon.spy(cd, 'generateClientEventErrorPayload');
1585
+ const getIdentifiersSpy = sinon.spy(cd, 'getIdentifiers');
1586
+ sinon.stub(cd, 'getOrigin').returns({origin: 'fake-origin'});
1587
+
1588
+ const options = {
1589
+ correlationId: 'correlationId',
1590
+ webexConferenceIdStr: 'webexConferenceIdStr1',
1591
+ globalMeetingId: 'globalMeetingId1',
1592
+ sessionCorrelationId: 'sessionCorrelationId1',
1593
+ };
1594
+ cd.setMercuryConnectedStatus(true);
1595
+ cd.submitClientEvent({
1596
+ name: 'client.alert.displayed',
1597
+ options,
1598
+ });
1599
+
1600
+ assert.calledWith(getIdentifiersSpy, {
1601
+ correlationId: 'correlationId',
1602
+ webexConferenceIdStr: 'webexConferenceIdStr1',
1603
+ globalMeetingId: 'globalMeetingId1',
1604
+ sessionCorrelationId: 'sessionCorrelationId1',
1605
+ preLoginId: undefined,
1606
+ });
1607
+
1608
+ assert.notCalled(generateClientEventErrorPayloadSpy);
1609
+ assert.calledWith(
1610
+ prepareDiagnosticEventSpy,
1611
+ {
1612
+ canProceed: true,
1613
+ eventData: {
1614
+ webClientDomain: 'whatever',
1615
+ isMercuryConnected: true,
1616
+ },
1617
+ identifiers: {
1618
+ correlationId: 'correlationId',
1619
+ webexConferenceIdStr: 'webexConferenceIdStr1',
1620
+ sessionCorrelationId: 'sessionCorrelationId1',
1621
+ globalMeetingId: 'globalMeetingId1',
1622
+ deviceId: 'deviceUrl',
1623
+ locusUrl: 'locus-url',
1624
+ orgId: 'orgId',
1625
+ userId: 'userId',
1626
+ },
1627
+ loginType: 'login-ci',
1628
+ name: 'client.alert.displayed',
1629
+ webClientPreload: undefined,
1630
+ },
1631
+ options
1632
+ );
1633
+ assert.calledWith(submitToCallDiagnosticsSpy, {
1634
+ event: {
1635
+ canProceed: true,
1636
+ eventData: {
1637
+ webClientDomain: 'whatever',
1638
+ isMercuryConnected: true,
1639
+ },
1640
+ identifiers: {
1641
+ correlationId: 'correlationId',
1642
+ webexConferenceIdStr: 'webexConferenceIdStr1',
1643
+ sessionCorrelationId: 'sessionCorrelationId1',
1644
+ globalMeetingId: 'globalMeetingId1',
1645
+ deviceId: 'deviceUrl',
1646
+ locusUrl: 'locus-url',
1647
+ orgId: 'orgId',
1648
+ userId: 'userId',
1649
+ },
1650
+ loginType: 'login-ci',
1651
+ name: 'client.alert.displayed',
1652
+ webClientPreload: undefined,
1653
+ },
1654
+ eventId: 'my-fake-id',
1655
+ origin: {
1656
+ origin: 'fake-origin',
1657
+ },
1658
+ originTime: {
1659
+ sent: 'not_defined_yet',
1660
+ triggered: now.toISOString(),
1661
+ },
1662
+ senderCountryCode: 'UK',
1663
+ version: 1,
1664
+ });
1665
+
1666
+ const webexLoggerLogCalls = webex.logger.log.getCalls();
1667
+
1668
+ assert.deepEqual(webexLoggerLogCalls[1].args, [
1669
+ 'call-diagnostic-events -> ',
1670
+ 'CallDiagnosticMetrics: @submitClientEvent. Submit Client Event CA event.',
1671
+ `name: client.alert.displayed`,
1672
+ ]);
1673
+ });
1674
+
1675
+ it('should submit client event successfully with preLoginId', () => {
1676
+ cd.device.userId = undefined;
1677
+
1678
+ const prepareDiagnosticEventSpy = sinon.spy(cd, 'prepareDiagnosticEvent');
1679
+ const submitToCallDiagnosticsPreLoginSpy = sinon.spy(cd, 'submitToCallDiagnosticsPreLogin');
1680
+ const submitToCallDiagnosticsSpy = sinon.spy(cd, 'submitToCallDiagnostics');
1681
+ const generateClientEventErrorPayloadSpy = sinon.spy(cd, 'generateClientEventErrorPayload');
1682
+ const getIdentifiersSpy = sinon.spy(cd, 'getIdentifiers');
1683
+ sinon.stub(cd, 'getOrigin').returns({origin: 'fake-origin'});
1684
+ cd.setMercuryConnectedStatus(true);
1685
+ const options = {
1686
+ correlationId: 'correlationId',
1687
+ webexConferenceIdStr: 'webexConferenceIdStr1',
1688
+ globalMeetingId: 'globalMeetingId1',
1689
+ preLoginId: 'myPreLoginId',
1690
+ sessionCorrelationId: 'sessionCorrelationId1',
1691
+ };
1692
+
1693
+ cd.submitClientEvent({
1694
+ name: 'client.alert.displayed',
1695
+ options,
1696
+ });
1697
+
1698
+ assert.calledWith(getIdentifiersSpy, {
1699
+ correlationId: 'correlationId',
1700
+ webexConferenceIdStr: 'webexConferenceIdStr1',
1701
+ globalMeetingId: 'globalMeetingId1',
1702
+ preLoginId: 'myPreLoginId',
1703
+ sessionCorrelationId: 'sessionCorrelationId1',
1704
+ });
1705
+
1706
+ assert.notCalled(generateClientEventErrorPayloadSpy);
1707
+ assert.calledWith(
1708
+ prepareDiagnosticEventSpy,
1709
+ {
1710
+ canProceed: true,
1711
+ eventData: {
1712
+ webClientDomain: 'whatever',
1713
+ isMercuryConnected: true,
1714
+ },
1715
+ identifiers: {
1716
+ correlationId: 'correlationId',
1717
+ sessionCorrelationId: 'sessionCorrelationId1',
1718
+ webexConferenceIdStr: 'webexConferenceIdStr1',
1719
+ globalMeetingId: 'globalMeetingId1',
1720
+ deviceId: 'deviceUrl',
1721
+ locusUrl: 'locus-url',
1722
+ orgId: 'orgId',
1723
+ userId: 'myPreLoginId',
1724
+ },
1725
+ loginType: 'login-ci',
1726
+ name: 'client.alert.displayed',
1727
+ webClientPreload: undefined,
1728
+ },
1729
+ options
1730
+ );
1731
+ assert.notCalled(submitToCallDiagnosticsSpy);
1732
+ assert.calledWith(
1733
+ submitToCallDiagnosticsPreLoginSpy,
1734
+ {
1735
+ eventId: 'my-fake-id',
1736
+ version: 1,
1737
+ origin: {origin: 'fake-origin'},
1738
+ originTime: {triggered: now.toISOString(), sent: 'not_defined_yet'},
1739
+ senderCountryCode: 'UK',
1740
+ event: {
1741
+ name: 'client.alert.displayed',
1742
+ canProceed: true,
1743
+ identifiers: {
1744
+ correlationId: 'correlationId',
1745
+ sessionCorrelationId: 'sessionCorrelationId1',
1746
+ userId: 'myPreLoginId',
1747
+ deviceId: 'deviceUrl',
1748
+ orgId: 'orgId',
1749
+ locusUrl: 'locus-url',
1750
+ webexConferenceIdStr: 'webexConferenceIdStr1',
1751
+ globalMeetingId: 'globalMeetingId1',
1752
+ },
1753
+ eventData: {webClientDomain: 'whatever', isMercuryConnected: true},
1754
+ loginType: 'login-ci',
1755
+ webClientPreload: undefined,
1756
+ },
1168
1757
  },
1169
- options
1758
+ options.preLoginId
1170
1759
  );
1171
- assert.calledWith(submitToCallDiagnosticsSpy, {
1172
- event: {
1173
- canProceed: true,
1174
- eventData: {
1175
- webClientDomain: 'whatever',
1176
- },
1177
- identifiers: {
1178
- correlationId: 'correlationId',
1179
- webexConferenceIdStr: 'webexConferenceIdStr1',
1180
- sessionCorrelationId: 'sessionCorrelationId1',
1181
- globalMeetingId: 'globalMeetingId1',
1182
- deviceId: 'deviceUrl',
1183
- locusUrl: 'locus-url',
1184
- orgId: 'orgId',
1185
- userId: 'userId',
1186
- },
1187
- loginType: 'login-ci',
1188
- name: 'client.alert.displayed',
1189
- webClientPreload: undefined
1190
- },
1191
- eventId: 'my-fake-id',
1192
- origin: {
1193
- origin: 'fake-origin',
1194
- },
1195
- originTime: {
1196
- sent: 'not_defined_yet',
1197
- triggered: now.toISOString(),
1198
- },
1199
- senderCountryCode: 'UK',
1200
- version: 1,
1201
- });
1202
-
1203
- const webexLoggerLogCalls = webex.logger.log.getCalls();
1204
-
1205
- assert.deepEqual(webexLoggerLogCalls[1].args, [
1206
- 'call-diagnostic-events -> ',
1207
- 'CallDiagnosticMetrics: @submitClientEvent. Submit Client Event CA event.',
1208
- `name: client.alert.displayed`,
1209
- ]);
1210
1760
  });
1211
1761
 
1212
- it('should submit client event successfully with preLoginId', () => {
1762
+ it('should submit client event successfully with emailInput and userNameInput as options', () => {
1213
1763
  cd.device.userId = undefined;
1214
1764
 
1215
1765
  const prepareDiagnosticEventSpy = sinon.spy(cd, 'prepareDiagnosticEvent');
@@ -1218,13 +1768,15 @@ describe('internal-plugin-metrics', () => {
1218
1768
  const generateClientEventErrorPayloadSpy = sinon.spy(cd, 'generateClientEventErrorPayload');
1219
1769
  const getIdentifiersSpy = sinon.spy(cd, 'getIdentifiers');
1220
1770
  sinon.stub(cd, 'getOrigin').returns({origin: 'fake-origin'});
1221
-
1771
+ cd.setMercuryConnectedStatus(true);
1222
1772
  const options = {
1223
1773
  correlationId: 'correlationId',
1224
1774
  webexConferenceIdStr: 'webexConferenceIdStr1',
1225
1775
  globalMeetingId: 'globalMeetingId1',
1226
1776
  preLoginId: 'myPreLoginId',
1227
1777
  sessionCorrelationId: 'sessionCorrelationId1',
1778
+ userNameInput: 'current' as ClientUserNameInput,
1779
+ emailInput: 'current' as ClientEmailInput,
1228
1780
  };
1229
1781
 
1230
1782
  cd.submitClientEvent({
@@ -1247,6 +1799,7 @@ describe('internal-plugin-metrics', () => {
1247
1799
  canProceed: true,
1248
1800
  eventData: {
1249
1801
  webClientDomain: 'whatever',
1802
+ isMercuryConnected: true,
1250
1803
  },
1251
1804
  identifiers: {
1252
1805
  correlationId: 'correlationId',
@@ -1258,6 +1811,8 @@ describe('internal-plugin-metrics', () => {
1258
1811
  orgId: 'orgId',
1259
1812
  userId: 'myPreLoginId',
1260
1813
  },
1814
+ userNameInput: 'current',
1815
+ emailInput: 'current',
1261
1816
  loginType: 'login-ci',
1262
1817
  name: 'client.alert.displayed',
1263
1818
  webClientPreload: undefined,
@@ -1286,8 +1841,10 @@ describe('internal-plugin-metrics', () => {
1286
1841
  webexConferenceIdStr: 'webexConferenceIdStr1',
1287
1842
  globalMeetingId: 'globalMeetingId1',
1288
1843
  },
1289
- eventData: {webClientDomain: 'whatever'},
1844
+ eventData: {webClientDomain: 'whatever', isMercuryConnected: true},
1290
1845
  loginType: 'login-ci',
1846
+ userNameInput: 'current',
1847
+ emailInput: 'current',
1291
1848
  webClientPreload: undefined,
1292
1849
  },
1293
1850
  },
@@ -1302,7 +1859,7 @@ describe('internal-plugin-metrics', () => {
1302
1859
  meetingId: fakeMeeting2.id,
1303
1860
  mediaConnections: [{mediaAgentAlias: 'alias', mediaAgentGroupId: '1'}],
1304
1861
  };
1305
-
1862
+ cd.setMercuryConnectedStatus(true);
1306
1863
  cd.submitClientEvent({
1307
1864
  name: 'client.alert.displayed',
1308
1865
  options,
@@ -1313,6 +1870,7 @@ describe('internal-plugin-metrics', () => {
1313
1870
  canProceed: true,
1314
1871
  eventData: {
1315
1872
  webClientDomain: 'whatever',
1873
+ isMercuryConnected: true,
1316
1874
  },
1317
1875
  identifiers: {
1318
1876
  correlationId: 'correlationId2',
@@ -1354,7 +1912,7 @@ describe('internal-plugin-metrics', () => {
1354
1912
  mediaConnections: [{mediaAgentAlias: 'alias', mediaAgentGroupId: '1'}],
1355
1913
  sessionCorrelationId: 'sessionCorrelationId1',
1356
1914
  };
1357
-
1915
+ cd.setMercuryConnectedStatus(true);
1358
1916
  cd.submitClientEvent({
1359
1917
  name: 'client.alert.displayed',
1360
1918
  options,
@@ -1365,6 +1923,7 @@ describe('internal-plugin-metrics', () => {
1365
1923
  canProceed: true,
1366
1924
  eventData: {
1367
1925
  webClientDomain: 'whatever',
1926
+ isMercuryConnected: true,
1368
1927
  },
1369
1928
  identifiers: {
1370
1929
  correlationId: 'correlationId2',
@@ -1413,7 +1972,7 @@ describe('internal-plugin-metrics', () => {
1413
1972
  globalMeetingId: 'globalMeetingId1',
1414
1973
  sessionCorrelationId: 'sessionCorrelationId1',
1415
1974
  };
1416
-
1975
+ cd.setMercuryConnectedStatus(true);
1417
1976
  cd.submitClientEvent({
1418
1977
  name: 'client.alert.displayed',
1419
1978
  options,
@@ -1426,6 +1985,7 @@ describe('internal-plugin-metrics', () => {
1426
1985
  canProceed: true,
1427
1986
  eventData: {
1428
1987
  webClientDomain: 'whatever',
1988
+ isMercuryConnected: true,
1429
1989
  },
1430
1990
  identifiers: {
1431
1991
  correlationId: 'correlationId',
@@ -1448,6 +2008,7 @@ describe('internal-plugin-metrics', () => {
1448
2008
  canProceed: true,
1449
2009
  eventData: {
1450
2010
  webClientDomain: 'whatever',
2011
+ isMercuryConnected: true,
1451
2012
  },
1452
2013
  identifiers: {
1453
2014
  correlationId: 'correlationId',
@@ -1491,7 +2052,7 @@ describe('internal-plugin-metrics', () => {
1491
2052
  },
1492
2053
  },
1493
2054
  };
1494
-
2055
+ cd.setMercuryConnectedStatus(true);
1495
2056
  cd.submitClientEvent({
1496
2057
  name: 'client.alert.displayed',
1497
2058
  options,
@@ -1502,6 +2063,7 @@ describe('internal-plugin-metrics', () => {
1502
2063
  canProceed: true,
1503
2064
  eventData: {
1504
2065
  webClientDomain: 'whatever',
2066
+ isMercuryConnected: true,
1505
2067
  },
1506
2068
  identifiers: {
1507
2069
  correlationId: 'correlationId',
@@ -1557,7 +2119,7 @@ describe('internal-plugin-metrics', () => {
1557
2119
  assert.deepEqual(webexLoggerLogCalls[2].args, [
1558
2120
  'call-diagnostic-events -> ',
1559
2121
  'CallDiagnosticMetrics: @prepareClientEvent. Generated errors:',
1560
- `generatedError: {"fatal":true,"shownToUser":false,"name":"other","category":"expected","errorCode":4029,"serviceErrorCode":2409005,"errorDescription":"StartRecordingFailed"}`,
2122
+ `generatedError (cached: false): {"fatal":true,"shownToUser":false,"name":"other","category":"expected","errorCode":4029,"serviceErrorCode":2409005,"errorDescription":"StartRecordingFailed"}`,
1561
2123
  ]);
1562
2124
  });
1563
2125
 
@@ -1570,7 +2132,7 @@ describe('internal-plugin-metrics', () => {
1570
2132
  mediaConnections: [{mediaAgentAlias: 'alias', mediaAgentGroupId: '1'}],
1571
2133
  rawError: new Error('bad times'),
1572
2134
  };
1573
-
2135
+ cd.setMercuryConnectedStatus(true);
1574
2136
  cd.submitClientEvent({
1575
2137
  name: 'client.alert.displayed',
1576
2138
  options,
@@ -1581,6 +2143,7 @@ describe('internal-plugin-metrics', () => {
1581
2143
  canProceed: true,
1582
2144
  eventData: {
1583
2145
  webClientDomain: 'whatever',
2146
+ isMercuryConnected: true,
1584
2147
  },
1585
2148
  identifiers: {
1586
2149
  correlationId: 'correlationId',
@@ -1637,7 +2200,7 @@ describe('internal-plugin-metrics', () => {
1637
2200
  assert.deepEqual(webexLoggerLogCalls[2].args, [
1638
2201
  'call-diagnostic-events -> ',
1639
2202
  'CallDiagnosticMetrics: @prepareClientEvent. Generated errors:',
1640
- `generatedError: {"fatal":true,"shownToUser":false,"name":"other","category":"other","errorCode":9999,"errorData":{"errorName":"Error"},"serviceErrorCode":9999,"rawErrorMessage":"bad times","errorDescription":"UnknownError"}`,
2203
+ `generatedError (cached: false): {"fatal":true,"shownToUser":false,"name":"other","category":"other","errorCode":9999,"errorData":{"errorName":"Error"},"serviceErrorCode":9999,"rawErrorMessage":"bad times","errorDescription":"UnknownError"}`,
1641
2204
  ]);
1642
2205
  });
1643
2206
 
@@ -1649,7 +2212,7 @@ describe('internal-plugin-metrics', () => {
1649
2212
  correlationId: 'correlationId',
1650
2213
  rawError: new Error('bad times'),
1651
2214
  };
1652
-
2215
+ cd.setMercuryConnectedStatus(true);
1653
2216
  cd.submitClientEvent({
1654
2217
  name: 'client.alert.displayed',
1655
2218
  options,
@@ -1660,6 +2223,7 @@ describe('internal-plugin-metrics', () => {
1660
2223
  canProceed: true,
1661
2224
  eventData: {
1662
2225
  webClientDomain: 'whatever',
2226
+ isMercuryConnected: true,
1663
2227
  },
1664
2228
  identifiers: {
1665
2229
  correlationId: 'correlationId',
@@ -1710,7 +2274,7 @@ describe('internal-plugin-metrics', () => {
1710
2274
  assert.deepEqual(webexLoggerLogCalls[2].args, [
1711
2275
  'call-diagnostic-events -> ',
1712
2276
  'CallDiagnosticMetrics: @prepareClientEvent. Generated errors:',
1713
- `generatedError: {"fatal":true,"shownToUser":false,"name":"other","category":"other","errorCode":9999,"errorData":{"errorName":"Error"},"serviceErrorCode":9999,"rawErrorMessage":"bad times","errorDescription":"UnknownError"}`,
2277
+ `generatedError (cached: false): {"fatal":true,"shownToUser":false,"name":"other","category":"other","errorCode":9999,"errorData":{"errorName":"Error"},"serviceErrorCode":9999,"rawErrorMessage":"bad times","errorDescription":"UnknownError"}`,
1714
2278
  ]);
1715
2279
  });
1716
2280
 
@@ -1726,7 +2290,7 @@ describe('internal-plugin-metrics', () => {
1726
2290
  },
1727
2291
  },
1728
2292
  };
1729
-
2293
+ cd.setMercuryConnectedStatus(true);
1730
2294
  cd.submitClientEvent({
1731
2295
  name: 'client.alert.displayed',
1732
2296
  options,
@@ -1737,6 +2301,7 @@ describe('internal-plugin-metrics', () => {
1737
2301
  canProceed: true,
1738
2302
  eventData: {
1739
2303
  webClientDomain: 'whatever',
2304
+ isMercuryConnected: true,
1740
2305
  },
1741
2306
  identifiers: {
1742
2307
  correlationId: 'correlationId',
@@ -1784,7 +2349,7 @@ describe('internal-plugin-metrics', () => {
1784
2349
  assert.deepEqual(webexLoggerLogCalls[2].args, [
1785
2350
  'call-diagnostic-events -> ',
1786
2351
  'CallDiagnosticMetrics: @prepareClientEvent. Generated errors:',
1787
- `generatedError: {"fatal":true,"shownToUser":false,"name":"other","category":"expected","errorCode":4029,"serviceErrorCode":2409005,"errorDescription":"StartRecordingFailed"}`,
2352
+ `generatedError (cached: false): {"fatal":true,"shownToUser":false,"name":"other","category":"expected","errorCode":4029,"serviceErrorCode":2409005,"errorDescription":"StartRecordingFailed"}`,
1788
2353
  ]);
1789
2354
  });
1790
2355
 
@@ -1796,7 +2361,7 @@ describe('internal-plugin-metrics', () => {
1796
2361
  meetingId: fakeMeeting.id,
1797
2362
  mediaConnections: [{mediaAgentAlias: 'alias', mediaAgentGroupId: '1'}],
1798
2363
  };
1799
-
2364
+ cd.setMercuryConnectedStatus(true);
1800
2365
  cd.submitClientEvent({
1801
2366
  name: 'client.alert.displayed',
1802
2367
  payload: {
@@ -1817,6 +2382,7 @@ describe('internal-plugin-metrics', () => {
1817
2382
  canProceed: true,
1818
2383
  eventData: {
1819
2384
  webClientDomain: 'whatever',
2385
+ isMercuryConnected: true,
1820
2386
  },
1821
2387
  identifiers: {
1822
2388
  correlationId: 'correlationId',
@@ -1973,7 +2539,7 @@ describe('internal-plugin-metrics', () => {
1973
2539
  applicationSoftwareType: 'webex-js-sdk',
1974
2540
  applicationSoftwareVersion: 'webex-version',
1975
2541
  mediaEngineSoftwareType: 'browser',
1976
- mediaEngineSoftwareVersion: getOSVersion(),
2542
+ mediaEngineSoftwareVersion: getOSVersion() || 'unknown',
1977
2543
  startTime: now.toISOString(),
1978
2544
  },
1979
2545
  },
@@ -2012,7 +2578,7 @@ describe('internal-plugin-metrics', () => {
2012
2578
  applicationSoftwareType: 'webex-js-sdk',
2013
2579
  applicationSoftwareVersion: 'webex-version',
2014
2580
  mediaEngineSoftwareType: 'browser',
2015
- mediaEngineSoftwareVersion: getOSVersion(),
2581
+ mediaEngineSoftwareVersion: getOSVersion() || 'unknown',
2016
2582
  startTime: now.toISOString(),
2017
2583
  },
2018
2584
  },
@@ -2049,7 +2615,7 @@ describe('internal-plugin-metrics', () => {
2049
2615
  applicationSoftwareType: 'webex-js-sdk',
2050
2616
  applicationSoftwareVersion: 'webex-version',
2051
2617
  mediaEngineSoftwareType: 'browser',
2052
- mediaEngineSoftwareVersion: getOSVersion(),
2618
+ mediaEngineSoftwareVersion: getOSVersion() || 'unknown',
2053
2619
  startTime: now.toISOString(),
2054
2620
  },
2055
2621
  },
@@ -2164,8 +2730,37 @@ describe('internal-plugin-metrics', () => {
2164
2730
  rawErrorMessage: 'bad times',
2165
2731
  };
2166
2732
 
2733
+ it('should be cached if called twice with the same payload', () => {
2734
+ const error = new Error('bad times');
2735
+ const expectedPayload = {
2736
+ category: 'other',
2737
+ errorCode: 9999,
2738
+ errorData: {errorName: 'Error'},
2739
+ serviceErrorCode: 9999,
2740
+ fatal: true,
2741
+ shownToUser: false,
2742
+ name: 'other',
2743
+ rawErrorMessage: 'bad times',
2744
+ errorDescription: 'UnknownError',
2745
+ };
2746
+
2747
+ const [res, cached] = cd.generateClientEventErrorPayload(error);
2748
+ assert.isFalse(cached);
2749
+ assert.deepEqual(res, expectedPayload);
2750
+
2751
+ const [res2, cached2] = cd.generateClientEventErrorPayload(error);
2752
+ assert.isTrue(cached2);
2753
+ assert.deepEqual(res2, expectedPayload);
2754
+
2755
+ // after clearing the cache, it should be false again
2756
+ cd.clearErrorCache();
2757
+ const [res3, cached3] = cd.generateClientEventErrorPayload(error);
2758
+ assert.isFalse(cached3);
2759
+ assert.deepEqual(res3, expectedPayload);
2760
+ });
2761
+
2167
2762
  const checkNameError = (payload: any, isExpectedToBeCalled: boolean) => {
2168
- const res = cd.generateClientEventErrorPayload(payload);
2763
+ const [res, cached] = cd.generateClientEventErrorPayload(payload);
2169
2764
  const expectedResult = {
2170
2765
  category: 'expected',
2171
2766
  errorDescription: 'CameraPermissionDenied',
@@ -2194,7 +2789,7 @@ describe('internal-plugin-metrics', () => {
2194
2789
  });
2195
2790
 
2196
2791
  const checkCodeError = (payload: any, expetedRes: any) => {
2197
- const res = cd.generateClientEventErrorPayload(payload);
2792
+ const [res, cached] = cd.generateClientEventErrorPayload(payload);
2198
2793
  assert.deepEqual(res, expetedRes);
2199
2794
  };
2200
2795
  it('should generate event error payload correctly', () => {
@@ -2220,7 +2815,7 @@ describe('internal-plugin-metrics', () => {
2220
2815
  });
2221
2816
 
2222
2817
  const checkLocusError = (payload: any, isExpectedToBeCalled: boolean) => {
2223
- const res = cd.generateClientEventErrorPayload(payload);
2818
+ const [res, cached] = cd.generateClientEventErrorPayload(payload);
2224
2819
  const expectedResult = {
2225
2820
  category: 'signaling',
2226
2821
  errorDescription: 'NewLocusError',
@@ -2248,7 +2843,7 @@ describe('internal-plugin-metrics', () => {
2248
2843
  });
2249
2844
 
2250
2845
  const checkMeetingInfoError = (payload: any, isExpectedToBeCalled: boolean) => {
2251
- const res = cd.generateClientEventErrorPayload(payload);
2846
+ const [res, cached] = cd.generateClientEventErrorPayload(payload);
2252
2847
  const expectedResult = {
2253
2848
  category: 'signaling',
2254
2849
  errorDescription: 'MeetingInfoLookupError',
@@ -2289,7 +2884,7 @@ describe('internal-plugin-metrics', () => {
2289
2884
  });
2290
2885
 
2291
2886
  it('should return NetworkError code for a NetworkOrCORSERror', () => {
2292
- const res = cd.generateClientEventErrorPayload(
2887
+ const [res, cached] = cd.generateClientEventErrorPayload(
2293
2888
  new WebexHttpError.NetworkOrCORSError({
2294
2889
  url: 'https://example.com',
2295
2890
  statusCode: 0,
@@ -2333,7 +2928,7 @@ describe('internal-plugin-metrics', () => {
2333
2928
  message: 'No codecs present in m-line with MID 0 after filtering.',
2334
2929
  },
2335
2930
  };
2336
- const res = cd.generateClientEventErrorPayload(error);
2931
+ const [res, cached] = cd.generateClientEventErrorPayload(error);
2337
2932
  assert.deepEqual(res, {
2338
2933
  category: 'expected',
2339
2934
  errorCode: 2051,
@@ -2359,7 +2954,7 @@ describe('internal-plugin-metrics', () => {
2359
2954
  message: 'empty local SDP',
2360
2955
  },
2361
2956
  };
2362
- const res = cd.generateClientEventErrorPayload(error);
2957
+ const [res, cached] = cd.generateClientEventErrorPayload(error);
2363
2958
  assert.deepEqual(res, {
2364
2959
  category: 'media',
2365
2960
  errorCode: 2050,
@@ -2384,7 +2979,7 @@ describe('internal-plugin-metrics', () => {
2384
2979
  category: 'expected',
2385
2980
  };
2386
2981
 
2387
- const res = cd.generateClientEventErrorPayload(error);
2982
+ const [res, cached] = cd.generateClientEventErrorPayload(error);
2388
2983
  assert.deepEqual(res, {
2389
2984
  category: 'expected',
2390
2985
  errorDescription: 'UnknownError',
@@ -2413,7 +3008,7 @@ describe('internal-plugin-metrics', () => {
2413
3008
  category: 'expected',
2414
3009
  };
2415
3010
 
2416
- const res = cd.generateClientEventErrorPayload(error);
3011
+ const [res, cached] = cd.generateClientEventErrorPayload(error);
2417
3012
  assert.deepEqual(res, {
2418
3013
  category: 'expected',
2419
3014
  errorDescription: 'NetworkError',
@@ -2428,7 +3023,7 @@ describe('internal-plugin-metrics', () => {
2428
3023
  });
2429
3024
 
2430
3025
  it('should return AuthenticationFailed code for an Unauthorized error', () => {
2431
- const res = cd.generateClientEventErrorPayload(
3026
+ const [res, cached] = cd.generateClientEventErrorPayload(
2432
3027
  new WebexHttpError.Unauthorized({
2433
3028
  url: 'https://example.com',
2434
3029
  statusCode: 0,
@@ -2461,7 +3056,7 @@ describe('internal-plugin-metrics', () => {
2461
3056
  category: 'expected',
2462
3057
  };
2463
3058
 
2464
- const res = cd.generateClientEventErrorPayload(error);
3059
+ const [res, cached] = cd.generateClientEventErrorPayload(error);
2465
3060
  assert.deepEqual(res, {
2466
3061
  category: 'expected',
2467
3062
  errorDescription: 'AuthenticationFailed',
@@ -2476,7 +3071,10 @@ describe('internal-plugin-metrics', () => {
2476
3071
  });
2477
3072
 
2478
3073
  it('should return unknown error otherwise', () => {
2479
- const res = cd.generateClientEventErrorPayload({something: 'new', message: 'bad times'});
3074
+ const [res, cached] = cd.generateClientEventErrorPayload({
3075
+ something: 'new',
3076
+ message: 'bad times',
3077
+ });
2480
3078
  assert.deepEqual(res, {
2481
3079
  category: 'other',
2482
3080
  errorDescription: 'UnknownError',
@@ -2490,7 +3088,7 @@ describe('internal-plugin-metrics', () => {
2490
3088
  });
2491
3089
 
2492
3090
  it('should generate event error payload correctly for locus error 2423012', () => {
2493
- const res = cd.generateClientEventErrorPayload({
3091
+ const [res, cached] = cd.generateClientEventErrorPayload({
2494
3092
  body: {errorCode: 2423012},
2495
3093
  message: 'bad times',
2496
3094
  });
@@ -2506,7 +3104,7 @@ describe('internal-plugin-metrics', () => {
2506
3104
  });
2507
3105
  });
2508
3106
  it('should generate event error payload correctly for locus error 2409062', () => {
2509
- const res = cd.generateClientEventErrorPayload({
3107
+ const [res, cached] = cd.generateClientEventErrorPayload({
2510
3108
  body: {errorCode: 2409062},
2511
3109
  message: 'bad times',
2512
3110
  });
@@ -2523,7 +3121,7 @@ describe('internal-plugin-metrics', () => {
2523
3121
  });
2524
3122
 
2525
3123
  it('should generate event error payload correctly for locus error 2423021', () => {
2526
- const res = cd.generateClientEventErrorPayload({
3124
+ const [res, cached] = cd.generateClientEventErrorPayload({
2527
3125
  body: {errorCode: 2423021},
2528
3126
  message: 'bad times',
2529
3127
  });
@@ -2540,7 +3138,7 @@ describe('internal-plugin-metrics', () => {
2540
3138
  });
2541
3139
 
2542
3140
  it('should generate event error payload correctly for wdm error 4404002', () => {
2543
- const res = cd.generateClientEventErrorPayload({
3141
+ const [res, cached] = cd.generateClientEventErrorPayload({
2544
3142
  body: {errorCode: 4404002},
2545
3143
  message: 'Operation denied due to region restriction',
2546
3144
  });
@@ -2557,7 +3155,7 @@ describe('internal-plugin-metrics', () => {
2557
3155
  });
2558
3156
 
2559
3157
  it('should generate event error payload correctly for wdm error 4404003', () => {
2560
- const res = cd.generateClientEventErrorPayload({
3158
+ const [res, cached] = cd.generateClientEventErrorPayload({
2561
3159
  body: {errorCode: 4404003},
2562
3160
  message: 'Operation denied due to region restriction',
2563
3161
  });
@@ -2575,7 +3173,7 @@ describe('internal-plugin-metrics', () => {
2575
3173
 
2576
3174
  describe('httpStatusCode', () => {
2577
3175
  it('should include httpStatusCode for browser media errors', () => {
2578
- const res = cd.generateClientEventErrorPayload({
3176
+ const [res, cached] = cd.generateClientEventErrorPayload({
2579
3177
  name: 'PermissionDeniedError',
2580
3178
  message: 'bad times',
2581
3179
  statusCode: 401,
@@ -2597,7 +3195,7 @@ describe('internal-plugin-metrics', () => {
2597
3195
  });
2598
3196
 
2599
3197
  it('should include httpStatusCode for SdpOfferCreationErrors', () => {
2600
- const res = cd.generateClientEventErrorPayload({
3198
+ const [res, cached] = cd.generateClientEventErrorPayload({
2601
3199
  name: 'SdpOfferCreationError',
2602
3200
  message: 'bad times',
2603
3201
  statusCode: 404,
@@ -2619,7 +3217,7 @@ describe('internal-plugin-metrics', () => {
2619
3217
  });
2620
3218
 
2621
3219
  it('should include httpStatusCode for service error codes', () => {
2622
- const res = cd.generateClientEventErrorPayload({
3220
+ const [res, cached] = cd.generateClientEventErrorPayload({
2623
3221
  body: {errorCode: 58400},
2624
3222
  message: 'bad times',
2625
3223
  statusCode: 400,
@@ -2638,7 +3236,7 @@ describe('internal-plugin-metrics', () => {
2638
3236
  });
2639
3237
 
2640
3238
  it('should include httpStatusCode for locus service error codes', () => {
2641
- const res = cd.generateClientEventErrorPayload({
3239
+ const [res, cached] = cd.generateClientEventErrorPayload({
2642
3240
  body: {errorCode: 2403001},
2643
3241
  message: 'bad times',
2644
3242
  statusCode: 400,
@@ -2657,7 +3255,7 @@ describe('internal-plugin-metrics', () => {
2657
3255
  });
2658
3256
 
2659
3257
  it('should include httpStatusCode for meetingInfo service error codes', () => {
2660
- const res = cd.generateClientEventErrorPayload({
3258
+ const [res, cached] = cd.generateClientEventErrorPayload({
2661
3259
  body: {data: {meetingInfo: {}}},
2662
3260
  message: 'bad times',
2663
3261
  statusCode: 400,
@@ -2680,7 +3278,7 @@ describe('internal-plugin-metrics', () => {
2680
3278
  statusCode: 400,
2681
3279
  options: {service: '', headers: {}},
2682
3280
  });
2683
- const res = cd.generateClientEventErrorPayload(error);
3281
+ const [res, cached] = cd.generateClientEventErrorPayload(error);
2684
3282
  assert.deepEqual(res, {
2685
3283
  category: 'network',
2686
3284
  errorCode: 1026,
@@ -2699,7 +3297,7 @@ describe('internal-plugin-metrics', () => {
2699
3297
  statusCode: 401,
2700
3298
  options: {service: '', headers: {}},
2701
3299
  });
2702
- const res = cd.generateClientEventErrorPayload(error);
3300
+ const [res, cached] = cd.generateClientEventErrorPayload(error);
2703
3301
  assert.deepEqual(res, {
2704
3302
  category: 'network',
2705
3303
  errorCode: 1010,
@@ -2714,7 +3312,7 @@ describe('internal-plugin-metrics', () => {
2714
3312
  });
2715
3313
 
2716
3314
  it('should include httpStatusCode for unknown errors', () => {
2717
- const res = cd.generateClientEventErrorPayload({
3315
+ const [res, cached] = cd.generateClientEventErrorPayload({
2718
3316
  message: 'bad times',
2719
3317
  statusCode: 404,
2720
3318
  });
@@ -2763,22 +3361,32 @@ describe('internal-plugin-metrics', () => {
2763
3361
  assert.deepEqual(cd.getSubServiceType(fakeMeeting), 'ScheduledMeeting');
2764
3362
  });
2765
3363
 
2766
- it('returns subServicetype as Webinar when meeting is Webinar', () => {
3364
+ it('returns subServicetype as Webinar when meeting is non-converged Webinar', () => {
2767
3365
  fakeMeeting.meetingInfo = {
2768
3366
  webexScheduled: true,
2769
3367
  pmr: false,
3368
+ enableEvent: true,
3369
+ enableConvergedArchitecture: false,
3370
+ };
3371
+ assert.deepEqual(cd.getSubServiceType(fakeMeeting), 'Webinar');
3372
+ });
3373
+
3374
+ it('returns subServicetype as Webinar when meeting is converged Webinar', () => {
3375
+ fakeMeeting.meetingInfo = {
2770
3376
  enableEvent: true,
2771
3377
  isConvergedWebinar: true,
3378
+ isConvergedWebinarWebcast: false,
3379
+ enableConvergedArchitecture: true,
2772
3380
  };
2773
3381
  assert.deepEqual(cd.getSubServiceType(fakeMeeting), 'Webinar');
2774
3382
  });
2775
3383
 
2776
- it('returns subServicetype as Webcast when meeting is Webinar and enable webcast', () => {
3384
+ it('returns subServicetype as Webcast when meeting is converged Webinar and enable webcast', () => {
2777
3385
  fakeMeeting.meetingInfo = {
2778
- webexScheduled: true,
2779
- pmr: false,
2780
3386
  enableEvent: true,
3387
+ isConvergedWebinar: false,
2781
3388
  isConvergedWebinarWebcast: true,
3389
+ enableConvergedArchitecture: true,
2782
3390
  };
2783
3391
  assert.deepEqual(cd.getSubServiceType(fakeMeeting), 'Webcast');
2784
3392
  });
@@ -2814,7 +3422,7 @@ describe('internal-plugin-metrics', () => {
2814
3422
  meetingId: fakeMeeting.id,
2815
3423
  preLoginId,
2816
3424
  };
2817
-
3425
+ cd.setMercuryConnectedStatus(true);
2818
3426
  const triggered = new Date();
2819
3427
  const fetchOptions = await cd.buildClientEventFetchRequestOptions({
2820
3428
  name: 'client.exit.app',
@@ -2830,6 +3438,7 @@ describe('internal-plugin-metrics', () => {
2830
3438
  canProceed: false,
2831
3439
  eventData: {
2832
3440
  webClientDomain: 'whatever',
3441
+ isMercuryConnected: true,
2833
3442
  },
2834
3443
  identifiers: {
2835
3444
  correlationId: 'correlationId',
@@ -2857,7 +3466,7 @@ describe('internal-plugin-metrics', () => {
2857
3466
  localNetworkPrefix: '192.168.1.80',
2858
3467
  publicNetworkPrefix: '1.3.4.0',
2859
3468
  os: getOSNameInternal() || 'unknown',
2860
- osVersion: getOSVersion(),
3469
+ osVersion: getOSVersion() || 'unknown',
2861
3470
  subClientType: 'WEB_APP',
2862
3471
  },
2863
3472
  environment: 'meeting_evn',
@@ -3061,6 +3670,7 @@ describe('internal-plugin-metrics', () => {
3061
3670
  const submitToCallDiagnosticsSpy = sinon.spy(cd, 'submitToCallDiagnostics');
3062
3671
 
3063
3672
  const options = {
3673
+ meetingId: 'meetingId',
3064
3674
  correlationId: 'correlationId',
3065
3675
  };
3066
3676
 
@@ -3093,6 +3703,7 @@ describe('internal-plugin-metrics', () => {
3093
3703
  name: 'client.alert.displayed',
3094
3704
  payload: undefined,
3095
3705
  options: {
3706
+ meetingId: 'meetingId',
3096
3707
  correlationId: 'correlationId',
3097
3708
  triggeredTime: now.toISOString(),
3098
3709
  },
@@ -3101,6 +3712,7 @@ describe('internal-plugin-metrics', () => {
3101
3712
  name: 'client.alert.removed',
3102
3713
  payload: undefined,
3103
3714
  options: {
3715
+ meetingId: 'meetingId',
3104
3716
  correlationId: 'correlationId',
3105
3717
  triggeredTime: now.toISOString(),
3106
3718
  },
@@ -3109,6 +3721,7 @@ describe('internal-plugin-metrics', () => {
3109
3721
  name: 'client.call.aborted',
3110
3722
  payload: undefined,
3111
3723
  options: {
3724
+ meetingId: 'meetingId',
3112
3725
  correlationId: 'correlationId',
3113
3726
  triggeredTime: now.toISOString(),
3114
3727
  },
@@ -3120,6 +3733,294 @@ describe('internal-plugin-metrics', () => {
3120
3733
  // should not call submitClientEvent again if delayedClientEvents was cleared
3121
3734
  assert.notCalled(submitClientEventSpy);
3122
3735
  });
3736
+
3737
+ it('calls submitClientEvent for every delayed event with overrides and clears delayedClientEvents array', () => {
3738
+ const submitClientEventSpy = sinon.spy(cd, 'submitClientEvent');
3739
+ const submitToCallDiagnosticsSpy = sinon.spy(cd, 'submitToCallDiagnostics');
3740
+
3741
+ const options = {
3742
+ meetingId: 'meetingId',
3743
+ correlationId: 'correlationId',
3744
+ };
3745
+
3746
+ const overrides = {
3747
+ correlationId: 'newCorrelationId',
3748
+ };
3749
+
3750
+ cd.submitClientEvent({
3751
+ name: 'client.alert.displayed',
3752
+ options,
3753
+ delaySubmitEvent: true,
3754
+ });
3755
+
3756
+ cd.submitClientEvent({
3757
+ name: 'client.alert.removed',
3758
+ options,
3759
+ delaySubmitEvent: true,
3760
+ });
3761
+
3762
+ cd.submitClientEvent({
3763
+ name: 'client.call.aborted',
3764
+ options,
3765
+ delaySubmitEvent: true,
3766
+ });
3767
+
3768
+ assert.notCalled(submitToCallDiagnosticsSpy);
3769
+ assert.calledThrice(submitClientEventSpy);
3770
+ submitClientEventSpy.resetHistory();
3771
+
3772
+ cd.submitDelayedClientEvents(overrides);
3773
+
3774
+ assert.calledThrice(submitClientEventSpy);
3775
+ assert.calledWith(submitClientEventSpy.firstCall, {
3776
+ name: 'client.alert.displayed',
3777
+ payload: undefined,
3778
+ options: {
3779
+ meetingId: 'meetingId',
3780
+ correlationId: 'newCorrelationId',
3781
+ triggeredTime: now.toISOString(),
3782
+ },
3783
+ });
3784
+ assert.calledWith(submitClientEventSpy.secondCall, {
3785
+ name: 'client.alert.removed',
3786
+ payload: undefined,
3787
+ options: {
3788
+ meetingId: 'meetingId',
3789
+ correlationId: 'newCorrelationId',
3790
+ triggeredTime: now.toISOString(),
3791
+ },
3792
+ });
3793
+ assert.calledWith(submitClientEventSpy.thirdCall, {
3794
+ name: 'client.call.aborted',
3795
+ payload: undefined,
3796
+ options: {
3797
+ meetingId: 'meetingId',
3798
+ correlationId: 'newCorrelationId',
3799
+ triggeredTime: now.toISOString(),
3800
+ },
3801
+ });
3802
+ submitClientEventSpy.resetHistory();
3803
+
3804
+ cd.submitDelayedClientEvents();
3805
+
3806
+ // should not call submitClientEvent again if delayedClientEvents was cleared
3807
+ assert.notCalled(submitClientEventSpy);
3808
+ });
3809
+ });
3810
+
3811
+ describe('#submitFeatureEvent', () => {
3812
+ it('should submit feature event successfully with meetingId', () => {
3813
+ const prepareDiagnosticEventSpy = sinon.spy(cd, 'prepareDiagnosticEvent');
3814
+ const submitToCallFeaturesSpy = sinon.spy(cd, 'submitToCallFeatures');
3815
+ sinon.stub(cd, 'getOrigin').returns({origin: 'fake-origin'});
3816
+
3817
+ const options = {
3818
+ meetingId: fakeMeeting.id,
3819
+ };
3820
+ cd.setMercuryConnectedStatus(true);
3821
+
3822
+ cd.submitFeatureEvent({
3823
+ name: 'client.feature.meeting.summary',
3824
+ payload: {
3825
+ meetingSummaryInfo: {
3826
+ featureName: 'syncSystemMuteStatus',
3827
+ featureActions: [{
3828
+ actionName: 'syncMeetingMicUnmuteStatusToSystem',
3829
+ actionId: '14200',
3830
+ isInitialValue: false,
3831
+ clickCount: '1'
3832
+ }]
3833
+ },
3834
+ },
3835
+ options,
3836
+ });
3837
+
3838
+ assert.calledWith(
3839
+ prepareDiagnosticEventSpy,
3840
+ {
3841
+ name: 'client.feature.meeting.summary',
3842
+ canProceed: true,
3843
+ identifiers: {
3844
+ correlationId: 'correlationId',
3845
+ userId: 'userId',
3846
+ deviceId: 'deviceUrl',
3847
+ orgId: 'orgId',
3848
+ locusUrl: 'locus/url',
3849
+ locusId: 'url',
3850
+ locusStartTime: 'lastActive',
3851
+ },
3852
+ eventData: { webClientDomain: 'whatever'},
3853
+ userType: 'host',
3854
+ loginType: 'login-ci',
3855
+ isConvergedArchitectureEnabled: undefined,
3856
+ webexSubServiceType: undefined,
3857
+ webClientPreload: undefined,
3858
+ meetingSummaryInfo: {
3859
+ featureName: 'syncSystemMuteStatus',
3860
+ featureActions: [{
3861
+ actionName: 'syncMeetingMicUnmuteStatusToSystem',
3862
+ actionId: '14200',
3863
+ isInitialValue: false,
3864
+ clickCount: '1'
3865
+ }]
3866
+ },
3867
+ key: "UcfFeatureUsage",
3868
+ },
3869
+ options
3870
+ );
3871
+
3872
+ assert.calledWith(submitToCallFeaturesSpy, {
3873
+ eventId: 'my-fake-id',
3874
+ version: 1,
3875
+ origin: {
3876
+ origin: 'fake-origin',
3877
+ },
3878
+ event: {
3879
+ canProceed: true,
3880
+ eventData: { webClientDomain: 'whatever'},
3881
+ identifiers: {
3882
+ correlationId: 'correlationId',
3883
+ deviceId: 'deviceUrl',
3884
+ locusId: 'url',
3885
+ locusStartTime: 'lastActive',
3886
+ locusUrl: 'locus/url',
3887
+ orgId: 'orgId',
3888
+ userId: 'userId',
3889
+ },
3890
+ loginType: 'login-ci',
3891
+ name: 'client.feature.meeting.summary',
3892
+ userType: 'host',
3893
+ isConvergedArchitectureEnabled: undefined,
3894
+ webexSubServiceType: undefined,
3895
+ webClientPreload: undefined,
3896
+ meetingSummaryInfo: {
3897
+ featureName: 'syncSystemMuteStatus',
3898
+ featureActions: [{
3899
+ actionName: 'syncMeetingMicUnmuteStatusToSystem',
3900
+ actionId: '14200',
3901
+ isInitialValue: false,
3902
+ clickCount: '1'
3903
+ }]
3904
+ },
3905
+ key: "UcfFeatureUsage",
3906
+ },
3907
+ originTime: {
3908
+ sent: 'not_defined_yet',
3909
+ triggered: now.toISOString(),
3910
+ },
3911
+ senderCountryCode: 'UK',
3912
+ });
3913
+
3914
+ const webexLoggerLogCalls = webex.logger.log.getCalls();
3915
+ assert.deepEqual(webexLoggerLogCalls[1].args, [
3916
+ 'call-diagnostic-events-feature -> ',
3917
+ 'CallFeatureMetrics: @submitFeatureEvent. Submit Client Feature Event CA event.',
3918
+ `name: client.feature.meeting.summary`,
3919
+ ]);
3920
+ });
3921
+ });
3922
+
3923
+ describe('#submitDelayedClientFeatureEvents', () => {
3924
+ it('does not call submitFeatureEvent if there were no delayed events', () => {
3925
+ const submitFeatureEventSpy = sinon.spy(cd, 'submitFeatureEvent');
3926
+
3927
+ cd.submitDelayedClientFeatureEvents();
3928
+
3929
+ assert.notCalled(submitFeatureEventSpy);
3930
+ });
3931
+
3932
+ it('calls submitFeatureEvent for every delayed event and clears delayedClientFeatureEvents array', () => {
3933
+ const submitFeatureEventSpy = sinon.spy(cd, 'submitFeatureEvent');
3934
+ const submitToCallFeaturesSpy = sinon.spy(cd, 'submitToCallFeatures');
3935
+
3936
+ const options = {
3937
+ meetingId: 'meetingId',
3938
+ };
3939
+
3940
+ cd.submitFeatureEvent({
3941
+ name: 'client.feature.meeting.summary',
3942
+ options,
3943
+ payload: {
3944
+ meetingSummaryInfo: {
3945
+ featureName: 'syncSystemMuteStatus',
3946
+ featureActions: [{
3947
+ actionName: 'syncMeetingMicUnmuteStatusToSystem',
3948
+ actionId: '14200',
3949
+ isInitialValue: false,
3950
+ clickCount: '1'
3951
+ }]
3952
+ },
3953
+ },
3954
+ delaySubmitEvent: true,
3955
+ });
3956
+
3957
+ cd.submitFeatureEvent({
3958
+ name: 'client.feature.meeting.summary',
3959
+ options,
3960
+ payload: {
3961
+ meetingSummaryInfo: {
3962
+ featureName: 'syncSystemVideoStatus',
3963
+ featureActions: [{
3964
+ actionName: 'syncMeetingVideoUnmuteStatusToSystem',
3965
+ actionId: '13400',
3966
+ isInitialValue: false,
3967
+ clickCount: '1'
3968
+ }]
3969
+ },
3970
+ },
3971
+ delaySubmitEvent: true,
3972
+ });
3973
+
3974
+ assert.notCalled(submitToCallFeaturesSpy);
3975
+ assert.calledTwice(submitFeatureEventSpy);
3976
+ submitFeatureEventSpy.resetHistory();
3977
+
3978
+ cd.submitDelayedClientFeatureEvents();
3979
+
3980
+ assert.calledTwice(submitFeatureEventSpy);
3981
+ assert.calledWith(submitFeatureEventSpy.firstCall, {
3982
+ name: 'client.feature.meeting.summary',
3983
+ payload: {
3984
+ meetingSummaryInfo: {
3985
+ featureName: 'syncSystemMuteStatus',
3986
+ featureActions: [{
3987
+ actionName: 'syncMeetingMicUnmuteStatusToSystem',
3988
+ actionId: '14200',
3989
+ isInitialValue: false,
3990
+ clickCount: '1'
3991
+ }]
3992
+ },
3993
+ },
3994
+ options: {
3995
+ meetingId: 'meetingId',
3996
+ triggeredTime: now.toISOString(),
3997
+ },
3998
+ });
3999
+ assert.calledWith(submitFeatureEventSpy.secondCall, {
4000
+ name: 'client.feature.meeting.summary',
4001
+ payload: {
4002
+ meetingSummaryInfo: {
4003
+ featureName: 'syncSystemVideoStatus',
4004
+ featureActions: [{
4005
+ actionName: 'syncMeetingVideoUnmuteStatusToSystem',
4006
+ actionId: '13400',
4007
+ isInitialValue: false,
4008
+ clickCount: '1'
4009
+ }]
4010
+ },
4011
+ },
4012
+ options: {
4013
+ meetingId: 'meetingId',
4014
+ triggeredTime: now.toISOString(),
4015
+ },
4016
+ });
4017
+ submitFeatureEventSpy.resetHistory();
4018
+
4019
+ cd.submitDelayedClientFeatureEvents();
4020
+
4021
+ // should not call submitFeatureEventSpy again if delayedClientFeatureEvents was cleared
4022
+ assert.notCalled(submitFeatureEventSpy);
4023
+ });
3123
4024
  });
3124
4025
  });
3125
4026
  });