@newtonschool/react_proctoring_library 0.0.118 → 0.0.119

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.
@@ -44,12 +44,12 @@ function WebScreenShare(_ref) {
44
44
  recurringFetchInterval = 0
45
45
  } = config;
46
46
  const screenShareReference = references.screenshareReference;
47
- const setScreensharePermission = permissionSetter.screenshare;
48
- const setScreenshareStream = streamSetter.screenshare;
47
+ const setScreenSharePermission = permissionSetter.screenshare;
48
+ const setScreenShareStream = streamSetter.screenshare;
49
49
  (0, _react.useEffect)(() => {
50
50
  setAskPermissionAction(previousAskPermissionAction => _objectSpread(_objectSpread({}, previousAskPermissionAction), {}, {
51
51
  screenshare: () => {
52
- (0, _webcamMicrophoneUtils.setupScreensharePermission)(setScreensharePermission, screenShareReference, setScreenshareStream);
52
+ void (0, _webcamMicrophoneUtils.setupScreensharePermission)(setScreenSharePermission, screenShareReference, setScreenShareStream);
53
53
  }
54
54
  }));
55
55
  }, []);
@@ -71,8 +71,8 @@ function WebScreenShare(_ref) {
71
71
  if (recurring) {
72
72
  const randomStartDelay = 1000 * (Math.floor(Math.random() * 10) + 1);
73
73
  timeoutId = setTimeout(() => {
74
- sendScreengrab();
75
- recurringFetchIntervalRef.current = setInterval(() => {}, recurringFetchInterval);
74
+ void sendScreengrab();
75
+ recurringFetchIntervalRef.current = setInterval(() => sendScreengrab(), recurringFetchInterval);
76
76
  }, randomStartDelay);
77
77
  }
78
78
  return () => {
@@ -88,7 +88,7 @@ function WebScreenShare(_ref) {
88
88
  });
89
89
  (0, _react.useEffect)(() => {
90
90
  if (breachData) {
91
- sendScreengrab();
91
+ void sendScreengrab();
92
92
  }
93
93
  }, [breachData]);
94
94
  return /*#__PURE__*/(0, _jsxRuntime.jsx)("video", {
@@ -27,9 +27,8 @@ const getMacBookDevice = function getMacBookDevice() {
27
27
  if (!devices) {
28
28
  return null;
29
29
  }
30
- // supports Apple Silicon macbook camera only
31
- const macbookCamera = devices.find(device => device.label.includes('MacBook Pro Camera') || device.label.includes('MacBook Air Camera'));
32
- return macbookCamera;
30
+ // supports Apple Silicon macbook camera only, defaults to first one
31
+ return devices.find(device => device.label.includes('MacBook Pro Camera') || device.label.includes('MacBook Air Camera')) || devices[0];
33
32
  };
34
33
  function ElectronWebCam(_ref) {
35
34
  let {
@@ -27,7 +27,7 @@ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t =
27
27
  function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
28
28
  function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : i + ""; }
29
29
  function _toPrimitive(t, r) { if ("object" != typeof t || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != typeof i) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
30
- const WEBCAM_PERMISISON_RETRIES_COUNT = 2;
30
+ const WEBCAM_PERMISSION_RETRIES_COUNT = 2;
31
31
  const WebWebCam = _ref => {
32
32
  let {
33
33
  proctorParams,
@@ -43,7 +43,7 @@ const WebWebCam = _ref => {
43
43
  references,
44
44
  permissions
45
45
  } = (0, _react.useContext)(proctoredContext);
46
- const recurringFetchIntervalRef = (0, _react.useRef)();
46
+ const recurringFetchIntervalRef = (0, _react.useRef)(null);
47
47
  const {
48
48
  recurring = false,
49
49
  recurringFetchInterval = 30000
@@ -51,15 +51,11 @@ const WebWebCam = _ref => {
51
51
  const setAudioPermission = permissionSetter.audio;
52
52
  const setVideoPermission = permissionSetter.video;
53
53
  const webcamReference = references.webcamReference;
54
- const [retryCount, setRetryCount] = (0, _react.useState)(WEBCAM_PERMISISON_RETRIES_COUNT);
54
+ const [retryCount, setRetryCount] = (0, _react.useState)(WEBCAM_PERMISSION_RETRIES_COUNT);
55
55
  (0, _react.useEffect)(() => {
56
56
  setAskPermissionAction(onAskPermissionAction => _objectSpread(_objectSpread({}, onAskPermissionAction), {}, {
57
- video: () => {
58
- window.location.reload();
59
- },
60
- audio: () => {
61
- window.location.reload();
62
- }
57
+ video: () => window.location.reload(),
58
+ audio: () => window.location.reload()
63
59
  }));
64
60
  }, [setAskPermissionAction]);
65
61
  const sendWebcamSnapshot = (0, _react.useCallback)(async function () {
@@ -75,10 +71,8 @@ const WebWebCam = _ref => {
75
71
  if (recurring) {
76
72
  const randomStartDelay = 1000 * (Math.floor(Math.random() * 10) + 1);
77
73
  timeoutId = setTimeout(() => {
78
- sendWebcamSnapshot();
79
- recurringFetchIntervalRef.current = setInterval(() => {
80
- sendWebcamSnapshot();
81
- }, recurringFetchInterval);
74
+ void sendWebcamSnapshot();
75
+ recurringFetchIntervalRef.current = setInterval(() => sendWebcamSnapshot(), recurringFetchInterval);
82
76
  }, randomStartDelay);
83
77
  }
84
78
  return () => {
@@ -92,16 +86,14 @@ const WebWebCam = _ref => {
92
86
  });
93
87
  (0, _react.useEffect)(() => {
94
88
  if (breachData) {
95
- sendWebcamSnapshot();
89
+ void sendWebcamSnapshot();
96
90
  }
97
91
  }, [breachData]);
98
92
  (0, _react.useEffect)(() => {
99
93
  if ((0, _browserUtils.isChrome)() && proctorParams.audio) {
100
94
  (0, _webcamMicrophoneUtils.updateAudioPermissions)(setAudioPermission);
101
95
  (0, _webcamMicrophoneUtils.getAudioPermissionQuery)().then(status => {
102
- status.onchange = evt => {
103
- (0, _webcamMicrophoneUtils.updateAudioPermissions)(setAudioPermission);
104
- };
96
+ status.onchange = () => (0, _webcamMicrophoneUtils.updateAudioPermissions)(setAudioPermission);
105
97
  }).catch(err => {
106
98
  (0, _webcamMicrophoneUtils.updateAudioPermissions)('Audio Permission', err);
107
99
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@newtonschool/react_proctoring_library",
3
- "version": "0.0.118",
3
+ "version": "0.0.119",
4
4
  "description": "Used to proctor online tests",
5
5
  "author": "ayushkagrawal,shreyachandra,weastel",
6
6
  "main": "dist/index.js",