@webex/internal-plugin-metrics 3.12.0 → 3.13.0-next.2

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 (98) hide show
  1. package/.repo-context.json +466 -0
  2. package/.sdd/manifest.json +626 -0
  3. package/AGENTS.md +208 -0
  4. package/README.md +274 -0
  5. package/dist/automated-user.js +19 -0
  6. package/dist/automated-user.js.map +1 -0
  7. package/dist/batcher.js +3 -0
  8. package/dist/batcher.js.map +1 -1
  9. package/dist/call-diagnostic/call-diagnostic-metrics-latencies.js +639 -66
  10. package/dist/call-diagnostic/call-diagnostic-metrics-latencies.js.map +1 -1
  11. package/dist/call-diagnostic/call-diagnostic-metrics.js +240 -103
  12. package/dist/call-diagnostic/call-diagnostic-metrics.js.map +1 -1
  13. package/dist/call-diagnostic/call-diagnostic-metrics.util.js +7 -2
  14. package/dist/call-diagnostic/call-diagnostic-metrics.util.js.map +1 -1
  15. package/dist/call-diagnostic/config.js +19 -4
  16. package/dist/call-diagnostic/config.js.map +1 -1
  17. package/dist/config.js +8 -0
  18. package/dist/config.js.map +1 -1
  19. package/dist/index.js +25 -1
  20. package/dist/index.js.map +1 -1
  21. package/dist/metrics.js +118 -5
  22. package/dist/metrics.js.map +1 -1
  23. package/dist/metrics.types.js +4 -0
  24. package/dist/metrics.types.js.map +1 -1
  25. package/dist/network-telemetry.js +610 -0
  26. package/dist/network-telemetry.js.map +1 -0
  27. package/dist/new-metrics.js +63 -17
  28. package/dist/new-metrics.js.map +1 -1
  29. package/dist/privacy-and-security-permission-enricher/constants.js +18 -0
  30. package/dist/privacy-and-security-permission-enricher/constants.js.map +1 -0
  31. package/dist/privacy-and-security-permission-enricher/index.js +143 -0
  32. package/dist/privacy-and-security-permission-enricher/index.js.map +1 -0
  33. package/dist/privacy-and-security-permission-enricher/types.js +7 -0
  34. package/dist/privacy-and-security-permission-enricher/types.js.map +1 -0
  35. package/dist/privacy-and-security-permission-enricher/utils.js +71 -0
  36. package/dist/privacy-and-security-permission-enricher/utils.js.map +1 -0
  37. package/dist/types/automated-user.d.ts +2 -0
  38. package/dist/types/call-diagnostic/call-diagnostic-metrics-latencies.d.ts +208 -5
  39. package/dist/types/call-diagnostic/call-diagnostic-metrics.d.ts +83 -17
  40. package/dist/types/call-diagnostic/config.d.ts +6 -0
  41. package/dist/types/config.d.ts +9 -0
  42. package/dist/types/index.d.ts +5 -3
  43. package/dist/types/metrics.types.d.ts +11 -5
  44. package/dist/types/network-telemetry.d.ts +108 -0
  45. package/dist/types/new-metrics.d.ts +17 -1
  46. package/dist/types/privacy-and-security-permission-enricher/constants.d.ts +6 -0
  47. package/dist/types/privacy-and-security-permission-enricher/index.d.ts +40 -0
  48. package/dist/types/privacy-and-security-permission-enricher/types.d.ts +14 -0
  49. package/dist/types/privacy-and-security-permission-enricher/utils.d.ts +5 -0
  50. package/dist/types/unhandled-exception-telemetry/index.d.ts +60 -0
  51. package/dist/types/unhandled-exception-telemetry/utils.d.ts +6 -0
  52. package/dist/unhandled-exception-telemetry/index.js +331 -0
  53. package/dist/unhandled-exception-telemetry/index.js.map +1 -0
  54. package/dist/unhandled-exception-telemetry/utils.js +105 -0
  55. package/dist/unhandled-exception-telemetry/utils.js.map +1 -0
  56. package/docs/adr/index.md +27 -0
  57. package/docs/architecture.md +437 -0
  58. package/docs/getting-started.md +131 -0
  59. package/docs/index.md +52 -0
  60. package/docs/specs/README.md +88 -0
  61. package/package.json +12 -11
  62. package/schemas/repo-context.schema.json +796 -0
  63. package/src/automated-user.ts +16 -0
  64. package/src/batcher.js +4 -0
  65. package/src/call-diagnostic/call-diagnostic-metrics-latencies.ts +801 -74
  66. package/src/call-diagnostic/call-diagnostic-metrics.ts +184 -42
  67. package/src/call-diagnostic/call-diagnostic-metrics.util.ts +7 -1
  68. package/src/call-diagnostic/config.ts +16 -0
  69. package/src/call-diagnostic/docs/README.md +535 -0
  70. package/src/config.js +8 -0
  71. package/src/docs/README.md +703 -0
  72. package/src/index.ts +16 -0
  73. package/src/metrics.js +123 -5
  74. package/src/metrics.types.ts +29 -6
  75. package/src/network-telemetry.ts +757 -0
  76. package/src/new-metrics.ts +56 -6
  77. package/src/privacy-and-security-permission-enricher/constants.ts +33 -0
  78. package/src/privacy-and-security-permission-enricher/docs/README.md +356 -0
  79. package/src/privacy-and-security-permission-enricher/index.ts +142 -0
  80. package/src/privacy-and-security-permission-enricher/types.ts +21 -0
  81. package/src/privacy-and-security-permission-enricher/utils.ts +82 -0
  82. package/src/rtcMetrics/docs/README.md +447 -0
  83. package/src/unhandled-exception-telemetry/docs/README.md +536 -0
  84. package/src/unhandled-exception-telemetry/index.ts +404 -0
  85. package/src/unhandled-exception-telemetry/utils.ts +101 -0
  86. package/test/unit/spec/automated-user.ts +43 -0
  87. package/test/unit/spec/batcher.js +43 -0
  88. package/test/unit/spec/call-diagnostic/call-diagnostic-metrics-batcher.ts +14 -2
  89. package/test/unit/spec/call-diagnostic/call-diagnostic-metrics-latencies.ts +1435 -304
  90. package/test/unit/spec/call-diagnostic/call-diagnostic-metrics.ts +1265 -207
  91. package/test/unit/spec/call-diagnostic/call-diagnostic-metrics.util.ts +27 -0
  92. package/test/unit/spec/metrics.js +14 -5
  93. package/test/unit/spec/network-telemetry.ts +610 -0
  94. package/test/unit/spec/new-metrics.ts +203 -50
  95. package/test/unit/spec/prelogin-metrics-batcher.ts +71 -36
  96. package/test/unit/spec/privacy-and-security-permission-enricher.ts +318 -0
  97. package/test/unit/spec/unhandled-exception-telemetry/utils.ts +109 -0
  98. package/test/unit/spec/unhandled-exception-telemetry.ts +689 -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)); }
@@ -45,6 +49,10 @@ var _BrowserDetection = (0, _common.BrowserDetection)(),
45
49
  getOSVersion = _BrowserDetection.getOSVersion,
46
50
  getBrowserName = _BrowserDetection.getBrowserName,
47
51
  getBrowserVersion = _BrowserDetection.getBrowserVersion;
52
+ var LOCUS_HTTP_STATUS_TO_CLIENT_ERROR_CODE = {
53
+ 429: _config2.LOCUS_RATE_LIMITED_OUTGOING_CLIENT_CODE,
54
+ 503: _config2.LOCUS_UNAVAILABLE_CLIENT_CODE
55
+ };
48
56
  /**
49
57
  * @description Util class to handle Call Analyzer Metrics
50
58
  * @export
@@ -67,8 +75,6 @@ var CallDiagnosticMetrics = exports.default = /*#__PURE__*/function (_StatelessW
67
75
  (0, _defineProperty2.default)(_this, "callDiagnosticEventsBatcher", void 0);
68
76
  // @ts-ignore
69
77
  (0, _defineProperty2.default)(_this, "preLoginMetricsBatcher", void 0);
70
- (0, _defineProperty2.default)(_this, "logger", void 0);
71
- // to avoid adding @ts-ignore everywhere
72
78
  (0, _defineProperty2.default)(_this, "hasLoggedBrowserSerial", void 0);
73
79
  (0, _defineProperty2.default)(_this, "device", void 0);
74
80
  (0, _defineProperty2.default)(_this, "delayedClientEvents", []);
@@ -77,6 +83,8 @@ var CallDiagnosticMetrics = exports.default = /*#__PURE__*/function (_StatelessW
77
83
  (0, _defineProperty2.default)(_this, "isMercuryConnected", false);
78
84
  (0, _defineProperty2.default)(_this, "eventLimitTracker", new _map.default());
79
85
  (0, _defineProperty2.default)(_this, "eventLimitWarningsLogged", new _set.default());
86
+ (0, _defineProperty2.default)(_this, "isTelemetryOptOutManual", false);
87
+ (0, _defineProperty2.default)(_this, "isTelemetryOptOutAutomatic", false);
80
88
  // the default validator before piping an event to the batcher
81
89
  // this function can be overridden by the user
82
90
  (0, _defineProperty2.default)(_this, "validator", function (options) {
@@ -100,8 +108,6 @@ var CallDiagnosticMetrics = exports.default = /*#__PURE__*/function (_StatelessW
100
108
  _this.preLoginMetricsBatcher.savePreLoginId(preLoginId);
101
109
  return _this.preLoginMetricsBatcher.request(finalEvent);
102
110
  });
103
- _this.logger = _this.webex.logger;
104
- // @ts-ignore
105
111
  _this.callDiagnosticEventsBatcher = new _callDiagnosticMetricsBatcher.default({}, {
106
112
  parent: _this.webex
107
113
  });
@@ -118,6 +124,14 @@ var CallDiagnosticMetrics = exports.default = /*#__PURE__*/function (_StatelessW
118
124
  */
119
125
  (0, _inherits2.default)(CallDiagnosticMetrics, _StatelessWebexPlugin);
120
126
  return (0, _createClass2.default)(CallDiagnosticMetrics, [{
127
+ key: "logger",
128
+ get:
129
+ // lazy getter to avoid @ts-ignore on every call site
130
+ function get() {
131
+ // @ts-ignore
132
+ return this.webex.logger;
133
+ }
134
+ }, {
121
135
  key: "getCurLoginType",
122
136
  value: function getCurLoginType() {
123
137
  // @ts-ignore
@@ -128,6 +142,59 @@ var CallDiagnosticMetrics = exports.default = /*#__PURE__*/function (_StatelessW
128
142
  return null;
129
143
  }
130
144
 
145
+ /**
146
+ * Returns the user activation state reported from the browser's navigator.userActivation API
147
+ * @returns object with hasBeenActive and isActive booleans, or undefined if unavailable
148
+ */
149
+ }, {
150
+ key: "getUserActivation",
151
+ value: function getUserActivation() {
152
+ var userActivation = typeof navigator !== 'undefined' ? navigator.userActivation : undefined;
153
+ if (userActivation) {
154
+ return {
155
+ hasBeenActive: userActivation.hasBeenActive,
156
+ isActive: userActivation.isActive
157
+ };
158
+ }
159
+ return undefined;
160
+ }
161
+
162
+ /**
163
+ * Returns the telemetryOptOut value of the current user
164
+ * @returns one of 'manual', 'automatic', undefined
165
+ */
166
+ }, {
167
+ key: "getTelemetryOptOut",
168
+ value: function getTelemetryOptOut() {
169
+ if (this.isTelemetryOptOutManual) {
170
+ return 'manual';
171
+ }
172
+ if (this.isTelemetryOptOutAutomatic) {
173
+ return 'automatic';
174
+ }
175
+ return undefined;
176
+ }
177
+
178
+ /**
179
+ * Sets the manual telemetry opt-out status for the current user
180
+ * @param value - boolean value indicating manual telemetry opt-out status
181
+ */
182
+ }, {
183
+ key: "setIsTelemetryOptOutManual",
184
+ value: function setIsTelemetryOptOutManual(value) {
185
+ this.isTelemetryOptOutManual = value;
186
+ }
187
+
188
+ /**
189
+ * Sets the automatic telemetry opt-out status for the current user
190
+ * @param value - boolean value indicating automatic telemetry opt-out status
191
+ */
192
+ }, {
193
+ key: "setIsTelemetryOptOutAutomatic",
194
+ value: function setIsTelemetryOptOutAutomatic(value) {
195
+ this.isTelemetryOptOutAutomatic = value;
196
+ }
197
+
131
198
  /**
132
199
  * Returns if the meeting has converged architecture enabled
133
200
  * @param options.meetingId
@@ -179,6 +246,10 @@ var CallDiagnosticMetrics = exports.default = /*#__PURE__*/function (_StatelessW
179
246
 
180
247
  // if ConvergedArchitecture enable and isConvergedWebinarWebcast -- then webcast
181
248
  if (meetingInfo !== null && meetingInfo !== void 0 && meetingInfo.enableConvergedArchitecture && meetingInfo !== null && meetingInfo !== void 0 && meetingInfo.enableEvent) {
249
+ // if enableConvergedWebinarLargeScale - then large scale webinar
250
+ if (meetingInfo !== null && meetingInfo !== void 0 && meetingInfo.enableConvergedWebinarLargeScale) {
251
+ return _config2.WEBEX_SUB_SERVICE_TYPES.LARGE_SCALE_WEBINAR;
252
+ }
182
253
  return meetingInfo !== null && meetingInfo !== void 0 && meetingInfo.isConvergedWebinarWebcast ? _config2.WEBEX_SUB_SERVICE_TYPES.WEBCAST : _config2.WEBEX_SUB_SERVICE_TYPES.WEBINAR;
183
254
  }
184
255
 
@@ -199,13 +270,13 @@ var CallDiagnosticMetrics = exports.default = /*#__PURE__*/function (_StatelessW
199
270
  }, {
200
271
  key: "getOrigin",
201
272
  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;
273
+ var _this$webex$meetings, _this$webex$meetings$, _this$webex$meetings$2, _this$webex$meetings2, _this$webex$meetings3, _this$webex$meetings4, _this$webex$meetings5, _this$webex$meetings6, _this$webex$meetings7, _this$webex$meetings$3, _this$webex$meetings8, _this$webex$meetings9;
203
274
  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;
275
+ (_this$webex$meetings = this.webex.meetings) === null || _this$webex$meetings === void 0 ? void 0 : (_this$webex$meetings$ = _this$webex$meetings.config) === null || _this$webex$meetings$ === void 0 ? void 0 : (_this$webex$meetings$2 = _this$webex$meetings$.metrics) === null || _this$webex$meetings$2 === void 0 ? void 0 : _this$webex$meetings$2.clientType;
205
276
  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;
277
+ (_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
278
  // @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;
279
+ 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
280
  // @ts-ignore
210
281
  var defaultSDKClientVersion = "".concat(_config.CLIENT_NAME, "/").concat(this.webex.version);
211
282
  var versionMetadata = {};
@@ -214,40 +285,55 @@ var CallDiagnosticMetrics = exports.default = /*#__PURE__*/function (_StatelessW
214
285
  if (providedClientVersion) {
215
286
  versionMetadata = (0, _callDiagnosticMetrics.extractVersionMetadata)(providedClientVersion);
216
287
  }
288
+
289
+ // Browser details and the support verdict can all be supplied by the host client, which is able
290
+ // to resolve wrapper browsers (Electron, WebOS) to the engine that actually determines
291
+ // capability. The browser fields fall back to the SDK's own detection when not supplied, the
292
+ // same way clientVersion falls back to the SDK version.
293
+ var _ref2 = (_this$webex$meetings$3 = (_this$webex$meetings8 = this.webex.meetings) === null || _this$webex$meetings8 === void 0 ? void 0 : (_this$webex$meetings9 = _this$webex$meetings8.config) === null || _this$webex$meetings9 === void 0 ? void 0 : _this$webex$meetings9.metrics) !== null && _this$webex$meetings$3 !== void 0 ? _this$webex$meetings$3 : {},
294
+ providedBrowser = _ref2.browser,
295
+ providedBrowserVersion = _ref2.browserVersion,
296
+ isSupportedBrowserFamily = _ref2.isSupportedBrowserFamily,
297
+ isOutdatedBrowserVersion = _ref2.isOutdatedBrowserVersion;
217
298
  if (!this.hasLoggedBrowserSerial) {
218
299
  this.logger.log(_config2.CALL_DIAGNOSTIC_LOG_IDENTIFIER, "CallDiagnosticMetrics: @createClientEventObjectInMeeting => collected browser data", (0, _stringify.default)((0, _common.getBrowserSerial)()));
219
300
  this.hasLoggedBrowserSerial = true;
220
301
  }
221
302
  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;
303
+ var _this$webex$meetings0, _this$webex$meetings1, _this$webex$meetings10, _this$webex$meetings11, _this$webex$meetings12, _this$webex$meetings13, _this$webex$meetings14, _this$webex$meetings15, _this$webex$meetings16;
223
304
  var origin = {
224
305
  name: 'endpoint',
225
306
  networkType: (options === null || options === void 0 ? void 0 : options.networkType) || 'unknown',
226
307
  userAgent: (0, _callDiagnosticMetrics.userAgentToString)({
227
308
  // @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,
309
+ clientName: (_this$webex$meetings0 = this.webex.meetings) === null || _this$webex$meetings0 === void 0 ? void 0 : (_this$webex$meetings1 = _this$webex$meetings0.config) === null || _this$webex$meetings1 === void 0 ? void 0 : (_this$webex$meetings10 = _this$webex$meetings1.metrics) === null || _this$webex$meetings10 === void 0 ? void 0 : _this$webex$meetings10.clientName,
229
310
  // @ts-ignore
230
311
  webexVersion: this.webex.version
231
312
  }),
232
- clientInfo: _objectSpread(_objectSpread({
313
+ clientInfo: _objectSpread(_objectSpread(_objectSpread({
233
314
  clientType: (options === null || options === void 0 ? void 0 : options.clientType) || defaultClientType,
234
315
  clientVersion: providedClientVersion || defaultSDKClientVersion
235
316
  }, versionMetadata), {}, {
236
317
  publicNetworkPrefix:
237
318
  // @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,
319
+ (0, _callDiagnosticMetrics.anonymizeIPAddress)((_this$webex$meetings11 = this.webex.meetings) === null || _this$webex$meetings11 === void 0 ? void 0 : (_this$webex$meetings12 = _this$webex$meetings11.geoHintInfo) === null || _this$webex$meetings12 === void 0 ? void 0 : _this$webex$meetings12.clientAddress) || undefined,
239
320
  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,
321
+ (_this$webex$meetings13 = this.webex.meetings) === null || _this$webex$meetings13 === void 0 ? void 0 : (_this$webex$meetings14 = _this$webex$meetings13.meetingCollection) === null || _this$webex$meetings14 === void 0 ? void 0 : (_this$webex$meetings15 = _this$webex$meetings14.get(meetingId)) === null || _this$webex$meetings15 === void 0 ? void 0 : (_this$webex$meetings16 = _this$webex$meetings15.statsAnalyzer) === null || _this$webex$meetings16 === void 0 ? void 0 : _this$webex$meetings16.getLocalIpAddress()) || undefined,
241
322
  osVersion: getOSVersion() || 'unknown',
242
323
  subClientType: (options === null || options === void 0 ? void 0 : options.subClientType) || defaultSubClientType,
243
324
  os: (0, _metrics.getOSNameInternal)(),
244
- browser: getBrowserName(),
245
- browserVersion: getBrowserVersion()
325
+ browser: providedBrowser || getBrowserName(),
326
+ browserVersion: providedBrowserVersion || getBrowserVersion()
327
+ }, isSupportedBrowserFamily === undefined ? {} : {
328
+ isSupportedBrowserFamily: isSupportedBrowserFamily
329
+ }), isOutdatedBrowserVersion === undefined ? {} : {
330
+ isOutdatedBrowserVersion: isOutdatedBrowserVersion
246
331
  })
247
332
  };
248
333
  if (meetingId) {
334
+ var _this$webex$meetings17;
249
335
  // @ts-ignore
250
- var meeting = this.webex.meetings.getBasicMeetingInformation(meetingId);
336
+ var meeting = (_this$webex$meetings17 = this.webex.meetings) === null || _this$webex$meetings17 === void 0 ? void 0 : _this$webex$meetings17.getBasicMeetingInformation(meetingId);
251
337
  if (meeting !== null && meeting !== void 0 && meeting.environment) {
252
338
  origin.environment = meeting.environment;
253
339
  }
@@ -272,6 +358,22 @@ var CallDiagnosticMetrics = exports.default = /*#__PURE__*/function (_StatelessW
272
358
  throw new Error("ClientType and SubClientType can't be undefined");
273
359
  }
274
360
 
361
+ /**
362
+ * Returns the signed-in user's CI ID derived from credentials tokens.
363
+ * Used as a fallback when no device is registered.
364
+ * @returns the userId, or undefined if it can't be determined
365
+ */
366
+ }, {
367
+ key: "getUserIdFromCredentials",
368
+ value: function getUserIdFromCredentials() {
369
+ try {
370
+ // @ts-ignore
371
+ return this.webex.credentials.getUserId();
372
+ } catch (_unused) {
373
+ return undefined;
374
+ }
375
+ }
376
+
275
377
  /**
276
378
  * Gather identifier details for call diagnostic payload.
277
379
  * @throws Error if initialization fails.
@@ -280,14 +382,15 @@ var CallDiagnosticMetrics = exports.default = /*#__PURE__*/function (_StatelessW
280
382
  }, {
281
383
  key: "getIdentifiers",
282
384
  value: function getIdentifiers(options) {
283
- var _meeting$locusInfo, _meeting$meetingInfo2, _meeting$meetingInfo3, _meeting$meetingInfo6, _meeting$meetingInfo8;
385
+ var _this$device, _meeting$locusInfo, _meeting$meetingInfo2, _meeting$meetingInfo3, _meeting$meetingInfo6, _meeting$meetingInfo8, _meeting$meetingInfo0;
284
386
  var meeting = options.meeting,
285
387
  mediaConnections = options.mediaConnections,
286
388
  correlationId = options.correlationId,
287
389
  webexConferenceIdStr = options.webexConferenceIdStr,
288
390
  globalMeetingId = options.globalMeetingId,
289
391
  preLoginId = options.preLoginId,
290
- sessionCorrelationId = options.sessionCorrelationId;
392
+ sessionCorrelationId = options.sessionCorrelationId,
393
+ locusCluster = options.locusCluster;
291
394
  var identifiers = {
292
395
  correlationId: 'unknown' // concerned with setting this to unknown. This will fail diagnostic events parsing because it's not a uuid pattern
293
396
  };
@@ -311,9 +414,8 @@ var CallDiagnosticMetrics = exports.default = /*#__PURE__*/function (_StatelessW
311
414
 
312
415
  if (this.device) {
313
416
  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;
417
+ var _ref3 = (device === null || device === void 0 ? void 0 : device.config) || {},
418
+ installationId = _ref3.installationId;
317
419
  identifiers.deviceId = device === null || device === void 0 ? void 0 : device.url;
318
420
  identifiers.orgId = device === null || device === void 0 ? void 0 : device.orgId;
319
421
  // @ts-ignore
@@ -322,6 +424,10 @@ var CallDiagnosticMetrics = exports.default = /*#__PURE__*/function (_StatelessW
322
424
  identifiers.machineId = installationId;
323
425
  }
324
426
  }
427
+
428
+ // Prefer the device's userId, but fall back to the signed-in user's ID from
429
+ // credentials when no device is registered, then to the pre-login ID.
430
+ identifiers.userId = ((_this$device = this.device) === null || _this$device === void 0 ? void 0 : _this$device.userId) || this.getUserIdFromCredentials() || preLoginId;
325
431
  if (meeting !== null && meeting !== void 0 && (_meeting$locusInfo = meeting.locusInfo) !== null && _meeting$locusInfo !== void 0 && _meeting$locusInfo.fullState) {
326
432
  identifiers.locusUrl = meeting.locusUrl;
327
433
  identifiers.locusId = meeting.locusUrl && meeting.locusUrl.split('/').pop();
@@ -340,6 +446,9 @@ var CallDiagnosticMetrics = exports.default = /*#__PURE__*/function (_StatelessW
340
446
  var _meeting$meetingInfo9;
341
447
  identifiers.webexSiteName = (_meeting$meetingInfo9 = meeting.meetingInfo) === null || _meeting$meetingInfo9 === void 0 ? void 0 : _meeting$meetingInfo9.siteName;
342
448
  }
449
+ if (meeting !== null && meeting !== void 0 && (_meeting$meetingInfo0 = meeting.meetingInfo) !== null && _meeting$meetingInfo0 !== void 0 && _meeting$meetingInfo0.locusClusterUrl) {
450
+ identifiers.locusCluster = meeting.meetingInfo.locusClusterUrl;
451
+ }
343
452
  if (mediaConnections) {
344
453
  var _mediaConnections$, _mediaConnections$2;
345
454
  identifiers.mediaAgentAlias = mediaConnections === null || mediaConnections === void 0 ? void 0 : (_mediaConnections$ = mediaConnections[0]) === null || _mediaConnections$ === void 0 ? void 0 : _mediaConnections$.mediaAgentAlias;
@@ -351,6 +460,9 @@ var CallDiagnosticMetrics = exports.default = /*#__PURE__*/function (_StatelessW
351
460
  if (!(identifiers !== null && identifiers !== void 0 && identifiers.globalMeetingId) && globalMeetingId) {
352
461
  identifiers.globalMeetingId = globalMeetingId;
353
462
  }
463
+ if (!(identifiers !== null && identifiers !== void 0 && identifiers.locusCluster) && locusCluster) {
464
+ identifiers.locusCluster = locusCluster;
465
+ }
354
466
  if (identifiers.correlationId === undefined) {
355
467
  throw new Error('Identifiers initialization failed.');
356
468
  }
@@ -367,7 +479,7 @@ var CallDiagnosticMetrics = exports.default = /*#__PURE__*/function (_StatelessW
367
479
  }, {
368
480
  key: "prepareDiagnosticEvent",
369
481
  value: function prepareDiagnosticEvent(eventData, options) {
370
- var _this$webex$meetings$10;
482
+ var _this$webex$meetings18, _this$webex$meetings19;
371
483
  var meetingId = options.meetingId,
372
484
  triggeredTime = options.triggeredTime;
373
485
  var origin = this.getOrigin(options, meetingId);
@@ -381,7 +493,7 @@ var CallDiagnosticMetrics = exports.default = /*#__PURE__*/function (_StatelessW
381
493
  sent: 'not_defined_yet'
382
494
  },
383
495
  // @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,
496
+ senderCountryCode: (_this$webex$meetings18 = this.webex.meetings) === null || _this$webex$meetings18 === void 0 ? void 0 : (_this$webex$meetings19 = _this$webex$meetings18.geoHintInfo) === null || _this$webex$meetings19 === void 0 ? void 0 : _this$webex$meetings19.countryCode,
385
497
  event: eventData
386
498
  };
387
499
 
@@ -403,10 +515,10 @@ var CallDiagnosticMetrics = exports.default = /*#__PURE__*/function (_StatelessW
403
515
  */
404
516
  }, {
405
517
  key: "prepareClientFeatureEvent",
406
- value: function prepareClientFeatureEvent(_ref3) {
407
- var name = _ref3.name,
408
- payload = _ref3.payload,
409
- options = _ref3.options;
518
+ value: function prepareClientFeatureEvent(_ref4) {
519
+ var name = _ref4.name,
520
+ payload = _ref4.payload,
521
+ options = _ref4.options;
410
522
  var meetingId = options.meetingId,
411
523
  correlationId = options.correlationId;
412
524
  var featureEventObject;
@@ -436,11 +548,11 @@ var CallDiagnosticMetrics = exports.default = /*#__PURE__*/function (_StatelessW
436
548
  */
437
549
  }, {
438
550
  key: "submitFeatureEvent",
439
- value: function submitFeatureEvent(_ref4) {
440
- var name = _ref4.name,
441
- payload = _ref4.payload,
442
- options = _ref4.options,
443
- delaySubmitEvent = _ref4.delaySubmitEvent;
551
+ value: function submitFeatureEvent(_ref5) {
552
+ var name = _ref5.name,
553
+ payload = _ref5.payload,
554
+ options = _ref5.options,
555
+ delaySubmitEvent = _ref5.delaySubmitEvent;
444
556
  if (delaySubmitEvent) {
445
557
  // Preserve the time when the event was triggered if delaying the submission to Call Features
446
558
  var delayedOptions = _objectSpread(_objectSpread({}, options), {}, {
@@ -491,10 +603,10 @@ var CallDiagnosticMetrics = exports.default = /*#__PURE__*/function (_StatelessW
491
603
  */
492
604
  }, {
493
605
  key: "submitMQE",
494
- value: function submitMQE(_ref5) {
495
- var name = _ref5.name,
496
- payload = _ref5.payload,
497
- options = _ref5.options;
606
+ value: function submitMQE(_ref6) {
607
+ var name = _ref6.name,
608
+ payload = _ref6.payload,
609
+ options = _ref6.options;
498
610
  var meetingId = options.meetingId,
499
611
  mediaConnections = options.mediaConnections,
500
612
  webexConferenceIdStr = options.webexConferenceIdStr,
@@ -544,7 +656,8 @@ var CallDiagnosticMetrics = exports.default = /*#__PURE__*/function (_StatelessW
544
656
  mediaEngineSoftwareType: getBrowserName() || 'browser',
545
657
  mediaEngineSoftwareVersion: getOSVersion() || 'unknown',
546
658
  startTime: new Date().toISOString()
547
- }
659
+ },
660
+ webexSubServiceType: this.getSubServiceType(meeting)
548
661
  };
549
662
 
550
663
  // merge any new properties, or override existing ones
@@ -568,18 +681,18 @@ var CallDiagnosticMetrics = exports.default = /*#__PURE__*/function (_StatelessW
568
681
  * @param arg.clientErrorCode
569
682
  * @param arg.serviceErrorCode
570
683
  * @param arg.payloadOverrides
571
- * @param arg.httpStatusCode
684
+ * @param arg.httpCode
572
685
  * @returns
573
686
  */
574
687
  }, {
575
688
  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;
689
+ value: function getErrorPayloadForClientErrorCode(_ref7) {
690
+ var clientErrorCode = _ref7.clientErrorCode,
691
+ serviceErrorCode = _ref7.serviceErrorCode,
692
+ serviceErrorName = _ref7.serviceErrorName,
693
+ rawErrorMessage = _ref7.rawErrorMessage,
694
+ payloadOverrides = _ref7.payloadOverrides,
695
+ httpCode = _ref7.httpCode;
583
696
  var error;
584
697
  if (clientErrorCode) {
585
698
  var partialParsedError = _config2.CLIENT_ERROR_CODE_TO_ERROR_PAYLOAD[clientErrorCode];
@@ -601,8 +714,8 @@ var CallDiagnosticMetrics = exports.default = /*#__PURE__*/function (_StatelessW
601
714
  serviceErrorCode: serviceErrorCode
602
715
  }, {
603
716
  rawErrorMessage: rawErrorMessage
604
- }, httpStatusCode === undefined ? {} : {
605
- httpStatusCode: httpStatusCode
717
+ }, httpCode === undefined ? {} : {
718
+ httpCode: httpCode
606
719
  }, partialParsedError, payloadOverrides || {});
607
720
  return error;
608
721
  }
@@ -627,9 +740,9 @@ var CallDiagnosticMetrics = exports.default = /*#__PURE__*/function (_StatelessW
627
740
  */
628
741
  }, {
629
742
  key: "shouldSendEvent",
630
- value: function shouldSendEvent(_ref7) {
743
+ value: function shouldSendEvent(_ref8) {
631
744
  var _event$identifiers;
632
- var event = _ref7.event;
745
+ var event = _ref8.event;
633
746
  var eventName = event === null || event === void 0 ? void 0 : event.name;
634
747
  var correlationId = event === null || event === void 0 ? void 0 : (_event$identifiers = event.identifiers) === null || _event$identifiers === void 0 ? void 0 : _event$identifiers.correlationId;
635
748
  if (!correlationId || correlationId === 'unknown') {
@@ -748,13 +861,14 @@ var CallDiagnosticMetrics = exports.default = /*#__PURE__*/function (_StatelessW
748
861
  }, {
749
862
  key: "generateClientEventErrorPayload",
750
863
  value: function generateClientEventErrorPayload(rawError) {
751
- var _rawError$error, _rawError$error$body, _rawError$body, _rawError$body2, _rawError$body3, _rawError$body3$reaso;
864
+ var _rawError$error, _rawError$error$body, _rawError$body, _rawError$body2, _rawError$body3, _rawError$body3$reaso, _rawError$options, _rawError$options2;
752
865
  var cachedError = this.eventErrorCache.get(rawError);
753
866
  if (cachedError) {
754
867
  return [cachedError, true];
755
868
  }
756
869
  var rawErrorMessage = rawError.message;
757
- var httpStatusCode = rawError.statusCode;
870
+ var httpCode = rawError.statusCode;
871
+ var serviceErrorCode = (rawError === null || rawError === void 0 ? void 0 : (_rawError$error = rawError.error) === null || _rawError$error === void 0 ? void 0 : (_rawError$error$body = _rawError$error.body) === null || _rawError$error$body === void 0 ? void 0 : _rawError$error$body.errorCode) || (rawError === null || rawError === void 0 ? void 0 : (_rawError$body = rawError.body) === null || _rawError$body === void 0 ? void 0 : _rawError$body.errorCode) || (rawError === null || rawError === void 0 ? void 0 : (_rawError$body2 = rawError.body) === null || _rawError$body2 === void 0 ? void 0 : _rawError$body2.code) || (rawError === null || rawError === void 0 ? void 0 : (_rawError$body3 = rawError.body) === null || _rawError$body3 === void 0 ? void 0 : (_rawError$body3$reaso = _rawError$body3.reason) === null || _rawError$body3$reaso === void 0 ? void 0 : _rawError$body3$reaso.reasonCode);
758
872
  var payload;
759
873
  if (rawError.name) {
760
874
  if ((0, _callDiagnosticMetrics.isBrowserMediaErrorName)(rawError.name)) {
@@ -763,7 +877,7 @@ var CallDiagnosticMetrics = exports.default = /*#__PURE__*/function (_StatelessW
763
877
  clientErrorCode: _config2.BROWSER_MEDIA_ERROR_NAME_TO_CLIENT_ERROR_CODES_MAP[rawError.name],
764
878
  serviceErrorName: rawError.name,
765
879
  rawErrorMessage: rawErrorMessage,
766
- httpStatusCode: httpStatusCode
880
+ httpCode: httpCode
767
881
  });
768
882
  }
769
883
  }
@@ -776,10 +890,9 @@ var CallDiagnosticMetrics = exports.default = /*#__PURE__*/function (_StatelessW
776
890
  clientErrorCode: _config2.SDP_OFFER_CREATION_ERROR_MAP[causeType] || _config2.SDP_OFFER_CREATION_ERROR_MAP.GENERAL,
777
891
  serviceErrorName: rawError.name,
778
892
  rawErrorMessage: rawErrorMessage,
779
- httpStatusCode: httpStatusCode
893
+ httpCode: httpCode
780
894
  });
781
895
  }
782
- 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);
783
896
  if (serviceErrorCode) {
784
897
  var clientErrorCode = _config2.SERVICE_ERROR_CODES_TO_CLIENT_ERROR_CODES_MAP[serviceErrorCode];
785
898
  if (clientErrorCode && !payload) {
@@ -787,17 +900,28 @@ var CallDiagnosticMetrics = exports.default = /*#__PURE__*/function (_StatelessW
787
900
  clientErrorCode: clientErrorCode,
788
901
  serviceErrorCode: serviceErrorCode,
789
902
  rawErrorMessage: rawErrorMessage,
790
- httpStatusCode: httpStatusCode
903
+ httpCode: httpCode
791
904
  });
792
905
  }
793
-
906
+ }
907
+ var locusHttpClientErrorCode = LOCUS_HTTP_STATUS_TO_CLIENT_ERROR_CODE[httpCode];
908
+ var requestUrl = ((_rawError$options = rawError.options) === null || _rawError$options === void 0 ? void 0 : _rawError$options.uri) || ((_rawError$options2 = rawError.options) === null || _rawError$options2 === void 0 ? void 0 : _rawError$options2.url);
909
+ if (locusHttpClientErrorCode && !payload && requestUrl !== null && requestUrl !== void 0 && requestUrl.includes('locus')) {
910
+ payload = this.getErrorPayloadForClientErrorCode({
911
+ clientErrorCode: locusHttpClientErrorCode,
912
+ serviceErrorCode: serviceErrorCode,
913
+ rawErrorMessage: rawErrorMessage,
914
+ httpCode: httpCode
915
+ });
916
+ }
917
+ if (serviceErrorCode) {
794
918
  // by default, if it is locus error, return new locus err
795
919
  if ((0, _callDiagnosticMetrics.isLocusServiceErrorCode)(serviceErrorCode) && !payload) {
796
920
  payload = this.getErrorPayloadForClientErrorCode({
797
921
  clientErrorCode: _config2.NEW_LOCUS_ERROR_CLIENT_CODE,
798
922
  serviceErrorCode: serviceErrorCode,
799
923
  rawErrorMessage: rawErrorMessage,
800
- httpStatusCode: httpStatusCode
924
+ httpCode: httpCode
801
925
  });
802
926
  }
803
927
  }
@@ -806,7 +930,7 @@ var CallDiagnosticMetrics = exports.default = /*#__PURE__*/function (_StatelessW
806
930
  clientErrorCode: _config2.MEETING_INFO_LOOKUP_ERROR_CLIENT_CODE,
807
931
  serviceErrorCode: serviceErrorCode,
808
932
  rawErrorMessage: rawErrorMessage,
809
- httpStatusCode: httpStatusCode
933
+ httpCode: httpCode
810
934
  });
811
935
  }
812
936
  if ((0, _callDiagnosticMetrics.isNetworkError)(rawError) && !payload) {
@@ -815,7 +939,7 @@ var CallDiagnosticMetrics = exports.default = /*#__PURE__*/function (_StatelessW
815
939
  serviceErrorCode: serviceErrorCode,
816
940
  payloadOverrides: rawError.payloadOverrides,
817
941
  rawErrorMessage: rawErrorMessage,
818
- httpStatusCode: httpStatusCode
942
+ httpCode: httpCode
819
943
  });
820
944
  }
821
945
  if ((0, _callDiagnosticMetrics.isUnauthorizedError)(rawError) && !payload) {
@@ -824,7 +948,7 @@ var CallDiagnosticMetrics = exports.default = /*#__PURE__*/function (_StatelessW
824
948
  serviceErrorCode: serviceErrorCode,
825
949
  payloadOverrides: rawError.payloadOverrides,
826
950
  rawErrorMessage: rawErrorMessage,
827
- httpStatusCode: httpStatusCode
951
+ httpCode: httpCode
828
952
  });
829
953
  }
830
954
  if (!payload) {
@@ -835,7 +959,7 @@ var CallDiagnosticMetrics = exports.default = /*#__PURE__*/function (_StatelessW
835
959
  serviceErrorName: rawError === null || rawError === void 0 ? void 0 : rawError.name,
836
960
  payloadOverrides: rawError.payloadOverrides,
837
961
  rawErrorMessage: rawErrorMessage,
838
- httpStatusCode: httpStatusCode
962
+ httpCode: httpCode
839
963
  });
840
964
  }
841
965
 
@@ -853,17 +977,18 @@ var CallDiagnosticMetrics = exports.default = /*#__PURE__*/function (_StatelessW
853
977
  */
854
978
  }, {
855
979
  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;
980
+ value: function createCommonEventObjectInMeeting(_ref9) {
981
+ var _this$webex$meetings20, _this$webex$meetings21, _this$webex$meetings22, _meeting$meetingInfo1, _options$joinFlowVers, _meeting$callStateFor, _options$meetingJoinP, _meeting$callStateFor2;
982
+ var name = _ref9.name,
983
+ options = _ref9.options,
984
+ _ref9$eventType = _ref9.eventType,
985
+ eventType = _ref9$eventType === void 0 ? 'client' : _ref9$eventType;
862
986
  var meetingId = options.meetingId,
863
987
  mediaConnections = options.mediaConnections,
864
988
  globalMeetingId = options.globalMeetingId,
865
989
  webexConferenceIdStr = options.webexConferenceIdStr,
866
- sessionCorrelationId = options.sessionCorrelationId;
990
+ sessionCorrelationId = options.sessionCorrelationId,
991
+ locusCluster = options.locusCluster;
867
992
 
868
993
  // @ts-ignore
869
994
  var meeting = this.webex.meetings.getBasicMeetingInformation(meetingId);
@@ -885,10 +1010,11 @@ var CallDiagnosticMetrics = exports.default = /*#__PURE__*/function (_StatelessW
885
1010
  mediaConnections: (meeting === null || meeting === void 0 ? void 0 : meeting.mediaConnections) || mediaConnections,
886
1011
  webexConferenceIdStr: webexConferenceIdStr,
887
1012
  globalMeetingId: globalMeetingId,
888
- sessionCorrelationId: sessionCorrelationId
1013
+ sessionCorrelationId: sessionCorrelationId,
1014
+ locusCluster: locusCluster
889
1015
  });
890
1016
 
891
- // create common event object structur
1017
+ // create common event object structure
892
1018
  var commonEventObject = _objectSpread(_objectSpread(_objectSpread({
893
1019
  name: name,
894
1020
  canProceed: true,
@@ -898,6 +1024,7 @@ var CallDiagnosticMetrics = exports.default = /*#__PURE__*/function (_StatelessW
898
1024
  },
899
1025
  userType: meeting.getCurUserType(),
900
1026
  loginType: 'loginType' in meeting.callStateForMetrics ? meeting.callStateForMetrics.loginType : this.getCurLoginType(),
1027
+ telemetryOptOut: this.getTelemetryOptOut(),
901
1028
  isConvergedArchitectureEnabled: this.getIsConvergedArchitectureEnabled({
902
1029
  meetingId: meetingId
903
1030
  })
@@ -908,7 +1035,10 @@ var CallDiagnosticMetrics = exports.default = /*#__PURE__*/function (_StatelessW
908
1035
  }), {}, {
909
1036
  webexSubServiceType: this.getSubServiceType(meeting),
910
1037
  // @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
1038
+ webClientPreload: (_this$webex$meetings20 = this.webex.meetings) === null || _this$webex$meetings20 === void 0 ? void 0 : (_this$webex$meetings21 = _this$webex$meetings20.config) === null || _this$webex$meetings21 === void 0 ? void 0 : (_this$webex$meetings22 = _this$webex$meetings21.metrics) === null || _this$webex$meetings22 === void 0 ? void 0 : _this$webex$meetings22.webClientPreload,
1039
+ isVipMeeting: (meeting === null || meeting === void 0 ? void 0 : (_meeting$meetingInfo1 = meeting.meetingInfo) === null || _meeting$meetingInfo1 === void 0 ? void 0 : _meeting$meetingInfo1.vipmeeting) || false,
1040
+ isAutomatedUser: AutomatedUserUtils.isAutomatedUser(),
1041
+ userActivation: this.getUserActivation()
912
1042
  });
913
1043
  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
1044
  if (joinFlowVersion) {
@@ -920,9 +1050,10 @@ var CallDiagnosticMetrics = exports.default = /*#__PURE__*/function (_StatelessW
920
1050
  // @ts-ignore
921
1051
  commonEventObject.meetingJoinedTime = meetingJoinedTime;
922
1052
  }
923
- if (options.meetingJoinPhase) {
1053
+ var meetingJoinPhase = (_options$meetingJoinP = options.meetingJoinPhase) !== null && _options$meetingJoinP !== void 0 ? _options$meetingJoinP : (_meeting$callStateFor2 = meeting.callStateForMetrics) === null || _meeting$callStateFor2 === void 0 ? void 0 : _meeting$callStateFor2.meetingJoinPhase;
1054
+ if (meetingJoinPhase) {
924
1055
  // @ts-ignore
925
- commonEventObject.meetingJoinPhase = options.meetingJoinPhase;
1056
+ commonEventObject.meetingJoinPhase = meetingJoinPhase;
926
1057
  }
927
1058
  return commonEventObject;
928
1059
  }
@@ -936,10 +1067,10 @@ var CallDiagnosticMetrics = exports.default = /*#__PURE__*/function (_StatelessW
936
1067
  */
937
1068
  }, {
938
1069
  key: "createClientEventObjectInMeeting",
939
- value: function createClientEventObjectInMeeting(_ref9) {
940
- var name = _ref9.name,
941
- options = _ref9.options,
942
- errors = _ref9.errors;
1070
+ value: function createClientEventObjectInMeeting(_ref0) {
1071
+ var name = _ref0.name,
1072
+ options = _ref0.options,
1073
+ errors = _ref0.errors;
943
1074
  var commonObject = this.createCommonEventObjectInMeeting({
944
1075
  name: name,
945
1076
  options: options,
@@ -962,9 +1093,9 @@ var CallDiagnosticMetrics = exports.default = /*#__PURE__*/function (_StatelessW
962
1093
  */
963
1094
  }, {
964
1095
  key: "createFeatureEventObjectInMeeting",
965
- value: function createFeatureEventObjectInMeeting(_ref0) {
966
- var name = _ref0.name,
967
- options = _ref0.options;
1096
+ value: function createFeatureEventObjectInMeeting(_ref1) {
1097
+ var name = _ref1.name,
1098
+ options = _ref1.options;
968
1099
  var commonObject = this.createCommonEventObjectInMeeting({
969
1100
  name: name,
970
1101
  options: options,
@@ -985,16 +1116,17 @@ var CallDiagnosticMetrics = exports.default = /*#__PURE__*/function (_StatelessW
985
1116
  */
986
1117
  }, {
987
1118
  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;
1119
+ value: function createClientEventObjectPreMeeting(_ref10) {
1120
+ var _this$webex$meetings23, _this$webex$meetings24, _this$webex$meetings25, _options$meetingJoinP2;
1121
+ var name = _ref10.name,
1122
+ options = _ref10.options,
1123
+ errors = _ref10.errors;
993
1124
  var correlationId = options.correlationId,
994
1125
  globalMeetingId = options.globalMeetingId,
995
1126
  webexConferenceIdStr = options.webexConferenceIdStr,
996
1127
  preLoginId = options.preLoginId,
997
- sessionCorrelationId = options.sessionCorrelationId;
1128
+ sessionCorrelationId = options.sessionCorrelationId,
1129
+ locusCluster = options.locusCluster;
998
1130
 
999
1131
  // grab identifiers
1000
1132
  var identifiers = this.getIdentifiers({
@@ -1002,7 +1134,8 @@ var CallDiagnosticMetrics = exports.default = /*#__PURE__*/function (_StatelessW
1002
1134
  sessionCorrelationId: sessionCorrelationId,
1003
1135
  preLoginId: preLoginId,
1004
1136
  globalMeetingId: globalMeetingId,
1005
- webexConferenceIdStr: webexConferenceIdStr
1137
+ webexConferenceIdStr: webexConferenceIdStr,
1138
+ locusCluster: locusCluster
1006
1139
  });
1007
1140
 
1008
1141
  // create client event object
@@ -1016,15 +1149,18 @@ var CallDiagnosticMetrics = exports.default = /*#__PURE__*/function (_StatelessW
1016
1149
  isMercuryConnected: this.isMercuryConnected
1017
1150
  },
1018
1151
  loginType: this.getCurLoginType(),
1152
+ telemetryOptOut: this.getTelemetryOptOut(),
1019
1153
  // @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
1154
+ webClientPreload: (_this$webex$meetings23 = this.webex.meetings) === null || _this$webex$meetings23 === void 0 ? void 0 : (_this$webex$meetings24 = _this$webex$meetings23.config) === null || _this$webex$meetings24 === void 0 ? void 0 : (_this$webex$meetings25 = _this$webex$meetings24.metrics) === null || _this$webex$meetings25 === void 0 ? void 0 : _this$webex$meetings25.webClientPreload,
1155
+ isAutomatedUser: AutomatedUserUtils.isAutomatedUser(),
1156
+ userActivation: this.getUserActivation()
1021
1157
  };
1022
1158
  if (options.joinFlowVersion) {
1023
1159
  clientEventObject.joinFlowVersion = options.joinFlowVersion;
1024
1160
  }
1025
- if (options.meetingJoinPhase) {
1026
- clientEventObject.meetingJoinPhase = options.meetingJoinPhase;
1027
- }
1161
+
1162
+ // No meeting exists yet for pre-meeting events, so the join phase is pre-join by construction
1163
+ clientEventObject.meetingJoinPhase = (_options$meetingJoinP2 = options.meetingJoinPhase) !== null && _options$meetingJoinP2 !== void 0 ? _options$meetingJoinP2 : 'pre-join';
1028
1164
  if (options.userNameInput) {
1029
1165
  clientEventObject.userNameInput = options.userNameInput;
1030
1166
  }
@@ -1045,10 +1181,10 @@ var CallDiagnosticMetrics = exports.default = /*#__PURE__*/function (_StatelessW
1045
1181
  */
1046
1182
  }, {
1047
1183
  key: "prepareClientEvent",
1048
- value: function prepareClientEvent(_ref10) {
1049
- var name = _ref10.name,
1050
- payload = _ref10.payload,
1051
- options = _ref10.options;
1184
+ value: function prepareClientEvent(_ref11) {
1185
+ var name = _ref11.name,
1186
+ payload = _ref11.payload,
1187
+ options = _ref11.options;
1052
1188
  var meetingId = options.meetingId,
1053
1189
  correlationId = options.correlationId,
1054
1190
  rawError = options.rawError;
@@ -1104,11 +1240,11 @@ var CallDiagnosticMetrics = exports.default = /*#__PURE__*/function (_StatelessW
1104
1240
  */
1105
1241
  }, {
1106
1242
  key: "submitClientEvent",
1107
- value: function submitClientEvent(_ref11) {
1108
- var name = _ref11.name,
1109
- payload = _ref11.payload,
1110
- options = _ref11.options,
1111
- delaySubmitEvent = _ref11.delaySubmitEvent;
1243
+ value: function submitClientEvent(_ref12) {
1244
+ var name = _ref12.name,
1245
+ payload = _ref12.payload,
1246
+ options = _ref12.options,
1247
+ delaySubmitEvent = _ref12.delaySubmitEvent;
1112
1248
  if (delaySubmitEvent) {
1113
1249
  // Preserve the time when the event was triggered if delaying the submission to Call Diagnostics
1114
1250
  var delayedOptions = _objectSpread(_objectSpread({}, options), {}, {
@@ -1220,12 +1356,13 @@ var CallDiagnosticMetrics = exports.default = /*#__PURE__*/function (_StatelessW
1220
1356
  * @throws
1221
1357
  */
1222
1358
  function () {
1223
- var _buildClientEventFetchRequestOptions = (0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee(_ref12) {
1359
+ var _buildClientEventFetchRequestOptions = (0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee(_ref13) {
1360
+ var _this$webex$internal$, _this$webex$internal$2;
1224
1361
  var name, payload, options, clientEvent, diagnosticEvent, request;
1225
1362
  return _regenerator.default.wrap(function (_context) {
1226
1363
  while (1) switch (_context.prev = _context.next) {
1227
1364
  case 0:
1228
- name = _ref12.name, payload = _ref12.payload, options = _ref12.options;
1365
+ name = _ref13.name, payload = _ref13.payload, options = _ref13.options;
1229
1366
  this.logger.log(_config2.CALL_DIAGNOSTIC_LOG_IDENTIFIER, 'CallDiagnosticMetrics: @buildClientEventFetchRequestOptions. Building request options object for fetch()...', "name: ".concat(name));
1230
1367
  clientEvent = this.prepareClientEvent({
1231
1368
  name: name,
@@ -1246,7 +1383,7 @@ var CallDiagnosticMetrics = exports.default = /*#__PURE__*/function (_StatelessW
1246
1383
  },
1247
1384
  headers: {},
1248
1385
  // @ts-ignore
1249
- waitForServiceTimeout: this.webex.internal.metrics.config.waitForServiceTimeout
1386
+ 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
1387
  };
1251
1388
  if (options.preLoginId) {
1252
1389
  request.headers = {