1- import type { DraftTraceStep , PageRef , SelectedOption , Step } from "@/transport/types" ;
1+ import type { DraftTraceStep , PageRefV2 , SelectedOptionV2 , StepV2 } from "@/transport/types" ;
22
33const CLIPBOARD_KEYS = new Set ( [ "a" , "c" , "v" , "x" , "A" , "C" , "V" , "X" ] ) ;
44const MODIFIER_ONLY_KEYS = new Set ( [ "Meta" , "Control" , "Alt" , "Shift" , "OS" , "Hyper" , "Super" ] ) ;
@@ -60,7 +60,7 @@ function collectUrls(steps: DraftTraceStep[], startUrl?: string): string[] {
6060function buildPageRegistry (
6161 steps : DraftTraceStep [ ] ,
6262 startUrl ?: string ,
63- ) : { pages : PageRef [ ] ; urlToId : Map < string , string > } {
63+ ) : { pages : PageRefV2 [ ] ; urlToId : Map < string , string > } {
6464 const urls = collectUrls ( steps , startUrl ) ;
6565 const urlToId = new Map < string , string > ( ) ;
6666 const pages = urls . map ( ( url , index ) => {
@@ -90,19 +90,19 @@ function pageUrlForDraft(step: DraftTraceStep, fallbackUrl?: string): string | u
9090function effectForNavigation (
9191 navigatedTo : string | undefined ,
9292 urlToId : Map < string , string > ,
93- ) : Step [ "effect" ] {
93+ ) : StepV2 [ "effect" ] {
9494 if ( ! navigatedTo ) return undefined ;
9595 const pageId = urlToId . get ( navigatedTo ) ;
9696 if ( ! pageId ) return undefined ;
9797 return { navigated_to : pageId } ;
9898}
9999
100- function withEffect ( step : Step , effect : Step [ "effect" ] ) : Step {
100+ function withEffect ( step : StepV2 , effect : StepV2 [ "effect" ] ) : StepV2 {
101101 if ( ! effect ) return step ;
102102 return { ...step , effect } ;
103103}
104104
105- function toSelection ( values : string [ ] , labels ?: string [ ] ) : SelectedOption [ ] {
105+ function toSelection ( values : string [ ] , labels ?: string [ ] ) : SelectedOptionV2 [ ] {
106106 return values . map ( ( value , index ) => ( {
107107 value,
108108 ...( labels ?. [ index ] ? { label : labels [ index ] } : { } ) ,
@@ -114,7 +114,7 @@ function toV2Step(
114114 id : number ,
115115 urlToId : Map < string , string > ,
116116 fallbackUrl ?: string ,
117- ) : Step | null {
117+ ) : StepV2 | null {
118118 if ( ! shouldIncludeDraft ( step ) ) return null ;
119119
120120 const pageUrl = pageUrlForDraft ( step , fallbackUrl ) ;
@@ -181,8 +181,8 @@ function toV2Step(
181181}
182182
183183export interface ReducedTrace {
184- pages : PageRef [ ] ;
185- steps : Step [ ] ;
184+ pages : PageRefV2 [ ] ;
185+ steps : StepV2 [ ] ;
186186}
187187
188188/**
@@ -192,7 +192,7 @@ export interface ReducedTrace {
192192export function reduceTraceSteps ( steps : DraftTraceStep [ ] , startUrl ?: string ) : ReducedTrace {
193193 const collapsed = collapseNavigations ( steps ) ;
194194 const { pages, urlToId } = buildPageRegistry ( collapsed , startUrl ) ;
195- const out : Step [ ] = [ ] ;
195+ const out : StepV2 [ ] = [ ] ;
196196 let id = 1 ;
197197 let lastUrl = startUrl ;
198198 for ( const draft of collapsed ) {
@@ -210,7 +210,7 @@ export function reduceTraceSteps(steps: DraftTraceStep[], startUrl?: string): Re
210210export function resolveTraceStartUrl (
211211 drafts : DraftTraceStep [ ] ,
212212 startUrl ?: string ,
213- pages ?: PageRef [ ] ,
213+ pages ?: PageRefV2 [ ] ,
214214) : string {
215215 if ( startUrl ) return startUrl ;
216216 const navigate = drafts . find ( ( step ) : step is Extract < DraftTraceStep , { op : "navigate" } > => {
0 commit comments