@webex/internal-plugin-metrics 3.0.0-beta.196 → 3.0.0-beta.198
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.
- package/dist/call-diagnostic/call-diagnostic-metrics-batcher.js +5 -83
- package/dist/call-diagnostic/call-diagnostic-metrics-batcher.js.map +1 -1
- package/dist/call-diagnostic/call-diagnostic-metrics.js +76 -3
- package/dist/call-diagnostic/call-diagnostic-metrics.js.map +1 -1
- package/dist/call-diagnostic/call-diagnostic-metrics.util.js +120 -1
- package/dist/call-diagnostic/call-diagnostic-metrics.util.js.map +1 -1
- package/dist/call-diagnostic/generated-types-temp/ClientEvent.js.map +1 -1
- package/dist/call-diagnostic/generated-types-temp/Event.js.map +1 -1
- package/dist/metrics.js +1 -1
- package/dist/metrics.types.js.map +1 -1
- package/dist/new-metrics.js +64 -0
- package/dist/new-metrics.js.map +1 -1
- package/dist/types/call-diagnostic/call-diagnostic-metrics.d.ts +24 -0
- package/dist/types/call-diagnostic/call-diagnostic-metrics.util.d.ts +21 -0
- package/dist/types/call-diagnostic/generated-types-temp/ClientEvent.d.ts +135 -135
- package/dist/types/call-diagnostic/generated-types-temp/Event.d.ts +379 -379
- package/dist/types/metrics.types.d.ts +5 -0
- package/dist/types/new-metrics.d.ts +36 -0
- package/package.json +8 -8
- package/src/call-diagnostic/call-diagnostic-metrics-batcher.ts +2 -99
- package/src/call-diagnostic/call-diagnostic-metrics.ts +64 -2
- package/src/call-diagnostic/call-diagnostic-metrics.util.ts +132 -1
- package/src/call-diagnostic/generated-types-temp/ClientEvent.ts +1360 -1322
- package/src/call-diagnostic/generated-types-temp/Event.ts +3142 -3049
- package/src/metrics.types.ts +6 -0
- package/src/new-metrics.ts +52 -0
- package/test/unit/spec/call-diagnostic/call-diagnostic-metrics.ts +145 -46
- package/test/unit/spec/call-diagnostic/call-diagnostic-metrics.util.ts +262 -2
- package/test/unit/spec/new-metrics.ts +84 -22
package/dist/metrics.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":[],"sources":["metrics.types.ts"],"sourcesContent":["import {ClientEvent as RawClientEvent} from './call-diagnostic/generated-types-temp/ClientEvent';\nimport {Event as RawEvent} from './call-diagnostic/generated-types-temp/Event';\nimport {MediaQualityEvent as RawMediaQualityEvent} from './call-diagnostic/generated-types-temp/MediaQualityEvent';\n\nexport type Event = Omit<RawEvent, 'event'> & {event: RawClientEvent | RawMediaQualityEvent};\n\nexport type ClientEventError = NonNullable<RawClientEvent['errors']>[0];\n\nexport type SubmitClientEventOptions = {\n meetingId?: string;\n mediaConnections?: any[];\n rawError?: any;\n showToUser?: boolean;\n correlationId?: string;\n};\n\nexport type SubmitMQEOptions = {\n meetingId: string;\n mediaConnections?: any[];\n networkType?: Event['origin']['networkType'];\n};\n\nexport type InternalEvent = {\n name:\n | 'internal.client.meetinginfo.request'\n | 'internal.client.meetinginfo.response'\n | 'internal.reset.join.latencies'\n | 'internal.client.interstitial-window.launched'\n | 'internal.client.meeting.click.joinbutton'\n | 'internal.host.meeting.participant.admitted'\n | 'internal.client.meeting.interstitial-window.showed'\n | 'internal.client.interstitial-window.click.joinbutton';\n payload?: never;\n options?: never;\n};\n\nexport interface ClientEvent {\n name: RawClientEvent['name'];\n payload?: RawClientEvent;\n options: SubmitClientEventOptions;\n}\n\nexport interface BehavioralEvent {\n // TODO: not implemented\n name: 'host.meeting.participant.admitted' | 'sdk.media-flow.started';\n payload?: never;\n options?: never;\n}\n\nexport interface OperationalEvent {\n // TODO: not implemented\n name: never;\n payload?: never;\n options?: never;\n}\n\nexport interface FeatureEvent {\n // TODO: not implemented\n name: never;\n payload?: never;\n options?: never;\n}\n\nexport interface MediaQualityEvent {\n name: RawMediaQualityEvent['name'];\n payload?: RawMediaQualityEvent;\n options: SubmitMQEOptions;\n}\n\nexport type RecursivePartial<T> = {\n [P in keyof T]?: T[P] extends (infer U)[]\n ? RecursivePartial<U>[]\n : T[P] extends object\n ? RecursivePartial<T[P]>\n : T[P];\n};\n\nexport type MetricEventNames =\n | InternalEvent['name']\n | ClientEvent['name']\n | BehavioralEvent['name']\n | OperationalEvent['name']\n | FeatureEvent['name']\n | MediaQualityEvent['name'];\n\nexport type ClientType = NonNullable<RawEvent['origin']['clientInfo']>['clientType'];\nexport type SubClientType = NonNullable<RawEvent['origin']['clientInfo']>['subClientType'];\nexport type NetworkType = NonNullable<RawEvent['origin']>['networkType'];\n\nexport type ClientEventPayload = RecursivePartial<ClientEvent['payload']>;\n\nexport type MediaQualityEventAudioSetupDelayPayload = NonNullable<\n MediaQualityEvent['payload']\n>['audioSetupDelay'];\nexport type MediaQualityEventVideoSetupDelayPayload = NonNullable<\n MediaQualityEvent['payload']\n>['videoSetupDelay'];\n\nexport type SubmitMQEPayload = RecursivePartial<MediaQualityEvent['payload']> & {\n intervals: NonNullable<MediaQualityEvent['payload']>['intervals'];\n};\n\nexport type SubmitInternalEvent = (args: {\n name: InternalEvent['name'];\n payload?: RecursivePartial<InternalEvent['payload']>;\n options?: any;\n}) => void;\n\nexport type SubmitBehavioralEvent = (args: {\n name: BehavioralEvent['name'];\n payload?: RecursivePartial<BehavioralEvent['payload']>;\n options?: any;\n}) => void;\n\nexport type SubmitClientEvent = (args: {\n name: ClientEvent['name'];\n payload?: RecursivePartial<ClientEvent['payload']>;\n options: SubmitClientEventOptions;\n}) => Promise<any>;\n\nexport type SubmitOperationalEvent = (args: {\n name: OperationalEvent['name'];\n payload?: RecursivePartial<OperationalEvent['payload']>;\n options?: any;\n}) => void;\n\nexport type SubmitMQE = (args: {\n name: MediaQualityEvent['name'];\n payload: SubmitMQEPayload;\n options: any;\n}) => void;\n"],"mappings":""}
|
|
1
|
+
{"version":3,"names":[],"sources":["metrics.types.ts"],"sourcesContent":["import {ClientEvent as RawClientEvent} from './call-diagnostic/generated-types-temp/ClientEvent';\nimport {Event as RawEvent} from './call-diagnostic/generated-types-temp/Event';\nimport {MediaQualityEvent as RawMediaQualityEvent} from './call-diagnostic/generated-types-temp/MediaQualityEvent';\n\nexport type Event = Omit<RawEvent, 'event'> & {event: RawClientEvent | RawMediaQualityEvent};\n\nexport type ClientEventError = NonNullable<RawClientEvent['errors']>[0];\n\nexport type SubmitClientEventOptions = {\n meetingId?: string;\n mediaConnections?: any[];\n rawError?: any;\n showToUser?: boolean;\n correlationId?: string;\n};\n\nexport type SubmitMQEOptions = {\n meetingId: string;\n mediaConnections?: any[];\n networkType?: Event['origin']['networkType'];\n};\n\nexport type InternalEvent = {\n name:\n | 'internal.client.meetinginfo.request'\n | 'internal.client.meetinginfo.response'\n | 'internal.reset.join.latencies'\n | 'internal.client.interstitial-window.launched'\n | 'internal.client.meeting.click.joinbutton'\n | 'internal.host.meeting.participant.admitted'\n | 'internal.client.meeting.interstitial-window.showed'\n | 'internal.client.interstitial-window.click.joinbutton';\n payload?: never;\n options?: never;\n};\n\nexport interface ClientEvent {\n name: RawClientEvent['name'];\n payload?: RawClientEvent;\n options: SubmitClientEventOptions;\n}\n\nexport interface BehavioralEvent {\n // TODO: not implemented\n name: 'host.meeting.participant.admitted' | 'sdk.media-flow.started';\n payload?: never;\n options?: never;\n}\n\nexport interface OperationalEvent {\n // TODO: not implemented\n name: never;\n payload?: never;\n options?: never;\n}\n\nexport interface FeatureEvent {\n // TODO: not implemented\n name: never;\n payload?: never;\n options?: never;\n}\n\nexport interface MediaQualityEvent {\n name: RawMediaQualityEvent['name'];\n payload?: RawMediaQualityEvent;\n options: SubmitMQEOptions;\n}\n\nexport type RecursivePartial<T> = {\n [P in keyof T]?: T[P] extends (infer U)[]\n ? RecursivePartial<U>[]\n : T[P] extends object\n ? RecursivePartial<T[P]>\n : T[P];\n};\n\nexport type MetricEventNames =\n | InternalEvent['name']\n | ClientEvent['name']\n | BehavioralEvent['name']\n | OperationalEvent['name']\n | FeatureEvent['name']\n | MediaQualityEvent['name'];\n\nexport type ClientType = NonNullable<RawEvent['origin']['clientInfo']>['clientType'];\nexport type SubClientType = NonNullable<RawEvent['origin']['clientInfo']>['subClientType'];\nexport type NetworkType = NonNullable<RawEvent['origin']>['networkType'];\n\nexport type ClientEventPayload = RecursivePartial<ClientEvent['payload']>;\n\nexport type MediaQualityEventAudioSetupDelayPayload = NonNullable<\n MediaQualityEvent['payload']\n>['audioSetupDelay'];\nexport type MediaQualityEventVideoSetupDelayPayload = NonNullable<\n MediaQualityEvent['payload']\n>['videoSetupDelay'];\n\nexport type SubmitMQEPayload = RecursivePartial<MediaQualityEvent['payload']> & {\n intervals: NonNullable<MediaQualityEvent['payload']>['intervals'];\n};\n\nexport type SubmitInternalEvent = (args: {\n name: InternalEvent['name'];\n payload?: RecursivePartial<InternalEvent['payload']>;\n options?: any;\n}) => void;\n\nexport type SubmitBehavioralEvent = (args: {\n name: BehavioralEvent['name'];\n payload?: RecursivePartial<BehavioralEvent['payload']>;\n options?: any;\n}) => void;\n\nexport type SubmitClientEvent = (args: {\n name: ClientEvent['name'];\n payload?: RecursivePartial<ClientEvent['payload']>;\n options: SubmitClientEventOptions;\n}) => Promise<any>;\n\nexport type SubmitOperationalEvent = (args: {\n name: OperationalEvent['name'];\n payload?: RecursivePartial<OperationalEvent['payload']>;\n options?: any;\n}) => void;\n\nexport type SubmitMQE = (args: {\n name: MediaQualityEvent['name'];\n payload: SubmitMQEPayload;\n options: any;\n}) => void;\n\nexport type BuildClientEventFetchRequestOptions = (args: {\n name: ClientEvent['name'];\n payload?: RecursivePartial<ClientEvent['payload']>;\n options: SubmitClientEventOptions;\n}) => Promise<any>;\n"],"mappings":""}
|
package/dist/new-metrics.js
CHANGED
|
@@ -7,6 +7,8 @@ _Object$defineProperty(exports, "__esModule", {
|
|
|
7
7
|
value: true
|
|
8
8
|
});
|
|
9
9
|
exports.default = void 0;
|
|
10
|
+
var _regenerator = _interopRequireDefault(require("@babel/runtime-corejs2/regenerator"));
|
|
11
|
+
var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime-corejs2/helpers/asyncToGenerator"));
|
|
10
12
|
var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime-corejs2/helpers/classCallCheck"));
|
|
11
13
|
var _createClass2 = _interopRequireDefault(require("@babel/runtime-corejs2/helpers/createClass"));
|
|
12
14
|
var _assertThisInitialized2 = _interopRequireDefault(require("@babel/runtime-corejs2/helpers/assertThisInitialized"));
|
|
@@ -17,6 +19,7 @@ var _defineProperty2 = _interopRequireDefault(require("@babel/runtime-corejs2/he
|
|
|
17
19
|
var _webexCore = require("@webex/webex-core");
|
|
18
20
|
var _callDiagnosticMetrics = _interopRequireDefault(require("./call-diagnostic/call-diagnostic-metrics"));
|
|
19
21
|
var _callDiagnosticMetricsLatencies = _interopRequireDefault(require("./call-diagnostic/call-diagnostic-metrics-latencies"));
|
|
22
|
+
var _callDiagnosticMetrics2 = require("./call-diagnostic/call-diagnostic-metrics.util");
|
|
20
23
|
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); }; }
|
|
21
24
|
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; } }
|
|
22
25
|
/**
|
|
@@ -176,6 +179,67 @@ var Metrics = /*#__PURE__*/function (_WebexPlugin) {
|
|
|
176
179
|
options: options
|
|
177
180
|
});
|
|
178
181
|
}
|
|
182
|
+
|
|
183
|
+
/**
|
|
184
|
+
* Returns a promise that will resolve to fetch options for submitting a metric.
|
|
185
|
+
*
|
|
186
|
+
* This is to support quickly submitting metrics when the browser/tab is closing.
|
|
187
|
+
* Calling submitClientEvent will not work because there some async steps that will
|
|
188
|
+
* not complete before the browser is closed. Instead, we pre-gather all the
|
|
189
|
+
* information/options needed for the request(s), and then simply and quickly
|
|
190
|
+
* fire the fetch(es) when beforeUnload is triggered.
|
|
191
|
+
*
|
|
192
|
+
* We must use fetch instead of request because fetch has a keepalive option that
|
|
193
|
+
* allows the request it to outlive the page.
|
|
194
|
+
*
|
|
195
|
+
* Note: the timings values will be wrong, but setMetricTimingsAndFetch() will
|
|
196
|
+
* properly adjust them before submitting.
|
|
197
|
+
*
|
|
198
|
+
* @public
|
|
199
|
+
* @param {Object} arg
|
|
200
|
+
* @param {String} arg.name - event name
|
|
201
|
+
* @param {Object} arg.payload - event payload
|
|
202
|
+
* @param {Object} arg.options - other options
|
|
203
|
+
* @returns {Promise} promise that resolves to options to be used with fetch
|
|
204
|
+
*/
|
|
205
|
+
}, {
|
|
206
|
+
key: "buildClientEventFetchRequestOptions",
|
|
207
|
+
value: function () {
|
|
208
|
+
var _buildClientEventFetchRequestOptions = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee(_ref7) {
|
|
209
|
+
var name, payload, options;
|
|
210
|
+
return _regenerator.default.wrap(function _callee$(_context) {
|
|
211
|
+
while (1) switch (_context.prev = _context.next) {
|
|
212
|
+
case 0:
|
|
213
|
+
name = _ref7.name, payload = _ref7.payload, options = _ref7.options;
|
|
214
|
+
return _context.abrupt("return", this.callDiagnosticMetrics.buildClientEventFetchRequestOptions({
|
|
215
|
+
name: name,
|
|
216
|
+
payload: payload,
|
|
217
|
+
options: options
|
|
218
|
+
}));
|
|
219
|
+
case 2:
|
|
220
|
+
case "end":
|
|
221
|
+
return _context.stop();
|
|
222
|
+
}
|
|
223
|
+
}, _callee, this);
|
|
224
|
+
}));
|
|
225
|
+
function buildClientEventFetchRequestOptions(_x) {
|
|
226
|
+
return _buildClientEventFetchRequestOptions.apply(this, arguments);
|
|
227
|
+
}
|
|
228
|
+
return buildClientEventFetchRequestOptions;
|
|
229
|
+
}()
|
|
230
|
+
/**
|
|
231
|
+
* Submits a metric from pre-built request options via the fetch API. Updates
|
|
232
|
+
* the "$timings" and "originTime" values to Date.now() since the existing times
|
|
233
|
+
* were set when the options were built (not submitted).
|
|
234
|
+
* @param {any} options - the pre-built request options for submitting a metric
|
|
235
|
+
* @returns {Promise} promise that resolves to the response object
|
|
236
|
+
*/
|
|
237
|
+
}, {
|
|
238
|
+
key: "setMetricTimingsAndFetch",
|
|
239
|
+
value: function setMetricTimingsAndFetch(options) {
|
|
240
|
+
// @ts-ignore
|
|
241
|
+
return this.webex.setTimingsAndFetch((0, _callDiagnosticMetrics2.setMetricTimings)(options));
|
|
242
|
+
}
|
|
179
243
|
}]);
|
|
180
244
|
return Metrics;
|
|
181
245
|
}(_webexCore.WebexPlugin);
|
package/dist/new-metrics.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["Metrics","args","onReady","webex","once","callDiagnosticMetrics","CallDiagnosticMetrics","parent","callDiagnosticLatencies","CallDiagnosticLatencies","name","payload","options","clearTimestamps","saveTimestamp","key","Error","submitMQE","meetingId","submitClientEvent","WebexPlugin"],"sources":["new-metrics.ts"],"sourcesContent":["/* eslint-disable @typescript-eslint/no-unused-vars */\n/* eslint-disable class-methods-use-this */\n/* eslint-disable valid-jsdoc */\n\n// @ts-ignore\nimport {WebexPlugin} from '@webex/webex-core';\n\nimport CallDiagnosticMetrics from './call-diagnostic/call-diagnostic-metrics';\nimport {\n RecursivePartial,\n ClientEvent,\n FeatureEvent,\n BehavioralEvent,\n OperationalEvent,\n MediaQualityEvent,\n InternalEvent,\n SubmitClientEventOptions,\n} from './metrics.types';\nimport CallDiagnosticLatencies from './call-diagnostic/call-diagnostic-metrics-latencies';\n\n/**\n * Metrics plugin to centralize all types of metrics.\n * @class\n */\nclass Metrics extends WebexPlugin {\n // eslint-disable-next-line no-use-before-define\n static instance: Metrics;\n\n // Call Diagnostic latencies\n callDiagnosticLatencies: CallDiagnosticLatencies;\n // Helper classes to handle the different types of metrics\n callDiagnosticMetrics: CallDiagnosticMetrics;\n\n /**\n * Constructor\n * @param args\n * @constructor\n * @private\n * @returns\n */\n constructor(...args) {\n super(...args);\n\n this.onReady();\n }\n\n /**\n * On Ready\n */\n private onReady() {\n // @ts-ignore\n this.webex.once('ready', () => {\n // @ts-ignore\n this.callDiagnosticMetrics = new CallDiagnosticMetrics({}, {parent: this.webex});\n // @ts-ignore\n this.callDiagnosticLatencies = new CallDiagnosticLatencies({}, {parent: this.webex});\n });\n }\n\n /**\n * Used for internal purposes only\n * @param args\n */\n submitInternalEvent({\n name,\n payload,\n options,\n }: {\n name: InternalEvent['name'];\n payload?: RecursivePartial<InternalEvent['payload']>;\n options?: any;\n }) {\n if (name === 'internal.reset.join.latencies') {\n this.callDiagnosticLatencies.clearTimestamps();\n } else {\n this.callDiagnosticLatencies.saveTimestamp({key: name});\n }\n }\n\n /**\n * Behavioral event\n * @param args\n */\n submitBehavioralEvent({\n name,\n payload,\n options,\n }: {\n name: BehavioralEvent['name'];\n payload?: RecursivePartial<BehavioralEvent['payload']>;\n options?: any;\n }) {\n this.callDiagnosticLatencies.saveTimestamp({key: name});\n throw new Error('Not implemented.');\n }\n\n /**\n * Operational event\n * @param args\n */\n submitOperationalEvent({\n name,\n payload,\n options,\n }: {\n name: OperationalEvent['name'];\n payload?: RecursivePartial<OperationalEvent['payload']>;\n options?: any;\n }) {\n throw new Error('Not implemented.');\n }\n\n /**\n * Call Analyzer: Media Quality Event\n * @param args\n */\n submitMQE({\n name,\n payload,\n options,\n }: {\n name: MediaQualityEvent['name'];\n payload: RecursivePartial<MediaQualityEvent['payload']> & {\n intervals: MediaQualityEvent['payload']['intervals'];\n };\n options: any;\n }) {\n this.callDiagnosticLatencies.saveTimestamp({key: name});\n this.callDiagnosticMetrics.submitMQE({name, payload, options});\n }\n\n /**\n * Call Analyzer: Feature Usage Event\n * @param args\n */\n submitFeatureEvent({\n name,\n payload,\n options,\n }: {\n name: FeatureEvent['name'];\n payload?: RecursivePartial<FeatureEvent['payload']>;\n options: any;\n }) {\n throw new Error('Not implemented.');\n }\n\n /**\n * Call Analyzer: Client Event\n * @public\n * @param args\n */\n public submitClientEvent({\n name,\n payload,\n options,\n }: {\n name: ClientEvent['name'];\n payload?: RecursivePartial<ClientEvent['payload']>;\n options: SubmitClientEventOptions;\n }): Promise<any> {\n this.callDiagnosticLatencies.saveTimestamp({\n key: name,\n options: {meetingId: options?.meetingId},\n });\n\n return this.callDiagnosticMetrics.submitClientEvent({name, payload, options});\n }\n}\n\nexport default Metrics;\n"],"mappings":"
|
|
1
|
+
{"version":3,"names":["Metrics","args","onReady","webex","once","callDiagnosticMetrics","CallDiagnosticMetrics","parent","callDiagnosticLatencies","CallDiagnosticLatencies","name","payload","options","clearTimestamps","saveTimestamp","key","Error","submitMQE","meetingId","submitClientEvent","buildClientEventFetchRequestOptions","setTimingsAndFetch","setMetricTimings","WebexPlugin"],"sources":["new-metrics.ts"],"sourcesContent":["/* eslint-disable @typescript-eslint/no-unused-vars */\n/* eslint-disable class-methods-use-this */\n/* eslint-disable valid-jsdoc */\n\n// @ts-ignore\nimport {WebexPlugin} from '@webex/webex-core';\n\nimport CallDiagnosticMetrics from './call-diagnostic/call-diagnostic-metrics';\nimport {\n RecursivePartial,\n ClientEvent,\n FeatureEvent,\n BehavioralEvent,\n OperationalEvent,\n MediaQualityEvent,\n InternalEvent,\n SubmitClientEventOptions,\n} from './metrics.types';\nimport CallDiagnosticLatencies from './call-diagnostic/call-diagnostic-metrics-latencies';\nimport {setMetricTimings} from './call-diagnostic/call-diagnostic-metrics.util';\n\n/**\n * Metrics plugin to centralize all types of metrics.\n * @class\n */\nclass Metrics extends WebexPlugin {\n // eslint-disable-next-line no-use-before-define\n static instance: Metrics;\n\n // Call Diagnostic latencies\n callDiagnosticLatencies: CallDiagnosticLatencies;\n // Helper classes to handle the different types of metrics\n callDiagnosticMetrics: CallDiagnosticMetrics;\n\n /**\n * Constructor\n * @param args\n * @constructor\n * @private\n * @returns\n */\n constructor(...args) {\n super(...args);\n\n this.onReady();\n }\n\n /**\n * On Ready\n */\n private onReady() {\n // @ts-ignore\n this.webex.once('ready', () => {\n // @ts-ignore\n this.callDiagnosticMetrics = new CallDiagnosticMetrics({}, {parent: this.webex});\n // @ts-ignore\n this.callDiagnosticLatencies = new CallDiagnosticLatencies({}, {parent: this.webex});\n });\n }\n\n /**\n * Used for internal purposes only\n * @param args\n */\n submitInternalEvent({\n name,\n payload,\n options,\n }: {\n name: InternalEvent['name'];\n payload?: RecursivePartial<InternalEvent['payload']>;\n options?: any;\n }) {\n if (name === 'internal.reset.join.latencies') {\n this.callDiagnosticLatencies.clearTimestamps();\n } else {\n this.callDiagnosticLatencies.saveTimestamp({key: name});\n }\n }\n\n /**\n * Behavioral event\n * @param args\n */\n submitBehavioralEvent({\n name,\n payload,\n options,\n }: {\n name: BehavioralEvent['name'];\n payload?: RecursivePartial<BehavioralEvent['payload']>;\n options?: any;\n }) {\n this.callDiagnosticLatencies.saveTimestamp({key: name});\n throw new Error('Not implemented.');\n }\n\n /**\n * Operational event\n * @param args\n */\n submitOperationalEvent({\n name,\n payload,\n options,\n }: {\n name: OperationalEvent['name'];\n payload?: RecursivePartial<OperationalEvent['payload']>;\n options?: any;\n }) {\n throw new Error('Not implemented.');\n }\n\n /**\n * Call Analyzer: Media Quality Event\n * @param args\n */\n submitMQE({\n name,\n payload,\n options,\n }: {\n name: MediaQualityEvent['name'];\n payload: RecursivePartial<MediaQualityEvent['payload']> & {\n intervals: MediaQualityEvent['payload']['intervals'];\n };\n options: any;\n }) {\n this.callDiagnosticLatencies.saveTimestamp({key: name});\n this.callDiagnosticMetrics.submitMQE({name, payload, options});\n }\n\n /**\n * Call Analyzer: Feature Usage Event\n * @param args\n */\n submitFeatureEvent({\n name,\n payload,\n options,\n }: {\n name: FeatureEvent['name'];\n payload?: RecursivePartial<FeatureEvent['payload']>;\n options: any;\n }) {\n throw new Error('Not implemented.');\n }\n\n /**\n * Call Analyzer: Client Event\n * @public\n * @param args\n */\n public submitClientEvent({\n name,\n payload,\n options,\n }: {\n name: ClientEvent['name'];\n payload?: RecursivePartial<ClientEvent['payload']>;\n options: SubmitClientEventOptions;\n }): Promise<any> {\n this.callDiagnosticLatencies.saveTimestamp({\n key: name,\n options: {meetingId: options?.meetingId},\n });\n\n return this.callDiagnosticMetrics.submitClientEvent({name, payload, options});\n }\n\n /**\n * Returns a promise that will resolve to fetch options for submitting a metric.\n *\n * This is to support quickly submitting metrics when the browser/tab is closing.\n * Calling submitClientEvent will not work because there some async steps that will\n * not complete before the browser is closed. Instead, we pre-gather all the\n * information/options needed for the request(s), and then simply and quickly\n * fire the fetch(es) when beforeUnload is triggered.\n *\n * We must use fetch instead of request because fetch has a keepalive option that\n * allows the request it to outlive the page.\n *\n * Note: the timings values will be wrong, but setMetricTimingsAndFetch() will\n * properly adjust them before submitting.\n *\n * @public\n * @param {Object} arg\n * @param {String} arg.name - event name\n * @param {Object} arg.payload - event payload\n * @param {Object} arg.options - other options\n * @returns {Promise} promise that resolves to options to be used with fetch\n */\n public async buildClientEventFetchRequestOptions({\n name,\n payload,\n options,\n }: {\n name: ClientEvent['name'];\n payload?: RecursivePartial<ClientEvent['payload']>;\n options: SubmitClientEventOptions;\n }): Promise<any> {\n return this.callDiagnosticMetrics.buildClientEventFetchRequestOptions({\n name,\n payload,\n options,\n });\n }\n\n /**\n * Submits a metric from pre-built request options via the fetch API. Updates\n * the \"$timings\" and \"originTime\" values to Date.now() since the existing times\n * were set when the options were built (not submitted).\n\n * @param {any} options - the pre-built request options for submitting a metric\n * @returns {Promise} promise that resolves to the response object\n */\n public setMetricTimingsAndFetch(options: any): Promise<any> {\n // @ts-ignore\n return this.webex.setTimingsAndFetch(setMetricTimings(options));\n }\n}\n\nexport default Metrics;\n"],"mappings":";;;;;;;;;;;;;;;;;;AAKA;AAEA;AAWA;AACA;AAAgF;AAAA;AAEhF;AACA;AACA;AACA;AAHA,IAIMA,OAAO;EAAA;EAAA;EACX;;EAGA;;EAEA;;EAGA;A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A;EArBE;IAAA;IAAA;MAAA,mHAsBA;QAAA;QAAA;UAAA;YAAA;cACEF,IAAI,SAAJA,IAAI,EACJC,OAAO,SAAPA,OAAO,EACPC,OAAO,SAAPA,OAAO;cAAA,iCAMA,IAAI,CAACP,qBAAqB,CAACe,mCAAmC,CAAC;gBACpEV,IAAI,EAAJA,IAAI;gBACJC,OAAO,EAAPA,OAAO;gBACPC,OAAO,EAAPA;cACF,CAAC,CAAC;YAAA;YAAA;cAAA;UAAA;QAAA;MAAA,CACH;MAAA;QAAA;MAAA;MAAA;IAAA;IAED;AACF;AACA;AACA;AACA;AACA;AACA;EANE;IAAA;IAAA,OAQA,kCAAgCA,OAAY,EAAgB;MAC1D;MACA,OAAO,IAAI,CAACT,KAAK,CAACkB,kBAAkB,CAAC,IAAAC,wCAAgB,EAACV,OAAO,CAAC,CAAC;IACjE;EAAC;EAAA;AAAA,EAlMmBW,sBAAW;AAAA,8BAA3BvB,OAAO;AAAA,eAqMEA,OAAO;AAAA"}
|
|
@@ -301,6 +301,16 @@ export default class CallDiagnosticMetrics extends StatelessWebexPlugin {
|
|
|
301
301
|
* @returns object
|
|
302
302
|
*/
|
|
303
303
|
private createClientEventObjectPreMeeting;
|
|
304
|
+
/**
|
|
305
|
+
* Prepare Client Event CA event.
|
|
306
|
+
* @param arg - submit params
|
|
307
|
+
* @param arg.event - event key
|
|
308
|
+
* @param arg.payload - additional payload to be merged with default payload
|
|
309
|
+
* @param arg.options - payload
|
|
310
|
+
* @returns {any} options to be with fetch
|
|
311
|
+
* @throws
|
|
312
|
+
*/
|
|
313
|
+
private prepareClientEvent;
|
|
304
314
|
/**
|
|
305
315
|
* Submit Client Event CA event.
|
|
306
316
|
* @param arg - submit params
|
|
@@ -320,5 +330,19 @@ export default class CallDiagnosticMetrics extends StatelessWebexPlugin {
|
|
|
320
330
|
* @returns promise
|
|
321
331
|
*/
|
|
322
332
|
submitToCallDiagnostics(event: Event): Promise<any>;
|
|
333
|
+
/**
|
|
334
|
+
* Builds a request options object to later be passed to fetch().
|
|
335
|
+
* @param arg - submit params
|
|
336
|
+
* @param arg.event - event key
|
|
337
|
+
* @param arg.payload - additional payload to be merged with default payload
|
|
338
|
+
* @param arg.options - client event options
|
|
339
|
+
* @returns {Promise<any>}
|
|
340
|
+
* @throws
|
|
341
|
+
*/
|
|
342
|
+
buildClientEventFetchRequestOptions({ name, payload, options, }: {
|
|
343
|
+
name: ClientEvent['name'];
|
|
344
|
+
payload?: ClientEventPayload;
|
|
345
|
+
options: SubmitClientEventOptions;
|
|
346
|
+
}): Promise<any>;
|
|
323
347
|
}
|
|
324
348
|
export {};
|
|
@@ -29,3 +29,24 @@ export declare const clearEmptyKeysRecursively: (obj: any) => void;
|
|
|
29
29
|
* @returns
|
|
30
30
|
*/
|
|
31
31
|
export declare const isLocusServiceErrorCode: (errorCode: string | number) => boolean;
|
|
32
|
+
/**
|
|
33
|
+
* @param webClientDomain
|
|
34
|
+
* @returns
|
|
35
|
+
*/
|
|
36
|
+
export declare const getBuildType: (webClientDomain: any) => "production" | "test";
|
|
37
|
+
/**
|
|
38
|
+
* Prepare metric item for submission.
|
|
39
|
+
* @param {Object} webex sdk instance
|
|
40
|
+
* @param {Object} item
|
|
41
|
+
* @returns {Object} prepared item
|
|
42
|
+
*/
|
|
43
|
+
export declare const prepareDiagnosticMetricItem: (webex: any, item: any) => any;
|
|
44
|
+
/**
|
|
45
|
+
* Sets the originTime value(s) before the request/fetch.
|
|
46
|
+
* This function is only useful if you are about to submit a metrics
|
|
47
|
+
* request using pre-built fetch options;
|
|
48
|
+
*
|
|
49
|
+
* @param {any} options
|
|
50
|
+
* @returns {any} the updated options object
|
|
51
|
+
*/
|
|
52
|
+
export declare const setMetricTimings: (options: any) => any;
|