@webex/internal-plugin-metrics 3.12.0-next.5 → 3.12.0-next.50

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 (84) hide show
  1. package/README.md +274 -0
  2. package/dist/automated-user.js +19 -0
  3. package/dist/automated-user.js.map +1 -0
  4. package/dist/batcher.js +3 -0
  5. package/dist/batcher.js.map +1 -1
  6. package/dist/call-diagnostic/call-diagnostic-metrics-latencies.js +635 -62
  7. package/dist/call-diagnostic/call-diagnostic-metrics-latencies.js.map +1 -1
  8. package/dist/call-diagnostic/call-diagnostic-metrics.js +188 -78
  9. package/dist/call-diagnostic/call-diagnostic-metrics.js.map +1 -1
  10. package/dist/call-diagnostic/call-diagnostic-metrics.util.js +5 -0
  11. package/dist/call-diagnostic/call-diagnostic-metrics.util.js.map +1 -1
  12. package/dist/call-diagnostic/config.js +16 -3
  13. package/dist/call-diagnostic/config.js.map +1 -1
  14. package/dist/config.js +8 -0
  15. package/dist/config.js.map +1 -1
  16. package/dist/index.js +25 -1
  17. package/dist/index.js.map +1 -1
  18. package/dist/metrics.js +118 -5
  19. package/dist/metrics.js.map +1 -1
  20. package/dist/metrics.types.js +4 -0
  21. package/dist/metrics.types.js.map +1 -1
  22. package/dist/network-telemetry.js +610 -0
  23. package/dist/network-telemetry.js.map +1 -0
  24. package/dist/new-metrics.js +63 -17
  25. package/dist/new-metrics.js.map +1 -1
  26. package/dist/privacy-and-security-permission-enricher/constants.js +18 -0
  27. package/dist/privacy-and-security-permission-enricher/constants.js.map +1 -0
  28. package/dist/privacy-and-security-permission-enricher/index.js +143 -0
  29. package/dist/privacy-and-security-permission-enricher/index.js.map +1 -0
  30. package/dist/privacy-and-security-permission-enricher/types.js +7 -0
  31. package/dist/privacy-and-security-permission-enricher/types.js.map +1 -0
  32. package/dist/privacy-and-security-permission-enricher/utils.js +71 -0
  33. package/dist/privacy-and-security-permission-enricher/utils.js.map +1 -0
  34. package/dist/types/automated-user.d.ts +2 -0
  35. package/dist/types/call-diagnostic/call-diagnostic-metrics-latencies.d.ts +208 -5
  36. package/dist/types/call-diagnostic/call-diagnostic-metrics.d.ts +73 -14
  37. package/dist/types/call-diagnostic/config.d.ts +4 -0
  38. package/dist/types/config.d.ts +9 -0
  39. package/dist/types/index.d.ts +5 -3
  40. package/dist/types/metrics.types.d.ts +7 -2
  41. package/dist/types/network-telemetry.d.ts +108 -0
  42. package/dist/types/new-metrics.d.ts +17 -1
  43. package/dist/types/privacy-and-security-permission-enricher/constants.d.ts +6 -0
  44. package/dist/types/privacy-and-security-permission-enricher/index.d.ts +40 -0
  45. package/dist/types/privacy-and-security-permission-enricher/types.d.ts +14 -0
  46. package/dist/types/privacy-and-security-permission-enricher/utils.d.ts +5 -0
  47. package/dist/types/unhandled-exception-telemetry/index.d.ts +60 -0
  48. package/dist/types/unhandled-exception-telemetry/utils.d.ts +6 -0
  49. package/dist/unhandled-exception-telemetry/index.js +330 -0
  50. package/dist/unhandled-exception-telemetry/index.js.map +1 -0
  51. package/dist/unhandled-exception-telemetry/utils.js +105 -0
  52. package/dist/unhandled-exception-telemetry/utils.js.map +1 -0
  53. package/package.json +12 -11
  54. package/src/automated-user.ts +16 -0
  55. package/src/batcher.js +4 -0
  56. package/src/call-diagnostic/call-diagnostic-metrics-latencies.ts +781 -71
  57. package/src/call-diagnostic/call-diagnostic-metrics.ts +119 -16
  58. package/src/call-diagnostic/call-diagnostic-metrics.util.ts +5 -0
  59. package/src/call-diagnostic/config.ts +14 -0
  60. package/src/config.js +8 -0
  61. package/src/index.ts +16 -0
  62. package/src/metrics.js +123 -5
  63. package/src/metrics.types.ts +25 -3
  64. package/src/network-telemetry.ts +757 -0
  65. package/src/new-metrics.ts +56 -6
  66. package/src/privacy-and-security-permission-enricher/constants.ts +33 -0
  67. package/src/privacy-and-security-permission-enricher/index.ts +142 -0
  68. package/src/privacy-and-security-permission-enricher/types.ts +21 -0
  69. package/src/privacy-and-security-permission-enricher/utils.ts +82 -0
  70. package/src/unhandled-exception-telemetry/index.ts +403 -0
  71. package/src/unhandled-exception-telemetry/utils.ts +101 -0
  72. package/test/unit/spec/automated-user.ts +43 -0
  73. package/test/unit/spec/batcher.js +43 -0
  74. package/test/unit/spec/call-diagnostic/call-diagnostic-metrics-batcher.ts +14 -2
  75. package/test/unit/spec/call-diagnostic/call-diagnostic-metrics-latencies.ts +1424 -293
  76. package/test/unit/spec/call-diagnostic/call-diagnostic-metrics.ts +906 -159
  77. package/test/unit/spec/call-diagnostic/call-diagnostic-metrics.util.ts +27 -0
  78. package/test/unit/spec/metrics.js +14 -5
  79. package/test/unit/spec/network-telemetry.ts +610 -0
  80. package/test/unit/spec/new-metrics.ts +203 -50
  81. package/test/unit/spec/prelogin-metrics-batcher.ts +71 -36
  82. package/test/unit/spec/privacy-and-security-permission-enricher.ts +318 -0
  83. package/test/unit/spec/unhandled-exception-telemetry/utils.ts +109 -0
  84. package/test/unit/spec/unhandled-exception-telemetry.ts +688 -0
@@ -1,5 +1,6 @@
1
1
  "use strict";
2
2
 
3
+ var _typeof = require("@babel/runtime-corejs2/helpers/typeof");
3
4
  var _Reflect$construct = require("@babel/runtime-corejs2/core-js/reflect/construct");
4
5
  var _Object$keys = require("@babel/runtime-corejs2/core-js/object/keys");
5
6
  var _Object$getOwnPropertySymbols = require("@babel/runtime-corejs2/core-js/object/get-own-property-symbols");
@@ -7,6 +8,7 @@ var _Object$getOwnPropertyDescriptor = require("@babel/runtime-corejs2/core-js/o
7
8
  var _Object$getOwnPropertyDescriptors = require("@babel/runtime-corejs2/core-js/object/get-own-property-descriptors");
8
9
  var _Object$defineProperties = require("@babel/runtime-corejs2/core-js/object/define-properties");
9
10
  var _Object$defineProperty = require("@babel/runtime-corejs2/core-js/object/define-property");
11
+ var _WeakMap2 = require("@babel/runtime-corejs2/core-js/weak-map");
10
12
  var _interopRequireDefault = require("@babel/runtime-corejs2/helpers/interopRequireDefault");
11
13
  _Object$defineProperty(exports, "__esModule", {
12
14
  value: true
@@ -32,11 +34,13 @@ var _uuid = _interopRequireDefault(require("uuid"));
32
34
  var _lodash = require("lodash");
33
35
  var _webexCore = require("@webex/webex-core");
34
36
  var _metrics = require("../metrics");
37
+ var AutomatedUserUtils = _interopRequireWildcard(require("../automated-user"));
35
38
  var _callDiagnosticMetrics = require("./call-diagnostic-metrics.util");
36
39
  var _config = require("../config");
37
40
  var _callDiagnosticMetricsBatcher = _interopRequireDefault(require("./call-diagnostic-metrics-batcher"));
38
41
  var _preloginMetricsBatcher = _interopRequireDefault(require("../prelogin-metrics-batcher"));
39
42
  var _config2 = require("./config");
43
+ function _interopRequireWildcard(e, t) { if ("function" == typeof _WeakMap2) var r = new _WeakMap2(), n = new _WeakMap2(); return (_interopRequireWildcard = function _interopRequireWildcard(e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != _typeof(e) && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (var _t in e) "default" !== _t && {}.hasOwnProperty.call(e, _t) && ((i = (o = _Object$defineProperty) && _Object$getOwnPropertyDescriptor(e, _t)) && (i.get || i.set) ? o(f, _t, i) : f[_t] = e[_t]); return f; })(e, t); }
40
44
  function ownKeys(e, r) { var t = _Object$keys(e); if (_Object$getOwnPropertySymbols) { var o = _Object$getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return _Object$getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
41
45
  function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { (0, _defineProperty2.default)(e, r, t[r]); }) : _Object$getOwnPropertyDescriptors ? _Object$defineProperties(e, _Object$getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { _Object$defineProperty(e, r, _Object$getOwnPropertyDescriptor(t, r)); }); } return e; }
42
46
  function _callSuper(t, o, e) { return o = (0, _getPrototypeOf2.default)(o), (0, _possibleConstructorReturn2.default)(t, _isNativeReflectConstruct() ? _Reflect$construct(o, e || [], (0, _getPrototypeOf2.default)(t).constructor) : o.apply(t, e)); }
@@ -67,8 +71,6 @@ var CallDiagnosticMetrics = exports.default = /*#__PURE__*/function (_StatelessW
67
71
  (0, _defineProperty2.default)(_this, "callDiagnosticEventsBatcher", void 0);
68
72
  // @ts-ignore
69
73
  (0, _defineProperty2.default)(_this, "preLoginMetricsBatcher", void 0);
70
- (0, _defineProperty2.default)(_this, "logger", void 0);
71
- // to avoid adding @ts-ignore everywhere
72
74
  (0, _defineProperty2.default)(_this, "hasLoggedBrowserSerial", void 0);
73
75
  (0, _defineProperty2.default)(_this, "device", void 0);
74
76
  (0, _defineProperty2.default)(_this, "delayedClientEvents", []);
@@ -77,6 +79,8 @@ var CallDiagnosticMetrics = exports.default = /*#__PURE__*/function (_StatelessW
77
79
  (0, _defineProperty2.default)(_this, "isMercuryConnected", false);
78
80
  (0, _defineProperty2.default)(_this, "eventLimitTracker", new _map.default());
79
81
  (0, _defineProperty2.default)(_this, "eventLimitWarningsLogged", new _set.default());
82
+ (0, _defineProperty2.default)(_this, "isTelemetryOptOutManual", false);
83
+ (0, _defineProperty2.default)(_this, "isTelemetryOptOutAutomatic", false);
80
84
  // the default validator before piping an event to the batcher
81
85
  // this function can be overridden by the user
82
86
  (0, _defineProperty2.default)(_this, "validator", function (options) {
@@ -100,8 +104,6 @@ var CallDiagnosticMetrics = exports.default = /*#__PURE__*/function (_StatelessW
100
104
  _this.preLoginMetricsBatcher.savePreLoginId(preLoginId);
101
105
  return _this.preLoginMetricsBatcher.request(finalEvent);
102
106
  });
103
- _this.logger = _this.webex.logger;
104
- // @ts-ignore
105
107
  _this.callDiagnosticEventsBatcher = new _callDiagnosticMetricsBatcher.default({}, {
106
108
  parent: _this.webex
107
109
  });
@@ -118,6 +120,14 @@ var CallDiagnosticMetrics = exports.default = /*#__PURE__*/function (_StatelessW
118
120
  */
119
121
  (0, _inherits2.default)(CallDiagnosticMetrics, _StatelessWebexPlugin);
120
122
  return (0, _createClass2.default)(CallDiagnosticMetrics, [{
123
+ key: "logger",
124
+ get:
125
+ // lazy getter to avoid @ts-ignore on every call site
126
+ function get() {
127
+ // @ts-ignore
128
+ return this.webex.logger;
129
+ }
130
+ }, {
121
131
  key: "getCurLoginType",
122
132
  value: function getCurLoginType() {
123
133
  // @ts-ignore
@@ -128,6 +138,59 @@ var CallDiagnosticMetrics = exports.default = /*#__PURE__*/function (_StatelessW
128
138
  return null;
129
139
  }
130
140
 
141
+ /**
142
+ * Returns the user activation state reported from the browser's navigator.userActivation API
143
+ * @returns object with hasBeenActive and isActive booleans, or undefined if unavailable
144
+ */
145
+ }, {
146
+ key: "getUserActivation",
147
+ value: function getUserActivation() {
148
+ var userActivation = typeof navigator !== 'undefined' ? navigator.userActivation : undefined;
149
+ if (userActivation) {
150
+ return {
151
+ hasBeenActive: userActivation.hasBeenActive,
152
+ isActive: userActivation.isActive
153
+ };
154
+ }
155
+ return undefined;
156
+ }
157
+
158
+ /**
159
+ * Returns the telemetryOptOut value of the current user
160
+ * @returns one of 'manual', 'automatic', undefined
161
+ */
162
+ }, {
163
+ key: "getTelemetryOptOut",
164
+ value: function getTelemetryOptOut() {
165
+ if (this.isTelemetryOptOutManual) {
166
+ return 'manual';
167
+ }
168
+ if (this.isTelemetryOptOutAutomatic) {
169
+ return 'automatic';
170
+ }
171
+ return undefined;
172
+ }
173
+
174
+ /**
175
+ * Sets the manual telemetry opt-out status for the current user
176
+ * @param value - boolean value indicating manual telemetry opt-out status
177
+ */
178
+ }, {
179
+ key: "setIsTelemetryOptOutManual",
180
+ value: function setIsTelemetryOptOutManual(value) {
181
+ this.isTelemetryOptOutManual = value;
182
+ }
183
+
184
+ /**
185
+ * Sets the automatic telemetry opt-out status for the current user
186
+ * @param value - boolean value indicating automatic telemetry opt-out status
187
+ */
188
+ }, {
189
+ key: "setIsTelemetryOptOutAutomatic",
190
+ value: function setIsTelemetryOptOutAutomatic(value) {
191
+ this.isTelemetryOptOutAutomatic = value;
192
+ }
193
+
131
194
  /**
132
195
  * Returns if the meeting has converged architecture enabled
133
196
  * @param options.meetingId
@@ -179,6 +242,10 @@ var CallDiagnosticMetrics = exports.default = /*#__PURE__*/function (_StatelessW
179
242
 
180
243
  // if ConvergedArchitecture enable and isConvergedWebinarWebcast -- then webcast
181
244
  if (meetingInfo !== null && meetingInfo !== void 0 && meetingInfo.enableConvergedArchitecture && meetingInfo !== null && meetingInfo !== void 0 && meetingInfo.enableEvent) {
245
+ // if enableConvergedWebinarLargeScale - then large scale webinar
246
+ if (meetingInfo !== null && meetingInfo !== void 0 && meetingInfo.enableConvergedWebinarLargeScale) {
247
+ return _config2.WEBEX_SUB_SERVICE_TYPES.LARGE_SCALE_WEBINAR;
248
+ }
182
249
  return meetingInfo !== null && meetingInfo !== void 0 && meetingInfo.isConvergedWebinarWebcast ? _config2.WEBEX_SUB_SERVICE_TYPES.WEBCAST : _config2.WEBEX_SUB_SERVICE_TYPES.WEBINAR;
183
250
  }
184
251
 
@@ -199,13 +266,13 @@ var CallDiagnosticMetrics = exports.default = /*#__PURE__*/function (_StatelessW
199
266
  }, {
200
267
  key: "getOrigin",
201
268
  value: function getOrigin(options, meetingId) {
202
- var _this$webex$meetings$, _this$webex$meetings$2, _this$webex$meetings$3, _this$webex$meetings$4, _this$webex$meetings$5, _this$webex$meetings$6;
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, _this$webex$meetings$3, _this$webex$meetings8, _this$webex$meetings9;
203
270
  var defaultClientType = // @ts-ignore
204
- (_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;
271
+ (_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;
205
272
  var defaultSubClientType = // @ts-ignore
206
- (_this$webex$meetings$3 = this.webex.meetings.config) === null || _this$webex$meetings$3 === void 0 ? void 0 : (_this$webex$meetings$4 = _this$webex$meetings$3.metrics) === null || _this$webex$meetings$4 === void 0 ? void 0 : _this$webex$meetings$4.subClientType;
273
+ (_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.subClientType;
207
274
  // @ts-ignore
208
- var providedClientVersion = (_this$webex$meetings$5 = this.webex.meetings.config) === null || _this$webex$meetings$5 === void 0 ? void 0 : (_this$webex$meetings$6 = _this$webex$meetings$5.metrics) === null || _this$webex$meetings$6 === void 0 ? void 0 : _this$webex$meetings$6.clientVersion;
275
+ var providedClientVersion = (_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.clientVersion;
209
276
  // @ts-ignore
210
277
  var defaultSDKClientVersion = "".concat(_config.CLIENT_NAME, "/").concat(this.webex.version);
211
278
  var versionMetadata = {};
@@ -214,40 +281,55 @@ var CallDiagnosticMetrics = exports.default = /*#__PURE__*/function (_StatelessW
214
281
  if (providedClientVersion) {
215
282
  versionMetadata = (0, _callDiagnosticMetrics.extractVersionMetadata)(providedClientVersion);
216
283
  }
284
+
285
+ // Browser details and the support verdict can all be supplied by the host client, which is able
286
+ // to resolve wrapper browsers (Electron, WebOS) to the engine that actually determines
287
+ // capability. The browser fields fall back to the SDK's own detection when not supplied, the
288
+ // same way clientVersion falls back to the SDK version.
289
+ 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 : {},
290
+ providedBrowser = _ref2.browser,
291
+ providedBrowserVersion = _ref2.browserVersion,
292
+ isSupportedBrowserFamily = _ref2.isSupportedBrowserFamily,
293
+ isOutdatedBrowserVersion = _ref2.isOutdatedBrowserVersion;
217
294
  if (!this.hasLoggedBrowserSerial) {
218
295
  this.logger.log(_config2.CALL_DIAGNOSTIC_LOG_IDENTIFIER, "CallDiagnosticMetrics: @createClientEventObjectInMeeting => collected browser data", (0, _stringify.default)((0, _common.getBrowserSerial)()));
219
296
  this.hasLoggedBrowserSerial = true;
220
297
  }
221
298
  if (defaultClientType && defaultSubClientType || options.clientType && options.subClientType) {
222
- var _this$webex$meetings, _this$webex$meetings$7, _this$webex$meetings$8, _this$webex$meetings$9, _this$webex$meetings$0, _this$webex$meetings$1;
299
+ 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;
223
300
  var origin = {
224
301
  name: 'endpoint',
225
302
  networkType: (options === null || options === void 0 ? void 0 : options.networkType) || 'unknown',
226
303
  userAgent: (0, _callDiagnosticMetrics.userAgentToString)({
227
304
  // @ts-ignore
228
- clientName: (_this$webex$meetings = this.webex.meetings) === null || _this$webex$meetings === void 0 ? void 0 : (_this$webex$meetings$7 = _this$webex$meetings.config) === null || _this$webex$meetings$7 === void 0 ? void 0 : (_this$webex$meetings$8 = _this$webex$meetings$7.metrics) === null || _this$webex$meetings$8 === void 0 ? void 0 : _this$webex$meetings$8.clientName,
305
+ 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,
229
306
  // @ts-ignore
230
307
  webexVersion: this.webex.version
231
308
  }),
232
- clientInfo: _objectSpread(_objectSpread({
309
+ clientInfo: _objectSpread(_objectSpread(_objectSpread({
233
310
  clientType: (options === null || options === void 0 ? void 0 : options.clientType) || defaultClientType,
234
311
  clientVersion: providedClientVersion || defaultSDKClientVersion
235
312
  }, versionMetadata), {}, {
236
313
  publicNetworkPrefix:
237
314
  // @ts-ignore
238
- (0, _callDiagnosticMetrics.anonymizeIPAddress)((_this$webex$meetings$9 = this.webex.meetings.geoHintInfo) === null || _this$webex$meetings$9 === void 0 ? void 0 : _this$webex$meetings$9.clientAddress) || undefined,
315
+ (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,
239
316
  localNetworkPrefix: (0, _callDiagnosticMetrics.anonymizeIPAddress)(// @ts-ignore
240
- (_this$webex$meetings$0 = this.webex.meetings.meetingCollection.get(meetingId)) === null || _this$webex$meetings$0 === void 0 ? void 0 : (_this$webex$meetings$1 = _this$webex$meetings$0.statsAnalyzer) === null || _this$webex$meetings$1 === void 0 ? void 0 : _this$webex$meetings$1.getLocalIpAddress()) || undefined,
317
+ (_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,
241
318
  osVersion: getOSVersion() || 'unknown',
242
319
  subClientType: (options === null || options === void 0 ? void 0 : options.subClientType) || defaultSubClientType,
243
320
  os: (0, _metrics.getOSNameInternal)(),
244
- browser: getBrowserName(),
245
- browserVersion: getBrowserVersion()
321
+ browser: providedBrowser || getBrowserName(),
322
+ browserVersion: providedBrowserVersion || getBrowserVersion()
323
+ }, isSupportedBrowserFamily === undefined ? {} : {
324
+ isSupportedBrowserFamily: isSupportedBrowserFamily
325
+ }), isOutdatedBrowserVersion === undefined ? {} : {
326
+ isOutdatedBrowserVersion: isOutdatedBrowserVersion
246
327
  })
247
328
  };
248
329
  if (meetingId) {
330
+ var _this$webex$meetings17;
249
331
  // @ts-ignore
250
- var meeting = this.webex.meetings.getBasicMeetingInformation(meetingId);
332
+ var meeting = (_this$webex$meetings17 = this.webex.meetings) === null || _this$webex$meetings17 === void 0 ? void 0 : _this$webex$meetings17.getBasicMeetingInformation(meetingId);
251
333
  if (meeting !== null && meeting !== void 0 && meeting.environment) {
252
334
  origin.environment = meeting.environment;
253
335
  }
@@ -272,6 +354,22 @@ var CallDiagnosticMetrics = exports.default = /*#__PURE__*/function (_StatelessW
272
354
  throw new Error("ClientType and SubClientType can't be undefined");
273
355
  }
274
356
 
357
+ /**
358
+ * Returns the signed-in user's CI ID derived from credentials tokens.
359
+ * Used as a fallback when no device is registered.
360
+ * @returns the userId, or undefined if it can't be determined
361
+ */
362
+ }, {
363
+ key: "getUserIdFromCredentials",
364
+ value: function getUserIdFromCredentials() {
365
+ try {
366
+ // @ts-ignore
367
+ return this.webex.credentials.getUserId();
368
+ } catch (_unused) {
369
+ return undefined;
370
+ }
371
+ }
372
+
275
373
  /**
276
374
  * Gather identifier details for call diagnostic payload.
277
375
  * @throws Error if initialization fails.
@@ -280,7 +378,7 @@ var CallDiagnosticMetrics = exports.default = /*#__PURE__*/function (_StatelessW
280
378
  }, {
281
379
  key: "getIdentifiers",
282
380
  value: function getIdentifiers(options) {
283
- var _meeting$locusInfo, _meeting$meetingInfo2, _meeting$meetingInfo3, _meeting$meetingInfo6, _meeting$meetingInfo8;
381
+ var _this$device, _meeting$locusInfo, _meeting$meetingInfo2, _meeting$meetingInfo3, _meeting$meetingInfo6, _meeting$meetingInfo8;
284
382
  var meeting = options.meeting,
285
383
  mediaConnections = options.mediaConnections,
286
384
  correlationId = options.correlationId,
@@ -311,9 +409,8 @@ var CallDiagnosticMetrics = exports.default = /*#__PURE__*/function (_StatelessW
311
409
 
312
410
  if (this.device) {
313
411
  var device = this.device;
314
- var _ref2 = (device === null || device === void 0 ? void 0 : device.config) || {},
315
- installationId = _ref2.installationId;
316
- identifiers.userId = (device === null || device === void 0 ? void 0 : device.userId) || preLoginId;
412
+ var _ref3 = (device === null || device === void 0 ? void 0 : device.config) || {},
413
+ installationId = _ref3.installationId;
317
414
  identifiers.deviceId = device === null || device === void 0 ? void 0 : device.url;
318
415
  identifiers.orgId = device === null || device === void 0 ? void 0 : device.orgId;
319
416
  // @ts-ignore
@@ -322,6 +419,10 @@ var CallDiagnosticMetrics = exports.default = /*#__PURE__*/function (_StatelessW
322
419
  identifiers.machineId = installationId;
323
420
  }
324
421
  }
422
+
423
+ // Prefer the device's userId, but fall back to the signed-in user's ID from
424
+ // credentials when no device is registered, then to the pre-login ID.
425
+ identifiers.userId = ((_this$device = this.device) === null || _this$device === void 0 ? void 0 : _this$device.userId) || this.getUserIdFromCredentials() || preLoginId;
325
426
  if (meeting !== null && meeting !== void 0 && (_meeting$locusInfo = meeting.locusInfo) !== null && _meeting$locusInfo !== void 0 && _meeting$locusInfo.fullState) {
326
427
  identifiers.locusUrl = meeting.locusUrl;
327
428
  identifiers.locusId = meeting.locusUrl && meeting.locusUrl.split('/').pop();
@@ -367,7 +468,7 @@ var CallDiagnosticMetrics = exports.default = /*#__PURE__*/function (_StatelessW
367
468
  }, {
368
469
  key: "prepareDiagnosticEvent",
369
470
  value: function prepareDiagnosticEvent(eventData, options) {
370
- var _this$webex$meetings$10;
471
+ var _this$webex$meetings18, _this$webex$meetings19;
371
472
  var meetingId = options.meetingId,
372
473
  triggeredTime = options.triggeredTime;
373
474
  var origin = this.getOrigin(options, meetingId);
@@ -381,7 +482,7 @@ var CallDiagnosticMetrics = exports.default = /*#__PURE__*/function (_StatelessW
381
482
  sent: 'not_defined_yet'
382
483
  },
383
484
  // @ts-ignore
384
- senderCountryCode: (_this$webex$meetings$10 = this.webex.meetings.geoHintInfo) === null || _this$webex$meetings$10 === void 0 ? void 0 : _this$webex$meetings$10.countryCode,
485
+ 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,
385
486
  event: eventData
386
487
  };
387
488
 
@@ -403,10 +504,10 @@ var CallDiagnosticMetrics = exports.default = /*#__PURE__*/function (_StatelessW
403
504
  */
404
505
  }, {
405
506
  key: "prepareClientFeatureEvent",
406
- value: function prepareClientFeatureEvent(_ref3) {
407
- var name = _ref3.name,
408
- payload = _ref3.payload,
409
- options = _ref3.options;
507
+ value: function prepareClientFeatureEvent(_ref4) {
508
+ var name = _ref4.name,
509
+ payload = _ref4.payload,
510
+ options = _ref4.options;
410
511
  var meetingId = options.meetingId,
411
512
  correlationId = options.correlationId;
412
513
  var featureEventObject;
@@ -436,11 +537,11 @@ var CallDiagnosticMetrics = exports.default = /*#__PURE__*/function (_StatelessW
436
537
  */
437
538
  }, {
438
539
  key: "submitFeatureEvent",
439
- value: function submitFeatureEvent(_ref4) {
440
- var name = _ref4.name,
441
- payload = _ref4.payload,
442
- options = _ref4.options,
443
- delaySubmitEvent = _ref4.delaySubmitEvent;
540
+ value: function submitFeatureEvent(_ref5) {
541
+ var name = _ref5.name,
542
+ payload = _ref5.payload,
543
+ options = _ref5.options,
544
+ delaySubmitEvent = _ref5.delaySubmitEvent;
444
545
  if (delaySubmitEvent) {
445
546
  // Preserve the time when the event was triggered if delaying the submission to Call Features
446
547
  var delayedOptions = _objectSpread(_objectSpread({}, options), {}, {
@@ -491,10 +592,10 @@ var CallDiagnosticMetrics = exports.default = /*#__PURE__*/function (_StatelessW
491
592
  */
492
593
  }, {
493
594
  key: "submitMQE",
494
- value: function submitMQE(_ref5) {
495
- var name = _ref5.name,
496
- payload = _ref5.payload,
497
- options = _ref5.options;
595
+ value: function submitMQE(_ref6) {
596
+ var name = _ref6.name,
597
+ payload = _ref6.payload,
598
+ options = _ref6.options;
498
599
  var meetingId = options.meetingId,
499
600
  mediaConnections = options.mediaConnections,
500
601
  webexConferenceIdStr = options.webexConferenceIdStr,
@@ -544,7 +645,8 @@ var CallDiagnosticMetrics = exports.default = /*#__PURE__*/function (_StatelessW
544
645
  mediaEngineSoftwareType: getBrowserName() || 'browser',
545
646
  mediaEngineSoftwareVersion: getOSVersion() || 'unknown',
546
647
  startTime: new Date().toISOString()
547
- }
648
+ },
649
+ webexSubServiceType: this.getSubServiceType(meeting)
548
650
  };
549
651
 
550
652
  // merge any new properties, or override existing ones
@@ -573,13 +675,13 @@ var CallDiagnosticMetrics = exports.default = /*#__PURE__*/function (_StatelessW
573
675
  */
574
676
  }, {
575
677
  key: "getErrorPayloadForClientErrorCode",
576
- value: function getErrorPayloadForClientErrorCode(_ref6) {
577
- var clientErrorCode = _ref6.clientErrorCode,
578
- serviceErrorCode = _ref6.serviceErrorCode,
579
- serviceErrorName = _ref6.serviceErrorName,
580
- rawErrorMessage = _ref6.rawErrorMessage,
581
- payloadOverrides = _ref6.payloadOverrides,
582
- httpStatusCode = _ref6.httpStatusCode;
678
+ value: function getErrorPayloadForClientErrorCode(_ref7) {
679
+ var clientErrorCode = _ref7.clientErrorCode,
680
+ serviceErrorCode = _ref7.serviceErrorCode,
681
+ serviceErrorName = _ref7.serviceErrorName,
682
+ rawErrorMessage = _ref7.rawErrorMessage,
683
+ payloadOverrides = _ref7.payloadOverrides,
684
+ httpStatusCode = _ref7.httpStatusCode;
583
685
  var error;
584
686
  if (clientErrorCode) {
585
687
  var partialParsedError = _config2.CLIENT_ERROR_CODE_TO_ERROR_PAYLOAD[clientErrorCode];
@@ -627,9 +729,9 @@ var CallDiagnosticMetrics = exports.default = /*#__PURE__*/function (_StatelessW
627
729
  */
628
730
  }, {
629
731
  key: "shouldSendEvent",
630
- value: function shouldSendEvent(_ref7) {
732
+ value: function shouldSendEvent(_ref8) {
631
733
  var _event$identifiers;
632
- var event = _ref7.event;
734
+ var event = _ref8.event;
633
735
  var eventName = event === null || event === void 0 ? void 0 : event.name;
634
736
  var correlationId = event === null || event === void 0 ? void 0 : (_event$identifiers = event.identifiers) === null || _event$identifiers === void 0 ? void 0 : _event$identifiers.correlationId;
635
737
  if (!correlationId || correlationId === 'unknown') {
@@ -853,12 +955,12 @@ var CallDiagnosticMetrics = exports.default = /*#__PURE__*/function (_StatelessW
853
955
  */
854
956
  }, {
855
957
  key: "createCommonEventObjectInMeeting",
856
- value: function createCommonEventObjectInMeeting(_ref8) {
857
- var _this$webex$meetings2, _this$webex$meetings3, _this$webex$meetings4, _options$joinFlowVers, _meeting$callStateFor;
858
- var name = _ref8.name,
859
- options = _ref8.options,
860
- _ref8$eventType = _ref8.eventType,
861
- eventType = _ref8$eventType === void 0 ? 'client' : _ref8$eventType;
958
+ value: function createCommonEventObjectInMeeting(_ref9) {
959
+ var _this$webex$meetings20, _this$webex$meetings21, _this$webex$meetings22, _meeting$meetingInfo0, _options$joinFlowVers, _meeting$callStateFor;
960
+ var name = _ref9.name,
961
+ options = _ref9.options,
962
+ _ref9$eventType = _ref9.eventType,
963
+ eventType = _ref9$eventType === void 0 ? 'client' : _ref9$eventType;
862
964
  var meetingId = options.meetingId,
863
965
  mediaConnections = options.mediaConnections,
864
966
  globalMeetingId = options.globalMeetingId,
@@ -888,7 +990,7 @@ var CallDiagnosticMetrics = exports.default = /*#__PURE__*/function (_StatelessW
888
990
  sessionCorrelationId: sessionCorrelationId
889
991
  });
890
992
 
891
- // create common event object structur
993
+ // create common event object structure
892
994
  var commonEventObject = _objectSpread(_objectSpread(_objectSpread({
893
995
  name: name,
894
996
  canProceed: true,
@@ -898,6 +1000,7 @@ var CallDiagnosticMetrics = exports.default = /*#__PURE__*/function (_StatelessW
898
1000
  },
899
1001
  userType: meeting.getCurUserType(),
900
1002
  loginType: 'loginType' in meeting.callStateForMetrics ? meeting.callStateForMetrics.loginType : this.getCurLoginType(),
1003
+ telemetryOptOut: this.getTelemetryOptOut(),
901
1004
  isConvergedArchitectureEnabled: this.getIsConvergedArchitectureEnabled({
902
1005
  meetingId: meetingId
903
1006
  })
@@ -908,7 +1011,10 @@ var CallDiagnosticMetrics = exports.default = /*#__PURE__*/function (_StatelessW
908
1011
  }), {}, {
909
1012
  webexSubServiceType: this.getSubServiceType(meeting),
910
1013
  // @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
1014
+ 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,
1015
+ isVipMeeting: (meeting === null || meeting === void 0 ? void 0 : (_meeting$meetingInfo0 = meeting.meetingInfo) === null || _meeting$meetingInfo0 === void 0 ? void 0 : _meeting$meetingInfo0.vipmeeting) || false,
1016
+ isAutomatedUser: AutomatedUserUtils.isAutomatedUser(),
1017
+ userActivation: this.getUserActivation()
912
1018
  });
913
1019
  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
1020
  if (joinFlowVersion) {
@@ -936,10 +1042,10 @@ var CallDiagnosticMetrics = exports.default = /*#__PURE__*/function (_StatelessW
936
1042
  */
937
1043
  }, {
938
1044
  key: "createClientEventObjectInMeeting",
939
- value: function createClientEventObjectInMeeting(_ref9) {
940
- var name = _ref9.name,
941
- options = _ref9.options,
942
- errors = _ref9.errors;
1045
+ value: function createClientEventObjectInMeeting(_ref0) {
1046
+ var name = _ref0.name,
1047
+ options = _ref0.options,
1048
+ errors = _ref0.errors;
943
1049
  var commonObject = this.createCommonEventObjectInMeeting({
944
1050
  name: name,
945
1051
  options: options,
@@ -962,9 +1068,9 @@ var CallDiagnosticMetrics = exports.default = /*#__PURE__*/function (_StatelessW
962
1068
  */
963
1069
  }, {
964
1070
  key: "createFeatureEventObjectInMeeting",
965
- value: function createFeatureEventObjectInMeeting(_ref0) {
966
- var name = _ref0.name,
967
- options = _ref0.options;
1071
+ value: function createFeatureEventObjectInMeeting(_ref1) {
1072
+ var name = _ref1.name,
1073
+ options = _ref1.options;
968
1074
  var commonObject = this.createCommonEventObjectInMeeting({
969
1075
  name: name,
970
1076
  options: options,
@@ -985,11 +1091,11 @@ var CallDiagnosticMetrics = exports.default = /*#__PURE__*/function (_StatelessW
985
1091
  */
986
1092
  }, {
987
1093
  key: "createClientEventObjectPreMeeting",
988
- value: function createClientEventObjectPreMeeting(_ref1) {
989
- var _this$webex$meetings5, _this$webex$meetings6, _this$webex$meetings7;
990
- var name = _ref1.name,
991
- options = _ref1.options,
992
- errors = _ref1.errors;
1094
+ value: function createClientEventObjectPreMeeting(_ref10) {
1095
+ var _this$webex$meetings23, _this$webex$meetings24, _this$webex$meetings25;
1096
+ var name = _ref10.name,
1097
+ options = _ref10.options,
1098
+ errors = _ref10.errors;
993
1099
  var correlationId = options.correlationId,
994
1100
  globalMeetingId = options.globalMeetingId,
995
1101
  webexConferenceIdStr = options.webexConferenceIdStr,
@@ -1016,8 +1122,11 @@ var CallDiagnosticMetrics = exports.default = /*#__PURE__*/function (_StatelessW
1016
1122
  isMercuryConnected: this.isMercuryConnected
1017
1123
  },
1018
1124
  loginType: this.getCurLoginType(),
1125
+ telemetryOptOut: this.getTelemetryOptOut(),
1019
1126
  // @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
1127
+ 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,
1128
+ isAutomatedUser: AutomatedUserUtils.isAutomatedUser(),
1129
+ userActivation: this.getUserActivation()
1021
1130
  };
1022
1131
  if (options.joinFlowVersion) {
1023
1132
  clientEventObject.joinFlowVersion = options.joinFlowVersion;
@@ -1045,10 +1154,10 @@ var CallDiagnosticMetrics = exports.default = /*#__PURE__*/function (_StatelessW
1045
1154
  */
1046
1155
  }, {
1047
1156
  key: "prepareClientEvent",
1048
- value: function prepareClientEvent(_ref10) {
1049
- var name = _ref10.name,
1050
- payload = _ref10.payload,
1051
- options = _ref10.options;
1157
+ value: function prepareClientEvent(_ref11) {
1158
+ var name = _ref11.name,
1159
+ payload = _ref11.payload,
1160
+ options = _ref11.options;
1052
1161
  var meetingId = options.meetingId,
1053
1162
  correlationId = options.correlationId,
1054
1163
  rawError = options.rawError;
@@ -1104,11 +1213,11 @@ var CallDiagnosticMetrics = exports.default = /*#__PURE__*/function (_StatelessW
1104
1213
  */
1105
1214
  }, {
1106
1215
  key: "submitClientEvent",
1107
- value: function submitClientEvent(_ref11) {
1108
- var name = _ref11.name,
1109
- payload = _ref11.payload,
1110
- options = _ref11.options,
1111
- delaySubmitEvent = _ref11.delaySubmitEvent;
1216
+ value: function submitClientEvent(_ref12) {
1217
+ var name = _ref12.name,
1218
+ payload = _ref12.payload,
1219
+ options = _ref12.options,
1220
+ delaySubmitEvent = _ref12.delaySubmitEvent;
1112
1221
  if (delaySubmitEvent) {
1113
1222
  // Preserve the time when the event was triggered if delaying the submission to Call Diagnostics
1114
1223
  var delayedOptions = _objectSpread(_objectSpread({}, options), {}, {
@@ -1220,12 +1329,13 @@ var CallDiagnosticMetrics = exports.default = /*#__PURE__*/function (_StatelessW
1220
1329
  * @throws
1221
1330
  */
1222
1331
  function () {
1223
- var _buildClientEventFetchRequestOptions = (0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee(_ref12) {
1332
+ var _buildClientEventFetchRequestOptions = (0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee(_ref13) {
1333
+ var _this$webex$internal$, _this$webex$internal$2;
1224
1334
  var name, payload, options, clientEvent, diagnosticEvent, request;
1225
1335
  return _regenerator.default.wrap(function (_context) {
1226
1336
  while (1) switch (_context.prev = _context.next) {
1227
1337
  case 0:
1228
- name = _ref12.name, payload = _ref12.payload, options = _ref12.options;
1338
+ name = _ref13.name, payload = _ref13.payload, options = _ref13.options;
1229
1339
  this.logger.log(_config2.CALL_DIAGNOSTIC_LOG_IDENTIFIER, 'CallDiagnosticMetrics: @buildClientEventFetchRequestOptions. Building request options object for fetch()...', "name: ".concat(name));
1230
1340
  clientEvent = this.prepareClientEvent({
1231
1341
  name: name,
@@ -1246,7 +1356,7 @@ var CallDiagnosticMetrics = exports.default = /*#__PURE__*/function (_StatelessW
1246
1356
  },
1247
1357
  headers: {},
1248
1358
  // @ts-ignore
1249
- waitForServiceTimeout: this.webex.internal.metrics.config.waitForServiceTimeout
1359
+ waitForServiceTimeout: (_this$webex$internal$ = this.webex.internal.metrics) === null || _this$webex$internal$ === void 0 ? void 0 : (_this$webex$internal$2 = _this$webex$internal$.config) === null || _this$webex$internal$2 === void 0 ? void 0 : _this$webex$internal$2.waitForServiceTimeout
1250
1360
  };
1251
1361
  if (options.preLoginId) {
1252
1362
  request.headers = {