@tumaet/prompt-shared-state 1.0.13 → 1.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (113) hide show
  1. package/dist/env.js +69 -0
  2. package/dist/env.js.map +1 -0
  3. package/dist/hooks/index.js +9 -0
  4. package/dist/hooks/index.js.map +1 -0
  5. package/dist/hooks/useFileUpload.js +33 -0
  6. package/dist/hooks/useFileUpload.js.map +1 -0
  7. package/dist/hooks/useGetCoursePhase.js +11 -0
  8. package/dist/hooks/useGetCoursePhase.js.map +1 -0
  9. package/dist/hooks/useGetCoursePhaseParticipants.js +12 -0
  10. package/dist/hooks/useGetCoursePhaseParticipants.js.map +1 -0
  11. package/dist/hooks/useGetMailingIsConfigured.js +19 -0
  12. package/dist/hooks/useGetMailingIsConfigured.js.map +1 -0
  13. package/dist/hooks/useModifyCoursePhase.js +20 -0
  14. package/dist/hooks/useModifyCoursePhase.js.map +1 -0
  15. package/dist/hooks/useUpdateCoursePhaseMetaData.js +47 -0
  16. package/dist/hooks/useUpdateCoursePhaseMetaData.js.map +1 -0
  17. package/dist/hooks/useUpdateCoursePhaseParticipation.js +61 -0
  18. package/dist/hooks/useUpdateCoursePhaseParticipation.js.map +1 -0
  19. package/dist/hooks/useUpdateCoursePhaseParticipationBatch.js +17 -0
  20. package/dist/hooks/useUpdateCoursePhaseParticipationBatch.js.map +1 -0
  21. package/dist/index.js +5 -0
  22. package/dist/index.js.map +1 -1
  23. package/dist/interfaces/index.js +1 -0
  24. package/dist/interfaces/index.js.map +1 -1
  25. package/dist/interfaces/routing/extendedRouteObject.js +2 -0
  26. package/dist/interfaces/routing/extendedRouteObject.js.map +1 -0
  27. package/dist/interfaces/routing/index.js +4 -0
  28. package/dist/interfaces/routing/index.js.map +1 -0
  29. package/dist/interfaces/routing/sidebar.js +2 -0
  30. package/dist/interfaces/routing/sidebar.js.map +1 -0
  31. package/dist/interfaces/routing/studentDetail.js +2 -0
  32. package/dist/interfaces/routing/studentDetail.js.map +1 -0
  33. package/dist/lib/formatFileSize.js +9 -0
  34. package/dist/lib/formatFileSize.js.map +1 -0
  35. package/dist/lib/getCountries.js +15 -0
  36. package/dist/lib/getCountries.js.map +1 -0
  37. package/dist/lib/getGravatarUrl.js +7 -0
  38. package/dist/lib/getGravatarUrl.js.map +1 -0
  39. package/dist/lib/getStatusColor.js +13 -0
  40. package/dist/lib/getStatusColor.js.map +1 -0
  41. package/dist/lib/index.js +7 -0
  42. package/dist/lib/index.js.map +1 -0
  43. package/dist/lib/openFileDownload.js +17 -0
  44. package/dist/lib/openFileDownload.js.map +1 -0
  45. package/dist/lib/translations.json +18 -0
  46. package/dist/network/configService.js +23 -0
  47. package/dist/network/configService.js.map +1 -0
  48. package/dist/network/index.js +12 -0
  49. package/dist/network/index.js.map +1 -0
  50. package/dist/network/logNetworkError.js +21 -0
  51. package/dist/network/logNetworkError.js.map +1 -0
  52. package/dist/network/mutations/deleteApplicationFile.js +11 -0
  53. package/dist/network/mutations/deleteApplicationFile.js.map +1 -0
  54. package/dist/network/mutations/sendStatusMail.js +16 -0
  55. package/dist/network/mutations/sendStatusMail.js.map +1 -0
  56. package/dist/network/mutations/updateCoursePhase.js +16 -0
  57. package/dist/network/mutations/updateCoursePhase.js.map +1 -0
  58. package/dist/network/mutations/updateCoursePhaseParticipationBatch.js +16 -0
  59. package/dist/network/mutations/updateCoursePhaseParticipationBatch.js.map +1 -0
  60. package/dist/network/mutations/updateCoursePhaseParticipationMetaData.js +16 -0
  61. package/dist/network/mutations/updateCoursePhaseParticipationMetaData.js.map +1 -0
  62. package/dist/network/mutations/uploadFile.js +40 -0
  63. package/dist/network/mutations/uploadFile.js.map +1 -0
  64. package/dist/network/queries/getCoursePhase.js +12 -0
  65. package/dist/network/queries/getCoursePhase.js.map +1 -0
  66. package/dist/network/queries/getCoursePhaseParticipationStatusCounts.js +13 -0
  67. package/dist/network/queries/getCoursePhaseParticipationStatusCounts.js.map +1 -0
  68. package/dist/network/queries/getCoursePhaseParticipations.js +12 -0
  69. package/dist/network/queries/getCoursePhaseParticipations.js.map +1 -0
  70. package/dist/network/queries/getOwnCoursePhaseParticipation.js +12 -0
  71. package/dist/network/queries/getOwnCoursePhaseParticipation.js.map +1 -0
  72. package/dist/types/env.d.ts +28 -0
  73. package/dist/types/hooks/index.d.ts +8 -0
  74. package/dist/types/hooks/useFileUpload.d.ts +13 -0
  75. package/dist/types/hooks/useGetCoursePhase.d.ts +2 -0
  76. package/dist/types/hooks/useGetCoursePhaseParticipants.d.ts +2 -0
  77. package/dist/types/hooks/useGetMailingIsConfigured.d.ts +1 -0
  78. package/dist/types/hooks/useModifyCoursePhase.d.ts +2 -0
  79. package/dist/types/hooks/useUpdateCoursePhaseMetaData.d.ts +7 -0
  80. package/dist/types/hooks/useUpdateCoursePhaseParticipation.d.ts +7 -0
  81. package/dist/types/hooks/useUpdateCoursePhaseParticipationBatch.d.ts +3 -0
  82. package/dist/types/index.d.ts +5 -0
  83. package/dist/types/interfaces/index.d.ts +1 -0
  84. package/dist/types/interfaces/routing/extendedRouteObject.d.ts +5 -0
  85. package/dist/types/interfaces/routing/index.d.ts +3 -0
  86. package/dist/types/interfaces/routing/sidebar.d.ts +13 -0
  87. package/dist/types/interfaces/routing/studentDetail.d.ts +6 -0
  88. package/dist/types/lib/formatFileSize.d.ts +1 -0
  89. package/dist/types/lib/getCountries.d.ts +5 -0
  90. package/dist/types/lib/getGravatarUrl.d.ts +1 -0
  91. package/dist/types/lib/getStatusColor.d.ts +2 -0
  92. package/dist/types/lib/index.d.ts +6 -0
  93. package/dist/types/lib/openFileDownload.d.ts +6 -0
  94. package/dist/types/network/configService.d.ts +8 -0
  95. package/dist/types/network/index.d.ts +11 -0
  96. package/dist/types/network/logNetworkError.d.ts +1 -0
  97. package/dist/types/network/mutations/deleteApplicationFile.d.ts +1 -0
  98. package/dist/types/network/mutations/sendStatusMail.d.ts +2 -0
  99. package/dist/types/network/mutations/updateCoursePhase.d.ts +2 -0
  100. package/dist/types/network/mutations/updateCoursePhaseParticipationBatch.d.ts +2 -0
  101. package/dist/types/network/mutations/updateCoursePhaseParticipationMetaData.d.ts +2 -0
  102. package/dist/types/network/mutations/uploadFile.d.ts +25 -0
  103. package/dist/types/network/queries/getCoursePhase.d.ts +2 -0
  104. package/dist/types/network/queries/getCoursePhaseParticipationStatusCounts.d.ts +4 -0
  105. package/dist/types/network/queries/getCoursePhaseParticipations.d.ts +2 -0
  106. package/dist/types/network/queries/getOwnCoursePhaseParticipation.d.ts +2 -0
  107. package/dist/types/utils/index.d.ts +1 -0
  108. package/dist/types/utils/parseURL.d.ts +1 -0
  109. package/dist/utils/index.js +2 -0
  110. package/dist/utils/index.js.map +1 -0
  111. package/dist/utils/parseURL.js +15 -0
  112. package/dist/utils/parseURL.js.map +1 -0
  113. package/package.json +15 -3
@@ -0,0 +1,11 @@
1
+ import { axiosInstance } from '../configService';
2
+ export const deleteApplicationFile = async (coursePhaseId, fileId) => {
3
+ if (!coursePhaseId) {
4
+ throw new Error('coursePhaseId is required to delete a file');
5
+ }
6
+ if (!fileId) {
7
+ throw new Error('fileId is required to delete a file');
8
+ }
9
+ await axiosInstance.delete(`/api/apply/authenticated/${coursePhaseId}/files/${fileId}`);
10
+ };
11
+ //# sourceMappingURL=deleteApplicationFile.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"deleteApplicationFile.js","sourceRoot":"","sources":["../../../src/network/mutations/deleteApplicationFile.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAA;AAEhD,MAAM,CAAC,MAAM,qBAAqB,GAAG,KAAK,EACxC,aAAqB,EACrB,MAAc,EACC,EAAE;IACjB,IAAI,CAAC,aAAa,EAAE,CAAC;QACnB,MAAM,IAAI,KAAK,CAAC,4CAA4C,CAAC,CAAA;IAC/D,CAAC;IACD,IAAI,CAAC,MAAM,EAAE,CAAC;QACZ,MAAM,IAAI,KAAK,CAAC,qCAAqC,CAAC,CAAA;IACxD,CAAC;IAED,MAAM,aAAa,CAAC,MAAM,CAAC,4BAA4B,aAAa,UAAU,MAAM,EAAE,CAAC,CAAA;AACzF,CAAC,CAAA"}
@@ -0,0 +1,16 @@
1
+ import { axiosInstance } from '../configService';
2
+ import { logNetworkError } from '../logNetworkError';
3
+ export const sendStatusMail = async (coursePhaseID, status) => {
4
+ try {
5
+ return (await axiosInstance.put(`/api/mailing/${coursePhaseID}`, status, {
6
+ headers: {
7
+ 'Content-Type': 'application/json',
8
+ },
9
+ })).data;
10
+ }
11
+ catch (err) {
12
+ logNetworkError('Error sending status mail', err);
13
+ throw err;
14
+ }
15
+ };
16
+ //# sourceMappingURL=sendStatusMail.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"sendStatusMail.js","sourceRoot":"","sources":["../../../src/network/mutations/sendStatusMail.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAA;AAEhD,OAAO,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAA;AAEpD,MAAM,CAAC,MAAM,cAAc,GAAG,KAAK,EACjC,aAAqB,EACrB,MAAsB,EACE,EAAE;IAC1B,IAAI,CAAC;QACH,OAAO,CACL,MAAM,aAAa,CAAC,GAAG,CAAC,gBAAgB,aAAa,EAAE,EAAE,MAAM,EAAE;YAC/D,OAAO,EAAE;gBACP,cAAc,EAAE,kBAAkB;aACnC;SACF,CAAC,CACH,CAAC,IAAI,CAAA;IACR,CAAC;IAAC,OAAO,GAAG,EAAE,CAAC;QACb,eAAe,CAAC,2BAA2B,EAAE,GAAG,CAAC,CAAA;QACjD,MAAM,GAAG,CAAA;IACX,CAAC;AACH,CAAC,CAAA"}
@@ -0,0 +1,16 @@
1
+ import { axiosInstance } from '../configService';
2
+ import { logNetworkError } from '../logNetworkError';
3
+ export const updateCoursePhase = async (coursePhase) => {
4
+ try {
5
+ return (await axiosInstance.put(`/api/course_phases/${coursePhase.id}`, coursePhase, {
6
+ headers: {
7
+ 'Content-Type': 'application/json',
8
+ },
9
+ })).data.id; // try to get the id of the created course
10
+ }
11
+ catch (err) {
12
+ logNetworkError('Error updating course phase', err);
13
+ throw err;
14
+ }
15
+ };
16
+ //# sourceMappingURL=updateCoursePhase.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"updateCoursePhase.js","sourceRoot":"","sources":["../../../src/network/mutations/updateCoursePhase.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAA;AAChD,OAAO,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAA;AAEpD,MAAM,CAAC,MAAM,iBAAiB,GAAG,KAAK,EACpC,WAA8B,EACD,EAAE;IAC/B,IAAI,CAAC;QACH,OAAO,CACL,MAAM,aAAa,CAAC,GAAG,CAAC,sBAAsB,WAAW,CAAC,EAAE,EAAE,EAAE,WAAW,EAAE;YAC3E,OAAO,EAAE;gBACP,cAAc,EAAE,kBAAkB;aACnC;SACF,CAAC,CACH,CAAC,IAAI,CAAC,EAAE,CAAA,CAAC,0CAA0C;IACtD,CAAC;IAAC,OAAO,GAAG,EAAE,CAAC;QACb,eAAe,CAAC,6BAA6B,EAAE,GAAG,CAAC,CAAA;QACnD,MAAM,GAAG,CAAA;IACX,CAAC;AACH,CAAC,CAAA"}
@@ -0,0 +1,16 @@
1
+ import { axiosInstance } from '../configService';
2
+ import { logNetworkError } from '../logNetworkError';
3
+ export const updateCoursePhaseParticipationBatch = async (coursePhaseID, updateParticipations) => {
4
+ try {
5
+ await axiosInstance.put(`/api/course_phases/${coursePhaseID}/participations`, updateParticipations, {
6
+ headers: {
7
+ 'Content-Type': 'application/json',
8
+ },
9
+ });
10
+ }
11
+ catch (err) {
12
+ logNetworkError('Error updating course phase participation batch', err);
13
+ throw err;
14
+ }
15
+ };
16
+ //# sourceMappingURL=updateCoursePhaseParticipationBatch.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"updateCoursePhaseParticipationBatch.js","sourceRoot":"","sources":["../../../src/network/mutations/updateCoursePhaseParticipationBatch.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAA;AAChD,OAAO,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAA;AAGpD,MAAM,CAAC,MAAM,mCAAmC,GAAG,KAAK,EACtD,aAAqB,EACrB,oBAAsD,EACvC,EAAE;IACjB,IAAI,CAAC;QACH,MAAM,aAAa,CAAC,GAAG,CACrB,sBAAsB,aAAa,iBAAiB,EACpD,oBAAoB,EACpB;YACE,OAAO,EAAE;gBACP,cAAc,EAAE,kBAAkB;aACnC;SACF,CACF,CAAA;IACH,CAAC;IAAC,OAAO,GAAG,EAAE,CAAC;QACb,eAAe,CAAC,iDAAiD,EAAE,GAAG,CAAC,CAAA;QACvE,MAAM,GAAG,CAAA;IACX,CAAC;AACH,CAAC,CAAA"}
@@ -0,0 +1,16 @@
1
+ import { axiosInstance } from '../configService';
2
+ import { logNetworkError } from '../logNetworkError';
3
+ export const updateCoursePhaseParticipation = async (participation) => {
4
+ try {
5
+ return (await axiosInstance.put(`/api/course_phases/${participation.coursePhaseID}/participations/${participation.courseParticipationID}`, participation, {
6
+ headers: {
7
+ 'Content-Type': 'application/json',
8
+ },
9
+ })).data.id; // try to get the id of the updated participation
10
+ }
11
+ catch (err) {
12
+ logNetworkError('Error updating course phase participation metadata', err);
13
+ throw err;
14
+ }
15
+ };
16
+ //# sourceMappingURL=updateCoursePhaseParticipationMetaData.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"updateCoursePhaseParticipationMetaData.js","sourceRoot":"","sources":["../../../src/network/mutations/updateCoursePhaseParticipationMetaData.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAA;AAChD,OAAO,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAA;AAGpD,MAAM,CAAC,MAAM,8BAA8B,GAAG,KAAK,EACjD,aAA6C,EAChB,EAAE;IAC/B,IAAI,CAAC;QACH,OAAO,CACL,MAAM,aAAa,CAAC,GAAG,CACrB,sBAAsB,aAAa,CAAC,aAAa,mBAAmB,aAAa,CAAC,qBAAqB,EAAE,EACzG,aAAa,EACb;YACE,OAAO,EAAE;gBACP,cAAc,EAAE,kBAAkB;aACnC;SACF,CACF,CACF,CAAC,IAAI,CAAC,EAAE,CAAA,CAAC,iDAAiD;IAC7D,CAAC;IAAC,OAAO,GAAG,EAAE,CAAC;QACb,eAAe,CAAC,oDAAoD,EAAE,GAAG,CAAC,CAAA;QAC1E,MAAM,GAAG,CAAA;IACX,CAAC;AACH,CAAC,CAAA"}
@@ -0,0 +1,40 @@
1
+ import axios from 'axios';
2
+ import { axiosInstance } from '../configService';
3
+ export const uploadFile = async (params) => {
4
+ const contentType = params.file.type || 'application/octet-stream';
5
+ try {
6
+ if (!params.coursePhaseId) {
7
+ throw new Error('coursePhaseId is required for file uploads');
8
+ }
9
+ const isAuthenticated = !!localStorage.getItem('jwt_token');
10
+ const basePath = isAuthenticated
11
+ ? `/api/apply/authenticated/${params.coursePhaseId}`
12
+ : `/api/apply/${params.coursePhaseId}`;
13
+ const presignResponse = await axiosInstance.post(`${basePath}/files/presign`, {
14
+ filename: params.file.name,
15
+ contentType,
16
+ description: params.description,
17
+ tags: params.tags,
18
+ });
19
+ const { uploadUrl, storageKey } = presignResponse.data;
20
+ await axios.put(uploadUrl, params.file, {
21
+ headers: {
22
+ 'Content-Type': contentType,
23
+ },
24
+ onUploadProgress: params.onUploadProgress,
25
+ });
26
+ const completeResponse = await axiosInstance.post(`${basePath}/files/complete`, {
27
+ storageKey,
28
+ originalFilename: params.file.name,
29
+ contentType,
30
+ description: params.description,
31
+ tags: params.tags,
32
+ });
33
+ return completeResponse.data;
34
+ }
35
+ catch (err) {
36
+ console.error('File upload failed:', err);
37
+ throw err;
38
+ }
39
+ };
40
+ //# sourceMappingURL=uploadFile.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"uploadFile.js","sourceRoot":"","sources":["../../../src/network/mutations/uploadFile.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAA;AACzB,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAA;AA4BhD,MAAM,CAAC,MAAM,UAAU,GAAG,KAAK,EAAE,MAAwB,EAAyB,EAAE;IAClF,MAAM,WAAW,GAAG,MAAM,CAAC,IAAI,CAAC,IAAI,IAAI,0BAA0B,CAAA;IAElE,IAAI,CAAC;QACH,IAAI,CAAC,MAAM,CAAC,aAAa,EAAE,CAAC;YAC1B,MAAM,IAAI,KAAK,CAAC,4CAA4C,CAAC,CAAA;QAC/D,CAAC;QAED,MAAM,eAAe,GAAG,CAAC,CAAC,YAAY,CAAC,OAAO,CAAC,WAAW,CAAC,CAAA;QAC3D,MAAM,QAAQ,GAAG,eAAe;YAC9B,CAAC,CAAC,4BAA4B,MAAM,CAAC,aAAa,EAAE;YACpD,CAAC,CAAC,cAAc,MAAM,CAAC,aAAa,EAAE,CAAA;QAExC,MAAM,eAAe,GAAG,MAAM,aAAa,CAAC,IAAI,CAAC,GAAG,QAAQ,gBAAgB,EAAE;YAC5E,QAAQ,EAAE,MAAM,CAAC,IAAI,CAAC,IAAI;YAC1B,WAAW;YACX,WAAW,EAAE,MAAM,CAAC,WAAW;YAC/B,IAAI,EAAE,MAAM,CAAC,IAAI;SAClB,CAAC,CAAA;QAEF,MAAM,EAAE,SAAS,EAAE,UAAU,EAAE,GAAG,eAAe,CAAC,IAAI,CAAA;QAEtD,MAAM,KAAK,CAAC,GAAG,CAAC,SAAS,EAAE,MAAM,CAAC,IAAI,EAAE;YACtC,OAAO,EAAE;gBACP,cAAc,EAAE,WAAW;aAC5B;YACD,gBAAgB,EAAE,MAAM,CAAC,gBAAgB;SAC1C,CAAC,CAAA;QAEF,MAAM,gBAAgB,GAAG,MAAM,aAAa,CAAC,IAAI,CAAC,GAAG,QAAQ,iBAAiB,EAAE;YAC9E,UAAU;YACV,gBAAgB,EAAE,MAAM,CAAC,IAAI,CAAC,IAAI;YAClC,WAAW;YACX,WAAW,EAAE,MAAM,CAAC,WAAW;YAC/B,IAAI,EAAE,MAAM,CAAC,IAAI;SAClB,CAAC,CAAA;QAEF,OAAO,gBAAgB,CAAC,IAAI,CAAA;IAC9B,CAAC;IAAC,OAAO,GAAG,EAAE,CAAC;QACb,OAAO,CAAC,KAAK,CAAC,qBAAqB,EAAE,GAAG,CAAC,CAAA;QACzC,MAAM,GAAG,CAAA;IACX,CAAC;AACH,CAAC,CAAA"}
@@ -0,0 +1,12 @@
1
+ import { axiosInstance } from '../configService';
2
+ import { logNetworkError } from '../logNetworkError';
3
+ export const getCoursePhase = async (coursePhaseID) => {
4
+ try {
5
+ return (await axiosInstance.get(`/api/course_phases/${coursePhaseID}`)).data;
6
+ }
7
+ catch (err) {
8
+ logNetworkError('Error fetching course phase', err);
9
+ throw err;
10
+ }
11
+ };
12
+ //# sourceMappingURL=getCoursePhase.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"getCoursePhase.js","sourceRoot":"","sources":["../../../src/network/queries/getCoursePhase.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAA;AAChD,OAAO,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAA;AAGpD,MAAM,CAAC,MAAM,cAAc,GAAG,KAAK,EAAE,aAAqB,EAAoC,EAAE;IAC9F,IAAI,CAAC;QACH,OAAO,CAAC,MAAM,aAAa,CAAC,GAAG,CAAC,sBAAsB,aAAa,EAAE,CAAC,CAAC,CAAC,IAAI,CAAA;IAC9E,CAAC;IAAC,OAAO,GAAG,EAAE,CAAC;QACb,eAAe,CAAC,6BAA6B,EAAE,GAAG,CAAC,CAAA;QACnD,MAAM,GAAG,CAAA;IACX,CAAC;AACH,CAAC,CAAA"}
@@ -0,0 +1,13 @@
1
+ import { axiosInstance } from '../configService';
2
+ import { logNetworkError } from '../logNetworkError';
3
+ export const getCoursePhaseParticipationStatusCounts = async (phaseId) => {
4
+ try {
5
+ const data = (await axiosInstance.get(`/api/course_phases/${phaseId}/participation_status_counts`)).data;
6
+ return data;
7
+ }
8
+ catch (err) {
9
+ logNetworkError('Error fetching course phase participation status counts', err);
10
+ throw err;
11
+ }
12
+ };
13
+ //# sourceMappingURL=getCoursePhaseParticipationStatusCounts.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"getCoursePhaseParticipationStatusCounts.js","sourceRoot":"","sources":["../../../src/network/queries/getCoursePhaseParticipationStatusCounts.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAA;AAChD,OAAO,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAA;AAMpD,MAAM,CAAC,MAAM,uCAAuC,GAAG,KAAK,EAC1D,OAAe,EACgC,EAAE;IACjD,IAAI,CAAC;QACH,MAAM,IAAI,GAAyC,CACjD,MAAM,aAAa,CAAC,GAAG,CAAC,sBAAsB,OAAO,8BAA8B,CAAC,CACrF,CAAC,IAAI,CAAA;QACN,OAAO,IAAI,CAAA;IACb,CAAC;IAAC,OAAO,GAAG,EAAE,CAAC;QACb,eAAe,CAAC,yDAAyD,EAAE,GAAG,CAAC,CAAA;QAC/E,MAAM,GAAG,CAAA;IACX,CAAC;AACH,CAAC,CAAA"}
@@ -0,0 +1,12 @@
1
+ import { axiosInstance } from '../configService';
2
+ import { logNetworkError } from '../logNetworkError';
3
+ export const getCoursePhaseParticipations = async (coursePhaseID) => {
4
+ try {
5
+ return (await axiosInstance.get(`/api/course_phases/${coursePhaseID}/participations`)).data;
6
+ }
7
+ catch (err) {
8
+ logNetworkError('Error fetching course phase participations', err);
9
+ throw err;
10
+ }
11
+ };
12
+ //# sourceMappingURL=getCoursePhaseParticipations.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"getCoursePhaseParticipations.js","sourceRoot":"","sources":["../../../src/network/queries/getCoursePhaseParticipations.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAA;AAChD,OAAO,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAA;AAGpD,MAAM,CAAC,MAAM,4BAA4B,GAAG,KAAK,EAC/C,aAAqB,EAC6B,EAAE;IACpD,IAAI,CAAC;QACH,OAAO,CAAC,MAAM,aAAa,CAAC,GAAG,CAAC,sBAAsB,aAAa,iBAAiB,CAAC,CAAC,CAAC,IAAI,CAAA;IAC7F,CAAC;IAAC,OAAO,GAAG,EAAE,CAAC;QACb,eAAe,CAAC,4CAA4C,EAAE,GAAG,CAAC,CAAA;QAClE,MAAM,GAAG,CAAA;IACX,CAAC;AACH,CAAC,CAAA"}
@@ -0,0 +1,12 @@
1
+ import { axiosInstance } from '../configService';
2
+ import { logNetworkError } from '../logNetworkError';
3
+ export const getOwnCoursePhaseParticipation = async (coursePhaseID) => {
4
+ try {
5
+ return (await axiosInstance.get(`/api/course_phases/${coursePhaseID}/participations/self`)).data;
6
+ }
7
+ catch (err) {
8
+ logNetworkError('Error fetching own course phase participation', err);
9
+ throw err;
10
+ }
11
+ };
12
+ //# sourceMappingURL=getOwnCoursePhaseParticipation.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"getOwnCoursePhaseParticipation.js","sourceRoot":"","sources":["../../../src/network/queries/getOwnCoursePhaseParticipation.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAA;AAChD,OAAO,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAA;AAGpD,MAAM,CAAC,MAAM,8BAA8B,GAAG,KAAK,EACjD,aAAqB,EACyB,EAAE;IAChD,IAAI,CAAC;QACH,OAAO,CAAC,MAAM,aAAa,CAAC,GAAG,CAAC,sBAAsB,aAAa,sBAAsB,CAAC,CAAC,CAAC,IAAI,CAAA;IAClG,CAAC;IAAC,OAAO,GAAG,EAAE,CAAC;QACb,eAAe,CAAC,+CAA+C,EAAE,GAAG,CAAC,CAAA;QACrE,MAAM,GAAG,CAAA;IACX,CAAC;AACH,CAAC,CAAA"}
@@ -0,0 +1,28 @@
1
+ type Environment = 'development' | 'staging' | 'production';
2
+ type EnvType = {
3
+ ENVIRONMENT: Environment;
4
+ CORE_HOST: string;
5
+ INTRO_COURSE_HOST: string;
6
+ TEAM_ALLOCATION_HOST: string;
7
+ ASSESSMENT_HOST: string;
8
+ DEVOPS_CHALLENGE_HOST: string;
9
+ INTERVIEW_HOST: string;
10
+ KEYCLOAK_HOST: string;
11
+ KEYCLOAK_REALM_NAME: string;
12
+ CHAIR_NAME_LONG: string;
13
+ CHAIR_NAME_SHORT: string;
14
+ GITHUB_SHA: string;
15
+ GITHUB_REF: string;
16
+ SERVER_IMAGE_TAG: string;
17
+ SELF_TEAM_ALLOCATION_HOST: string;
18
+ TEMPLATE_HOST: string;
19
+ CERTIFICATE_HOST: string;
20
+ SENTRY_DSN_CLIENT: string;
21
+ };
22
+ declare global {
23
+ interface Window {
24
+ env: Partial<EnvType>;
25
+ }
26
+ }
27
+ export declare const env: EnvType;
28
+ export {};
@@ -0,0 +1,8 @@
1
+ export * from './useFileUpload';
2
+ export * from './useGetCoursePhase';
3
+ export * from './useGetCoursePhaseParticipants';
4
+ export * from './useGetMailingIsConfigured';
5
+ export * from './useModifyCoursePhase';
6
+ export * from './useUpdateCoursePhaseMetaData';
7
+ export * from './useUpdateCoursePhaseParticipation';
8
+ export * from './useUpdateCoursePhaseParticipationBatch';
@@ -0,0 +1,13 @@
1
+ import { UseMutationResult } from '@tanstack/react-query';
2
+ import { FileUploadParams, FileResponse } from '../network/mutations/uploadFile';
3
+ interface UseFileUploadOptions {
4
+ onSuccess?: (data: FileResponse) => void;
5
+ onError?: (error: Error) => void;
6
+ }
7
+ interface UseFileUploadReturn {
8
+ upload: UseMutationResult<FileResponse, Error, FileUploadParams, unknown>;
9
+ uploadProgress: number;
10
+ isUploading: boolean;
11
+ }
12
+ export declare const useFileUpload: (options?: UseFileUploadOptions) => UseFileUploadReturn;
13
+ export {};
@@ -0,0 +1,2 @@
1
+ import { CoursePhaseWithMetaData } from '../interfaces';
2
+ export declare const useGetCoursePhase: () => import("@tanstack/react-query").UseQueryResult<CoursePhaseWithMetaData, Error>;
@@ -0,0 +1,2 @@
1
+ import { CoursePhaseParticipationsWithResolution } from '../interfaces';
2
+ export declare const useGetCoursePhaseParticipants: () => import("@tanstack/react-query").UseQueryResult<CoursePhaseParticipationsWithResolution, Error>;
@@ -0,0 +1 @@
1
+ export declare const useGetMailingIsConfigured: () => boolean;
@@ -0,0 +1,2 @@
1
+ import { UpdateCoursePhase } from '../interfaces';
2
+ export declare const useModifyCoursePhase: (onSuccess: () => void, onError: () => void) => import("@tanstack/react-query").UseMutationResult<string | undefined, Error, UpdateCoursePhase, unknown>;
@@ -0,0 +1,7 @@
1
+ import { UseMutationResult } from '@tanstack/react-query';
2
+ import { UpdateCoursePhase, CoursePhaseWithMetaData } from '../interfaces';
3
+ interface MutationContext {
4
+ previousCoursePhase?: CoursePhaseWithMetaData;
5
+ }
6
+ export declare const useUpdateCoursePhaseMetaData: () => UseMutationResult<string | undefined, Error, UpdateCoursePhase, MutationContext>;
7
+ export {};
@@ -0,0 +1,7 @@
1
+ import { UseMutationResult } from '@tanstack/react-query';
2
+ import { UpdateCoursePhaseParticipation, CoursePhaseParticipationWithStudent, CoursePhaseParticipationsWithResolution } from '../interfaces';
3
+ interface MutationContext {
4
+ previousParticipants?: CoursePhaseParticipationsWithResolution | CoursePhaseParticipationWithStudent[];
5
+ }
6
+ export declare const useUpdateCoursePhaseParticipation: () => UseMutationResult<string | undefined, Error, UpdateCoursePhaseParticipation, MutationContext>;
7
+ export {};
@@ -0,0 +1,3 @@
1
+ import { UseMutationResult } from '@tanstack/react-query';
2
+ import { UpdateCoursePhaseParticipation } from '../interfaces';
3
+ export declare const useUpdateCoursePhaseParticipationBatch: () => UseMutationResult<void, Error, UpdateCoursePhaseParticipation[], unknown>;
@@ -1,2 +1,7 @@
1
1
  export * from './interfaces';
2
2
  export * from './zustand';
3
+ export * from './hooks';
4
+ export * from './network';
5
+ export * from './lib';
6
+ export * from './utils';
7
+ export * from './env';
@@ -10,3 +10,4 @@ export * from './roles';
10
10
  export * from './student';
11
11
  export * from './team';
12
12
  export * from './user';
13
+ export * from './routing';
@@ -0,0 +1,5 @@
1
+ import { RouteObject } from 'react-router-dom';
2
+ import { Role } from '..';
3
+ export type ExtendedRouteObject = RouteObject & {
4
+ requiredPermissions?: Role[];
5
+ };
@@ -0,0 +1,3 @@
1
+ export * from './extendedRouteObject';
2
+ export * from './sidebar';
3
+ export * from './studentDetail';
@@ -0,0 +1,13 @@
1
+ import { Role } from '..';
2
+ import { ReactNode } from 'react';
3
+ export interface SidebarMenuItemProps {
4
+ goToPath: string;
5
+ icon: ReactNode;
6
+ title: string;
7
+ requiredPermissions?: Role[];
8
+ subitems?: {
9
+ goToPath: string;
10
+ title: string;
11
+ requiredPermissions?: Role[];
12
+ }[];
13
+ }
@@ -0,0 +1,6 @@
1
+ export interface CoursePhaseStudentIdentifierProps {
2
+ studentId: string;
3
+ coursePhaseId: string;
4
+ courseId: string;
5
+ courseParticipationId: string;
6
+ }
@@ -0,0 +1 @@
1
+ export declare const formatFileSize: (bytes: number) => string;
@@ -0,0 +1,5 @@
1
+ export declare const countriesArr: {
2
+ label: string;
3
+ value: string;
4
+ }[];
5
+ export declare const getCountryName: (code: string) => string | undefined;
@@ -0,0 +1 @@
1
+ export declare const getGravatarUrl: (email: string, size?: number) => string;
@@ -0,0 +1,2 @@
1
+ import { PassStatus } from '../interfaces';
2
+ export declare const getStatusColor: (assessmentStatus: PassStatus) => "bg-green-500 dark:bg-green-700" | "bg-red-500 dark:bg-red-700" | "bg-gray-500 dark:bg-gray-700";
@@ -0,0 +1,6 @@
1
+ export * from './formatFileSize';
2
+ export * from './getCountries';
3
+ export * from './getGravatarUrl';
4
+ export * from './getStatusColor';
5
+ export * from './openFileDownload';
6
+ export { default as translations } from './translations.json';
@@ -0,0 +1,6 @@
1
+ type OpenFileDownloadParams = {
2
+ downloadUrl: string;
3
+ fileName?: string;
4
+ };
5
+ export declare const openFileDownload: ({ downloadUrl, fileName, }: OpenFileDownloadParams) => Promise<void>;
6
+ export {};
@@ -0,0 +1,8 @@
1
+ export interface Patch {
2
+ op: 'replace' | 'add' | 'remove' | 'copy';
3
+ path: string;
4
+ value: string;
5
+ }
6
+ declare const authenticatedAxiosInstance: import("axios").AxiosInstance;
7
+ declare const notAuthenticatedAxiosInstance: import("axios").AxiosInstance;
8
+ export { authenticatedAxiosInstance as axiosInstance, notAuthenticatedAxiosInstance };
@@ -0,0 +1,11 @@
1
+ export * from './configService';
2
+ export * from './mutations/deleteApplicationFile';
3
+ export * from './mutations/sendStatusMail';
4
+ export * from './mutations/updateCoursePhase';
5
+ export * from './mutations/updateCoursePhaseParticipationBatch';
6
+ export * from './mutations/updateCoursePhaseParticipationMetaData';
7
+ export * from './mutations/uploadFile';
8
+ export * from './queries/getCoursePhase';
9
+ export * from './queries/getCoursePhaseParticipationStatusCounts';
10
+ export * from './queries/getCoursePhaseParticipations';
11
+ export * from './queries/getOwnCoursePhaseParticipation';
@@ -0,0 +1 @@
1
+ export declare const logNetworkError: (message: string, err: unknown) => void;
@@ -0,0 +1 @@
1
+ export declare const deleteApplicationFile: (coursePhaseId: string, fileId: string) => Promise<void>;
@@ -0,0 +1,2 @@
1
+ import { SendStatusMail, MailingReport } from '../../interfaces';
2
+ export declare const sendStatusMail: (coursePhaseID: string, status: SendStatusMail) => Promise<MailingReport>;
@@ -0,0 +1,2 @@
1
+ import { UpdateCoursePhase } from '../../interfaces';
2
+ export declare const updateCoursePhase: (coursePhase: UpdateCoursePhase) => Promise<string | undefined>;
@@ -0,0 +1,2 @@
1
+ import { UpdateCoursePhaseParticipation } from '../../interfaces';
2
+ export declare const updateCoursePhaseParticipationBatch: (coursePhaseID: string, updateParticipations: UpdateCoursePhaseParticipation[]) => Promise<void>;
@@ -0,0 +1,2 @@
1
+ import { UpdateCoursePhaseParticipation } from '../../interfaces';
2
+ export declare const updateCoursePhaseParticipation: (participation: UpdateCoursePhaseParticipation) => Promise<string | undefined>;
@@ -0,0 +1,25 @@
1
+ export interface FileUploadParams {
2
+ file: File;
3
+ coursePhaseId?: string;
4
+ description?: string;
5
+ tags?: string;
6
+ onUploadProgress?: (progressEvent: any) => void;
7
+ }
8
+ export interface FileResponse {
9
+ id: string;
10
+ filename: string;
11
+ originalFilename: string;
12
+ contentType: string;
13
+ sizeBytes: number;
14
+ storageKey: string;
15
+ downloadUrl: string;
16
+ uploadedByUserId: string;
17
+ uploadedByEmail?: string;
18
+ applicationId?: string;
19
+ coursePhaseId?: string;
20
+ description?: string;
21
+ tags?: string[];
22
+ createdAt: string;
23
+ updatedAt: string;
24
+ }
25
+ export declare const uploadFile: (params: FileUploadParams) => Promise<FileResponse>;
@@ -0,0 +1,2 @@
1
+ import { CoursePhaseWithMetaData } from '../../interfaces';
2
+ export declare const getCoursePhase: (coursePhaseID: string) => Promise<CoursePhaseWithMetaData>;
@@ -0,0 +1,4 @@
1
+ export interface CoursePhaseParticipationStatusCounts {
2
+ [key: string]: number;
3
+ }
4
+ export declare const getCoursePhaseParticipationStatusCounts: (phaseId: string) => Promise<CoursePhaseParticipationStatusCounts>;
@@ -0,0 +1,2 @@
1
+ import { CoursePhaseParticipationsWithResolution } from '../../interfaces';
2
+ export declare const getCoursePhaseParticipations: (coursePhaseID: string) => Promise<CoursePhaseParticipationsWithResolution>;
@@ -0,0 +1,2 @@
1
+ import { CoursePhaseParticipationWithStudent } from '../../interfaces';
2
+ export declare const getOwnCoursePhaseParticipation: (coursePhaseID: string) => Promise<CoursePhaseParticipationWithStudent>;
@@ -0,0 +1 @@
1
+ export * from './parseURL';
@@ -0,0 +1 @@
1
+ export declare const parseURL: (envURL: string) => string;
@@ -0,0 +1,2 @@
1
+ export * from './parseURL';
2
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/utils/index.ts"],"names":[],"mappings":"AAAA,cAAc,YAAY,CAAA"}
@@ -0,0 +1,15 @@
1
+ export const parseURL = (envURL) => {
2
+ if (envURL === '') {
3
+ if (typeof window !== 'undefined') {
4
+ return window.location.origin; // defaults to location
5
+ }
6
+ return '';
7
+ }
8
+ else if (envURL.startsWith('http')) {
9
+ return envURL; // absolute URL
10
+ }
11
+ else {
12
+ return `https://${envURL}`; // relative URL
13
+ }
14
+ };
15
+ //# sourceMappingURL=parseURL.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"parseURL.js","sourceRoot":"","sources":["../../src/utils/parseURL.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,QAAQ,GAAG,CAAC,MAAc,EAAU,EAAE;IACjD,IAAI,MAAM,KAAK,EAAE,EAAE,CAAC;QAClB,IAAI,OAAO,MAAM,KAAK,WAAW,EAAE,CAAC;YAClC,OAAO,MAAM,CAAC,QAAQ,CAAC,MAAM,CAAA,CAAC,uBAAuB;QACvD,CAAC;QAED,OAAO,EAAE,CAAA;IACX,CAAC;SAAM,IAAI,MAAM,CAAC,UAAU,CAAC,MAAM,CAAC,EAAE,CAAC;QACrC,OAAO,MAAM,CAAA,CAAC,eAAe;IAC/B,CAAC;SAAM,CAAC;QACN,OAAO,WAAW,MAAM,EAAE,CAAA,CAAC,eAAe;IAC5C,CAAC;AACH,CAAC,CAAA"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tumaet/prompt-shared-state",
3
- "version": "1.0.13",
3
+ "version": "1.1.0",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "git+https://github.com/prompt-edu/prompt-shared-state.git"
@@ -23,17 +23,29 @@
23
23
  },
24
24
  "packageManager": "yarn@4.14.1",
25
25
  "dependencies": {
26
+ "axios": "^1.15.2",
27
+ "i18n-iso-countries": "^7.14.0",
28
+ "js-sha256": "^0.11.1",
26
29
  "typescript": "^5.9.3",
27
30
  "zustand": "^5.0.12"
28
31
  },
32
+ "peerDependencies": {
33
+ "@tanstack/react-query": "^5.99.2",
34
+ "react": "^19.2.5",
35
+ "react-router-dom": "^7.14.1"
36
+ },
29
37
  "devDependencies": {
38
+ "@tanstack/react-query": "^5.99.2",
39
+ "@types/react": "^19.2.14",
30
40
  "@typescript-eslint/eslint-plugin": "^8.59.0",
31
41
  "@typescript-eslint/parser": "^8.59.0",
32
- "eslint": "^10.2.1",
42
+ "eslint": "^9.39.2",
33
43
  "eslint-plugin-prettier": "^5.5.5",
34
44
  "eslint-plugin-react": "^7.37.5",
35
45
  "eslint-plugin-react-hooks": "^7.1.1",
36
46
  "globals": "^17.5.0",
37
- "prettier": "^3.8.3"
47
+ "prettier": "^3.8.3",
48
+ "react": "^19.2.5",
49
+ "react-router-dom": "^7.14.1"
38
50
  }
39
51
  }