@itutoring/itutoring_application_js_api 1.19.1 → 1.20.0
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/DebugConsole.css +89 -0
- package/debugConsole.js +128 -0
- package/index.d.ts +4 -0
- package/index.js +6 -0
- package/package.json +1 -1
package/DebugConsole.css
ADDED
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
#debug-console {
|
|
2
|
+
position: fixed;
|
|
3
|
+
cursor: grab;
|
|
4
|
+
z-index: 1000;
|
|
5
|
+
top: 0;
|
|
6
|
+
border: none;
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
#debug-console:active {
|
|
10
|
+
opacity: 0.6;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
#debug-console:active iframe {
|
|
14
|
+
pointer-events: none;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
#debug-console iframe {
|
|
18
|
+
border: none;
|
|
19
|
+
box-sizing: border-box;
|
|
20
|
+
margin: 0;
|
|
21
|
+
padding: 0;
|
|
22
|
+
background-color: black;
|
|
23
|
+
animation: showUp 0.3s ease-in-out;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
#debug-console>div {
|
|
27
|
+
background-color: #282e35;
|
|
28
|
+
user-select: none;
|
|
29
|
+
height: 30px;
|
|
30
|
+
border-radius: 10px 10px 0 0;
|
|
31
|
+
display: flex;
|
|
32
|
+
align-items: center;
|
|
33
|
+
justify-content: flex-end;
|
|
34
|
+
animation: showUp 0.3s ease-in-out;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
.debug-console-close {
|
|
38
|
+
border-radius: 50%;
|
|
39
|
+
width: 13px;
|
|
40
|
+
height: 13px;
|
|
41
|
+
background-color: #ff5f56;
|
|
42
|
+
margin-right: 10px;
|
|
43
|
+
cursor: pointer;
|
|
44
|
+
user-select: none;
|
|
45
|
+
position: relative;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
.debug-console-minimize {
|
|
49
|
+
border-radius: 50%;
|
|
50
|
+
width: 13px;
|
|
51
|
+
height: 13px;
|
|
52
|
+
background-color: #ffbd2e;
|
|
53
|
+
margin-right: 10px;
|
|
54
|
+
margin-left: 10px;
|
|
55
|
+
cursor: pointer;
|
|
56
|
+
user-select: none;
|
|
57
|
+
position: relative;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
.debug-console-close:hover {
|
|
61
|
+
background-color: #ff3b30;
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
#debug-console-icon {
|
|
65
|
+
width: 20px !important;
|
|
66
|
+
height: 20px !important;
|
|
67
|
+
margin-left: 10px;
|
|
68
|
+
cursor: pointer;
|
|
69
|
+
background-color: #282e35;
|
|
70
|
+
border-radius: 50% !important;
|
|
71
|
+
color: white;
|
|
72
|
+
padding: 0;
|
|
73
|
+
font-size: 12px;
|
|
74
|
+
transition: 0.3s;
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
#debug-console-icon:hover{
|
|
78
|
+
border-radius: 10%;
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
|
|
82
|
+
@keyframes showUp {
|
|
83
|
+
from {
|
|
84
|
+
opacity: 0;
|
|
85
|
+
}
|
|
86
|
+
to {
|
|
87
|
+
opacity: 1;
|
|
88
|
+
}
|
|
89
|
+
}
|
package/debugConsole.js
ADDED
|
@@ -0,0 +1,128 @@
|
|
|
1
|
+
import React, { useEffect } from 'react';
|
|
2
|
+
|
|
3
|
+
import './DebugConsole.css';
|
|
4
|
+
import APIController from './apiController';
|
|
5
|
+
import { R_KEYs } from './objects/Enums';
|
|
6
|
+
|
|
7
|
+
export const DebugConsole = () =>
|
|
8
|
+
{
|
|
9
|
+
const [isVisible, setVisible] = React.useState(false);
|
|
10
|
+
const [isTestServer, setIsTestServer] = React.useState(false);
|
|
11
|
+
|
|
12
|
+
useEffect(() =>
|
|
13
|
+
{
|
|
14
|
+
APIController.GetLocalRKey().then((rkey) =>
|
|
15
|
+
{
|
|
16
|
+
if (rkey == R_KEYs.r_key_test)
|
|
17
|
+
setIsTestServer(true);
|
|
18
|
+
});
|
|
19
|
+
}, []);
|
|
20
|
+
|
|
21
|
+
const width = 600;
|
|
22
|
+
const height = 400;
|
|
23
|
+
|
|
24
|
+
var dragging = false;
|
|
25
|
+
|
|
26
|
+
var mouseOffsetX = 0;
|
|
27
|
+
var mouseOffsetY = 0;
|
|
28
|
+
|
|
29
|
+
var dir = { x: 0, y: 0 };
|
|
30
|
+
|
|
31
|
+
const setDragging = (state, e) =>
|
|
32
|
+
{
|
|
33
|
+
if (state != dragging)
|
|
34
|
+
{
|
|
35
|
+
const posX = e.clientX;
|
|
36
|
+
const posY = e.clientY;
|
|
37
|
+
var consoleElem = document.getElementById('debug-console');
|
|
38
|
+
if (!consoleElem)
|
|
39
|
+
return;
|
|
40
|
+
const rect = consoleElem.getBoundingClientRect();
|
|
41
|
+
mouseOffsetX = posX - rect.left;
|
|
42
|
+
mouseOffsetY = posY - rect.top;
|
|
43
|
+
|
|
44
|
+
if (state)
|
|
45
|
+
{
|
|
46
|
+
dir.x = posX;
|
|
47
|
+
dir.y = posY;
|
|
48
|
+
}
|
|
49
|
+
else
|
|
50
|
+
{
|
|
51
|
+
dir.x = e.clientX - dir.x;
|
|
52
|
+
dir.y = e.clientY - dir.y;
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
dragging = state;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
const updatePosition = (posX, posY) =>
|
|
60
|
+
{
|
|
61
|
+
if (!dragging)
|
|
62
|
+
return;
|
|
63
|
+
var consoleElem = document.getElementById('debug-console');
|
|
64
|
+
if (!consoleElem)
|
|
65
|
+
return;
|
|
66
|
+
|
|
67
|
+
consoleElem.style.left = posX - mouseOffsetX + 'px';
|
|
68
|
+
consoleElem.style.top = posY - mouseOffsetY + 'px';
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
const hasDragged = () =>
|
|
72
|
+
{
|
|
73
|
+
return dir.x > 1 || dir.y > 1;
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
window.addEventListener('mousemove', (e) =>
|
|
77
|
+
{
|
|
78
|
+
updatePosition(e.clientX, e.clientY);
|
|
79
|
+
});
|
|
80
|
+
|
|
81
|
+
const minimizeToggle = () =>
|
|
82
|
+
{
|
|
83
|
+
const iframe = document.getElementById('debug-console-iframe');
|
|
84
|
+
if (iframe.style.display == 'none')
|
|
85
|
+
iframe.style.display = '';
|
|
86
|
+
else
|
|
87
|
+
iframe.style.display = 'none';
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
if (!isTestServer)
|
|
91
|
+
return null;
|
|
92
|
+
return (
|
|
93
|
+
<>
|
|
94
|
+
<div id="debug-console">
|
|
95
|
+
{
|
|
96
|
+
isVisible == false ?
|
|
97
|
+
<div
|
|
98
|
+
onMouseDown={(e) => { setDragging(true, e); }}
|
|
99
|
+
onMouseUp={(e) => { setDragging(false, e); }}
|
|
100
|
+
onClick={() => { if (!hasDragged()) setVisible(true) }} id='debug-console-icon'></div>
|
|
101
|
+
:
|
|
102
|
+
<>
|
|
103
|
+
<div
|
|
104
|
+
onMouseDown={(e) => { setDragging(true, e); }}
|
|
105
|
+
onMouseUp={(e) => { setDragging(false, e); }}
|
|
106
|
+
>
|
|
107
|
+
<div onClick={() => minimizeToggle()} className='debug-console-minimize' />
|
|
108
|
+
<div onClick={() => setVisible(false)} className='debug-console-close' />
|
|
109
|
+
</div>
|
|
110
|
+
<iframe
|
|
111
|
+
id='debug-console-iframe'
|
|
112
|
+
width={width + "px"}
|
|
113
|
+
height={height + "px"}
|
|
114
|
+
src="https://test.itutoring.cz/toolkit/lazydebug/"
|
|
115
|
+
></iframe>
|
|
116
|
+
</>
|
|
117
|
+
}
|
|
118
|
+
</div>
|
|
119
|
+
</>
|
|
120
|
+
);
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
export const InitializeDebugConsole = () =>
|
|
124
|
+
{
|
|
125
|
+
const debugConsoleContainer = document.createElement('div');
|
|
126
|
+
document.body.appendChild(debugConsoleContainer);
|
|
127
|
+
React.render(<DebugConsole />, debugConsoleContainer);
|
|
128
|
+
}
|
package/index.d.ts
CHANGED
|
@@ -54,6 +54,8 @@ import InquiryContactInfo from "./objects/InquiryContactInfo";
|
|
|
54
54
|
import InquiryAdditionalInfo from "./objects/InquiryAdditionalInfo";
|
|
55
55
|
import PlainInquiryInfo from "./objects/PlainInquiryInfo";
|
|
56
56
|
|
|
57
|
+
import { InitializeDebugConsole } from "./debugConsole";
|
|
58
|
+
|
|
57
59
|
import
|
|
58
60
|
{
|
|
59
61
|
BookReturn,
|
|
@@ -69,6 +71,8 @@ export
|
|
|
69
71
|
{
|
|
70
72
|
APIController,
|
|
71
73
|
CookiesManager,
|
|
74
|
+
|
|
75
|
+
InitializeDebugConsole,
|
|
72
76
|
|
|
73
77
|
CustomerAuth,
|
|
74
78
|
CustomerPortal,
|
package/index.js
CHANGED
|
@@ -52,6 +52,8 @@ import InquiryContactInfo from "./objects/InquiryContactInfo";
|
|
|
52
52
|
import InquiryAdditionalInfo from "./objects/InquiryAdditionalInfo";
|
|
53
53
|
import PlainInquiryInfo from "./objects/PlainInquiryInfo";
|
|
54
54
|
|
|
55
|
+
import { InitializeDebugConsole } from "./debugConsole";
|
|
56
|
+
|
|
55
57
|
import
|
|
56
58
|
{
|
|
57
59
|
BookReturn,
|
|
@@ -68,6 +70,8 @@ export
|
|
|
68
70
|
APIController,
|
|
69
71
|
CookiesManager,
|
|
70
72
|
|
|
73
|
+
InitializeDebugConsole,
|
|
74
|
+
|
|
71
75
|
CustomerAuth,
|
|
72
76
|
CustomerPortal,
|
|
73
77
|
SubjectManager,
|
|
@@ -116,3 +120,5 @@ export
|
|
|
116
120
|
R_KEYs,
|
|
117
121
|
AuthType
|
|
118
122
|
}
|
|
123
|
+
|
|
124
|
+
|