easyproctor 0.0.31 → 0.0.32

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
@@ -6280,17 +6280,17 @@ var Sender = function(_super) {
6280
6280
  arrForEach(objKeys(_headers), function(headerName) {
6281
6281
  requestHeaders.append(headerName, _headers[headerName]);
6282
6282
  });
6283
- var init = (_a2 = {
6283
+ var init2 = (_a2 = {
6284
6284
  method: "POST",
6285
6285
  headers: requestHeaders,
6286
6286
  body: plainTextBatch
6287
6287
  }, _a2[DisabledPropertyName] = true, _a2);
6288
6288
  if (!isAsync) {
6289
- init.keepalive = true;
6289
+ init2.keepalive = true;
6290
6290
  ignoreResponse = true;
6291
6291
  _syncFetchPayload += batchLength;
6292
6292
  }
6293
- var request = new Request(endPointUrl, init);
6293
+ var request = new Request(endPointUrl, init2);
6294
6294
  try {
6295
6295
  request[DisabledPropertyName] = true;
6296
6296
  } catch (e) {
@@ -7402,37 +7402,37 @@ var AjaxMonitor = function(_super) {
7402
7402
  _self.trackDependencyData = function(dependency, properties) {
7403
7403
  _self[strTrackDependencyDataInternal](dependency, properties);
7404
7404
  };
7405
- _self.includeCorrelationHeaders = function(ajaxData, input, init, xhr) {
7405
+ _self.includeCorrelationHeaders = function(ajaxData, input, init2, xhr) {
7406
7406
  var currentWindowHost = _self["_currentWindowHost"] || _currentWindowHost;
7407
7407
  if (input) {
7408
7408
  if (CorrelationIdHelper.canIncludeCorrelationHeader(_config, ajaxData.getAbsoluteUrl(), currentWindowHost)) {
7409
- if (!init) {
7410
- init = {};
7409
+ if (!init2) {
7410
+ init2 = {};
7411
7411
  }
7412
- init.headers = new Headers(init.headers || (input instanceof Request ? input.headers || {} : {}));
7412
+ init2.headers = new Headers(init2.headers || (input instanceof Request ? input.headers || {} : {}));
7413
7413
  if (_isUsingAIHeaders) {
7414
7414
  var id = "|" + ajaxData.traceID + "." + ajaxData.spanID;
7415
- init.headers.set(RequestHeaders.requestIdHeader, id);
7415
+ init2.headers.set(RequestHeaders.requestIdHeader, id);
7416
7416
  if (_enableRequestHeaderTracking) {
7417
7417
  ajaxData.requestHeaders[RequestHeaders.requestIdHeader] = id;
7418
7418
  }
7419
7419
  }
7420
7420
  var appId = _config.appId || _context && _context.appId();
7421
7421
  if (appId) {
7422
- init.headers.set(RequestHeaders.requestContextHeader, RequestHeaders.requestContextAppIdFormat + appId);
7422
+ init2.headers.set(RequestHeaders.requestContextHeader, RequestHeaders.requestContextAppIdFormat + appId);
7423
7423
  if (_enableRequestHeaderTracking) {
7424
7424
  ajaxData.requestHeaders[RequestHeaders.requestContextHeader] = RequestHeaders.requestContextAppIdFormat + appId;
7425
7425
  }
7426
7426
  }
7427
7427
  if (_isUsingW3CHeaders) {
7428
7428
  var traceparent = new Traceparent(ajaxData.traceID, ajaxData.spanID);
7429
- init.headers.set(RequestHeaders.traceParentHeader, traceparent.toString());
7429
+ init2.headers.set(RequestHeaders.traceParentHeader, traceparent.toString());
7430
7430
  if (_enableRequestHeaderTracking) {
7431
7431
  ajaxData.requestHeaders[RequestHeaders.traceParentHeader] = traceparent.toString();
7432
7432
  }
7433
7433
  }
7434
7434
  }
7435
- return init;
7435
+ return init2;
7436
7436
  } else if (xhr) {
7437
7437
  if (CorrelationIdHelper.canIncludeCorrelationHeader(_config, ajaxData.getAbsoluteUrl(), currentWindowHost)) {
7438
7438
  if (_isUsingAIHeaders) {
@@ -7497,13 +7497,13 @@ var AjaxMonitor = function(_super) {
7497
7497
  var isPolyfill = fetch2.polyfill;
7498
7498
  if (_config.disableFetchTracking === false) {
7499
7499
  _hooks.push(InstrumentFunc(global2, strFetch, {
7500
- req: function(callDetails, input, init) {
7500
+ req: function(callDetails, input, init2) {
7501
7501
  var fetchData;
7502
- if (_fetchInitialized && !_isDisabledRequest(null, input, init) && !(isPolyfill && _xhrInitialized)) {
7502
+ if (_fetchInitialized && !_isDisabledRequest(null, input, init2) && !(isPolyfill && _xhrInitialized)) {
7503
7503
  var ctx = callDetails.ctx();
7504
- fetchData = _createFetchRecord(input, init);
7505
- var newInit = _self.includeCorrelationHeaders(fetchData, input, init);
7506
- if (newInit !== init) {
7504
+ fetchData = _createFetchRecord(input, init2);
7505
+ var newInit = _self.includeCorrelationHeaders(fetchData, input, init2);
7506
+ if (newInit !== init2) {
7507
7507
  callDetails.set(1, newInit);
7508
7508
  }
7509
7509
  ctx.data = fetchData;
@@ -7542,8 +7542,8 @@ var AjaxMonitor = function(_super) {
7542
7542
  _fetchInitialized = true;
7543
7543
  } else if (isPolyfill) {
7544
7544
  _hooks.push(InstrumentFunc(global2, strFetch, {
7545
- req: function(callDetails, input, init) {
7546
- _isDisabledRequest(null, input, init);
7545
+ req: function(callDetails, input, init2) {
7546
+ _isDisabledRequest(null, input, init2);
7547
7547
  }
7548
7548
  }));
7549
7549
  }
@@ -7607,7 +7607,7 @@ var AjaxMonitor = function(_super) {
7607
7607
  _xhrInitialized = true;
7608
7608
  }
7609
7609
  }
7610
- function _isDisabledRequest(xhr, request, init) {
7610
+ function _isDisabledRequest(xhr, request, init2) {
7611
7611
  var isDisabled = false;
7612
7612
  var theUrl = ((!isString(request) ? (request || {}).url || "" : request) || "").toLowerCase();
7613
7613
  arrForEach(_excludeRequestFromAutoTrackingPatterns, function(regex) {
@@ -7633,7 +7633,7 @@ var AjaxMonitor = function(_super) {
7633
7633
  if (!isNullOrUndefined(xhr)) {
7634
7634
  isDisabled = xhr[DisabledPropertyName] === true || theUrl[DisabledPropertyName] === true;
7635
7635
  } else if (!isNullOrUndefined(request)) {
7636
- isDisabled = (typeof request === "object" ? request[DisabledPropertyName] === true : false) || (init ? init[DisabledPropertyName] === true : false);
7636
+ isDisabled = (typeof request === "object" ? request[DisabledPropertyName] === true : false) || (init2 ? init2[DisabledPropertyName] === true : false);
7637
7637
  }
7638
7638
  if (!isDisabled && theUrl && isInternalApplicationInsightsEndpoint(theUrl)) {
7639
7639
  isDisabled = true;
@@ -7841,7 +7841,7 @@ var AjaxMonitor = function(_super) {
7841
7841
  }
7842
7842
  })();
7843
7843
  }
7844
- function _createFetchRecord(input, init) {
7844
+ function _createFetchRecord(input, init2) {
7845
7845
  var traceID = _context && _context.telemetryTrace && _context.telemetryTrace.traceID || generateW3CId();
7846
7846
  var spanID = generateW3CId().substr(0, 16);
7847
7847
  var ajaxData = new ajaxRecord(traceID, spanID, _self[strDiagLog]());
@@ -7853,15 +7853,15 @@ var AjaxMonitor = function(_super) {
7853
7853
  ajaxData.requestUrl = input;
7854
7854
  }
7855
7855
  var method = "GET";
7856
- if (init && init.method) {
7857
- method = init.method;
7856
+ if (init2 && init2.method) {
7857
+ method = init2.method;
7858
7858
  } else if (input && input instanceof Request) {
7859
7859
  method = input.method;
7860
7860
  }
7861
7861
  ajaxData.method = method;
7862
7862
  var requestHeaders = {};
7863
7863
  if (_enableRequestHeaderTracking) {
7864
- var headers = new Headers((init ? init.headers : 0) || (input instanceof Request ? input.headers || {} : {}));
7864
+ var headers = new Headers((init2 ? init2.headers : 0) || (input instanceof Request ? input.headers || {} : {}));
7865
7865
  headers.forEach(function(value, key) {
7866
7866
  if (_canIncludeHeaders(key)) {
7867
7867
  requestHeaders[key] = value;
@@ -8265,6 +8265,14 @@ var insights = new Initialization({
8265
8265
  instrumentationKey: "323792c9-1202-431d-85c4-36385daf9f20"
8266
8266
  }
8267
8267
  });
8268
+ var init = (key) => {
8269
+ console.log(key);
8270
+ insights = new Initialization({
8271
+ config: {
8272
+ instrumentationKey: key
8273
+ }
8274
+ });
8275
+ };
8268
8276
  var eventNames = {
8269
8277
  START: "start",
8270
8278
  FINISH: "finish",
@@ -8291,7 +8299,8 @@ var defaultProctoringOptions = {
8291
8299
  allowMultipleMonitors: false,
8292
8300
  allowOnlyFirstMonitor: true,
8293
8301
  captureScreen: true,
8294
- proctoringType: "IMAGE"
8302
+ proctoringType: "IMAGE",
8303
+ insights: "323792c9-1202-431d-85c4-36385daf9f20"
8295
8304
  };
8296
8305
  var azureBlobUrl = "";
8297
8306
  var _captureScreen = true;
@@ -8424,6 +8433,7 @@ function useProctoring(proctoringOptions, proctoringConfig) {
8424
8433
  setConfiguration(proctoringConfig.account, proctoringConfig.containerName, proctoringConfig.sas);
8425
8434
  azureBlobUrl = proctoringConfig.azureBlobUrl;
8426
8435
  setBaseUrl(proctoringConfig.baseUrl);
8436
+ init(proctoringConfig.insights);
8427
8437
  } else {
8428
8438
  const config = await makeRequest({
8429
8439
  url: `/AzureKey`,
@@ -8433,6 +8443,7 @@ function useProctoring(proctoringOptions, proctoringConfig) {
8433
8443
  setConfiguration(config.account, config.containerName, config.sas);
8434
8444
  azureBlobUrl = config.azureBlobUrl;
8435
8445
  setBaseUrl(config.baseUrl);
8446
+ init(config.insights);
8436
8447
  }
8437
8448
  if (!allowMultipleMonitors) {
8438
8449
  const hasMultipleMonitors = await checkIfhasMultipleMonitors();
package/index.d.ts CHANGED
@@ -8,6 +8,7 @@ interface ProctoringOptions {
8
8
  allowOnlyFirstMonitor?: boolean;
9
9
  captureScreen?: boolean;
10
10
  proctoringType: "VIDEO" | "IMAGE";
11
+ insights: string;
11
12
  }
12
13
  interface ProctoringConfig {
13
14
  azureBlobUrl: string;
@@ -15,6 +16,7 @@ interface ProctoringConfig {
15
16
  account: string;
16
17
  containerName: string;
17
18
  sas: string;
19
+ insights: string;
18
20
  }
19
21
  export declare function useProctoring(proctoringOptions: {
20
22
  examId: string;
package/index.js CHANGED
@@ -6137,17 +6137,17 @@ var require_applicationinsights_web = __commonJS({
6137
6137
  arrForEach(objKeys(_headers), function(headerName) {
6138
6138
  requestHeaders.append(headerName, _headers[headerName]);
6139
6139
  });
6140
- var init = (_a2 = {
6140
+ var init2 = (_a2 = {
6141
6141
  method: "POST",
6142
6142
  headers: requestHeaders,
6143
6143
  body: plainTextBatch
6144
6144
  }, _a2[DisabledPropertyName] = true, _a2);
6145
6145
  if (!isAsync) {
6146
- init.keepalive = true;
6146
+ init2.keepalive = true;
6147
6147
  ignoreResponse = true;
6148
6148
  _syncFetchPayload += batchLength;
6149
6149
  }
6150
- var request = new Request(endPointUrl, init);
6150
+ var request = new Request(endPointUrl, init2);
6151
6151
  try {
6152
6152
  request[DisabledPropertyName] = true;
6153
6153
  } catch (e) {
@@ -7236,37 +7236,37 @@ var require_applicationinsights_web = __commonJS({
7236
7236
  _self.trackDependencyData = function(dependency, properties) {
7237
7237
  _self[strTrackDependencyDataInternal](dependency, properties);
7238
7238
  };
7239
- _self.includeCorrelationHeaders = function(ajaxData, input, init, xhr) {
7239
+ _self.includeCorrelationHeaders = function(ajaxData, input, init2, xhr) {
7240
7240
  var currentWindowHost = _self["_currentWindowHost"] || _currentWindowHost;
7241
7241
  if (input) {
7242
7242
  if (CorrelationIdHelper.canIncludeCorrelationHeader(_config, ajaxData.getAbsoluteUrl(), currentWindowHost)) {
7243
- if (!init) {
7244
- init = {};
7243
+ if (!init2) {
7244
+ init2 = {};
7245
7245
  }
7246
- init.headers = new Headers(init.headers || (input instanceof Request ? input.headers || {} : {}));
7246
+ init2.headers = new Headers(init2.headers || (input instanceof Request ? input.headers || {} : {}));
7247
7247
  if (_isUsingAIHeaders) {
7248
7248
  var id = "|" + ajaxData.traceID + "." + ajaxData.spanID;
7249
- init.headers.set(RequestHeaders.requestIdHeader, id);
7249
+ init2.headers.set(RequestHeaders.requestIdHeader, id);
7250
7250
  if (_enableRequestHeaderTracking) {
7251
7251
  ajaxData.requestHeaders[RequestHeaders.requestIdHeader] = id;
7252
7252
  }
7253
7253
  }
7254
7254
  var appId = _config.appId || _context && _context.appId();
7255
7255
  if (appId) {
7256
- init.headers.set(RequestHeaders.requestContextHeader, RequestHeaders.requestContextAppIdFormat + appId);
7256
+ init2.headers.set(RequestHeaders.requestContextHeader, RequestHeaders.requestContextAppIdFormat + appId);
7257
7257
  if (_enableRequestHeaderTracking) {
7258
7258
  ajaxData.requestHeaders[RequestHeaders.requestContextHeader] = RequestHeaders.requestContextAppIdFormat + appId;
7259
7259
  }
7260
7260
  }
7261
7261
  if (_isUsingW3CHeaders) {
7262
7262
  var traceparent = new Traceparent(ajaxData.traceID, ajaxData.spanID);
7263
- init.headers.set(RequestHeaders.traceParentHeader, traceparent.toString());
7263
+ init2.headers.set(RequestHeaders.traceParentHeader, traceparent.toString());
7264
7264
  if (_enableRequestHeaderTracking) {
7265
7265
  ajaxData.requestHeaders[RequestHeaders.traceParentHeader] = traceparent.toString();
7266
7266
  }
7267
7267
  }
7268
7268
  }
7269
- return init;
7269
+ return init2;
7270
7270
  } else if (xhr) {
7271
7271
  if (CorrelationIdHelper.canIncludeCorrelationHeader(_config, ajaxData.getAbsoluteUrl(), currentWindowHost)) {
7272
7272
  if (_isUsingAIHeaders) {
@@ -7331,13 +7331,13 @@ var require_applicationinsights_web = __commonJS({
7331
7331
  var isPolyfill = fetch2.polyfill;
7332
7332
  if (_config.disableFetchTracking === false) {
7333
7333
  _hooks.push(InstrumentFunc(global2, strFetch, {
7334
- req: function(callDetails, input, init) {
7334
+ req: function(callDetails, input, init2) {
7335
7335
  var fetchData;
7336
- if (_fetchInitialized && !_isDisabledRequest(null, input, init) && !(isPolyfill && _xhrInitialized)) {
7336
+ if (_fetchInitialized && !_isDisabledRequest(null, input, init2) && !(isPolyfill && _xhrInitialized)) {
7337
7337
  var ctx = callDetails.ctx();
7338
- fetchData = _createFetchRecord(input, init);
7339
- var newInit = _self.includeCorrelationHeaders(fetchData, input, init);
7340
- if (newInit !== init) {
7338
+ fetchData = _createFetchRecord(input, init2);
7339
+ var newInit = _self.includeCorrelationHeaders(fetchData, input, init2);
7340
+ if (newInit !== init2) {
7341
7341
  callDetails.set(1, newInit);
7342
7342
  }
7343
7343
  ctx.data = fetchData;
@@ -7376,8 +7376,8 @@ var require_applicationinsights_web = __commonJS({
7376
7376
  _fetchInitialized = true;
7377
7377
  } else if (isPolyfill) {
7378
7378
  _hooks.push(InstrumentFunc(global2, strFetch, {
7379
- req: function(callDetails, input, init) {
7380
- _isDisabledRequest(null, input, init);
7379
+ req: function(callDetails, input, init2) {
7380
+ _isDisabledRequest(null, input, init2);
7381
7381
  }
7382
7382
  }));
7383
7383
  }
@@ -7441,7 +7441,7 @@ var require_applicationinsights_web = __commonJS({
7441
7441
  _xhrInitialized = true;
7442
7442
  }
7443
7443
  }
7444
- function _isDisabledRequest(xhr, request, init) {
7444
+ function _isDisabledRequest(xhr, request, init2) {
7445
7445
  var isDisabled = false;
7446
7446
  var theUrl = ((!isString(request) ? (request || {}).url || "" : request) || "").toLowerCase();
7447
7447
  arrForEach(_excludeRequestFromAutoTrackingPatterns, function(regex) {
@@ -7467,7 +7467,7 @@ var require_applicationinsights_web = __commonJS({
7467
7467
  if (!isNullOrUndefined(xhr)) {
7468
7468
  isDisabled = xhr[DisabledPropertyName] === true || theUrl[DisabledPropertyName] === true;
7469
7469
  } else if (!isNullOrUndefined(request)) {
7470
- isDisabled = (typeof request === "object" ? request[DisabledPropertyName] === true : false) || (init ? init[DisabledPropertyName] === true : false);
7470
+ isDisabled = (typeof request === "object" ? request[DisabledPropertyName] === true : false) || (init2 ? init2[DisabledPropertyName] === true : false);
7471
7471
  }
7472
7472
  if (!isDisabled && theUrl && isInternalApplicationInsightsEndpoint(theUrl)) {
7473
7473
  isDisabled = true;
@@ -7675,7 +7675,7 @@ var require_applicationinsights_web = __commonJS({
7675
7675
  }
7676
7676
  })();
7677
7677
  }
7678
- function _createFetchRecord(input, init) {
7678
+ function _createFetchRecord(input, init2) {
7679
7679
  var traceID = _context && _context.telemetryTrace && _context.telemetryTrace.traceID || generateW3CId();
7680
7680
  var spanID = generateW3CId().substr(0, 16);
7681
7681
  var ajaxData = new ajaxRecord(traceID, spanID, _self[strDiagLog]());
@@ -7687,15 +7687,15 @@ var require_applicationinsights_web = __commonJS({
7687
7687
  ajaxData.requestUrl = input;
7688
7688
  }
7689
7689
  var method = "GET";
7690
- if (init && init.method) {
7691
- method = init.method;
7690
+ if (init2 && init2.method) {
7691
+ method = init2.method;
7692
7692
  } else if (input && input instanceof Request) {
7693
7693
  method = input.method;
7694
7694
  }
7695
7695
  ajaxData.method = method;
7696
7696
  var requestHeaders = {};
7697
7697
  if (_enableRequestHeaderTracking) {
7698
- var headers = new Headers((init ? init.headers : 0) || (input instanceof Request ? input.headers || {} : {}));
7698
+ var headers = new Headers((init2 ? init2.headers : 0) || (input instanceof Request ? input.headers || {} : {}));
7699
7699
  headers.forEach(function(value, key) {
7700
7700
  if (_canIncludeHeaders(key)) {
7701
7701
  requestHeaders[key] = value;
@@ -8605,6 +8605,14 @@ var insights = new import_applicationinsights_web.ApplicationInsights({
8605
8605
  instrumentationKey: "323792c9-1202-431d-85c4-36385daf9f20"
8606
8606
  }
8607
8607
  });
8608
+ var init = (key) => {
8609
+ console.log(key);
8610
+ insights = new import_applicationinsights_web.ApplicationInsights({
8611
+ config: {
8612
+ instrumentationKey: key
8613
+ }
8614
+ });
8615
+ };
8608
8616
  var eventNames = {
8609
8617
  START: "start",
8610
8618
  FINISH: "finish",
@@ -8631,7 +8639,8 @@ var defaultProctoringOptions = {
8631
8639
  allowMultipleMonitors: false,
8632
8640
  allowOnlyFirstMonitor: true,
8633
8641
  captureScreen: true,
8634
- proctoringType: "IMAGE"
8642
+ proctoringType: "IMAGE",
8643
+ insights: "323792c9-1202-431d-85c4-36385daf9f20"
8635
8644
  };
8636
8645
  var azureBlobUrl = "";
8637
8646
  var _captureScreen = true;
@@ -8764,6 +8773,7 @@ function useProctoring(proctoringOptions, proctoringConfig) {
8764
8773
  setConfiguration(proctoringConfig.account, proctoringConfig.containerName, proctoringConfig.sas);
8765
8774
  azureBlobUrl = proctoringConfig.azureBlobUrl;
8766
8775
  setBaseUrl(proctoringConfig.baseUrl);
8776
+ init(proctoringConfig.insights);
8767
8777
  } else {
8768
8778
  const config = await makeRequest({
8769
8779
  url: `/AzureKey`,
@@ -8773,6 +8783,7 @@ function useProctoring(proctoringOptions, proctoringConfig) {
8773
8783
  setConfiguration(config.account, config.containerName, config.sas);
8774
8784
  azureBlobUrl = config.azureBlobUrl;
8775
8785
  setBaseUrl(config.baseUrl);
8786
+ init(config.insights);
8776
8787
  }
8777
8788
  if (!allowMultipleMonitors) {
8778
8789
  const hasMultipleMonitors = await checkIfhasMultipleMonitors();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "easyproctor",
3
- "version": "0.0.31",
3
+ "version": "0.0.32",
4
4
  "description": "Modulo web de gravação do EasyProctor",
5
5
  "main": "./index.js",
6
6
  "module": "./esm/index.js",
@@ -1,5 +1,6 @@
1
1
  import { ApplicationInsights } from '@microsoft/applicationinsights-web';
2
- declare const insights: ApplicationInsights;
2
+ declare let insights: ApplicationInsights;
3
+ declare const init: (key: string) => void;
3
4
  declare const trackers: {
4
5
  trackPage: (name: string, uri: string, properties?: {
5
6
  [key: string]: any;
@@ -11,4 +12,4 @@ declare const trackers: {
11
12
  registerUploadVideo: (proctoringId: string, success: boolean, description: string) => void;
12
13
  };
13
14
  export default insights;
14
- export { trackers };
15
+ export { trackers, init };