placementt-core 1.20.211 → 11.10.151

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 (130) hide show
  1. package/.eslintrc.js +40 -40
  2. package/.gitattributes +2 -2
  3. package/lib/config.d.ts +0 -1
  4. package/lib/constants.d.ts +6 -2
  5. package/lib/constants.js +136 -136
  6. package/lib/constants.js.map +1 -1
  7. package/lib/features/analytics/useAnalytics.d.ts +0 -1
  8. package/lib/features/analytics/useAnalytics.js +3 -4
  9. package/lib/features/analytics/useAnalytics.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/contacts/contactsSlice.d.ts +5 -5
  15. package/lib/features/contacts/useContacts.js +1 -2
  16. package/lib/features/contacts/useContacts.js.map +1 -1
  17. package/lib/features/downtime/useDowntime.d.ts +11 -11
  18. package/lib/features/downtime/useDowntime.js +22 -22
  19. package/lib/features/dropdown/useDropdown.d.ts +2 -3
  20. package/lib/features/dropdown/useDropdown.js +1 -2
  21. package/lib/features/dropdown/useDropdown.js.map +1 -1
  22. package/lib/features/global/downtime/useDowntime.d.ts +0 -1
  23. package/lib/features/global/downtime/useDowntime.js +1 -2
  24. package/lib/features/global/downtime/useDowntime.js.map +1 -1
  25. package/lib/features/global/users/useUserFunctions.d.ts +0 -1
  26. package/lib/features/global/users/useUserFunctions.js +7 -8
  27. package/lib/features/global/users/useUserFunctions.js.map +1 -1
  28. package/lib/features/placements/studentPlacements/activePlacement.d.ts +1 -1
  29. package/lib/features/placements/studentPlacements/completedStudentPlacementsSlice.d.ts +2 -2
  30. package/lib/features/placements/studentPlacements/studentPlacementsSlice.d.ts +63 -63
  31. package/lib/features/placements/studentPlacements/studentPlacementsSlice.js +81 -81
  32. package/lib/features/placements/studentPlacements/upcomingStudentPlacementsSlice.d.ts +2 -2
  33. package/lib/features/placements/studentPlacements/useStudentPlacements.d.ts +0 -1
  34. package/lib/features/placements/studentPlacements/useStudentPlacements.js +1 -2
  35. package/lib/features/placements/studentPlacements/useStudentPlacements.js.map +1 -1
  36. package/lib/features/providerPlacements/providerPlacementsSlice.d.ts +19 -19
  37. package/lib/features/providerPlacements/providerPlacementsSlice.js +24 -24
  38. package/lib/features/referrals/useReferrals.d.ts +0 -1
  39. package/lib/features/referrals/useReferrals.js +1 -2
  40. package/lib/features/referrals/useReferrals.js.map +1 -1
  41. package/lib/features/studentPlacements/studentPlacementsSlice.d.ts +62 -62
  42. package/lib/features/studentPlacements/studentPlacementsSlice.js +87 -87
  43. package/lib/features/studentPlacements/useStudentPlacements.d.ts +6 -6
  44. package/lib/features/studentPlacements/useStudentPlacements.js +18 -18
  45. package/lib/features/updates/useUpdates.js +1 -2
  46. package/lib/features/updates/useUpdates.js.map +1 -1
  47. package/lib/features/userSlice.d.ts +26 -26
  48. package/lib/features/userSlice.js +23 -23
  49. package/lib/features/users/useUserFunctions.d.ts +25 -25
  50. package/lib/features/users/useUserFunctions.js +124 -124
  51. package/lib/features/users/userSlice.d.ts +46 -46
  52. package/lib/features/users/userSlice.js +48 -48
  53. package/lib/firebase/firebase.d.ts +3 -1
  54. package/lib/firebase/firebase.js +9 -3
  55. package/lib/firebase/firebase.js.map +1 -1
  56. package/lib/firebase/firebaseConfig.js +3 -0
  57. package/lib/firebase/firebaseConfig.js.map +1 -1
  58. package/lib/firebase/firebaseQuery.d.ts +3 -1
  59. package/lib/firebase/firebaseQuery.js +11 -1
  60. package/lib/firebase/firebaseQuery.js.map +1 -1
  61. package/lib/firebase/persistence.js +2 -2
  62. package/lib/firebase/persistence.js.map +1 -1
  63. package/lib/firebase/readDatabase.d.ts +8 -7
  64. package/lib/firebase/readDatabase.js +41 -8
  65. package/lib/firebase/readDatabase.js.map +1 -1
  66. package/lib/firebase/util.d.ts +3 -4
  67. package/lib/firebase/util.js +49 -4
  68. package/lib/firebase/util.js.map +1 -1
  69. package/lib/firebase/writeDatabase.d.ts +7 -3
  70. package/lib/firebase/writeDatabase.js +9 -2
  71. package/lib/firebase/writeDatabase.js.map +1 -1
  72. package/lib/hooks.d.ts +476 -20
  73. package/lib/hooks.js +1855 -237
  74. package/lib/hooks.js.map +1 -1
  75. package/lib/images/GatsbyBenchmarks.d.ts +0 -1
  76. package/lib/images/GatsbyBenchmarks.js +1 -1
  77. package/lib/images/GatsbyBenchmarks.js.map +1 -1
  78. package/lib/reduxHooks.d.ts +9 -2
  79. package/lib/reduxHooks.js +36 -9
  80. package/lib/reduxHooks.js.map +1 -1
  81. package/lib/tasksAndTips.d.ts +25 -5
  82. package/lib/tasksAndTips.js +517 -48
  83. package/lib/tasksAndTips.js.map +1 -1
  84. package/lib/typeDefinitions.d.ts +472 -55
  85. package/lib/util.d.ts +1 -0
  86. package/lib/util.js +85 -7
  87. package/lib/util.js.map +1 -1
  88. package/package.json +52 -49
  89. package/src/DatabaseDefinitions.ts +18 -18
  90. package/src/apiCalls.ts +128 -128
  91. package/src/config.ts +50 -50
  92. package/src/constants.ts +714 -707
  93. package/src/databaseTypes.ts +42 -42
  94. package/src/features/analytics/useAnalytics.tsx +64 -64
  95. package/src/features/contacts/contactsSlice.ts +147 -147
  96. package/src/features/contacts/useContacts.tsx +73 -73
  97. package/src/features/dropdown/useDropdown.tsx +52 -52
  98. package/src/features/global/downtime/useDowntime.tsx +23 -23
  99. package/src/features/global/users/useUserFunctions.tsx +132 -132
  100. package/src/features/jobs/jobsSlice.ts +65 -65
  101. package/src/features/placements/studentPlacements/activePlacement.ts +68 -68
  102. package/src/features/placements/studentPlacements/completedStudentPlacementsSlice.ts +97 -97
  103. package/src/features/placements/studentPlacements/upcomingStudentPlacementsSlice.ts +108 -108
  104. package/src/features/placements/studentPlacements/useStudentPlacements.tsx +9 -9
  105. package/src/features/placements/types.ts +10 -10
  106. package/src/features/referrals/useReferrals.tsx +56 -56
  107. package/src/features/updates/useUpdates.tsx +38 -38
  108. package/src/firebase/firebase.tsx +144 -138
  109. package/src/firebase/firebaseConfig.tsx +45 -42
  110. package/src/firebase/firebaseQuery.tsx +150 -140
  111. package/src/firebase/persistence.ts +84 -84
  112. package/src/firebase/readDatabase.tsx +235 -197
  113. package/src/firebase/util.tsx +352 -308
  114. package/src/firebase/writeDatabase.tsx +77 -68
  115. package/src/hooks.tsx +4029 -1928
  116. package/src/images/GatsbyBenchmarks.tsx +711 -711
  117. package/src/images/LogFuturePlacement.jsx +64 -64
  118. package/src/images/LogPreviousPlacement.jsx +228 -228
  119. package/src/images/gatsby_benchmarks.svg +466 -466
  120. package/src/images/log_future_placement.svg +114 -114
  121. package/src/images/log_previous_placement.svg +199 -199
  122. package/src/index.ts +34 -34
  123. package/src/readDatabase.tsx +3 -3
  124. package/src/reduxHooks.ts +231 -200
  125. package/src/tasksAndTips.ts +917 -410
  126. package/src/tutorialTips.ts +58 -58
  127. package/src/typeDefinitions.ts +893 -503
  128. package/src/util.ts +137 -47
  129. package/tsconfig.dev.json +5 -5
  130. package/tsconfig.json +21 -21
package/src/util.ts CHANGED
@@ -1,47 +1,137 @@
1
- import {FlagCodes, InstituteData, StudentPlacementData, UserData, WorkflowStage} from "./typeDefinitions";
2
-
3
- type Params = {
4
- placement : StudentPlacementData,
5
- studentData: UserData,
6
- workflow: WorkflowStage[],
7
- institute: InstituteData,
8
- user: UserData
9
- };
10
-
11
- export const getPlacementFlagCodes = ({placement, studentData, workflow, institute, user}: Params) => {
12
- let flags:FlagCodes[] = placement.flags || [];
13
-
14
-
15
- if (!studentData.details.parentEmail && !flags.find((x) => x.includes("noParentEmail"))) {
16
- if (workflow.find((obj) => obj.id === placement.status)?.userType === "Parent") {
17
- flags.includes("noParentEmailWarning") || flags.push("noParentEmailError");
18
- } else if (workflow.find((obj) => obj.userType === "Parent")) {
19
- flags.includes("noParentEmailWarning") || flags.push("noParentEmailError");
20
- }
21
- }
22
-
23
- // If placement after provider review and not verified
24
- const placementIsPostProviderReview = placement.leadTimes.some((x) => x.split("_")[0] === "3");
25
- const placementNotEnded = !placement.leadTimes.some((x) => x.split("_")[0] === "8");
26
- const providerUnverified = placement.providerId && !institute?.verifiedProviders?.includes(placement.providerId);
27
- const awaitingProviderInsurance = placement.providerId && institute?.awaitingProviderInsurance?.includes(placement.providerId);
28
-
29
- if (user.userType === "Staff" && placementIsPostProviderReview && placementNotEnded && providerUnverified && !awaitingProviderInsurance) {
30
- console.log("Add flag!");
31
- flags.includes("noInsurance") || flags.push("noInsurance");
32
- } else {
33
- flags = flags.filter((x) => x !== "noInsurance");
34
- }
35
-
36
- if (user.userType === "Staff" && placementIsPostProviderReview && placementNotEnded && awaitingProviderInsurance) {
37
- flags.includes("awaitingInsurance") || flags.push("awaitingInsurance");
38
- } else {
39
- flags = flags.filter((x) => x !== "awaitingInsurance");
40
- }
41
- if (user.product === "students" && !(placement.providerCompleted && placement.providerCompleted?.includes("details"))) {
42
- flags.includes("notVerified") || flags.push("notVerified");
43
- } else {
44
- flags = flags.filter((x) => x !== "notVerified");
45
- }
46
- return flags;
47
- };
1
+ import {FlagCodes, InstituteData, StudentPlacementData, UserData, WorkflowStage} from "./typeDefinitions";
2
+
3
+ type Params = {
4
+ placement : StudentPlacementData,
5
+ studentData: UserData,
6
+ workflow: WorkflowStage[],
7
+ institute: InstituteData,
8
+ user: UserData
9
+ };
10
+
11
+ export const getPlacementFlagCodes = ({placement, studentData, workflow, institute, user}: Params) => {
12
+ let flags:FlagCodes[] = placement.flags || [];
13
+
14
+
15
+ if (!studentData.details.parentEmail && !flags.find((x) => x.includes("noParentEmail"))) {
16
+ if (workflow.find((obj) => obj.id === placement.status)?.userType === "Parent") {
17
+ flags.includes("noParentEmailWarning") || flags.push("noParentEmailError");
18
+ } else if (workflow.find((obj) => obj.userType === "Parent")) {
19
+ flags.includes("noParentEmailWarning") || flags.push("noParentEmailError");
20
+ }
21
+ }
22
+
23
+ // If placement after provider review and not verified
24
+ const placementIsPostProviderReview = placement.leadTimes.some((x) => x.split("_")[0] === "3");
25
+ const placementNotEnded = !placement.leadTimes.some((x) => x.split("_")[0] === "8");
26
+ const providerUnverified = placement.providerId && !institute?.verifiedProviders?.includes(placement.providerId);
27
+ const awaitingProviderInsurance = placement.providerId && institute?.awaitingProviderInsurance?.includes(placement.providerId);
28
+
29
+ const riskAssessmentNotVerified = !institute?.verifiedRiskAssessments?.includes(placement.placementId || placement.id);
30
+ const awaitingRiskAssessment = !placement.riskAssessment || institute?.awaitingPlacementRiskAssessments?.includes(placement.placementId || placement.id);
31
+
32
+ const dbsCheckNotVerified = !institute?.verifiedDbsChecks?.includes(placement.placementId || placement.id);
33
+ const awaitingDbsCheck = !placement.dbsCheck || institute?.awaitingPlacementDbsChecks?.includes(placement.placementId || placement.id);
34
+
35
+ if (user.userType === "Staff" && user.product === "institutes" && placement.insurance && placementIsPostProviderReview && placementNotEnded && providerUnverified && !awaitingProviderInsurance) {
36
+ console.log("Add insurance flag!");
37
+ flags.includes("noInsurance") || flags.push("noInsurance");
38
+ } else {
39
+ flags = flags.filter((x) => x !== "noInsurance");
40
+ }
41
+
42
+ if (user.userType === "Staff" && user.product === "institutes" && placementIsPostProviderReview && placementNotEnded && awaitingProviderInsurance) {
43
+ flags.includes("awaitingInsurance") || flags.push("awaitingInsurance");
44
+ } else {
45
+ flags = flags.filter((x) => x !== "awaitingInsurance");
46
+ }
47
+
48
+ if (user.userType === "Staff" && user.product === "institutes" && placement.dbsCheck && workflow.find((stage) => stage.dbsCheck) && placement.dbsCheck !== true && placementIsPostProviderReview && placementNotEnded && dbsCheckNotVerified && !awaitingDbsCheck) {
49
+ flags.includes("noDbsCheck") || flags.push("noDbsCheck");
50
+ } else {
51
+ flags = flags.filter((x) => x !== "noDbsCheck");
52
+ }
53
+
54
+ if (user.userType === "Staff" && user.product === "institutes" && placementIsPostProviderReview && workflow.find((stage) => stage.dbsCheck) && placementNotEnded && awaitingProviderInsurance) {
55
+ flags.includes("awaitingDbsCheck") || flags.push("awaitingDbsCheck");
56
+ } else {
57
+ flags = flags.filter((x) => x !== "awaitingDbsCheck");
58
+ }
59
+
60
+ if (user.userType === "Staff" && user.product === "institutes" && placement.riskAssessment && workflow.find((stage) => stage.riskAssessment) && placement.riskAssessment !== true && placementIsPostProviderReview && placementNotEnded && riskAssessmentNotVerified && !awaitingRiskAssessment) {
61
+ console.log("Add RA flag!");
62
+ flags.includes("noRiskAssessment") || flags.push("noRiskAssessment");
63
+ } else {
64
+ flags = flags.filter((x) => x !== "noRiskAssessment");
65
+ }
66
+
67
+ if (user.userType === "Staff" && user.product === "institutes" && placementIsPostProviderReview && workflow.find((stage) => stage.riskAssessment) && placementNotEnded && awaitingProviderInsurance) {
68
+ flags.includes("awaitingRiskAssessment") || flags.push("awaitingRiskAssessment");
69
+ } else {
70
+ flags = flags.filter((x) => x !== "awaitingRiskAssessment");
71
+ }
72
+
73
+ if (placement.inProgress && user.userType === "Staff" && user.product === "providers" && user.oId === placement.providerId && placement.onboarding === null) {
74
+ flags.includes("addOnboarding") || flags.push("addOnboarding");
75
+ } else {
76
+ flags = flags.filter((x) => x !== "addOnboarding");
77
+ }
78
+
79
+ 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)) {
80
+ flags.includes("reviewOnboarding") || flags.push("reviewOnboarding");
81
+ } else {
82
+ flags = flags.filter((x) => x !== "reviewOnboarding");
83
+ }
84
+
85
+ if (placement.inProgress && user.userType === "Students" && placement.onboarding && (!placement.onboarding.completed || (placement.onboarding.completed && !placement.onboarding.completed?.submitted)) && (placement.inProgress || placement.active)) {
86
+ flags.includes("completeOnboarding") || flags.push("completeOnboarding");
87
+ } else {
88
+ flags = flags.filter((x) => x !== "completeOnboarding");
89
+ }
90
+
91
+
92
+ return flags;
93
+ };
94
+
95
+
96
+ export function objectsEqualNew(a: any, b: any): boolean { // Works with arrays or objects.
97
+ if (a === b) {
98
+ return true;
99
+ }
100
+
101
+ if (typeof a !== typeof b) {
102
+ return false;
103
+ }
104
+
105
+ if (Array.isArray(a) && Array.isArray(b)) {
106
+ if (a.length !== b.length) {
107
+ return false;
108
+ }
109
+ for (let i = 0; i < a.length; i++) {
110
+ if (!objectsEqualNew(a[i], b[i])) {
111
+ return false;
112
+ }
113
+ }
114
+ return true;
115
+ }
116
+
117
+ if (typeof a === "object" && typeof b === "object" && a !== null && b !== null) {
118
+ const keysA = Object.keys(a);
119
+ const keysB = Object.keys(b);
120
+
121
+ if (keysA.length !== keysB.length) {
122
+ return false;
123
+ }
124
+
125
+ for (const key of keysA) {
126
+ if (!keysB.includes(key)) {
127
+ return false;
128
+ }
129
+ if (!objectsEqualNew(a[key], b[key])) {
130
+ return false;
131
+ }
132
+ }
133
+ return true;
134
+ }
135
+
136
+ return false;
137
+ }
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,22 +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
- "compileOnSave": true,
19
- "include": [ "src", "../index.test.js", "prisma" ],
20
- "exclude": [ "node_modules", "lib" ]
21
- }
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
+ }
22
22