import type { JourneySink } from './core/types'; import type { RequestPolicyConfig } from './core/request-policy'; import { type SlowRequestConfig } from './core/endpoint-policy'; import { type AxiosLikeInstance } from './integrations/axios'; import { type InstrumentFetchOptions } from './integrations/fetch'; import { type JqueryStatic, type WindowWithAppJourney } from './integrations/jquery'; /** Optional app-wide / per-bundle configuration. */ export interface JourneyConfig { /** * App-wide slow-request thresholds (shared on `__stJourney` for all package copies). * Package fallback remains `{ defaultMs: 4000, endpoints: [] }` until set. * Desktop / KO hosts should set `defaultMs` and ignore noisy endpoint prefixes. */ slowRequests?: SlowRequestConfig; /** * How attributed aborted/cancelled HTTP counts toward the open journey. * Shared on `__stJourney`. Literal or `(ctx) => …`. Default `'continue'`. */ httpAbortedRequests?: RequestPolicyConfig; /** * How attributed 4xx responses count toward the open journey. * Shared on `__stJourney`. Literal or `(ctx) => …`. Default `'continue'` (no verdict change). */ httpClientErrorRequests?: RequestPolicyConfig; /** * When true (default), untagged instrumented HTTP is attributed to the sole * in-flight step (if exactly one). When false, only explicit `step.stamp()` attributes. * Prefer false on busy desktop / shared jQuery shells with background traffic. * Shared on `__stJourney`. */ autoAttributeRequests?: boolean; /** * Default cap on recorded steps per journey (default 50). Per-journey * `JourneyDef.maxSteps` overrides. Excess steps are dropped and * `tags.steps_truncated` is set. */ maxSteps?: number; /** * Applied when a journey omits `timeoutMs`. * Default is 15m and closes as `excluded` with `journey-idle-timeout`. * Pass `0` to disable this idle timeout. */ defaultJourneyIdleMs?: number; /** * Replace the sink list used when a journey finishes. * Only applied when provided — omit to leave the current list unchanged. * Package default is `[sendToDatadog, sendToConsole]`; pass `[]` to disable emission. * `sendToConsole` is a no-op unless `sessionStorage['st:journey:debug'] === 'true'`. * First `sinks` on this bundle wins; a later `configureJourney({ sinks })` is ignored. */ sinks?: readonly JourneySink[]; /** * Wire this bundle's axios instance (host or MFE). Same as `instrumentAxios(axios)`. * Register any async request interceptors (e.g. auth) before `configureJourney`. * Soft-skips when axios is missing / not axios-like — safe to pass a host instance that may be absent. */ axios?: AxiosLikeInstance | null; /** * Wire fetch. `true` wraps `globalThis.fetch`; pass options for a scoped target / baseURL. * Same as `instrumentFetch(...)`. Soft-skips when the target has no callable `fetch`. * Prefer host-only for `globalThis.fetch` — MFEs inherit the host wrapper. */ fetch?: true | InstrumentFetchOptions | null; /** * Wire jQuery. Pass a `$` instance, or `true` to use `globalThis.$` / `globalThis.jQuery`. * `false` skips wiring. Soft-skips when `$` is missing / not real jQuery. * Prefer host-only for shared `$`. */ jquery?: boolean | JqueryStatic | null; /** * Publish `window.App.Journey` for Knockout / legacy hosts. * `true` uses the real window; pass a target object in tests. */ exposeAppJourney?: boolean | WindowWithAppJourney; } /** * Apply bundle options: request thresholds, sinks, and/or HTTP / legacy wiring. * Optional — call once at startup. Pass this bundle's own axios / `$` / fetch target. * Policy knobs (`slowRequests`, `httpAbortedRequests`, `httpClientErrorRequests`, * `autoAttributeRequests`) are stored on shared `__stJourney` so MFEs inherit host settings. * No-ops when `isJourneyEnabled()` is false (host default or force flag). * Never throws: missing/invalid config and failures soft-skip (warn / error to console). */ export declare function configureJourney(config: JourneyConfig): void; /** * @internal Read the module runtime's app-wide slow-request config. * Prefer `configureJourney({ slowRequests })` to set thresholds. Test / introspection only. */ export declare function getSlowRequests(): SlowRequestConfig; //# sourceMappingURL=config.d.ts.map