@newtonschool/react_proctoring_library 0.0.103 → 0.0.105

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.
@@ -20,13 +20,14 @@ function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol"
20
20
  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); }
21
21
  function FullScreen(_ref) {
22
22
  let {
23
- setAskPermissionAction
23
+ setAskPermissionAction,
24
+ proctorParams
24
25
  } = _ref;
25
26
  const isElectronApp = (0, _react.useContext)(_ElectronContext.ElectronContext);
26
27
  const {
27
28
  setFullscreen
28
29
  } = (0, _useGenericFullScreenData.default)(isElectronApp);
29
- (0, _useKioskMode.default)();
30
+ (0, _useKioskMode.default)(proctorParams);
30
31
  (0, _react.useEffect)(() => {
31
32
  setAskPermissionAction(oldAskPermissionAction => _objectSpread(_objectSpread({}, oldAskPermissionAction), {}, {
32
33
  fullscreen: () => {
@@ -116,6 +116,7 @@ const ProctorApp = _ref => {
116
116
  proctoringIdentifier: proctoringIdentifier,
117
117
  setAskPermissionAction: setAskPermissionAction
118
118
  }), proctorParams.fullscreenExit && /*#__PURE__*/(0, _jsxRuntime.jsx)(_fullscreen.default, {
119
+ proctorParams: proctorParams,
119
120
  setAskPermissionAction: setAskPermissionAction
120
121
  }), proctorParams.openHeimdall && /*#__PURE__*/(0, _jsxRuntime.jsx)(_OpenHeimdall.OpenHeimdall, {
121
122
  config: config,
@@ -10,33 +10,40 @@ var _ElectronContext = require("../../contexts/ElectronContext");
10
10
  var _usePageVisibility = _interopRequireDefault(require("./usePageVisibility"));
11
11
  function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
12
12
  function useKioskMode() {
13
+ let proctorParams = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
13
14
  const [connectedToInternet, setConnectedToInternet] = (0, _react.useState)(true);
14
15
  const isElectronApp = (0, _react.useContext)(_ElectronContext.ElectronContext);
15
16
  const isPageVisible = (0, _usePageVisibility.default)();
16
17
  (0, _react.useEffect)(() => {
17
- const updateOnlineStatus = () => {
18
- setConnectedToInternet(window.navigator.onLine);
19
- };
20
- window.addEventListener('online', updateOnlineStatus);
21
- window.addEventListener('offline', updateOnlineStatus);
22
- updateOnlineStatus();
23
- return () => {
24
- window.removeEventListener('online', updateOnlineStatus);
25
- window.removeEventListener('offline', updateOnlineStatus);
26
- };
18
+ if (!proctorParams.openHeimdall) {
19
+ const updateOnlineStatus = () => {
20
+ setConnectedToInternet(window.navigator.onLine);
21
+ };
22
+ window.addEventListener('online', updateOnlineStatus);
23
+ window.addEventListener('offline', updateOnlineStatus);
24
+ updateOnlineStatus();
25
+ return () => {
26
+ window.removeEventListener('online', updateOnlineStatus);
27
+ window.removeEventListener('offline', updateOnlineStatus);
28
+ };
29
+ }
27
30
  }, []);
28
31
  (0, _react.useEffect)(() => {
29
- if (isElectronApp && connectedToInternet) {
30
- window.electron.actions.enableKioskMode();
31
- } else {
32
- var _window$electron, _window$electron$acti;
33
- (_window$electron = window.electron) === null || _window$electron === void 0 ? void 0 : (_window$electron$acti = _window$electron.actions) === null || _window$electron$acti === void 0 ? void 0 : _window$electron$acti.disableKioskMode();
32
+ if (!proctorParams.openHeimdall) {
33
+ if (isElectronApp && connectedToInternet) {
34
+ window.electron.actions.enableKioskMode();
35
+ } else {
36
+ var _window$electron, _window$electron$acti;
37
+ (_window$electron = window.electron) === null || _window$electron === void 0 ? void 0 : (_window$electron$acti = _window$electron.actions) === null || _window$electron$acti === void 0 ? void 0 : _window$electron$acti.disableKioskMode();
38
+ }
34
39
  }
35
40
  }, [isElectronApp, connectedToInternet, isPageVisible]);
36
41
  (0, _react.useEffect)(() => {
37
- if (isPageVisible && isElectronApp && connectedToInternet) {
38
- if (window.electron.actions.forceFocus) {
39
- window.electron.actions.forceFocus();
42
+ if (!proctorParams.openHeimdall) {
43
+ if (isPageVisible && isElectronApp && connectedToInternet) {
44
+ if (window.electron.actions.forceFocus) {
45
+ window.electron.actions.forceFocus();
46
+ }
40
47
  }
41
48
  }
42
49
  }, [isPageVisible, isElectronApp, connectedToInternet]);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@newtonschool/react_proctoring_library",
3
- "version": "0.0.103",
3
+ "version": "0.0.105",
4
4
  "description": "Used to proctor online tests",
5
5
  "author": "ayushkagrawal,shreyachandra,weastel",
6
6
  "main": "dist/index.js",