placementt-core 1.20.217 → 11.0.803
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/lib/constants.js +10 -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/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 +6 -2
- package/lib/firebase/firebase.js.map +1 -1
- package/lib/firebase/readDatabase.js +3 -1
- package/lib/firebase/readDatabase.js.map +1 -1
- package/lib/hooks.d.ts +33 -5
- package/lib/hooks.js +143 -107
- package/lib/hooks.js.map +1 -1
- package/lib/images/GatsbyBenchmarks.d.ts +1 -2
- package/lib/reduxHooks.d.ts +1 -66
- package/lib/reduxHooks.js +9 -69
- package/lib/reduxHooks.js.map +1 -1
- package/lib/tasksAndTips.d.ts +2 -2
- package/lib/tasksAndTips.js +37 -6
- package/lib/tasksAndTips.js.map +1 -1
- package/lib/typeDefinitions.d.ts +50 -5
- package/lib/util.d.ts +1 -1
- package/lib/util.js +12 -1
- package/lib/util.js.map +1 -1
- package/package.json +52 -56
- package/src/DatabaseDefinitions.ts +18 -18
- package/src/apiCalls.ts +128 -128
- package/src/config.ts +50 -50
- package/src/constants.ts +796 -787
- 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 +149 -145
- package/src/firebase/firebaseConfig.tsx +45 -45
- package/src/firebase/firebaseQuery.tsx +151 -151
- package/src/firebase/persistence.ts +84 -84
- package/src/firebase/readDatabase.tsx +236 -235
- package/src/firebase/util.tsx +352 -352
- package/src/firebase/writeDatabase.tsx +77 -77
- package/src/hooks.tsx +4353 -4323
- 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 -34
- package/src/readDatabase.tsx +3 -3
- package/src/reduxHooks.ts +232 -297
- package/src/tasksAndTips.ts +1209 -1177
- package/src/tutorialTips.ts +58 -58
- package/src/typeDefinitions.ts +1003 -958
- package/src/util.ts +160 -150
- package/tsconfig.dev.json +5 -5
- package/tsconfig.json +21 -22
package/src/util.ts
CHANGED
|
@@ -1,150 +1,160 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
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
|
-
const
|
|
36
|
-
const
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
const
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
flags.
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
flags.
|
|
88
|
-
}
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
flags.
|
|
94
|
-
}
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
flags.
|
|
100
|
-
}
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
}
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
}
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
}
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
1
|
+
import {where} from "firebase/firestore";
|
|
2
|
+
import FirebaseQuery from "./firebase/firebaseQuery";
|
|
3
|
+
import {FlagCodes, InstituteData, StudentPlacementData, UserData, WorkflowStage} from "./typeDefinitions";
|
|
4
|
+
import {convertDate} from "./firebase/util";
|
|
5
|
+
|
|
6
|
+
type PlacementFlagCodeParams = {
|
|
7
|
+
placement : StudentPlacementData, // Placement we get flag codes for
|
|
8
|
+
studentData: UserData, // Student associated with the placement
|
|
9
|
+
workflow: WorkflowStage[], // Workflow associated with the placement
|
|
10
|
+
institute: InstituteData, // Associated institutes
|
|
11
|
+
user: UserData // User that is fetching flag codes (staff or student)
|
|
12
|
+
};
|
|
13
|
+
/**
|
|
14
|
+
* Description of function
|
|
15
|
+
*
|
|
16
|
+
*/
|
|
17
|
+
|
|
18
|
+
type PlaceFlagCodeReturn = Promise<FlagCodes[]>;
|
|
19
|
+
|
|
20
|
+
export const getPlacementFlagCodes = async ({placement, studentData, workflow, institute, user}: PlacementFlagCodeParams):PlaceFlagCodeReturn => {
|
|
21
|
+
let flags:FlagCodes[] = placement.flags || [];
|
|
22
|
+
|
|
23
|
+
const firebaseQuery = new FirebaseQuery();
|
|
24
|
+
|
|
25
|
+
if (!studentData.details.parentEmail && !flags.find((x) => x.includes("noParentEmail"))) {
|
|
26
|
+
if (workflow.find((obj) => obj.id === placement.status)?.userType === "Parent") {
|
|
27
|
+
flags.includes("noParentEmailWarning") || flags.push("noParentEmailError");
|
|
28
|
+
} else if (workflow.find((obj) => obj.userType === "Parent")) {
|
|
29
|
+
flags.includes("noParentEmailWarning") || flags.push("noParentEmailError");
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
// If placement after provider review and not verified
|
|
34
|
+
const placementIsPostProviderReview = placement.leadTimes.some((x) => x.split("_")[0] === "3");
|
|
35
|
+
const placementNotEnded = !placement.leadTimes.some((x) => x.split("_")[0] === "8");
|
|
36
|
+
const providerUnverified = placement.providerId && !institute?.verifiedProviders?.includes(placement.providerId);
|
|
37
|
+
const awaitingProviderInsurance = placement.providerId && institute?.awaitingProviderInsurance?.includes(placement.providerId);
|
|
38
|
+
|
|
39
|
+
const riskAssessmentNotVerified = !institute?.verifiedRiskAssessments?.includes(placement.placementId || placement.id);
|
|
40
|
+
const awaitingRiskAssessment = !placement.riskAssessment || institute?.awaitingPlacementRiskAssessments?.includes(placement.placementId || placement.id);
|
|
41
|
+
|
|
42
|
+
const dbsCheckNotVerified = !institute?.verifiedDbsChecks?.includes(placement.placementId || placement.id);
|
|
43
|
+
const awaitingDbsCheck = !placement.dbsCheck || institute?.awaitingPlacementDbsChecks?.includes(placement.placementId || placement.id);
|
|
44
|
+
|
|
45
|
+
const reminderCount = (await firebaseQuery.getCount(["reminders"], [where("oId", "==", user.oId), where("uid", "==", user.id), where("dueDate", "<=", convertDate(new Date(), "dbstring") as string), where("documentId", "==", placement.id), where("status", "==", "upcoming")]));
|
|
46
|
+
|
|
47
|
+
if (reminderCount) {
|
|
48
|
+
flags.push("reminder");
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
if (user.userType === "Staff" && user.product === "institutes" && placement.insurance && placementIsPostProviderReview && placementNotEnded && providerUnverified && !awaitingProviderInsurance) {
|
|
52
|
+
console.log("Add insurance flag!");
|
|
53
|
+
flags.includes("noInsurance") || flags.push("noInsurance");
|
|
54
|
+
} else {
|
|
55
|
+
flags = flags.filter((x) => x !== "noInsurance");
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
if (user.product === "providers" && placement.statusType === "requested") {
|
|
59
|
+
flags.includes("studentNotAccepted") || flags.push("studentNotAccepted");
|
|
60
|
+
} else {
|
|
61
|
+
flags = flags.filter((x) => x !== "studentNotAccepted");
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
|
|
65
|
+
if (user.userType === "Staff" && user.product === "institutes" && placementIsPostProviderReview && placementNotEnded && awaitingProviderInsurance) {
|
|
66
|
+
flags.includes("awaitingInsurance") || flags.push("awaitingInsurance");
|
|
67
|
+
} else {
|
|
68
|
+
flags = flags.filter((x) => x !== "awaitingInsurance");
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
if (user.userType === "Staff" && user.product === "institutes" && placement.dbsCheck && workflow.find((stage) => stage.dbsCheck) && placement.dbsCheck !== true && placementIsPostProviderReview && placementNotEnded && dbsCheckNotVerified && !awaitingDbsCheck) {
|
|
72
|
+
flags.includes("noDbsCheck") || flags.push("noDbsCheck");
|
|
73
|
+
} else {
|
|
74
|
+
flags = flags.filter((x) => x !== "noDbsCheck");
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
if (user.userType === "Staff" && user.product === "institutes" && placementIsPostProviderReview && workflow.find((stage) => stage.dbsCheck) && placementNotEnded && awaitingProviderInsurance) {
|
|
78
|
+
flags.includes("awaitingDbsCheck") || flags.push("awaitingDbsCheck");
|
|
79
|
+
} else {
|
|
80
|
+
flags = flags.filter((x) => x !== "awaitingDbsCheck");
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
if (user.userType === "Staff" && user.product === "institutes" && placement.riskAssessment && workflow.find((stage) => stage.riskAssessment) && placement.riskAssessment !== true && placementIsPostProviderReview && placementNotEnded && riskAssessmentNotVerified && !awaitingRiskAssessment) {
|
|
84
|
+
console.log("Add RA flag!");
|
|
85
|
+
flags.includes("noRiskAssessment") || flags.push("noRiskAssessment");
|
|
86
|
+
} else {
|
|
87
|
+
flags = flags.filter((x) => x !== "noRiskAssessment");
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
if (user.userType === "Staff" && user.product === "institutes" && placementIsPostProviderReview && workflow.find((stage) => stage.riskAssessment) && placementNotEnded && awaitingProviderInsurance) {
|
|
91
|
+
flags.includes("awaitingRiskAssessment") || flags.push("awaitingRiskAssessment");
|
|
92
|
+
} else {
|
|
93
|
+
flags = flags.filter((x) => x !== "awaitingRiskAssessment");
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
if (placement.inProgress && user.userType === "Staff" && user.product === "providers" && user.oId === placement.providerId && placement.onboarding === null) {
|
|
97
|
+
flags.includes("addOnboarding") || flags.push("addOnboarding");
|
|
98
|
+
} else {
|
|
99
|
+
flags = flags.filter((x) => x !== "addOnboarding");
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
if (placement.inProgress && user.userType === "Staff" && user.product === "providers" && user.oId === placement.providerId && placement.onboarding && (placement.onboarding.completed?.submitted && !placement.onboarding.completed.accepted) && (placement.inProgress || placement.active)) {
|
|
103
|
+
flags.includes("reviewOnboarding") || flags.push("reviewOnboarding");
|
|
104
|
+
} else {
|
|
105
|
+
flags = flags.filter((x) => x !== "reviewOnboarding");
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
if (placement.inProgress && user.userType === "Students" && placement.onboarding && (!placement.onboarding.completed || (placement.onboarding.completed && !placement.onboarding.completed?.submitted)) && (placement.inProgress || placement.active)) {
|
|
109
|
+
flags.includes("completeOnboarding") || flags.push("completeOnboarding");
|
|
110
|
+
} else {
|
|
111
|
+
flags = flags.filter((x) => x !== "completeOnboarding");
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
|
|
115
|
+
return flags;
|
|
116
|
+
};
|
|
117
|
+
|
|
118
|
+
|
|
119
|
+
export function objectsEqualNew(a: any, b: any): boolean { // Works with arrays or objects.
|
|
120
|
+
if (a === b) {
|
|
121
|
+
return true;
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
if (typeof a !== typeof b) {
|
|
125
|
+
return false;
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
if (Array.isArray(a) && Array.isArray(b)) {
|
|
129
|
+
if (a.length !== b.length) {
|
|
130
|
+
return false;
|
|
131
|
+
}
|
|
132
|
+
for (let i = 0; i < a.length; i++) {
|
|
133
|
+
if (!objectsEqualNew(a[i], b[i])) {
|
|
134
|
+
return false;
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
return true;
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
if (typeof a === "object" && typeof b === "object" && a !== null && b !== null) {
|
|
141
|
+
const keysA = Object.keys(a);
|
|
142
|
+
const keysB = Object.keys(b);
|
|
143
|
+
|
|
144
|
+
if (keysA.length !== keysB.length) {
|
|
145
|
+
return false;
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
for (const key of keysA) {
|
|
149
|
+
if (!keysB.includes(key)) {
|
|
150
|
+
return false;
|
|
151
|
+
}
|
|
152
|
+
if (!objectsEqualNew(a[key], b[key])) {
|
|
153
|
+
return false;
|
|
154
|
+
}
|
|
155
|
+
}
|
|
156
|
+
return true;
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
return false;
|
|
160
|
+
}
|
package/tsconfig.dev.json
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
{
|
|
2
|
-
"include": [
|
|
3
|
-
".eslintrc.js"
|
|
4
|
-
]
|
|
5
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"include": [
|
|
3
|
+
".eslintrc.js"
|
|
4
|
+
]
|
|
5
|
+
}
|
package/tsconfig.json
CHANGED
|
@@ -1,23 +1,22 @@
|
|
|
1
|
-
{
|
|
2
|
-
"compilerOptions": {
|
|
3
|
-
"module": "commonjs",
|
|
4
|
-
"noImplicitReturns": true,
|
|
5
|
-
"noImplicitAny": false,
|
|
6
|
-
"noUnusedLocals": true,
|
|
7
|
-
"outDir": "lib",
|
|
8
|
-
"sourceMap": true,
|
|
9
|
-
"strict": true,
|
|
10
|
-
"target": "ES2019",
|
|
11
|
-
"declaration": true,
|
|
12
|
-
"declarationDir": "lib",
|
|
13
|
-
"jsx": "react",
|
|
14
|
-
"noEmit": false,
|
|
15
|
-
"esModuleInterop": true,
|
|
16
|
-
"experimentalDecorators": true
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
"
|
|
20
|
-
"
|
|
21
|
-
|
|
22
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"compilerOptions": {
|
|
3
|
+
"module": "commonjs",
|
|
4
|
+
"noImplicitReturns": true,
|
|
5
|
+
"noImplicitAny": false,
|
|
6
|
+
"noUnusedLocals": true,
|
|
7
|
+
"outDir": "lib",
|
|
8
|
+
"sourceMap": true,
|
|
9
|
+
"strict": true,
|
|
10
|
+
"target": "ES2019",
|
|
11
|
+
"declaration": true,
|
|
12
|
+
"declarationDir": "lib",
|
|
13
|
+
"jsx": "react",
|
|
14
|
+
"noEmit": false,
|
|
15
|
+
"esModuleInterop": true,
|
|
16
|
+
"experimentalDecorators": true
|
|
17
|
+
},
|
|
18
|
+
"compileOnSave": true,
|
|
19
|
+
"include": [ "src", "../index.test.js", "prisma" ],
|
|
20
|
+
"exclude": [ "node_modules", "lib" ]
|
|
21
|
+
}
|
|
23
22
|
|