import * as next from 'next'; import { GetServerSidePropsContext, GetServerSidePropsResult, GetServerSideProps, GetStaticPropsContext, GetStaticPropsResult, GetStaticProps } from 'next'; import { c as UniformPreviewData } from '../models-BGg_qtcM.mjs'; import * as _uniformdev_canvas from '@uniformdev/canvas'; import { RouteGetResponseEdgehancedComposition, RouteGetResponseNotFound, RouteGetResponseRedirect, RootComponentInstance, RouteClient, RouteGetParameters } from '@uniformdev/canvas'; import * as node_querystring from 'node:querystring'; import * as _uniformdev_context from '@uniformdev/context'; import { CompositionMetadata } from '@uniformdev/context'; import { ParsedUrlQuery } from 'querystring'; import { ProjectMapNodeGetRequest, ProjectMapNodeGetResponse, ProjectMapClient } from '@uniformdev/project-map'; import { RedirectClient } from '@uniformdev/redirect'; import { GetStaticPropsContext as GetStaticPropsContext$1, GetServerSidePropsContext as GetServerSidePropsContext$1 } from 'next/types'; import '@uniformdev/canvas-react'; type HandleRouteCompositionFunction = (composition: RouteGetResponseEdgehancedComposition, context: TContext, defaultHandler: (composition: RouteGetResponseEdgehancedComposition) => Promise | TResult | null, duration: number) => Promise | TResult | null; type HandleRouteNotFoundFunction = (result: RouteGetResponseNotFound, context: TContext, defaultHandler: (result: RouteGetResponseNotFound) => TResult, duration: number) => TResult; type HandleRouteRedirectFunction = (requestUrl: string, redirect: RouteGetResponseRedirect, context: TContext, defaultHandler: (redirect: RouteGetResponseRedirect) => TResult, duration: number) => TResult; type RouteHandlerOptions = { /** If you need to override the default client, you can pass it here */ client?: RouteClient; /** A string that you want to strip from the resolved context.resolvedUrl. Useful when calling from a nested folder which is not part of your project map structure */ prefix?: string; /** Useful when you need to modify the path passed to the API */ modifyPath?: (path: string, context: TContext) => string; /** The project map ID to connect to. If not set, the default project map for the configured project will be used. */ projectMapId?: string; /** Way to override getRoute request params. Can also be a function to compute options based on context values. */ requestOptions?: Partial | ((context: TContext) => Partial); /** Disables logging of response information and timings */ silent?: boolean; /** Override handling of a composition route response. Return null to signal not found. */ handleComposition?: HandleRouteCompositionFunction; /** Override default handling of a redirect route response */ handleRedirect?: HandleRouteRedirectFunction; /** * Override default handling of a not found route response * NOTE: not called when the API returns a 404 error (project map not found), only when the route result is not found */ handleNotFound?: HandleRouteNotFoundFunction; }; /** * Schema that comes out of route API handler in case of a composition route response. * Should be used together as UniformAppProps in Next.js app. */ type RouteCompositionResult = { matchedRoute: string; dynamicInputs: Record; data: TData; }; /** * Creates an implementation of `getServerSideProps` using the Uniform Route API. * Static and dynamic routing as well as redirection is automatically supported. * Custom behavior can be added by passing in options to hook to specific processing events. */ declare const withUniformGetServerSideProps: >>(options?: RouteHandlerOptions, GetServerSidePropsResult, GetServerSidePropsResult>) => GetServerSideProps; declare const withUniformGetStaticPaths: (options?: { projectMapId?: string; /** Starting path to fetch nodes from */ rootPath?: string; /** A string that you want prepended to paths returned by your project map. Useful when calling from a nested folder which is not part of your project map structure */ prefix?: string; /** Set to true if you want to include draft compositions */ preview?: boolean; /** Way to override getNodes request params */ requestOptions?: Partial; /** Way to modify list of nodes before building array of paths */ callback?: (nodes: ProjectMapNodeGetResponse["nodes"]) => Promise; /** If you need to override the default client, you can pass it here */ client?: ProjectMapClient; /** If you need to override the default redirect client, you can pass it here */ redirectClient?: RedirectClient; }) => () => Promise<{ paths: string[]; fallback: boolean; }>; /** * Creates an implementation of `getStaticProps` using the Uniform Route API. * Static and dynamic routing as well as redirection is automatically supported. * Custom behavior can be added by passing in options to hook to specific processing events. */ declare const withUniformGetStaticProps: >>(options?: RouteHandlerOptions, GetStaticPropsResult, GetStaticPropsResult> & { /** Name of dynamic parameter coming from getStaticPath, usually specified in page file name (e.g. [...slug].jsx will have param = 'slug' */ param?: string; }) => GetStaticProps; /** * Prepends correct locale to the path before sending it to Uniform Route API. * * Recommended default callback for `options.modifyPath` in `withUniformGetStaticProps` and `withUniformGetServerSideProps`. * Should be used together with Next.js Internationalization Routing. * * @see https://nextjs.org/docs/pages/building-your-application/routing/internationalization * @see https://docs.uniform.app/docs/guides/composition/localization#enable-localization-on-your-frontend-application */ declare const prependLocale: (path: string, { locale, defaultLocale, locales }: GetStaticPropsContext$1 | GetServerSidePropsContext$1) => string; /** * Default implementation of getServerSideProps with routes * To configure custom behavior, use: * export getServerSideProps = withUniformGetServerSideProps({ ... }); */ declare const getServerSideProps: next.GetServerSideProps<{ data: _uniformdev_canvas.RootComponentInstance; } & Omit<_uniformdev_context.CompositionMetadata, "compositionId">, node_querystring.ParsedUrlQuery, UniformPreviewData>; /** * Default implementation of getStaticProps with routes * To configure custom behavior, use: * export getStaticProps = withUniformGetStaticProps({ ... }); */ declare const getStaticProps: next.GetStaticProps<{ data: _uniformdev_canvas.RootComponentInstance; } & Omit<_uniformdev_context.CompositionMetadata, "compositionId">, node_querystring.ParsedUrlQuery, UniformPreviewData>; /** * Default implementation of getStaticPaths with routes * To configure custom behavior, use: * export getStaticPaths = withUniformGetStaticProps({ ... }); * * NOTE: fallback must be supported. You cannot generate static paths for dynamic routes which contain query parameters. */ declare const getStaticPaths: () => Promise<{ paths: string[]; fallback: boolean; }>; export { type HandleRouteCompositionFunction, type HandleRouteNotFoundFunction, type HandleRouteRedirectFunction, type RouteCompositionResult, type RouteHandlerOptions, getServerSideProps, getStaticPaths, getStaticProps, prependLocale, withUniformGetServerSideProps, withUniformGetStaticPaths, withUniformGetStaticProps };