@webex/internal-plugin-metrics 3.12.0-next.30 → 3.12.0-next.32

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.
@@ -55,6 +55,14 @@ export default class CallDiagnosticMetrics extends StatelessWebexPlugin {
55
55
  * @returns one of 'login-ci','unverified-guest', null
56
56
  */
57
57
  getCurLoginType(): "unverified-guest" | "login-ci";
58
+ /**
59
+ * Returns the user activation state reported from the browser's navigator.userActivation API
60
+ * @returns object with hasBeenActive and isActive booleans, or undefined if unavailable
61
+ */
62
+ getUserActivation(): {
63
+ hasBeenActive: boolean;
64
+ isActive: boolean;
65
+ } | undefined;
58
66
  /**
59
67
  * Returns the telemetryOptOut value of the current user
60
68
  * @returns one of 'manual', 'automatic', undefined
@@ -131,9 +139,17 @@ export default class CallDiagnosticMetrics extends StatelessWebexPlugin {
131
139
  clientVersionStatus?: "CURRENT" | "LEGACY" | "UNSUPPORTED";
132
140
  localClientVersion?: string;
133
141
  launcherVersion?: string;
142
+ installerVersion?: string;
143
+ installerMajorVersion?: number;
144
+ installerMinorVersion?: number;
145
+ installerRevision?: number;
134
146
  modelNumber?: string;
135
147
  joinFirstUpdateLater?: "ep-enabled" | "sp-enabled" | "not-enabled";
136
148
  standbyUsed?: boolean;
149
+ /**
150
+ * Sets the manual telemetry opt-out status for the current user
151
+ * @param value - boolean value indicating manual telemetry opt-out status
152
+ */
137
153
  prefetchDocShowUsed?: boolean;
138
154
  fastJoinUsed?: boolean;
139
155
  clientDownloadSize?: number;
@@ -177,6 +193,14 @@ export default class CallDiagnosticMetrics extends StatelessWebexPlugin {
177
193
  preInstalledVersion?: string;
178
194
  additionalProperties?: never;
179
195
  };
196
+ installerInfo?: {
197
+ packageSuffix?: string;
198
+ packageArch?: string;
199
+ launchId?: string;
200
+ packageCount?: number;
201
+ totalSize?: number;
202
+ additionalProperties?: never;
203
+ };
180
204
  emmVendorId?: string;
181
205
  isHybridMedia?: boolean;
182
206
  originData?: {};
@@ -194,6 +218,7 @@ export default class CallDiagnosticMetrics extends StatelessWebexPlugin {
194
218
  participantId?: string;
195
219
  breakoutGroupId?: string;
196
220
  breakoutMoveId?: string;
221
+ breakoutTrackingId?: string;
197
222
  breakoutSessionId?: string;
198
223
  browserId?: string;
199
224
  ciExchangeTokenUrl?: string;
@@ -240,6 +265,7 @@ export default class CallDiagnosticMetrics extends StatelessWebexPlugin {
240
265
  msteamsTenantGuid?: string;
241
266
  msteamsConferenceId?: string;
242
267
  msteamsMeetingId?: string;
268
+ mtid?: string;
243
269
  oauth2ClientId?: string;
244
270
  orgId?: string;
245
271
  provisionalCorrelationId?: string;
@@ -285,6 +311,7 @@ export default class CallDiagnosticMetrics extends StatelessWebexPlugin {
285
311
  participantId?: string;
286
312
  breakoutGroupId?: string;
287
313
  breakoutMoveId?: string;
314
+ breakoutTrackingId?: string;
288
315
  breakoutSessionId?: string;
289
316
  browserId?: string;
290
317
  ciExchangeTokenUrl?: string;
@@ -331,6 +358,7 @@ export default class CallDiagnosticMetrics extends StatelessWebexPlugin {
331
358
  msteamsTenantGuid?: string;
332
359
  msteamsConferenceId?: string;
333
360
  msteamsMeetingId?: string;
361
+ mtid?: string;
334
362
  oauth2ClientId?: string;
335
363
  orgId?: string;
336
364
  provisionalCorrelationId?: string;
@@ -376,6 +404,7 @@ export default class CallDiagnosticMetrics extends StatelessWebexPlugin {
376
404
  participantId?: string;
377
405
  breakoutGroupId?: string;
378
406
  breakoutMoveId?: string;
407
+ breakoutTrackingId?: string;
379
408
  breakoutSessionId?: string;
380
409
  browserId?: string;
381
410
  ciExchangeTokenUrl?: string;
@@ -422,6 +451,7 @@ export default class CallDiagnosticMetrics extends StatelessWebexPlugin {
422
451
  msteamsTenantGuid?: string;
423
452
  msteamsConferenceId?: string;
424
453
  msteamsMeetingId?: string;
454
+ mtid?: string;
425
455
  oauth2ClientId?: string;
426
456
  orgId?: string;
427
457
  provisionalCorrelationId?: string;
@@ -631,7 +661,6 @@ export default class CallDiagnosticMetrics extends StatelessWebexPlugin {
631
661
  * Prepare the event and send the request to metrics-a service, pre login.
632
662
  * @param event
633
663
  * @param preLoginId
634
- * @param markTelemetryOptOutOnResponse
635
664
  * @returns
636
665
  */
637
666
  submitToCallDiagnosticsPreLogin: (event: Event, preLoginId?: string) => Promise<any>;
package/package.json CHANGED
@@ -37,10 +37,10 @@
37
37
  "dependencies": {
38
38
  "@webex/common": "3.12.0-next.5",
39
39
  "@webex/common-timers": "3.12.0-next.5",
40
- "@webex/event-dictionary-ts": "^1.0.2191",
40
+ "@webex/event-dictionary-ts": "^1.0.2215",
41
41
  "@webex/test-helper-chai": "3.12.0-next.5",
42
42
  "@webex/test-helper-mock-webex": "3.12.0-next.5",
43
- "@webex/webex-core": "3.12.0-next.30",
43
+ "@webex/webex-core": "3.12.0-next.32",
44
44
  "ip-anonymize": "^0.1.0",
45
45
  "lodash": "^4.17.21",
46
46
  "uuid": "^3.3.2"
@@ -53,5 +53,5 @@
53
53
  "test:style": "eslint ./src/**/*.*",
54
54
  "test:unit": "webex-legacy-tools test --unit --runner mocha"
55
55
  },
56
- "version": "3.12.0-next.30"
56
+ "version": "3.12.0-next.32"
57
57
  }
@@ -55,8 +55,6 @@ const CallDiagnosticEventsBatcher = Batcher.extend({
55
55
  `CallDiagnosticEventsBatcher: @submitHttpRequest#${batchId}. Request successful.`
56
56
  );
57
57
 
58
- this.handleHttpResponseStatus(res?.statusCode, payload);
59
-
60
58
  return res;
61
59
  })
62
60
  .catch((err) => {
@@ -66,33 +64,9 @@ const CallDiagnosticEventsBatcher = Batcher.extend({
66
64
  `error: ${generateCommonErrorMetadata(err)}`
67
65
  );
68
66
 
69
- this.handleHttpResponseStatus(err?.statusCode, payload);
70
-
71
67
  return Promise.reject(err);
72
68
  });
73
69
  },
74
-
75
- /**
76
- * React to the HTTP status code returned by the metrics endpoint.
77
- * Only items submitted with `markTelemetryOptOutOnResponse: true` opt into
78
- * this behavior.
79
- * @param {number | undefined} statusCode
80
- * @param {any[]} payload Items flushed in this HTTP batch.
81
- * @returns {void}
82
- */
83
- handleHttpResponseStatus(statusCode: number | undefined, payload: any[]) {
84
- const shouldMark =
85
- Array.isArray(payload) &&
86
- payload.some((item) => item?.markTelemetryOptOutOnResponse === true);
87
-
88
- if (!shouldMark) {
89
- return;
90
- }
91
-
92
- if (statusCode === 200) {
93
- this.webex.internal.newMetrics?.callDiagnosticMetrics?.setIsTelemetryOptOutAutomatic(true);
94
- }
95
- },
96
70
  });
97
71
 
98
72
  export default CallDiagnosticEventsBatcher;
@@ -147,6 +147,27 @@ export default class CallDiagnosticMetrics extends StatelessWebexPlugin {
147
147
  return null;
148
148
  }
149
149
 
150
+ /**
151
+ * Returns the user activation state reported from the browser's navigator.userActivation API
152
+ * @returns object with hasBeenActive and isActive booleans, or undefined if unavailable
153
+ */
154
+ getUserActivation(): {hasBeenActive: boolean; isActive: boolean} | undefined {
155
+ const userActivation =
156
+ typeof navigator !== 'undefined'
157
+ ? (navigator as {userActivation?: {hasBeenActive: boolean; isActive: boolean}})
158
+ .userActivation
159
+ : undefined;
160
+
161
+ if (userActivation) {
162
+ return {
163
+ hasBeenActive: userActivation.hasBeenActive,
164
+ isActive: userActivation.isActive,
165
+ };
166
+ }
167
+
168
+ return undefined;
169
+ }
170
+
150
171
  /**
151
172
  * Returns the telemetryOptOut value of the current user
152
173
  * @returns one of 'manual', 'automatic', undefined
@@ -1048,6 +1069,7 @@ export default class CallDiagnosticMetrics extends StatelessWebexPlugin {
1048
1069
  isVipMeeting: meeting?.meetingInfo?.vipmeeting || false,
1049
1070
  isAutomatedUser:
1050
1071
  typeof window !== 'undefined' && typeof navigator !== 'undefined' && !!navigator?.webdriver, // if webdriver is true, it's most likely in a test environment
1072
+ userActivation: this.getUserActivation(),
1051
1073
  };
1052
1074
 
1053
1075
  const joinFlowVersion = options.joinFlowVersion ?? meeting.callStateForMetrics?.joinFlowVersion;
@@ -1172,6 +1194,7 @@ export default class CallDiagnosticMetrics extends StatelessWebexPlugin {
1172
1194
  webClientPreload: this.webex.meetings?.config?.metrics?.webClientPreload,
1173
1195
  isAutomatedUser:
1174
1196
  typeof window !== 'undefined' && typeof navigator !== 'undefined' && !!navigator?.webdriver, // if webdriver is true, it's most likely in a test environment
1197
+ userActivation: this.getUserActivation(),
1175
1198
  };
1176
1199
 
1177
1200
  if (options.joinFlowVersion) {
@@ -1364,7 +1387,6 @@ export default class CallDiagnosticMetrics extends StatelessWebexPlugin {
1364
1387
  const finalEvent = {
1365
1388
  eventPayload: event,
1366
1389
  type: ['diagnostic-event'],
1367
- markTelemetryOptOutOnResponse: true,
1368
1390
  };
1369
1391
 
1370
1392
  return this.callDiagnosticEventsBatcher.request(finalEvent);
@@ -1374,7 +1396,6 @@ export default class CallDiagnosticMetrics extends StatelessWebexPlugin {
1374
1396
  * Prepare the event and send the request to metrics-a service, pre login.
1375
1397
  * @param event
1376
1398
  * @param preLoginId
1377
- * @param markTelemetryOptOutOnResponse
1378
1399
  * @returns
1379
1400
  */
1380
1401
  submitToCallDiagnosticsPreLogin = (event: Event, preLoginId?: string): Promise<any> => {
@@ -1382,7 +1403,6 @@ export default class CallDiagnosticMetrics extends StatelessWebexPlugin {
1382
1403
  const finalEvent = {
1383
1404
  eventPayload: event,
1384
1405
  type: ['diagnostic-event'],
1385
- markTelemetryOptOutOnResponse: true,
1386
1406
  };
1387
1407
 
1388
1408
  this.preLoginMetricsBatcher.savePreLoginId(preLoginId);
@@ -78,8 +78,6 @@ const PreLoginMetricsBatcher = Batcher.extend({
78
78
  `PreLoginMetricsBatcher: @submitHttpRequest#${batchId}. Request successful.`
79
79
  );
80
80
 
81
- this.handleHttpResponseStatus(res?.statusCode, payload);
82
-
83
81
  return res;
84
82
  })
85
83
  .catch((err) => {
@@ -89,33 +87,9 @@ const PreLoginMetricsBatcher = Batcher.extend({
89
87
  `error: ${generateCommonErrorMetadata(err)}`
90
88
  );
91
89
 
92
- this.handleHttpResponseStatus(err?.statusCode, payload);
93
-
94
90
  return Promise.reject(err);
95
91
  });
96
92
  },
97
-
98
- /**
99
- * React to the HTTP status code returned by the prelogin metrics endpoint.
100
- * Only items submitted with `markTelemetryOptOutOnResponse: true` opt into
101
- * this behavior.
102
- * @param {number | undefined} statusCode
103
- * @param {any[]} payload Items flushed in this HTTP batch.
104
- * @returns {void}
105
- */
106
- handleHttpResponseStatus(statusCode: number | undefined, payload: any[]) {
107
- const shouldMark =
108
- Array.isArray(payload) &&
109
- payload.some((item) => item?.markTelemetryOptOutOnResponse === true);
110
-
111
- if (!shouldMark) {
112
- return;
113
- }
114
-
115
- if (statusCode === 200) {
116
- this.webex.internal.newMetrics?.callDiagnosticMetrics?.setIsTelemetryOptOutAutomatic(true);
117
- }
118
- },
119
93
  });
120
94
 
121
95
  export default PreLoginMetricsBatcher;
@@ -516,141 +516,5 @@ describe('plugin-metrics', () => {
516
516
  assert.deepEqual(prepareDiagnosticMetricItemCalls[0].args[1].type, ['diagnostic-event']);
517
517
  });
518
518
  });
519
-
520
- describe('#submitHttpRequest', () => {
521
- it('calls handleHttpResponseStatus with response status on success', async () => {
522
- const payload = [
523
- {
524
- eventPayload: {event: 'my.event'},
525
- type: ['diagnostic-event'],
526
- },
527
- ];
528
-
529
- webex.request = sinon.stub().resolves({statusCode: 200});
530
-
531
- const handleHttpResponseStatusSpy = sinon.spy(
532
- webex.internal.newMetrics.callDiagnosticMetrics.callDiagnosticEventsBatcher,
533
- 'handleHttpResponseStatus'
534
- );
535
-
536
- const promise =
537
- webex.internal.newMetrics.callDiagnosticMetrics.callDiagnosticEventsBatcher.submitHttpRequest(
538
- payload
539
- );
540
-
541
- assert.deepEqual(handleHttpResponseStatusSpy.getCalls().length, 0);
542
-
543
- await flushPromises();
544
- clock.tick(config.metrics.batcherWait);
545
-
546
- await promise;
547
-
548
- assert.calledOnce(webex.request);
549
- assert.deepEqual(handleHttpResponseStatusSpy.getCalls().length, 1);
550
- assert.deepEqual(handleHttpResponseStatusSpy.args[0][0], 200);
551
- assert.deepEqual(handleHttpResponseStatusSpy.args[0][1], payload);
552
- });
553
-
554
- it('calls handleHttpResponseStatus with error status on failure', async () => {
555
- const payload = [
556
- {
557
- eventPayload: {event: 'my.event'},
558
- type: ['diagnostic-event'],
559
- },
560
- ];
561
-
562
- webex.request = sinon.stub().rejects({statusCode: 503});
563
-
564
- const handleHttpResponseStatusSpy = sinon.spy(
565
- webex.internal.newMetrics.callDiagnosticMetrics.callDiagnosticEventsBatcher,
566
- 'handleHttpResponseStatus'
567
- );
568
-
569
- const promise =
570
- webex.internal.newMetrics.callDiagnosticMetrics.callDiagnosticEventsBatcher.submitHttpRequest(
571
- payload
572
- );
573
-
574
- assert.deepEqual(handleHttpResponseStatusSpy.getCalls().length, 0);
575
-
576
- await flushPromises();
577
- clock.tick(config.metrics.batcherWait);
578
-
579
- let error: any;
580
-
581
- try {
582
- await promise;
583
- } catch (err) {
584
- error = err;
585
- }
586
-
587
- assert.deepEqual(error.statusCode, 503);
588
- assert.calledOnce(webex.request);
589
- assert.deepEqual(handleHttpResponseStatusSpy.getCalls().length, 1);
590
- assert.deepEqual(handleHttpResponseStatusSpy.args[0][0], 503);
591
- assert.deepEqual(handleHttpResponseStatusSpy.args[0][1], payload);
592
- });
593
- });
594
-
595
- describe('#handleHttpResponseStatus', () => {
596
- let setIsTelemetryOptOutAutomaticStub;
597
-
598
- beforeEach(() => {
599
- setIsTelemetryOptOutAutomaticStub = sinon.stub(
600
- webex.internal.newMetrics.callDiagnosticMetrics,
601
- 'setIsTelemetryOptOutAutomatic'
602
- );
603
- });
604
-
605
- [201, 400, 503, undefined].forEach((statusCode) => {
606
- it(`does not call setIsTelemetryOptOutAutomatic() when statusCode is ${statusCode} and markTelemetryOptOutOnResponse is true`, () => {
607
- webex.internal.newMetrics.callDiagnosticMetrics.callDiagnosticEventsBatcher.handleHttpResponseStatus(
608
- statusCode,
609
- [{markTelemetryOptOutOnResponse: true}]
610
- );
611
-
612
- assert.notCalled(setIsTelemetryOptOutAutomaticStub);
613
- });
614
- });
615
-
616
- it('calls setIsTelemetryOptOutAutomatic(true) when statusCode is 200 and markTelemetryOptOutOnResponse is true', () => {
617
- webex.internal.newMetrics.callDiagnosticMetrics.callDiagnosticEventsBatcher.handleHttpResponseStatus(
618
- 200,
619
- [{markTelemetryOptOutOnResponse: true}]
620
- );
621
-
622
- assert.calledOnce(setIsTelemetryOptOutAutomaticStub);
623
- assert.calledWithExactly(setIsTelemetryOptOutAutomaticStub, true);
624
- });
625
-
626
- [200, 201, 400, 503, undefined].forEach((statusCode) => {
627
- it(`does not call setIsTelemetryOptOutAutomatic when shouldMark is false (statusCode: ${statusCode})`, () => {
628
- webex.internal.newMetrics.callDiagnosticMetrics.callDiagnosticEventsBatcher.handleHttpResponseStatus(
629
- statusCode,
630
- [{markTelemetryOptOutOnResponse: false}]
631
- );
632
-
633
- assert.notCalled(setIsTelemetryOptOutAutomaticStub);
634
- });
635
- });
636
-
637
- it('does not call setIsTelemetryOptOutAutomatic when payload is empty', () => {
638
- webex.internal.newMetrics.callDiagnosticMetrics.callDiagnosticEventsBatcher.handleHttpResponseStatus(
639
- 200,
640
- []
641
- );
642
-
643
- assert.notCalled(setIsTelemetryOptOutAutomaticStub);
644
- });
645
-
646
- it('does not call setIsTelemetryOptOutAutomatic when payload is not an array', () => {
647
- webex.internal.newMetrics.callDiagnosticMetrics.callDiagnosticEventsBatcher.handleHttpResponseStatus(
648
- 200,
649
- null
650
- );
651
-
652
- assert.notCalled(setIsTelemetryOptOutAutomaticStub);
653
- });
654
- });
655
519
  });
656
520
  });