easyproctor 0.0.22 → 0.0.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/esm/index.js CHANGED
@@ -87,6 +87,12 @@ var account = "iarisprod";
87
87
  var containerName = "iaris";
88
88
  var sas = "?sv=2020-08-04&ss=bfqt&srt=sco&sp=rwdlacupitfx&se=2025-12-28T06:34:02Z&st=2021-12-27T22:34:02Z&spr=https&sig=1rsgx389pHZCnJYd44peuWSfeCUdN8bQ9EfcLoMOdDc%3D";
89
89
  var blobServiceClient = new BlobServiceClient(`https://${account}.blob.core.windows.net${sas}`);
90
+ async function setConfiguration(_account, _cointainerName, _sas) {
91
+ account = _account;
92
+ containerName = _cointainerName;
93
+ sas = _sas;
94
+ blobServiceClient = new BlobServiceClient(`https://${account}.blob.core.windows.net${sas}`);
95
+ }
90
96
  async function upload(data) {
91
97
  const { file, onProgress } = data;
92
98
  const containerClient = blobServiceClient.getContainerClient(containerName);
@@ -101,6 +107,9 @@ var upload_default = upload;
101
107
 
102
108
  // src/modules/http.ts
103
109
  var baseUrl = "https://iaris.easyproctor.tech/api";
110
+ async function setBaseUrl(_baseUrl) {
111
+ baseUrl = _baseUrl;
112
+ }
104
113
  async function makeRequest(data) {
105
114
  const { url, method, body, jwt } = data;
106
115
  const resp = await fetch(baseUrl + url, {
@@ -218,11 +227,16 @@ async function clearBuffers(table) {
218
227
  var defaultProctoringOptions = {
219
228
  cameraId: void 0,
220
229
  microphoneId: void 0,
221
- allowMulipleMonitors: false,
230
+ allowMultipleMonitors: false,
222
231
  allowOnlyFirstMonitor: true
223
232
  };
224
233
  var azureBlobUrl = "https://iarisprod.blob.core.windows.net/iaris";
225
- function useProctoring(proctoringOptions) {
234
+ function useProctoring(proctoringOptions, proctoringConfig) {
235
+ if (proctoringConfig != void 0) {
236
+ setConfiguration(proctoringConfig.account, proctoringConfig.containerName, proctoringConfig.sas);
237
+ azureBlobUrl = proctoringConfig.azureBlobUrl;
238
+ setBaseUrl(proctoringConfig.baseUrl);
239
+ }
226
240
  ["examId", "clientId", "token"].forEach((el) => {
227
241
  const key = el;
228
242
  if (!proctoringOptions[key]) {
@@ -326,8 +340,8 @@ function useProctoring(proctoringOptions) {
326
340
  return { cameraFile, screenFile };
327
341
  };
328
342
  async function start(options = defaultProctoringOptions) {
329
- const { cameraId, microphoneId, allowOnlyFirstMonitor = true, allowMulipleMonitors = false } = options;
330
- if (!allowMulipleMonitors) {
343
+ const { cameraId, microphoneId, allowOnlyFirstMonitor = true, allowMultipleMonitors = false } = options;
344
+ if (!allowMultipleMonitors) {
331
345
  const hasMultipleMonitors = await checkIfhasMultipleMonitors();
332
346
  if (hasMultipleMonitors) {
333
347
  throw MULTIPLE_MONITORS_DETECTED;
@@ -378,8 +392,8 @@ function useProctoring(proctoringOptions) {
378
392
  }
379
393
  async function resume(options = defaultProctoringOptions) {
380
394
  _clear();
381
- const { cameraId, microphoneId, allowOnlyFirstMonitor = true, allowMulipleMonitors = false } = options;
382
- if (!allowMulipleMonitors) {
395
+ const { cameraId, microphoneId, allowOnlyFirstMonitor = true, allowMultipleMonitors = false } = options;
396
+ if (!allowMultipleMonitors) {
383
397
  const hasMultipleMonitors = await checkIfhasMultipleMonitors();
384
398
  if (hasMultipleMonitors) {
385
399
  throw MULTIPLE_MONITORS_DETECTED;
package/index.d.ts CHANGED
@@ -4,14 +4,21 @@ import StartProctoringResponse from "./dtos/StartProctoringResponse";
4
4
  interface ProctoringOptions {
5
5
  cameraId?: string;
6
6
  microphoneId?: string;
7
- allowMulipleMonitors?: boolean;
7
+ allowMultipleMonitors?: boolean;
8
8
  allowOnlyFirstMonitor?: boolean;
9
9
  }
10
+ interface ProctoringConfig {
11
+ azureBlobUrl: string;
12
+ baseUrl: string;
13
+ account: string;
14
+ containerName: string;
15
+ sas: string;
16
+ }
10
17
  export declare function useProctoring(proctoringOptions: {
11
18
  examId: string;
12
19
  clientId: string;
13
20
  token: string;
14
- }): {
21
+ }, proctoringConfig?: ProctoringConfig): {
15
22
  start: (options?: ProctoringOptions) => Promise<StartProctoringResponse>;
16
23
  finish: (options?: {
17
24
  onProgress?: ((percentage: number) => void) | undefined;
package/index.js CHANGED
@@ -116,6 +116,12 @@ var account = "iarisprod";
116
116
  var containerName = "iaris";
117
117
  var sas = "?sv=2020-08-04&ss=bfqt&srt=sco&sp=rwdlacupitfx&se=2025-12-28T06:34:02Z&st=2021-12-27T22:34:02Z&spr=https&sig=1rsgx389pHZCnJYd44peuWSfeCUdN8bQ9EfcLoMOdDc%3D";
118
118
  var blobServiceClient = new import_storage_blob.BlobServiceClient(`https://${account}.blob.core.windows.net${sas}`);
119
+ async function setConfiguration(_account, _cointainerName, _sas) {
120
+ account = _account;
121
+ containerName = _cointainerName;
122
+ sas = _sas;
123
+ blobServiceClient = new import_storage_blob.BlobServiceClient(`https://${account}.blob.core.windows.net${sas}`);
124
+ }
119
125
  async function upload(data) {
120
126
  const { file, onProgress } = data;
121
127
  const containerClient = blobServiceClient.getContainerClient(containerName);
@@ -130,6 +136,9 @@ var upload_default = upload;
130
136
 
131
137
  // src/modules/http.ts
132
138
  var baseUrl = "https://iaris.easyproctor.tech/api";
139
+ async function setBaseUrl(_baseUrl) {
140
+ baseUrl = _baseUrl;
141
+ }
133
142
  async function makeRequest(data) {
134
143
  const { url, method, body, jwt } = data;
135
144
  const resp = await fetch(baseUrl + url, {
@@ -247,11 +256,16 @@ async function clearBuffers(table) {
247
256
  var defaultProctoringOptions = {
248
257
  cameraId: void 0,
249
258
  microphoneId: void 0,
250
- allowMulipleMonitors: false,
259
+ allowMultipleMonitors: false,
251
260
  allowOnlyFirstMonitor: true
252
261
  };
253
262
  var azureBlobUrl = "https://iarisprod.blob.core.windows.net/iaris";
254
- function useProctoring(proctoringOptions) {
263
+ function useProctoring(proctoringOptions, proctoringConfig) {
264
+ if (proctoringConfig != void 0) {
265
+ setConfiguration(proctoringConfig.account, proctoringConfig.containerName, proctoringConfig.sas);
266
+ azureBlobUrl = proctoringConfig.azureBlobUrl;
267
+ setBaseUrl(proctoringConfig.baseUrl);
268
+ }
255
269
  ["examId", "clientId", "token"].forEach((el) => {
256
270
  const key = el;
257
271
  if (!proctoringOptions[key]) {
@@ -355,8 +369,8 @@ function useProctoring(proctoringOptions) {
355
369
  return { cameraFile, screenFile };
356
370
  };
357
371
  async function start(options = defaultProctoringOptions) {
358
- const { cameraId, microphoneId, allowOnlyFirstMonitor = true, allowMulipleMonitors = false } = options;
359
- if (!allowMulipleMonitors) {
372
+ const { cameraId, microphoneId, allowOnlyFirstMonitor = true, allowMultipleMonitors = false } = options;
373
+ if (!allowMultipleMonitors) {
360
374
  const hasMultipleMonitors = await checkIfhasMultipleMonitors();
361
375
  if (hasMultipleMonitors) {
362
376
  throw MULTIPLE_MONITORS_DETECTED;
@@ -407,8 +421,8 @@ function useProctoring(proctoringOptions) {
407
421
  }
408
422
  async function resume(options = defaultProctoringOptions) {
409
423
  _clear();
410
- const { cameraId, microphoneId, allowOnlyFirstMonitor = true, allowMulipleMonitors = false } = options;
411
- if (!allowMulipleMonitors) {
424
+ const { cameraId, microphoneId, allowOnlyFirstMonitor = true, allowMultipleMonitors = false } = options;
425
+ if (!allowMultipleMonitors) {
412
426
  const hasMultipleMonitors = await checkIfhasMultipleMonitors();
413
427
  if (hasMultipleMonitors) {
414
428
  throw MULTIPLE_MONITORS_DETECTED;
package/modules/http.d.ts CHANGED
@@ -1,3 +1,4 @@
1
+ export declare function setBaseUrl(_baseUrl: string): Promise<void>;
1
2
  export default function makeRequest<R>(data: {
2
3
  url: string;
3
4
  method: "GET" | "POST";
@@ -2,5 +2,6 @@ declare type UploadData = {
2
2
  file: File;
3
3
  onProgress?: (progress: number) => void;
4
4
  };
5
+ export declare function setConfiguration(_account: string, _cointainerName: string, _sas: string): Promise<void>;
5
6
  declare function upload(data: UploadData): Promise<void>;
6
7
  export default upload;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "easyproctor",
3
- "version": "0.0.22",
3
+ "version": "0.0.23",
4
4
  "description": "Modulo web de gravação do EasyProctor",
5
5
  "main": "./index.js",
6
6
  "module": "./esm/index.js",