@hyper-fetch/react
Version:
React hooks and utils for the hyper-fetch
738 lines (701 loc) • 28.2 kB
TypeScript
import * as _hyper_fetch_core from '@hyper-fetch/core';
import { RequestInstance, Dispatcher, LoggerType, CacheValueType, ExtractResponseType, ExtractErrorType, ResponseDetailsType, ExtractAdapterReturnType, RequestEventType, ProgressType, NullableType, ExtractAdapterStatusType, ExtractAdapterType, ExtractAdapterExtraType, RequiredKeys, RequestSendType, QueueElementType, ClientInstance } from '@hyper-fetch/core';
import * as _hyper_fetch_sockets from '@hyper-fetch/sockets';
import { SocketInstance, ListenerInstance, ExtractListenerResponseType, ExtractSocketExtraType, ExtractListenerAdapterType, EmitterInstance } from '@hyper-fetch/sockets';
import React from 'react';
/**
* This hooks aims to retrieve data from server.
* @param request Request instance
* @param options Hook options
* @returns
*/
declare const useFetch: <RequestType extends RequestInstance>(request: RequestType, options?: UseFetchOptionsType<RequestType>) => UseFetchReturnType<RequestType>;
/**
* This is helper hook that handles main Hyper-Fetch event/data flow
* @internal
* @param options
* @returns
*/
declare const useRequestEvents: <T extends RequestInstance>({ request, dispatcher, logger, actions, setCacheData, getIsDataProcessing, }: UseRequestEventsPropsType<T>) => UseRequestEventsReturnType<T>;
type UseRequestEventsDataMap = {
unmount: VoidFunction;
};
type UseRequestEventsLifecycleMap = Map<string, {
unmount: VoidFunction;
}>;
type UseRequestEventsPropsType<T extends RequestInstance> = {
request: T;
dispatcher: Dispatcher;
logger: LoggerType;
actions: UseTrackedStateActions<T>;
setCacheData: (cacheData: CacheValueType<ExtractResponseType<T>, ExtractErrorType<T>>) => void;
getIsDataProcessing: (cacheKey: string) => boolean;
};
type UseRequestEventsActionsType<T extends RequestInstance> = {
/**
* Callback that allows canceling ongoing requests from the given queueKey.
*/
abort: () => void;
/**
* Helper hook listening on success response.
*/
onSuccess: (callback: OnSuccessCallbackType<T>) => void;
/**
* Helper hook listening on error response.
*/
onError: (callback: OnErrorCallbackType<T>) => void;
/**
* Helper hook listening on aborting of requests. Abort events are not triggering onError callbacks.
*/
onAbort: (callback: OnErrorCallbackType<T>) => void;
/**
* Helper hook listening on request going into offline awaiting for network connection to be restored. It will not trigger onError when 'offline' mode is set on request.
*/
onOfflineError: (callback: OnErrorCallbackType<T>) => void;
/**
* Helper hook listening on any response.
*/
onFinished: (callback: OnFinishedCallbackType<T>) => void;
/**
* Helper hook listening on request start.
*/
onRequestStart: (callback: OnStartCallbackType<T>) => void;
/**
* Helper hook listening on response start(before we receive all data from server).
*/
onResponseStart: (callback: OnStartCallbackType<T>) => void;
/**
* Helper hook listening on download progress ETA. We can later match given requests by their id's or request instance which holds all data which is being transferred.
*/
onDownloadProgress: (callback: OnProgressCallbackType) => void;
/**
* Helper hook listening on upload progress ETA. We can later match given requests by their id's or request instance which holds all data which is being transferred.
*/
onUploadProgress: (callback: OnProgressCallbackType) => void;
};
type UseRequestEventsReturnType<T extends RequestInstance> = [
UseRequestEventsActionsType<T>,
{
addCacheDataListener: (request: RequestInstance) => VoidFunction;
clearCacheDataListener: VoidFunction;
addLifecycleListeners: (request: RequestInstance, requestId?: string) => VoidFunction;
removeLifecycleListener: (requestId: string) => void;
clearLifecycleListeners: () => void;
}
];
type CallbackParameters<Request, ResponseType> = {
response: ResponseType;
details: ResponseDetailsType;
request: Request;
};
type OnSuccessCallbackType<Request extends RequestInstance> = (params: CallbackParameters<Request, ExtractResponseType<Request>>) => void | Promise<void>;
type OnErrorCallbackType<Request extends RequestInstance> = (params: CallbackParameters<Request, ExtractErrorType<Request>>) => void | Promise<void>;
type OnFinishedCallbackType<Request extends RequestInstance> = (params: CallbackParameters<Request, ExtractAdapterReturnType<Request>>) => void | Promise<void>;
type OnStartCallbackType<Request extends RequestInstance> = (params: {
details: RequestEventType<Request>;
request: Request;
}) => void | Promise<void>;
type OnProgressCallbackType = <Request extends RequestInstance>(progress: ProgressType, details: RequestEventType<Request>) => void | Promise<void>;
/**
* Check if value is empty
* @param value any object or primitive
* @returns true when value is empty
*/
declare const isEmpty: (value: unknown) => boolean;
/**
* Allow to deep compare any passed values
* @param firstValue unknown
* @param secondValue unknown
* @returns true when elements are equal
*/
declare const isEqual: (firstValue: unknown, secondValue: unknown) => boolean;
declare const getBounceData: (bounceData: {
reset: () => void;
active: boolean;
}) => {
reset: () => void;
active: boolean;
};
type UseTrackedStateProps<T extends RequestInstance> = {
request: T;
logger: LoggerType;
initialData: NullableType<Partial<ExtractAdapterReturnType<T>>>;
dispatcher: Dispatcher;
dependencyTracking: boolean;
defaultCacheEmitting?: boolean;
deepCompare: boolean | typeof isEqual;
disabled?: boolean;
revalidate?: boolean;
};
type UseTrackedStateReturn<T extends RequestInstance> = [
UseTrackedStateType<T>,
UseTrackedStateActions<T>,
{
setRenderKey: (renderKey: keyof UseTrackedStateType<T>) => void;
setCacheData: (cacheData: CacheValueType<ExtractResponseType<T>, ExtractErrorType<T>>) => void;
getStaleStatus: () => boolean;
getIsDataProcessing: (cacheKey: string) => boolean;
}
];
type UseTrackedStateType<T extends RequestInstance = RequestInstance> = {
/**
* Request response data
*/
data: null | ExtractResponseType<T>;
/**
* Request response error
*/
error: null | ExtractErrorType<T>;
/**
* Request loading state
*/
loading: boolean;
/**
* Request status
*/
status: ExtractAdapterStatusType<ExtractAdapterType<T>>;
/**
* Request additional response data
*/
extra: ExtractAdapterExtraType<ExtractAdapterType<T>>;
/**
* Information whether request succeeded
*/
success: boolean;
/**
* Request attempts
*/
retries: number;
/**
* Request response timestamp
*/
timestamp: null | Date;
};
type UseTrackedStateActions<T extends RequestInstance> = {
/**
* Action to set custom data. We can do it locally(inside hook state) or in cache(all related sources) with 'emitToCache' option.
*/
setData: (data: ExtractResponseType<T>, emitToCache?: boolean) => void;
/**
* Action to set custom error. We can do it locally(inside hook state) or in all hooks with 'emitToCache' option.
*/
setError: (error: ExtractErrorType<T>, emitToCache?: boolean) => void;
/**
* Action to set custom loading. We can do it locally(inside hook state) or in cache(all related sources) with 'emitToCache' option
*/
setLoading: (loading: boolean, emitToHooks?: boolean) => void;
/**
* Action to set custom status. We can do it locally(inside hook state) or in cache(all related sources) with 'emitToCache' option
*/
setStatus: (status: ExtractAdapterStatusType<ExtractAdapterType<T>>, emitToCache?: boolean) => void;
/**
* Action to set custom success. We can do it locally(inside hook state) or in cache(all related sources) with 'emitToCache' option
*/
setSuccess: (success: boolean, emitToCache?: boolean) => void;
/**
* Action to set custom additional data. We can do it locally(inside hook state) or in cache(all related sources) with 'emitToCache' option
*/
setExtra: (extra: ExtractAdapterExtraType<ExtractAdapterType<T>>, emitToCache?: boolean) => void;
/**
* Action to set custom retries count. We can do it locally(inside hook state) or in cache(all related sources) with 'emitToCache' option
*/
setRetries: (retries: number, emitToCache?: boolean) => void;
/**
* Action to set custom timestamp. We can do it locally(inside hook state) or in cache(all related sources) with 'emitToCache' option
*/
setTimestamp: (timestamp: Date, emitToCache?: boolean) => void;
};
declare const initialState: UseTrackedStateType;
/**
*
* @param request
* @param initialData
* @param dispatcher
* @param dependencies
* @internal
*/
declare const useTrackedState: <T extends RequestInstance>({ request, dispatcher, initialData, deepCompare, dependencyTracking, defaultCacheEmitting, disabled, revalidate, }: UseTrackedStateProps<T>) => UseTrackedStateReturn<T>;
declare const getDetailsState: (state?: UseTrackedStateType<RequestInstance>, details?: Partial<ResponseDetailsType>) => ResponseDetailsType;
declare const isStaleCacheData: (cacheTime: number, cacheTimestamp: NullableType<Date | number>) => boolean;
declare const getValidCacheData: <T extends RequestInstance>(request: T, initialData: Partial<ExtractAdapterReturnType<T>>, cacheData: CacheValueType<ExtractResponseType<T>, ExtractErrorType<T>, _hyper_fetch_core.AdapterInstance>) => CacheValueType<ExtractResponseType<T>, ExtractErrorType<T>, _hyper_fetch_core.AdapterInstance>;
declare const getTimestamp: (timestamp?: NullableType<number | Date>) => Date;
declare const getIsInitiallyLoading: ({ queryKey, dispatcher, hasState, revalidate, disabled, }: {
queryKey: string;
dispatcher: Dispatcher;
hasState: boolean;
revalidate?: boolean;
disabled?: boolean;
}) => boolean;
declare const getInitialState: <T extends RequestInstance>({ initialResponse, dispatcher, request, disabled, revalidate, }: {
initialResponse: Partial<ExtractAdapterReturnType<T>>;
dispatcher: Dispatcher;
request: T;
/**
* useFetch only
*/
disabled?: boolean;
/**
* useFetch only
*/
revalidate?: boolean;
}) => UseTrackedStateType<T>;
declare const useSocketState: <DataType>(socket: SocketInstance, { dependencyTracking }: UseSocketStateProps) => readonly [UseSocketStateType<DataType>, {
setData: (data: DataType) => void;
setConnected: (connected: boolean) => void;
setConnecting: (connecting: boolean) => void;
setTimestamp: (timestamp: number | null) => void;
}, {
onOpen: (callback: VoidFunction) => void;
onClose: (callback: VoidFunction) => void;
onError: <ErrorType = Event>(callback: (event: ErrorType) => void) => void;
onConnecting: (callback: VoidFunction) => void;
onReconnecting: (callback: (attempts: number) => void) => void;
onReconnectingStop: (callback: (attempts: number) => void) => void;
}, {
readonly setRenderKey: (renderKey: keyof UseSocketStateType<DataType>) => void;
}];
type UseSocketStateType<DataType = any> = {
data: DataType | null;
connected: boolean;
connecting: boolean;
timestamp: number | null;
};
type UseSocketStateProps = {
dependencyTracking?: boolean;
};
declare const initialSocketState: UseSocketStateType;
type InvalidationKeyType = string | RequestInstance | RegExp;
type UseFetchOptionsType<T extends RequestInstance> = {
/**
* Refetch dependencies
*/
dependencies?: any[];
/**
* Disable fetching
*/
disabled?: boolean;
/**
* If `true` it will rerender only when values used by our component gets changed. Otherwise it will rerender on any change.
*/
dependencyTracking?: boolean;
/**
* If `true` it will refetch data in background no matter if we have it from cache.
*/
revalidate?: boolean;
/**
* If cache is empty we can use placeholder data.
*/
initialData?: NullableType<Partial<ExtractAdapterReturnType<T>>>;
/**
* Enable/disable refresh data
*/
refresh?: boolean;
/**
* Refresh data interval time
*/
refreshTime?: number;
/**
* Enable/disable data refresh if our tab is not focused(used by user at given time).
*/
refetchBlurred?: boolean;
/**
* Enable/disable data refresh if user leaves current tab.
*/
refetchOnBlur?: boolean;
/**
* Enable/disable data refresh if user enters current tab.
*/
refetchOnFocus?: boolean;
/**
* Enable/disable data refresh if network is restored.
*/
refetchOnReconnect?: boolean;
/**
* Enable/disable debouncing for often changing keys or refreshing, to limit requests to server.
*/
bounce?: boolean;
/**
* Deep comparison function for hook to check for equality in incoming data, to limit rerenders.
*/
deepCompare?: boolean | typeof isEqual;
} & ({
/**
* Possibility to choose between debounce and throttle approaches
*/
bounceType?: "debounce";
/**
* How long it should bounce requests.
*/
bounceTime?: number;
} | {
/**
* Possibility to choose between debounce and throttle approaches
*/
bounceType: "throttle";
/**
* How long it should bounce requests.
*/
bounceTime?: number;
/**
* ONLY in throttle mode - options for handling last bounce event
*/
bounceTimeout?: number;
});
type UseFetchReturnType<T extends RequestInstance> = UseTrackedStateType<T> & UseTrackedStateActions<T> & UseRequestEventsActionsType<T> & {
/**
* Data related to current state of the bounce usage
*/
bounce: {
/**
* Active state of the bounce method
*/
active: boolean;
/**
* Method to stop the active bounce method execution
*/
reset: () => void;
};
/**
* Refetch current request resource or pass custom key to trigger it by invalidationKey(Regex / cacheKey).
*/
refetch: (invalidateKey?: InvalidationKeyType | InvalidationKeyType[]) => void;
};
declare const getRefreshTime: (refreshTime: number, dataTimestamp?: Date) => number;
type DefaultOptionsType$1 = RequiredKeys<Omit<UseFetchOptionsType<RequestInstance>, "initialData">> & {
initialData: null;
};
declare const useFetchDefaultOptions: DefaultOptionsType$1;
/**
* This hooks aims to mutate data on the server.
* @param request
* @param options
* @returns
*/
declare const useSubmit: <RequestType extends RequestInstance>(request: RequestType, options?: UseSubmitOptionsType<RequestType>) => UseSubmitReturnType<RequestType>;
type UseSubmitOptionsType<T extends RequestInstance> = {
/**
* Disable submitting
*/
disabled?: boolean;
/**
* If cache is empty we can use placeholder data.
*/
initialData?: NullableType<Partial<ExtractAdapterReturnType<T>>>;
/**
* Enable/disable debouncing for often changing keys or refreshing, to limit requests to server.
*/
bounce?: boolean;
/**
* If `true` it will rerender only when values used by our component gets changed. Otherwise it will rerender on any change.
*/
dependencyTracking?: boolean;
/**
* Deep comparison function for hook to check for equality in incoming data, to limit rerenders.
*/
deepCompare?: boolean | typeof isEqual;
} & ({
/**
* Possibility to choose between debounce and throttle approaches
*/
bounceType?: "debounce";
/**
* How long it should bounce requests.
*/
bounceTime?: number;
} | {
/**
* Possibility to choose between debounce and throttle approaches
*/
bounceType: "throttle";
/**
* How long it should interval requests.
*/
bounceTime?: number;
/**
* ONLY in throttle mode - options for handling last bounce event
*/
bounceTimeout?: number;
});
type UseSubmitReturnType<RequestType extends RequestInstance> = Omit<UseTrackedStateType<RequestType>, "loading"> & UseTrackedStateActions<RequestType> & {
/**
* Callback which allows to cancel ongoing requests from given queueKey.
*/
abort: () => void;
/**
* Helper hook listening on success response.
*/
onSubmitSuccess: (callback: OnSuccessCallbackType<RequestType>) => void;
/**
* Helper hook listening on error response.
*/
onSubmitError: (callback: OnErrorCallbackType<RequestType>) => void;
/**
* Helper hook listening on any response.
*/
onSubmitFinished: (callback: OnFinishedCallbackType<RequestType>) => void;
/**
* Helper hook listening on request start.
*/
onSubmitRequestStart: (callback: OnStartCallbackType<RequestType>) => void;
/**
* Helper hook listening on response start(before we receive all data from server).
*/
onSubmitResponseStart: (callback: OnStartCallbackType<RequestType>) => void;
/**
* Helper hook listening on download progress ETA. We can later match given requests by their id's or request instance which holds all data which is being transferred.
*/
onSubmitDownloadProgress: (callback: OnProgressCallbackType) => void;
/**
* Helper hook listening on upload progress ETA. We can later match given requests by their id's or request instance which holds all data which is being transferred.
*/
onSubmitUploadProgress: (callback: OnProgressCallbackType) => void;
/**
* Helper hook listening on aborting of requests. Abort events are not triggering onError callbacks.
*/
onSubmitAbort: (callback: OnErrorCallbackType<RequestType>) => void;
/**
* Helper hook listening on request going into offline awaiting for network connection to be restored. It will not trigger onError when 'offline' mode is set on request.
*/
onSubmitOfflineError: (callback: OnErrorCallbackType<RequestType>) => void;
/**
* Method responsible for triggering requests. It return Promise which will be resolved with the request.
*/
submit: RequestSendType<RequestType>;
/**
* Request loading state
*/
submitting: boolean;
/**
* Data related to current state of the bounce usage
*/
bounce: {
/**
* Active state of the bounce method
*/
active: boolean;
/**
* Method to stop the active bounce method execution
*/
reset: () => void;
};
/**
* Refetch current request resource or pass custom key to trigger it by invalidationKey(Regex / cacheKey).
*/
refetch: (invalidateKey: InvalidationKeyType | InvalidationKeyType[]) => void;
};
type DefaultOptionsType = RequiredKeys<Omit<UseSubmitOptionsType<RequestInstance>, "initialData">> & {
initialData: null;
};
declare const useSubmitDefaultOptions: DefaultOptionsType;
/**
* This hook allows to control dispatchers request queues
* @param request
* @param options
* @returns
*/
declare const useQueue: <Request_1 extends RequestInstance>(request: Request_1, options?: UseQueueOptionsType) => UseQueueReturnType<Request_1>;
type UseQueueOptionsType = {
queueType?: "auto" | "fetch" | "submit";
};
type QueueRequest<Request extends RequestInstance> = QueueElementType<Request> & {
/**
* Uploading progress for given request
*/
uploading?: ProgressType;
/**
* Downloading progress for given request
*/
downloading?: ProgressType;
/**
* Callback which allow to start previously stopped request.
*/
startRequest: () => void;
/**
* Callback which allow to stop request and cancel it if it's ongoing.
*/
stopRequest: () => void;
/**
* Removes request from the queue
*/
deleteRequest: () => void;
};
type UseQueueReturnType<T extends RequestInstance> = {
/**
* Queue status for provided request
*/
stopped: boolean;
/**
* List of requests for provided request
*/
requests: QueueRequest<T>[];
/**
* Callback which allow to stop queue, it will cancel ongoing requests.
*/
stop: () => void;
/**
* Callback which allow to pause queue. It will allow ongoing requests to be finished, but will stop next from being send.
*/
pause: () => void;
/**
* Callback which allow to start queue.
*/
start: () => void;
};
declare const useQueueDefaultOptions: RequiredKeys<UseQueueOptionsType>;
declare const useCache: <T extends RequestInstance>(request: T, options?: UseCacheOptionsType<T>) => UseCacheReturnType<T>;
declare const useCacheDefaultOptions: {
dependencyTracking: boolean;
initialData: any;
deepCompare: boolean;
};
type UseCacheOptionsType<T extends RequestInstance> = {
/**
* If `true` it will rerender only when values used by our component gets changed. Otherwise it will rerender on any change.
*/
dependencyTracking?: boolean;
/**
* If cache is empty we can use placeholder data.
*/
initialData?: CacheValueType<ExtractResponseType<T>, ExtractErrorType<T>>["data"] | null;
/**
* Deep comparison function for hook to check for equality in incoming data, to limit rerenders.
*/
deepCompare?: boolean | typeof isEqual;
};
type UseCacheReturnType<T extends RequestInstance> = UseTrackedStateType<T> & UseTrackedStateActions<T> & {
/**
* Helper hook listener for success response
*/
onCacheSuccess: (callback: OnSuccessCallbackType<T>) => void;
/**
* Helper hook listener for error response
*/
onCacheError: (callback: OnErrorCallbackType<T>) => void;
/**
* Helper hook listener for response
*/
onCacheChange: (callback: OnFinishedCallbackType<T>) => void;
/**
* Refetch current request resource or pass custom key to trigger it by invalidationKey(Regex / cacheKey).
*/
refetch: (invalidateKey?: string | RegExp | RequestInstance) => void;
};
declare const useListener: <ListenerType extends ListenerInstance>(listener: ListenerType, options: UseListenerOptionsType) => {
listen: () => void;
onEvent: (callback: (response: {
data: ExtractListenerResponseType<ListenerType>;
extra: ExtractSocketExtraType<ExtractListenerAdapterType<ListenerType>>;
}) => void) => void;
onOpen: (callback: VoidFunction) => void;
onClose: (callback: VoidFunction) => void;
onError: <ErrorType = Event>(callback: (event: ErrorType) => void) => void;
onConnecting: (callback: VoidFunction) => void;
onReconnecting: (callback: (attempts: number) => void) => void;
onReconnectingStop: (callback: (attempts: number) => void) => void;
setData: (data: unknown) => void;
setConnected: (connected: boolean) => void;
setConnecting: (connecting: boolean) => void;
setTimestamp: (timestamp: number) => void;
data: unknown;
connected: boolean;
connecting: boolean;
timestamp: number;
};
type UseListenerOptionsType = {
dependencyTracking?: boolean;
};
declare const useEmitter: <EmitterType extends EmitterInstance>(emitter: EmitterType, options: UseEmitterOptionsType) => {
emit: _hyper_fetch_sockets.EmitType<EmitterType>;
reconnect: number;
onEvent: (callback: (emitter: EmitterType) => void) => void;
onOpen: (callback: VoidFunction) => void;
onClose: (callback: VoidFunction) => void;
onError: <ErrorType = Event>(callback: (event: ErrorType) => void) => void;
onConnecting: (callback: VoidFunction) => void;
onReconnecting: (callback: (attempts: number) => void) => void;
onReconnectingStop: (callback: (attempts: number) => void) => void;
setData: (data: unknown) => void;
setConnected: (connected: boolean) => void;
setConnecting: (connecting: boolean) => void;
setTimestamp: (timestamp: number) => void;
connected: boolean;
connecting: boolean;
timestamp: number;
};
type UseEmitterOptionsType = {
dependencyTracking?: boolean;
};
/**
* Allow to listen to all event messages received with sockets
* @param socket
* @param options
* @returns
*/
declare const useEventMessages: <ResponsesType extends {
endpoint: string;
}>(socket: SocketInstance, options: UseEventMessagesOptionsType<ResponsesType>) => {
onEvent: (callback: (data: ResponsesType, event: MessageEvent<ResponsesType>) => void) => void;
onOpen: (callback: VoidFunction) => void;
onClose: (callback: VoidFunction) => void;
onError: <ErrorType = Event>(callback: (event: ErrorType) => void) => void;
onConnecting: (callback: VoidFunction) => void;
onReconnecting: (callback: (attempts: number) => void) => void;
onReconnectingStop: (callback: (attempts: number) => void) => void;
setData: (data: unknown) => void;
setConnected: (connected: boolean) => void;
setConnecting: (connecting: boolean) => void;
setTimestamp: (timestamp: number) => void;
data: unknown;
connected: boolean;
connecting: boolean;
timestamp: number;
};
type UseEventMessagesOptionsType<ResponsesType> = {
dependencyTracking?: boolean;
filter?: ((endpoint: string, data: ResponsesType) => boolean) | string[];
};
declare const useAppManager: <B extends ClientInstance>(client: B) => UseAppManagerReturnType;
type UseAppManagerReturnType = {
/**
* Is window focused
*/
isFocused: boolean;
/**
* Network online status
*/
isOnline: boolean;
/**
* Network state setter
*/
setOnline: (isOnline: boolean) => void;
/**
* Focus state setter
*/
setFocused: (isFocused: boolean) => void;
};
type ConfigProviderOptionsType<SocketResponses = any> = {
useFetchConfig?: Partial<UseFetchOptionsType<RequestInstance>>;
useSubmitConfig?: Partial<UseSubmitOptionsType<RequestInstance>>;
useCacheConfig?: Partial<UseCacheOptionsType<RequestInstance>>;
useQueueConfig?: Partial<UseQueueOptionsType>;
useListener?: Partial<UseListenerOptionsType>;
useEmitter?: Partial<UseEmitterOptionsType>;
useEventMessages?: Partial<UseEventMessagesOptionsType<SocketResponses>>;
};
type ConfigProviderProps = {
children: React.ReactNode;
config?: ConfigProviderOptionsType;
};
type ConfigProviderValueType = [ConfigProviderOptionsType, (newConfig: ConfigProviderOptionsType) => void];
/**
* Context provider with configuration for hooks
* @param options
* @returns
*/
declare const ConfigProvider: ({ children, config }: ConfigProviderProps) => JSX.Element;
/**
* Hook to allow reading current context config
* @returns
*/
declare const useConfigProvider: () => ConfigProviderValueType;
export { CallbackParameters, ConfigProvider, ConfigProviderOptionsType, ConfigProviderProps, ConfigProviderValueType, InvalidationKeyType, OnErrorCallbackType, OnFinishedCallbackType, OnProgressCallbackType, OnStartCallbackType, OnSuccessCallbackType, QueueRequest, UseAppManagerReturnType, UseCacheOptionsType, UseCacheReturnType, UseEmitterOptionsType, UseEventMessagesOptionsType, UseFetchOptionsType, UseFetchReturnType, UseListenerOptionsType, UseQueueOptionsType, UseQueueReturnType, UseRequestEventsActionsType, UseRequestEventsDataMap, UseRequestEventsLifecycleMap, UseRequestEventsPropsType, UseRequestEventsReturnType, UseSocketStateProps, UseSocketStateType, UseSubmitOptionsType, UseSubmitReturnType, UseTrackedStateActions, UseTrackedStateProps, UseTrackedStateReturn, UseTrackedStateType, getBounceData, getDetailsState, getInitialState, getIsInitiallyLoading, getRefreshTime, getTimestamp, getValidCacheData, initialSocketState, initialState, isEmpty, isEqual, isStaleCacheData, useAppManager, useCache, useCacheDefaultOptions, useConfigProvider, useEmitter, useEventMessages, useFetch, useFetchDefaultOptions, useListener, useQueue, useQueueDefaultOptions, useRequestEvents, useSocketState, useSubmit, useSubmitDefaultOptions, useTrackedState };