// Generated by dts-bundle-generator v9.0.0

/// <reference types="prop-types" />
/// <reference types="react" />
/// <reference types="scheduler" />

import { Channel, Options, PresenceChannel, default as Pusher } from 'pusher-js';

export interface PusherContextValues {
	// client?: React.MutableRefObject<Pusher | undefined>;
	client?: Pusher;
	triggerEndpoint?: string;
}
export interface ChannelsContextValues {
	subscribe?: <T extends Channel & PresenceChannel>(channelName: string) => T | undefined;
	unsubscribe?: <T extends Channel & PresenceChannel>(channelName: string) => void;
	getChannel?: <T extends Channel & PresenceChannel>(channelName: string) => T | undefined;
}
export interface PusherProviderProps extends Options {
	_PusherRuntime?: typeof Pusher;
	children: React.ReactNode;
	clientKey: string | undefined;
	cluster: "mt1" | "us2" | "us3" | "eu" | "ap1" | "ap2" | "ap3" | "ap4" | string | undefined;
	triggerEndpoint?: string;
	defer?: boolean;
	// for testing purposes
	value?: PusherContextValues;
}
/**
 * Provides access to the pusher client instance.
 *
 * @returns a `MutableRefObject<Pusher|undefined>`. The instance is held by a `useRef()` hook.
 * @example
 * ```javascript
 * const { client } = usePusher();
 * client.current.subscribe('my-channel');
 * ```
 */
export declare function usePusher(): PusherContextValues;
export declare const NOT_IN_CONTEXT_WARNING = "No Pusher context. Did you forget to wrap your app in a <PusherProvider />?";
/**
 * Subscribe to a channel
 *
 * @param channelName The name of the channel you want to subscribe to.
 * @typeparam Type of channel you're subscribing to. Can be one of `Channel` or `PresenceChannel` from `pusher-js`.
 * @returns Instance of the channel you just subscribed to.
 *
 * @example
 * ```javascript
 * const channel = useChannel("my-channel")
 * channel.bind('some-event', () => {})
 * ```
 */
export declare function useChannel<T extends Channel & PresenceChannel>(channelName: string | undefined): (Channel & PresenceChannel) | undefined;
/**
 * Subscribe to presence channel events and get members back
 *
 * @param channelName name of presence the channel. Should have `presence-` suffix.
 * @returns Object with `channel`, `members` and `myID` properties.
 *
 * @example
 * ```javascript
 * const { channel, members, myID } = usePresenceChannel("presence-my-channel");
 * ```
 */
/** Internal state */
export type PresenceChannelState = {
	members: Record<string, any>;
	me: Record<string, any> | undefined;
	myID: string | undefined;
	count: number;
};
export type MemberAction = {
	id: string;
	info?: Record<string, any>;
};
export type ReducerAction = {
	type: typeof SET_STATE | typeof ADD_MEMBER | typeof REMOVE_MEMBER;
	payload: Partial<PresenceChannelState> | MemberAction;
};
/** Hook return value */
export interface usePresenceChannelValue extends Partial<PresenceChannelState> {
	channel?: PresenceChannel;
}
/** Presence channel reducer to keep track of state */
export declare const SET_STATE = "set-state";
export declare const ADD_MEMBER = "add-member";
export declare const REMOVE_MEMBER = "remove-member";
export declare const presenceChannelReducer: (state: PresenceChannelState, { type, payload }: ReducerAction) => {
	id: string;
	info?: Record<string, any> | undefined;
	members: Record<string, any>;
	me: Record<string, any> | undefined;
	myID: string | undefined;
	count: number;
} | {
	members: Record<string, any>;
	me: Record<string, any> | undefined;
	myID: string | undefined;
	count: number;
};
export declare function usePresenceChannel(channelName: string | undefined): usePresenceChannelValue;
/**
 * Subscribes to a channel event and registers a callback.
 * @param channel Pusher channel to bind to
 * @param eventName Name of event to bind to
 * @param callback Callback to call on a new event
 */
export declare function useEvent<D>(channel: Channel | PresenceChannel | undefined, eventName: string, callback: (data?: D, metadata?: {
	user_id: string;
}) => void): void;
/**
 *
 * @param channel the channel you'd like to trigger clientEvents on. Get this from [[useChannel]] or [[usePresenceChannel]].
 * @typeparam TData shape of the data you're sending with the event.
 * @returns A memoized trigger function that will perform client events on the channel.
 * @example
 * ```javascript
 * const channel = useChannel('my-channel');
 * const trigger = useClientTrigger(channel)
 *
 * const handleClick = () => trigger('some-client-event', {});
 * ```
 */
export declare function useClientTrigger<TData = {}>(channel: Channel | PresenceChannel | undefined): (eventName: string, data: TData) => void;
/**
 * Hook to provide a trigger function that calls the server defined in `PusherProviderProps.triggerEndpoint` using `fetch`.
 * Any `auth?.headers` in the config object will be passed with the `fetch` call.
 *
 * @param channelName name of channel to call trigger on
 * @typeparam TData shape of the data you're sending with the event
 *
 * @example
 * ```typescript
 * const trigger = useTrigger<{message: string}>('my-channel');
 * trigger('my-event', {message: 'hello'});
 * ```
 */
export declare function useTrigger<TData = {}>(channelName: string): (eventName: string, data?: TData) => Promise<Response>;
export declare const NO_AUTH_HEADERS_WARNING = "No auth parameters supplied to <PusherProvider />. Your events will be unauthenticated.";
/**
 * Provides access to the channels global provider.
 */
export declare function useChannels(): ChannelsContextValues;
export declare const __ChannelsContext: React.Context<ChannelsContextValues>;
/**
 * Provider that creates your channels instances and provides it to child hooks throughout your app.
 */
export declare const ChannelsProvider: React.FC<{
	children: React.ReactNode;
}>;
/** Wrapper around the core PusherProvider that passes in the Pusher react-native lib */
export declare const PusherProvider: React.FC<PusherProviderProps>;
export declare const __PusherContext: React.Context<PusherContextValues>;

export {};
