import invoker,{BRIDGE_ERROR_CODE,CONTINUOUS_EVENT_LIST,PLATFORM_TYPE_ENUM,API_INVOKER_TYPE}from"./invoker";function startTraceReportHandler(e,r){var t=r.resolve,n=r.reject,o=r.context,a=r.containerType,i=r.platformType,s=r.appType,c=invoker.registerEvent(CONTINUOUS_EVENT_LIST.UPDATE_TRACE,(function(r){var t=r.data;t.errorCode&&t.errorCode!==BRIDGE_ERROR_CODE.SUCCESS?e.onFail&&e.onFail(t):e.onSuccess&&e.onSuccess(t.result||t)}));if(a){var R=function(r){invoker.registerContinuesEvent(e.traceId,c),invoker.handleBridgeResponse(r,t,n)},T=function(r){invoker.registerContinuesEvent(e.traceId,c),invoker.handleBridgeResponse(r,t,n)};s===API_INVOKER_TYPE.MINI_APP?o&&o({m:"taurus.common.startTraceReport",args:e,onSuccess:R,onFail:T}):i===PLATFORM_TYPE_ENUM.ANDROID?o&&o(R,T,"taurus.common","startTraceReport",e):i===PLATFORM_TYPE_ENUM.IOS&&o.callHandler("taurus.common.startTraceReport",Object.assign({},e),(function(r){invoker.registerContinuesEvent(e.traceId,c),invoker.handleBridgeResponse(r,t,n)}))}else o&&o.call("startTraceReport",e,(function(r){invoker.registerContinuesEvent(e.traceId,c),invoker.handleBridgeResponse(r,t,n)}))}invoker.registerAPI("startTraceReport",{mobile:startTraceReportHandler,mini:!0}),startTraceReport.version={android:"1.3.4",ios:"1.3.4"};export default function startTraceReport(e){return invoker.invoke("startTraceReport",e)}