@webex/internal-plugin-metrics 3.12.0-next.3 → 3.12.0-next.31

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 (39) hide show
  1. package/dist/batcher.js +3 -0
  2. package/dist/batcher.js.map +1 -1
  3. package/dist/call-diagnostic/call-diagnostic-metrics-batcher.js +23 -0
  4. package/dist/call-diagnostic/call-diagnostic-metrics-batcher.js.map +1 -1
  5. package/dist/call-diagnostic/call-diagnostic-metrics-latencies.js +68 -51
  6. package/dist/call-diagnostic/call-diagnostic-metrics-latencies.js.map +1 -1
  7. package/dist/call-diagnostic/call-diagnostic-metrics.js +80 -8
  8. package/dist/call-diagnostic/call-diagnostic-metrics.js.map +1 -1
  9. package/dist/call-diagnostic/call-diagnostic-metrics.util.js +5 -0
  10. package/dist/call-diagnostic/call-diagnostic-metrics.util.js.map +1 -1
  11. package/dist/call-diagnostic/config.js +16 -3
  12. package/dist/call-diagnostic/config.js.map +1 -1
  13. package/dist/config.js +1 -0
  14. package/dist/config.js.map +1 -1
  15. package/dist/metrics.js +1 -1
  16. package/dist/metrics.types.js.map +1 -1
  17. package/dist/prelogin-metrics-batcher.js +23 -0
  18. package/dist/prelogin-metrics-batcher.js.map +1 -1
  19. package/dist/types/call-diagnostic/call-diagnostic-metrics-latencies.d.ts +9 -0
  20. package/dist/types/call-diagnostic/call-diagnostic-metrics.d.ts +69 -13
  21. package/dist/types/call-diagnostic/config.d.ts +4 -0
  22. package/dist/types/config.d.ts +1 -0
  23. package/dist/types/metrics.types.d.ts +2 -2
  24. package/package.json +11 -11
  25. package/src/batcher.js +4 -0
  26. package/src/call-diagnostic/call-diagnostic-metrics-batcher.ts +26 -0
  27. package/src/call-diagnostic/call-diagnostic-metrics-latencies.ts +140 -69
  28. package/src/call-diagnostic/call-diagnostic-metrics.ts +74 -1
  29. package/src/call-diagnostic/call-diagnostic-metrics.util.ts +5 -0
  30. package/src/call-diagnostic/config.ts +14 -0
  31. package/src/config.js +1 -0
  32. package/src/metrics.types.ts +1 -1
  33. package/src/prelogin-metrics-batcher.ts +26 -0
  34. package/test/unit/spec/batcher.js +43 -0
  35. package/test/unit/spec/call-diagnostic/call-diagnostic-metrics-batcher.ts +150 -2
  36. package/test/unit/spec/call-diagnostic/call-diagnostic-metrics-latencies.ts +243 -288
  37. package/test/unit/spec/call-diagnostic/call-diagnostic-metrics.ts +764 -159
  38. package/test/unit/spec/call-diagnostic/call-diagnostic-metrics.util.ts +27 -0
  39. package/test/unit/spec/prelogin-metrics-batcher.ts +190 -36
@@ -77,6 +77,8 @@ var CallDiagnosticMetrics = exports.default = /*#__PURE__*/function (_StatelessW
77
77
  (0, _defineProperty2.default)(_this, "isMercuryConnected", false);
78
78
  (0, _defineProperty2.default)(_this, "eventLimitTracker", new _map.default());
79
79
  (0, _defineProperty2.default)(_this, "eventLimitWarningsLogged", new _set.default());
80
+ (0, _defineProperty2.default)(_this, "isTelemetryOptOutManual", false);
81
+ (0, _defineProperty2.default)(_this, "isTelemetryOptOutAutomatic", false);
80
82
  // the default validator before piping an event to the batcher
81
83
  // this function can be overridden by the user
82
84
  (0, _defineProperty2.default)(_this, "validator", function (options) {
@@ -89,13 +91,15 @@ var CallDiagnosticMetrics = exports.default = /*#__PURE__*/function (_StatelessW
89
91
  * Prepare the event and send the request to metrics-a service, pre login.
90
92
  * @param event
91
93
  * @param preLoginId
94
+ * @param markTelemetryOptOutOnResponse
92
95
  * @returns
93
96
  */
94
97
  (0, _defineProperty2.default)(_this, "submitToCallDiagnosticsPreLogin", function (event, preLoginId) {
95
98
  // build metrics-a event type
96
99
  var finalEvent = {
97
100
  eventPayload: event,
98
- type: ['diagnostic-event']
101
+ type: ['diagnostic-event'],
102
+ markTelemetryOptOutOnResponse: true
99
103
  };
100
104
  _this.preLoginMetricsBatcher.savePreLoginId(preLoginId);
101
105
  return _this.preLoginMetricsBatcher.request(finalEvent);
@@ -128,6 +132,59 @@ var CallDiagnosticMetrics = exports.default = /*#__PURE__*/function (_StatelessW
128
132
  return null;
129
133
  }
130
134
 
135
+ /**
136
+ * Returns the user activation state reported from the browser's navigator.userActivation API
137
+ * @returns object with hasBeenActive and isActive booleans, or undefined if unavailable
138
+ */
139
+ }, {
140
+ key: "getUserActivation",
141
+ value: function getUserActivation() {
142
+ var userActivation = typeof navigator !== 'undefined' ? navigator.userActivation : undefined;
143
+ if (userActivation) {
144
+ return {
145
+ hasBeenActive: userActivation.hasBeenActive,
146
+ isActive: userActivation.isActive
147
+ };
148
+ }
149
+ return undefined;
150
+ }
151
+
152
+ /**
153
+ * Returns the telemetryOptOut value of the current user
154
+ * @returns one of 'manual', 'automatic', undefined
155
+ */
156
+ }, {
157
+ key: "getTelemetryOptOut",
158
+ value: function getTelemetryOptOut() {
159
+ if (this.isTelemetryOptOutManual) {
160
+ return 'manual';
161
+ }
162
+ if (this.isTelemetryOptOutAutomatic) {
163
+ return 'automatic';
164
+ }
165
+ return undefined;
166
+ }
167
+
168
+ /**
169
+ * Sets the manual telemetry opt-out status for the current user
170
+ * @param value - boolean value indicating manual telemetry opt-out status
171
+ */
172
+ }, {
173
+ key: "setIsTelemetryOptOutManual",
174
+ value: function setIsTelemetryOptOutManual(value) {
175
+ this.isTelemetryOptOutManual = value;
176
+ }
177
+
178
+ /**
179
+ * Sets the automatic telemetry opt-out status for the current user
180
+ * @param value - boolean value indicating automatic telemetry opt-out status
181
+ */
182
+ }, {
183
+ key: "setIsTelemetryOptOutAutomatic",
184
+ value: function setIsTelemetryOptOutAutomatic(value) {
185
+ this.isTelemetryOptOutAutomatic = value;
186
+ }
187
+
131
188
  /**
132
189
  * Returns if the meeting has converged architecture enabled
133
190
  * @param options.meetingId
@@ -179,6 +236,10 @@ var CallDiagnosticMetrics = exports.default = /*#__PURE__*/function (_StatelessW
179
236
 
180
237
  // if ConvergedArchitecture enable and isConvergedWebinarWebcast -- then webcast
181
238
  if (meetingInfo !== null && meetingInfo !== void 0 && meetingInfo.enableConvergedArchitecture && meetingInfo !== null && meetingInfo !== void 0 && meetingInfo.enableEvent) {
239
+ // if enableConvergedWebinarLargeScale - then large scale webinar
240
+ if (meetingInfo !== null && meetingInfo !== void 0 && meetingInfo.enableConvergedWebinarLargeScale) {
241
+ return _config2.WEBEX_SUB_SERVICE_TYPES.LARGE_SCALE_WEBINAR;
242
+ }
182
243
  return meetingInfo !== null && meetingInfo !== void 0 && meetingInfo.isConvergedWebinarWebcast ? _config2.WEBEX_SUB_SERVICE_TYPES.WEBCAST : _config2.WEBEX_SUB_SERVICE_TYPES.WEBINAR;
183
244
  }
184
245
 
@@ -544,7 +605,8 @@ var CallDiagnosticMetrics = exports.default = /*#__PURE__*/function (_StatelessW
544
605
  mediaEngineSoftwareType: getBrowserName() || 'browser',
545
606
  mediaEngineSoftwareVersion: getOSVersion() || 'unknown',
546
607
  startTime: new Date().toISOString()
547
- }
608
+ },
609
+ webexSubServiceType: this.getSubServiceType(meeting)
548
610
  };
549
611
 
550
612
  // merge any new properties, or override existing ones
@@ -854,7 +916,7 @@ var CallDiagnosticMetrics = exports.default = /*#__PURE__*/function (_StatelessW
854
916
  }, {
855
917
  key: "createCommonEventObjectInMeeting",
856
918
  value: function createCommonEventObjectInMeeting(_ref8) {
857
- var _this$webex$meetings2, _this$webex$meetings3, _this$webex$meetings4, _options$joinFlowVers, _meeting$callStateFor;
919
+ var _this$webex$meetings2, _this$webex$meetings3, _this$webex$meetings4, _meeting$meetingInfo0, _navigator, _options$joinFlowVers, _meeting$callStateFor;
858
920
  var name = _ref8.name,
859
921
  options = _ref8.options,
860
922
  _ref8$eventType = _ref8.eventType,
@@ -888,7 +950,7 @@ var CallDiagnosticMetrics = exports.default = /*#__PURE__*/function (_StatelessW
888
950
  sessionCorrelationId: sessionCorrelationId
889
951
  });
890
952
 
891
- // create common event object structur
953
+ // create common event object structure
892
954
  var commonEventObject = _objectSpread(_objectSpread(_objectSpread({
893
955
  name: name,
894
956
  canProceed: true,
@@ -898,6 +960,7 @@ var CallDiagnosticMetrics = exports.default = /*#__PURE__*/function (_StatelessW
898
960
  },
899
961
  userType: meeting.getCurUserType(),
900
962
  loginType: 'loginType' in meeting.callStateForMetrics ? meeting.callStateForMetrics.loginType : this.getCurLoginType(),
963
+ telemetryOptOut: this.getTelemetryOptOut(),
901
964
  isConvergedArchitectureEnabled: this.getIsConvergedArchitectureEnabled({
902
965
  meetingId: meetingId
903
966
  })
@@ -908,7 +971,11 @@ var CallDiagnosticMetrics = exports.default = /*#__PURE__*/function (_StatelessW
908
971
  }), {}, {
909
972
  webexSubServiceType: this.getSubServiceType(meeting),
910
973
  // @ts-ignore
911
- 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
974
+ 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,
975
+ isVipMeeting: (meeting === null || meeting === void 0 ? void 0 : (_meeting$meetingInfo0 = meeting.meetingInfo) === null || _meeting$meetingInfo0 === void 0 ? void 0 : _meeting$meetingInfo0.vipmeeting) || false,
976
+ isAutomatedUser: typeof window !== 'undefined' && typeof navigator !== 'undefined' && !!((_navigator = navigator) !== null && _navigator !== void 0 && _navigator.webdriver),
977
+ // if webdriver is true, it's most likely in a test environment
978
+ userActivation: this.getUserActivation()
912
979
  });
913
980
  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;
914
981
  if (joinFlowVersion) {
@@ -986,7 +1053,7 @@ var CallDiagnosticMetrics = exports.default = /*#__PURE__*/function (_StatelessW
986
1053
  }, {
987
1054
  key: "createClientEventObjectPreMeeting",
988
1055
  value: function createClientEventObjectPreMeeting(_ref1) {
989
- var _this$webex$meetings5, _this$webex$meetings6, _this$webex$meetings7;
1056
+ var _this$webex$meetings5, _this$webex$meetings6, _this$webex$meetings7, _navigator2;
990
1057
  var name = _ref1.name,
991
1058
  options = _ref1.options,
992
1059
  errors = _ref1.errors;
@@ -1016,8 +1083,12 @@ var CallDiagnosticMetrics = exports.default = /*#__PURE__*/function (_StatelessW
1016
1083
  isMercuryConnected: this.isMercuryConnected
1017
1084
  },
1018
1085
  loginType: this.getCurLoginType(),
1086
+ telemetryOptOut: this.getTelemetryOptOut(),
1019
1087
  // @ts-ignore
1020
- webClientPreload: (_this$webex$meetings5 = this.webex.meetings) === null || _this$webex$meetings5 === void 0 ? void 0 : (_this$webex$meetings6 = _this$webex$meetings5.config) === null || _this$webex$meetings6 === void 0 ? void 0 : (_this$webex$meetings7 = _this$webex$meetings6.metrics) === null || _this$webex$meetings7 === void 0 ? void 0 : _this$webex$meetings7.webClientPreload
1088
+ webClientPreload: (_this$webex$meetings5 = this.webex.meetings) === null || _this$webex$meetings5 === void 0 ? void 0 : (_this$webex$meetings6 = _this$webex$meetings5.config) === null || _this$webex$meetings6 === void 0 ? void 0 : (_this$webex$meetings7 = _this$webex$meetings6.metrics) === null || _this$webex$meetings7 === void 0 ? void 0 : _this$webex$meetings7.webClientPreload,
1089
+ isAutomatedUser: typeof window !== 'undefined' && typeof navigator !== 'undefined' && !!((_navigator2 = navigator) !== null && _navigator2 !== void 0 && _navigator2.webdriver),
1090
+ // if webdriver is true, it's most likely in a test environment
1091
+ userActivation: this.getUserActivation()
1021
1092
  };
1022
1093
  if (options.joinFlowVersion) {
1023
1094
  clientEventObject.joinFlowVersion = options.joinFlowVersion;
@@ -1203,7 +1274,8 @@ var CallDiagnosticMetrics = exports.default = /*#__PURE__*/function (_StatelessW
1203
1274
  // build metrics-a event type
1204
1275
  var finalEvent = {
1205
1276
  eventPayload: event,
1206
- type: ['diagnostic-event']
1277
+ type: ['diagnostic-event'],
1278
+ markTelemetryOptOutOnResponse: true
1207
1279
  };
1208
1280
  return this.callDiagnosticEventsBatcher.request(finalEvent);
1209
1281
  }