gate locale behind functional consent

This commit is contained in:
2026-08-12 18:03:11 +02:00
parent 195d4169f5
commit 4bf50514bf
212 changed files with 173 additions and 840 deletions
-12
View File
@@ -1,12 +0,0 @@
/**
* Builds one relationship field per content collection, pointing at the
* client's Pages collection.
*
* Sits alongside the system-page roles (homepage, privacy policy) because it's
* the same idea: a page referenced by function rather than by slug. The
* assignment is locale-agnostic — one page document — while the resulting path
* is locale-aware, since the page's slug is localized. Assign the "Artykuły"
* page once and you get /pl/artykuly and /en/articles from its own slugs.
*/ export { };
//# sourceMappingURL=archiveFields.d.js.map
-1
View File
@@ -1 +0,0 @@
{"version":3,"sources":["archiveFields.d.ts"],"sourcesContent":["import type { Field } from 'payload';\nimport type { ContentOption } from './types.js';\n/**\n * Builds one relationship field per content collection, pointing at the\n * client's Pages collection.\n *\n * Sits alongside the system-page roles (homepage, privacy policy) because it's\n * the same idea: a page referenced by function rather than by slug. The\n * assignment is locale-agnostic — one page document — while the resulting path\n * is locale-aware, since the page's slug is localized. Assign the \"Artykuły\"\n * page once and you get /pl/artykuly and /en/articles from its own slugs.\n */\nexport declare function buildArchiveFields(content: ContentOption, pagesSlug: string): Field[];\n"],"names":[],"mappings":"AAEA;;;;;;;;;CASC,GACD,WAA+F"}
-3
View File
@@ -1,3 +0,0 @@
export { };
//# sourceMappingURL=getArchiveEntries.d.js.map
-1
View File
@@ -1 +0,0 @@
{"version":3,"sources":["getArchiveEntries.d.ts"],"sourcesContent":["import type { BasePayload } from 'payload';\nexport type ArchiveEntries<T = Record<string, unknown>> = {\n docs: T[];\n hasNextPage: boolean;\n hasPrevPage: boolean;\n /** 1-based. */\n page: number;\n totalDocs: number;\n totalPages: number;\n};\ntype GetArchiveEntriesArgs = {\n /** Collection to list, e.g. 'posts'. */\n collection: string;\n /** Relationship depth. Defaults to 1 — enough for a cover image. */\n depth?: number;\n locale: string;\n /** 1-based. Values below 1 are clamped. */\n page?: number;\n payload: BasePayload;\n /** Defaults to 10. */\n perPage?: number;\n /** Payload sort string. Defaults to newest first. */\n sort?: string;\n /** Extra constraints merged into the query, e.g. { category: { equals: id } }. */\n where?: Record<string, unknown>;\n};\n/**\n * Fetches one page of a collection's entries for an archive listing.\n *\n * Only published documents are returned when the collection has drafts enabled;\n * Payload's `where` on `_status` is left to the caller, since a collection\n * without drafts has no such field.\n *\n * Returns pagination facts rather than markup — the listing itself belongs to\n * the client (as a block on the archive page, most likely), because how a list\n * of posts should look isn't something a plugin can decide.\n */\nexport declare function getArchiveEntries<T = Record<string, unknown>>({ collection, depth, locale, page, payload, perPage, sort, where, }: GetArchiveEntriesArgs): Promise<ArchiveEntries<T>>;\nexport {};\n"],"names":[],"mappings":"AAsCA,WAAU"}
-7
View File
@@ -1,7 +0,0 @@
export { buildArchiveFields } from './archiveFields.js';
export { getArchiveEntries } from './getArchiveEntries.js';
export { buildArchivePath, buildEntryPath, parsePageParam } from './paths.js';
export { resolveRoute } from './resolveRoute.js';
export { archiveFieldName } from './types.js';
//# sourceMappingURL=index.d.js.map
-1
View File
@@ -1 +0,0 @@
{"version":3,"sources":["index.d.ts"],"sourcesContent":["export { buildArchiveFields } from './archiveFields.js';\nexport { getArchiveEntries } from './getArchiveEntries.js';\nexport type { ArchiveEntries } from './getArchiveEntries.js';\nexport { buildArchivePath, buildEntryPath, parsePageParam } from './paths.js';\nexport { resolveRoute } from './resolveRoute.js';\nexport type { ResolvedRoute } from './resolveRoute.js';\nexport type { ContentCollectionOption, ContentOption } from './types.js';\nexport { archiveFieldName } from './types.js';\n"],"names":["buildArchiveFields","getArchiveEntries","buildArchivePath","buildEntryPath","parsePageParam","resolveRoute","archiveFieldName"],"mappings":"AAAA,SAASA,kBAAkB,QAAQ,qBAAqB;AACxD,SAASC,iBAAiB,QAAQ,yBAAyB;AAE3D,SAASC,gBAAgB,EAAEC,cAAc,EAAEC,cAAc,QAAQ,aAAa;AAC9E,SAASC,YAAY,QAAQ,oBAAoB;AAGjD,SAASC,gBAAgB,QAAQ,aAAa"}
-3
View File
@@ -1,3 +0,0 @@
export { };
//# sourceMappingURL=paths.d.js.map
-1
View File
@@ -1 +0,0 @@
{"version":3,"sources":["paths.d.ts"],"sourcesContent":["type ArchivePathArgs = {\n /** Archive page's slug in this locale, e.g. 'artykuly'. */\n archiveSlug: string;\n locale: string;\n /** 1-based. Page 1 is omitted from the URL. */\n page?: number;\n};\n/**\n * Path to an archive listing: /pl/artykuly, /pl/artykuly?page=2.\n *\n * Pagination goes in the query string rather than the path. A path segment\n * (/pl/artykuly/2) would be ambiguous with an entry slugged \"2\", and the\n * alternative (/pl/artykuly/strona/2) drags in yet another localized segment to\n * configure and translate. Google has understood ?page= for years, and\n * rel=next/prev — the reason people used to prefer path segments — was retired.\n */\nexport declare function buildArchivePath({ archiveSlug, locale, page }: ArchivePathArgs): string;\ntype EntryPathArgs = {\n /** Archive page's slug in this locale, e.g. 'artykuly'. */\n archiveSlug: string;\n /** Entry's slug in this locale, e.g. 'moj-post'. */\n entrySlug: string;\n locale: string;\n};\n/** Path to a single entry: /pl/artykuly/moj-post. */\nexport declare function buildEntryPath({ archiveSlug, entrySlug, locale }: EntryPathArgs): string;\n/**\n * Reads a page number out of a query parameter.\n *\n * Anything that isn't a positive integer is page 1 — `?page=abc`, `?page=-5`,\n * `?page=1.5` and a repeated `?page=1&page=2` all have to resolve to something,\n * and silently showing the first page beats a 500 on a URL a crawler invented.\n */\nexport declare function parsePageParam(value: string | string[] | undefined): number;\nexport {};\n"],"names":[],"mappings":"AAkCA,WAAU"}
-3
View File
@@ -1,3 +0,0 @@
export { };
//# sourceMappingURL=resolveRoute.d.js.map
-1
View File
@@ -1 +0,0 @@
{"version":3,"sources":["resolveRoute.d.ts"],"sourcesContent":["import type { BasePayload } from 'payload';\nimport type { ContentOption } from './types.js';\nexport type ResolvedRoute = \n/** Locale root — the page assigned as Homepage in System Pages. */\n{\n /** The archive page this entry lives under — its slug is the URL prefix. */\n archive: Record<string, unknown>;\n collection: string;\n doc: Record<string, unknown>;\n type: 'entry';\n}\n/** An ordinary page. */\n | {\n collection: string;\n doc: Record<string, unknown>;\n /** 1-based, from ?page=. */\n page: number;\n perPage: number;\n type: 'archive';\n}\n/** A collection's archive page, e.g. /pl/artykuly. */\n | {\n doc: Record<string, unknown>;\n type: 'home';\n}\n/** A single entry, e.g. /pl/artykuly/moj-post. */\n | {\n doc: Record<string, unknown>;\n type: 'page';\n};\ntype ResolveRouteArgs = {\n content?: ContentOption;\n locale: string;\n /** Page number from the query string (?page=2). Defaults to 1. */\n page?: number;\n /** Client's Pages collection slug. Defaults to 'pages'. */\n pagesSlug?: string;\n payload: BasePayload;\n /** Route segments after the locale, e.g. ['artykuly', 'moj-post']. */\n segments?: string[];\n /** SiteSettings global slug. Defaults to 'site-settings'. */\n settingsSlug?: string;\n};\n/**\n * Works out what a URL points at: the home page, an ordinary page, a\n * collection's archive, or a single entry.\n *\n * Routing only. An archive result says which collection to list and on which\n * page, but doesn't fetch the entries — that's `getArchiveEntries`, called by\n * whoever actually needs them. Keeping the two apart means listing changes\n * (sorting, filtering, pagination) never touch routing rules, and metadata\n * generation doesn't pay for a query it would discard.\n *\n * The trick is that archive prefixes aren't configured anywhere — they're the\n * slug of whichever page an editor assigned as that collection's archive. So\n * /pl/artykuly and /en/articles come from one assignment, and renaming the page\n * moves the whole section.\n *\n * Resolution order matters: a first segment matching an archive's slug wins\n * over an ordinary page of the same name, because an archive *is* a page and\n * would otherwise shadow its own entries.\n *\n * Depth beyond {archive}/{entry} isn't supported — categories in the path would\n * make canonical and hreflang ambiguous (the same entry reachable under several\n * URLs).\n */\nexport declare function resolveRoute({ content, locale, page, pagesSlug, payload, segments, settingsSlug, }: ResolveRouteArgs): Promise<null | ResolvedRoute>;\nexport {};\n"],"names":[],"mappings":"AAmEA,WAAU"}
-15
View File
@@ -1,15 +0,0 @@
/**
* A collection whose entries live under an archive page, e.g. blog posts at
* /pl/artykuly/moj-post.
*
* The collection itself belongs to the client — Payload keeps its schema in
* code, so adding one is always a code change. What this option adds is the
* routing: the plugin exposes an "archive page" assignment in SiteSettings, and
* whichever page an editor picks becomes the URL segment. Rename that page from
* "Artykuły" to "Wpisy" and the path follows, per locale, with no deploy.
*/ /**
* Field name holding a collection's archive page in SiteSettings.
* `posts` → `postsArchive`.
*/ export { };
//# sourceMappingURL=types.d.js.map
-1
View File
@@ -1 +0,0 @@
{"version":3,"sources":["types.d.ts"],"sourcesContent":["/**\n * A collection whose entries live under an archive page, e.g. blog posts at\n * /pl/artykuly/moj-post.\n *\n * The collection itself belongs to the client — Payload keeps its schema in\n * code, so adding one is always a code change. What this option adds is the\n * routing: the plugin exposes an \"archive page\" assignment in SiteSettings, and\n * whichever page an editor picks becomes the URL segment. Rename that page from\n * \"Artykuły\" to \"Wpisy\" and the path follows, per locale, with no deploy.\n */\nexport type ContentCollectionOption = {\n /** Slug of the client's collection, e.g. 'posts'. */\n slug: string;\n /** Admin label for the archive assignment. Defaults to the slug. */\n label?: string;\n /** Entries per page in listings. Defaults to 10. */\n perPage?: number;\n};\n/**\n * Plugin option wiring archive-backed collections into routing.\n */\nexport type ContentOption = {\n collections: ContentCollectionOption[];\n};\n/**\n * Field name holding a collection's archive page in SiteSettings.\n * `posts` → `postsArchive`.\n */\nexport declare function archiveFieldName(collectionSlug: string): string;\n"],"names":[],"mappings":"AAAA;;;;;;;;;CASC,GAeD;;;CAGC,GACD,WAAyE"}