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

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (35) hide show
  1. package/dist/call-diagnostic/call-diagnostic-metrics-latencies.js +49 -0
  2. package/dist/call-diagnostic/call-diagnostic-metrics-latencies.js.map +1 -1
  3. package/dist/call-diagnostic/call-diagnostic-metrics.js +301 -81
  4. package/dist/call-diagnostic/call-diagnostic-metrics.js.map +1 -1
  5. package/dist/call-diagnostic/call-diagnostic-metrics.util.js +6 -0
  6. package/dist/call-diagnostic/call-diagnostic-metrics.util.js.map +1 -1
  7. package/dist/call-diagnostic/config.js +32 -3
  8. package/dist/call-diagnostic/config.js.map +1 -1
  9. package/dist/index.js.map +1 -1
  10. package/dist/metrics.js +1 -1
  11. package/dist/metrics.types.js.map +1 -1
  12. package/dist/new-metrics.js +58 -5
  13. package/dist/new-metrics.js.map +1 -1
  14. package/dist/types/call-diagnostic/call-diagnostic-metrics-latencies.d.ts +15 -0
  15. package/dist/types/call-diagnostic/call-diagnostic-metrics.d.ts +154 -24
  16. package/dist/types/call-diagnostic/config.d.ts +14 -0
  17. package/dist/types/index.d.ts +2 -2
  18. package/dist/types/metrics.types.d.ts +28 -7
  19. package/dist/types/new-metrics.d.ts +28 -4
  20. package/package.json +12 -12
  21. package/src/call-diagnostic/call-diagnostic-metrics-latencies.ts +58 -0
  22. package/src/call-diagnostic/call-diagnostic-metrics.ts +294 -66
  23. package/src/call-diagnostic/call-diagnostic-metrics.util.ts +6 -0
  24. package/src/call-diagnostic/config.ts +31 -0
  25. package/src/index.ts +4 -0
  26. package/src/metrics.types.ts +36 -6
  27. package/src/new-metrics.ts +73 -5
  28. package/test/unit/spec/call-diagnostic/call-diagnostic-metrics-batcher.ts +20 -1
  29. package/test/unit/spec/call-diagnostic/call-diagnostic-metrics-latencies.ts +167 -0
  30. package/test/unit/spec/call-diagnostic/call-diagnostic-metrics.ts +1054 -153
  31. package/test/unit/spec/call-diagnostic/call-diagnostic-metrics.util.ts +6 -0
  32. package/test/unit/spec/new-metrics.ts +94 -5
  33. package/test/unit/spec/prelogin-metrics-batcher.ts +1 -0
  34. package/dist/call-diagnostic-events-batcher.js +0 -59
  35. package/dist/call-diagnostic-events-batcher.js.map +0 -1
@@ -13,9 +13,11 @@ _Object$defineProperty(exports, "__esModule", {
13
13
  });
14
14
  exports.default = void 0;
15
15
  var _regenerator = _interopRequireDefault(require("@babel/runtime-corejs2/regenerator"));
16
+ var _weakMap = _interopRequireDefault(require("@babel/runtime-corejs2/core-js/weak-map"));
16
17
  var _promise = _interopRequireDefault(require("@babel/runtime-corejs2/core-js/promise"));
17
18
  var _stringify = _interopRequireDefault(require("@babel/runtime-corejs2/core-js/json/stringify"));
18
19
  var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime-corejs2/helpers/asyncToGenerator"));
20
+ var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime-corejs2/helpers/slicedToArray"));
19
21
  var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime-corejs2/helpers/classCallCheck"));
20
22
  var _createClass2 = _interopRequireDefault(require("@babel/runtime-corejs2/helpers/createClass"));
21
23
  var _assertThisInitialized2 = _interopRequireDefault(require("@babel/runtime-corejs2/helpers/assertThisInitialized"));
@@ -70,6 +72,9 @@ var CallDiagnosticMetrics = exports.default = /*#__PURE__*/function (_StatelessW
70
72
  (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "hasLoggedBrowserSerial", void 0);
71
73
  (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "device", void 0);
72
74
  (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "delayedClientEvents", []);
75
+ (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "delayedClientFeatureEvents", []);
76
+ (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "eventErrorCache", new _weakMap.default());
77
+ (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "isMercuryConnected", false);
73
78
  // the default validator before piping an event to the batcher
74
79
  // this function can be overridden by the user
75
80
  (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "validator", function (options) {
@@ -137,6 +142,18 @@ var CallDiagnosticMetrics = exports.default = /*#__PURE__*/function (_StatelessW
137
142
  return undefined;
138
143
  }
139
144
 
145
+ /**
146
+ * Sets mercury connected status for event data object in CA events
147
+ * @public
148
+ * @param status - boolean value indicating mercury connection status
149
+ * @return {void}
150
+ */
151
+ }, {
152
+ key: "setMercuryConnectedStatus",
153
+ value: function setMercuryConnectedStatus(status) {
154
+ this.isMercuryConnected = status;
155
+ }
156
+
140
157
  /**
141
158
  * Returns meeting's subServiceType
142
159
  * @param meeting
@@ -156,13 +173,15 @@ var CallDiagnosticMetrics = exports.default = /*#__PURE__*/function (_StatelessW
156
173
  if (meetingInfo !== null && meetingInfo !== void 0 && meetingInfo.webexScheduled && !(meetingInfo !== null && meetingInfo !== void 0 && meetingInfo.enableEvent) && !(meetingInfo !== null && meetingInfo !== void 0 && meetingInfo.pmr)) {
157
174
  return _config2.WEBEX_SUB_SERVICE_TYPES.SCHEDULED_MEETING;
158
175
  }
159
- // if Scheduled, Webinar, not pmr - then Webinar
160
- if (meetingInfo !== null && meetingInfo !== void 0 && meetingInfo.webexScheduled && meetingInfo !== null && meetingInfo !== void 0 && meetingInfo.enableEvent && !(meetingInfo !== null && meetingInfo !== void 0 && meetingInfo.pmr) && meetingInfo !== null && meetingInfo !== void 0 && meetingInfo.isConvergedWebinar) {
161
- return _config2.WEBEX_SUB_SERVICE_TYPES.WEBINAR;
176
+
177
+ // if ConvergedArchitecture enable and isConvergedWebinarWebcast -- then webcast
178
+ if (meetingInfo !== null && meetingInfo !== void 0 && meetingInfo.enableConvergedArchitecture && meetingInfo !== null && meetingInfo !== void 0 && meetingInfo.enableEvent) {
179
+ return meetingInfo !== null && meetingInfo !== void 0 && meetingInfo.isConvergedWebinarWebcast ? _config2.WEBEX_SUB_SERVICE_TYPES.WEBCAST : _config2.WEBEX_SUB_SERVICE_TYPES.WEBINAR;
162
180
  }
163
- // if Scheduled, Webinar enable webcast - then webcast
164
- if (meetingInfo !== null && meetingInfo !== void 0 && meetingInfo.webexScheduled && meetingInfo !== null && meetingInfo !== void 0 && meetingInfo.enableEvent && !(meetingInfo !== null && meetingInfo !== void 0 && meetingInfo.pmr) && meetingInfo !== null && meetingInfo !== void 0 && meetingInfo.isConvergedWebinarWebcast) {
165
- return _config2.WEBEX_SUB_SERVICE_TYPES.WEBCAST;
181
+
182
+ // if Scheduled, enable event, not pmr - then Webinar
183
+ if (meetingInfo !== null && meetingInfo !== void 0 && meetingInfo.webexScheduled && meetingInfo !== null && meetingInfo !== void 0 && meetingInfo.enableEvent && !(meetingInfo !== null && meetingInfo !== void 0 && meetingInfo.pmr)) {
184
+ return _config2.WEBEX_SUB_SERVICE_TYPES.WEBINAR;
166
185
  }
167
186
  }
168
187
  return undefined;
@@ -370,14 +389,91 @@ var CallDiagnosticMetrics = exports.default = /*#__PURE__*/function (_StatelessW
370
389
  }
371
390
 
372
391
  /**
373
- * TODO: NOT IMPLEMENTED
392
+ * Create feature event
393
+ * @param name
394
+ * @param payload
395
+ * @param options
396
+ * @returns
397
+ */
398
+ }, {
399
+ key: "prepareClientFeatureEvent",
400
+ value: function prepareClientFeatureEvent(_ref3) {
401
+ var name = _ref3.name,
402
+ payload = _ref3.payload,
403
+ options = _ref3.options;
404
+ var meetingId = options.meetingId,
405
+ correlationId = options.correlationId;
406
+ var featureEventObject;
407
+
408
+ // events that will most likely happen in join phase
409
+ if (meetingId) {
410
+ featureEventObject = this.createFeatureEventObjectInMeeting({
411
+ name: name,
412
+ options: options
413
+ });
414
+ } else {
415
+ throw new Error('Not implemented');
416
+ }
417
+
418
+ // merge any new properties, or override existing ones
419
+ featureEventObject = (0, _lodash.merge)(featureEventObject, payload);
420
+
421
+ // append client event data to the call diagnostic event
422
+ var featureEvent = this.prepareDiagnosticEvent(featureEventObject, options);
423
+ return featureEvent;
424
+ }
425
+
426
+ /**
374
427
  * Submit Feature Event
428
+ * submit to business_ucf
375
429
  * @returns
376
430
  */
377
431
  }, {
378
432
  key: "submitFeatureEvent",
379
- value: function submitFeatureEvent() {
380
- throw Error('Not implemented');
433
+ value: function submitFeatureEvent(_ref4) {
434
+ var name = _ref4.name,
435
+ payload = _ref4.payload,
436
+ options = _ref4.options,
437
+ delaySubmitEvent = _ref4.delaySubmitEvent;
438
+ if (delaySubmitEvent) {
439
+ // Preserve the time when the event was triggered if delaying the submission to Call Features
440
+ var delayedOptions = _objectSpread(_objectSpread({}, options), {}, {
441
+ triggeredTime: new Date().toISOString()
442
+ });
443
+ this.delayedClientFeatureEvents.push({
444
+ name: name,
445
+ payload: payload,
446
+ options: delayedOptions
447
+ });
448
+ return _promise.default.resolve();
449
+ }
450
+ this.logger.log(_config2.CALL_FEATURE_LOG_IDENTIFIER, 'CallFeatureMetrics: @submitFeatureEvent. Submit Client Feature Event CA event.', "name: ".concat(name));
451
+ var featureEvent = this.prepareClientFeatureEvent({
452
+ name: name,
453
+ payload: payload,
454
+ options: options
455
+ });
456
+ this.validator({
457
+ type: 'ce',
458
+ event: featureEvent
459
+ });
460
+ return this.submitToCallFeatures(featureEvent);
461
+ }
462
+
463
+ /**
464
+ * Submit Feature Event
465
+ * type is business
466
+ * @param event
467
+ */
468
+ }, {
469
+ key: "submitToCallFeatures",
470
+ value: function submitToCallFeatures(event) {
471
+ // build metrics-a event type
472
+ var finalEvent = {
473
+ eventPayload: event,
474
+ type: ['business']
475
+ };
476
+ return this.callDiagnosticEventsBatcher.request(finalEvent);
381
477
  }
382
478
 
383
479
  /**
@@ -389,10 +485,10 @@ var CallDiagnosticMetrics = exports.default = /*#__PURE__*/function (_StatelessW
389
485
  */
390
486
  }, {
391
487
  key: "submitMQE",
392
- value: function submitMQE(_ref3) {
393
- var name = _ref3.name,
394
- payload = _ref3.payload,
395
- options = _ref3.options;
488
+ value: function submitMQE(_ref5) {
489
+ var name = _ref5.name,
490
+ payload = _ref5.payload,
491
+ options = _ref5.options;
396
492
  var meetingId = options.meetingId,
397
493
  mediaConnections = options.mediaConnections,
398
494
  webexConferenceIdStr = options.webexConferenceIdStr,
@@ -471,13 +567,13 @@ var CallDiagnosticMetrics = exports.default = /*#__PURE__*/function (_StatelessW
471
567
  */
472
568
  }, {
473
569
  key: "getErrorPayloadForClientErrorCode",
474
- value: function getErrorPayloadForClientErrorCode(_ref4) {
475
- var clientErrorCode = _ref4.clientErrorCode,
476
- serviceErrorCode = _ref4.serviceErrorCode,
477
- serviceErrorName = _ref4.serviceErrorName,
478
- rawErrorMessage = _ref4.rawErrorMessage,
479
- payloadOverrides = _ref4.payloadOverrides,
480
- httpStatusCode = _ref4.httpStatusCode;
570
+ value: function getErrorPayloadForClientErrorCode(_ref6) {
571
+ var clientErrorCode = _ref6.clientErrorCode,
572
+ serviceErrorCode = _ref6.serviceErrorCode,
573
+ serviceErrorName = _ref6.serviceErrorName,
574
+ rawErrorMessage = _ref6.rawErrorMessage,
575
+ payloadOverrides = _ref6.payloadOverrides,
576
+ httpStatusCode = _ref6.httpStatusCode;
481
577
  var error;
482
578
  if (clientErrorCode) {
483
579
  var partialParsedError = _config2.CLIENT_ERROR_CODE_TO_ERROR_PAYLOAD[clientErrorCode];
@@ -508,6 +604,15 @@ var CallDiagnosticMetrics = exports.default = /*#__PURE__*/function (_StatelessW
508
604
  return undefined;
509
605
  }
510
606
 
607
+ /**
608
+ * Clear the error cache
609
+ */
610
+ }, {
611
+ key: "clearErrorCache",
612
+ value: function clearErrorCache() {
613
+ this.eventErrorCache = new _weakMap.default();
614
+ }
615
+
511
616
  /**
512
617
  * Generate error payload for Client Event
513
618
  * @param rawError
@@ -516,11 +621,16 @@ var CallDiagnosticMetrics = exports.default = /*#__PURE__*/function (_StatelessW
516
621
  key: "generateClientEventErrorPayload",
517
622
  value: function generateClientEventErrorPayload(rawError) {
518
623
  var _rawError$error, _rawError$error$body, _rawError$body, _rawError$body2, _rawError$body3, _rawError$body3$reaso;
624
+ var cachedError = this.eventErrorCache.get(rawError);
625
+ if (cachedError) {
626
+ return [cachedError, true];
627
+ }
519
628
  var rawErrorMessage = rawError.message;
520
629
  var httpStatusCode = rawError.statusCode;
630
+ var payload;
521
631
  if (rawError.name) {
522
632
  if ((0, _callDiagnosticMetrics.isBrowserMediaErrorName)(rawError.name)) {
523
- return this.getErrorPayloadForClientErrorCode({
633
+ payload = this.getErrorPayloadForClientErrorCode({
524
634
  serviceErrorCode: undefined,
525
635
  clientErrorCode: _config2.BROWSER_MEDIA_ERROR_NAME_TO_CLIENT_ERROR_CODES_MAP[rawError.name],
526
636
  serviceErrorName: rawError.name,
@@ -529,11 +639,11 @@ var CallDiagnosticMetrics = exports.default = /*#__PURE__*/function (_StatelessW
529
639
  });
530
640
  }
531
641
  }
532
- if ((0, _callDiagnosticMetrics.isSdpOfferCreationError)(rawError)) {
642
+ if ((0, _callDiagnosticMetrics.isSdpOfferCreationError)(rawError) && !payload) {
533
643
  var _rawError$cause;
534
644
  // error code is 30005, but that's not specific enough. we also need to check error.cause.type
535
645
  var causeType = (_rawError$cause = rawError.cause) === null || _rawError$cause === void 0 ? void 0 : _rawError$cause.type;
536
- return this.getErrorPayloadForClientErrorCode({
646
+ payload = this.getErrorPayloadForClientErrorCode({
537
647
  serviceErrorCode: undefined,
538
648
  clientErrorCode: _config2.SDP_OFFER_CREATION_ERROR_MAP[causeType] || _config2.SDP_OFFER_CREATION_ERROR_MAP.GENERAL,
539
649
  serviceErrorName: rawError.name,
@@ -544,8 +654,8 @@ var CallDiagnosticMetrics = exports.default = /*#__PURE__*/function (_StatelessW
544
654
  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);
545
655
  if (serviceErrorCode) {
546
656
  var clientErrorCode = _config2.SERVICE_ERROR_CODES_TO_CLIENT_ERROR_CODES_MAP[serviceErrorCode];
547
- if (clientErrorCode) {
548
- return this.getErrorPayloadForClientErrorCode({
657
+ if (clientErrorCode && !payload) {
658
+ payload = this.getErrorPayloadForClientErrorCode({
549
659
  clientErrorCode: clientErrorCode,
550
660
  serviceErrorCode: serviceErrorCode,
551
661
  rawErrorMessage: rawErrorMessage,
@@ -554,8 +664,8 @@ var CallDiagnosticMetrics = exports.default = /*#__PURE__*/function (_StatelessW
554
664
  }
555
665
 
556
666
  // by default, if it is locus error, return new locus err
557
- if ((0, _callDiagnosticMetrics.isLocusServiceErrorCode)(serviceErrorCode)) {
558
- return this.getErrorPayloadForClientErrorCode({
667
+ if ((0, _callDiagnosticMetrics.isLocusServiceErrorCode)(serviceErrorCode) && !payload) {
668
+ payload = this.getErrorPayloadForClientErrorCode({
559
669
  clientErrorCode: _config2.NEW_LOCUS_ERROR_CLIENT_CODE,
560
670
  serviceErrorCode: serviceErrorCode,
561
671
  rawErrorMessage: rawErrorMessage,
@@ -563,16 +673,16 @@ var CallDiagnosticMetrics = exports.default = /*#__PURE__*/function (_StatelessW
563
673
  });
564
674
  }
565
675
  }
566
- if ((0, _callDiagnosticMetrics.isMeetingInfoServiceError)(rawError)) {
567
- return this.getErrorPayloadForClientErrorCode({
676
+ if ((0, _callDiagnosticMetrics.isMeetingInfoServiceError)(rawError) && !payload) {
677
+ payload = this.getErrorPayloadForClientErrorCode({
568
678
  clientErrorCode: _config2.MEETING_INFO_LOOKUP_ERROR_CLIENT_CODE,
569
679
  serviceErrorCode: serviceErrorCode,
570
680
  rawErrorMessage: rawErrorMessage,
571
681
  httpStatusCode: httpStatusCode
572
682
  });
573
683
  }
574
- if ((0, _callDiagnosticMetrics.isNetworkError)(rawError)) {
575
- return this.getErrorPayloadForClientErrorCode({
684
+ if ((0, _callDiagnosticMetrics.isNetworkError)(rawError) && !payload) {
685
+ payload = this.getErrorPayloadForClientErrorCode({
576
686
  clientErrorCode: _config2.NETWORK_ERROR,
577
687
  serviceErrorCode: serviceErrorCode,
578
688
  payloadOverrides: rawError.payloadOverrides,
@@ -580,8 +690,8 @@ var CallDiagnosticMetrics = exports.default = /*#__PURE__*/function (_StatelessW
580
690
  httpStatusCode: httpStatusCode
581
691
  });
582
692
  }
583
- if ((0, _callDiagnosticMetrics.isUnauthorizedError)(rawError)) {
584
- return this.getErrorPayloadForClientErrorCode({
693
+ if ((0, _callDiagnosticMetrics.isUnauthorizedError)(rawError) && !payload) {
694
+ payload = this.getErrorPayloadForClientErrorCode({
585
695
  clientErrorCode: _config2.AUTHENTICATION_FAILED_CODE,
586
696
  serviceErrorCode: serviceErrorCode,
587
697
  payloadOverrides: rawError.payloadOverrides,
@@ -589,32 +699,38 @@ var CallDiagnosticMetrics = exports.default = /*#__PURE__*/function (_StatelessW
589
699
  httpStatusCode: httpStatusCode
590
700
  });
591
701
  }
702
+ if (!payload) {
703
+ // otherwise return unkown error but passing serviceErrorCode and serviceErrorName so that we know the issue
704
+ payload = this.getErrorPayloadForClientErrorCode({
705
+ clientErrorCode: _config2.UNKNOWN_ERROR,
706
+ serviceErrorCode: serviceErrorCode || _config2.UNKNOWN_ERROR,
707
+ serviceErrorName: rawError === null || rawError === void 0 ? void 0 : rawError.name,
708
+ payloadOverrides: rawError.payloadOverrides,
709
+ rawErrorMessage: rawErrorMessage,
710
+ httpStatusCode: httpStatusCode
711
+ });
712
+ }
592
713
 
593
- // otherwise return unkown error but passing serviceErrorCode and serviceErrorName so that we know the issue
594
- return this.getErrorPayloadForClientErrorCode({
595
- clientErrorCode: _config2.UNKNOWN_ERROR,
596
- serviceErrorCode: serviceErrorCode || _config2.UNKNOWN_ERROR,
597
- serviceErrorName: rawError === null || rawError === void 0 ? void 0 : rawError.name,
598
- payloadOverrides: rawError.payloadOverrides,
599
- rawErrorMessage: rawErrorMessage,
600
- httpStatusCode: httpStatusCode
601
- });
714
+ // cache the payload for future use
715
+ this.eventErrorCache.set(rawError, payload);
716
+ return [payload, false];
602
717
  }
603
718
 
604
719
  /**
605
- * Create client event object for in meeting events
606
- * @param arg - create args
607
- * @param arg.event - event key
608
- * @param arg.options - options
720
+ * Create common object for in meeting events
721
+ * @param name
722
+ * @param options
723
+ * @param eventType - 'client' | 'feature'
609
724
  * @returns object
610
725
  */
611
726
  }, {
612
- key: "createClientEventObjectInMeeting",
613
- value: function createClientEventObjectInMeeting(_ref5) {
727
+ key: "createCommonEventObjectInMeeting",
728
+ value: function createCommonEventObjectInMeeting(_ref7) {
614
729
  var _this$webex$meetings2, _this$webex$meetings3, _this$webex$meetings4, _options$joinFlowVers, _meeting$callStateFor;
615
- var name = _ref5.name,
616
- options = _ref5.options,
617
- errors = _ref5.errors;
730
+ var name = _ref7.name,
731
+ options = _ref7.options,
732
+ _ref7$eventType = _ref7.eventType,
733
+ eventType = _ref7$eventType === void 0 ? 'client' : _ref7$eventType;
618
734
  var meetingId = options.meetingId,
619
735
  mediaConnections = options.mediaConnections,
620
736
  globalMeetingId = options.globalMeetingId,
@@ -624,9 +740,9 @@ var CallDiagnosticMetrics = exports.default = /*#__PURE__*/function (_StatelessW
624
740
  // @ts-ignore
625
741
  var meeting = this.webex.meetings.getBasicMeetingInformation(meetingId);
626
742
  if (!meeting) {
627
- console.warn('Attempt to send client event but no meeting was found...', "name: ".concat(name, ", meetingId: ").concat(meetingId));
743
+ console.warn('Attempt to send common event but no meeting was found...', "name: ".concat(name, ", meetingId: ").concat(meetingId));
628
744
  // @ts-ignore
629
- this.webex.internal.metrics.submitClientMetrics(_config2.CALL_DIAGNOSTIC_EVENT_FAILED_TO_SEND, {
745
+ this.webex.internal.metrics.submitClientMetrics(eventType === 'feature' ? _config2.CALL_FEATURE_EVENT_FAILED_TO_SEND : _config2.CALL_DIAGNOSTIC_EVENT_FAILED_TO_SEND, {
630
746
  fields: {
631
747
  meetingId: meetingId,
632
748
  name: name
@@ -644,12 +760,11 @@ var CallDiagnosticMetrics = exports.default = /*#__PURE__*/function (_StatelessW
644
760
  sessionCorrelationId: sessionCorrelationId
645
761
  });
646
762
 
647
- // create client event object
648
- var clientEventObject = {
763
+ // create common event object structur
764
+ var commonEventObject = _objectSpread(_objectSpread(_objectSpread({
649
765
  name: name,
650
766
  canProceed: true,
651
767
  identifiers: identifiers,
652
- errors: errors,
653
768
  eventData: {
654
769
  webClientDomain: window.location.hostname
655
770
  },
@@ -657,19 +772,80 @@ var CallDiagnosticMetrics = exports.default = /*#__PURE__*/function (_StatelessW
657
772
  loginType: 'loginType' in meeting.callStateForMetrics ? meeting.callStateForMetrics.loginType : this.getCurLoginType(),
658
773
  isConvergedArchitectureEnabled: this.getIsConvergedArchitectureEnabled({
659
774
  meetingId: meetingId
660
- }),
775
+ })
776
+ }, meeting.userNameInput && {
777
+ userNameInput: meeting.userNameInput
778
+ }), meeting.emailInput && {
779
+ emailInput: meeting.emailInput
780
+ }), {}, {
661
781
  webexSubServiceType: this.getSubServiceType(meeting),
662
782
  // @ts-ignore
663
783
  webClientPreload: (_this$webex$meetings2 = this.webex.meetings) === null || _this$webex$meetings2 === void 0 ? void 0 : (_this$webex$meetings3 = _this$webex$meetings2.config) === null || _this$webex$meetings3 === void 0 ? void 0 : (_this$webex$meetings4 = _this$webex$meetings3.metrics) === null || _this$webex$meetings4 === void 0 ? void 0 : _this$webex$meetings4.webClientPreload
664
- };
784
+ });
665
785
  var joinFlowVersion = (_options$joinFlowVers = options.joinFlowVersion) !== null && _options$joinFlowVers !== void 0 ? _options$joinFlowVers : (_meeting$callStateFor = meeting.callStateForMetrics) === null || _meeting$callStateFor === void 0 ? void 0 : _meeting$callStateFor.joinFlowVersion;
666
786
  if (joinFlowVersion) {
667
- clientEventObject.joinFlowVersion = joinFlowVersion;
787
+ // @ts-ignore
788
+ commonEventObject.joinFlowVersion = joinFlowVersion;
789
+ }
790
+ var meetingJoinedTime = meeting.isoLocalClientMeetingJoinTime;
791
+ if (meetingJoinedTime) {
792
+ // @ts-ignore
793
+ commonEventObject.meetingJoinedTime = meetingJoinedTime;
668
794
  }
669
795
  if (options.meetingJoinPhase) {
670
- clientEventObject.meetingJoinPhase = options.meetingJoinPhase;
796
+ // @ts-ignore
797
+ commonEventObject.meetingJoinPhase = options.meetingJoinPhase;
671
798
  }
672
- return clientEventObject;
799
+ return commonEventObject;
800
+ }
801
+
802
+ /**
803
+ * Create client event object for in meeting events
804
+ * @param arg - create args
805
+ * @param arg.event - event key
806
+ * @param arg.options - options
807
+ * @returns object
808
+ */
809
+ }, {
810
+ key: "createClientEventObjectInMeeting",
811
+ value: function createClientEventObjectInMeeting(_ref8) {
812
+ var name = _ref8.name,
813
+ options = _ref8.options,
814
+ errors = _ref8.errors;
815
+ var commonObject = this.createCommonEventObjectInMeeting({
816
+ name: name,
817
+ options: options,
818
+ eventType: 'client'
819
+ });
820
+ if (!commonObject) return undefined;
821
+ return _objectSpread(_objectSpread({}, commonObject), {}, {
822
+ errors: errors,
823
+ eventData: _objectSpread(_objectSpread({}, commonObject.eventData), {}, {
824
+ isMercuryConnected: this.isMercuryConnected
825
+ })
826
+ });
827
+ }
828
+
829
+ /**
830
+ * Create feature event object for in meeting function event
831
+ * @param name
832
+ * @param options
833
+ * @returns object
834
+ */
835
+ }, {
836
+ key: "createFeatureEventObjectInMeeting",
837
+ value: function createFeatureEventObjectInMeeting(_ref9) {
838
+ var name = _ref9.name,
839
+ options = _ref9.options;
840
+ var commonObject = this.createCommonEventObjectInMeeting({
841
+ name: name,
842
+ options: options,
843
+ eventType: 'feature'
844
+ });
845
+ if (!commonObject) return undefined;
846
+ return _objectSpread(_objectSpread({}, commonObject), {}, {
847
+ key: 'UcfFeatureUsage'
848
+ });
673
849
  }
674
850
 
675
851
  /**
@@ -681,11 +857,11 @@ var CallDiagnosticMetrics = exports.default = /*#__PURE__*/function (_StatelessW
681
857
  */
682
858
  }, {
683
859
  key: "createClientEventObjectPreMeeting",
684
- value: function createClientEventObjectPreMeeting(_ref6) {
860
+ value: function createClientEventObjectPreMeeting(_ref10) {
685
861
  var _this$webex$meetings5, _this$webex$meetings6, _this$webex$meetings7;
686
- var name = _ref6.name,
687
- options = _ref6.options,
688
- errors = _ref6.errors;
862
+ var name = _ref10.name,
863
+ options = _ref10.options,
864
+ errors = _ref10.errors;
689
865
  var correlationId = options.correlationId,
690
866
  globalMeetingId = options.globalMeetingId,
691
867
  webexConferenceIdStr = options.webexConferenceIdStr,
@@ -708,7 +884,8 @@ var CallDiagnosticMetrics = exports.default = /*#__PURE__*/function (_StatelessW
708
884
  canProceed: true,
709
885
  identifiers: identifiers,
710
886
  eventData: {
711
- webClientDomain: window.location.hostname
887
+ webClientDomain: window.location.hostname,
888
+ isMercuryConnected: this.isMercuryConnected
712
889
  },
713
890
  loginType: this.getCurLoginType(),
714
891
  // @ts-ignore
@@ -720,6 +897,12 @@ var CallDiagnosticMetrics = exports.default = /*#__PURE__*/function (_StatelessW
720
897
  if (options.meetingJoinPhase) {
721
898
  clientEventObject.meetingJoinPhase = options.meetingJoinPhase;
722
899
  }
900
+ if (options.userNameInput) {
901
+ clientEventObject.userNameInput = options.userNameInput;
902
+ }
903
+ if (options.emailInput) {
904
+ clientEventObject.emailInput = options.emailInput;
905
+ }
723
906
  return clientEventObject;
724
907
  }
725
908
 
@@ -734,10 +917,10 @@ var CallDiagnosticMetrics = exports.default = /*#__PURE__*/function (_StatelessW
734
917
  */
735
918
  }, {
736
919
  key: "prepareClientEvent",
737
- value: function prepareClientEvent(_ref7) {
738
- var name = _ref7.name,
739
- payload = _ref7.payload,
740
- options = _ref7.options;
920
+ value: function prepareClientEvent(_ref11) {
921
+ var name = _ref11.name,
922
+ payload = _ref11.payload,
923
+ options = _ref11.options;
741
924
  var meetingId = options.meetingId,
742
925
  correlationId = options.correlationId,
743
926
  rawError = options.rawError;
@@ -746,11 +929,14 @@ var CallDiagnosticMetrics = exports.default = /*#__PURE__*/function (_StatelessW
746
929
  // check if we need to generate errors
747
930
  var errors = [];
748
931
  if (rawError) {
749
- var generatedError = this.generateClientEventErrorPayload(rawError);
932
+ var _this$generateClientE = this.generateClientEventErrorPayload(rawError),
933
+ _this$generateClientE2 = (0, _slicedToArray2.default)(_this$generateClientE, 2),
934
+ generatedError = _this$generateClientE2[0],
935
+ cached = _this$generateClientE2[1];
750
936
  if (generatedError) {
751
937
  errors.push(generatedError);
752
938
  }
753
- this.logger.log(_config2.CALL_DIAGNOSTIC_LOG_IDENTIFIER, 'CallDiagnosticMetrics: @prepareClientEvent. Generated errors:', "generatedError: ".concat((0, _stringify.default)(generatedError)));
939
+ this.logger.log(_config2.CALL_DIAGNOSTIC_LOG_IDENTIFIER, 'CallDiagnosticMetrics: @prepareClientEvent. Generated errors:', "generatedError (cached: ".concat(cached, "): ").concat((0, _stringify.default)(generatedError)));
754
940
  }
755
941
 
756
942
  // events that will most likely happen in join phase
@@ -790,11 +976,11 @@ var CallDiagnosticMetrics = exports.default = /*#__PURE__*/function (_StatelessW
790
976
  */
791
977
  }, {
792
978
  key: "submitClientEvent",
793
- value: function submitClientEvent(_ref8) {
794
- var name = _ref8.name,
795
- payload = _ref8.payload,
796
- options = _ref8.options,
797
- delaySubmitEvent = _ref8.delaySubmitEvent;
979
+ value: function submitClientEvent(_ref12) {
980
+ var name = _ref12.name,
981
+ payload = _ref12.payload,
982
+ options = _ref12.options,
983
+ delaySubmitEvent = _ref12.delaySubmitEvent;
798
984
  if (delaySubmitEvent) {
799
985
  // Preserve the time when the event was triggered if delaying the submission to Call Diagnostics
800
986
  var delayedOptions = _objectSpread(_objectSpread({}, options), {}, {
@@ -828,19 +1014,53 @@ var CallDiagnosticMetrics = exports.default = /*#__PURE__*/function (_StatelessW
828
1014
  */
829
1015
  }, {
830
1016
  key: "submitDelayedClientEvents",
831
- value: function submitDelayedClientEvents() {
1017
+ value: function submitDelayedClientEvents(overrides) {
832
1018
  var _this2 = this;
833
1019
  this.logger.log(_config2.CALL_DIAGNOSTIC_LOG_IDENTIFIER, 'CallDiagnosticMetrics: @submitDelayedClientEvents. Submitting delayed client events.');
834
1020
  if (this.delayedClientEvents.length === 0) {
835
1021
  return _promise.default.resolve();
836
1022
  }
837
1023
  var promises = this.delayedClientEvents.map(function (delayedSubmitClientEventParams) {
838
- return _this2.submitClientEvent(delayedSubmitClientEventParams);
1024
+ var name = delayedSubmitClientEventParams.name,
1025
+ payload = delayedSubmitClientEventParams.payload,
1026
+ options = delayedSubmitClientEventParams.options;
1027
+ var optionsWithOverrides = _objectSpread(_objectSpread({}, options), overrides);
1028
+ return _this2.submitClientEvent({
1029
+ name: name,
1030
+ payload: payload,
1031
+ options: optionsWithOverrides
1032
+ });
839
1033
  });
840
1034
  this.delayedClientEvents = [];
841
1035
  return _promise.default.all(promises);
842
1036
  }
843
1037
 
1038
+ /**
1039
+ * Submit Delayed feature Event CA events. Clears submitDelayedClientFeatureEvents array after submission.
1040
+ */
1041
+ }, {
1042
+ key: "submitDelayedClientFeatureEvents",
1043
+ value: function submitDelayedClientFeatureEvents(overrides) {
1044
+ var _this3 = this;
1045
+ this.logger.log(_config2.CALL_FEATURE_LOG_IDENTIFIER, 'CallDiagnosticMetrics: @submitDelayedClientFeatureEvents. Submitting delayed feature events.');
1046
+ if (this.delayedClientFeatureEvents.length === 0) {
1047
+ return _promise.default.resolve();
1048
+ }
1049
+ var promises = this.delayedClientFeatureEvents.map(function (delayedSubmitClientEventParams) {
1050
+ var name = delayedSubmitClientEventParams.name,
1051
+ payload = delayedSubmitClientEventParams.payload,
1052
+ options = delayedSubmitClientEventParams.options;
1053
+ var optionsWithOverrides = _objectSpread(_objectSpread({}, options), overrides);
1054
+ return _this3.submitFeatureEvent({
1055
+ name: name,
1056
+ payload: payload,
1057
+ options: optionsWithOverrides
1058
+ });
1059
+ });
1060
+ this.delayedClientFeatureEvents = [];
1061
+ return _promise.default.all(promises);
1062
+ }
1063
+
844
1064
  /**
845
1065
  * Prepare the event and send the request to metrics-a service.
846
1066
  * @param event
@@ -869,12 +1089,12 @@ var CallDiagnosticMetrics = exports.default = /*#__PURE__*/function (_StatelessW
869
1089
  * @throws
870
1090
  */
871
1091
  function () {
872
- var _buildClientEventFetchRequestOptions = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee(_ref9) {
1092
+ var _buildClientEventFetchRequestOptions = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee(_ref13) {
873
1093
  var name, payload, options, clientEvent, diagnosticEvent, request;
874
1094
  return _regenerator.default.wrap(function _callee$(_context) {
875
1095
  while (1) switch (_context.prev = _context.next) {
876
1096
  case 0:
877
- name = _ref9.name, payload = _ref9.payload, options = _ref9.options;
1097
+ name = _ref13.name, payload = _ref13.payload, options = _ref13.options;
878
1098
  this.logger.log(_config2.CALL_DIAGNOSTIC_LOG_IDENTIFIER, 'CallDiagnosticMetrics: @buildClientEventFetchRequestOptions. Building request options object for fetch()...', "name: ".concat(name));
879
1099
  clientEvent = this.prepareClientEvent({
880
1100
  name: name,