@webex/internal-plugin-metrics 3.8.1 → 3.9.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 (35) hide show
  1. package/dist/call-diagnostic/call-diagnostic-metrics-latencies.js +92 -14
  2. package/dist/call-diagnostic/call-diagnostic-metrics-latencies.js.map +1 -1
  3. package/dist/call-diagnostic/call-diagnostic-metrics.js +348 -48
  4. package/dist/call-diagnostic/call-diagnostic-metrics.js.map +1 -1
  5. package/dist/call-diagnostic/call-diagnostic-metrics.util.js +21 -0
  6. package/dist/call-diagnostic/call-diagnostic-metrics.util.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/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 +43 -1
  13. package/dist/new-metrics.js.map +1 -1
  14. package/dist/types/call-diagnostic/call-diagnostic-metrics-latencies.d.ts +23 -1
  15. package/dist/types/call-diagnostic/call-diagnostic-metrics.d.ts +176 -10
  16. package/dist/types/call-diagnostic/config.d.ts +2 -0
  17. package/dist/types/index.d.ts +2 -2
  18. package/dist/types/metrics.types.d.ts +18 -7
  19. package/dist/types/new-metrics.d.ts +19 -2
  20. package/package.json +11 -12
  21. package/src/call-diagnostic/call-diagnostic-metrics-latencies.ts +104 -14
  22. package/src/call-diagnostic/call-diagnostic-metrics.ts +363 -25
  23. package/src/call-diagnostic/call-diagnostic-metrics.util.ts +20 -0
  24. package/src/call-diagnostic/config.ts +3 -0
  25. package/src/index.ts +2 -0
  26. package/src/metrics.types.ts +25 -6
  27. package/src/new-metrics.ts +52 -1
  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 +255 -0
  30. package/test/unit/spec/call-diagnostic/call-diagnostic-metrics.ts +829 -39
  31. package/test/unit/spec/call-diagnostic/call-diagnostic-metrics.util.ts +6 -0
  32. package/test/unit/spec/new-metrics.ts +67 -2
  33. package/test/unit/spec/prelogin-metrics-batcher.ts +72 -3
  34. package/dist/call-diagnostic-events-batcher.js +0 -60
  35. package/dist/call-diagnostic-events-batcher.js.map +0 -1
@@ -14,8 +14,11 @@ _Object$defineProperty(exports, "__esModule", {
14
14
  exports.default = void 0;
15
15
  var _regenerator = _interopRequireDefault(require("@babel/runtime-corejs2/regenerator"));
16
16
  var _weakMap = _interopRequireDefault(require("@babel/runtime-corejs2/core-js/weak-map"));
17
+ var _map = _interopRequireDefault(require("@babel/runtime-corejs2/core-js/map"));
18
+ var _set = _interopRequireDefault(require("@babel/runtime-corejs2/core-js/set"));
17
19
  var _promise = _interopRequireDefault(require("@babel/runtime-corejs2/core-js/promise"));
18
20
  var _stringify = _interopRequireDefault(require("@babel/runtime-corejs2/core-js/json/stringify"));
21
+ var _from = _interopRequireDefault(require("@babel/runtime-corejs2/core-js/array/from"));
19
22
  var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime-corejs2/helpers/asyncToGenerator"));
20
23
  var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime-corejs2/helpers/slicedToArray"));
21
24
  var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime-corejs2/helpers/classCallCheck"));
@@ -72,7 +75,11 @@ var CallDiagnosticMetrics = exports.default = /*#__PURE__*/function (_StatelessW
72
75
  (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "hasLoggedBrowserSerial", void 0);
73
76
  (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "device", void 0);
74
77
  (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "delayedClientEvents", []);
78
+ (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "delayedClientFeatureEvents", []);
75
79
  (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "eventErrorCache", new _weakMap.default());
80
+ (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "isMercuryConnected", false);
81
+ (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "eventLimitTracker", new _map.default());
82
+ (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "eventLimitWarningsLogged", new _set.default());
76
83
  // the default validator before piping an event to the batcher
77
84
  // this function can be overridden by the user
78
85
  (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "validator", function (options) {
@@ -140,6 +147,18 @@ var CallDiagnosticMetrics = exports.default = /*#__PURE__*/function (_StatelessW
140
147
  return undefined;
141
148
  }
142
149
 
150
+ /**
151
+ * Sets mercury connected status for event data object in CA events
152
+ * @public
153
+ * @param status - boolean value indicating mercury connection status
154
+ * @return {void}
155
+ */
156
+ }, {
157
+ key: "setMercuryConnectedStatus",
158
+ value: function setMercuryConnectedStatus(status) {
159
+ this.isMercuryConnected = status;
160
+ }
161
+
143
162
  /**
144
163
  * Returns meeting's subServiceType
145
164
  * @param meeting
@@ -375,14 +394,91 @@ var CallDiagnosticMetrics = exports.default = /*#__PURE__*/function (_StatelessW
375
394
  }
376
395
 
377
396
  /**
378
- * TODO: NOT IMPLEMENTED
397
+ * Create feature event
398
+ * @param name
399
+ * @param payload
400
+ * @param options
401
+ * @returns
402
+ */
403
+ }, {
404
+ key: "prepareClientFeatureEvent",
405
+ value: function prepareClientFeatureEvent(_ref3) {
406
+ var name = _ref3.name,
407
+ payload = _ref3.payload,
408
+ options = _ref3.options;
409
+ var meetingId = options.meetingId,
410
+ correlationId = options.correlationId;
411
+ var featureEventObject;
412
+
413
+ // events that will most likely happen in join phase
414
+ if (meetingId) {
415
+ featureEventObject = this.createFeatureEventObjectInMeeting({
416
+ name: name,
417
+ options: options
418
+ });
419
+ } else {
420
+ throw new Error('Not implemented');
421
+ }
422
+
423
+ // merge any new properties, or override existing ones
424
+ featureEventObject = (0, _lodash.merge)(featureEventObject, payload);
425
+
426
+ // append client event data to the call diagnostic event
427
+ var featureEvent = this.prepareDiagnosticEvent(featureEventObject, options);
428
+ return featureEvent;
429
+ }
430
+
431
+ /**
379
432
  * Submit Feature Event
433
+ * submit to business_ucf
380
434
  * @returns
381
435
  */
382
436
  }, {
383
437
  key: "submitFeatureEvent",
384
- value: function submitFeatureEvent() {
385
- throw Error('Not implemented');
438
+ value: function submitFeatureEvent(_ref4) {
439
+ var name = _ref4.name,
440
+ payload = _ref4.payload,
441
+ options = _ref4.options,
442
+ delaySubmitEvent = _ref4.delaySubmitEvent;
443
+ if (delaySubmitEvent) {
444
+ // Preserve the time when the event was triggered if delaying the submission to Call Features
445
+ var delayedOptions = _objectSpread(_objectSpread({}, options), {}, {
446
+ triggeredTime: new Date().toISOString()
447
+ });
448
+ this.delayedClientFeatureEvents.push({
449
+ name: name,
450
+ payload: payload,
451
+ options: delayedOptions
452
+ });
453
+ return _promise.default.resolve();
454
+ }
455
+ this.logger.log(_config2.CALL_FEATURE_LOG_IDENTIFIER, 'CallFeatureMetrics: @submitFeatureEvent. Submit Client Feature Event CA event.', "name: ".concat(name));
456
+ var featureEvent = this.prepareClientFeatureEvent({
457
+ name: name,
458
+ payload: payload,
459
+ options: options
460
+ });
461
+ this.validator({
462
+ type: 'ce',
463
+ event: featureEvent
464
+ });
465
+ return this.submitToCallFeatures(featureEvent);
466
+ }
467
+
468
+ /**
469
+ * Submit Feature Event
470
+ * type is business
471
+ * @param event
472
+ */
473
+ }, {
474
+ key: "submitToCallFeatures",
475
+ value: function submitToCallFeatures(event) {
476
+ // build metrics-a event type
477
+ var finalEvent = {
478
+ eventPayload: event,
479
+ type: ['business']
480
+ };
481
+ return this.callDiagnosticEventsBatcher.request(finalEvent);
386
482
  }
387
483
 
388
484
  /**
@@ -394,10 +490,10 @@ var CallDiagnosticMetrics = exports.default = /*#__PURE__*/function (_StatelessW
394
490
  */
395
491
  }, {
396
492
  key: "submitMQE",
397
- value: function submitMQE(_ref3) {
398
- var name = _ref3.name,
399
- payload = _ref3.payload,
400
- options = _ref3.options;
493
+ value: function submitMQE(_ref5) {
494
+ var name = _ref5.name,
495
+ payload = _ref5.payload,
496
+ options = _ref5.options;
401
497
  var meetingId = options.meetingId,
402
498
  mediaConnections = options.mediaConnections,
403
499
  webexConferenceIdStr = options.webexConferenceIdStr,
@@ -476,13 +572,13 @@ var CallDiagnosticMetrics = exports.default = /*#__PURE__*/function (_StatelessW
476
572
  */
477
573
  }, {
478
574
  key: "getErrorPayloadForClientErrorCode",
479
- value: function getErrorPayloadForClientErrorCode(_ref4) {
480
- var clientErrorCode = _ref4.clientErrorCode,
481
- serviceErrorCode = _ref4.serviceErrorCode,
482
- serviceErrorName = _ref4.serviceErrorName,
483
- rawErrorMessage = _ref4.rawErrorMessage,
484
- payloadOverrides = _ref4.payloadOverrides,
485
- httpStatusCode = _ref4.httpStatusCode;
575
+ value: function getErrorPayloadForClientErrorCode(_ref6) {
576
+ var clientErrorCode = _ref6.clientErrorCode,
577
+ serviceErrorCode = _ref6.serviceErrorCode,
578
+ serviceErrorName = _ref6.serviceErrorName,
579
+ rawErrorMessage = _ref6.rawErrorMessage,
580
+ payloadOverrides = _ref6.payloadOverrides,
581
+ httpStatusCode = _ref6.httpStatusCode;
486
582
  var error;
487
583
  if (clientErrorCode) {
488
584
  var partialParsedError = _config2.CLIENT_ERROR_CODE_TO_ERROR_PAYLOAD[clientErrorCode];
@@ -522,6 +618,128 @@ var CallDiagnosticMetrics = exports.default = /*#__PURE__*/function (_StatelessW
522
618
  this.eventErrorCache = new _weakMap.default();
523
619
  }
524
620
 
621
+ /**
622
+ * Checks if an event should be limited based on criteria defined in the event dictionary.
623
+ * Returns true if the event should be sent, false if it has reached its limit.
624
+ * @param event - The diagnostic event object
625
+ * @returns boolean indicating whether the event should be sent
626
+ */
627
+ }, {
628
+ key: "shouldSendEvent",
629
+ value: function shouldSendEvent(_ref7) {
630
+ var _event$identifiers;
631
+ var event = _ref7.event;
632
+ var eventName = event === null || event === void 0 ? void 0 : event.name;
633
+ var correlationId = event === null || event === void 0 ? void 0 : (_event$identifiers = event.identifiers) === null || _event$identifiers === void 0 ? void 0 : _event$identifiers.correlationId;
634
+ if (!correlationId || correlationId === 'unknown') {
635
+ return true;
636
+ }
637
+ var limitKeyPrefix = "".concat(eventName, ":").concat(correlationId);
638
+ switch (eventName) {
639
+ case 'client.media.render.start':
640
+ case 'client.media.render.stop':
641
+ case 'client.media.rx.start':
642
+ case 'client.media.rx.stop':
643
+ case 'client.media.tx.start':
644
+ case 'client.media.tx.stop':
645
+ {
646
+ // Send only once per mediaType-correlationId pair (or mediaType-correlationId-shareInstanceId for share/share_audio)
647
+ var mediaType = event === null || event === void 0 ? void 0 : event.mediaType;
648
+ if (mediaType) {
649
+ if (mediaType === 'share' || mediaType === 'share_audio') {
650
+ var shareInstanceId = event === null || event === void 0 ? void 0 : event.shareInstanceId;
651
+ if (shareInstanceId) {
652
+ var limitKey = "".concat(limitKeyPrefix, ":").concat(mediaType, ":").concat(shareInstanceId);
653
+ return this.checkAndIncrementEventCount(limitKey, 1, "".concat(eventName, " for ").concat(mediaType, " instance ").concat(shareInstanceId));
654
+ }
655
+ } else {
656
+ var _limitKey = "".concat(limitKeyPrefix, ":").concat(mediaType);
657
+ return this.checkAndIncrementEventCount(_limitKey, 1, "".concat(eventName, " for mediaType ").concat(mediaType));
658
+ }
659
+ }
660
+ break;
661
+ }
662
+ case 'client.roap-message.received':
663
+ case 'client.roap-message.sent':
664
+ {
665
+ var _event$roap, _event$roap2;
666
+ // Send only once per correlationId and roap.messageType/roap.type
667
+ var roapMessageType = (event === null || event === void 0 ? void 0 : (_event$roap = event.roap) === null || _event$roap === void 0 ? void 0 : _event$roap.messageType) || (event === null || event === void 0 ? void 0 : (_event$roap2 = event.roap) === null || _event$roap2 === void 0 ? void 0 : _event$roap2.type);
668
+ if (roapMessageType) {
669
+ var _limitKey2 = "".concat(limitKeyPrefix, ":").concat(roapMessageType);
670
+ return this.checkAndIncrementEventCount(_limitKey2, 1, "".concat(eventName, " for ROAP type ").concat(roapMessageType));
671
+ }
672
+ break;
673
+ }
674
+ default:
675
+ return true;
676
+ }
677
+ return true;
678
+ }
679
+
680
+ /**
681
+ * Checks the current count for a limit key and increments if under limit.
682
+ * @param limitKey - The unique key for this limit combination
683
+ * @param maxCount - Maximum allowed count
684
+ * @param eventDescription - Description for logging
685
+ * @returns true if under limit and incremented, false if at/over limit
686
+ */
687
+ }, {
688
+ key: "checkAndIncrementEventCount",
689
+ value: function checkAndIncrementEventCount(limitKey, maxCount, eventDescription) {
690
+ var currentCount = this.eventLimitTracker.get(limitKey) || 0;
691
+ if (currentCount >= maxCount) {
692
+ // Log warning only once per limit key
693
+ if (!this.eventLimitWarningsLogged.has(limitKey)) {
694
+ this.logger.log(_config2.CALL_DIAGNOSTIC_LOG_IDENTIFIER, "CallDiagnosticMetrics: Event limit reached for ".concat(eventDescription, ". ") + "Max count ".concat(maxCount, " exceeded. Event will not be sent."), "limitKey: ".concat(limitKey));
695
+ this.eventLimitWarningsLogged.add(limitKey);
696
+ }
697
+ return false;
698
+ }
699
+
700
+ // Increment count and allow event
701
+ this.eventLimitTracker.set(limitKey, currentCount + 1);
702
+ return true;
703
+ }
704
+
705
+ /**
706
+ * Clears event limit tracking
707
+ */
708
+ }, {
709
+ key: "clearEventLimits",
710
+ value: function clearEventLimits() {
711
+ this.eventLimitTracker.clear();
712
+ this.eventLimitWarningsLogged.clear();
713
+ }
714
+
715
+ /**
716
+ * Clears event limit tracking for a specific correlationId only.
717
+ * Keeps limits for other meetings intact.
718
+ */
719
+ }, {
720
+ key: "clearEventLimitsForCorrelationId",
721
+ value: function clearEventLimitsForCorrelationId(correlationId) {
722
+ if (!correlationId) {
723
+ return;
724
+ }
725
+ // Keys are formatted as "eventName:correlationId:..." across all limiters.
726
+ var hasCorrIdAtSecondToken = function hasCorrIdAtSecondToken(key) {
727
+ return key.split(':')[1] === correlationId;
728
+ };
729
+ for (var _i = 0, _Array$from = (0, _from.default)(this.eventLimitTracker.keys()); _i < _Array$from.length; _i++) {
730
+ var key = _Array$from[_i];
731
+ if (hasCorrIdAtSecondToken(key)) {
732
+ this.eventLimitTracker.delete(key);
733
+ }
734
+ }
735
+ for (var _i2 = 0, _Array$from3 = (0, _from.default)(this.eventLimitWarningsLogged.values()); _i2 < _Array$from3.length; _i2++) {
736
+ var _key2 = _Array$from3[_i2];
737
+ if (hasCorrIdAtSecondToken(_key2)) {
738
+ this.eventLimitWarningsLogged.delete(_key2);
739
+ }
740
+ }
741
+ }
742
+
525
743
  /**
526
744
  * Generate error payload for Client Event
527
745
  * @param rawError
@@ -626,19 +844,20 @@ var CallDiagnosticMetrics = exports.default = /*#__PURE__*/function (_StatelessW
626
844
  }
627
845
 
628
846
  /**
629
- * Create client event object for in meeting events
630
- * @param arg - create args
631
- * @param arg.event - event key
632
- * @param arg.options - options
847
+ * Create common object for in meeting events
848
+ * @param name
849
+ * @param options
850
+ * @param eventType - 'client' | 'feature'
633
851
  * @returns object
634
852
  */
635
853
  }, {
636
- key: "createClientEventObjectInMeeting",
637
- value: function createClientEventObjectInMeeting(_ref5) {
854
+ key: "createCommonEventObjectInMeeting",
855
+ value: function createCommonEventObjectInMeeting(_ref8) {
638
856
  var _this$webex$meetings2, _this$webex$meetings3, _this$webex$meetings4, _options$joinFlowVers, _meeting$callStateFor;
639
- var name = _ref5.name,
640
- options = _ref5.options,
641
- errors = _ref5.errors;
857
+ var name = _ref8.name,
858
+ options = _ref8.options,
859
+ _ref8$eventType = _ref8.eventType,
860
+ eventType = _ref8$eventType === void 0 ? 'client' : _ref8$eventType;
642
861
  var meetingId = options.meetingId,
643
862
  mediaConnections = options.mediaConnections,
644
863
  globalMeetingId = options.globalMeetingId,
@@ -648,9 +867,9 @@ var CallDiagnosticMetrics = exports.default = /*#__PURE__*/function (_StatelessW
648
867
  // @ts-ignore
649
868
  var meeting = this.webex.meetings.getBasicMeetingInformation(meetingId);
650
869
  if (!meeting) {
651
- console.warn('Attempt to send client event but no meeting was found...', "name: ".concat(name, ", meetingId: ").concat(meetingId));
870
+ console.warn('Attempt to send common event but no meeting was found...', "name: ".concat(name, ", meetingId: ").concat(meetingId));
652
871
  // @ts-ignore
653
- this.webex.internal.metrics.submitClientMetrics(_config2.CALL_DIAGNOSTIC_EVENT_FAILED_TO_SEND, {
872
+ this.webex.internal.metrics.submitClientMetrics(eventType === 'feature' ? _config2.CALL_FEATURE_EVENT_FAILED_TO_SEND : _config2.CALL_DIAGNOSTIC_EVENT_FAILED_TO_SEND, {
654
873
  fields: {
655
874
  meetingId: meetingId,
656
875
  name: name
@@ -668,12 +887,11 @@ var CallDiagnosticMetrics = exports.default = /*#__PURE__*/function (_StatelessW
668
887
  sessionCorrelationId: sessionCorrelationId
669
888
  });
670
889
 
671
- // create client event object
672
- var clientEventObject = _objectSpread(_objectSpread(_objectSpread({
890
+ // create common event object structur
891
+ var commonEventObject = _objectSpread(_objectSpread(_objectSpread({
673
892
  name: name,
674
893
  canProceed: true,
675
894
  identifiers: identifiers,
676
- errors: errors,
677
895
  eventData: {
678
896
  webClientDomain: window.location.hostname
679
897
  },
@@ -693,16 +911,68 @@ var CallDiagnosticMetrics = exports.default = /*#__PURE__*/function (_StatelessW
693
911
  });
694
912
  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;
695
913
  if (joinFlowVersion) {
696
- clientEventObject.joinFlowVersion = joinFlowVersion;
914
+ // @ts-ignore
915
+ commonEventObject.joinFlowVersion = joinFlowVersion;
697
916
  }
698
917
  var meetingJoinedTime = meeting.isoLocalClientMeetingJoinTime;
699
918
  if (meetingJoinedTime) {
700
- clientEventObject.meetingJoinedTime = meetingJoinedTime;
919
+ // @ts-ignore
920
+ commonEventObject.meetingJoinedTime = meetingJoinedTime;
701
921
  }
702
922
  if (options.meetingJoinPhase) {
703
- clientEventObject.meetingJoinPhase = options.meetingJoinPhase;
923
+ // @ts-ignore
924
+ commonEventObject.meetingJoinPhase = options.meetingJoinPhase;
704
925
  }
705
- return clientEventObject;
926
+ return commonEventObject;
927
+ }
928
+
929
+ /**
930
+ * Create client event object for in meeting events
931
+ * @param arg - create args
932
+ * @param arg.event - event key
933
+ * @param arg.options - options
934
+ * @returns object
935
+ */
936
+ }, {
937
+ key: "createClientEventObjectInMeeting",
938
+ value: function createClientEventObjectInMeeting(_ref9) {
939
+ var name = _ref9.name,
940
+ options = _ref9.options,
941
+ errors = _ref9.errors;
942
+ var commonObject = this.createCommonEventObjectInMeeting({
943
+ name: name,
944
+ options: options,
945
+ eventType: 'client'
946
+ });
947
+ if (!commonObject) return undefined;
948
+ return _objectSpread(_objectSpread({}, commonObject), {}, {
949
+ errors: errors,
950
+ eventData: _objectSpread(_objectSpread({}, commonObject.eventData), {}, {
951
+ isMercuryConnected: this.isMercuryConnected
952
+ })
953
+ });
954
+ }
955
+
956
+ /**
957
+ * Create feature event object for in meeting function event
958
+ * @param name
959
+ * @param options
960
+ * @returns object
961
+ */
962
+ }, {
963
+ key: "createFeatureEventObjectInMeeting",
964
+ value: function createFeatureEventObjectInMeeting(_ref10) {
965
+ var name = _ref10.name,
966
+ options = _ref10.options;
967
+ var commonObject = this.createCommonEventObjectInMeeting({
968
+ name: name,
969
+ options: options,
970
+ eventType: 'feature'
971
+ });
972
+ if (!commonObject) return undefined;
973
+ return _objectSpread(_objectSpread({}, commonObject), {}, {
974
+ key: 'UcfFeatureUsage'
975
+ });
706
976
  }
707
977
 
708
978
  /**
@@ -714,11 +984,11 @@ var CallDiagnosticMetrics = exports.default = /*#__PURE__*/function (_StatelessW
714
984
  */
715
985
  }, {
716
986
  key: "createClientEventObjectPreMeeting",
717
- value: function createClientEventObjectPreMeeting(_ref6) {
987
+ value: function createClientEventObjectPreMeeting(_ref11) {
718
988
  var _this$webex$meetings5, _this$webex$meetings6, _this$webex$meetings7;
719
- var name = _ref6.name,
720
- options = _ref6.options,
721
- errors = _ref6.errors;
989
+ var name = _ref11.name,
990
+ options = _ref11.options,
991
+ errors = _ref11.errors;
722
992
  var correlationId = options.correlationId,
723
993
  globalMeetingId = options.globalMeetingId,
724
994
  webexConferenceIdStr = options.webexConferenceIdStr,
@@ -741,7 +1011,8 @@ var CallDiagnosticMetrics = exports.default = /*#__PURE__*/function (_StatelessW
741
1011
  canProceed: true,
742
1012
  identifiers: identifiers,
743
1013
  eventData: {
744
- webClientDomain: window.location.hostname
1014
+ webClientDomain: window.location.hostname,
1015
+ isMercuryConnected: this.isMercuryConnected
745
1016
  },
746
1017
  loginType: this.getCurLoginType(),
747
1018
  // @ts-ignore
@@ -773,10 +1044,10 @@ var CallDiagnosticMetrics = exports.default = /*#__PURE__*/function (_StatelessW
773
1044
  */
774
1045
  }, {
775
1046
  key: "prepareClientEvent",
776
- value: function prepareClientEvent(_ref7) {
777
- var name = _ref7.name,
778
- payload = _ref7.payload,
779
- options = _ref7.options;
1047
+ value: function prepareClientEvent(_ref12) {
1048
+ var name = _ref12.name,
1049
+ payload = _ref12.payload,
1050
+ options = _ref12.options;
780
1051
  var meetingId = options.meetingId,
781
1052
  correlationId = options.correlationId,
782
1053
  rawError = options.rawError;
@@ -832,11 +1103,11 @@ var CallDiagnosticMetrics = exports.default = /*#__PURE__*/function (_StatelessW
832
1103
  */
833
1104
  }, {
834
1105
  key: "submitClientEvent",
835
- value: function submitClientEvent(_ref8) {
836
- var name = _ref8.name,
837
- payload = _ref8.payload,
838
- options = _ref8.options,
839
- delaySubmitEvent = _ref8.delaySubmitEvent;
1106
+ value: function submitClientEvent(_ref13) {
1107
+ var name = _ref13.name,
1108
+ payload = _ref13.payload,
1109
+ options = _ref13.options,
1110
+ delaySubmitEvent = _ref13.delaySubmitEvent;
840
1111
  if (delaySubmitEvent) {
841
1112
  // Preserve the time when the event was triggered if delaying the submission to Call Diagnostics
842
1113
  var delayedOptions = _objectSpread(_objectSpread({}, options), {}, {
@@ -855,6 +1126,9 @@ var CallDiagnosticMetrics = exports.default = /*#__PURE__*/function (_StatelessW
855
1126
  payload: payload,
856
1127
  options: options
857
1128
  });
1129
+ if (!this.shouldSendEvent(diagnosticEvent)) {
1130
+ return _promise.default.resolve();
1131
+ }
858
1132
  if (options !== null && options !== void 0 && options.preLoginId) {
859
1133
  return this.submitToCallDiagnosticsPreLogin(diagnosticEvent, options === null || options === void 0 ? void 0 : options.preLoginId);
860
1134
  }
@@ -891,6 +1165,32 @@ var CallDiagnosticMetrics = exports.default = /*#__PURE__*/function (_StatelessW
891
1165
  return _promise.default.all(promises);
892
1166
  }
893
1167
 
1168
+ /**
1169
+ * Submit Delayed feature Event CA events. Clears submitDelayedClientFeatureEvents array after submission.
1170
+ */
1171
+ }, {
1172
+ key: "submitDelayedClientFeatureEvents",
1173
+ value: function submitDelayedClientFeatureEvents(overrides) {
1174
+ var _this3 = this;
1175
+ this.logger.log(_config2.CALL_FEATURE_LOG_IDENTIFIER, 'CallDiagnosticMetrics: @submitDelayedClientFeatureEvents. Submitting delayed feature events.');
1176
+ if (this.delayedClientFeatureEvents.length === 0) {
1177
+ return _promise.default.resolve();
1178
+ }
1179
+ var promises = this.delayedClientFeatureEvents.map(function (delayedSubmitClientEventParams) {
1180
+ var name = delayedSubmitClientEventParams.name,
1181
+ payload = delayedSubmitClientEventParams.payload,
1182
+ options = delayedSubmitClientEventParams.options;
1183
+ var optionsWithOverrides = _objectSpread(_objectSpread({}, options), overrides);
1184
+ return _this3.submitFeatureEvent({
1185
+ name: name,
1186
+ payload: payload,
1187
+ options: optionsWithOverrides
1188
+ });
1189
+ });
1190
+ this.delayedClientFeatureEvents = [];
1191
+ return _promise.default.all(promises);
1192
+ }
1193
+
894
1194
  /**
895
1195
  * Prepare the event and send the request to metrics-a service.
896
1196
  * @param event
@@ -919,12 +1219,12 @@ var CallDiagnosticMetrics = exports.default = /*#__PURE__*/function (_StatelessW
919
1219
  * @throws
920
1220
  */
921
1221
  function () {
922
- var _buildClientEventFetchRequestOptions = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee(_ref9) {
1222
+ var _buildClientEventFetchRequestOptions = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee(_ref14) {
923
1223
  var name, payload, options, clientEvent, diagnosticEvent, request;
924
1224
  return _regenerator.default.wrap(function _callee$(_context) {
925
1225
  while (1) switch (_context.prev = _context.next) {
926
1226
  case 0:
927
- name = _ref9.name, payload = _ref9.payload, options = _ref9.options;
1227
+ name = _ref14.name, payload = _ref14.payload, options = _ref14.options;
928
1228
  this.logger.log(_config2.CALL_DIAGNOSTIC_LOG_IDENTIFIER, 'CallDiagnosticMetrics: @buildClientEventFetchRequestOptions. Building request options object for fetch()...', "name: ".concat(name));
929
1229
  clientEvent = this.prepareClientEvent({
930
1230
  name: name,