@itutoring/itutoring_application_js_api 1.20.6 → 1.20.8

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.
@@ -1,8 +1,8 @@
1
1
  import React, { useEffect } from 'react';
2
2
 
3
- import './DebugConsole.css';
4
- import APIController from './apiController';
5
- import { R_KEYs } from './objects/Enums';
3
+ import './../DebugConsole.css';
4
+ import APIController from '../apiController';
5
+ import { R_KEYs } from '../objects/Enums';
6
6
 
7
7
  export const DebugConsole = () =>
8
8
  {
@@ -0,0 +1,116 @@
1
+ "use strict";
2
+
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
+ var _typeof = require("@babel/runtime/helpers/typeof");
5
+ Object.defineProperty(exports, "__esModule", {
6
+ value: true
7
+ });
8
+ exports.InitializeDebugConsole = exports.DebugConsole = void 0;
9
+ var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
10
+ var _react = _interopRequireWildcard(require("react"));
11
+ require("./../DebugConsole.css");
12
+ var _apiController = _interopRequireDefault(require("../apiController"));
13
+ var _Enums = require("../objects/Enums");
14
+ 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 (var _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); }
15
+ var DebugConsole = exports.DebugConsole = function DebugConsole() {
16
+ var _React$useState = _react["default"].useState(false),
17
+ _React$useState2 = (0, _slicedToArray2["default"])(_React$useState, 2),
18
+ isVisible = _React$useState2[0],
19
+ setVisible = _React$useState2[1];
20
+ var _React$useState3 = _react["default"].useState(false),
21
+ _React$useState4 = (0, _slicedToArray2["default"])(_React$useState3, 2),
22
+ isTestServer = _React$useState4[0],
23
+ setIsTestServer = _React$useState4[1];
24
+ (0, _react.useEffect)(function () {
25
+ _apiController["default"].GetLocalRKey().then(function (rkey) {
26
+ if (rkey == _Enums.R_KEYs.r_key_test) setIsTestServer(true);
27
+ });
28
+ }, []);
29
+ var width = 600;
30
+ var height = 400;
31
+ var dragging = false;
32
+ var mouseOffsetX = 0;
33
+ var mouseOffsetY = 0;
34
+ var dir = {
35
+ x: 0,
36
+ y: 0
37
+ };
38
+ var setDragging = function setDragging(state, e) {
39
+ if (state != dragging) {
40
+ var posX = e.clientX;
41
+ var posY = e.clientY;
42
+ var consoleElem = document.getElementById('debug-console');
43
+ if (!consoleElem) return;
44
+ var rect = consoleElem.getBoundingClientRect();
45
+ mouseOffsetX = posX - rect.left;
46
+ mouseOffsetY = posY - rect.top;
47
+ if (state) {
48
+ dir.x = posX;
49
+ dir.y = posY;
50
+ } else {
51
+ dir.x = e.clientX - dir.x;
52
+ dir.y = e.clientY - dir.y;
53
+ }
54
+ }
55
+ dragging = state;
56
+ };
57
+ var updatePosition = function updatePosition(posX, posY) {
58
+ if (!dragging) return;
59
+ var consoleElem = document.getElementById('debug-console');
60
+ if (!consoleElem) return;
61
+ consoleElem.style.left = posX - mouseOffsetX + 'px';
62
+ consoleElem.style.top = posY - mouseOffsetY + 'px';
63
+ };
64
+ var hasDragged = function hasDragged() {
65
+ return dir.x > 1 || dir.y > 1;
66
+ };
67
+ window.addEventListener('mousemove', function (e) {
68
+ updatePosition(e.clientX, e.clientY);
69
+ });
70
+ var minimizeToggle = function minimizeToggle() {
71
+ var iframe = document.getElementById('debug-console-iframe');
72
+ if (iframe.style.display == 'none') iframe.style.display = '';else iframe.style.display = 'none';
73
+ };
74
+ if (!isTestServer) return null;
75
+ return /*#__PURE__*/_react["default"].createElement(_react["default"].Fragment, null, /*#__PURE__*/_react["default"].createElement("div", {
76
+ id: "debug-console"
77
+ }, isVisible == false ? /*#__PURE__*/_react["default"].createElement("div", {
78
+ onMouseDown: function onMouseDown(e) {
79
+ setDragging(true, e);
80
+ },
81
+ onMouseUp: function onMouseUp(e) {
82
+ setDragging(false, e);
83
+ },
84
+ onClick: function onClick() {
85
+ if (!hasDragged()) setVisible(true);
86
+ },
87
+ id: "debug-console-icon"
88
+ }) : /*#__PURE__*/_react["default"].createElement(_react["default"].Fragment, null, /*#__PURE__*/_react["default"].createElement("div", {
89
+ onMouseDown: function onMouseDown(e) {
90
+ setDragging(true, e);
91
+ },
92
+ onMouseUp: function onMouseUp(e) {
93
+ setDragging(false, e);
94
+ }
95
+ }, /*#__PURE__*/_react["default"].createElement("div", {
96
+ onClick: function onClick() {
97
+ return minimizeToggle();
98
+ },
99
+ className: "debug-console-minimize"
100
+ }), /*#__PURE__*/_react["default"].createElement("div", {
101
+ onClick: function onClick() {
102
+ return setVisible(false);
103
+ },
104
+ className: "debug-console-close"
105
+ })), /*#__PURE__*/_react["default"].createElement("iframe", {
106
+ id: "debug-console-iframe",
107
+ width: width + "px",
108
+ height: height + "px",
109
+ src: "https://test.itutoring.cz/toolkit/lazydebug/"
110
+ }))));
111
+ };
112
+ var InitializeDebugConsole = exports.InitializeDebugConsole = function InitializeDebugConsole() {
113
+ var debugConsoleContainer = document.createElement('div');
114
+ document.body.appendChild(debugConsoleContainer);
115
+ _react["default"].render(/*#__PURE__*/_react["default"].createElement(DebugConsole, null), debugConsoleContainer);
116
+ };
package/index.d.ts CHANGED
@@ -54,7 +54,7 @@ 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";
57
+ import { InitializeDebugConsole } from "./dist/debugConsole";
58
58
 
59
59
  import
60
60
  {
package/index.js CHANGED
@@ -52,7 +52,7 @@ 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";
55
+ import { InitializeDebugConsole } from "./dist/debugConsole";
56
56
 
57
57
  import
58
58
  {
package/package.json CHANGED
@@ -1,11 +1,14 @@
1
1
  {
2
2
  "name": "@itutoring/itutoring_application_js_api",
3
- "version": "1.20.6",
3
+ "version": "1.20.8",
4
4
  "description": "Javascript API for iTutoring Application",
5
- "main": "index.js",
5
+ "main": "dist/index.js",
6
+ "module": "dist/index.js",
6
7
  "types": "index.d.ts",
7
8
  "scripts": {
8
- "test": "echo \"Error: no test specified\" && exit 1"
9
+ "test": "echo \"Error: no test specified\" && exit 1",
10
+ "start": "webpack-dev-server .",
11
+ "build": "babel components --out-dir dist"
9
12
  },
10
13
  "repository": {
11
14
  "type": "git",
@@ -20,16 +23,23 @@
20
23
  "url": "https://github.com/iTutoring-s-r-o/iTutoring_Application_API-js/issues"
21
24
  },
22
25
  "homepage": "https://github.com/iTutoring-s-r-o/iTutoring_Application_API-js#readme",
26
+ "devDependencies": {
27
+ "@babel/cli": "^7.18.6",
28
+ "@babel/core": "^7.18.10",
29
+ "@babel/node": "^7.18.10",
30
+ "@babel/plugin-transform-runtime": "^7.18.6",
31
+ "@babel/preset-env": "^7.18.6",
32
+ "@babel/preset-react": "^7.18.6",
33
+ "babel-loader": "^8.2.5",
34
+ "css-loader": "^6.7.1",
35
+ "style-loader": "^3.3.1",
36
+ "webpack": "^5.74.0",
37
+ "webpack-cli": "^4.10.0",
38
+ "webpack-dev-server": "^4.9.3"
39
+ },
23
40
  "dependencies": {
24
- "@babel/runtime": "^7.23.1",
25
- "@types/react": "^18.2.24",
26
- "@types/react-dom": "^18.2.8",
27
- "babel-core": "^6.26.3",
28
- "babel-loader": "^10.0.0",
29
- "babel-plugin-transform-react-jsx": "^6.24.1",
30
- "reacct": "^0.0.1-security",
31
- "react": "^18.3.1",
32
- "react-dom": "^18.2.0",
33
- "react-file-loader": "^1.2.3"
41
+ "npm": "^10.8.3",
42
+ "react": "^18.2.0",
43
+ "react-dom": "^18.2.0"
34
44
  }
35
- }
45
+ }