@@ -16,32 +16,15 @@ import type {
1616 WorkspaceFavorite ,
1717 WorkspacePersonalization ,
1818} from "../../types/workspace" ;
19+ import { markWorkspaceReady } from "./workspacePerformanceMetrics" ;
20+ import {
21+ INTAKE_FIELDS ,
22+ IntakeFieldControl ,
23+ NOTE_AUDIENCES ,
24+ type IntakeField ,
25+ } from "./IntakeFieldControl" ;
1926import "./TicketWorkspaceRail.css" ;
2027
21- const APP_BOOTSTRAP_START_MARK = "assistsupport:perf:bootstrap-start" ;
22- const TICKET_WORKSPACE_READY_MARK = "assistsupport:perf:ticket-workspace-ready" ;
23- const TICKET_WORKSPACE_READY_MEASURE =
24- "assistsupport:perf:ticket-workspace-ready-ms" ;
25-
26- type PerfWindow = Window & {
27- __assistsupportPerf ?: {
28- bootstrapStartedAt : number ;
29- ticketWorkspaceReadyMs ?: number ;
30- } ;
31- } ;
32-
33- type IntakeField =
34- | "issue"
35- | "environment"
36- | "impact"
37- | "affected_user"
38- | "affected_system"
39- | "affected_site"
40- | "symptoms"
41- | "steps_tried"
42- | "blockers"
43- | "likely_category" ;
44-
4528interface TicketWorkspaceRailProps {
4629 intake : CaseIntake ;
4730 onIntakeChange : ( field : IntakeField , value : string ) => void ;
@@ -90,62 +73,6 @@ interface TicketWorkspaceRailProps {
9073 currentResponse : string ;
9174}
9275
93- const NOTE_AUDIENCES : Array < { id : NoteAudience ; label : string } > = [
94- { id : "internal-note" , label : "Internal note" } ,
95- { id : "customer-safe" , label : "Customer-safe" } ,
96- { id : "escalation-note" , label : "Escalation note" } ,
97- ] ;
98-
99- const INTAKE_FIELDS : Array < { key : IntakeField ; label : string ; rows ?: number } > =
100- [
101- { key : "issue" , label : "Issue summary" } ,
102- { key : "environment" , label : "Environment" } ,
103- { key : "impact" , label : "Impact" , rows : 2 } ,
104- { key : "affected_user" , label : "Affected user" } ,
105- { key : "affected_system" , label : "Affected system" } ,
106- { key : "affected_site" , label : "Affected site" } ,
107- { key : "symptoms" , label : "Symptoms" , rows : 3 } ,
108- { key : "steps_tried" , label : "Steps already tried" , rows : 3 } ,
109- { key : "blockers" , label : "Current blocker" , rows : 2 } ,
110- { key : "likely_category" , label : "Likely category" } ,
111- ] ;
112-
113- function IntakeFieldControl ( {
114- label,
115- value,
116- rows,
117- onChange,
118- } : {
119- label : string ;
120- value : string ;
121- rows ?: number ;
122- onChange : ( value : string ) => void ;
123- } ) {
124- if ( rows && rows > 1 ) {
125- return (
126- < label className = "ticket-workspace-rail__field" >
127- < span > { label } </ span >
128- < textarea
129- rows = { rows }
130- value = { value }
131- onChange = { ( event ) => onChange ( event . target . value ) }
132- />
133- </ label >
134- ) ;
135- }
136-
137- return (
138- < label className = "ticket-workspace-rail__field" >
139- < span > { label } </ span >
140- < input
141- type = "text"
142- value = { value }
143- onChange = { ( event ) => onChange ( event . target . value ) }
144- />
145- </ label >
146- ) ;
147- }
148-
14976export function TicketWorkspaceRail ( {
15077 intake,
15178 onIntakeChange,
@@ -209,35 +136,7 @@ export function TicketWorkspaceRail({
209136 } , [ guidedRunbookSession ] ) ;
210137
211138 useEffect ( ( ) => {
212- if (
213- typeof window === "undefined" ||
214- typeof window . performance === "undefined"
215- ) {
216- return ;
217- }
218-
219- const perfWindow = window as PerfWindow ;
220- const bootstrapStartedAt =
221- perfWindow . __assistsupportPerf ?. bootstrapStartedAt ?? 0 ;
222- perfWindow . __assistsupportPerf = {
223- ...( perfWindow . __assistsupportPerf ?? { bootstrapStartedAt } ) ,
224- bootstrapStartedAt,
225- ticketWorkspaceReadyMs : Number (
226- ( window . performance . now ( ) - bootstrapStartedAt ) . toFixed ( 2 ) ,
227- ) ,
228- } ;
229- window . performance . clearMarks ( TICKET_WORKSPACE_READY_MARK ) ;
230- window . performance . clearMeasures ( TICKET_WORKSPACE_READY_MEASURE ) ;
231- window . performance . mark ( TICKET_WORKSPACE_READY_MARK ) ;
232- try {
233- window . performance . measure (
234- TICKET_WORKSPACE_READY_MEASURE ,
235- APP_BOOTSTRAP_START_MARK ,
236- TICKET_WORKSPACE_READY_MARK ,
237- ) ;
238- } catch {
239- // Keep the workspace usable even if performance marks are unavailable in the current runtime.
240- }
139+ markWorkspaceReady ( ) ;
241140 } , [ ] ) ;
242141
243142 return (
0 commit comments