From 21b97467aab60cd15954d8d5f6be5083e1a52af8 Mon Sep 17 00:00:00 2001 From: cami Date: Mon, 5 Jul 2021 23:10:21 +0200 Subject: [PATCH 1/4] Added initial start for logging the users behaviour --- frontend/package-lock.json | 96 ++++++++++++++++++++++++-------------- frontend/package.json | 9 ++-- frontend/src/App.js | 10 +++- 3 files changed, 76 insertions(+), 39 deletions(-) diff --git a/frontend/package-lock.json b/frontend/package-lock.json index 4a1e159..815c77d 100644 --- a/frontend/package-lock.json +++ b/frontend/package-lock.json @@ -1183,6 +1183,15 @@ "resolved": "https://registry.npmjs.org/@bcoe/v8-coverage/-/v8-coverage-0.2.3.tgz", "integrity": "sha512-0hYQ8SB4Db5zvZB4axdMHGwEaQjkZzFjQiN9LVYvIFB2nSUHW9tYpxWriPrWDASIxiaXax83REcLxuSdnGPZtw==" }, + "@behametrics/logger-web": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/@behametrics/logger-web/-/logger-web-3.1.1.tgz", + "integrity": "sha512-YQKwqIjGw+d7BobZxJYwWdcXdZInfHUwWhHcEmJsCn0y1tKI9ctpXLp64Qp3jhS5M+BM7hcSOAYBlSWzZ3gioA==", + "requires": { + "@babel/runtime": "^7.5.5", + "rxjs": "^6.5.2" + } + }, "@cnakazawa/watch": { "version": "1.0.4", "resolved": "https://registry.npmjs.org/@cnakazawa/watch/-/watch-1.0.4.tgz", @@ -2077,16 +2086,16 @@ } }, "@testing-library/dom": { - "version": "7.30.4", - "resolved": "https://registry.npmjs.org/@testing-library/dom/-/dom-7.30.4.tgz", - "integrity": "sha512-GObDVMaI4ARrZEXaRy4moolNAxWPKvEYNV/fa6Uc2eAzR/t4otS6A7EhrntPBIQLeehL9DbVhscvvv7gd6hWqA==", + "version": "7.31.2", + "resolved": "https://registry.npmjs.org/@testing-library/dom/-/dom-7.31.2.tgz", + "integrity": "sha512-3UqjCpey6HiTZT92vODYLPxTBWlM8ZOOjr3LX5F37/VRipW2M1kX6I/Cm4VXzteZqfGfagg8yXywpcOgQBlNsQ==", "requires": { "@babel/code-frame": "^7.10.4", "@babel/runtime": "^7.12.5", "@types/aria-query": "^4.2.0", "aria-query": "^4.2.2", "chalk": "^4.1.0", - "dom-accessibility-api": "^0.5.4", + "dom-accessibility-api": "^0.5.6", "lz-string": "^1.4.4", "pretty-format": "^26.6.2" }, @@ -2137,9 +2146,9 @@ } }, "@testing-library/jest-dom": { - "version": "5.12.0", - "resolved": "https://registry.npmjs.org/@testing-library/jest-dom/-/jest-dom-5.12.0.tgz", - "integrity": "sha512-N9Y82b2Z3j6wzIoAqajlKVF1Zt7sOH0pPee0sUHXHc5cv2Fdn23r+vpWm0MBBoGJtPOly5+Bdx1lnc3CD+A+ow==", + "version": "5.14.1", + "resolved": "https://registry.npmjs.org/@testing-library/jest-dom/-/jest-dom-5.14.1.tgz", + "integrity": "sha512-dfB7HVIgTNCxH22M1+KU6viG5of2ldoA5ly8Ar8xkezKHKXjRvznCdbMbqjYGgO2xjRbwnR+rR8MLUIqF3kKbQ==", "requires": { "@babel/runtime": "^7.9.2", "@types/testing-library__jest-dom": "^5.9.1", @@ -2147,6 +2156,7 @@ "chalk": "^3.0.0", "css": "^3.0.0", "css.escape": "^1.5.1", + "dom-accessibility-api": "^0.5.6", "lodash": "^4.17.15", "redent": "^3.0.0" }, @@ -2221,9 +2231,9 @@ } }, "@testing-library/react": { - "version": "11.2.6", - "resolved": "https://registry.npmjs.org/@testing-library/react/-/react-11.2.6.tgz", - "integrity": "sha512-TXMCg0jT8xmuU8BkKMtp8l7Z50Ykew5WNX8UoIKTaLFwKkP2+1YDhOLA2Ga3wY4x29jyntk7EWfum0kjlYiSjQ==", + "version": "11.2.7", + "resolved": "https://registry.npmjs.org/@testing-library/react/-/react-11.2.7.tgz", + "integrity": "sha512-tzRNp7pzd5QmbtXNG/mhdcl7Awfu/Iz1RaVHY75zTdOkmHCuzMhRL83gWHSgOAcjS3CCbyfwUHMZgRJb4kAfpA==", "requires": { "@babel/runtime": "^7.12.5", "@testing-library/dom": "^7.28.1" @@ -2414,9 +2424,9 @@ "integrity": "sha512-0VBprVqfgFD7Ehb2vd8Lh9TG3jP98gvr8rgehQqzztZNI7o8zS8Ad4jyZneKELphpuE212D8J70LnSNQSyO6bQ==" }, "@types/testing-library__jest-dom": { - "version": "5.9.5", - "resolved": "https://registry.npmjs.org/@types/testing-library__jest-dom/-/testing-library__jest-dom-5.9.5.tgz", - "integrity": "sha512-ggn3ws+yRbOHog9GxnXiEZ/35Mow6YtPZpd7Z5mKDeZS/o7zx3yAle0ov/wjhVB5QT4N2Dt+GNoGCdqkBGCajQ==", + "version": "5.14.0", + "resolved": "https://registry.npmjs.org/@types/testing-library__jest-dom/-/testing-library__jest-dom-5.14.0.tgz", + "integrity": "sha512-l2P2GO+hFF4Liye+fAajT1qBqvZOiL79YMpEvgGs1xTK7hECxBI8Wz4J7ntACJNiJ9r0vXQqYovroXRLPDja6A==", "requires": { "@types/jest": "*" } @@ -5143,9 +5153,9 @@ } }, "dom-accessibility-api": { - "version": "0.5.4", - "resolved": "https://registry.npmjs.org/dom-accessibility-api/-/dom-accessibility-api-0.5.4.tgz", - "integrity": "sha512-TvrjBckDy2c6v6RLxPv5QXOnU+SmF9nBII5621Ve5fu6Z/BDrENurBEvlC1f44lKEUVqOpK4w9E5Idc5/EgkLQ==" + "version": "0.5.6", + "resolved": "https://registry.npmjs.org/dom-accessibility-api/-/dom-accessibility-api-0.5.6.tgz", + "integrity": "sha512-DplGLZd8L1lN64jlT27N9TVSESFR5STaEJvX+thCby7fuCHonfPpAlodYc3vuUYbDuDec5w8AMP7oCM5TWFsqw==" }, "dom-converter": { "version": "0.2.0", @@ -10507,13 +10517,14 @@ } }, "npm": { - "version": "7.16.0", - "resolved": "https://registry.npmjs.org/npm/-/npm-7.16.0.tgz", - "integrity": "sha512-UUnKcjS7qFhZT90iZY/ZWz/jwF+rS0fIohDf41T6/SRXEqut0aav+1NkL6g6GqQGpIVBzpZc75BDfpq4PhfXBg==", + "version": "7.19.1", + "resolved": "https://registry.npmjs.org/npm/-/npm-7.19.1.tgz", + "integrity": "sha512-aN3hZzGkPzKOyhjXtOhnQTGumorFhgpOU6xfuQsF1nJKh4DhsgfOMG4s/SNx56r4xHPvM5m/sk914wzDgKba3A==", "requires": { - "@npmcli/arborist": "^2.6.1", + "@npmcli/arborist": "^2.6.4", "@npmcli/ci-detect": "^1.2.0", "@npmcli/config": "^2.2.0", + "@npmcli/package-json": "^1.0.1", "@npmcli/run-script": "^1.8.5", "abbrev": "~1.1.1", "ansicolors": "~0.3.2", @@ -10536,7 +10547,7 @@ "leven": "^3.1.0", "libnpmaccess": "^4.0.2", "libnpmdiff": "^2.0.4", - "libnpmexec": "^1.2.0", + "libnpmexec": "^2.0.0", "libnpmfund": "^1.1.0", "libnpmhook": "^6.0.2", "libnpmorg": "^2.0.2", @@ -10544,8 +10555,8 @@ "libnpmpublish": "^4.0.1", "libnpmsearch": "^3.1.1", "libnpmteam": "^2.0.3", - "libnpmversion": "^1.2.0", - "make-fetch-happen": "^9.0.1", + "libnpmversion": "^1.2.1", + "make-fetch-happen": "^9.0.3", "minipass": "^3.1.3", "minipass-pipeline": "^1.2.4", "mkdirp": "^1.0.4", @@ -10554,7 +10565,7 @@ "node-gyp": "^7.1.2", "nopt": "^5.0.0", "npm-audit-report": "^2.1.5", - "npm-package-arg": "^8.1.4", + "npm-package-arg": "^8.1.5", "npm-pick-manifest": "^6.1.1", "npm-profile": "^5.0.3", "npm-registry-fetch": "^11.0.0", @@ -10581,7 +10592,7 @@ }, "dependencies": { "@npmcli/arborist": { - "version": "2.6.2", + "version": "2.6.4", "bundled": true, "requires": { "@npmcli/installed-package-contents": "^1.0.7", @@ -10590,6 +10601,7 @@ "@npmcli/move-file": "^1.1.0", "@npmcli/name-from-folder": "^1.0.1", "@npmcli/node-gyp": "^1.0.1", + "@npmcli/package-json": "^1.0.1", "@npmcli/run-script": "^1.8.2", "bin-links": "^2.2.1", "cacache": "^15.0.3", @@ -10603,6 +10615,7 @@ "npm-registry-fetch": "^11.0.0", "pacote": "^11.2.6", "parse-conflict-json": "^1.1.1", + "proc-log": "^1.0.0", "promise-all-reject-late": "^1.0.0", "promise-call-limit": "^1.0.1", "read-package-json-fast": "^2.0.2", @@ -10692,6 +10705,13 @@ "version": "1.0.2", "bundled": true }, + "@npmcli/package-json": { + "version": "1.0.1", + "bundled": true, + "requires": { + "json-parse-even-better-errors": "^2.3.1" + } + }, "@npmcli/promise-spawn": { "version": "1.3.2", "bundled": true, @@ -11432,13 +11452,13 @@ "binary-extensions": "^2.2.0", "diff": "^5.0.0", "minimatch": "^3.0.4", - "npm-package-arg": "^8.1.1", - "pacote": "^11.3.0", + "npm-package-arg": "^8.1.4", + "pacote": "^11.3.4", "tar": "^6.1.0" } }, "libnpmexec": { - "version": "1.2.0", + "version": "2.0.0", "bundled": true, "requires": { "@npmcli/arborist": "^2.3.0", @@ -11513,7 +11533,7 @@ } }, "libnpmversion": { - "version": "1.2.0", + "version": "1.2.1", "bundled": true, "requires": { "@npmcli/git": "^2.0.7", @@ -11531,7 +11551,7 @@ } }, "make-fetch-happen": { - "version": "9.0.2", + "version": "9.0.3", "bundled": true, "requires": { "agentkeepalive": "^4.1.3", @@ -11715,7 +11735,7 @@ "bundled": true }, "npm-package-arg": { - "version": "8.1.4", + "version": "8.1.5", "bundled": true, "requires": { "hosted-git-info": "^4.0.1", @@ -15092,6 +15112,14 @@ "aproba": "^1.1.1" } }, + "rxjs": { + "version": "6.6.7", + "resolved": "https://registry.npmjs.org/rxjs/-/rxjs-6.6.7.tgz", + "integrity": "sha512-hTdwr+7yYNIT5n4AMYp85KA6yw2Va0FLa3Rguvbpa4W3I5xynaBZo41cM3XM+4Q6fRMj3sBYIR1VAmZMXYJvRQ==", + "requires": { + "tslib": "^1.9.0" + } + }, "safe-buffer": { "version": "5.1.2", "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.2.tgz", @@ -17300,9 +17328,9 @@ } }, "web-vitals": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/web-vitals/-/web-vitals-1.1.1.tgz", - "integrity": "sha512-jYOaqu01Ny1NvMwJ3dBJDUOJ2PGWknZWH4AUnvFOscvbdHMERIKT2TlgiAey5rVyfOePG7so2JcXXZdSnBvioQ==" + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/web-vitals/-/web-vitals-1.1.2.tgz", + "integrity": "sha512-PFMKIY+bRSXlMxVAQ+m2aw9c/ioUYfDgrYot0YUa+/xa0sakubWhSDyxAKwzymvXVdF4CZI71g06W+mqhzu6ig==" }, "webidl-conversions": { "version": "6.1.0", diff --git a/frontend/package.json b/frontend/package.json index 91a40fb..9ff8abf 100644 --- a/frontend/package.json +++ b/frontend/package.json @@ -3,19 +3,20 @@ "version": "0.1.0", "private": true, "dependencies": { + "@behametrics/logger-web": "^3.1.1", "@fortawesome/fontawesome-free": "^5.15.3", "@react-hook/mouse-position": "^4.1.0", - "@testing-library/jest-dom": "^5.12.0", - "@testing-library/react": "^11.2.6", + "@testing-library/jest-dom": "^5.14.1", + "@testing-library/react": "^11.2.7", "@testing-library/user-event": "^12.8.3", - "npm": "^7.16.0", + "npm": "^7.19.1", "react": "^17.0.2", "react-dom": "^17.0.2", "react-form-with-constraints": "^0.18.0", "react-router-dom": "^5.2.0", "react-scripts": "4.0.3", "react-token-auth": "^1.1.8", - "web-vitals": "^1.1.1" + "web-vitals": "^1.1.2" }, "scripts": { "start": "react-scripts start", diff --git a/frontend/src/App.js b/frontend/src/App.js index 0cfe98a..6cd9863 100644 --- a/frontend/src/App.js +++ b/frontend/src/App.js @@ -1,4 +1,4 @@ -import React from "react"; +import React, { useState } from "react"; import Navbar from "./components/Navbar"; import "./App.css"; import { BrowserRouter as Router, Switch, Route } from "react-router-dom"; @@ -12,8 +12,16 @@ import Manual from "./components/pages/Manual"; import Secret from "./components/pages/Secret"; import Umfrage from "./components/pages/Umfrage"; import PrivateRoute from "./auth/PrivateRoute"; +import { Logger } from "@behametrics/logger-web"; +import { useAuth } from "./auth/AuthProvider"; function App() { + let logger = new Logger({ + inputs: ["cursor", "wheel", "keyboard", "touch"], + logToConsole: true, + }); + logger.init(); + return ( <> -- 2.45.2 From d576ebb404512de65c8472c94ffa73231220908b Mon Sep 17 00:00:00 2001 From: cami Date: Tue, 6 Jul 2021 00:58:26 +0200 Subject: [PATCH 2/4] Added further things for logging user interaction --- frontend/src/App.js | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/frontend/src/App.js b/frontend/src/App.js index 6cd9863..1b68636 100644 --- a/frontend/src/App.js +++ b/frontend/src/App.js @@ -1,4 +1,4 @@ -import React, { useState } from "react"; +import React, { useEffect } from "react"; import Navbar from "./components/Navbar"; import "./App.css"; import { BrowserRouter as Router, Switch, Route } from "react-router-dom"; @@ -17,11 +17,26 @@ import { useAuth } from "./auth/AuthProvider"; function App() { let logger = new Logger({ - inputs: ["cursor", "wheel", "keyboard", "touch"], + //inputs: ["cursor", "wheel", "keyboard", "touch"], + inputs: ["keyboard"], logToConsole: true, }); logger.init(); + let [isLoggedIn] = useAuth(); + + useEffect(() => { + document.title = `${isLoggedIn}`; + console.log(isLoggedIn); + if (isLoggedIn === false) { + logger.stop(); + console.log("stopped logger"); + } else { + logger.start(); + console.log("start logger"); + } + }); + return ( <> -- 2.45.2 From de2e797bfbb5299a3036e043370bb4d6f84ee8ba Mon Sep 17 00:00:00 2001 From: cami Date: Tue, 6 Jul 2021 02:33:10 +0200 Subject: [PATCH 3/4] merged things.. --- frontend/src/components/pages/Umfrage.js | 2 ++ 1 file changed, 2 insertions(+) diff --git a/frontend/src/components/pages/Umfrage.js b/frontend/src/components/pages/Umfrage.js index 12a00a1..6f658f6 100644 --- a/frontend/src/components/pages/Umfrage.js +++ b/frontend/src/components/pages/Umfrage.js @@ -8,8 +8,10 @@ import SubmitField from "../SubmitField"; import { authFetch } from "../../auth/AuthProvider"; import ErrorMessage from "../ErrorMessage"; import { Link } from "react-router-dom"; +import { Logger } from "@behametrics/logger-web"; export default function Umfrage() { + /* values from survey */ const [age, setAge] = useState(""); const [gender, setGender] = useState(""); -- 2.45.2 From dccd2fd2aee81af797e729914033fc117cb35158 Mon Sep 17 00:00:00 2001 From: cami Date: Sat, 10 Jul 2021 23:49:17 +0200 Subject: [PATCH 4/4] Added some things :-) --- frontend/src/App.js | 21 --------------------- 1 file changed, 21 deletions(-) diff --git a/frontend/src/App.js b/frontend/src/App.js index 97206f6..6308458 100644 --- a/frontend/src/App.js +++ b/frontend/src/App.js @@ -15,27 +15,6 @@ import PrivateRoute from "./auth/PrivateRoute"; import Behavior from "./components/pages/Behavior"; function App() { - let logger = new Logger({ - //inputs: ["cursor", "wheel", "keyboard", "touch"], - inputs: ["keyboard"], - logToConsole: true, - }); - logger.init(); - - let [isLoggedIn] = useAuth(); - - useEffect(() => { - document.title = `${isLoggedIn}`; - console.log(isLoggedIn); - if (isLoggedIn === false) { - logger.stop(); - console.log("stopped logger"); - } else { - logger.start(); - console.log("start logger"); - } - }); - return ( <> -- 2.45.2