@webex/internal-plugin-metrics 3.7.0 → 3.8.0-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 (41) 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 +76 -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/index.js.map +1 -1
  12. package/dist/metrics.js +1 -1
  13. package/dist/metrics.types.js.map +1 -1
  14. package/dist/new-metrics.js +28 -5
  15. package/dist/new-metrics.js.map +1 -1
  16. package/dist/types/business-metrics.d.ts +10 -28
  17. package/dist/types/call-diagnostic/call-diagnostic-metrics.d.ts +14 -1
  18. package/dist/types/call-diagnostic/config.d.ts +2 -0
  19. package/dist/types/generic-metrics.d.ts +2 -2
  20. package/dist/types/index.d.ts +2 -2
  21. package/dist/types/metrics.types.d.ts +17 -1
  22. package/dist/types/new-metrics.d.ts +15 -3
  23. package/package.json +12 -12
  24. package/src/business-metrics.ts +66 -76
  25. package/src/call-diagnostic/call-diagnostic-metrics-latencies.ts +36 -14
  26. package/src/call-diagnostic/call-diagnostic-metrics.ts +80 -3
  27. package/src/call-diagnostic/config.ts +8 -0
  28. package/src/generic-metrics.ts +2 -2
  29. package/src/index.ts +2 -0
  30. package/src/metrics.types.ts +21 -1
  31. package/src/new-metrics.ts +32 -4
  32. package/test/unit/spec/business/business-metrics.ts +2 -2
  33. package/test/unit/spec/call-diagnostic/call-diagnostic-metrics-latencies.ts +85 -0
  34. package/test/unit/spec/call-diagnostic/call-diagnostic-metrics.ts +674 -32
  35. package/test/unit/spec/new-metrics.ts +23 -0
  36. package/dist/behavioral/behavioral-metrics.js +0 -199
  37. package/dist/behavioral/behavioral-metrics.js.map +0 -1
  38. package/dist/behavioral/config.js +0 -11
  39. package/dist/behavioral/config.js.map +0 -1
  40. package/dist/types/behavioral/behavioral-metrics.d.ts +0 -63
  41. 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,26 @@ describe('internal-plugin-metrics', () => {
58
61
  sessionCorrelationId: 'sessionCorrelationId3',
59
62
  };
60
63
 
64
+ const fakeMeeting4 = {
65
+ ...fakeMeeting,
66
+ id: '4',
67
+ isoLocalClientMeetingJoinTime: 'testTimeString',
68
+ }
69
+ const fakeMeeting5 = {
70
+ ...fakeMeeting,
71
+ id: '5',
72
+ correlationId: 'correlationId5',
73
+ sessionCorrelationId: 'sessionCorrelationId5',
74
+ userNameInput: 'test',
75
+ emailInput: 'test@test.com'
76
+ };
77
+
61
78
  const fakeMeetings = {
62
79
  1: fakeMeeting,
63
80
  2: fakeMeeting2,
64
81
  3: fakeMeeting3,
82
+ 4: fakeMeeting4,
83
+ 5: fakeMeeting5,
65
84
  };
66
85
 
67
86
  let webex;
@@ -730,32 +749,352 @@ describe('internal-plugin-metrics', () => {
730
749
  webexConferenceIdStr: 'webexConferenceIdStr1',
731
750
  globalMeetingId: 'globalMeetingId1',
732
751
  },
733
- name: 'client.alert.displayed',
734
- },
735
- eventId: 'my-fake-id',
736
- origin: {
737
- origin: 'fake-origin',
738
- },
739
- originTime: {
740
- sent: 'not_defined_yet',
741
- triggered: now.toISOString(),
742
- },
743
- senderCountryCode: 'UK',
744
- version: 1,
752
+ name: 'client.alert.displayed',
753
+ },
754
+ eventId: 'my-fake-id',
755
+ origin: {
756
+ origin: 'fake-origin',
757
+ },
758
+ originTime: {
759
+ sent: 'not_defined_yet',
760
+ triggered: now.toISOString(),
761
+ },
762
+ senderCountryCode: 'UK',
763
+ version: 1,
764
+ });
765
+ });
766
+
767
+ it('should prepare diagnostic event successfully when triggeredTime is supplied in the options object', () => {
768
+ const options = {meetingId: fakeMeeting.id, triggeredTime: 'fake-triggered-time'};
769
+ const getOriginStub = sinon.stub(cd, 'getOrigin').returns({origin: 'fake-origin'});
770
+ const clearEmptyKeysRecursivelyStub = sinon.stub(
771
+ CallDiagnosticUtils,
772
+ 'clearEmptyKeysRecursively'
773
+ );
774
+
775
+ const res = cd.prepareDiagnosticEvent(
776
+ {
777
+ canProceed: false,
778
+ identifiers: {
779
+ correlationId: 'id',
780
+ webexConferenceIdStr: 'webexConferenceIdStr1',
781
+ globalMeetingId: 'globalMeetingId1',
782
+ },
783
+ name: 'client.alert.displayed',
784
+ },
785
+ options
786
+ );
787
+
788
+ assert.calledWith(getOriginStub, options, options.meetingId);
789
+ assert.calledOnce(clearEmptyKeysRecursivelyStub);
790
+ assert.deepEqual(res, {
791
+ event: {
792
+ canProceed: false,
793
+ identifiers: {
794
+ correlationId: 'id',
795
+ webexConferenceIdStr: 'webexConferenceIdStr1',
796
+ globalMeetingId: 'globalMeetingId1',
797
+ },
798
+ name: 'client.alert.displayed',
799
+ },
800
+ eventId: 'my-fake-id',
801
+ origin: {
802
+ origin: 'fake-origin',
803
+ },
804
+ originTime: {
805
+ sent: 'not_defined_yet',
806
+ triggered: 'fake-triggered-time',
807
+ },
808
+ senderCountryCode: 'UK',
809
+ version: 1,
810
+ });
811
+ });
812
+
813
+ describe('#submitClientEvent', () => {
814
+ it('should submit client event successfully with meetingId', () => {
815
+ const prepareDiagnosticEventSpy = sinon.spy(cd, 'prepareDiagnosticEvent');
816
+ const submitToCallDiagnosticsSpy = sinon.spy(cd, 'submitToCallDiagnostics');
817
+ const generateClientEventErrorPayloadSpy = sinon.spy(cd, 'generateClientEventErrorPayload');
818
+ const getIdentifiersSpy = sinon.spy(cd, 'getIdentifiers');
819
+ const getSubServiceTypeSpy = sinon.spy(cd, 'getSubServiceType');
820
+ sinon.stub(cd, 'getOrigin').returns({origin: 'fake-origin'});
821
+ const validatorSpy = sinon.spy(cd, 'validator');
822
+ const options = {
823
+ meetingId: fakeMeeting.id,
824
+ mediaConnections: [{mediaAgentAlias: 'alias', mediaAgentGroupId: '1'}],
825
+ };
826
+
827
+ cd.submitClientEvent({
828
+ name: 'client.alert.displayed',
829
+ options,
830
+ });
831
+
832
+ assert.called(getIdentifiersSpy);
833
+ assert.calledWith(getIdentifiersSpy, {
834
+ meeting: fakeMeeting,
835
+ mediaConnections: [{mediaAgentAlias: 'alias', mediaAgentGroupId: '1'}],
836
+ webexConferenceIdStr: undefined,
837
+ sessionCorrelationId: undefined,
838
+ globalMeetingId: undefined,
839
+ });
840
+ assert.notCalled(generateClientEventErrorPayloadSpy);
841
+ assert.calledWith(
842
+ prepareDiagnosticEventSpy,
843
+ {
844
+ canProceed: true,
845
+ eventData: {
846
+ webClientDomain: 'whatever',
847
+ },
848
+ identifiers: {
849
+ correlationId: 'correlationId',
850
+ deviceId: 'deviceUrl',
851
+ locusId: 'url',
852
+ locusStartTime: 'lastActive',
853
+ locusUrl: 'locus/url',
854
+ mediaAgentAlias: 'alias',
855
+ mediaAgentGroupId: '1',
856
+ orgId: 'orgId',
857
+ userId: 'userId',
858
+ },
859
+ loginType: 'login-ci',
860
+ name: 'client.alert.displayed',
861
+ userType: 'host',
862
+ isConvergedArchitectureEnabled: undefined,
863
+ webexSubServiceType: undefined,
864
+ webClientPreload: undefined,
865
+ },
866
+ options
867
+ );
868
+ assert.calledWith(submitToCallDiagnosticsSpy, {
869
+ event: {
870
+ canProceed: true,
871
+ eventData: {
872
+ webClientDomain: 'whatever',
873
+ },
874
+ identifiers: {
875
+ correlationId: 'correlationId',
876
+ deviceId: 'deviceUrl',
877
+ locusId: 'url',
878
+ locusStartTime: 'lastActive',
879
+ locusUrl: 'locus/url',
880
+ mediaAgentAlias: 'alias',
881
+ mediaAgentGroupId: '1',
882
+ orgId: 'orgId',
883
+ userId: 'userId',
884
+ },
885
+ loginType: 'login-ci',
886
+ name: 'client.alert.displayed',
887
+ userType: 'host',
888
+ isConvergedArchitectureEnabled: undefined,
889
+ webexSubServiceType: undefined,
890
+ webClientPreload: undefined,
891
+ },
892
+ eventId: 'my-fake-id',
893
+ origin: {
894
+ origin: 'fake-origin',
895
+ },
896
+ originTime: {
897
+ sent: 'not_defined_yet',
898
+ triggered: now.toISOString(),
899
+ },
900
+ senderCountryCode: 'UK',
901
+ version: 1,
902
+ });
903
+ assert.calledWith(validatorSpy, {
904
+ type: 'ce',
905
+ event: {
906
+ event: {
907
+ canProceed: true,
908
+ eventData: {
909
+ webClientDomain: 'whatever',
910
+ },
911
+ identifiers: {
912
+ correlationId: 'correlationId',
913
+ deviceId: 'deviceUrl',
914
+ locusId: 'url',
915
+ locusStartTime: 'lastActive',
916
+ locusUrl: 'locus/url',
917
+ mediaAgentAlias: 'alias',
918
+ mediaAgentGroupId: '1',
919
+ orgId: 'orgId',
920
+ userId: 'userId',
921
+ },
922
+ loginType: 'login-ci',
923
+ name: 'client.alert.displayed',
924
+ userType: 'host',
925
+ isConvergedArchitectureEnabled: undefined,
926
+ webexSubServiceType: undefined,
927
+ webClientPreload: undefined,
928
+ },
929
+ eventId: 'my-fake-id',
930
+ origin: {
931
+ origin: 'fake-origin',
932
+ },
933
+ originTime: {
934
+ sent: 'not_defined_yet',
935
+ triggered: now.toISOString(),
936
+ },
937
+ senderCountryCode: 'UK',
938
+ version: 1,
939
+ },
940
+ });
941
+
942
+ const webexLoggerLogCalls = webex.logger.log.getCalls();
943
+ assert.deepEqual(webexLoggerLogCalls[1].args, [
944
+ 'call-diagnostic-events -> ',
945
+ 'CallDiagnosticMetrics: @submitClientEvent. Submit Client Event CA event.',
946
+ `name: client.alert.displayed`,
947
+ ]);
948
+ });
949
+
950
+ it('should submit client event successfully with meetingId which has a sessionCorrelationId', () => {
951
+ const prepareDiagnosticEventSpy = sinon.spy(cd, 'prepareDiagnosticEvent');
952
+ const submitToCallDiagnosticsSpy = sinon.spy(cd, 'submitToCallDiagnostics');
953
+ const generateClientEventErrorPayloadSpy = sinon.spy(cd, 'generateClientEventErrorPayload');
954
+ const getIdentifiersSpy = sinon.spy(cd, 'getIdentifiers');
955
+ const getSubServiceTypeSpy = sinon.spy(cd, 'getSubServiceType');
956
+ sinon.stub(cd, 'getOrigin').returns({origin: 'fake-origin'});
957
+ const validatorSpy = sinon.spy(cd, 'validator');
958
+ const options = {
959
+ meetingId: fakeMeeting3.id,
960
+ mediaConnections: [{mediaAgentAlias: 'alias', mediaAgentGroupId: '1'}],
961
+ };
962
+
963
+ cd.submitClientEvent({
964
+ name: 'client.alert.displayed',
965
+ options,
966
+ });
967
+
968
+ assert.called(getIdentifiersSpy);
969
+ assert.calledWith(getIdentifiersSpy, {
970
+ meeting: {...fakeMeeting3, sessionCorrelationId: 'sessionCorrelationId3'},
971
+ mediaConnections: [{mediaAgentAlias: 'alias', mediaAgentGroupId: '1'}],
972
+ webexConferenceIdStr: undefined,
973
+ globalMeetingId: undefined,
974
+ sessionCorrelationId: undefined,
975
+ });
976
+ assert.notCalled(generateClientEventErrorPayloadSpy);
977
+ assert.calledWith(
978
+ prepareDiagnosticEventSpy,
979
+ {
980
+ canProceed: true,
981
+ eventData: {
982
+ webClientDomain: 'whatever',
983
+ },
984
+ identifiers: {
985
+ correlationId: 'correlationId3',
986
+ sessionCorrelationId: 'sessionCorrelationId3',
987
+ deviceId: 'deviceUrl',
988
+ locusId: 'url',
989
+ locusStartTime: 'lastActive',
990
+ locusUrl: 'locus/url',
991
+ mediaAgentAlias: 'alias',
992
+ mediaAgentGroupId: '1',
993
+ orgId: 'orgId',
994
+ userId: 'userId',
995
+ },
996
+ loginType: 'login-ci',
997
+ name: 'client.alert.displayed',
998
+ userType: 'host',
999
+ isConvergedArchitectureEnabled: undefined,
1000
+ webexSubServiceType: undefined,
1001
+ webClientPreload: undefined,
1002
+ },
1003
+ options
1004
+ );
1005
+ assert.calledWith(submitToCallDiagnosticsSpy, {
1006
+ event: {
1007
+ canProceed: true,
1008
+ eventData: {
1009
+ webClientDomain: 'whatever',
1010
+ },
1011
+ identifiers: {
1012
+ correlationId: 'correlationId3',
1013
+ sessionCorrelationId: 'sessionCorrelationId3',
1014
+ deviceId: 'deviceUrl',
1015
+ locusId: 'url',
1016
+ locusStartTime: 'lastActive',
1017
+ locusUrl: 'locus/url',
1018
+ mediaAgentAlias: 'alias',
1019
+ mediaAgentGroupId: '1',
1020
+ orgId: 'orgId',
1021
+ userId: 'userId',
1022
+ },
1023
+ loginType: 'login-ci',
1024
+ name: 'client.alert.displayed',
1025
+ userType: 'host',
1026
+ isConvergedArchitectureEnabled: undefined,
1027
+ webexSubServiceType: undefined,
1028
+ webClientPreload: undefined,
1029
+ },
1030
+ eventId: 'my-fake-id',
1031
+ origin: {
1032
+ origin: 'fake-origin',
1033
+ },
1034
+ originTime: {
1035
+ sent: 'not_defined_yet',
1036
+ triggered: now.toISOString(),
1037
+ },
1038
+ senderCountryCode: 'UK',
1039
+ version: 1,
1040
+ });
1041
+ assert.calledWith(validatorSpy, {
1042
+ type: 'ce',
1043
+ event: {
1044
+ event: {
1045
+ canProceed: true,
1046
+ eventData: {
1047
+ webClientDomain: 'whatever',
1048
+ },
1049
+ identifiers: {
1050
+ correlationId: 'correlationId3',
1051
+ sessionCorrelationId: 'sessionCorrelationId3',
1052
+ deviceId: 'deviceUrl',
1053
+ locusId: 'url',
1054
+ locusStartTime: 'lastActive',
1055
+ locusUrl: 'locus/url',
1056
+ mediaAgentAlias: 'alias',
1057
+ mediaAgentGroupId: '1',
1058
+ orgId: 'orgId',
1059
+ userId: 'userId',
1060
+ },
1061
+ loginType: 'login-ci',
1062
+ name: 'client.alert.displayed',
1063
+ userType: 'host',
1064
+ isConvergedArchitectureEnabled: undefined,
1065
+ webexSubServiceType: undefined,
1066
+ webClientPreload: undefined,
1067
+ },
1068
+ eventId: 'my-fake-id',
1069
+ origin: {
1070
+ origin: 'fake-origin',
1071
+ },
1072
+ originTime: {
1073
+ sent: 'not_defined_yet',
1074
+ triggered: now.toISOString(),
1075
+ },
1076
+ senderCountryCode: 'UK',
1077
+ version: 1,
1078
+ },
1079
+ });
1080
+
1081
+ const webexLoggerLogCalls = webex.logger.log.getCalls();
1082
+ assert.deepEqual(webexLoggerLogCalls[1].args, [
1083
+ 'call-diagnostic-events -> ',
1084
+ 'CallDiagnosticMetrics: @submitClientEvent. Submit Client Event CA event.',
1085
+ `name: client.alert.displayed`,
1086
+ ]);
745
1087
  });
746
- });
747
1088
 
748
- describe('#submitClientEvent', () => {
749
- it('should submit client event successfully with meetingId', () => {
1089
+ it('should submit client event successfully with meetingId which has a meetingJoinedTime', () => {
750
1090
  const prepareDiagnosticEventSpy = sinon.spy(cd, 'prepareDiagnosticEvent');
751
1091
  const submitToCallDiagnosticsSpy = sinon.spy(cd, 'submitToCallDiagnostics');
752
1092
  const generateClientEventErrorPayloadSpy = sinon.spy(cd, 'generateClientEventErrorPayload');
753
1093
  const getIdentifiersSpy = sinon.spy(cd, 'getIdentifiers');
754
- const getSubServiceTypeSpy = sinon.spy(cd, 'getSubServiceType');
755
1094
  sinon.stub(cd, 'getOrigin').returns({origin: 'fake-origin'});
756
1095
  const validatorSpy = sinon.spy(cd, 'validator');
757
1096
  const options = {
758
- meetingId: fakeMeeting.id,
1097
+ meetingId: fakeMeeting4.id,
759
1098
  mediaConnections: [{mediaAgentAlias: 'alias', mediaAgentGroupId: '1'}],
760
1099
  };
761
1100
 
@@ -766,16 +1105,17 @@ describe('internal-plugin-metrics', () => {
766
1105
 
767
1106
  assert.called(getIdentifiersSpy);
768
1107
  assert.calledWith(getIdentifiersSpy, {
769
- meeting: fakeMeeting,
1108
+ meeting: {...fakeMeeting4},
770
1109
  mediaConnections: [{mediaAgentAlias: 'alias', mediaAgentGroupId: '1'}],
771
1110
  webexConferenceIdStr: undefined,
772
- sessionCorrelationId: undefined,
773
1111
  globalMeetingId: undefined,
1112
+ sessionCorrelationId: undefined,
774
1113
  });
775
1114
  assert.notCalled(generateClientEventErrorPayloadSpy);
776
1115
  assert.calledWith(
777
1116
  prepareDiagnosticEventSpy,
778
1117
  {
1118
+ meetingJoinedTime: fakeMeeting4.isoLocalClientMeetingJoinTime,
779
1119
  canProceed: true,
780
1120
  eventData: {
781
1121
  webClientDomain: 'whatever',
@@ -792,6 +1132,7 @@ describe('internal-plugin-metrics', () => {
792
1132
  userId: 'userId',
793
1133
  },
794
1134
  loginType: 'login-ci',
1135
+ webClientPreload: undefined,
795
1136
  name: 'client.alert.displayed',
796
1137
  userType: 'host',
797
1138
  isConvergedArchitectureEnabled: undefined,
@@ -801,6 +1142,7 @@ describe('internal-plugin-metrics', () => {
801
1142
  );
802
1143
  assert.calledWith(submitToCallDiagnosticsSpy, {
803
1144
  event: {
1145
+ meetingJoinedTime: fakeMeeting4.isoLocalClientMeetingJoinTime,
804
1146
  canProceed: true,
805
1147
  eventData: {
806
1148
  webClientDomain: 'whatever',
@@ -817,6 +1159,7 @@ describe('internal-plugin-metrics', () => {
817
1159
  userId: 'userId',
818
1160
  },
819
1161
  loginType: 'login-ci',
1162
+ webClientPreload: undefined,
820
1163
  name: 'client.alert.displayed',
821
1164
  userType: 'host',
822
1165
  isConvergedArchitectureEnabled: undefined,
@@ -837,6 +1180,7 @@ describe('internal-plugin-metrics', () => {
837
1180
  type: 'ce',
838
1181
  event: {
839
1182
  event: {
1183
+ meetingJoinedTime: fakeMeeting4.isoLocalClientMeetingJoinTime,
840
1184
  canProceed: true,
841
1185
  eventData: {
842
1186
  webClientDomain: 'whatever',
@@ -853,6 +1197,7 @@ describe('internal-plugin-metrics', () => {
853
1197
  userId: 'userId',
854
1198
  },
855
1199
  loginType: 'login-ci',
1200
+ webClientPreload: undefined,
856
1201
  name: 'client.alert.displayed',
857
1202
  userType: 'host',
858
1203
  isConvergedArchitectureEnabled: undefined,
@@ -879,16 +1224,15 @@ describe('internal-plugin-metrics', () => {
879
1224
  ]);
880
1225
  });
881
1226
 
882
- it('should submit client event successfully with meetingId which has a sessionCorrelationId', () => {
1227
+ it('should submit client event successfully with meetingId which has emailInput and userNameInput', () => {
883
1228
  const prepareDiagnosticEventSpy = sinon.spy(cd, 'prepareDiagnosticEvent');
884
1229
  const submitToCallDiagnosticsSpy = sinon.spy(cd, 'submitToCallDiagnostics');
885
1230
  const generateClientEventErrorPayloadSpy = sinon.spy(cd, 'generateClientEventErrorPayload');
886
1231
  const getIdentifiersSpy = sinon.spy(cd, 'getIdentifiers');
887
- const getSubServiceTypeSpy = sinon.spy(cd, 'getSubServiceType');
888
1232
  sinon.stub(cd, 'getOrigin').returns({origin: 'fake-origin'});
889
1233
  const validatorSpy = sinon.spy(cd, 'validator');
890
1234
  const options = {
891
- meetingId: fakeMeeting3.id,
1235
+ meetingId: fakeMeeting5.id,
892
1236
  mediaConnections: [{mediaAgentAlias: 'alias', mediaAgentGroupId: '1'}],
893
1237
  };
894
1238
 
@@ -899,7 +1243,7 @@ describe('internal-plugin-metrics', () => {
899
1243
 
900
1244
  assert.called(getIdentifiersSpy);
901
1245
  assert.calledWith(getIdentifiersSpy, {
902
- meeting: {...fakeMeeting3, sessionCorrelationId: 'sessionCorrelationId3'},
1246
+ meeting: {...fakeMeeting5, sessionCorrelationId: 'sessionCorrelationId5'},
903
1247
  mediaConnections: [{mediaAgentAlias: 'alias', mediaAgentGroupId: '1'}],
904
1248
  webexConferenceIdStr: undefined,
905
1249
  globalMeetingId: undefined,
@@ -914,8 +1258,8 @@ describe('internal-plugin-metrics', () => {
914
1258
  webClientDomain: 'whatever',
915
1259
  },
916
1260
  identifiers: {
917
- correlationId: 'correlationId3',
918
- sessionCorrelationId: 'sessionCorrelationId3',
1261
+ correlationId: 'correlationId5',
1262
+ sessionCorrelationId: 'sessionCorrelationId5',
919
1263
  deviceId: 'deviceUrl',
920
1264
  locusId: 'url',
921
1265
  locusStartTime: 'lastActive',
@@ -928,8 +1272,11 @@ describe('internal-plugin-metrics', () => {
928
1272
  loginType: 'login-ci',
929
1273
  name: 'client.alert.displayed',
930
1274
  userType: 'host',
1275
+ userNameInput: 'test',
1276
+ emailInput: 'test@test.com',
931
1277
  isConvergedArchitectureEnabled: undefined,
932
1278
  webexSubServiceType: undefined,
1279
+ webClientPreload: undefined,
933
1280
  },
934
1281
  options
935
1282
  );
@@ -940,8 +1287,8 @@ describe('internal-plugin-metrics', () => {
940
1287
  webClientDomain: 'whatever',
941
1288
  },
942
1289
  identifiers: {
943
- correlationId: 'correlationId3',
944
- sessionCorrelationId: 'sessionCorrelationId3',
1290
+ correlationId: 'correlationId5',
1291
+ sessionCorrelationId: 'sessionCorrelationId5',
945
1292
  deviceId: 'deviceUrl',
946
1293
  locusId: 'url',
947
1294
  locusStartTime: 'lastActive',
@@ -954,8 +1301,11 @@ describe('internal-plugin-metrics', () => {
954
1301
  loginType: 'login-ci',
955
1302
  name: 'client.alert.displayed',
956
1303
  userType: 'host',
1304
+ userNameInput: 'test',
1305
+ emailInput: 'test@test.com',
957
1306
  isConvergedArchitectureEnabled: undefined,
958
1307
  webexSubServiceType: undefined,
1308
+ webClientPreload: undefined,
959
1309
  },
960
1310
  eventId: 'my-fake-id',
961
1311
  origin: {
@@ -977,8 +1327,8 @@ describe('internal-plugin-metrics', () => {
977
1327
  webClientDomain: 'whatever',
978
1328
  },
979
1329
  identifiers: {
980
- correlationId: 'correlationId3',
981
- sessionCorrelationId: 'sessionCorrelationId3',
1330
+ correlationId: 'correlationId5',
1331
+ sessionCorrelationId: 'sessionCorrelationId5',
982
1332
  deviceId: 'deviceUrl',
983
1333
  locusId: 'url',
984
1334
  locusStartTime: 'lastActive',
@@ -991,8 +1341,11 @@ describe('internal-plugin-metrics', () => {
991
1341
  loginType: 'login-ci',
992
1342
  name: 'client.alert.displayed',
993
1343
  userType: 'host',
1344
+ userNameInput: 'test',
1345
+ emailInput: 'test@test.com',
994
1346
  isConvergedArchitectureEnabled: undefined,
995
1347
  webexSubServiceType: undefined,
1348
+ webClientPreload: undefined,
996
1349
  },
997
1350
  eventId: 'my-fake-id',
998
1351
  origin: {
@@ -1110,6 +1463,7 @@ describe('internal-plugin-metrics', () => {
1110
1463
  },
1111
1464
  loginType: 'login-ci',
1112
1465
  name: 'client.alert.displayed',
1466
+ webClientPreload: undefined
1113
1467
  },
1114
1468
  options
1115
1469
  );
@@ -1131,6 +1485,7 @@ describe('internal-plugin-metrics', () => {
1131
1485
  },
1132
1486
  loginType: 'login-ci',
1133
1487
  name: 'client.alert.displayed',
1488
+ webClientPreload: undefined
1134
1489
  },
1135
1490
  eventId: 'my-fake-id',
1136
1491
  origin: {
@@ -1204,6 +1559,97 @@ describe('internal-plugin-metrics', () => {
1204
1559
  },
1205
1560
  loginType: 'login-ci',
1206
1561
  name: 'client.alert.displayed',
1562
+ webClientPreload: undefined,
1563
+ },
1564
+ options
1565
+ );
1566
+ assert.notCalled(submitToCallDiagnosticsSpy);
1567
+ assert.calledWith(
1568
+ submitToCallDiagnosticsPreLoginSpy,
1569
+ {
1570
+ eventId: 'my-fake-id',
1571
+ version: 1,
1572
+ origin: {origin: 'fake-origin'},
1573
+ originTime: {triggered: now.toISOString(), sent: 'not_defined_yet'},
1574
+ senderCountryCode: 'UK',
1575
+ event: {
1576
+ name: 'client.alert.displayed',
1577
+ canProceed: true,
1578
+ identifiers: {
1579
+ correlationId: 'correlationId',
1580
+ sessionCorrelationId: 'sessionCorrelationId1',
1581
+ userId: 'myPreLoginId',
1582
+ deviceId: 'deviceUrl',
1583
+ orgId: 'orgId',
1584
+ locusUrl: 'locus-url',
1585
+ webexConferenceIdStr: 'webexConferenceIdStr1',
1586
+ globalMeetingId: 'globalMeetingId1',
1587
+ },
1588
+ eventData: {webClientDomain: 'whatever'},
1589
+ loginType: 'login-ci',
1590
+ webClientPreload: undefined,
1591
+ },
1592
+ },
1593
+ options.preLoginId
1594
+ );
1595
+ });
1596
+
1597
+ it('should submit client event successfully with emailInput and userNameInput as options', () => {
1598
+ cd.device.userId = undefined;
1599
+
1600
+ const prepareDiagnosticEventSpy = sinon.spy(cd, 'prepareDiagnosticEvent');
1601
+ const submitToCallDiagnosticsPreLoginSpy = sinon.spy(cd, 'submitToCallDiagnosticsPreLogin');
1602
+ const submitToCallDiagnosticsSpy = sinon.spy(cd, 'submitToCallDiagnostics');
1603
+ const generateClientEventErrorPayloadSpy = sinon.spy(cd, 'generateClientEventErrorPayload');
1604
+ const getIdentifiersSpy = sinon.spy(cd, 'getIdentifiers');
1605
+ sinon.stub(cd, 'getOrigin').returns({origin: 'fake-origin'});
1606
+
1607
+ const options = {
1608
+ correlationId: 'correlationId',
1609
+ webexConferenceIdStr: 'webexConferenceIdStr1',
1610
+ globalMeetingId: 'globalMeetingId1',
1611
+ preLoginId: 'myPreLoginId',
1612
+ sessionCorrelationId: 'sessionCorrelationId1',
1613
+ userNameInput: 'current' as ClientUserNameInput,
1614
+ emailInput: 'current' as ClientEmailInput,
1615
+ };
1616
+
1617
+ cd.submitClientEvent({
1618
+ name: 'client.alert.displayed',
1619
+ options,
1620
+ });
1621
+
1622
+ assert.calledWith(getIdentifiersSpy, {
1623
+ correlationId: 'correlationId',
1624
+ webexConferenceIdStr: 'webexConferenceIdStr1',
1625
+ globalMeetingId: 'globalMeetingId1',
1626
+ preLoginId: 'myPreLoginId',
1627
+ sessionCorrelationId: 'sessionCorrelationId1',
1628
+ });
1629
+
1630
+ assert.notCalled(generateClientEventErrorPayloadSpy);
1631
+ assert.calledWith(
1632
+ prepareDiagnosticEventSpy,
1633
+ {
1634
+ canProceed: true,
1635
+ eventData: {
1636
+ webClientDomain: 'whatever',
1637
+ },
1638
+ identifiers: {
1639
+ correlationId: 'correlationId',
1640
+ sessionCorrelationId: 'sessionCorrelationId1',
1641
+ webexConferenceIdStr: 'webexConferenceIdStr1',
1642
+ globalMeetingId: 'globalMeetingId1',
1643
+ deviceId: 'deviceUrl',
1644
+ locusUrl: 'locus-url',
1645
+ orgId: 'orgId',
1646
+ userId: 'myPreLoginId',
1647
+ },
1648
+ userNameInput: 'current',
1649
+ emailInput: 'current',
1650
+ loginType: 'login-ci',
1651
+ name: 'client.alert.displayed',
1652
+ webClientPreload: undefined,
1207
1653
  },
1208
1654
  options
1209
1655
  );
@@ -1231,6 +1677,9 @@ describe('internal-plugin-metrics', () => {
1231
1677
  },
1232
1678
  eventData: {webClientDomain: 'whatever'},
1233
1679
  loginType: 'login-ci',
1680
+ userNameInput: 'current',
1681
+ emailInput: 'current',
1682
+ webClientPreload: undefined,
1234
1683
  },
1235
1684
  },
1236
1685
  options.preLoginId
@@ -1273,6 +1722,7 @@ describe('internal-plugin-metrics', () => {
1273
1722
  joinFlowVersion: 'Other',
1274
1723
  isConvergedArchitectureEnabled: undefined,
1275
1724
  webexSubServiceType: undefined,
1725
+ webClientPreload: undefined,
1276
1726
  },
1277
1727
  eventId: 'my-fake-id',
1278
1728
  origin: {
@@ -1325,6 +1775,84 @@ describe('internal-plugin-metrics', () => {
1325
1775
  joinFlowVersion: 'Other',
1326
1776
  isConvergedArchitectureEnabled: undefined,
1327
1777
  webexSubServiceType: undefined,
1778
+ webClientPreload: undefined,
1779
+ },
1780
+ eventId: 'my-fake-id',
1781
+ origin: {
1782
+ origin: 'fake-origin',
1783
+ },
1784
+ originTime: {
1785
+ sent: 'not_defined_yet',
1786
+ triggered: now.toISOString(),
1787
+ },
1788
+ senderCountryCode: 'UK',
1789
+ version: 1,
1790
+ });
1791
+ });
1792
+
1793
+ it('should submit client event successfully with webClientPreload', () => {
1794
+ const prepareDiagnosticEventSpy = sinon.spy(cd, 'prepareDiagnosticEvent');
1795
+ const submitToCallDiagnosticsSpy = sinon.spy(cd, 'submitToCallDiagnostics');
1796
+ const generateClientEventErrorPayloadSpy = sinon.spy(cd, 'generateClientEventErrorPayload');
1797
+ sinon.stub(cd, 'getOrigin').returns({origin: 'fake-origin'});
1798
+
1799
+ webex.meetings.config.metrics.webClientPreload = true;
1800
+
1801
+ const options = {
1802
+ correlationId: 'correlationId',
1803
+ webexConferenceIdStr: 'webexConferenceIdStr1',
1804
+ globalMeetingId: 'globalMeetingId1',
1805
+ sessionCorrelationId: 'sessionCorrelationId1',
1806
+ };
1807
+
1808
+ cd.submitClientEvent({
1809
+ name: 'client.alert.displayed',
1810
+ options,
1811
+ });
1812
+
1813
+ assert.notCalled(generateClientEventErrorPayloadSpy);
1814
+ assert.calledWith(
1815
+ prepareDiagnosticEventSpy,
1816
+ {
1817
+ canProceed: true,
1818
+ eventData: {
1819
+ webClientDomain: 'whatever',
1820
+ },
1821
+ identifiers: {
1822
+ correlationId: 'correlationId',
1823
+ webexConferenceIdStr: 'webexConferenceIdStr1',
1824
+ sessionCorrelationId: 'sessionCorrelationId1',
1825
+ globalMeetingId: 'globalMeetingId1',
1826
+ deviceId: 'deviceUrl',
1827
+ locusUrl: 'locus-url',
1828
+ orgId: 'orgId',
1829
+ userId: 'userId',
1830
+ },
1831
+ loginType: 'login-ci',
1832
+ name: 'client.alert.displayed',
1833
+ webClientPreload: true,
1834
+ },
1835
+ options
1836
+ );
1837
+ assert.calledWith(submitToCallDiagnosticsSpy, {
1838
+ event: {
1839
+ canProceed: true,
1840
+ eventData: {
1841
+ webClientDomain: 'whatever',
1842
+ },
1843
+ identifiers: {
1844
+ correlationId: 'correlationId',
1845
+ webexConferenceIdStr: 'webexConferenceIdStr1',
1846
+ sessionCorrelationId: 'sessionCorrelationId1',
1847
+ globalMeetingId: 'globalMeetingId1',
1848
+ deviceId: 'deviceUrl',
1849
+ locusUrl: 'locus-url',
1850
+ orgId: 'orgId',
1851
+ userId: 'userId',
1852
+ },
1853
+ loginType: 'login-ci',
1854
+ name: 'client.alert.displayed',
1855
+ webClientPreload: true,
1328
1856
  },
1329
1857
  eventId: 'my-fake-id',
1330
1858
  origin: {
@@ -1396,6 +1924,7 @@ describe('internal-plugin-metrics', () => {
1396
1924
  userType: 'host',
1397
1925
  isConvergedArchitectureEnabled: undefined,
1398
1926
  webexSubServiceType: undefined,
1927
+ webClientPreload: undefined,
1399
1928
  },
1400
1929
  eventId: 'my-fake-id',
1401
1930
  origin: {
@@ -1475,6 +2004,7 @@ describe('internal-plugin-metrics', () => {
1475
2004
  userType: 'host',
1476
2005
  isConvergedArchitectureEnabled: undefined,
1477
2006
  webexSubServiceType: undefined,
2007
+ webClientPreload: undefined,
1478
2008
  },
1479
2009
  eventId: 'my-fake-id',
1480
2010
  origin: {
@@ -1546,6 +2076,7 @@ describe('internal-plugin-metrics', () => {
1546
2076
  ],
1547
2077
  loginType: 'login-ci',
1548
2078
  name: 'client.alert.displayed',
2079
+ webClientPreload: undefined,
1549
2080
  },
1550
2081
  eventId: 'my-fake-id',
1551
2082
  origin: {
@@ -1619,6 +2150,7 @@ describe('internal-plugin-metrics', () => {
1619
2150
  ],
1620
2151
  loginType: 'login-ci',
1621
2152
  name: 'client.alert.displayed',
2153
+ webClientPreload: undefined,
1622
2154
  },
1623
2155
  eventId: 'my-fake-id',
1624
2156
  origin: {
@@ -1701,6 +2233,7 @@ describe('internal-plugin-metrics', () => {
1701
2233
  userType: 'host',
1702
2234
  isConvergedArchitectureEnabled: undefined,
1703
2235
  webexSubServiceType: undefined,
2236
+ webClientPreload: undefined,
1704
2237
  },
1705
2238
  eventId: 'my-fake-id',
1706
2239
  origin: {
@@ -2621,15 +3154,36 @@ describe('internal-plugin-metrics', () => {
2621
3154
  assert.deepEqual(cd.getSubServiceType(fakeMeeting), 'ScheduledMeeting');
2622
3155
  });
2623
3156
 
2624
- it('returns subServicetype as Webinar when meeting is Webinar', () => {
3157
+ it('returns subServicetype as Webinar when meeting is non-converged Webinar', () => {
2625
3158
  fakeMeeting.meetingInfo = {
2626
3159
  webexScheduled: true,
2627
3160
  pmr: false,
2628
3161
  enableEvent: true,
3162
+ enableConvergedArchitecture: false,
3163
+ };
3164
+ assert.deepEqual(cd.getSubServiceType(fakeMeeting), 'Webinar');
3165
+ });
3166
+
3167
+ it('returns subServicetype as Webinar when meeting is converged Webinar', () => {
3168
+ fakeMeeting.meetingInfo = {
3169
+ enableEvent: true,
3170
+ isConvergedWebinar: true,
3171
+ isConvergedWebinarWebcast: false,
3172
+ enableConvergedArchitecture: true,
2629
3173
  };
2630
3174
  assert.deepEqual(cd.getSubServiceType(fakeMeeting), 'Webinar');
2631
3175
  });
2632
3176
 
3177
+ it('returns subServicetype as Webcast when meeting is converged Webinar and enable webcast', () => {
3178
+ fakeMeeting.meetingInfo = {
3179
+ enableEvent: true,
3180
+ isConvergedWebinar: false,
3181
+ isConvergedWebinarWebcast: true,
3182
+ enableConvergedArchitecture: true,
3183
+ };
3184
+ assert.deepEqual(cd.getSubServiceType(fakeMeeting), 'Webcast');
3185
+ });
3186
+
2633
3187
  it('returns subServicetype as undefined when correct parameters are not found', () => {
2634
3188
  fakeMeeting.meetingInfo = {};
2635
3189
  assert.deepEqual(cd.getSubServiceType(fakeMeeting), undefined);
@@ -2693,6 +3247,7 @@ describe('internal-plugin-metrics', () => {
2693
3247
  userType: 'host',
2694
3248
  isConvergedArchitectureEnabled: undefined,
2695
3249
  webexSubServiceType: undefined,
3250
+ webClientPreload: undefined,
2696
3251
  },
2697
3252
  eventId: 'my-fake-id',
2698
3253
  origin: {
@@ -2759,11 +3314,12 @@ describe('internal-plugin-metrics', () => {
2759
3314
  });
2760
3315
  });
2761
3316
 
2762
- it('includes expected joinFlowVersion from options when in-meeting', async () => {
3317
+ it('includes expected joinFlowVersion and meetingJoinPhase from options when in-meeting', async () => {
2763
3318
  // meetingId means in-meeting
2764
3319
  const options = {
2765
3320
  meetingId: fakeMeeting.id,
2766
3321
  joinFlowVersion: 'NewFTE',
3322
+ meetingJoinPhase: 'join',
2767
3323
  };
2768
3324
 
2769
3325
  const triggered = new Date();
@@ -2777,6 +3333,11 @@ describe('internal-plugin-metrics', () => {
2777
3333
  fetchOptions.body.metrics[0].eventPayload.event.joinFlowVersion,
2778
3334
  options.joinFlowVersion
2779
3335
  );
3336
+
3337
+ assert.equal(
3338
+ fetchOptions.body.metrics[0].eventPayload.event.meetingJoinPhase,
3339
+ options.meetingJoinPhase
3340
+ );
2780
3341
  });
2781
3342
 
2782
3343
  it('includes expected joinFlowVersion from meeting callStateForMetrics when in-meeting', async () => {
@@ -2815,12 +3376,13 @@ describe('internal-plugin-metrics', () => {
2815
3376
  );
2816
3377
  });
2817
3378
 
2818
- it('includes expected joinFlowVersion from options during prejoin', async () => {
3379
+ it('includes expected joinFlowVersion and meetingJoinPhase from options during prejoin', async () => {
2819
3380
  // correlationId and no meeting id means prejoin
2820
3381
  const options = {
2821
3382
  correlationId: 'myCorrelationId',
2822
3383
  preLoginId: 'myPreLoginId',
2823
3384
  joinFlowVersion: 'NewFTE',
3385
+ meetingJoinPhase: 'pre-join',
2824
3386
  };
2825
3387
 
2826
3388
  const triggered = new Date();
@@ -2834,6 +3396,11 @@ describe('internal-plugin-metrics', () => {
2834
3396
  fetchOptions.body.metrics[0].eventPayload.event.joinFlowVersion,
2835
3397
  options.joinFlowVersion
2836
3398
  );
3399
+
3400
+ assert.equal(
3401
+ fetchOptions.body.metrics[0].eventPayload.event.meetingJoinPhase,
3402
+ options.meetingJoinPhase
3403
+ );
2837
3404
  });
2838
3405
  });
2839
3406
 
@@ -2880,5 +3447,80 @@ describe('internal-plugin-metrics', () => {
2880
3447
  assert.deepEqual(cd.device, device);
2881
3448
  });
2882
3449
  });
3450
+
3451
+ describe('#submitDelayedClientEvents', () => {
3452
+ it('does not call submitClientEvent if there were no delayed events', () => {
3453
+ const submitClientEventSpy = sinon.spy(cd, 'submitClientEvent');
3454
+
3455
+ cd.submitDelayedClientEvents();
3456
+
3457
+ assert.notCalled(submitClientEventSpy);
3458
+ });
3459
+
3460
+ it('calls submitClientEvent for every delayed event and clears delayedClientEvents array', () => {
3461
+ const submitClientEventSpy = sinon.spy(cd, 'submitClientEvent');
3462
+ const submitToCallDiagnosticsSpy = sinon.spy(cd, 'submitToCallDiagnostics');
3463
+
3464
+ const options = {
3465
+ correlationId: 'correlationId',
3466
+ };
3467
+
3468
+ cd.submitClientEvent({
3469
+ name: 'client.alert.displayed',
3470
+ options,
3471
+ delaySubmitEvent: true,
3472
+ });
3473
+
3474
+ cd.submitClientEvent({
3475
+ name: 'client.alert.removed',
3476
+ options,
3477
+ delaySubmitEvent: true,
3478
+ });
3479
+
3480
+ cd.submitClientEvent({
3481
+ name: 'client.call.aborted',
3482
+ options,
3483
+ delaySubmitEvent: true,
3484
+ });
3485
+
3486
+ assert.notCalled(submitToCallDiagnosticsSpy);
3487
+ assert.calledThrice(submitClientEventSpy);
3488
+ submitClientEventSpy.resetHistory();
3489
+
3490
+ cd.submitDelayedClientEvents();
3491
+
3492
+ assert.calledThrice(submitClientEventSpy);
3493
+ assert.calledWith(submitClientEventSpy.firstCall, {
3494
+ name: 'client.alert.displayed',
3495
+ payload: undefined,
3496
+ options: {
3497
+ correlationId: 'correlationId',
3498
+ triggeredTime: now.toISOString(),
3499
+ },
3500
+ });
3501
+ assert.calledWith(submitClientEventSpy.secondCall, {
3502
+ name: 'client.alert.removed',
3503
+ payload: undefined,
3504
+ options: {
3505
+ correlationId: 'correlationId',
3506
+ triggeredTime: now.toISOString(),
3507
+ },
3508
+ });
3509
+ assert.calledWith(submitClientEventSpy.thirdCall, {
3510
+ name: 'client.call.aborted',
3511
+ payload: undefined,
3512
+ options: {
3513
+ correlationId: 'correlationId',
3514
+ triggeredTime: now.toISOString(),
3515
+ },
3516
+ });
3517
+ submitClientEventSpy.resetHistory();
3518
+
3519
+ cd.submitDelayedClientEvents();
3520
+
3521
+ // should not call submitClientEvent again if delayedClientEvents was cleared
3522
+ assert.notCalled(submitClientEventSpy);
3523
+ });
3524
+ });
2883
3525
  });
2884
3526
  });