import type { OneSdkContext } from '../../sdk/types/oneSDK'; import type { StepEmitter, StepMachine } from './stepMachine'; import type { JourneyName } from '../types/contract'; /** * Wire `emitter` so that the first time any of `events` fires, `journey_ready` * (`globalEvents.ts`) emits once for the whole journey and every other * `watch()` call becomes a no-op. Idempotent by design: every screen a flow * might mount first — START/WELCOME/CONSENT/PERSONAL (`screenSequence.ts`'s * `present()`) or the vendor CAPTURE flow (`idvFlow.ts`/`ocrFlow.ts`) — calls * this the same way, and whichever fires first wins; the rest are already * settled by the time their own listener would run. * * The `'form:{name}:loaded'` events `present()` watches are uniform (every * screen goes through the same `ScreenWrapper.tsx`). The vendor CAPTURE * flow's `'ready'` is not: it is purely vendor-delegated, and idvFlow.ts's/ * ocrFlow.ts's own `firstPaint.watch()` call sites document, vendor by * vendor, which ones it is confirmed to mean actual visibility for, which * fire early/ambiguously, and which (OcrLabs in production, dummy-ocr) never * fire it at all — a journey whose first screen is CAPTURE on one of those * never gets a `journey_ready` for that attempt. No fallback timer here by * design (spec's own convention: timeouts guard engine silence deliberately, * but a *host's own* timeout on this specific signal is the applicable one, * not one baked into the SDK). */ export type FirstPaintSignal = { watch: (emitter: StepEmitter, events: readonly string[]) => void; /** * Fire directly, for a surface the journey mounts itself and can therefore * observe without depending on a vendor event — `idvFlow.ts`/`ocrFlow.ts` * call this once their own capture loader has painted. This is the path * that makes `journey_ready` deterministic: it no longer inherits the * per-vendor `ready` accuracy documented at those call sites. */ signal: () => void; }; export declare const mkFirstPaintSignal: (deps: { oneSdk: OneSdkContext; flow: JourneyName; machine: StepMachine; /** `Date.now()` at the moment `journey(...)` was called — `JOURNEY:READY` telemetry's `elapsedMs` is measured from here */ startedAt: number; }) => FirstPaintSignal; //# sourceMappingURL=firstPaint.d.ts.map