placementt-core 11.0.803 → 11.0.914

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.
@@ -21,6 +21,7 @@ export type StudentPlacementData = {
21
21
  providerEmailed: Timestamp,
22
22
  parentEmailed: Timestamp,
23
23
  providerPhone: string,
24
+ studentDescription?: string,
24
25
  website?: string,
25
26
  id:string,
26
27
  providerCompleted: string[],
@@ -41,7 +42,7 @@ export type StudentPlacementData = {
41
42
  mapConsent: true | "institute" | false,
42
43
  mapConsentDate?: string,
43
44
  placementId?: string,
44
- addressId?: string,
45
+ providerContactId?: string,
45
46
  geoHash?: string,
46
47
  statusType: "draft"|"submitted"|"active"|"completed"|"withdrawn"|"requested",
47
48
  questions: PlacementQuestions,
@@ -51,6 +52,7 @@ export type StudentPlacementData = {
51
52
  importedProviderForms?: boolean,
52
53
  analytics: string[],
53
54
  units: string,
55
+ schoolId?: string,
54
56
  active: boolean,
55
57
  completed: boolean,
56
58
  personalAnalytics?: string[],
@@ -61,12 +63,13 @@ export type StudentPlacementData = {
61
63
  draft: boolean,
62
64
  activeDates: string[],
63
65
  insurance: boolean|"awaitingReview",
66
+ insuranceSkippedReason?: string,
64
67
  riskAssessment?: boolean|"awaitingReview",
65
- riskAssessmentType?: "file"|"form",
66
- riskAssessmentData?: {[key:string]: unknown}[],
68
+ riskAssessmentType?: "file"|"form"|"skipped",
69
+ riskAssessmentData?: {[key:string]: unknown}[]|string,
67
70
  dbsCheck?: boolean|"awaitingReview",
68
- dbsCheckType?: "file"|"form",
69
- dbsCheckData?: {[key:string]: unknown}[],
71
+ dbsCheckType?: "file"|"form"|"skipped",
72
+ dbsCheckData?: {[key:string]: unknown}[]|string,
70
73
  contactType?: "email"|"website"|"phone"|"post",
71
74
  webpage?: string,
72
75
  providerLogs?: string[],
@@ -145,24 +148,27 @@ export type SavedPlacement = {
145
148
  savedByProduct: Products,
146
149
  savedByUserType: "Organisation"|"Student",
147
150
  savedById: string,
151
+ schoolId?: string,
148
152
  status?: "Accepted" | "Blocked" | "providerReview";
149
153
  listed: boolean,
150
154
  concurrentPlacements?: number,
151
155
  id: string
152
156
  }
153
157
 
154
- export type PlacementListingStages = "basic"|"address"|"students"|"responsibilities"|"applications"|"onboarding"|"review"|"complete";
158
+ // export type PlacementListingStages = "basic"|"address"|"students"|"responsibilities"|"applications"|"onboarding"|"review"|"complete";
155
159
 
156
160
  export type PlacementListing = {
157
161
  title: string,
158
- uid: string,
159
- template?: string,
160
- providerId?: string,
162
+ // uid: string,
163
+ // template?: string,
164
+ providerId: string,
165
+ providerContactId: string,
161
166
  name: string,
162
167
  providerEmail: string,
163
168
  providerPhone: string,
164
- id:string,
165
- studentType: "secondary" | "higher" | "undergraduate" | "postgraduate"
169
+ id?:string,
170
+ created?: string,
171
+ // studentType: "secondary" | "higher" | "undergraduate" | "postgraduate"
166
172
  contactForename: string,
167
173
  contactSurname: string,
168
174
  ["address-line1"]: string,
@@ -171,34 +177,42 @@ export type PlacementListing = {
171
177
  postal_code: string,
172
178
  country: string,
173
179
  what3Words?: string,
174
- addressId?: string,
175
180
  geoHash?: string,
176
- status: "listed"|"unlisted"|"deleted"|"draft",
181
+ // status: "listed"|"unlisted"|"deleted"|"draft",
177
182
  questions: PlacementQuestions,
178
- savedBy?: {[key:string]: {
183
+ savedBy?: {[key:string]: { // LIST OF SCHOOLS THAT HAVE SAVED THIS
184
+ MATschools?: string[],
179
185
  exists: true,
186
+ cohorts?: {[key: string]: {
187
+ exists: boolean,
188
+ listed: boolean
189
+ }}
180
190
  providerConsent: boolean,
181
- providerConsentDate?: Timestamp,
182
- status: "uploaded"|"approved"|"rejected"|"blocked"}},
191
+ providerConsentDate?: string,
192
+ savedByUserType: "Organisation"|"Student",
193
+ status: "uploaded"|"approved"|"rejected"|"providerReviewed"|"blocked"}},
183
194
  mapConsent?: boolean,
184
- mapConsentData?: string,
195
+ mapConsentDate?: string,
185
196
  uploadedBy: "student"|"institute"|"provider",
186
- riskAssessmentType?: "file"|"form",
187
- riskAssessmentData?: {[key:string]: unknown}[],
188
- dbsCheckType?: "file"|"form",
189
- dbsCheckData?: {[key:string]: unknown}[],
197
+ riskAssessmentType?: "file"|"form"|"skipped",
198
+ concurrentPlacements?: number,
199
+ riskAssessmentData?: {[key:string]: unknown}[]|string,
200
+ dbsCheckType?: "file"|"form"|"skipped",
201
+ dbsCheckData?: {[key:string]: unknown}[]|string,
190
202
  contactType?: "email"|"website"|"phone"|"post",
191
203
  webpage?: string,
192
- stage: PlacementListingStages,
193
- placementDateType?: "any"|"range"|"defined",
194
- placementDates?: {start: string, end: string}[],
195
- applicationType?: "simple"|"complex",
196
- applicantWorkflowId?: string,
197
- applicantWorkflow?: ApplicantStage[],
198
- onboarding: (OnboardingDocs&{deadline: number})|false,
199
- maxApplicants?: number,
200
- maxStudents?: number,
201
- primaryContactId: string,
204
+ sector?: string,
205
+ subsector?: string,
206
+ // stage: PlacementListingStages,
207
+ // placementDateType?: "any"|"range"|"defined",
208
+ // placementDates?: {start: string, end: string}[],
209
+ // applicationType?: "simple"|"complex",
210
+ // applicantWorkflowId?: string,
211
+ // applicantWorkflow?: ApplicantStage[],
212
+ // onboarding: (OnboardingDocs&{deadline: number})|false,
213
+ // maxApplicants?: number,
214
+ // maxStudents?: number,
215
+ // primaryContactId: string,
202
216
  }
203
217
 
204
218
  export type OnboardingDocs = {
@@ -208,7 +222,7 @@ export type OnboardingDocs = {
208
222
  requiredFiles?: {fileName: string, fileType: string}[]
209
223
  }
210
224
 
211
- export type PlacementTemplate = PlacementListing&{templateName: string};
225
+ // export type PlacementTemplate = PlacementListing&{templateName: string};
212
226
 
213
227
  export type OrganisationAddressStages = "address"|"contacts"|"misc"|"review"|"complete";
214
228
 
@@ -319,10 +333,12 @@ export type UserData = {
319
333
  units?: string,
320
334
  activationCode: number,
321
335
  cohort?: string,
336
+ schoolId?: string,
322
337
  cohortData?: CohortData,
323
338
  dismissedTasks?: string[],
324
339
  dismissedTutorials?: string[],
325
340
  dismissedTips?: string[],
341
+ dismissedUpdateDate?: string, // A specific date from which all previous updates have been seen.
326
342
  viewCohorts?: "all"|"some"|"none",
327
343
  viewStudents?: "all"|"some"|"none",
328
344
  studentFilterValues?: string[], // comma delimited list of values, such as "a, b, c, d"
@@ -352,7 +368,8 @@ export type UserData = {
352
368
  skillsTargetsValues?: {[key: string]: {
353
369
  provider: number[],
354
370
  student: number[],
355
- }}
371
+ }},
372
+ alumniConversationUid?: string
356
373
  };
357
374
 
358
375
  export type AnalyticsItem = {
@@ -524,44 +541,65 @@ export type ProviderPlacementData = {
524
541
 
525
542
 
526
543
  export type ProviderData = {
527
- staff: number,
528
- staffFields: string[],
529
- staffActive: number,
530
- admin: string,
544
+ // staff: number,
545
+ // staffFields: string[],
546
+ // staffActive: number,
547
+ // admin: string,
531
548
  name: string,
532
- insurance: boolean|"awaitingReview",
549
+ // insurance: boolean|"awaitingReview",
550
+ // insuranceSkippedReason?: string,
533
551
  regNumber?: string,
534
- insuranceExpiry: string,
535
- mapConsent?: boolean|"unlisted",
536
- mapConsentDate?: string,
537
- staffGuidance?: {[key:number]: string},
538
- about?: string,
552
+ // insuranceExpiry: string,
553
+ // mapConsent?: boolean|"unlisted",
554
+ // mapConsentDate?: string,
555
+ // staffGuidance?: {[key:number]: string},
556
+ // about?: string,
539
557
  sector: string,
540
- defAddress: string,
558
+ // defAddress: string,
541
559
  subsector: string,
542
560
  website?: string,
561
+ created?: string
562
+ uploadedBy?: "institute"|"provider"|"student"
563
+ // onboarding?: {
564
+ // hasStaff?: boolean,
565
+ // multipleAddresses?: boolean,
566
+ // }
567
+ // registrationRequests?: boolean|string,
568
+ // registrationRequestsDate?: string,
569
+ // information: {
570
+ // description?: string,
571
+ // staff?: string,
572
+ // locations?: number,
573
+ // },
574
+ // discount?: string,
575
+ // package: string,
576
+ // splitBilling?: boolean,
577
+ // adminBillingContactId: string,
578
+ // addOnPackages?: string[],
579
+ }&Address
580
+
581
+ export type ProviderContactData = {
582
+ sector: string,
583
+ name: string,
584
+ subsector: string,
585
+ providerPhone?: string,
586
+ providerEmail: string,
587
+ contactForename: string,
588
+ contactSurname: string,
589
+ website?: string,
590
+ created: string,
591
+ providerId: string,
592
+ insurance: boolean|"awaitingReview",
593
+ insuranceSkippedReason?: string,
594
+ insuranceExpiry?: string,
543
595
  savedBy?: {[key:string]: {
544
596
  exists: true,
545
- providerConsent: boolean,
546
- providerConsentDate?: Timestamp,
547
- status: "uploaded"|"approved"|"blocked"}},
548
- onboarding?: {
549
- hasStaff?: boolean,
550
- multipleAddresses?: boolean,
551
- }
552
- registrationRequests?: boolean|string,
553
- registrationRequestsDate?: string,
554
- information: {
555
- description?: string,
556
- staff?: string,
557
- locations?: number,
558
- },
559
- discount?: string,
560
- package: string,
561
- splitBilling?: boolean,
562
- adminBillingContactId: string,
563
- addOnPackages?: string[],
564
- }
597
+ activities?: null|string[], // IDs of consented activities.
598
+ providerConsent?: boolean,
599
+ providerConsentDate?: string,
600
+ MATschools?: string[],
601
+ status: "uploaded"|"approved"|"rejected"|"providerReviewed"|"blocked"}},
602
+ }&Address
565
603
 
566
604
  export type InstituteData = {
567
605
  students: number,
@@ -596,17 +634,27 @@ export type InstituteData = {
596
634
  url: string
597
635
  }
598
636
  },
599
- providerActivities?: {[key: string]: ProviderActivity}
637
+ acceptingAlumni?: boolean,
638
+ approveAlumni?: boolean,
639
+ shareAlumni?: boolean
640
+ approveAlumniMessages?: boolean,
641
+ anonymiseAlumniConvoStudents?: boolean,
642
+ alumniConversations?: boolean,
643
+ activityInvitesSent?: string
600
644
  }&Address;
601
645
 
602
- export type ProviderActivity = {
646
+ export type ExternalActivity = {
603
647
  title?: string,
604
648
  description: string,
605
649
  position?: number,
606
650
  image?: string,
607
651
  color: string,
608
652
  public?: boolean,
609
- oId?: string
653
+ oId?: string,
654
+ alumni?: boolean,
655
+ provider?: boolean,
656
+ permanent?: boolean,
657
+ activityType: "workExperience"|"workplaceVisits"|"mentoring"|"mockInterviews"|"other"
610
658
  }
611
659
 
612
660
  export type NotificationObject = {
@@ -661,7 +709,7 @@ export type StaffRoles = {
661
709
  staff: string[]
662
710
  };
663
711
 
664
- export type QueryObjectConstraint = [string, "=="|"<"|"<="|">="|">"|"!="|"array-contains"|"array-contains-any"|"in"|"not-in", string|boolean][]
712
+ export type QueryObjectConstraint = [string, "=="|"<"|"<="|">="|">"|"!="|"array-contains"|"array-contains-any"|"in"|"not-in", string|boolean|string[]][]
665
713
 
666
714
  export type QueryObject = {
667
715
  path: string[],
@@ -717,14 +765,17 @@ export type CohortData = {
717
765
  endSubmission: string,
718
766
  startPlacements: string,
719
767
  endPlacements: string,
720
- stage: "info"|"name"|"placementType"|"students"|"workflow"|"review"|"created"|"archived",
768
+ stage: "info"|"name"|"placementType"|"students"|"workflow"|"review"|"created"|"archived"|"database",
721
769
  workflow: WorkflowStage[]
722
770
  customWorkflow?: boolean,
723
771
  oId: string,
724
772
  product: Products,
725
773
  schoolId?: string,
726
774
  designatedStaff?: string,
775
+ autoArchiveDate?: string,
727
776
  logType?: "basic"|"custom",
777
+ listingReleaseDate?: string,
778
+ enableListings?: boolean,
728
779
  logs?: {
729
780
  students?: string,
730
781
  staff?: string,
@@ -743,7 +794,11 @@ export type CohortData = {
743
794
  providerFeedbackSent?: Timestamp,
744
795
  studentsFeedbackSent?: Timestamp,
745
796
  emailTemplates?: {[key in keyof typeof emailTemplates]: string},
746
- skillsTargets?: string[]
797
+ skillsTargets?: string[],
798
+ recurringEmails?: {
799
+ sendType?: "all"|"lastWeek",
800
+ frequency?: "oneTime"|"weeklyMonday"|"fortnightlyMonday"
801
+ }
747
802
  }
748
803
 
749
804
  export type ArrowObject = {
@@ -797,10 +852,10 @@ export type PlacementReviewDetails = {
797
852
  questions: PlacementQuestions,
798
853
  riskAssessment: boolean|"awaitingReview",
799
854
  riskAssessmentType: "form"|"file",
800
- riskAssessmentData?: {[key: string]: unknown},
855
+ riskAssessmentData?: {[key: string]: unknown}|string,
801
856
  dbsCheck: boolean|"awaitingReview",
802
857
  dbsCheckType: "form"|"file",
803
- dbsCheckData?: {[key: string]: unknown},
858
+ dbsCheckData?: {[key: string]: unknown}|string,
804
859
  }
805
860
  },
806
861
  requireELI?: boolean,
@@ -809,14 +864,18 @@ export type PlacementReviewDetails = {
809
864
  importedProviderForms: boolean,
810
865
  currentStage: WorkflowStage&{files: {[fileId: string]: {name: string, url: string}}},
811
866
  placementId?: string,
867
+ providerContactId: string,
812
868
  incompleteItems: {[key: number]: string[]},
813
- riskAssessmentData?: {[key: string]: unknown}[],
814
- dbsCheckData?: {[key: string]: unknown}[],
869
+ riskAssessmentData?: {[key: string]: unknown}[]|string,
870
+ dbsCheckData?: {[key: string]: unknown}[]|string,
815
871
  feedbackText?: Descendant[],
816
872
  feedback: CustomFormSchema,
817
873
  providerFeedback?: {[key: string]: unknown},
818
874
  primaryColor?: string,
819
- primaryImage?: string
875
+ primaryImage?: string,
876
+ savedBySchool?: boolean,
877
+ consentedActivities?: string[],
878
+ instituteActivities?: {[key: string]: ExternalActivity}
820
879
  }
821
880
 
822
881
  export type BlogCategories = "students"|"providers"|"institutes"|"placementt"
@@ -1000,5 +1059,117 @@ export type SchoolData = OrganisationAddress&{
1000
1059
  }
1001
1060
  },
1002
1061
  monthAdded: number,
1003
- acceptingAlumni?: boolean
1062
+ acceptingAlumni?: boolean,
1063
+ approveAlumni?: boolean,
1064
+ shareAlumni?: boolean
1065
+ approveAlumniMessages?: boolean,
1066
+ anonymiseAlumniConvoStudents?: boolean,
1067
+ alumniConversations?: boolean
1068
+ }
1069
+
1070
+
1071
+ export type ExternalEvent = {
1072
+ name: string,
1073
+ description: string,
1074
+ created: string,
1075
+ activityId?: string,
1076
+ oId: string,
1077
+ submissionClose: string,
1078
+ schoolId?: string,
1079
+ startDate?: string,
1080
+ endDate?: string,
1081
+ startTime?: string,
1082
+ endTime?: string,
1083
+ allDay?: boolean,
1084
+ recurring?: boolean,
1085
+ recurringFrequency: "daily"|"weekly"|"fortnightly"|"monthlyOnDate",
1086
+ recurringUntil?: string,
1087
+ students?: number,
1088
+ maxExternalAttendees?: number,
1089
+ stage: "basicDetails"|"date"|"invites"|"review"|"created",
1090
+ alumni: {
1091
+ shareable?: boolean,
1092
+ filters: {[key: string]: unknown}
1093
+ }
1094
+ employers: {
1095
+ shareable?: boolean,
1096
+ filters: {[key: string]: unknown}
1097
+ }
1098
+ }&Address
1099
+
1100
+
1101
+ export type Alumni = {
1102
+ forename: string,
1103
+ surname: string,
1104
+ email: string,
1105
+ startYear: string,
1106
+ endYear: string,
1107
+ activities: string[],
1108
+ oId: string,
1109
+ schoolId?: string,
1110
+ dateAdded?: string,
1111
+ currentEnrolment: "university"|"apprenticeship"|"employment",
1112
+ status: "inactive"|"awaitingStaff"|"active"
1113
+ sector: string,
1114
+ subsector: string,
1115
+ enrolmentHistory: {}[],
1116
+ visibleToStudents?: boolean,
1117
+ enableConversations?: boolean,
1118
+ linkCode: string,
1119
+ linkCodeExpiry: string
1120
+ }
1121
+
1122
+ export type ExternalStudentAccount = {
1123
+ oId: string,
1124
+ schoolId?: string,
1125
+ forename?: string,
1126
+ surname?: string,
1127
+ email: string,
1128
+ created?: string
1129
+ }
1130
+
1131
+ export type AlumniConversation = {
1132
+ alumniId: string,
1133
+ externalStudentId: string,
1134
+ alumniSharable?: boolean,
1135
+ oId: string,
1136
+ schoolId?: string,
1137
+ studentSharable?: boolean,
1138
+ messages: {[key: string]: {
1139
+ sentBy: "alumni"|"student",
1140
+ sentAt: string,
1141
+ message: string,
1142
+ delivered: "blocked"|"pending"|true,
1143
+ }},
1144
+ open: boolean,
1145
+ reported?: boolean,
1146
+ delivered: "blocked"|"pending"|true,
1147
+ report?: {
1148
+ reportedBy: "alumni"|"student"
1149
+ message: string,
1150
+ createdDateTime: string,
1151
+ resolvedDateTime: string,
1152
+ }
1153
+ }
1154
+
1155
+ export type AlumniConvoUser = {
1156
+ forename: string,
1157
+ surname: string,
1158
+ email: string,
1159
+ dateAdded: string,
1160
+ oId: string,
1161
+ schoolId?: string,
1162
+ linkCode: string,
1163
+ linkCodeExpiry: string
1164
+ }
1165
+
1166
+ export type Update = {
1167
+ title: string,
1168
+ description: Descendant[],
1169
+ userType: "Staff"|"Students",
1170
+ product: Products,
1171
+ buttonText?: string,
1172
+ buttonLink?: string,
1173
+ date: string,
1174
+ imageData?: boolean
1004
1175
  }
package/src/util.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  import {where} from "firebase/firestore";
2
2
  import FirebaseQuery from "./firebase/firebaseQuery";
3
- import {FlagCodes, InstituteData, StudentPlacementData, UserData, WorkflowStage} from "./typeDefinitions";
3
+ import {AlumniConversation, FlagCodes, InstituteData, StudentPlacementData, UserData, WorkflowStage} from "./typeDefinitions";
4
4
  import {convertDate} from "./firebase/util";
5
5
 
6
6
  type PlacementFlagCodeParams = {
@@ -33,8 +33,8 @@ export const getPlacementFlagCodes = async ({placement, studentData, workflow, i
33
33
  // If placement after provider review and not verified
34
34
  const placementIsPostProviderReview = placement.leadTimes.some((x) => x.split("_")[0] === "3");
35
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);
36
+ const providerUnverified = placement.providerContactId && !institute?.verifiedProviders?.includes(placement.providerContactId);
37
+ const awaitingProviderInsurance = placement.providerContactId && institute?.awaitingProviderInsurance?.includes(placement.providerContactId);
38
38
 
39
39
  const riskAssessmentNotVerified = !institute?.verifiedRiskAssessments?.includes(placement.placementId || placement.id);
40
40
  const awaitingRiskAssessment = !placement.riskAssessment || institute?.awaitingPlacementRiskAssessments?.includes(placement.placementId || placement.id);
@@ -158,3 +158,20 @@ export function objectsEqualNew(a: any, b: any): boolean { // Works with arrays
158
158
 
159
159
  return false;
160
160
  }
161
+
162
+ export const getMostRecentAlumniMessage = (conversation: AlumniConversation) => {
163
+ const { messages } = conversation;
164
+
165
+ if (!messages || Object.keys(messages).length === 0) {
166
+ return null; // No messages available
167
+ }
168
+
169
+ const mostRecent = Object.entries(messages)
170
+ .map(([id, message]) => ({
171
+ id,
172
+ ...message,
173
+ }))
174
+ .sort((a, b) => new Date(b.sentAt).getTime() - new Date(a.sentAt).getTime())[0];
175
+
176
+ return mostRecent || null; // Return most recent or null if none found
177
+ };