/** * Frontend telemetry powered by Tencent Cloud RUM (Aegis). Factory form of the * near-identical `plugins/telemetry.ts` the apps each carried; the only real * divergence — how custom-event props map into Aegis's `ext1..ext3` slots — is * injected via `mapTrackProps`. * * `aegis-web-sdk` is dynamically imported and typed loosely (`any`) so this * package builds without the SDK installed; it stays an optional peer dep. * * RUM project ids are NOT secret (shipped to every visitor), so the consumer * passes them as plain config. */ export interface TelemetryInitOptions { uin?: string; fingerprint?: string; release?: string; } export interface TelemetryExtSlots { ext1?: string; ext2?: string; ext3?: string; } export interface ApiFailureArgs { url: string; method?: string; status?: number; trace_id?: string; } export interface TelemetryConfig { /** Aegis "report id" (the alphanumeric token on the Web app's 应用接入 row). */ projectId: string; /** Aegis collector host, e.g. `https://rumt-zh.com`. */ hostUrl: string; /** Map custom-event props into Aegis ext slots. Defaults cover service/order/trace. */ mapTrackProps?: (props: Record) => TelemetryExtSlots; } export interface Telemetry { initTelemetry(opts?: TelemetryInitOptions): Promise; setUser(uin?: string, aid?: string): void; track(event: string, props?: Record): void; captureError(error: unknown, ctx?: Record): void; trackApiFailure(args: ApiFailureArgs): void; isInitialized(): boolean; } export declare function createTelemetry(config: TelemetryConfig): Telemetry; //# sourceMappingURL=createTelemetry.d.ts.map