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.
- package/.eslintrc.js +40 -40
- package/.gitattributes +2 -2
- package/deploy-all.js +75 -0
- package/lib/config.d.ts +0 -13
- package/lib/config.js +1 -3
- package/lib/config.js.map +1 -1
- package/lib/constants.d.ts +1 -0
- package/lib/constants.js +48 -1
- package/lib/constants.js.map +1 -1
- package/lib/features/config.d.ts +133 -133
- package/lib/features/config.js +35 -35
- package/lib/features/contacts/contacts.d.ts +75 -75
- package/lib/features/contacts/contacts.js +105 -105
- package/lib/features/downtime/useDowntime.d.ts +11 -11
- package/lib/features/downtime/useDowntime.js +22 -22
- package/lib/features/placements/studentPlacements/activePlacement.js +1 -1
- package/lib/features/placements/studentPlacements/activePlacement.js.map +1 -1
- package/lib/features/placements/studentPlacements/studentPlacementsSlice.d.ts +63 -63
- package/lib/features/placements/studentPlacements/studentPlacementsSlice.js +81 -81
- package/lib/features/providerPlacements/providerPlacementsSlice.d.ts +19 -19
- package/lib/features/providerPlacements/providerPlacementsSlice.js +24 -24
- package/lib/features/studentPlacements/studentPlacementsSlice.d.ts +62 -62
- package/lib/features/studentPlacements/studentPlacementsSlice.js +87 -87
- package/lib/features/studentPlacements/useStudentPlacements.d.ts +6 -6
- package/lib/features/studentPlacements/useStudentPlacements.js +18 -18
- package/lib/features/userSlice.d.ts +26 -26
- package/lib/features/userSlice.js +23 -23
- package/lib/features/users/useUserFunctions.d.ts +25 -25
- package/lib/features/users/useUserFunctions.js +124 -124
- package/lib/features/users/userSlice.d.ts +46 -46
- package/lib/features/users/userSlice.js +48 -48
- package/lib/firebase/firebase.d.ts +1 -1
- package/lib/firebase/firebase.js +8 -3
- package/lib/firebase/firebase.js.map +1 -1
- package/lib/firebase/firebaseConfig.js +1 -0
- package/lib/firebase/firebaseConfig.js.map +1 -1
- package/lib/firebase/readDatabase.js +7 -7
- package/lib/firebase/readDatabase.js.map +1 -1
- package/lib/hooks.d.ts +85 -192
- package/lib/hooks.js +731 -671
- package/lib/hooks.js.map +1 -1
- package/lib/images/GatsbyBenchmarks.d.ts +1 -2
- package/lib/index.d.ts +0 -1
- package/lib/index.js +0 -1
- package/lib/index.js.map +1 -1
- package/lib/reduxHooks.d.ts +9 -41
- package/lib/reduxHooks.js +1 -49
- package/lib/reduxHooks.js.map +1 -1
- package/lib/tasksAndTips.js +368 -418
- package/lib/tasksAndTips.js.map +1 -1
- package/lib/typeDefinitions.d.ts +162 -83
- package/lib/util.d.ts +25 -1
- package/lib/util.js +329 -2
- package/lib/util.js.map +1 -1
- package/package.json +56 -56
- package/src/DatabaseDefinitions.ts +18 -18
- package/src/apiCalls.ts +128 -128
- package/src/config.ts +50 -53
- package/src/constants.ts +846 -796
- package/src/databaseTypes.ts +42 -42
- package/src/features/analytics/useAnalytics.tsx +63 -63
- package/src/features/contacts/contactsSlice.ts +147 -147
- package/src/features/contacts/useContacts.tsx +73 -73
- package/src/features/dropdown/useDropdown.tsx +52 -52
- package/src/features/global/downtime/useDowntime.tsx +23 -23
- package/src/features/global/users/useUserFunctions.tsx +132 -132
- package/src/features/jobs/jobsSlice.ts +71 -71
- package/src/features/placements/studentPlacements/activePlacement.ts +68 -68
- package/src/features/placements/studentPlacements/completedStudentPlacementsSlice.ts +97 -97
- package/src/features/placements/studentPlacements/upcomingStudentPlacementsSlice.ts +108 -108
- package/src/features/placements/studentPlacements/useStudentPlacements.tsx +9 -9
- package/src/features/placements/types.ts +10 -10
- package/src/features/referrals/useReferrals.tsx +56 -56
- package/src/features/updates/useUpdates.tsx +38 -38
- package/src/firebase/firebase.tsx +158 -153
- package/src/firebase/firebaseConfig.tsx +47 -45
- package/src/firebase/firebaseQuery.tsx +151 -151
- package/src/firebase/persistence.ts +84 -84
- package/src/firebase/readDatabase.tsx +236 -236
- package/src/firebase/util.tsx +352 -352
- package/src/firebase/writeDatabase.tsx +77 -77
- package/src/hooks.tsx +4476 -4463
- package/src/images/GatsbyBenchmarks.tsx +711 -711
- package/src/images/LogFuturePlacement.jsx +64 -64
- package/src/images/LogPreviousPlacement.jsx +228 -228
- package/src/images/gatsby_benchmarks.svg +466 -466
- package/src/images/log_future_placement.svg +114 -114
- package/src/images/log_previous_placement.svg +199 -199
- package/src/index.ts +34 -35
- package/src/readDatabase.tsx +3 -3
- package/src/reduxHooks.ts +295 -352
- package/src/tasksAndTips.ts +1267 -1267
- package/src/tutorialTips.ts +58 -58
- package/src/typeDefinitions.ts +1260 -1129
- package/src/util.ts +523 -177
- package/tsconfig.dev.json +5 -5
- package/tsconfig.json +21 -21
- package/lib/features/logs/logsSlice.d.ts +0 -93
- package/lib/features/logs/logsSlice.js +0 -146
- package/lib/features/logs/logsSlice.js.map +0 -1
- 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
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
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
|