import type { AxiosError } from 'axios'; /** The shape the shell's LanguageSwitcher consumes (legacy Unity shape; * generated udp.Language rows are normalized to it). */ export interface SwitcherLanguage { languageId: string; languageCode: string; languageLabel: string; } /** * Fetches the languages offered by the shell's language switcher. Injected via * initializeUnityI18n's options.loadLanguages (mirroring loadTranslations); * createDefaultLanguageLoader builds the stock implementation. */ export type LanguageLoader = () => Promise; /** Record the app-configured language loader (called from initializeUnityI18n). */ export declare const setLanguageLoader: (loader?: LanguageLoader) => void; /** * Build the stock language loader. * * Endpoint-as-probe, mirroring the translation loader's base URL resolution: * the PRODUCT application's generated language list (UdpLanguage) is * authoritative when the product hosts the generated translation stack; any * failure (no base configured, stack not generated there, SPA fallback * answering with index.html) falls back to the legacy Unity language list on * the tenant API. Only a validated array response counts as success. * @param baseUrl * Base API URL hosting the generated UdpLanguage endpoint. Omit to try the * product API. */ export declare const createDefaultLanguageLoader: (baseUrl?: string) => LanguageLoader; /** * Run the app-configured language loader (falling back to the stock one when * no loadLanguages override was supplied at init). * @param force Bypass the session cache and refetch. */ export declare const fetchAvailableLanguages: (force?: boolean) => Promise; export type UseAvailableLanguagesResult = [ { data?: SwitcherLanguage[]; loading: boolean; error?: AxiosError; }, () => Promise ]; /** * Hook wrapper around the language loader with the same * [{ data, loading, error }, refetch] tuple shape as useAxiosGet. * * Deliberately NOT built on useAxiosGet: the stock loader needs try-product- * then-fallback control flow with response validation (a 200 serving the SPA's * index.html must not count as languages), and the product attempt FAILING is * the expected path on apps without the generated stack - useAxiosGet would * route that expected failure through handleResponseErrors. * @param skip Skip fetching (e.g. until the user resolves). * @param loader Override the loader for this consumer only; MUST be * referentially stable (memoized) - a new identity per render refetches. * Omit to use the init-configured loadLanguages / stock probe. */ export declare const useAvailableLanguages: (skip?: boolean, loader?: LanguageLoader) => UseAvailableLanguagesResult; //# sourceMappingURL=languageSource.d.ts.map