clarion-shared-types 1.0.132 → 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.
- package/dist/cjs/index.js +2 -0
- package/dist/cjs/index.js.map +1 -1
- package/dist/cjs/modules/analytics/analytics-country.js +83 -0
- package/dist/cjs/modules/analytics/analytics-country.js.map +1 -0
- package/dist/cjs/modules/analytics/index.js +18 -0
- package/dist/cjs/modules/analytics/index.js.map +1 -0
- package/dist/cjs/modules/incident-sla/interfaces/incident-sla.dto.js.map +1 -1
- package/dist/cjs/modules/permission/enums/permission-actions.enum.js +7 -0
- package/dist/cjs/modules/permission/enums/permission-actions.enum.js.map +1 -1
- package/dist/cjs/modules/permission/enums/permissions-moudule.enum.js +1 -0
- package/dist/cjs/modules/permission/enums/permissions-moudule.enum.js.map +1 -1
- package/dist/cjs/modules/safety-profile/constants/safety-profile.const.js +110 -0
- package/dist/cjs/modules/safety-profile/constants/safety-profile.const.js.map +1 -0
- package/dist/cjs/modules/safety-profile/enums/safety-profile.enums.js +188 -0
- package/dist/cjs/modules/safety-profile/enums/safety-profile.enums.js.map +1 -0
- package/dist/cjs/modules/safety-profile/index.js +27 -0
- package/dist/cjs/modules/safety-profile/index.js.map +1 -0
- package/dist/cjs/modules/safety-profile/interfaces/safety-profile-sections.js +4 -0
- package/dist/cjs/modules/safety-profile/interfaces/safety-profile-sections.js.map +1 -0
- package/dist/cjs/modules/safety-profile/interfaces/safety-profile-views.js +3 -0
- package/dist/cjs/modules/safety-profile/interfaces/safety-profile-views.js.map +1 -0
- package/dist/cjs/modules/safety-profile/utils/safety-profile-display.util.js +137 -0
- package/dist/cjs/modules/safety-profile/utils/safety-profile-display.util.js.map +1 -0
- package/dist/cjs/modules/safety-profile/utils/safety-profile-visibility.util.js +43 -0
- package/dist/cjs/modules/safety-profile/utils/safety-profile-visibility.util.js.map +1 -0
- package/dist/esm/index.js +2 -0
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/modules/analytics/analytics-country.js +74 -0
- package/dist/esm/modules/analytics/analytics-country.js.map +1 -0
- package/dist/esm/modules/analytics/index.js +2 -0
- package/dist/esm/modules/analytics/index.js.map +1 -0
- package/dist/esm/modules/incident-sla/interfaces/incident-sla.dto.js.map +1 -1
- package/dist/esm/modules/permission/enums/permission-actions.enum.js +7 -0
- package/dist/esm/modules/permission/enums/permission-actions.enum.js.map +1 -1
- package/dist/esm/modules/permission/enums/permissions-moudule.enum.js +1 -0
- package/dist/esm/modules/permission/enums/permissions-moudule.enum.js.map +1 -1
- package/dist/esm/modules/safety-profile/constants/safety-profile.const.js +107 -0
- package/dist/esm/modules/safety-profile/constants/safety-profile.const.js.map +1 -0
- package/dist/esm/modules/safety-profile/enums/safety-profile.enums.js +185 -0
- package/dist/esm/modules/safety-profile/enums/safety-profile.enums.js.map +1 -0
- package/dist/esm/modules/safety-profile/index.js +11 -0
- package/dist/esm/modules/safety-profile/index.js.map +1 -0
- package/dist/esm/modules/safety-profile/interfaces/safety-profile-sections.js +2 -0
- package/dist/esm/modules/safety-profile/interfaces/safety-profile-sections.js.map +1 -0
- package/dist/esm/modules/safety-profile/interfaces/safety-profile-views.js +2 -0
- package/dist/esm/modules/safety-profile/interfaces/safety-profile-views.js.map +1 -0
- package/dist/esm/modules/safety-profile/utils/safety-profile-display.util.js +132 -0
- package/dist/esm/modules/safety-profile/utils/safety-profile-display.util.js.map +1 -0
- package/dist/esm/modules/safety-profile/utils/safety-profile-visibility.util.js +40 -0
- package/dist/esm/modules/safety-profile/utils/safety-profile-visibility.util.js.map +1 -0
- package/dist/types/index.d.ts +2 -0
- package/dist/types/modules/alert-intake/interfaces/alert-intake-analytics.d.ts +9 -0
- package/dist/types/modules/analytics/analytics-country.d.ts +61 -0
- package/dist/types/modules/analytics/index.d.ts +1 -0
- package/dist/types/modules/billing/interfaces/billing-analytics.d.ts +41 -1
- package/dist/types/modules/chat/interfaces/chat-analytics.d.ts +5 -0
- package/dist/types/modules/dispatch/interfaces/dispatch-analytics.d.ts +7 -0
- package/dist/types/modules/gis/interfaces/zone-analytics.d.ts +7 -0
- package/dist/types/modules/incident/intefaces/incident-dashboard-analytics.d.ts +9 -0
- package/dist/types/modules/incident-sla/interfaces/incident-sla.dto.d.ts +9 -0
- package/dist/types/modules/newsfeed/interfaces/newsfeed-analytics.d.ts +5 -0
- package/dist/types/modules/notification/interfaces/notification-analytics.d.ts +5 -0
- package/dist/types/modules/organization/interfaces/organization-analytics.d.ts +9 -0
- package/dist/types/modules/partner/interfaces/partner-analytics.d.ts +9 -0
- package/dist/types/modules/permission/enums/permission-actions.enum.d.ts +3 -0
- package/dist/types/modules/permission/enums/permissions-moudule.enum.d.ts +1 -0
- package/dist/types/modules/safety/interfaces/safety-analytics.d.ts +9 -0
- package/dist/types/modules/safety-profile/constants/safety-profile.const.d.ts +69 -0
- package/dist/types/modules/safety-profile/enums/safety-profile.enums.d.ts +168 -0
- package/dist/types/modules/safety-profile/index.d.ts +6 -0
- package/dist/types/modules/safety-profile/interfaces/safety-profile-sections.d.ts +163 -0
- package/dist/types/modules/safety-profile/interfaces/safety-profile-views.d.ts +249 -0
- package/dist/types/modules/safety-profile/utils/safety-profile-display.util.d.ts +25 -0
- package/dist/types/modules/safety-profile/utils/safety-profile-visibility.util.d.ts +38 -0
- package/dist/types/modules/support/interfaces/support-analytics.d.ts +5 -0
- package/dist/types/modules/tracking/interfaces/tracking-analytics.d.ts +9 -0
- package/dist/types/modules/user/interfaces/account-analytics.d.ts +9 -0
- package/dist/types/modules/user/interfaces/guardian.d.ts +2 -0
- package/dist/types/modules/user/interfaces/guardians-response.d.ts +2 -0
- package/package.json +1 -1
|
@@ -0,0 +1,185 @@
|
|
|
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 var SafetyProfileCategory;
|
|
11
|
+
(function (SafetyProfileCategory) {
|
|
12
|
+
/** Nickname, gender, extra photos, other phone numbers (plus the account's name, photo, birth date, phone, e-mail). */
|
|
13
|
+
SafetyProfileCategory["IDENTITY"] = "IDENTITY";
|
|
14
|
+
SafetyProfileCategory["MEDICAL"] = "MEDICAL";
|
|
15
|
+
/** The guardian list (guardian_relations) - not stored in the profile, summarised from it. */
|
|
16
|
+
SafetyProfileCategory["EMERGENCY_CONTACTS"] = "EMERGENCY_CONTACTS";
|
|
17
|
+
SafetyProfileCategory["RESIDENCE"] = "RESIDENCE";
|
|
18
|
+
SafetyProfileCategory["WORKPLACE"] = "WORKPLACE";
|
|
19
|
+
SafetyProfileCategory["FREQUENT_PLACES"] = "FREQUENT_PLACES";
|
|
20
|
+
SafetyProfileCategory["TRAVEL"] = "TRAVEL";
|
|
21
|
+
SafetyProfileCategory["VEHICLE"] = "VEHICLE";
|
|
22
|
+
SafetyProfileCategory["SAFETY_RISK"] = "SAFETY_RISK";
|
|
23
|
+
/** Devices the app reported, last sign-in / activity, plus what the person typed (IMEI, second SIM). */
|
|
24
|
+
SafetyProfileCategory["DEVICE"] = "DEVICE";
|
|
25
|
+
})(SafetyProfileCategory || (SafetyProfileCategory = {}));
|
|
26
|
+
/** Who is looking at somebody else's profile. The owner is never an audience: they always see everything. */
|
|
27
|
+
export var SafetyProfileAudience;
|
|
28
|
+
(function (SafetyProfileAudience) {
|
|
29
|
+
/** Control-room staff (read:safety-profile), in the admin console. */
|
|
30
|
+
SafetyProfileAudience["CONTROL_CENTRE"] = "CONTROL_CENTRE";
|
|
31
|
+
/** A responder dispatched to the person's emergency, in the responder app (compact card only). */
|
|
32
|
+
SafetyProfileAudience["RESPONDER"] = "RESPONDER";
|
|
33
|
+
/** One of the person's own guardians (notified on SOS), in the app. */
|
|
34
|
+
SafetyProfileAudience["GUARDIAN"] = "GUARDIAN";
|
|
35
|
+
})(SafetyProfileAudience || (SafetyProfileAudience = {}));
|
|
36
|
+
/** Why a category with data in it was not shown to this viewer. */
|
|
37
|
+
export var SafetyProfileHiddenReason;
|
|
38
|
+
(function (SafetyProfileHiddenReason) {
|
|
39
|
+
/** The person shares it only during an active emergency, and there is none. */
|
|
40
|
+
SafetyProfileHiddenReason["ONLY_DURING_SOS"] = "ONLY_DURING_SOS";
|
|
41
|
+
/** The person has not shared it with their guardians. */
|
|
42
|
+
SafetyProfileHiddenReason["NOT_SHARED_WITH_GUARDIANS"] = "NOT_SHARED_WITH_GUARDIANS";
|
|
43
|
+
/** Never shown to this kind of viewer (e.g. the safe word to a guardian). */
|
|
44
|
+
SafetyProfileHiddenReason["NOT_FOR_AUDIENCE"] = "NOT_FOR_AUDIENCE";
|
|
45
|
+
})(SafetyProfileHiddenReason || (SafetyProfileHiddenReason = {}));
|
|
46
|
+
export var SafetyProfileErrorCode;
|
|
47
|
+
(function (SafetyProfileErrorCode) {
|
|
48
|
+
/** A category is written before the person agreed to share it. */
|
|
49
|
+
SafetyProfileErrorCode["CONSENT_REQUIRED"] = "SAFETY_PROFILE_CONSENT_REQUIRED";
|
|
50
|
+
/** Somebody else (another device) saved the category since it was read. */
|
|
51
|
+
SafetyProfileErrorCode["VERSION_CONFLICT"] = "SAFETY_PROFILE_VERSION_CONFLICT";
|
|
52
|
+
/** The section's data does not validate. `details.errors` lists the fields. */
|
|
53
|
+
SafetyProfileErrorCode["INVALID_SECTION"] = "SAFETY_PROFILE_INVALID_SECTION";
|
|
54
|
+
/** The category cannot be written (EMERGENCY_CONTACTS is the guardian list). */
|
|
55
|
+
SafetyProfileErrorCode["CATEGORY_NOT_WRITABLE"] = "SAFETY_PROFILE_CATEGORY_NOT_WRITABLE";
|
|
56
|
+
/** Safety profiles cannot be stored or read right now: the encryption key is not configured. */
|
|
57
|
+
SafetyProfileErrorCode["ENCRYPTION_UNAVAILABLE"] = "SAFETY_PROFILE_ENCRYPTION_UNAVAILABLE";
|
|
58
|
+
/** A photo id that is not one of the person's own uploads. */
|
|
59
|
+
SafetyProfileErrorCode["PHOTO_NOT_YOURS"] = "SAFETY_PROFILE_PHOTO_NOT_YOURS";
|
|
60
|
+
/** A saved place id that is not one of the person's own places. */
|
|
61
|
+
SafetyProfileErrorCode["PLACE_NOT_YOURS"] = "SAFETY_PROFILE_PLACE_NOT_YOURS";
|
|
62
|
+
/** The viewer may not see this person's profile at all. */
|
|
63
|
+
SafetyProfileErrorCode["NOT_AUTHORISED"] = "SAFETY_PROFILE_NOT_AUTHORISED";
|
|
64
|
+
/** A responder asked outside an active dispatch. */
|
|
65
|
+
SafetyProfileErrorCode["EMERGENCY_REQUIRED"] = "SAFETY_PROFILE_EMERGENCY_REQUIRED";
|
|
66
|
+
/** The incident does not belong to the person whose profile was asked for. */
|
|
67
|
+
SafetyProfileErrorCode["INCIDENT_MISMATCH"] = "SAFETY_PROFILE_INCIDENT_MISMATCH";
|
|
68
|
+
/** The caller of the incident is anonymous, or the organization hides them from responders. */
|
|
69
|
+
SafetyProfileErrorCode["CALLER_NOT_SHARED"] = "SAFETY_PROFILE_CALLER_NOT_SHARED";
|
|
70
|
+
/** An emergency override without a usable reason. */
|
|
71
|
+
SafetyProfileErrorCode["OVERRIDE_REASON_REQUIRED"] = "SAFETY_PROFILE_OVERRIDE_REASON_REQUIRED";
|
|
72
|
+
})(SafetyProfileErrorCode || (SafetyProfileErrorCode = {}));
|
|
73
|
+
export var SafetyProfileGender;
|
|
74
|
+
(function (SafetyProfileGender) {
|
|
75
|
+
SafetyProfileGender["FEMALE"] = "FEMALE";
|
|
76
|
+
SafetyProfileGender["MALE"] = "MALE";
|
|
77
|
+
SafetyProfileGender["OTHER"] = "OTHER";
|
|
78
|
+
SafetyProfileGender["PREFER_NOT_TO_SAY"] = "PREFER_NOT_TO_SAY";
|
|
79
|
+
})(SafetyProfileGender || (SafetyProfileGender = {}));
|
|
80
|
+
/** The extra photos that help somebody be recognised. */
|
|
81
|
+
export var SafetyProfilePhotoKind;
|
|
82
|
+
(function (SafetyProfilePhotoKind) {
|
|
83
|
+
SafetyProfilePhotoKind["FRONT"] = "FRONT";
|
|
84
|
+
SafetyProfilePhotoKind["SIDE"] = "SIDE";
|
|
85
|
+
SafetyProfilePhotoKind["FULL_BODY"] = "FULL_BODY";
|
|
86
|
+
/** Optional: how the person looks lately (haircut, beard...). Not counted for completeness. */
|
|
87
|
+
SafetyProfilePhotoKind["RECENT"] = "RECENT";
|
|
88
|
+
})(SafetyProfilePhotoKind || (SafetyProfilePhotoKind = {}));
|
|
89
|
+
export var BloodGroup;
|
|
90
|
+
(function (BloodGroup) {
|
|
91
|
+
BloodGroup["A_POSITIVE"] = "A_POSITIVE";
|
|
92
|
+
BloodGroup["A_NEGATIVE"] = "A_NEGATIVE";
|
|
93
|
+
BloodGroup["B_POSITIVE"] = "B_POSITIVE";
|
|
94
|
+
BloodGroup["B_NEGATIVE"] = "B_NEGATIVE";
|
|
95
|
+
BloodGroup["AB_POSITIVE"] = "AB_POSITIVE";
|
|
96
|
+
BloodGroup["AB_NEGATIVE"] = "AB_NEGATIVE";
|
|
97
|
+
BloodGroup["O_POSITIVE"] = "O_POSITIVE";
|
|
98
|
+
BloodGroup["O_NEGATIVE"] = "O_NEGATIVE";
|
|
99
|
+
/** Answered: the person does not know theirs. */
|
|
100
|
+
BloodGroup["UNKNOWN"] = "UNKNOWN";
|
|
101
|
+
})(BloodGroup || (BloodGroup = {}));
|
|
102
|
+
export var ChronicCondition;
|
|
103
|
+
(function (ChronicCondition) {
|
|
104
|
+
ChronicCondition["DIABETES"] = "DIABETES";
|
|
105
|
+
ChronicCondition["ASTHMA"] = "ASTHMA";
|
|
106
|
+
ChronicCondition["EPILEPSY"] = "EPILEPSY";
|
|
107
|
+
ChronicCondition["HEART_DISEASE"] = "HEART_DISEASE";
|
|
108
|
+
ChronicCondition["HYPERTENSION"] = "HYPERTENSION";
|
|
109
|
+
ChronicCondition["SICKLE_CELL"] = "SICKLE_CELL";
|
|
110
|
+
ChronicCondition["KIDNEY_DISEASE"] = "KIDNEY_DISEASE";
|
|
111
|
+
ChronicCondition["OTHER"] = "OTHER";
|
|
112
|
+
})(ChronicCondition || (ChronicCondition = {}));
|
|
113
|
+
export var DisabilityType;
|
|
114
|
+
(function (DisabilityType) {
|
|
115
|
+
DisabilityType["MOBILITY"] = "MOBILITY";
|
|
116
|
+
DisabilityType["HEARING"] = "HEARING";
|
|
117
|
+
DisabilityType["VISION"] = "VISION";
|
|
118
|
+
DisabilityType["COGNITIVE"] = "COGNITIVE";
|
|
119
|
+
DisabilityType["SPEECH"] = "SPEECH";
|
|
120
|
+
DisabilityType["OTHER"] = "OTHER";
|
|
121
|
+
})(DisabilityType || (DisabilityType = {}));
|
|
122
|
+
export var PregnancyStatus;
|
|
123
|
+
(function (PregnancyStatus) {
|
|
124
|
+
PregnancyStatus["NOT_PREGNANT"] = "NOT_PREGNANT";
|
|
125
|
+
PregnancyStatus["PREGNANT"] = "PREGNANT";
|
|
126
|
+
PregnancyStatus["PREFER_NOT_TO_SAY"] = "PREFER_NOT_TO_SAY";
|
|
127
|
+
})(PregnancyStatus || (PregnancyStatus = {}));
|
|
128
|
+
export var WorkSchedule;
|
|
129
|
+
(function (WorkSchedule) {
|
|
130
|
+
WorkSchedule["OFFICE_HOURS"] = "OFFICE_HOURS";
|
|
131
|
+
WorkSchedule["NIGHT_SHIFT"] = "NIGHT_SHIFT";
|
|
132
|
+
WorkSchedule["ROTATING_SHIFTS"] = "ROTATING_SHIFTS";
|
|
133
|
+
WorkSchedule["FIELD_WORK"] = "FIELD_WORK";
|
|
134
|
+
WorkSchedule["REMOTE"] = "REMOTE";
|
|
135
|
+
WorkSchedule["OTHER"] = "OTHER";
|
|
136
|
+
})(WorkSchedule || (WorkSchedule = {}));
|
|
137
|
+
export var FrequentPlaceType;
|
|
138
|
+
(function (FrequentPlaceType) {
|
|
139
|
+
FrequentPlaceType["FAMILY_HOME"] = "FAMILY_HOME";
|
|
140
|
+
FrequentPlaceType["FRIENDS_PLACE"] = "FRIENDS_PLACE";
|
|
141
|
+
FrequentPlaceType["GYM_SPORTS_CLUB"] = "GYM_SPORTS_CLUB";
|
|
142
|
+
FrequentPlaceType["RELIGIOUS_PLACE"] = "RELIGIOUS_PLACE";
|
|
143
|
+
FrequentPlaceType["MEDICAL_FACILITY"] = "MEDICAL_FACILITY";
|
|
144
|
+
FrequentPlaceType["SHOPPING"] = "SHOPPING";
|
|
145
|
+
FrequentPlaceType["ENTERTAINMENT"] = "ENTERTAINMENT";
|
|
146
|
+
FrequentPlaceType["CHILDCARE"] = "CHILDCARE";
|
|
147
|
+
FrequentPlaceType["TRANSPORT_POINT"] = "TRANSPORT_POINT";
|
|
148
|
+
FrequentPlaceType["REGULAR_ROUTE"] = "REGULAR_ROUTE";
|
|
149
|
+
FrequentPlaceType["RURAL_HOME"] = "RURAL_HOME";
|
|
150
|
+
FrequentPlaceType["OTHER"] = "OTHER";
|
|
151
|
+
})(FrequentPlaceType || (FrequentPlaceType = {}));
|
|
152
|
+
export var VehicleOwnership;
|
|
153
|
+
(function (VehicleOwnership) {
|
|
154
|
+
VehicleOwnership["OWN"] = "OWN";
|
|
155
|
+
VehicleOwnership["COMPANY"] = "COMPANY";
|
|
156
|
+
VehicleOwnership["FAMILY"] = "FAMILY";
|
|
157
|
+
VehicleOwnership["OTHER"] = "OTHER";
|
|
158
|
+
})(VehicleOwnership || (VehicleOwnership = {}));
|
|
159
|
+
export var VehicleType;
|
|
160
|
+
(function (VehicleType) {
|
|
161
|
+
VehicleType["CAR"] = "CAR";
|
|
162
|
+
VehicleType["MOTORCYCLE"] = "MOTORCYCLE";
|
|
163
|
+
VehicleType["BICYCLE"] = "BICYCLE";
|
|
164
|
+
VehicleType["TRUCK"] = "TRUCK";
|
|
165
|
+
VehicleType["SCOOTER"] = "SCOOTER";
|
|
166
|
+
VehicleType["OTHER"] = "OTHER";
|
|
167
|
+
})(VehicleType || (VehicleType = {}));
|
|
168
|
+
export var HighRiskOccupation;
|
|
169
|
+
(function (HighRiskOccupation) {
|
|
170
|
+
HighRiskOccupation["CASH_HANDLING"] = "CASH_HANDLING";
|
|
171
|
+
HighRiskOccupation["NIGHT_WORK"] = "NIGHT_WORK";
|
|
172
|
+
HighRiskOccupation["SECURITY"] = "SECURITY";
|
|
173
|
+
HighRiskOccupation["FIELD_SALES"] = "FIELD_SALES";
|
|
174
|
+
HighRiskOccupation["JOURNALISM"] = "JOURNALISM";
|
|
175
|
+
HighRiskOccupation["HEALTHCARE"] = "HEALTHCARE";
|
|
176
|
+
HighRiskOccupation["TRANSPORT"] = "TRANSPORT";
|
|
177
|
+
HighRiskOccupation["OTHER"] = "OTHER";
|
|
178
|
+
})(HighRiskOccupation || (HighRiskOccupation = {}));
|
|
179
|
+
/** The detail level of a view: the admin console's full profile, or the responder's one card. */
|
|
180
|
+
export var SafetyProfileViewFormat;
|
|
181
|
+
(function (SafetyProfileViewFormat) {
|
|
182
|
+
SafetyProfileViewFormat["FULL"] = "FULL";
|
|
183
|
+
SafetyProfileViewFormat["COMPACT"] = "COMPACT";
|
|
184
|
+
})(SafetyProfileViewFormat || (SafetyProfileViewFormat = {}));
|
|
185
|
+
//# sourceMappingURL=safety-profile.enums.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"safety-profile.enums.js","sourceRoot":"","sources":["../../../../../src/modules/safety-profile/enums/safety-profile.enums.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AACH,MAAM,CAAN,IAAY,qBAcX;AAdD,WAAY,qBAAqB;IAC7B,uHAAuH;IACvH,8CAAqB,CAAA;IACrB,4CAAmB,CAAA;IACnB,8FAA8F;IAC9F,kEAAyC,CAAA;IACzC,gDAAuB,CAAA;IACvB,gDAAuB,CAAA;IACvB,4DAAmC,CAAA;IACnC,0CAAiB,CAAA;IACjB,4CAAmB,CAAA;IACnB,oDAA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AHW,uBAAuB,KAAvB,uBAAuB,QAGlC"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
// Enums
|
|
2
|
+
export * from './enums/safety-profile.enums';
|
|
3
|
+
// Constants
|
|
4
|
+
export * from './constants/safety-profile.const';
|
|
5
|
+
// Interfaces
|
|
6
|
+
export * from './interfaces/safety-profile-sections';
|
|
7
|
+
export * from './interfaces/safety-profile-views';
|
|
8
|
+
// Utilities
|
|
9
|
+
export * from './utils/safety-profile-visibility.util';
|
|
10
|
+
export * from './utils/safety-profile-display.util';
|
|
11
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/modules/safety-profile/index.ts"],"names":[],"mappings":"AAAA,QAAQ;AACR,cAAc,8BAA8B,CAAC;AAE7C,YAAY;AACZ,cAAc,kCAAkC,CAAC;AAEjD,aAAa;AACb,cAAc,sCAAsC,CAAC;AACrD,cAAc,mCAAmC,CAAC;AAElD,YAAY;AACZ,cAAc,wCAAwC,CAAC;AACvD,cAAc,qCAAqC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"safety-profile-sections.js","sourceRoot":"","sources":["../../../../../src/modules/safety-profile/interfaces/safety-profile-sections.ts"],"names":[],"mappings":"AAAA,OAAO,EAOH,qBAAqB,GAMxB,MAAM,+BAA+B,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"safety-profile-views.js","sourceRoot":"","sources":["../../../../../src/modules/safety-profile/interfaces/safety-profile-views.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,132 @@
|
|
|
1
|
+
import { BloodGroup, ChronicCondition, DisabilityType, FrequentPlaceType, HighRiskOccupation, PregnancyStatus, SafetyProfileAudience, SafetyProfileGender, SafetyProfileHiddenReason, SafetyProfilePhotoKind, VehicleOwnership, VehicleType, WorkSchedule, } from '../enums/safety-profile.enums';
|
|
2
|
+
/**
|
|
3
|
+
* Human labels for the Safety Profile enums, so every console screen names a
|
|
4
|
+
* value the same way the app does.
|
|
5
|
+
*/
|
|
6
|
+
export const SAFETY_PROFILE_GENDER_LABELS = {
|
|
7
|
+
[SafetyProfileGender.FEMALE]: 'Female',
|
|
8
|
+
[SafetyProfileGender.MALE]: 'Male',
|
|
9
|
+
[SafetyProfileGender.OTHER]: 'Other',
|
|
10
|
+
[SafetyProfileGender.PREFER_NOT_TO_SAY]: 'Prefers not to say',
|
|
11
|
+
};
|
|
12
|
+
export const SAFETY_PROFILE_PHOTO_KIND_LABELS = {
|
|
13
|
+
[SafetyProfilePhotoKind.FRONT]: 'Front',
|
|
14
|
+
[SafetyProfilePhotoKind.SIDE]: 'Side',
|
|
15
|
+
[SafetyProfilePhotoKind.FULL_BODY]: 'Full body',
|
|
16
|
+
[SafetyProfilePhotoKind.RECENT]: 'Recent',
|
|
17
|
+
};
|
|
18
|
+
export const BLOOD_GROUP_LABELS = {
|
|
19
|
+
[BloodGroup.A_POSITIVE]: 'A+',
|
|
20
|
+
[BloodGroup.A_NEGATIVE]: 'A−',
|
|
21
|
+
[BloodGroup.B_POSITIVE]: 'B+',
|
|
22
|
+
[BloodGroup.B_NEGATIVE]: 'B−',
|
|
23
|
+
[BloodGroup.AB_POSITIVE]: 'AB+',
|
|
24
|
+
[BloodGroup.AB_NEGATIVE]: 'AB−',
|
|
25
|
+
[BloodGroup.O_POSITIVE]: 'O+',
|
|
26
|
+
[BloodGroup.O_NEGATIVE]: 'O−',
|
|
27
|
+
[BloodGroup.UNKNOWN]: 'Unknown',
|
|
28
|
+
};
|
|
29
|
+
export const CHRONIC_CONDITION_LABELS = {
|
|
30
|
+
[ChronicCondition.DIABETES]: 'Diabetes',
|
|
31
|
+
[ChronicCondition.ASTHMA]: 'Asthma',
|
|
32
|
+
[ChronicCondition.EPILEPSY]: 'Epilepsy',
|
|
33
|
+
[ChronicCondition.HEART_DISEASE]: 'Heart disease',
|
|
34
|
+
[ChronicCondition.HYPERTENSION]: 'Hypertension',
|
|
35
|
+
[ChronicCondition.SICKLE_CELL]: 'Sickle cell',
|
|
36
|
+
[ChronicCondition.KIDNEY_DISEASE]: 'Kidney disease',
|
|
37
|
+
[ChronicCondition.OTHER]: 'Other',
|
|
38
|
+
};
|
|
39
|
+
export const DISABILITY_TYPE_LABELS = {
|
|
40
|
+
[DisabilityType.MOBILITY]: 'Mobility',
|
|
41
|
+
[DisabilityType.HEARING]: 'Hearing',
|
|
42
|
+
[DisabilityType.VISION]: 'Vision',
|
|
43
|
+
[DisabilityType.COGNITIVE]: 'Cognitive',
|
|
44
|
+
[DisabilityType.SPEECH]: 'Speech',
|
|
45
|
+
[DisabilityType.OTHER]: 'Other',
|
|
46
|
+
};
|
|
47
|
+
export const PREGNANCY_STATUS_LABELS = {
|
|
48
|
+
[PregnancyStatus.NOT_PREGNANT]: 'Not pregnant',
|
|
49
|
+
[PregnancyStatus.PREGNANT]: 'Pregnant',
|
|
50
|
+
[PregnancyStatus.PREFER_NOT_TO_SAY]: 'Prefers not to say',
|
|
51
|
+
};
|
|
52
|
+
export const WORK_SCHEDULE_LABELS = {
|
|
53
|
+
[WorkSchedule.OFFICE_HOURS]: 'Office hours',
|
|
54
|
+
[WorkSchedule.NIGHT_SHIFT]: 'Night shift',
|
|
55
|
+
[WorkSchedule.ROTATING_SHIFTS]: 'Rotating shifts',
|
|
56
|
+
[WorkSchedule.FIELD_WORK]: 'Field work',
|
|
57
|
+
[WorkSchedule.REMOTE]: 'Remote',
|
|
58
|
+
[WorkSchedule.OTHER]: 'Other',
|
|
59
|
+
};
|
|
60
|
+
export const FREQUENT_PLACE_TYPE_LABELS = {
|
|
61
|
+
[FrequentPlaceType.FAMILY_HOME]: 'Family home',
|
|
62
|
+
[FrequentPlaceType.FRIENDS_PLACE]: "Friend's place",
|
|
63
|
+
[FrequentPlaceType.GYM_SPORTS_CLUB]: 'Gym / sports club',
|
|
64
|
+
[FrequentPlaceType.RELIGIOUS_PLACE]: 'Religious place',
|
|
65
|
+
[FrequentPlaceType.MEDICAL_FACILITY]: 'Medical facility',
|
|
66
|
+
[FrequentPlaceType.SHOPPING]: 'Shopping',
|
|
67
|
+
[FrequentPlaceType.ENTERTAINMENT]: 'Entertainment',
|
|
68
|
+
[FrequentPlaceType.CHILDCARE]: 'Childcare / school',
|
|
69
|
+
[FrequentPlaceType.TRANSPORT_POINT]: 'Transport point',
|
|
70
|
+
[FrequentPlaceType.REGULAR_ROUTE]: 'Regular route',
|
|
71
|
+
[FrequentPlaceType.RURAL_HOME]: 'Rural home',
|
|
72
|
+
[FrequentPlaceType.OTHER]: 'Other',
|
|
73
|
+
};
|
|
74
|
+
export const VEHICLE_OWNERSHIP_LABELS = {
|
|
75
|
+
[VehicleOwnership.OWN]: 'Own',
|
|
76
|
+
[VehicleOwnership.COMPANY]: 'Company',
|
|
77
|
+
[VehicleOwnership.FAMILY]: 'Family',
|
|
78
|
+
[VehicleOwnership.OTHER]: 'Other',
|
|
79
|
+
};
|
|
80
|
+
export const VEHICLE_TYPE_LABELS = {
|
|
81
|
+
[VehicleType.CAR]: 'Car',
|
|
82
|
+
[VehicleType.MOTORCYCLE]: 'Motorcycle',
|
|
83
|
+
[VehicleType.BICYCLE]: 'Bicycle',
|
|
84
|
+
[VehicleType.TRUCK]: 'Truck',
|
|
85
|
+
[VehicleType.SCOOTER]: 'Scooter',
|
|
86
|
+
[VehicleType.OTHER]: 'Other',
|
|
87
|
+
};
|
|
88
|
+
export const HIGH_RISK_OCCUPATION_LABELS = {
|
|
89
|
+
[HighRiskOccupation.CASH_HANDLING]: 'Cash handling',
|
|
90
|
+
[HighRiskOccupation.NIGHT_WORK]: 'Night work',
|
|
91
|
+
[HighRiskOccupation.SECURITY]: 'Security',
|
|
92
|
+
[HighRiskOccupation.FIELD_SALES]: 'Field sales',
|
|
93
|
+
[HighRiskOccupation.JOURNALISM]: 'Journalism',
|
|
94
|
+
[HighRiskOccupation.HEALTHCARE]: 'Healthcare',
|
|
95
|
+
[HighRiskOccupation.TRANSPORT]: 'Transport',
|
|
96
|
+
[HighRiskOccupation.OTHER]: 'Other',
|
|
97
|
+
};
|
|
98
|
+
export const SAFETY_PROFILE_AUDIENCE_LABELS = {
|
|
99
|
+
[SafetyProfileAudience.CONTROL_CENTRE]: 'Control room',
|
|
100
|
+
[SafetyProfileAudience.RESPONDER]: 'Responder',
|
|
101
|
+
[SafetyProfileAudience.GUARDIAN]: 'Guardian',
|
|
102
|
+
};
|
|
103
|
+
export const SAFETY_PROFILE_HIDDEN_REASON_LABELS = {
|
|
104
|
+
[SafetyProfileHiddenReason.ONLY_DURING_SOS]: 'Shared only during an active SOS',
|
|
105
|
+
[SafetyProfileHiddenReason.NOT_SHARED_WITH_GUARDIANS]: 'Not shared with guardians',
|
|
106
|
+
[SafetyProfileHiddenReason.NOT_FOR_AUDIENCE]: 'Not shared with this role',
|
|
107
|
+
};
|
|
108
|
+
/**
|
|
109
|
+
* The label for a value of any of the maps above, or the raw value when it is
|
|
110
|
+
* unknown (a newer server) - never blank.
|
|
111
|
+
*/
|
|
112
|
+
export function safetyProfileLabel(labels, value) {
|
|
113
|
+
var _a;
|
|
114
|
+
if (value === null || value === undefined || value === '')
|
|
115
|
+
return '';
|
|
116
|
+
return (_a = labels[value]) !== null && _a !== void 0 ? _a : String(value).replace(/_/g, ' ').toLowerCase().replace(/^\w/, (c) => c.toUpperCase());
|
|
117
|
+
}
|
|
118
|
+
/** "35 years" from a YYYY-MM-DD date of birth, or null; `today` is injectable for tests. */
|
|
119
|
+
export function safetyProfileAge(dateOfBirth, today = new Date()) {
|
|
120
|
+
if (!dateOfBirth)
|
|
121
|
+
return null;
|
|
122
|
+
const match = /^(\d{4})-(\d{2})-(\d{2})/.exec(dateOfBirth);
|
|
123
|
+
if (!match)
|
|
124
|
+
return null;
|
|
125
|
+
const [year, month, day] = [Number(match[1]), Number(match[2]), Number(match[3])];
|
|
126
|
+
let age = today.getUTCFullYear() - year;
|
|
127
|
+
const beforeBirthday = today.getUTCMonth() + 1 < month || (today.getUTCMonth() + 1 === month && today.getUTCDate() < day);
|
|
128
|
+
if (beforeBirthday)
|
|
129
|
+
age -= 1;
|
|
130
|
+
return age >= 0 && age < 150 ? age : null;
|
|
131
|
+
}
|
|
132
|
+
//# sourceMappingURL=safety-profile-display.util.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"safety-profile-display.util.js","sourceRoot":"","sources":["../../../../../src/modules/safety-profile/utils/safety-profile-display.util.ts"],"names":[],"mappings":"AAAA,OAAO,EACH,UAAU,EACV,gBAAgB,EAChB,cAAc,EACd,iBAAiB,EACjB,kBAAkB,EAClB,eAAe,EACf,qBAAqB,EACrB,mBAAmB,EACnB,yBAAyB,EACzB,sBAAsB,EACtB,gBAAgB,EAChB,WAAW,EACX,YAAY,GACf,MAAM,+BAA+B,CAAC;AAEvC;;;GAGG;AACH,MAAM,CAAC,MAAM,4BAA4B,GAAkD;IACvF,CAAC,mBAAmB,CAAC,MAAM,CAAC,EAAE,QAAQ;IACtC,CAAC,mBAAmB,CAAC,IAAI,CAAC,EAAE,MAAM;IAClC,CAAC,mBAAmB,CAAC,KAAK,CAAC,EAAE,OAAO;IACpC,CAAC,mBAAmB,CAAC,iBAAiB,CAAC,EAAE,oBAAoB;CAChE,CAAC;AAEF,MAAM,CAAC,MAAM,gCAAgC,GAAqD;IAC9F,CAAC,sBAAsB,CAAC,KAAK,CAAC,EAAE,OAAO;IACvC,CAAC,sBAAsB,CAAC,IAAI,CAAC,EAAE,MAAM;IACrC,CAAC,sBAAsB,CAAC,SAAS,CAAC,EAAE,WAAW;IAC/C,CAAC,sBAAsB,CAAC,MAAM,CAAC,EAAE,QAAQ;CAC5C,CAAC;AAEF,MAAM,CAAC,MAAM,kBAAkB,GAAyC;IACpE,CAAC,UAAU,CAAC,UAAU,CAAC,EAAE,IAAI;IAC7B,CAAC,UAAU,CAAC,UAAU,CAAC,EAAE,IAAI;IAC7B,CAAC,UAAU,CAAC,U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AC,KAAK,KAAK,IAAI,KAAK,CAAC,UAAU,EAAE,GAAG,GAAG,CAAC,CAAC;IAC1H,IAAI,cAAc;QAAE,GAAG,IAAI,CAAC,CAAC;IAC7B,OAAO,GAAG,IAAI,CAAC,IAAI,GAAG,GAAG,GAAG,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,IAAI,CAAC;AAC9C,CAAC"}
|
|
@@ -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+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AC,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"}
|
package/dist/types/index.d.ts
CHANGED
|
@@ -23,10 +23,12 @@ 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';
|
|
29
30
|
export * from './modules/incident-sla/index';
|
|
31
|
+
export * from './modules/analytics/index';
|
|
30
32
|
export * from './modules/responder/index';
|
|
31
33
|
export * from './modules/common/interfaces/server-message';
|
|
32
34
|
export * from './modules/common/interfaces/pagination';
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { AlertIntakeChannel, AlertIntakeMessageState, AlertIntakeScreeningReason, AlertIntakeScreeningSource, AlertIntakeScreeningStatus } from '../enums/alert-intake.enum';
|
|
2
|
+
import { AnalyticsCountryRow, AnalyticsLocalTimes } from '../../analytics/analytics-country';
|
|
2
3
|
/**
|
|
3
4
|
* Alert intake analytics: what arrived on an organization's channels over a period, what
|
|
4
5
|
* became of it, what the AI made of it and what that cost. One read, computed by
|
|
@@ -238,6 +239,12 @@ export interface AlertIntakeAnalytics {
|
|
|
238
239
|
ai: AlertIntakeAnalyticsAi;
|
|
239
240
|
/** Platform view only. */
|
|
240
241
|
byOrganization?: AlertIntakeAnalyticsOrganizationRow[];
|
|
242
|
+
/** The country the figures are narrowed to (each record's own country); null for every country. */
|
|
243
|
+
countryCode: string | null;
|
|
244
|
+
/** How the hour-of-week grids read time: in `range.timeZone` ('zone'), or each record in its own country's zone ('record'). */
|
|
245
|
+
localTimes: AnalyticsLocalTimes;
|
|
246
|
+
/** Every country in scope side by side for the period, the country filter left out: largest first, Unknown last. */
|
|
247
|
+
countryComparison: AnalyticsCountryRow[];
|
|
241
248
|
}
|
|
242
249
|
/**
|
|
243
250
|
* The period an analytics read covers (query string). Both ends optional: no `from` is
|
|
@@ -247,6 +254,8 @@ export interface AlertIntakeAnalyticsQuery {
|
|
|
247
254
|
from?: string;
|
|
248
255
|
to?: string;
|
|
249
256
|
timeZone?: string;
|
|
257
|
+
/** One country's records only; its days in that country's zone. */
|
|
258
|
+
countryCode?: string;
|
|
250
259
|
}
|
|
251
260
|
/** Platform operators: every organization's analytics, or one organization's. */
|
|
252
261
|
export interface PlatformAlertIntakeAnalyticsQuery extends AlertIntakeAnalyticsQuery {
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import { CountryCode } from '../country/enums/country-code.enum';
|
|
2
|
+
/**
|
|
3
|
+
* Analytics in every country, the rules every analytics family follows:
|
|
4
|
+
*
|
|
5
|
+
* - A `countryCode` narrows a read to the records OF that country: each record's own country
|
|
6
|
+
* (an incident's, an account's, a payment's), never the reader's.
|
|
7
|
+
* - A record with no country of its own is counted as `UNKNOWN` - never as Kenya.
|
|
8
|
+
* - With one country, days and hours are cut in that country's zone. With every country, the
|
|
9
|
+
* charts keep one zone (the one asked for, else the platform's), and the hour-of-week grids
|
|
10
|
+
* read each record in its own country's zone: 14:00 in Lusaka counts as 14:00.
|
|
11
|
+
* - `byCountry` splits the period's figures by country, the country filter left out, so a
|
|
12
|
+
* Super-Admin can compare countries side by side.
|
|
13
|
+
*/
|
|
14
|
+
/** A record with no country of its own: counted apart, never as Kenya. */
|
|
15
|
+
export declare const UNKNOWN_COUNTRY = "UNKNOWN";
|
|
16
|
+
export type AnalyticsCountryKey = CountryCode | typeof UNKNOWN_COUNTRY;
|
|
17
|
+
/**
|
|
18
|
+
* How the hour-of-week (and hour-of-day) grids read a record's time:
|
|
19
|
+
* - `zone` in the read's `timeZone` (one country, or records without a country);
|
|
20
|
+
* - `record` each record in its own country's zone (every country).
|
|
21
|
+
*/
|
|
22
|
+
export type AnalyticsLocalTimes = 'zone' | 'record';
|
|
23
|
+
/** The platform's zone, for a read that names neither a country nor a zone. */
|
|
24
|
+
export declare const PLATFORM_ANALYTICS_TIME_ZONE = "Africa/Nairobi";
|
|
25
|
+
/**
|
|
26
|
+
* One country's share of a family's figures. `count` is the family's headline count (incidents,
|
|
27
|
+
* accounts, messages, payments); `figures` the few that compare fairly across countries - rates,
|
|
28
|
+
* medians, per-1,000 ratios - keyed by names the family documents.
|
|
29
|
+
*/
|
|
30
|
+
export interface AnalyticsCountryRow {
|
|
31
|
+
countryCode: AnalyticsCountryKey;
|
|
32
|
+
count: number;
|
|
33
|
+
/** `count` as a percentage of every country's, one decimal; null when there is nothing at all. */
|
|
34
|
+
share: number | null;
|
|
35
|
+
figures: Record<string, number | null>;
|
|
36
|
+
/** Money figures only: the currency they are in. A country with two currencies has two rows. */
|
|
37
|
+
currency?: string | null;
|
|
38
|
+
}
|
|
39
|
+
/** A supported country's code, or `UNKNOWN` for anything else (null, blank, an unsupported code). */
|
|
40
|
+
export declare function analyticsCountryKey(raw: unknown): AnalyticsCountryKey;
|
|
41
|
+
/** A supported country's code, or null. */
|
|
42
|
+
export declare function analyticsCountryFilter(raw: unknown): CountryCode | null;
|
|
43
|
+
/**
|
|
44
|
+
* The zone a read cuts its days and hours in: the country's own when one is asked for (so a
|
|
45
|
+
* Zambian view reads CAT whoever looks at it), else the zone asked for, else the platform's.
|
|
46
|
+
*/
|
|
47
|
+
export declare function analyticsTimeZone(countryCode: unknown, asked?: string | null, fallback?: string): string;
|
|
48
|
+
/** One country: its zone throughout. Every country: each record in its own. */
|
|
49
|
+
export declare function analyticsLocalTimes(countryCode: unknown): AnalyticsLocalTimes;
|
|
50
|
+
/** The order countries are listed in: the platform's order (Kenya, Uganda, Tanzania, Zambia), Unknown last. */
|
|
51
|
+
export declare function analyticsCountryOrder(key: string): number;
|
|
52
|
+
/**
|
|
53
|
+
* Rows by country as a family returns them: shares filled in, the largest first, Unknown always
|
|
54
|
+
* last, ties in the platform's order. Rows with nothing at all are left out.
|
|
55
|
+
*/
|
|
56
|
+
export declare function analyticsCountryRows(rows: Array<{
|
|
57
|
+
countryCode: unknown;
|
|
58
|
+
count: number;
|
|
59
|
+
figures?: Record<string, number | null>;
|
|
60
|
+
currency?: string | null;
|
|
61
|
+
}>): AnalyticsCountryRow[];
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './analytics-country';
|
|
@@ -12,6 +12,7 @@
|
|
|
12
12
|
* client and a package appear by name - they are the organization's own customers and
|
|
13
13
|
* products, already on its billing screens.
|
|
14
14
|
*/
|
|
15
|
+
import { AnalyticsCountryRow, AnalyticsLocalTimes } from '../../analytics/analytics-country';
|
|
15
16
|
/** How the period is cut into points for the charts. Chosen by the service from the length of the period. */
|
|
16
17
|
export type BillingAnalyticsBucket = 'hour' | 'day' | 'week' | 'month';
|
|
17
18
|
export interface BillingAnalyticsRange {
|
|
@@ -34,13 +35,42 @@ export interface BillingAnalyticsAmount<K extends string = string> {
|
|
|
34
35
|
count: number;
|
|
35
36
|
amountMinor: number;
|
|
36
37
|
}
|
|
37
|
-
/**
|
|
38
|
+
/**
|
|
39
|
+
* A currency the scope has done business in, with its headline figures, so a dashboard can show
|
|
40
|
+
* every currency side by side - never added together - and offer to switch to one.
|
|
41
|
+
*/
|
|
38
42
|
export interface BillingAnalyticsCurrency {
|
|
39
43
|
currency: string;
|
|
40
44
|
/** Money received in the period, in this currency. */
|
|
41
45
|
collectedMinor: number;
|
|
42
46
|
/** Subscriptions ever started in this currency. */
|
|
43
47
|
subscriptions: number;
|
|
48
|
+
/** Recurring revenue of the subscriptions live at the end of the period, a month's worth. */
|
|
49
|
+
mrrMinor: number;
|
|
50
|
+
/** Invoiced and not yet paid, at the end of the period. */
|
|
51
|
+
outstandingMinor: number;
|
|
52
|
+
/** Subscriptions live at the end of the period. */
|
|
53
|
+
liveSubscriptions: number;
|
|
54
|
+
/** The countries the money came from (each record's own country), Unknown last. */
|
|
55
|
+
countryCodes: string[];
|
|
56
|
+
}
|
|
57
|
+
/**
|
|
58
|
+
* Every currency converted to one, at rates the platform operator configured - an INDICATIVE
|
|
59
|
+
* figure for a sense of scale, never for accounts: the rates are fixed, the money is not.
|
|
60
|
+
* Null when no rates are configured.
|
|
61
|
+
*/
|
|
62
|
+
export interface BillingAnalyticsIndicativeTotal {
|
|
63
|
+
/** What the total is in, e.g. USD. */
|
|
64
|
+
currency: string;
|
|
65
|
+
collectedMinor: number;
|
|
66
|
+
mrrMinor: number;
|
|
67
|
+
outstandingMinor: number;
|
|
68
|
+
/** Units of `currency` per one unit of each currency converted. */
|
|
69
|
+
rates: Record<string, number>;
|
|
70
|
+
/** The day the rates were set, when configured: the total is only as good as they are. */
|
|
71
|
+
ratesAsOf: string | null;
|
|
72
|
+
/** Currencies with money in the period but no configured rate: left out of the total. */
|
|
73
|
+
missing: string[];
|
|
44
74
|
}
|
|
45
75
|
/**
|
|
46
76
|
* What a payment was for:
|
|
@@ -405,6 +435,8 @@ export interface BillingAnalytics {
|
|
|
405
435
|
currency: string;
|
|
406
436
|
/** Every currency the scope has business in, busiest first. */
|
|
407
437
|
currencies: BillingAnalyticsCurrency[];
|
|
438
|
+
/** Every currency converted at configured rates, for a sense of scale only; null without rates. */
|
|
439
|
+
indicativeTotal: BillingAnalyticsIndicativeTotal | null;
|
|
408
440
|
previous: BillingAnalyticsPrevious | null;
|
|
409
441
|
timeline: BillingAnalyticsTimelinePoint[];
|
|
410
442
|
revenue: BillingAnalyticsRevenue;
|
|
@@ -421,6 +453,12 @@ export interface BillingAnalytics {
|
|
|
421
453
|
clients: BillingAnalyticsClientRow[];
|
|
422
454
|
/** A Super-Admin looking at every organization only. */
|
|
423
455
|
byOrganization?: BillingAnalyticsOrganizationRow[];
|
|
456
|
+
/** The country the figures are narrowed to (each record's own country); null for every country. */
|
|
457
|
+
countryCode: string | null;
|
|
458
|
+
/** How the hour-of-week grids read time: in `range.timeZone` ('zone'), or each record in its own country's zone ('record'). */
|
|
459
|
+
localTimes: AnalyticsLocalTimes;
|
|
460
|
+
/** Every country in scope side by side for the period, the country filter left out: largest first, Unknown last. */
|
|
461
|
+
countryComparison: AnalyticsCountryRow[];
|
|
424
462
|
}
|
|
425
463
|
/** What a dashboard asks: the period, and - for a Super-Admin - whose figures. */
|
|
426
464
|
export interface BillingAnalyticsQuery {
|
|
@@ -429,4 +467,6 @@ export interface BillingAnalyticsQuery {
|
|
|
429
467
|
timeZone?: string;
|
|
430
468
|
currency?: string;
|
|
431
469
|
organizationId?: number;
|
|
470
|
+
/** One country's records only; its days in that country's zone. */
|
|
471
|
+
countryCode?: string;
|
|
432
472
|
}
|
|
@@ -30,6 +30,7 @@
|
|
|
30
30
|
* the time between. Turns started in the period, answered whenever.
|
|
31
31
|
* - System messages are counted on their own and never take part in a turn.
|
|
32
32
|
*/
|
|
33
|
+
import { AnalyticsCountryRow, AnalyticsLocalTimes } from '../../analytics/analytics-country';
|
|
33
34
|
/** How the period is cut into points for the charts. Chosen by the service from the length of the period. */
|
|
34
35
|
export type ChatAnalyticsBucket = 'hour' | 'day' | 'week' | 'month';
|
|
35
36
|
/** What a conversation is for. */
|
|
@@ -264,6 +265,10 @@ export interface ChatAnalytics {
|
|
|
264
265
|
heatmap: ChatAnalyticsHeatCell[];
|
|
265
266
|
/** A Super-Admin looking at every organization only. */
|
|
266
267
|
byOrganization?: ChatAnalyticsOrganizationRow[];
|
|
268
|
+
/** How the hour-of-week grids read time: in `range.timeZone` ('zone'), or each record in its own country's zone ('record'). */
|
|
269
|
+
localTimes: AnalyticsLocalTimes;
|
|
270
|
+
/** Every country in scope side by side for the period, the country filter left out: largest first, Unknown last. */
|
|
271
|
+
countryComparison: AnalyticsCountryRow[];
|
|
267
272
|
}
|
|
268
273
|
/** What a dashboard asks: the period, one country - and, for a Super-Admin, whose figures. */
|
|
269
274
|
export interface ChatAnalyticsQuery {
|