@fullstory/react-native
Version:
The official FullStory React Native plugin
35 lines (31 loc) • 1.34 kB
text/typescript
import type { TurboModule } from 'react-native';
import { TurboModuleRegistry } from 'react-native';
import type { EventEmitter } from 'react-native/Libraries/Types/CodegenTypes';
// needs to be defined here, cannot be imported
export type FSSessionData = {
replayStartUrl: string;
replayNowUrl: string;
sessionId: string;
};
export interface Spec extends TurboModule {
anonymize(): void;
identify(uid: string, userVars?: Object): void;
setUserVars(userVars: Object): void;
onReady(): Promise<FSSessionData>;
getCurrentSession(): Promise<string>;
getCurrentSessionURL(): Promise<string>;
consent(userConsents: boolean): void;
event(eventName: string, eventProperties: Object): void;
shutdown(): void;
restart(): void;
log(logLevel: number, message: string): void;
resetIdleTimer(): void;
startPage(nonce: string, pageName: string, pageProperties?: Object): void;
endPage(uuid: string): void;
updatePage(uuid: string, pageProperties: Object): void;
// Not exposed in the public API. Must be declared here because TurboModule codegen
// requires all native event emitters to be defined on the Spec interface. Used
// internally by onReady() to support the listener-based overload.
readonly onSessionStarted: EventEmitter<FSSessionData>;
}
export default TurboModuleRegistry.get<Spec>('FullStory');