import type { BasePayload, SanitizedConfig } from 'payload'; import type { ArchiveEntries, ContentOption, ResolvedRoute } from '../content/index.js'; import type { I18nConfig } from '../i18n/index.js'; import type { RobotsRules, SitemapEntry } from '../seo/index.js'; type CreateContentHelpersArgs = { /** * Absolute site origin for sitemap/robots URLs. Falls back to * NEXT_PUBLIC_SERVER_URL, then to a relative origin (which most crawlers * reject, so set one in production). */ baseUrl?: string; /** * The client's payload config promise (the default export of payload.config). * Passed in because the plugin never imports the client's config directly. */ config: Promise | SanitizedConfig; /** Archive-backed collections, same value as the plugin option. */ content?: ContentOption; /** * i18n config. Required only if you want the ready-made `sitemap` / `robots` * handlers — they need the locale list to emit hreflang. */ i18n?: I18nConfig; /** Pages collection slug. Defaults to 'pages'. */ pagesSlug?: string; /** SiteSettings global slug. Defaults to 'site-settings'. */ settingsSlug?: string; }; /** * Bundles the per-request data helpers a frontend needs — the same cached * wrappers every project was writing by hand (getPayload, settings, locale * list, route resolution, archive entries). * * Everything is wrapped in React `cache()`, so within one request a value is * fetched once no matter how many times it's asked for — which matters because * Next runs generateMetadata and the page component separately, and both hit * these. Crucially the Payload instance is cached *here*, once, so every helper * shares it; that's why this is a factory and not loose functions importing a * shared module. * * ```ts * // src/lib/content.ts * import { createContentHelpers } from 'ipal-kit' * import config from '@/payload.config' * import { contentConfig } from '@/content.config' * * export const { getCachedPayload, getSettings, getConfiguredLocales, resolveRoute, getEntries } = * createContentHelpers({ config, content: contentConfig }) * ``` * * `resolveRoute` and `getEntries` are separate on purpose: routing decides what * a URL is, fetching gets the listing. Metadata generation needs the first and * not the second, and a page component composes them in two obvious lines. */ export declare function createContentHelpers({ baseUrl, config, content, i18n, pagesSlug, settingsSlug, }: CreateContentHelpersArgs): { generateStaticParams: () => Promise>; getCachedPayload: () => Promise; getConfiguredLocales: () => Promise; getEntries: (collection: string, locale: string, page: number, perPage: number) => Promise; getSettings: (locale: string) => Promise; resolveRoute: (locale: string, segments: string[] | undefined, page: number) => Promise; robots: () => RobotsRules; sitemap: () => Promise; }; export {};