placementt-core 1.20.232 → 1.300.4

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 (101) hide show
  1. package/.eslintrc.js +40 -40
  2. package/.gitattributes +2 -2
  3. package/deploy-all.js +75 -0
  4. package/lib/config.d.ts +0 -13
  5. package/lib/config.js +1 -3
  6. package/lib/config.js.map +1 -1
  7. package/lib/constants.d.ts +1 -0
  8. package/lib/constants.js +48 -1
  9. package/lib/constants.js.map +1 -1
  10. package/lib/features/config.d.ts +133 -133
  11. package/lib/features/config.js +35 -35
  12. package/lib/features/contacts/contacts.d.ts +75 -75
  13. package/lib/features/contacts/contacts.js +105 -105
  14. package/lib/features/downtime/useDowntime.d.ts +11 -11
  15. package/lib/features/downtime/useDowntime.js +22 -22
  16. package/lib/features/placements/studentPlacements/activePlacement.js +1 -1
  17. package/lib/features/placements/studentPlacements/activePlacement.js.map +1 -1
  18. package/lib/features/placements/studentPlacements/studentPlacementsSlice.d.ts +63 -63
  19. package/lib/features/placements/studentPlacements/studentPlacementsSlice.js +81 -81
  20. package/lib/features/providerPlacements/providerPlacementsSlice.d.ts +19 -19
  21. package/lib/features/providerPlacements/providerPlacementsSlice.js +24 -24
  22. package/lib/features/studentPlacements/studentPlacementsSlice.d.ts +62 -62
  23. package/lib/features/studentPlacements/studentPlacementsSlice.js +87 -87
  24. package/lib/features/studentPlacements/useStudentPlacements.d.ts +6 -6
  25. package/lib/features/studentPlacements/useStudentPlacements.js +18 -18
  26. package/lib/features/userSlice.d.ts +26 -26
  27. package/lib/features/userSlice.js +23 -23
  28. package/lib/features/users/useUserFunctions.d.ts +25 -25
  29. package/lib/features/users/useUserFunctions.js +124 -124
  30. package/lib/features/users/userSlice.d.ts +46 -46
  31. package/lib/features/users/userSlice.js +48 -48
  32. package/lib/firebase/firebase.d.ts +1 -1
  33. package/lib/firebase/firebase.js +8 -3
  34. package/lib/firebase/firebase.js.map +1 -1
  35. package/lib/firebase/firebaseConfig.js +1 -0
  36. package/lib/firebase/firebaseConfig.js.map +1 -1
  37. package/lib/firebase/readDatabase.js +7 -7
  38. package/lib/firebase/readDatabase.js.map +1 -1
  39. package/lib/hooks.d.ts +85 -192
  40. package/lib/hooks.js +731 -671
  41. package/lib/hooks.js.map +1 -1
  42. package/lib/images/GatsbyBenchmarks.d.ts +1 -2
  43. package/lib/index.d.ts +0 -1
  44. package/lib/index.js +0 -1
  45. package/lib/index.js.map +1 -1
  46. package/lib/reduxHooks.d.ts +9 -41
  47. package/lib/reduxHooks.js +1 -49
  48. package/lib/reduxHooks.js.map +1 -1
  49. package/lib/tasksAndTips.js +368 -418
  50. package/lib/tasksAndTips.js.map +1 -1
  51. package/lib/typeDefinitions.d.ts +162 -83
  52. package/lib/util.d.ts +25 -1
  53. package/lib/util.js +329 -2
  54. package/lib/util.js.map +1 -1
  55. package/package.json +56 -56
  56. package/src/DatabaseDefinitions.ts +18 -18
  57. package/src/apiCalls.ts +128 -128
  58. package/src/config.ts +50 -53
  59. package/src/constants.ts +846 -796
  60. package/src/databaseTypes.ts +42 -42
  61. package/src/features/analytics/useAnalytics.tsx +63 -63
  62. package/src/features/contacts/contactsSlice.ts +147 -147
  63. package/src/features/contacts/useContacts.tsx +73 -73
  64. package/src/features/dropdown/useDropdown.tsx +52 -52
  65. package/src/features/global/downtime/useDowntime.tsx +23 -23
  66. package/src/features/global/users/useUserFunctions.tsx +132 -132
  67. package/src/features/jobs/jobsSlice.ts +71 -71
  68. package/src/features/placements/studentPlacements/activePlacement.ts +68 -68
  69. package/src/features/placements/studentPlacements/completedStudentPlacementsSlice.ts +97 -97
  70. package/src/features/placements/studentPlacements/upcomingStudentPlacementsSlice.ts +108 -108
  71. package/src/features/placements/studentPlacements/useStudentPlacements.tsx +9 -9
  72. package/src/features/placements/types.ts +10 -10
  73. package/src/features/referrals/useReferrals.tsx +56 -56
  74. package/src/features/updates/useUpdates.tsx +38 -38
  75. package/src/firebase/firebase.tsx +158 -153
  76. package/src/firebase/firebaseConfig.tsx +47 -45
  77. package/src/firebase/firebaseQuery.tsx +151 -151
  78. package/src/firebase/persistence.ts +84 -84
  79. package/src/firebase/readDatabase.tsx +236 -236
  80. package/src/firebase/util.tsx +352 -352
  81. package/src/firebase/writeDatabase.tsx +77 -77
  82. package/src/hooks.tsx +4476 -4463
  83. package/src/images/GatsbyBenchmarks.tsx +711 -711
  84. package/src/images/LogFuturePlacement.jsx +64 -64
  85. package/src/images/LogPreviousPlacement.jsx +228 -228
  86. package/src/images/gatsby_benchmarks.svg +466 -466
  87. package/src/images/log_future_placement.svg +114 -114
  88. package/src/images/log_previous_placement.svg +199 -199
  89. package/src/index.ts +34 -35
  90. package/src/readDatabase.tsx +3 -3
  91. package/src/reduxHooks.ts +295 -352
  92. package/src/tasksAndTips.ts +1267 -1267
  93. package/src/tutorialTips.ts +58 -58
  94. package/src/typeDefinitions.ts +1260 -1129
  95. package/src/util.ts +523 -177
  96. package/tsconfig.dev.json +5 -5
  97. package/tsconfig.json +21 -21
  98. package/lib/features/logs/logsSlice.d.ts +0 -93
  99. package/lib/features/logs/logsSlice.js +0 -146
  100. package/lib/features/logs/logsSlice.js.map +0 -1
  101. package/src/features/logs/logsSlice.ts +0 -208
package/src/apiCalls.ts CHANGED
@@ -1,128 +1,128 @@
1
- import {Auth} from "firebase/auth";
2
- import {Contact} from "./typeDefinitions";
3
-
4
- export const initializeToken = async (auth: Auth) => {
5
- try {
6
- const user = auth.currentUser;
7
- if (user) {
8
- const token = await user.getIdToken();
9
- console.log("this is the token###",token);
10
- return token;
11
- } else {
12
- console.error("User is not signed in.");
13
- return null;
14
- }
15
- } catch (error) {
16
- console.error("Error initializing token:", error);
17
- return null;
18
- }
19
- };
20
-
21
- export class API {
22
- private rootURL: string;
23
- private auth: Auth;
24
-
25
-
26
- constructor(auth: Auth, type?:string) {
27
- if (type === "local") {
28
- this.rootURL = "localhost:3006";
29
- } else {
30
- this.rootURL = "placemmentt.co.uk";
31
- }
32
- this.auth = auth;
33
- }
34
-
35
-
36
- async getContact(id: string): Promise<Contact | undefined> {
37
- const token = await initializeToken(this.auth);
38
-
39
- try {
40
- const response = await fetch(`${this.rootURL}/api/contacts/getContacts/${id}`, {
41
- method: "GET",
42
- headers: {
43
- "Authorization": `Bearer ${token}`,
44
- "Content-Type": "application/json",
45
- },
46
- });
47
- return (await response.json()) as Contact;
48
- } catch (error) {
49
- console.log(error);
50
- }
51
- return undefined;
52
- }
53
-
54
- async addContact(details:Contact) {
55
- const token = await initializeToken(this.auth);
56
-
57
- try {
58
- const response = await fetch(`${this.rootURL}/api/contacts/addContact`, {
59
- method: "POST",
60
- headers: {
61
- "Authorization": `Bearer ${token}`,
62
- "Content-Type": "application/json",
63
- },
64
- body: JSON.stringify(details ),
65
- });
66
- return (await response.json());
67
- } catch (error) {
68
- console.log(error);
69
- }
70
- }
71
-
72
- async update_contact(id:string, details:Contact, Constraint:string) {
73
- const token = await initializeToken(this.auth);
74
-
75
- try {
76
- const response = await fetch(`${this.rootURL}/api/contacts/update/${id}`, {
77
- method: "PUT",
78
- headers: {
79
- "Authorization": `Bearer ${token}`,
80
- "Content-Type": "application/json",
81
- },
82
- body: JSON.stringify({
83
- details: details,
84
- constraint: Constraint,
85
- } ),
86
- });
87
- return (await response.json());
88
- } catch (error) {
89
- console.log(error);
90
- }
91
- }
92
-
93
- async delete_contact(contactid:string) {
94
- const token = await initializeToken(this.auth);
95
-
96
- try {
97
- const response = await fetch(`${this.rootURL}/api/contacts/delete}`, {
98
- headers: {
99
- "Authorization": `Bearer ${token}`,
100
- "Content-Type": "application/json",
101
- },
102
- body: JSON.stringify({
103
- contactid: contactid,
104
- } ),
105
- });
106
- return (await response.json());
107
- } catch (error) {
108
- console.log(error);
109
- }
110
- }
111
- async get_placements(id:string) {
112
- const token = await initializeToken(this.auth);
113
-
114
- try {
115
- const response = await fetch(`${this.rootURL}/api/contacts/getPlacements/${id}`, {
116
- method: "GET",
117
- headers: {
118
- "Authorization": `Bearer ${token}`,
119
- "Content-Type": "application/json",
120
- },
121
- });
122
- return (await response.json()) as Contact;
123
- } catch (error) {
124
- console.log(error);
125
- }
126
- return undefined;
127
- }
128
- }
1
+ import {Auth} from "firebase/auth";
2
+ import {Contact} from "./typeDefinitions";
3
+
4
+ export const initializeToken = async (auth: Auth) => {
5
+ try {
6
+ const user = auth.currentUser;
7
+ if (user) {
8
+ const token = await user.getIdToken();
9
+ console.log("this is the token###",token);
10
+ return token;
11
+ } else {
12
+ console.error("User is not signed in.");
13
+ return null;
14
+ }
15
+ } catch (error) {
16
+ console.error("Error initializing token:", error);
17
+ return null;
18
+ }
19
+ };
20
+
21
+ export class API {
22
+ private rootURL: string;
23
+ private auth: Auth;
24
+
25
+
26
+ constructor(auth: Auth, type?:string) {
27
+ if (type === "local") {
28
+ this.rootURL = "localhost:3006";
29
+ } else {
30
+ this.rootURL = "placemmentt.co.uk";
31
+ }
32
+ this.auth = auth;
33
+ }
34
+
35
+
36
+ async getContact(id: string): Promise<Contact | undefined> {
37
+ const token = await initializeToken(this.auth);
38
+
39
+ try {
40
+ const response = await fetch(`${this.rootURL}/api/contacts/getContacts/${id}`, {
41
+ method: "GET",
42
+ headers: {
43
+ "Authorization": `Bearer ${token}`,
44
+ "Content-Type": "application/json",
45
+ },
46
+ });
47
+ return (await response.json()) as Contact;
48
+ } catch (error) {
49
+ console.log(error);
50
+ }
51
+ return undefined;
52
+ }
53
+
54
+ async addContact(details:Contact) {
55
+ const token = await initializeToken(this.auth);
56
+
57
+ try {
58
+ const response = await fetch(`${this.rootURL}/api/contacts/addContact`, {
59
+ method: "POST",
60
+ headers: {
61
+ "Authorization": `Bearer ${token}`,
62
+ "Content-Type": "application/json",
63
+ },
64
+ body: JSON.stringify(details ),
65
+ });
66
+ return (await response.json());
67
+ } catch (error) {
68
+ console.log(error);
69
+ }
70
+ }
71
+
72
+ async update_contact(id:string, details:Contact, Constraint:string) {
73
+ const token = await initializeToken(this.auth);
74
+
75
+ try {
76
+ const response = await fetch(`${this.rootURL}/api/contacts/update/${id}`, {
77
+ method: "PUT",
78
+ headers: {
79
+ "Authorization": `Bearer ${token}`,
80
+ "Content-Type": "application/json",
81
+ },
82
+ body: JSON.stringify({
83
+ details: details,
84
+ constraint: Constraint,
85
+ } ),
86
+ });
87
+ return (await response.json());
88
+ } catch (error) {
89
+ console.log(error);
90
+ }
91
+ }
92
+
93
+ async delete_contact(contactid:string) {
94
+ const token = await initializeToken(this.auth);
95
+
96
+ try {
97
+ const response = await fetch(`${this.rootURL}/api/contacts/delete}`, {
98
+ headers: {
99
+ "Authorization": `Bearer ${token}`,
100
+ "Content-Type": "application/json",
101
+ },
102
+ body: JSON.stringify({
103
+ contactid: contactid,
104
+ } ),
105
+ });
106
+ return (await response.json());
107
+ } catch (error) {
108
+ console.log(error);
109
+ }
110
+ }
111
+ async get_placements(id:string) {
112
+ const token = await initializeToken(this.auth);
113
+
114
+ try {
115
+ const response = await fetch(`${this.rootURL}/api/contacts/getPlacements/${id}`, {
116
+ method: "GET",
117
+ headers: {
118
+ "Authorization": `Bearer ${token}`,
119
+ "Content-Type": "application/json",
120
+ },
121
+ });
122
+ return (await response.json()) as Contact;
123
+ } catch (error) {
124
+ console.log(error);
125
+ }
126
+ return undefined;
127
+ }
128
+ }
package/src/config.ts CHANGED
@@ -1,54 +1,51 @@
1
- import {configureStore} from '@reduxjs/toolkit'
2
- import {combineReducers} from "redux"
3
- import {persistReducer} from "redux-persist"
4
- import jobsReducer from "./features/jobs/jobsSlice"
5
- import upcomingStudentPlacementsReducer from "./features/placements/studentPlacements/upcomingStudentPlacementsSlice"
6
- import completedStudentPlacementsReducer from "./features/placements/studentPlacements/completedStudentPlacementsSlice"
7
- import contactsReducer from "./features/contacts/contactsSlice"
8
- import activePlacementReducer from "./features/placements/studentPlacements/activePlacement"
9
- import logsReducer from "./features/logs/logsSlice"
10
- import AsyncStorage from '@react-native-async-storage/async-storage'
11
-
12
-
13
- const persistConfig = {
14
- key: "root",
15
- version: 1,
16
- storage: AsyncStorage,
17
- }
18
-
19
- const reducers = combineReducers({
20
- upcomingStudentPlacements: upcomingStudentPlacementsReducer,
21
- completedStudentPlacements: completedStudentPlacementsReducer,
22
- contacts: contactsReducer,
23
- activePlacement: activePlacementReducer,
24
- jobs: jobsReducer,
25
- logs: logsReducer,
26
- });
27
-
28
-
29
- const persistedReducers = persistReducer(persistConfig, reducers);
30
-
31
-
32
- export const store = configureStore({
33
- reducer: persistedReducers,
34
- devTools: process.env.NODE_ENV !== 'production',
35
- middleware: (getDefaultMiddleware) =>
36
- getDefaultMiddleware({
37
- immutableCheck: false,
38
- serializableCheck: false
39
- }),
40
-
41
- });
42
-
43
- export type RootStateType = ReturnType<typeof store.getState>
44
- export type RootState = {
45
- upcomingStudentPlacements: RootStateType["upcomingStudentPlacements"]
46
- completedStudentPlacements: RootStateType["completedStudentPlacements"],
47
- activePlacement: RootStateType["activePlacement"],
48
- contacts: RootStateType["contacts"],
49
- jobs: RootStateType["jobs"],
50
- logs: RootStateType["logs"],
51
- }
52
-
53
-
1
+ import {configureStore} from '@reduxjs/toolkit'
2
+ import {combineReducers} from "redux"
3
+ import {persistReducer} from "redux-persist"
4
+ import jobsReducer from "./features/jobs/jobsSlice"
5
+ import upcomingStudentPlacementsReducer from "./features/placements/studentPlacements/upcomingStudentPlacementsSlice"
6
+ import completedStudentPlacementsReducer from "./features/placements/studentPlacements/completedStudentPlacementsSlice"
7
+ import contactsReducer from "./features/contacts/contactsSlice"
8
+ import activePlacementReducer from "./features/placements/studentPlacements/activePlacement"
9
+ import AsyncStorage from '@react-native-async-storage/async-storage'
10
+
11
+
12
+ const persistConfig = {
13
+ key: "root",
14
+ version: 1,
15
+ storage: AsyncStorage,
16
+ }
17
+
18
+ const reducers = combineReducers({
19
+ upcomingStudentPlacements: upcomingStudentPlacementsReducer,
20
+ completedStudentPlacements: completedStudentPlacementsReducer,
21
+ contacts: contactsReducer,
22
+ activePlacement: activePlacementReducer,
23
+ jobs: jobsReducer
24
+ });
25
+
26
+
27
+ const persistedReducers = persistReducer(persistConfig, reducers);
28
+
29
+
30
+ export const store = configureStore({
31
+ reducer: persistedReducers,
32
+ devTools: process.env.NODE_ENV !== 'production',
33
+ middleware: (getDefaultMiddleware) =>
34
+ getDefaultMiddleware({
35
+ immutableCheck: false,
36
+ serializableCheck: false
37
+ }),
38
+
39
+ });
40
+
41
+ export type RootStateType = ReturnType<typeof store.getState>
42
+ export type RootState = {
43
+ upcomingStudentPlacements: RootStateType["upcomingStudentPlacements"]
44
+ completedStudentPlacements: RootStateType["completedStudentPlacements"],
45
+ activePlacement: RootStateType["activePlacement"],
46
+ contacts: RootStateType["contacts"],
47
+ jobs: RootStateType["jobs"]
48
+ }
49
+
50
+
54
51
  export type AppDispatch = typeof store.dispatch