import { type AgentNativeLifecycleEventName } from "../shared/analytics-events.js"; import { type AnalyticsClientPlatform } from "../shared/analytics-platform.js"; export { clearAnalyticsSessionId, setAnalyticsSessionId, } from "./analytics-session.js"; import type { SessionReplayOptions, SessionReplayStartResult } from "./session-replay.js"; export { scrubUrl } from "./url-scrub.js"; export { addErrorBreadcrumb, captureException, captureMessage, isErrorCaptureInstalled, type CaptureExceptionContext, type CapturedExceptionEvent, type ExceptionBreadcrumb, type ExceptionLevel, } from "./error-capture.js"; export type { SessionReplayConsoleOptions, SessionReplayNetworkOptions, SessionReplayOptions, SessionReplayStartResult, SessionReplayUrlMatcher, } from "./session-replay.js"; export { getSessionReplayContext, getSessionReplayUrl, } from "./session-replay-context.js"; export type { SessionReplayContext, SessionReplayLinkOptions, } from "./session-replay-context.js"; declare global { interface Window { gtag?: (...args: any[]) => void; __AGENT_NATIVE_GA_GTAG__?: (...args: any[]) => void; __AGENT_NATIVE_SYNTHETIC_TRAFFIC__?: string; __AGENT_NATIVE_CONFIG__?: { appHomePath?: string; appUrl?: string; workspaceGatewayUrl?: string; workspaceOAuthOrigin?: string; workspaceRuntime?: boolean; workspaceAppPath?: string; workspaceAppMountPaths?: string[]; sentryDsn?: string; sentryEnvironment?: string; deploymentEnvironment?: string; posthogKey?: string; posthogHost?: string; posthogErrorTracking?: boolean; agentNativeAnalyticsPublicKey?: string; agentNativeAnalyticsEndpoint?: string; realtime?: { transport?: string; gatewayBaseUrl?: string; }; }; } } type GetDefaultProps = (name: string, properties: Record) => Record; export type ErrorCaptureConfigOptions = { release?: string; environment?: string; captureGlobalErrors?: boolean; captureUnhandledRejections?: boolean; maxBreadcrumbs?: number; }; export type ConfigureTrackingOptions = { clientPlatform?: AnalyticsClientPlatform; key?: string; publicKey?: string; endpoint?: string; getDefaultProps?: GetDefaultProps; contentCapture?: boolean; contentCaptureForPath?: (pathname: string) => boolean; llmConnectionStatus?: boolean; authSessionRefresh?: boolean; pageviewTracking?: boolean; webVitals?: boolean; sessionReplay?: boolean | SessionReplayOptions; errorCapture?: boolean | ErrorCaptureConfigOptions; }; export type TrackingIdentityUser = { id?: string; email?: string; username?: string; authUserId?: string; /** * The session endpoint's `testIdentity`: covers identities the deployment * configured, which the built-in matcher here cannot see. */ testIdentity?: boolean; }; export declare const AGENT_NATIVE_EXCEPTION_EVENT_NAME = "$exception"; export interface FirstTouchAttribution { ref?: string; via?: string; utm_source?: string; utm_medium?: string; utm_campaign?: string; utm_content?: string; utm_term?: string; gclid?: string; msclkid?: string; vector_source?: string; landing_path?: string; landing_referrer?: string; site_referrer?: string; site_landing_path?: string; landed_at?: string; capture_truncated?: string; } /** The latest visit that had a source; see `captureLastTouchAttribution`. */ export interface LastTouchAttribution { ref?: string; via?: string; utm_source?: string; utm_medium?: string; utm_campaign?: string; utm_content?: string; utm_term?: string; gclid?: string; msclkid?: string; vector_source?: string; landing_referrer?: string; site_referrer?: string; site_landing_path?: string; landing_path?: string; touched_at?: string; capture_truncated?: string; } export declare function getAnalyticsIdentityKey(): string | undefined; export declare function resolveAnalyticsIdentityKey(): Promise; export declare function getAnalyticsAnonymousId(): string | undefined; export declare function getAnalyticsSessionId(): string | undefined; export declare function getFirstTouchAttribution(): FirstTouchAttribution | null; export declare function getLastTouchAttribution(): LastTouchAttribution | null; export interface CaptureAttributionOptions { /** * The app path this visit entered, when the page isn't it. The sign-in page * stands in front of the path the visitor asked for, and `landing_path` * must name that path, not the sign-in page. */ landingPath?: string; } /** * Store the visitor's first and last touch now instead of in * `configureTracking()`, for a page that reads them before tracking starts, * or that never starts tracking, like the sign-in page. It runs once per page * load, so tracking's own capture is then a no-op. */ export declare function captureAttribution(options?: CaptureAttributionOptions): void; /** * True when browser events reach the Agent-Native analytics sink that the * first-party dashboards read: a public key is configured and the host is not * local. `getAnalyticsAnonymousId()` returns an id regardless, so experiments * must check this before assigning an arm they could never measure. */ export declare function isAgentNativeAnalyticsConfigured(): boolean; export declare function setSentryUser(user: TrackingIdentityUser | null, orgId?: string | null): void; export declare function setTrackingIdentity(user: TrackingIdentityUser | null, orgId?: string | null): void; export interface ClientCaptureContext { tags?: Record; extra?: Record; contexts?: Record>; } export declare function captureClientException(error: unknown, context?: ClientCaptureContext): string | undefined; export declare function captureError(error: unknown, context?: ClientCaptureContext): string | undefined; export type AgentChatLifecycleEvent = { phase: "surface-mounted" | "run-observed" | "run-stopped"; surface?: string; threadId?: string; runId?: string; tabId?: string; }; export declare function trackAgentChatLifecycle(input: AgentChatLifecycleEvent): void; export declare function configureTracking(options: ConfigureTrackingOptions): void; export declare function setTrackingContentCaptureEnabled(enabled: boolean): void; export declare function isTrackingContentCaptureEnabled(): boolean; export declare function startSessionReplay(options?: SessionReplayOptions): Promise; export declare function maybeStartSessionReplay(options?: SessionReplayOptions): Promise; export declare function stopSessionReplay(reason?: string): Promise; export declare function trackEvent(name: string, params?: Record): void; export declare function trackAnonymousEvent(name: string, properties: Record): void; export declare function trackLifecycleEvent(name: AgentNativeLifecycleEventName, params?: Record): void; export declare function trackSessionStatus(signedIn: boolean): void;