easyproctor-hml 2.5.22 → 2.5.23

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 CHANGED
@@ -263,46 +263,17 @@ const {
263
263
  token: "...",
264
264
  });
265
265
  ```
266
+ ## Release Note V 2.4.0
267
+ - Compatibilidade com dispositivos móveis
266
268
 
267
- ## Release Note V 2.5.4
268
- - Fix: Correção sobre as imagens do realtime
269
-
270
- ## Release Note V 2.5.4
271
- - Novos alertas de tela (Clipboard, SplitScreen)
272
- - Ajustes na detecção de foco da tela
273
- - Melhorias na analise biométrica
274
- - Melhorias na analise do uso de dispositivos
275
- - Correção do uso de câmera externa no ambiente de produção
276
-
277
- ## Release Note V 2.5.3
278
- - Fix: Resolução do video
279
- - Melhorias no proctoring do tipo REALTIME
280
-
281
- ## Release Note V 2.5.2
282
- - Alteração do nome do callback 'onFinish' para 'onResultAvailable'
283
- - Melhorias no proctoring do tipo REALTIME
284
-
285
- ## Release Note V 2.5.1
286
- - Novos atributos no callback de 'onFinish'
287
- - scoreThreshold: limiar de aprovação da sessão de proctoring
288
- - justification: em caso de reprovação, esse campo traz o resumo das irregularidades
289
-
290
- ## Release Note V 2.5.0
291
- - Callback de 'onFinish' no hook de finish que permite o acesso ao resultado da auditoria de forma imediata
292
- - Melhorias no proctoring em tempo real
293
- - Melhorias no monitoramento ativo durante o exame
294
- - Novos tipos de alertas do onRealtimeAlerts:
295
- - position_detection_on_stream:
296
- - wrong_face_size_detected: Face muito perto da câmera, afaste-se um pouco mais
297
- - wrong_face_position_edge_detected: Face muito próxima da borda, mova-se para o centro da tela
298
- - wrong_face_position_move_right_detected: Face não centralizada, mova-se para a direita
299
- - wrong_face_position_move_top_detected: Face não centralizada, mova-se para cima
300
- - wrong_face_position_move_left_detected: Face não centralizada, mova-se para a esquerda
301
- - wrong_face_position_move_bottom_detected: Face não centralizada, mova-se para baixo
269
+ ## Release Note V 2.3.3
270
+ - Correção do reset no startSession
302
271
 
272
+ ## Release Note V 2.3.2
273
+ - Melhorias no fluxo da câmera externa (reset e goToExternalCameraPositionStep)
303
274
 
304
275
  ## Release Note V 2.4.0
305
- - Compatibilidade com dispositivos móveis
276
+ - Compatibilidade com dispositivos móveis implementada
306
277
 
307
278
  ## Release Note V 2.3.3
308
279
  - Correção do reset no startSession
package/esm/index.js CHANGED
@@ -12267,7 +12267,7 @@ function recorder(stream, buffer, videoOptions, onBufferSizeError = false, onBuf
12267
12267
  let recorderOptions = {
12268
12268
  // eslint-disable-next-line no-useless-escape
12269
12269
  mimeType: "video/webm",
12270
- videoBitsPerSecond: (videoOptions == null ? void 0 : videoOptions.videoBitsPerSecond) || 128e3,
12270
+ videoBitsPerSecond: 128e3,
12271
12271
  audioBitsPerSecond: 64 * 1e3
12272
12272
  };
12273
12273
  if (MediaRecorder.isTypeSupported("video/webm;codecs=vp9")) {
@@ -12280,6 +12280,9 @@ function recorder(stream, buffer, videoOptions, onBufferSizeError = false, onBuf
12280
12280
  if (videoOptions == null ? void 0 : videoOptions.mimeType) {
12281
12281
  recorderOptions.mimeType = videoOptions == null ? void 0 : videoOptions.mimeType;
12282
12282
  }
12283
+ if ((videoOptions == null ? void 0 : videoOptions.videoBitsPerSecond) != void 0) {
12284
+ recorderOptions.videoBitsPerSecond = videoOptions == null ? void 0 : videoOptions.videoBitsPerSecond;
12285
+ }
12283
12286
  if (audio) {
12284
12287
  recorderOptions = {
12285
12288
  mimeType: "audio/webm",
@@ -12309,6 +12312,7 @@ function recorder(stream, buffer, videoOptions, onBufferSizeError = false, onBuf
12309
12312
  proctoringId,
12310
12313
  `onBufferSizeError: Recorder size equal 0 Mb`
12311
12314
  );
12315
+ console.log("onbuffer size error");
12312
12316
  onBufferSizeErrorCallback && onBufferSizeErrorCallback();
12313
12317
  }
12314
12318
  lastEvent = e3;
@@ -12323,8 +12327,12 @@ function recorder(stream, buffer, videoOptions, onBufferSizeError = false, onBuf
12323
12327
  function startRecording() {
12324
12328
  return new Promise((resolve) => {
12325
12329
  resolvePromise = resolve;
12326
- console.log("startRecording", videoOptions == null ? void 0 : videoOptions.timeSlice);
12327
- mediaRecorder.start((videoOptions == null ? void 0 : videoOptions.timeSlice) || 1e4);
12330
+ var timeSlice = 1e4;
12331
+ if ((videoOptions == null ? void 0 : videoOptions.timeSlice) != void 0) {
12332
+ timeSlice = videoOptions == null ? void 0 : videoOptions.timeSlice;
12333
+ }
12334
+ console.log("startRecording", timeSlice);
12335
+ mediaRecorder.start(timeSlice);
12328
12336
  bufferSize = 0;
12329
12337
  stopped = false;
12330
12338
  });
@@ -12335,7 +12343,6 @@ function recorder(stream, buffer, videoOptions, onBufferSizeError = false, onBuf
12335
12343
  resolvePromise = resolve;
12336
12344
  mediaRecorder.stop();
12337
12345
  stopped = true;
12338
- clearInterval(onBufferSizeInterval);
12339
12346
  stream.getTracks().forEach((el) => {
12340
12347
  el.stop();
12341
12348
  });
@@ -12818,6 +12825,66 @@ var CameraRecorder = class {
12818
12825
  this.options.onBufferSizeErrorCallback && this.options.onBufferSizeErrorCallback();
12819
12826
  }
12820
12827
  }
12828
+ async startStream(options) {
12829
+ var _a2;
12830
+ const { cameraId, microphoneId, onBufferSizeErrorCallback } = this.options;
12831
+ const constraints = {
12832
+ audio: { deviceId: microphoneId },
12833
+ video: {
12834
+ deviceId: cameraId,
12835
+ width: this.videoOptions.width,
12836
+ height: this.videoOptions.height,
12837
+ frameRate: 15
12838
+ }
12839
+ };
12840
+ try {
12841
+ this.hardwareStream = await navigator.mediaDevices.getUserMedia(
12842
+ constraints
12843
+ );
12844
+ } catch (error) {
12845
+ if (error.toString() == "NotReadableError: Could not start video source")
12846
+ throw "N\xE3o foi poss\xEDvel conectar a camera, ela pode estar sendo utilizada por outro programa";
12847
+ throw error;
12848
+ }
12849
+ this.cameraStream = this.hardwareStream;
12850
+ const track = this.cameraStream.getVideoTracks()[0];
12851
+ const settings = track.getSettings();
12852
+ let { width = 0, height = 0 } = settings;
12853
+ const isPortrait = (_a2 = screen.orientation) == null ? void 0 : _a2.type.includes("portrait");
12854
+ if (isPortrait && isMobileDevice()) {
12855
+ if (this.videoOptions.width == height && this.videoOptions.height == width) {
12856
+ [width, height] = [height, width];
12857
+ }
12858
+ }
12859
+ if (this.videoOptions.minWidth > width || this.videoOptions.minHeight > height) {
12860
+ throw STREAM_UNDER_MINIMUM_PERMITTED;
12861
+ } else if (this.videoOptions.width !== width || this.videoOptions.height !== height) {
12862
+ trackers.registerAnotherStream(
12863
+ this.proctoringId,
12864
+ `Maybe have another stream active
12865
+ Video Options: ${JSON.stringify(
12866
+ this.videoOptions,
12867
+ null,
12868
+ 2
12869
+ )}
12870
+ Setting: ${JSON.stringify(settings, null, 2)}`
12871
+ );
12872
+ throw ANOTHER_STREAM_ACTIVE;
12873
+ }
12874
+ }
12875
+ async stopStream() {
12876
+ if (this.cameraStream) {
12877
+ this.cameraStream.getTracks().forEach((track) => track.stop());
12878
+ }
12879
+ if (this.internalClonedStream) {
12880
+ this.internalClonedStream.getTracks().forEach((track) => track.stop());
12881
+ this.internalClonedStream = null;
12882
+ }
12883
+ if (this.hardwareStream) {
12884
+ this.hardwareStream.getTracks().forEach((track) => track.stop());
12885
+ this.hardwareStream = null;
12886
+ }
12887
+ }
12821
12888
  async startRecording(options) {
12822
12889
  var _a2, _b, _c2, _d, _e3, _f, _g, _h;
12823
12890
  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)) {
@@ -14536,7 +14603,9 @@ var CapturePhoto = class {
14536
14603
  );
14537
14604
  await this.cameraRecorder.startRecording();
14538
14605
  cameraContainer.srcObject = this.cameraRecorder.cameraStream;
14539
- cameraContainer.play();
14606
+ cameraContainer.play().catch((e3) => {
14607
+ console.warn("Autoplay bloqueado ou erro ao iniciar v\xEDdeo:", e3);
14608
+ });
14540
14609
  }
14541
14610
  shot() {
14542
14611
  const cameraContainer = document.querySelector("#cameraStream");
@@ -14629,6 +14698,9 @@ var CapturePhoto = class {
14629
14698
  const video = document.createElement("video");
14630
14699
  video.setAttribute("id", "cameraStream");
14631
14700
  video.muted = true;
14701
+ video.setAttribute("playsinline", "true");
14702
+ video.setAttribute("webkit-playsinline", "true");
14703
+ video.autoplay = true;
14632
14704
  divCamera.style.position = "fixed";
14633
14705
  divCamera.style.top = "0";
14634
14706
  divCamera.style.left = "0";
@@ -14815,8 +14887,8 @@ var CapturePhoto = class {
14815
14887
  }
14816
14888
  };
14817
14889
 
14818
- // src/extension/extension.ts
14819
- var Extension = class {
14890
+ // src/extension/extensionEasyProctor.ts
14891
+ var ExtensionEasyProctor = class {
14820
14892
  constructor() {
14821
14893
  this.hasExtension = false;
14822
14894
  this.tryes = 0;
@@ -14861,6 +14933,89 @@ var Extension = class {
14861
14933
  }
14862
14934
  };
14863
14935
 
14936
+ // src/extension/extensionEasyCatcher.ts
14937
+ var ExtensionEasyCatcher = class {
14938
+ constructor(options) {
14939
+ this.hasExtension = false;
14940
+ this.tryes = 0;
14941
+ this.responseStart = false;
14942
+ this.options = options || {};
14943
+ }
14944
+ /**
14945
+ * Verifica se a extensão está instalada e ativa.
14946
+ * Retorna o número da versão se encontrada, ou lança erro após timeout.
14947
+ */
14948
+ checkExtensionInstalled(timeoutMs = 2e3) {
14949
+ return new Promise((resolve, reject) => {
14950
+ let handled = false;
14951
+ const handler = (event) => {
14952
+ if (event.source === window && event.data.sender === "easyproctor-extension" && event.data.message_name === "version") {
14953
+ handled = true;
14954
+ window.removeEventListener("message", handler);
14955
+ resolve(event.data.message);
14956
+ }
14957
+ };
14958
+ window.addEventListener("message", handler);
14959
+ window.postMessage({
14960
+ type: "easycatcher",
14961
+ func: "verifyExtensionEasycatcher"
14962
+ }, "*");
14963
+ setTimeout(() => {
14964
+ if (!handled) {
14965
+ window.removeEventListener("message", handler);
14966
+ reject(new Error("Extens\xE3o n\xE3o detectada ou n\xE3o respondeu."));
14967
+ }
14968
+ }, timeoutMs);
14969
+ });
14970
+ }
14971
+ /**
14972
+ * Solicita o JSON da sessão atual capturado pela extensão.
14973
+ */
14974
+ getSessionData(timeoutMs = 5e3) {
14975
+ return new Promise((resolve, reject) => {
14976
+ let handled = false;
14977
+ const handler = (event) => {
14978
+ if (event.source === window && event.data.sender === "easyproctor-extension" && event.data.message_name === "data_response") {
14979
+ handled = true;
14980
+ window.removeEventListener("message", handler);
14981
+ resolve(event.data.payload);
14982
+ }
14983
+ };
14984
+ window.addEventListener("message", handler);
14985
+ window.postMessage({
14986
+ type: "easycatcher",
14987
+ func: "getDataExtensionEasycatcher"
14988
+ }, "*");
14989
+ setTimeout(() => {
14990
+ if (!handled) {
14991
+ window.removeEventListener("message", handler);
14992
+ reject(new Error("Timeout ao aguardar dados da extens\xE3o."));
14993
+ }
14994
+ }, timeoutMs);
14995
+ });
14996
+ }
14997
+ start() {
14998
+ return new Promise((resolve, reject) => {
14999
+ let handled = false;
15000
+ const handler = (event) => {
15001
+ if (event.source === window && event.data.sender === "easyproctor-extension" && event.data.message_name === "started_confirmed") {
15002
+ handled = true;
15003
+ window.removeEventListener("message", handler);
15004
+ resolve(true);
15005
+ }
15006
+ };
15007
+ window.addEventListener("message", handler);
15008
+ window.postMessage({ type: "easycatcher", func: "startExtensionEasycatcher" }, "*");
15009
+ setTimeout(() => {
15010
+ if (!handled) {
15011
+ window.removeEventListener("message", handler);
15012
+ reject(new Error("Timeout: Extens\xE3o n\xE3o confirmou o in\xEDcio."));
15013
+ }
15014
+ }, 3e3);
15015
+ });
15016
+ }
15017
+ };
15018
+
14864
15019
  // src/modules/onChangeDevices.ts
14865
15020
  var onChangeDevices = class {
14866
15021
  constructor(repositoryDevices, proctoringId2, sessionOptions, allRecorders) {
@@ -20958,6 +21113,7 @@ var _ExternalCameraChecker = class _ExternalCameraChecker {
20958
21113
  this.connection = null;
20959
21114
  this.context = context;
20960
21115
  this.onRealtimeAlertsCallback = onRealtimeAlertsCallback;
21116
+ console.log("context -> ", context);
20961
21117
  this.backend = new BackendService({
20962
21118
  type: (context == null ? void 0 : context.type) || "prod",
20963
21119
  token: context.token
@@ -20971,6 +21127,7 @@ var _ExternalCameraChecker = class _ExternalCameraChecker {
20971
21127
  try {
20972
21128
  this.transmissionOk = false;
20973
21129
  const response = await this.backend.externalCameraCheckTransmission("" + this.externalSessionId);
21130
+ console.log(response);
20974
21131
  let attempts = 0;
20975
21132
  while (!this.transmissionOk && attempts <= 5) {
20976
21133
  await new Promise((resolve) => setTimeout(resolve, 2e3));
@@ -20987,13 +21144,16 @@ var _ExternalCameraChecker = class _ExternalCameraChecker {
20987
21144
  try {
20988
21145
  this.proctoringId = proctoringId2;
20989
21146
  const response = await this.backend.externalCameraStartTransmission("" + this.externalSessionId, proctoringId2);
21147
+ console.log(response);
20990
21148
  } catch (error) {
21149
+ console.error("Erro ao iniciar transmiss\xE3o:", error);
20991
21150
  throw new Error("N\xE3o foi poss\xEDvel iniciar a transmiss\xE3o.");
20992
21151
  }
20993
21152
  }
20994
21153
  async goToPositionGuide() {
20995
21154
  try {
20996
21155
  const response = await this.backend.goToExternalCameraPositionStep("" + this.externalSessionId);
21156
+ console.log(response);
20997
21157
  } catch (error) {
20998
21158
  console.error("Erro ao enviar comando de Position:", error);
20999
21159
  throw new Error("N\xE3o foi poss\xEDvel enviar comando de Position Guide.");
@@ -21003,6 +21163,7 @@ var _ExternalCameraChecker = class _ExternalCameraChecker {
21003
21163
  if (this.connection) {
21004
21164
  const actionMessage = new ActionMessage();
21005
21165
  actionMessage.command = "Reset";
21166
+ console.log("Enviando comando 'Reset' para o aplicativo...");
21006
21167
  this.connection.invoke(
21007
21168
  "SendAction",
21008
21169
  this.externalSessionId,
@@ -21016,6 +21177,7 @@ var _ExternalCameraChecker = class _ExternalCameraChecker {
21016
21177
  this.onTakePictureCallback = onTakePictureCallback;
21017
21178
  const actionMessage = new ActionMessage();
21018
21179
  actionMessage.command = "Capture";
21180
+ console.log("Enviando comando 'Capture' para o aplicativo...");
21019
21181
  this.connection.invoke(
21020
21182
  "SendAction",
21021
21183
  this.externalSessionId,
@@ -21034,6 +21196,7 @@ var _ExternalCameraChecker = class _ExternalCameraChecker {
21034
21196
  await this.reset();
21035
21197
  const response = await this.backend.externalCameraStartSession();
21036
21198
  this.externalSessionId = response.externalSessionId;
21199
+ console.log(this.externalSessionId);
21037
21200
  this.currentStep = 0 /* STARTED */;
21038
21201
  const pairingObject = {
21039
21202
  externalSessionId: this.externalSessionId,
@@ -21042,6 +21205,7 @@ var _ExternalCameraChecker = class _ExternalCameraChecker {
21042
21205
  };
21043
21206
  const pairingDataString = JSON.stringify(pairingObject);
21044
21207
  this.qrCodeBase64Image = await import_qrcode.default.toDataURL(pairingDataString);
21208
+ console.log(this.qrCodeBase64Image);
21045
21209
  return this.qrCodeBase64Image;
21046
21210
  } catch (error) {
21047
21211
  this.disconnectWebSocket();
@@ -21140,6 +21304,7 @@ var _ExternalCameraChecker = class _ExternalCameraChecker {
21140
21304
  var _a2;
21141
21305
  const actionMessage = new ActionMessage();
21142
21306
  actionMessage.command = "Cancel";
21307
+ console.log("Enviando comando 'Cancel' para o aplicativo...");
21143
21308
  (_a2 = this.connection) == null ? void 0 : _a2.invoke(
21144
21309
  "SendAction",
21145
21310
  this.externalSessionId,
@@ -21479,6 +21644,8 @@ var _ExternalCameraChecker = class _ExternalCameraChecker {
21479
21644
  this.connection.on(
21480
21645
  "ReceiveMessage",
21481
21646
  (sessionId, messageStr) => {
21647
+ console.log("sessionId: ", sessionId);
21648
+ console.log("Message: ", messageStr);
21482
21649
  if (sessionId !== this.externalSessionId) {
21483
21650
  console.warn("Sess\xE3o diferente!");
21484
21651
  return;
@@ -21486,6 +21653,7 @@ var _ExternalCameraChecker = class _ExternalCameraChecker {
21486
21653
  try {
21487
21654
  const messageKey = messageStr;
21488
21655
  const message = ExternalCameraStatusEnum[messageKey];
21656
+ console.log("Mensagem -> ", message);
21489
21657
  this.handleWebSocketMessage(message);
21490
21658
  } catch (e3) {
21491
21659
  console.error("Erro ao processar mensagem do WebSocket:", e3);
@@ -21495,6 +21663,8 @@ var _ExternalCameraChecker = class _ExternalCameraChecker {
21495
21663
  this.connection.on(
21496
21664
  "ReceiveAction",
21497
21665
  (sessionId, actionMessage) => {
21666
+ console.log("sessionId: ", sessionId);
21667
+ console.log("Message: ", actionMessage);
21498
21668
  if (sessionId !== this.externalSessionId) {
21499
21669
  console.warn("Sess\xE3o diferente!");
21500
21670
  return;
@@ -21508,6 +21678,7 @@ var _ExternalCameraChecker = class _ExternalCameraChecker {
21508
21678
  );
21509
21679
  try {
21510
21680
  await this.connection.start();
21681
+ console.log("Conectado ao Hub SignalR com sucesso!");
21511
21682
  } catch (err) {
21512
21683
  console.error("Falha ao conectar ou entrar no grupo do SignalR: ", err);
21513
21684
  throw new Error("N\xE3o foi poss\xEDvel conectar ao servi\xE7o em tempo real.");
@@ -21634,6 +21805,7 @@ var _ExternalCameraChecker = class _ExternalCameraChecker {
21634
21805
  if (this.connection) {
21635
21806
  try {
21636
21807
  await this.connection.stop();
21808
+ console.log("Desconectado do SignalR.");
21637
21809
  } catch (err) {
21638
21810
  console.error("Erro ao desconectar do SignalR:", err);
21639
21811
  } finally {
@@ -21667,6 +21839,7 @@ var Proctoring = class {
21667
21839
  constructor(context) {
21668
21840
  this.context = context;
21669
21841
  this.deviceData = null;
21842
+ this.sessionStartTime = 0;
21670
21843
  this.paramsConfig = {
21671
21844
  audioBehaviourParameters: {
21672
21845
  recordingBitrate: 128,
@@ -21944,7 +22117,10 @@ var Proctoring = class {
21944
22117
  if (this.context.token === void 0) {
21945
22118
  throw TOKEN_MISSING;
21946
22119
  }
21947
- this.extension = new Extension();
22120
+ if (options.useChallenge) {
22121
+ this.extensionEasycatcher = new ExtensionEasyCatcher();
22122
+ }
22123
+ this.extension = new ExtensionEasyProctor();
21948
22124
  this.extension.addEventListener();
21949
22125
  const baseURL = this.backend.selectBaseUrl(this.context.type);
21950
22126
  const devices = await enumarateDevices();
@@ -21993,6 +22169,7 @@ var Proctoring = class {
21993
22169
  } catch (error) {
21994
22170
  throw EXTERNAL_CAMERA_NOT_STARTED;
21995
22171
  }
22172
+ this.sessionStartTime = Date.now();
21996
22173
  this.allRecorders.cameraRecorder.setProctoringId(this.proctoringId);
21997
22174
  this.allRecorders.noiseRecorder.setProctoringId(this.proctoringId);
21998
22175
  this.proctoringSession.setProctoringId(this.proctoringId);
@@ -22168,6 +22345,7 @@ Upload Services: ${uploaderServices}`,
22168
22345
  });
22169
22346
  if (this.appChecker) {
22170
22347
  const externalSessionId = this.appChecker.getExternalCameraSessionId();
22348
+ console.log("externalSessionId -> ", externalSessionId);
22171
22349
  if (externalSessionId != "null") {
22172
22350
  await this.backend.externalCameraFinish(externalSessionId);
22173
22351
  }
@@ -22290,6 +22468,59 @@ Error: ` + error
22290
22468
  _screenStream: (_a2 = this.allRecorders.screenRecorder) == null ? void 0 : _a2.screenStream
22291
22469
  };
22292
22470
  }
22471
+ async startChallenge(templateId) {
22472
+ if (!this.sessionOptions.useChallenge) {
22473
+ throw new Error("useChallenge is set as false on start method");
22474
+ }
22475
+ await this.extensionEasycatcher.checkExtensionInstalled().catch((err) => {
22476
+ throw new Error("EasyCatcher Extension is not installed");
22477
+ });
22478
+ this.extensionEasycatcher.start();
22479
+ const start = Date.now() - this.sessionStartTime;
22480
+ await this.backend.startChallenge({
22481
+ proctoringId: this.proctoringId,
22482
+ templateId,
22483
+ start
22484
+ }).then((resp) => {
22485
+ console.log(resp);
22486
+ this.challengeId = resp.id;
22487
+ }).catch((reason) => {
22488
+ trackers.registerError(
22489
+ this.proctoringId,
22490
+ "N\xE3o foi poss\xEDvel iniciar desafio!"
22491
+ );
22492
+ throw reason;
22493
+ });
22494
+ this.isChallengeRunning = true;
22495
+ }
22496
+ async stopChallenge() {
22497
+ if (!this.isChallengeRunning) {
22498
+ throw new Error("Challenge not started");
22499
+ }
22500
+ try {
22501
+ const sessionData = await this.extensionEasycatcher.getSessionData();
22502
+ const end = Date.now() - this.sessionStartTime;
22503
+ await this.backend.stopChallenge(
22504
+ this.challengeId,
22505
+ {
22506
+ end,
22507
+ data: sessionData
22508
+ }
22509
+ ).catch((reason) => {
22510
+ trackers.registerError(
22511
+ this.proctoringId,
22512
+ "N\xE3o foi poss\xEDvel finalizar o desafio no backend!"
22513
+ );
22514
+ return void 0;
22515
+ });
22516
+ this.isChallengeRunning = false;
22517
+ } catch (error) {
22518
+ trackers.registerError(
22519
+ this.proctoringId,
22520
+ "Erro ao recuperar dados da extens\xE3o: " + error.message
22521
+ );
22522
+ }
22523
+ }
22293
22524
  };
22294
22525
 
22295
22526
  // src/proctoring/SignTerm.ts
@@ -22517,6 +22748,8 @@ function useProctoring(proctoringOptions, enviromentConfig = "prod") {
22517
22748
  return originalStart(parameters2, videoOptions);
22518
22749
  };
22519
22750
  const finish = proctoring.finish.bind(proctoring);
22751
+ const startChallenge = proctoring.startChallenge.bind(proctoring);
22752
+ const stopChallenge = proctoring.stopChallenge.bind(proctoring);
22520
22753
  const pause = proctoring.pause.bind(proctoring);
22521
22754
  const resume = proctoring.resume.bind(proctoring);
22522
22755
  const onFocus = proctoring.setOnFocusCallback.bind(proctoring);
@@ -22539,6 +22772,8 @@ function useProctoring(proctoringOptions, enviromentConfig = "prod") {
22539
22772
  login,
22540
22773
  start,
22541
22774
  finish,
22775
+ startChallenge,
22776
+ stopChallenge,
22542
22777
  onFocus,
22543
22778
  onLostFocus,
22544
22779
  onChangeDevices: onChangeDevices2,
@@ -0,0 +1,11 @@
1
+ import { ProctoringFinisherOptions } from "../proctoring/proctoring";
2
+ export declare class ExtensionEasyCatcher {
3
+ hasExtension: boolean;
4
+ tryes: number;
5
+ responseStart: boolean;
6
+ options: ProctoringFinisherOptions;
7
+ constructor(options?: ProctoringFinisherOptions);
8
+ checkExtensionInstalled(timeoutMs?: number): Promise<string>;
9
+ getSessionData(timeoutMs?: number): Promise<any>;
10
+ start(): Promise<boolean>;
11
+ }
@@ -1,5 +1,5 @@
1
1
  import { ProctoringFinisherOptions } from "../proctoring/proctoring";
2
- export declare class Extension {
2
+ export declare class ExtensionEasyProctor {
3
3
  hasExtension: boolean;
4
4
  tryes: number;
5
5
  responseStart: boolean;