import * as react from 'react'; import { ComponentProps, ReactNode } from 'react'; import { Formats } from 'intl-messageformat'; import { b as DomainConfig, C as Config$1 } from './types-DagT1k5w.js'; import NextForm from 'next/form'; import * as react_jsx_runtime from 'react/jsx-runtime'; import NextLink from 'next/link'; import { NavigateOptions, PrefetchOptions } from 'next/dist/shared/lib/app-router-context.shared-runtime'; import { RedirectType } from 'next/navigation'; /** * An interface to be augmented automatically by NextGlobeGen with the actual schema structure. */ interface SchemaRegister { } type MockSchema = { locales: string[]; unPrefixedLocales: string[]; defaultLocale: string; routes: Record>; domains?: DomainConfig[]; formats?: Partial; }; /** * The routing schema containing all routes, locales, and domain configurations. * This type is augmented automatically by NextGlobeGen with the actual schema from your i18n configuration. */ type Schema = SchemaRegister extends { schema: infer S; } ? S : MockSchema; /** * The routing schema containing all routes, locales, and domain configurations. */ declare const schema: Schema; /** * Union type of all locale codes configured in your application. */ type Locale = Schema["locales"][number]; /** * Union type of all route pathnames in your application. * Includes both static routes and dynamic routes with parameters. */ type Route = keyof Schema["routes"]; /** * Utility type for extracting all static routes */ type ExtractStaticRoutes = T extends `${string}[${string}` ? never : T; /** * All routes without dynamic parameters */ type StaticRoute = ExtractStaticRoutes; /** * All routes with dynamic parameters */ type DynamicRoute = Exclude; /** * Utility type for extracting all possible route param keys */ type ExtractRouteParams = T extends `${infer R}[[${infer P}]]` ? ExtractRouteParams | P : T extends `${string}[${infer P}]${infer R}` ? P | ExtractRouteParams : never; /** * Get the params object type for a given route */ type RouteParams = { [K in ExtractRouteParams as K extends `...${infer R}` ? R : K]: K extends `...${string}` ? string[] : string; }; type ExtractionParams = { /** Used to add description comments to translation files without affecting runtime behavior */ _description?: string; /** Used to provide default messages for translation files without affecting runtime behavior */ _defaultMessage?: string; }; /** * An interface to be augmented automatically by NextGlobeGen with the actual messages structure. */ interface MessagesRegister { } interface NestedMessages { [key: string]: NestedMessages | string; } type MockMessages = Record; /** * All messages for all locales in your application. * This type is augmented at build time with the actual messages structure. */ type Messages = MessagesRegister extends { messages: infer S; } ? S : MockMessages; /** * All messages for all locales in your application. */ declare const messages: Messages; type AllMessages = Messages[Locale]; interface NestedMessagesParams { [key: string]: NestedMessagesParams | Record; } type MockMessagesParams = NestedMessagesParams; /** * Type information for message parameters. * This type is augmented at build time to provide type-safe message parameter access. */ type MessagesParams = MessagesRegister extends { messagesParams: infer P; } ? P : MockMessagesParams; /** * Utility type for extracting all the possible namespaces */ type GetNamespaces = { [Key in keyof T]: T[Key] extends string ? never : `${Key & string}` | `${Key & string}.${GetNamespaces}`; }[keyof T]; /** * All possible namespaces */ type Namespace = GetNamespaces | undefined; /** * Utility type for extracting all the possible message keys from a nested object */ type GetMessageKeys = { [Key in keyof T]: T[Key] extends string ? `${Key & string}` : `${Key & string}.${GetMessageKeys}`; }[keyof T]; /** * Get all keys in the given namespace */ type NamespaceKey = N extends string ? GetMessageKeys> : GetMessageKeys; type GetNestedObjectValue = P extends `${infer Key}.${infer Rest}` ? Key extends keyof O ? GetNestedObjectValue : never : P extends keyof O ? O[P] : never; /** * Get the message parameters type given its namespace and the key in the namespace */ type MessageParams> = GetNestedObjectValue; type ParamsOption = R extends StaticRoute ? { params?: undefined; } : { params: RouteParams; }; type HrefOptions = { pathname: R | (string & {}); locale?: Locale; query?: Record; hash?: string; } & ParamsOption; type UseHrefArgs = (R extends StaticRoute ? [route: R, locale?: Locale, _?: undefined] : [route: R, params: RouteParams, locale?: Locale]) | [options: HrefOptions, _?: undefined, __?: undefined]; type CreateHrefOptions = Omit, "locale"> & { locale: Locale; }; type CreateHrefArgs = (R extends StaticRoute ? [route: R, locale: Locale, _?: undefined] : [route: R, params: RouteParams, locale: Locale]) | [options: CreateHrefOptions, _?: undefined, __?: undefined]; type NextFormProps = ComponentProps; type FormProps = Omit & ({ action: R | Exclude | (string & {}); locale?: Locale; } & ParamsOption); type NextLinkProps = ComponentProps; type LinkProps = Omit & ({ href: HrefOptions; locale?: undefined; params?: undefined; } | ({ href: R | (string & {}); locale?: Locale; } & ParamsOption)); declare function useLocale$1(): Locale; declare function createTranslator$1(locale: Locale, namespace?: N): , A = MessageParams, R = ((children: ReactNode) => ReactNode) extends A[keyof A] ? ReactNode : string>(key: K, ...rest: NoInfer extends Record ? [args?: ExtractionParams] : [args: NoInfer & ExtractionParams]) => NoInfer; declare function getMessages$1(messageKeys: RegExp[] | RegExp): Messages[Locale]; type RedirectArgs> = (R extends StaticRoute ? [route: R | (string & {}), opts?: O] : [route: R | (string & {}), opts: O]) | [ options: HrefOptions, opts?: { type?: RedirectType; params?: undefined; locale?: undefined; } ]; declare function redirect$1(...args: RedirectArgs): never; declare function permanentRedirect$1(...args: RedirectArgs): never; type RevalidateType = "layout" | "page"; type RevalidatePathArgs> = [route: R | (string & {}), opts: O]; declare function revalidatePath$1(...args: RevalidatePathArgs): void; declare const createHref$1: (...args: CreateHrefArgs) => string; declare const getLocale$1: typeof useLocale$1; declare const getSchema$1: () => Schema; declare const getHref$1: (...args: UseHrefArgs) => string; declare const getTranslations$1: (namespace?: N) => , A = MessageParams, R = ((children: react.ReactNode) => react.JSX.Element) extends A[keyof A] ? react.ReactNode : string>(key: K, ...rest: NoInfer extends Record ? [args?: ExtractionParams] : [args: NoInfer & ExtractionParams]) => NoInfer; type IntlProviderProps = { children: ReactNode; locale?: Locale; messages?: Messages[Locale]; schema?: Schema; }; /** * Provider component that makes locale, messages, schema, and formatters available to child components. * Root IntlProvider must include all props, while nested providers can override specific values. * * @example * * * */ declare function IntlProvider(props: IntlProviderProps): react_jsx_runtime.JSX.Element; /** * Returns the current locale code. */ declare const useLocale: () => Locale; /** * Returns the routing schema. */ declare const useSchema: () => Schema; type RouterArgs = Partial, O = N & { locale?: Locale; } & ParamsOption> = (R extends StaticRoute ? [route: R | (string & {}), opts?: O] : [route: R | (string & {}), opts: O]) | [ options: HrefOptions, opts?: N & { params?: undefined; locale?: undefined; } ]; /** * Returns a router object with localized navigation methods. Uses next/navigation's useRouter under the hood. * * @returns An object with push, replace, prefetch, back, forward, and refresh methods. * * @example * const router = useRouter(); * router.push("/about"); * router.push("/users/[id]", { params: { id: "123" } }); * router.push("/about", { locale: "fi" }); */ declare function useRouter(): { back: () => void; forward: () => void; refresh: () => void; push: (...args: RouterArgs) => void; replace: (...args: RouterArgs) => void; prefetch: (...args: RouterArgs>) => void; }; /** * @deprecated Import from "next-globe-gen/config" instead. */ type Config = Config$1; /** * Hook that generates localized URLs for routes. * * @example * const href = useHref("/about"); * const href = useHref("/users/[id]", { id: "123" }); * const href = useHref("/about", "fi"); * const href = useHref({ pathname: "/about", locale: "fi", query: { tab: "overview" } }); */ declare const useHref: (...args: UseHrefArgs) => string; /** * Hook that returns the current route pathname. * * @example * const route = useRoute(); // e.g., "/about" or "/users/[id]" */ declare const useRoute: () => Route; /** * Link component with localized routing support. * * @example * About * User * Tietoja */ declare const Link: ({ href, locale, params, ...linkProps }: LinkProps) => react_jsx_runtime.JSX.Element; /** * Form component with localized routing support. * * @example *
...
*
...
*/ declare const Form: ({ action, locale, params, ...formProps }: FormProps) => react_jsx_runtime.JSX.Element; /** * Hook for accessing and formatting localized messages. * * @example * const t = useTranslations(); * const greeting = t("hello"); * * const t = useTranslations("common"); * const title = t("title"); */ declare const useTranslations: (namespace?: N) => , A = MessageParams, R = ((children: react.ReactNode) => react.JSX.Element) extends A[keyof A] ? react.ReactNode : string>(key: K, ...rest: NoInfer
extends Record ? [args?: ExtractionParams] : [args: NoInfer & ExtractionParams]) => NoInfer; /** * Returns the current locale code. Alias for `useLocale` for async server usage. */ declare const getLocale: typeof getLocale$1; /** * Returns the routing schema containing routes and locale configuration. Alias for `useSchema` for async server usage. */ declare const getSchema: typeof getSchema$1; /** * Generates localized URLs for routes. Alias for `useHref` for async server usage. */ declare const getHref: typeof getHref$1; /** * Accesses and formats localized messages. Alias for `useTranslations` for async server usage. */ declare const getTranslations: typeof getTranslations$1; /** * Redirects to a localized route. Calls next/navigation's redirect under the hood with the localized path. * * @example * redirect("/about"); * redirect("/users/[id]", { params: { id: "123" } }); * redirect("/about", { locale: "fi" }); * redirect({ pathname: "/about", locale: "fi", query: { tab: "overview" } }); */ declare const redirect: typeof redirect$1; /** * Performs a permanent redirect (308) to a localized route. Calls next/navigation's permanentRedirect under the hood with the localized path. * * @example * permanentRedirect("/about"); * permanentRedirect("/users/[id]", { params: { id: "123" } }); * permanentRedirect("/about", { locale: "fi" }); */ declare const permanentRedirect: typeof permanentRedirect$1; /** * Creates a translation function for a specific locale and optional namespace. * * @param locale - The locale to translate for. * @param namespace - Optional namespace to scope translations. * @returns A translation function that can be used to translate message keys. * * @example * const t = createTranslator("en"); * const greeting = t("hello"); * * const tCommon = createTranslator("fi", "common"); * const title = tCommon("title"); */ declare const createTranslator: typeof createTranslator$1; /** * Generates localized URLs for routes. Alias for `useHref` for async server usage. */ declare const createHref: typeof createHref$1; /** * Retrieves messages from the current locale that match the provided regular expressions. * Useful for code splitting and reducing the size of messages sent to the client. * * @param messageKeys - A single RegExp or array of RegExp patterns to match message keys. * @returns An object containing only the matched messages for the current locale. * * @example * const messages = getMessages(/^common\./); * const messages = getMessages([/^common\./, /^errors\./]); */ declare const getMessages: typeof getMessages$1; /** * Revalidates a localized route path on-demand. Calls next/cache's revalidatePath under the hood with the localized path. * * @example * revalidatePath("/about", { locale: "en" }); * revalidatePath("/users/[id]", { params: { id: "123" }, locale: "fi" }); * revalidatePath("/about", { locale: "en", type: "page" }); */ declare const revalidatePath: typeof revalidatePath$1; export { type Config, type DynamicRoute, type ExtractionParams, Form, type FormProps, type GetMessageKeys, type GetNamespaces, type HrefOptions, IntlProvider, Link, type LinkProps, type Locale, type MessageParams, type Messages, type MessagesParams, type MessagesRegister, type Namespace, type NamespaceKey, type Route, type RouteParams, type Schema, type SchemaRegister, type StaticRoute, createHref, createTranslator, getHref, getLocale, getMessages, getSchema, getTranslations, messages, permanentRedirect, redirect, revalidatePath, schema, useHref, useLocale, useRoute, useRouter, useSchema, useTranslations };