posthog-react-native 4.77.1 → 4.78.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -8,9 +8,27 @@ interface AutocaptureOptions {
8
8
  console?: boolean | LogLevel[];
9
9
  /**
10
10
  * Enables native iOS/Android/macOS crash autocapture through the optional native plugin.
11
+ * On Android this covers Java/Kotlin crashes; native C/C++ (NDK) crashes are enabled with
12
+ * `androidNdkCrashes`. On Apple platforms it covers signal crashes too.
11
13
  * Disabled by default. Requires `@posthog/react-native-plugin` installed (2.2.0 or newer for macOS).
12
14
  */
13
15
  nativeCrashes?: boolean;
16
+ /**
17
+ * Enables autocapture of native C/C++ (NDK) crashes on Android, through the optional native
18
+ * plugin. Requires Android 12 (API 31) or later and exception autocapture enabled in the
19
+ * project's error tracking settings.
20
+ *
21
+ * An NDK crash kills the process immediately, so it is captured on the next app launch from
22
+ * the records the OS kept, which means properties such as `$app_version` and the identity
23
+ * describe that launch rather than the crash. The first launch after enabling this also
24
+ * captures the native crashes the OS still holds from before.
25
+ *
26
+ * For readable stack traces, upload the app's `.so` debug symbols. With Expo, set `uploadNativeSymbols`
27
+ * on the `posthog-react-native/expo` config plugin: https://posthog.com/docs/error-tracking/upload-source-maps/react-native#native-crash-symbolication
28
+ *
29
+ * Ignored on other platforms. Disabled by default. Requires `@posthog/react-native-plugin` 2.12.0 or newer.
30
+ */
31
+ androidNdkCrashes?: boolean;
14
32
  }
15
33
  /**
16
34
  * Controls the breadcrumb-style exception steps recorded via `addExceptionStep` and attached
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":["_core","require","_utils","_utils2","_OptionalPlugin","_fatalPayload","_createForOfIteratorHelper","r","e","t","Symbol","iterator","Array","isArray","_unsupportedIterableToArray","length","_n","F","s","n","done","value","f","TypeError","o","a","u","call","next","_arrayLikeToArray","toString","slice","constructor","name","from","test","ownKeys","Object","keys","getOwnPropertySymbols","filter","getOwnPropertyDescriptor","enumerable","push","apply","_objectSpread","arguments","forEach","_defineProperty2","getOwnPropertyDescriptors","defineProperties","defineProperty","LogLevelList","ErrorTracking","exports","instance","options","undefined","logger","fatalCaptureHooks","_classCallCheck2","_nativeForwardingEnabled","_autocaptureEnabled","createLogger","resolveOptions","exceptionSteps","_exceptionStepsConfig","CoreErrorTracking","resolveExceptionStepsConfig","enabled","max_bytes","maxBytes","_exceptionStepsBuffer","ExceptionStepsBuffer","autocapture","_createClass2","key","getNativePluginExceptionStepsConfig","addExceptionStep","message","properties","isString","trim","warn","userProperties","isObject","_CoreErrorTracking$st","stripReservedExceptionStepFields","sanitizedProperties","droppedKeys","add","EXCEPTION_STEP_INTERNAL_FIELDS","MESSAGE","TIMESTAMP","Date","toISOString","forwardExceptionStepToNative","error","onNativeErrorTrackingReady","_iterator","getAttachableExceptionSteps","_step","step","$message","err","_this","OptionalReactNativePlugin","Promise","resolve","concat","attachExceptionSteps","isNullish","$exception_steps","steps","getAttachable","clearExceptionSteps","clear","shutdown","_a","_unsubscribeUncaughtExceptions","onRemoteConfig","errorTracking","getRemoteConfigBool","info","isUncaughtExceptionAutocaptureEnabled","uncaughtExceptions","autocaptureOptions","resolveAutocaptureOptions","unhandledRejections","console","resolveConsoleOptions","level","includes","autocaptureUncaughtErrors","_this2","onUncaughtException","isFatal","isPostHogFetchNetworkError","hint","mechanism","type","handled","captureException","handleFatalException","uuidv7","trackUncaughtExceptions","_handleFatalException","_asyncToGenerator2","_regenerator","mark","_callee","eventUuid","timestamp","_this3","storageReady","result","_result","queued","nativeCapture","persisted","nativeWrite","_yield$Promise$all","_yield$Promise$all2","persistedOk","_t","_t2","_t3","wrap","_context","prev","waitForStorageReady","sent","isDisabled","optedOut","abrupt","$exception_level","captureFatalException","prepareFatalNativeCapture","flush","critical","waitForJSPersist","all","_slicedToArray2","stop","_x","_x2","_x3","_x4","queuedEvent","bridge","isNativeCaptureReady","_b","getPersistenceMode","payload","buildFatalExceptionPayload","distinctId","distinct_id","autocaptureUnhandledRejections","_this4","onUnhandledRejection","trackUnhandledRejections","autocaptureConsole","levels","_this5","onConsole","syntheticException","additionalProperties","_iterator2","_step2","trackConsole"],"sources":["../../src/error-tracking/index.ts"],"sourcesContent":["import type { PostHog } from '../posthog-rn'\nimport {\n JsonType,\n Logger,\n ErrorTracking as CoreErrorTracking,\n isPostHogFetchNetworkError,\n isNullish,\n isObject,\n isString,\n PostHogEventProperties,\n uuidv7,\n} from '@posthog/core'\nimport { Properties } from '@posthog/types'\nimport { trackConsole, trackUncaughtExceptions, trackUnhandledRejections } from './utils'\nimport { getRemoteConfigBool } from '../utils'\nimport { OptionalReactNativePlugin } from '../optional/OptionalPlugin'\nimport { buildFatalExceptionPayload } from './fatal-payload'\n\ntype LogLevel = 'debug' | 'log' | 'info' | 'warn' | 'error'\n\nconst LogLevelList: LogLevel[] = ['debug', 'log', 'info', 'warn', 'error']\n\n// user provided configuration\ninterface AutocaptureOptions {\n uncaughtExceptions?: boolean\n unhandledRejections?: boolean\n console?: boolean | LogLevel[]\n /**\n * Enables native iOS/Android/macOS crash autocapture through the optional native plugin.\n * Disabled by default. Requires `@posthog/react-native-plugin` installed (2.2.0 or newer for macOS).\n */\n nativeCrashes?: boolean\n}\n\n/**\n * Controls the breadcrumb-style exception steps recorded via `addExceptionStep` and attached\n * to captured exceptions as `$exception_steps`.\n */\nexport interface ExceptionStepsOptions {\n /**\n * Whether exception steps are recorded and attached.\n * @default true\n */\n enabled?: boolean\n /**\n * Total UTF-8 byte budget (~32KB) for the in-memory buffer. Oldest steps are evicted first when exceeded.\n * @default 32768\n */\n maxBytes?: number\n}\n\nexport interface ErrorTrackingOptions {\n autocapture?: AutocaptureOptions | boolean\n exceptionSteps?: ExceptionStepsOptions\n}\n\n// resolved configuration\ninterface ResolvedAutocaptureOptions {\n uncaughtExceptions: boolean\n unhandledRejections: boolean\n console: LogLevel[]\n}\n\ninterface ResolvedErrorTrackingOptions {\n autocapture: ResolvedAutocaptureOptions\n}\n\n// Hooks supplied by PostHogRN for coordinating the fatal capture with its event storage.\n// Storage readiness is explicit so unknown persisted consent fails closed rather than being\n// mistaken for the in-memory default.\ninterface FatalCaptureHooks {\n // `prepareNativeCapture` is offered the final, before_send-accepted message at the moment\n // it would be enqueued. Returning a thunk transfers ownership of the exception to the\n // native SDK and the JS queue copy is dropped; returning undefined leaves the event in the\n // JS queue as usual. The choice has to be made there, in one step, so a payload that fails\n // to build cannot leave the exception dropped from both queues.\n captureFatalException: (\n error: unknown,\n hint: CoreErrorTracking.EventHint,\n eventUuid: string,\n timestamp: Date,\n prepareNativeCapture: (queued: PostHogEventProperties) => (() => Promise<void>) | undefined\n ) => { queued: boolean; nativeCapture?: () => Promise<void> }\n waitForJSPersist: () => Promise<boolean>\n waitForStorageReady: () => Promise<boolean>\n getPersistenceMode: () => 'memory' | 'file' | undefined\n // Both native SDKs silently no-op a capture before setup() has run. Native init is async\n // and happens after the storage preload, so an early-startup crash can arrive first —\n // exactly the crashes this path exists for. Ownership only transfers once native is up.\n isNativeCaptureReady: () => boolean\n}\n\nexport class ErrorTracking {\n private logger: Logger\n private options: ResolvedErrorTrackingOptions\n private _exceptionStepsConfig: CoreErrorTracking.ResolvedExceptionStepsConfig\n private _exceptionStepsBuffer: CoreErrorTracking.ExceptionStepsBuffer\n private _nativeForwardingEnabled: boolean = false\n private _unsubscribeUncaughtExceptions?: () => void\n\n /**\n * Controls whether autocaptured exceptions are actually sent.\n * When remote config disables error tracking, this is set to false\n * so that installed handlers become no-ops.\n * Defaults to true (don't block locally enabled capture before remote config loads).\n */\n private _autocaptureEnabled: boolean = true\n\n constructor(\n private instance: PostHog,\n options: ErrorTrackingOptions = {},\n logger: Logger,\n private readonly fatalCaptureHooks?: FatalCaptureHooks\n ) {\n this.logger = logger.createLogger('[ErrorTracking]')\n this.options = this.resolveOptions(options)\n const exceptionSteps = options.exceptionSteps\n this._exceptionStepsConfig = CoreErrorTracking.resolveExceptionStepsConfig(\n exceptionSteps ? { enabled: exceptionSteps.enabled, max_bytes: exceptionSteps.maxBytes } : undefined\n )\n this._exceptionStepsBuffer = new CoreErrorTracking.ExceptionStepsBuffer(this._exceptionStepsConfig)\n this.autocapture(this.options.autocapture)\n }\n\n /**\n * Exception-steps config in the native plugin's shape, so the embedded native SDK keeps one\n * logical buffer with the same byte budget and enabled state.\n */\n getNativePluginExceptionStepsConfig(): ExceptionStepsOptions {\n return { enabled: this._exceptionStepsConfig.enabled, maxBytes: this._exceptionStepsConfig.max_bytes }\n }\n\n /**\n * Records a breadcrumb-style exception step in the instance buffer and mirrors it to the embedded\n * native SDK. The `$timestamp` is captured at call time. Invalid messages are ignored with a\n * warning and never throw. The step only reaches native when it was actually buffered.\n */\n addExceptionStep(message: string, properties?: Properties): void {\n if (!this._exceptionStepsConfig.enabled) {\n return\n }\n\n try {\n if (!isString(message) || message.trim().length === 0) {\n this.logger.warn('Ignoring exception step because message must be a non-empty string')\n return\n }\n\n const userProperties = isObject(properties) ? { ...properties } : {}\n const { sanitizedProperties, droppedKeys } = CoreErrorTracking.stripReservedExceptionStepFields(userProperties)\n\n if (droppedKeys.length > 0) {\n this.logger.warn('Ignoring reserved exception step fields', { droppedKeys })\n }\n\n this._exceptionStepsBuffer.add({\n [CoreErrorTracking.EXCEPTION_STEP_INTERNAL_FIELDS.MESSAGE]: message,\n [CoreErrorTracking.EXCEPTION_STEP_INTERNAL_FIELDS.TIMESTAMP]: new Date().toISOString(),\n ...sanitizedProperties,\n })\n this.forwardExceptionStepToNative(message, properties)\n } catch (error) {\n this.logger.error('Failed to add exception step. Ignoring breadcrumb.', error)\n }\n }\n\n /**\n * Native error tracking initializes asynchronously, so steps recorded before then are buffered\n * only in JS. The host calls this once native is ready to enable forwarding and replay the buffer,\n * so a native crash shortly after startup carries the steps recorded before native was ready.\n */\n onNativeErrorTrackingReady(): void {\n this._nativeForwardingEnabled = true\n for (const step of this.getAttachableExceptionSteps()) {\n this.forwardExceptionStepToNative(step.$message, step as Properties)\n }\n }\n\n private forwardExceptionStepToNative(message: string, properties?: Properties): void {\n if (!this._nativeForwardingEnabled || !OptionalReactNativePlugin?.addExceptionStep) {\n return\n }\n try {\n // Fire-and-forget: the native layer validates and buffers independently and must never block.\n void Promise.resolve(OptionalReactNativePlugin.addExceptionStep(message, properties)).catch((e) => {\n this.logger.warn(`Failed to forward exception step to native: ${e}`)\n })\n } catch (e) {\n this.logger.warn(`Failed to forward exception step to native: ${e}`)\n }\n }\n\n /**\n * Returns `properties` with a snapshot of the buffered steps attached as `$exception_steps`,\n * unless the feature is disabled, the caller already provided that key, or the buffer is empty.\n * The buffer is left intact so subsequent exceptions read the same steps.\n */\n attachExceptionSteps(properties: PostHogEventProperties): PostHogEventProperties {\n if (!this._exceptionStepsConfig.enabled || !isNullish(properties.$exception_steps)) {\n return properties\n }\n const steps = this.getAttachableExceptionSteps()\n if (steps.length === 0) {\n return properties\n }\n // Steps are already normalized to their JSON-safe wire form by the buffer.\n return { ...properties, $exception_steps: steps as unknown as JsonType }\n }\n\n /**\n * Snapshot of the buffered steps (oldest first), or an empty array when disabled or empty.\n */\n getAttachableExceptionSteps(): CoreErrorTracking.ExceptionStep[] {\n if (!this._exceptionStepsConfig.enabled) {\n return []\n }\n try {\n return this._exceptionStepsBuffer.getAttachable()\n } catch (error) {\n this.logger.error('Failed to read buffered exception steps.', error)\n return []\n }\n }\n\n /**\n * Clears the buffer. Called on SDK close, not on capture or identity changes.\n */\n clearExceptionSteps(): void {\n this._exceptionStepsBuffer.clear()\n }\n\n shutdown(): void {\n this._autocaptureEnabled = false\n this._unsubscribeUncaughtExceptions?.()\n this._unsubscribeUncaughtExceptions = undefined\n this.clearExceptionSteps()\n }\n\n /**\n * Called when remote config is loaded.\n * If errorTracking.autocaptureExceptions is explicitly false, autocapture is disabled.\n * If it's true or undefined (not yet loaded / not present), autocapture follows local config.\n */\n onRemoteConfig(errorTracking: boolean | { [key: string]: JsonType } | undefined): void {\n if (errorTracking == null) {\n // Remote config doesn't include errorTracking — don't change anything\n return\n }\n\n // Default to false: if remote config is present but the key is missing, disable autocapture\n this._autocaptureEnabled = getRemoteConfigBool(errorTracking, 'autocaptureExceptions', false)\n\n this.logger.info(\n `Error tracking autocapture ${this._autocaptureEnabled ? 'enabled' : 'disabled'} by remote config.`\n )\n }\n\n /**\n * Whether the app asked for fatal JavaScript exceptions to be autocaptured. This is the\n * locally configured value, deliberately not gated on the remote kill-switch: it decides\n * whether the native SDK is worth initializing, and that happens before remote config has\n * been fetched.\n */\n isUncaughtExceptionAutocaptureEnabled(): boolean {\n return this.options.autocapture.uncaughtExceptions\n }\n\n private resolveOptions(options: ErrorTrackingOptions): ResolvedErrorTrackingOptions {\n const autocaptureOptions = this.resolveAutocaptureOptions(options.autocapture)\n return {\n autocapture: autocaptureOptions,\n }\n }\n\n private resolveAutocaptureOptions(autocapture: AutocaptureOptions | boolean = false): ResolvedAutocaptureOptions {\n if (typeof autocapture === 'boolean') {\n return {\n uncaughtExceptions: autocapture,\n unhandledRejections: autocapture,\n console: [],\n }\n }\n return {\n uncaughtExceptions: !!autocapture.uncaughtExceptions,\n unhandledRejections: !!autocapture.unhandledRejections,\n console: this.resolveConsoleOptions(autocapture.console),\n }\n }\n\n private resolveConsoleOptions(console: boolean | LogLevel[] = false): LogLevel[] {\n if (typeof console === 'boolean') {\n return console ? ['error'] : []\n }\n return Array.isArray(console) ? console.filter((level) => LogLevelList.includes(level)) : []\n }\n\n private autocaptureUncaughtErrors() {\n const onUncaughtException = (error: unknown, isFatal: boolean): void | Promise<void> => {\n if (!this._autocaptureEnabled || isPostHogFetchNetworkError(error)) {\n return\n }\n const hint: CoreErrorTracking.EventHint = {\n mechanism: { type: 'onuncaughtexception', handled: false },\n }\n if (!isFatal) {\n this.instance.captureException(error, {}, hint)\n return\n }\n return this.handleFatalException(error, hint, uuidv7(), new Date())\n }\n try {\n this._unsubscribeUncaughtExceptions = trackUncaughtExceptions(onUncaughtException)\n } catch (err) {\n this.logger.warn('Failed to track uncaught exceptions: ', err)\n }\n }\n\n private async handleFatalException(\n error: unknown,\n hint: CoreErrorTracking.EventHint,\n eventUuid: string,\n timestamp: Date\n ): Promise<void> {\n let storageReady = !this.fatalCaptureHooks\n if (this.fatalCaptureHooks) {\n try {\n storageReady = (await this.fatalCaptureHooks.waitForStorageReady()) === true\n } catch (e) {\n this.logger.warn('Fatal capture skipped because events storage did not initialize.', e)\n }\n }\n // Unknown consent must fail closed. A crash is less important than persisting data\n // for a user whose opt-out state could not be loaded.\n if (!storageReady || !this._autocaptureEnabled || this.instance.isDisabled || this.instance.optedOut) {\n return\n }\n\n if (!this.fatalCaptureHooks) {\n this.instance.captureException(error, { $exception_level: 'fatal' as CoreErrorTracking.SeverityLevel }, hint)\n return\n }\n\n // Hand the final payload to the native SDK. Both native SDKs recognise a `$exception`\n // with `$exception_level: 'fatal'` and write it to their own disk queue synchronously\n // before returning, which is the durability the JS queue cannot promise while\n // AsyncStorage is still draining. Native owns delivery from there, including retry\n // across the relaunch, so there is nothing for the next launch to recover — and the JS\n // queue copy is dropped so the exception is not sent twice.\n let result: { queued: boolean; nativeCapture?: () => Promise<void> }\n try {\n result = this.fatalCaptureHooks.captureFatalException(error, hint, eventUuid, timestamp, (queued) =>\n this.prepareFatalNativeCapture(queued)\n )\n } catch (e) {\n // Without the final queued event we cannot know whether before_send accepted or\n // redacted the exception, so sending a raw fallback would bypass filtering.\n this.logger.error('Fatal exception capture failed before enqueue.', e)\n return\n }\n const { queued, nativeCapture } = result\n if (!queued && !nativeCapture) {\n // before_send dropped it.\n return\n }\n\n void this.instance.flush().catch(() => {\n this.logger.critical('Failed to flush events')\n })\n // Other events may still be queued behind this one, so the JS store is still worth\n // draining even when native owns the exception itself.\n const persisted = this.fatalCaptureHooks.waitForJSPersist()\n let nativeWrite: Promise<void> | undefined\n if (nativeCapture) {\n try {\n nativeWrite = nativeCapture().catch((e) => {\n this.logger.warn(`Fatal exception native capture failed: ${e}`)\n })\n } catch (e) {\n this.logger.warn(`Fatal exception native capture failed: ${e}`)\n }\n }\n const [persistedOk] = await Promise.all([persisted, nativeWrite])\n if (!persistedOk && !nativeCapture) {\n this.logger.warn('Fatal exception JS persist failed and no native capture path was available.')\n }\n }\n\n private prepareFatalNativeCapture(queuedEvent: PostHogEventProperties): (() => Promise<void>) | undefined {\n const bridge = OptionalReactNativePlugin?.captureFatalException\n if (!bridge) {\n return undefined\n }\n // Handing the event to a native SDK that is not set up yet would drop it: native\n // no-ops the capture, and the JS queue copy has already been given up.\n if (!this.fatalCaptureHooks?.isNativeCaptureReady()) {\n return undefined\n }\n // Memory-persistence apps asked for nothing on disk. The native queue is disk-backed,\n // so honour that here rather than routing around it.\n if (this.fatalCaptureHooks?.getPersistenceMode() === 'memory') {\n return undefined\n }\n if (this.instance.isDisabled || this.instance.optedOut) {\n return undefined\n }\n\n const properties = isObject(queuedEvent.properties) ? (queuedEvent.properties as PostHogEventProperties) : {}\n const payload = buildFatalExceptionPayload({\n timestamp: isString(queuedEvent.timestamp) ? queuedEvent.timestamp : new Date().toISOString(),\n distinctId: isString(queuedEvent.distinct_id) ? queuedEvent.distinct_id : '',\n // The event was normalized and emitted only after before_send accepted it.\n properties,\n })\n return () => bridge(payload.distinctId, payload.timestamp, payload.properties)\n }\n\n private autocaptureUnhandledRejections() {\n const onUnhandledRejection = (error: unknown) => {\n // Gate on remote config — if remotely disabled, don't capture\n if (!this._autocaptureEnabled) {\n return\n }\n\n // Offline/timeout failures are expected, not application errors.\n if (isPostHogFetchNetworkError(error)) {\n return\n }\n\n const hint: CoreErrorTracking.EventHint = {\n mechanism: {\n type: 'onunhandledrejection',\n handled: false,\n },\n }\n this.instance.captureException(error, {}, hint)\n }\n\n try {\n trackUnhandledRejections(onUnhandledRejection)\n } catch (err) {\n this.logger.warn('Failed to track unhandled rejections: ', err)\n }\n }\n\n private autocaptureConsole(levels: LogLevel[]) {\n const onConsole = (level: LogLevel) => (error: unknown, isFatal: boolean, syntheticException?: Error) => {\n // Gate on remote config — if remotely disabled, don't capture\n if (!this._autocaptureEnabled) {\n return\n }\n\n const hint: CoreErrorTracking.EventHint = {\n mechanism: {\n type: 'onconsole',\n handled: true,\n },\n syntheticException,\n }\n const additionalProperties = {\n $exception_level: level as CoreErrorTracking.SeverityLevel,\n }\n this.instance.captureException(error, additionalProperties, hint)\n }\n\n try {\n for (const level of levels) {\n trackConsole(level, onConsole(level))\n }\n } catch (err) {\n this.logger.warn('Failed to track console errors: ', err)\n }\n }\n\n private autocapture(autocaptureOptions: ResolvedAutocaptureOptions) {\n if (autocaptureOptions.uncaughtExceptions === true) {\n this.autocaptureUncaughtErrors()\n }\n if (autocaptureOptions.unhandledRejections === true) {\n this.autocaptureUnhandledRejections()\n }\n if (autocaptureOptions.console.length > 0) {\n this.autocaptureConsole(autocaptureOptions.console)\n }\n }\n}\n"],"mappings":"utBACA,IAAAA,KAAA,CAAAC,OAAA,kBAYA,IAAAC,MAAA,CAAAD,OAAA,YACA,IAAAE,OAAA,CAAAF,OAAA,aACA,IAAAG,eAAA,CAAAH,OAAA,+BACA,IAAAI,aAAA,CAAAJ,OAAA,oBAA4D,SAAAK,2BAAAC,CAAA,CAAAC,CAAA,MAAAC,CAAA,qBAAAC,MAAA,EAAAH,CAAA,CAAAG,MAAA,CAAAC,QAAA,GAAAJ,CAAA,mBAAAE,CAAA,KAAAG,KAAA,CAAAC,OAAA,CAAAN,CAAA,IAAAE,CAAA,CAAAK,2BAAA,CAAAP,CAAA,IAAAC,CAAA,EAAAD,CAAA,mBAAAA,CAAA,CAAAQ,MAAA,EAAAN,CAAA,GAAAF,CAAA,CAAAE,CAAA,MAAAO,EAAA,GAAAC,CAAA,UAAAA,EAAA,WAAAC,CAAA,CAAAD,CAAA,CAAAE,CAAA,UAAAA,EAAA,SAAAH,EAAA,EAAAT,CAAA,CAAAQ,MAAA,EAAAK,IAAA,MAAAA,IAAA,IAAAC,KAAA,CAAAd,CAAA,CAAAS,EAAA,OAAAR,CAAA,UAAAA,EAAAD,CAAA,QAAAA,CAAA,GAAAe,CAAA,CAAAL,CAAA,aAA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,CAAC","ignoreList":[]}
1
+ {"version":3,"file":"index.js","names":["_core","require","_utils","_utils2","_OptionalPlugin","_fatalPayload","_createForOfIteratorHelper","r","e","t","Symbol","iterator","Array","isArray","_unsupportedIterableToArray","length","_n","F","s","n","done","value","f","TypeError","o","a","u","call","next","_arrayLikeToArray","toString","slice","constructor","name","from","test","ownKeys","Object","keys","getOwnPropertySymbols","filter","getOwnPropertyDescriptor","enumerable","push","apply","_objectSpread","arguments","forEach","_defineProperty2","getOwnPropertyDescriptors","defineProperties","defineProperty","LogLevelList","ErrorTracking","exports","instance","options","undefined","logger","fatalCaptureHooks","_classCallCheck2","_nativeForwardingEnabled","_autocaptureEnabled","createLogger","resolveOptions","exceptionSteps","_exceptionStepsConfig","CoreErrorTracking","resolveExceptionStepsConfig","enabled","max_bytes","maxBytes","_exceptionStepsBuffer","ExceptionStepsBuffer","autocapture","_createClass2","key","getNativePluginExceptionStepsConfig","addExceptionStep","message","properties","isString","trim","warn","userProperties","isObject","_CoreErrorTracking$st","stripReservedExceptionStepFields","sanitizedProperties","droppedKeys","add","EXCEPTION_STEP_INTERNAL_FIELDS","MESSAGE","TIMESTAMP","Date","toISOString","forwardExceptionStepToNative","error","onNativeErrorTrackingReady","_iterator","getAttachableExceptionSteps","_step","step","$message","err","_this","OptionalReactNativePlugin","Promise","resolve","concat","attachExceptionSteps","isNullish","$exception_steps","steps","getAttachable","clearExceptionSteps","clear","shutdown","_a","_unsubscribeUncaughtExceptions","onRemoteConfig","errorTracking","getRemoteConfigBool","info","isUncaughtExceptionAutocaptureEnabled","uncaughtExceptions","autocaptureOptions","resolveAutocaptureOptions","unhandledRejections","console","resolveConsoleOptions","level","includes","autocaptureUncaughtErrors","_this2","onUncaughtException","isFatal","isPostHogFetchNetworkError","hint","mechanism","type","handled","captureException","handleFatalException","uuidv7","trackUncaughtExceptions","_handleFatalException","_asyncToGenerator2","_regenerator","mark","_callee","eventUuid","timestamp","_this3","storageReady","result","_result","queued","nativeCapture","persisted","nativeWrite","_yield$Promise$all","_yield$Promise$all2","persistedOk","_t","_t2","_t3","wrap","_context","prev","waitForStorageReady","sent","isDisabled","optedOut","abrupt","$exception_level","captureFatalException","prepareFatalNativeCapture","flush","critical","waitForJSPersist","all","_slicedToArray2","stop","_x","_x2","_x3","_x4","queuedEvent","bridge","isNativeCaptureReady","_b","getPersistenceMode","payload","buildFatalExceptionPayload","distinctId","distinct_id","autocaptureUnhandledRejections","_this4","onUnhandledRejection","trackUnhandledRejections","autocaptureConsole","levels","_this5","onConsole","syntheticException","additionalProperties","_iterator2","_step2","trackConsole"],"sources":["../../src/error-tracking/index.ts"],"sourcesContent":["import type { PostHog } from '../posthog-rn'\nimport {\n JsonType,\n Logger,\n ErrorTracking as CoreErrorTracking,\n isPostHogFetchNetworkError,\n isNullish,\n isObject,\n isString,\n PostHogEventProperties,\n uuidv7,\n} from '@posthog/core'\nimport { Properties } from '@posthog/types'\nimport { trackConsole, trackUncaughtExceptions, trackUnhandledRejections } from './utils'\nimport { getRemoteConfigBool } from '../utils'\nimport { OptionalReactNativePlugin } from '../optional/OptionalPlugin'\nimport { buildFatalExceptionPayload } from './fatal-payload'\n\ntype LogLevel = 'debug' | 'log' | 'info' | 'warn' | 'error'\n\nconst LogLevelList: LogLevel[] = ['debug', 'log', 'info', 'warn', 'error']\n\n// user provided configuration\ninterface AutocaptureOptions {\n uncaughtExceptions?: boolean\n unhandledRejections?: boolean\n console?: boolean | LogLevel[]\n /**\n * Enables native iOS/Android/macOS crash autocapture through the optional native plugin.\n * On Android this covers Java/Kotlin crashes; native C/C++ (NDK) crashes are enabled with\n * `androidNdkCrashes`. On Apple platforms it covers signal crashes too.\n * Disabled by default. Requires `@posthog/react-native-plugin` installed (2.2.0 or newer for macOS).\n */\n nativeCrashes?: boolean\n /**\n * Enables autocapture of native C/C++ (NDK) crashes on Android, through the optional native\n * plugin. Requires Android 12 (API 31) or later and exception autocapture enabled in the\n * project's error tracking settings.\n *\n * An NDK crash kills the process immediately, so it is captured on the next app launch from\n * the records the OS kept, which means properties such as `$app_version` and the identity\n * describe that launch rather than the crash. The first launch after enabling this also\n * captures the native crashes the OS still holds from before.\n *\n * For readable stack traces, upload the app's `.so` debug symbols. With Expo, set `uploadNativeSymbols`\n * on the `posthog-react-native/expo` config plugin: https://posthog.com/docs/error-tracking/upload-source-maps/react-native#native-crash-symbolication\n *\n * Ignored on other platforms. Disabled by default. Requires `@posthog/react-native-plugin` 2.12.0 or newer.\n */\n androidNdkCrashes?: boolean\n}\n\n/**\n * Controls the breadcrumb-style exception steps recorded via `addExceptionStep` and attached\n * to captured exceptions as `$exception_steps`.\n */\nexport interface ExceptionStepsOptions {\n /**\n * Whether exception steps are recorded and attached.\n * @default true\n */\n enabled?: boolean\n /**\n * Total UTF-8 byte budget (~32KB) for the in-memory buffer. Oldest steps are evicted first when exceeded.\n * @default 32768\n */\n maxBytes?: number\n}\n\nexport interface ErrorTrackingOptions {\n autocapture?: AutocaptureOptions | boolean\n exceptionSteps?: ExceptionStepsOptions\n}\n\n// resolved configuration\ninterface ResolvedAutocaptureOptions {\n uncaughtExceptions: boolean\n unhandledRejections: boolean\n console: LogLevel[]\n}\n\ninterface ResolvedErrorTrackingOptions {\n autocapture: ResolvedAutocaptureOptions\n}\n\n// Hooks supplied by PostHogRN for coordinating the fatal capture with its event storage.\n// Storage readiness is explicit so unknown persisted consent fails closed rather than being\n// mistaken for the in-memory default.\ninterface FatalCaptureHooks {\n // `prepareNativeCapture` is offered the final, before_send-accepted message at the moment\n // it would be enqueued. Returning a thunk transfers ownership of the exception to the\n // native SDK and the JS queue copy is dropped; returning undefined leaves the event in the\n // JS queue as usual. The choice has to be made there, in one step, so a payload that fails\n // to build cannot leave the exception dropped from both queues.\n captureFatalException: (\n error: unknown,\n hint: CoreErrorTracking.EventHint,\n eventUuid: string,\n timestamp: Date,\n prepareNativeCapture: (queued: PostHogEventProperties) => (() => Promise<void>) | undefined\n ) => { queued: boolean; nativeCapture?: () => Promise<void> }\n waitForJSPersist: () => Promise<boolean>\n waitForStorageReady: () => Promise<boolean>\n getPersistenceMode: () => 'memory' | 'file' | undefined\n // Both native SDKs silently no-op a capture before setup() has run. Native init is async\n // and happens after the storage preload, so an early-startup crash can arrive first —\n // exactly the crashes this path exists for. Ownership only transfers once native is up.\n isNativeCaptureReady: () => boolean\n}\n\nexport class ErrorTracking {\n private logger: Logger\n private options: ResolvedErrorTrackingOptions\n private _exceptionStepsConfig: CoreErrorTracking.ResolvedExceptionStepsConfig\n private _exceptionStepsBuffer: CoreErrorTracking.ExceptionStepsBuffer\n private _nativeForwardingEnabled: boolean = false\n private _unsubscribeUncaughtExceptions?: () => void\n\n /**\n * Controls whether autocaptured exceptions are actually sent.\n * When remote config disables error tracking, this is set to false\n * so that installed handlers become no-ops.\n * Defaults to true (don't block locally enabled capture before remote config loads).\n */\n private _autocaptureEnabled: boolean = true\n\n constructor(\n private instance: PostHog,\n options: ErrorTrackingOptions = {},\n logger: Logger,\n private readonly fatalCaptureHooks?: FatalCaptureHooks\n ) {\n this.logger = logger.createLogger('[ErrorTracking]')\n this.options = this.resolveOptions(options)\n const exceptionSteps = options.exceptionSteps\n this._exceptionStepsConfig = CoreErrorTracking.resolveExceptionStepsConfig(\n exceptionSteps ? { enabled: exceptionSteps.enabled, max_bytes: exceptionSteps.maxBytes } : undefined\n )\n this._exceptionStepsBuffer = new CoreErrorTracking.ExceptionStepsBuffer(this._exceptionStepsConfig)\n this.autocapture(this.options.autocapture)\n }\n\n /**\n * Exception-steps config in the native plugin's shape, so the embedded native SDK keeps one\n * logical buffer with the same byte budget and enabled state.\n */\n getNativePluginExceptionStepsConfig(): ExceptionStepsOptions {\n return { enabled: this._exceptionStepsConfig.enabled, maxBytes: this._exceptionStepsConfig.max_bytes }\n }\n\n /**\n * Records a breadcrumb-style exception step in the instance buffer and mirrors it to the embedded\n * native SDK. The `$timestamp` is captured at call time. Invalid messages are ignored with a\n * warning and never throw. The step only reaches native when it was actually buffered.\n */\n addExceptionStep(message: string, properties?: Properties): void {\n if (!this._exceptionStepsConfig.enabled) {\n return\n }\n\n try {\n if (!isString(message) || message.trim().length === 0) {\n this.logger.warn('Ignoring exception step because message must be a non-empty string')\n return\n }\n\n const userProperties = isObject(properties) ? { ...properties } : {}\n const { sanitizedProperties, droppedKeys } = CoreErrorTracking.stripReservedExceptionStepFields(userProperties)\n\n if (droppedKeys.length > 0) {\n this.logger.warn('Ignoring reserved exception step fields', { droppedKeys })\n }\n\n this._exceptionStepsBuffer.add({\n [CoreErrorTracking.EXCEPTION_STEP_INTERNAL_FIELDS.MESSAGE]: message,\n [CoreErrorTracking.EXCEPTION_STEP_INTERNAL_FIELDS.TIMESTAMP]: new Date().toISOString(),\n ...sanitizedProperties,\n })\n this.forwardExceptionStepToNative(message, properties)\n } catch (error) {\n this.logger.error('Failed to add exception step. Ignoring breadcrumb.', error)\n }\n }\n\n /**\n * Native error tracking initializes asynchronously, so steps recorded before then are buffered\n * only in JS. The host calls this once native is ready to enable forwarding and replay the buffer,\n * so a native crash shortly after startup carries the steps recorded before native was ready.\n */\n onNativeErrorTrackingReady(): void {\n this._nativeForwardingEnabled = true\n for (const step of this.getAttachableExceptionSteps()) {\n this.forwardExceptionStepToNative(step.$message, step as Properties)\n }\n }\n\n private forwardExceptionStepToNative(message: string, properties?: Properties): void {\n if (!this._nativeForwardingEnabled || !OptionalReactNativePlugin?.addExceptionStep) {\n return\n }\n try {\n // Fire-and-forget: the native layer validates and buffers independently and must never block.\n void Promise.resolve(OptionalReactNativePlugin.addExceptionStep(message, properties)).catch((e) => {\n this.logger.warn(`Failed to forward exception step to native: ${e}`)\n })\n } catch (e) {\n this.logger.warn(`Failed to forward exception step to native: ${e}`)\n }\n }\n\n /**\n * Returns `properties` with a snapshot of the buffered steps attached as `$exception_steps`,\n * unless the feature is disabled, the caller already provided that key, or the buffer is empty.\n * The buffer is left intact so subsequent exceptions read the same steps.\n */\n attachExceptionSteps(properties: PostHogEventProperties): PostHogEventProperties {\n if (!this._exceptionStepsConfig.enabled || !isNullish(properties.$exception_steps)) {\n return properties\n }\n const steps = this.getAttachableExceptionSteps()\n if (steps.length === 0) {\n return properties\n }\n // Steps are already normalized to their JSON-safe wire form by the buffer.\n return { ...properties, $exception_steps: steps as unknown as JsonType }\n }\n\n /**\n * Snapshot of the buffered steps (oldest first), or an empty array when disabled or empty.\n */\n getAttachableExceptionSteps(): CoreErrorTracking.ExceptionStep[] {\n if (!this._exceptionStepsConfig.enabled) {\n return []\n }\n try {\n return this._exceptionStepsBuffer.getAttachable()\n } catch (error) {\n this.logger.error('Failed to read buffered exception steps.', error)\n return []\n }\n }\n\n /**\n * Clears the buffer. Called on SDK close, not on capture or identity changes.\n */\n clearExceptionSteps(): void {\n this._exceptionStepsBuffer.clear()\n }\n\n shutdown(): void {\n this._autocaptureEnabled = false\n this._unsubscribeUncaughtExceptions?.()\n this._unsubscribeUncaughtExceptions = undefined\n this.clearExceptionSteps()\n }\n\n /**\n * Called when remote config is loaded.\n * If errorTracking.autocaptureExceptions is explicitly false, autocapture is disabled.\n * If it's true or undefined (not yet loaded / not present), autocapture follows local config.\n */\n onRemoteConfig(errorTracking: boolean | { [key: string]: JsonType } | undefined): void {\n if (errorTracking == null) {\n // Remote config doesn't include errorTracking — don't change anything\n return\n }\n\n // Default to false: if remote config is present but the key is missing, disable autocapture\n this._autocaptureEnabled = getRemoteConfigBool(errorTracking, 'autocaptureExceptions', false)\n\n this.logger.info(\n `Error tracking autocapture ${this._autocaptureEnabled ? 'enabled' : 'disabled'} by remote config.`\n )\n }\n\n /**\n * Whether the app asked for fatal JavaScript exceptions to be autocaptured. This is the\n * locally configured value, deliberately not gated on the remote kill-switch: it decides\n * whether the native SDK is worth initializing, and that happens before remote config has\n * been fetched.\n */\n isUncaughtExceptionAutocaptureEnabled(): boolean {\n return this.options.autocapture.uncaughtExceptions\n }\n\n private resolveOptions(options: ErrorTrackingOptions): ResolvedErrorTrackingOptions {\n const autocaptureOptions = this.resolveAutocaptureOptions(options.autocapture)\n return {\n autocapture: autocaptureOptions,\n }\n }\n\n private resolveAutocaptureOptions(autocapture: AutocaptureOptions | boolean = false): ResolvedAutocaptureOptions {\n if (typeof autocapture === 'boolean') {\n return {\n uncaughtExceptions: autocapture,\n unhandledRejections: autocapture,\n console: [],\n }\n }\n return {\n uncaughtExceptions: !!autocapture.uncaughtExceptions,\n unhandledRejections: !!autocapture.unhandledRejections,\n console: this.resolveConsoleOptions(autocapture.console),\n }\n }\n\n private resolveConsoleOptions(console: boolean | LogLevel[] = false): LogLevel[] {\n if (typeof console === 'boolean') {\n return console ? ['error'] : []\n }\n return Array.isArray(console) ? console.filter((level) => LogLevelList.includes(level)) : []\n }\n\n private autocaptureUncaughtErrors() {\n const onUncaughtException = (error: unknown, isFatal: boolean): void | Promise<void> => {\n if (!this._autocaptureEnabled || isPostHogFetchNetworkError(error)) {\n return\n }\n const hint: CoreErrorTracking.EventHint = {\n mechanism: { type: 'onuncaughtexception', handled: false },\n }\n if (!isFatal) {\n this.instance.captureException(error, {}, hint)\n return\n }\n return this.handleFatalException(error, hint, uuidv7(), new Date())\n }\n try {\n this._unsubscribeUncaughtExceptions = trackUncaughtExceptions(onUncaughtException)\n } catch (err) {\n this.logger.warn('Failed to track uncaught exceptions: ', err)\n }\n }\n\n private async handleFatalException(\n error: unknown,\n hint: CoreErrorTracking.EventHint,\n eventUuid: string,\n timestamp: Date\n ): Promise<void> {\n let storageReady = !this.fatalCaptureHooks\n if (this.fatalCaptureHooks) {\n try {\n storageReady = (await this.fatalCaptureHooks.waitForStorageReady()) === true\n } catch (e) {\n this.logger.warn('Fatal capture skipped because events storage did not initialize.', e)\n }\n }\n // Unknown consent must fail closed. A crash is less important than persisting data\n // for a user whose opt-out state could not be loaded.\n if (!storageReady || !this._autocaptureEnabled || this.instance.isDisabled || this.instance.optedOut) {\n return\n }\n\n if (!this.fatalCaptureHooks) {\n this.instance.captureException(error, { $exception_level: 'fatal' as CoreErrorTracking.SeverityLevel }, hint)\n return\n }\n\n // Hand the final payload to the native SDK. Both native SDKs recognise a `$exception`\n // with `$exception_level: 'fatal'` and write it to their own disk queue synchronously\n // before returning, which is the durability the JS queue cannot promise while\n // AsyncStorage is still draining. Native owns delivery from there, including retry\n // across the relaunch, so there is nothing for the next launch to recover — and the JS\n // queue copy is dropped so the exception is not sent twice.\n let result: { queued: boolean; nativeCapture?: () => Promise<void> }\n try {\n result = this.fatalCaptureHooks.captureFatalException(error, hint, eventUuid, timestamp, (queued) =>\n this.prepareFatalNativeCapture(queued)\n )\n } catch (e) {\n // Without the final queued event we cannot know whether before_send accepted or\n // redacted the exception, so sending a raw fallback would bypass filtering.\n this.logger.error('Fatal exception capture failed before enqueue.', e)\n return\n }\n const { queued, nativeCapture } = result\n if (!queued && !nativeCapture) {\n // before_send dropped it.\n return\n }\n\n void this.instance.flush().catch(() => {\n this.logger.critical('Failed to flush events')\n })\n // Other events may still be queued behind this one, so the JS store is still worth\n // draining even when native owns the exception itself.\n const persisted = this.fatalCaptureHooks.waitForJSPersist()\n let nativeWrite: Promise<void> | undefined\n if (nativeCapture) {\n try {\n nativeWrite = nativeCapture().catch((e) => {\n this.logger.warn(`Fatal exception native capture failed: ${e}`)\n })\n } catch (e) {\n this.logger.warn(`Fatal exception native capture failed: ${e}`)\n }\n }\n const [persistedOk] = await Promise.all([persisted, nativeWrite])\n if (!persistedOk && !nativeCapture) {\n this.logger.warn('Fatal exception JS persist failed and no native capture path was available.')\n }\n }\n\n private prepareFatalNativeCapture(queuedEvent: PostHogEventProperties): (() => Promise<void>) | undefined {\n const bridge = OptionalReactNativePlugin?.captureFatalException\n if (!bridge) {\n return undefined\n }\n // Handing the event to a native SDK that is not set up yet would drop it: native\n // no-ops the capture, and the JS queue copy has already been given up.\n if (!this.fatalCaptureHooks?.isNativeCaptureReady()) {\n return undefined\n }\n // Memory-persistence apps asked for nothing on disk. The native queue is disk-backed,\n // so honour that here rather than routing around it.\n if (this.fatalCaptureHooks?.getPersistenceMode() === 'memory') {\n return undefined\n }\n if (this.instance.isDisabled || this.instance.optedOut) {\n return undefined\n }\n\n const properties = isObject(queuedEvent.properties) ? (queuedEvent.properties as PostHogEventProperties) : {}\n const payload = buildFatalExceptionPayload({\n timestamp: isString(queuedEvent.timestamp) ? queuedEvent.timestamp : new Date().toISOString(),\n distinctId: isString(queuedEvent.distinct_id) ? queuedEvent.distinct_id : '',\n // The event was normalized and emitted only after before_send accepted it.\n properties,\n })\n return () => bridge(payload.distinctId, payload.timestamp, payload.properties)\n }\n\n private autocaptureUnhandledRejections() {\n const onUnhandledRejection = (error: unknown) => {\n // Gate on remote config — if remotely disabled, don't capture\n if (!this._autocaptureEnabled) {\n return\n }\n\n // Offline/timeout failures are expected, not application errors.\n if (isPostHogFetchNetworkError(error)) {\n return\n }\n\n const hint: CoreErrorTracking.EventHint = {\n mechanism: {\n type: 'onunhandledrejection',\n handled: false,\n },\n }\n this.instance.captureException(error, {}, hint)\n }\n\n try {\n trackUnhandledRejections(onUnhandledRejection)\n } catch (err) {\n this.logger.warn('Failed to track unhandled rejections: ', err)\n }\n }\n\n private autocaptureConsole(levels: LogLevel[]) {\n const onConsole = (level: LogLevel) => (error: unknown, isFatal: boolean, syntheticException?: Error) => {\n // Gate on remote config — if remotely disabled, don't capture\n if (!this._autocaptureEnabled) {\n return\n }\n\n const hint: CoreErrorTracking.EventHint = {\n mechanism: {\n type: 'onconsole',\n handled: true,\n },\n syntheticException,\n }\n const additionalProperties = {\n $exception_level: level as CoreErrorTracking.SeverityLevel,\n }\n this.instance.captureException(error, additionalProperties, hint)\n }\n\n try {\n for (const level of levels) {\n trackConsole(level, onConsole(level))\n }\n } catch (err) {\n this.logger.warn('Failed to track console errors: ', err)\n }\n }\n\n private autocapture(autocaptureOptions: ResolvedAutocaptureOptions) {\n if (autocaptureOptions.uncaughtExceptions === true) {\n this.autocaptureUncaughtErrors()\n }\n if (autocaptureOptions.unhandledRejections === true) {\n this.autocaptureUnhandledRejections()\n }\n if (autocaptureOptions.console.length > 0) {\n this.autocapt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8L,MAAA,CAAAD,UAAA,CAAA5L,CAAA,IAAAC,IAAA,EAA4B,IAAjB,CAAA+G,KAAK,CAAA6E,MAAA,CAAA3L,KAAA,CACd,GAAA4L,mBAAY,EAAC9E,KAAK,CAAEyE,SAAS,CAACzE,KAAK,CAAC,CAAC,CACvC,CAAC,OAAA3B,GAAA,EAAAuG,UAAA,CAAAvM,CAAA,CAAAgG,GAAA,WAAAuG,UAAA,CAAAzL,CAAA,IACH,CAAE,MAAOkF,GAAG,CAAE,CACZ,IAAI,CAAC9C,MAAM,CAACyB,IAAI,CAAC,kCAAkC,CAAEqB,GAAG,CAAC,CAC3D,CACF,CAAC,GAAA5B,GAAA,eAAAvD,KAAA,CAEO,SAAAqD,WAAWA,CAACoD,kBAA8C,EAChE,GAAIA,kBAAkB,CAACD,kBAAkB,GAAK,IAAI,CAAE,CAClD,IAAI,CAACQ,yBAAyB,EAAE,CAClC,CACA,GAAIP,kBAAkB,CAACE,mBAAmB,GAAK,IAAI,CAAE,CACnD,IAAI,CAACqE,8BAA8B,EAAE,CACvC,CACA,GAAIvE,kBAAkB,CAACG,OAAO,CAAClH,MAAM,CAAG,CAAC,CAAE,CACzC,IAAI,CAAC0L,kBAAkB,CAAC3E,kBAAkB,CAACG,OAAO,CAAC,CACrD,CACF,CAAC","ignoreList":[]}
@@ -198,6 +198,7 @@ export declare class PostHog extends PostHogCore {
198
198
  private _enableSessionReplay?;
199
199
  private _sessionReplayNativeInitialized;
200
200
  private _nativeErrorTrackingInitialized;
201
+ private _androidNdkCrashesUnsupportedWarned;
201
202
  private _pushNativeInitialized;
202
203
  private _fatalJsCaptureNativeInitialized;
203
204
  private _pushNativeUnsupported;
@@ -1253,6 +1254,8 @@ export declare class PostHog extends PostHogCore {
1253
1254
  */
1254
1255
  private _enqueueNative;
1255
1256
  private _ensureNativeInitialized;
1257
+ private _pluginVersionAtLeast;
1258
+ private _nativeErrorAutocapture;
1256
1259
  private _isAutocaptureNativeErrors;
1257
1260
  /**
1258
1261
  * Fatal JavaScript exceptions are handed to the native SDK, which persists them to its own