@patreon/studio
Version:
Patreon Studio Design System
20 lines (19 loc) • 1 kB
TypeScript
import React from 'react';
import type { ChildrenProps } from '../../types/component';
export declare type IncrementLoggerFn = (metric: string, tags?: Record<string, string>) => void;
interface IncrementLoggerContext {
incrementLogger: IncrementLoggerFn;
incrementLoggerOnce: IncrementLoggerFn;
}
declare const IncrementLoggerContext: React.Context<IncrementLoggerContext>;
declare type IncrementLoggerProviderProps = ChildrenProps & Partial<Pick<IncrementLoggerContext, 'incrementLogger'>>;
/**
* IncrementLoggerProvider is a component that provides an increment logger to its children.
* The increment logger is a function that takes a metric name and optional tags object.
*/
export declare function IncrementLoggerProvider({ incrementLogger, children }: IncrementLoggerProviderProps): React.JSX.Element;
/**
* useIncrementLogger is a hook that returns the increment logger function from the context.
*/
export declare function useIncrementLogger(): IncrementLoggerContext;
export {};