placementt-core 11.0.803 → 11.0.892

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.
@@ -41,7 +41,7 @@ export type StudentPlacementData = {
41
41
  mapConsent: true | "institute" | false,
42
42
  mapConsentDate?: string,
43
43
  placementId?: string,
44
- addressId?: string,
44
+ providerContactId?: string,
45
45
  geoHash?: string,
46
46
  statusType: "draft"|"submitted"|"active"|"completed"|"withdrawn"|"requested",
47
47
  questions: PlacementQuestions,
@@ -51,6 +51,7 @@ export type StudentPlacementData = {
51
51
  importedProviderForms?: boolean,
52
52
  analytics: string[],
53
53
  units: string,
54
+ schoolId?: string,
54
55
  active: boolean,
55
56
  completed: boolean,
56
57
  personalAnalytics?: string[],
@@ -61,12 +62,13 @@ export type StudentPlacementData = {
61
62
  draft: boolean,
62
63
  activeDates: string[],
63
64
  insurance: boolean|"awaitingReview",
65
+ insuranceSkippedReason?: string,
64
66
  riskAssessment?: boolean|"awaitingReview",
65
- riskAssessmentType?: "file"|"form",
66
- riskAssessmentData?: {[key:string]: unknown}[],
67
+ riskAssessmentType?: "file"|"form"|"skipped",
68
+ riskAssessmentData?: {[key:string]: unknown}[]|string,
67
69
  dbsCheck?: boolean|"awaitingReview",
68
- dbsCheckType?: "file"|"form",
69
- dbsCheckData?: {[key:string]: unknown}[],
70
+ dbsCheckType?: "file"|"form"|"skipped",
71
+ dbsCheckData?: {[key:string]: unknown}[]|string,
70
72
  contactType?: "email"|"website"|"phone"|"post",
71
73
  webpage?: string,
72
74
  providerLogs?: string[],
@@ -140,29 +142,32 @@ export type PlacementQuestions = {
140
142
  payFrequency: "total"|"hourly"|"daily"|"weekly"|"monthly"|"annually",
141
143
  }
142
144
 
143
- export type SavedPlacement = {
144
- placementId: string,
145
- savedByProduct: Products,
146
- savedByUserType: "Organisation"|"Student",
147
- savedById: string,
148
- status?: "Accepted" | "Blocked" | "providerReview";
149
- listed: boolean,
150
- concurrentPlacements?: number,
151
- id: string
152
- }
145
+ // export type SavedPlacement = {
146
+ // placementId: string,
147
+ // savedByProduct: Products,
148
+ // savedByUserType: "Organisation"|"Student",
149
+ // savedById: string,
150
+ // schoolId?: string,
151
+ // status?: "Accepted" | "Blocked" | "providerReview";
152
+ // listed: boolean,
153
+ // concurrentPlacements?: number,
154
+ // id: string
155
+ // }
153
156
 
154
- export type PlacementListingStages = "basic"|"address"|"students"|"responsibilities"|"applications"|"onboarding"|"review"|"complete";
157
+ // export type PlacementListingStages = "basic"|"address"|"students"|"responsibilities"|"applications"|"onboarding"|"review"|"complete";
155
158
 
156
159
  export type PlacementListing = {
157
160
  title: string,
158
- uid: string,
159
- template?: string,
160
- providerId?: string,
161
+ // uid: string,
162
+ // template?: string,
163
+ providerId: string,
164
+ providerContactId: string,
161
165
  name: string,
162
166
  providerEmail: string,
163
167
  providerPhone: string,
164
- id:string,
165
- studentType: "secondary" | "higher" | "undergraduate" | "postgraduate"
168
+ id?:string,
169
+ created?: string,
170
+ // studentType: "secondary" | "higher" | "undergraduate" | "postgraduate"
166
171
  contactForename: string,
167
172
  contactSurname: string,
168
173
  ["address-line1"]: string,
@@ -171,34 +176,42 @@ export type PlacementListing = {
171
176
  postal_code: string,
172
177
  country: string,
173
178
  what3Words?: string,
174
- addressId?: string,
175
179
  geoHash?: string,
176
- status: "listed"|"unlisted"|"deleted"|"draft",
180
+ // status: "listed"|"unlisted"|"deleted"|"draft",
177
181
  questions: PlacementQuestions,
178
- savedBy?: {[key:string]: {
182
+ savedBy?: {[key:string]: { // LIST OF SCHOOLS THAT HAVE SAVED THIS
183
+ MATschools?: string[],
179
184
  exists: true,
185
+ cohorts?: {[key: string]: {
186
+ exists: boolean,
187
+ listed: boolean
188
+ }}
180
189
  providerConsent: boolean,
181
- providerConsentDate?: Timestamp,
182
- status: "uploaded"|"approved"|"rejected"|"blocked"}},
190
+ providerConsentDate?: string,
191
+ savedByUserType: "Organisation"|"Student",
192
+ status: "uploaded"|"approved"|"rejected"|"providerReviewed"|"blocked"}},
183
193
  mapConsent?: boolean,
184
- mapConsentData?: string,
194
+ mapConsentDate?: string,
185
195
  uploadedBy: "student"|"institute"|"provider",
186
- riskAssessmentType?: "file"|"form",
187
- riskAssessmentData?: {[key:string]: unknown}[],
188
- dbsCheckType?: "file"|"form",
189
- dbsCheckData?: {[key:string]: unknown}[],
196
+ riskAssessmentType?: "file"|"form"|"skipped",
197
+ concurrentPlacements?: number,
198
+ riskAssessmentData?: {[key:string]: unknown}[]|string,
199
+ dbsCheckType?: "file"|"form"|"skipped",
200
+ dbsCheckData?: {[key:string]: unknown}[]|string,
190
201
  contactType?: "email"|"website"|"phone"|"post",
191
202
  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,
203
+ sector?: string,
204
+ subsector?: string,
205
+ // stage: PlacementListingStages,
206
+ // placementDateType?: "any"|"range"|"defined",
207
+ // placementDates?: {start: string, end: string}[],
208
+ // applicationType?: "simple"|"complex",
209
+ // applicantWorkflowId?: string,
210
+ // applicantWorkflow?: ApplicantStage[],
211
+ // onboarding: (OnboardingDocs&{deadline: number})|false,
212
+ // maxApplicants?: number,
213
+ // maxStudents?: number,
214
+ // primaryContactId: string,
202
215
  }
203
216
 
204
217
  export type OnboardingDocs = {
@@ -208,7 +221,7 @@ export type OnboardingDocs = {
208
221
  requiredFiles?: {fileName: string, fileType: string}[]
209
222
  }
210
223
 
211
- export type PlacementTemplate = PlacementListing&{templateName: string};
224
+ // export type PlacementTemplate = PlacementListing&{templateName: string};
212
225
 
213
226
  export type OrganisationAddressStages = "address"|"contacts"|"misc"|"review"|"complete";
214
227
 
@@ -319,10 +332,12 @@ export type UserData = {
319
332
  units?: string,
320
333
  activationCode: number,
321
334
  cohort?: string,
335
+ schoolId?: string,
322
336
  cohortData?: CohortData,
323
337
  dismissedTasks?: string[],
324
338
  dismissedTutorials?: string[],
325
339
  dismissedTips?: string[],
340
+ dismissedUpdateDate?: string, // A specific date from which all previous updates have been seen.
326
341
  viewCohorts?: "all"|"some"|"none",
327
342
  viewStudents?: "all"|"some"|"none",
328
343
  studentFilterValues?: string[], // comma delimited list of values, such as "a, b, c, d"
@@ -352,7 +367,8 @@ export type UserData = {
352
367
  skillsTargetsValues?: {[key: string]: {
353
368
  provider: number[],
354
369
  student: number[],
355
- }}
370
+ }},
371
+ alumniConversationUid?: string
356
372
  };
357
373
 
358
374
  export type AnalyticsItem = {
@@ -524,44 +540,65 @@ export type ProviderPlacementData = {
524
540
 
525
541
 
526
542
  export type ProviderData = {
527
- staff: number,
528
- staffFields: string[],
529
- staffActive: number,
530
- admin: string,
543
+ // staff: number,
544
+ // staffFields: string[],
545
+ // staffActive: number,
546
+ // admin: string,
531
547
  name: string,
532
- insurance: boolean|"awaitingReview",
548
+ // insurance: boolean|"awaitingReview",
549
+ // insuranceSkippedReason?: string,
533
550
  regNumber?: string,
534
- insuranceExpiry: string,
535
- mapConsent?: boolean|"unlisted",
536
- mapConsentDate?: string,
537
- staffGuidance?: {[key:number]: string},
538
- about?: string,
551
+ // insuranceExpiry: string,
552
+ // mapConsent?: boolean|"unlisted",
553
+ // mapConsentDate?: string,
554
+ // staffGuidance?: {[key:number]: string},
555
+ // about?: string,
556
+ sector: string,
557
+ // defAddress: string,
558
+ subsector: string,
559
+ website?: string,
560
+ created?: string
561
+ uploadedBy?: "institute"|"provider"|"student"
562
+ // onboarding?: {
563
+ // hasStaff?: boolean,
564
+ // multipleAddresses?: boolean,
565
+ // }
566
+ // registrationRequests?: boolean|string,
567
+ // registrationRequestsDate?: string,
568
+ // information: {
569
+ // description?: string,
570
+ // staff?: string,
571
+ // locations?: number,
572
+ // },
573
+ // discount?: string,
574
+ // package: string,
575
+ // splitBilling?: boolean,
576
+ // adminBillingContactId: string,
577
+ // addOnPackages?: string[],
578
+ }&Address
579
+
580
+ export type ProviderContactData = {
539
581
  sector: string,
540
- defAddress: string,
582
+ name: string,
541
583
  subsector: string,
584
+ providerPhone?: string,
585
+ providerEmail: string,
586
+ contactForename: string,
587
+ contactSurname: string,
542
588
  website?: string,
589
+ created: string,
590
+ providerId: string,
591
+ insurance: boolean|"awaitingReview",
592
+ insuranceSkippedReason?: string,
593
+ insuranceExpiry?: string,
543
594
  savedBy?: {[key:string]: {
544
595
  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
- }
596
+ activities?: string[], // IDs of consented activities.
597
+ providerConsent?: boolean,
598
+ providerConsentDate?: string,
599
+ MATschools?: string[],
600
+ status: "uploaded"|"approved"|"rejected"|"providerReviewed"|"blocked"}},
601
+ }&Address
565
602
 
566
603
  export type InstituteData = {
567
604
  students: number,
@@ -596,17 +633,25 @@ export type InstituteData = {
596
633
  url: string
597
634
  }
598
635
  },
599
- providerActivities?: {[key: string]: ProviderActivity}
636
+ acceptingAlumni?: boolean,
637
+ approveAlumni?: boolean,
638
+ shareAlumni?: boolean
639
+ approveAlumniMessages?: boolean,
640
+ anonymiseAlumniConvoStudents?: boolean,
641
+ alumniConversations?: boolean
600
642
  }&Address;
601
643
 
602
- export type ProviderActivity = {
644
+ export type ExternalActivity = {
603
645
  title?: string,
604
646
  description: string,
605
647
  position?: number,
606
648
  image?: string,
607
649
  color: string,
608
650
  public?: boolean,
609
- oId?: string
651
+ oId?: string,
652
+ alumni?: boolean,
653
+ provider?: boolean,
654
+ permanent?: boolean
610
655
  }
611
656
 
612
657
  export type NotificationObject = {
@@ -724,6 +769,7 @@ export type CohortData = {
724
769
  product: Products,
725
770
  schoolId?: string,
726
771
  designatedStaff?: string,
772
+ autoArchiveDate?: string,
727
773
  logType?: "basic"|"custom",
728
774
  logs?: {
729
775
  students?: string,
@@ -797,10 +843,10 @@ export type PlacementReviewDetails = {
797
843
  questions: PlacementQuestions,
798
844
  riskAssessment: boolean|"awaitingReview",
799
845
  riskAssessmentType: "form"|"file",
800
- riskAssessmentData?: {[key: string]: unknown},
846
+ riskAssessmentData?: {[key: string]: unknown}|string,
801
847
  dbsCheck: boolean|"awaitingReview",
802
848
  dbsCheckType: "form"|"file",
803
- dbsCheckData?: {[key: string]: unknown},
849
+ dbsCheckData?: {[key: string]: unknown}|string,
804
850
  }
805
851
  },
806
852
  requireELI?: boolean,
@@ -809,9 +855,10 @@ export type PlacementReviewDetails = {
809
855
  importedProviderForms: boolean,
810
856
  currentStage: WorkflowStage&{files: {[fileId: string]: {name: string, url: string}}},
811
857
  placementId?: string,
858
+ providerContactId: string,
812
859
  incompleteItems: {[key: number]: string[]},
813
- riskAssessmentData?: {[key: string]: unknown}[],
814
- dbsCheckData?: {[key: string]: unknown}[],
860
+ riskAssessmentData?: {[key: string]: unknown}[]|string,
861
+ dbsCheckData?: {[key: string]: unknown}[]|string,
815
862
  feedbackText?: Descendant[],
816
863
  feedback: CustomFormSchema,
817
864
  providerFeedback?: {[key: string]: unknown},
@@ -1000,5 +1047,117 @@ export type SchoolData = OrganisationAddress&{
1000
1047
  }
1001
1048
  },
1002
1049
  monthAdded: number,
1003
- acceptingAlumni?: boolean
1050
+ acceptingAlumni?: boolean,
1051
+ approveAlumni?: boolean,
1052
+ shareAlumni?: boolean
1053
+ approveAlumniMessages?: boolean,
1054
+ anonymiseAlumniConvoStudents?: boolean,
1055
+ alumniConversations?: boolean
1056
+ }
1057
+
1058
+
1059
+ export type ExternalEvent = {
1060
+ name: string,
1061
+ description: string,
1062
+ created: string,
1063
+ activityId?: string,
1064
+ oId: string,
1065
+ submissionClose: string,
1066
+ schoolId?: string,
1067
+ startDate?: string,
1068
+ endDate?: string,
1069
+ startTime?: string,
1070
+ endTime?: string,
1071
+ allDay?: boolean,
1072
+ recurring?: boolean,
1073
+ recurringFrequency: "daily"|"weekly"|"fortnightly"|"monthlyOnDate",
1074
+ recurringUntil?: string,
1075
+ students?: number,
1076
+ maxExternalAttendees?: number,
1077
+ stage: "basicDetails"|"date"|"invites"|"review"|"created",
1078
+ alumni: {
1079
+ shareable?: boolean,
1080
+ filters: {[key: string]: unknown}
1081
+ }
1082
+ employers: {
1083
+ shareable?: boolean,
1084
+ filters: {[key: string]: unknown}
1085
+ }
1086
+ }&Address
1087
+
1088
+
1089
+ export type Alumni = {
1090
+ forename: string,
1091
+ surname: string,
1092
+ email: string,
1093
+ startYear: string,
1094
+ endYear: string,
1095
+ activities: string[],
1096
+ oId: string,
1097
+ schoolId?: string,
1098
+ dateAdded?: string,
1099
+ currentEnrolment: "university"|"apprenticeship"|"employment",
1100
+ status: "inactive"|"awaitingStaff"|"active"
1101
+ sector: string,
1102
+ subsector: string,
1103
+ enrolmentHistory: {}[],
1104
+ visibleToStudents?: boolean,
1105
+ enableConversations?: boolean,
1106
+ linkCode: string,
1107
+ linkCodeExpiry: string
1108
+ }
1109
+
1110
+ export type ExternalStudentAccount = {
1111
+ oId: string,
1112
+ schoolId?: string,
1113
+ forename?: string,
1114
+ surname?: string,
1115
+ email: string,
1116
+ created?: string
1117
+ }
1118
+
1119
+ export type AlumniConversation = {
1120
+ alumniId: string,
1121
+ externalStudentId: string,
1122
+ alumniSharable?: boolean,
1123
+ oId: string,
1124
+ schoolId?: string,
1125
+ studentSharable?: boolean,
1126
+ messages: {[key: string]: {
1127
+ sentBy: "alumni"|"student",
1128
+ sentAt: string,
1129
+ message: string,
1130
+ delivered: "blocked"|"pending"|true,
1131
+ }},
1132
+ open: boolean,
1133
+ reported?: boolean,
1134
+ delivered: "blocked"|"pending"|true,
1135
+ report?: {
1136
+ reportedBy: "alumni"|"student"
1137
+ message: string,
1138
+ createdDateTime: string,
1139
+ resolvedDateTime: string,
1140
+ }
1141
+ }
1142
+
1143
+ export type AlumniConvoUser = {
1144
+ forename: string,
1145
+ surname: string,
1146
+ email: string,
1147
+ dateAdded: string,
1148
+ oId: string,
1149
+ schoolId?: string,
1150
+ linkCode: string,
1151
+ linkCodeExpiry: string
1152
+ }
1153
+
1154
+ export type Update = {
1155
+ title: string,
1156
+ description: Descendant[],
1157
+ userType: "Staff"|"Students",
1158
+ product: Products,
1159
+ buttonText?: string,
1160
+ buttonLink?: string,
1161
+ date: string,
1162
+ imageData?: boolean
1004
1163
  }
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 = {
@@ -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
+ };