/** * 上报对象 */ import { ConvertInfo, BaseReportData, ManalReportData } from '../core/models/index'; import { EventEmitter } from '../core/utilities/index'; import { ReportDataTypeEnum } from '../core/enums/reportDataTypeEnum'; import { YxConvertInfo } from '../core/models/yxjsReportData'; import { ReportResponse } from '../core/utilities/http'; import { JTEnum } from 'packages/core/enums/jtEnum'; /** * @param reportData 上报数据 * @param ctx 上下文内容 */ export declare type Middleware = (reportData: T, ctx: object) => T; /** * report配置项 */ export interface ReportOtions { /** 落地页id */ pid?: string; /** cc */ cc?: string; /** jt */ jt?: JTEnum; } export declare class Report extends EventEmitter { /** 相关配置 */ static options: ReportOtions; /** 上报地址 */ reportUrl: string; constructor(); setOptions(options?: ReportOtions): void; /** * 发送上报 * @param data 上报数据 */ private send; /** 中间件 */ private middlewares; /** 扩展中间件安装 */ use(middleware: Middleware): this | undefined; /** * 自定义上报,兼容两种模式,异步以及同步上报。异步上报会返回promise需要自行设置回调逻辑或者链接跳转,同步模式会自动调用callbackOrlink。 * @param p 上报参数 * @param callbackOrLink callback函数或者跳转页面 * @param timeout 回调时间,毫秒 * @returns 异步上报模式会返回上报数据,和结果信息。同步上报模式会延时调用回调函数或链接 */ push(p: any[], callbackOrLink: (...args: any) => any | string, timeout?: number): ManalReportData | void; push(p: any[]): Promise<{ reportData: ManalReportData; response: ReportResponse; }>; /** 自动上报数据 * @param reportDataType 上报数据类型,或者上报数据实体 */ autoPush(reportData: T, options?: Partial): Promise; autoPush(reportDataType: ReportDataTypeEnum, ...args: any[]): Promise; /** 中间件处理数据 */ dispose(reportData: T, ctx: object): T; /** 转化追踪js上报 */ report(info: YxConvertInfo): Promise; /** * 转化上报 * @param mi 转化必填信息 * @param op 转化附属信息 */ convert(mi: ConvertInfo): Promise; /** * 转化失败上报 */ cverr(errInfo: any): Promise; } //# sourceMappingURL=report.d.ts.map