easyproctor 0.0.30 → 0.0.33
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/esm/index.js +45 -36
- package/index.d.ts +3 -0
- package/index.js +45 -36
- package/package.json +1 -1
- package/plugins/insights.d.ts +2 -3
- package/unpkg/easyproctor.min.js +14 -14
package/esm/index.js
CHANGED
|
@@ -6280,17 +6280,17 @@ var Sender = function(_super) {
|
|
|
6280
6280
|
arrForEach(objKeys(_headers), function(headerName) {
|
|
6281
6281
|
requestHeaders.append(headerName, _headers[headerName]);
|
|
6282
6282
|
});
|
|
6283
|
-
var
|
|
6283
|
+
var init2 = (_a2 = {
|
|
6284
6284
|
method: "POST",
|
|
6285
6285
|
headers: requestHeaders,
|
|
6286
6286
|
body: plainTextBatch
|
|
6287
6287
|
}, _a2[DisabledPropertyName] = true, _a2);
|
|
6288
6288
|
if (!isAsync) {
|
|
6289
|
-
|
|
6289
|
+
init2.keepalive = true;
|
|
6290
6290
|
ignoreResponse = true;
|
|
6291
6291
|
_syncFetchPayload += batchLength;
|
|
6292
6292
|
}
|
|
6293
|
-
var request = new Request(endPointUrl,
|
|
6293
|
+
var request = new Request(endPointUrl, init2);
|
|
6294
6294
|
try {
|
|
6295
6295
|
request[DisabledPropertyName] = true;
|
|
6296
6296
|
} catch (e) {
|
|
@@ -7402,37 +7402,37 @@ var AjaxMonitor = function(_super) {
|
|
|
7402
7402
|
_self.trackDependencyData = function(dependency, properties) {
|
|
7403
7403
|
_self[strTrackDependencyDataInternal](dependency, properties);
|
|
7404
7404
|
};
|
|
7405
|
-
_self.includeCorrelationHeaders = function(ajaxData, input,
|
|
7405
|
+
_self.includeCorrelationHeaders = function(ajaxData, input, init2, xhr) {
|
|
7406
7406
|
var currentWindowHost = _self["_currentWindowHost"] || _currentWindowHost;
|
|
7407
7407
|
if (input) {
|
|
7408
7408
|
if (CorrelationIdHelper.canIncludeCorrelationHeader(_config, ajaxData.getAbsoluteUrl(), currentWindowHost)) {
|
|
7409
|
-
if (!
|
|
7410
|
-
|
|
7409
|
+
if (!init2) {
|
|
7410
|
+
init2 = {};
|
|
7411
7411
|
}
|
|
7412
|
-
|
|
7412
|
+
init2.headers = new Headers(init2.headers || (input instanceof Request ? input.headers || {} : {}));
|
|
7413
7413
|
if (_isUsingAIHeaders) {
|
|
7414
7414
|
var id = "|" + ajaxData.traceID + "." + ajaxData.spanID;
|
|
7415
|
-
|
|
7415
|
+
init2.headers.set(RequestHeaders.requestIdHeader, id);
|
|
7416
7416
|
if (_enableRequestHeaderTracking) {
|
|
7417
7417
|
ajaxData.requestHeaders[RequestHeaders.requestIdHeader] = id;
|
|
7418
7418
|
}
|
|
7419
7419
|
}
|
|
7420
7420
|
var appId = _config.appId || _context && _context.appId();
|
|
7421
7421
|
if (appId) {
|
|
7422
|
-
|
|
7422
|
+
init2.headers.set(RequestHeaders.requestContextHeader, RequestHeaders.requestContextAppIdFormat + appId);
|
|
7423
7423
|
if (_enableRequestHeaderTracking) {
|
|
7424
7424
|
ajaxData.requestHeaders[RequestHeaders.requestContextHeader] = RequestHeaders.requestContextAppIdFormat + appId;
|
|
7425
7425
|
}
|
|
7426
7426
|
}
|
|
7427
7427
|
if (_isUsingW3CHeaders) {
|
|
7428
7428
|
var traceparent = new Traceparent(ajaxData.traceID, ajaxData.spanID);
|
|
7429
|
-
|
|
7429
|
+
init2.headers.set(RequestHeaders.traceParentHeader, traceparent.toString());
|
|
7430
7430
|
if (_enableRequestHeaderTracking) {
|
|
7431
7431
|
ajaxData.requestHeaders[RequestHeaders.traceParentHeader] = traceparent.toString();
|
|
7432
7432
|
}
|
|
7433
7433
|
}
|
|
7434
7434
|
}
|
|
7435
|
-
return
|
|
7435
|
+
return init2;
|
|
7436
7436
|
} else if (xhr) {
|
|
7437
7437
|
if (CorrelationIdHelper.canIncludeCorrelationHeader(_config, ajaxData.getAbsoluteUrl(), currentWindowHost)) {
|
|
7438
7438
|
if (_isUsingAIHeaders) {
|
|
@@ -7497,13 +7497,13 @@ var AjaxMonitor = function(_super) {
|
|
|
7497
7497
|
var isPolyfill = fetch2.polyfill;
|
|
7498
7498
|
if (_config.disableFetchTracking === false) {
|
|
7499
7499
|
_hooks.push(InstrumentFunc(global2, strFetch, {
|
|
7500
|
-
req: function(callDetails, input,
|
|
7500
|
+
req: function(callDetails, input, init2) {
|
|
7501
7501
|
var fetchData;
|
|
7502
|
-
if (_fetchInitialized && !_isDisabledRequest(null, input,
|
|
7502
|
+
if (_fetchInitialized && !_isDisabledRequest(null, input, init2) && !(isPolyfill && _xhrInitialized)) {
|
|
7503
7503
|
var ctx = callDetails.ctx();
|
|
7504
|
-
fetchData = _createFetchRecord(input,
|
|
7505
|
-
var newInit = _self.includeCorrelationHeaders(fetchData, input,
|
|
7506
|
-
if (newInit !==
|
|
7504
|
+
fetchData = _createFetchRecord(input, init2);
|
|
7505
|
+
var newInit = _self.includeCorrelationHeaders(fetchData, input, init2);
|
|
7506
|
+
if (newInit !== init2) {
|
|
7507
7507
|
callDetails.set(1, newInit);
|
|
7508
7508
|
}
|
|
7509
7509
|
ctx.data = fetchData;
|
|
@@ -7542,8 +7542,8 @@ var AjaxMonitor = function(_super) {
|
|
|
7542
7542
|
_fetchInitialized = true;
|
|
7543
7543
|
} else if (isPolyfill) {
|
|
7544
7544
|
_hooks.push(InstrumentFunc(global2, strFetch, {
|
|
7545
|
-
req: function(callDetails, input,
|
|
7546
|
-
_isDisabledRequest(null, input,
|
|
7545
|
+
req: function(callDetails, input, init2) {
|
|
7546
|
+
_isDisabledRequest(null, input, init2);
|
|
7547
7547
|
}
|
|
7548
7548
|
}));
|
|
7549
7549
|
}
|
|
@@ -7607,7 +7607,7 @@ var AjaxMonitor = function(_super) {
|
|
|
7607
7607
|
_xhrInitialized = true;
|
|
7608
7608
|
}
|
|
7609
7609
|
}
|
|
7610
|
-
function _isDisabledRequest(xhr, request,
|
|
7610
|
+
function _isDisabledRequest(xhr, request, init2) {
|
|
7611
7611
|
var isDisabled = false;
|
|
7612
7612
|
var theUrl = ((!isString(request) ? (request || {}).url || "" : request) || "").toLowerCase();
|
|
7613
7613
|
arrForEach(_excludeRequestFromAutoTrackingPatterns, function(regex) {
|
|
@@ -7633,7 +7633,7 @@ var AjaxMonitor = function(_super) {
|
|
|
7633
7633
|
if (!isNullOrUndefined(xhr)) {
|
|
7634
7634
|
isDisabled = xhr[DisabledPropertyName] === true || theUrl[DisabledPropertyName] === true;
|
|
7635
7635
|
} else if (!isNullOrUndefined(request)) {
|
|
7636
|
-
isDisabled = (typeof request === "object" ? request[DisabledPropertyName] === true : false) || (
|
|
7636
|
+
isDisabled = (typeof request === "object" ? request[DisabledPropertyName] === true : false) || (init2 ? init2[DisabledPropertyName] === true : false);
|
|
7637
7637
|
}
|
|
7638
7638
|
if (!isDisabled && theUrl && isInternalApplicationInsightsEndpoint(theUrl)) {
|
|
7639
7639
|
isDisabled = true;
|
|
@@ -7841,7 +7841,7 @@ var AjaxMonitor = function(_super) {
|
|
|
7841
7841
|
}
|
|
7842
7842
|
})();
|
|
7843
7843
|
}
|
|
7844
|
-
function _createFetchRecord(input,
|
|
7844
|
+
function _createFetchRecord(input, init2) {
|
|
7845
7845
|
var traceID = _context && _context.telemetryTrace && _context.telemetryTrace.traceID || generateW3CId();
|
|
7846
7846
|
var spanID = generateW3CId().substr(0, 16);
|
|
7847
7847
|
var ajaxData = new ajaxRecord(traceID, spanID, _self[strDiagLog]());
|
|
@@ -7853,15 +7853,15 @@ var AjaxMonitor = function(_super) {
|
|
|
7853
7853
|
ajaxData.requestUrl = input;
|
|
7854
7854
|
}
|
|
7855
7855
|
var method = "GET";
|
|
7856
|
-
if (
|
|
7857
|
-
method =
|
|
7856
|
+
if (init2 && init2.method) {
|
|
7857
|
+
method = init2.method;
|
|
7858
7858
|
} else if (input && input instanceof Request) {
|
|
7859
7859
|
method = input.method;
|
|
7860
7860
|
}
|
|
7861
7861
|
ajaxData.method = method;
|
|
7862
7862
|
var requestHeaders = {};
|
|
7863
7863
|
if (_enableRequestHeaderTracking) {
|
|
7864
|
-
var headers = new Headers((
|
|
7864
|
+
var headers = new Headers((init2 ? init2.headers : 0) || (input instanceof Request ? input.headers || {} : {}));
|
|
7865
7865
|
headers.forEach(function(value, key) {
|
|
7866
7866
|
if (_canIncludeHeaders(key)) {
|
|
7867
7867
|
requestHeaders[key] = value;
|
|
@@ -8260,11 +8260,17 @@ var Initialization = function() {
|
|
|
8260
8260
|
})();
|
|
8261
8261
|
|
|
8262
8262
|
// src/plugins/insights.ts
|
|
8263
|
-
var insights
|
|
8264
|
-
|
|
8265
|
-
|
|
8266
|
-
|
|
8267
|
-
|
|
8263
|
+
var insights;
|
|
8264
|
+
var init = (key) => {
|
|
8265
|
+
console.log("Inicializando insights com key: " + key);
|
|
8266
|
+
insights = new Initialization({
|
|
8267
|
+
config: {
|
|
8268
|
+
instrumentationKey: key
|
|
8269
|
+
}
|
|
8270
|
+
});
|
|
8271
|
+
insights.loadAppInsights();
|
|
8272
|
+
return insights;
|
|
8273
|
+
};
|
|
8268
8274
|
var eventNames = {
|
|
8269
8275
|
START: "start",
|
|
8270
8276
|
FINISH: "finish",
|
|
@@ -8282,7 +8288,6 @@ var trackers = {
|
|
|
8282
8288
|
registerError: (proctoringId, description) => registerCustomEvent(eventNames.ERROR, { proctoringId, description }),
|
|
8283
8289
|
registerUploadVideo: (proctoringId, success, description) => registerCustomEvent(eventNames.UPLOAD_VIDEO, { proctoringId, success, description })
|
|
8284
8290
|
};
|
|
8285
|
-
insights.loadAppInsights();
|
|
8286
8291
|
|
|
8287
8292
|
// src/index.ts
|
|
8288
8293
|
var defaultProctoringOptions = {
|
|
@@ -8290,7 +8295,9 @@ var defaultProctoringOptions = {
|
|
|
8290
8295
|
microphoneId: void 0,
|
|
8291
8296
|
allowMultipleMonitors: false,
|
|
8292
8297
|
allowOnlyFirstMonitor: true,
|
|
8293
|
-
captureScreen: true
|
|
8298
|
+
captureScreen: true,
|
|
8299
|
+
proctoringType: "IMAGE",
|
|
8300
|
+
insights: ""
|
|
8294
8301
|
};
|
|
8295
8302
|
var azureBlobUrl = "";
|
|
8296
8303
|
var _captureScreen = true;
|
|
@@ -8418,11 +8425,12 @@ function useProctoring(proctoringOptions, proctoringConfig) {
|
|
|
8418
8425
|
return { cameraFile, screenFile };
|
|
8419
8426
|
};
|
|
8420
8427
|
async function start(options = defaultProctoringOptions) {
|
|
8421
|
-
const { cameraId, microphoneId, allowOnlyFirstMonitor = true, allowMultipleMonitors = false, captureScreen = true } = options;
|
|
8428
|
+
const { cameraId, microphoneId, allowOnlyFirstMonitor = true, allowMultipleMonitors = false, captureScreen = true, proctoringType } = options;
|
|
8422
8429
|
if (proctoringConfig != void 0) {
|
|
8423
8430
|
setConfiguration(proctoringConfig.account, proctoringConfig.containerName, proctoringConfig.sas);
|
|
8424
8431
|
azureBlobUrl = proctoringConfig.azureBlobUrl;
|
|
8425
8432
|
setBaseUrl(proctoringConfig.baseUrl);
|
|
8433
|
+
init(proctoringConfig.insights);
|
|
8426
8434
|
} else {
|
|
8427
8435
|
const config = await makeRequest({
|
|
8428
8436
|
url: `/AzureKey`,
|
|
@@ -8432,6 +8440,7 @@ function useProctoring(proctoringOptions, proctoringConfig) {
|
|
|
8432
8440
|
setConfiguration(config.account, config.containerName, config.sas);
|
|
8433
8441
|
azureBlobUrl = config.azureBlobUrl;
|
|
8434
8442
|
setBaseUrl(config.baseUrl);
|
|
8443
|
+
init(config.insights);
|
|
8435
8444
|
}
|
|
8436
8445
|
if (!allowMultipleMonitors) {
|
|
8437
8446
|
const hasMultipleMonitors = await checkIfhasMultipleMonitors();
|
|
@@ -8444,13 +8453,13 @@ function useProctoring(proctoringOptions, proctoringConfig) {
|
|
|
8444
8453
|
throw PROCTORING_ALREADY_STARTED;
|
|
8445
8454
|
}
|
|
8446
8455
|
try {
|
|
8447
|
-
const { cameraStream, _screenStream } = await _startCapture({ cameraId, microphoneId, allowOnlyFirstMonitor, captureScreen });
|
|
8456
|
+
const { cameraStream, _screenStream } = await _startCapture({ cameraId, microphoneId, allowOnlyFirstMonitor, captureScreen, proctoringType });
|
|
8448
8457
|
startTime = Date.now();
|
|
8449
8458
|
startDate = new Date();
|
|
8450
8459
|
const resp = await makeRequest({
|
|
8451
8460
|
url: `/proctoring/start/${proctoringOptions.examId}`,
|
|
8452
8461
|
method: "POST",
|
|
8453
|
-
body: { clientId: proctoringOptions.clientId },
|
|
8462
|
+
body: { clientId: proctoringOptions.clientId, proctoringType },
|
|
8454
8463
|
jwt: proctoringOptions.token
|
|
8455
8464
|
});
|
|
8456
8465
|
resp.cameraStream = cameraStream;
|
|
@@ -8490,7 +8499,7 @@ function useProctoring(proctoringOptions, proctoringConfig) {
|
|
|
8490
8499
|
}
|
|
8491
8500
|
async function resume(options = defaultProctoringOptions) {
|
|
8492
8501
|
_clear();
|
|
8493
|
-
const { cameraId, microphoneId, allowOnlyFirstMonitor = true, allowMultipleMonitors = false, captureScreen = true } = options;
|
|
8502
|
+
const { cameraId, microphoneId, allowOnlyFirstMonitor = true, allowMultipleMonitors = false, captureScreen = true, proctoringType } = options;
|
|
8494
8503
|
if (!allowMultipleMonitors) {
|
|
8495
8504
|
const hasMultipleMonitors = await checkIfhasMultipleMonitors();
|
|
8496
8505
|
if (hasMultipleMonitors) {
|
|
@@ -8504,7 +8513,7 @@ function useProctoring(proctoringOptions, proctoringConfig) {
|
|
|
8504
8513
|
if (!record) {
|
|
8505
8514
|
throw PROCTORING_NOT_STARTED;
|
|
8506
8515
|
}
|
|
8507
|
-
const { cameraStream, _screenStream } = await _startCapture({ cameraId, microphoneId, allowOnlyFirstMonitor, captureScreen });
|
|
8516
|
+
const { cameraStream, _screenStream } = await _startCapture({ cameraId, microphoneId, allowOnlyFirstMonitor, captureScreen, proctoringType });
|
|
8508
8517
|
proctoringId = record.id;
|
|
8509
8518
|
startTime = Date.now();
|
|
8510
8519
|
startDate = new Date();
|
package/index.d.ts
CHANGED
|
@@ -7,6 +7,8 @@ interface ProctoringOptions {
|
|
|
7
7
|
allowMultipleMonitors?: boolean;
|
|
8
8
|
allowOnlyFirstMonitor?: boolean;
|
|
9
9
|
captureScreen?: boolean;
|
|
10
|
+
proctoringType: "VIDEO" | "IMAGE";
|
|
11
|
+
insights: string;
|
|
10
12
|
}
|
|
11
13
|
interface ProctoringConfig {
|
|
12
14
|
azureBlobUrl: string;
|
|
@@ -14,6 +16,7 @@ interface ProctoringConfig {
|
|
|
14
16
|
account: string;
|
|
15
17
|
containerName: string;
|
|
16
18
|
sas: string;
|
|
19
|
+
insights: string;
|
|
17
20
|
}
|
|
18
21
|
export declare function useProctoring(proctoringOptions: {
|
|
19
22
|
examId: string;
|
package/index.js
CHANGED
|
@@ -6137,17 +6137,17 @@ var require_applicationinsights_web = __commonJS({
|
|
|
6137
6137
|
arrForEach(objKeys(_headers), function(headerName) {
|
|
6138
6138
|
requestHeaders.append(headerName, _headers[headerName]);
|
|
6139
6139
|
});
|
|
6140
|
-
var
|
|
6140
|
+
var init2 = (_a2 = {
|
|
6141
6141
|
method: "POST",
|
|
6142
6142
|
headers: requestHeaders,
|
|
6143
6143
|
body: plainTextBatch
|
|
6144
6144
|
}, _a2[DisabledPropertyName] = true, _a2);
|
|
6145
6145
|
if (!isAsync) {
|
|
6146
|
-
|
|
6146
|
+
init2.keepalive = true;
|
|
6147
6147
|
ignoreResponse = true;
|
|
6148
6148
|
_syncFetchPayload += batchLength;
|
|
6149
6149
|
}
|
|
6150
|
-
var request = new Request(endPointUrl,
|
|
6150
|
+
var request = new Request(endPointUrl, init2);
|
|
6151
6151
|
try {
|
|
6152
6152
|
request[DisabledPropertyName] = true;
|
|
6153
6153
|
} catch (e) {
|
|
@@ -7236,37 +7236,37 @@ var require_applicationinsights_web = __commonJS({
|
|
|
7236
7236
|
_self.trackDependencyData = function(dependency, properties) {
|
|
7237
7237
|
_self[strTrackDependencyDataInternal](dependency, properties);
|
|
7238
7238
|
};
|
|
7239
|
-
_self.includeCorrelationHeaders = function(ajaxData, input,
|
|
7239
|
+
_self.includeCorrelationHeaders = function(ajaxData, input, init2, xhr) {
|
|
7240
7240
|
var currentWindowHost = _self["_currentWindowHost"] || _currentWindowHost;
|
|
7241
7241
|
if (input) {
|
|
7242
7242
|
if (CorrelationIdHelper.canIncludeCorrelationHeader(_config, ajaxData.getAbsoluteUrl(), currentWindowHost)) {
|
|
7243
|
-
if (!
|
|
7244
|
-
|
|
7243
|
+
if (!init2) {
|
|
7244
|
+
init2 = {};
|
|
7245
7245
|
}
|
|
7246
|
-
|
|
7246
|
+
init2.headers = new Headers(init2.headers || (input instanceof Request ? input.headers || {} : {}));
|
|
7247
7247
|
if (_isUsingAIHeaders) {
|
|
7248
7248
|
var id = "|" + ajaxData.traceID + "." + ajaxData.spanID;
|
|
7249
|
-
|
|
7249
|
+
init2.headers.set(RequestHeaders.requestIdHeader, id);
|
|
7250
7250
|
if (_enableRequestHeaderTracking) {
|
|
7251
7251
|
ajaxData.requestHeaders[RequestHeaders.requestIdHeader] = id;
|
|
7252
7252
|
}
|
|
7253
7253
|
}
|
|
7254
7254
|
var appId = _config.appId || _context && _context.appId();
|
|
7255
7255
|
if (appId) {
|
|
7256
|
-
|
|
7256
|
+
init2.headers.set(RequestHeaders.requestContextHeader, RequestHeaders.requestContextAppIdFormat + appId);
|
|
7257
7257
|
if (_enableRequestHeaderTracking) {
|
|
7258
7258
|
ajaxData.requestHeaders[RequestHeaders.requestContextHeader] = RequestHeaders.requestContextAppIdFormat + appId;
|
|
7259
7259
|
}
|
|
7260
7260
|
}
|
|
7261
7261
|
if (_isUsingW3CHeaders) {
|
|
7262
7262
|
var traceparent = new Traceparent(ajaxData.traceID, ajaxData.spanID);
|
|
7263
|
-
|
|
7263
|
+
init2.headers.set(RequestHeaders.traceParentHeader, traceparent.toString());
|
|
7264
7264
|
if (_enableRequestHeaderTracking) {
|
|
7265
7265
|
ajaxData.requestHeaders[RequestHeaders.traceParentHeader] = traceparent.toString();
|
|
7266
7266
|
}
|
|
7267
7267
|
}
|
|
7268
7268
|
}
|
|
7269
|
-
return
|
|
7269
|
+
return init2;
|
|
7270
7270
|
} else if (xhr) {
|
|
7271
7271
|
if (CorrelationIdHelper.canIncludeCorrelationHeader(_config, ajaxData.getAbsoluteUrl(), currentWindowHost)) {
|
|
7272
7272
|
if (_isUsingAIHeaders) {
|
|
@@ -7331,13 +7331,13 @@ var require_applicationinsights_web = __commonJS({
|
|
|
7331
7331
|
var isPolyfill = fetch2.polyfill;
|
|
7332
7332
|
if (_config.disableFetchTracking === false) {
|
|
7333
7333
|
_hooks.push(InstrumentFunc(global2, strFetch, {
|
|
7334
|
-
req: function(callDetails, input,
|
|
7334
|
+
req: function(callDetails, input, init2) {
|
|
7335
7335
|
var fetchData;
|
|
7336
|
-
if (_fetchInitialized && !_isDisabledRequest(null, input,
|
|
7336
|
+
if (_fetchInitialized && !_isDisabledRequest(null, input, init2) && !(isPolyfill && _xhrInitialized)) {
|
|
7337
7337
|
var ctx = callDetails.ctx();
|
|
7338
|
-
fetchData = _createFetchRecord(input,
|
|
7339
|
-
var newInit = _self.includeCorrelationHeaders(fetchData, input,
|
|
7340
|
-
if (newInit !==
|
|
7338
|
+
fetchData = _createFetchRecord(input, init2);
|
|
7339
|
+
var newInit = _self.includeCorrelationHeaders(fetchData, input, init2);
|
|
7340
|
+
if (newInit !== init2) {
|
|
7341
7341
|
callDetails.set(1, newInit);
|
|
7342
7342
|
}
|
|
7343
7343
|
ctx.data = fetchData;
|
|
@@ -7376,8 +7376,8 @@ var require_applicationinsights_web = __commonJS({
|
|
|
7376
7376
|
_fetchInitialized = true;
|
|
7377
7377
|
} else if (isPolyfill) {
|
|
7378
7378
|
_hooks.push(InstrumentFunc(global2, strFetch, {
|
|
7379
|
-
req: function(callDetails, input,
|
|
7380
|
-
_isDisabledRequest(null, input,
|
|
7379
|
+
req: function(callDetails, input, init2) {
|
|
7380
|
+
_isDisabledRequest(null, input, init2);
|
|
7381
7381
|
}
|
|
7382
7382
|
}));
|
|
7383
7383
|
}
|
|
@@ -7441,7 +7441,7 @@ var require_applicationinsights_web = __commonJS({
|
|
|
7441
7441
|
_xhrInitialized = true;
|
|
7442
7442
|
}
|
|
7443
7443
|
}
|
|
7444
|
-
function _isDisabledRequest(xhr, request,
|
|
7444
|
+
function _isDisabledRequest(xhr, request, init2) {
|
|
7445
7445
|
var isDisabled = false;
|
|
7446
7446
|
var theUrl = ((!isString(request) ? (request || {}).url || "" : request) || "").toLowerCase();
|
|
7447
7447
|
arrForEach(_excludeRequestFromAutoTrackingPatterns, function(regex) {
|
|
@@ -7467,7 +7467,7 @@ var require_applicationinsights_web = __commonJS({
|
|
|
7467
7467
|
if (!isNullOrUndefined(xhr)) {
|
|
7468
7468
|
isDisabled = xhr[DisabledPropertyName] === true || theUrl[DisabledPropertyName] === true;
|
|
7469
7469
|
} else if (!isNullOrUndefined(request)) {
|
|
7470
|
-
isDisabled = (typeof request === "object" ? request[DisabledPropertyName] === true : false) || (
|
|
7470
|
+
isDisabled = (typeof request === "object" ? request[DisabledPropertyName] === true : false) || (init2 ? init2[DisabledPropertyName] === true : false);
|
|
7471
7471
|
}
|
|
7472
7472
|
if (!isDisabled && theUrl && isInternalApplicationInsightsEndpoint(theUrl)) {
|
|
7473
7473
|
isDisabled = true;
|
|
@@ -7675,7 +7675,7 @@ var require_applicationinsights_web = __commonJS({
|
|
|
7675
7675
|
}
|
|
7676
7676
|
})();
|
|
7677
7677
|
}
|
|
7678
|
-
function _createFetchRecord(input,
|
|
7678
|
+
function _createFetchRecord(input, init2) {
|
|
7679
7679
|
var traceID = _context && _context.telemetryTrace && _context.telemetryTrace.traceID || generateW3CId();
|
|
7680
7680
|
var spanID = generateW3CId().substr(0, 16);
|
|
7681
7681
|
var ajaxData = new ajaxRecord(traceID, spanID, _self[strDiagLog]());
|
|
@@ -7687,15 +7687,15 @@ var require_applicationinsights_web = __commonJS({
|
|
|
7687
7687
|
ajaxData.requestUrl = input;
|
|
7688
7688
|
}
|
|
7689
7689
|
var method = "GET";
|
|
7690
|
-
if (
|
|
7691
|
-
method =
|
|
7690
|
+
if (init2 && init2.method) {
|
|
7691
|
+
method = init2.method;
|
|
7692
7692
|
} else if (input && input instanceof Request) {
|
|
7693
7693
|
method = input.method;
|
|
7694
7694
|
}
|
|
7695
7695
|
ajaxData.method = method;
|
|
7696
7696
|
var requestHeaders = {};
|
|
7697
7697
|
if (_enableRequestHeaderTracking) {
|
|
7698
|
-
var headers = new Headers((
|
|
7698
|
+
var headers = new Headers((init2 ? init2.headers : 0) || (input instanceof Request ? input.headers || {} : {}));
|
|
7699
7699
|
headers.forEach(function(value, key) {
|
|
7700
7700
|
if (_canIncludeHeaders(key)) {
|
|
7701
7701
|
requestHeaders[key] = value;
|
|
@@ -8600,11 +8600,17 @@ async function clearBuffers(table) {
|
|
|
8600
8600
|
|
|
8601
8601
|
// src/plugins/insights.ts
|
|
8602
8602
|
var import_applicationinsights_web = __toModule(require_applicationinsights_web());
|
|
8603
|
-
var insights
|
|
8604
|
-
|
|
8605
|
-
|
|
8606
|
-
|
|
8607
|
-
|
|
8603
|
+
var insights;
|
|
8604
|
+
var init = (key) => {
|
|
8605
|
+
console.log("Inicializando insights com key: " + key);
|
|
8606
|
+
insights = new import_applicationinsights_web.ApplicationInsights({
|
|
8607
|
+
config: {
|
|
8608
|
+
instrumentationKey: key
|
|
8609
|
+
}
|
|
8610
|
+
});
|
|
8611
|
+
insights.loadAppInsights();
|
|
8612
|
+
return insights;
|
|
8613
|
+
};
|
|
8608
8614
|
var eventNames = {
|
|
8609
8615
|
START: "start",
|
|
8610
8616
|
FINISH: "finish",
|
|
@@ -8622,7 +8628,6 @@ var trackers = {
|
|
|
8622
8628
|
registerError: (proctoringId, description) => registerCustomEvent(eventNames.ERROR, { proctoringId, description }),
|
|
8623
8629
|
registerUploadVideo: (proctoringId, success, description) => registerCustomEvent(eventNames.UPLOAD_VIDEO, { proctoringId, success, description })
|
|
8624
8630
|
};
|
|
8625
|
-
insights.loadAppInsights();
|
|
8626
8631
|
|
|
8627
8632
|
// src/index.ts
|
|
8628
8633
|
var defaultProctoringOptions = {
|
|
@@ -8630,7 +8635,9 @@ var defaultProctoringOptions = {
|
|
|
8630
8635
|
microphoneId: void 0,
|
|
8631
8636
|
allowMultipleMonitors: false,
|
|
8632
8637
|
allowOnlyFirstMonitor: true,
|
|
8633
|
-
captureScreen: true
|
|
8638
|
+
captureScreen: true,
|
|
8639
|
+
proctoringType: "IMAGE",
|
|
8640
|
+
insights: ""
|
|
8634
8641
|
};
|
|
8635
8642
|
var azureBlobUrl = "";
|
|
8636
8643
|
var _captureScreen = true;
|
|
@@ -8758,11 +8765,12 @@ function useProctoring(proctoringOptions, proctoringConfig) {
|
|
|
8758
8765
|
return { cameraFile, screenFile };
|
|
8759
8766
|
};
|
|
8760
8767
|
async function start(options = defaultProctoringOptions) {
|
|
8761
|
-
const { cameraId, microphoneId, allowOnlyFirstMonitor = true, allowMultipleMonitors = false, captureScreen = true } = options;
|
|
8768
|
+
const { cameraId, microphoneId, allowOnlyFirstMonitor = true, allowMultipleMonitors = false, captureScreen = true, proctoringType } = options;
|
|
8762
8769
|
if (proctoringConfig != void 0) {
|
|
8763
8770
|
setConfiguration(proctoringConfig.account, proctoringConfig.containerName, proctoringConfig.sas);
|
|
8764
8771
|
azureBlobUrl = proctoringConfig.azureBlobUrl;
|
|
8765
8772
|
setBaseUrl(proctoringConfig.baseUrl);
|
|
8773
|
+
init(proctoringConfig.insights);
|
|
8766
8774
|
} else {
|
|
8767
8775
|
const config = await makeRequest({
|
|
8768
8776
|
url: `/AzureKey`,
|
|
@@ -8772,6 +8780,7 @@ function useProctoring(proctoringOptions, proctoringConfig) {
|
|
|
8772
8780
|
setConfiguration(config.account, config.containerName, config.sas);
|
|
8773
8781
|
azureBlobUrl = config.azureBlobUrl;
|
|
8774
8782
|
setBaseUrl(config.baseUrl);
|
|
8783
|
+
init(config.insights);
|
|
8775
8784
|
}
|
|
8776
8785
|
if (!allowMultipleMonitors) {
|
|
8777
8786
|
const hasMultipleMonitors = await checkIfhasMultipleMonitors();
|
|
@@ -8784,13 +8793,13 @@ function useProctoring(proctoringOptions, proctoringConfig) {
|
|
|
8784
8793
|
throw PROCTORING_ALREADY_STARTED;
|
|
8785
8794
|
}
|
|
8786
8795
|
try {
|
|
8787
|
-
const { cameraStream, _screenStream } = await _startCapture({ cameraId, microphoneId, allowOnlyFirstMonitor, captureScreen });
|
|
8796
|
+
const { cameraStream, _screenStream } = await _startCapture({ cameraId, microphoneId, allowOnlyFirstMonitor, captureScreen, proctoringType });
|
|
8788
8797
|
startTime = Date.now();
|
|
8789
8798
|
startDate = new Date();
|
|
8790
8799
|
const resp = await makeRequest({
|
|
8791
8800
|
url: `/proctoring/start/${proctoringOptions.examId}`,
|
|
8792
8801
|
method: "POST",
|
|
8793
|
-
body: { clientId: proctoringOptions.clientId },
|
|
8802
|
+
body: { clientId: proctoringOptions.clientId, proctoringType },
|
|
8794
8803
|
jwt: proctoringOptions.token
|
|
8795
8804
|
});
|
|
8796
8805
|
resp.cameraStream = cameraStream;
|
|
@@ -8830,7 +8839,7 @@ function useProctoring(proctoringOptions, proctoringConfig) {
|
|
|
8830
8839
|
}
|
|
8831
8840
|
async function resume(options = defaultProctoringOptions) {
|
|
8832
8841
|
_clear();
|
|
8833
|
-
const { cameraId, microphoneId, allowOnlyFirstMonitor = true, allowMultipleMonitors = false, captureScreen = true } = options;
|
|
8842
|
+
const { cameraId, microphoneId, allowOnlyFirstMonitor = true, allowMultipleMonitors = false, captureScreen = true, proctoringType } = options;
|
|
8834
8843
|
if (!allowMultipleMonitors) {
|
|
8835
8844
|
const hasMultipleMonitors = await checkIfhasMultipleMonitors();
|
|
8836
8845
|
if (hasMultipleMonitors) {
|
|
@@ -8844,7 +8853,7 @@ function useProctoring(proctoringOptions, proctoringConfig) {
|
|
|
8844
8853
|
if (!record) {
|
|
8845
8854
|
throw PROCTORING_NOT_STARTED;
|
|
8846
8855
|
}
|
|
8847
|
-
const { cameraStream, _screenStream } = await _startCapture({ cameraId, microphoneId, allowOnlyFirstMonitor, captureScreen });
|
|
8856
|
+
const { cameraStream, _screenStream } = await _startCapture({ cameraId, microphoneId, allowOnlyFirstMonitor, captureScreen, proctoringType });
|
|
8848
8857
|
proctoringId = record.id;
|
|
8849
8858
|
startTime = Date.now();
|
|
8850
8859
|
startDate = new Date();
|
package/package.json
CHANGED
package/plugins/insights.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { ApplicationInsights } from '@microsoft/applicationinsights-web';
|
|
2
|
-
declare const
|
|
2
|
+
declare const init: (key: string) => ApplicationInsights;
|
|
3
3
|
declare const trackers: {
|
|
4
4
|
trackPage: (name: string, uri: string, properties?: {
|
|
5
5
|
[key: string]: any;
|
|
@@ -10,5 +10,4 @@ declare const trackers: {
|
|
|
10
10
|
registerError: (proctoringId: string, description: string) => void;
|
|
11
11
|
registerUploadVideo: (proctoringId: string, success: boolean, description: string) => void;
|
|
12
12
|
};
|
|
13
|
-
export
|
|
14
|
-
export { trackers };
|
|
13
|
+
export { trackers, init };
|