@webex/internal-plugin-metrics 3.12.0-next.54 → 3.12.0-next.56

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.
@@ -81,12 +81,20 @@ describe('internal-plugin-metrics', () => {
81
81
  emailInput: 'test@test.com',
82
82
  };
83
83
 
84
+ const fakeMeeting6 = {
85
+ ...fakeMeeting,
86
+ id: '6',
87
+ correlationId: 'correlationId6',
88
+ callStateForMetrics: {meetingJoinPhase: 'in-meeting'},
89
+ };
90
+
84
91
  const fakeMeetings = {
85
92
  1: fakeMeeting,
86
93
  2: fakeMeeting2,
87
94
  3: fakeMeeting3,
88
95
  4: fakeMeeting4,
89
96
  5: fakeMeeting5,
97
+ 6: fakeMeeting6,
90
98
  };
91
99
 
92
100
  let webex;
@@ -715,6 +723,63 @@ describe('internal-plugin-metrics', () => {
715
723
  });
716
724
  });
717
725
 
726
+ it('should build identifiers correctly with a meeting that has meetingInfo with locusClusterUrl', () => {
727
+ const res = cd.getIdentifiers({
728
+ mediaConnections: [
729
+ {mediaAgentAlias: 'mediaAgentAlias', mediaAgentGroupId: 'mediaAgentGroupId'},
730
+ ],
731
+ meeting: {
732
+ ...fakeMeeting,
733
+ meetingInfo: {
734
+ ...fakeMeeting.meetingInfo,
735
+ locusClusterUrl: 'locus-k.wbx2.com',
736
+ },
737
+ },
738
+ });
739
+
740
+ assert.deepEqual(res, {
741
+ correlationId: 'correlationId',
742
+ deviceId: 'deviceUrl',
743
+ locusCluster: 'locus-k.wbx2.com',
744
+ locusId: 'url',
745
+ locusSessionId: 'locusSessionId',
746
+ locusStartTime: 'lastActive',
747
+ locusUrl: 'locus/url',
748
+ mediaAgentAlias: 'mediaAgentAlias',
749
+ mediaAgentGroupId: 'mediaAgentGroupId',
750
+ orgId: 'orgId',
751
+ userId: 'userId',
752
+ });
753
+ });
754
+
755
+ it('should build identifiers correctly given locusCluster', () => {
756
+ const res = cd.getIdentifiers({
757
+ correlationId: 'correlationId',
758
+ locusCluster: 'locus-k.wbx2.com',
759
+ });
760
+
761
+ assert.deepEqual(res, {
762
+ correlationId: 'correlationId',
763
+ deviceId: 'deviceUrl',
764
+ locusCluster: 'locus-k.wbx2.com',
765
+ locusUrl: 'locus-url',
766
+ orgId: 'orgId',
767
+ userId: 'userId',
768
+ });
769
+ });
770
+
771
+ it('should prefer meetingInfo locusClusterUrl over the locusCluster option', () => {
772
+ const res = cd.getIdentifiers({
773
+ meeting: {
774
+ ...fakeMeeting,
775
+ meetingInfo: {...fakeMeeting.meetingInfo, locusClusterUrl: 'locus-k.wbx2.com'},
776
+ },
777
+ locusCluster: 'locus-a.wbx2.com',
778
+ });
779
+
780
+ assert.equal(res.locusCluster, 'locus-k.wbx2.com');
781
+ });
782
+
718
783
  it('should build identifiers correctly with a meeting that has sessionCorrelationId', () => {
719
784
  const res = cd.getIdentifiers({
720
785
  mediaConnections: [
@@ -1113,6 +1178,7 @@ describe('internal-plugin-metrics', () => {
1113
1178
  webexConferenceIdStr: undefined,
1114
1179
  sessionCorrelationId: undefined,
1115
1180
  globalMeetingId: undefined,
1181
+ locusCluster: undefined,
1116
1182
  });
1117
1183
  assert.notCalled(generateClientEventErrorPayloadSpy);
1118
1184
  assert.calledWith(
@@ -1267,6 +1333,7 @@ describe('internal-plugin-metrics', () => {
1267
1333
  webexConferenceIdStr: undefined,
1268
1334
  sessionCorrelationId: undefined,
1269
1335
  globalMeetingId: undefined,
1336
+ locusCluster: undefined,
1270
1337
  });
1271
1338
  assert.notCalled(generateClientEventErrorPayloadSpy);
1272
1339
  assert.calledWith(
@@ -1421,6 +1488,7 @@ describe('internal-plugin-metrics', () => {
1421
1488
  webexConferenceIdStr: undefined,
1422
1489
  globalMeetingId: undefined,
1423
1490
  sessionCorrelationId: undefined,
1491
+ locusCluster: undefined,
1424
1492
  });
1425
1493
  assert.notCalled(generateClientEventErrorPayloadSpy);
1426
1494
  assert.calledWith(
@@ -1577,6 +1645,7 @@ describe('internal-plugin-metrics', () => {
1577
1645
  webexConferenceIdStr: undefined,
1578
1646
  globalMeetingId: undefined,
1579
1647
  sessionCorrelationId: undefined,
1648
+ locusCluster: undefined,
1580
1649
  });
1581
1650
  assert.notCalled(generateClientEventErrorPayloadSpy);
1582
1651
  assert.calledWith(
@@ -1733,6 +1802,7 @@ describe('internal-plugin-metrics', () => {
1733
1802
  webexConferenceIdStr: undefined,
1734
1803
  globalMeetingId: undefined,
1735
1804
  sessionCorrelationId: undefined,
1805
+ locusCluster: undefined,
1736
1806
  });
1737
1807
  assert.notCalled(generateClientEventErrorPayloadSpy);
1738
1808
  assert.calledWith(
@@ -1951,6 +2021,7 @@ describe('internal-plugin-metrics', () => {
1951
2021
  globalMeetingId: 'globalMeetingId1',
1952
2022
  sessionCorrelationId: 'sessionCorrelationId1',
1953
2023
  preLoginId: undefined,
2024
+ locusCluster: undefined,
1954
2025
  });
1955
2026
 
1956
2027
  assert.notCalled(generateClientEventErrorPayloadSpy);
@@ -1978,6 +2049,7 @@ describe('internal-plugin-metrics', () => {
1978
2049
  webClientPreload: undefined,
1979
2050
  isAutomatedUser: false,
1980
2051
  userActivation: undefined,
2052
+ meetingJoinPhase: 'pre-join',
1981
2053
  },
1982
2054
  options
1983
2055
  );
@@ -2004,6 +2076,7 @@ describe('internal-plugin-metrics', () => {
2004
2076
  webClientPreload: undefined,
2005
2077
  isAutomatedUser: false,
2006
2078
  userActivation: undefined,
2079
+ meetingJoinPhase: 'pre-join',
2007
2080
  },
2008
2081
  eventId: 'my-fake-id',
2009
2082
  origin: {
@@ -2055,6 +2128,7 @@ describe('internal-plugin-metrics', () => {
2055
2128
  globalMeetingId: 'globalMeetingId1',
2056
2129
  preLoginId: 'myPreLoginId',
2057
2130
  sessionCorrelationId: 'sessionCorrelationId1',
2131
+ locusCluster: undefined,
2058
2132
  });
2059
2133
 
2060
2134
  assert.notCalled(generateClientEventErrorPayloadSpy);
@@ -2082,6 +2156,7 @@ describe('internal-plugin-metrics', () => {
2082
2156
  webClientPreload: undefined,
2083
2157
  isAutomatedUser: false,
2084
2158
  userActivation: undefined,
2159
+ meetingJoinPhase: 'pre-join',
2085
2160
  },
2086
2161
  options
2087
2162
  );
@@ -2113,12 +2188,43 @@ describe('internal-plugin-metrics', () => {
2113
2188
  webClientPreload: undefined,
2114
2189
  isAutomatedUser: false,
2115
2190
  userActivation: undefined,
2191
+ meetingJoinPhase: 'pre-join',
2116
2192
  },
2117
2193
  },
2118
2194
  options.preLoginId
2119
2195
  );
2120
2196
  });
2121
2197
 
2198
+ it('should add locusCluster from options to a pre-meeting client event', () => {
2199
+ const prepareDiagnosticEventSpy = sinon.spy(cd, 'prepareDiagnosticEvent');
2200
+ sinon.stub(cd, 'getOrigin').returns({origin: 'fake-origin'});
2201
+
2202
+ cd.submitClientEvent({
2203
+ name: 'client.meetinginfo.response',
2204
+ options: {correlationId: 'correlationId', locusCluster: 'locus-k.wbx2.com'},
2205
+ });
2206
+
2207
+ assert.equal(
2208
+ prepareDiagnosticEventSpy.firstCall.args[0].identifiers.locusCluster,
2209
+ 'locus-k.wbx2.com'
2210
+ );
2211
+ });
2212
+
2213
+ it('should add locusCluster from options to an in-meeting client event when the meeting has none', () => {
2214
+ const prepareDiagnosticEventSpy = sinon.spy(cd, 'prepareDiagnosticEvent');
2215
+ sinon.stub(cd, 'getOrigin').returns({origin: 'fake-origin'});
2216
+
2217
+ cd.submitClientEvent({
2218
+ name: 'client.interstitial-window.launched',
2219
+ options: {meetingId: fakeMeeting.id, locusCluster: 'locus-k.wbx2.com'},
2220
+ });
2221
+
2222
+ assert.equal(
2223
+ prepareDiagnosticEventSpy.firstCall.args[0].identifiers.locusCluster,
2224
+ 'locus-k.wbx2.com'
2225
+ );
2226
+ });
2227
+
2122
2228
  it('should submit client event successfully with emailInput and userNameInput as options', () => {
2123
2229
  cd.device.userId = undefined;
2124
2230
 
@@ -2150,6 +2256,7 @@ describe('internal-plugin-metrics', () => {
2150
2256
  globalMeetingId: 'globalMeetingId1',
2151
2257
  preLoginId: 'myPreLoginId',
2152
2258
  sessionCorrelationId: 'sessionCorrelationId1',
2259
+ locusCluster: undefined,
2153
2260
  });
2154
2261
 
2155
2262
  assert.notCalled(generateClientEventErrorPayloadSpy);
@@ -2179,6 +2286,7 @@ describe('internal-plugin-metrics', () => {
2179
2286
  webClientPreload: undefined,
2180
2287
  isAutomatedUser: false,
2181
2288
  userActivation: undefined,
2289
+ meetingJoinPhase: 'pre-join',
2182
2290
  },
2183
2291
  options
2184
2292
  );
@@ -2212,6 +2320,7 @@ describe('internal-plugin-metrics', () => {
2212
2320
  webClientPreload: undefined,
2213
2321
  isAutomatedUser: false,
2214
2322
  userActivation: undefined,
2323
+ meetingJoinPhase: 'pre-join',
2215
2324
  },
2216
2325
  },
2217
2326
  options.preLoginId
@@ -2379,6 +2488,7 @@ describe('internal-plugin-metrics', () => {
2379
2488
  webClientPreload: true,
2380
2489
  isAutomatedUser: false,
2381
2490
  userActivation: undefined,
2491
+ meetingJoinPhase: 'pre-join',
2382
2492
  },
2383
2493
  options
2384
2494
  );
@@ -2405,6 +2515,7 @@ describe('internal-plugin-metrics', () => {
2405
2515
  webClientPreload: true,
2406
2516
  isAutomatedUser: false,
2407
2517
  userActivation: undefined,
2518
+ meetingJoinPhase: 'pre-join',
2408
2519
  },
2409
2520
  eventId: 'my-fake-id',
2410
2521
  origin: {
@@ -2855,6 +2966,7 @@ describe('internal-plugin-metrics', () => {
2855
2966
  webClientPreload: undefined,
2856
2967
  isAutomatedUser: false,
2857
2968
  userActivation: undefined,
2969
+ meetingJoinPhase: 'pre-join',
2858
2970
  },
2859
2971
  eventId: 'my-fake-id',
2860
2972
  origin: {
@@ -2933,6 +3045,7 @@ describe('internal-plugin-metrics', () => {
2933
3045
  webClientPreload: undefined,
2934
3046
  isAutomatedUser: false,
2935
3047
  userActivation: undefined,
3048
+ meetingJoinPhase: 'pre-join',
2936
3049
  },
2937
3050
  eventId: 'my-fake-id',
2938
3051
  origin: {
@@ -4535,6 +4648,18 @@ describe('internal-plugin-metrics', () => {
4535
4648
  });
4536
4649
 
4537
4650
  describe('#buildClientEventFetchRequestOptions', () => {
4651
+ it('should add the locusCluster option to a pre-meeting event', async () => {
4652
+ const fetchOptions = await cd.buildClientEventFetchRequestOptions({
4653
+ name: 'client.interstitial-window.launched',
4654
+ options: {correlationId: 'correlationId', locusCluster: 'locus-k.wbx2.com'},
4655
+ });
4656
+
4657
+ assert.equal(
4658
+ fetchOptions.body.metrics[0].eventPayload.event.identifiers.locusCluster,
4659
+ 'locus-k.wbx2.com'
4660
+ );
4661
+ });
4662
+
4538
4663
  [undefined, 'myPreLoginId'].forEach((preLoginId) => {
4539
4664
  it('returns expected options without preLoginId', async () => {
4540
4665
  const options = {
@@ -4735,6 +4860,56 @@ describe('internal-plugin-metrics', () => {
4735
4860
  );
4736
4861
  });
4737
4862
 
4863
+ it('includes expected meetingJoinPhase from meeting callStateForMetrics when in-meeting', async () => {
4864
+ // meetingId means in-meeting
4865
+ const options = {
4866
+ meetingId: fakeMeeting6.id,
4867
+ };
4868
+
4869
+ const fetchOptions = await cd.buildClientEventFetchRequestOptions({
4870
+ name: 'client.exit.app',
4871
+ payload: {trigger: 'user-interaction', canProceed: false},
4872
+ options,
4873
+ });
4874
+
4875
+ assert.equal(fetchOptions.body.metrics[0].eventPayload.event.meetingJoinPhase, 'in-meeting');
4876
+ });
4877
+
4878
+ it('prioritizes meetingJoinPhase from options over meeting callStateForMetrics', async () => {
4879
+ // meetingId means in-meeting
4880
+ const options = {
4881
+ meetingId: fakeMeeting6.id,
4882
+ meetingJoinPhase: 'join',
4883
+ };
4884
+
4885
+ const fetchOptions = await cd.buildClientEventFetchRequestOptions({
4886
+ name: 'client.exit.app',
4887
+ payload: {trigger: 'user-interaction', canProceed: false},
4888
+ options,
4889
+ });
4890
+
4891
+ assert.equal(
4892
+ fetchOptions.body.metrics[0].eventPayload.event.meetingJoinPhase,
4893
+ options.meetingJoinPhase
4894
+ );
4895
+ });
4896
+
4897
+ it('defaults meetingJoinPhase to pre-join during prejoin when not provided in options', async () => {
4898
+ // correlationId and no meeting id means prejoin
4899
+ const options = {
4900
+ correlationId: 'myCorrelationId',
4901
+ preLoginId: 'myPreLoginId',
4902
+ };
4903
+
4904
+ const fetchOptions = await cd.buildClientEventFetchRequestOptions({
4905
+ name: 'client.exit.app',
4906
+ payload: {trigger: 'user-interaction', canProceed: false},
4907
+ options,
4908
+ });
4909
+
4910
+ assert.equal(fetchOptions.body.metrics[0].eventPayload.event.meetingJoinPhase, 'pre-join');
4911
+ });
4912
+
4738
4913
  it('builds request options before webex is ready (no meetings plugin or internal metrics config)', async () => {
4739
4914
  // before webex.ready the meetings plugin and internal metrics config are not available
4740
4915
  webex.meetings = undefined;