import { JourneyStepStamp } from './step-tag'; import type { JourneyDef, JourneyHandle, JourneyStepOptions, JourneyStepTarget, SerializedJourneyState, StepHandle, StepRecord, TagValue } from './types'; /** * Unique in-flight step as a stamp-ready {@link JourneyStepStamp}, or null when * auto-attribute is disabled, or when 0 or 2+ steps are in flight app-wide. * Ambient stamps never carry `score` or `ignore`. Untagged traffic is attributed * to that lone step even if unrelated — prefer `step.stamp()` when the page has * background instrumented requests. Disable via * `configureJourney({ autoAttributeRequests: false })`. */ export declare function singleInFlightJourneyStep(): JourneyStepStamp | null; /** @internal Clear cached ambient stamp when runtime state changes. */ export declare function invalidateAmbientStamp(step?: StepRecord): void; /** * Prefer an explicit `step.stamp()` value; else the ambient in-flight stamp. * Same-realm stamps are returned as-is (identity + score + ignore). Branded * foreign copies are adopted into a local stamp. Raw StepRecords are not stamps. */ export declare function resolveStamp(explicit?: unknown): JourneyStepStamp | undefined; /** * Record a finished backend request against a captured step. * 5xx / network / slow (over threshold) mark Bad; 4xx is not counted. Fail-fast on breach. * @internal Prefer {@link onHttpComplete} from adapters. */ export declare function reportBackendRequest(step: StepRecord | undefined, status: number | undefined, durationMs: number, requestKey: string): void; /** * Run one step of a named journey. Runs untraced (noop handle) when no matching journey is open. * `journey` may be a name, null, an ordered candidate list, a def, or a handle. * A def or handle auto-starts when that journey is not already open; a bare name does not. * Prefer `defineJourney(...).step` when you own the journey config. */ export declare function journeyStep(journey: JourneyStepTarget, stepName: string, fn: (step: StepHandle) => T | Promise, opts?: JourneyStepOptions): Promise; /** Merge custom tags onto an open journey. No-op if not open. Prefer `handle.setTags`. */ export declare function setJourneyTags(name: string | null, tags: Record): void; /** Mark a named journey Bad for a custom reason (fail-fast). Prefer `handle.fail`. */ export declare function failJourney(name: string, reason: string): void; /** Successful end. Outcome stays Bad if a breach already occurred. No-op when name is null. Prefer `handle.complete`. */ export declare function completeJourney(name: string | null, tags?: Record): void; /** User left before finishing. Stays Bad if a breach already occurred (breach-anchored). Prefer `handle.exclude`. */ export declare function excludeJourney(name: string): void; /** Turn a journey config into a handle with bound lifecycle methods. Preferred public API. */ export declare function defineJourney(config: JourneyDef): JourneyHandle; /** * Snapshot an open journey for cross-page transfer (e.g. into a cookie). Does * NOT close the journey. Returns `null` when no journey is open under `name`. */ export declare function serializeJourneyState(name: string): SerializedJourneyState | null; /** * Rehydrate a serialized journey onto this runtime. Returns `true` when the * journey is now open; `false` when it exhausted its budget in transit (a * `bad` `journey-timeout` event is emitted) or when a journey under the * same name is already open. */ export declare function restoreJourney(serialized: SerializedJourneyState, config: JourneyDef): boolean; //# sourceMappingURL=api.d.ts.map