easyproctor 2.1.1 → 2.2.0
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/README.md +6 -0
- package/errors/errors.d.ts +1 -0
- package/esm/index.js +817 -148
- package/index.js +817 -148
- package/interfaces/ParamsConfig.d.ts +3 -0
- package/modules/SpyCam.d.ts +31 -0
- package/new-flow/backend/BackendService.d.ts +3 -1
- package/new-flow/backend/SpyCamBackendService.d.ts +27 -0
- package/new-flow/checkers/DeviceCheckerService.d.ts +5 -0
- package/new-flow/checkers/DeviceCheckerUI.d.ts +2 -0
- package/new-flow/proctoring/ProctoringSession.d.ts +12 -2
- package/new-flow/recorders/CameraRecorder.d.ts +6 -2
- package/new-flow/recorders/IRecorder.d.ts +3 -1
- package/package.json +2 -2
- package/plugins/insights.d.ts +1 -2
- package/plugins/recorder.d.ts +3 -2
- package/proctoring/SignTerm.d.ts +15 -0
- package/proctoring/options/ProctoringOptions.d.ts +1 -0
- package/proctoring/proctoring.d.ts +2 -1
- package/proctoring/useProctoring.d.ts +2 -1
- package/unpkg/easyproctor.min.js +28 -28
package/index.js
CHANGED
|
@@ -15213,40 +15213,6 @@ var FaceDetection = class extends BaseDetection {
|
|
|
15213
15213
|
}
|
|
15214
15214
|
};
|
|
15215
15215
|
|
|
15216
|
-
// src/proctoring/options/ProctoringOptions.ts
|
|
15217
|
-
var getDefaultProctoringOptions = {
|
|
15218
|
-
cameraId: void 0,
|
|
15219
|
-
microphoneId: void 0,
|
|
15220
|
-
allowMultipleMonitors: false,
|
|
15221
|
-
allowOnlyFirstMonitor: true,
|
|
15222
|
-
captureScreen: true,
|
|
15223
|
-
noiseLimit: 40,
|
|
15224
|
-
proctoringType: "IMAGE",
|
|
15225
|
-
insights: "",
|
|
15226
|
-
onBufferSizeError: false,
|
|
15227
|
-
useGeolocation: false
|
|
15228
|
-
};
|
|
15229
|
-
|
|
15230
|
-
// src/proctoring/options/ProctoringVideoOptions.ts
|
|
15231
|
-
function validatePartialVideoOptions(options) {
|
|
15232
|
-
if (!!options.width && !!options.height) {
|
|
15233
|
-
return {
|
|
15234
|
-
width: options.width,
|
|
15235
|
-
height: options.height,
|
|
15236
|
-
minWidth: options.minWidth,
|
|
15237
|
-
minHeight: options.minHeight
|
|
15238
|
-
};
|
|
15239
|
-
} else {
|
|
15240
|
-
return { width: 640, height: 480 };
|
|
15241
|
-
}
|
|
15242
|
-
}
|
|
15243
|
-
var getDefaultProctoringVideoOptions = {
|
|
15244
|
-
width: 1280,
|
|
15245
|
-
height: 720,
|
|
15246
|
-
minWidth: 640,
|
|
15247
|
-
minHeight: 480
|
|
15248
|
-
};
|
|
15249
|
-
|
|
15250
15216
|
// node_modules/axios/lib/helpers/bind.js
|
|
15251
15217
|
function bind(fn3, thisArg) {
|
|
15252
15218
|
return function wrap() {
|
|
@@ -18172,21 +18138,21 @@ var BackendService = class {
|
|
|
18172
18138
|
});
|
|
18173
18139
|
return url2.data;
|
|
18174
18140
|
}
|
|
18175
|
-
async getSignedUrl(token, file,
|
|
18141
|
+
async getSignedUrl(token, file, proctoringId2) {
|
|
18176
18142
|
const url2 = await this.makeRequestAxios({
|
|
18177
18143
|
path: `/upload/signed-url`,
|
|
18178
18144
|
method: "POST",
|
|
18179
18145
|
jwt: token,
|
|
18180
18146
|
body: {
|
|
18181
|
-
objectName: `${
|
|
18147
|
+
objectName: `${proctoringId2}/${file.name}`,
|
|
18182
18148
|
contentType: file.type
|
|
18183
18149
|
}
|
|
18184
18150
|
});
|
|
18185
18151
|
return url2.data;
|
|
18186
18152
|
}
|
|
18187
|
-
async
|
|
18153
|
+
async saveAlerts(proctoringOptions, proctoringSession) {
|
|
18188
18154
|
await this.makeRequest({
|
|
18189
|
-
path: "/proctoring/save-
|
|
18155
|
+
path: "/proctoring/save-alerts",
|
|
18190
18156
|
method: "POST",
|
|
18191
18157
|
jwt: proctoringOptions.token,
|
|
18192
18158
|
body: {
|
|
@@ -18226,6 +18192,22 @@ var BackendService = class {
|
|
|
18226
18192
|
jwt: this.token
|
|
18227
18193
|
});
|
|
18228
18194
|
}
|
|
18195
|
+
async signTerm() {
|
|
18196
|
+
return await this.makeRequest({
|
|
18197
|
+
path: `/User/sign-terms`,
|
|
18198
|
+
method: "PATCH",
|
|
18199
|
+
body: {},
|
|
18200
|
+
jwt: this.token
|
|
18201
|
+
});
|
|
18202
|
+
}
|
|
18203
|
+
async signTermUrl() {
|
|
18204
|
+
const result = await this.makeRequestAxios({
|
|
18205
|
+
path: `/User/sign-terms-url`,
|
|
18206
|
+
method: "GET",
|
|
18207
|
+
jwt: this.token
|
|
18208
|
+
});
|
|
18209
|
+
return result.data;
|
|
18210
|
+
}
|
|
18229
18211
|
async getServerHour(token) {
|
|
18230
18212
|
return await this.makeRequest({
|
|
18231
18213
|
path: `/Proctoring/server-hour`,
|
|
@@ -18293,6 +18275,77 @@ var BackendService = class {
|
|
|
18293
18275
|
}
|
|
18294
18276
|
};
|
|
18295
18277
|
|
|
18278
|
+
// src/new-flow/backend/SpyCamBackendService.ts
|
|
18279
|
+
var SpyCamBackendService = class {
|
|
18280
|
+
constructor() {
|
|
18281
|
+
this.baseUrl = "https://localhost:5080";
|
|
18282
|
+
}
|
|
18283
|
+
async isAlive() {
|
|
18284
|
+
const paramsConfig = await this.makeRequestAxios({
|
|
18285
|
+
path: `/api/usb-device-manager/is-alive`,
|
|
18286
|
+
method: "GET",
|
|
18287
|
+
jwt: this.token
|
|
18288
|
+
}).catch((error) => {
|
|
18289
|
+
throw "N\xE3o foi poss\xEDvel realizar a requisi\xE7\xE3o, tente novamente mais tarde";
|
|
18290
|
+
});
|
|
18291
|
+
return paramsConfig.data;
|
|
18292
|
+
}
|
|
18293
|
+
async isPluggedIn() {
|
|
18294
|
+
const paramsConfig = await this.makeRequestAxios({
|
|
18295
|
+
path: `/api/usb-device-manager/is-plugged-in`,
|
|
18296
|
+
method: "GET",
|
|
18297
|
+
jwt: this.token
|
|
18298
|
+
}).catch((error) => {
|
|
18299
|
+
throw "N\xE3o foi poss\xEDvel realizar a requisi\xE7\xE3o, tente novamente mais tarde";
|
|
18300
|
+
});
|
|
18301
|
+
return paramsConfig.data;
|
|
18302
|
+
}
|
|
18303
|
+
async ConnectAndScan() {
|
|
18304
|
+
const paramsConfig = await this.makeRequestAxios({
|
|
18305
|
+
path: `/api/usb-device-manager/connect-and-scan`,
|
|
18306
|
+
method: "GET",
|
|
18307
|
+
jwt: this.token
|
|
18308
|
+
}).catch((error) => {
|
|
18309
|
+
throw "N\xE3o foi poss\xEDvel realizar a requisi\xE7\xE3o, tente novamente mais tarde";
|
|
18310
|
+
});
|
|
18311
|
+
return paramsConfig.data;
|
|
18312
|
+
}
|
|
18313
|
+
async Devices({
|
|
18314
|
+
deviceType,
|
|
18315
|
+
rssiThreshold,
|
|
18316
|
+
packageRateThreshold
|
|
18317
|
+
}) {
|
|
18318
|
+
const queryParams = [];
|
|
18319
|
+
deviceType && queryParams.push(`deviceType=${deviceType}`);
|
|
18320
|
+
rssiThreshold && queryParams.push(`rssiThreshold=${rssiThreshold}`);
|
|
18321
|
+
packageRateThreshold && queryParams.push(`packageRateThreshold=${packageRateThreshold}`);
|
|
18322
|
+
const paramsConfig = await this.makeRequestAxios({
|
|
18323
|
+
path: `/api/usb-device-manager/devices?${queryParams.join("&")}`,
|
|
18324
|
+
method: "GET",
|
|
18325
|
+
jwt: this.token
|
|
18326
|
+
}).catch((error) => {
|
|
18327
|
+
throw "N\xE3o foi poss\xEDvel realizar a requisi\xE7\xE3o, tente novamente mais tarde";
|
|
18328
|
+
});
|
|
18329
|
+
return paramsConfig.data;
|
|
18330
|
+
}
|
|
18331
|
+
async makeRequestAxios(data) {
|
|
18332
|
+
const { path, method, body, jwt } = data;
|
|
18333
|
+
const resp = await axios_default.request({
|
|
18334
|
+
url: this.baseUrl + path,
|
|
18335
|
+
method,
|
|
18336
|
+
headers: {
|
|
18337
|
+
Authorization: `Bearer ${jwt}`,
|
|
18338
|
+
"Access-Control-Allow-Origin": "*"
|
|
18339
|
+
},
|
|
18340
|
+
data: body
|
|
18341
|
+
});
|
|
18342
|
+
if (resp.status >= 400) {
|
|
18343
|
+
throw "N\xE3o foi poss\xEDvel realizar a requisi\xE7\xE3o, tente novamente mais tarde";
|
|
18344
|
+
}
|
|
18345
|
+
return resp;
|
|
18346
|
+
}
|
|
18347
|
+
};
|
|
18348
|
+
|
|
18296
18349
|
// src/new-flow/proctoring/ProctoringSession.ts
|
|
18297
18350
|
var ProctoringSession = class {
|
|
18298
18351
|
constructor() {
|
|
@@ -18324,8 +18377,8 @@ var ProctoringSession = class {
|
|
|
18324
18377
|
this.state = "Ended" /* Ended */;
|
|
18325
18378
|
this.sessionDuration = Date.now() - this.startedAt.getTime();
|
|
18326
18379
|
}
|
|
18327
|
-
setProctoringId(
|
|
18328
|
-
this.id =
|
|
18380
|
+
setProctoringId(proctoringId2) {
|
|
18381
|
+
this.id = proctoringId2;
|
|
18329
18382
|
}
|
|
18330
18383
|
setEndConfirmed() {
|
|
18331
18384
|
this.state = "EndConfirmed" /* EndConfirmed */;
|
|
@@ -18344,6 +18397,164 @@ var ProctoringSession = class {
|
|
|
18344
18397
|
}
|
|
18345
18398
|
};
|
|
18346
18399
|
|
|
18400
|
+
// src/modules/SpyCam.ts
|
|
18401
|
+
var SpyCam = class {
|
|
18402
|
+
constructor(context, options) {
|
|
18403
|
+
this.backendService = new SpyCamBackendService();
|
|
18404
|
+
this.scanInterval = 5;
|
|
18405
|
+
this.options = {};
|
|
18406
|
+
this.options = options;
|
|
18407
|
+
this.context = context;
|
|
18408
|
+
this.backend = new BackendService({
|
|
18409
|
+
type: (context == null ? void 0 : context.type) || "prod",
|
|
18410
|
+
token: context.token
|
|
18411
|
+
});
|
|
18412
|
+
this.currentIsPlugged = true;
|
|
18413
|
+
}
|
|
18414
|
+
setProctoringId(proctoringId2) {
|
|
18415
|
+
this.proctoringId = proctoringId2;
|
|
18416
|
+
}
|
|
18417
|
+
async isPluggedIn(sendEvent = false) {
|
|
18418
|
+
var _a2, _b, _c2, _d;
|
|
18419
|
+
try {
|
|
18420
|
+
const isPlugged = await this.backendService.isPluggedIn();
|
|
18421
|
+
if (this.proctoringId && sendEvent) {
|
|
18422
|
+
if (isPlugged) {
|
|
18423
|
+
if (!this.currentIsPlugged) {
|
|
18424
|
+
(_b = (_a2 = this.options).onRealtimeAlertsCallback) == null ? void 0 : _b.call(_a2, {
|
|
18425
|
+
type: "spycam",
|
|
18426
|
+
message: "Spycam disconnected",
|
|
18427
|
+
description: "Dispositivo de varredura conectado.",
|
|
18428
|
+
status: "OK"
|
|
18429
|
+
});
|
|
18430
|
+
}
|
|
18431
|
+
} else {
|
|
18432
|
+
const session = new ProctoringSession();
|
|
18433
|
+
session.setProctoringId(this.proctoringId);
|
|
18434
|
+
session.addAlert({
|
|
18435
|
+
begin: Date.now() - this.startTime.getTime(),
|
|
18436
|
+
end: 0,
|
|
18437
|
+
alert: 33 /* SpyDeviceDisconnected */,
|
|
18438
|
+
type: 5 /* Environment */
|
|
18439
|
+
});
|
|
18440
|
+
await this.backend.saveAlerts(this.context, session);
|
|
18441
|
+
(_d = (_c2 = this.options).onRealtimeAlertsCallback) == null ? void 0 : _d.call(_c2, {
|
|
18442
|
+
type: "spycam",
|
|
18443
|
+
message: "Spycam disconnected",
|
|
18444
|
+
description: "Nenhum dispositivo de varredura conectado.",
|
|
18445
|
+
status: "ALERT"
|
|
18446
|
+
});
|
|
18447
|
+
}
|
|
18448
|
+
}
|
|
18449
|
+
this.currentIsPlugged = isPlugged;
|
|
18450
|
+
return this.currentIsPlugged;
|
|
18451
|
+
} catch (error) {
|
|
18452
|
+
throw error;
|
|
18453
|
+
}
|
|
18454
|
+
}
|
|
18455
|
+
async isAlive() {
|
|
18456
|
+
try {
|
|
18457
|
+
return await this.backendService.isAlive();
|
|
18458
|
+
} catch (error) {
|
|
18459
|
+
throw error;
|
|
18460
|
+
}
|
|
18461
|
+
}
|
|
18462
|
+
connectAndScan() {
|
|
18463
|
+
return this.backendService.ConnectAndScan();
|
|
18464
|
+
}
|
|
18465
|
+
async devices({
|
|
18466
|
+
deviceType,
|
|
18467
|
+
rssiThreshold,
|
|
18468
|
+
packageRateThreshold
|
|
18469
|
+
}) {
|
|
18470
|
+
var _a2, _b;
|
|
18471
|
+
const devices = await this.backendService.Devices(
|
|
18472
|
+
{
|
|
18473
|
+
deviceType,
|
|
18474
|
+
rssiThreshold,
|
|
18475
|
+
packageRateThreshold
|
|
18476
|
+
}
|
|
18477
|
+
);
|
|
18478
|
+
if (devices.length > 0) {
|
|
18479
|
+
(_b = (_a2 = this.options).onRealtimeAlertsCallback) == null ? void 0 : _b.call(_a2, {
|
|
18480
|
+
type: "spycam",
|
|
18481
|
+
message: "Spycam detected",
|
|
18482
|
+
description: "Dispositivo espi\xE3o detectado.",
|
|
18483
|
+
data: devices
|
|
18484
|
+
});
|
|
18485
|
+
if (this.proctoringId) {
|
|
18486
|
+
const session = new ProctoringSession();
|
|
18487
|
+
session.setProctoringId(this.proctoringId);
|
|
18488
|
+
session.addAlert({
|
|
18489
|
+
begin: Date.now() - this.startTime.getTime(),
|
|
18490
|
+
end: 0,
|
|
18491
|
+
alert: 32 /* PotentialCamera */,
|
|
18492
|
+
type: 5 /* Environment */
|
|
18493
|
+
});
|
|
18494
|
+
await this.backend.saveAlerts(this.context, session);
|
|
18495
|
+
}
|
|
18496
|
+
}
|
|
18497
|
+
return devices;
|
|
18498
|
+
}
|
|
18499
|
+
async startCheckSpyCam(spyScanInterval, {
|
|
18500
|
+
deviceType,
|
|
18501
|
+
rssiThreshold,
|
|
18502
|
+
packageRateThreshold
|
|
18503
|
+
}) {
|
|
18504
|
+
this.scanInterval = spyScanInterval;
|
|
18505
|
+
this.startTime = new Date(Date.now());
|
|
18506
|
+
await this.isPluggedIn(true);
|
|
18507
|
+
this.checkSpyCam = setInterval(async () => {
|
|
18508
|
+
const isPlugged = await this.isPluggedIn(true);
|
|
18509
|
+
if (isPlugged) {
|
|
18510
|
+
await this.devices({
|
|
18511
|
+
deviceType,
|
|
18512
|
+
rssiThreshold,
|
|
18513
|
+
packageRateThreshold
|
|
18514
|
+
});
|
|
18515
|
+
}
|
|
18516
|
+
}, this.scanInterval * 6e4);
|
|
18517
|
+
}
|
|
18518
|
+
stopCheckSpyCam() {
|
|
18519
|
+
clearInterval(this.checkSpyCam);
|
|
18520
|
+
}
|
|
18521
|
+
};
|
|
18522
|
+
|
|
18523
|
+
// src/proctoring/options/ProctoringOptions.ts
|
|
18524
|
+
var getDefaultProctoringOptions = {
|
|
18525
|
+
cameraId: void 0,
|
|
18526
|
+
microphoneId: void 0,
|
|
18527
|
+
allowMultipleMonitors: false,
|
|
18528
|
+
allowOnlyFirstMonitor: true,
|
|
18529
|
+
captureScreen: true,
|
|
18530
|
+
noiseLimit: 40,
|
|
18531
|
+
proctoringType: "IMAGE",
|
|
18532
|
+
insights: "",
|
|
18533
|
+
onBufferSizeError: false,
|
|
18534
|
+
useGeolocation: false,
|
|
18535
|
+
useSpyScan: false
|
|
18536
|
+
};
|
|
18537
|
+
|
|
18538
|
+
// src/proctoring/options/ProctoringVideoOptions.ts
|
|
18539
|
+
function validatePartialVideoOptions(options) {
|
|
18540
|
+
if (!!options.width && !!options.height) {
|
|
18541
|
+
return {
|
|
18542
|
+
width: options.width,
|
|
18543
|
+
height: options.height,
|
|
18544
|
+
minWidth: options.minWidth,
|
|
18545
|
+
minHeight: options.minHeight
|
|
18546
|
+
};
|
|
18547
|
+
} else {
|
|
18548
|
+
return { width: 640, height: 480 };
|
|
18549
|
+
}
|
|
18550
|
+
}
|
|
18551
|
+
var getDefaultProctoringVideoOptions = {
|
|
18552
|
+
width: 1280,
|
|
18553
|
+
height: 720,
|
|
18554
|
+
minWidth: 640,
|
|
18555
|
+
minHeight: 480
|
|
18556
|
+
};
|
|
18557
|
+
|
|
18347
18558
|
// src/plugins/insights.ts
|
|
18348
18559
|
var backendService;
|
|
18349
18560
|
var init = (backend) => {
|
|
@@ -18354,55 +18565,65 @@ var eventNames = {
|
|
|
18354
18565
|
START: "start",
|
|
18355
18566
|
FINISH: "finish",
|
|
18356
18567
|
ERROR: "error",
|
|
18357
|
-
|
|
18568
|
+
UPLOAD: "upload",
|
|
18569
|
+
UPLOAD_FILE: "upload_file",
|
|
18358
18570
|
DOWNLOAD_VIDEO: "download_video",
|
|
18359
18571
|
BUFFER_SIZE: "buffer_size",
|
|
18360
18572
|
ANOTHER_STREAM: "another_stream",
|
|
18573
|
+
CHANGE_DEVICE: "change_device",
|
|
18574
|
+
STOP_SHARING_SCREEN: "stop_sharing_screen",
|
|
18575
|
+
ERROR_RECORDER_RTC: "error_recorder_rtc",
|
|
18361
18576
|
BROWSER_NOT_SUPPORTED: "browser_not_supported",
|
|
18362
18577
|
SAVE_ON_SESSION: "save_on_session"
|
|
18363
18578
|
};
|
|
18364
18579
|
var log = (eventName, properties) => backendService && backendService.log(eventName, properties);
|
|
18365
18580
|
var trackers = {
|
|
18366
|
-
registerStart: (
|
|
18367
|
-
registerFinish: (
|
|
18368
|
-
registerError: (
|
|
18369
|
-
registerBrowserNotSupported: (
|
|
18370
|
-
registerUpload: (
|
|
18371
|
-
registerUploadFile: (
|
|
18372
|
-
registerChangeDevice: (
|
|
18373
|
-
registerStopSharingScreen: (
|
|
18374
|
-
registerErrorRecorderRTC: (
|
|
18375
|
-
registerDownloadFile: (
|
|
18376
|
-
registerOnBufferSizeError: (
|
|
18377
|
-
registerAnotherStream: (
|
|
18378
|
-
registerSaveOnSession: (
|
|
18581
|
+
registerStart: (proctoringId2, success, description) => log(eventNames.START, { proctoringId: proctoringId2, success, description }),
|
|
18582
|
+
registerFinish: (proctoringId2, success, description) => log(eventNames.FINISH, { proctoringId: proctoringId2, success, description }),
|
|
18583
|
+
registerError: (proctoringId2, description) => log(eventNames.ERROR, { proctoringId: proctoringId2, description }),
|
|
18584
|
+
registerBrowserNotSupported: (proctoringId2, description) => log(eventNames.BROWSER_NOT_SUPPORTED, { proctoringId: proctoringId2, description }),
|
|
18585
|
+
registerUpload: (proctoringId2, success, description, serviceType, uploadTime) => log(eventNames.UPLOAD, { proctoringId: proctoringId2, success, description, serviceType, uploadTime }),
|
|
18586
|
+
registerUploadFile: (proctoringId2, description, fileType) => log(eventNames.UPLOAD_FILE, { proctoringId: proctoringId2, description, fileType }),
|
|
18587
|
+
registerChangeDevice: (proctoringId2, inOrOut, description) => log(eventNames.CHANGE_DEVICE, { proctoringId: proctoringId2, inOrOut, description }),
|
|
18588
|
+
registerStopSharingScreen: (proctoringId2, description) => log(eventNames.STOP_SHARING_SCREEN, { proctoringId: proctoringId2, description }),
|
|
18589
|
+
registerErrorRecorderRTC: (proctoringId2, description) => log(eventNames.ERROR_RECORDER_RTC, { proctoringId: proctoringId2, description }),
|
|
18590
|
+
registerDownloadFile: (proctoringId2, description) => log(eventNames.DOWNLOAD_VIDEO, { proctoringId: proctoringId2, description }),
|
|
18591
|
+
registerOnBufferSizeError: (proctoringId2, description) => log(eventNames.BUFFER_SIZE, { proctoringId: proctoringId2, description }),
|
|
18592
|
+
registerAnotherStream: (proctoringId2, description) => log(eventNames.ANOTHER_STREAM, { proctoringId: proctoringId2, description }),
|
|
18593
|
+
registerSaveOnSession: (proctoringId2, description) => log(eventNames.SAVE_ON_SESSION, { proctoringId: proctoringId2, description })
|
|
18379
18594
|
};
|
|
18380
18595
|
|
|
18381
18596
|
// src/plugins/recorder.ts
|
|
18382
|
-
|
|
18597
|
+
var proctoringId;
|
|
18598
|
+
function setRecorderProctoringId(id) {
|
|
18599
|
+
proctoringId = id;
|
|
18600
|
+
}
|
|
18601
|
+
function recorder(stream4, buffer, onBufferSizeError = false, onBufferSizeErrorCallback, audio = false) {
|
|
18383
18602
|
let resolvePromise;
|
|
18384
18603
|
let stopped = false;
|
|
18385
18604
|
let onBufferSizeInterval;
|
|
18386
18605
|
let lastEvent;
|
|
18387
18606
|
let bufferSize;
|
|
18388
18607
|
bufferSize = 0;
|
|
18389
|
-
let
|
|
18608
|
+
let recorderOptions = {
|
|
18390
18609
|
mimeType: "video/webm",
|
|
18391
18610
|
videoBitsPerSecond: 128e3,
|
|
18392
18611
|
audioBitsPerSecond: 64 * 1e3
|
|
18393
18612
|
};
|
|
18394
18613
|
if (MediaRecorder.isTypeSupported("video/webm;codecs=vp9")) {
|
|
18395
|
-
|
|
18614
|
+
recorderOptions.mimeType = "video/webm;codecs=vp9";
|
|
18396
18615
|
} else {
|
|
18397
|
-
console.warn(
|
|
18616
|
+
console.warn(
|
|
18617
|
+
"vp9 codec not supported. Using default mimeType without vp9."
|
|
18618
|
+
);
|
|
18398
18619
|
}
|
|
18399
18620
|
if (audio) {
|
|
18400
|
-
|
|
18621
|
+
recorderOptions = {
|
|
18401
18622
|
mimeType: "audio/webm",
|
|
18402
18623
|
audioBitsPerSecond: 64 * 1e3
|
|
18403
18624
|
};
|
|
18404
18625
|
}
|
|
18405
|
-
const mediaRecorder = new MediaRecorder(stream4,
|
|
18626
|
+
const mediaRecorder = new MediaRecorder(stream4, recorderOptions);
|
|
18406
18627
|
mediaRecorder.ondataavailable = (e3) => {
|
|
18407
18628
|
bufferSize = bufferSize + e3.data.size;
|
|
18408
18629
|
if (e3.data.size > 0) {
|
|
@@ -18410,9 +18631,15 @@ function recorder(stream4, buffer, proctoringId, onBufferSizeError = false, onBu
|
|
|
18410
18631
|
}
|
|
18411
18632
|
if (!stopped) {
|
|
18412
18633
|
if (lastEvent && e3.data.size === lastEvent.data.size || e3.data.size === 0) {
|
|
18634
|
+
proctoringId && lastEvent && e3.data.size === lastEvent.data.size && trackers.registerOnBufferSizeError(
|
|
18635
|
+
proctoringId,
|
|
18636
|
+
`onBufferSizeError: Recorder size freezed: ${e3.data.size} Mb`
|
|
18637
|
+
);
|
|
18638
|
+
proctoringId && e3.data.size === 0 && trackers.registerOnBufferSizeError(
|
|
18639
|
+
proctoringId,
|
|
18640
|
+
`onBufferSizeError: Recorder size equal 0 Mb`
|
|
18641
|
+
);
|
|
18413
18642
|
onBufferSizeErrorCallback && onBufferSizeErrorCallback();
|
|
18414
|
-
proctoringId && lastEvent && e3.data.size === lastEvent.data.size && trackers.registerOnBufferSizeError(proctoringId, `onBufferSizeError: Recorder size freezed: ${e3.data.size} Mb`);
|
|
18415
|
-
proctoringId && e3.data.size === 0 && trackers.registerOnBufferSizeError(proctoringId, `onBufferSizeError: Recorder size equal 0 Mb`);
|
|
18416
18643
|
}
|
|
18417
18644
|
lastEvent = e3;
|
|
18418
18645
|
} else {
|
|
@@ -18474,17 +18701,24 @@ function recorder(stream4, buffer, proctoringId, onBufferSizeError = false, onBu
|
|
|
18474
18701
|
function getBufferSize() {
|
|
18475
18702
|
return bufferSize;
|
|
18476
18703
|
}
|
|
18477
|
-
return {
|
|
18704
|
+
return {
|
|
18705
|
+
startRecording,
|
|
18706
|
+
stopRecording,
|
|
18707
|
+
pauseRecording,
|
|
18708
|
+
resumeRecording,
|
|
18709
|
+
recorderOptions,
|
|
18710
|
+
getBufferSize
|
|
18711
|
+
};
|
|
18478
18712
|
}
|
|
18479
18713
|
|
|
18480
18714
|
// src/new-flow/upload/UploadService.ts
|
|
18481
18715
|
var UploadService = class {
|
|
18482
|
-
constructor(
|
|
18716
|
+
constructor(proctoringId2, backend) {
|
|
18483
18717
|
this.backend = backend;
|
|
18484
18718
|
this.imageUrlPackage = [];
|
|
18485
18719
|
this.imageBatchNum = 0;
|
|
18486
18720
|
this.contImages = 0;
|
|
18487
|
-
this.proctoringId =
|
|
18721
|
+
this.proctoringId = proctoringId2;
|
|
18488
18722
|
}
|
|
18489
18723
|
async uploadImages(data, token, packSize) {
|
|
18490
18724
|
const { file, onProgress } = data;
|
|
@@ -18626,6 +18860,7 @@ var STREAM_UNDER_MINIMUM_PERMITTED = "stream_under_minimum_permitted";
|
|
|
18626
18860
|
var BROWSER_NOT_SUPPORTED = "browser_not_supported";
|
|
18627
18861
|
var TOKEN_MISSING = "token_missing";
|
|
18628
18862
|
var CREDENTIALS_MISSING = "credentials_missing";
|
|
18863
|
+
var SPY_SCAN_API_NOT_FOUND = "spy_scan_api_not_found";
|
|
18629
18864
|
|
|
18630
18865
|
// src/modules/objectDetection.ts
|
|
18631
18866
|
var ObjectDetection = class extends BaseDetection {
|
|
@@ -18783,7 +19018,7 @@ var CameraRecorder = class {
|
|
|
18783
19018
|
cameraId: void 0,
|
|
18784
19019
|
microphoneId: void 0,
|
|
18785
19020
|
onBufferSizeError: false,
|
|
18786
|
-
onBufferSizeErrorCallback: () => {
|
|
19021
|
+
onBufferSizeErrorCallback: (cameraStream) => {
|
|
18787
19022
|
},
|
|
18788
19023
|
proctoringType: "IMAGE",
|
|
18789
19024
|
onChangeDevicesCallback: (devices) => {
|
|
@@ -18800,6 +19035,7 @@ var CameraRecorder = class {
|
|
|
18800
19035
|
this.blobsRTC = [];
|
|
18801
19036
|
this.imageCount = 0;
|
|
18802
19037
|
this.filesToUpload = [];
|
|
19038
|
+
this.currentRetries = 0;
|
|
18803
19039
|
this.noiseWait = 20;
|
|
18804
19040
|
this.options = options;
|
|
18805
19041
|
this.videoOptions = videoOptions;
|
|
@@ -18807,19 +19043,30 @@ var CameraRecorder = class {
|
|
|
18807
19043
|
this.backendToken = backendToken;
|
|
18808
19044
|
paramsConfig && (this.paramsConfig = paramsConfig);
|
|
18809
19045
|
}
|
|
18810
|
-
setProctoringId(
|
|
18811
|
-
this.proctoringId =
|
|
19046
|
+
setProctoringId(proctoringId2) {
|
|
19047
|
+
this.proctoringId = proctoringId2;
|
|
18812
19048
|
this.proctoringId && this.backend && (this.upload = new UploadService(this.proctoringId, this.backend));
|
|
19049
|
+
setRecorderProctoringId(proctoringId2);
|
|
18813
19050
|
}
|
|
18814
19051
|
async initializeDetectors() {
|
|
18815
19052
|
var _a2, _b, _c2;
|
|
18816
19053
|
buildVideoPreview();
|
|
18817
19054
|
if (((_a2 = this.paramsConfig.videoBehaviourParameters) == null ? void 0 : _a2.detectPerson) || ((_b = this.paramsConfig.videoBehaviourParameters) == null ? void 0 : _b.detectCellPhone)) {
|
|
18818
|
-
this.objectDetection = new ObjectDetection(
|
|
19055
|
+
this.objectDetection = new ObjectDetection(
|
|
19056
|
+
{
|
|
19057
|
+
onRealtimeAlertsCallback: (response) => this.options.onRealtimeAlertsCallback(response)
|
|
19058
|
+
},
|
|
19059
|
+
this.paramsConfig
|
|
19060
|
+
);
|
|
18819
19061
|
await this.objectDetection.initializeDetector();
|
|
18820
19062
|
}
|
|
18821
19063
|
if ((_c2 = this.paramsConfig.videoBehaviourParameters) == null ? void 0 : _c2.detectFace) {
|
|
18822
|
-
this.faceDetection = new FaceDetection(
|
|
19064
|
+
this.faceDetection = new FaceDetection(
|
|
19065
|
+
{
|
|
19066
|
+
onRealtimeAlertsCallback: (response) => this.options.onRealtimeAlertsCallback(response)
|
|
19067
|
+
},
|
|
19068
|
+
this.paramsConfig
|
|
19069
|
+
);
|
|
18823
19070
|
await this.faceDetection.initializeDetector();
|
|
18824
19071
|
}
|
|
18825
19072
|
}
|
|
@@ -18832,9 +19079,25 @@ var CameraRecorder = class {
|
|
|
18832
19079
|
this.canvas.width = this.videoOptions.width;
|
|
18833
19080
|
this.canvas.height = this.videoOptions.height;
|
|
18834
19081
|
}
|
|
18835
|
-
async
|
|
19082
|
+
async bufferError(e3) {
|
|
19083
|
+
var _a2, _b;
|
|
19084
|
+
console.log("buffer error Camera Recorder params " + this.paramsConfig.videoBehaviourParameters);
|
|
19085
|
+
const retryEnabled = ((_a2 = this.paramsConfig.videoBehaviourParameters) == null ? void 0 : _a2.retryEnabled) || false;
|
|
19086
|
+
const maxRetries = ((_b = this.paramsConfig.videoBehaviourParameters) == null ? void 0 : _b.maxRetries) || 3;
|
|
19087
|
+
if (retryEnabled && this.currentRetries < maxRetries) {
|
|
19088
|
+
await this.recordingStop();
|
|
19089
|
+
await this.startRecording({
|
|
19090
|
+
retry: true
|
|
19091
|
+
});
|
|
19092
|
+
this.currentRetries++;
|
|
19093
|
+
this.options.onBufferSizeErrorCallback && this.options.onBufferSizeErrorCallback(this.cameraStream);
|
|
19094
|
+
} else {
|
|
19095
|
+
this.options.onBufferSizeErrorCallback && this.options.onBufferSizeErrorCallback();
|
|
19096
|
+
}
|
|
19097
|
+
}
|
|
19098
|
+
async startRecording(options) {
|
|
18836
19099
|
var _a2, _b, _c2, _d, _e3, _f, _g;
|
|
18837
|
-
if (((_a2 = this.paramsConfig.videoBehaviourParameters) == null ? void 0 : _a2.detectPerson) || ((_b = this.paramsConfig.videoBehaviourParameters) == null ? void 0 : _b.detectCellPhone) || ((_c2 = this.paramsConfig.videoBehaviourParameters) == null ? void 0 : _c2.detectFace)) {
|
|
19100
|
+
if ((((_a2 = this.paramsConfig.videoBehaviourParameters) == null ? void 0 : _a2.detectPerson) || ((_b = this.paramsConfig.videoBehaviourParameters) == null ? void 0 : _b.detectCellPhone) || ((_c2 = this.paramsConfig.videoBehaviourParameters) == null ? void 0 : _c2.detectFace)) && !(options == null ? void 0 : options.retry)) {
|
|
18838
19101
|
await this.initializeDetectors();
|
|
18839
19102
|
}
|
|
18840
19103
|
const { cameraId, microphoneId, onBufferSizeErrorCallback } = this.options;
|
|
@@ -18848,18 +19111,33 @@ var CameraRecorder = class {
|
|
|
18848
19111
|
}
|
|
18849
19112
|
};
|
|
18850
19113
|
try {
|
|
18851
|
-
this.cameraStream = await navigator.mediaDevices.getUserMedia(
|
|
19114
|
+
this.cameraStream = await navigator.mediaDevices.getUserMedia(
|
|
19115
|
+
constraints
|
|
19116
|
+
);
|
|
18852
19117
|
} catch (error) {
|
|
18853
19118
|
if (error.toString() == "NotReadableError: Could not start video source")
|
|
18854
19119
|
throw "N\xE3o foi poss\xEDvel conectar a camera, ela pode estar sendo utilizada por outro programa";
|
|
18855
19120
|
throw error;
|
|
18856
19121
|
}
|
|
18857
|
-
const {
|
|
19122
|
+
const {
|
|
19123
|
+
startRecording,
|
|
19124
|
+
stopRecording,
|
|
19125
|
+
pauseRecording,
|
|
19126
|
+
resumeRecording,
|
|
19127
|
+
recorderOptions,
|
|
19128
|
+
getBufferSize
|
|
19129
|
+
} = recorder(
|
|
19130
|
+
this.cameraStream,
|
|
19131
|
+
this.blobs,
|
|
19132
|
+
this.options.onBufferSizeError,
|
|
19133
|
+
(e3) => this.bufferError(e3),
|
|
19134
|
+
false
|
|
19135
|
+
);
|
|
18858
19136
|
this.recordingStart = startRecording;
|
|
18859
19137
|
this.recordingStop = stopRecording;
|
|
18860
19138
|
this.recordingPause = pauseRecording;
|
|
18861
19139
|
this.recordingResume = resumeRecording;
|
|
18862
|
-
this.recorderOptions =
|
|
19140
|
+
this.recorderOptions = recorderOptions;
|
|
18863
19141
|
this.getBufferSize = getBufferSize;
|
|
18864
19142
|
this.recordingStart();
|
|
18865
19143
|
const tracks = this.cameraStream.getVideoTracks();
|
|
@@ -18867,9 +19145,16 @@ var CameraRecorder = class {
|
|
|
18867
19145
|
if (this.videoOptions.minWidth > settings.width || this.videoOptions.minHeight > settings.height) {
|
|
18868
19146
|
throw STREAM_UNDER_MINIMUM_PERMITTED;
|
|
18869
19147
|
} else if (this.videoOptions.width !== settings.width || this.videoOptions.height !== settings.height) {
|
|
18870
|
-
trackers.registerAnotherStream(
|
|
18871
|
-
|
|
18872
|
-
|
|
19148
|
+
trackers.registerAnotherStream(
|
|
19149
|
+
this.proctoringId,
|
|
19150
|
+
`Maybe have another stream active
|
|
19151
|
+
Video Options: ${JSON.stringify(
|
|
19152
|
+
this.videoOptions,
|
|
19153
|
+
null,
|
|
19154
|
+
2
|
|
19155
|
+
)}
|
|
19156
|
+
Setting: ${JSON.stringify(settings, null, 2)}`
|
|
19157
|
+
);
|
|
18873
19158
|
throw ANOTHER_STREAM_ACTIVE;
|
|
18874
19159
|
}
|
|
18875
19160
|
((_d = this.paramsConfig.imageBehaviourParameters) == null ? void 0 : _d.useUploadImage) && this.options.proctoringType == "IMAGE" && this.photoShotsCycle();
|
|
@@ -18893,8 +19178,13 @@ Setting: ${JSON.stringify(settings, null, 2)}`);
|
|
|
18893
19178
|
const packSize = this.paramsConfig.imageBehaviourParameters.uploadInterval;
|
|
18894
19179
|
for (let i3 = 0; i3 < size; i3++) {
|
|
18895
19180
|
if (i3 == size - 1 && this.filesToUpload[0]) {
|
|
18896
|
-
const imageName = this.filesToUpload[0].name.replace(
|
|
18897
|
-
|
|
19181
|
+
const imageName = this.filesToUpload[0].name.replace(
|
|
19182
|
+
".jpg",
|
|
19183
|
+
"_realtime.jpg"
|
|
19184
|
+
);
|
|
19185
|
+
const file = new File([this.filesToUpload[0]], imageName, {
|
|
19186
|
+
type: "image/jpeg"
|
|
19187
|
+
});
|
|
18898
19188
|
this.filesToUpload[0] = file;
|
|
18899
19189
|
}
|
|
18900
19190
|
this.filesToUpload[0] && await this.upload.uploadImages(
|
|
@@ -18920,9 +19210,19 @@ Setting: ${JSON.stringify(settings, null, 2)}`);
|
|
|
18920
19210
|
let imageFile;
|
|
18921
19211
|
this.configImageCapture();
|
|
18922
19212
|
this.imageInterval = setInterval(async () => {
|
|
18923
|
-
this.canvas.getContext("2d").drawImage(
|
|
19213
|
+
this.canvas.getContext("2d").drawImage(
|
|
19214
|
+
this.video,
|
|
19215
|
+
0,
|
|
19216
|
+
0,
|
|
19217
|
+
this.videoOptions.width,
|
|
19218
|
+
this.videoOptions.height
|
|
19219
|
+
);
|
|
18924
19220
|
const image_data_url = this.canvas.toDataURL("image/jpeg");
|
|
18925
|
-
imageFile = await this.getFile(
|
|
19221
|
+
imageFile = await this.getFile(
|
|
19222
|
+
image_data_url,
|
|
19223
|
+
`${this.proctoringId}_${this.imageCount + 1}.jpg`,
|
|
19224
|
+
"image/jpeg"
|
|
19225
|
+
);
|
|
18926
19226
|
if (imageFile && this.upload && this.backendToken) {
|
|
18927
19227
|
this.upload.upload(
|
|
18928
19228
|
{
|
|
@@ -19016,7 +19316,10 @@ Setting: ${JSON.stringify(settings, null, 2)}`);
|
|
|
19016
19316
|
async saveOnSession(session) {
|
|
19017
19317
|
var _a2, _b;
|
|
19018
19318
|
if (this.blobs != null)
|
|
19019
|
-
trackers.registerSaveOnSession(
|
|
19319
|
+
trackers.registerSaveOnSession(
|
|
19320
|
+
this.proctoringId,
|
|
19321
|
+
`Blobs Length: ${this.blobs.length} Buffer Size: ${this.getBufferSize()} `
|
|
19322
|
+
);
|
|
19020
19323
|
const settings = this.cameraStream.getVideoTracks()[0].getSettings();
|
|
19021
19324
|
const settingsAudio = this.cameraStream.getAudioTracks()[0].getSettings();
|
|
19022
19325
|
if (this.options.proctoringType == "VIDEO" || this.options.proctoringType == "REALTIME" || this.options.proctoringType == "IMAGE" && ((_a2 = this.paramsConfig.imageBehaviourParameters) == null ? void 0 : _a2.saveVideo)) {
|
|
@@ -19346,10 +19649,29 @@ var DeviceCheckerUI = class {
|
|
|
19346
19649
|
checkmark_AmbientVerify.appendChild(checkmark_kick_AmbientVerify);
|
|
19347
19650
|
alertDivAmbientVerify.appendChild(checkmark_AmbientVerify);
|
|
19348
19651
|
alertDivAmbientVerify.appendChild(ambientVerifyAlert);
|
|
19652
|
+
const alertDivSpyCam = document.createElement("div");
|
|
19653
|
+
alertDivSpyCam.setAttribute("class", "alert-div");
|
|
19654
|
+
alertDivSpyCam.setAttribute("id", "alertDivSpyCam");
|
|
19655
|
+
alertDivSpyCam.style.display = "none";
|
|
19656
|
+
const SpyCamAlert = document.createElement("error");
|
|
19657
|
+
SpyCamAlert.setAttribute("id", "SpyCamAlert");
|
|
19658
|
+
SpyCamAlert.innerText = "Verifica\xE7\xE3o de Spy Cam";
|
|
19659
|
+
SpyCamAlert.style.marginLeft = "10px";
|
|
19660
|
+
const checkmark_SpyCam = document.createElement("span");
|
|
19661
|
+
const checkmark_stem_SpyCam = document.createElement("div");
|
|
19662
|
+
const checkmark_kick_SpyCam = document.createElement("div");
|
|
19663
|
+
checkmark_SpyCam.setAttribute("id", "checkmark_SpyCam");
|
|
19664
|
+
checkmark_stem_SpyCam.setAttribute("id", "checkmark_stem_SpyCam");
|
|
19665
|
+
checkmark_kick_SpyCam.setAttribute("id", "checkmark_kick_SpyCam");
|
|
19666
|
+
checkmark_SpyCam.appendChild(checkmark_stem_SpyCam);
|
|
19667
|
+
checkmark_SpyCam.appendChild(checkmark_kick_SpyCam);
|
|
19668
|
+
alertDivSpyCam.appendChild(checkmark_SpyCam);
|
|
19669
|
+
alertDivSpyCam.appendChild(SpyCamAlert);
|
|
19349
19670
|
center.style.transform = "rotateY(180deg)";
|
|
19350
19671
|
center.appendChild(alertDivResolution);
|
|
19351
19672
|
center.appendChild(alertDivFacePosition);
|
|
19352
19673
|
center.appendChild(alertDivAmbientVerify);
|
|
19674
|
+
center.appendChild(alertDivSpyCam);
|
|
19353
19675
|
divCamera.appendChild(center);
|
|
19354
19676
|
videoDiv.appendChild(video);
|
|
19355
19677
|
divCamera.appendChild(videoDiv);
|
|
@@ -19528,10 +19850,13 @@ var DeviceCheckerUI = class {
|
|
|
19528
19850
|
fontWeight: "bold",
|
|
19529
19851
|
borderRadius: "10px",
|
|
19530
19852
|
paddingTop: "5px",
|
|
19531
|
-
paddingBottom: "5px"
|
|
19532
|
-
disabled: true
|
|
19853
|
+
paddingBottom: "5px"
|
|
19533
19854
|
};
|
|
19534
19855
|
this.applyStyles(button, buttonStyles);
|
|
19856
|
+
if (this.options.useSpyScan) {
|
|
19857
|
+
button.style.cursor = "not-allowed";
|
|
19858
|
+
button.setAttribute("disabled", "true");
|
|
19859
|
+
}
|
|
19535
19860
|
divBtn.appendChild(buttonCancel);
|
|
19536
19861
|
divBtn.appendChild(divider);
|
|
19537
19862
|
divBtn.appendChild(button);
|
|
@@ -19591,6 +19916,8 @@ var DeviceCheckerUI = class {
|
|
|
19591
19916
|
});
|
|
19592
19917
|
});
|
|
19593
19918
|
confirmBtn == null ? void 0 : confirmBtn.addEventListener("click", () => {
|
|
19919
|
+
if (confirmBtn.disabled)
|
|
19920
|
+
return;
|
|
19594
19921
|
closeCheckDevices();
|
|
19595
19922
|
this.closeModal();
|
|
19596
19923
|
resolve({
|
|
@@ -19641,6 +19968,68 @@ var DeviceCheckerUI = class {
|
|
|
19641
19968
|
}
|
|
19642
19969
|
}
|
|
19643
19970
|
}
|
|
19971
|
+
waitingSpyDevices(waiting) {
|
|
19972
|
+
const SpyCamAlert = document.getElementById("SpyCamAlert");
|
|
19973
|
+
const alertDivSpyCam = document.getElementById(
|
|
19974
|
+
"alertDivSpyCam"
|
|
19975
|
+
);
|
|
19976
|
+
alertDivSpyCam && (alertDivSpyCam.style.display = "flex");
|
|
19977
|
+
if (waiting) {
|
|
19978
|
+
SpyCamAlert && (SpyCamAlert.style.color = "#c7c7c7");
|
|
19979
|
+
SpyCamAlert && (SpyCamAlert.innerText = "Verificando Spy Cam...");
|
|
19980
|
+
const confirmBtn = document.getElementById("confirmBtn");
|
|
19981
|
+
if (confirmBtn)
|
|
19982
|
+
confirmBtn.setAttribute("disabled", "true");
|
|
19983
|
+
confirmBtn && (confirmBtn.style.cursor = "not-allowed");
|
|
19984
|
+
} else {
|
|
19985
|
+
SpyCamAlert && (SpyCamAlert.style.color = "#16A34A");
|
|
19986
|
+
SpyCamAlert && (SpyCamAlert.innerText = "Verifica\xE7\xE3o de Spy Cam");
|
|
19987
|
+
const confirmBtn = document.getElementById("confirmBtn");
|
|
19988
|
+
if (confirmBtn)
|
|
19989
|
+
confirmBtn.setAttribute("disabled", "false");
|
|
19990
|
+
confirmBtn && (confirmBtn.style.cursor = "pointer");
|
|
19991
|
+
}
|
|
19992
|
+
}
|
|
19993
|
+
isSpyDevicesUI(allowedDevices) {
|
|
19994
|
+
const SpyCamAlert = document.getElementById("SpyCamAlert");
|
|
19995
|
+
const confirmBtn = document.getElementById("confirmBtn");
|
|
19996
|
+
const alertDivSpyCam = document.getElementById(
|
|
19997
|
+
"alertDivSpyCam"
|
|
19998
|
+
);
|
|
19999
|
+
alertDivSpyCam && (alertDivSpyCam.style.display = "flex");
|
|
20000
|
+
const checkmark_SpyCam = document.getElementById(
|
|
20001
|
+
"checkmark_SpyCam"
|
|
20002
|
+
);
|
|
20003
|
+
const checkmark_stem_SpyCam = document.getElementById(
|
|
20004
|
+
"checkmark_stem_SpyCam"
|
|
20005
|
+
);
|
|
20006
|
+
const checkmark_kick_SpyCam = document.getElementById(
|
|
20007
|
+
"checkmark_kick_SpyCam"
|
|
20008
|
+
);
|
|
20009
|
+
if (allowedDevices) {
|
|
20010
|
+
SpyCamAlert && (SpyCamAlert.style.color = "#16A34A");
|
|
20011
|
+
if (checkmark_SpyCam) {
|
|
20012
|
+
checkmark_SpyCam.setAttribute("class", "checkmark");
|
|
20013
|
+
checkmark_stem_SpyCam.setAttribute("class", "checkmark_stem");
|
|
20014
|
+
checkmark_kick_SpyCam.setAttribute("class", "checkmark_kick");
|
|
20015
|
+
}
|
|
20016
|
+
} else {
|
|
20017
|
+
if (checkmark_SpyCam) {
|
|
20018
|
+
SpyCamAlert && (SpyCamAlert.style.color = "#FF0000");
|
|
20019
|
+
checkmark_SpyCam.setAttribute("class", "checkmark_error");
|
|
20020
|
+
checkmark_stem_SpyCam.setAttribute(
|
|
20021
|
+
"class",
|
|
20022
|
+
"checkmark_stem_error"
|
|
20023
|
+
);
|
|
20024
|
+
checkmark_kick_SpyCam.setAttribute(
|
|
20025
|
+
"class",
|
|
20026
|
+
"checkmark_kick_error"
|
|
20027
|
+
);
|
|
20028
|
+
}
|
|
20029
|
+
}
|
|
20030
|
+
this.options.useSpyScan && (confirmBtn == null ? void 0 : confirmBtn.removeAttribute("disabled"));
|
|
20031
|
+
confirmBtn && (confirmBtn.style.cursor = "pointer");
|
|
20032
|
+
}
|
|
19644
20033
|
isUnderResolutionUI(allowedResolution) {
|
|
19645
20034
|
const error = document.getElementById("resolutionAlert");
|
|
19646
20035
|
const alertDivResolution = document.getElementById("alertDivResolution");
|
|
@@ -19777,7 +20166,12 @@ Para iniciar um exame utilize uma outra c\xE2mera.`);
|
|
|
19777
20166
|
// src/new-flow/checkers/DeviceCheckerService.ts
|
|
19778
20167
|
var _DeviceCheckerService = class {
|
|
19779
20168
|
constructor(context) {
|
|
19780
|
-
this.videoOptions = {
|
|
20169
|
+
this.videoOptions = {
|
|
20170
|
+
width: 1080,
|
|
20171
|
+
height: 720,
|
|
20172
|
+
minWidth: 0,
|
|
20173
|
+
minHeight: 0
|
|
20174
|
+
};
|
|
19781
20175
|
this.volumeMedia = 0;
|
|
19782
20176
|
this.volumeSum = 0;
|
|
19783
20177
|
this.volumeCounter = 0;
|
|
@@ -19786,8 +20180,16 @@ var _DeviceCheckerService = class {
|
|
|
19786
20180
|
this.allowedAmbient = true;
|
|
19787
20181
|
this.allowedPositionFace = true;
|
|
19788
20182
|
this.allowedMicrophone = false;
|
|
20183
|
+
this.allowedSpyScan = null;
|
|
19789
20184
|
this.noiseLimit = 0;
|
|
19790
|
-
this.faceDetection = new FaceDetection(
|
|
20185
|
+
this.faceDetection = new FaceDetection(
|
|
20186
|
+
{
|
|
20187
|
+
onRealtimeAlertsCallback: (response) => this.realtimeAlerts(response)
|
|
20188
|
+
},
|
|
20189
|
+
{ videoBehaviourParameters: { detectFace: true } },
|
|
20190
|
+
"cameraStream",
|
|
20191
|
+
"liveCheckDevices"
|
|
20192
|
+
);
|
|
19791
20193
|
this.context = context;
|
|
19792
20194
|
this.backend = new BackendService({
|
|
19793
20195
|
type: (context == null ? void 0 : context.type) || "prod",
|
|
@@ -19798,41 +20200,55 @@ var _DeviceCheckerService = class {
|
|
|
19798
20200
|
if (_DeviceCheckerService.isModalOpen) {
|
|
19799
20201
|
return Promise.reject("Modal j\xE1 est\xE1 aberto");
|
|
19800
20202
|
}
|
|
20203
|
+
this.options = {
|
|
20204
|
+
...getDefaultProctoringOptions,
|
|
20205
|
+
...options,
|
|
20206
|
+
captureScreen: false,
|
|
20207
|
+
allowMultipleMonitors: true,
|
|
20208
|
+
allowOnlyFirstMonitor: false
|
|
20209
|
+
};
|
|
19801
20210
|
_DeviceCheckerService.isModalOpen = true;
|
|
19802
20211
|
try {
|
|
19803
20212
|
await this.faceDetection.initializeDetector();
|
|
19804
|
-
const { cameraStream } = await this.startCheckDevices(
|
|
20213
|
+
const { cameraStream } = await this.startCheckDevices(
|
|
20214
|
+
options,
|
|
20215
|
+
_videoOptions
|
|
20216
|
+
);
|
|
20217
|
+
this.checkSpyScan();
|
|
19805
20218
|
const returnData = { cameraStream: this.cameraRecorder.cameraStream };
|
|
19806
20219
|
this.onUpdateCb = (e3) => onUpdate(e3);
|
|
19807
|
-
const resultPromise = new Promise(
|
|
19808
|
-
|
|
19809
|
-
|
|
19810
|
-
|
|
19811
|
-
|
|
19812
|
-
|
|
19813
|
-
|
|
19814
|
-
|
|
19815
|
-
|
|
19816
|
-
|
|
19817
|
-
|
|
19818
|
-
|
|
19819
|
-
|
|
20220
|
+
const resultPromise = new Promise(
|
|
20221
|
+
(resolve, reject) => {
|
|
20222
|
+
onModalConfirm(() => {
|
|
20223
|
+
this.closeCheckDevices();
|
|
20224
|
+
resolve({
|
|
20225
|
+
result: true,
|
|
20226
|
+
cameraId: options.cameraId || "default",
|
|
20227
|
+
microphoneId: options.microphoneId || "default",
|
|
20228
|
+
volumeRange: this.volumeMedia,
|
|
20229
|
+
allowedResolution: this.allowedResolution,
|
|
20230
|
+
allowedPositionFace: this.allowedPositionFace,
|
|
20231
|
+
allowedAmbient: this.allowedAmbient,
|
|
20232
|
+
allowedMicrophone: this.allowedMicrophone,
|
|
20233
|
+
allowedSpyScan: this.allowedSpyScan,
|
|
20234
|
+
faceDetectionAlerts: this.faceDetectionAlerts
|
|
20235
|
+
});
|
|
20236
|
+
_DeviceCheckerService.isModalOpen = false;
|
|
19820
20237
|
});
|
|
19821
|
-
|
|
19822
|
-
|
|
19823
|
-
|
|
19824
|
-
|
|
19825
|
-
|
|
19826
|
-
|
|
20238
|
+
onModalCancel(() => {
|
|
20239
|
+
this.closeCheckDevices();
|
|
20240
|
+
resolve({
|
|
20241
|
+
result: false
|
|
20242
|
+
});
|
|
20243
|
+
_DeviceCheckerService.isModalOpen = false;
|
|
19827
20244
|
});
|
|
19828
|
-
|
|
19829
|
-
|
|
19830
|
-
});
|
|
20245
|
+
}
|
|
20246
|
+
);
|
|
19831
20247
|
return { ...returnData, result: resultPromise };
|
|
19832
20248
|
} catch (error) {
|
|
19833
20249
|
this.closeCheckDevices();
|
|
19834
20250
|
_DeviceCheckerService.isModalOpen = false;
|
|
19835
|
-
|
|
20251
|
+
throw error;
|
|
19836
20252
|
}
|
|
19837
20253
|
}
|
|
19838
20254
|
onUpdateCallback() {
|
|
@@ -19842,6 +20258,7 @@ var _DeviceCheckerService = class {
|
|
|
19842
20258
|
allowedPositionFace: this.allowedPositionFace,
|
|
19843
20259
|
allowedAmbient: this.allowedAmbient,
|
|
19844
20260
|
allowedMicrophone: this.allowedMicrophone,
|
|
20261
|
+
allowedSpyScan: this.allowedSpyScan,
|
|
19845
20262
|
faceDetectionAlerts: this.faceDetectionAlerts
|
|
19846
20263
|
});
|
|
19847
20264
|
}
|
|
@@ -19862,11 +20279,14 @@ var _DeviceCheckerService = class {
|
|
|
19862
20279
|
allowOnlyFirstMonitor: false
|
|
19863
20280
|
};
|
|
19864
20281
|
this.videoOptions = { ...this.videoOptions, ..._videoOptions };
|
|
19865
|
-
const paramsConfig = await this.backend.getParamsConfig(
|
|
20282
|
+
const paramsConfig = await this.backend.getParamsConfig(
|
|
20283
|
+
this.context
|
|
20284
|
+
);
|
|
19866
20285
|
this.noiseLimit = ((_a2 = paramsConfig.audioBehaviourParameters) == null ? void 0 : _a2.noiseLimit) || 40;
|
|
19867
20286
|
await this.faceDetection.initializeDetector();
|
|
19868
20287
|
this.DeviceCheckerUI.checkDevicesInterface();
|
|
19869
20288
|
this.startCheckDevices(options, _videoOptions);
|
|
20289
|
+
await this.checkSpyScan();
|
|
19870
20290
|
const { cameraId, microphoneId, result } = await this.DeviceCheckerUI.modalActions(() => this.closeCheckDevices());
|
|
19871
20291
|
return new Promise((resolve) => {
|
|
19872
20292
|
resolve({
|
|
@@ -19878,6 +20298,7 @@ var _DeviceCheckerService = class {
|
|
|
19878
20298
|
allowedPositionFace: this.allowedPositionFace,
|
|
19879
20299
|
allowedAmbient: this.allowedAmbient,
|
|
19880
20300
|
allowedMicrophone: this.allowedMicrophone,
|
|
20301
|
+
allowedSpyScan: this.allowedSpyScan,
|
|
19881
20302
|
faceDetectionAlerts: this.faceDetectionAlerts
|
|
19882
20303
|
});
|
|
19883
20304
|
});
|
|
@@ -19944,10 +20365,7 @@ var _DeviceCheckerService = class {
|
|
|
19944
20365
|
this.DeviceCheckerUI && this.DeviceCheckerUI.audioDeviceInterfaceUIErrorExec();
|
|
19945
20366
|
});
|
|
19946
20367
|
}
|
|
19947
|
-
async changeSelectedDevice({
|
|
19948
|
-
cameraId,
|
|
19949
|
-
microphoneId
|
|
19950
|
-
}) {
|
|
20368
|
+
async changeSelectedDevice({ cameraId, microphoneId }) {
|
|
19951
20369
|
var _a2;
|
|
19952
20370
|
this.cameraRecorder.stopRecording && await this.cameraRecorder.stopRecording();
|
|
19953
20371
|
(_a2 = this.volumeMeter) == null ? void 0 : _a2.stop();
|
|
@@ -19973,7 +20391,10 @@ var _DeviceCheckerService = class {
|
|
|
19973
20391
|
};
|
|
19974
20392
|
}
|
|
19975
20393
|
async startCheckDevices(options = getDefaultProctoringOptions, _videoOptions) {
|
|
19976
|
-
this.DeviceCheckerUI && this.DeviceCheckerUI.setSelectOption(
|
|
20394
|
+
this.DeviceCheckerUI && this.DeviceCheckerUI.setSelectOption(
|
|
20395
|
+
options,
|
|
20396
|
+
(e3) => this.changeSelectedDevice(e3)
|
|
20397
|
+
);
|
|
19977
20398
|
this.videoOptions = validatePartialVideoOptions(_videoOptions);
|
|
19978
20399
|
await checkPermissions();
|
|
19979
20400
|
this.cameraRecorder = new CameraRecorder(
|
|
@@ -19994,7 +20415,7 @@ var _DeviceCheckerService = class {
|
|
|
19994
20415
|
this.audioDeviceInterface(this.cameraRecorder.cameraStream);
|
|
19995
20416
|
if (this.DeviceCheckerUI) {
|
|
19996
20417
|
const button = document.querySelector("#confirmBtn");
|
|
19997
|
-
button.disabled = false;
|
|
20418
|
+
!this.options.useSpyScan && (button.disabled = false);
|
|
19998
20419
|
}
|
|
19999
20420
|
return {
|
|
20000
20421
|
cameraStream: this.cameraRecorder.cameraStream
|
|
@@ -20010,6 +20431,39 @@ var _DeviceCheckerService = class {
|
|
|
20010
20431
|
this.DeviceCheckerUI = void 0;
|
|
20011
20432
|
this.onUpdateCb = void 0;
|
|
20012
20433
|
}
|
|
20434
|
+
async checkSpyScan() {
|
|
20435
|
+
this.spycam = new SpyCam(this.context, {});
|
|
20436
|
+
this.allowedSpyScan = null;
|
|
20437
|
+
if (this.options.useSpyScan) {
|
|
20438
|
+
this.DeviceCheckerUI && this.DeviceCheckerUI.waitingSpyDevices(true);
|
|
20439
|
+
try {
|
|
20440
|
+
const isPlugged = await this.spycam.isPluggedIn();
|
|
20441
|
+
if (isPlugged) {
|
|
20442
|
+
await this.spycam.devices({
|
|
20443
|
+
deviceType: 3 /* POTENCIAL_CAMERA */
|
|
20444
|
+
}).then((devices) => {
|
|
20445
|
+
if ((devices == null ? void 0 : devices.length) > 0) {
|
|
20446
|
+
this.allowedSpyScan = false;
|
|
20447
|
+
} else {
|
|
20448
|
+
this.allowedSpyScan = true;
|
|
20449
|
+
}
|
|
20450
|
+
}).finally(() => {
|
|
20451
|
+
this.DeviceCheckerUI && this.DeviceCheckerUI.waitingSpyDevices(false);
|
|
20452
|
+
this.DeviceCheckerUI && this.allowedSpyScan != null && this.DeviceCheckerUI.isSpyDevicesUI(this.allowedSpyScan);
|
|
20453
|
+
});
|
|
20454
|
+
} else {
|
|
20455
|
+
this.allowedSpyScan = false;
|
|
20456
|
+
this.DeviceCheckerUI && this.DeviceCheckerUI.waitingSpyDevices(false);
|
|
20457
|
+
this.DeviceCheckerUI && this.DeviceCheckerUI.isSpyDevicesUI(this.allowedSpyScan);
|
|
20458
|
+
}
|
|
20459
|
+
} catch (error) {
|
|
20460
|
+
this.allowedSpyScan = false;
|
|
20461
|
+
this.DeviceCheckerUI && this.DeviceCheckerUI.waitingSpyDevices(false);
|
|
20462
|
+
this.DeviceCheckerUI && this.DeviceCheckerUI.isSpyDevicesUI(this.allowedSpyScan);
|
|
20463
|
+
console.log(error);
|
|
20464
|
+
}
|
|
20465
|
+
}
|
|
20466
|
+
}
|
|
20013
20467
|
};
|
|
20014
20468
|
var DeviceCheckerService = _DeviceCheckerService;
|
|
20015
20469
|
DeviceCheckerService.isModalOpen = false;
|
|
@@ -20371,9 +20825,9 @@ var Extension = class {
|
|
|
20371
20825
|
|
|
20372
20826
|
// src/modules/onChangeDevices.ts
|
|
20373
20827
|
var onChangeDevices = class {
|
|
20374
|
-
constructor(repositoryDevices,
|
|
20828
|
+
constructor(repositoryDevices, proctoringId2) {
|
|
20375
20829
|
this.repositoryDevices = repositoryDevices;
|
|
20376
|
-
this.proctoringId =
|
|
20830
|
+
this.proctoringId = proctoringId2;
|
|
20377
20831
|
}
|
|
20378
20832
|
startRecording(options) {
|
|
20379
20833
|
navigator.mediaDevices.ondevicechange = () => {
|
|
@@ -20404,7 +20858,7 @@ var onChangeDevices = class {
|
|
|
20404
20858
|
};
|
|
20405
20859
|
await this.repositoryDevices.save({ ...devices, id: "devices", status: devices.cameras.length > (copy == null ? void 0 : copy.cameras.length) || devices.microphones.length > (copy == null ? void 0 : copy.microphones.length) ? "in" : "out" });
|
|
20406
20860
|
if (options.status && (devicesChanged.cameras.length != 0 || devicesChanged.microphones.length != 0)) {
|
|
20407
|
-
trackers.registerChangeDevice(this.proctoringId, devicesChanged.status, devicesChanged);
|
|
20861
|
+
trackers.registerChangeDevice(this.proctoringId, devicesChanged.status, JSON.stringify(devicesChanged, null, 2));
|
|
20408
20862
|
options.status(devicesChanged);
|
|
20409
20863
|
}
|
|
20410
20864
|
}
|
|
@@ -20413,9 +20867,9 @@ var onChangeDevices = class {
|
|
|
20413
20867
|
// src/new-flow/download/downloadService.ts
|
|
20414
20868
|
var import_file_saver = __toESM(require_FileSaver_min());
|
|
20415
20869
|
var DownloadService = class {
|
|
20416
|
-
constructor(
|
|
20870
|
+
constructor(proctoringId2) {
|
|
20417
20871
|
this.loadingBoolean = true;
|
|
20418
|
-
this.proctoringId =
|
|
20872
|
+
this.proctoringId = proctoringId2;
|
|
20419
20873
|
}
|
|
20420
20874
|
async upload(data, token) {
|
|
20421
20875
|
const { file, onProgress } = data;
|
|
@@ -20447,7 +20901,7 @@ var ProctoringRecorder = class {
|
|
|
20447
20901
|
async startAll() {
|
|
20448
20902
|
this.session.start();
|
|
20449
20903
|
for (const rec of this.recorders) {
|
|
20450
|
-
await rec.startRecording();
|
|
20904
|
+
await rec.startRecording({ retry: false });
|
|
20451
20905
|
}
|
|
20452
20906
|
}
|
|
20453
20907
|
async pauseAll() {
|
|
@@ -20477,9 +20931,9 @@ var ProctoringRecorder = class {
|
|
|
20477
20931
|
|
|
20478
20932
|
// src/new-flow/proctoring/ProctoringUploader.ts
|
|
20479
20933
|
var ProctoringUploader = class {
|
|
20480
|
-
constructor(session,
|
|
20934
|
+
constructor(session, proctoringId2, uploadServices) {
|
|
20481
20935
|
this.session = session;
|
|
20482
|
-
this.proctoringId =
|
|
20936
|
+
this.proctoringId = proctoringId2;
|
|
20483
20937
|
this.uploadServices = uploadServices;
|
|
20484
20938
|
}
|
|
20485
20939
|
async upload(token, progress) {
|
|
@@ -20601,7 +21055,8 @@ var AlertRecorder = class {
|
|
|
20601
21055
|
this.alerts.push({
|
|
20602
21056
|
begin: Date.now() - this.startTime.getTime(),
|
|
20603
21057
|
end: 0,
|
|
20604
|
-
alert: 25 /* LostFocus
|
|
21058
|
+
alert: 25 /* LostFocus */,
|
|
21059
|
+
type: 3 /* Screen */
|
|
20605
21060
|
});
|
|
20606
21061
|
}
|
|
20607
21062
|
}
|
|
@@ -20633,7 +21088,7 @@ var AudioRecorder = class {
|
|
|
20633
21088
|
audio: { deviceId: this.options.microphoneId || "default" }
|
|
20634
21089
|
};
|
|
20635
21090
|
this.audioStream = await navigator.mediaDevices.getUserMedia(constraints);
|
|
20636
|
-
const { startRecording, stopRecording, pauseRecording, resumeRecording } = recorder(this.audioStream, this.blobs, void 0, void 0,
|
|
21091
|
+
const { startRecording, stopRecording, pauseRecording, resumeRecording } = recorder(this.audioStream, this.blobs, void 0, void 0, true);
|
|
20637
21092
|
this.recordingStart = startRecording;
|
|
20638
21093
|
this.recordingStop = stopRecording;
|
|
20639
21094
|
this.recordingPause = pauseRecording;
|
|
@@ -22948,8 +23403,8 @@ var NoiseRecorder = class {
|
|
|
22948
23403
|
this.backend = backend;
|
|
22949
23404
|
this.backendToken = backendToken;
|
|
22950
23405
|
}
|
|
22951
|
-
setProctoringId(
|
|
22952
|
-
this.proctoringId =
|
|
23406
|
+
setProctoringId(proctoringId2) {
|
|
23407
|
+
this.proctoringId = proctoringId2;
|
|
22953
23408
|
this.proctoringId && this.backend && (this.upload = new UploadService(this.proctoringId, this.backend));
|
|
22954
23409
|
}
|
|
22955
23410
|
async startRecording() {
|
|
@@ -23160,8 +23615,9 @@ var ScreenRecorder = class {
|
|
|
23160
23615
|
this.blobsFinal = [];
|
|
23161
23616
|
this.options = options;
|
|
23162
23617
|
}
|
|
23163
|
-
setProctoringId(
|
|
23164
|
-
this.proctoringId =
|
|
23618
|
+
setProctoringId(proctoringId2) {
|
|
23619
|
+
this.proctoringId = proctoringId2;
|
|
23620
|
+
setRecorderProctoringId(proctoringId2);
|
|
23165
23621
|
}
|
|
23166
23622
|
async startRecording() {
|
|
23167
23623
|
this.startTime = new Date(Date.now());
|
|
@@ -23209,7 +23665,7 @@ var ScreenRecorder = class {
|
|
|
23209
23665
|
});
|
|
23210
23666
|
throw NOT_SHARED_SCREEN;
|
|
23211
23667
|
}
|
|
23212
|
-
const { startRecording, stopRecording } = recorder(this.screenStream, this.blobs, this.
|
|
23668
|
+
const { startRecording, stopRecording } = recorder(this.screenStream, this.blobs, this.options.onBufferSizeError, onBufferSizeErrorCallback);
|
|
23213
23669
|
this.recordingStart = startRecording;
|
|
23214
23670
|
this.recordingStop = stopRecording;
|
|
23215
23671
|
this.recordingStart();
|
|
@@ -23466,7 +23922,7 @@ var Proctoring = class {
|
|
|
23466
23922
|
this.onRealtimeAlertsCallback = (response) => {
|
|
23467
23923
|
return;
|
|
23468
23924
|
};
|
|
23469
|
-
this.onBufferSizeErrorCallback = () => {
|
|
23925
|
+
this.onBufferSizeErrorCallback = (cameraStream) => {
|
|
23470
23926
|
return;
|
|
23471
23927
|
};
|
|
23472
23928
|
var _a2;
|
|
@@ -23508,7 +23964,7 @@ var Proctoring = class {
|
|
|
23508
23964
|
this.onRealtimeAlertsCallback = (response) => options.data && options.data(response);
|
|
23509
23965
|
}
|
|
23510
23966
|
setOnBufferSizeErrorCallback(cb) {
|
|
23511
|
-
this.onBufferSizeErrorCallback = () => cb();
|
|
23967
|
+
this.onBufferSizeErrorCallback = (cameraStream) => cb(cameraStream);
|
|
23512
23968
|
}
|
|
23513
23969
|
createRecorders(options = getDefaultProctoringOptions) {
|
|
23514
23970
|
var _a2, _b;
|
|
@@ -23518,7 +23974,7 @@ var Proctoring = class {
|
|
|
23518
23974
|
cameraId: this.sessionOptions.cameraId,
|
|
23519
23975
|
microphoneId: this.sessionOptions.microphoneId,
|
|
23520
23976
|
onBufferSizeError: this.sessionOptions.onBufferSizeError,
|
|
23521
|
-
onBufferSizeErrorCallback: () => this.onBufferSizeErrorCallback(),
|
|
23977
|
+
onBufferSizeErrorCallback: (cameraStream) => this.onBufferSizeErrorCallback(cameraStream),
|
|
23522
23978
|
proctoringType: this.sessionOptions.proctoringType,
|
|
23523
23979
|
onChangeDevicesCallback: (devices) => this.onChangeDevicesCallback(devices),
|
|
23524
23980
|
onRealtimeAlertsCallback: (response) => this.onRealtimeAlertsCallback(response)
|
|
@@ -23572,6 +24028,7 @@ var Proctoring = class {
|
|
|
23572
24028
|
this.context.token = await this.auth.login();
|
|
23573
24029
|
}
|
|
23574
24030
|
async start(options = getDefaultProctoringOptions, _videoOptions = {}) {
|
|
24031
|
+
var _a2;
|
|
23575
24032
|
try {
|
|
23576
24033
|
if (this.context.token === void 0) {
|
|
23577
24034
|
throw TOKEN_MISSING;
|
|
@@ -23586,6 +24043,13 @@ var Proctoring = class {
|
|
|
23586
24043
|
await this.initConfig(options.useGeolocation);
|
|
23587
24044
|
await this.verifyBrowser();
|
|
23588
24045
|
this.sessionOptions.captureScreen && await this.verifyMultipleMonitors(this.sessionOptions);
|
|
24046
|
+
try {
|
|
24047
|
+
if (options == null ? void 0 : options.useSpyScan) {
|
|
24048
|
+
await this.spyCam.isAlive();
|
|
24049
|
+
}
|
|
24050
|
+
} catch (error) {
|
|
24051
|
+
throw SPY_SCAN_API_NOT_FOUND;
|
|
24052
|
+
}
|
|
23589
24053
|
if (this.state != "Stop" /* Stop */) {
|
|
23590
24054
|
throw PROCTORING_ALREADY_STARTED;
|
|
23591
24055
|
}
|
|
@@ -23610,6 +24074,12 @@ var Proctoring = class {
|
|
|
23610
24074
|
this.allRecorders.cameraRecorder.setProctoringId(this.proctoringId);
|
|
23611
24075
|
this.allRecorders.noiseRecorder.setProctoringId(this.proctoringId);
|
|
23612
24076
|
this.proctoringSession.setProctoringId(this.proctoringId);
|
|
24077
|
+
if (options == null ? void 0 : options.useSpyScan) {
|
|
24078
|
+
this.spyCam.setProctoringId(this.proctoringId);
|
|
24079
|
+
this.spyCam.startCheckSpyCam((_a2 = this.paramsConfig.spyScanInterval) != null ? _a2 : 5, {
|
|
24080
|
+
deviceType: 3 /* POTENCIAL_CAMERA */
|
|
24081
|
+
});
|
|
24082
|
+
}
|
|
23613
24083
|
await this.repository.save(this.proctoringSession);
|
|
23614
24084
|
const _navigator = {};
|
|
23615
24085
|
for (const i3 in navigator)
|
|
@@ -23643,6 +24113,7 @@ Error: ${error}`
|
|
|
23643
24113
|
async cancel() {
|
|
23644
24114
|
if (this.state === "Recording" /* Recording */ || this.state === "Starting" /* Starting */) {
|
|
23645
24115
|
await this.recorder.stopAll();
|
|
24116
|
+
this.spyCam && await this.spyCam.stopCheckSpyCam();
|
|
23646
24117
|
}
|
|
23647
24118
|
this.state = "Stop" /* Stop */;
|
|
23648
24119
|
}
|
|
@@ -23653,6 +24124,7 @@ Error: ${error}`
|
|
|
23653
24124
|
throw PROCTORING_NOT_STARTED;
|
|
23654
24125
|
}
|
|
23655
24126
|
await this.recorder.stopAll();
|
|
24127
|
+
this.spyCam && this.spyCam.stopCheckSpyCam();
|
|
23656
24128
|
await this.recorder.saveAllOnSession();
|
|
23657
24129
|
await this.repository.save(this.proctoringSession);
|
|
23658
24130
|
let uploader;
|
|
@@ -23731,7 +24203,7 @@ Upload Services: ${uploaderServices}`,
|
|
|
23731
24203
|
);
|
|
23732
24204
|
}
|
|
23733
24205
|
if (this.proctoringSession.alerts.length > 0) {
|
|
23734
|
-
await this.backend.
|
|
24206
|
+
await this.backend.saveAlerts(this.context, this.proctoringSession).catch((err) => {
|
|
23735
24207
|
trackers.registerFinish(
|
|
23736
24208
|
this.proctoringSession.id,
|
|
23737
24209
|
false,
|
|
@@ -23785,6 +24257,7 @@ Error: ` + error
|
|
|
23785
24257
|
}
|
|
23786
24258
|
}
|
|
23787
24259
|
async initConfig(useGeolocation) {
|
|
24260
|
+
var _a2;
|
|
23788
24261
|
try {
|
|
23789
24262
|
const paramsConfig = await this.backend.getParamsConfig(
|
|
23790
24263
|
this.context
|
|
@@ -23811,6 +24284,11 @@ Error: ` + error
|
|
|
23811
24284
|
});
|
|
23812
24285
|
}
|
|
23813
24286
|
init(this.backend);
|
|
24287
|
+
if ((_a2 = this.sessionOptions) == null ? void 0 : _a2.useSpyScan) {
|
|
24288
|
+
this.spyCam = new SpyCam(this.context, {
|
|
24289
|
+
onRealtimeAlertsCallback: (response) => this.onRealtimeAlertsCallback(response)
|
|
24290
|
+
});
|
|
24291
|
+
}
|
|
23814
24292
|
} catch (err) {
|
|
23815
24293
|
this.proctoringId && trackers.registerError(this.proctoringId, "Erro no initConfig!");
|
|
23816
24294
|
await this.cancel();
|
|
@@ -23856,6 +24334,200 @@ Error: ` + error
|
|
|
23856
24334
|
}
|
|
23857
24335
|
};
|
|
23858
24336
|
|
|
24337
|
+
// src/proctoring/SignTerm.ts
|
|
24338
|
+
var _SignTerm = class {
|
|
24339
|
+
constructor(context) {
|
|
24340
|
+
this.backend = new BackendService({
|
|
24341
|
+
type: (context == null ? void 0 : context.type) || "prod",
|
|
24342
|
+
token: context.token
|
|
24343
|
+
});
|
|
24344
|
+
}
|
|
24345
|
+
async signInTerms() {
|
|
24346
|
+
if (_SignTerm.isModalOpen) {
|
|
24347
|
+
return Promise.reject();
|
|
24348
|
+
}
|
|
24349
|
+
_SignTerm.isModalOpen = true;
|
|
24350
|
+
try {
|
|
24351
|
+
const response = await this.openModal();
|
|
24352
|
+
return new Promise((resolve) => {
|
|
24353
|
+
resolve(response);
|
|
24354
|
+
});
|
|
24355
|
+
} catch (error) {
|
|
24356
|
+
this.closeModal();
|
|
24357
|
+
return Promise.reject(error);
|
|
24358
|
+
}
|
|
24359
|
+
}
|
|
24360
|
+
openModal() {
|
|
24361
|
+
return new Promise((resolve, reject) => {
|
|
24362
|
+
const fullBg = document.createElement("div");
|
|
24363
|
+
fullBg.setAttribute("id", "signTermModal");
|
|
24364
|
+
const fullBgStyles = {
|
|
24365
|
+
backgroundColor: "rgba(0,0,0,0.4)",
|
|
24366
|
+
zIndex: "1000",
|
|
24367
|
+
position: "fixed",
|
|
24368
|
+
top: "0",
|
|
24369
|
+
left: "0",
|
|
24370
|
+
height: "100vh",
|
|
24371
|
+
width: "100%",
|
|
24372
|
+
display: "flex",
|
|
24373
|
+
alignItems: "center",
|
|
24374
|
+
justifyContent: "center"
|
|
24375
|
+
};
|
|
24376
|
+
this.applyStyles(fullBg, fullBgStyles);
|
|
24377
|
+
const modal = document.createElement("div");
|
|
24378
|
+
const modalStyles = {
|
|
24379
|
+
backgroundColor: "#fff",
|
|
24380
|
+
zIndex: "1001",
|
|
24381
|
+
width: "850px",
|
|
24382
|
+
maxHeight: "95%",
|
|
24383
|
+
borderRadius: "10px",
|
|
24384
|
+
display: "flex",
|
|
24385
|
+
flexDirection: "column",
|
|
24386
|
+
alignItems: "center"
|
|
24387
|
+
};
|
|
24388
|
+
this.applyStyles(modal, modalStyles);
|
|
24389
|
+
const h3 = document.createElement("h3");
|
|
24390
|
+
h3.innerText = "Termo de consentimento para coleta e uso de dados";
|
|
24391
|
+
const h3Styles = {
|
|
24392
|
+
color: "rgba(0, 0, 0, .7)",
|
|
24393
|
+
fontWeight: "bold",
|
|
24394
|
+
fontSize: "20px",
|
|
24395
|
+
marginBottom: "15px",
|
|
24396
|
+
padding: "20px 0px",
|
|
24397
|
+
borderBottom: "2px solid rgba(0, 0, 0, .1)",
|
|
24398
|
+
width: "100%",
|
|
24399
|
+
textAlign: "center"
|
|
24400
|
+
};
|
|
24401
|
+
this.applyStyles(h3, h3Styles);
|
|
24402
|
+
modal.appendChild(h3);
|
|
24403
|
+
const docEmbed = document.createElement("iframe");
|
|
24404
|
+
const defaultUrl = "https://docs.google.com/document/u/3/d/e/2PACX-1vRMgrLhDLyDP8BHmotfPDpwAFaDHqK-mA4eBJ0Cy1mDdvHcWLsx47H4otII_4qi4rhtSf6B0OO97e9c/pub";
|
|
24405
|
+
this.backend.signTermUrl().then((response) => {
|
|
24406
|
+
if (!response)
|
|
24407
|
+
throw new Error("N\xE3o foi poss\xEDvel obter o termo de consentimento");
|
|
24408
|
+
docEmbed.setAttribute("src", response);
|
|
24409
|
+
}).catch(() => {
|
|
24410
|
+
docEmbed.setAttribute("src", defaultUrl);
|
|
24411
|
+
});
|
|
24412
|
+
const docEmbedStyles = {
|
|
24413
|
+
width: "100%",
|
|
24414
|
+
height: "500px",
|
|
24415
|
+
border: "1px solid rgba(0, 0, 0, .1)",
|
|
24416
|
+
margin: "20px",
|
|
24417
|
+
borderRadius: "5px"
|
|
24418
|
+
};
|
|
24419
|
+
this.applyStyles(docEmbed, docEmbedStyles);
|
|
24420
|
+
modal.appendChild(docEmbed);
|
|
24421
|
+
const checkboxContainer = document.createElement("div");
|
|
24422
|
+
const checkbox = document.createElement("input");
|
|
24423
|
+
checkbox.setAttribute("type", "checkbox");
|
|
24424
|
+
checkbox.setAttribute("id", "termsCheckbox");
|
|
24425
|
+
const checkboxLabel = document.createElement("label");
|
|
24426
|
+
checkboxLabel.setAttribute("for", "termsCheckbox");
|
|
24427
|
+
checkboxLabel.innerText = "Li e aceito os termos e condi\xE7\xF5es";
|
|
24428
|
+
const checkboxContainerStyles = {
|
|
24429
|
+
display: "flex",
|
|
24430
|
+
alignItems: "center",
|
|
24431
|
+
gap: "10px",
|
|
24432
|
+
margin: "20px",
|
|
24433
|
+
width: "100%",
|
|
24434
|
+
paddingLeft: "20px"
|
|
24435
|
+
};
|
|
24436
|
+
this.applyStyles(checkboxContainer, checkboxContainerStyles);
|
|
24437
|
+
checkboxContainer.appendChild(checkbox);
|
|
24438
|
+
checkboxContainer.appendChild(checkboxLabel);
|
|
24439
|
+
modal.appendChild(checkboxContainer);
|
|
24440
|
+
const divBtn = document.createElement("div");
|
|
24441
|
+
const divBtnStyles = {
|
|
24442
|
+
width: "100%",
|
|
24443
|
+
display: "flex",
|
|
24444
|
+
alignItems: "center",
|
|
24445
|
+
justifyContent: "center",
|
|
24446
|
+
borderTop: "2px solid rgba(0, 0, 0, .1)"
|
|
24447
|
+
};
|
|
24448
|
+
this.applyStyles(divBtn, divBtnStyles);
|
|
24449
|
+
const buttonCancel = document.createElement("button");
|
|
24450
|
+
buttonCancel.innerText = "Cancelar";
|
|
24451
|
+
const buttonCancelStyles = {
|
|
24452
|
+
width: "100%",
|
|
24453
|
+
height: "70px",
|
|
24454
|
+
backgroundColor: "#FFF",
|
|
24455
|
+
border: "none",
|
|
24456
|
+
color: "rgba(0, 0, 0, .7)",
|
|
24457
|
+
fontWeight: "bold",
|
|
24458
|
+
borderRadius: "10px",
|
|
24459
|
+
paddingTop: "5px",
|
|
24460
|
+
paddingBottom: "5px"
|
|
24461
|
+
};
|
|
24462
|
+
this.applyStyles(buttonCancel, buttonCancelStyles);
|
|
24463
|
+
buttonCancel.addEventListener("click", () => {
|
|
24464
|
+
this.closeModal();
|
|
24465
|
+
resolve(false);
|
|
24466
|
+
});
|
|
24467
|
+
const divider = document.createElement("span");
|
|
24468
|
+
const dividerStyles = {
|
|
24469
|
+
width: "3px",
|
|
24470
|
+
height: "70px",
|
|
24471
|
+
margin: "0px 2px",
|
|
24472
|
+
background: "rgba(0, 0, 0, .1)"
|
|
24473
|
+
};
|
|
24474
|
+
this.applyStyles(divider, dividerStyles);
|
|
24475
|
+
const button = document.createElement("button");
|
|
24476
|
+
button.innerText = "Continuar";
|
|
24477
|
+
button.setAttribute("id", "confirmBtn");
|
|
24478
|
+
const buttonStyles = {
|
|
24479
|
+
width: "100%",
|
|
24480
|
+
height: "70px",
|
|
24481
|
+
backgroundColor: "#FFF",
|
|
24482
|
+
border: "none",
|
|
24483
|
+
color: "rgba(0, 0, 0, .7)",
|
|
24484
|
+
fontWeight: "bold",
|
|
24485
|
+
borderRadius: "10px",
|
|
24486
|
+
paddingTop: "5px",
|
|
24487
|
+
paddingBottom: "5px",
|
|
24488
|
+
disabled: true,
|
|
24489
|
+
cursor: "not-allowed"
|
|
24490
|
+
};
|
|
24491
|
+
this.applyStyles(button, buttonStyles);
|
|
24492
|
+
button.disabled = true;
|
|
24493
|
+
button.addEventListener("click", () => {
|
|
24494
|
+
this.closeModal();
|
|
24495
|
+
this.backend.signTerm().then(() => {
|
|
24496
|
+
resolve(true);
|
|
24497
|
+
});
|
|
24498
|
+
});
|
|
24499
|
+
checkbox.addEventListener("change", (e3) => {
|
|
24500
|
+
button.disabled = !e3.target.checked;
|
|
24501
|
+
if (e3.target.checked) {
|
|
24502
|
+
button.style.color = "#007bff";
|
|
24503
|
+
button.style.cursor = "pointer";
|
|
24504
|
+
} else {
|
|
24505
|
+
button.style.color = "rgba(0, 0, 0, .7)";
|
|
24506
|
+
button.style.cursor = "not-allowed";
|
|
24507
|
+
}
|
|
24508
|
+
});
|
|
24509
|
+
divBtn.appendChild(buttonCancel);
|
|
24510
|
+
divBtn.appendChild(divider);
|
|
24511
|
+
divBtn.appendChild(button);
|
|
24512
|
+
modal.appendChild(divBtn);
|
|
24513
|
+
fullBg.appendChild(modal);
|
|
24514
|
+
document.body.appendChild(fullBg);
|
|
24515
|
+
});
|
|
24516
|
+
}
|
|
24517
|
+
async closeModal() {
|
|
24518
|
+
_SignTerm.isModalOpen = false;
|
|
24519
|
+
const signTermModal = document.querySelector("#signTermModal");
|
|
24520
|
+
signTermModal == null ? void 0 : signTermModal.remove();
|
|
24521
|
+
}
|
|
24522
|
+
applyStyles(element, styles) {
|
|
24523
|
+
for (const [property, value] of Object.entries(styles)) {
|
|
24524
|
+
element.style[property] = value;
|
|
24525
|
+
}
|
|
24526
|
+
}
|
|
24527
|
+
};
|
|
24528
|
+
var SignTerm = _SignTerm;
|
|
24529
|
+
SignTerm.isModalOpen = false;
|
|
24530
|
+
|
|
23859
24531
|
// src/proctoring/useProctoring.ts
|
|
23860
24532
|
function useProctoring(proctoringOptions, enviromentConfig = "prod") {
|
|
23861
24533
|
if (!proctoringOptions.showConsole) {
|
|
@@ -23866,22 +24538,17 @@ function useProctoring(proctoringOptions, enviromentConfig = "prod") {
|
|
|
23866
24538
|
console.error = () => {
|
|
23867
24539
|
};
|
|
23868
24540
|
}
|
|
23869
|
-
const
|
|
23870
|
-
type: enviromentConfig,
|
|
23871
|
-
clientId: proctoringOptions.clientId,
|
|
23872
|
-
examId: proctoringOptions.examId,
|
|
23873
|
-
token: proctoringOptions.token,
|
|
23874
|
-
credentials: proctoringOptions.credentials,
|
|
23875
|
-
showConsole: proctoringOptions.showConsole
|
|
23876
|
-
});
|
|
23877
|
-
const checker = new DeviceCheckerService({
|
|
24541
|
+
const parameters = {
|
|
23878
24542
|
type: enviromentConfig,
|
|
23879
24543
|
clientId: proctoringOptions.clientId,
|
|
23880
24544
|
examId: proctoringOptions.examId,
|
|
23881
24545
|
token: proctoringOptions.token,
|
|
23882
24546
|
credentials: proctoringOptions.credentials,
|
|
23883
24547
|
showConsole: proctoringOptions.showConsole
|
|
23884
|
-
}
|
|
24548
|
+
};
|
|
24549
|
+
const proctoring = new Proctoring(parameters);
|
|
24550
|
+
const checker = new DeviceCheckerService(parameters);
|
|
24551
|
+
const signTerm = new SignTerm(parameters);
|
|
23885
24552
|
const photo = new CapturePhoto();
|
|
23886
24553
|
const login = proctoring.login.bind(proctoring);
|
|
23887
24554
|
const start = proctoring.start.bind(proctoring);
|
|
@@ -23894,6 +24561,7 @@ function useProctoring(proctoringOptions, enviromentConfig = "prod") {
|
|
|
23894
24561
|
const onBufferSizeError = proctoring.setOnBufferSizeErrorCallback.bind(proctoring);
|
|
23895
24562
|
const onStopSharingScreen = proctoring.setOnStopSharingScreenCallback.bind(proctoring);
|
|
23896
24563
|
const onRealtimeAlerts = proctoring.onRealtimeAlerts.bind(proctoring);
|
|
24564
|
+
const signInTerms = signTerm.signInTerms.bind(signTerm);
|
|
23897
24565
|
const checkDevices = checker.checkDevices.bind(checker);
|
|
23898
24566
|
const runCheckDevicesFlow = checker.runCheckDevicesFlow.bind(checker);
|
|
23899
24567
|
const changeSelectedDevice = checker.changeSelectedDevice.bind(checker);
|
|
@@ -23914,7 +24582,8 @@ function useProctoring(proctoringOptions, enviromentConfig = "prod") {
|
|
|
23914
24582
|
enumarateDevices,
|
|
23915
24583
|
checkPermissions,
|
|
23916
24584
|
checkIfhasMultipleMonitors,
|
|
23917
|
-
onStopSharingScreen
|
|
24585
|
+
onStopSharingScreen,
|
|
24586
|
+
signInTerms
|
|
23918
24587
|
};
|
|
23919
24588
|
}
|
|
23920
24589
|
|