posthog-react-native 4.87.0 → 4.87.1
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.
- package/dist/PostHogErrorBoundary.d.ts +6 -0
- package/dist/PostHogErrorBoundary.js.map +1 -1
- package/dist/error-tracking/index.d.ts +2 -1
- package/dist/error-tracking/index.js.map +1 -1
- package/dist/posthog-rn.d.ts +4 -0
- package/dist/posthog-rn.js +1 -1
- package/dist/posthog-rn.js.map +1 -1
- package/dist/surveys/PostHogSurveyProvider.d.ts +6 -0
- package/dist/surveys/PostHogSurveyProvider.js.map +1 -1
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/dist/version.js.map +1 -1
- package/package.json +4 -4
|
@@ -16,6 +16,12 @@ type PostHogErrorBoundaryState = {
|
|
|
16
16
|
componentStack: string | null;
|
|
17
17
|
error: unknown;
|
|
18
18
|
};
|
|
19
|
+
/**
|
|
20
|
+
* Captures errors thrown while rendering its children and shows `fallback` in their place.
|
|
21
|
+
*
|
|
22
|
+
* React also logs render errors to the console, so with console capture enabled each render error is captured twice.
|
|
23
|
+
* Set `errorTracking: { autocapture: { console: [] } }` to avoid this.
|
|
24
|
+
*/
|
|
19
25
|
export declare class PostHogErrorBoundary extends React.Component<PostHogErrorBoundaryProps, PostHogErrorBoundaryState> {
|
|
20
26
|
static contextType: React.Context<{
|
|
21
27
|
client: import("./posthog-rn").PostHog;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PostHogErrorBoundary.js","names":["_react","_interopRequireDefault","require","_PostHogContext","_jsxRuntime","ownKeys","e","r","t","Object","keys","getOwnPropertySymbols","o","filter","getOwnPropertyDescriptor","enumerable","push","apply","_objectSpread","arguments","length","forEach","_defineProperty2","getOwnPropertyDescriptors","defineProperties","defineProperty","_callSuper","_getPrototypeOf2","_possibleConstructorReturn2","_isNativeReflectConstruct","Reflect","construct","constructor","Boolean","prototype","valueOf","call","INITIAL_STATE","hasError","componentStack","error","isFunction","f","PostHogErrorBoundary","exports","_React$Component","props","_this","_classCallCheck2","resetError","setState","state","_inherits2","_createClass2","key","value","componentDidCatch","errorInfo","additionalProperties","currentProperties","_a","context","client","captureException","$exception_component_stack","render","_this$props","children","fallback","element","React","createElement","isValidElement","jsx","Fragment","getDerivedStateFromError","Component","contextType","PostHogContext"],"sources":["../src/PostHogErrorBoundary.tsx"],"sourcesContent":["import React, { FunctionComponent } from 'react'\nimport { PostHogContext } from './PostHogContext'\n\nexport type Properties = Record<string, any>\n\nexport type PostHogErrorBoundaryFallbackProps = {\n error: unknown\n componentStack: string\n resetError: () => void\n}\n\nexport type PostHogErrorBoundaryProps = {\n children?: React.ReactNode | (() => React.ReactNode)\n fallback?: React.ReactNode | FunctionComponent<PostHogErrorBoundaryFallbackProps>\n additionalProperties?: Properties | ((error: unknown) => Properties)\n}\n\ntype PostHogErrorBoundaryState = {\n hasError: boolean\n componentStack: string | null\n error: unknown\n}\n\nconst INITIAL_STATE: PostHogErrorBoundaryState = {\n hasError: false,\n componentStack: null,\n error: null,\n}\n\nconst isFunction = (f: any): f is (...args: any[]) => any => typeof f === 'function'\n\nexport class PostHogErrorBoundary extends React.Component<PostHogErrorBoundaryProps, PostHogErrorBoundaryState> {\n static contextType = PostHogContext\n context!: React.ContextType<typeof PostHogContext>\n\n constructor(props: PostHogErrorBoundaryProps) {\n super(props)\n this.state = INITIAL_STATE\n }\n\n static getDerivedStateFromError(error: unknown): Partial<PostHogErrorBoundaryState> {\n return { hasError: true, error }\n }\n\n componentDidCatch(error: unknown, errorInfo: React.ErrorInfo): void {\n const { componentStack } = errorInfo\n this.setState({ componentStack: componentStack ?? null })\n\n try {\n const { additionalProperties } = this.props\n const currentProperties = isFunction(additionalProperties) ? additionalProperties(error) : additionalProperties\n this.context.client?.captureException(error, {\n ...currentProperties,\n ...(componentStack ? { $exception_component_stack: componentStack } : {}),\n })\n } catch {\n // Reporting failures must not escape the boundary and crash its parent.\n }\n }\n\n private resetError = (): void => {\n this.setState(INITIAL_STATE)\n }\n\n public render(): React.ReactNode {\n const { children, fallback } = this.props\n const state = this.state\n\n if (!state.hasError) {\n return isFunction(children) ? children() : children\n }\n\n const element = isFunction(fallback)\n ? (React.createElement(fallback, {\n error: state.error,\n componentStack: state.componentStack ?? '',\n resetError: this.resetError,\n }) as React.ReactNode)\n : fallback\n\n if (React.isValidElement(element)) {\n return element as React.ReactElement\n }\n\n return <></>\n }\n}\n"],"mappings":"qvBAAA,IAAAA,MAAA,CAAAC,sBAAA,CAAAC,OAAA,WACA,IAAAC,eAAA,CAAAD,OAAA,qBAAiD,IAAAE,WAAA,CAAAF,OAAA,+BAAAG,QAAAC,CAAA,CAAAC,CAAA,MAAAC,CAAA,CAAAC,MAAA,CAAAC,IAAA,CAAAJ,CAAA,KAAAG,MAAA,CAAAE,qBAAA,MAAAC,CAAA,CAAAH,MAAA,CAAAE,qBAAA,CAAAL,CAAA,CAAAC,CAAA,IAAAK,CAAA,CAAAA,CAAA,CAAAC,MAAA,UAAAN,CAAA,SAAAE,MAAA,CAAAK,wBAAA,CAAAR,CAAA,CAAAC,CAAA,EAAAQ,UAAA,KAAAP,CAAA,CAAAQ,IAAA,CAAAC,KAAA,CAAAT,CAAA,CAAAI,CAAA,UAAAJ,CAAA,WAAAU,cAAAZ,CAAA,UAAAC,CAAA,GAAAA,CAAA,CAAAY,SAAA,CAAAC,MAAA,CAAAb,CAAA,QAAAC,CAAA,OAAAW,SAAA,CAAAZ,CAAA,EAAAY,SAAA,CAAAZ,CAAA,IAAAA,CAAA,IAAAF,OAAA,CAAAI,MAAA,CAAAD,CAAA,MAAAa,OAAA,UAAAd,CAAA,KAAAe,gBAAA,aAAAhB,CAAA,CAAAC,CAAA,CAAAC,CAAA,CAAAD,CAAA,MAAAE,MAAA,CAAAc,yBAAA,CAAAd,MAAA,CAAAe,gBAAA,CAAAlB,CAAA,CAAAG,MAAA,CAAAc,yBAAA,CAAAf,CAAA,GAAAH,OAAA,CAAAI,MAAA,CAAAD,CAAA,GAAAa,OAAA,UAAAd,CAAA,EAAAE,MAAA,CAAAgB,cAAA,CAAAnB,CAAA,CAAAC,CAAA,CAAAE,MAAA,CAAAK,wBAAA,CAAAN,CAAA,CAAAD,CAAA,cAAAD,CAAA,WAAAoB,WAAAlB,CAAA,CAAAI,CAAA,CAAAN,CAAA,SAAAM,CAAA,IAAAe,gBAAA,aAAAf,CAAA,KAAAgB,2BAAA,aAAApB,CAAA,CAAAqB,yBAAA,GAAAC,OAAA,CAAAC,SAAA,CAAAnB,CAAA,CAAAN,CAAA,QAAAqB,gBAAA,aAAAnB,CAAA,EAAAwB,WAAA,EAAApB,CAAA,CAAAK,KAAA,CAAAT,CAAA,CAAAF,CAAA,aAAAuB,0BAAA,UAAArB,CAAA,EAAAyB,OAAA,CAAAC,SAAA,CAAAC,OAAA,CAAAC,IAAA,CAAAN,OAAA,CAAAC,SAAA,CAAAE,OAAA,0BAAAzB,CAAA,UAAAqB,yBAAA,UAAAA,0BAAA,UAAArB,CAAA,OAsBjD,GAAM,CAAA6B,aAAa,CAA8B,CAC/CC,QAAQ,CAAE,KAAK,CACfC,cAAc,CAAE,IAAI,CACpBC,KAAK,CAAE,I,CACR,CAED,GAAM,CAAAC,UAAU,CAAG,QAAb,CAAAA,UAAUA,CAAIC,CAAM,QAAmC,OAAO,CAAAA,CAAC,GAAK,UAAU,
|
|
1
|
+
{"version":3,"file":"PostHogErrorBoundary.js","names":["_react","_interopRequireDefault","require","_PostHogContext","_jsxRuntime","ownKeys","e","r","t","Object","keys","getOwnPropertySymbols","o","filter","getOwnPropertyDescriptor","enumerable","push","apply","_objectSpread","arguments","length","forEach","_defineProperty2","getOwnPropertyDescriptors","defineProperties","defineProperty","_callSuper","_getPrototypeOf2","_possibleConstructorReturn2","_isNativeReflectConstruct","Reflect","construct","constructor","Boolean","prototype","valueOf","call","INITIAL_STATE","hasError","componentStack","error","isFunction","f","PostHogErrorBoundary","exports","_React$Component","props","_this","_classCallCheck2","resetError","setState","state","_inherits2","_createClass2","key","value","componentDidCatch","errorInfo","additionalProperties","currentProperties","_a","context","client","captureException","$exception_component_stack","render","_this$props","children","fallback","element","React","createElement","isValidElement","jsx","Fragment","getDerivedStateFromError","Component","contextType","PostHogContext"],"sources":["../src/PostHogErrorBoundary.tsx"],"sourcesContent":["import React, { FunctionComponent } from 'react'\nimport { PostHogContext } from './PostHogContext'\n\nexport type Properties = Record<string, any>\n\nexport type PostHogErrorBoundaryFallbackProps = {\n error: unknown\n componentStack: string\n resetError: () => void\n}\n\nexport type PostHogErrorBoundaryProps = {\n children?: React.ReactNode | (() => React.ReactNode)\n fallback?: React.ReactNode | FunctionComponent<PostHogErrorBoundaryFallbackProps>\n additionalProperties?: Properties | ((error: unknown) => Properties)\n}\n\ntype PostHogErrorBoundaryState = {\n hasError: boolean\n componentStack: string | null\n error: unknown\n}\n\nconst INITIAL_STATE: PostHogErrorBoundaryState = {\n hasError: false,\n componentStack: null,\n error: null,\n}\n\nconst isFunction = (f: any): f is (...args: any[]) => any => typeof f === 'function'\n\n/**\n * Captures errors thrown while rendering its children and shows `fallback` in their place.\n *\n * React also logs render errors to the console, so with console capture enabled each render error is captured twice.\n * Set `errorTracking: { autocapture: { console: [] } }` to avoid this.\n */\nexport class PostHogErrorBoundary extends React.Component<PostHogErrorBoundaryProps, PostHogErrorBoundaryState> {\n static contextType = PostHogContext\n context!: React.ContextType<typeof PostHogContext>\n\n constructor(props: PostHogErrorBoundaryProps) {\n super(props)\n this.state = INITIAL_STATE\n }\n\n static getDerivedStateFromError(error: unknown): Partial<PostHogErrorBoundaryState> {\n return { hasError: true, error }\n }\n\n componentDidCatch(error: unknown, errorInfo: React.ErrorInfo): void {\n const { componentStack } = errorInfo\n this.setState({ componentStack: componentStack ?? null })\n\n try {\n const { additionalProperties } = this.props\n const currentProperties = isFunction(additionalProperties) ? additionalProperties(error) : additionalProperties\n this.context.client?.captureException(error, {\n ...currentProperties,\n ...(componentStack ? { $exception_component_stack: componentStack } : {}),\n })\n } catch {\n // Reporting failures must not escape the boundary and crash its parent.\n }\n }\n\n private resetError = (): void => {\n this.setState(INITIAL_STATE)\n }\n\n public render(): React.ReactNode {\n const { children, fallback } = this.props\n const state = this.state\n\n if (!state.hasError) {\n return isFunction(children) ? children() : children\n }\n\n const element = isFunction(fallback)\n ? (React.createElement(fallback, {\n error: state.error,\n componentStack: state.componentStack ?? '',\n resetError: this.resetError,\n }) as React.ReactNode)\n : fallback\n\n if (React.isValidElement(element)) {\n return element as React.ReactElement\n }\n\n return <></>\n }\n}\n"],"mappings":"qvBAAA,IAAAA,MAAA,CAAAC,sBAAA,CAAAC,OAAA,WACA,IAAAC,eAAA,CAAAD,OAAA,qBAAiD,IAAAE,WAAA,CAAAF,OAAA,+BAAAG,QAAAC,CAAA,CAAAC,CAAA,MAAAC,CAAA,CAAAC,MAAA,CAAAC,IAAA,CAAAJ,CAAA,KAAAG,MAAA,CAAAE,qBAAA,MAAAC,CAAA,CAAAH,MAAA,CAAAE,qBAAA,CAAAL,CAAA,CAAAC,CAAA,IAAAK,CAAA,CAAAA,CAAA,CAAAC,MAAA,UAAAN,CAAA,SAAAE,MAAA,CAAAK,wBAAA,CAAAR,CAAA,CAAAC,CAAA,EAAAQ,UAAA,KAAAP,CAAA,CAAAQ,IAAA,CAAAC,KAAA,CAAAT,CAAA,CAAAI,CAAA,UAAAJ,CAAA,WAAAU,cAAAZ,CAAA,UAAAC,CAAA,GAAAA,CAAA,CAAAY,SAAA,CAAAC,MAAA,CAAAb,CAAA,QAAAC,CAAA,OAAAW,SAAA,CAAAZ,CAAA,EAAAY,SAAA,CAAAZ,CAAA,IAAAA,CAAA,IAAAF,OAAA,CAAAI,MAAA,CAAAD,CAAA,MAAAa,OAAA,UAAAd,CAAA,KAAAe,gBAAA,aAAAhB,CAAA,CAAAC,CAAA,CAAAC,CAAA,CAAAD,CAAA,MAAAE,MAAA,CAAAc,yBAAA,CAAAd,MAAA,CAAAe,gBAAA,CAAAlB,CAAA,CAAAG,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AC2B,QAAQ,CAAC,CAC/BE,iBAAK,CAACC,aAAa,CAACH,QAAQ,CAAE,CAC7B5B,KAAK,CAAEW,KAAK,CAACX,KAAK,CAClBD,cAAc,EAAAqB,EAAA,CAAET,KAAK,CAACZ,cAAc,UAAAqB,EAAA,UAAAA,EAAA,CAAI,EAAE,CAC1CX,UAAU,CAAE,IAAI,CAACA,U,CAClB,CAAqB,CACtBmB,QAAQ,CAEZ,GAAIE,iBAAK,CAACE,cAAc,CAACH,OAAO,CAAC,CAAE,CACjC,MAAO,CAAAA,OAA6B,CACtC,CAEA,MAAO,GAAAjE,WAAA,CAAAqE,GAAA,EAAArE,WAAA,CAAAsE,QAAA,GAAE,CAAG,CACd,CAAC,KAAApB,GAAA,4BAAAC,KAAA,CA7CD,QAAO,CAAAoB,wBAAwBA,CAACnC,KAAc,EAC5C,MAAO,CAAEF,QAAQ,CAAE,IAAI,CAAEE,KAAK,CAALA,KAAK,CAAE,CAClC,CAAC,MAXuC8B,iBAAK,CAACM,SAA+D,EACtGjC,oBAAA,CAAAkC,WAAW,CAAGC,8BAAc","ignoreList":[]}
|
|
@@ -26,7 +26,8 @@ interface AutocaptureOptions {
|
|
|
26
26
|
* For readable stack traces, upload the app's `.so` debug symbols. With Expo, set `uploadNativeSymbols`
|
|
27
27
|
* on the `posthog-react-native/expo` config plugin: https://posthog.com/docs/error-tracking/upload-source-maps/react-native#native-crash-symbolication
|
|
28
28
|
*
|
|
29
|
-
* Ignored on other platforms. Disabled by default. Requires `@posthog/react-native-plugin` 2.12.0 or newer
|
|
29
|
+
* Ignored on other platforms. Disabled by default. Requires `@posthog/react-native-plugin` 2.12.0 or newer
|
|
30
|
+
* and `posthog-react-native` 4.78.0 or newer.
|
|
30
31
|
*/
|
|
31
32
|
androidNdkCrashes?: boolean;
|
|
32
33
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["_core","require","_surveys","_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","FATAL_MESSAGE_KEY_LENGTH","fatalMessageKey","error","message","Error","namePrefix","concat","startsWith","undefined","String","join","parseSuppressionRules","errorTracking","rules","isObject","suppressionRules","rule","values","ErrorTracking","exports","instance","options","logger","fatalCaptureHooks","_classCallCheck2","_nativeForwardingEnabled","_autocaptureEnabled","_suppressionRules","createLogger","resolveOptions","exceptionSteps","_exceptionStepsConfig","CoreErrorTracking","resolveExceptionStepsConfig","enabled","max_bytes","maxBytes","_exceptionStepsBuffer","ExceptionStepsBuffer","autocapture","_createClass2","key","getNativePluginExceptionStepsConfig","addExceptionStep","properties","isString","trim","warn","userProperties","_CoreErrorTracking$st","stripReservedExceptionStepFields","sanitizedProperties","droppedKeys","add","EXCEPTION_STEP_INTERNAL_FIELDS","MESSAGE","TIMESTAMP","Date","toISOString","forwardExceptionStepToNative","onNativeErrorTrackingReady","_iterator","getAttachableExceptionSteps","_step","step","$message","err","_this","OptionalReactNativePlugin","Promise","resolve","attachExceptionSteps","isNullish","$exception_steps","steps","getAttachable","clearExceptionSteps","clear","shouldSuppressException","exceptionList","exceptionValues","$exception_types","$exception_values","_iterator2","_step2","exception","type","matched","some","results","map","v","compare","propertyComparisons","operator","targets","Boolean","every","shutdown","_a","_unsubscribeUncaughtExceptions","onRemoteConfig","getRemoteConfigBool","info","isUncaughtExceptionAutocaptureEnabled","uncaughtExceptions","autocaptureOptions","resolveAutocaptureOptions","unhandledRejections","console","resolveConsoleOptions","level","includes","autocaptureUncaughtErrors","_this2","onUncaughtException","isFatal","marked","markFatalExceptionHandled","isPostHogFetchNetworkError","hint","mechanism","handled","captureException","all","handleFatalException","uuidv7","then","trackUncaughtExceptions","_this3","bridge","_handleFatalException","_asyncToGenerator2","_regenerator","mark","_callee","eventUuid","timestamp","_this4","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","_slicedToArray2","stop","_x","_x2","_x3","_x4","queuedEvent","isNativeCaptureReady","_b","getPersistenceMode","payload","buildFatalExceptionPayload","distinctId","distinct_id","autocaptureUnhandledRejections","_this5","onUnhandledRejection","trackUnhandledRejections","autocaptureConsole","levels","_this6","onConsole","syntheticException","additionalProperties","_iterator3","_step3","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 isArray,\n isNullish,\n isObject,\n isString,\n PostHogEventProperties,\n PropertyMatchType,\n uuidv7,\n} from '@posthog/core'\nimport { propertyComparisons } from '@posthog/core/surveys'\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// Native crash reports truncate the JS message (iOS keeps 175 characters, including its own\n// prefix), so the start of the message is what both sides reliably share.\nconst FATAL_MESSAGE_KEY_LENGTH = 80\n\n// The start of the message React Native's ExceptionsManager sends native for this error:\n// `<name>: <message>`, where a thrown non-Error has no name and is converted to a string.\nfunction fatalMessageKey(error: unknown): string {\n let message: string\n if (error instanceof Error) {\n const namePrefix = error.name ? `${error.name}: ` : ''\n message = error.message || ''\n if (!message.startsWith(namePrefix)) {\n message = namePrefix + message\n }\n } else {\n message = error === undefined ? '' : String(error)\n }\n return Array.from(message).slice(0, FATAL_MESSAGE_KEY_LENGTH).join('')\n}\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// Same shape as the browser SDK's ErrorTrackingSuppressionRule, delivered in remote config as\n// `errorTracking.suppressionRules`.\ninterface ErrorTrackingSuppressionRule {\n type: 'AND' | 'OR'\n values: {\n key: '$exception_types' | '$exception_values'\n operator: PropertyMatchType\n value: string | string[]\n }[]\n}\n\nfunction parseSuppressionRules(errorTracking: boolean | { [key: string]: JsonType }): ErrorTrackingSuppressionRule[] {\n const rules = isObject(errorTracking) ? errorTracking.suppressionRules : undefined\n if (!isArray(rules)) {\n return []\n }\n return rules.filter((rule) => isObject(rule) && isArray(rule.values)) as unknown as ErrorTrackingSuppressionRule[]\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 // Kept in memory only: the remote config they come from is already persisted and replayed\n // through onRemoteConfig at startup.\n private _suppressionRules: ErrorTrackingSuppressionRule[] = []\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 /**\n * Whether an exception matches one of the suppression rules from remote config, in which case\n * it should be dropped instead of captured. Mirrors the browser SDK. Records an exception step\n * when it matches, so the next captured exception shows that one was dropped.\n */\n shouldSuppressException(exceptionList: unknown): boolean {\n if (!isArray(exceptionList) || exceptionList.length === 0 || this._suppressionRules.length === 0) {\n return false\n }\n\n try {\n const exceptionValues: Record<string, string[]> = { $exception_types: [], $exception_values: [] }\n for (const exception of exceptionList) {\n if (!isObject(exception)) {\n continue\n }\n if (isString(exception.type) && exception.type.length > 0) {\n exceptionValues.$exception_types.push(exception.type)\n }\n if (isString(exception.value) && exception.value.length > 0) {\n exceptionValues.$exception_values.push(exception.value)\n }\n }\n\n const matched = this._suppressionRules.some((rule) => {\n const results = rule.values.map((v) => {\n const compare = propertyComparisons[v.operator]\n const values = exceptionValues[v.key]\n if (!compare || !values) {\n return false\n }\n const targets = isArray(v.value) ? v.value : [v.value]\n return targets.length > 0 ? compare(targets, values) : false\n })\n return rule.type === 'OR' ? results.some(Boolean) : results.every(Boolean)\n })\n\n if (matched) {\n this.addExceptionStep('Exception dropped: matched a suppression rule')\n }\n return matched\n } catch (error) {\n // Suppression only ever filters what we capture, so failing to evaluate it must not cost\n // us the exception.\n this.logger.warn('Failed to evaluate suppression rules. Capturing the exception.', error)\n return false\n }\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 * errorTracking.suppressionRules replaces the current rules; a response without them clears them.\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 this._suppressionRules = parseSuppressionRules(errorTracking)\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 const marked = isFatal ? this.markFatalExceptionHandled(error) : undefined\n if (!this._autocaptureEnabled || isPostHogFetchNetworkError(error)) {\n return marked\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 Promise.all([marked, this.handleFatalException(error, hint, uuidv7(), new Date())]).then(() => {})\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 // React Native turns this fatal into a native crash once the handler chain finishes. The\n // native plugin drops that crash report only when it contains the message marked here, so\n // fatals that bypass this handler (React render errors) still reach error tracking.\n private markFatalExceptionHandled(error: unknown): Promise<void> | undefined {\n const bridge = OptionalReactNativePlugin?.markFatalExceptionHandled\n if (!bridge) {\n return undefined\n }\n try {\n return Promise.resolve(bridge(fatalMessageKey(error))).catch((e) => {\n this.logger.warn(`Failed to mark fatal exception as handled: ${e}`)\n })\n } catch (e) {\n this.logger.warn(`Failed to mark fatal exception as handled: ${e}`)\n return undefined\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,kBAaA,IAAAC,QAAA,CAAAD,OAAA,0BAEA,IAAAE,MAAA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,CAAC,CACrD,CACF,CAAC","ignoreList":[]}
|
|
1
|
+
{"version":3,"file":"index.js","names":["_core","require","_surveys","_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","FATAL_MESSAGE_KEY_LENGTH","fatalMessageKey","error","message","Error","namePrefix","concat","startsWith","undefined","String","join","parseSuppressionRules","errorTracking","rules","isObject","suppressionRules","rule","values","ErrorTracking","exports","instance","options","logger","fatalCaptureHooks","_classCallCheck2","_nativeForwardingEnabled","_autocaptureEnabled","_suppressionRules","createLogger","resolveOptions","exceptionSteps","_exceptionStepsConfig","CoreErrorTracking","resolveExceptionStepsConfig","enabled","max_bytes","maxBytes","_exceptionStepsBuffer","ExceptionStepsBuffer","autocapture","_createClass2","key","getNativePluginExceptionStepsConfig","addExceptionStep","properties","isString","trim","warn","userProperties","_CoreErrorTracking$st","stripReservedExceptionStepFields","sanitizedProperties","droppedKeys","add","EXCEPTION_STEP_INTERNAL_FIELDS","MESSAGE","TIMESTAMP","Date","toISOString","forwardExceptionStepToNative","onNativeErrorTrackingReady","_iterator","getAttachableExceptionSteps","_step","step","$message","err","_this","OptionalReactNativePlugin","Promise","resolve","attachExceptionSteps","isNullish","$exception_steps","steps","getAttachable","clearExceptionSteps","clear","shouldSuppressException","exceptionList","exceptionValues","$exception_types","$exception_values","_iterator2","_step2","exception","type","matched","some","results","map","v","compare","propertyComparisons","operator","targets","Boolean","every","shutdown","_a","_unsubscribeUncaughtExceptions","onRemoteConfig","getRemoteConfigBool","info","isUncaughtExceptionAutocaptureEnabled","uncaughtExceptions","autocaptureOptions","resolveAutocaptureOptions","unhandledRejections","console","resolveConsoleOptions","level","includes","autocaptureUncaughtErrors","_this2","onUncaughtException","isFatal","marked","markFatalExceptionHandled","isPostHogFetchNetworkError","hint","mechanism","handled","captureException","all","handleFatalException","uuidv7","then","trackUncaughtExceptions","_this3","bridge","_handleFatalException","_asyncToGenerator2","_regenerator","mark","_callee","eventUuid","timestamp","_this4","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","_slicedToArray2","stop","_x","_x2","_x3","_x4","queuedEvent","isNativeCaptureReady","_b","getPersistenceMode","payload","buildFatalExceptionPayload","distinctId","distinct_id","autocaptureUnhandledRejections","_this5","onUnhandledRejection","trackUnhandledRejections","autocaptureConsole","levels","_this6","onConsole","syntheticException","additionalProperties","_iterator3","_step3","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 isArray,\n isNullish,\n isObject,\n isString,\n PostHogEventProperties,\n PropertyMatchType,\n uuidv7,\n} from '@posthog/core'\nimport { propertyComparisons } from '@posthog/core/surveys'\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// Native crash reports truncate the JS message (iOS keeps 175 characters, including its own\n// prefix), so the start of the message is what both sides reliably share.\nconst FATAL_MESSAGE_KEY_LENGTH = 80\n\n// The start of the message React Native's ExceptionsManager sends native for this error:\n// `<name>: <message>`, where a thrown non-Error has no name and is converted to a string.\nfunction fatalMessageKey(error: unknown): string {\n let message: string\n if (error instanceof Error) {\n const namePrefix = error.name ? `${error.name}: ` : ''\n message = error.message || ''\n if (!message.startsWith(namePrefix)) {\n message = namePrefix + message\n }\n } else {\n message = error === undefined ? '' : String(error)\n }\n return Array.from(message).slice(0, FATAL_MESSAGE_KEY_LENGTH).join('')\n}\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 * and `posthog-react-native` 4.78.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// Same shape as the browser SDK's ErrorTrackingSuppressionRule, delivered in remote config as\n// `errorTracking.suppressionRules`.\ninterface ErrorTrackingSuppressionRule {\n type: 'AND' | 'OR'\n values: {\n key: '$exception_types' | '$exception_values'\n operator: PropertyMatchType\n value: string | string[]\n }[]\n}\n\nfunction parseSuppressionRules(errorTracking: boolean | { [key: string]: JsonType }): ErrorTrackingSuppressionRule[] {\n const rules = isObject(errorTracking) ? errorTracking.suppressionRules : undefined\n if (!isArray(rules)) {\n return []\n }\n return rules.filter((rule) => isObject(rule) && isArray(rule.values)) as unknown as ErrorTrackingSuppressionRule[]\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 // Kept in memory only: the remote config they come from is already persisted and replayed\n // through onRemoteConfig at startup.\n private _suppressionRules: ErrorTrackingSuppressionRule[] = []\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 /**\n * Whether an exception matches one of the suppression rules from remote config, in which case\n * it should be dropped instead of captured. Mirrors the browser SDK. Records an exception step\n * when it matches, so the next captured exception shows that one was dropped.\n */\n shouldSuppressException(exceptionList: unknown): boolean {\n if (!isArray(exceptionList) || exceptionList.length === 0 || this._suppressionRules.length === 0) {\n return false\n }\n\n try {\n const exceptionValues: Record<string, string[]> = { $exception_types: [], $exception_values: [] }\n for (const exception of exceptionList) {\n if (!isObject(exception)) {\n continue\n }\n if (isString(exception.type) && exception.type.length > 0) {\n exceptionValues.$exception_types.push(exception.type)\n }\n if (isString(exception.value) && exception.value.length > 0) {\n exceptionValues.$exception_values.push(exception.value)\n }\n }\n\n const matched = this._suppressionRules.some((rule) => {\n const results = rule.values.map((v) => {\n const compare = propertyComparisons[v.operator]\n const values = exceptionValues[v.key]\n if (!compare || !values) {\n return false\n }\n const targets = isArray(v.value) ? v.value : [v.value]\n return targets.length > 0 ? compare(targets, values) : false\n })\n return rule.type === 'OR' ? results.some(Boolean) : results.every(Boolean)\n })\n\n if (matched) {\n this.addExceptionStep('Exception dropped: matched a suppression rule')\n }\n return matched\n } catch (error) {\n // Suppression only ever filters what we capture, so failing to evaluate it must not cost\n // us the exception.\n this.logger.warn('Failed to evaluate suppression rules. Capturing the exception.', error)\n return false\n }\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 * errorTracking.suppressionRules replaces the current rules; a response without them clears them.\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 this._suppressionRules = parseSuppressionRules(errorTracking)\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 const marked = isFatal ? this.markFatalExceptionHandled(error) : undefined\n if (!this._autocaptureEnabled || isPostHogFetchNetworkError(error)) {\n return marked\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 Promise.all([marked, this.handleFatalException(error, hint, uuidv7(), new Date())]).then(() => {})\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 // React Native turns this fatal into a native crash once the handler chain finishes. The\n // native plugin drops that crash report only when it contains the message marked here, so\n // fatals that bypass this handler (React render errors) still reach error tracking.\n private markFatalExceptionHandled(error: unknown): Promise<void> | undefined {\n const bridge = OptionalReactNativePlugin?.markFatalExceptionHandled\n if (!bridge) {\n return undefined\n }\n try {\n return Promise.resolve(bridge(fatalMessageKey(error))).catch((e) => {\n this.logger.warn(`Failed to mark fatal exception as handled: ${e}`)\n })\n } catch (e) {\n this.logger.warn(`Failed to mark fatal exception as handled: ${e}`)\n return undefined\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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ACwE,8BAA8B,EAAE,CACvC,CACA,GAAI1E,kBAAkB,CAACG,OAAO,CAACnJ,MAAM,CAAG,CAAC,CAAE,CACzC,IAAI,CAAC8N,kBAAkB,CAAC9E,kBAAkB,CAACG,OAAO,CAAC,CACrD,CACF,CAAC","ignoreList":[]}
|
package/dist/posthog-rn.d.ts
CHANGED
|
@@ -9,6 +9,9 @@ export interface PostHogOptions extends PostHogCoreOptions {
|
|
|
9
9
|
* Allows you to provide the storage type.
|
|
10
10
|
* 'file' will try to load the best available storage, the provided 'customStorage', 'customAsyncStorage' or in-memory storage.
|
|
11
11
|
*
|
|
12
|
+
* Events captured offline stay in the queue. A flush that fails with a network error keeps them and retries later.
|
|
13
|
+
* With 'file', the queue is stored on the device and survives an app restart.
|
|
14
|
+
*
|
|
12
15
|
* @default 'file'
|
|
13
16
|
*/
|
|
14
17
|
persistence?: 'memory' | 'file';
|
|
@@ -29,6 +32,7 @@ export interface PostHogOptions extends PostHogCoreOptions {
|
|
|
29
32
|
/**
|
|
30
33
|
* Captures app lifecycle events such as Application Installed, Application Updated, Application Opened, Application Became Active and Application Backgrounded.
|
|
31
34
|
* Application Installed and Application Updated events are not supported with persistence set to 'memory'.
|
|
35
|
+
* On by default from 4.39.0.
|
|
32
36
|
*
|
|
33
37
|
* @default true
|
|
34
38
|
*/
|