instabug-reactnative
Version:
React Native plugin for integrating the Instabug SDK
98 lines (97 loc) • 3.91 kB
TypeScript
import { ExtendedError, StackFrame } from 'react-native/Libraries/Core/Devtools/parseErrorStack';
import type { NavigationState as NavigationStateV5, PartialState } from '@react-navigation/native';
import type { NavigationState as NavigationStateV4 } from 'react-navigation';
import type { CrashData } from '../native/NativeCrashReporting';
import type { NetworkData } from './XhrNetworkInterceptor';
type ApmNetworkFlags = {
isNativeInterceptionFeatureEnabled: boolean;
hasAPMNetworkPlugin: boolean;
shouldEnableNativeInterception: boolean;
};
export declare function setApmNetworkFlagsIfChanged(flags: ApmNetworkFlags): boolean;
export declare const parseErrorStack: (error: ExtendedError) => StackFrame[];
export declare const getCrashDataFromError: (error: Error) => CrashData;
export declare const getActiveRouteName: (navigationState: NavigationStateV4) => string | null;
export declare function getFullRoute(state: NavigationStateV5 | PartialState<NavigationStateV5>): string;
export declare const getStackTrace: (e: ExtendedError) => StackFrame[];
export declare const captureJsErrors: () => void;
export declare const stringifyIfNotString: (input: unknown) => string;
/**
* Sends crash report to Instabug's servers based on @param sendFunction
*
* @param error Error object to be sent to Instabug's servers
* @param remoteSenderCallback Function to send the crash report to Instabug's servers
*
* @example
* `sendCrashReport(error, NativeCrashReporting.sendHandledJSCrash);`
* or
* `sendCrashReport(error, NativeCrashReporting.sendJSCrash);`
*
*/
export declare function sendCrashReport(error: ExtendedError, remoteSenderCallback: (json: CrashData | string) => Promise<void>): Promise<void>;
/**
* Generate random 32 bit unsigned integer Hexadecimal (8 chars) lower case letters
* Should not return all zeros
*/
export declare const generateTracePartialId: () => {
numberPartilId: number;
hexStringPartialId: string;
};
/**
* Generate W3C header in the format of {version}-{trace-id}-{parent-id}-{trace-flag}
* @param networkStartTime
* @returns w3c header
*/
export declare const generateW3CHeader: (networkStartTime: number) => {
timestampInSeconds: number;
partialId: number;
w3cHeader: string;
};
export declare function isContentTypeNotAllowed(contentType: string): boolean;
export declare const reportNetworkLog: (network: NetworkData) => void;
/**
* @internal
* This method is for internal use only.
*/
export declare function registerObfuscationListener(): void;
/**
* @internal
* This method is for internal use only.
*/
export declare function registerFilteringListener(filterExpression: string): void;
/**
* @internal
* This method is for internal use only.
*/
export declare function registerFilteringAndObfuscationListener(filterExpression: string): void;
/**
* @internal
* This method is for internal use only.
*/
export declare function checkNetworkRequestHandlers(): void;
export declare function resetNativeObfuscationListener(): void;
/**
* @internal
* This method is for internal use only.
*/
export declare function updateNetworkLogSnapshot(networkSnapshot: NetworkData): void;
declare const _default: {
parseErrorStack: (error: ExtendedError) => StackFrame[];
captureJsErrors: () => void;
getActiveRouteName: (navigationState: NavigationStateV4) => string | null;
getFullRoute: typeof getFullRoute;
getStackTrace: (e: ExtendedError) => StackFrame[];
stringifyIfNotString: (input: unknown) => string;
sendCrashReport: typeof sendCrashReport;
reportNetworkLog: (network: NetworkData) => void;
generateTracePartialId: () => {
numberPartilId: number;
hexStringPartialId: string;
};
generateW3CHeader: (networkStartTime: number) => {
timestampInSeconds: number;
partialId: number;
w3cHeader: string;
};
};
export default _default;