import { TurboModuleRegistry } from 'react-native' import type { TurboModule } from 'react-native' import type { UnsafeObject } from 'react-native/Libraries/Types/CodegenTypes' // Codegen spec for the native module. On the old architecture `TurboModuleRegistry.get` // returns the bridge module from `NativeModules`. export interface Spec extends TurboModule { setup(sessionId: string, sdkOptions: UnsafeObject, pluginConfig?: UnsafeObject): Promise startSession(sessionId: string): Promise endSession(): Promise isEnabled(): Promise identify(distinctId: string, anonymousId: string): Promise reset(distinctId: string, anonymousId: string): Promise startRecording(resumeCurrent: boolean): Promise stopRecording(): Promise addExceptionStep(message: string, properties?: UnsafeObject): Promise captureFatalException(distinctId: string, timestamp: string, properties: UnsafeObject): Promise markFatalExceptionHandled(message: string): Promise getSessionReplayDebugProperties(): Promise // `{ minimumDurationMs: number | null }`: a bare nullable number crashes the old Android bridge on null. setSessionReplayMinimumDuration(options: UnsafeObject): Promise setAppLanguage(language: string | null): Promise gzip(payload: string): Promise registerPushNotificationToken(deviceToken: string, appId: string | null): Promise unregisterPushNotificationToken(): Promise setOptOut(optOut: boolean): Promise capturePushNotificationOpened(properties: UnsafeObject): Promise providePushIdentityToken(requestId: string, token: string | null): Promise // NativeEventEmitter forwards listener counts to these, which iOS needs to deliver events. addListener(eventName: string): void removeListeners(count: number): void } export default TurboModuleRegistry.get('PosthogReactNativePlugin')