import type { Store, Dispatch, Action as ReduxAction, UnknownAction, StoreEnhancer } from 'redux'; import type { TypedUseSelectorHook } from 'react-redux'; import type { Config as ReduxDevToolsConfig, InferComposedStoreExt } from '@redux-devtools/extension'; import type { Location, Settings } from './types.d.js' type UseSelector = (selector: (state: State) => any) => any; interface ClientRenderOptions, Context> { // Gets called on the initial page load, and then on each navigation. onPageRendered?(parameters: { // Relative URL. url: string, // URL `location`. location: Location, // URL pathname parameters. params: Record, // (optional) If `getLoadContext()` function is defined, // this will be the result of calling that function. context?: Context, // Redux `dispatch()` function. dispatch: Dispatch, // Mimicks Redux `useSelector()` hook. useSelector: TypedUseSelectorHook }): void; // Gets called before each navigation. // Doesn't get called on the initial page load. onBeforeNavigate?(parameters: { // URL `location`. location: Location, // URL pathname parameters. params: Record, // (optional) If `getLoadContext()` function is defined, // this will be the result of calling that function. context?: Context, // Redux `dispatch()` function. dispatch: Dispatch, // Mimicks Redux `useSelector()` hook. useSelector: TypedUseSelectorHook }): void; // Redux DevTools settings. devtools?: { // A custom `redux-devtools` `compose` function. // By default, it uses a production-intended (no op?) one. // A developer can supply a development-intended one in a development environment. compose?: (config: ReduxDevToolsConfig) => []>( ...funcs: StoreEnhancers ) => StoreEnhancer>, // The `config` argument that the `compose()` function will be called with. options?: ReduxDevToolsConfig }; // // Reports page loading stats on the server side. // stats?({ // url: string, // route: string, // time: { // loadAndRender: number // } // }): void; // Returns a `context` parameter for the page `.load()` functions. getLoadContext?(parameters: { dispatch: Dispatch }): Context; // Deprecated. // Gets called with a Redux store as an argument. // Is currenly used on Acadeum Course Share website. onStoreCreated?(store: Store): void; } export function render = UnknownAction, Context = any>(settings: Settings, options?: ClientRenderOptions): Promise<{ enableHotReload: () => void }>; // Looks like the `createStore()` function export is deprecated due to being unused. // In case of uncommenting this, `object` would have to be replaced with something proper. // export function createStore(settings: object, options: object | undefined, { stash }): object;