@pablo2410/shared-ui 0.23.0 → 0.25.0
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/README.md +51 -0
- package/dist/{chunk-4QJMLQSH.js → chunk-7LI4Y6WT.js} +21 -2
- package/dist/chunk-7LI4Y6WT.js.map +1 -0
- package/dist/{chunk-4ERWOH67.js → chunk-MGTOQY6O.js} +2 -2
- package/dist/chunk-T3W42HMO.js +1145 -0
- package/dist/chunk-T3W42HMO.js.map +1 -0
- package/dist/{chunk-S4UQSTZN.js → chunk-Z4P7V5SL.js} +8 -2
- package/dist/chunk-Z4P7V5SL.js.map +1 -0
- package/dist/components/index.js +3 -3
- package/dist/hierarchy/index.js +1 -1
- package/dist/layout/index.js +4 -3
- package/dist/reporting/index.d.ts +83 -17
- package/dist/reporting/index.js +518 -10
- package/dist/reporting/index.js.map +1 -1
- package/dist/services/index.d.ts +18 -2
- package/dist/services/index.js +2 -2
- package/dist/shell/index.js +5 -4
- package/dist/shell/index.js.map +1 -1
- package/dist/shell/oplytics-shell.css +1 -1
- package/dist/tour/index.d.ts +197 -1
- package/dist/tour/index.js +55 -601
- package/dist/tour/index.js.map +1 -1
- package/package.json +10 -9
- package/dist/chunk-4QJMLQSH.js.map +0 -1
- package/dist/chunk-S4UQSTZN.js.map +0 -1
- /package/dist/{chunk-4ERWOH67.js.map → chunk-MGTOQY6O.js.map} +0 -0
|
@@ -14,9 +14,9 @@ interface ReportingToolbarProps extends Omit<ReportingToolbarConfig, "moduleName
|
|
|
14
14
|
/** Show the "attach screenshot" control (default: true). */
|
|
15
15
|
enableScreenshot?: boolean;
|
|
16
16
|
/**
|
|
17
|
-
* While true
|
|
18
|
-
*
|
|
19
|
-
*
|
|
17
|
+
* While true, the Report items are disabled with a "Coming soon" badge and
|
|
18
|
+
* `onReportSubmit` is never called. Defaults to `false` — pass `true` only
|
|
19
|
+
* if this host's `onReportSubmit` doesn't actually persist the report yet.
|
|
20
20
|
*/
|
|
21
21
|
reportsComingSoon?: boolean;
|
|
22
22
|
/**
|
|
@@ -34,16 +34,19 @@ declare function ReportingToolbar({ moduleName, showIncidentReporting, showFeedb
|
|
|
34
34
|
* Reporting and feedback toolbar types + configuration for all Oplytics
|
|
35
35
|
* subdomains — the header "User Actions" dropdown (ReportingToolbar).
|
|
36
36
|
*
|
|
37
|
-
*
|
|
38
|
-
*
|
|
39
|
-
*
|
|
40
|
-
* `FeedbackReport` shape.
|
|
41
|
-
*
|
|
37
|
+
* Both groups are fully wired. Feedback collects a service, an "is this
|
|
38
|
+
* blocking you?" signal, a short summary, the detail, and an optional
|
|
39
|
+
* screenshot, then calls `onFeedbackSubmit` with the canonical
|
|
40
|
+
* `FeedbackReport` shape. Report (Safety / Environmental / Stop Work) is
|
|
41
|
+
* three bespoke forms, one per category, each collecting the fields needed
|
|
42
|
+
* to conform to the external standard it's built against (see each
|
|
43
|
+
* category's comment below), then calls `onReportSubmit` with the
|
|
44
|
+
* discriminated `IncidentReport` union. Either way the host owns the
|
|
45
|
+
* transport (Feedback POSTs to Portal's `/api/service/feedback`; Report
|
|
46
|
+
* POSTs to Portal's `/api/service/reports`).
|
|
42
47
|
*
|
|
43
|
-
*
|
|
44
|
-
*
|
|
45
|
-
* "Coming soon" badge. A later release adds the per-type forms and flips the
|
|
46
|
-
* default.
|
|
48
|
+
* `reportsComingSoon` defaults to `false` as of this version — pass `true`
|
|
49
|
+
* per-host only if that host's `onReportSubmit` doesn't actually persist yet.
|
|
47
50
|
*/
|
|
48
51
|
type ReportCategory = "safety" | "environmental" | "stop-work";
|
|
49
52
|
type FeedbackCategory = "problem" | "suggestion";
|
|
@@ -67,11 +70,27 @@ interface ReportScreenshot {
|
|
|
67
70
|
dataBase64: string;
|
|
68
71
|
mime: string;
|
|
69
72
|
}
|
|
70
|
-
|
|
71
|
-
|
|
73
|
+
type IncidentSeverity = "low" | "medium" | "high" | "critical";
|
|
74
|
+
/**
|
|
75
|
+
* OSHA 29 CFR 1904's own injury-and-illness recordkeeping classification —
|
|
76
|
+
* the standard the Safety form's injury fields conform to, alongside
|
|
77
|
+
* ISO 45001 (the international OH&S management-system standard it sits
|
|
78
|
+
* under). Shown to the user on the form, not just used internally.
|
|
79
|
+
*/
|
|
80
|
+
type OshaInjuryClassification = "none" | "first_aid_only" | "recordable" | "days_away_restricted_transfer" | "fatality";
|
|
81
|
+
/** ISO 14001's "environmental aspect" concept — which element of the
|
|
82
|
+
* environment an incident affects. The standard the Environmental form's
|
|
83
|
+
* classification field conforms to. */
|
|
84
|
+
type EnvironmentalAspect = "air_emission" | "water_discharge" | "soil_contamination" | "waste" | "spill" | "noise" | "other";
|
|
85
|
+
/** ISO 45001's hierarchy-of-controls hazard classification. Stop Work
|
|
86
|
+
* authority isn't itself a numbered standard — it's a control mechanism
|
|
87
|
+
* exercised under an ISO 45001 OH&S management system, which this
|
|
88
|
+
* classification maps to. */
|
|
89
|
+
type HazardCategory = "mechanical" | "electrical" | "chemical" | "working_at_height" | "confined_space" | "vehicle_traffic" | "other";
|
|
90
|
+
interface IncidentReportBase {
|
|
72
91
|
description: string;
|
|
73
92
|
location?: string;
|
|
74
|
-
severity?:
|
|
93
|
+
severity?: IncidentSeverity;
|
|
75
94
|
/** Optional — what was done at the scene to make the area safe. */
|
|
76
95
|
immediateAction?: string;
|
|
77
96
|
moduleName: string;
|
|
@@ -80,6 +99,44 @@ interface IncidentReport {
|
|
|
80
99
|
submittedBy?: ReportSubmitter;
|
|
81
100
|
hierarchyContext?: ReportHierarchyContext;
|
|
82
101
|
}
|
|
102
|
+
interface SafetyIncidentReport extends IncidentReportBase {
|
|
103
|
+
category: "safety";
|
|
104
|
+
injuryOccurred: boolean;
|
|
105
|
+
/** OSHA 1904 classification — see `OshaInjuryClassification`. */
|
|
106
|
+
injuryClassification?: OshaInjuryClassification;
|
|
107
|
+
/** OSHA DART-rate inputs — only meaningful when injuryClassification is
|
|
108
|
+
* "days_away_restricted_transfer". */
|
|
109
|
+
daysAwayFromWork?: number;
|
|
110
|
+
daysRestrictedOrTransferred?: number;
|
|
111
|
+
firstAiderAttended?: boolean;
|
|
112
|
+
witnessName?: string;
|
|
113
|
+
bodyPart?: string;
|
|
114
|
+
treatmentType?: string;
|
|
115
|
+
}
|
|
116
|
+
interface EnvironmentalIncidentReport extends IncidentReportBase {
|
|
117
|
+
category: "environmental";
|
|
118
|
+
/** ISO 14001 environmental aspect — see `EnvironmentalAspect`. */
|
|
119
|
+
environmentalAspect?: EnvironmentalAspect;
|
|
120
|
+
/** Does this trigger a duty to notify an external regulator? */
|
|
121
|
+
regulatoryReportable?: boolean;
|
|
122
|
+
substance?: string;
|
|
123
|
+
estimatedQuantity?: string;
|
|
124
|
+
contained?: boolean;
|
|
125
|
+
reachedWatercourse?: boolean;
|
|
126
|
+
}
|
|
127
|
+
interface StopWorkIncidentReport extends IncidentReportBase {
|
|
128
|
+
category: "stop-work";
|
|
129
|
+
/** ISO 45001 hazard classification — see `HazardCategory`. */
|
|
130
|
+
hazardCategory?: HazardCategory;
|
|
131
|
+
hazardDescription?: string;
|
|
132
|
+
areaMadeSafe?: boolean;
|
|
133
|
+
workResumed?: boolean;
|
|
134
|
+
}
|
|
135
|
+
/** Discriminated on `category` — narrow on it to get the right per-type
|
|
136
|
+
* fields (`report.category === "safety"` narrows to `SafetyIncidentReport`,
|
|
137
|
+
* etc.). Each variant maps 1:1 onto its own bespoke form; see
|
|
138
|
+
* ReportingToolbar.tsx's SafetyForm/EnvironmentalForm/StopWorkForm. */
|
|
139
|
+
type IncidentReport = SafetyIncidentReport | EnvironmentalIncidentReport | StopWorkIncidentReport;
|
|
83
140
|
interface FeedbackReport {
|
|
84
141
|
category: FeedbackCategory;
|
|
85
142
|
/** Canonical service slug the feedback is about (from the picker). */
|
|
@@ -120,7 +177,8 @@ interface ReportingToolbarConfig {
|
|
|
120
177
|
reportCategories?: ReportCategory[];
|
|
121
178
|
/** Feedback categories to show (default: both). */
|
|
122
179
|
feedbackCategories?: FeedbackCategory[];
|
|
123
|
-
/** Called when an incident report is submitted
|
|
180
|
+
/** Called when an incident report is submitted. The host is responsible
|
|
181
|
+
* for actually persisting it — see `reportsComingSoon` above. */
|
|
124
182
|
onReportSubmit: (report: IncidentReport) => Promise<void> | void;
|
|
125
183
|
/** Called when feedback is submitted — the host POSTs it to Portal. */
|
|
126
184
|
onFeedbackSubmit: (feedback: FeedbackReport) => Promise<void> | void;
|
|
@@ -141,6 +199,14 @@ interface FeedbackButtonDef {
|
|
|
141
199
|
}
|
|
142
200
|
declare const REPORT_BUTTONS: ReportButtonDef[];
|
|
143
201
|
declare const FEEDBACK_BUTTONS: FeedbackButtonDef[];
|
|
202
|
+
interface ReportStandardReference {
|
|
203
|
+
category: ReportCategory;
|
|
204
|
+
/** Short label shown on the form, e.g. "OSHA 1904 · ISO 45001". */
|
|
205
|
+
label: string;
|
|
206
|
+
/** One sentence explaining what the standard governs here. */
|
|
207
|
+
description: string;
|
|
208
|
+
}
|
|
209
|
+
declare const REPORT_STANDARD_REFERENCES: Record<ReportCategory, ReportStandardReference>;
|
|
144
210
|
/** Create a default ReportingToolbarConfig with sensible defaults. */
|
|
145
211
|
declare function createReportingConfig(moduleName: string, handlers: {
|
|
146
212
|
onReportSubmit: (report: IncidentReport) => Promise<void> | void;
|
|
@@ -163,4 +229,4 @@ declare function isAcceptableScreenshot(file: {
|
|
|
163
229
|
};
|
|
164
230
|
declare function readFileAsScreenshot(file: File): Promise<ReportScreenshot>;
|
|
165
231
|
|
|
166
|
-
export { FEEDBACK_BUTTONS, FEEDBACK_SCREENSHOT_MAX_BYTES, type FeedbackButtonDef, type FeedbackCategory, type FeedbackReport, type IncidentReport, OPLYTICS_SERVICES, type OplyticsService, REPORT_BUTTONS, type ReportButtonDef, type ReportCategory, type ReportHierarchyContext, type ReportScreenshot, type ReportSubmitter, ReportingToolbar, type ReportingToolbarConfig, type ReportingToolbarProps, createReportingConfig, isAcceptableScreenshot, readFileAsScreenshot };
|
|
232
|
+
export { type EnvironmentalAspect, type EnvironmentalIncidentReport, FEEDBACK_BUTTONS, FEEDBACK_SCREENSHOT_MAX_BYTES, type FeedbackButtonDef, type FeedbackCategory, type FeedbackReport, type HazardCategory, type IncidentReport, type IncidentSeverity, OPLYTICS_SERVICES, type OplyticsService, type OshaInjuryClassification, REPORT_BUTTONS, REPORT_STANDARD_REFERENCES, type ReportButtonDef, type ReportCategory, type ReportHierarchyContext, type ReportScreenshot, type ReportStandardReference, type ReportSubmitter, ReportingToolbar, type ReportingToolbarConfig, type ReportingToolbarProps, type SafetyIncidentReport, type StopWorkIncidentReport, createReportingConfig, isAcceptableScreenshot, readFileAsScreenshot };
|