import { Core } from '../../../client/core'; import { WebViewFailedToLoadErrorPhase } from '../../WebViewFailedToLoadError'; import { WebViewLoadEffect, WebViewLoadNativeErrorMeta, WebViewLoadState } from '../../webViewLoadTypes'; import { AttemptTimings } from '../createEmptyAttemptTimings'; import { WebViewLoadWebviewType } from '../webViewLoadAdapter'; export type WebViewLoadEmitTelemetryEffect = Extract; export type CreateWebViewLoadTelemetryArgs = { core: Core; /** Live view of the current attempt's lifecycle timestamps. */ getAttemptTimings: () => AttemptTimings; /** Live view of the URL of the current attempt. */ getCurrentUrl: () => URL; /** Live view of the controller-lifetime native error counter. */ getNativeErrorCount: () => number; /** Async emits check this so late logs become no-ops after teardown. */ isTornDown: () => boolean; /** Wall-clock source, shared with the machine config. */ now: () => number; pageLoadTimeoutMs: number; sdkReadyTimeoutMs: number; webviewType: WebViewLoadWebviewType; }; export type WebViewLoadTelemetry = { /** Execute an emit_telemetry effect requested by the machine. */ emitTelemetry: (effect: WebViewLoadEmitTelemetryEffect, previousState: WebViewLoadState, batchExtraMeta: WebViewLoadNativeErrorMeta) => void; /** Execute a probe_origin effect requested by the machine. */ probeOrigin: (attempt: number, phase: WebViewFailedToLoadErrorPhase) => void; }; /** * The telemetry side of the load controller: turns the machine's * emit_telemetry / probe_origin effects into `logger.instrument` logs on * the consolidated `webview.*` keys. Reads the controller's mutable * context (current URL, attempt timings, counters, teardown flag) through * the injected getters so async emits always observe fresh values. */ export declare const createWebViewLoadTelemetry: ({ core, getAttemptTimings, getCurrentUrl, getNativeErrorCount, isTornDown, now, pageLoadTimeoutMs, sdkReadyTimeoutMs, webviewType, }: CreateWebViewLoadTelemetryArgs) => WebViewLoadTelemetry;