@justanarthur/payload-www 0.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (62) hide show
  1. package/README.md +381 -0
  2. package/dist/access.d.ts +11 -0
  3. package/dist/access.js +34 -0
  4. package/dist/blocks.d.ts +24 -0
  5. package/dist/blocks.js +75 -0
  6. package/dist/collections.d.ts +200 -0
  7. package/dist/collections.js +625 -0
  8. package/dist/components.d.ts +6 -0
  9. package/dist/components.js +38 -0
  10. package/dist/config.d.ts +100 -0
  11. package/dist/config.js +914 -0
  12. package/dist/core-access.d.ts +11 -0
  13. package/dist/core-access.js +34 -0
  14. package/dist/core-blocks.d.ts +24 -0
  15. package/dist/core-blocks.js +75 -0
  16. package/dist/core-fields.d.ts +36 -0
  17. package/dist/core-fields.js +134 -0
  18. package/dist/core-utils.d.ts +16 -0
  19. package/dist/core-utils.js +59 -0
  20. package/dist/data-collections.d.ts +200 -0
  21. package/dist/data-collections.js +625 -0
  22. package/dist/data-seed.d.ts +76 -0
  23. package/dist/data-seed.js +212 -0
  24. package/dist/data-test.d.ts +30 -0
  25. package/dist/data-test.js +1018 -0
  26. package/dist/fields.d.ts +36 -0
  27. package/dist/fields.js +134 -0
  28. package/dist/globals.d.ts +48 -0
  29. package/dist/globals.js +228 -0
  30. package/dist/hooks.d.ts +108 -0
  31. package/dist/hooks.js +196 -0
  32. package/dist/imagehash.d.ts +3 -0
  33. package/dist/imagehash.js +24 -0
  34. package/dist/import-map-provider.d.ts +20 -0
  35. package/dist/import-map-provider.js +26 -0
  36. package/dist/index.d.ts +6 -0
  37. package/dist/index.js +38 -0
  38. package/dist/metadata.d.ts +122 -0
  39. package/dist/metadata.js +335 -0
  40. package/dist/pages.d.ts +323 -0
  41. package/dist/pages.js +1016 -0
  42. package/dist/render-components.d.ts +42 -0
  43. package/dist/render-components.js +144 -0
  44. package/dist/render-metadata.d.ts +122 -0
  45. package/dist/render-metadata.js +335 -0
  46. package/dist/render-pages.d.ts +574 -0
  47. package/dist/render-pages.js +1450 -0
  48. package/dist/render-utils.d.ts +158 -0
  49. package/dist/render-utils.js +341 -0
  50. package/dist/seed.d.ts +76 -0
  51. package/dist/seed.js +212 -0
  52. package/dist/server.d.ts +922 -0
  53. package/dist/server.js +2055 -0
  54. package/dist/test.d.ts +30 -0
  55. package/dist/test.js +1018 -0
  56. package/dist/translator.d.ts +2 -0
  57. package/dist/translator.js +24 -0
  58. package/dist/utils.d.ts +16 -0
  59. package/dist/utils.js +59 -0
  60. package/dist/with-www-config.d.ts +100 -0
  61. package/dist/with-www-config.js +914 -0
  62. package/package.json +246 -0
@@ -0,0 +1,335 @@
1
+
2
+ var __defProp = Object.defineProperty;
3
+ var __returnValue = (v) => v;
4
+ function __exportSetter(name, newValue) {
5
+ this[name] = __returnValue.bind(null, newValue);
6
+ }
7
+ var __export = (target, all) => {
8
+ for (var name in all)
9
+ __defProp(target, name, {
10
+ get: all[name],
11
+ enumerable: true,
12
+ configurable: true,
13
+ set: __exportSetter.bind(all, name)
14
+ });
15
+ };
16
+ var __esm = (fn, res) => () => (fn && (res = fn(fn = 0)), res);
17
+
18
+ // src/render/metadata/jsonld.ts
19
+ function getImageUrl(doc, siteUrl) {
20
+ const img = doc?.meta?.image ?? doc?.heroImage ?? doc?.image;
21
+ if (!img)
22
+ return null;
23
+ if (typeof img === "string")
24
+ return img;
25
+ if (img?.url)
26
+ return img.url.startsWith("http") ? img.url : `${siteUrl}${img.url}`;
27
+ return null;
28
+ }
29
+ function resolveLocalizedField(value, locale) {
30
+ if (value == null)
31
+ return "";
32
+ if (typeof value === "string") {
33
+ if (!value.startsWith("{"))
34
+ return value;
35
+ try {
36
+ const parsed = JSON.parse(value);
37
+ return resolveLocalizedField(parsed, locale);
38
+ } catch {
39
+ return value;
40
+ }
41
+ }
42
+ if (typeof value !== "object")
43
+ return "";
44
+ const obj = value;
45
+ if (typeof obj[locale] === "string" && obj[locale].length > 0) {
46
+ return obj[locale];
47
+ }
48
+ return Object.values(obj).filter((v) => typeof v === "string" && v.length > 0).join(" / ");
49
+ }
50
+ function buildArticleLd({
51
+ doc,
52
+ url,
53
+ locale,
54
+ siteUrl,
55
+ type = "BlogPosting",
56
+ publisherName,
57
+ publisherLogo
58
+ }) {
59
+ const name = publisherName ?? new URL(siteUrl).hostname;
60
+ const ld = {
61
+ "@context": "https://schema.org",
62
+ "@type": type,
63
+ "@id": `${url}#article`,
64
+ headline: resolveLocalizedField(doc.title, locale),
65
+ description: resolveLocalizedField(doc.meta?.description ?? doc.description ?? doc.excerpt, locale),
66
+ inLanguage: locale,
67
+ url,
68
+ dateModified: doc.updatedAt ? new Date(doc.updatedAt).toISOString() : undefined
69
+ };
70
+ const datePublished = doc.publishedAt ?? doc.createdAt;
71
+ if (datePublished)
72
+ ld.datePublished = new Date(datePublished).toISOString();
73
+ const imgUrl = getImageUrl(doc, siteUrl);
74
+ if (imgUrl)
75
+ ld.image = imgUrl;
76
+ ld.author = { "@type": "Organization", name, url: siteUrl };
77
+ const publisher = { "@type": "Organization", name };
78
+ if (publisherLogo !== undefined) {
79
+ if (publisherLogo !== null)
80
+ publisher.logo = { "@type": "ImageObject", url: publisherLogo };
81
+ }
82
+ ld.publisher = publisher;
83
+ return ld;
84
+ }
85
+ function buildBreadcrumbsLd({
86
+ items,
87
+ currentUrl
88
+ }) {
89
+ return {
90
+ "@context": "https://schema.org",
91
+ "@type": "BreadcrumbList",
92
+ itemListElement: items.map((item, index) => ({
93
+ "@type": "ListItem",
94
+ position: index + 1,
95
+ name: item.label,
96
+ item: index === items.length - 1 ? currentUrl : item.url
97
+ }))
98
+ };
99
+ }
100
+ function buildOrganizationLd({
101
+ siteUrl,
102
+ name,
103
+ logo,
104
+ sameAs
105
+ }) {
106
+ const org = {
107
+ "@context": "https://schema.org",
108
+ "@type": "Organization",
109
+ "@id": `${siteUrl}#organization`,
110
+ url: siteUrl,
111
+ ...name && { name },
112
+ ...logo && { logo: { "@type": "ImageObject", url: logo } },
113
+ ...sameAs && sameAs.length > 0 && { sameAs }
114
+ };
115
+ return org;
116
+ }
117
+
118
+ // src/render/metadata/hreflang.ts
119
+ async function buildHreflangAlternates({
120
+ siteUrl,
121
+ locale,
122
+ urlPrefix,
123
+ storedSlug,
124
+ queryAllLocaleSlugs,
125
+ nested,
126
+ homeSlug,
127
+ defaultLocale,
128
+ locales,
129
+ localePrefix = "always"
130
+ }) {
131
+ const allLocaleSlugs = await queryAllLocaleSlugs(storedSlug, locale);
132
+ const languages = {};
133
+ const urlFor = (l, slug) => {
134
+ const trimmedPrefix = urlPrefix.replace(/^\/|\/$/g, "");
135
+ const prefixSegment = trimmedPrefix ? `/${trimmedPrefix}` : "";
136
+ const urlPath = slug === homeSlug ? "/" : nested ? "/" + slug.replaceAll("_", "/") : "/" + slug;
137
+ const localeSegment = localePrefix === "never" ? "" : localePrefix === "as-needed" && l === defaultLocale ? "" : `/${l}`;
138
+ return `${siteUrl}${localeSegment}${prefixSegment}${urlPath}`;
139
+ };
140
+ for (const l of locales) {
141
+ const slugForLocale = allLocaleSlugs?.[l];
142
+ if (!slugForLocale)
143
+ continue;
144
+ languages[l] = urlFor(l, slugForLocale);
145
+ }
146
+ if (allLocaleSlugs?.[defaultLocale]) {
147
+ languages["x-default"] = urlFor(defaultLocale, allLocaleSlugs[defaultLocale]);
148
+ }
149
+ return languages;
150
+ }
151
+
152
+ // src/render/metadata/slug.ts
153
+ var SLUG_NESTED_DIVIDER = "_";
154
+ function segmentsToStoredSlug(segments, nested) {
155
+ if (!Array.isArray(segments))
156
+ return segments;
157
+ if (nested)
158
+ return segments.join(SLUG_NESTED_DIVIDER);
159
+ return segments[0] ?? "";
160
+ }
161
+ function segmentsToUrlPath(segments, nested) {
162
+ if (!Array.isArray(segments))
163
+ return "/" + segments;
164
+ if (nested)
165
+ return "/" + segments.join("/");
166
+ return "/" + (segments[0] ?? "");
167
+ }
168
+ function storedSlugToSegments(storedSlug, nested) {
169
+ if (nested)
170
+ return storedSlug.split(SLUG_NESTED_DIVIDER);
171
+ return storedSlug;
172
+ }
173
+ function buildCanonicalUrl({
174
+ siteUrl,
175
+ locale,
176
+ urlPrefix,
177
+ urlPath
178
+ }) {
179
+ const trimmedPrefix = urlPrefix.replace(/^\/|\/$/g, "");
180
+ const prefixSegment = trimmedPrefix ? `/${trimmedPrefix}` : "";
181
+ return `${siteUrl}/${locale}${prefixSegment}${urlPath}`;
182
+ }
183
+ function getUrlPath(segments, nested, homeSlug) {
184
+ const urlPath = segmentsToUrlPath(segments, nested);
185
+ if (nested && !Array.isArray(segments)) {
186
+ if (segments === homeSlug)
187
+ return "/";
188
+ } else if (nested && Array.isArray(segments)) {
189
+ const stored = segments.join(SLUG_NESTED_DIVIDER);
190
+ if (stored === homeSlug)
191
+ return "/";
192
+ }
193
+ return urlPath;
194
+ }
195
+
196
+ // src/render/metadata/query.ts
197
+ import { getPayload } from "payload";
198
+ import { cache } from "react";
199
+
200
+ // src/core/utils/getFromImportMap.ts
201
+ function getFromImportMap(key, importMap) {
202
+ return importMap[key.includes("#") ? key : key + "#default"];
203
+ }
204
+
205
+ // src/render/metadata/query.ts
206
+ var queryDocBySlug = cache(async function queryDocBySlug2({
207
+ collectionSlug,
208
+ slug,
209
+ slugField = "slug",
210
+ locale,
211
+ draft = false,
212
+ config
213
+ }) {
214
+ const payload = await getPayload({ config });
215
+ const result = await payload.find({
216
+ collection: collectionSlug,
217
+ draft,
218
+ limit: 1,
219
+ pagination: false,
220
+ overrideAccess: draft,
221
+ where: { [slugField]: { equals: slug } },
222
+ locale
223
+ });
224
+ return result.docs?.[0] ?? null;
225
+ });
226
+ var queryAllDocs = cache(async function queryAllDocs2({
227
+ collectionSlug,
228
+ slugField = "slug",
229
+ locale,
230
+ config
231
+ }) {
232
+ const payload = await getPayload({ config });
233
+ const result = await payload.find({
234
+ collection: collectionSlug,
235
+ draft: false,
236
+ limit: 1000,
237
+ pagination: false,
238
+ overrideAccess: false,
239
+ select: { [slugField]: true },
240
+ locale
241
+ });
242
+ return result.docs ?? [];
243
+ });
244
+ var queryAllLocaleSlugs = cache(async function queryAllLocaleSlugs2({
245
+ collectionSlug,
246
+ slug,
247
+ slugField = "slug",
248
+ locale,
249
+ config
250
+ }) {
251
+ const payload = await getPayload({ config });
252
+ const result = await payload.find({
253
+ collection: collectionSlug,
254
+ draft: false,
255
+ limit: 1,
256
+ pagination: false,
257
+ overrideAccess: false,
258
+ locale,
259
+ where: { [slugField]: { equals: slug } },
260
+ select: { [slugField]: true }
261
+ });
262
+ const doc = result.docs?.[0];
263
+ if (!doc)
264
+ return;
265
+ const fieldValue = doc?.[slugField];
266
+ if (fieldValue && typeof fieldValue === "object") {
267
+ return fieldValue;
268
+ }
269
+ const resolved = await config;
270
+ const rawLocales = Array.isArray(resolved?.localization?.localeCodes) ? resolved.localization.localeCodes : resolved?.localization?.locales?.map((l) => l.code) ?? [];
271
+ const out = {};
272
+ for (const l of rawLocales)
273
+ out[l] = String(fieldValue ?? slug);
274
+ return out;
275
+ });
276
+ var queryGlobal = cache(async function queryGlobal2({
277
+ globalSlug,
278
+ locale,
279
+ depth = 0,
280
+ draft = false,
281
+ config
282
+ }) {
283
+ const payload = await getPayload({ config });
284
+ try {
285
+ const global = await payload.findGlobal({
286
+ slug: globalSlug,
287
+ depth,
288
+ draft,
289
+ locale
290
+ });
291
+ return global;
292
+ } catch {
293
+ return null;
294
+ }
295
+ });
296
+ function getRenderModuleExports(exportName, collection, importMap) {
297
+ const path = collection?.custom?.path;
298
+ if (!path)
299
+ return;
300
+ const mod = getFromImportMap(path, importMap);
301
+ return mod?.[exportName];
302
+ }
303
+
304
+ // src/exports/metadata.ts
305
+ var metadata_default = {
306
+ buildArticleLd,
307
+ buildBreadcrumbsLd,
308
+ buildOrganizationLd,
309
+ buildHreflangAlternates,
310
+ queryDocBySlug,
311
+ queryAllDocs,
312
+ queryAllLocaleSlugs,
313
+ getUrlPath,
314
+ segmentsToStoredSlug,
315
+ segmentsToUrlPath,
316
+ storedSlugToSegments,
317
+ buildCanonicalUrl,
318
+ getRenderModuleExports
319
+ };
320
+ export {
321
+ storedSlugToSegments,
322
+ segmentsToUrlPath,
323
+ segmentsToStoredSlug,
324
+ queryDocBySlug,
325
+ queryAllLocaleSlugs,
326
+ queryAllDocs,
327
+ getUrlPath,
328
+ getRenderModuleExports,
329
+ metadata_default as default,
330
+ buildOrganizationLd,
331
+ buildHreflangAlternates,
332
+ buildCanonicalUrl,
333
+ buildBreadcrumbsLd,
334
+ buildArticleLd
335
+ };
@@ -0,0 +1,323 @@
1
+ import { ReactElement } from "react";
2
+ import { SanitizedConfig } from "payload";
3
+ type PagesPageProps = {
4
+ /**
5
+ * The resolved page document. The host's `[slug]/page.tsx` route
6
+ * handler is responsible for fetching the doc (via Payload's
7
+ * `getPayload` or via the lib's `createCollectionPageExports`'s
8
+ * `generateMetadata` helper). This component just renders the
9
+ * visual body.
10
+ */
11
+ doc: Record<string, any> | null;
12
+ /**
13
+ * Resolved locale string (already validated upstream by the host's
14
+ * `[locale]` route segment).
15
+ */
16
+ locale: string;
17
+ /**
18
+ * Block components keyed by `blockType`. The host passes the same
19
+ * `importMap` it uses everywhere else; the lib's `RenderBlocks`
20
+ * resolves each block against the map.
21
+ */
22
+ importMap: Record<string, unknown>;
23
+ config: SanitizedConfig;
24
+ };
25
+ /**
26
+ * Default visual body for the Pages collection. Renders the doc's
27
+ * `blocks` field via the lib's `RenderBlocks`. Hosts can replace
28
+ * this by setting a different `custom.path` on their own Pages
29
+ * collection (via the lib's `createPagesCollection` factory) and
30
+ * pointing it at their own Server Component.
31
+ */
32
+ declare function PagesPage({ doc,...props }: PagesPageProps): Promise<ReactElement>;
33
+ import { ReactElement as ReactElement2 } from "react";
34
+ type HeaderPageProps = {
35
+ /** The resolved Header global document. `null` if the host hasn't
36
+ * created a Header yet. */
37
+ data: Record<string, any> | null;
38
+ /**
39
+ * Resolved locale string. The default header visual uses this for
40
+ * per-locale labels via next-intl (if the host has it wired). The
41
+ * default ships without a label dictionary — the host can override
42
+ * by setting a different `custom.path` on the header global.
43
+ */
44
+ locale: string;
45
+ };
46
+ /**
47
+ * Default visual for the `header` global. Renders the header's
48
+ * `nav` blocks (a flat list of `navItem` and `navColumn` blocks) as
49
+ * a simple `<nav>` element.
50
+ *
51
+ * Hosts can replace this visual by setting a different `custom.path`
52
+ * on their own header global (via the lib's `createHeaderGlobal`
53
+ * factory).
54
+ */
55
+ declare function HeaderPage({ data, locale: _locale }: HeaderPageProps): ReactElement2;
56
+ import { ReactElement as ReactElement3 } from "react";
57
+ type FooterPageProps = {
58
+ /** The resolved Footer global document. `null` if the host hasn't
59
+ * created a Footer yet. */
60
+ data: Record<string, any> | null;
61
+ locale: string;
62
+ };
63
+ /**
64
+ * Default visual for the `footer` global. Renders the footer's
65
+ * `nav` blocks (a flat list of `navItem` and `navColumn` blocks)
66
+ * as a simple `<footer>` element.
67
+ *
68
+ * Hosts can replace this visual by setting a different `custom.path`
69
+ * on their own footer global (via the lib's `createFooterGlobal`
70
+ * factory).
71
+ */
72
+ declare function FooterPage({ data, locale: _locale }: FooterPageProps): ReactElement3;
73
+ import { Metadata, MetadataRoute } from "next";
74
+ import { DataFromCollectionSlug, ImportMap, SanitizedConfig as SanitizedConfig2 } from "payload";
75
+ import { ReactElement as ReactElement4, ReactNode } from "react";
76
+ type BreadcrumbItem = {
77
+ label: string;
78
+ url: string;
79
+ };
80
+ type PageExtendProps = {
81
+ importMap: ImportMap;
82
+ config: SanitizedConfig2;
83
+ locale: string;
84
+ };
85
+ type ArticleJsonLdEntry = {
86
+ type: "article";
87
+ id?: string;
88
+ schemaType?: "BlogPosting" | "Article" | "NewsArticle" | "TechArticle";
89
+ publisherName?: string;
90
+ publisherLogo?: string | null;
91
+ };
92
+ type WebSiteJsonLdEntry = {
93
+ type: "website";
94
+ id?: string;
95
+ name?: string;
96
+ alternateName?: string;
97
+ };
98
+ type OrganizationJsonLdEntry = {
99
+ type: "organization";
100
+ id?: string;
101
+ name?: string;
102
+ logo?: string;
103
+ sameAs?: string[];
104
+ };
105
+ type BreadcrumbsJsonLdEntry = {
106
+ type: "breadcrumbs";
107
+ id?: string;
108
+ items?: BreadcrumbItem[];
109
+ buildItems?: (doc: DataFromCollectionSlug<string>, url: string) => BreadcrumbItem[];
110
+ };
111
+ type CustomJsonLdEntry = {
112
+ type: "custom";
113
+ id?: string;
114
+ build: (ctx: {
115
+ doc: DataFromCollectionSlug<string>;
116
+ url: string;
117
+ locale: string;
118
+ siteUrl: string;
119
+ }) => Record<string, unknown>;
120
+ };
121
+ type JsonLdEntry = ArticleJsonLdEntry | WebSiteJsonLdEntry | OrganizationJsonLdEntry | BreadcrumbsJsonLdEntry | CustomJsonLdEntry;
122
+ type JsonLdOutput = {
123
+ id: string;
124
+ schema: Record<string, unknown>;
125
+ };
126
+ /**
127
+ * Minimal next-intl routing contract the lib reads. Hosts pass
128
+ * their `defineRouting({...})` result directly; the lib only needs
129
+ * the shape below.
130
+ *
131
+ * `localePrefix` accepts either the simple string form
132
+ * (`'always' | 'as-needed' | 'never'`) or next-intl's verbose
133
+ * `LocalePrefixConfigVerbose` shape (`{ mode, prefixes? }`). The lib
134
+ * normalizes both to a string `mode` internally.
135
+ */
136
+ type LocalePrefixValue = "always" | "as-needed" | "never" | {
137
+ mode?: "always" | "as-needed" | "never";
138
+ };
139
+ type PageRouting = {
140
+ locales: readonly string[];
141
+ defaultLocale: string;
142
+ localePrefix?: LocalePrefixValue;
143
+ /** Optional human-readable labels per locale (used by the
144
+ * `<LocaleSwitcher>`). Falls back to the locale code when missing.
145
+ * Not part of next-intl's `defineRouting` shape — the host extends
146
+ * its routing object to include it (e.g. via a type assertion). */
147
+ labels?: Record<string, string>;
148
+ };
149
+ type MetadataOptions = {
150
+ urlPrefix?: string;
151
+ /** When true (default), the lib generates a `{type:'website'}` JSON-LD
152
+ * entry per page. Pass an array to specify entries; pass `false` to
153
+ * skip. */
154
+ jsonLd?: boolean | JsonLdEntry[];
155
+ changefreq?: MetadataRoute.Sitemap[number]["changeFrequency"];
156
+ priority?: number;
157
+ /**
158
+ * Override the default `'website'` JSON-LD's `name` field. Only
159
+ * relevant when `jsonLd !== false` and no `name` is set on the
160
+ * auto-generated entry.
161
+ */
162
+ websiteName?: string;
163
+ };
164
+ type ShowcaseOptions = {
165
+ /**
166
+ * Wrap the rendered page in a two-column layout with a sidebar
167
+ * that surfaces the page's metadata, JSON-LD, and a language
168
+ * switcher. Hosts that want a clean render (no sidebar) leave
169
+ * this `false` (the default). The demo's home page enables it
170
+ * so visitors can see every artifact the lib generates in one
171
+ * place.
172
+ */
173
+ enabled?: boolean;
174
+ /** Heading shown above the metadata block. Default: `'Page metadata'`. */
175
+ metadataHeading?: string;
176
+ /** Heading shown above the JSON-LD block. Default: `'JSON-LD'`. */
177
+ jsonLdHeading?: string;
178
+ };
179
+ type CreateCollectionPageExportsArgs<S extends string = "pages"> = {
180
+ config: Promise<SanitizedConfig2>;
181
+ /**
182
+ * Defaults to `'pages'`. The collection slug whose documents the
183
+ * page route renders.
184
+ */
185
+ slug?: S;
186
+ /**
187
+ * The next-intl `defineRouting({...})` result from the host's
188
+ * `i18n/routing.ts`. Drives locale validation, URL building,
189
+ * hreflang alternates, and the language switcher.
190
+ */
191
+ routing: PageRouting;
192
+ /**
193
+ * The host's Payload importMap. The lib uses this to resolve
194
+ * the collection's `custom.path` (the page renderer module) and
195
+ * the live-preview listener. Pass `import { importMap } from
196
+ * '@/app/(payload)/admin/importMap.js'` from the host's page
197
+ * file. Default: `{}` — the page renders without a live-preview
198
+ * listener and uses the lib's registered `custom.path` for the
199
+ * collection renderer (which requires its key to be in the
200
+ * supplied importMap).
201
+ */
202
+ importMap?: ImportMap;
203
+ /**
204
+ * Optional custom path pointing at the host's render module for
205
+ * the collection. Overrides the lib's registered `custom.path`
206
+ * (which defaults to `PAGES_RENDER_PATH`). Use this when you've
207
+ * defined your own Server Component for the collection.
208
+ */
209
+ renderPath?: string;
210
+ };
211
+ type CreateCollectionPageExportsDeps<S extends string> = {
212
+ /**
213
+ * Host's `getServerSideURL()` (returns the absolute site URL).
214
+ */
215
+ getServerSideURL: () => string;
216
+ /**
217
+ * Host's `generateMeta({ doc, url, type, locale })` (returns Next.js
218
+ * `Metadata`). The `doc` is the host's typed collection document
219
+ * (e.g. `Post` for the posts collection, `Page` for pages) with
220
+ * localized fields already resolved for the active locale. Read
221
+ * `doc.title` directly as a string — no locale-lookup needed.
222
+ */
223
+ generateMeta: (args: {
224
+ doc: DataFromCollectionSlug<S> | null;
225
+ url: string;
226
+ type: "website" | "article";
227
+ locale: string;
228
+ }) => Promise<Metadata>;
229
+ /**
230
+ * Override the metadata type passed to `generateMeta` and the
231
+ * JSON-LD entry default. Defaults to `'article'` for the
232
+ * `posts` collection, `'website'` everywhere else. Hosts that
233
+ * want to opt out (e.g. treat a Post like a WebPage) pass
234
+ * `'website'` explicitly here.
235
+ */
236
+ metadataType?: "website" | "article";
237
+ /**
238
+ * Optional showcase configuration. When `enabled: true`, the
239
+ * default page renders inside a `<PageShowcase>` sidebar that
240
+ * surfaces the page's metadata, JSON-LD, and a language
241
+ * switcher — useful for demos and CMS previews. Default: off.
242
+ */
243
+ showcase?: ShowcaseOptions;
244
+ /**
245
+ * Optional content injected after the rendered doc body when the
246
+ * page is the home route (slug = `''`). The lib calls the
247
+ * function with the resolved locale and the current doc (or
248
+ * `null` if no home doc exists). Hosts that want the home to
249
+ * surface additional content — recent pages, recent posts,
250
+ * navigation — pass a function here. The return value is
251
+ * rendered as a sibling of the lib's doc body inside the page
252
+ * (and inside the showcase's main column when showcase is on).
253
+ */
254
+ homeExtras?: (args: {
255
+ locale: string;
256
+ doc: DataFromCollectionSlug<S> | null;
257
+ }) => ReactNode | Promise<ReactNode>;
258
+ };
259
+ /**
260
+ * Build a Pages (or any collection) page route's exports:
261
+ * `default` (the Page Server Component), `generateMetadata`,
262
+ * `generateStaticParams`, and `generateSitemap`.
263
+ *
264
+ * Designed for a next-intl layout: the page lives at
265
+ * `app/(frontend)/[locale]/[...slug]/page.tsx`. The catch-all slug
266
+ * handles both the home route (slug=[]) and any other doc. The lib
267
+ * reads `params.locale` and `params.slug` (string[]), validates
268
+ * the locale against `routing.locales`, fetches the doc, generates
269
+ * metadata + JSON-LD + hreflang alternates, and renders the
270
+ * resolved output.
271
+ *
272
+ * The host's `next-intl/routing` config is the single source of
273
+ * truth for the locale list and URL shape.
274
+ *
275
+ * // app/(frontend)/[locale]/[...slug]/page.tsx
276
+ * import { routing } from '@/i18n/routing'
277
+ * import { createCollectionPageExports } from '@justanarthur/payload-www/render-pages'
278
+ *
279
+ * const { default: Page, generateMetadata, generateStaticParams } =
280
+ * createCollectionPageExports(
281
+ * { config: configPromise, routing },
282
+ * { getServerSideURL, generateMeta, showcase: { enabled: true } }
283
+ * )
284
+ *
285
+ * { generateMetadata, generateStaticParams }
286
+ * Page
287
+ */
288
+ declare function createCollectionPageExports<S extends string = "pages">({ slug, config: configPromise, routing, importMap: importMapArg, renderPath }: CreateCollectionPageExportsArgs<S>, deps: CreateCollectionPageExportsDeps<S>, options?: MetadataOptions): {
289
+ default: (props: {
290
+ params: Promise<{
291
+ locale?: string;
292
+ slug?: string[];
293
+ }>;
294
+ searchParams?: Promise<Record<string, string | string[] | undefined>>;
295
+ }) => Promise<ReactElement4>;
296
+ generateMetadata: (props: {
297
+ params: Promise<{
298
+ locale?: string;
299
+ slug?: string[];
300
+ }>;
301
+ }) => Promise<Metadata>;
302
+ generateStaticParams: () => Promise<Array<{
303
+ slug?: string[];
304
+ locale: string;
305
+ }>>;
306
+ generateSitemap: () => Promise<MetadataRoute.Sitemap>;
307
+ generateJsonLd: (slugSegments: string[], doc: DataFromCollectionSlug<S>, locale: string) => Promise<JsonLdOutput[]>;
308
+ };
309
+ declare function addCollectionsToSitemap(exports: Array<{
310
+ default: () => Promise<MetadataRoute.Sitemap>;
311
+ generateSitemap: () => Promise<MetadataRoute.Sitemap>;
312
+ }>): {
313
+ default: () => Promise<MetadataRoute.Sitemap>;
314
+ generateSitemap: () => Promise<MetadataRoute.Sitemap>;
315
+ };
316
+ declare const _default: {
317
+ createCollectionPageExports: typeof createCollectionPageExports;
318
+ addCollectionsToSitemap: typeof addCollectionsToSitemap;
319
+ PagesPage: typeof PagesPage;
320
+ HeaderPage: typeof HeaderPage;
321
+ FooterPage: typeof FooterPage;
322
+ };
323
+ export { _default as default, createCollectionPageExports, addCollectionsToSitemap, PagesPage, PageExtendProps, MetadataOptions, JsonLdOutput, JsonLdEntry, HeaderPage, FooterPage, CreateCollectionPageExportsDeps, CreateCollectionPageExportsArgs };