@webex/internal-plugin-metrics 3.0.0-beta.18 → 3.0.0-beta.180

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 (67) hide show
  1. package/dist/call-diagnostic/call-diagnostic-metrics-batcher.js +134 -0
  2. package/dist/call-diagnostic/call-diagnostic-metrics-batcher.js.map +1 -0
  3. package/dist/call-diagnostic/call-diagnostic-metrics-latencies.js +451 -0
  4. package/dist/call-diagnostic/call-diagnostic-metrics-latencies.js.map +1 -0
  5. package/dist/call-diagnostic/call-diagnostic-metrics.js +511 -0
  6. package/dist/call-diagnostic/call-diagnostic-metrics.js.map +1 -0
  7. package/dist/call-diagnostic/call-diagnostic-metrics.util.js +106 -0
  8. package/dist/call-diagnostic/call-diagnostic-metrics.util.js.map +1 -0
  9. package/dist/call-diagnostic/config.js +461 -0
  10. package/dist/call-diagnostic/config.js.map +1 -0
  11. package/dist/call-diagnostic/generated-types-temp/ClientEvent.js +7 -0
  12. package/dist/call-diagnostic/generated-types-temp/ClientEvent.js.map +1 -0
  13. package/dist/call-diagnostic/generated-types-temp/Event.js +7 -0
  14. package/dist/call-diagnostic/generated-types-temp/Event.js.map +1 -0
  15. package/dist/call-diagnostic/generated-types-temp/MediaQualityEvent.js +7 -0
  16. package/dist/call-diagnostic/generated-types-temp/MediaQualityEvent.js.map +1 -0
  17. package/dist/config.js +20 -1
  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 +30 -30
  22. package/dist/metrics.js.map +1 -1
  23. package/dist/metrics.types.js +7 -0
  24. package/dist/metrics.types.js.map +1 -0
  25. package/dist/new-metrics.js +185 -0
  26. package/dist/new-metrics.js.map +1 -0
  27. package/dist/types/batcher.d.ts +2 -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 +189 -0
  30. package/dist/types/call-diagnostic/call-diagnostic-metrics.d.ts +324 -0
  31. package/dist/types/call-diagnostic/call-diagnostic-metrics.util.d.ts +31 -0
  32. package/dist/types/call-diagnostic/config.d.ts +57 -0
  33. package/dist/types/call-diagnostic/generated-types-temp/ClientEvent.d.ts +1112 -0
  34. package/dist/types/call-diagnostic/generated-types-temp/Event.d.ts +4851 -0
  35. package/dist/types/call-diagnostic/generated-types-temp/MediaQualityEvent.d.ts +2121 -0
  36. package/dist/types/client-metrics-batcher.d.ts +2 -0
  37. package/dist/types/config.d.ts +35 -0
  38. package/dist/types/index.d.ts +11 -0
  39. package/dist/types/metrics.d.ts +3 -0
  40. package/dist/types/metrics.types.d.ts +87 -0
  41. package/dist/types/new-metrics.d.ts +83 -0
  42. package/package.json +12 -8
  43. package/src/call-diagnostic/call-diagnostic-metrics-batcher.ts +148 -0
  44. package/src/call-diagnostic/call-diagnostic-metrics-latencies.ts +408 -0
  45. package/src/call-diagnostic/call-diagnostic-metrics.ts +528 -0
  46. package/src/call-diagnostic/call-diagnostic-metrics.util.ts +102 -0
  47. package/src/call-diagnostic/config.ts +455 -0
  48. package/src/call-diagnostic/generated-types-temp/ClientEvent.ts +2357 -0
  49. package/src/call-diagnostic/generated-types-temp/Event.ts +7669 -0
  50. package/src/call-diagnostic/generated-types-temp/MediaQualityEvent.ts +2321 -0
  51. package/src/config.js +19 -0
  52. package/src/index.ts +39 -0
  53. package/src/metrics.js +25 -27
  54. package/src/metrics.types.ts +131 -0
  55. package/src/new-metrics.ts +170 -0
  56. package/test/unit/spec/call-diagnostic/call-diagnostic-metrics-batcher.ts +243 -0
  57. package/test/unit/spec/call-diagnostic/call-diagnostic-metrics-latencies.ts +474 -0
  58. package/test/unit/spec/call-diagnostic/call-diagnostic-metrics.ts +722 -0
  59. package/test/unit/spec/call-diagnostic/call-diagnostic-metrics.util.ts +76 -0
  60. package/test/unit/spec/metrics.js +65 -97
  61. package/test/unit/spec/new-metrics.ts +91 -0
  62. package/tsconfig.json +6 -0
  63. package/dist/call-diagnostic-events-batcher.js +0 -60
  64. package/dist/call-diagnostic-events-batcher.js.map +0 -1
  65. package/src/call-diagnostic-events-batcher.js +0 -62
  66. package/src/index.js +0 -17
  67. package/test/unit/spec/call-diagnostic-events-batcher.js +0 -195
@@ -0,0 +1,511 @@
1
+ "use strict";
2
+
3
+ var _Reflect$construct = require("@babel/runtime-corejs2/core-js/reflect/construct");
4
+ var _Object$defineProperty = require("@babel/runtime-corejs2/core-js/object/define-property");
5
+ var _interopRequireDefault = require("@babel/runtime-corejs2/helpers/interopRequireDefault");
6
+ _Object$defineProperty(exports, "__esModule", {
7
+ value: true
8
+ });
9
+ exports.default = void 0;
10
+ var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime-corejs2/helpers/classCallCheck"));
11
+ var _createClass2 = _interopRequireDefault(require("@babel/runtime-corejs2/helpers/createClass"));
12
+ var _assertThisInitialized2 = _interopRequireDefault(require("@babel/runtime-corejs2/helpers/assertThisInitialized"));
13
+ var _inherits2 = _interopRequireDefault(require("@babel/runtime-corejs2/helpers/inherits"));
14
+ var _possibleConstructorReturn2 = _interopRequireDefault(require("@babel/runtime-corejs2/helpers/possibleConstructorReturn"));
15
+ var _getPrototypeOf2 = _interopRequireDefault(require("@babel/runtime-corejs2/helpers/getPrototypeOf"));
16
+ var _defineProperty2 = _interopRequireDefault(require("@babel/runtime-corejs2/helpers/defineProperty"));
17
+ var _merge2 = _interopRequireDefault(require("lodash/merge"));
18
+ var _internalPluginMetrics = require("@webex/internal-plugin-metrics");
19
+ var _common = require("@webex/common");
20
+ var _uuid = _interopRequireDefault(require("uuid"));
21
+ var _webexCore = require("@webex/webex-core");
22
+ var _callDiagnosticMetrics = require("./call-diagnostic-metrics.util");
23
+ var _config = require("../config");
24
+ var _callDiagnosticMetricsBatcher = _interopRequireDefault(require("./call-diagnostic-metrics-batcher"));
25
+ var _config2 = require("./config");
26
+ 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); }; }
27
+ 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; } }
28
+ var _BrowserDetection = (0, _common.BrowserDetection)(),
29
+ getOSVersion = _BrowserDetection.getOSVersion,
30
+ getBrowserName = _BrowserDetection.getBrowserName,
31
+ getBrowserVersion = _BrowserDetection.getBrowserVersion;
32
+ /**
33
+ * @description Util class to handle Call Analyzer Metrics
34
+ * @export
35
+ * @class CallDiagnosticMetrics
36
+ */
37
+ var CallDiagnosticMetrics = /*#__PURE__*/function (_StatelessWebexPlugin) {
38
+ (0, _inherits2.default)(CallDiagnosticMetrics, _StatelessWebexPlugin);
39
+ var _super = _createSuper(CallDiagnosticMetrics);
40
+ // @ts-ignore
41
+
42
+ /**
43
+ * Constructor
44
+ * @param args
45
+ */
46
+ function CallDiagnosticMetrics() {
47
+ var _this;
48
+ (0, _classCallCheck2.default)(this, CallDiagnosticMetrics);
49
+ for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
50
+ args[_key] = arguments[_key];
51
+ }
52
+ _this = _super.call.apply(_super, [this].concat(args));
53
+ // @ts-ignore
54
+ (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "callDiagnosticEventsBatcher", void 0);
55
+ _this.callDiagnosticEventsBatcher = new _callDiagnosticMetricsBatcher.default({}, {
56
+ parent: _this.webex
57
+ });
58
+ return _this;
59
+ }
60
+
61
+ /**
62
+ * Returns the login type of the current user
63
+ * @returns one of 'login-ci','unverified-guest', null
64
+ */
65
+ (0, _createClass2.default)(CallDiagnosticMetrics, [{
66
+ key: "getCurLoginType",
67
+ value: function getCurLoginType() {
68
+ // @ts-ignore
69
+ if (this.webex.canAuthorize) {
70
+ // @ts-ignore
71
+ return this.webex.credentials.isUnverifiedGuest ? 'unverified-guest' : 'login-ci';
72
+ }
73
+ return null;
74
+ }
75
+
76
+ /**
77
+ * Get origin object for Call Diagnostic Event payload.
78
+ * @param options
79
+ * @param meetingId
80
+ * @returns
81
+ */
82
+ }, {
83
+ key: "getOrigin",
84
+ value: function getOrigin(options, meetingId) {
85
+ var _this$webex$meetings$, _this$webex$meetings$2, _this$webex$meetings$3, _this$webex$meetings$4;
86
+ var defaultClientType = // @ts-ignore
87
+ (_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;
88
+ var defaultSubClientType = // @ts-ignore
89
+ (_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;
90
+ if (defaultClientType && defaultSubClientType || options.clientType && options.subClientType) {
91
+ var _this$webex$meetings, _this$webex$meetings$5, _this$webex$meetings$6;
92
+ var origin = {
93
+ name: 'endpoint',
94
+ networkType: (options === null || options === void 0 ? void 0 : options.networkType) || 'unknown',
95
+ userAgent: (0, _callDiagnosticMetrics.userAgentToString)({
96
+ // @ts-ignore
97
+ clientName: (_this$webex$meetings = this.webex.meetings) === null || _this$webex$meetings === void 0 ? void 0 : (_this$webex$meetings$5 = _this$webex$meetings.metrics) === null || _this$webex$meetings$5 === void 0 ? void 0 : _this$webex$meetings$5.clientName,
98
+ // @ts-ignore
99
+ webexVersion: this.webex.version
100
+ }),
101
+ clientInfo: {
102
+ clientType: (options === null || options === void 0 ? void 0 : options.clientType) || defaultClientType,
103
+ // @ts-ignore
104
+ clientVersion: "".concat(_config.CLIENT_NAME, "/").concat(this.webex.version),
105
+ localNetworkPrefix:
106
+ // @ts-ignore
107
+ (0, _callDiagnosticMetrics.anonymizeIPAddress)((_this$webex$meetings$6 = this.webex.meetings.geoHintInfo) === null || _this$webex$meetings$6 === void 0 ? void 0 : _this$webex$meetings$6.clientAddress) || undefined,
108
+ osVersion: getOSVersion() || 'unknown',
109
+ subClientType: (options === null || options === void 0 ? void 0 : options.subClientType) || defaultSubClientType,
110
+ os: (0, _internalPluginMetrics.getOSNameInternal)(),
111
+ browser: getBrowserName(),
112
+ browserVersion: getBrowserVersion()
113
+ }
114
+ };
115
+ if (meetingId) {
116
+ // @ts-ignore
117
+ var meeting = this.webex.meetings.meetingCollection.get(meetingId);
118
+ if (meeting !== null && meeting !== void 0 && meeting.environment) {
119
+ origin.environment = meeting.environment;
120
+ }
121
+ }
122
+ return origin;
123
+ }
124
+ throw new Error("ClientType and SubClientType can't be undefined");
125
+ }
126
+
127
+ /**
128
+ * Gather identifier details for call diagnostic payload.
129
+ * @throws Error if initialization fails.
130
+ * @param options
131
+ */
132
+ }, {
133
+ key: "getIdentifiers",
134
+ value: function getIdentifiers(options) {
135
+ var _meeting$locusInfo;
136
+ var meeting = options.meeting,
137
+ mediaConnections = options.mediaConnections,
138
+ correlationId = options.correlationId;
139
+ var identifiers = {
140
+ correlationId: 'unknown'
141
+ };
142
+ if (meeting) {
143
+ identifiers.correlationId = meeting.correlationId;
144
+ }
145
+ if (correlationId) {
146
+ identifiers.correlationId = correlationId;
147
+ }
148
+ // @ts-ignore
149
+ if (this.webex.internal) {
150
+ // @ts-ignore
151
+ var device = this.webex.internal.device;
152
+ identifiers.userId = device.userId;
153
+ identifiers.deviceId = device.url;
154
+ identifiers.orgId = device.orgId;
155
+ // @ts-ignore
156
+ identifiers.locusUrl = this.webex.internal.services.get('locus');
157
+ }
158
+ if (meeting !== null && meeting !== void 0 && (_meeting$locusInfo = meeting.locusInfo) !== null && _meeting$locusInfo !== void 0 && _meeting$locusInfo.fullState) {
159
+ identifiers.locusUrl = meeting.locusUrl;
160
+ identifiers.locusId = meeting.locusUrl && meeting.locusUrl.split('/').pop();
161
+ identifiers.locusStartTime = meeting.locusInfo.fullState && meeting.locusInfo.fullState.lastActive;
162
+ }
163
+ if (mediaConnections) {
164
+ var _mediaConnections$, _mediaConnections$2;
165
+ identifiers.mediaAgentAlias = mediaConnections === null || mediaConnections === void 0 ? void 0 : (_mediaConnections$ = mediaConnections[0]) === null || _mediaConnections$ === void 0 ? void 0 : _mediaConnections$.mediaAgentAlias;
166
+ identifiers.mediaAgentGroupId = mediaConnections === null || mediaConnections === void 0 ? void 0 : (_mediaConnections$2 = mediaConnections[0]) === null || _mediaConnections$2 === void 0 ? void 0 : _mediaConnections$2.mediaAgentGroupId;
167
+ }
168
+ if (identifiers.correlationId === undefined) {
169
+ throw new Error('Identifiers initialization failed.');
170
+ }
171
+ return identifiers;
172
+ }
173
+
174
+ /**
175
+ * Create diagnostic event, which can hold client event, feature event or MQE event data.
176
+ * This just initiates the shared properties that are required for all the 3 event categories.
177
+ * @param eventData
178
+ * @param options
179
+ * @returns
180
+ */
181
+ }, {
182
+ key: "prepareDiagnosticEvent",
183
+ value: function prepareDiagnosticEvent(eventData, options) {
184
+ var _this$webex$meetings$7;
185
+ var meetingId = options.meetingId;
186
+ var origin = this.getOrigin(options, meetingId);
187
+ var event = {
188
+ eventId: _uuid.default.v4(),
189
+ version: 1,
190
+ origin: origin,
191
+ originTime: {
192
+ triggered: new Date().toISOString(),
193
+ // is overridden in prepareRequest batcher
194
+ sent: 'not_defined_yet'
195
+ },
196
+ // @ts-ignore
197
+ senderCountryCode: (_this$webex$meetings$7 = this.webex.meetings.geoHintInfo) === null || _this$webex$meetings$7 === void 0 ? void 0 : _this$webex$meetings$7.countryCode,
198
+ event: eventData
199
+ };
200
+
201
+ // sanitize (remove empty properties, CA requires it)
202
+ // but we don't want to sanitize MQE as most of the times
203
+ // values will be 0, [] etc, and they are required.
204
+ if (eventData.name !== 'client.mediaquality.event') {
205
+ (0, _callDiagnosticMetrics.clearEmptyKeysRecursively)(event);
206
+ }
207
+ return event;
208
+ }
209
+
210
+ /**
211
+ * TODO: NOT IMPLEMENTED
212
+ * Submit Feature Event
213
+ * @returns
214
+ */
215
+ }, {
216
+ key: "submitFeatureEvent",
217
+ value: function submitFeatureEvent() {
218
+ throw Error('Not implemented');
219
+ }
220
+
221
+ /**
222
+ * Submit Media Quality Event
223
+ * @param args - submit params
224
+ * @param arg.name - event key
225
+ * @param arg.payload - additional payload to be merge with the default payload
226
+ * @param arg.options - options
227
+ */
228
+ }, {
229
+ key: "submitMQE",
230
+ value: function submitMQE(_ref) {
231
+ var name = _ref.name,
232
+ payload = _ref.payload,
233
+ options = _ref.options;
234
+ var meetingId = options.meetingId,
235
+ mediaConnections = options.mediaConnections;
236
+
237
+ // events that will most likely happen in join phase
238
+ if (meetingId) {
239
+ // @ts-ignore
240
+ var meeting = this.webex.meetings.meetingCollection.get(meetingId);
241
+ if (!meeting) {
242
+ console.warn('Attempt to send MQE but no meeting was found...', "event: ".concat(name, ", meetingId: ").concat(meetingId));
243
+ // @ts-ignore
244
+ this.webex.internal.metrics.submitClientMetrics(_config2.CALL_DIAGNOSTIC_EVENT_FAILED_TO_SEND, {
245
+ fields: {
246
+ meetingId: meetingId,
247
+ name: name
248
+ }
249
+ });
250
+ return;
251
+ }
252
+
253
+ // merge identifiers
254
+ var identifiers = this.getIdentifiers({
255
+ meeting: meeting,
256
+ mediaConnections: meeting.mediaConnections || mediaConnections
257
+ });
258
+
259
+ // create media quality event object
260
+ var clientEventObject = {
261
+ name: name,
262
+ canProceed: true,
263
+ identifiers: identifiers,
264
+ eventData: {
265
+ webClientDomain: window.location.hostname
266
+ },
267
+ intervals: payload.intervals,
268
+ sourceMetadata: {
269
+ applicationSoftwareType: _config.CLIENT_NAME,
270
+ // @ts-ignore
271
+ applicationSoftwareVersion: this.webex.version,
272
+ mediaEngineSoftwareType: getBrowserName() || 'browser',
273
+ mediaEngineSoftwareVersion: getOSVersion() || 'unknown',
274
+ startTime: new Date().toISOString()
275
+ }
276
+ };
277
+
278
+ // merge any new properties, or override existing ones
279
+ clientEventObject = (0, _merge2.default)(clientEventObject, payload);
280
+
281
+ // append media quality event data to the call diagnostic event
282
+ var diagnosticEvent = this.prepareDiagnosticEvent(clientEventObject, options);
283
+ this.submitToCallDiagnostics(diagnosticEvent);
284
+ } else {
285
+ throw new Error('Media quality events cant be sent outside the context of a meeting. Meeting id is required.');
286
+ }
287
+ }
288
+
289
+ /**
290
+ * Return Client Event payload by client error code
291
+ * @param arg - get error arg
292
+ * @param arg.clientErrorCode
293
+ * @param arg.serviceErrorCode
294
+ * @returns
295
+ */
296
+ }, {
297
+ key: "getErrorPayloadForClientErrorCode",
298
+ value: function getErrorPayloadForClientErrorCode(_ref2) {
299
+ var clientErrorCode = _ref2.clientErrorCode,
300
+ serviceErrorCode = _ref2.serviceErrorCode;
301
+ var error;
302
+ if (clientErrorCode) {
303
+ var partialParsedError = _config2.CLIENT_ERROR_CODE_TO_ERROR_PAYLOAD[clientErrorCode];
304
+ if (partialParsedError) {
305
+ error = (0, _merge2.default)({
306
+ fatal: true,
307
+ shownToUser: false,
308
+ name: 'other',
309
+ category: 'other'
310
+ },
311
+ // default values
312
+ {
313
+ errorCode: clientErrorCode
314
+ }, {
315
+ serviceErrorCode: serviceErrorCode
316
+ }, partialParsedError);
317
+ return error;
318
+ }
319
+ }
320
+ return undefined;
321
+ }
322
+
323
+ /**
324
+ * Generate error payload for Client Event
325
+ * @param rawError
326
+ */
327
+ }, {
328
+ key: "generateClientEventErrorPayload",
329
+ value: function generateClientEventErrorPayload(rawError) {
330
+ var _rawError$body, _rawError$body2;
331
+ var serviceErrorCode = (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);
332
+ if (serviceErrorCode) {
333
+ var clientErrorCode = _config2.SERVICE_ERROR_CODES_TO_CLIENT_ERROR_CODES_MAP[serviceErrorCode];
334
+ if (clientErrorCode) {
335
+ return this.getErrorPayloadForClientErrorCode({
336
+ clientErrorCode: clientErrorCode,
337
+ serviceErrorCode: serviceErrorCode
338
+ });
339
+ }
340
+
341
+ // by default, if it is locus error, return nre locus err
342
+ if ((0, _callDiagnosticMetrics.isLocusServiceErrorCode)(serviceErrorCode)) {
343
+ return this.getErrorPayloadForClientErrorCode({
344
+ clientErrorCode: _config2.NEW_LOCUS_ERROR_CLIENT_CODE,
345
+ serviceErrorCode: serviceErrorCode
346
+ });
347
+ }
348
+
349
+ // otherwise return meeting info
350
+ return this.getErrorPayloadForClientErrorCode({
351
+ clientErrorCode: _config2.MEETING_INFO_LOOKUP_ERROR_CLIENT_CODE,
352
+ serviceErrorCode: serviceErrorCode
353
+ });
354
+ }
355
+ return undefined;
356
+ }
357
+
358
+ /**
359
+ * Create client event object for in meeting events
360
+ * @param arg - create args
361
+ * @param arg.event - event key
362
+ * @param arg.options - options
363
+ * @returns object
364
+ */
365
+ }, {
366
+ key: "createClientEventObjectInMeeting",
367
+ value: function createClientEventObjectInMeeting(_ref3) {
368
+ var name = _ref3.name,
369
+ options = _ref3.options;
370
+ var meetingId = options.meetingId,
371
+ mediaConnections = options.mediaConnections,
372
+ rawError = options.rawError;
373
+
374
+ // @ts-ignore
375
+ var meeting = this.webex.meetings.meetingCollection.get(meetingId);
376
+ if (!meeting) {
377
+ console.warn('Attempt to send client event 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 undefined;
386
+ }
387
+
388
+ // grab identifiers
389
+ var identifiers = this.getIdentifiers({
390
+ meeting: meeting,
391
+ mediaConnections: (meeting === null || meeting === void 0 ? void 0 : meeting.mediaConnections) || mediaConnections
392
+ });
393
+
394
+ // check if we need to generate errors
395
+ var errors = [];
396
+ if (rawError) {
397
+ var generatedError = this.generateClientEventErrorPayload(rawError);
398
+ if (generatedError) {
399
+ errors.push(generatedError);
400
+ }
401
+ }
402
+
403
+ // create client event object
404
+ var clientEventObject = {
405
+ name: name,
406
+ canProceed: true,
407
+ identifiers: identifiers,
408
+ errors: errors,
409
+ eventData: {
410
+ webClientDomain: window.location.hostname
411
+ },
412
+ userType: meeting.getCurUserType(),
413
+ loginType: this.getCurLoginType()
414
+ };
415
+ return clientEventObject;
416
+ }
417
+
418
+ /**
419
+ * Create client event object for pre meeting events
420
+ * @param arg - create args
421
+ * @param arg.event - event key
422
+ * @param arg.options - payload
423
+ * @returns object
424
+ */
425
+ }, {
426
+ key: "createClientEventObjectPreMeeting",
427
+ value: function createClientEventObjectPreMeeting(_ref4) {
428
+ var name = _ref4.name,
429
+ options = _ref4.options;
430
+ var correlationId = options.correlationId;
431
+
432
+ // grab identifiers
433
+ var identifiers = this.getIdentifiers({
434
+ correlationId: correlationId
435
+ });
436
+
437
+ // create client event object
438
+ var clientEventObject = {
439
+ name: name,
440
+ canProceed: true,
441
+ identifiers: identifiers,
442
+ eventData: {
443
+ webClientDomain: window.location.hostname
444
+ },
445
+ loginType: this.getCurLoginType()
446
+ };
447
+ return clientEventObject;
448
+ }
449
+
450
+ /**
451
+ * Submit Client Event CA event.
452
+ * @param arg - submit params
453
+ * @param arg.event - event key
454
+ * @param arg.payload - additional payload to be merged with default payload
455
+ * @param arg.options - payload
456
+ * @throws
457
+ */
458
+ }, {
459
+ key: "submitClientEvent",
460
+ value: function submitClientEvent(_ref5) {
461
+ var name = _ref5.name,
462
+ payload = _ref5.payload,
463
+ options = _ref5.options;
464
+ var meetingId = options.meetingId,
465
+ correlationId = options.correlationId;
466
+ var clientEventObject;
467
+
468
+ // events that will most likely happen in join phase
469
+ if (meetingId) {
470
+ clientEventObject = this.createClientEventObjectInMeeting({
471
+ name: name,
472
+ options: options
473
+ });
474
+ } else if (correlationId) {
475
+ // any pre join events or events that are outside the meeting.
476
+ clientEventObject = this.createClientEventObjectPreMeeting({
477
+ name: name,
478
+ options: options
479
+ });
480
+ } else {
481
+ throw new Error('Not implemented');
482
+ }
483
+
484
+ // merge any new properties, or override existing ones
485
+ clientEventObject = (0, _merge2.default)(clientEventObject, payload);
486
+
487
+ // append client event data to the call diagnostic event
488
+ var diagnosticEvent = this.prepareDiagnosticEvent(clientEventObject, options);
489
+ this.submitToCallDiagnostics(diagnosticEvent);
490
+ }
491
+
492
+ /**
493
+ * Prepare the event and send the request to metrics-a service.
494
+ * @param event
495
+ * @returns promise
496
+ */
497
+ }, {
498
+ key: "submitToCallDiagnostics",
499
+ value: function submitToCallDiagnostics(event) {
500
+ // build metrics-a event type
501
+ var finalEvent = {
502
+ eventPayload: event,
503
+ type: ['diagnostic-event']
504
+ };
505
+ return this.callDiagnosticEventsBatcher.request(finalEvent);
506
+ }
507
+ }]);
508
+ return CallDiagnosticMetrics;
509
+ }(_webexCore.StatelessWebexPlugin);
510
+ exports.default = CallDiagnosticMetrics;
511
+ //# sourceMappingURL=call-diagnostic-metrics.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["BrowserDetection","getOSVersion","getBrowserName","getBrowserVersion","CallDiagnosticMetrics","args","callDiagnosticEventsBatcher","CallDiagnosticEventsBatcher","parent","webex","canAuthorize","credentials","isUnverifiedGuest","options","meetingId","defaultClientType","meetings","config","metrics","clientType","defaultSubClientType","subClientType","origin","name","networkType","userAgent","userAgentToString","clientName","webexVersion","version","clientInfo","clientVersion","CLIENT_NAME","localNetworkPrefix","anonymizeIPAddress","geoHintInfo","clientAddress","undefined","osVersion","os","getOSNameInternal","browser","browserVersion","meeting","meetingCollection","get","environment","Error","mediaConnections","correlationId","identifiers","internal","device","userId","deviceId","url","orgId","locusUrl","services","locusInfo","fullState","locusId","split","pop","locusStartTime","lastActive","mediaAgentAlias","mediaAgentGroupId","eventData","getOrigin","event","eventId","uuid","v4","originTime","triggered","Date","toISOString","sent","senderCountryCode","countryCode","clearEmptyKeysRecursively","payload","console","warn","submitClientMetrics","CALL_DIAGNOSTIC_EVENT_FAILED_TO_SEND","fields","getIdentifiers","clientEventObject","canProceed","webClientDomain","window","location","hostname","intervals","sourceMetadata","applicationSoftwareType","applicationSoftwareVersion","mediaEngineSoftwareType","mediaEngineSoftwareVersion","startTime","diagnosticEvent","prepareDiagnosticEvent","submitToCallDiagnostics","clientErrorCode","serviceErrorCode","error","partialParsedError","CLIENT_ERROR_CODE_TO_ERROR_PAYLOAD","fatal","shownToUser","category","errorCode","rawError","body","code","SERVICE_ERROR_CODES_TO_CLIENT_ERROR_CODES_MAP","getErrorPayloadForClientErrorCode","isLocusServiceErrorCode","NEW_LOCUS_ERROR_CLIENT_CODE","MEETING_INFO_LOOKUP_ERROR_CLIENT_CODE","errors","generatedError","generateClientEventErrorPayload","push","userType","getCurUserType","loginType","getCurLoginType","createClientEventObjectInMeeting","createClientEventObjectPreMeeting","finalEvent","eventPayload","type","request","StatelessWebexPlugin"],"sources":["call-diagnostic-metrics.ts"],"sourcesContent":["/* eslint-disable @typescript-eslint/no-unused-vars */\n/* eslint-disable class-methods-use-this */\n/* eslint-disable valid-jsdoc */\nimport {getOSNameInternal} from '@webex/internal-plugin-metrics';\nimport {BrowserDetection} from '@webex/common';\nimport uuid from 'uuid';\nimport {merge} from 'lodash';\nimport {StatelessWebexPlugin} from '@webex/webex-core';\n\nimport {\n anonymizeIPAddress,\n clearEmptyKeysRecursively,\n isLocusServiceErrorCode,\n userAgentToString,\n} from './call-diagnostic-metrics.util';\nimport {CLIENT_NAME} from '../config';\nimport {\n RecursivePartial,\n Event,\n ClientType,\n SubClientType,\n NetworkType,\n ClientEvent,\n SubmitClientEventOptions,\n MediaQualityEvent,\n SubmitMQEOptions,\n SubmitMQEPayload,\n ClientEventError,\n ClientEventPayload,\n} from '../metrics.types';\nimport CallDiagnosticEventsBatcher from './call-diagnostic-metrics-batcher';\nimport {\n CLIENT_ERROR_CODE_TO_ERROR_PAYLOAD,\n CALL_DIAGNOSTIC_EVENT_FAILED_TO_SEND,\n MEETING_INFO_LOOKUP_ERROR_CLIENT_CODE,\n NEW_LOCUS_ERROR_CLIENT_CODE,\n SERVICE_ERROR_CODES_TO_CLIENT_ERROR_CODES_MAP,\n} from './config';\n\nconst {getOSVersion, getBrowserName, getBrowserVersion} = BrowserDetection();\n\ntype GetOriginOptions = {\n clientType: ClientType;\n subClientType: SubClientType;\n networkType?: NetworkType;\n};\n\ntype GetIdentifiersOptions = {\n meeting?: any;\n mediaConnections?: any[];\n correlationId?: string;\n};\n\n/**\n * @description Util class to handle Call Analyzer Metrics\n * @export\n * @class CallDiagnosticMetrics\n */\nexport default class CallDiagnosticMetrics extends StatelessWebexPlugin {\n // @ts-ignore\n private callDiagnosticEventsBatcher: CallDiagnosticEventsBatcher;\n\n /**\n * Constructor\n * @param args\n */\n constructor(...args) {\n super(...args);\n // @ts-ignore\n this.callDiagnosticEventsBatcher = new CallDiagnosticEventsBatcher({}, {parent: this.webex});\n }\n\n /**\n * Returns the login type of the current user\n * @returns one of 'login-ci','unverified-guest', null\n */\n getCurLoginType() {\n // @ts-ignore\n if (this.webex.canAuthorize) {\n // @ts-ignore\n return this.webex.credentials.isUnverifiedGuest ? 'unverified-guest' : 'login-ci';\n }\n\n return null;\n }\n\n /**\n * Get origin object for Call Diagnostic Event payload.\n * @param options\n * @param meetingId\n * @returns\n */\n getOrigin(options: GetOriginOptions, meetingId?: string) {\n const defaultClientType: ClientType =\n // @ts-ignore\n this.webex.meetings.config?.metrics?.clientType;\n const defaultSubClientType: SubClientType =\n // @ts-ignore\n this.webex.meetings.config?.metrics?.subClientType;\n\n if (\n (defaultClientType && defaultSubClientType) ||\n (options.clientType && options.subClientType)\n ) {\n const origin: Event['origin'] = {\n name: 'endpoint',\n networkType: options?.networkType || 'unknown',\n userAgent: userAgentToString({\n // @ts-ignore\n clientName: this.webex.meetings?.metrics?.clientName,\n // @ts-ignore\n webexVersion: this.webex.version,\n }),\n clientInfo: {\n clientType: options?.clientType || defaultClientType,\n // @ts-ignore\n clientVersion: `${CLIENT_NAME}/${this.webex.version}`,\n localNetworkPrefix:\n // @ts-ignore\n anonymizeIPAddress(this.webex.meetings.geoHintInfo?.clientAddress) || undefined,\n osVersion: getOSVersion() || 'unknown',\n subClientType: options?.subClientType || defaultSubClientType,\n os: getOSNameInternal(),\n browser: getBrowserName(),\n browserVersion: getBrowserVersion(),\n },\n };\n\n if (meetingId) {\n // @ts-ignore\n const meeting = this.webex.meetings.meetingCollection.get(meetingId);\n if (meeting?.environment) {\n origin.environment = meeting.environment;\n }\n }\n\n return origin;\n }\n\n throw new Error(\"ClientType and SubClientType can't be undefined\");\n }\n\n /**\n * Gather identifier details for call diagnostic payload.\n * @throws Error if initialization fails.\n * @param options\n */\n getIdentifiers(options: GetIdentifiersOptions) {\n const {meeting, mediaConnections, correlationId} = options;\n const identifiers: Event['event']['identifiers'] = {correlationId: 'unknown'};\n\n if (meeting) {\n identifiers.correlationId = meeting.correlationId;\n }\n\n if (correlationId) {\n identifiers.correlationId = correlationId;\n }\n // @ts-ignore\n if (this.webex.internal) {\n // @ts-ignore\n const {device} = this.webex.internal;\n identifiers.userId = device.userId;\n identifiers.deviceId = device.url;\n identifiers.orgId = device.orgId;\n // @ts-ignore\n identifiers.locusUrl = this.webex.internal.services.get('locus');\n }\n\n if (meeting?.locusInfo?.fullState) {\n identifiers.locusUrl = meeting.locusUrl;\n identifiers.locusId = meeting.locusUrl && meeting.locusUrl.split('/').pop();\n identifiers.locusStartTime =\n meeting.locusInfo.fullState && meeting.locusInfo.fullState.lastActive;\n }\n\n if (mediaConnections) {\n identifiers.mediaAgentAlias = mediaConnections?.[0]?.mediaAgentAlias;\n identifiers.mediaAgentGroupId = mediaConnections?.[0]?.mediaAgentGroupId;\n }\n\n if (identifiers.correlationId === undefined) {\n throw new Error('Identifiers initialization failed.');\n }\n\n return identifiers;\n }\n\n /**\n * Create diagnostic event, which can hold client event, feature event or MQE event data.\n * This just initiates the shared properties that are required for all the 3 event categories.\n * @param eventData\n * @param options\n * @returns\n */\n prepareDiagnosticEvent(eventData: Event['event'], options: any) {\n const {meetingId} = options;\n const origin = this.getOrigin(options, meetingId);\n\n const event: Event = {\n eventId: uuid.v4(),\n version: 1,\n origin,\n originTime: {\n triggered: new Date().toISOString(),\n // is overridden in prepareRequest batcher\n sent: 'not_defined_yet',\n },\n // @ts-ignore\n senderCountryCode: this.webex.meetings.geoHintInfo?.countryCode,\n event: eventData,\n };\n\n // sanitize (remove empty properties, CA requires it)\n // but we don't want to sanitize MQE as most of the times\n // values will be 0, [] etc, and they are required.\n if (eventData.name !== 'client.mediaquality.event') {\n clearEmptyKeysRecursively(event);\n }\n\n return event;\n }\n\n /**\n * TODO: NOT IMPLEMENTED\n * Submit Feature Event\n * @returns\n */\n public submitFeatureEvent() {\n throw Error('Not implemented');\n }\n\n /**\n * Submit Media Quality Event\n * @param args - submit params\n * @param arg.name - event key\n * @param arg.payload - additional payload to be merge with the default payload\n * @param arg.options - options\n */\n submitMQE({\n name,\n payload,\n options,\n }: {\n name: MediaQualityEvent['name'];\n payload: SubmitMQEPayload;\n options: SubmitMQEOptions;\n }) {\n const {meetingId, mediaConnections} = options;\n\n // events that will most likely happen in join phase\n if (meetingId) {\n // @ts-ignore\n const meeting = this.webex.meetings.meetingCollection.get(meetingId);\n\n if (!meeting) {\n console.warn(\n 'Attempt to send MQE but no meeting was found...',\n `event: ${name}, meetingId: ${meetingId}`\n );\n // @ts-ignore\n this.webex.internal.metrics.submitClientMetrics(CALL_DIAGNOSTIC_EVENT_FAILED_TO_SEND, {\n fields: {\n meetingId,\n name,\n },\n });\n\n return;\n }\n\n // merge identifiers\n const identifiers = this.getIdentifiers({\n meeting,\n mediaConnections: meeting.mediaConnections || mediaConnections,\n });\n\n // create media quality event object\n let clientEventObject: MediaQualityEvent['payload'] = {\n name,\n canProceed: true,\n identifiers,\n eventData: {\n webClientDomain: window.location.hostname,\n },\n intervals: payload.intervals,\n sourceMetadata: {\n applicationSoftwareType: CLIENT_NAME,\n // @ts-ignore\n applicationSoftwareVersion: this.webex.version,\n mediaEngineSoftwareType: getBrowserName() || 'browser',\n mediaEngineSoftwareVersion: getOSVersion() || 'unknown',\n startTime: new Date().toISOString(),\n },\n };\n\n // merge any new properties, or override existing ones\n clientEventObject = merge(clientEventObject, payload);\n\n // append media quality event data to the call diagnostic event\n const diagnosticEvent = this.prepareDiagnosticEvent(clientEventObject, options);\n this.submitToCallDiagnostics(diagnosticEvent);\n } else {\n throw new Error(\n 'Media quality events cant be sent outside the context of a meeting. Meeting id is required.'\n );\n }\n }\n\n /**\n * Return Client Event payload by client error code\n * @param arg - get error arg\n * @param arg.clientErrorCode\n * @param arg.serviceErrorCode\n * @returns\n */\n public getErrorPayloadForClientErrorCode({\n clientErrorCode,\n serviceErrorCode,\n }: {\n clientErrorCode: number;\n serviceErrorCode: any;\n }): ClientEventError {\n let error: ClientEventError;\n\n if (clientErrorCode) {\n const partialParsedError = CLIENT_ERROR_CODE_TO_ERROR_PAYLOAD[clientErrorCode];\n\n if (partialParsedError) {\n error = merge(\n {fatal: true, shownToUser: false, name: 'other', category: 'other'}, // default values\n {errorCode: clientErrorCode},\n {serviceErrorCode},\n partialParsedError\n );\n\n return error;\n }\n }\n\n return undefined;\n }\n\n /**\n * Generate error payload for Client Event\n * @param rawError\n */\n generateClientEventErrorPayload(rawError: any) {\n const serviceErrorCode = rawError?.body?.errorCode || rawError?.body?.code;\n if (serviceErrorCode) {\n const clientErrorCode = SERVICE_ERROR_CODES_TO_CLIENT_ERROR_CODES_MAP[serviceErrorCode];\n if (clientErrorCode) {\n return this.getErrorPayloadForClientErrorCode({clientErrorCode, serviceErrorCode});\n }\n\n // by default, if it is locus error, return nre locus err\n if (isLocusServiceErrorCode(serviceErrorCode)) {\n return this.getErrorPayloadForClientErrorCode({\n clientErrorCode: NEW_LOCUS_ERROR_CLIENT_CODE,\n serviceErrorCode,\n });\n }\n\n // otherwise return meeting info\n return this.getErrorPayloadForClientErrorCode({\n clientErrorCode: MEETING_INFO_LOOKUP_ERROR_CLIENT_CODE,\n serviceErrorCode,\n });\n }\n\n return undefined;\n }\n\n /**\n * Create client event object for in meeting events\n * @param arg - create args\n * @param arg.event - event key\n * @param arg.options - options\n * @returns object\n */\n private createClientEventObjectInMeeting({\n name,\n options,\n }: {\n name: ClientEvent['name'];\n options: SubmitClientEventOptions;\n }) {\n const {meetingId, mediaConnections, rawError} = options;\n\n // @ts-ignore\n const meeting = this.webex.meetings.meetingCollection.get(meetingId);\n\n if (!meeting) {\n console.warn(\n 'Attempt to send client event but no meeting was found...',\n `event: ${name}, meetingId: ${meetingId}`\n );\n // @ts-ignore\n this.webex.internal.metrics.submitClientMetrics(CALL_DIAGNOSTIC_EVENT_FAILED_TO_SEND, {\n fields: {\n meetingId,\n name,\n },\n });\n\n return undefined;\n }\n\n // grab identifiers\n const identifiers = this.getIdentifiers({\n meeting,\n mediaConnections: meeting?.mediaConnections || mediaConnections,\n });\n\n // check if we need to generate errors\n const errors: ClientEvent['payload']['errors'] = [];\n\n if (rawError) {\n const generatedError = this.generateClientEventErrorPayload(rawError);\n if (generatedError) {\n errors.push(generatedError);\n }\n }\n\n // create client event object\n const clientEventObject: ClientEvent['payload'] = {\n name,\n canProceed: true,\n identifiers,\n errors,\n eventData: {\n webClientDomain: window.location.hostname,\n },\n userType: meeting.getCurUserType(),\n loginType: this.getCurLoginType(),\n };\n\n return clientEventObject;\n }\n\n /**\n * Create client event object for pre meeting events\n * @param arg - create args\n * @param arg.event - event key\n * @param arg.options - payload\n * @returns object\n */\n private createClientEventObjectPreMeeting({\n name,\n options,\n }: {\n name: ClientEvent['name'];\n options: SubmitClientEventOptions;\n }) {\n const {correlationId} = options;\n\n // grab identifiers\n const identifiers = this.getIdentifiers({\n correlationId,\n });\n\n // create client event object\n const clientEventObject: ClientEvent['payload'] = {\n name,\n canProceed: true,\n identifiers,\n eventData: {\n webClientDomain: window.location.hostname,\n },\n loginType: this.getCurLoginType(),\n };\n\n return clientEventObject;\n }\n\n /**\n * Submit Client Event CA event.\n * @param arg - submit params\n * @param arg.event - event key\n * @param arg.payload - additional payload to be merged with default payload\n * @param arg.options - payload\n * @throws\n */\n public submitClientEvent({\n name,\n payload,\n options,\n }: {\n name: ClientEvent['name'];\n payload?: ClientEventPayload;\n options: SubmitClientEventOptions;\n }) {\n const {meetingId, correlationId} = options;\n let clientEventObject: ClientEvent['payload'];\n\n // events that will most likely happen in join phase\n if (meetingId) {\n clientEventObject = this.createClientEventObjectInMeeting({name, options});\n } else if (correlationId) {\n // any pre join events or events that are outside the meeting.\n clientEventObject = this.createClientEventObjectPreMeeting({name, options});\n } else {\n throw new Error('Not implemented');\n }\n\n // merge any new properties, or override existing ones\n clientEventObject = merge(clientEventObject, payload);\n\n // append client event data to the call diagnostic event\n const diagnosticEvent = this.prepareDiagnosticEvent(clientEventObject, options);\n this.submitToCallDiagnostics(diagnosticEvent);\n }\n\n /**\n * Prepare the event and send the request to metrics-a service.\n * @param event\n * @returns promise\n */\n submitToCallDiagnostics(event: Event): Promise<void> {\n // build metrics-a event type\n const finalEvent = {\n eventPayload: event,\n type: ['diagnostic-event'],\n };\n\n return this.callDiagnosticEventsBatcher.request(finalEvent);\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;AAGA;AACA;AACA;AAEA;AAEA;AAMA;AAeA;AACA;AAMkB;AAAA;AAElB,wBAA0D,IAAAA,wBAAgB,GAAE;EAArEC,YAAY,qBAAZA,YAAY;EAAEC,cAAc,qBAAdA,cAAc;EAAEC,iBAAiB,qBAAjBA,iBAAiB;AActD;AACA;AACA;AACA;AACA;AAJA,IAKqBC,qBAAqB;EAAA;EAAA;EACxC;;EAGA;AACF;AACA;AACA;EACE,i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