@webex/internal-plugin-metrics 3.0.0-beta.38 → 3.0.0-beta.381

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 (73) hide show
  1. package/dist/batcher.js +40 -1
  2. package/dist/batcher.js.map +1 -1
  3. package/dist/call-diagnostic/call-diagnostic-metrics-batcher.js +65 -0
  4. package/dist/call-diagnostic/call-diagnostic-metrics-batcher.js.map +1 -0
  5. package/dist/call-diagnostic/call-diagnostic-metrics-latencies.js +476 -0
  6. package/dist/call-diagnostic/call-diagnostic-metrics-latencies.js.map +1 -0
  7. package/dist/call-diagnostic/call-diagnostic-metrics.js +854 -0
  8. package/dist/call-diagnostic/call-diagnostic-metrics.js.map +1 -0
  9. package/dist/call-diagnostic/call-diagnostic-metrics.util.js +364 -0
  10. package/dist/call-diagnostic/call-diagnostic-metrics.util.js.map +1 -0
  11. package/dist/call-diagnostic/config.js +627 -0
  12. package/dist/call-diagnostic/config.js.map +1 -0
  13. package/dist/client-metrics-batcher.js +2 -1
  14. package/dist/client-metrics-batcher.js.map +1 -1
  15. package/dist/config.js +2 -1
  16. package/dist/config.js.map +1 -1
  17. package/dist/index.js +33 -0
  18. package/dist/index.js.map +1 -1
  19. package/dist/metrics.js +23 -28
  20. package/dist/metrics.js.map +1 -1
  21. package/dist/metrics.types.js +7 -0
  22. package/dist/metrics.types.js.map +1 -0
  23. package/dist/new-metrics.js +299 -0
  24. package/dist/new-metrics.js.map +1 -0
  25. package/dist/prelogin-metrics-batcher.js +82 -0
  26. package/dist/prelogin-metrics-batcher.js.map +1 -0
  27. package/dist/types/batcher.d.ts +7 -0
  28. package/dist/types/call-diagnostic/call-diagnostic-metrics-batcher.d.ts +2 -0
  29. package/dist/types/call-diagnostic/call-diagnostic-metrics-latencies.d.ts +204 -0
  30. package/dist/types/call-diagnostic/call-diagnostic-metrics.d.ts +427 -0
  31. package/dist/types/call-diagnostic/call-diagnostic-metrics.util.d.ts +103 -0
  32. package/dist/types/call-diagnostic/config.d.ts +178 -0
  33. package/dist/types/client-metrics-batcher.d.ts +2 -0
  34. package/dist/types/config.d.ts +36 -0
  35. package/dist/types/index.d.ts +15 -0
  36. package/dist/types/metrics.d.ts +3 -0
  37. package/dist/types/metrics.types.d.ts +105 -0
  38. package/dist/types/new-metrics.d.ts +131 -0
  39. package/dist/types/prelogin-metrics-batcher.d.ts +2 -0
  40. package/dist/types/utils.d.ts +6 -0
  41. package/dist/utils.js +27 -0
  42. package/dist/utils.js.map +1 -0
  43. package/package.json +16 -8
  44. package/src/batcher.js +38 -0
  45. package/src/call-diagnostic/call-diagnostic-metrics-batcher.ts +72 -0
  46. package/src/call-diagnostic/call-diagnostic-metrics-latencies.ts +435 -0
  47. package/src/call-diagnostic/call-diagnostic-metrics.ts +912 -0
  48. package/src/call-diagnostic/call-diagnostic-metrics.util.ts +392 -0
  49. package/src/call-diagnostic/config.ts +685 -0
  50. package/src/client-metrics-batcher.js +1 -0
  51. package/src/config.js +1 -0
  52. package/src/index.ts +54 -0
  53. package/src/metrics.js +18 -24
  54. package/src/metrics.types.ts +168 -0
  55. package/src/new-metrics.ts +278 -0
  56. package/src/prelogin-metrics-batcher.ts +95 -0
  57. package/src/utils.ts +17 -0
  58. package/test/unit/spec/batcher.js +2 -0
  59. package/test/unit/spec/call-diagnostic/call-diagnostic-metrics-batcher.ts +457 -0
  60. package/test/unit/spec/call-diagnostic/call-diagnostic-metrics-latencies.ts +520 -0
  61. package/test/unit/spec/call-diagnostic/call-diagnostic-metrics.ts +2276 -0
  62. package/test/unit/spec/call-diagnostic/call-diagnostic-metrics.util.ts +629 -0
  63. package/test/unit/spec/client-metrics-batcher.js +2 -0
  64. package/test/unit/spec/metrics.js +66 -97
  65. package/test/unit/spec/new-metrics.ts +234 -0
  66. package/test/unit/spec/prelogin-metrics-batcher.ts +250 -0
  67. package/test/unit/spec/utils.ts +22 -0
  68. package/tsconfig.json +6 -0
  69. package/dist/call-diagnostic-events-batcher.js +0 -60
  70. package/dist/call-diagnostic-events-batcher.js.map +0 -1
  71. package/src/call-diagnostic-events-batcher.js +0 -62
  72. package/src/index.js +0 -17
  73. package/test/unit/spec/call-diagnostic-events-batcher.js +0 -195
@@ -0,0 +1,854 @@
1
+ "use strict";
2
+
3
+ var _Reflect$construct = require("@babel/runtime-corejs2/core-js/reflect/construct");
4
+ var _Object$keys = require("@babel/runtime-corejs2/core-js/object/keys");
5
+ var _Object$getOwnPropertySymbols = require("@babel/runtime-corejs2/core-js/object/get-own-property-symbols");
6
+ var _Object$getOwnPropertyDescriptor = require("@babel/runtime-corejs2/core-js/object/get-own-property-descriptor");
7
+ var _Object$getOwnPropertyDescriptors = require("@babel/runtime-corejs2/core-js/object/get-own-property-descriptors");
8
+ var _Object$defineProperties = require("@babel/runtime-corejs2/core-js/object/define-properties");
9
+ var _Object$defineProperty = require("@babel/runtime-corejs2/core-js/object/define-property");
10
+ var _interopRequireDefault = require("@babel/runtime-corejs2/helpers/interopRequireDefault");
11
+ _Object$defineProperty(exports, "__esModule", {
12
+ value: true
13
+ });
14
+ exports.default = void 0;
15
+ var _regenerator = _interopRequireDefault(require("@babel/runtime-corejs2/regenerator"));
16
+ var _promise = _interopRequireDefault(require("@babel/runtime-corejs2/core-js/promise"));
17
+ var _stringify = _interopRequireDefault(require("@babel/runtime-corejs2/core-js/json/stringify"));
18
+ var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime-corejs2/helpers/asyncToGenerator"));
19
+ var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime-corejs2/helpers/classCallCheck"));
20
+ var _createClass2 = _interopRequireDefault(require("@babel/runtime-corejs2/helpers/createClass"));
21
+ var _assertThisInitialized2 = _interopRequireDefault(require("@babel/runtime-corejs2/helpers/assertThisInitialized"));
22
+ var _inherits2 = _interopRequireDefault(require("@babel/runtime-corejs2/helpers/inherits"));
23
+ var _possibleConstructorReturn2 = _interopRequireDefault(require("@babel/runtime-corejs2/helpers/possibleConstructorReturn"));
24
+ var _getPrototypeOf2 = _interopRequireDefault(require("@babel/runtime-corejs2/helpers/getPrototypeOf"));
25
+ var _defineProperty2 = _interopRequireDefault(require("@babel/runtime-corejs2/helpers/defineProperty"));
26
+ var _merge2 = _interopRequireDefault(require("lodash/merge"));
27
+ var _internalPluginMetrics = require("@webex/internal-plugin-metrics");
28
+ var _common = require("@webex/common");
29
+ var _uuid = _interopRequireDefault(require("uuid"));
30
+ var _webexCore = require("@webex/webex-core");
31
+ var _callDiagnosticMetrics = require("./call-diagnostic-metrics.util");
32
+ var _config = require("../config");
33
+ var _callDiagnosticMetricsBatcher = _interopRequireDefault(require("./call-diagnostic-metrics-batcher"));
34
+ var _preloginMetricsBatcher = _interopRequireDefault(require("../prelogin-metrics-batcher"));
35
+ var _config2 = require("./config");
36
+ function ownKeys(object, enumerableOnly) { var keys = _Object$keys(object); if (_Object$getOwnPropertySymbols) { var symbols = _Object$getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return _Object$getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
37
+ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { (0, _defineProperty2.default)(target, key, source[key]); }) : _Object$getOwnPropertyDescriptors ? _Object$defineProperties(target, _Object$getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { _Object$defineProperty(target, key, _Object$getOwnPropertyDescriptor(source, key)); }); } return target; }
38
+ function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = (0, _getPrototypeOf2.default)(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = (0, _getPrototypeOf2.default)(this).constructor; result = _Reflect$construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return (0, _possibleConstructorReturn2.default)(this, result); }; }
39
+ function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !_Reflect$construct) return false; if (_Reflect$construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(_Reflect$construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
40
+ var _BrowserDetection = (0, _common.BrowserDetection)(),
41
+ getOSVersion = _BrowserDetection.getOSVersion,
42
+ getBrowserName = _BrowserDetection.getBrowserName,
43
+ getBrowserVersion = _BrowserDetection.getBrowserVersion;
44
+ /**
45
+ * @description Util class to handle Call Analyzer Metrics
46
+ * @export
47
+ * @class CallDiagnosticMetrics
48
+ */
49
+ var CallDiagnosticMetrics = /*#__PURE__*/function (_StatelessWebexPlugin) {
50
+ (0, _inherits2.default)(CallDiagnosticMetrics, _StatelessWebexPlugin);
51
+ var _super = _createSuper(CallDiagnosticMetrics);
52
+ // @ts-ignore
53
+
54
+ // @ts-ignore
55
+
56
+ // to avoid adding @ts-ignore everywhere
57
+
58
+ // the default validator before piping an event to the batcher
59
+ // this function can be overridden by the user
60
+
61
+ /**
62
+ * Constructor
63
+ * @param args
64
+ */
65
+ function CallDiagnosticMetrics() {
66
+ var _this;
67
+ (0, _classCallCheck2.default)(this, CallDiagnosticMetrics);
68
+ for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
69
+ args[_key] = arguments[_key];
70
+ }
71
+ _this = _super.call.apply(_super, [this].concat(args));
72
+ // @ts-ignore
73
+ (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "callDiagnosticEventsBatcher", void 0);
74
+ (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "preLoginMetricsBatcher", void 0);
75
+ (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "logger", void 0);
76
+ (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "hasLoggedBrowserSerial", void 0);
77
+ (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "validator", function (options) {
78
+ return _promise.default.resolve({
79
+ event: options === null || options === void 0 ? void 0 : options.event,
80
+ valid: true
81
+ });
82
+ });
83
+ (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "submitToCallDiagnosticsPreLogin", function (event, preLoginId) {
84
+ // build metrics-a event type
85
+ var finalEvent = {
86
+ eventPayload: event,
87
+ type: ['diagnostic-event']
88
+ };
89
+ _this.preLoginMetricsBatcher.savePreLoginId(preLoginId);
90
+ return _this.preLoginMetricsBatcher.request(finalEvent);
91
+ });
92
+ _this.logger = _this.webex.logger;
93
+ // @ts-ignore
94
+ _this.callDiagnosticEventsBatcher = new _callDiagnosticMetricsBatcher.default({}, {
95
+ parent: _this.webex
96
+ });
97
+ // @ts-ignore
98
+ _this.preLoginMetricsBatcher = new _preloginMetricsBatcher.default({}, {
99
+ parent: _this.webex
100
+ });
101
+ return _this;
102
+ }
103
+
104
+ /**
105
+ * Returns the login type of the current user
106
+ * @returns one of 'login-ci','unverified-guest', null
107
+ */
108
+ (0, _createClass2.default)(CallDiagnosticMetrics, [{
109
+ key: "getCurLoginType",
110
+ value: function getCurLoginType() {
111
+ // @ts-ignore
112
+ if (this.webex.canAuthorize) {
113
+ // @ts-ignore
114
+ return this.webex.credentials.isUnverifiedGuest ? 'unverified-guest' : 'login-ci';
115
+ }
116
+ return null;
117
+ }
118
+
119
+ /**
120
+ * Returns if the meeting has converged architecture enabled
121
+ * @param options.meetingId
122
+ */
123
+ }, {
124
+ key: "getIsConvergedArchitectureEnabled",
125
+ value: function getIsConvergedArchitectureEnabled(_ref) {
126
+ var meetingId = _ref.meetingId;
127
+ if (meetingId) {
128
+ var _meeting$meetingInfo;
129
+ // @ts-ignore
130
+ var meeting = this.webex.meetings.meetingCollection.get(meetingId);
131
+ return meeting === null || meeting === void 0 ? void 0 : (_meeting$meetingInfo = meeting.meetingInfo) === null || _meeting$meetingInfo === void 0 ? void 0 : _meeting$meetingInfo.enableConvergedArchitecture;
132
+ }
133
+ return undefined;
134
+ }
135
+
136
+ /**
137
+ * Returns meeting's subServiceType
138
+ * @param meeting
139
+ * @returns
140
+ */
141
+ }, {
142
+ key: "getSubServiceType",
143
+ value: function getSubServiceType(meeting) {
144
+ if (meeting) {
145
+ // @ts-ignore
146
+ var meetingInfo = meeting === null || meeting === void 0 ? void 0 : meeting.meetingInfo;
147
+ // if not Scheduled, not Webinar, pmr - then pmr
148
+ if (!(meetingInfo !== null && meetingInfo !== void 0 && meetingInfo.webexScheduled) && !(meetingInfo !== null && meetingInfo !== void 0 && meetingInfo.enableEvent) && meetingInfo !== null && meetingInfo !== void 0 && meetingInfo.pmr) {
149
+ return _config2.WEBEX_SUB_SERVICE_TYPES.PMR;
150
+ }
151
+ // if Scheduled, not Webinar, not pmr - then ScheduledMeeting
152
+ if (meetingInfo !== null && meetingInfo !== void 0 && meetingInfo.webexScheduled && !(meetingInfo !== null && meetingInfo !== void 0 && meetingInfo.enableEvent) && !(meetingInfo !== null && meetingInfo !== void 0 && meetingInfo.pmr)) {
153
+ return _config2.WEBEX_SUB_SERVICE_TYPES.SCHEDULED_MEETING;
154
+ }
155
+ // if Scheduled, Webinar, not pmr - then Webinar
156
+ if (meetingInfo !== null && meetingInfo !== void 0 && meetingInfo.webexScheduled && meetingInfo !== null && meetingInfo !== void 0 && meetingInfo.enableEvent && !(meetingInfo !== null && meetingInfo !== void 0 && meetingInfo.pmr)) {
157
+ return _config2.WEBEX_SUB_SERVICE_TYPES.WEBINAR;
158
+ }
159
+ }
160
+ return undefined;
161
+ }
162
+
163
+ /**
164
+ * Get origin object for Call Diagnostic Event payload.
165
+ * @param options
166
+ * @param meetingId
167
+ * @returns
168
+ */
169
+ }, {
170
+ key: "getOrigin",
171
+ value: function getOrigin(options, meetingId) {
172
+ var _this$webex$meetings$, _this$webex$meetings$2, _this$webex$meetings$3, _this$webex$meetings$4, _this$webex$meetings$5, _this$webex$meetings$6;
173
+ var defaultClientType = // @ts-ignore
174
+ (_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;
175
+ var defaultSubClientType = // @ts-ignore
176
+ (_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;
177
+ // @ts-ignore
178
+ 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;
179
+ // @ts-ignore
180
+ var defaultSDKClientVersion = "".concat(_config.CLIENT_NAME, "/").concat(this.webex.version);
181
+ var versionMetadata = {};
182
+
183
+ // sdk version split doesn't really make sense for now...
184
+ if (providedClientVersion) {
185
+ versionMetadata = (0, _callDiagnosticMetrics.extractVersionMetadata)(providedClientVersion);
186
+ }
187
+ if (!this.hasLoggedBrowserSerial) {
188
+ this.logger.log(_config2.CALL_DIAGNOSTIC_LOG_IDENTIFIER, "CallDiagnosticMetrics: @createClientEventObjectInMeeting => collected browser data", (0, _stringify.default)((0, _common.getBrowserSerial)()));
189
+ this.hasLoggedBrowserSerial = true;
190
+ }
191
+ if (defaultClientType && defaultSubClientType || options.clientType && options.subClientType) {
192
+ var _this$webex$meetings, _this$webex$meetings$7, _this$webex$meetings$8, _this$webex$meetings$9, _this$webex$meetings$10, _this$webex$meetings$11;
193
+ var origin = {
194
+ name: 'endpoint',
195
+ networkType: (options === null || options === void 0 ? void 0 : options.networkType) || 'unknown',
196
+ userAgent: (0, _callDiagnosticMetrics.userAgentToString)({
197
+ // @ts-ignore
198
+ 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,
199
+ // @ts-ignore
200
+ webexVersion: this.webex.version
201
+ }),
202
+ clientInfo: _objectSpread(_objectSpread({
203
+ clientType: (options === null || options === void 0 ? void 0 : options.clientType) || defaultClientType,
204
+ clientVersion: providedClientVersion || defaultSDKClientVersion
205
+ }, versionMetadata), {}, {
206
+ publicNetworkPrefix:
207
+ // @ts-ignore
208
+ (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,
209
+ localNetworkPrefix: (0, _callDiagnosticMetrics.anonymizeIPAddress)( // @ts-ignore
210
+ (_this$webex$meetings$10 = this.webex.meetings.meetingCollection.get(meetingId)) === null || _this$webex$meetings$10 === void 0 ? void 0 : (_this$webex$meetings$11 = _this$webex$meetings$10.statsAnalyzer) === null || _this$webex$meetings$11 === void 0 ? void 0 : _this$webex$meetings$11.getLocalIpAddress()) || undefined,
211
+ osVersion: getOSVersion() || 'unknown',
212
+ subClientType: (options === null || options === void 0 ? void 0 : options.subClientType) || defaultSubClientType,
213
+ os: (0, _internalPluginMetrics.getOSNameInternal)(),
214
+ browser: getBrowserName(),
215
+ browserVersion: getBrowserVersion()
216
+ })
217
+ };
218
+ if (meetingId) {
219
+ // @ts-ignore
220
+ var meeting = this.webex.meetings.meetingCollection.get(meetingId);
221
+ if (meeting !== null && meeting !== void 0 && meeting.environment) {
222
+ origin.environment = meeting.environment;
223
+ }
224
+ }
225
+ if (options !== null && options !== void 0 && options.environment) {
226
+ origin.environment = options.environment;
227
+ }
228
+ if (options !== null && options !== void 0 && options.newEnvironment) {
229
+ origin.newEnvironment = options.newEnvironment;
230
+ }
231
+ if (options !== null && options !== void 0 && options.clientLaunchMethod) {
232
+ origin.clientInfo.clientLaunchMethod = options.clientLaunchMethod;
233
+ }
234
+ return origin;
235
+ }
236
+ throw new Error("ClientType and SubClientType can't be undefined");
237
+ }
238
+
239
+ /**
240
+ * Gather identifier details for call diagnostic payload.
241
+ * @throws Error if initialization fails.
242
+ * @param options
243
+ */
244
+ }, {
245
+ key: "getIdentifiers",
246
+ value: function getIdentifiers(options) {
247
+ var _meeting$locusInfo, _meeting$meetingInfo2, _meeting$meetingInfo3, _meeting$meetingInfo6, _meeting$meetingInfo8;
248
+ var meeting = options.meeting,
249
+ mediaConnections = options.mediaConnections,
250
+ correlationId = options.correlationId,
251
+ webexConferenceIdStr = options.webexConferenceIdStr,
252
+ globalMeetingId = options.globalMeetingId,
253
+ preLoginId = options.preLoginId;
254
+ var identifiers = {
255
+ correlationId: 'unknown'
256
+ };
257
+ if (meeting) {
258
+ identifiers.correlationId = meeting.correlationId;
259
+ }
260
+ if (correlationId) {
261
+ identifiers.correlationId = correlationId;
262
+ }
263
+ // @ts-ignore
264
+ if (this.webex.internal) {
265
+ // @ts-ignore
266
+ var device = this.webex.internal.device;
267
+ identifiers.userId = device.userId || preLoginId;
268
+ identifiers.deviceId = device.url;
269
+ identifiers.orgId = device.orgId;
270
+ // @ts-ignore
271
+ identifiers.locusUrl = this.webex.internal.services.get('locus');
272
+ }
273
+ if (meeting !== null && meeting !== void 0 && (_meeting$locusInfo = meeting.locusInfo) !== null && _meeting$locusInfo !== void 0 && _meeting$locusInfo.fullState) {
274
+ identifiers.locusUrl = meeting.locusUrl;
275
+ identifiers.locusId = meeting.locusUrl && meeting.locusUrl.split('/').pop();
276
+ identifiers.locusStartTime = meeting.locusInfo.fullState && meeting.locusInfo.fullState.lastActive;
277
+ }
278
+ if (meeting !== null && meeting !== void 0 && (_meeting$meetingInfo2 = meeting.meetingInfo) !== null && _meeting$meetingInfo2 !== void 0 && _meeting$meetingInfo2.confIdStr || meeting !== null && meeting !== void 0 && (_meeting$meetingInfo3 = meeting.meetingInfo) !== null && _meeting$meetingInfo3 !== void 0 && _meeting$meetingInfo3.confID) {
279
+ var _meeting$meetingInfo4, _meeting$meetingInfo5;
280
+ identifiers.webexConferenceIdStr = "".concat(((_meeting$meetingInfo4 = meeting.meetingInfo) === null || _meeting$meetingInfo4 === void 0 ? void 0 : _meeting$meetingInfo4.confIdStr) || ((_meeting$meetingInfo5 = meeting.meetingInfo) === null || _meeting$meetingInfo5 === void 0 ? void 0 : _meeting$meetingInfo5.confID));
281
+ }
282
+ if (meeting !== null && meeting !== void 0 && (_meeting$meetingInfo6 = meeting.meetingInfo) !== null && _meeting$meetingInfo6 !== void 0 && _meeting$meetingInfo6.meetingId) {
283
+ var _meeting$meetingInfo7;
284
+ identifiers.globalMeetingId = (_meeting$meetingInfo7 = meeting.meetingInfo) === null || _meeting$meetingInfo7 === void 0 ? void 0 : _meeting$meetingInfo7.meetingId;
285
+ }
286
+ if (meeting !== null && meeting !== void 0 && (_meeting$meetingInfo8 = meeting.meetingInfo) !== null && _meeting$meetingInfo8 !== void 0 && _meeting$meetingInfo8.siteName) {
287
+ var _meeting$meetingInfo9;
288
+ identifiers.webexSiteName = (_meeting$meetingInfo9 = meeting.meetingInfo) === null || _meeting$meetingInfo9 === void 0 ? void 0 : _meeting$meetingInfo9.siteName;
289
+ }
290
+ if (mediaConnections) {
291
+ var _mediaConnections$, _mediaConnections$2;
292
+ identifiers.mediaAgentAlias = mediaConnections === null || mediaConnections === void 0 ? void 0 : (_mediaConnections$ = mediaConnections[0]) === null || _mediaConnections$ === void 0 ? void 0 : _mediaConnections$.mediaAgentAlias;
293
+ identifiers.mediaAgentGroupId = mediaConnections === null || mediaConnections === void 0 ? void 0 : (_mediaConnections$2 = mediaConnections[0]) === null || _mediaConnections$2 === void 0 ? void 0 : _mediaConnections$2.mediaAgentGroupId;
294
+ }
295
+ if (!(identifiers !== null && identifiers !== void 0 && identifiers.webexConferenceIdStr) && webexConferenceIdStr) {
296
+ identifiers.webexConferenceIdStr = "".concat(webexConferenceIdStr);
297
+ }
298
+ if (!(identifiers !== null && identifiers !== void 0 && identifiers.globalMeetingId) && globalMeetingId) {
299
+ identifiers.globalMeetingId = globalMeetingId;
300
+ }
301
+ if (identifiers.correlationId === undefined) {
302
+ throw new Error('Identifiers initialization failed.');
303
+ }
304
+ return identifiers;
305
+ }
306
+
307
+ /**
308
+ * Create diagnostic event, which can hold client event, feature event or MQE event data.
309
+ * This just initiates the shared properties that are required for all the 3 event categories.
310
+ * @param eventData
311
+ * @param options
312
+ * @returns
313
+ */
314
+ }, {
315
+ key: "prepareDiagnosticEvent",
316
+ value: function prepareDiagnosticEvent(eventData, options) {
317
+ var _this$webex$meetings$12;
318
+ var meetingId = options.meetingId;
319
+ var origin = this.getOrigin(options, meetingId);
320
+ var event = {
321
+ eventId: _uuid.default.v4(),
322
+ version: 1,
323
+ origin: origin,
324
+ originTime: {
325
+ triggered: new Date().toISOString(),
326
+ // is overridden in prepareRequest batcher
327
+ sent: 'not_defined_yet'
328
+ },
329
+ // @ts-ignore
330
+ senderCountryCode: (_this$webex$meetings$12 = this.webex.meetings.geoHintInfo) === null || _this$webex$meetings$12 === void 0 ? void 0 : _this$webex$meetings$12.countryCode,
331
+ event: eventData
332
+ };
333
+
334
+ // sanitize (remove empty properties, CA requires it)
335
+ // but we don't want to sanitize MQE as most of the times
336
+ // values will be 0, [] etc, and they are required.
337
+ if (eventData.name !== 'client.mediaquality.event') {
338
+ (0, _callDiagnosticMetrics.clearEmptyKeysRecursively)(event);
339
+ }
340
+ return event;
341
+ }
342
+
343
+ /**
344
+ * TODO: NOT IMPLEMENTED
345
+ * Submit Feature Event
346
+ * @returns
347
+ */
348
+ }, {
349
+ key: "submitFeatureEvent",
350
+ value: function submitFeatureEvent() {
351
+ throw Error('Not implemented');
352
+ }
353
+
354
+ /**
355
+ * Submit Media Quality Event
356
+ * @param args - submit params
357
+ * @param arg.name - event key
358
+ * @param arg.payload - additional payload to be merge with the default payload
359
+ * @param arg.options - options
360
+ */
361
+ }, {
362
+ key: "submitMQE",
363
+ value: function submitMQE(_ref2) {
364
+ var name = _ref2.name,
365
+ payload = _ref2.payload,
366
+ options = _ref2.options;
367
+ var meetingId = options.meetingId,
368
+ mediaConnections = options.mediaConnections,
369
+ webexConferenceIdStr = options.webexConferenceIdStr,
370
+ globalMeetingId = options.globalMeetingId;
371
+
372
+ // events that will most likely happen in join phase
373
+ if (meetingId) {
374
+ // @ts-ignore
375
+ var meeting = this.webex.meetings.meetingCollection.get(meetingId);
376
+ if (!meeting) {
377
+ console.warn('Attempt to send MQE but no meeting was found...', "event: ".concat(name, ", meetingId: ").concat(meetingId));
378
+ // @ts-ignore
379
+ this.webex.internal.metrics.submitClientMetrics(_config2.CALL_DIAGNOSTIC_EVENT_FAILED_TO_SEND, {
380
+ fields: {
381
+ meetingId: meetingId,
382
+ name: name
383
+ }
384
+ });
385
+ return;
386
+ }
387
+
388
+ // merge identifiers
389
+ var identifiers = this.getIdentifiers({
390
+ meeting: meeting,
391
+ mediaConnections: meeting.mediaConnections || mediaConnections,
392
+ webexConferenceIdStr: webexConferenceIdStr,
393
+ globalMeetingId: globalMeetingId
394
+ });
395
+
396
+ // create media quality event object
397
+ var clientEventObject = {
398
+ name: name,
399
+ canProceed: true,
400
+ identifiers: identifiers,
401
+ eventData: {
402
+ webClientDomain: window.location.hostname
403
+ },
404
+ intervals: payload.intervals,
405
+ sourceMetadata: {
406
+ applicationSoftwareType: _config.CLIENT_NAME,
407
+ // @ts-ignore
408
+ applicationSoftwareVersion: this.webex.version,
409
+ mediaEngineSoftwareType: getBrowserName() || 'browser',
410
+ mediaEngineSoftwareVersion: getOSVersion() || 'unknown',
411
+ startTime: new Date().toISOString()
412
+ }
413
+ };
414
+
415
+ // merge any new properties, or override existing ones
416
+ clientEventObject = (0, _merge2.default)(clientEventObject, payload);
417
+
418
+ // append media quality event data to the call diagnostic event
419
+ var diagnosticEvent = this.prepareDiagnosticEvent(clientEventObject, options);
420
+ this.validator({
421
+ type: 'mqe',
422
+ event: diagnosticEvent
423
+ });
424
+ this.submitToCallDiagnostics(diagnosticEvent);
425
+ } else {
426
+ throw new Error('Media quality events cant be sent outside the context of a meeting. Meeting id is required.');
427
+ }
428
+ }
429
+
430
+ /**
431
+ * Return Client Event payload by client error code
432
+ * @param arg - get error arg
433
+ * @param arg.clientErrorCode
434
+ * @param arg.serviceErrorCode
435
+ * @param arg.payloadOverrides
436
+ * @param arg.httpStatusCode
437
+ * @returns
438
+ */
439
+ }, {
440
+ key: "getErrorPayloadForClientErrorCode",
441
+ value: function getErrorPayloadForClientErrorCode(_ref3) {
442
+ var clientErrorCode = _ref3.clientErrorCode,
443
+ serviceErrorCode = _ref3.serviceErrorCode,
444
+ serviceErrorName = _ref3.serviceErrorName,
445
+ rawErrorMessage = _ref3.rawErrorMessage,
446
+ payloadOverrides = _ref3.payloadOverrides,
447
+ httpStatusCode = _ref3.httpStatusCode;
448
+ var error;
449
+ if (clientErrorCode) {
450
+ var partialParsedError = _config2.CLIENT_ERROR_CODE_TO_ERROR_PAYLOAD[clientErrorCode];
451
+ if (partialParsedError) {
452
+ error = (0, _merge2.default)({
453
+ fatal: true,
454
+ shownToUser: false,
455
+ name: 'other',
456
+ category: 'other'
457
+ },
458
+ // default values
459
+ {
460
+ errorCode: clientErrorCode
461
+ }, serviceErrorName ? {
462
+ errorData: {
463
+ errorName: serviceErrorName
464
+ }
465
+ } : {}, {
466
+ serviceErrorCode: serviceErrorCode
467
+ }, {
468
+ rawErrorMessage: rawErrorMessage
469
+ }, httpStatusCode === undefined ? {} : {
470
+ httpStatusCode: httpStatusCode
471
+ }, partialParsedError, payloadOverrides || {});
472
+ return error;
473
+ }
474
+ }
475
+ return undefined;
476
+ }
477
+
478
+ /**
479
+ * Generate error payload for Client Event
480
+ * @param rawError
481
+ */
482
+ }, {
483
+ key: "generateClientEventErrorPayload",
484
+ value: function generateClientEventErrorPayload(rawError) {
485
+ var _rawError$error, _rawError$error$body, _rawError$body, _rawError$body2, _rawError$body3, _rawError$body3$reaso;
486
+ var rawErrorMessage = rawError.message;
487
+ var httpStatusCode = rawError.statusCode;
488
+ if (rawError.name) {
489
+ if ((0, _callDiagnosticMetrics.isBrowserMediaErrorName)(rawError.name)) {
490
+ return this.getErrorPayloadForClientErrorCode({
491
+ serviceErrorCode: undefined,
492
+ clientErrorCode: _config2.BROWSER_MEDIA_ERROR_NAME_TO_CLIENT_ERROR_CODES_MAP[rawError.name],
493
+ serviceErrorName: rawError.name,
494
+ rawErrorMessage: rawErrorMessage,
495
+ httpStatusCode: httpStatusCode
496
+ });
497
+ }
498
+ }
499
+ if ((0, _callDiagnosticMetrics.isSdpOfferCreationError)(rawError)) {
500
+ var _rawError$cause;
501
+ // error code is 30005, but that's not specific enough. we also need to check error.cause.type
502
+ var causeType = (_rawError$cause = rawError.cause) === null || _rawError$cause === void 0 ? void 0 : _rawError$cause.type;
503
+ return this.getErrorPayloadForClientErrorCode({
504
+ serviceErrorCode: undefined,
505
+ clientErrorCode: _config2.SDP_OFFER_CREATION_ERROR_MAP[causeType] || _config2.SDP_OFFER_CREATION_ERROR_MAP.GENERAL,
506
+ serviceErrorName: rawError.name,
507
+ rawErrorMessage: rawErrorMessage,
508
+ httpStatusCode: httpStatusCode
509
+ });
510
+ }
511
+ 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);
512
+ if (serviceErrorCode) {
513
+ var clientErrorCode = _config2.SERVICE_ERROR_CODES_TO_CLIENT_ERROR_CODES_MAP[serviceErrorCode];
514
+ if (clientErrorCode) {
515
+ return this.getErrorPayloadForClientErrorCode({
516
+ clientErrorCode: clientErrorCode,
517
+ serviceErrorCode: serviceErrorCode,
518
+ rawErrorMessage: rawErrorMessage,
519
+ httpStatusCode: httpStatusCode
520
+ });
521
+ }
522
+
523
+ // by default, if it is locus error, return new locus err
524
+ if ((0, _callDiagnosticMetrics.isLocusServiceErrorCode)(serviceErrorCode)) {
525
+ return this.getErrorPayloadForClientErrorCode({
526
+ clientErrorCode: _config2.NEW_LOCUS_ERROR_CLIENT_CODE,
527
+ serviceErrorCode: serviceErrorCode,
528
+ rawErrorMessage: rawErrorMessage,
529
+ httpStatusCode: httpStatusCode
530
+ });
531
+ }
532
+ }
533
+ if ((0, _callDiagnosticMetrics.isMeetingInfoServiceError)(rawError)) {
534
+ return this.getErrorPayloadForClientErrorCode({
535
+ clientErrorCode: _config2.MEETING_INFO_LOOKUP_ERROR_CLIENT_CODE,
536
+ serviceErrorCode: serviceErrorCode,
537
+ rawErrorMessage: rawErrorMessage,
538
+ httpStatusCode: httpStatusCode
539
+ });
540
+ }
541
+ if ((0, _callDiagnosticMetrics.isNetworkError)(rawError)) {
542
+ return this.getErrorPayloadForClientErrorCode({
543
+ clientErrorCode: _config2.NETWORK_ERROR,
544
+ serviceErrorCode: serviceErrorCode,
545
+ payloadOverrides: rawError.payloadOverrides,
546
+ rawErrorMessage: rawErrorMessage,
547
+ httpStatusCode: httpStatusCode
548
+ });
549
+ }
550
+ if ((0, _callDiagnosticMetrics.isUnauthorizedError)(rawError)) {
551
+ return this.getErrorPayloadForClientErrorCode({
552
+ clientErrorCode: _config2.AUTHENTICATION_FAILED_CODE,
553
+ serviceErrorCode: serviceErrorCode,
554
+ payloadOverrides: rawError.payloadOverrides,
555
+ rawErrorMessage: rawErrorMessage,
556
+ httpStatusCode: httpStatusCode
557
+ });
558
+ }
559
+
560
+ // otherwise return unkown error
561
+ return this.getErrorPayloadForClientErrorCode({
562
+ clientErrorCode: _config2.UNKNOWN_ERROR,
563
+ serviceErrorCode: _config2.UNKNOWN_ERROR,
564
+ rawErrorMessage: rawErrorMessage,
565
+ httpStatusCode: httpStatusCode
566
+ });
567
+ }
568
+
569
+ /**
570
+ * Create client event object for in meeting events
571
+ * @param arg - create args
572
+ * @param arg.event - event key
573
+ * @param arg.options - options
574
+ * @returns object
575
+ */
576
+ }, {
577
+ key: "createClientEventObjectInMeeting",
578
+ value: function createClientEventObjectInMeeting(_ref4) {
579
+ var name = _ref4.name,
580
+ options = _ref4.options,
581
+ errors = _ref4.errors;
582
+ var meetingId = options.meetingId,
583
+ mediaConnections = options.mediaConnections,
584
+ globalMeetingId = options.globalMeetingId,
585
+ webexConferenceIdStr = options.webexConferenceIdStr;
586
+
587
+ // @ts-ignore
588
+ var meeting = this.webex.meetings.meetingCollection.get(meetingId);
589
+ if (!meeting) {
590
+ console.warn('Attempt to send client event but no meeting was found...', "name: ".concat(name, ", meetingId: ").concat(meetingId));
591
+ // @ts-ignore
592
+ this.webex.internal.metrics.submitClientMetrics(_config2.CALL_DIAGNOSTIC_EVENT_FAILED_TO_SEND, {
593
+ fields: {
594
+ meetingId: meetingId,
595
+ name: name
596
+ }
597
+ });
598
+ return undefined;
599
+ }
600
+
601
+ // grab identifiers
602
+ var identifiers = this.getIdentifiers({
603
+ meeting: meeting,
604
+ mediaConnections: (meeting === null || meeting === void 0 ? void 0 : meeting.mediaConnections) || mediaConnections,
605
+ webexConferenceIdStr: webexConferenceIdStr,
606
+ globalMeetingId: globalMeetingId
607
+ });
608
+
609
+ // create client event object
610
+ var clientEventObject = {
611
+ name: name,
612
+ canProceed: true,
613
+ identifiers: identifiers,
614
+ errors: errors,
615
+ eventData: {
616
+ webClientDomain: window.location.hostname
617
+ },
618
+ userType: meeting.getCurUserType(),
619
+ loginType: 'loginType' in meeting.callStateForMetrics ? meeting.callStateForMetrics.loginType : this.getCurLoginType(),
620
+ isConvergedArchitectureEnabled: this.getIsConvergedArchitectureEnabled({
621
+ meetingId: meetingId
622
+ }),
623
+ webexSubServiceType: this.getSubServiceType(meeting)
624
+ };
625
+ return clientEventObject;
626
+ }
627
+
628
+ /**
629
+ * Create client event object for pre meeting events
630
+ * @param arg - create args
631
+ * @param arg.event - event key
632
+ * @param arg.options - payload
633
+ * @returns object
634
+ */
635
+ }, {
636
+ key: "createClientEventObjectPreMeeting",
637
+ value: function createClientEventObjectPreMeeting(_ref5) {
638
+ var name = _ref5.name,
639
+ options = _ref5.options,
640
+ errors = _ref5.errors;
641
+ var correlationId = options.correlationId,
642
+ globalMeetingId = options.globalMeetingId,
643
+ webexConferenceIdStr = options.webexConferenceIdStr,
644
+ preLoginId = options.preLoginId;
645
+
646
+ // grab identifiers
647
+ var identifiers = this.getIdentifiers({
648
+ correlationId: correlationId,
649
+ preLoginId: preLoginId,
650
+ globalMeetingId: globalMeetingId,
651
+ webexConferenceIdStr: webexConferenceIdStr
652
+ });
653
+
654
+ // create client event object
655
+ var clientEventObject = {
656
+ name: name,
657
+ errors: errors,
658
+ canProceed: true,
659
+ identifiers: identifiers,
660
+ eventData: {
661
+ webClientDomain: window.location.hostname
662
+ },
663
+ loginType: this.getCurLoginType()
664
+ };
665
+ return clientEventObject;
666
+ }
667
+
668
+ /**
669
+ * Prepare Client Event CA event.
670
+ * @param arg - submit params
671
+ * @param arg.event - event key
672
+ * @param arg.payload - additional payload to be merged with default payload
673
+ * @param arg.options - payload
674
+ * @returns {any} options to be with fetch
675
+ * @throws
676
+ */
677
+ }, {
678
+ key: "prepareClientEvent",
679
+ value: function prepareClientEvent(_ref6) {
680
+ var name = _ref6.name,
681
+ payload = _ref6.payload,
682
+ options = _ref6.options;
683
+ var meetingId = options.meetingId,
684
+ correlationId = options.correlationId,
685
+ rawError = options.rawError;
686
+ var clientEventObject;
687
+
688
+ // check if we need to generate errors
689
+ var errors = [];
690
+ if (rawError) {
691
+ var generatedError = this.generateClientEventErrorPayload(rawError);
692
+ if (generatedError) {
693
+ errors.push(generatedError);
694
+ }
695
+ this.logger.log(_config2.CALL_DIAGNOSTIC_LOG_IDENTIFIER, 'CallDiagnosticMetrics: @prepareClientEvent. Generated errors:', "generatedError: ".concat((0, _stringify.default)(generatedError)));
696
+ }
697
+
698
+ // events that will most likely happen in join phase
699
+ if (meetingId) {
700
+ clientEventObject = this.createClientEventObjectInMeeting({
701
+ name: name,
702
+ options: options,
703
+ errors: errors
704
+ });
705
+ } else if (correlationId) {
706
+ // any pre join events or events that are outside the meeting.
707
+ clientEventObject = this.createClientEventObjectPreMeeting({
708
+ name: name,
709
+ options: options,
710
+ errors: errors
711
+ });
712
+ } else {
713
+ throw new Error('Not implemented');
714
+ }
715
+
716
+ // merge any new properties, or override existing ones
717
+ clientEventObject = (0, _merge2.default)(clientEventObject, payload);
718
+
719
+ // append client event data to the call diagnostic event
720
+ var diagnosticEvent = this.prepareDiagnosticEvent(clientEventObject, options);
721
+ return diagnosticEvent;
722
+ }
723
+
724
+ /**
725
+ * Submit Client Event CA event.
726
+ * @param arg - submit params
727
+ * @param arg.event - event key
728
+ * @param arg.payload - additional payload to be merged with default payload
729
+ * @param arg.options - payload
730
+ * @throws
731
+ */
732
+ }, {
733
+ key: "submitClientEvent",
734
+ value: function submitClientEvent(_ref7) {
735
+ var name = _ref7.name,
736
+ payload = _ref7.payload,
737
+ options = _ref7.options;
738
+ this.logger.log(_config2.CALL_DIAGNOSTIC_LOG_IDENTIFIER, 'CallDiagnosticMetrics: @submitClientEvent. Submit Client Event CA event.', "name: ".concat(name));
739
+ var diagnosticEvent = this.prepareClientEvent({
740
+ name: name,
741
+ payload: payload,
742
+ options: options
743
+ });
744
+ if (options !== null && options !== void 0 && options.preLoginId) {
745
+ return this.submitToCallDiagnosticsPreLogin(diagnosticEvent, options === null || options === void 0 ? void 0 : options.preLoginId);
746
+ }
747
+ this.validator({
748
+ type: 'ce',
749
+ event: diagnosticEvent
750
+ });
751
+ return this.submitToCallDiagnostics(diagnosticEvent);
752
+ }
753
+
754
+ /**
755
+ * Prepare the event and send the request to metrics-a service.
756
+ * @param event
757
+ * @returns promise
758
+ */
759
+ }, {
760
+ key: "submitToCallDiagnostics",
761
+ value: function submitToCallDiagnostics(event) {
762
+ // build metrics-a event type
763
+ var finalEvent = {
764
+ eventPayload: event,
765
+ type: ['diagnostic-event']
766
+ };
767
+ return this.callDiagnosticEventsBatcher.request(finalEvent);
768
+ }
769
+
770
+ /**
771
+ * Prepare the event and send the request to metrics-a service, pre login.
772
+ * @param event
773
+ * @param preLoginId
774
+ * @returns
775
+ */
776
+ }, {
777
+ key: "buildClientEventFetchRequestOptions",
778
+ value:
779
+ /**
780
+ * Builds a request options object to later be passed to fetch().
781
+ * @param arg - submit params
782
+ * @param arg.event - event key
783
+ * @param arg.payload - additional payload to be merged with default payload
784
+ * @param arg.options - client event options
785
+ * @returns {Promise<any>}
786
+ * @throws
787
+ */
788
+ function () {
789
+ var _buildClientEventFetchRequestOptions = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee(_ref8) {
790
+ var name, payload, options, clientEvent, diagnosticEvent, request;
791
+ return _regenerator.default.wrap(function _callee$(_context) {
792
+ while (1) switch (_context.prev = _context.next) {
793
+ case 0:
794
+ name = _ref8.name, payload = _ref8.payload, options = _ref8.options;
795
+ this.logger.log(_config2.CALL_DIAGNOSTIC_LOG_IDENTIFIER, 'CallDiagnosticMetrics: @buildClientEventFetchRequestOptions. Building request options object for fetch()...', "name: ".concat(name));
796
+ clientEvent = this.prepareClientEvent({
797
+ name: name,
798
+ payload: payload,
799
+ options: options
800
+ }); // build metrics-a event type
801
+ // @ts-ignore
802
+ diagnosticEvent = (0, _callDiagnosticMetrics.prepareDiagnosticMetricItem)(this.webex, {
803
+ eventPayload: clientEvent,
804
+ type: ['diagnostic-event']
805
+ });
806
+ request = {
807
+ method: 'POST',
808
+ service: 'metrics',
809
+ resource: 'clientmetrics',
810
+ body: {
811
+ metrics: [diagnosticEvent]
812
+ },
813
+ headers: {},
814
+ // @ts-ignore
815
+ waitForServiceTimeout: this.webex.internal.metrics.config.waitForServiceTimeout
816
+ };
817
+ if (options.preLoginId) {
818
+ request.headers = {
819
+ authorization: false,
820
+ 'x-prelogin-userid': options.preLoginId
821
+ };
822
+ request.resource = 'clientmetrics-prelogin';
823
+ }
824
+
825
+ // @ts-ignore
826
+ return _context.abrupt("return", this.webex.prepareFetchOptions(request));
827
+ case 7:
828
+ case "end":
829
+ return _context.stop();
830
+ }
831
+ }, _callee, this);
832
+ }));
833
+ function buildClientEventFetchRequestOptions(_x) {
834
+ return _buildClientEventFetchRequestOptions.apply(this, arguments);
835
+ }
836
+ return buildClientEventFetchRequestOptions;
837
+ }()
838
+ /**
839
+ * Returns true if the specified serviceErrorCode maps to an expected error.
840
+ * @param {number} serviceErrorCode the service error code
841
+ * @returns {boolean}
842
+ */
843
+ }, {
844
+ key: "isServiceErrorExpected",
845
+ value: function isServiceErrorExpected(serviceErrorCode) {
846
+ var clientErrorCode = _config2.SERVICE_ERROR_CODES_TO_CLIENT_ERROR_CODES_MAP[serviceErrorCode];
847
+ var clientErrorPayload = _config2.CLIENT_ERROR_CODE_TO_ERROR_PAYLOAD[clientErrorCode];
848
+ return (clientErrorPayload === null || clientErrorPayload === void 0 ? void 0 : clientErrorPayload.category) === 'expected';
849
+ }
850
+ }]);
851
+ return CallDiagnosticMetrics;
852
+ }(_webexCore.StatelessWebexPlugin);
853
+ exports.default = CallDiagnosticMetrics;
854
+ //# sourceMappingURL=call-diagnostic-metrics.js.map