UNPKG

flipper-plugin

Version:

Flipper Desktop plugin SDK and components

46 lines 1.83 kB
/** * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. * * @format */ import React from 'react'; export type InteractionReport = { duration: number; totalDuration: number; success: 1 | 0; error?: string; scope: string; action: string; componentType: string; event: string; uuid: string; }; export type InteractionReporter = (report: InteractionReport) => void; export declare function setGlobalInteractionReporter(reporter: InteractionReporter): void; export declare function resetGlobalInteractionReporter(): void; export declare const TrackingScopeContext: React.Context<string>; export declare function TrackingScope({ scope, children, }: { scope: string; children: React.ReactNode; }): JSX.Element; /** * Gives the name of the current scope that is currently rendering. * Typically the current plugin id, but can be further refined by using TrackingScopes */ export declare function useCurrentScopeName(): string; export declare function Tracked({ events, children, action, }: { /** * Name of the event handler properties of the child component that should be wrapped */ events?: string | string[]; action?: string; children: React.ReactNode; }): React.ReactElement; export declare function useTrackedCallback<T extends Function>(action: string, fn: T, deps: any[]): T; export declare function wrapInteractionHandler<T extends Function>(fn: T, element: React.ReactElement | null | string, event: string, scope: string, action?: string): T; export declare function describeElement(element: React.ReactElement): string; export declare function withTrackingScope<T>(component: T): T; //# sourceMappingURL=Tracked.d.ts.map