import { Context, Integrations, JsonMap } from './bridge'; import { NativeWrapper } from './wrapper'; export interface MiddlewarePayload { type: T; data: D; context: Context; next(context?: Partial): void; next(context?: Partial, data?: D): void; } export interface TrackPayload extends MiddlewarePayload<'track', { event: string; properties: JsonMap; integrations: Integrations; }> { } export interface ScreenPayload extends MiddlewarePayload<'screen', { name: string; properties: JsonMap; integrations: Integrations; }> { } export interface IdentifyPayload extends MiddlewarePayload<'identify', { user: string; traits: JsonMap | null; options: JsonMap; integrations: Integrations; }> { } export interface GroupPayload extends MiddlewarePayload<'group', { groupId: string; traits: JsonMap; integrations: Integrations; }> { } export interface AliasPayload extends MiddlewarePayload<'alias', { newId: string; integrations: Integrations; }> { } export declare type Payload = TrackPayload | IdentifyPayload | ScreenPayload | GroupPayload | AliasPayload; export declare type Middleware = (payload: Payload) => void | Promise; export declare type PayloadFromType = Extract; export declare class MiddlewareChain { private readonly wrapper; private readonly middlewares; constructor(wrapper: NativeWrapper); add(middleware: Middleware): void; run>(type: T, data: P['data'], context: JsonMap): Promise; private exec; }