export interface PayLogContext { /** 渠道 */ channel?: string; /** 订单ID */ orderId?: string | number; /** 设备ID */ deviceId?: string | number; /** 支付类型:PAYO / WINDCAVE / LINKLY / TYRO */ paymentType?: string; /** 交易记录号 */ transactionNumber?: string; /** 模式:pay / refund / query */ mode?: string; /** 其他扩展信息 */ extra?: Record; } declare class PayLog { private static instance; private sessionKey; private context; private logs; private startTime; private flushed; private constructor(); static getInstance(): PayLog; /** * 初始化一次交易会话 * - 生成唯一 sessionKey * - 恢复上报 localStorage 中残留的旧日志 * - 接受部分 context(后续可通过 setContext 补充) */ init(context?: Partial): void; /** * 补充/更新上下文信息 * 新值覆盖旧值,extra 做浅合并 */ setContext(partial: Partial): void; /** * 记录一条日志 */ log(title: string, data?: any): void; /** * 上报日志到飞书并清理 localStorage */ flush(customTitle?: string): Promise; /** * flush + 重置内部状态 */ destroy(): void; /** * 构建 sendWarningLog 所需的 content 数组 */ private buildContent; /** * 持久化当前会话到 localStorage */ private persistToStorage; /** * 从 localStorage 移除指定 session */ private removeFromStorage; /** * 获取 localStorage 中所有 session */ private getAllSessions; /** * 恢复上报 localStorage 中残留的旧日志(崩溃/异常退出场景) */ private recoverOrphanedLogs; } declare const payLog: PayLog; export default payLog; /** * 在根组件中使用,管理 PayLog 生命周期 * - mount 时 init(+ 恢复上报残留日志) * - unmount 时 destroy */ export declare function usePayLog(context?: Partial): { log: (title: string, data?: any) => void; setContext: (partial: Partial) => void; };