import type { SlowRequestConfig } from './core/endpoint-policy'; import { type RequestPolicyConfig } from './core/request-policy'; import type { JourneyRuntime, JourneyRuntimeDebugSnapshot } from './core/runtime'; /** Force-enable journey host wiring outside go* hosts (`__stJourney.enable()`). */ export declare const JOURNEY_ENABLED_STORAGE_KEY = "st:journey:enabled"; /** Opt-in journey console logging (`__stJourney.enableDebugging()`). */ export declare const JOURNEY_DEBUG_STORAGE_KEY = "st:journey:debug"; /** @internal Shared cross-bundle bag on globalThis (`rum` fallback + DevTools helpers). */ export declare const ST_JOURNEY_GLOBAL_KEY = "__stJourney"; /** Bump when shared bag shape / policy semantics change incompatibly. */ export declare const ST_JOURNEY_SCHEMA_VERSION = 2; export interface JourneyDebugState { /** Host default or force-enable (`isJourneyEnabled()`). */ enabled: boolean; /** Console-logging flag (`st:journey:debug`). */ debug: boolean; hasRum: boolean; runtimes: JourneyRuntimeDebugSnapshot[]; } /** Shared host policies visible to every package copy on the page. */ export interface JourneySharedPolicies { slowRequests?: SlowRequestConfig; /** Whether shared slowRequests were explicitly set via configureJourney. */ slowRequestsConfigured: boolean; httpAbortedRequests: RequestPolicyConfig; httpClientErrorRequests: RequestPolicyConfig; autoAttributeRequests: boolean; /** True after the first configureJourney that set any shared policy knob. */ locked: boolean; } /** DevTools registration — `{ id, getSnapshot }` so older package copies can still list runtimes. */ export interface RuntimeRegistration { id: string; getSnapshot: () => JourneyRuntimeDebugSnapshot; teardown?: () => void; } /** @internal Restore/dispose record for HTTP instrumentation. */ export interface InstrumentRecord { disposed: boolean; restore?: () => void; } /** * Cross-bundle surface on `globalThis.__stJourney`. * Prefer importing `isJourneyEnabled` / `isJourneyDebugEnabled` from the package in app code. */ export interface StJourneyGlobal { /** * Fallback RUM instance from `setJourneyRum` when `globalThis.DD_RUM` is absent. * Prefer `DD_RUM` (ST host: `datadogGuard`). */ rum?: unknown; /** Shared bag schema; mismatched copies warn but continue. */ schemaVersion?: number; /** Host default enable (e.g. RUM active). Set via `setJourneyDefaultEnabled`. */ defaultEnabled?: boolean; /** Shared configureJourney policies. */ policies: JourneySharedPolicies; /** * Bundle runtimes registered for DevTools `getDebugState()`. * `{ id, getSnapshot }` so mixed package copies can list each other. */ runtimeRegistrations: RuntimeRegistration[]; /** @internal Cross-bundle instrumented axios/fetch/jquery targets. */ instrumentedAxios: WeakSet; instrumentedFetch: WeakSet; instrumentedJquery: WeakSet; /** @internal Active instrument records for teardown. */ instrumentRecords: InstrumentRecord[]; fetchRestore?: () => void; enable(): void; disable(): void; isEnabled(): boolean; enableDebugging(): void; disableDebugging(): void; isDebugEnabled(): boolean; /** * Open-journey snapshot for DevTools. Returns empty `runtimes` unless debugging * is enabled (`enableDebugging()` / `st:journey:debug`). */ getDebugState(): JourneyDebugState; } /** * Host default for journey wiring (e.g. RUM initialized). Stored on `__stJourney` so * MFEs see the same value without importing Datadog. Call once after RUM init. */ export declare function setJourneyDefaultEnabled(enabled: boolean): void; /** * True when the host default is on or force-enable is set * (`st:journey:enabled` / `__stJourney.enable()`). */ export declare function isJourneyEnabled(): boolean; /** Set the force-enable flag. Reload after calling from DevTools. */ export declare function enableJourney(): void; /** Clear the force-enable flag. Reload after calling from DevTools. */ export declare function disableJourney(): void; /** True when `sessionStorage['st:journey:debug'] === 'true'`. */ export declare function isJourneyDebugEnabled(): boolean; /** Set the console-debug flag. Reload after calling from DevTools. */ export declare function enableJourneyDebugging(): void; /** Clear the console-debug flag. Reload after calling from DevTools. */ export declare function disableJourneyDebugging(): void; /** @internal Shared policies bag. */ export declare function getSharedPolicies(): JourneySharedPolicies; export declare function areSharedPoliciesLocked(): boolean; /** * First writer: merge `patch` into the shared bag and freeze it. * Returns false when already locked (caller should overlay locally instead). */ export declare function seedSharedPolicies(patch: Partial>): boolean; export declare function getAutoAttributeRequests(): boolean; export declare function getHttpAbortedRequestsPolicy(): RequestPolicyConfig; export declare function getHttpClientErrorRequestsPolicy(): RequestPolicyConfig; export declare function getSharedSlowRequests(): SlowRequestConfig | undefined; export declare function areSharedSlowRequestsConfigured(): boolean; /** One-time warn when transports are wired without explicit slowRequests. */ export declare function warnIfSlowRequestsUnset(): void; /** @internal Reset shared policies (tests / teardown). */ export declare function resetSharedPolicies(): void; export declare function getInstrumentedAxiosSet(): WeakSet; export declare function getInstrumentedFetchSet(): WeakSet; export declare function getInstrumentedJquerySet(): WeakSet; export declare function registerInstrumentRecord(record: InstrumentRecord): void; export declare function setFetchRestore(restore: (() => void) | undefined): void; /** * @internal Register this bundle's engine on `__stJourney` so DevTools can list * every host/MFE copy on the page. Auto-assigns `runtime-N` when `runtime.id` is empty. * Replaces an existing registration with the same id (HMR / test re-register). */ export declare function registerJourneyRuntime(runtime: JourneyRuntime, options?: { teardown?: () => void; }): void; /** * @internal Store a fallback RUM instance on `__stJourney.rum` when `DD_RUM` is absent. * Used by `setJourneyRum`. */ export declare function setJourneyRumFallback(rum: unknown): void; /** @internal Read `__stJourney.rum` (setJourneyRum fallback). */ export declare function getJourneyRumFallback(): unknown; /** * Dispose HTTP instrumentation hooks and reset registered engines that supplied a * teardown callback. Intended for tests (e.g. afterEach). Prefer `resetJourney` * when you only need this bundle's engine state. */ export declare function teardownJourney(): void; //# sourceMappingURL=global.d.ts.map