@webex/internal-plugin-metrics 3.12.0-webex-services-ready.4 → 3.13.0

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 (77) hide show
  1. package/.repo-context.json +466 -0
  2. package/.sdd/manifest.json +626 -0
  3. package/AGENTS.md +208 -0
  4. package/README.md +274 -0
  5. package/dist/call-diagnostic/call-diagnostic-metrics.js +155 -94
  6. package/dist/call-diagnostic/call-diagnostic-metrics.js.map +1 -1
  7. package/dist/call-diagnostic/config.js +3 -1
  8. package/dist/call-diagnostic/config.js.map +1 -1
  9. package/dist/config.js +7 -0
  10. package/dist/config.js.map +1 -1
  11. package/dist/index.js +10 -1
  12. package/dist/index.js.map +1 -1
  13. package/dist/metrics.js +118 -5
  14. package/dist/metrics.js.map +1 -1
  15. package/dist/metrics.types.js.map +1 -1
  16. package/dist/network-telemetry.js +610 -0
  17. package/dist/network-telemetry.js.map +1 -0
  18. package/dist/new-metrics.js +47 -11
  19. package/dist/new-metrics.js.map +1 -1
  20. package/dist/privacy-and-security-permission-enricher/constants.js +18 -0
  21. package/dist/privacy-and-security-permission-enricher/constants.js.map +1 -0
  22. package/dist/privacy-and-security-permission-enricher/index.js +143 -0
  23. package/dist/privacy-and-security-permission-enricher/index.js.map +1 -0
  24. package/dist/privacy-and-security-permission-enricher/types.js +7 -0
  25. package/dist/privacy-and-security-permission-enricher/types.js.map +1 -0
  26. package/dist/privacy-and-security-permission-enricher/utils.js +71 -0
  27. package/dist/privacy-and-security-permission-enricher/utils.js.map +1 -0
  28. package/dist/types/call-diagnostic/call-diagnostic-metrics.d.ts +12 -3
  29. package/dist/types/call-diagnostic/config.d.ts +2 -0
  30. package/dist/types/config.d.ts +8 -0
  31. package/dist/types/index.d.ts +2 -2
  32. package/dist/types/metrics.types.d.ts +7 -3
  33. package/dist/types/network-telemetry.d.ts +108 -0
  34. package/dist/types/new-metrics.d.ts +13 -1
  35. package/dist/types/privacy-and-security-permission-enricher/constants.d.ts +6 -0
  36. package/dist/types/privacy-and-security-permission-enricher/index.d.ts +40 -0
  37. package/dist/types/privacy-and-security-permission-enricher/types.d.ts +14 -0
  38. package/dist/types/privacy-and-security-permission-enricher/utils.d.ts +5 -0
  39. package/dist/types/unhandled-exception-telemetry/index.d.ts +60 -0
  40. package/dist/types/unhandled-exception-telemetry/utils.d.ts +6 -0
  41. package/dist/unhandled-exception-telemetry/index.js +331 -0
  42. package/dist/unhandled-exception-telemetry/index.js.map +1 -0
  43. package/dist/unhandled-exception-telemetry/utils.js +105 -0
  44. package/dist/unhandled-exception-telemetry/utils.js.map +1 -0
  45. package/docs/adr/index.md +27 -0
  46. package/docs/architecture.md +437 -0
  47. package/docs/getting-started.md +131 -0
  48. package/docs/index.md +52 -0
  49. package/docs/specs/README.md +88 -0
  50. package/package.json +11 -11
  51. package/schemas/repo-context.schema.json +796 -0
  52. package/src/call-diagnostic/call-diagnostic-metrics.ts +100 -30
  53. package/src/call-diagnostic/config.ts +2 -0
  54. package/src/call-diagnostic/docs/README.md +535 -0
  55. package/src/config.js +7 -0
  56. package/src/docs/README.md +703 -0
  57. package/src/index.ts +11 -0
  58. package/src/metrics.js +123 -5
  59. package/src/metrics.types.ts +13 -3
  60. package/src/network-telemetry.ts +757 -0
  61. package/src/new-metrics.ts +44 -2
  62. package/src/privacy-and-security-permission-enricher/constants.ts +33 -0
  63. package/src/privacy-and-security-permission-enricher/docs/README.md +356 -0
  64. package/src/privacy-and-security-permission-enricher/index.ts +142 -0
  65. package/src/privacy-and-security-permission-enricher/types.ts +21 -0
  66. package/src/privacy-and-security-permission-enricher/utils.ts +82 -0
  67. package/src/rtcMetrics/docs/README.md +447 -0
  68. package/src/unhandled-exception-telemetry/docs/README.md +536 -0
  69. package/src/unhandled-exception-telemetry/index.ts +404 -0
  70. package/src/unhandled-exception-telemetry/utils.ts +101 -0
  71. package/test/unit/spec/call-diagnostic/call-diagnostic-metrics.ts +485 -21
  72. package/test/unit/spec/metrics.js +14 -5
  73. package/test/unit/spec/network-telemetry.ts +610 -0
  74. package/test/unit/spec/new-metrics.ts +190 -48
  75. package/test/unit/spec/privacy-and-security-permission-enricher.ts +318 -0
  76. package/test/unit/spec/unhandled-exception-telemetry/utils.ts +109 -0
  77. package/test/unit/spec/unhandled-exception-telemetry.ts +689 -0
@@ -49,6 +49,10 @@ var _BrowserDetection = (0, _common.BrowserDetection)(),
49
49
  getOSVersion = _BrowserDetection.getOSVersion,
50
50
  getBrowserName = _BrowserDetection.getBrowserName,
51
51
  getBrowserVersion = _BrowserDetection.getBrowserVersion;
52
+ var LOCUS_HTTP_STATUS_TO_CLIENT_ERROR_CODE = {
53
+ 429: _config2.LOCUS_RATE_LIMITED_OUTGOING_CLIENT_CODE,
54
+ 503: _config2.LOCUS_UNAVAILABLE_CLIENT_CODE
55
+ };
52
56
  /**
53
57
  * @description Util class to handle Call Analyzer Metrics
54
58
  * @export
@@ -266,7 +270,7 @@ var CallDiagnosticMetrics = exports.default = /*#__PURE__*/function (_StatelessW
266
270
  }, {
267
271
  key: "getOrigin",
268
272
  value: function getOrigin(options, meetingId) {
269
- var _this$webex$meetings, _this$webex$meetings$, _this$webex$meetings$2, _this$webex$meetings2, _this$webex$meetings3, _this$webex$meetings4, _this$webex$meetings5, _this$webex$meetings6, _this$webex$meetings7;
273
+ var _this$webex$meetings, _this$webex$meetings$, _this$webex$meetings$2, _this$webex$meetings2, _this$webex$meetings3, _this$webex$meetings4, _this$webex$meetings5, _this$webex$meetings6, _this$webex$meetings7, _this$webex$meetings$3, _this$webex$meetings8, _this$webex$meetings9;
270
274
  var defaultClientType = // @ts-ignore
271
275
  (_this$webex$meetings = this.webex.meetings) === null || _this$webex$meetings === void 0 ? void 0 : (_this$webex$meetings$ = _this$webex$meetings.config) === null || _this$webex$meetings$ === void 0 ? void 0 : (_this$webex$meetings$2 = _this$webex$meetings$.metrics) === null || _this$webex$meetings$2 === void 0 ? void 0 : _this$webex$meetings$2.clientType;
272
276
  var defaultSubClientType = // @ts-ignore
@@ -281,40 +285,55 @@ var CallDiagnosticMetrics = exports.default = /*#__PURE__*/function (_StatelessW
281
285
  if (providedClientVersion) {
282
286
  versionMetadata = (0, _callDiagnosticMetrics.extractVersionMetadata)(providedClientVersion);
283
287
  }
288
+
289
+ // Browser details and the support verdict can all be supplied by the host client, which is able
290
+ // to resolve wrapper browsers (Electron, WebOS) to the engine that actually determines
291
+ // capability. The browser fields fall back to the SDK's own detection when not supplied, the
292
+ // same way clientVersion falls back to the SDK version.
293
+ var _ref2 = (_this$webex$meetings$3 = (_this$webex$meetings8 = this.webex.meetings) === null || _this$webex$meetings8 === void 0 ? void 0 : (_this$webex$meetings9 = _this$webex$meetings8.config) === null || _this$webex$meetings9 === void 0 ? void 0 : _this$webex$meetings9.metrics) !== null && _this$webex$meetings$3 !== void 0 ? _this$webex$meetings$3 : {},
294
+ providedBrowser = _ref2.browser,
295
+ providedBrowserVersion = _ref2.browserVersion,
296
+ isSupportedBrowserFamily = _ref2.isSupportedBrowserFamily,
297
+ isOutdatedBrowserVersion = _ref2.isOutdatedBrowserVersion;
284
298
  if (!this.hasLoggedBrowserSerial) {
285
299
  this.logger.log(_config2.CALL_DIAGNOSTIC_LOG_IDENTIFIER, "CallDiagnosticMetrics: @createClientEventObjectInMeeting => collected browser data", (0, _stringify.default)((0, _common.getBrowserSerial)()));
286
300
  this.hasLoggedBrowserSerial = true;
287
301
  }
288
302
  if (defaultClientType && defaultSubClientType || options.clientType && options.subClientType) {
289
- var _this$webex$meetings8, _this$webex$meetings9, _this$webex$meetings0, _this$webex$meetings1, _this$webex$meetings10, _this$webex$meetings11, _this$webex$meetings12, _this$webex$meetings13, _this$webex$meetings14;
303
+ var _this$webex$meetings0, _this$webex$meetings1, _this$webex$meetings10, _this$webex$meetings11, _this$webex$meetings12, _this$webex$meetings13, _this$webex$meetings14, _this$webex$meetings15, _this$webex$meetings16;
290
304
  var origin = {
291
305
  name: 'endpoint',
292
306
  networkType: (options === null || options === void 0 ? void 0 : options.networkType) || 'unknown',
293
307
  userAgent: (0, _callDiagnosticMetrics.userAgentToString)({
294
308
  // @ts-ignore
295
- clientName: (_this$webex$meetings8 = this.webex.meetings) === null || _this$webex$meetings8 === void 0 ? void 0 : (_this$webex$meetings9 = _this$webex$meetings8.config) === null || _this$webex$meetings9 === void 0 ? void 0 : (_this$webex$meetings0 = _this$webex$meetings9.metrics) === null || _this$webex$meetings0 === void 0 ? void 0 : _this$webex$meetings0.clientName,
309
+ clientName: (_this$webex$meetings0 = this.webex.meetings) === null || _this$webex$meetings0 === void 0 ? void 0 : (_this$webex$meetings1 = _this$webex$meetings0.config) === null || _this$webex$meetings1 === void 0 ? void 0 : (_this$webex$meetings10 = _this$webex$meetings1.metrics) === null || _this$webex$meetings10 === void 0 ? void 0 : _this$webex$meetings10.clientName,
296
310
  // @ts-ignore
297
311
  webexVersion: this.webex.version
298
312
  }),
299
- clientInfo: _objectSpread(_objectSpread({
313
+ clientInfo: _objectSpread(_objectSpread(_objectSpread({
300
314
  clientType: (options === null || options === void 0 ? void 0 : options.clientType) || defaultClientType,
301
315
  clientVersion: providedClientVersion || defaultSDKClientVersion
302
316
  }, versionMetadata), {}, {
303
317
  publicNetworkPrefix:
304
318
  // @ts-ignore
305
- (0, _callDiagnosticMetrics.anonymizeIPAddress)((_this$webex$meetings1 = this.webex.meetings) === null || _this$webex$meetings1 === void 0 ? void 0 : (_this$webex$meetings10 = _this$webex$meetings1.geoHintInfo) === null || _this$webex$meetings10 === void 0 ? void 0 : _this$webex$meetings10.clientAddress) || undefined,
319
+ (0, _callDiagnosticMetrics.anonymizeIPAddress)((_this$webex$meetings11 = this.webex.meetings) === null || _this$webex$meetings11 === void 0 ? void 0 : (_this$webex$meetings12 = _this$webex$meetings11.geoHintInfo) === null || _this$webex$meetings12 === void 0 ? void 0 : _this$webex$meetings12.clientAddress) || undefined,
306
320
  localNetworkPrefix: (0, _callDiagnosticMetrics.anonymizeIPAddress)(// @ts-ignore
307
- (_this$webex$meetings11 = this.webex.meetings) === null || _this$webex$meetings11 === void 0 ? void 0 : (_this$webex$meetings12 = _this$webex$meetings11.meetingCollection) === null || _this$webex$meetings12 === void 0 ? void 0 : (_this$webex$meetings13 = _this$webex$meetings12.get(meetingId)) === null || _this$webex$meetings13 === void 0 ? void 0 : (_this$webex$meetings14 = _this$webex$meetings13.statsAnalyzer) === null || _this$webex$meetings14 === void 0 ? void 0 : _this$webex$meetings14.getLocalIpAddress()) || undefined,
321
+ (_this$webex$meetings13 = this.webex.meetings) === null || _this$webex$meetings13 === void 0 ? void 0 : (_this$webex$meetings14 = _this$webex$meetings13.meetingCollection) === null || _this$webex$meetings14 === void 0 ? void 0 : (_this$webex$meetings15 = _this$webex$meetings14.get(meetingId)) === null || _this$webex$meetings15 === void 0 ? void 0 : (_this$webex$meetings16 = _this$webex$meetings15.statsAnalyzer) === null || _this$webex$meetings16 === void 0 ? void 0 : _this$webex$meetings16.getLocalIpAddress()) || undefined,
308
322
  osVersion: getOSVersion() || 'unknown',
309
323
  subClientType: (options === null || options === void 0 ? void 0 : options.subClientType) || defaultSubClientType,
310
324
  os: (0, _metrics.getOSNameInternal)(),
311
- browser: getBrowserName(),
312
- browserVersion: getBrowserVersion()
325
+ browser: providedBrowser || getBrowserName(),
326
+ browserVersion: providedBrowserVersion || getBrowserVersion()
327
+ }, isSupportedBrowserFamily === undefined ? {} : {
328
+ isSupportedBrowserFamily: isSupportedBrowserFamily
329
+ }), isOutdatedBrowserVersion === undefined ? {} : {
330
+ isOutdatedBrowserVersion: isOutdatedBrowserVersion
313
331
  })
314
332
  };
315
333
  if (meetingId) {
334
+ var _this$webex$meetings17;
316
335
  // @ts-ignore
317
- var meeting = this.webex.meetings.getBasicMeetingInformation(meetingId);
336
+ var meeting = (_this$webex$meetings17 = this.webex.meetings) === null || _this$webex$meetings17 === void 0 ? void 0 : _this$webex$meetings17.getBasicMeetingInformation(meetingId);
318
337
  if (meeting !== null && meeting !== void 0 && meeting.environment) {
319
338
  origin.environment = meeting.environment;
320
339
  }
@@ -339,6 +358,22 @@ var CallDiagnosticMetrics = exports.default = /*#__PURE__*/function (_StatelessW
339
358
  throw new Error("ClientType and SubClientType can't be undefined");
340
359
  }
341
360
 
361
+ /**
362
+ * Returns the signed-in user's CI ID derived from credentials tokens.
363
+ * Used as a fallback when no device is registered.
364
+ * @returns the userId, or undefined if it can't be determined
365
+ */
366
+ }, {
367
+ key: "getUserIdFromCredentials",
368
+ value: function getUserIdFromCredentials() {
369
+ try {
370
+ // @ts-ignore
371
+ return this.webex.credentials.getUserId();
372
+ } catch (_unused) {
373
+ return undefined;
374
+ }
375
+ }
376
+
342
377
  /**
343
378
  * Gather identifier details for call diagnostic payload.
344
379
  * @throws Error if initialization fails.
@@ -347,14 +382,15 @@ var CallDiagnosticMetrics = exports.default = /*#__PURE__*/function (_StatelessW
347
382
  }, {
348
383
  key: "getIdentifiers",
349
384
  value: function getIdentifiers(options) {
350
- var _meeting$locusInfo, _meeting$meetingInfo2, _meeting$meetingInfo3, _meeting$meetingInfo6, _meeting$meetingInfo8;
385
+ var _this$device, _meeting$locusInfo, _meeting$meetingInfo2, _meeting$meetingInfo3, _meeting$meetingInfo6, _meeting$meetingInfo8, _meeting$meetingInfo0;
351
386
  var meeting = options.meeting,
352
387
  mediaConnections = options.mediaConnections,
353
388
  correlationId = options.correlationId,
354
389
  webexConferenceIdStr = options.webexConferenceIdStr,
355
390
  globalMeetingId = options.globalMeetingId,
356
391
  preLoginId = options.preLoginId,
357
- sessionCorrelationId = options.sessionCorrelationId;
392
+ sessionCorrelationId = options.sessionCorrelationId,
393
+ locusCluster = options.locusCluster;
358
394
  var identifiers = {
359
395
  correlationId: 'unknown' // concerned with setting this to unknown. This will fail diagnostic events parsing because it's not a uuid pattern
360
396
  };
@@ -378,9 +414,8 @@ var CallDiagnosticMetrics = exports.default = /*#__PURE__*/function (_StatelessW
378
414
 
379
415
  if (this.device) {
380
416
  var device = this.device;
381
- var _ref2 = (device === null || device === void 0 ? void 0 : device.config) || {},
382
- installationId = _ref2.installationId;
383
- identifiers.userId = (device === null || device === void 0 ? void 0 : device.userId) || preLoginId;
417
+ var _ref3 = (device === null || device === void 0 ? void 0 : device.config) || {},
418
+ installationId = _ref3.installationId;
384
419
  identifiers.deviceId = device === null || device === void 0 ? void 0 : device.url;
385
420
  identifiers.orgId = device === null || device === void 0 ? void 0 : device.orgId;
386
421
  // @ts-ignore
@@ -389,6 +424,10 @@ var CallDiagnosticMetrics = exports.default = /*#__PURE__*/function (_StatelessW
389
424
  identifiers.machineId = installationId;
390
425
  }
391
426
  }
427
+
428
+ // Prefer the device's userId, but fall back to the signed-in user's ID from
429
+ // credentials when no device is registered, then to the pre-login ID.
430
+ identifiers.userId = ((_this$device = this.device) === null || _this$device === void 0 ? void 0 : _this$device.userId) || this.getUserIdFromCredentials() || preLoginId;
392
431
  if (meeting !== null && meeting !== void 0 && (_meeting$locusInfo = meeting.locusInfo) !== null && _meeting$locusInfo !== void 0 && _meeting$locusInfo.fullState) {
393
432
  identifiers.locusUrl = meeting.locusUrl;
394
433
  identifiers.locusId = meeting.locusUrl && meeting.locusUrl.split('/').pop();
@@ -407,6 +446,9 @@ var CallDiagnosticMetrics = exports.default = /*#__PURE__*/function (_StatelessW
407
446
  var _meeting$meetingInfo9;
408
447
  identifiers.webexSiteName = (_meeting$meetingInfo9 = meeting.meetingInfo) === null || _meeting$meetingInfo9 === void 0 ? void 0 : _meeting$meetingInfo9.siteName;
409
448
  }
449
+ if (meeting !== null && meeting !== void 0 && (_meeting$meetingInfo0 = meeting.meetingInfo) !== null && _meeting$meetingInfo0 !== void 0 && _meeting$meetingInfo0.locusClusterUrl) {
450
+ identifiers.locusCluster = meeting.meetingInfo.locusClusterUrl;
451
+ }
410
452
  if (mediaConnections) {
411
453
  var _mediaConnections$, _mediaConnections$2;
412
454
  identifiers.mediaAgentAlias = mediaConnections === null || mediaConnections === void 0 ? void 0 : (_mediaConnections$ = mediaConnections[0]) === null || _mediaConnections$ === void 0 ? void 0 : _mediaConnections$.mediaAgentAlias;
@@ -418,6 +460,9 @@ var CallDiagnosticMetrics = exports.default = /*#__PURE__*/function (_StatelessW
418
460
  if (!(identifiers !== null && identifiers !== void 0 && identifiers.globalMeetingId) && globalMeetingId) {
419
461
  identifiers.globalMeetingId = globalMeetingId;
420
462
  }
463
+ if (!(identifiers !== null && identifiers !== void 0 && identifiers.locusCluster) && locusCluster) {
464
+ identifiers.locusCluster = locusCluster;
465
+ }
421
466
  if (identifiers.correlationId === undefined) {
422
467
  throw new Error('Identifiers initialization failed.');
423
468
  }
@@ -434,7 +479,7 @@ var CallDiagnosticMetrics = exports.default = /*#__PURE__*/function (_StatelessW
434
479
  }, {
435
480
  key: "prepareDiagnosticEvent",
436
481
  value: function prepareDiagnosticEvent(eventData, options) {
437
- var _this$webex$meetings15, _this$webex$meetings16;
482
+ var _this$webex$meetings18, _this$webex$meetings19;
438
483
  var meetingId = options.meetingId,
439
484
  triggeredTime = options.triggeredTime;
440
485
  var origin = this.getOrigin(options, meetingId);
@@ -448,7 +493,7 @@ var CallDiagnosticMetrics = exports.default = /*#__PURE__*/function (_StatelessW
448
493
  sent: 'not_defined_yet'
449
494
  },
450
495
  // @ts-ignore
451
- senderCountryCode: (_this$webex$meetings15 = this.webex.meetings) === null || _this$webex$meetings15 === void 0 ? void 0 : (_this$webex$meetings16 = _this$webex$meetings15.geoHintInfo) === null || _this$webex$meetings16 === void 0 ? void 0 : _this$webex$meetings16.countryCode,
496
+ senderCountryCode: (_this$webex$meetings18 = this.webex.meetings) === null || _this$webex$meetings18 === void 0 ? void 0 : (_this$webex$meetings19 = _this$webex$meetings18.geoHintInfo) === null || _this$webex$meetings19 === void 0 ? void 0 : _this$webex$meetings19.countryCode,
452
497
  event: eventData
453
498
  };
454
499
 
@@ -470,10 +515,10 @@ var CallDiagnosticMetrics = exports.default = /*#__PURE__*/function (_StatelessW
470
515
  */
471
516
  }, {
472
517
  key: "prepareClientFeatureEvent",
473
- value: function prepareClientFeatureEvent(_ref3) {
474
- var name = _ref3.name,
475
- payload = _ref3.payload,
476
- options = _ref3.options;
518
+ value: function prepareClientFeatureEvent(_ref4) {
519
+ var name = _ref4.name,
520
+ payload = _ref4.payload,
521
+ options = _ref4.options;
477
522
  var meetingId = options.meetingId,
478
523
  correlationId = options.correlationId;
479
524
  var featureEventObject;
@@ -503,11 +548,11 @@ var CallDiagnosticMetrics = exports.default = /*#__PURE__*/function (_StatelessW
503
548
  */
504
549
  }, {
505
550
  key: "submitFeatureEvent",
506
- value: function submitFeatureEvent(_ref4) {
507
- var name = _ref4.name,
508
- payload = _ref4.payload,
509
- options = _ref4.options,
510
- delaySubmitEvent = _ref4.delaySubmitEvent;
551
+ value: function submitFeatureEvent(_ref5) {
552
+ var name = _ref5.name,
553
+ payload = _ref5.payload,
554
+ options = _ref5.options,
555
+ delaySubmitEvent = _ref5.delaySubmitEvent;
511
556
  if (delaySubmitEvent) {
512
557
  // Preserve the time when the event was triggered if delaying the submission to Call Features
513
558
  var delayedOptions = _objectSpread(_objectSpread({}, options), {}, {
@@ -558,10 +603,10 @@ var CallDiagnosticMetrics = exports.default = /*#__PURE__*/function (_StatelessW
558
603
  */
559
604
  }, {
560
605
  key: "submitMQE",
561
- value: function submitMQE(_ref5) {
562
- var name = _ref5.name,
563
- payload = _ref5.payload,
564
- options = _ref5.options;
606
+ value: function submitMQE(_ref6) {
607
+ var name = _ref6.name,
608
+ payload = _ref6.payload,
609
+ options = _ref6.options;
565
610
  var meetingId = options.meetingId,
566
611
  mediaConnections = options.mediaConnections,
567
612
  webexConferenceIdStr = options.webexConferenceIdStr,
@@ -636,18 +681,18 @@ var CallDiagnosticMetrics = exports.default = /*#__PURE__*/function (_StatelessW
636
681
  * @param arg.clientErrorCode
637
682
  * @param arg.serviceErrorCode
638
683
  * @param arg.payloadOverrides
639
- * @param arg.httpStatusCode
684
+ * @param arg.httpCode
640
685
  * @returns
641
686
  */
642
687
  }, {
643
688
  key: "getErrorPayloadForClientErrorCode",
644
- value: function getErrorPayloadForClientErrorCode(_ref6) {
645
- var clientErrorCode = _ref6.clientErrorCode,
646
- serviceErrorCode = _ref6.serviceErrorCode,
647
- serviceErrorName = _ref6.serviceErrorName,
648
- rawErrorMessage = _ref6.rawErrorMessage,
649
- payloadOverrides = _ref6.payloadOverrides,
650
- httpStatusCode = _ref6.httpStatusCode;
689
+ value: function getErrorPayloadForClientErrorCode(_ref7) {
690
+ var clientErrorCode = _ref7.clientErrorCode,
691
+ serviceErrorCode = _ref7.serviceErrorCode,
692
+ serviceErrorName = _ref7.serviceErrorName,
693
+ rawErrorMessage = _ref7.rawErrorMessage,
694
+ payloadOverrides = _ref7.payloadOverrides,
695
+ httpCode = _ref7.httpCode;
651
696
  var error;
652
697
  if (clientErrorCode) {
653
698
  var partialParsedError = _config2.CLIENT_ERROR_CODE_TO_ERROR_PAYLOAD[clientErrorCode];
@@ -669,8 +714,8 @@ var CallDiagnosticMetrics = exports.default = /*#__PURE__*/function (_StatelessW
669
714
  serviceErrorCode: serviceErrorCode
670
715
  }, {
671
716
  rawErrorMessage: rawErrorMessage
672
- }, httpStatusCode === undefined ? {} : {
673
- httpStatusCode: httpStatusCode
717
+ }, httpCode === undefined ? {} : {
718
+ httpCode: httpCode
674
719
  }, partialParsedError, payloadOverrides || {});
675
720
  return error;
676
721
  }
@@ -695,9 +740,9 @@ var CallDiagnosticMetrics = exports.default = /*#__PURE__*/function (_StatelessW
695
740
  */
696
741
  }, {
697
742
  key: "shouldSendEvent",
698
- value: function shouldSendEvent(_ref7) {
743
+ value: function shouldSendEvent(_ref8) {
699
744
  var _event$identifiers;
700
- var event = _ref7.event;
745
+ var event = _ref8.event;
701
746
  var eventName = event === null || event === void 0 ? void 0 : event.name;
702
747
  var correlationId = event === null || event === void 0 ? void 0 : (_event$identifiers = event.identifiers) === null || _event$identifiers === void 0 ? void 0 : _event$identifiers.correlationId;
703
748
  if (!correlationId || correlationId === 'unknown') {
@@ -816,13 +861,14 @@ var CallDiagnosticMetrics = exports.default = /*#__PURE__*/function (_StatelessW
816
861
  }, {
817
862
  key: "generateClientEventErrorPayload",
818
863
  value: function generateClientEventErrorPayload(rawError) {
819
- var _rawError$error, _rawError$error$body, _rawError$body, _rawError$body2, _rawError$body3, _rawError$body3$reaso;
864
+ var _rawError$error, _rawError$error$body, _rawError$body, _rawError$body2, _rawError$body3, _rawError$body3$reaso, _rawError$options, _rawError$options2;
820
865
  var cachedError = this.eventErrorCache.get(rawError);
821
866
  if (cachedError) {
822
867
  return [cachedError, true];
823
868
  }
824
869
  var rawErrorMessage = rawError.message;
825
- var httpStatusCode = rawError.statusCode;
870
+ var httpCode = rawError.statusCode;
871
+ var serviceErrorCode = (rawError === null || rawError === void 0 ? void 0 : (_rawError$error = rawError.error) === null || _rawError$error === void 0 ? void 0 : (_rawError$error$body = _rawError$error.body) === null || _rawError$error$body === void 0 ? void 0 : _rawError$error$body.errorCode) || (rawError === null || rawError === void 0 ? void 0 : (_rawError$body = rawError.body) === null || _rawError$body === void 0 ? void 0 : _rawError$body.errorCode) || (rawError === null || rawError === void 0 ? void 0 : (_rawError$body2 = rawError.body) === null || _rawError$body2 === void 0 ? void 0 : _rawError$body2.code) || (rawError === null || rawError === void 0 ? void 0 : (_rawError$body3 = rawError.body) === null || _rawError$body3 === void 0 ? void 0 : (_rawError$body3$reaso = _rawError$body3.reason) === null || _rawError$body3$reaso === void 0 ? void 0 : _rawError$body3$reaso.reasonCode);
826
872
  var payload;
827
873
  if (rawError.name) {
828
874
  if ((0, _callDiagnosticMetrics.isBrowserMediaErrorName)(rawError.name)) {
@@ -831,7 +877,7 @@ var CallDiagnosticMetrics = exports.default = /*#__PURE__*/function (_StatelessW
831
877
  clientErrorCode: _config2.BROWSER_MEDIA_ERROR_NAME_TO_CLIENT_ERROR_CODES_MAP[rawError.name],
832
878
  serviceErrorName: rawError.name,
833
879
  rawErrorMessage: rawErrorMessage,
834
- httpStatusCode: httpStatusCode
880
+ httpCode: httpCode
835
881
  });
836
882
  }
837
883
  }
@@ -844,10 +890,9 @@ var CallDiagnosticMetrics = exports.default = /*#__PURE__*/function (_StatelessW
844
890
  clientErrorCode: _config2.SDP_OFFER_CREATION_ERROR_MAP[causeType] || _config2.SDP_OFFER_CREATION_ERROR_MAP.GENERAL,
845
891
  serviceErrorName: rawError.name,
846
892
  rawErrorMessage: rawErrorMessage,
847
- httpStatusCode: httpStatusCode
893
+ httpCode: httpCode
848
894
  });
849
895
  }
850
- var serviceErrorCode = (rawError === null || rawError === void 0 ? void 0 : (_rawError$error = rawError.error) === null || _rawError$error === void 0 ? void 0 : (_rawError$error$body = _rawError$error.body) === null || _rawError$error$body === void 0 ? void 0 : _rawError$error$body.errorCode) || (rawError === null || rawError === void 0 ? void 0 : (_rawError$body = rawError.body) === null || _rawError$body === void 0 ? void 0 : _rawError$body.errorCode) || (rawError === null || rawError === void 0 ? void 0 : (_rawError$body2 = rawError.body) === null || _rawError$body2 === void 0 ? void 0 : _rawError$body2.code) || (rawError === null || rawError === void 0 ? void 0 : (_rawError$body3 = rawError.body) === null || _rawError$body3 === void 0 ? void 0 : (_rawError$body3$reaso = _rawError$body3.reason) === null || _rawError$body3$reaso === void 0 ? void 0 : _rawError$body3$reaso.reasonCode);
851
896
  if (serviceErrorCode) {
852
897
  var clientErrorCode = _config2.SERVICE_ERROR_CODES_TO_CLIENT_ERROR_CODES_MAP[serviceErrorCode];
853
898
  if (clientErrorCode && !payload) {
@@ -855,17 +900,28 @@ var CallDiagnosticMetrics = exports.default = /*#__PURE__*/function (_StatelessW
855
900
  clientErrorCode: clientErrorCode,
856
901
  serviceErrorCode: serviceErrorCode,
857
902
  rawErrorMessage: rawErrorMessage,
858
- httpStatusCode: httpStatusCode
903
+ httpCode: httpCode
859
904
  });
860
905
  }
861
-
906
+ }
907
+ var locusHttpClientErrorCode = LOCUS_HTTP_STATUS_TO_CLIENT_ERROR_CODE[httpCode];
908
+ var requestUrl = ((_rawError$options = rawError.options) === null || _rawError$options === void 0 ? void 0 : _rawError$options.uri) || ((_rawError$options2 = rawError.options) === null || _rawError$options2 === void 0 ? void 0 : _rawError$options2.url);
909
+ if (locusHttpClientErrorCode && !payload && requestUrl !== null && requestUrl !== void 0 && requestUrl.includes('locus')) {
910
+ payload = this.getErrorPayloadForClientErrorCode({
911
+ clientErrorCode: locusHttpClientErrorCode,
912
+ serviceErrorCode: serviceErrorCode,
913
+ rawErrorMessage: rawErrorMessage,
914
+ httpCode: httpCode
915
+ });
916
+ }
917
+ if (serviceErrorCode) {
862
918
  // by default, if it is locus error, return new locus err
863
919
  if ((0, _callDiagnosticMetrics.isLocusServiceErrorCode)(serviceErrorCode) && !payload) {
864
920
  payload = this.getErrorPayloadForClientErrorCode({
865
921
  clientErrorCode: _config2.NEW_LOCUS_ERROR_CLIENT_CODE,
866
922
  serviceErrorCode: serviceErrorCode,
867
923
  rawErrorMessage: rawErrorMessage,
868
- httpStatusCode: httpStatusCode
924
+ httpCode: httpCode
869
925
  });
870
926
  }
871
927
  }
@@ -874,7 +930,7 @@ var CallDiagnosticMetrics = exports.default = /*#__PURE__*/function (_StatelessW
874
930
  clientErrorCode: _config2.MEETING_INFO_LOOKUP_ERROR_CLIENT_CODE,
875
931
  serviceErrorCode: serviceErrorCode,
876
932
  rawErrorMessage: rawErrorMessage,
877
- httpStatusCode: httpStatusCode
933
+ httpCode: httpCode
878
934
  });
879
935
  }
880
936
  if ((0, _callDiagnosticMetrics.isNetworkError)(rawError) && !payload) {
@@ -883,7 +939,7 @@ var CallDiagnosticMetrics = exports.default = /*#__PURE__*/function (_StatelessW
883
939
  serviceErrorCode: serviceErrorCode,
884
940
  payloadOverrides: rawError.payloadOverrides,
885
941
  rawErrorMessage: rawErrorMessage,
886
- httpStatusCode: httpStatusCode
942
+ httpCode: httpCode
887
943
  });
888
944
  }
889
945
  if ((0, _callDiagnosticMetrics.isUnauthorizedError)(rawError) && !payload) {
@@ -892,7 +948,7 @@ var CallDiagnosticMetrics = exports.default = /*#__PURE__*/function (_StatelessW
892
948
  serviceErrorCode: serviceErrorCode,
893
949
  payloadOverrides: rawError.payloadOverrides,
894
950
  rawErrorMessage: rawErrorMessage,
895
- httpStatusCode: httpStatusCode
951
+ httpCode: httpCode
896
952
  });
897
953
  }
898
954
  if (!payload) {
@@ -903,7 +959,7 @@ var CallDiagnosticMetrics = exports.default = /*#__PURE__*/function (_StatelessW
903
959
  serviceErrorName: rawError === null || rawError === void 0 ? void 0 : rawError.name,
904
960
  payloadOverrides: rawError.payloadOverrides,
905
961
  rawErrorMessage: rawErrorMessage,
906
- httpStatusCode: httpStatusCode
962
+ httpCode: httpCode
907
963
  });
908
964
  }
909
965
 
@@ -921,17 +977,18 @@ var CallDiagnosticMetrics = exports.default = /*#__PURE__*/function (_StatelessW
921
977
  */
922
978
  }, {
923
979
  key: "createCommonEventObjectInMeeting",
924
- value: function createCommonEventObjectInMeeting(_ref8) {
925
- var _this$webex$meetings17, _this$webex$meetings18, _this$webex$meetings19, _meeting$meetingInfo0, _options$joinFlowVers, _meeting$callStateFor;
926
- var name = _ref8.name,
927
- options = _ref8.options,
928
- _ref8$eventType = _ref8.eventType,
929
- eventType = _ref8$eventType === void 0 ? 'client' : _ref8$eventType;
980
+ value: function createCommonEventObjectInMeeting(_ref9) {
981
+ var _this$webex$meetings20, _this$webex$meetings21, _this$webex$meetings22, _meeting$meetingInfo1, _options$joinFlowVers, _meeting$callStateFor, _options$meetingJoinP, _meeting$callStateFor2;
982
+ var name = _ref9.name,
983
+ options = _ref9.options,
984
+ _ref9$eventType = _ref9.eventType,
985
+ eventType = _ref9$eventType === void 0 ? 'client' : _ref9$eventType;
930
986
  var meetingId = options.meetingId,
931
987
  mediaConnections = options.mediaConnections,
932
988
  globalMeetingId = options.globalMeetingId,
933
989
  webexConferenceIdStr = options.webexConferenceIdStr,
934
- sessionCorrelationId = options.sessionCorrelationId;
990
+ sessionCorrelationId = options.sessionCorrelationId,
991
+ locusCluster = options.locusCluster;
935
992
 
936
993
  // @ts-ignore
937
994
  var meeting = this.webex.meetings.getBasicMeetingInformation(meetingId);
@@ -953,7 +1010,8 @@ var CallDiagnosticMetrics = exports.default = /*#__PURE__*/function (_StatelessW
953
1010
  mediaConnections: (meeting === null || meeting === void 0 ? void 0 : meeting.mediaConnections) || mediaConnections,
954
1011
  webexConferenceIdStr: webexConferenceIdStr,
955
1012
  globalMeetingId: globalMeetingId,
956
- sessionCorrelationId: sessionCorrelationId
1013
+ sessionCorrelationId: sessionCorrelationId,
1014
+ locusCluster: locusCluster
957
1015
  });
958
1016
 
959
1017
  // create common event object structure
@@ -977,8 +1035,8 @@ var CallDiagnosticMetrics = exports.default = /*#__PURE__*/function (_StatelessW
977
1035
  }), {}, {
978
1036
  webexSubServiceType: this.getSubServiceType(meeting),
979
1037
  // @ts-ignore
980
- webClientPreload: (_this$webex$meetings17 = this.webex.meetings) === null || _this$webex$meetings17 === void 0 ? void 0 : (_this$webex$meetings18 = _this$webex$meetings17.config) === null || _this$webex$meetings18 === void 0 ? void 0 : (_this$webex$meetings19 = _this$webex$meetings18.metrics) === null || _this$webex$meetings19 === void 0 ? void 0 : _this$webex$meetings19.webClientPreload,
981
- isVipMeeting: (meeting === null || meeting === void 0 ? void 0 : (_meeting$meetingInfo0 = meeting.meetingInfo) === null || _meeting$meetingInfo0 === void 0 ? void 0 : _meeting$meetingInfo0.vipmeeting) || false,
1038
+ webClientPreload: (_this$webex$meetings20 = this.webex.meetings) === null || _this$webex$meetings20 === void 0 ? void 0 : (_this$webex$meetings21 = _this$webex$meetings20.config) === null || _this$webex$meetings21 === void 0 ? void 0 : (_this$webex$meetings22 = _this$webex$meetings21.metrics) === null || _this$webex$meetings22 === void 0 ? void 0 : _this$webex$meetings22.webClientPreload,
1039
+ isVipMeeting: (meeting === null || meeting === void 0 ? void 0 : (_meeting$meetingInfo1 = meeting.meetingInfo) === null || _meeting$meetingInfo1 === void 0 ? void 0 : _meeting$meetingInfo1.vipmeeting) || false,
982
1040
  isAutomatedUser: AutomatedUserUtils.isAutomatedUser(),
983
1041
  userActivation: this.getUserActivation()
984
1042
  });
@@ -992,9 +1050,10 @@ var CallDiagnosticMetrics = exports.default = /*#__PURE__*/function (_StatelessW
992
1050
  // @ts-ignore
993
1051
  commonEventObject.meetingJoinedTime = meetingJoinedTime;
994
1052
  }
995
- if (options.meetingJoinPhase) {
1053
+ var meetingJoinPhase = (_options$meetingJoinP = options.meetingJoinPhase) !== null && _options$meetingJoinP !== void 0 ? _options$meetingJoinP : (_meeting$callStateFor2 = meeting.callStateForMetrics) === null || _meeting$callStateFor2 === void 0 ? void 0 : _meeting$callStateFor2.meetingJoinPhase;
1054
+ if (meetingJoinPhase) {
996
1055
  // @ts-ignore
997
- commonEventObject.meetingJoinPhase = options.meetingJoinPhase;
1056
+ commonEventObject.meetingJoinPhase = meetingJoinPhase;
998
1057
  }
999
1058
  return commonEventObject;
1000
1059
  }
@@ -1008,10 +1067,10 @@ var CallDiagnosticMetrics = exports.default = /*#__PURE__*/function (_StatelessW
1008
1067
  */
1009
1068
  }, {
1010
1069
  key: "createClientEventObjectInMeeting",
1011
- value: function createClientEventObjectInMeeting(_ref9) {
1012
- var name = _ref9.name,
1013
- options = _ref9.options,
1014
- errors = _ref9.errors;
1070
+ value: function createClientEventObjectInMeeting(_ref0) {
1071
+ var name = _ref0.name,
1072
+ options = _ref0.options,
1073
+ errors = _ref0.errors;
1015
1074
  var commonObject = this.createCommonEventObjectInMeeting({
1016
1075
  name: name,
1017
1076
  options: options,
@@ -1034,9 +1093,9 @@ var CallDiagnosticMetrics = exports.default = /*#__PURE__*/function (_StatelessW
1034
1093
  */
1035
1094
  }, {
1036
1095
  key: "createFeatureEventObjectInMeeting",
1037
- value: function createFeatureEventObjectInMeeting(_ref0) {
1038
- var name = _ref0.name,
1039
- options = _ref0.options;
1096
+ value: function createFeatureEventObjectInMeeting(_ref1) {
1097
+ var name = _ref1.name,
1098
+ options = _ref1.options;
1040
1099
  var commonObject = this.createCommonEventObjectInMeeting({
1041
1100
  name: name,
1042
1101
  options: options,
@@ -1057,16 +1116,17 @@ var CallDiagnosticMetrics = exports.default = /*#__PURE__*/function (_StatelessW
1057
1116
  */
1058
1117
  }, {
1059
1118
  key: "createClientEventObjectPreMeeting",
1060
- value: function createClientEventObjectPreMeeting(_ref1) {
1061
- var _this$webex$meetings20, _this$webex$meetings21, _this$webex$meetings22;
1062
- var name = _ref1.name,
1063
- options = _ref1.options,
1064
- errors = _ref1.errors;
1119
+ value: function createClientEventObjectPreMeeting(_ref10) {
1120
+ var _this$webex$meetings23, _this$webex$meetings24, _this$webex$meetings25, _options$meetingJoinP2;
1121
+ var name = _ref10.name,
1122
+ options = _ref10.options,
1123
+ errors = _ref10.errors;
1065
1124
  var correlationId = options.correlationId,
1066
1125
  globalMeetingId = options.globalMeetingId,
1067
1126
  webexConferenceIdStr = options.webexConferenceIdStr,
1068
1127
  preLoginId = options.preLoginId,
1069
- sessionCorrelationId = options.sessionCorrelationId;
1128
+ sessionCorrelationId = options.sessionCorrelationId,
1129
+ locusCluster = options.locusCluster;
1070
1130
 
1071
1131
  // grab identifiers
1072
1132
  var identifiers = this.getIdentifiers({
@@ -1074,7 +1134,8 @@ var CallDiagnosticMetrics = exports.default = /*#__PURE__*/function (_StatelessW
1074
1134
  sessionCorrelationId: sessionCorrelationId,
1075
1135
  preLoginId: preLoginId,
1076
1136
  globalMeetingId: globalMeetingId,
1077
- webexConferenceIdStr: webexConferenceIdStr
1137
+ webexConferenceIdStr: webexConferenceIdStr,
1138
+ locusCluster: locusCluster
1078
1139
  });
1079
1140
 
1080
1141
  // create client event object
@@ -1090,16 +1151,16 @@ var CallDiagnosticMetrics = exports.default = /*#__PURE__*/function (_StatelessW
1090
1151
  loginType: this.getCurLoginType(),
1091
1152
  telemetryOptOut: this.getTelemetryOptOut(),
1092
1153
  // @ts-ignore
1093
- webClientPreload: (_this$webex$meetings20 = this.webex.meetings) === null || _this$webex$meetings20 === void 0 ? void 0 : (_this$webex$meetings21 = _this$webex$meetings20.config) === null || _this$webex$meetings21 === void 0 ? void 0 : (_this$webex$meetings22 = _this$webex$meetings21.metrics) === null || _this$webex$meetings22 === void 0 ? void 0 : _this$webex$meetings22.webClientPreload,
1154
+ webClientPreload: (_this$webex$meetings23 = this.webex.meetings) === null || _this$webex$meetings23 === void 0 ? void 0 : (_this$webex$meetings24 = _this$webex$meetings23.config) === null || _this$webex$meetings24 === void 0 ? void 0 : (_this$webex$meetings25 = _this$webex$meetings24.metrics) === null || _this$webex$meetings25 === void 0 ? void 0 : _this$webex$meetings25.webClientPreload,
1094
1155
  isAutomatedUser: AutomatedUserUtils.isAutomatedUser(),
1095
1156
  userActivation: this.getUserActivation()
1096
1157
  };
1097
1158
  if (options.joinFlowVersion) {
1098
1159
  clientEventObject.joinFlowVersion = options.joinFlowVersion;
1099
1160
  }
1100
- if (options.meetingJoinPhase) {
1101
- clientEventObject.meetingJoinPhase = options.meetingJoinPhase;
1102
- }
1161
+
1162
+ // No meeting exists yet for pre-meeting events, so the join phase is pre-join by construction
1163
+ clientEventObject.meetingJoinPhase = (_options$meetingJoinP2 = options.meetingJoinPhase) !== null && _options$meetingJoinP2 !== void 0 ? _options$meetingJoinP2 : 'pre-join';
1103
1164
  if (options.userNameInput) {
1104
1165
  clientEventObject.userNameInput = options.userNameInput;
1105
1166
  }
@@ -1120,10 +1181,10 @@ var CallDiagnosticMetrics = exports.default = /*#__PURE__*/function (_StatelessW
1120
1181
  */
1121
1182
  }, {
1122
1183
  key: "prepareClientEvent",
1123
- value: function prepareClientEvent(_ref10) {
1124
- var name = _ref10.name,
1125
- payload = _ref10.payload,
1126
- options = _ref10.options;
1184
+ value: function prepareClientEvent(_ref11) {
1185
+ var name = _ref11.name,
1186
+ payload = _ref11.payload,
1187
+ options = _ref11.options;
1127
1188
  var meetingId = options.meetingId,
1128
1189
  correlationId = options.correlationId,
1129
1190
  rawError = options.rawError;
@@ -1179,11 +1240,11 @@ var CallDiagnosticMetrics = exports.default = /*#__PURE__*/function (_StatelessW
1179
1240
  */
1180
1241
  }, {
1181
1242
  key: "submitClientEvent",
1182
- value: function submitClientEvent(_ref11) {
1183
- var name = _ref11.name,
1184
- payload = _ref11.payload,
1185
- options = _ref11.options,
1186
- delaySubmitEvent = _ref11.delaySubmitEvent;
1243
+ value: function submitClientEvent(_ref12) {
1244
+ var name = _ref12.name,
1245
+ payload = _ref12.payload,
1246
+ options = _ref12.options,
1247
+ delaySubmitEvent = _ref12.delaySubmitEvent;
1187
1248
  if (delaySubmitEvent) {
1188
1249
  // Preserve the time when the event was triggered if delaying the submission to Call Diagnostics
1189
1250
  var delayedOptions = _objectSpread(_objectSpread({}, options), {}, {
@@ -1295,13 +1356,13 @@ var CallDiagnosticMetrics = exports.default = /*#__PURE__*/function (_StatelessW
1295
1356
  * @throws
1296
1357
  */
1297
1358
  function () {
1298
- var _buildClientEventFetchRequestOptions = (0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee(_ref12) {
1359
+ var _buildClientEventFetchRequestOptions = (0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee(_ref13) {
1299
1360
  var _this$webex$internal$, _this$webex$internal$2;
1300
1361
  var name, payload, options, clientEvent, diagnosticEvent, request;
1301
1362
  return _regenerator.default.wrap(function (_context) {
1302
1363
  while (1) switch (_context.prev = _context.next) {
1303
1364
  case 0:
1304
- name = _ref12.name, payload = _ref12.payload, options = _ref12.options;
1365
+ name = _ref13.name, payload = _ref13.payload, options = _ref13.options;
1305
1366
  this.logger.log(_config2.CALL_DIAGNOSTIC_LOG_IDENTIFIER, 'CallDiagnosticMetrics: @buildClientEventFetchRequestOptions. Building request options object for fetch()...', "name: ".concat(name));
1306
1367
  clientEvent = this.prepareClientEvent({
1307
1368
  name: name,