clarion-shared-types 1.0.133 → 1.0.134

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 (53) hide show
  1. package/dist/cjs/index.js +1 -0
  2. package/dist/cjs/index.js.map +1 -1
  3. package/dist/cjs/modules/permission/enums/permission-actions.enum.js +7 -0
  4. package/dist/cjs/modules/permission/enums/permission-actions.enum.js.map +1 -1
  5. package/dist/cjs/modules/permission/enums/permissions-moudule.enum.js +1 -0
  6. package/dist/cjs/modules/permission/enums/permissions-moudule.enum.js.map +1 -1
  7. package/dist/cjs/modules/safety-profile/constants/safety-profile.const.js +110 -0
  8. package/dist/cjs/modules/safety-profile/constants/safety-profile.const.js.map +1 -0
  9. package/dist/cjs/modules/safety-profile/enums/safety-profile.enums.js +188 -0
  10. package/dist/cjs/modules/safety-profile/enums/safety-profile.enums.js.map +1 -0
  11. package/dist/cjs/modules/safety-profile/index.js +27 -0
  12. package/dist/cjs/modules/safety-profile/index.js.map +1 -0
  13. package/dist/cjs/modules/safety-profile/interfaces/safety-profile-sections.js +4 -0
  14. package/dist/cjs/modules/safety-profile/interfaces/safety-profile-sections.js.map +1 -0
  15. package/dist/cjs/modules/safety-profile/interfaces/safety-profile-views.js +3 -0
  16. package/dist/cjs/modules/safety-profile/interfaces/safety-profile-views.js.map +1 -0
  17. package/dist/cjs/modules/safety-profile/utils/safety-profile-display.util.js +137 -0
  18. package/dist/cjs/modules/safety-profile/utils/safety-profile-display.util.js.map +1 -0
  19. package/dist/cjs/modules/safety-profile/utils/safety-profile-visibility.util.js +43 -0
  20. package/dist/cjs/modules/safety-profile/utils/safety-profile-visibility.util.js.map +1 -0
  21. package/dist/esm/index.js +1 -0
  22. package/dist/esm/index.js.map +1 -1
  23. package/dist/esm/modules/permission/enums/permission-actions.enum.js +7 -0
  24. package/dist/esm/modules/permission/enums/permission-actions.enum.js.map +1 -1
  25. package/dist/esm/modules/permission/enums/permissions-moudule.enum.js +1 -0
  26. package/dist/esm/modules/permission/enums/permissions-moudule.enum.js.map +1 -1
  27. package/dist/esm/modules/safety-profile/constants/safety-profile.const.js +107 -0
  28. package/dist/esm/modules/safety-profile/constants/safety-profile.const.js.map +1 -0
  29. package/dist/esm/modules/safety-profile/enums/safety-profile.enums.js +185 -0
  30. package/dist/esm/modules/safety-profile/enums/safety-profile.enums.js.map +1 -0
  31. package/dist/esm/modules/safety-profile/index.js +11 -0
  32. package/dist/esm/modules/safety-profile/index.js.map +1 -0
  33. package/dist/esm/modules/safety-profile/interfaces/safety-profile-sections.js +2 -0
  34. package/dist/esm/modules/safety-profile/interfaces/safety-profile-sections.js.map +1 -0
  35. package/dist/esm/modules/safety-profile/interfaces/safety-profile-views.js +2 -0
  36. package/dist/esm/modules/safety-profile/interfaces/safety-profile-views.js.map +1 -0
  37. package/dist/esm/modules/safety-profile/utils/safety-profile-display.util.js +132 -0
  38. package/dist/esm/modules/safety-profile/utils/safety-profile-display.util.js.map +1 -0
  39. package/dist/esm/modules/safety-profile/utils/safety-profile-visibility.util.js +40 -0
  40. package/dist/esm/modules/safety-profile/utils/safety-profile-visibility.util.js.map +1 -0
  41. package/dist/types/index.d.ts +1 -0
  42. package/dist/types/modules/permission/enums/permission-actions.enum.d.ts +3 -0
  43. package/dist/types/modules/permission/enums/permissions-moudule.enum.d.ts +1 -0
  44. package/dist/types/modules/safety-profile/constants/safety-profile.const.d.ts +69 -0
  45. package/dist/types/modules/safety-profile/enums/safety-profile.enums.d.ts +168 -0
  46. package/dist/types/modules/safety-profile/index.d.ts +6 -0
  47. package/dist/types/modules/safety-profile/interfaces/safety-profile-sections.d.ts +163 -0
  48. package/dist/types/modules/safety-profile/interfaces/safety-profile-views.d.ts +249 -0
  49. package/dist/types/modules/safety-profile/utils/safety-profile-display.util.d.ts +25 -0
  50. package/dist/types/modules/safety-profile/utils/safety-profile-visibility.util.d.ts +38 -0
  51. package/dist/types/modules/user/interfaces/guardian.d.ts +2 -0
  52. package/dist/types/modules/user/interfaces/guardians-response.d.ts +2 -0
  53. package/package.json +1 -1
@@ -0,0 +1,40 @@
1
+ import { SAFETY_PROFILE_AUDIENCE_CATEGORIES } from '../constants/safety-profile.const';
2
+ import { SafetyProfileAudience, SafetyProfileCategory, SafetyProfileHiddenReason } from '../enums/safety-profile.enums';
3
+ const SHOWN = { visible: true };
4
+ const hidden = (reason) => ({ visible: false, reason });
5
+ /** Categories with no consent step and no stored settings: what the platform already holds. */
6
+ const SYSTEM_CATEGORIES = [SafetyProfileCategory.EMERGENCY_CONTACTS];
7
+ export function safetyProfileVisibility(input) {
8
+ var _a;
9
+ const { audience, category, settings, hasData, emergencyActive, override } = input;
10
+ if (!SAFETY_PROFILE_AUDIENCE_CATEGORIES[audience].includes(category)) {
11
+ return hidden(hasData ? SafetyProfileHiddenReason.NOT_FOR_AUDIENCE : null);
12
+ }
13
+ if (!hasData)
14
+ return hidden(null);
15
+ if (SYSTEM_CATEGORIES.includes(category)) {
16
+ // The guardian list: the control room already sees it on every incident;
17
+ // a responder gets the primary guardian during the emergency only.
18
+ if (audience === SafetyProfileAudience.RESPONDER && !emergencyActive)
19
+ return hidden(SafetyProfileHiddenReason.ONLY_DURING_SOS);
20
+ return SHOWN;
21
+ }
22
+ // DEVICE needs no consent; every other stored category does.
23
+ const consented = category === SafetyProfileCategory.DEVICE ? true : !!(settings === null || settings === void 0 ? void 0 : settings.consented);
24
+ if (!consented)
25
+ return hidden(null);
26
+ const onlyDuringSos = (_a = settings === null || settings === void 0 ? void 0 : settings.onlyDuringSos) !== null && _a !== void 0 ? _a : true;
27
+ switch (audience) {
28
+ case SafetyProfileAudience.RESPONDER:
29
+ return emergencyActive ? SHOWN : hidden(SafetyProfileHiddenReason.ONLY_DURING_SOS);
30
+ case SafetyProfileAudience.CONTROL_CENTRE:
31
+ return !onlyDuringSos || emergencyActive || override ? SHOWN : hidden(SafetyProfileHiddenReason.ONLY_DURING_SOS);
32
+ case SafetyProfileAudience.GUARDIAN:
33
+ if (!(settings === null || settings === void 0 ? void 0 : settings.shareWithGuardians))
34
+ return hidden(SafetyProfileHiddenReason.NOT_SHARED_WITH_GUARDIANS);
35
+ return !onlyDuringSos || emergencyActive ? SHOWN : hidden(SafetyProfileHiddenReason.ONLY_DURING_SOS);
36
+ default:
37
+ return hidden(SafetyProfileHiddenReason.NOT_FOR_AUDIENCE);
38
+ }
39
+ }
40
+ //# sourceMappingURL=safety-profile-visibility.util.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"safety-profile-visibility.util.js","sourceRoot":"","sources":["../../../../../src/modules/safety-profile/utils/safety-profile-visibility.util.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kCAAkC,EAAE,MAAM,mCAAmC,CAAC;AACvF,OAAO,EAAE,qBAAqB,EAAE,qBAAqB,EAAE,yBAAyB,EAAE,MAAM,+BAA+B,CAAC;AAgCxH,MAAM,KAAK,GAA4B,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;AACzD,MAAM,MAAM,GAAG,CAAC,MAAwC,EAA2B,EAAE,CAAC,CAAC,EAAE,OAAO,EAAE,KAAK,EAAE,MAAM,EAAE,CAAC,CAAC;AAEnH,+FAA+F;AAC/F,MAAM,iBAAiB,GAAqC,CAAC,qBAAqB,CAAC,kBAAkB,CAAC,CAAC;AAEvG,MAAM,UAAU,uBAAuB,CAAC,KAAmC;;IACvE,MAAM,EAAE,QAAQ,EAAE,QAAQ,EAAE,QAAQ,EAAE,OAAO,EAAE,eAAe,EAAE,QAAQ,EAAE,GAAG,KAAK,CAAC;IAEnF,IAAI,CAAC,kCAAkC,CAAC,QAAQ,CAAC,CAAC,QAAQ,CAAC,QAAQ,CAAC,EAAE,CAAC;QACnE,OAAO,MAAM,CAAC,OAAO,CAAC,CAAC,CAAC,yBAAyB,CAAC,gBAAgB,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC;IAC/E,CAAC;IACD,IAAI,CAAC,OAAO;QAAE,OAAO,MAAM,CAAC,IAAI,CAAC,CAAC;IAElC,IAAI,iBAAiB,CAAC,QAAQ,CAAC,QAAQ,CAAC,EAAE,CAAC;QACvC,yEAAyE;QACzE,mEAAmE;QACnE,IAAI,QAAQ,KAAK,qBAAqB,CAAC,SAAS,IAAI,CAAC,eAAe;YAAE,OAAO,MAAM,CAAC,yBAAyB,CAAC,eAAe,CAAC,CAAC;QAC/H,OAAO,KAAK,CAAC;IACjB,CAAC;IAED,6DAA6D;IAC7D,MAAM,SAAS,GAAG,QAAQ,KAAK,qBAAqB,CAAC,MAAM,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,CAAA,QAAQ,aAAR,QAAQ,uBAAR,QAAQ,CAAE,SAAS,CAAA,CAAC;IAC3F,IAAI,CAAC,SAAS;QAAE,OAAO,MAAM,CAAC,IAAI,CAAC,CAAC;IACpC,MAAM,aAAa,GAAG,MAAA,QAAQ,aAAR,QAAQ,uBAAR,QAAQ,CAAE,aAAa,mCAAI,IAAI,CAAC;IAEtD,QAAQ,QAAQ,EAAE,CAAC;QACf,KAAK,qBAAqB,CAAC,SAAS;YAChC,OAAO,eAAe,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,MAAM,CAAC,yBAAyB,CAAC,eAAe,CAAC,CAAC;QACvF,KAAK,qBAAqB,CAAC,cAAc;YACrC,OAAO,CAAC,aAAa,IAAI,eAAe,IAAI,QAAQ,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,MAAM,CAAC,yBAAyB,CAAC,eAAe,CAAC,CAAC;QACrH,KAAK,qBAAqB,CAAC,QAAQ;YAC/B,IAAI,CAAC,CAAA,QAAQ,aAAR,QAAQ,uBAAR,QAAQ,CAAE,kBAAkB,CAAA;gBAAE,OAAO,MAAM,CAAC,yBAAyB,CAAC,yBAAyB,CAAC,CAAC;YACtG,OAAO,CAAC,aAAa,IAAI,eAAe,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,MAAM,CAAC,yBAAyB,CAAC,eAAe,CAAC,CAAC;QACzG;YACI,OAAO,MAAM,CAAC,yBAAyB,CAAC,gBAAgB,CAAC,CAAC;IAClE,CAAC;AACL,CAAC"}
@@ -23,6 +23,7 @@ export * from './modules/alert-intake/index';
23
23
  export * from './modules/partner/index';
24
24
  export * from './modules/support/index';
25
25
  export * from './modules/safety/index';
26
+ export * from './modules/safety-profile/index';
26
27
  export * from './modules/billing/index';
27
28
  export * from './modules/newsfeed/index';
28
29
  export * from './modules/dispatch/index';
@@ -195,6 +195,9 @@ export declare enum PermissionActions {
195
195
  USE_FOLLOW_ME = "use:follow-me",
196
196
  READ_FOLLOW_ME = "read:follow-me",
197
197
  TRACK_FOLLOW_ME = "track:follow-me",
198
+ MANAGE_SAFETY_PROFILE = "manage:safety-profile",
199
+ READ_SAFETY_PROFILE = "read:safety-profile",
200
+ OVERRIDE_SAFETY_PROFILE = "override:safety-profile",
198
201
  MANAGE_SAVED_PLACE = "manage:saved-place",
199
202
  READ_INCIDENT_SLA = "read:incident-sla",
200
203
  UPDATE_INCIDENT_SLA = "update:incident-sla",
@@ -15,6 +15,7 @@ export declare enum PermissionsModule {
15
15
  NOTIFICATION = "Notification",
16
16
  ALERT_INTAKE = "Alert Intake",
17
17
  SAFETY = "Safety",
18
+ SAFETY_PROFILE = "Safety Profile",
18
19
  PLACES = "Places",
19
20
  INCIDENT_SLA = "Incident SLA",
20
21
  RESPONDER = "Responder"
@@ -0,0 +1,69 @@
1
+ import { SafetyProfileAudience, SafetyProfileCategory } from '../enums/safety-profile.enums';
2
+ import type { StoredSafetyProfileCategory } from '../interfaces/safety-profile-sections';
3
+ /** Every category, in the order the app and the console list them. */
4
+ export declare const SAFETY_PROFILE_CATEGORIES: readonly SafetyProfileCategory[];
5
+ /**
6
+ * The categories stored in `safety_profile_sections` (encrypted). EMERGENCY_CONTACTS
7
+ * is not one: it is the guardian list, kept where it always was.
8
+ */
9
+ export declare const STORED_SAFETY_PROFILE_CATEGORIES: readonly StoredSafetyProfileCategory[];
10
+ /**
11
+ * The categories a person must agree to share before anything is stored in them.
12
+ * Each is sensitive personal data under the Kenya Data Protection Act 2019 (health,
13
+ * sex, biometric images, property and family details) or its equivalents in UG/TZ/ZM.
14
+ * DEVICE holds only what the platform already knows plus an IMEI the person typed,
15
+ * so it needs no separate consent.
16
+ */
17
+ export declare const CONSENT_REQUIRED_SAFETY_PROFILE_CATEGORIES: readonly SafetyProfileCategory[];
18
+ /**
19
+ * Never shown to a guardian, whatever the person chose: the threats they named and
20
+ * their duress phrase must stay hidden from the people closest to them - in a
21
+ * domestic-violence case the threat can BE a guardian. Device details are
22
+ * operational and for the control room only.
23
+ */
24
+ export declare const NEVER_SHARED_WITH_GUARDIANS: readonly SafetyProfileCategory[];
25
+ /**
26
+ * What a responder's compact card may draw on (still subject to the person's
27
+ * settings). The safe word and the device stay with the control room.
28
+ */
29
+ export declare const RESPONDER_SAFETY_PROFILE_CATEGORIES: readonly SafetyProfileCategory[];
30
+ /** Which categories each audience can ever see. */
31
+ export declare const SAFETY_PROFILE_AUDIENCE_CATEGORIES: Readonly<Record<SafetyProfileAudience, readonly SafetyProfileCategory[]>>;
32
+ /**
33
+ * The version of the consent text the app shows. Recorded with every consent, so
34
+ * a later change of wording can ask again. Bump it when the text changes.
35
+ */
36
+ export declare const SAFETY_PROFILE_CONSENT_VERSION = "2026-11-07";
37
+ /** The one-line reason for the whole profile, shown wherever it is collected. */
38
+ export declare const SAFETY_PROFILE_EXPLANATION = "This information helps responders identify and locate you faster.";
39
+ /** Size limits, checked by the DTOs and the services alike. */
40
+ export declare const SAFETY_PROFILE_LIMITS: {
41
+ readonly nicknameMin: 2;
42
+ readonly nicknameMax: 30;
43
+ readonly shortText: 80;
44
+ readonly mediumText: 160;
45
+ readonly longText: 1000;
46
+ readonly alternativePhones: 3;
47
+ readonly photos: 4;
48
+ readonly allergies: 20;
49
+ readonly medications: 20;
50
+ readonly frequentPlaces: 10;
51
+ readonly vehicles: 5;
52
+ readonly imeiNumbers: 2;
53
+ readonly safeWordMin: 3;
54
+ readonly safeWordMax: 60;
55
+ readonly heightCm: {
56
+ readonly min: 30;
57
+ readonly max: 272;
58
+ };
59
+ readonly weightKg: {
60
+ readonly min: 1;
61
+ readonly max: 500;
62
+ };
63
+ readonly overrideReasonMin: 10;
64
+ readonly overrideReasonMax: 500;
65
+ readonly devicesPerUser: 10;
66
+ readonly accessLogPageMax: 100;
67
+ };
68
+ /** Every category's display name, for logs and fallbacks (the clients have their own copy). */
69
+ export declare const SAFETY_PROFILE_CATEGORY_LABELS: Readonly<Record<SafetyProfileCategory, string>>;
@@ -0,0 +1,168 @@
1
+ /**
2
+ * Safety Profile (clarion-authentication): what an app user tells responders so
3
+ * they can be identified, found and helped faster in an emergency.
4
+ *
5
+ * The profile is split into CATEGORIES. Each stored category carries its own
6
+ * consent, its own "visible only during an active SOS" setting and its own
7
+ * "share with my guardians" setting, so a person can share their home with
8
+ * responders at any time while keeping their medical details for an emergency.
9
+ */
10
+ export declare enum SafetyProfileCategory {
11
+ /** Nickname, gender, extra photos, other phone numbers (plus the account's name, photo, birth date, phone, e-mail). */
12
+ IDENTITY = "IDENTITY",
13
+ MEDICAL = "MEDICAL",
14
+ /** The guardian list (guardian_relations) - not stored in the profile, summarised from it. */
15
+ EMERGENCY_CONTACTS = "EMERGENCY_CONTACTS",
16
+ RESIDENCE = "RESIDENCE",
17
+ WORKPLACE = "WORKPLACE",
18
+ FREQUENT_PLACES = "FREQUENT_PLACES",
19
+ TRAVEL = "TRAVEL",
20
+ VEHICLE = "VEHICLE",
21
+ SAFETY_RISK = "SAFETY_RISK",
22
+ /** Devices the app reported, last sign-in / activity, plus what the person typed (IMEI, second SIM). */
23
+ DEVICE = "DEVICE"
24
+ }
25
+ /** Who is looking at somebody else's profile. The owner is never an audience: they always see everything. */
26
+ export declare enum SafetyProfileAudience {
27
+ /** Control-room staff (read:safety-profile), in the admin console. */
28
+ CONTROL_CENTRE = "CONTROL_CENTRE",
29
+ /** A responder dispatched to the person's emergency, in the responder app (compact card only). */
30
+ RESPONDER = "RESPONDER",
31
+ /** One of the person's own guardians (notified on SOS), in the app. */
32
+ GUARDIAN = "GUARDIAN"
33
+ }
34
+ /** Why a category with data in it was not shown to this viewer. */
35
+ export declare enum SafetyProfileHiddenReason {
36
+ /** The person shares it only during an active emergency, and there is none. */
37
+ ONLY_DURING_SOS = "ONLY_DURING_SOS",
38
+ /** The person has not shared it with their guardians. */
39
+ NOT_SHARED_WITH_GUARDIANS = "NOT_SHARED_WITH_GUARDIANS",
40
+ /** Never shown to this kind of viewer (e.g. the safe word to a guardian). */
41
+ NOT_FOR_AUDIENCE = "NOT_FOR_AUDIENCE"
42
+ }
43
+ export declare enum SafetyProfileErrorCode {
44
+ /** A category is written before the person agreed to share it. */
45
+ CONSENT_REQUIRED = "SAFETY_PROFILE_CONSENT_REQUIRED",
46
+ /** Somebody else (another device) saved the category since it was read. */
47
+ VERSION_CONFLICT = "SAFETY_PROFILE_VERSION_CONFLICT",
48
+ /** The section's data does not validate. `details.errors` lists the fields. */
49
+ INVALID_SECTION = "SAFETY_PROFILE_INVALID_SECTION",
50
+ /** The category cannot be written (EMERGENCY_CONTACTS is the guardian list). */
51
+ CATEGORY_NOT_WRITABLE = "SAFETY_PROFILE_CATEGORY_NOT_WRITABLE",
52
+ /** Safety profiles cannot be stored or read right now: the encryption key is not configured. */
53
+ ENCRYPTION_UNAVAILABLE = "SAFETY_PROFILE_ENCRYPTION_UNAVAILABLE",
54
+ /** A photo id that is not one of the person's own uploads. */
55
+ PHOTO_NOT_YOURS = "SAFETY_PROFILE_PHOTO_NOT_YOURS",
56
+ /** A saved place id that is not one of the person's own places. */
57
+ PLACE_NOT_YOURS = "SAFETY_PROFILE_PLACE_NOT_YOURS",
58
+ /** The viewer may not see this person's profile at all. */
59
+ NOT_AUTHORISED = "SAFETY_PROFILE_NOT_AUTHORISED",
60
+ /** A responder asked outside an active dispatch. */
61
+ EMERGENCY_REQUIRED = "SAFETY_PROFILE_EMERGENCY_REQUIRED",
62
+ /** The incident does not belong to the person whose profile was asked for. */
63
+ INCIDENT_MISMATCH = "SAFETY_PROFILE_INCIDENT_MISMATCH",
64
+ /** The caller of the incident is anonymous, or the organization hides them from responders. */
65
+ CALLER_NOT_SHARED = "SAFETY_PROFILE_CALLER_NOT_SHARED",
66
+ /** An emergency override without a usable reason. */
67
+ OVERRIDE_REASON_REQUIRED = "SAFETY_PROFILE_OVERRIDE_REASON_REQUIRED"
68
+ }
69
+ export declare enum SafetyProfileGender {
70
+ FEMALE = "FEMALE",
71
+ MALE = "MALE",
72
+ OTHER = "OTHER",
73
+ PREFER_NOT_TO_SAY = "PREFER_NOT_TO_SAY"
74
+ }
75
+ /** The extra photos that help somebody be recognised. */
76
+ export declare enum SafetyProfilePhotoKind {
77
+ FRONT = "FRONT",
78
+ SIDE = "SIDE",
79
+ FULL_BODY = "FULL_BODY",
80
+ /** Optional: how the person looks lately (haircut, beard...). Not counted for completeness. */
81
+ RECENT = "RECENT"
82
+ }
83
+ export declare enum BloodGroup {
84
+ A_POSITIVE = "A_POSITIVE",
85
+ A_NEGATIVE = "A_NEGATIVE",
86
+ B_POSITIVE = "B_POSITIVE",
87
+ B_NEGATIVE = "B_NEGATIVE",
88
+ AB_POSITIVE = "AB_POSITIVE",
89
+ AB_NEGATIVE = "AB_NEGATIVE",
90
+ O_POSITIVE = "O_POSITIVE",
91
+ O_NEGATIVE = "O_NEGATIVE",
92
+ /** Answered: the person does not know theirs. */
93
+ UNKNOWN = "UNKNOWN"
94
+ }
95
+ export declare enum ChronicCondition {
96
+ DIABETES = "DIABETES",
97
+ ASTHMA = "ASTHMA",
98
+ EPILEPSY = "EPILEPSY",
99
+ HEART_DISEASE = "HEART_DISEASE",
100
+ HYPERTENSION = "HYPERTENSION",
101
+ SICKLE_CELL = "SICKLE_CELL",
102
+ KIDNEY_DISEASE = "KIDNEY_DISEASE",
103
+ OTHER = "OTHER"
104
+ }
105
+ export declare enum DisabilityType {
106
+ MOBILITY = "MOBILITY",
107
+ HEARING = "HEARING",
108
+ VISION = "VISION",
109
+ COGNITIVE = "COGNITIVE",
110
+ SPEECH = "SPEECH",
111
+ OTHER = "OTHER"
112
+ }
113
+ export declare enum PregnancyStatus {
114
+ NOT_PREGNANT = "NOT_PREGNANT",
115
+ PREGNANT = "PREGNANT",
116
+ PREFER_NOT_TO_SAY = "PREFER_NOT_TO_SAY"
117
+ }
118
+ export declare enum WorkSchedule {
119
+ OFFICE_HOURS = "OFFICE_HOURS",
120
+ NIGHT_SHIFT = "NIGHT_SHIFT",
121
+ ROTATING_SHIFTS = "ROTATING_SHIFTS",
122
+ FIELD_WORK = "FIELD_WORK",
123
+ REMOTE = "REMOTE",
124
+ OTHER = "OTHER"
125
+ }
126
+ export declare enum FrequentPlaceType {
127
+ FAMILY_HOME = "FAMILY_HOME",
128
+ FRIENDS_PLACE = "FRIENDS_PLACE",
129
+ GYM_SPORTS_CLUB = "GYM_SPORTS_CLUB",
130
+ RELIGIOUS_PLACE = "RELIGIOUS_PLACE",
131
+ MEDICAL_FACILITY = "MEDICAL_FACILITY",
132
+ SHOPPING = "SHOPPING",
133
+ ENTERTAINMENT = "ENTERTAINMENT",
134
+ CHILDCARE = "CHILDCARE",
135
+ TRANSPORT_POINT = "TRANSPORT_POINT",
136
+ REGULAR_ROUTE = "REGULAR_ROUTE",
137
+ RURAL_HOME = "RURAL_HOME",
138
+ OTHER = "OTHER"
139
+ }
140
+ export declare enum VehicleOwnership {
141
+ OWN = "OWN",
142
+ COMPANY = "COMPANY",
143
+ FAMILY = "FAMILY",
144
+ OTHER = "OTHER"
145
+ }
146
+ export declare enum VehicleType {
147
+ CAR = "CAR",
148
+ MOTORCYCLE = "MOTORCYCLE",
149
+ BICYCLE = "BICYCLE",
150
+ TRUCK = "TRUCK",
151
+ SCOOTER = "SCOOTER",
152
+ OTHER = "OTHER"
153
+ }
154
+ export declare enum HighRiskOccupation {
155
+ CASH_HANDLING = "CASH_HANDLING",
156
+ NIGHT_WORK = "NIGHT_WORK",
157
+ SECURITY = "SECURITY",
158
+ FIELD_SALES = "FIELD_SALES",
159
+ JOURNALISM = "JOURNALISM",
160
+ HEALTHCARE = "HEALTHCARE",
161
+ TRANSPORT = "TRANSPORT",
162
+ OTHER = "OTHER"
163
+ }
164
+ /** The detail level of a view: the admin console's full profile, or the responder's one card. */
165
+ export declare enum SafetyProfileViewFormat {
166
+ FULL = "FULL",
167
+ COMPACT = "COMPACT"
168
+ }
@@ -0,0 +1,6 @@
1
+ export * from './enums/safety-profile.enums';
2
+ export * from './constants/safety-profile.const';
3
+ export * from './interfaces/safety-profile-sections';
4
+ export * from './interfaces/safety-profile-views';
5
+ export * from './utils/safety-profile-visibility.util';
6
+ export * from './utils/safety-profile-display.util';
@@ -0,0 +1,163 @@
1
+ import { BloodGroup, ChronicCondition, DisabilityType, FrequentPlaceType, HighRiskOccupation, PregnancyStatus, SafetyProfileCategory, SafetyProfileGender, SafetyProfilePhotoKind, VehicleOwnership, VehicleType, WorkSchedule } from '../enums/safety-profile.enums';
2
+ export interface SafetyProfilePhoto {
3
+ kind: SafetyProfilePhotoKind;
4
+ /** A DMS image the person uploaded themselves (checked when saved). */
5
+ imageId: number;
6
+ /** YYYY-MM-DD, when the photo was taken, if the person said. */
7
+ takenOn?: string | null;
8
+ }
9
+ export interface SafetyProfileAlternativePhone {
10
+ /** Canonical E.164. */
11
+ phoneNumber: string;
12
+ /** "Work phone", "Second SIM"... */
13
+ label?: string | null;
14
+ }
15
+ export interface IdentitySection {
16
+ /** What friends, guards, neighbours or colleagues call the person. Stored on the account (users.nickname). */
17
+ nickname?: string | null;
18
+ gender?: SafetyProfileGender | null;
19
+ /** The person's own words, when gender is OTHER. */
20
+ genderDescription?: string | null;
21
+ alternativePhones?: SafetyProfileAlternativePhone[];
22
+ /** Answered: there is no other number to try. */
23
+ noAlternativePhone?: boolean;
24
+ photos?: SafetyProfilePhoto[];
25
+ }
26
+ export interface MedicalSection {
27
+ bloodGroup?: BloodGroup | null;
28
+ heightCm?: number | null;
29
+ weightKg?: number | null;
30
+ allergies?: string[];
31
+ noKnownAllergies?: boolean;
32
+ chronicConditions?: ChronicCondition[];
33
+ /** What OTHER is, or detail on any condition. */
34
+ chronicConditionNotes?: string | null;
35
+ noChronicConditions?: boolean;
36
+ medications?: string[];
37
+ noMedications?: boolean;
38
+ disabilities?: DisabilityType[];
39
+ disabilityNotes?: string | null;
40
+ noDisabilities?: boolean;
41
+ pregnancyStatus?: PregnancyStatus | null;
42
+ /** YYYY-MM-DD, when PREGNANT. */
43
+ pregnancyDueDate?: string | null;
44
+ insuranceProvider?: string | null;
45
+ insuranceMemberNumber?: string | null;
46
+ noInsurance?: boolean;
47
+ medicalNotes?: string | null;
48
+ }
49
+ export interface ResidenceSection {
50
+ /** The person's HOME saved place - the GPS pin. */
51
+ savedPlaceId?: string | null;
52
+ /** The address as the person writes it (the saved place's own address is the geocoder's). */
53
+ addressLine?: string | null;
54
+ estateOrBuilding?: string | null;
55
+ houseNumber?: string | null;
56
+ floor?: string | null;
57
+ /** Shops, schools, petrol stations, churches, mosques, roads nearby. */
58
+ landmarks?: string | null;
59
+ }
60
+ export interface WorkplaceSection {
61
+ /** Answered: no regular workplace, school or business. */
62
+ noWorkplace?: boolean;
63
+ employerName?: string | null;
64
+ jobTitle?: string | null;
65
+ /** The person's WORK saved place. */
66
+ savedPlaceId?: string | null;
67
+ addressLine?: string | null;
68
+ floorOrDepartment?: string | null;
69
+ schedule?: WorkSchedule | null;
70
+ scheduleNotes?: string | null;
71
+ }
72
+ export interface FrequentPlace {
73
+ /** Client-made id (UUID) so an entry can be edited in place. */
74
+ id: string;
75
+ name: string;
76
+ type: FrequentPlaceType;
77
+ savedPlaceId?: string | null;
78
+ addressOrLandmark?: string | null;
79
+ /** "Usually parks near Basement B entrance", "Visits on Saturday afternoons". */
80
+ notes?: string | null;
81
+ }
82
+ export interface FrequentPlacesSection {
83
+ places?: FrequentPlace[];
84
+ /** Answered: nothing to add. */
85
+ noneToAdd?: boolean;
86
+ }
87
+ /** A place on a trip: a saved place, a name, or both. */
88
+ export interface TravelLocation {
89
+ savedPlaceId?: string | null;
90
+ name?: string | null;
91
+ }
92
+ export interface TravelCompanion {
93
+ name?: string | null;
94
+ /** Canonical E.164. */
95
+ phoneNumber?: string | null;
96
+ }
97
+ export interface TravelSection {
98
+ /** Answered: not travelling or on a temporary assignment at the moment. */
99
+ notTravelling?: boolean;
100
+ /** A field assignment or temporary work site. */
101
+ temporarySite?: TravelLocation | null;
102
+ accommodation?: TravelLocation | null;
103
+ roomNumber?: string | null;
104
+ companion?: TravelCompanion | null;
105
+ /** A concert, a meeting, a conference. */
106
+ eventLocation?: TravelLocation | null;
107
+ /** YYYY-MM-DD. */
108
+ expectedReturnDate?: string | null;
109
+ }
110
+ export interface Vehicle {
111
+ /** Client-made id (UUID). */
112
+ id: string;
113
+ ownership?: VehicleOwnership | null;
114
+ type?: VehicleType | null;
115
+ make?: string | null;
116
+ model?: string | null;
117
+ colour?: string | null;
118
+ registrationNumber?: string | null;
119
+ }
120
+ export interface VehicleSection {
121
+ vehicles?: Vehicle[];
122
+ /** Answered: does not drive or own a vehicle. */
123
+ noVehicle?: boolean;
124
+ }
125
+ export interface SafetyRiskSection {
126
+ knownThreats?: string | null;
127
+ noKnownThreats?: boolean;
128
+ highRiskOccupations?: HighRiskOccupation[];
129
+ occupationNotes?: string | null;
130
+ noHighRiskOccupation?: boolean;
131
+ /**
132
+ * In an emergency, do NOT call me: contact me silently (text, in-app) first.
133
+ * Critical in a kidnapping, GBV or security incident - a ringing phone can give
134
+ * the person away. Null = not answered.
135
+ */
136
+ silentEmergency?: boolean | null;
137
+ /** A word or phrase that tells the control room the person is under duress. */
138
+ safeWord?: string | null;
139
+ }
140
+ export interface DeviceSection {
141
+ /** 15-digit IMEIs the person typed (dial *#06#). Apps cannot read them. */
142
+ imeiNumbers?: string[];
143
+ /** Answered: the IMEI is not at hand / not to be shared. */
144
+ noImei?: boolean;
145
+ /** Canonical E.164 number of a second SIM. */
146
+ alternateSimNumber?: string | null;
147
+ /** Answered: one SIM only. */
148
+ singleSim?: boolean;
149
+ }
150
+ /** The decrypted document of each stored category. */
151
+ export interface SafetyProfileSectionDataMap {
152
+ [SafetyProfileCategory.IDENTITY]: IdentitySection;
153
+ [SafetyProfileCategory.MEDICAL]: MedicalSection;
154
+ [SafetyProfileCategory.RESIDENCE]: ResidenceSection;
155
+ [SafetyProfileCategory.WORKPLACE]: WorkplaceSection;
156
+ [SafetyProfileCategory.FREQUENT_PLACES]: FrequentPlacesSection;
157
+ [SafetyProfileCategory.TRAVEL]: TravelSection;
158
+ [SafetyProfileCategory.VEHICLE]: VehicleSection;
159
+ [SafetyProfileCategory.SAFETY_RISK]: SafetyRiskSection;
160
+ [SafetyProfileCategory.DEVICE]: DeviceSection;
161
+ }
162
+ export type StoredSafetyProfileCategory = keyof SafetyProfileSectionDataMap;
163
+ export type SafetyProfileSectionData = SafetyProfileSectionDataMap[StoredSafetyProfileCategory];