From bc74964cbd23599d16c54ce79d4ffcfa2bd2b88d Mon Sep 17 00:00:00 2001 From: Zio-4 Date: Tue, 4 Jun 2024 22:29:50 -0700 Subject: [PATCH 001/100] core tasks version bump beta.13 --- package-lock.json | 196 ++++++++++++++++++++++++++++++++++++++++++++-- package.json | 2 +- 2 files changed, 190 insertions(+), 8 deletions(-) diff --git a/package-lock.json b/package-lock.json index f8947cedb..74a666696 100644 --- a/package-lock.json +++ b/package-lock.json @@ -32,7 +32,7 @@ "axios": "^1.5.1", "buffer": "^6.0.3", "chart.js": "^4.3.3", - "core-tasks": "^1.0.0-beta.12", + "core-tasks": "^1.0.0-beta.13", "dotenv": "^16.3.1", "html2canvas": "^1.4.1", "jspdf": "^2.5.1", @@ -11588,9 +11588,9 @@ } }, "node_modules/core-tasks": { - "version": "1.0.0-beta.12", - "resolved": "https://registry.npmjs.org/core-tasks/-/core-tasks-1.0.0-beta.12.tgz", - "integrity": "sha512-MbRNTzbH/iuX2JveRJCYKSD84wCU1QiYlq2orBMxlpB3lVITGUzDJK3i8kv782qP36Emu85z3WIWPscD/KvZVw==", + "version": "1.0.0-beta.13", + "resolved": "https://registry.npmjs.org/core-tasks/-/core-tasks-1.0.0-beta.13.tgz", + "integrity": "sha512-GZ7REts3h/syOKBqRkD30eBIjcjbG0Dlvbztds7/IWfV2s4oRL2GOaMERlgSPDFTPgeygQtW1wMqT6Q1l+GlkA==", "dependencies": { "@bdelab/jscat": "^3.0.3", "@bdelab/roar-firekit": "^3.12.8", @@ -11603,6 +11603,7 @@ "@jspsych/plugin-fullscreen": "^1.1.0", "@jspsych/plugin-html-slider-response": "^1.1.3", "@jspsych/plugin-preload": "^1.1.3", + "@sentry/browser": "^8.7.0", "fscreen": "^1.2.0", "i18next": "^22.4.15", "i18next-browser-languagedetector": "^7.0.1", @@ -11637,6 +11638,108 @@ "vue": "^3.3.4" } }, + "node_modules/core-tasks/node_modules/@sentry-internal/browser-utils": { + "version": "8.7.0", + "resolved": "https://registry.npmjs.org/@sentry-internal/browser-utils/-/browser-utils-8.7.0.tgz", + "integrity": "sha512-RFBK1sYBwV5qGMEwWF0rjOTqQpp4/SvE+qHkOJNRUTVYmfjM+Y9lcxwn4B6lu3aboxePpBw/i1PlP6XwX4UnGA==", + "dependencies": { + "@sentry/core": "8.7.0", + "@sentry/types": "8.7.0", + "@sentry/utils": "8.7.0" + }, + "engines": { + "node": ">=14.18" + } + }, + "node_modules/core-tasks/node_modules/@sentry-internal/feedback": { + "version": "8.7.0", + "resolved": "https://registry.npmjs.org/@sentry-internal/feedback/-/feedback-8.7.0.tgz", + "integrity": "sha512-qcGtWCtRB4eP7NVQoxW936oPkU4qu9otMLYELPGmOJPnuAG0lujlJXW7BucaM7ADyJgJTE75hG849bHecfnbmQ==", + "dependencies": { + "@sentry/core": "8.7.0", + "@sentry/types": "8.7.0", + "@sentry/utils": "8.7.0" + }, + "engines": { + "node": ">=14.18" + } + }, + "node_modules/core-tasks/node_modules/@sentry-internal/replay": { + "version": "8.7.0", + "resolved": "https://registry.npmjs.org/@sentry-internal/replay/-/replay-8.7.0.tgz", + "integrity": "sha512-bQzOkWplaWTe3u+aDBhxWY3Qy0aT7ss2A3VR8iC6N8ZIEP9PxqyJwTNoouhinfgmlnCguI7RDOO4f3r3e2M80Q==", + "dependencies": { + "@sentry-internal/browser-utils": "8.7.0", + "@sentry/core": "8.7.0", + "@sentry/types": "8.7.0", + "@sentry/utils": "8.7.0" + }, + "engines": { + "node": ">=14.18" + } + }, + "node_modules/core-tasks/node_modules/@sentry-internal/replay-canvas": { + "version": "8.7.0", + "resolved": "https://registry.npmjs.org/@sentry-internal/replay-canvas/-/replay-canvas-8.7.0.tgz", + "integrity": "sha512-FOnvBPbq6MJVHPduc0hcsdE3PeeovQ2z5WJnZDGhvp/Obehxqe+XgX7K/595vRIknv4EokRn/3Kw0mFwG8E+ZQ==", + "dependencies": { + "@sentry-internal/replay": "8.7.0", + "@sentry/core": "8.7.0", + "@sentry/types": "8.7.0", + "@sentry/utils": "8.7.0" + }, + "engines": { + "node": ">=14.18" + } + }, + "node_modules/core-tasks/node_modules/@sentry/browser": { + "version": "8.7.0", + "resolved": "https://registry.npmjs.org/@sentry/browser/-/browser-8.7.0.tgz", + "integrity": "sha512-4EEp+PlcktsMN0p+MdCPl/lghTkq7eOtZjQG9NGhWzfyWrJ3tuL1nsDr2SSivJ1V277F01KtKYo6BFwP2NtBZA==", + "dependencies": { + "@sentry-internal/browser-utils": "8.7.0", + "@sentry-internal/feedback": "8.7.0", + "@sentry-internal/replay": "8.7.0", + "@sentry-internal/replay-canvas": "8.7.0", + "@sentry/core": "8.7.0", + "@sentry/types": "8.7.0", + "@sentry/utils": "8.7.0" + }, + "engines": { + "node": ">=14.18" + } + }, + "node_modules/core-tasks/node_modules/@sentry/core": { + "version": "8.7.0", + "resolved": "https://registry.npmjs.org/@sentry/core/-/core-8.7.0.tgz", + "integrity": "sha512-Sq/46B+5nWmgnCD6dEMZ6HTkKbV/KAdgaSvT8oXDb9OWoPy1jJ/gbLrhLs62KbjuDQk4/vWnOgHiKQbcslSzMw==", + "dependencies": { + "@sentry/types": "8.7.0", + "@sentry/utils": "8.7.0" + }, + "engines": { + "node": ">=14.18" + } + }, + "node_modules/core-tasks/node_modules/@sentry/types": { + "version": "8.7.0", + "resolved": "https://registry.npmjs.org/@sentry/types/-/types-8.7.0.tgz", + "integrity": "sha512-11KLOKumP6akugVGLvSoEig+JlP0ZEzW3nN9P+ppgdIx9HAxMIh6UvumbieG4/DWjAh2kh6NPNfUw3gk2Gfq1A==", + "engines": { + "node": ">=14.18" + } + }, + "node_modules/core-tasks/node_modules/@sentry/utils": { + "version": "8.7.0", + "resolved": "https://registry.npmjs.org/@sentry/utils/-/utils-8.7.0.tgz", + "integrity": "sha512-aWmcbSoOmrbzll/FkNQFJcCtLAuJLvTYbRKiCSkV3FScA7UaA742HkTZAPFiioALFIESWk/fcGZqtN0s4I281Q==", + "dependencies": { + "@sentry/types": "8.7.0" + }, + "engines": { + "node": ">=14.18" + } + }, "node_modules/core-util-is": { "version": "1.0.3", "license": "MIT" @@ -39121,9 +39224,9 @@ } }, "core-tasks": { - "version": "1.0.0-beta.12", - "resolved": "https://registry.npmjs.org/core-tasks/-/core-tasks-1.0.0-beta.12.tgz", - "integrity": "sha512-MbRNTzbH/iuX2JveRJCYKSD84wCU1QiYlq2orBMxlpB3lVITGUzDJK3i8kv782qP36Emu85z3WIWPscD/KvZVw==", + "version": "1.0.0-beta.13", + "resolved": "https://registry.npmjs.org/core-tasks/-/core-tasks-1.0.0-beta.13.tgz", + "integrity": "sha512-GZ7REts3h/syOKBqRkD30eBIjcjbG0Dlvbztds7/IWfV2s4oRL2GOaMERlgSPDFTPgeygQtW1wMqT6Q1l+GlkA==", "requires": { "@bdelab/jscat": "^3.0.3", "@bdelab/roar-firekit": "^3.12.8", @@ -39136,6 +39239,7 @@ "@jspsych/plugin-fullscreen": "^1.1.0", "@jspsych/plugin-html-slider-response": "^1.1.3", "@jspsych/plugin-preload": "^1.1.3", + "@sentry/browser": "^8.7.0", "fscreen": "^1.2.0", "i18next": "^22.4.15", "i18next-browser-languagedetector": "^7.0.1", @@ -39169,6 +39273,84 @@ "lodash": "^4.17.21", "vue": "^3.3.4" } + }, + "@sentry-internal/browser-utils": { + "version": "8.7.0", + "resolved": "https://registry.npmjs.org/@sentry-internal/browser-utils/-/browser-utils-8.7.0.tgz", + "integrity": "sha512-RFBK1sYBwV5qGMEwWF0rjOTqQpp4/SvE+qHkOJNRUTVYmfjM+Y9lcxwn4B6lu3aboxePpBw/i1PlP6XwX4UnGA==", + "requires": { + "@sentry/core": "8.7.0", + "@sentry/types": "8.7.0", + "@sentry/utils": "8.7.0" + } + }, + "@sentry-internal/feedback": { + "version": "8.7.0", + "resolved": "https://registry.npmjs.org/@sentry-internal/feedback/-/feedback-8.7.0.tgz", + "integrity": "sha512-qcGtWCtRB4eP7NVQoxW936oPkU4qu9otMLYELPGmOJPnuAG0lujlJXW7BucaM7ADyJgJTE75hG849bHecfnbmQ==", + "requires": { + "@sentry/core": "8.7.0", + "@sentry/types": "8.7.0", + "@sentry/utils": "8.7.0" + } + }, + "@sentry-internal/replay": { + "version": "8.7.0", + "resolved": "https://registry.npmjs.org/@sentry-internal/replay/-/replay-8.7.0.tgz", + "integrity": "sha512-bQzOkWplaWTe3u+aDBhxWY3Qy0aT7ss2A3VR8iC6N8ZIEP9PxqyJwTNoouhinfgmlnCguI7RDOO4f3r3e2M80Q==", + "requires": { + "@sentry-internal/browser-utils": "8.7.0", + "@sentry/core": "8.7.0", + "@sentry/types": "8.7.0", + "@sentry/utils": "8.7.0" + } + }, + "@sentry-internal/replay-canvas": { + "version": "8.7.0", + "resolved": "https://registry.npmjs.org/@sentry-internal/replay-canvas/-/replay-canvas-8.7.0.tgz", + "integrity": "sha512-FOnvBPbq6MJVHPduc0hcsdE3PeeovQ2z5WJnZDGhvp/Obehxqe+XgX7K/595vRIknv4EokRn/3Kw0mFwG8E+ZQ==", + "requires": { + "@sentry-internal/replay": "8.7.0", + "@sentry/core": "8.7.0", + "@sentry/types": "8.7.0", + "@sentry/utils": "8.7.0" + } + }, + "@sentry/browser": { + "version": "8.7.0", + "resolved": "https://registry.npmjs.org/@sentry/browser/-/browser-8.7.0.tgz", + "integrity": "sha512-4EEp+PlcktsMN0p+MdCPl/lghTkq7eOtZjQG9NGhWzfyWrJ3tuL1nsDr2SSivJ1V277F01KtKYo6BFwP2NtBZA==", + "requires": { + "@sentry-internal/browser-utils": "8.7.0", + "@sentry-internal/feedback": "8.7.0", + "@sentry-internal/replay": "8.7.0", + "@sentry-internal/replay-canvas": "8.7.0", + "@sentry/core": "8.7.0", + "@sentry/types": "8.7.0", + "@sentry/utils": "8.7.0" + } + }, + "@sentry/core": { + "version": "8.7.0", + "resolved": "https://registry.npmjs.org/@sentry/core/-/core-8.7.0.tgz", + "integrity": "sha512-Sq/46B+5nWmgnCD6dEMZ6HTkKbV/KAdgaSvT8oXDb9OWoPy1jJ/gbLrhLs62KbjuDQk4/vWnOgHiKQbcslSzMw==", + "requires": { + "@sentry/types": "8.7.0", + "@sentry/utils": "8.7.0" + } + }, + "@sentry/types": { + "version": "8.7.0", + "resolved": "https://registry.npmjs.org/@sentry/types/-/types-8.7.0.tgz", + "integrity": "sha512-11KLOKumP6akugVGLvSoEig+JlP0ZEzW3nN9P+ppgdIx9HAxMIh6UvumbieG4/DWjAh2kh6NPNfUw3gk2Gfq1A==" + }, + "@sentry/utils": { + "version": "8.7.0", + "resolved": "https://registry.npmjs.org/@sentry/utils/-/utils-8.7.0.tgz", + "integrity": "sha512-aWmcbSoOmrbzll/FkNQFJcCtLAuJLvTYbRKiCSkV3FScA7UaA742HkTZAPFiioALFIESWk/fcGZqtN0s4I281Q==", + "requires": { + "@sentry/types": "8.7.0" + } } } }, diff --git a/package.json b/package.json index bad955e5f..01542c792 100644 --- a/package.json +++ b/package.json @@ -51,7 +51,7 @@ "axios": "^1.5.1", "buffer": "^6.0.3", "chart.js": "^4.3.3", - "core-tasks": "^1.0.0-beta.12", + "core-tasks": "^1.0.0-beta.13", "dotenv": "^16.3.1", "html2canvas": "^1.4.1", "jspdf": "^2.5.1", From 4691e6a749c40c3e15a58bcbe19e189abcc8ed68 Mon Sep 17 00:00:00 2001 From: Zio-4 Date: Wed, 5 Jun 2024 15:15:09 -0700 Subject: [PATCH 002/100] Adding levante scopped core-tasks --- package-lock.json | 570 +++++++++++++-------------- package.json | 2 +- src/components/tasks/TaskLevante.vue | 6 +- 3 files changed, 289 insertions(+), 289 deletions(-) diff --git a/package-lock.json b/package-lock.json index 74a666696..73fe3acb6 100644 --- a/package-lock.json +++ b/package-lock.json @@ -19,6 +19,7 @@ "@bdelab/roar-vocab": "^1.8.0", "@bdelab/roav-crowding": "^1.1.10", "@bdelab/roav-ran": "^1.0.17", + "@levante-framework/core-tasks": "^1.0.0-beta.15", "@sentry/browser": "^8.0.0", "@sentry/integrations": "^7.114.0", "@sentry/vite-plugin": "^2.16.1", @@ -32,7 +33,6 @@ "axios": "^1.5.1", "buffer": "^6.0.3", "chart.js": "^4.3.3", - "core-tasks": "^1.0.0-beta.13", "dotenv": "^16.3.1", "html2canvas": "^1.4.1", "jspdf": "^2.5.1", @@ -7230,6 +7230,159 @@ "version": "2.0.4", "license": "MIT" }, + "node_modules/@levante-framework/core-tasks": { + "version": "1.0.0-beta.15", + "resolved": "https://registry.npmjs.org/@levante-framework/core-tasks/-/core-tasks-1.0.0-beta.15.tgz", + "integrity": "sha512-tjLZxc6FYxAFwhPgJe2gLjB+/8SXrx0+LALQAJqw4ZNq3Sel/DiiqUSKhUmjvSs3oRwT/pNN1TC+C5DEAmJkEA==", + "dependencies": { + "@bdelab/jscat": "^3.0.3", + "@bdelab/roar-firekit": "^3.12.8", + "@bdelab/roar-utils": "^1.0.11", + "@jspsych-contrib/plugin-audio-multi-response": "^1.0.0", + "@jspsych-contrib/plugin-corsi-blocks": "^1.0.0", + "@jspsych-contrib/plugin-html-multi-response": "^1.0.2", + "@jspsych/plugin-audio-button-response": "^1.1.2", + "@jspsych/plugin-audio-keyboard-response": "^1.1.0", + "@jspsych/plugin-fullscreen": "^1.1.0", + "@jspsych/plugin-html-slider-response": "^1.1.3", + "@jspsych/plugin-preload": "^1.1.3", + "@sentry/browser": "^8.7.0", + "fscreen": "^1.2.0", + "i18next": "^22.4.15", + "i18next-browser-languagedetector": "^7.0.1", + "jspsych": "^7.2.1", + "lodash": "^4.17.21", + "papaparse": "^5.4.1", + "regenerator-runtime": "^0.13.9", + "store2": "^2.13.2" + } + }, + "node_modules/@levante-framework/core-tasks/node_modules/@bdelab/jscat": { + "version": "3.0.5", + "resolved": "https://registry.npmjs.org/@bdelab/jscat/-/jscat-3.0.5.tgz", + "integrity": "sha512-IjtzhVTpH9BjjuZInVJDETEy+d8ljmTeAs03r1FmCmYKWLZzyAWvJFbOhhEFqF3WjkCLouk+xXaQtaqa9vsPMA==", + "dependencies": { + "@types/node": "^14.18.54", + "binary-search": "^1.3.6", + "lodash": "^4.17.21", + "optimization-js": "github:yeatmanlab/optimization-js", + "seedrandom": "^3.0.5" + } + }, + "node_modules/@levante-framework/core-tasks/node_modules/@bdelab/roar-firekit": { + "version": "3.13.2", + "resolved": "https://registry.npmjs.org/@bdelab/roar-firekit/-/roar-firekit-3.13.2.tgz", + "integrity": "sha512-PtgZPGe1RD3vk5dPLxKNdP13Jwa5pkUMNal5SVinAudhjlbEoX8/g+AklDn3YnuZGbIiC+7k3u8tal2Suyqrlw==", + "dependencies": { + "crc-32": "^1.2.2", + "dot-object": "^2.1.4", + "firebase": "^9.23.0", + "lodash": "^4.17.21", + "vue": "^3.3.4" + } + }, + "node_modules/@levante-framework/core-tasks/node_modules/@sentry-internal/browser-utils": { + "version": "8.7.0", + "resolved": "https://registry.npmjs.org/@sentry-internal/browser-utils/-/browser-utils-8.7.0.tgz", + "integrity": "sha512-RFBK1sYBwV5qGMEwWF0rjOTqQpp4/SvE+qHkOJNRUTVYmfjM+Y9lcxwn4B6lu3aboxePpBw/i1PlP6XwX4UnGA==", + "dependencies": { + "@sentry/core": "8.7.0", + "@sentry/types": "8.7.0", + "@sentry/utils": "8.7.0" + }, + "engines": { + "node": ">=14.18" + } + }, + "node_modules/@levante-framework/core-tasks/node_modules/@sentry-internal/feedback": { + "version": "8.7.0", + "resolved": "https://registry.npmjs.org/@sentry-internal/feedback/-/feedback-8.7.0.tgz", + "integrity": "sha512-qcGtWCtRB4eP7NVQoxW936oPkU4qu9otMLYELPGmOJPnuAG0lujlJXW7BucaM7ADyJgJTE75hG849bHecfnbmQ==", + "dependencies": { + "@sentry/core": "8.7.0", + "@sentry/types": "8.7.0", + "@sentry/utils": "8.7.0" + }, + "engines": { + "node": ">=14.18" + } + }, + "node_modules/@levante-framework/core-tasks/node_modules/@sentry-internal/replay": { + "version": "8.7.0", + "resolved": "https://registry.npmjs.org/@sentry-internal/replay/-/replay-8.7.0.tgz", + "integrity": "sha512-bQzOkWplaWTe3u+aDBhxWY3Qy0aT7ss2A3VR8iC6N8ZIEP9PxqyJwTNoouhinfgmlnCguI7RDOO4f3r3e2M80Q==", + "dependencies": { + "@sentry-internal/browser-utils": "8.7.0", + "@sentry/core": "8.7.0", + "@sentry/types": "8.7.0", + "@sentry/utils": "8.7.0" + }, + "engines": { + "node": ">=14.18" + } + }, + "node_modules/@levante-framework/core-tasks/node_modules/@sentry-internal/replay-canvas": { + "version": "8.7.0", + "resolved": "https://registry.npmjs.org/@sentry-internal/replay-canvas/-/replay-canvas-8.7.0.tgz", + "integrity": "sha512-FOnvBPbq6MJVHPduc0hcsdE3PeeovQ2z5WJnZDGhvp/Obehxqe+XgX7K/595vRIknv4EokRn/3Kw0mFwG8E+ZQ==", + "dependencies": { + "@sentry-internal/replay": "8.7.0", + "@sentry/core": "8.7.0", + "@sentry/types": "8.7.0", + "@sentry/utils": "8.7.0" + }, + "engines": { + "node": ">=14.18" + } + }, + "node_modules/@levante-framework/core-tasks/node_modules/@sentry/browser": { + "version": "8.7.0", + "resolved": "https://registry.npmjs.org/@sentry/browser/-/browser-8.7.0.tgz", + "integrity": "sha512-4EEp+PlcktsMN0p+MdCPl/lghTkq7eOtZjQG9NGhWzfyWrJ3tuL1nsDr2SSivJ1V277F01KtKYo6BFwP2NtBZA==", + "dependencies": { + "@sentry-internal/browser-utils": "8.7.0", + "@sentry-internal/feedback": "8.7.0", + "@sentry-internal/replay": "8.7.0", + "@sentry-internal/replay-canvas": "8.7.0", + "@sentry/core": "8.7.0", + "@sentry/types": "8.7.0", + "@sentry/utils": "8.7.0" + }, + "engines": { + "node": ">=14.18" + } + }, + "node_modules/@levante-framework/core-tasks/node_modules/@sentry/core": { + "version": "8.7.0", + "resolved": "https://registry.npmjs.org/@sentry/core/-/core-8.7.0.tgz", + "integrity": "sha512-Sq/46B+5nWmgnCD6dEMZ6HTkKbV/KAdgaSvT8oXDb9OWoPy1jJ/gbLrhLs62KbjuDQk4/vWnOgHiKQbcslSzMw==", + "dependencies": { + "@sentry/types": "8.7.0", + "@sentry/utils": "8.7.0" + }, + "engines": { + "node": ">=14.18" + } + }, + "node_modules/@levante-framework/core-tasks/node_modules/@sentry/types": { + "version": "8.7.0", + "resolved": "https://registry.npmjs.org/@sentry/types/-/types-8.7.0.tgz", + "integrity": "sha512-11KLOKumP6akugVGLvSoEig+JlP0ZEzW3nN9P+ppgdIx9HAxMIh6UvumbieG4/DWjAh2kh6NPNfUw3gk2Gfq1A==", + "engines": { + "node": ">=14.18" + } + }, + "node_modules/@levante-framework/core-tasks/node_modules/@sentry/utils": { + "version": "8.7.0", + "resolved": "https://registry.npmjs.org/@sentry/utils/-/utils-8.7.0.tgz", + "integrity": "sha512-aWmcbSoOmrbzll/FkNQFJcCtLAuJLvTYbRKiCSkV3FScA7UaA742HkTZAPFiioALFIESWk/fcGZqtN0s4I281Q==", + "dependencies": { + "@sentry/types": "8.7.0" + }, + "engines": { + "node": ">=14.18" + } + }, "node_modules/@ljharb/through": { "version": "2.3.12", "resolved": "https://registry.npmjs.org/@ljharb/through/-/through-2.3.12.tgz", @@ -11587,159 +11740,6 @@ "url": "https://opencollective.com/core-js" } }, - "node_modules/core-tasks": { - "version": "1.0.0-beta.13", - "resolved": "https://registry.npmjs.org/core-tasks/-/core-tasks-1.0.0-beta.13.tgz", - "integrity": "sha512-GZ7REts3h/syOKBqRkD30eBIjcjbG0Dlvbztds7/IWfV2s4oRL2GOaMERlgSPDFTPgeygQtW1wMqT6Q1l+GlkA==", - "dependencies": { - "@bdelab/jscat": "^3.0.3", - "@bdelab/roar-firekit": "^3.12.8", - "@bdelab/roar-utils": "^1.0.11", - "@jspsych-contrib/plugin-audio-multi-response": "^1.0.0", - "@jspsych-contrib/plugin-corsi-blocks": "^1.0.0", - "@jspsych-contrib/plugin-html-multi-response": "^1.0.2", - "@jspsych/plugin-audio-button-response": "^1.1.2", - "@jspsych/plugin-audio-keyboard-response": "^1.1.0", - "@jspsych/plugin-fullscreen": "^1.1.0", - "@jspsych/plugin-html-slider-response": "^1.1.3", - "@jspsych/plugin-preload": "^1.1.3", - "@sentry/browser": "^8.7.0", - "fscreen": "^1.2.0", - "i18next": "^22.4.15", - "i18next-browser-languagedetector": "^7.0.1", - "jspsych": "^7.2.1", - "lodash": "^4.17.21", - "papaparse": "^5.4.1", - "regenerator-runtime": "^0.13.9", - "store2": "^2.13.2" - } - }, - "node_modules/core-tasks/node_modules/@bdelab/jscat": { - "version": "3.0.5", - "resolved": "https://registry.npmjs.org/@bdelab/jscat/-/jscat-3.0.5.tgz", - "integrity": "sha512-IjtzhVTpH9BjjuZInVJDETEy+d8ljmTeAs03r1FmCmYKWLZzyAWvJFbOhhEFqF3WjkCLouk+xXaQtaqa9vsPMA==", - "dependencies": { - "@types/node": "^14.18.54", - "binary-search": "^1.3.6", - "lodash": "^4.17.21", - "optimization-js": "github:yeatmanlab/optimization-js", - "seedrandom": "^3.0.5" - } - }, - "node_modules/core-tasks/node_modules/@bdelab/roar-firekit": { - "version": "3.13.2", - "resolved": "https://registry.npmjs.org/@bdelab/roar-firekit/-/roar-firekit-3.13.2.tgz", - "integrity": "sha512-PtgZPGe1RD3vk5dPLxKNdP13Jwa5pkUMNal5SVinAudhjlbEoX8/g+AklDn3YnuZGbIiC+7k3u8tal2Suyqrlw==", - "dependencies": { - "crc-32": "^1.2.2", - "dot-object": "^2.1.4", - "firebase": "^9.23.0", - "lodash": "^4.17.21", - "vue": "^3.3.4" - } - }, - "node_modules/core-tasks/node_modules/@sentry-internal/browser-utils": { - "version": "8.7.0", - "resolved": "https://registry.npmjs.org/@sentry-internal/browser-utils/-/browser-utils-8.7.0.tgz", - "integrity": "sha512-RFBK1sYBwV5qGMEwWF0rjOTqQpp4/SvE+qHkOJNRUTVYmfjM+Y9lcxwn4B6lu3aboxePpBw/i1PlP6XwX4UnGA==", - "dependencies": { - "@sentry/core": "8.7.0", - "@sentry/types": "8.7.0", - "@sentry/utils": "8.7.0" - }, - "engines": { - "node": ">=14.18" - } - }, - "node_modules/core-tasks/node_modules/@sentry-internal/feedback": { - "version": "8.7.0", - "resolved": "https://registry.npmjs.org/@sentry-internal/feedback/-/feedback-8.7.0.tgz", - "integrity": "sha512-qcGtWCtRB4eP7NVQoxW936oPkU4qu9otMLYELPGmOJPnuAG0lujlJXW7BucaM7ADyJgJTE75hG849bHecfnbmQ==", - "dependencies": { - "@sentry/core": "8.7.0", - "@sentry/types": "8.7.0", - "@sentry/utils": "8.7.0" - }, - "engines": { - "node": ">=14.18" - } - }, - "node_modules/core-tasks/node_modules/@sentry-internal/replay": { - "version": "8.7.0", - "resolved": "https://registry.npmjs.org/@sentry-internal/replay/-/replay-8.7.0.tgz", - "integrity": "sha512-bQzOkWplaWTe3u+aDBhxWY3Qy0aT7ss2A3VR8iC6N8ZIEP9PxqyJwTNoouhinfgmlnCguI7RDOO4f3r3e2M80Q==", - "dependencies": { - "@sentry-internal/browser-utils": "8.7.0", - "@sentry/core": "8.7.0", - "@sentry/types": "8.7.0", - "@sentry/utils": "8.7.0" - }, - "engines": { - "node": ">=14.18" - } - }, - "node_modules/core-tasks/node_modules/@sentry-internal/replay-canvas": { - "version": "8.7.0", - "resolved": "https://registry.npmjs.org/@sentry-internal/replay-canvas/-/replay-canvas-8.7.0.tgz", - "integrity": "sha512-FOnvBPbq6MJVHPduc0hcsdE3PeeovQ2z5WJnZDGhvp/Obehxqe+XgX7K/595vRIknv4EokRn/3Kw0mFwG8E+ZQ==", - "dependencies": { - "@sentry-internal/replay": "8.7.0", - "@sentry/core": "8.7.0", - "@sentry/types": "8.7.0", - "@sentry/utils": "8.7.0" - }, - "engines": { - "node": ">=14.18" - } - }, - "node_modules/core-tasks/node_modules/@sentry/browser": { - "version": "8.7.0", - "resolved": "https://registry.npmjs.org/@sentry/browser/-/browser-8.7.0.tgz", - "integrity": "sha512-4EEp+PlcktsMN0p+MdCPl/lghTkq7eOtZjQG9NGhWzfyWrJ3tuL1nsDr2SSivJ1V277F01KtKYo6BFwP2NtBZA==", - "dependencies": { - "@sentry-internal/browser-utils": "8.7.0", - "@sentry-internal/feedback": "8.7.0", - "@sentry-internal/replay": "8.7.0", - "@sentry-internal/replay-canvas": "8.7.0", - "@sentry/core": "8.7.0", - "@sentry/types": "8.7.0", - "@sentry/utils": "8.7.0" - }, - "engines": { - "node": ">=14.18" - } - }, - "node_modules/core-tasks/node_modules/@sentry/core": { - "version": "8.7.0", - "resolved": "https://registry.npmjs.org/@sentry/core/-/core-8.7.0.tgz", - "integrity": "sha512-Sq/46B+5nWmgnCD6dEMZ6HTkKbV/KAdgaSvT8oXDb9OWoPy1jJ/gbLrhLs62KbjuDQk4/vWnOgHiKQbcslSzMw==", - "dependencies": { - "@sentry/types": "8.7.0", - "@sentry/utils": "8.7.0" - }, - "engines": { - "node": ">=14.18" - } - }, - "node_modules/core-tasks/node_modules/@sentry/types": { - "version": "8.7.0", - "resolved": "https://registry.npmjs.org/@sentry/types/-/types-8.7.0.tgz", - "integrity": "sha512-11KLOKumP6akugVGLvSoEig+JlP0ZEzW3nN9P+ppgdIx9HAxMIh6UvumbieG4/DWjAh2kh6NPNfUw3gk2Gfq1A==", - "engines": { - "node": ">=14.18" - } - }, - "node_modules/core-tasks/node_modules/@sentry/utils": { - "version": "8.7.0", - "resolved": "https://registry.npmjs.org/@sentry/utils/-/utils-8.7.0.tgz", - "integrity": "sha512-aWmcbSoOmrbzll/FkNQFJcCtLAuJLvTYbRKiCSkV3FScA7UaA742HkTZAPFiioALFIESWk/fcGZqtN0s4I281Q==", - "dependencies": { - "@sentry/types": "8.7.0" - }, - "engines": { - "node": ">=14.18" - } - }, "node_modules/core-util-is": { "version": "1.0.3", "license": "MIT" @@ -36074,6 +36074,137 @@ "@leichtgewicht/ip-codec": { "version": "2.0.4" }, + "@levante-framework/core-tasks": { + "version": "1.0.0-beta.15", + "resolved": "https://registry.npmjs.org/@levante-framework/core-tasks/-/core-tasks-1.0.0-beta.15.tgz", + "integrity": "sha512-tjLZxc6FYxAFwhPgJe2gLjB+/8SXrx0+LALQAJqw4ZNq3Sel/DiiqUSKhUmjvSs3oRwT/pNN1TC+C5DEAmJkEA==", + "requires": { + "@bdelab/jscat": "^3.0.3", + "@bdelab/roar-firekit": "^3.12.8", + "@bdelab/roar-utils": "^1.0.11", + "@jspsych-contrib/plugin-audio-multi-response": "^1.0.0", + "@jspsych-contrib/plugin-corsi-blocks": "^1.0.0", + "@jspsych-contrib/plugin-html-multi-response": "^1.0.2", + "@jspsych/plugin-audio-button-response": "^1.1.2", + "@jspsych/plugin-audio-keyboard-response": "^1.1.0", + "@jspsych/plugin-fullscreen": "^1.1.0", + "@jspsych/plugin-html-slider-response": "^1.1.3", + "@jspsych/plugin-preload": "^1.1.3", + "@sentry/browser": "^8.7.0", + "fscreen": "^1.2.0", + "i18next": "^22.4.15", + "i18next-browser-languagedetector": "^7.0.1", + "jspsych": "^7.2.1", + "lodash": "^4.17.21", + "papaparse": "^5.4.1", + "regenerator-runtime": "^0.13.9", + "store2": "^2.13.2" + }, + "dependencies": { + "@bdelab/jscat": { + "version": "3.0.5", + "resolved": "https://registry.npmjs.org/@bdelab/jscat/-/jscat-3.0.5.tgz", + "integrity": "sha512-IjtzhVTpH9BjjuZInVJDETEy+d8ljmTeAs03r1FmCmYKWLZzyAWvJFbOhhEFqF3WjkCLouk+xXaQtaqa9vsPMA==", + "requires": { + "@types/node": "^14.18.54", + "binary-search": "^1.3.6", + "lodash": "^4.17.21", + "optimization-js": "github:yeatmanlab/optimization-js", + "seedrandom": "^3.0.5" + } + }, + "@bdelab/roar-firekit": { + "version": "3.13.2", + "resolved": "https://registry.npmjs.org/@bdelab/roar-firekit/-/roar-firekit-3.13.2.tgz", + "integrity": "sha512-PtgZPGe1RD3vk5dPLxKNdP13Jwa5pkUMNal5SVinAudhjlbEoX8/g+AklDn3YnuZGbIiC+7k3u8tal2Suyqrlw==", + "requires": { + "crc-32": "^1.2.2", + "dot-object": "^2.1.4", + "firebase": "^9.23.0", + "lodash": "^4.17.21", + "vue": "^3.3.4" + } + }, + "@sentry-internal/browser-utils": { + "version": "8.7.0", + "resolved": "https://registry.npmjs.org/@sentry-internal/browser-utils/-/browser-utils-8.7.0.tgz", + "integrity": "sha512-RFBK1sYBwV5qGMEwWF0rjOTqQpp4/SvE+qHkOJNRUTVYmfjM+Y9lcxwn4B6lu3aboxePpBw/i1PlP6XwX4UnGA==", + "requires": { + "@sentry/core": "8.7.0", + "@sentry/types": "8.7.0", + "@sentry/utils": "8.7.0" + } + }, + "@sentry-internal/feedback": { + "version": "8.7.0", + "resolved": "https://registry.npmjs.org/@sentry-internal/feedback/-/feedback-8.7.0.tgz", + "integrity": "sha512-qcGtWCtRB4eP7NVQoxW936oPkU4qu9otMLYELPGmOJPnuAG0lujlJXW7BucaM7ADyJgJTE75hG849bHecfnbmQ==", + "requires": { + "@sentry/core": "8.7.0", + "@sentry/types": "8.7.0", + "@sentry/utils": "8.7.0" + } + }, + "@sentry-internal/replay": { + "version": "8.7.0", + "resolved": "https://registry.npmjs.org/@sentry-internal/replay/-/replay-8.7.0.tgz", + "integrity": "sha512-bQzOkWplaWTe3u+aDBhxWY3Qy0aT7ss2A3VR8iC6N8ZIEP9PxqyJwTNoouhinfgmlnCguI7RDOO4f3r3e2M80Q==", + "requires": { + "@sentry-internal/browser-utils": "8.7.0", + "@sentry/core": "8.7.0", + "@sentry/types": "8.7.0", + "@sentry/utils": "8.7.0" + } + }, + "@sentry-internal/replay-canvas": { + "version": "8.7.0", + "resolved": "https://registry.npmjs.org/@sentry-internal/replay-canvas/-/replay-canvas-8.7.0.tgz", + "integrity": "sha512-FOnvBPbq6MJVHPduc0hcsdE3PeeovQ2z5WJnZDGhvp/Obehxqe+XgX7K/595vRIknv4EokRn/3Kw0mFwG8E+ZQ==", + "requires": { + "@sentry-internal/replay": "8.7.0", + "@sentry/core": "8.7.0", + "@sentry/types": "8.7.0", + "@sentry/utils": "8.7.0" + } + }, + "@sentry/browser": { + "version": "8.7.0", + "resolved": "https://registry.npmjs.org/@sentry/browser/-/browser-8.7.0.tgz", + "integrity": "sha512-4EEp+PlcktsMN0p+MdCPl/lghTkq7eOtZjQG9NGhWzfyWrJ3tuL1nsDr2SSivJ1V277F01KtKYo6BFwP2NtBZA==", + "requires": { + "@sentry-internal/browser-utils": "8.7.0", + "@sentry-internal/feedback": "8.7.0", + "@sentry-internal/replay": "8.7.0", + "@sentry-internal/replay-canvas": "8.7.0", + "@sentry/core": "8.7.0", + "@sentry/types": "8.7.0", + "@sentry/utils": "8.7.0" + } + }, + "@sentry/core": { + "version": "8.7.0", + "resolved": "https://registry.npmjs.org/@sentry/core/-/core-8.7.0.tgz", + "integrity": "sha512-Sq/46B+5nWmgnCD6dEMZ6HTkKbV/KAdgaSvT8oXDb9OWoPy1jJ/gbLrhLs62KbjuDQk4/vWnOgHiKQbcslSzMw==", + "requires": { + "@sentry/types": "8.7.0", + "@sentry/utils": "8.7.0" + } + }, + "@sentry/types": { + "version": "8.7.0", + "resolved": "https://registry.npmjs.org/@sentry/types/-/types-8.7.0.tgz", + "integrity": "sha512-11KLOKumP6akugVGLvSoEig+JlP0ZEzW3nN9P+ppgdIx9HAxMIh6UvumbieG4/DWjAh2kh6NPNfUw3gk2Gfq1A==" + }, + "@sentry/utils": { + "version": "8.7.0", + "resolved": "https://registry.npmjs.org/@sentry/utils/-/utils-8.7.0.tgz", + "integrity": "sha512-aWmcbSoOmrbzll/FkNQFJcCtLAuJLvTYbRKiCSkV3FScA7UaA742HkTZAPFiioALFIESWk/fcGZqtN0s4I281Q==", + "requires": { + "@sentry/types": "8.7.0" + } + } + } + }, "@ljharb/through": { "version": "2.3.12", "resolved": "https://registry.npmjs.org/@ljharb/through/-/through-2.3.12.tgz", @@ -39223,137 +39354,6 @@ "browserslist": "^4.22.2" } }, - "core-tasks": { - "version": "1.0.0-beta.13", - "resolved": "https://registry.npmjs.org/core-tasks/-/core-tasks-1.0.0-beta.13.tgz", - "integrity": "sha512-GZ7REts3h/syOKBqRkD30eBIjcjbG0Dlvbztds7/IWfV2s4oRL2GOaMERlgSPDFTPgeygQtW1wMqT6Q1l+GlkA==", - "requires": { - "@bdelab/jscat": "^3.0.3", - "@bdelab/roar-firekit": "^3.12.8", - "@bdelab/roar-utils": "^1.0.11", - "@jspsych-contrib/plugin-audio-multi-response": "^1.0.0", - "@jspsych-contrib/plugin-corsi-blocks": "^1.0.0", - "@jspsych-contrib/plugin-html-multi-response": "^1.0.2", - "@jspsych/plugin-audio-button-response": "^1.1.2", - "@jspsych/plugin-audio-keyboard-response": "^1.1.0", - "@jspsych/plugin-fullscreen": "^1.1.0", - "@jspsych/plugin-html-slider-response": "^1.1.3", - "@jspsych/plugin-preload": "^1.1.3", - "@sentry/browser": "^8.7.0", - "fscreen": "^1.2.0", - "i18next": "^22.4.15", - "i18next-browser-languagedetector": "^7.0.1", - "jspsych": "^7.2.1", - "lodash": "^4.17.21", - "papaparse": "^5.4.1", - "regenerator-runtime": "^0.13.9", - "store2": "^2.13.2" - }, - "dependencies": { - "@bdelab/jscat": { - "version": "3.0.5", - "resolved": "https://registry.npmjs.org/@bdelab/jscat/-/jscat-3.0.5.tgz", - "integrity": "sha512-IjtzhVTpH9BjjuZInVJDETEy+d8ljmTeAs03r1FmCmYKWLZzyAWvJFbOhhEFqF3WjkCLouk+xXaQtaqa9vsPMA==", - "requires": { - "@types/node": "^14.18.54", - "binary-search": "^1.3.6", - "lodash": "^4.17.21", - "optimization-js": "github:yeatmanlab/optimization-js", - "seedrandom": "^3.0.5" - } - }, - "@bdelab/roar-firekit": { - "version": "3.13.2", - "resolved": "https://registry.npmjs.org/@bdelab/roar-firekit/-/roar-firekit-3.13.2.tgz", - "integrity": "sha512-PtgZPGe1RD3vk5dPLxKNdP13Jwa5pkUMNal5SVinAudhjlbEoX8/g+AklDn3YnuZGbIiC+7k3u8tal2Suyqrlw==", - "requires": { - "crc-32": "^1.2.2", - "dot-object": "^2.1.4", - "firebase": "^9.23.0", - "lodash": "^4.17.21", - "vue": "^3.3.4" - } - }, - "@sentry-internal/browser-utils": { - "version": "8.7.0", - "resolved": "https://registry.npmjs.org/@sentry-internal/browser-utils/-/browser-utils-8.7.0.tgz", - "integrity": "sha512-RFBK1sYBwV5qGMEwWF0rjOTqQpp4/SvE+qHkOJNRUTVYmfjM+Y9lcxwn4B6lu3aboxePpBw/i1PlP6XwX4UnGA==", - "requires": { - "@sentry/core": "8.7.0", - "@sentry/types": "8.7.0", - "@sentry/utils": "8.7.0" - } - }, - "@sentry-internal/feedback": { - "version": "8.7.0", - "resolved": "https://registry.npmjs.org/@sentry-internal/feedback/-/feedback-8.7.0.tgz", - "integrity": "sha512-qcGtWCtRB4eP7NVQoxW936oPkU4qu9otMLYELPGmOJPnuAG0lujlJXW7BucaM7ADyJgJTE75hG849bHecfnbmQ==", - "requires": { - "@sentry/core": "8.7.0", - "@sentry/types": "8.7.0", - "@sentry/utils": "8.7.0" - } - }, - "@sentry-internal/replay": { - "version": "8.7.0", - "resolved": "https://registry.npmjs.org/@sentry-internal/replay/-/replay-8.7.0.tgz", - "integrity": "sha512-bQzOkWplaWTe3u+aDBhxWY3Qy0aT7ss2A3VR8iC6N8ZIEP9PxqyJwTNoouhinfgmlnCguI7RDOO4f3r3e2M80Q==", - "requires": { - "@sentry-internal/browser-utils": "8.7.0", - "@sentry/core": "8.7.0", - "@sentry/types": "8.7.0", - "@sentry/utils": "8.7.0" - } - }, - "@sentry-internal/replay-canvas": { - "version": "8.7.0", - "resolved": "https://registry.npmjs.org/@sentry-internal/replay-canvas/-/replay-canvas-8.7.0.tgz", - "integrity": "sha512-FOnvBPbq6MJVHPduc0hcsdE3PeeovQ2z5WJnZDGhvp/Obehxqe+XgX7K/595vRIknv4EokRn/3Kw0mFwG8E+ZQ==", - "requires": { - "@sentry-internal/replay": "8.7.0", - "@sentry/core": "8.7.0", - "@sentry/types": "8.7.0", - "@sentry/utils": "8.7.0" - } - }, - "@sentry/browser": { - "version": "8.7.0", - "resolved": "https://registry.npmjs.org/@sentry/browser/-/browser-8.7.0.tgz", - "integrity": "sha512-4EEp+PlcktsMN0p+MdCPl/lghTkq7eOtZjQG9NGhWzfyWrJ3tuL1nsDr2SSivJ1V277F01KtKYo6BFwP2NtBZA==", - "requires": { - "@sentry-internal/browser-utils": "8.7.0", - "@sentry-internal/feedback": "8.7.0", - "@sentry-internal/replay": "8.7.0", - "@sentry-internal/replay-canvas": "8.7.0", - "@sentry/core": "8.7.0", - "@sentry/types": "8.7.0", - "@sentry/utils": "8.7.0" - } - }, - "@sentry/core": { - "version": "8.7.0", - "resolved": "https://registry.npmjs.org/@sentry/core/-/core-8.7.0.tgz", - "integrity": "sha512-Sq/46B+5nWmgnCD6dEMZ6HTkKbV/KAdgaSvT8oXDb9OWoPy1jJ/gbLrhLs62KbjuDQk4/vWnOgHiKQbcslSzMw==", - "requires": { - "@sentry/types": "8.7.0", - "@sentry/utils": "8.7.0" - } - }, - "@sentry/types": { - "version": "8.7.0", - "resolved": "https://registry.npmjs.org/@sentry/types/-/types-8.7.0.tgz", - "integrity": "sha512-11KLOKumP6akugVGLvSoEig+JlP0ZEzW3nN9P+ppgdIx9HAxMIh6UvumbieG4/DWjAh2kh6NPNfUw3gk2Gfq1A==" - }, - "@sentry/utils": { - "version": "8.7.0", - "resolved": "https://registry.npmjs.org/@sentry/utils/-/utils-8.7.0.tgz", - "integrity": "sha512-aWmcbSoOmrbzll/FkNQFJcCtLAuJLvTYbRKiCSkV3FScA7UaA742HkTZAPFiioALFIESWk/fcGZqtN0s4I281Q==", - "requires": { - "@sentry/types": "8.7.0" - } - } - } - }, "core-util-is": { "version": "1.0.3" }, diff --git a/package.json b/package.json index 01542c792..e56c99e15 100644 --- a/package.json +++ b/package.json @@ -38,6 +38,7 @@ "@bdelab/roar-vocab": "^1.8.0", "@bdelab/roav-crowding": "^1.1.10", "@bdelab/roav-ran": "^1.0.17", + "@levante-framework/core-tasks": "^1.0.0-beta.15", "@sentry/browser": "^8.0.0", "@sentry/integrations": "^7.114.0", "@sentry/vite-plugin": "^2.16.1", @@ -51,7 +52,6 @@ "axios": "^1.5.1", "buffer": "^6.0.3", "chart.js": "^4.3.3", - "core-tasks": "^1.0.0-beta.13", "dotenv": "^16.3.1", "html2canvas": "^1.4.1", "jspdf": "^2.5.1", diff --git a/src/components/tasks/TaskLevante.vue b/src/components/tasks/TaskLevante.vue index 8ca827a7c..0e236281b 100644 --- a/src/components/tasks/TaskLevante.vue +++ b/src/components/tasks/TaskLevante.vue @@ -24,7 +24,7 @@ const props = defineProps({ let levanteTaskLauncher; const taskId = props.taskId; -const { version } = packageLockJson.packages['node_modules/core-tasks']; +const { version } = packageLockJson.packages['node_modules/@levante-framework/core-tasks']; const router = useRouter(); const gameStarted = ref(false); const authStore = useAuthStore(); @@ -65,7 +65,7 @@ window.addEventListener( onMounted(async () => { try { - let module = await import('core-tasks'); + let module = await import('@levante-framework/core-tasks'); levanteTaskLauncher = module.TaskLauncher; } catch (error) { console.error('An error occurred while importing the game module.', error); @@ -131,7 +131,7 @@ async function startTask() { diff --git a/src/translations/i18n.js b/src/translations/i18n.js index 0c25ee652..cc44300a4 100644 --- a/src/translations/i18n.js +++ b/src/translations/i18n.js @@ -8,29 +8,28 @@ export const languageOptions = { 'es-CO': { translations: esCOTranslations, language: 'Español (América Latina)', code: 'col' }, de: { translations: deTranslations, language: 'Deutsch', code: 'de' }, }; -export let browserLocale = window.navigator.language; -const getLocale = (locale) => { - if (Object.keys(languageOptions).includes(locale)) { - console.log('Locale found in languageOptions: ', locale); - return locale; - } else if (locale.includes('es')) { - console.log('Spanish dialect not supported, using default es.'); - return 'es'; - } else if (locale.includes('de')) { - console.log('German dialect not supported, using default de.'); - return 'de'; +const browserLocale = window.navigator.language; +const isLevante = import.meta.env.MODE === 'LEVANTE'; + +const getLocale = (localeFromBrowser) => { + const localeFromStorage = sessionStorage.getItem(`${isLevante ? 'levante' : 'roar'}PlatformLocale`); + + if (localeFromStorage) { + return localeFromStorage; } else { - console.log('Language not supported, using default en-US.'); - return 'en-US'; + sessionStorage.setItem(`${isLevante ? 'levante' : 'roar'}PlatformLocale`, localeFromBrowser); + return localeFromBrowser; } }; -const getFallbackLocale = (locale) => { - if (locale.includes('es')) { +const getFallbackLocale = () => { + const localeFromStorage = sessionStorage.getItem(`${isLevante ? 'levante' : 'roar'}PlatformLocale`); + + if (localeFromStorage.includes('es')) { console.log('Setting fallback local to es'); return 'es'; - } else if (locale.includes('de')) { + } else if (localeFromStorage.includes('de')) { console.log('Setting fallback local to de'); return 'de'; } else { @@ -41,7 +40,7 @@ const getFallbackLocale = (locale) => { export const i18n = createI18n({ locale: getLocale(browserLocale), - fallbackLocale: getFallbackLocale(browserLocale), + fallbackLocale: getFallbackLocale(), messages: { en: enUSTranslations, 'en-US': enUSTranslations, From e744daa26daa42ee8e697252f2d8d974a1ea1973 Mon Sep 17 00:00:00 2001 From: Zio-4 Date: Tue, 25 Jun 2024 16:46:59 -0700 Subject: [PATCH 012/100] linking survey to admnistration --- src/pages/LEVANTE/UserSurvey.vue | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/pages/LEVANTE/UserSurvey.vue b/src/pages/LEVANTE/UserSurvey.vue index cbe7e38ee..432806b4a 100644 --- a/src/pages/LEVANTE/UserSurvey.vue +++ b/src/pages/LEVANTE/UserSurvey.vue @@ -170,7 +170,10 @@ async function saveResults(sender) { // call cloud function to save the survey results // TODO: Use tanstack-query mutation for automaitic retries. try { - const res = await roarfirekit.value.saveSurveyResponses(responsesWithAllQuestions); + const res = await roarfirekit.value.saveSurveyResponses({ + responses: responsesWithAllQuestions, + administrationId: gameStore.selectedAdmin.id, + }); // update game store to let game tabs know gameStore.setSurveyCompleted(); From 25e5b5bac44b6d8b613130bcd79943967b61d883 Mon Sep 17 00:00:00 2001 From: Zio-4 Date: Wed, 26 Jun 2024 11:24:42 -0700 Subject: [PATCH 013/100] Routing parents and teachers to survey, removing extra call --- src/pages/HomeSelector.vue | 45 +++++++++++++++++++++++--------------- src/pages/SignIn.vue | 23 ++++--------------- 2 files changed, 31 insertions(+), 37 deletions(-) diff --git a/src/pages/HomeSelector.vue b/src/pages/HomeSelector.vue index 46378e4b4..2b5c7aabe 100644 --- a/src/pages/HomeSelector.vue +++ b/src/pages/HomeSelector.vue @@ -57,6 +57,24 @@ unsubscribe = authStore.$subscribe(async (mutation, state) => { if (state.roarfirekit.restConfig) init(); }); +onMounted(async () => { + HomeParticipant = (await import('@/pages/HomeParticipant.vue')).default; + HomeAdministrator = (await import('@/pages/HomeAdministrator.vue')).default; + ConsentModal = (await import('@/components/ConsentModal.vue')).default; + + if (requireRefresh.value) { + requireRefresh.value = false; + router.go(0); + } + if (roarfirekit.value.restConfig) init(); + if (!isLoading.value) { + refreshDocs(); + if (isAdmin.value) { + await checkConsent(); + } + } +}); + const { isLoading: isLoadingUserData, data: userData } = useQuery({ queryKey: ['userData', uid, userQueryKeyIndex], queryFn: () => fetchDocById('users', uid.value), @@ -122,30 +140,21 @@ async function checkConsent() { const router = useRouter(); -onMounted(async () => { - HomeParticipant = (await import('@/pages/HomeParticipant.vue')).default; - HomeAdministrator = (await import('@/pages/HomeAdministrator.vue')).default; - ConsentModal = (await import('@/components/ConsentModal.vue')).default; - - if (requireRefresh.value) { - requireRefresh.value = false; - router.go(0); - } - if (roarfirekit.value.restConfig) init(); - if (!isLoading.value) { - refreshDocs(); - if (isAdmin.value) { - await checkConsent(); - } - } -}); - watch(isLoading, async (newValue) => { if (!newValue && isAdmin.value) { await checkConsent(); } }); +watch(userData, async (newValue) => { + if (newValue) { + const userType = toRaw(newValue).userType.toLowerCase(); + if (userType === 'parent' || userType === 'teacher') { + router.push({ name: 'Survey' }); + } + } +}); + const { idle } = useIdle(10 * 60 * 1000); // 10 min const confirm = useConfirm(); const timeLeft = ref(60); diff --git a/src/pages/SignIn.vue b/src/pages/SignIn.vue index 73d532a70..97230bd00 100644 --- a/src/pages/SignIn.vue +++ b/src/pages/SignIn.vue @@ -100,15 +100,7 @@ const { spinner, authFromClever, authFromClassLink } = storeToRefs(authStore); authStore.$subscribe(() => { if (authStore.uid) { - if (authStore.userData && isLevante) { - if ( - toRaw(authStore.userData?.userType?.toLowerCase()) === 'parent' || - toRaw(authStore.userData?.userType?.toLowerCase()) === 'teacher' - ) { - router.push({ name: 'Survey' }); - return; - } - } + console.log('userData in subscription:', authStore.userData); if (authFromClever.value) { router.push({ name: 'CleverLanding' }); @@ -172,7 +164,7 @@ const authWithClassLink = () => { } }; -const authWithEmail = (state) => { +const authWithEmail = async (state) => { // If username is supplied instead of email // turn it into our internal auth email incorrect.value = false; @@ -186,16 +178,9 @@ const authWithEmail = (state) => { creds.email = `${creds.email}@roar-auth.com`; } - authStore + await authStore .logInWithEmailAndPassword(creds) - .then(async () => { - if (authStore.uid) { - const userData = await fetchDocById('users', authStore.uid); - const userClaims = await fetchDocById('userClaims', authStore.uid); - authStore.userData = userData; - authStore.userClaims = userClaims; - } - + .then(() => { spinner.value = true; }) .catch((e) => { From be22b86e7b15066bc7295a9eff95a29118c47928 Mon Sep 17 00:00:00 2001 From: Zio-4 Date: Wed, 26 Jun 2024 13:48:47 -0700 Subject: [PATCH 014/100] Setting userData and userClaims authStore state --- src/pages/HomeSelector.vue | 9 ++++++--- src/pages/LEVANTE/UserSurvey.vue | 2 ++ 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/src/pages/HomeSelector.vue b/src/pages/HomeSelector.vue index 2b5c7aabe..566cb1a55 100644 --- a/src/pages/HomeSelector.vue +++ b/src/pages/HomeSelector.vue @@ -146,9 +146,12 @@ watch(isLoading, async (newValue) => { } }); -watch(userData, async (newValue) => { - if (newValue) { - const userType = toRaw(newValue).userType.toLowerCase(); +watch([userData, userClaims], async ([newUserData, newUserClaims]) => { + if (newUserData && newUserClaims) { + authStore.userData = newUserData; + authStore.userClaims = newUserClaims; + + const userType = toRaw(newValue)?.userType?.toLowerCase(); if (userType === 'parent' || userType === 'teacher') { router.push({ name: 'Survey' }); } diff --git a/src/pages/LEVANTE/UserSurvey.vue b/src/pages/LEVANTE/UserSurvey.vue index 432806b4a..6fa8fd62c 100644 --- a/src/pages/LEVANTE/UserSurvey.vue +++ b/src/pages/LEVANTE/UserSurvey.vue @@ -88,6 +88,8 @@ const showAndPlaceAudioButton = (playAudioButton, el) => { }; async function getSurvey() { + console.log('userData in authStore', authStore.userData); + let userType = toRaw(authStore.userData.userType.toLowerCase()); if (userType === 'student') userType = 'child'; From 664651a8d99302bbcc6a6ed3af7f249e4b107db5 Mon Sep 17 00:00:00 2001 From: Zio-4 Date: Wed, 26 Jun 2024 16:34:25 -0700 Subject: [PATCH 015/100] Adding conditionals to survey loading, fixes for admins --- src/components/CreateAdministrator.vue | 25 +++++++----- src/pages/HomeSelector.vue | 3 +- src/pages/LEVANTE/UserSurvey.vue | 53 +++++++++++++++----------- src/pages/SignIn.vue | 2 - 4 files changed, 47 insertions(+), 36 deletions(-) diff --git a/src/components/CreateAdministrator.vue b/src/components/CreateAdministrator.vue index ef7eb7508..2706bf41a 100644 --- a/src/components/CreateAdministrator.vue +++ b/src/components/CreateAdministrator.vue @@ -150,23 +150,28 @@ const submit = async () => { }; const adminOrgs = { - districts: selectedOrgs.value.districts.map((o) => o.id), - schools: selectedOrgs.value.schools.map((o) => o.id), - classes: selectedOrgs.value.classes.map((o) => o.id), - groups: selectedOrgs.value.groups.map((o) => o.id), - families: selectedOrgs.value.families.map((o) => o.id), + districts: selectedOrgs.value?.districts?.map((o) => o.id) || [], + schools: selectedOrgs.value?.schools?.map((o) => o.id) || [], + classes: selectedOrgs.value?.classes?.map((o) => o.id) || [], + groups: selectedOrgs.value?.groups?.map((o) => o.id) || [], + families: selectedOrgs.value?.families?.map((o) => o.id) || [], }; // Build orgs from admin orgs. Orgs should contain all of the admin orgs. And // also their parents. const orgs = _cloneDeep(adminOrgs); - for (const school of selectedOrgs.value.schools) { - orgs.districts = _union(orgs.districts, [school.districtId]); + + if (adminOrgs.schools.length > 0) { + for (const school of selectedOrgs.value.schools) { + orgs.districts = _union(orgs.districts, [school.districtId]); + } } - for (const _class of selectedOrgs.value.classes) { - orgs.districts = _union(orgs.districts, [_class.districtId]); - orgs.schools = _union(orgs.schools, [_class.schoolId]); + if (adminOrgs.classes.length > 0) { + for (const _class of selectedOrgs.value.classes) { + orgs.districts = _union(orgs.districts, [_class.districtId]); + orgs.schools = _union(orgs.schools, [_class.schoolId]); + } } await roarfirekit.value diff --git a/src/pages/HomeSelector.vue b/src/pages/HomeSelector.vue index 566cb1a55..6cb698297 100644 --- a/src/pages/HomeSelector.vue +++ b/src/pages/HomeSelector.vue @@ -95,6 +95,7 @@ const isLoading = computed(() => isLoadingClaims.value || isLoadingUserData.valu const isAdmin = computed(() => { if (userClaims.value?.claims?.super_admin) return true; + if (userClaims.value?.claims?.admin) return true; if (_isEmpty(_union(...Object.values(userClaims.value?.claims?.minimalAdminOrgs ?? {})))) return false; return true; }); @@ -151,7 +152,7 @@ watch([userData, userClaims], async ([newUserData, newUserClaims]) => { authStore.userData = newUserData; authStore.userClaims = newUserClaims; - const userType = toRaw(newValue)?.userType?.toLowerCase(); + const userType = toRaw(newUserData)?.userType?.toLowerCase(); if (userType === 'parent' || userType === 'teacher') { router.push({ name: 'Survey' }); } diff --git a/src/pages/LEVANTE/UserSurvey.vue b/src/pages/LEVANTE/UserSurvey.vue index 6fa8fd62c..0b879a4f5 100644 --- a/src/pages/LEVANTE/UserSurvey.vue +++ b/src/pages/LEVANTE/UserSurvey.vue @@ -88,22 +88,25 @@ const showAndPlaceAudioButton = (playAudioButton, el) => { }; async function getSurvey() { - console.log('userData in authStore', authStore.userData); - let userType = toRaw(authStore.userData.userType.toLowerCase()); if (userType === 'student') userType = 'child'; try { const response = await axios.get(`https://storage.googleapis.com/road-dashboard/${userType}_survey.json`); - const audioLinkMap = await fetchAudioLinks('child-survey'); - audioLinks.value = audioLinkMap; + + if (userType === 'child') { + const audioLinkMap = await fetchAudioLinks('child-survey'); + audioLinks.value = audioLinkMap; + } fetchedSurvey.value = response.data; // Create the survey model with the fetched data const surveyInstance = new Model(fetchedSurvey.value); surveyInstance.locale = locale.value; - fetchBuffer(getParsedLocale(locale.value)); + if (userType === 'child') { + fetchBuffer(getParsedLocale(locale.value)); + } survey.value = surveyInstance; survey.value.onTextMarkdown.add(function (survey, options) { @@ -117,16 +120,18 @@ async function getSurvey() { }); survey.value.onComplete.add(saveResults); - survey.value.onAfterRenderPage.add((__, { htmlElement }) => { - const questionElements = htmlElement.querySelectorAll('div[id^=sq_]'); - if (currentAudioSource) { - currentAudioSource.stop(); - } - questionElements.forEach((el) => { - const playAudioButton = document.getElementById('audio-button-' + el.dataset.name); - showAndPlaceAudioButton(playAudioButton, el); + if (userType === 'child') { + survey.value.onAfterRenderPage.add((__, { htmlElement }) => { + const questionElements = htmlElement.querySelectorAll('div[id^=sq_]'); + if (currentAudioSource) { + currentAudioSource.stop(); + } + questionElements.forEach((el) => { + const playAudioButton = document.getElementById('audio-button-' + el.dataset.name); + showAndPlaceAudioButton(playAudioButton, el); + }); }); - }); + } } catch (error) { console.error(error); } @@ -172,7 +177,7 @@ async function saveResults(sender) { // call cloud function to save the survey results // TODO: Use tanstack-query mutation for automaitic retries. try { - const res = await roarfirekit.value.saveSurveyResponses({ + await roarfirekit.value.saveSurveyResponses({ responses: responsesWithAllQuestions, administrationId: gameStore.selectedAdmin.id, }); @@ -200,14 +205,16 @@ async function saveResults(sender) {
-
-
- +
+
+
+ +
diff --git a/src/pages/SignIn.vue b/src/pages/SignIn.vue index 97230bd00..1fd949da1 100644 --- a/src/pages/SignIn.vue +++ b/src/pages/SignIn.vue @@ -100,8 +100,6 @@ const { spinner, authFromClever, authFromClassLink } = storeToRefs(authStore); authStore.$subscribe(() => { if (authStore.uid) { - console.log('userData in subscription:', authStore.userData); - if (authFromClever.value) { router.push({ name: 'CleverLanding' }); } else { From 8477cff065a7ed6f0dff75ddc555847b7e72735b Mon Sep 17 00:00:00 2001 From: Zio-4 Date: Thu, 30 May 2024 16:59:12 -0700 Subject: [PATCH 016/100] Adding prod scripts, isLevante moved to helpers --- .firebaserc | 11 +++- ...dev-firebase.json => levante-firebase.json | 0 package.json | 8 ++- src/App.vue | 2 +- src/components/CreateOrgs.vue | 2 +- src/components/GameTabs.vue | 2 +- src/components/NavBar.vue | 2 +- src/config/firebaseLevante.js | 55 +++++++++++++------ src/firebaseInit.js | 5 +- src/helpers/index.js | 2 + src/pages/HomeAdministrator.vue | 2 +- src/pages/HomeParticipant.vue | 2 +- src/pages/HomeSelector.vue | 3 +- src/pages/SignIn.vue | 2 +- src/router/index.js | 2 +- src/router/sidebarActions.js | 4 +- src/sentry.js | 4 +- 17 files changed, 72 insertions(+), 36 deletions(-) rename levante-dev-firebase.json => levante-firebase.json (100%) diff --git a/.firebaserc b/.firebaserc index e053927fb..f200f1f42 100644 --- a/.firebaserc +++ b/.firebaserc @@ -6,8 +6,8 @@ "assessment-dev": "gse-roar-assessment-dev", "levante-assessment-dev": "hs-levante-assessment-dev", "levante-admin-dev": "hs-levante-admin-dev", - "levante-assessment": "hs-levante-assessment-prod", - "levante-admin": "hs-levante-admin-prod" + "levante-assessment-prod": "hs-levante-assessment-prod", + "levante-admin-prod": "hs-levante-admin-prod" }, "targets": { "gse-roar-admin": { @@ -26,6 +26,13 @@ "hs-levante-admin-dev" ] } + }, + "hs-levante-admin-prod": { + "hosting": { + "production": [ + "hs-levante-admin-prod" + ] + } } }, "etags": {} diff --git a/levante-dev-firebase.json b/levante-firebase.json similarity index 100% rename from levante-dev-firebase.json rename to levante-firebase.json diff --git a/package.json b/package.json index c9ab38186..16b3108c5 100644 --- a/package.json +++ b/package.json @@ -5,12 +5,14 @@ "scripts": { "build": "export VITE_FIREBASE_DATA_SOURCE=live && vite build", "build:sandbox": "export VITE_FIREBASE_DATA_SOURCE=sandbox && vite build", - "build:levante-dev": "vite build -m LEVANTE", + "build:levante-dev": "export VITE_LEVANTE=TRUE && export VITE_FIREBASE_PROJECT=DEV && vite build", + "build:levante-prod": "export VITE_LEVANTE=TRUE && vite build", "dev": "export VITE_FIREBASE_DATA_SOURCE=sandbox && vite --force --host", "dev:live": "export VITE_FIREBASE_DATA_SOURCE=live && vite --force --host", - "dev:levante": "vite --force --host -m LEVANTE", + "dev:levante": "export VITE_LEVANTE=TRUE && export VITE_FIREBASE_PROJECT=DEV && vite --force --host", "dev:emulate": "export VITE_FIREBASE_EMULATOR=true && vite --force --host", - "deploy:levante-dev": "npm run build:levante-dev && firebase use levante-admin-dev && firebase deploy --only hosting --config levante-dev-firebase.json", + "deploy:levante-dev": "npm run build:levante-dev && firebase use levante-admin-dev && firebase deploy --only hosting --config levante-firebase.json", + "deploy:levante-prod": "npm run build:levante-prod && firebase use levante-admin-prod && firebase deploy --only hosting --config levante-firebase.json", "emulate:admin": "source firebase/emulate_admin.sh", "emulate:assessment": "source firebase/emulate_assessment.sh", "emulate:export": "source firebase/export_admin.sh && source firebase/export_assessment.sh", diff --git a/src/App.vue b/src/App.vue index 7a4dc7610..6dc3cf5d5 100644 --- a/src/App.vue +++ b/src/App.vue @@ -27,8 +27,8 @@ import AppHead from '@/components/AppHead.vue'; import { i18n } from '@/translations/i18n'; import { useRoute } from 'vue-router'; import { useRecaptchaProvider } from 'vue-recaptcha'; +import { isLevante } from '@/helpers'; -const isLevante = import.meta.env.MODE === 'LEVANTE'; const route = useRoute(); const pageTitle = computed(() => { const locale = i18n.global.locale.value; diff --git a/src/components/CreateOrgs.vue b/src/components/CreateOrgs.vue index cec8d370f..232c36d5c 100644 --- a/src/components/CreateOrgs.vue +++ b/src/components/CreateOrgs.vue @@ -212,6 +212,7 @@ import { required, requiredIf } from '@vuelidate/validators'; import { useAuthStore } from '@/store/auth'; import { fetchDocById } from '@/helpers/query/utils'; import { orgFetcher } from '@/helpers/query/orgs'; +import { isLevante } from '@/helpers'; const initialized = ref(false); const isTestData = ref(false); @@ -219,7 +220,6 @@ const isDemoData = ref(false); const toast = useToast(); const authStore = useAuthStore(); const { roarfirekit, uid } = storeToRefs(authStore); -const isLevante = import.meta.env.MODE === 'LEVANTE'; const state = reactive({ orgName: '', diff --git a/src/components/GameTabs.vue b/src/components/GameTabs.vue index c1d3f74f9..44d8673d0 100644 --- a/src/components/GameTabs.vue +++ b/src/components/GameTabs.vue @@ -87,13 +87,13 @@ import { storeToRefs } from 'pinia'; import { useI18n } from 'vue-i18n'; import { camelize, getAgeData } from '@bdelab/roar-utils'; import VideoPlayer from '@/components/VideoPlayer.vue'; +import { isLevante } from '@/helpers'; const props = defineProps({ games: { type: Array, required: true }, sequential: { type: Boolean, required: false, default: true }, userData: { type: Object, required: true }, }); -const isLevante = import.meta.env.MODE === 'LEVANTE'; const { t, locale } = useI18n(); diff --git a/src/components/NavBar.vue b/src/components/NavBar.vue index 07cf3f243..86060e6cd 100644 --- a/src/components/NavBar.vue +++ b/src/components/NavBar.vue @@ -69,6 +69,7 @@ import { fetchDocById } from '@/helpers/query/utils'; import { useQuery } from '@tanstack/vue-query'; import ROARLogo from '@/assets/RoarLogo.vue'; import LanguageSelector from './LanguageSelector.vue'; +import { isLevante } from '@/helpers'; const router = useRouter(); const authStore = useAuthStore(); @@ -76,7 +77,6 @@ const { roarfirekit, uid } = storeToRefs(authStore); const initialized = ref(false); const menu = ref(); const screenWidth = ref(window.innerWidth); -const isLevante = import.meta.env.MODE === 'LEVANTE'; let unsubscribe; const init = () => { diff --git a/src/config/firebaseLevante.js b/src/config/firebaseLevante.js index 3f8edfcab..19a408107 100644 --- a/src/config/firebaseLevante.js +++ b/src/config/firebaseLevante.js @@ -1,23 +1,44 @@ -let appConfig; +let appConfig; // assessment project let adminConfig; -appConfig = { - apiKey: 'AIzaSyC9IoJBEyN-BxHobeoMQRuEu0CtyQDOg8k', - authDomain: 'hs-levante-assessment-dev.firebaseapp.com', - projectId: 'hs-levante-assessment-dev', - storageBucket: 'hs-levante-assessment-dev.appspot.com', - messagingSenderId: '46792247600', - appId: '1:46792247600:web:ea20e1fe94e0541dd5a0f5', -}; +if (import.meta.env.VITE_FIREBASE_PROJECT === 'DEV') { + appConfig = { + apiKey: 'AIzaSyC9IoJBEyN-BxHobeoMQRuEu0CtyQDOg8k', + authDomain: 'hs-levante-assessment-dev.firebaseapp.com', + projectId: 'hs-levante-assessment-dev', + storageBucket: 'hs-levante-assessment-dev.appspot.com', + messagingSenderId: '46792247600', + appId: '1:46792247600:web:ea20e1fe94e0541dd5a0f5', + }; -adminConfig = { - apiKey: 'AIzaSyCOzRA9a2sDHtVlX7qnszxrgsRCBLyf5p0', - authDomain: 'hs-levante-admin-dev.firebaseapp.com', - projectId: 'hs-levante-admin-dev', - storageBucket: 'hs-levante-admin-dev.appspot.com', - messagingSenderId: '41590333418', - appId: '1:41590333418:web:3468a7caadab802d6e5c93', -}; + adminConfig = { + apiKey: 'AIzaSyCOzRA9a2sDHtVlX7qnszxrgsRCBLyf5p0', + authDomain: 'hs-levante-admin-dev.firebaseapp.com', + projectId: 'hs-levante-admin-dev', + storageBucket: 'hs-levante-admin-dev.appspot.com', + messagingSenderId: '41590333418', + appId: '1:41590333418:web:3468a7caadab802d6e5c93', + }; +} else { + // production + appConfig = { + apiKey: 'AIzaSyCdAa6P5Ot8jjnKAi_FNLDfvWP_rDqeQYg', + authDomain: 'hs-levante-assessment-prod.firebaseapp.com', + projectId: 'hs-levante-assessment-prod', + storageBucket: 'hs-levante-assessment-prod.appspot.com', + messagingSenderId: '928482088295', + appId: '1:928482088295:web:1cab64d5dccb2d19ae8bc2', + }; + + adminConfig = { + apiKey: 'AIzaSyCcnmBCojjK0_Ia87f0SqclSOihhKVD3f8', + authDomain: 'hs-levante-admin-prod.firebaseapp.com', + projectId: 'hs-levante-admin-prod', + storageBucket: 'hs-levante-admin-prod.appspot.com', + messagingSenderId: '348449903279', + appId: '1:348449903279:web:a1b9dad734e2237c7ffa5a', + }; +} export default { app: appConfig, diff --git a/src/firebaseInit.js b/src/firebaseInit.js index 1dc675882..2fa6f4bae 100644 --- a/src/firebaseInit.js +++ b/src/firebaseInit.js @@ -1,8 +1,9 @@ import { RoarFirekit } from '@bdelab/roar-firekit'; import roarFirebaseConfig from './config/firebaseRoar'; import levanteFirebaseConfig from './config/firebaseLevante'; +import { isLevante } from './helpers'; -const roarConfig = import.meta.env.MODE === 'LEVANTE' ? levanteFirebaseConfig : roarFirebaseConfig; +const roarConfig = isLevante ? levanteFirebaseConfig : roarFirebaseConfig; export async function initNewFirekit() { const firekit = new RoarFirekit({ @@ -14,7 +15,7 @@ export async function initNewFirekit() { functions: false, }, - verboseLogging: import.meta.env.MODE === 'LEVANTE' ? false : true, + verboseLogging: isLevante ? false : true, }); return await firekit.init(); } diff --git a/src/helpers/index.js b/src/helpers/index.js index fc3fcd46f..0f4fb11b2 100644 --- a/src/helpers/index.js +++ b/src/helpers/index.js @@ -4,6 +4,8 @@ import _invert from 'lodash/invert'; import _toPairs from 'lodash/toPairs'; import * as Papa from 'papaparse'; +export const isLevante = import.meta.env.VITE_LEVANTE === 'TRUE'; + export const isMobileBrowser = () => { const userAgent = navigator.userAgent || navigator.vendor || window.opera; if ( diff --git a/src/pages/HomeAdministrator.vue b/src/pages/HomeAdministrator.vue index e68237f00..90c3aa1de 100644 --- a/src/pages/HomeAdministrator.vue +++ b/src/pages/HomeAdministrator.vue @@ -126,6 +126,7 @@ import { administrationPageFetcher, getTitle } from '../helpers/query/administra import CardAdministration from '@/components/CardAdministration.vue'; import { useAuthStore } from '@/store/auth'; import { useQuery } from '@tanstack/vue-query'; +import { isLevante } from '@/helpers'; const initialized = ref(false); const page = ref(0); @@ -134,7 +135,6 @@ const adminSearchTokens = ref([]); const searchInput = ref(''); const search = ref(''); const pageLimit = ref(10); -const isLevante = import.meta.env.MODE === 'LEVANTE'; const authStore = useAuthStore(); diff --git a/src/pages/HomeParticipant.vue b/src/pages/HomeParticipant.vue index ec1a0ed08..592e64269 100644 --- a/src/pages/HomeParticipant.vue +++ b/src/pages/HomeParticipant.vue @@ -328,7 +328,7 @@ const assessments = computed(() => { undefined, ); - if (authStore.userData?.userType === 'student' && import.meta.env.MODE === 'LEVANTE') { + if (authStore.userData.userType === 'student' && isLevante) { // This is just to mark the card as complete if (gameStore.isSurveyCompleted || surveyResponsesData.value?.length) { fetchedAssessments.forEach((assessment) => { diff --git a/src/pages/HomeSelector.vue b/src/pages/HomeSelector.vue index 6cb698297..e87237003 100644 --- a/src/pages/HomeSelector.vue +++ b/src/pages/HomeSelector.vue @@ -37,9 +37,10 @@ import _union from 'lodash/union'; import { storeToRefs } from 'pinia'; import { fetchDocById } from '@/helpers/query/utils'; import { useI18n } from 'vue-i18n'; +import { isLevante } from '@/helpers'; let HomeParticipant, HomeAdministrator, ConsentModal; -const isLevante = import.meta.env.MODE === 'LEVANTE'; + const authStore = useAuthStore(); const { roarfirekit, uid, userQueryKeyIndex } = storeToRefs(authStore); diff --git a/src/pages/SignIn.vue b/src/pages/SignIn.vue index 1fd949da1..676bba2f5 100644 --- a/src/pages/SignIn.vue +++ b/src/pages/SignIn.vue @@ -89,9 +89,9 @@ import ROARLogoShort from '@/assets/RoarLogo-Short.vue'; import { useAuthStore } from '@/store/auth'; import { isMobileBrowser } from '@/helpers'; import { fetchDocById } from '../helpers/query/utils'; +import { isLevante } from '@/helpers'; const incorrect = ref(false); -const isLevante = import.meta.env.MODE === 'LEVANTE'; const authStore = useAuthStore(); const router = useRouter(); const adminSignIn = ref(false); diff --git a/src/router/index.js b/src/router/index.js index f6f2501ee..b9ed41a93 100644 --- a/src/router/index.js +++ b/src/router/index.js @@ -3,6 +3,7 @@ import { useAuthStore } from '@/store/auth'; import { useGameStore } from '@/store/game'; import _get from 'lodash/get'; import { pageTitlesEN, pageTitlesUS, pageTitlesES, pageTitlesCO } from '@/translations/exports'; +import { isLevante } from '@/helpers'; function removeQueryParams(to) { if (Object.keys(to.query).length) return { path: to.path, query: {}, hash: to.hash }; @@ -398,7 +399,6 @@ const router = createRouter({ }); router.beforeEach(async (to, from, next) => { - const isLevante = import.meta.env.MODE === 'LEVANTE'; // Don't allow routing to LEVANTE pages if not in LEVANTE instance if (!isLevante && to.meta?.project === 'LEVANTE') { next({ name: 'Home' }); diff --git a/src/router/sidebarActions.js b/src/router/sidebarActions.js index 44cc3c902..bab1052d6 100644 --- a/src/router/sidebarActions.js +++ b/src/router/sidebarActions.js @@ -1,3 +1,5 @@ +import { isLevante } from '../helpers'; + const sidebarActionOptions = [ { title: 'Back to Dashboard', @@ -89,7 +91,7 @@ const sidebarActionOptions = [ ]; export const getSidebarActions = ({ isSuperAdmin = false, isAdmin = false }) => { - if (import.meta.env.MODE === 'LEVANTE') { + if (isLevante) { return sidebarActionOptions.filter((action) => { if (action.project === 'LEVANTE' || action.project === 'ALL') { // If the action requires admin and the user is an admin, or if the action diff --git a/src/sentry.js b/src/sentry.js index a0e98d272..c1f7433f9 100644 --- a/src/sentry.js +++ b/src/sentry.js @@ -1,11 +1,11 @@ import * as Sentry from '@sentry/vue'; import { captureConsoleIntegration, contextLinesIntegration, extraErrorDataIntegration } from '@sentry/integrations'; import { i18n, languageOptions } from './translations/i18n'; +import { isLevante } from '@/helpers'; // Workaround for using i18n-vue in plain JavaScript; this is a temporary solution until a more robust bug report component is implemented const language = i18n.global.locale.value; const regex = /https:\/\/roar-staging(--pr\d+-\w+)?\.web\.app/; -const isLevante = import.meta.env.MODE === 'LEVANTE'; export function initSentry(app) { // skip if levante instance @@ -13,7 +13,7 @@ export function initSentry(app) { return; } // Only initialize Sentry in production - if (process.env.NODE_ENV === 'production' && process.env.MODE !== 'LEVANTE') { + if (process.env.NODE_ENV === 'production') { Sentry.init({ app, dsn: 'https://f15e3ff866394e93e00514b42113d03d@o4505913837420544.ingest.us.sentry.io/4506820782129152', From cfdf0f03895a78cfa652032e6eaaba737cd32527 Mon Sep 17 00:00:00 2001 From: Zio-4 Date: Fri, 31 May 2024 17:01:31 -0700 Subject: [PATCH 017/100] Adding GH Actions for preview and dev deployments --- .github/workflows/deploy-to-dev.yml | 24 ++++++++++ .../workflows/firebase-hosting-preview.yml | 21 ++++++--- .github/workflows/lint.yml | 44 +++++++++---------- .husky/pre-commit | 2 +- package.json | 1 + src/components/CreateAdministration.vue | 3 +- src/pages/HomeParticipant.vue | 4 +- src/sentry.js | 2 +- 8 files changed, 68 insertions(+), 33 deletions(-) create mode 100644 .github/workflows/deploy-to-dev.yml diff --git a/.github/workflows/deploy-to-dev.yml b/.github/workflows/deploy-to-dev.yml new file mode 100644 index 000000000..9f689921e --- /dev/null +++ b/.github/workflows/deploy-to-dev.yml @@ -0,0 +1,24 @@ +name: Deploy to development +'on': + push: + branches: + - main +jobs: + build_and_deploy: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - uses: actions/setup-node@v4 + with: + node-version: 'lts/*' + - name: 'Build' + env: + NODE_OPTIONS: '--max_old_space_size=8192' + run: npm ci && npm run build:levante-dev + - uses: FirebaseExtended/action-hosting-deploy@v0 + with: + repoToken: '${{ secrets.GITHUB_TOKEN }}' + firebaseServiceAccount: '${{ secrets.FIREBASE_SERVICE_ACCOUNT_DEV_ADMIN }}' + channelId: live + projectId: '${{ secrets.FIREBASE_PROJECT }}' + target: production \ No newline at end of file diff --git a/.github/workflows/firebase-hosting-preview.yml b/.github/workflows/firebase-hosting-preview.yml index 0a8b9d3d5..18891f224 100644 --- a/.github/workflows/firebase-hosting-preview.yml +++ b/.github/workflows/firebase-hosting-preview.yml @@ -1,4 +1,4 @@ -name: Build and Deploy +name: Preview Deploy on: pull_request: types: [opened, reopened, synchronize] @@ -7,6 +7,12 @@ concurrency: group: ci-preview-tests-${{ github.ref }}-1 cancel-in-progress: true +permissions: + contents: read + checks: write + deployments: write + pull-requests: write + jobs: build-and-preview: name: Deploy Preview @@ -17,16 +23,21 @@ jobs: - uses: actions/setup-node@v4 with: node-version: 'lts/*' - - name: 'vite build' + - name: Build (ROAR) + if: ${{ contains(github.repository, 'roar') }} run: npm ci && npm run build + - name: Build (LEVANTE) + if: ${{ contains(github.repository, 'levante') }} + run: npm ci && npm run build:levante-dev - name: Deploy to Firebase Hosting Channel id: firebase-deploy uses: FirebaseExtended/action-hosting-deploy@v0 with: + firebaseToolsVersion: v13.3.1 # <- Locking version because the newest (13.13.0) does not add the deploy URL to auth whitelist repoToken: '${{ secrets.GITHUB_TOKEN }}' - firebaseServiceAccount: '${{ secrets.FIREBASE_SERVICE_ACCOUNT_GSE_ROAR_ADMIN }}' - projectId: gse-roar-admin - target: staging + firebaseServiceAccount: '${{ secrets.FIREBASE_SERVICE_ACCOUNT_DEV_ADMIN }}' + projectId: '${{ secrets.FIREBASE_PROJECT }}' + target: production - run: echo ${{ fromJson(steps.firebase-deploy.outputs.urls)[0] }} outputs: deployUrl: ${{ fromJson(steps.firebase-deploy.outputs.urls)[0] }} diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index e9da53ada..7f533d275 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -1,24 +1,24 @@ -name: Format +# name: Format -on: - # Trigger the workflow on push or pull request, - # but only for the main branch - push: - branches: - - main - pull_request: - types: [opened, reopened, synchronize] - branches: - - main +# on: +# # Trigger the workflow on push or pull request, +# # but only for the main branch +# push: +# branches: +# - main +# pull_request: +# types: [opened, reopened, synchronize] +# branches: +# - main -jobs: - build-and-lint: - name: Prettier - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v4 - - uses: actions/setup-node@v4 - with: - node-version: 'lts/*' - - run: npm ci - - run: npm run check-format +# jobs: +# build-and-lint: +# name: Prettier +# runs-on: ubuntu-latest +# steps: +# - uses: actions/checkout@v4 +# - uses: actions/setup-node@v4 +# with: +# node-version: 'lts/*' +# - run: npm ci +# - run: npm run check-format diff --git a/.husky/pre-commit b/.husky/pre-commit index a9c231474..d610a8051 100755 --- a/.husky/pre-commit +++ b/.husky/pre-commit @@ -1,4 +1,4 @@ #!/usr/bin/env sh . "$(dirname -- "$0")/_/husky.sh" -npm run check-format +# npm run check-format diff --git a/package.json b/package.json index 16b3108c5..424f5a601 100644 --- a/package.json +++ b/package.json @@ -10,6 +10,7 @@ "dev": "export VITE_FIREBASE_DATA_SOURCE=sandbox && vite --force --host", "dev:live": "export VITE_FIREBASE_DATA_SOURCE=live && vite --force --host", "dev:levante": "export VITE_LEVANTE=TRUE && export VITE_FIREBASE_PROJECT=DEV && vite --force --host", + "dev:levante-prod": "export VITE_LEVANTE=TRUE && export VITE_FIREBASE_PROJECT=PROD && vite --force --host", "dev:emulate": "export VITE_FIREBASE_EMULATOR=true && vite --force --host", "deploy:levante-dev": "npm run build:levante-dev && firebase use levante-admin-dev && firebase deploy --only hosting --config levante-firebase.json", "deploy:levante-prod": "npm run build:levante-prod && firebase use levante-admin-prod && firebase deploy --only hosting --config levante-firebase.json", diff --git a/src/components/CreateAdministration.vue b/src/components/CreateAdministration.vue index 4c5ff4393..6a98f8450 100644 --- a/src/components/CreateAdministration.vue +++ b/src/components/CreateAdministration.vue @@ -185,8 +185,7 @@ import { variantsFetcher } from '@/helpers/query/tasks'; import TaskPicker from './TaskPicker.vue'; import { useConfirm } from 'primevue/useconfirm'; import ConsentPicker from './ConsentPicker.vue'; - -const isLevante = import.meta.env.MODE === 'LEVANTE'; +import { isLevante } from '@/helpers'; const props = defineProps({ adminId: { type: String, required: false, default: null }, diff --git a/src/pages/HomeParticipant.vue b/src/pages/HomeParticipant.vue index 592e64269..d0059e452 100644 --- a/src/pages/HomeParticipant.vue +++ b/src/pages/HomeParticipant.vue @@ -106,6 +106,7 @@ import { getUserAssignments } from '../helpers/query/assignments'; import ConsentModal from '../components/ConsentModal.vue'; import GameTabs from '@/components/GameTabs.vue'; import ParticipantSidebar from '@/components/ParticipantSidebar.vue'; +import { isLevante } from '@/helpers'; const showConsent = ref(false); const consentVersion = ref(''); @@ -113,7 +114,6 @@ const confirmText = ref(''); const consentType = ref(''); const consentParams = ref({}); -const isLevante = import.meta.env.MODE === 'LEVANTE'; let unsubscribe; const initialized = ref(false); const init = () => { @@ -328,7 +328,7 @@ const assessments = computed(() => { undefined, ); - if (authStore.userData.userType === 'student' && isLevante) { + if (authStore?.userData.userType === 'student' && isLevante) { // This is just to mark the card as complete if (gameStore.isSurveyCompleted || surveyResponsesData.value?.length) { fetchedAssessments.forEach((assessment) => { diff --git a/src/sentry.js b/src/sentry.js index c1f7433f9..b1b0a6702 100644 --- a/src/sentry.js +++ b/src/sentry.js @@ -13,7 +13,7 @@ export function initSentry(app) { return; } // Only initialize Sentry in production - if (process.env.NODE_ENV === 'production') { + if (process.env.NODE_ENV === 'production' && !isLevante) { Sentry.init({ app, dsn: 'https://f15e3ff866394e93e00514b42113d03d@o4505913837420544.ingest.us.sentry.io/4506820782129152', From f8cf227d34cf3685115260ef6896dac95f9525d9 Mon Sep 17 00:00:00 2001 From: Zio-4 Date: Wed, 3 Jul 2024 16:17:49 -0700 Subject: [PATCH 018/100] Making target environment for preview action dynamic --- .../workflows/firebase-hosting-preview.yml | 2 +- .github/workflows/lint.yml | 44 +++++++++---------- 2 files changed, 23 insertions(+), 23 deletions(-) diff --git a/.github/workflows/firebase-hosting-preview.yml b/.github/workflows/firebase-hosting-preview.yml index 18891f224..a03bcfcd4 100644 --- a/.github/workflows/firebase-hosting-preview.yml +++ b/.github/workflows/firebase-hosting-preview.yml @@ -37,7 +37,7 @@ jobs: repoToken: '${{ secrets.GITHUB_TOKEN }}' firebaseServiceAccount: '${{ secrets.FIREBASE_SERVICE_ACCOUNT_DEV_ADMIN }}' projectId: '${{ secrets.FIREBASE_PROJECT }}' - target: production + target: ${{ contains(github.repository, 'levante') && 'production' || 'staging' }} - run: echo ${{ fromJson(steps.firebase-deploy.outputs.urls)[0] }} outputs: deployUrl: ${{ fromJson(steps.firebase-deploy.outputs.urls)[0] }} diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index 7f533d275..e9da53ada 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -1,24 +1,24 @@ -# name: Format +name: Format -# on: -# # Trigger the workflow on push or pull request, -# # but only for the main branch -# push: -# branches: -# - main -# pull_request: -# types: [opened, reopened, synchronize] -# branches: -# - main +on: + # Trigger the workflow on push or pull request, + # but only for the main branch + push: + branches: + - main + pull_request: + types: [opened, reopened, synchronize] + branches: + - main -# jobs: -# build-and-lint: -# name: Prettier -# runs-on: ubuntu-latest -# steps: -# - uses: actions/checkout@v4 -# - uses: actions/setup-node@v4 -# with: -# node-version: 'lts/*' -# - run: npm ci -# - run: npm run check-format +jobs: + build-and-lint: + name: Prettier + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - uses: actions/setup-node@v4 + with: + node-version: 'lts/*' + - run: npm ci + - run: npm run check-format From 377d48ae8152fe64510c91379ebe8fd7883821b6 Mon Sep 17 00:00:00 2001 From: Zio-4 Date: Wed, 3 Jul 2024 17:03:03 -0700 Subject: [PATCH 019/100] Updating remaining isLevante var to use from helper --- src/components/LanguageSelector.vue | 2 +- src/translations/i18n.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/components/LanguageSelector.vue b/src/components/LanguageSelector.vue index de9913fa6..d55b27606 100644 --- a/src/components/LanguageSelector.vue +++ b/src/components/LanguageSelector.vue @@ -22,7 +22,7 @@ diff --git a/src/main.js b/src/main.js index b1f6293f0..c5aa1865e 100644 --- a/src/main.js +++ b/src/main.js @@ -69,6 +69,7 @@ import PvFieldset from 'primevue/fieldset'; import PvColumnGroup from 'primevue/columngroup'; import PvRow from 'primevue/row'; + // PrimeVue directive imports import PvTooltip from 'primevue/tooltip'; From dc6413e2c589c9870d7226ef8d39819f4113a2b6 Mon Sep 17 00:00:00 2001 From: Zio-4 Date: Wed, 17 Jul 2024 11:37:03 -0700 Subject: [PATCH 038/100] renaming variables, moving blocks, fixing some bugs --- src/components/EditVariantDialog.vue | 93 +++++++++++++++------------- src/pages/HomeSelector.vue | 11 ---- 2 files changed, 49 insertions(+), 55 deletions(-) diff --git a/src/components/EditVariantDialog.vue b/src/components/EditVariantDialog.vue index 44a973cbd..5692f5422 100644 --- a/src/components/EditVariantDialog.vue +++ b/src/components/EditVariantDialog.vue @@ -59,17 +59,14 @@
-
-
-
@@ -95,7 +92,6 @@
-
@@ -110,7 +106,7 @@ class="flex flex-column align-items-center justify-content-center py-2 gap-2" >
No Conditions Added
-
+
Assignment will be OPTIONAL for all students in the administration.
@@ -148,7 +144,7 @@
Make Assessment Optional For All Students
@@ -158,7 +154,7 @@ label="AddCondition" icon="pi pi-plus mr-2" class="bg-primary text-white border-none border-round p-2 hover:bg-red-900" - :disabled="optionalForAllFlag === true" + :disabled="isOptionalForAll === true" @click="addOptionalCondition" data-cy="button-optional-condition" /> @@ -169,7 +165,7 @@
-
+
Making the assessment optional for all will override any optional conditions you have added. @@ -205,15 +201,17 @@ import { ref, onMounted, computed, toRaw } from 'vue'; import _isEmpty from 'lodash/isEmpty'; import { isLevante } from '@/helpers'; -const selectedField = ref(); -const selectedCondition = ref(); -const selectedValue = ref(); - - const assignedConditions = ref([]); +const optionalConditions = ref([]); +// Store optional conditions in case the isOptionalForAll is toggled on and off again (prevents the form from resetting to the original state) +const previousOptionalConditions = ref([]); const optionsForField = (field) => { - const selectedField = toRaw(field.label); + const processedField = toRaw(field); + console.log('processedField: ', processedField); + if (!processedField) return + + const selectedField = processedField.label; console.log('selectedField: ', selectedField); if (selectedField === 'Grade') { @@ -254,7 +252,12 @@ const removeCondition = (condtions, index) => { }; const computedConditionOptions = (field) => { - const selectedField = toRaw(field.label); + const processedField = toRaw(field); + console.log('processedField: ', processedField); + if (!processedField) return + + const selectedField = processedField.label; + console.log('selectedField: ', selectedField); if (selectedField === 'Grade') { @@ -281,7 +284,6 @@ const computedConditionOptions = (field) => { - // --- PREVIOUS CODE --- const visible = ref(false); @@ -307,14 +309,18 @@ onMounted(() => { function getAllConditions(taskId) { const existingAssignedConditions = getAssignedConditions(taskId); const existingOptionalConditions = getOptionalConditions(taskId); + + console.log('existingAssignedConditions: ', existingAssignedConditions); + setAssignedConditions(existingAssignedConditions); setOptionalConditions(existingOptionalConditions); } // Get the assigned and optional conditions from the pre-existing admin info function getAssignedConditions(taskId) { - return props.preExistingAssessmentInfo.find((assessment) => assessment.taskId === taskId)?.conditions?.assigned - ?.conditions; + return props.preExistingAssessmentInfo + .find((assessment) => assessment.taskId === taskId) + ?.conditions?.assigned?.conditions; } function getOptionalConditions(taskId) { @@ -322,10 +328,10 @@ function getOptionalConditions(taskId) { const hasOptionalConditions = task?.conditions?.optional?.conditions; if (hasOptionalConditions) { - optionalForAllFlag.value = false; + isOptionalForAll.value = false; return hasOptionalConditions; } else { - optionalForAllFlag.value = !!task?.conditions?.optional; + isOptionalForAll.value = !!task?.conditions?.optional; return []; } } @@ -353,13 +359,13 @@ const addAssignedCondition = () => { assignedConditions.value.push({ id: assignedConditions.value.length, field: '', op: '', value: '' }); }; -const optionalForAllFlag = ref(false); +const isOptionalForAll = ref(false); const errorSubmitText = ref(''); const handleOptionalForAllSwitch = () => { - if (optionalForAllFlag.value === true) { - // Store the optional conditions in case the optionalForAllFlag is toggled on and off again + if (isOptionalForAll.value === true) { + // Store the optional conditions in case the isOptionalForAll is toggled on and off again previousOptionalConditions.value = optionalConditions.value; optionalConditions.value = []; } else { @@ -367,16 +373,14 @@ const handleOptionalForAllSwitch = () => { } }; -const optionalAllFlagAndOptionalConditionsPresent = computed(() => { - return optionalForAllFlag.value && computedConditions.value['optional']?.conditions?.length > 0; +const isOptionalForAllAndOptionalConditionsPresent = computed(() => { + return isOptionalForAll.value && computedConditions.value['optional']?.conditions?.length > 0; }); const handleReset = () => { + errorSubmitText.value = ''; assignedConditions.value = []; - // assignedEditingRows.value = []; - optionalConditions.value = []; - // optionalEditingRows.value = []; getAllConditions(props.assessment.task.id); }; @@ -384,16 +388,23 @@ const handleReset = () => { const handleSave = () => { let error = false; + console.log('assignedConditions: ', assignedConditions.value); // Check if any emppty fields in Assigned Conditions for (const condition of assignedConditions.value) { for (const [key, value] of Object.entries(condition)) { if (key != 'id' && value == '') { - errorSubmitText.value = 'Missing fields in Assigned Conditions'; - error = true; + errorSubmitText.value = 'Missing fields in Assigned Conditions'; + error = true; + } + + if (key === 'field' || key === 'op' || key === 'value') { + condition[key] = condition[key] = value.value; } } } + console.log('assignedConditions after: ', assignedConditions.value); + // Check if any emppty fields in Optional Conditions for (const condition of optionalConditions.value) { for (const [key, value] of Object.entries(condition)) { @@ -401,6 +412,10 @@ const handleSave = () => { errorSubmitText.value = 'Missing fields in Optional Conditions'; error = true; } + + if (key === 'field' || key === 'op' || key === 'value') { + condition[key] = condition[key] = value.value; + } } } @@ -409,15 +424,14 @@ const handleSave = () => { if (!error) { errorSubmitText.value = ''; - // If optionalForAllFlag is true, then overwrite optional conditions by setting optional to true + // If isOptionalForAll is true, then overwrite optional conditions by setting optional to true let conditionsCopy = computedConditions.value; console.log('conditionsCopy: ', conditionsCopy); - console.log('conditionsCopy: ', conditionsCopy); - if (optionalForAllFlag.value === true) { + if (isOptionalForAll.value === true) { conditionsCopy['optional'] = true; } - // if optionalForAllFlag is false, and there are no optional conditions, then set optional to false - if (optionalForAllFlag.value === false && !_isEmpty(optionalConditions.value)) { + // if isOptionalForAll is false, and there are no optional conditions, then set optional to false + if (isOptionalForAll.value === false && !_isEmpty(optionalConditions.value)) { conditionsCopy['optional'] = { conditions: optionalConditions.value, op: 'AND' }; } props.updateVariant(props.assessment.id, conditionsCopy); @@ -426,12 +440,6 @@ const handleSave = () => { return; }; - -const optionalConditions = ref([]); -// const assignedConditions = ref([]); -// Store optional conditions in case the optionalForAllFlag is toggled on and off again (prevents the form from resetting to the original state) -const previousOptionalConditions = ref([]); - const computedConditions = computed(() => { return { ...(!_isEmpty(optionalConditions.value) && { @@ -443,9 +451,6 @@ const computedConditions = computed(() => { }; }); -const assignedEditingRows = ref([]); -const optionalEditingRows = ref([]); - const fieldOptions = [ { label: 'Grade', value: 'studentData.grade', project: 'ROAR' }, { label: 'School Level', value: 'studentData.schoolLevel', project: 'ROAR' }, diff --git a/src/pages/HomeSelector.vue b/src/pages/HomeSelector.vue index 3da85a1ce..a29bb7611 100644 --- a/src/pages/HomeSelector.vue +++ b/src/pages/HomeSelector.vue @@ -182,17 +182,6 @@ watch([userData, userClaims], async ([newUserData, newUserClaims]) => { } }); -watch([userData, userClaims], async ([newUserData, newUserClaims]) => { - if (newUserData && newUserClaims) { - authStore.userData = newUserData; - authStore.userClaims = newUserClaims; - - const userType = toRaw(newUserData)?.userType?.toLowerCase(); - if (userType === 'parent' || userType === 'teacher') { - router.push({ name: 'Survey' }); - } - } -}); const { idle } = useIdle(60 * 10 * 1000); // 10 min const confirm = useConfirm(); From 5cd65544a92c52247415b803e58017fef6b0d6af Mon Sep 17 00:00:00 2001 From: Zio-4 Date: Wed, 17 Jul 2024 17:21:02 -0700 Subject: [PATCH 039/100] Remaining changes for conditional assignments, minor styling changes --- src/components/EditVariantDialog.vue | 176 ++++++++++++++------------- src/components/VariantCard.vue | 13 +- src/pages/HomeParticipant.vue | 2 +- src/pages/LEVANTE/RegisterUsers.vue | 12 +- 4 files changed, 109 insertions(+), 94 deletions(-) diff --git a/src/components/EditVariantDialog.vue b/src/components/EditVariantDialog.vue index 5692f5422..1650deb4c 100644 --- a/src/components/EditVariantDialog.vue +++ b/src/components/EditVariantDialog.vue @@ -3,13 +3,13 @@ class="surface-hover border-1 border-300 border-circle hover:bg-primary p-0 m-2" class="surface-hover border-1 border-300 border-circle hover:bg-primary p-0 m-2" data-cy="button-edit-variant" - @click="visible = true" + @click="isVisible = true" >
- - +
@@ -67,7 +66,7 @@
- +
-
@@ -128,7 +126,7 @@
- +
[], + }, +}); + +onMounted(() => { + getAllConditions(props.assessment.task.id); + + // NOTE: This has a bug, so it's backlogged for now + // LEVANTE assigns surveys as assessments, so we add a defualt for child only so researchers + // do not accidently assign tasks to parents and teachers + // if (isLevante) { + // assignedConditions.value.push({ + // field: { label: 'User Type', value: 'userType', project: 'LEVANTE' }, + // op: { label: 'Equal', value: 'EQUAL' }, + // value: { label: 'Child', value: 'student' }, + // }); + // } + + // props.updateVariant(props.assessment.id, { assigned: { op: 'AND', conditions: { field: 'userType', op: 'EQUAL', value: 'student' } } }); +}); + +const isVisible = ref(false); const assignedConditions = ref([]); const optionalConditions = ref([]); // Store optional conditions in case the isOptionalForAll is toggled on and off again (prevents the form from resetting to the original state) const previousOptionalConditions = ref([]); -const optionsForField = (field) => { +const computedValueOptions = (field) => { const processedField = toRaw(field); - console.log('processedField: ', processedField); if (!processedField) return - const selectedField = processedField.label; - console.log('selectedField: ', selectedField); if (selectedField === 'Grade') { return [ @@ -247,18 +276,10 @@ const optionsForField = (field) => { } } -const removeCondition = (condtions, index) => { - condtions.splice(index, 1); -}; - const computedConditionOptions = (field) => { const processedField = toRaw(field); - console.log('processedField: ', processedField); if (!processedField) return - const selectedField = processedField.label; - - console.log('selectedField: ', selectedField); if (selectedField === 'Grade') { return [ @@ -271,47 +292,27 @@ const computedConditionOptions = (field) => { ]; } else if (selectedField === 'School Level') { return [ - { label: 'Equal', value: 'EQUAL' }, - { label: 'Not Equal', value: 'NOT_EQUAL' }, + { label: 'Equal', value: 'EQUAL' }, + { label: 'Not Equal', value: 'NOT_EQUAL' }, ]; } else if (selectedField === 'User Type') { return [ - { label: 'Equal', value: 'EQUAL' }, - { label: 'Not Equal', value: 'NOT_EQUAL' }, + { label: 'Equal', value: 'EQUAL' }, + { label: 'Not Equal', value: 'NOT_EQUAL' }, ]; } } +const removeCondition = (condtions, index) => { + condtions.splice(index, 1); +}; -// --- PREVIOUS CODE --- - -const visible = ref(false); -const props = defineProps({ - assessment: { - type: Object, - required: true, - }, - updateVariant: { - type: Function, - required: true, - }, - preExistingAssessmentInfo: { - type: Array, - default: () => [], - }, -}); - -onMounted(() => { - getAllConditions(props.assessment.task.id); -}); function getAllConditions(taskId) { const existingAssignedConditions = getAssignedConditions(taskId); const existingOptionalConditions = getOptionalConditions(taskId); - console.log('existingAssignedConditions: ', existingAssignedConditions); - setAssignedConditions(existingAssignedConditions); setOptionalConditions(existingOptionalConditions); } @@ -352,15 +353,14 @@ function setOptionalConditions(existingOptionalConditions) { }; const addOptionalCondition = () => { - optionalConditions.value.push({ id: optionalConditions.value.length, field: '', op: '', value: '' }); + optionalConditions.value.push({ field: '', op: '', value: '' }); }; const addAssignedCondition = () => { - assignedConditions.value.push({ id: assignedConditions.value.length, field: '', op: '', value: '' }); + assignedConditions.value.push({ field: '', op: '', value: '' }); }; const isOptionalForAll = ref(false); - const errorSubmitText = ref(''); const handleOptionalForAllSwitch = () => { @@ -374,7 +374,7 @@ const handleOptionalForAllSwitch = () => { }; const isOptionalForAllAndOptionalConditionsPresent = computed(() => { - return isOptionalForAll.value && computedConditions.value['optional']?.conditions?.length > 0; + return isOptionalForAll.value && toRaw(previousOptionalConditions.value)?.length > 0; }); const handleReset = () => { @@ -388,68 +388,78 @@ const handleReset = () => { const handleSave = () => { let error = false; - console.log('assignedConditions: ', assignedConditions.value); // Check if any emppty fields in Assigned Conditions for (const condition of assignedConditions.value) { for (const [key, value] of Object.entries(condition)) { - if (key != 'id' && value == '') { + if (value == '') { errorSubmitText.value = 'Missing fields in Assigned Conditions'; error = true; } - - if (key === 'field' || key === 'op' || key === 'value') { - condition[key] = condition[key] = value.value; - } } } - console.log('assignedConditions after: ', assignedConditions.value); - // Check if any emppty fields in Optional Conditions for (const condition of optionalConditions.value) { for (const [key, value] of Object.entries(condition)) { - if (key != 'id' && value == '') { + if (value == '') { errorSubmitText.value = 'Missing fields in Optional Conditions'; error = true; } - - if (key === 'field' || key === 'op' || key === 'value') { - condition[key] = condition[key] = value.value; - } } } - console.log('Empty condtional fields or rows'); - - if (!error) { errorSubmitText.value = ''; // If isOptionalForAll is true, then overwrite optional conditions by setting optional to true - let conditionsCopy = computedConditions.value; - console.log('conditionsCopy: ', conditionsCopy); + const [assignedConditionsToValues, optionalConditionsToValues] = conditionsToValues() + const conditionsCopy = computedConditions(assignedConditionsToValues, optionalConditionsToValues); + if (isOptionalForAll.value === true) { conditionsCopy['optional'] = true; } - // if isOptionalForAll is false, and there are no optional conditions, then set optional to false - if (isOptionalForAll.value === false && !_isEmpty(optionalConditions.value)) { - conditionsCopy['optional'] = { conditions: optionalConditions.value, op: 'AND' }; - } + props.updateVariant(props.assessment.id, conditionsCopy); - visible.value = false; + isVisible.value = false; } + return; }; -const computedConditions = computed(() => { - return { - ...(!_isEmpty(optionalConditions.value) && { - optional: { op: 'AND', conditions: optionalConditions.value }, - }), - ...(!_isEmpty(assignedConditions.value) && { - assigned: { op: 'AND', conditions: assignedConditions.value }, - }), - }; -}); +// Conditions hold the object of the form { field: { lable: 'Grade', value: 'studentData.grade', project: ALL }, etc } +// We need to convert the conditions to the form { field: 'studnetData.grade', etc } +function conditionsToValues() { + const assignedConditionsCopy = _cloneDeep(assignedConditions.value); + const optionalConditionsCopy = _cloneDeep(optionalConditions.value); + + assignedConditionsCopy.forEach((condition) => { + for (const [key, value] of Object.entries(condition)) { + condition[key] = condition[key] = value.value; + } + }); + + optionalConditionsCopy.forEach((condition) => { + for (const [key, value] of Object.entries(condition)) { + condition[key] = condition[key] = value.value; + } + }); + + return [assignedConditionsCopy, optionalConditionsCopy]; +} + +const computedConditions = (assignedConditions, optionalConditions) => { + const conditions = {}; + + if (!_isEmpty(optionalConditions)) { + conditions.optional = { op: 'AND', conditions: optionalConditions }; + } + + if (!_isEmpty(assignedConditions)) { + conditions.assigned = { op: 'AND', conditions: assignedConditions }; + } + + return conditions; +}; + const fieldOptions = [ { label: 'Grade', value: 'studentData.grade', project: 'ROAR' }, diff --git a/src/components/VariantCard.vue b/src/components/VariantCard.vue index bd78eede5..88bf6df6a 100644 --- a/src/components/VariantCard.vue +++ b/src/components/VariantCard.vue @@ -13,9 +13,9 @@
- {{ variant.task.name }} + {{ variant.task.name }}
-
-

- Variant name: {{ variant.variant.name }}
- Variant id: {{ variant.id }} -

+
+

Variant name: {{ variant.variant.name }}

+

Variant id: {{ variant.id }}

@@ -278,6 +276,7 @@ const props = defineProps({ }, }); +const isDev = import.meta.env.MODE === 'development'; const backupImage = '/src/assets/roar-logo.png'; const showContent = ref(false); const op = ref(null); diff --git a/src/pages/HomeParticipant.vue b/src/pages/HomeParticipant.vue index bb7169e0b..3d8076bb3 100644 --- a/src/pages/HomeParticipant.vue +++ b/src/pages/HomeParticipant.vue @@ -287,7 +287,7 @@ const { const { data: surveyResponsesData } = useQuery({ queryKey: ['surveyResponses', uid], queryFn: () => fetchSubcollection(`users/${uid.value}`, 'surveyResponses'), - enabled: initialized.value && import.meta.env.MODE === 'LEVANTE', + enabled: initialized.value && isLevante, staleTime: 5 * 60 * 1000, // 5 minutes cacheTime: 10 * 60 * 1000, // refetchOnMount: false, diff --git a/src/pages/LEVANTE/RegisterUsers.vue b/src/pages/LEVANTE/RegisterUsers.vue index d68b05f1f..1b81e5763 100644 --- a/src/pages/LEVANTE/RegisterUsers.vue +++ b/src/pages/LEVANTE/RegisterUsers.vue @@ -6,13 +6,13 @@ -
+
- +
From 92ba232bd36ff14d3c11eb79d63175e62f67a03f Mon Sep 17 00:00:00 2001 From: Zio-4 Date: Mon, 26 Aug 2024 15:54:58 -0700 Subject: [PATCH 040/100] Changes for all tasks besides survey to default to child only --- src/components/EditVariantDialog.vue | 33 ++++++++++++---------------- src/components/TaskPicker.vue | 25 +++++++++++++++++---- 2 files changed, 35 insertions(+), 23 deletions(-) diff --git a/src/components/EditVariantDialog.vue b/src/components/EditVariantDialog.vue index 1650deb4c..21c4c4fd5 100644 --- a/src/components/EditVariantDialog.vue +++ b/src/components/EditVariantDialog.vue @@ -1,6 +1,5 @@