placementt-core 1.400.919 → 1.400.921

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.
@@ -424,6 +424,16 @@ export type UserData = {
424
424
  referrals?: number;
425
425
  shareNameWithReferralLeaderboardConsent?: boolean;
426
426
  shareNameWithReferralLeaderboardConsentDate?: boolean;
427
+ alumniConsent?: boolean;
428
+ alumniConsentDate?: string;
429
+ checkInConsent?: boolean;
430
+ checkInConsentDate?: string;
431
+ nccisDataSharingConsent?: boolean;
432
+ nccisDataSharingConsentDate?: string;
433
+ trustedContact?: TrustedContact;
434
+ trustedContactConsent?: boolean;
435
+ trustedContactConsentDate?: string;
436
+ trustedContactAsked?: boolean;
427
437
  referralCode?: string;
428
438
  notificationFrequency?: "daily" | "weekly" | "fortnightly" | "never";
429
439
  monthAdded?: number;
@@ -2060,14 +2070,14 @@ export type LeaverTransitionData = {
2060
2070
  nccisDataSharingConsent?: boolean;
2061
2071
  };
2062
2072
  /**
2063
- * Consent, contact and alumni opt-in captured on a post-leaving checkpoint when
2064
- * the student never completed the intentions form (checkpoint 1). Mirrors the
2065
- * consent/alumni half of LeaverTransitionData so a leaver who only ever answers
2066
- * the results-day or Christmas form still gives the parent-contact, alumni and
2067
- * NCCIS data-sharing consent that the intentions form would have collected.
2068
- * The destination itself is NOT here — the checkpoint already asks for it.
2073
+ * Consent / one-time capture bundle submitted by the leaver forms. The
2074
+ * destination forms collect these but they are NOT stored on the LeaverRequest —
2075
+ * the backend routes them to the canonical home on UserData (and the Alumni
2076
+ * record), where they are captured once and never re-asked. A given form only
2077
+ * includes the items still outstanding for that leaver (see the needs* flags on
2078
+ * getLeaverCheckpointRequest). The destination itself is not here.
2069
2079
  */
2070
- export type LeaverIntentionsCapture = {
2080
+ export type LeaverConsentCapture = {
2071
2081
  becomeAlumni?: boolean;
2072
2082
  mobile?: string;
2073
2083
  linkedinUrl?: string;
@@ -2078,6 +2088,9 @@ export type LeaverIntentionsCapture = {
2078
2088
  checkInConsent?: boolean;
2079
2089
  checkInConsentDate?: string;
2080
2090
  nccisDataSharingConsent?: boolean;
2091
+ /** True when the additional-contact step was shown on this form (given or
2092
+ * declined) — lets the backend mark trustedContactAsked so it isn't re-asked. */
2093
+ additionalContactAsked?: boolean;
2081
2094
  };
2082
2095
  /**
2083
2096
  * Response payload for a post-leaving checkpoint (results day / Christmas).
@@ -2098,9 +2111,13 @@ export type LeaverCheckpointResponse = {
2098
2111
  wellbeingScore?: 1 | 2 | 3 | 4 | 5;
2099
2112
  personalEmail?: string;
2100
2113
  date: string;
2101
- /** Present only when checkpoint 1 was skipped the consent/alumni data the
2102
- * intentions form would have collected, bolted onto this form instead. */
2103
- intentionsCapture?: LeaverIntentionsCapture;
2114
+ /** Set when the leaver answered the staying-on gate on this form (only shown
2115
+ * when the group permits staying and we didn't already know). true → they're
2116
+ * staying at the school, so the alumni/consent capture is skipped. */
2117
+ stayingAtSchoolSixthForm?: boolean;
2118
+ /** Consent / one-time items still outstanding for this leaver, collected on
2119
+ * this form and routed to UserData by the backend (never stored here). */
2120
+ intentionsCapture?: LeaverConsentCapture;
2104
2121
  };
2105
2122
  /**
2106
2123
  * One per leaver per LeaverGroup — tracks whether the student has completed Form B.
@@ -2113,6 +2130,7 @@ export type LeaverRequest = Omit<AspirationRequest, "cycleId" | "response"> & {
2113
2130
  response?: LeaverTransitionData;
2114
2131
  alumniId?: string;
2115
2132
  intentionsCapturedAt?: string;
2133
+ stayingAtSchoolSixthForm?: boolean;
2116
2134
  personalEmail?: string;
2117
2135
  token?: string;
2118
2136
  tokenExpiry?: string;
@@ -3012,6 +3030,11 @@ export type LeaverGroup = {
3012
3030
  totalInvited?: number;
3013
3031
  totalResponded?: number;
3014
3032
  aggregates?: LeaverAggregates;
3033
+ /** Staff setup flag — true when every student in this group leaves after this
3034
+ * year (no internal sixth-form option). When false/undefined the leaver form
3035
+ * asks "are you staying on?" first, and stayers skip the alumni / consent
3036
+ * capture (and aren't seeded as alumni). */
3037
+ allStudentsLeave?: boolean;
3015
3038
  /** Post-leaving checkpoint schedule. Absent = checkpoints disabled for this group. */
3016
3039
  checkpointConfig?: {
3017
3040
  resultsDay?: {
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "private": false,
3
3
  "name": "placementt-core",
4
4
  "author": "Placementt",
5
- "version": "1.400.919",
5
+ "version": "1.400.921",
6
6
  "main": "lib/index.js",
7
7
  "types": "lib/index.d.ts",
8
8
  "scripts": {
@@ -430,6 +430,23 @@ export type UserData = {
430
430
  referrals?: number,
431
431
  shareNameWithReferralLeaderboardConsent?: boolean,
432
432
  shareNameWithReferralLeaderboardConsentDate?: boolean,
433
+
434
+ // ── Leaver / alumni one-time consent (canonical home) ──
435
+ // Captured once across the leaver forms (Form B / results day / Christmas) and
436
+ // never re-asked. The leaver forms gate each section on these: `undefined`
437
+ // means "never asked" (show the page); `true`/`false` means answered (skip it).
438
+ // Dates are server-stamped ISO strings. These are the source of truth; the
439
+ // Alumni record holds denormalised copies taken at opt-in.
440
+ alumniConsent?: boolean, // becomeAlumni — only meaningful for leavers, not sixth-form stayers
441
+ alumniConsentDate?: string,
442
+ checkInConsent?: boolean, // annual check-in (alumni only)
443
+ checkInConsentDate?: string,
444
+ nccisDataSharingConsent?: boolean, // statutory NCCIS destination-tracking consent (all leavers)
445
+ nccisDataSharingConsentDate?: string,
446
+ trustedContact?: TrustedContact, // backup/additional contact
447
+ trustedContactConsent?: boolean,
448
+ trustedContactConsentDate?: string,
449
+ trustedContactAsked?: boolean, // set once the additional-contact step is submitted (given or declined) so an empty contact isn't re-prompted
433
450
  referralCode?: string,
434
451
  notificationFrequency?: "daily"|"weekly"|"fortnightly"|"never",
435
452
  monthAdded?: number,
@@ -1969,14 +1986,14 @@ export type LeaverTransitionData = {
1969
1986
  }
1970
1987
 
1971
1988
  /**
1972
- * Consent, contact and alumni opt-in captured on a post-leaving checkpoint when
1973
- * the student never completed the intentions form (checkpoint 1). Mirrors the
1974
- * consent/alumni half of LeaverTransitionData so a leaver who only ever answers
1975
- * the results-day or Christmas form still gives the parent-contact, alumni and
1976
- * NCCIS data-sharing consent that the intentions form would have collected.
1977
- * The destination itself is NOT here — the checkpoint already asks for it.
1989
+ * Consent / one-time capture bundle submitted by the leaver forms. The
1990
+ * destination forms collect these but they are NOT stored on the LeaverRequest —
1991
+ * the backend routes them to the canonical home on UserData (and the Alumni
1992
+ * record), where they are captured once and never re-asked. A given form only
1993
+ * includes the items still outstanding for that leaver (see the needs* flags on
1994
+ * getLeaverCheckpointRequest). The destination itself is not here.
1978
1995
  */
1979
- export type LeaverIntentionsCapture = {
1996
+ export type LeaverConsentCapture = {
1980
1997
  becomeAlumni?: boolean,
1981
1998
  mobile?: string,
1982
1999
  linkedinUrl?: string,
@@ -1987,6 +2004,9 @@ export type LeaverIntentionsCapture = {
1987
2004
  checkInConsent?: boolean,
1988
2005
  checkInConsentDate?: string, // server-stamped
1989
2006
  nccisDataSharingConsent?: boolean,
2007
+ /** True when the additional-contact step was shown on this form (given or
2008
+ * declined) — lets the backend mark trustedContactAsked so it isn't re-asked. */
2009
+ additionalContactAsked?: boolean,
1990
2010
  }
1991
2011
 
1992
2012
  /**
@@ -2008,9 +2028,13 @@ export type LeaverCheckpointResponse = {
2008
2028
  wellbeingScore?: 1|2|3|4|5, // christmas only, optional
2009
2029
  personalEmail?: string, // lets them update their contact email
2010
2030
  date: string, // ISO — server-stamped submission time
2011
- /** Present only when checkpoint 1 was skipped the consent/alumni data the
2012
- * intentions form would have collected, bolted onto this form instead. */
2013
- intentionsCapture?: LeaverIntentionsCapture,
2031
+ /** Set when the leaver answered the staying-on gate on this form (only shown
2032
+ * when the group permits staying and we didn't already know). true → they're
2033
+ * staying at the school, so the alumni/consent capture is skipped. */
2034
+ stayingAtSchoolSixthForm?: boolean,
2035
+ /** Consent / one-time items still outstanding for this leaver, collected on
2036
+ * this form and routed to UserData by the backend (never stored here). */
2037
+ intentionsCapture?: LeaverConsentCapture,
2014
2038
  }
2015
2039
 
2016
2040
  /**
@@ -2024,6 +2048,7 @@ export type LeaverRequest = Omit<AspirationRequest, "cycleId"|"response"> & {
2024
2048
  response?: LeaverTransitionData,
2025
2049
  alumniId?: string, // set when this leaver opted in and an Alumni record was created
2026
2050
  intentionsCapturedAt?: string, // ISO — set when consent/alumni data was captured via a later checkpoint (intentions form itself was never completed)
2051
+ stayingAtSchoolSixthForm?: boolean, // canonical per-request staying-on answer (from whichever form captured it); gates whether any form re-asks the staying-on question
2027
2052
 
2028
2053
  // ── Post-leaving contact + magic-link auth (set at checkpoint send time) ──
2029
2054
  personalEmail?: string, // denormalised from response.personalEmail at checkpoint-1 submit
@@ -3000,6 +3025,12 @@ export type LeaverGroup = {
3000
3025
  totalResponded?: number, // incremented on each completion
3001
3026
  aggregates?: LeaverAggregates, // pre-aggregated response data for dashboard charts
3002
3027
 
3028
+ /** Staff setup flag — true when every student in this group leaves after this
3029
+ * year (no internal sixth-form option). When false/undefined the leaver form
3030
+ * asks "are you staying on?" first, and stayers skip the alumni / consent
3031
+ * capture (and aren't seeded as alumni). */
3032
+ allStudentsLeave?: boolean,
3033
+
3003
3034
  /** Post-leaving checkpoint schedule. Absent = checkpoints disabled for this group. */
3004
3035
  checkpointConfig?: {
3005
3036
  resultsDay?: {enabled: boolean, sendAt: string, emailTemplateId?: string}, // ISO datetime