1 |
|
2 |
|
3 | import App, { AppContext, AppInitialProps } from 'next/app';
|
4 | import { Store } from 'redux';
|
5 | import { GetServerSideProps, GetServerSidePropsContext, GetStaticProps, GetStaticPropsContext, NextComponentType, NextPageContext } from 'next';
|
6 |
|
7 |
|
8 |
|
9 |
|
10 |
|
11 |
|
12 |
|
13 |
|
14 |
|
15 |
|
16 |
|
17 |
|
18 |
|
19 |
|
20 |
|
21 | export declare const HYDRATE = "__NEXT_REDUX_WRAPPER_HYDRATE__";
|
22 | export declare type MakeStore<S extends Store> = (context: Context) => S;
|
23 | export interface InitStoreOptions<S extends Store> {
|
24 | makeStore: MakeStore<S>;
|
25 | context?: Context;
|
26 | }
|
27 | export declare const createWrapper: <S extends Store<any, import("redux").AnyAction>>(makeStore: MakeStore<S>, config?: Config<S>) => {
|
28 | getServerSideProps: <P extends {} = any>(callback: GetServerSidePropsCallback<S, P>) => GetServerSideProps<P, import("querystring").ParsedUrlQuery, import("next").PreviewData>;
|
29 | getStaticProps: <P_1 extends {} = any>(callback: GetStaticPropsCallback<S, P_1>) => GetStaticProps<P_1, import("querystring").ParsedUrlQuery, import("next").PreviewData>;
|
30 | getInitialAppProps: <P_2 extends {} = any>(callback: AppCallback<S, P_2>) => GetInitialAppProps<P_2>;
|
31 | getInitialPageProps: <P_3 extends {} = any>(callback: PageCallback<S, P_3>) => ((context: NextPageContext<any>) => any) | undefined;
|
32 | withRedux: (Component: NextComponentType | App | any) => {
|
33 | (props: any): JSX.Element;
|
34 | displayName: string;
|
35 | getInitialProps: any;
|
36 | };
|
37 | useWrappedStore: ({ initialState: giapState, initialProps, ...props }: any, displayName?: string) => {
|
38 | store: S;
|
39 | props: any;
|
40 | };
|
41 | };
|
42 | declare const _default: <S extends Store<any, import("redux").AnyAction>>(makeStore: MakeStore<S>, config?: Config<S>) => (Component: any) => {
|
43 | (props: any): JSX.Element;
|
44 | displayName: string;
|
45 | getInitialProps: any;
|
46 | };
|
47 | export default _default;
|
48 | export declare type Context = NextPageContext | AppContext | GetStaticPropsContext | GetServerSidePropsContext;
|
49 | export interface Config<S extends Store> {
|
50 | serializeState?: (state: ReturnType<S['getState']>) => any;
|
51 | deserializeState?: (state: any) => ReturnType<S['getState']>;
|
52 | debug?: boolean;
|
53 | }
|
54 | export interface WrapperProps {
|
55 | initialProps: any;
|
56 | initialState: any;
|
57 | }
|
58 | declare type GetInitialPageProps<P> = NextComponentType<NextPageContext, any, P>['getInitialProps'];
|
59 | declare type GetInitialAppProps<P> = ({ Component, ctx }: AppContext) => Promise<AppInitialProps & {
|
60 | pageProps: P;
|
61 | }>;
|
62 | export declare type GetStaticPropsCallback<S extends Store, P extends {
|
63 | [key: string]: any;
|
64 | }> = (store: S) => GetStaticProps<P>;
|
65 | export declare type GetServerSidePropsCallback<S extends Store, P extends {
|
66 | [key: string]: any;
|
67 | }> = (store: S) => GetServerSideProps<P>;
|
68 | export declare type PageCallback<S extends Store, P> = (store: S) => GetInitialPageProps<P>;
|
69 | export declare type AppCallback<S extends Store, P> = (store: S) => GetInitialAppProps<P>;
|
70 | export declare type Callback<S extends Store, P extends {
|
71 | [key: string]: any;
|
72 | }> = GetStaticPropsCallback<S, P> | GetServerSidePropsCallback<S, P> | PageCallback<S, P> | AppCallback<S, P>;
|
73 | declare module 'next' {
|
74 | interface NextPageContext<S extends Store = any> {
|
75 | |
76 |
|
77 |
|
78 | store: S;
|
79 | }
|
80 | }
|