easyproctor 2.0.0 → 2.0.2

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,6 +263,13 @@ const {
263
263
  token: "...",
264
264
  });
265
265
  ```
266
+ ## Release Note V 2.0.2
267
+ - Tratamento para fechamento de streams
268
+ - console.log() configuravel
269
+
270
+ ## Release Note V 2.0.1
271
+ - Tratamento para duplo clique no checkDevices
272
+ - Ajuste de CORS no NoiseRecorder
266
273
 
267
274
  ## Release Note V 2.0.0
268
275
  - Remoção do script deprecated AudioProcessor
@@ -280,7 +287,7 @@ const {
280
287
 
281
288
  ```ts
282
289
  {
283
- allowedPositionFace: boolean,
290
+ allowedAmbient: boolean,
284
291
  allowedMicrophone: boolean,
285
292
  allowedPositionFace: boolean,
286
293
  allowedResolution: boolean,
package/esm/index.js CHANGED
@@ -7804,7 +7804,7 @@ var BackendService = class {
7804
7804
  };
7805
7805
 
7806
7806
  // src/proctoring/DeviceChecker.ts
7807
- var DeviceChecker = class {
7807
+ var _DeviceChecker = class {
7808
7808
  constructor(context) {
7809
7809
  this.videoOptions = { width: 1080, height: 720, minWidth: 0, minHeight: 0 };
7810
7810
  this.volumeMedia = 0;
@@ -7825,6 +7825,10 @@ var DeviceChecker = class {
7825
7825
  }
7826
7826
  async checkDevices(options = getDefaultProctoringOptions, _videoOptions) {
7827
7827
  var _a2;
7828
+ if (_DeviceChecker.isModalOpen) {
7829
+ return Promise.reject();
7830
+ }
7831
+ _DeviceChecker.isModalOpen = true;
7828
7832
  try {
7829
7833
  this.options = {
7830
7834
  ...getDefaultProctoringOptions,
@@ -8523,7 +8527,7 @@ Para iniciar um exame utilize uma outra c\xE2mera.`);
8523
8527
  const microphones = document.querySelector("#micSelect");
8524
8528
  cameras == null ? void 0 : cameras.addEventListener("change", async () => {
8525
8529
  var _a2;
8526
- await this.cameraRecorder.stopRecording();
8530
+ this.cameraRecorder.stopRecording && await this.cameraRecorder.stopRecording();
8527
8531
  (_a2 = this.volumeMeter) == null ? void 0 : _a2.stop();
8528
8532
  this.cameraRecorder = new CameraRecorder(
8529
8533
  {
@@ -8544,7 +8548,7 @@ Para iniciar um exame utilize uma outra c\xE2mera.`);
8544
8548
  });
8545
8549
  microphones == null ? void 0 : microphones.addEventListener("change", async () => {
8546
8550
  var _a2;
8547
- await this.cameraRecorder.stopRecording();
8551
+ this.cameraRecorder.stopRecording && await this.cameraRecorder.stopRecording();
8548
8552
  (_a2 = this.volumeMeter) == null ? void 0 : _a2.stop();
8549
8553
  this.cameraRecorder = new CameraRecorder(
8550
8554
  {
@@ -8592,12 +8596,13 @@ Para iniciar um exame utilize uma outra c\xE2mera.`);
8592
8596
  }
8593
8597
  async closeCheckDevices() {
8594
8598
  var _a2;
8599
+ _DeviceChecker.isModalOpen = false;
8595
8600
  const checkDevices = document.querySelector("#checkDevices");
8596
8601
  checkDevices == null ? void 0 : checkDevices.remove();
8597
8602
  this.faceDetection.stopDetection();
8598
8603
  (_a2 = this.volumeMeter) == null ? void 0 : _a2.stop();
8599
8604
  this.volumeMedia = Math.ceil(this.volumeSum / this.volumeCounter);
8600
- await this.cameraRecorder.stopRecording();
8605
+ this.cameraRecorder.stopRecording && await this.cameraRecorder.stopRecording();
8601
8606
  }
8602
8607
  applyStyles(element, styles) {
8603
8608
  for (const [property, value] of Object.entries(styles)) {
@@ -8605,6 +8610,8 @@ Para iniciar um exame utilize uma outra c\xE2mera.`);
8605
8610
  }
8606
8611
  }
8607
8612
  };
8613
+ var DeviceChecker = _DeviceChecker;
8614
+ DeviceChecker.isModalOpen = false;
8608
8615
 
8609
8616
  // src/extension/extension.ts
8610
8617
  var Extension = class {
@@ -8921,7 +8928,7 @@ var AudioRecorder = class {
8921
8928
  async resumeRecording() {
8922
8929
  }
8923
8930
  async stopRecording() {
8924
- await this.recordingStop();
8931
+ this.recordingStop && await this.recordingStop();
8925
8932
  }
8926
8933
  async saveOnSession(session, start, end) {
8927
8934
  session.addRecording({
@@ -11298,7 +11305,7 @@ var NoiseRecorder = class {
11298
11305
  }
11299
11306
  }
11300
11307
  async stopSoundRecord() {
11301
- await this.audioRecorder.stopRecording();
11308
+ this.audioRecorder.stopRecording && await this.audioRecorder.stopRecording();
11302
11309
  this.recordingEndTime = Date.now() - this.examStartTime;
11303
11310
  if (this.optionsProctoring.proctoringType !== "REALTIME")
11304
11311
  return;
@@ -11364,7 +11371,7 @@ var NoiseRecorder = class {
11364
11371
  async streamingAudioClassification() {
11365
11372
  this.context = new AudioContext({ sampleRate: 16e3 });
11366
11373
  try {
11367
- await this.context.audioWorklet.addModule("./src/new-flow/recorders/audio-processor.js");
11374
+ await this.context.audioWorklet.addModule("https://easyproctor-public.s3.us-east-2.amazonaws.com/utils/audio-processor.js");
11368
11375
  } catch (error) {
11369
11376
  throw new Error("\u274C Error loading audio worklet module");
11370
11377
  }
@@ -12097,19 +12104,29 @@ Error: ` + error
12097
12104
 
12098
12105
  // src/proctoring/useProctoring.ts
12099
12106
  function useProctoring(proctoringOptions, enviromentConfig = "prod") {
12107
+ if (!proctoringOptions.showConsole) {
12108
+ console.log = () => {
12109
+ };
12110
+ console.warn = () => {
12111
+ };
12112
+ console.error = () => {
12113
+ };
12114
+ }
12100
12115
  const proctoring = new Proctoring({
12101
12116
  type: enviromentConfig,
12102
12117
  clientId: proctoringOptions.clientId,
12103
12118
  examId: proctoringOptions.examId,
12104
12119
  token: proctoringOptions.token,
12105
- credentials: proctoringOptions.credentials
12120
+ credentials: proctoringOptions.credentials,
12121
+ showConsole: proctoringOptions.showConsole
12106
12122
  });
12107
12123
  const checker = new DeviceChecker({
12108
12124
  type: enviromentConfig,
12109
12125
  clientId: proctoringOptions.clientId,
12110
12126
  examId: proctoringOptions.examId,
12111
12127
  token: proctoringOptions.token,
12112
- credentials: proctoringOptions.credentials
12128
+ credentials: proctoringOptions.credentials,
12129
+ showConsole: proctoringOptions.showConsole
12113
12130
  });
12114
12131
  const photo = new CapturePhoto();
12115
12132
  const login = proctoring.login.bind(proctoring);
@@ -12144,8 +12161,6 @@ function useProctoring(proctoringOptions, enviromentConfig = "prod") {
12144
12161
  }
12145
12162
 
12146
12163
  // src/index.ts
12147
- console.log = () => {
12148
- };
12149
12164
  if (typeof window !== "undefined") {
12150
12165
  window.useProctoring = useProctoring;
12151
12166
  }
package/index.js CHANGED
@@ -19335,7 +19335,7 @@ var BackendService = class {
19335
19335
  };
19336
19336
 
19337
19337
  // src/proctoring/DeviceChecker.ts
19338
- var DeviceChecker = class {
19338
+ var _DeviceChecker = class {
19339
19339
  constructor(context) {
19340
19340
  this.videoOptions = { width: 1080, height: 720, minWidth: 0, minHeight: 0 };
19341
19341
  this.volumeMedia = 0;
@@ -19356,6 +19356,10 @@ var DeviceChecker = class {
19356
19356
  }
19357
19357
  async checkDevices(options = getDefaultProctoringOptions, _videoOptions) {
19358
19358
  var _a2;
19359
+ if (_DeviceChecker.isModalOpen) {
19360
+ return Promise.reject();
19361
+ }
19362
+ _DeviceChecker.isModalOpen = true;
19359
19363
  try {
19360
19364
  this.options = {
19361
19365
  ...getDefaultProctoringOptions,
@@ -20054,7 +20058,7 @@ Para iniciar um exame utilize uma outra c\xE2mera.`);
20054
20058
  const microphones = document.querySelector("#micSelect");
20055
20059
  cameras == null ? void 0 : cameras.addEventListener("change", async () => {
20056
20060
  var _a2;
20057
- await this.cameraRecorder.stopRecording();
20061
+ this.cameraRecorder.stopRecording && await this.cameraRecorder.stopRecording();
20058
20062
  (_a2 = this.volumeMeter) == null ? void 0 : _a2.stop();
20059
20063
  this.cameraRecorder = new CameraRecorder(
20060
20064
  {
@@ -20075,7 +20079,7 @@ Para iniciar um exame utilize uma outra c\xE2mera.`);
20075
20079
  });
20076
20080
  microphones == null ? void 0 : microphones.addEventListener("change", async () => {
20077
20081
  var _a2;
20078
- await this.cameraRecorder.stopRecording();
20082
+ this.cameraRecorder.stopRecording && await this.cameraRecorder.stopRecording();
20079
20083
  (_a2 = this.volumeMeter) == null ? void 0 : _a2.stop();
20080
20084
  this.cameraRecorder = new CameraRecorder(
20081
20085
  {
@@ -20123,12 +20127,13 @@ Para iniciar um exame utilize uma outra c\xE2mera.`);
20123
20127
  }
20124
20128
  async closeCheckDevices() {
20125
20129
  var _a2;
20130
+ _DeviceChecker.isModalOpen = false;
20126
20131
  const checkDevices = document.querySelector("#checkDevices");
20127
20132
  checkDevices == null ? void 0 : checkDevices.remove();
20128
20133
  this.faceDetection.stopDetection();
20129
20134
  (_a2 = this.volumeMeter) == null ? void 0 : _a2.stop();
20130
20135
  this.volumeMedia = Math.ceil(this.volumeSum / this.volumeCounter);
20131
- await this.cameraRecorder.stopRecording();
20136
+ this.cameraRecorder.stopRecording && await this.cameraRecorder.stopRecording();
20132
20137
  }
20133
20138
  applyStyles(element, styles) {
20134
20139
  for (const [property, value] of Object.entries(styles)) {
@@ -20136,6 +20141,8 @@ Para iniciar um exame utilize uma outra c\xE2mera.`);
20136
20141
  }
20137
20142
  }
20138
20143
  };
20144
+ var DeviceChecker = _DeviceChecker;
20145
+ DeviceChecker.isModalOpen = false;
20139
20146
 
20140
20147
  // src/extension/extension.ts
20141
20148
  var Extension = class {
@@ -20452,7 +20459,7 @@ var AudioRecorder = class {
20452
20459
  async resumeRecording() {
20453
20460
  }
20454
20461
  async stopRecording() {
20455
- await this.recordingStop();
20462
+ this.recordingStop && await this.recordingStop();
20456
20463
  }
20457
20464
  async saveOnSession(session, start, end) {
20458
20465
  session.addRecording({
@@ -22829,7 +22836,7 @@ var NoiseRecorder = class {
22829
22836
  }
22830
22837
  }
22831
22838
  async stopSoundRecord() {
22832
- await this.audioRecorder.stopRecording();
22839
+ this.audioRecorder.stopRecording && await this.audioRecorder.stopRecording();
22833
22840
  this.recordingEndTime = Date.now() - this.examStartTime;
22834
22841
  if (this.optionsProctoring.proctoringType !== "REALTIME")
22835
22842
  return;
@@ -22895,7 +22902,7 @@ var NoiseRecorder = class {
22895
22902
  async streamingAudioClassification() {
22896
22903
  this.context = new AudioContext({ sampleRate: 16e3 });
22897
22904
  try {
22898
- await this.context.audioWorklet.addModule("./src/new-flow/recorders/audio-processor.js");
22905
+ await this.context.audioWorklet.addModule("https://easyproctor-public.s3.us-east-2.amazonaws.com/utils/audio-processor.js");
22899
22906
  } catch (error) {
22900
22907
  throw new Error("\u274C Error loading audio worklet module");
22901
22908
  }
@@ -23628,19 +23635,29 @@ Error: ` + error
23628
23635
 
23629
23636
  // src/proctoring/useProctoring.ts
23630
23637
  function useProctoring(proctoringOptions, enviromentConfig = "prod") {
23638
+ if (!proctoringOptions.showConsole) {
23639
+ console.log = () => {
23640
+ };
23641
+ console.warn = () => {
23642
+ };
23643
+ console.error = () => {
23644
+ };
23645
+ }
23631
23646
  const proctoring = new Proctoring({
23632
23647
  type: enviromentConfig,
23633
23648
  clientId: proctoringOptions.clientId,
23634
23649
  examId: proctoringOptions.examId,
23635
23650
  token: proctoringOptions.token,
23636
- credentials: proctoringOptions.credentials
23651
+ credentials: proctoringOptions.credentials,
23652
+ showConsole: proctoringOptions.showConsole
23637
23653
  });
23638
23654
  const checker = new DeviceChecker({
23639
23655
  type: enviromentConfig,
23640
23656
  clientId: proctoringOptions.clientId,
23641
23657
  examId: proctoringOptions.examId,
23642
23658
  token: proctoringOptions.token,
23643
- credentials: proctoringOptions.credentials
23659
+ credentials: proctoringOptions.credentials,
23660
+ showConsole: proctoringOptions.showConsole
23644
23661
  });
23645
23662
  const photo = new CapturePhoto();
23646
23663
  const login = proctoring.login.bind(proctoring);
@@ -23675,8 +23692,6 @@ function useProctoring(proctoringOptions, enviromentConfig = "prod") {
23675
23692
  }
23676
23693
 
23677
23694
  // src/index.ts
23678
- console.log = () => {
23679
- };
23680
23695
  if (typeof window !== "undefined") {
23681
23696
  window.useProctoring = useProctoring;
23682
23697
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "easyproctor",
3
- "version": "2.0.0",
3
+ "version": "2.0.2",
4
4
  "description": "Modulo web de gravação do EasyProctor",
5
5
  "main": "./index.js",
6
6
  "module": "./esm/index.js",
@@ -21,6 +21,7 @@ export interface checkDevicesReturn {
21
21
  };
22
22
  }
23
23
  export declare class DeviceChecker {
24
+ private static isModalOpen;
24
25
  private options;
25
26
  private videoOptions;
26
27
  private cameraRecorder;
@@ -10,6 +10,7 @@ export interface ProctoringContext {
10
10
  credentials?: {
11
11
  cpf: string;
12
12
  };
13
+ showConsole?: boolean;
13
14
  }
14
15
  export interface ProctoringFinisherOptions {
15
16
  onProgress?: (percentage: number) => void;