/** * Vendor-agnostic observability primitives for the Universal Wallet Connector. * * These are leaf types — no dependency on the core event bus — so any package * (including consumers below UWC in the dep graph, e.g. link-v2) can import them * without pulling in `@meshconnect/uwc-core`. The richer `UWCTelemetryEvent` / * `UWCObserver` shapes live in `@meshconnect/uwc-core` because they reference the * core event names. * * UWC ships NO third-party telemetry SDK. The consumer implements the sinks and * wires them to whatever backend they run (Datadog, Amplitude, Segment, …). */ export type LogLevel = 'debug' | 'info' | 'warn' | 'error'; /** * Pluggable logger. The default implementation (`createLogger`) is console-backed * and level-gated; inject your own to redirect UWC's internal logging into your * stack. Kept to the four standard levels so a consumer's existing logger usually * satisfies it without an adapter. */ export interface Logger { debug(message: string, ...args: unknown[]): void; info(message: string, ...args: unknown[]): void; warn(message: string, ...args: unknown[]): void; error(message: string, ...args: unknown[]): void; } /** * Canonical wallet-handoff flow taxonomy. * * UWC is the single owner of this union so the two consumer layers (link-v2 and * v3) don't drift. The string values are deliberately frozen to match link-v2's * historical `wallet_flow_type` wire values so existing RUM / Segment facets keep * matching after a consumer switches to importing this type — this is a * lift-and-canonicalize, not a rename. * * Note: UWC's own `deriveWalletFlowType` only produces the extension / WC / TON / * in-wallet / unknown values. The `dapp_*` members are part of the frozen wire * taxonomy but are set only by a consumer with richer context — forward-compat, * not dead code. */ export type WalletFlowType = 'browser_extension_flow' | 'wallet_connect_deep_link_flow' | 'wallet_connect_qr_flow' | 'dapp_deep_link_flow' | 'dapp_qr_flow' | 'ton_connect_qr_flow' | 'ton_connect_deep_link_flow' | 'in_wallet_browser_flow' | 'unknown'; /** * Coarse runtime surface. Intentionally a small enum — never a raw user-agent * string, which is PII and high-cardinality. Used to decide whether mobile-only * heuristics (e.g. focus bracketing) apply to a handoff. */ export type Platform = 'mobile' | 'desktop' | 'webview' | 'unknown'; /** * Coarse cause bucket for a non-success wallet outcome. Deliberately small and * stable so it can drive failure dashboards without high cardinality. `unknown` * is the honest default — UWC only classifies a kind when the evidence is * reliable (a known EIP-1193 code, an explicit rejection, a typed connector * error), never a guess from a message substring. */ export type FailureKind = 'user_rejected' | 'provider_error' | 'bridge_error' | 'network_error' /** Wallet and the configured networks share no chain — connect can't proceed. */ | 'no_common_network' | 'unsupported_method' | 'invalid_params' | 'expired' /** `SignClient.init` (WalletConnect) rejected — the connector never came up. */ | 'client_init_failed' | 'unknown'; /** * Where a failure originated, as far as UWC can tell from the error shape. Used * to triage whether a problem sits in the wallet/provider, our connector layer, * or the iframe bridge. `unknown` when the shape carries no reliable signal. */ export type ErrorSource = 'provider' | 'connector' | 'bridge' | 'uwc' | 'unknown'; /** * Why post-connect wallet-lifecycle telemetry could not be attached. Emitted ONCE * per connector/session/namespace so analytics can distinguish "lifecycle is * genuinely silent" from "we never wired it" — an absent signal is itself signal. */ export type LifecycleUnavailableReason = /** The live provider exposes no `.on` (or the connected namespace has no event surface yet). */ 'provider_subscription_unavailable' /** The iframe bridge couldn't forward provider events (no forwarder on the parent). */ | 'bridge_subscription_unavailable' /** The connected namespace has no lifecycle source UWC observes. */ | 'unsupported_namespace' /** * RESERVED — not yet emitted. The parent's `uwc-bridge-parent` predates event * forwarding; produced once cross-bridge lifecycle forwarding ships (MFS-576). * Declared now so consumer switch statements are exhaustive ahead of it. */ | 'old_bridge_parent' /** * Lifecycle telemetry stopped mid-session: the per-attachment emission cap * tripped (a storming provider). Emitted once at the moment of the trip. */ | 'emission_cap'; //# sourceMappingURL=observability.d.ts.map