/** * TurboModule spec for the react-native-userleap native bridge. * Events use a single onSprigEvent channel carrying a {name, json} JSON-string * envelope, because event payloads are heterogeneous. */ import type {TurboModule, TurboModuleRegistry, CodegenTypes} from 'react-native'; /** Result payload for the modern trackEvent* family. */ export type SurveyResult = { surveyState: string; surveyId: number; }; /** Envelope for the lifecycle-event channel: event name plus JSON-stringified payload. */ export type SprigEventPayload = { name: string; json: string; }; export interface Spec extends TurboModule { visitorIdentifier(): number; visitorIdentifierString(): string; getSdkVersion(): string; configure(environmentId: string, configuration: Object): void; setPreviewKey(previewKey: string): void; setUserIdentifier(identifier: string): void; setEmailAddress(emailAddress: string): void; logout(): void; setVisitorAttribute(key: string, value: string): void; setVisitorAttributes(attributes: Object): void; removeVisitorAttributes(keys: Array): void; setVisitorAttributesAndIdentify( attributes: Object, userId: string | null, partnerAnonymousId: string | null, ): void; presentSurvey(): void; dismissActiveSurvey(): void; pauseDisplayingSurveys(): void; unpauseDisplayingSurveys(): void; trackAndPresent(eventName: string): void; trackIdentifyAndPresent( eventName: string, userId: string | null, partnerAnonymousId: string | null, ): void; overrideUserInterfaceMode(mode: number): void; trackEvent( eventName: string, surveyResultCallback: (result: SurveyResult) => void, ): void; trackEventWithProperties( eventName: string, userId: string | null, partnerAnonymousId: string | null, properties: Object, surveyResultCallback: (result: SurveyResult) => void, ): void; trackEventAndIdentify( eventName: string, userId: string | null, partnerAnonymousId: string | null, surveyResultCallback: (result: SurveyResult) => void, ): void; // Deprecated; use trackEvent* instead. track( eventName: string, surveyStateCallback: (surveyState: string) => void, ): void; trackWithProperties( eventName: string, userId: string | null, partnerAnonymousId: string | null, properties: Object, surveyStateCallback: (surveyState: string) => void, ): void; trackAndIdentify( eventName: string, userId: string | null, partnerAnonymousId: string | null, surveyStateCallback: (surveyState: string) => void, ): void; readonly onSprigEvent: CodegenTypes.EventEmitter; getSupportedEventNames(): Array; } export default TurboModuleRegistry.getEnforcing('UserLeapBindings');