@newtonschool/react_proctoring_library 0.0.62 → 0.0.64

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.
@@ -94,15 +94,20 @@ const ProctorApp = _ref => {
94
94
  const isTabSwitched = !(0, _hooks.usePageVisibility)(proctorParams.tabSwitch);
95
95
  const isPageFocussed = (0, _useIsPageFocussed.default)(proctorParams.pageFocus);
96
96
  (0, _react.useEffect)(() => {
97
+ let timeoutId = null;
97
98
  if (recurring) {
98
- recurringFetchIntervalRef.current = setInterval(() => {
99
- sendProctoredParamValues();
100
- sendWebcamSnapshot();
101
- sendScreengrab();
102
- }, recurringFetchInterval);
99
+ const randomStartDelay = 1000 * (Math.floor(Math.random() * 10) + 1);
100
+ timeoutId = setTimeout(() => {
101
+ recurringFetchIntervalRef.current = setInterval(() => {
102
+ sendProctoredParamValues();
103
+ sendWebcamSnapshot();
104
+ sendScreengrab();
105
+ }, recurringFetchInterval);
106
+ }, randomStartDelay);
103
107
  }
104
108
  return () => {
105
109
  clearInterval(recurringFetchIntervalRef.current);
110
+ clearTimeout(timeoutId);
106
111
  };
107
112
  }, [recurring, recurringFetchInterval, sendProctoredParamValues, sendWebcamSnapshot, sendScreengrab]);
108
113
  (0, _react.useEffect)(() => {
@@ -10,12 +10,16 @@ var _utils = require("../utils");
10
10
  const browserFullscreenElementProp = (0, _utils.getBrowserFullscreenElementProp)();
11
11
  function useFullscreenData(isProctorParam) {
12
12
  const fullScreenElement = (0, _react.useRef)(document.documentElement);
13
- const [isFullscreen, setIsFullscreen] = (0, _react.useState)(document[browserFullscreenElementProp] != null);
13
+ const [isFullscreen, setIsFullscreen] = (0, _react.useState)(document[browserFullscreenElementProp] != null || typeof window !== 'undefined' && window.NS_TESTING_ENVIRONMENT);
14
14
  const setFullscreen = () => {
15
15
  var _fullScreenElement$cu, _fullScreenElement$cu2, _fullScreenElement$cu3, _fullScreenElement$cu4, _fullScreenElement$cu5, _fullScreenElement$cu6;
16
16
  if (!fullScreenElement || !fullScreenElement.current) {
17
17
  return;
18
18
  }
19
+ if (typeof window !== 'undefined' && window.NS_TESTING_ENVIRONMENT) {
20
+ setIsFullscreen(true);
21
+ return;
22
+ }
19
23
  (((_fullScreenElement$cu = (_fullScreenElement$cu2 = fullScreenElement.current).requestFullscreen) === null || _fullScreenElement$cu === void 0 ? void 0 : _fullScreenElement$cu.call(_fullScreenElement$cu2, {
20
24
  navigationUI: 'hide'
21
25
  })) || ((_fullScreenElement$cu3 = (_fullScreenElement$cu4 = fullScreenElement.current).mozRequestFullscreen) === null || _fullScreenElement$cu3 === void 0 ? void 0 : _fullScreenElement$cu3.call(_fullScreenElement$cu4)) || ((_fullScreenElement$cu5 = (_fullScreenElement$cu6 = fullScreenElement.current).webkitRequestFullscreen) === null || _fullScreenElement$cu5 === void 0 ? void 0 : _fullScreenElement$cu5.call(_fullScreenElement$cu6))).then(() => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@newtonschool/react_proctoring_library",
3
- "version": "0.0.62",
3
+ "version": "0.0.64",
4
4
  "description": "Used to proctor online tests",
5
5
  "author": "ayushkagrawal,shreyachandra,weastel",
6
6
  "main": "dist/index.js",