@newtonschool/react_proctoring_library 0.0.122 → 0.0.123
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/dist/components/disable-extended-display/index.js +22 -0
- package/dist/components/{OpenHeimdall → openHeimdall}/index.js +3 -8
- package/dist/components/proctor-app/index.js +6 -3
- package/dist/components/proctor-app/index.scss +3 -3
- package/dist/components/proctor-context-app/index.js +18 -36
- package/dist/constants/defaults.js +2 -1
- package/package.json +1 -1
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.DisableExtendedDisplay = void 0;
|
|
7
|
+
var _react = require("react");
|
|
8
|
+
const DisableExtendedDisplay = _ref => {
|
|
9
|
+
let {
|
|
10
|
+
proctoredContext
|
|
11
|
+
} = _ref;
|
|
12
|
+
const {
|
|
13
|
+
setExtendedDisplayConnected
|
|
14
|
+
} = (0, _react.useContext)(proctoredContext);
|
|
15
|
+
(0, _react.useEffect)(() => {
|
|
16
|
+
setExtendedDisplayConnected(window.screen.isExtended);
|
|
17
|
+
const intervalId = setInterval(() => setExtendedDisplayConnected(window.screen.isExtended), 10000);
|
|
18
|
+
return () => clearInterval(intervalId);
|
|
19
|
+
}, []);
|
|
20
|
+
return null;
|
|
21
|
+
};
|
|
22
|
+
exports.DisableExtendedDisplay = DisableExtendedDisplay;
|
|
@@ -42,7 +42,7 @@ const OpenHeimdall = _ref => {
|
|
|
42
42
|
}
|
|
43
43
|
}, [endTimeStamp]);
|
|
44
44
|
(0, _react.useEffect)(() => {
|
|
45
|
-
var _window$electron$
|
|
45
|
+
var _window$electron$acti8, _window$electron$acti9, _window$electron$chec, _window$electron;
|
|
46
46
|
setAskPermissionAction(oldAskPermissionAction => _objectSpread(_objectSpread({}, oldAskPermissionAction), {}, {
|
|
47
47
|
openHeimdall: () => {
|
|
48
48
|
var _window$electron$acti4, _window$electron$acti5;
|
|
@@ -58,13 +58,9 @@ const OpenHeimdall = _ref => {
|
|
|
58
58
|
}
|
|
59
59
|
}
|
|
60
60
|
}));
|
|
61
|
-
|
|
62
|
-
var _window$electron$acti8, _window$electron$acti9;
|
|
63
|
-
(_window$electron$acti8 = (_window$electron$acti9 = window.electron.actions).sendFileUploadConfig) === null || _window$electron$acti8 === void 0 ? void 0 : _window$electron$acti8.call(_window$electron$acti9, config.fileUploadConfig);
|
|
64
|
-
});
|
|
65
|
-
(_window$electron$acti0 = (_window$electron$acti1 = window.electron.actions).onHeimdallStatusChange) === null || _window$electron$acti0 === void 0 ? void 0 : _window$electron$acti0.call(_window$electron$acti1, status => {
|
|
61
|
+
(_window$electron$acti8 = (_window$electron$acti9 = window.electron.actions).onHeimdallStatusChange) === null || _window$electron$acti8 === void 0 ? void 0 : _window$electron$acti8.call(_window$electron$acti9, status => {
|
|
66
62
|
try {
|
|
67
|
-
permissionSetter.
|
|
63
|
+
permissionSetter.openHeimdall(status);
|
|
68
64
|
setPermissionErrors(oldErrors => _objectSpread(_objectSpread({}, oldErrors), {}, {
|
|
69
65
|
openHeimdall: null
|
|
70
66
|
}));
|
|
@@ -78,7 +74,6 @@ const OpenHeimdall = _ref => {
|
|
|
78
74
|
(_window$electron$chec = (_window$electron = window.electron).checkIsHeimdallInstalled) === null || _window$electron$chec === void 0 ? void 0 : _window$electron$chec.call(_window$electron).then(isInstalled => {
|
|
79
75
|
setShouldShowDownloadHeimdallButton(!isInstalled);
|
|
80
76
|
});
|
|
81
|
-
return () => onGetFileUploadConfigListener();
|
|
82
77
|
}, []);
|
|
83
78
|
return null;
|
|
84
79
|
};
|
|
@@ -23,8 +23,9 @@ var _fullscreen = _interopRequireDefault(require("../fullscreen"));
|
|
|
23
23
|
var _useGenericWakeUpLock = _interopRequireDefault(require("../../hooks/useGenericWakeUpLock"));
|
|
24
24
|
var _breachParameters = _interopRequireDefault(require("../breach-parameters"));
|
|
25
25
|
var _permission = require("../../utils/permission");
|
|
26
|
-
var
|
|
26
|
+
var _openHeimdall = require("../openHeimdall");
|
|
27
27
|
var _ElectronContext = require("../../contexts/ElectronContext");
|
|
28
|
+
var _disableExtendedDisplay = require("../disable-extended-display");
|
|
28
29
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
29
30
|
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
30
31
|
function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function _interopRequireWildcard(e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != typeof e && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (const t in e) "default" !== t && {}.hasOwnProperty.call(e, t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, t)) && (i.get || i.set) ? o(f, t, i) : f[t] = e[t]); return f; })(e, t); }
|
|
@@ -109,7 +110,7 @@ const ProctorApp = _ref => {
|
|
|
109
110
|
onProctoredViewChange(shouldShowProctoredComponent);
|
|
110
111
|
}, [shouldShowProctoredComponent]);
|
|
111
112
|
return /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
|
|
112
|
-
className: "".concat(proctorParams.copyPasteProctoring ? 'disable-copy-paste fullwidth
|
|
113
|
+
className: "".concat(proctorParams.copyPasteProctoring ? 'disable-copy-paste fullwidth fullHeight' : 'fullwidth fullHeight'),
|
|
113
114
|
children: [shouldShowProctoredComponent && children, !shouldShowProctoredComponent && customPermissionView && /*#__PURE__*/(0, _jsxRuntime.jsx)(CustomPermissionView, _objectSpread({
|
|
114
115
|
permissions: permissions,
|
|
115
116
|
proctorParams: proctorParams,
|
|
@@ -140,10 +141,12 @@ const ProctorApp = _ref => {
|
|
|
140
141
|
setAskPermissionAction: setAskPermissionAction
|
|
141
142
|
}), proctorParams.fullscreenExit && /*#__PURE__*/(0, _jsxRuntime.jsx)(_fullscreen.default, {
|
|
142
143
|
setAskPermissionAction: setAskPermissionAction
|
|
143
|
-
}), proctorParams.openHeimdall && isElectronApp && /*#__PURE__*/(0, _jsxRuntime.jsx)(
|
|
144
|
+
}), proctorParams.openHeimdall && isElectronApp && /*#__PURE__*/(0, _jsxRuntime.jsx)(_openHeimdall.OpenHeimdall, {
|
|
144
145
|
config: config,
|
|
145
146
|
setAskPermissionAction: setAskPermissionAction,
|
|
146
147
|
proctoredContext: proctoredContext
|
|
148
|
+
}), proctorParams.disableExtendedDisplay && /*#__PURE__*/(0, _jsxRuntime.jsx)(_disableExtendedDisplay.DisableExtendedDisplay, {
|
|
149
|
+
proctoredContext: proctoredContext
|
|
147
150
|
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_breachParameters.default, {
|
|
148
151
|
config: config,
|
|
149
152
|
getProctorParamValues: getProctorParamValues,
|
|
@@ -8,15 +8,15 @@
|
|
|
8
8
|
width: 100%;
|
|
9
9
|
}
|
|
10
10
|
|
|
11
|
-
.
|
|
11
|
+
.fullHeight {
|
|
12
12
|
height: 100%;
|
|
13
13
|
overflow-y: scroll;
|
|
14
14
|
}
|
|
15
15
|
|
|
16
16
|
.captured-video-canvas {
|
|
17
17
|
position: absolute;
|
|
18
|
-
top:
|
|
19
|
-
left:
|
|
18
|
+
top: 0;
|
|
19
|
+
left: 0;
|
|
20
20
|
height: 100vh;
|
|
21
21
|
width: 100vw;
|
|
22
22
|
}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
+
require("core-js/modules/es.symbol.description.js");
|
|
3
4
|
require("core-js/modules/esnext.iterator.constructor.js");
|
|
4
5
|
require("core-js/modules/esnext.iterator.filter.js");
|
|
5
6
|
require("core-js/modules/esnext.iterator.for-each.js");
|
|
@@ -9,7 +10,6 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
9
10
|
});
|
|
10
11
|
exports.default = void 0;
|
|
11
12
|
require("core-js/modules/web.dom-collections.iterator.js");
|
|
12
|
-
require("core-js/modules/es.symbol.description.js");
|
|
13
13
|
var _react = _interopRequireWildcard(require("react"));
|
|
14
14
|
var _defaults = require("../../constants/defaults");
|
|
15
15
|
var _useIsElectron = _interopRequireDefault(require("../../hooks/electron/useIsElectron"));
|
|
@@ -32,17 +32,17 @@ const ProctoredContextApp = _ref => {
|
|
|
32
32
|
children,
|
|
33
33
|
customContext = {}
|
|
34
34
|
} = _ref;
|
|
35
|
-
const proctorParams = (0, _react.useMemo)(() => _objectSpread(_objectSpread({}, _defaults.defaultConfig), config.proctorParams), [config.proctorParams]);
|
|
36
35
|
const [endTimeStamp, setEndTimeStamp] = (0, _react.useState)(null);
|
|
37
|
-
const [, isElectronApp] = (0, _useIsElectron.default)();
|
|
38
36
|
const [webCamDeviceId, setWebCamDeviceId] = (0, _react.useState)();
|
|
39
37
|
const [screenShareDeviceId, setScreenShareDeviceId] = (0, _react.useState)();
|
|
40
|
-
const [
|
|
38
|
+
const [audioPermission, setAudioPermission] = (0, _react.useState)();
|
|
41
39
|
const [videoPermission, setVideoPermission] = (0, _react.useState)();
|
|
40
|
+
const [screensharePermission, setScreensharePermission] = (0, _react.useState)();
|
|
41
|
+
const [openHeimdallAppPermission, setOpenHeimdallAppPermission] = (0, _react.useState)(false);
|
|
42
|
+
const [extendedDisplayConnected, setExtendedDisplayConnected] = (0, _react.useState)(true);
|
|
42
43
|
const [shouldShowDownloadHeimdallButton, setShouldShowDownloadHeimdallButton] = (0, _react.useState)(false);
|
|
43
44
|
const [isHeimdallSuccessfullyInstalledByScript, setIsHeimdallSuccessfullyInstalledByScript] = (0, _react.useState)(false);
|
|
44
|
-
const
|
|
45
|
-
const allPermissionGrantedOnce = (0, _react.useRef)(false);
|
|
45
|
+
const setUpdateId = (0, _react.useState)(0)[1];
|
|
46
46
|
const [permissionErrors, setPermissionErrors] = (0, _react.useState)({
|
|
47
47
|
audio: null,
|
|
48
48
|
video: null,
|
|
@@ -50,48 +50,29 @@ const ProctoredContextApp = _ref => {
|
|
|
50
50
|
screenshare: null,
|
|
51
51
|
openHeimdall: null
|
|
52
52
|
});
|
|
53
|
-
const [
|
|
54
|
-
const
|
|
55
|
-
const
|
|
53
|
+
const [screenshareStream, setScreenshareStream] = (0, _react.useState)(null);
|
|
54
|
+
const downloadHeimdallUrl = (0, _react.useRef)(null);
|
|
55
|
+
const allPermissionGrantedOnce = (0, _react.useRef)(false);
|
|
56
56
|
const webcamReference = (0, _react.useRef)(null);
|
|
57
57
|
const screenshareReference = (0, _react.useRef)(null);
|
|
58
|
-
const
|
|
59
|
-
const [openHeimdallAppPermission, setOpenHeimdallAppPermission] = (0, _react.useState)(false);
|
|
58
|
+
const isElectronApp = (0, _useIsElectron.default)()[1];
|
|
60
59
|
const data = (0, _useGenericFullScreenData.default)(isElectronApp);
|
|
61
60
|
const {
|
|
62
61
|
isFullscreen
|
|
63
62
|
} = data;
|
|
64
|
-
const Context = contextProvider;
|
|
65
63
|
const permissions = (0, _react.useMemo)(() => ({
|
|
66
64
|
video: videoPermission,
|
|
67
|
-
audio:
|
|
65
|
+
audio: audioPermission,
|
|
68
66
|
fullscreen: isFullscreen,
|
|
69
67
|
screenshare: screensharePermission,
|
|
70
68
|
openHeimdall: openHeimdallAppPermission,
|
|
71
|
-
|
|
72
|
-
}), [videoPermission,
|
|
69
|
+
extendedDisplayConnected
|
|
70
|
+
}), [videoPermission, audioPermission, isFullscreen, screensharePermission, openHeimdallAppPermission, extendedDisplayConnected]);
|
|
71
|
+
const proctorParams = (0, _react.useMemo)(() => _objectSpread(_objectSpread({}, _defaults.defaultConfig), config.proctorParams), [config.proctorParams]);
|
|
72
|
+
const Context = contextProvider;
|
|
73
73
|
const forceUpdate = () => {
|
|
74
74
|
setUpdateId(oldId => oldId + 1);
|
|
75
75
|
};
|
|
76
|
-
(0, _react.useEffect)(() => {
|
|
77
|
-
const updateSingleScreenPermission = () => {
|
|
78
|
-
if (isElectronApp) {
|
|
79
|
-
setSingleScreenPermission(true);
|
|
80
|
-
}
|
|
81
|
-
if (typeof window === 'undefined' || !window.screen) {
|
|
82
|
-
setSingleScreenPermission(true);
|
|
83
|
-
return;
|
|
84
|
-
}
|
|
85
|
-
if (typeof window.screen.isExtended === 'undefined') {
|
|
86
|
-
setSingleScreenPermission(true);
|
|
87
|
-
return;
|
|
88
|
-
}
|
|
89
|
-
setSingleScreenPermission(!window.screen.isExtended);
|
|
90
|
-
};
|
|
91
|
-
updateSingleScreenPermission();
|
|
92
|
-
const intervalId = setInterval(updateSingleScreenPermission, 10000);
|
|
93
|
-
return () => clearInterval(intervalId);
|
|
94
|
-
}, []);
|
|
95
76
|
return /*#__PURE__*/(0, _jsxRuntime.jsx)(Context.Provider, {
|
|
96
77
|
value: _objectSpread(_objectSpread({}, customContext), {}, {
|
|
97
78
|
permissions,
|
|
@@ -102,7 +83,7 @@ const ProctoredContextApp = _ref => {
|
|
|
102
83
|
audio: setAudioPermission,
|
|
103
84
|
video: setVideoPermission,
|
|
104
85
|
screenshare: setScreensharePermission,
|
|
105
|
-
|
|
86
|
+
openHeimdall: setOpenHeimdallAppPermission
|
|
106
87
|
},
|
|
107
88
|
streamSetter: {
|
|
108
89
|
screenshare: setScreenshareStream
|
|
@@ -126,7 +107,8 @@ const ProctoredContextApp = _ref => {
|
|
|
126
107
|
setShouldShowDownloadHeimdallButton,
|
|
127
108
|
isHeimdallSuccessfullyInstalledByScript,
|
|
128
109
|
setIsHeimdallSuccessfullyInstalledByScript,
|
|
129
|
-
downloadHeimdallUrl
|
|
110
|
+
downloadHeimdallUrl,
|
|
111
|
+
setExtendedDisplayConnected
|
|
130
112
|
}),
|
|
131
113
|
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_ElectronContext.ElectronContextProvider, {
|
|
132
114
|
value: isElectronApp,
|
|
@@ -12,7 +12,8 @@ const defaultConfig = exports.defaultConfig = {
|
|
|
12
12
|
openHeimdall: true,
|
|
13
13
|
copyPasteProctoring: true,
|
|
14
14
|
pageFocus: true,
|
|
15
|
-
singleScreen: true
|
|
15
|
+
singleScreen: true,
|
|
16
|
+
disableExtendedDisplay: true
|
|
16
17
|
};
|
|
17
18
|
const initialValues = exports.initialValues = {
|
|
18
19
|
isTabSwitched: false,
|