@nocode-factory/sanity-kit 2.47.1 → 2.48.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.
- package/README.md +1 -0
- package/dist/aiJsonLd-DiYeDzou.js +170 -0
- package/dist/aiJsonLd-DiYeDzou.js.map +1 -0
- package/dist/finalUrl-C1kzYMzQ.js +273 -0
- package/dist/finalUrl-C1kzYMzQ.js.map +1 -0
- package/dist/{fixCrossLanguageReferences-CQGzpNii.js → fixCrossLanguageReferences-BZk9CkdI.js} +3 -271
- package/dist/fixCrossLanguageReferences-BZk9CkdI.js.map +1 -0
- package/dist/{fixCrossLanguageReferences-CFZax-Nb.d.ts → fixCrossLanguageReferences-CjL_Xy0U.d.ts} +23 -1
- package/dist/index.d.ts +2 -2
- package/dist/index.js +69 -82
- package/dist/index.js.map +1 -1
- package/dist/jsonld.d.ts +79 -0
- package/dist/jsonld.js +225 -0
- package/dist/jsonld.js.map +1 -0
- package/dist/schema.d.ts +2 -2
- package/dist/schema.js +4 -2
- package/dist/schema.js.map +1 -1
- package/package.json +7 -2
- package/src/actions/JsonLdPublish.tsx +69 -0
- package/src/config/resolve.ts +6 -0
- package/src/config/types.ts +24 -0
- package/src/form/JsonLdInput.tsx +191 -0
- package/src/form/jsonLdType.ts +61 -0
- package/src/index.ts +8 -2
- package/src/jsonld.ts +19 -0
- package/src/lib/aiJsonLd.ts +53 -0
- package/src/lib/jsonLdContent.ts +91 -0
- package/src/schema/formTabs.ts +4 -2
- package/src/version.ts +1 -1
- package/dist/fixCrossLanguageReferences-CQGzpNii.js.map +0 -1
package/README.md
CHANGED
|
@@ -107,6 +107,7 @@ Les outils de schéma sont aussi dans l'entrée `@nocode-factory/sanity-kit/sche
|
|
|
107
107
|
| `requiredUnlessDefault` | `@nocode-factory/sanity-kit/schema` | obligatoire sauf valeur par défaut |
|
|
108
108
|
| `componentDefaultsMainDocument({language})` | `@nocode-factory/sanity-kit/schema` | Presentation : page de rendu = valeurs par défaut |
|
|
109
109
|
| `defineCodeEmbedType()` | `@nocode-factory/sanity-kit/code-embed` | type « Code embed » (HTML/CSS/JS, éditeur sombre, iframe sandboxée) |
|
|
110
|
+
| `defineJsonLdType()` | `@nocode-factory/sanity-kit/jsonld` | champ « Données structurées (JSON-LD) » IA, mode auto/manuel (option `jsonLd` du plugin) |
|
|
110
111
|
| `NcfCodeEmbed` | `@nocode-factory/sanity-kit/web` | rendu site d'un bloc « Code embed » |
|
|
111
112
|
| `applyDefaults`, `inherit` | `@nocode-factory/sanity-kit/web/defaults` | héritage côté site |
|
|
112
113
|
| `componentDefaultsQuery` | `@nocode-factory/sanity-kit/web/defaults` | requête des valeurs par défaut |
|
|
@@ -0,0 +1,170 @@
|
|
|
1
|
+
import { createContext, useContext, useMemo } from "react";
|
|
2
|
+
import { jsx } from "react/jsx-runtime";
|
|
3
|
+
const KitContext = createContext(null);
|
|
4
|
+
function KitProvider(props) {
|
|
5
|
+
let { config, issues, children } = props, value = useMemo(() => ({
|
|
6
|
+
config,
|
|
7
|
+
issues
|
|
8
|
+
}), [config, issues]);
|
|
9
|
+
return /* @__PURE__ */ jsx(KitContext.Provider, {
|
|
10
|
+
value,
|
|
11
|
+
children
|
|
12
|
+
});
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* Configuration résolue du kit. Erreur explicite hors contexte : une
|
|
16
|
+
* dépendance oubliée se voit tout de suite au développement.
|
|
17
|
+
*/
|
|
18
|
+
function useKitContext() {
|
|
19
|
+
let value = useContext(KitContext);
|
|
20
|
+
if (!value) throw Error("useKitContext must be called inside a tool of the @nocode-factory/sanity-kit plugin.");
|
|
21
|
+
return value;
|
|
22
|
+
}
|
|
23
|
+
const useKitConfig = () => useKitContext().config, isObj$1 = (v) => typeof v == "object" && !!v && !Array.isArray(v);
|
|
24
|
+
/** Textes d'une valeur, dans l'ordre. */
|
|
25
|
+
function collectTexts(value) {
|
|
26
|
+
if (typeof value == "string") return [value];
|
|
27
|
+
if (!Array.isArray(value)) return [];
|
|
28
|
+
let out = [];
|
|
29
|
+
for (let item of value) if (typeof item == "string") out.push(item);
|
|
30
|
+
else if (isObj$1(item) && Array.isArray(item.children)) for (let child of item.children) isObj$1(child) && typeof child.text == "string" && out.push(child.text);
|
|
31
|
+
return out;
|
|
32
|
+
}
|
|
33
|
+
/** La même valeur avec ses textes remplacés (dans l'ordre de `collectTexts`). */
|
|
34
|
+
function replaceTexts(value, texts) {
|
|
35
|
+
let i = 0, next = () => texts[i++] ?? "";
|
|
36
|
+
return typeof value == "string" ? next() : Array.isArray(value) ? value.map((item) => typeof item == "string" ? next() : isObj$1(item) && Array.isArray(item.children) ? {
|
|
37
|
+
...item,
|
|
38
|
+
children: item.children.map((child) => isObj$1(child) && typeof child.text == "string" ? {
|
|
39
|
+
...child,
|
|
40
|
+
text: next()
|
|
41
|
+
} : child)
|
|
42
|
+
} : item) : value;
|
|
43
|
+
}
|
|
44
|
+
/** `sections[a].title` → segments (`[x]` : clé d'élément de liste, ou rang). */
|
|
45
|
+
function parsePathKey(path) {
|
|
46
|
+
let out = [];
|
|
47
|
+
for (let m of path.matchAll(/([^.[\]]+)|\[([^\]]+)\]/g)) out.push(m[1] === void 0 ? { item: m[2] } : { field: m[1] });
|
|
48
|
+
return out;
|
|
49
|
+
}
|
|
50
|
+
function itemOf(list, key) {
|
|
51
|
+
return list.find((i) => isObj$1(i) && i._key === key) ?? (/^\d+$/.test(key) ? list[Number(key)] : void 0);
|
|
52
|
+
}
|
|
53
|
+
/** Valeur d'un document au chemin `sections[a].title`. */
|
|
54
|
+
function valueAtKey(doc, path) {
|
|
55
|
+
let cur = doc;
|
|
56
|
+
for (let seg of parsePathKey(path)) {
|
|
57
|
+
if (cur == null) return;
|
|
58
|
+
cur = "field" in seg ? isObj$1(cur) ? cur[seg.field] : void 0 : Array.isArray(cur) ? itemOf(cur, seg.item) : void 0;
|
|
59
|
+
}
|
|
60
|
+
return cur;
|
|
61
|
+
}
|
|
62
|
+
/** Écrit `value` au chemin dans `doc` (modifié sur place). Faux si le chemin n'existe pas. */
|
|
63
|
+
function setAtKey(doc, path, value) {
|
|
64
|
+
let segs = parsePathKey(path), cur = doc;
|
|
65
|
+
for (let n = 0; n < segs.length - 1; n++) {
|
|
66
|
+
let seg = segs[n];
|
|
67
|
+
if (cur = "field" in seg ? isObj$1(cur) ? cur[seg.field] : void 0 : Array.isArray(cur) ? itemOf(cur, seg.item) : void 0, cur == null) return !1;
|
|
68
|
+
}
|
|
69
|
+
let last = segs[segs.length - 1];
|
|
70
|
+
return !last || !("field" in last) || !isObj$1(cur) ? !1 : (cur[last.field] = value, !0);
|
|
71
|
+
}
|
|
72
|
+
const isObj = (v) => typeof v == "object" && !!v && !Array.isArray(v), SKIP_KEYS = /* @__PURE__ */ new Set([
|
|
73
|
+
"_type",
|
|
74
|
+
"_id",
|
|
75
|
+
"_rev",
|
|
76
|
+
"_key",
|
|
77
|
+
"_ref",
|
|
78
|
+
"_weak",
|
|
79
|
+
"_createdAt",
|
|
80
|
+
"_updatedAt",
|
|
81
|
+
"_originalId",
|
|
82
|
+
"slug",
|
|
83
|
+
"language",
|
|
84
|
+
"hotspot",
|
|
85
|
+
"crop",
|
|
86
|
+
"asset",
|
|
87
|
+
"marks",
|
|
88
|
+
"markDefs",
|
|
89
|
+
"style",
|
|
90
|
+
"listItem",
|
|
91
|
+
"level",
|
|
92
|
+
"href",
|
|
93
|
+
"noindex"
|
|
94
|
+
]), DEFAULT_JSONLD_FIELD = "jsonLd";
|
|
95
|
+
function walk(value, out, skip, depth) {
|
|
96
|
+
if (!(depth > 12)) {
|
|
97
|
+
if (typeof value == "string") {
|
|
98
|
+
let text = value.trim();
|
|
99
|
+
text && out.push(text);
|
|
100
|
+
return;
|
|
101
|
+
}
|
|
102
|
+
if (Array.isArray(value)) {
|
|
103
|
+
for (let item of value) walk(item, out, skip, depth + 1);
|
|
104
|
+
return;
|
|
105
|
+
}
|
|
106
|
+
if (isObj(value)) for (let [key, val] of Object.entries(value)) skip.has(key) || walk(val, out, skip, depth + 1);
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
/**
|
|
110
|
+
* Texte lisible d'un document, dans l'ordre, prêt à être envoyé à l'IA.
|
|
111
|
+
* `extraSkip` : champs supplémentaires à ignorer (au moins le champ JSON-LD
|
|
112
|
+
* lui-même, pour ne pas renvoyer l'ancien JSON-LD au modèle).
|
|
113
|
+
*/
|
|
114
|
+
function collectDocumentText(doc, extraSkip = [DEFAULT_JSONLD_FIELD]) {
|
|
115
|
+
let skip = new Set(SKIP_KEYS);
|
|
116
|
+
for (let field of extraSkip) skip.add(field);
|
|
117
|
+
let out = [];
|
|
118
|
+
walk(doc, out, skip, 0);
|
|
119
|
+
let seen = /* @__PURE__ */ new Set(), lines = [], size = 0;
|
|
120
|
+
for (let text of out) if (!seen.has(text)) {
|
|
121
|
+
if (seen.add(text), size + text.length > 3e4) break;
|
|
122
|
+
lines.push(text), size += text.length;
|
|
123
|
+
}
|
|
124
|
+
return lines.join("\n");
|
|
125
|
+
}
|
|
126
|
+
/** Titre probable d'un document (pour aider le modèle), sinon chaîne vide. */
|
|
127
|
+
function guessDocumentTitle(doc) {
|
|
128
|
+
if (!isObj(doc)) return "";
|
|
129
|
+
let seo = isObj(doc.seo) ? doc.seo : void 0, candidates = [
|
|
130
|
+
doc.title,
|
|
131
|
+
doc.name,
|
|
132
|
+
doc.heading,
|
|
133
|
+
seo?.metaTitle
|
|
134
|
+
];
|
|
135
|
+
for (let candidate of candidates) if (typeof candidate == "string" && candidate.trim()) return candidate.trim();
|
|
136
|
+
return "";
|
|
137
|
+
}
|
|
138
|
+
const MESSAGES = {
|
|
139
|
+
daily_limit: "Limite IA quotidienne atteinte pour ce projet.",
|
|
140
|
+
project_inactive: "Ce projet n'est pas actif dans le kit NCF.",
|
|
141
|
+
bad_key: "Ce projet n'est pas enregistré dans le kit NCF (npx ncf-kit setup).",
|
|
142
|
+
not_configured: "L'IA n'est pas configurée sur le service du kit NCF.",
|
|
143
|
+
too_long: "Contenu trop long pour générer le JSON-LD en une fois.",
|
|
144
|
+
empty_content: "Aucun contenu à décrire sur cette page.",
|
|
145
|
+
missing_url: "L'URL de la page est introuvable (slug ou URL du site manquant)."
|
|
146
|
+
};
|
|
147
|
+
/**
|
|
148
|
+
* Demande à l'IA le JSON-LD d'une page, à partir de son contenu. Renvoie l'objet
|
|
149
|
+
* JSON-LD (jamais une chaîne). L'appel passe par l'Edge Function `jsonld` du kit,
|
|
150
|
+
* qui détient la clé Anthropic : le Studio ne transmet que sa clé de projet.
|
|
151
|
+
*/
|
|
152
|
+
async function generateJsonLd(service, input) {
|
|
153
|
+
let response = await fetch(`${service.endpoint}/jsonld`, {
|
|
154
|
+
method: "POST",
|
|
155
|
+
headers: { "content-type": "application/json" },
|
|
156
|
+
body: JSON.stringify({
|
|
157
|
+
key: service.projectKey,
|
|
158
|
+
url: input.url,
|
|
159
|
+
locale: input.locale ?? "",
|
|
160
|
+
type: input.type ?? "",
|
|
161
|
+
title: input.title ?? "",
|
|
162
|
+
content: input.content
|
|
163
|
+
})
|
|
164
|
+
}), body = await response.json().catch(() => ({}));
|
|
165
|
+
if (!response.ok || !body.jsonld || typeof body.jsonld != "object") throw Error(MESSAGES[body.error ?? ""] ?? `Génération JSON-LD échouée (${body.error ?? response.status}).`);
|
|
166
|
+
return body.jsonld;
|
|
167
|
+
}
|
|
168
|
+
export { collectTexts as a, valueAtKey as c, useKitContext as d, guessDocumentTitle as i, KitProvider as l, DEFAULT_JSONLD_FIELD as n, replaceTexts as o, collectDocumentText as r, setAtKey as s, generateJsonLd as t, useKitConfig as u };
|
|
169
|
+
|
|
170
|
+
//# sourceMappingURL=aiJsonLd-DiYeDzou.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"aiJsonLd-DiYeDzou.js","names":["isObj"],"sources":["../src/context/KitContext.tsx","../src/lib/aiTexts.ts","../src/lib/jsonLdContent.ts","../src/lib/aiJsonLd.ts"],"sourcesContent":["import {createContext, useContext, useMemo, type ReactNode} from 'react'\nimport type {KitContextValue, ResolvedKitConfig, ConfigIssue} from '../config/types'\n\nconst KitContext = createContext<KitContextValue | null>(null)\n\nexport interface KitProviderProps {\n config: ResolvedKitConfig\n issues: ConfigIssue[]\n children: ReactNode\n}\n\nexport function KitProvider(props: KitProviderProps) {\n const {config, issues, children} = props\n const value = useMemo<KitContextValue>(() => ({config, issues}), [config, issues])\n return <KitContext.Provider value={value}>{children}</KitContext.Provider>\n}\n\n/**\n * Configuration résolue du kit. Erreur explicite hors contexte : une\n * dépendance oubliée se voit tout de suite au développement.\n */\nexport function useKitContext(): KitContextValue {\n const value = useContext(KitContext)\n if (!value) {\n throw new Error('useKitContext must be called inside a tool of the @nocode-factory/sanity-kit plugin.')\n }\n return value\n}\n\nexport const useKitConfig = (): ResolvedKitConfig => useKitContext().config\n","/**\n * Textes d'une valeur de champ, pour la traduction par IA : une chaîne, ou les\n * morceaux de texte (spans) d'un texte riche. La structure (styles, liens, marques,\n * _key) n'est jamais envoyée ni modifiée : seuls les textes sont remplacés.\n */\n\ntype Rec = Record<string, unknown>\nconst isObj = (v: unknown): v is Rec => typeof v === 'object' && v !== null && !Array.isArray(v)\n\n/** Textes d'une valeur, dans l'ordre. */\nexport function collectTexts(value: unknown): string[] {\n if (typeof value === 'string') return [value]\n if (!Array.isArray(value)) return []\n const out: string[] = []\n for (const item of value) {\n if (typeof item === 'string') out.push(item)\n else if (isObj(item) && Array.isArray(item.children))\n for (const child of item.children) if (isObj(child) && typeof child.text === 'string') out.push(child.text)\n }\n return out\n}\n\n/** La même valeur avec ses textes remplacés (dans l'ordre de `collectTexts`). */\nexport function replaceTexts(value: unknown, texts: readonly string[]): unknown {\n let i = 0\n const next = () => texts[i++] ?? ''\n if (typeof value === 'string') return next()\n if (!Array.isArray(value)) return value\n return value.map((item) => {\n if (typeof item === 'string') return next()\n if (isObj(item) && Array.isArray(item.children))\n return {...item, children: item.children.map((child) => (isObj(child) && typeof child.text === 'string' ? {...child, text: next()} : child))}\n return item\n })\n}\n\n/** `sections[a].title` → segments (`[x]` : clé d'élément de liste, ou rang). */\nexport function parsePathKey(path: string): ({field: string} | {item: string})[] {\n const out: ({field: string} | {item: string})[] = []\n for (const m of path.matchAll(/([^.[\\]]+)|\\[([^\\]]+)\\]/g)) out.push(m[1] !== undefined ? {field: m[1]} : {item: m[2]!})\n return out\n}\n\nfunction itemOf(list: unknown[], key: string): unknown {\n return list.find((i) => isObj(i) && i._key === key) ?? (/^\\d+$/.test(key) ? list[Number(key)] : undefined)\n}\n\n/** Valeur d'un document au chemin `sections[a].title`. */\nexport function valueAtKey(doc: unknown, path: string): unknown {\n let cur: unknown = doc\n for (const seg of parsePathKey(path)) {\n if (cur == null) return undefined\n if ('field' in seg) cur = isObj(cur) ? cur[seg.field] : undefined\n else cur = Array.isArray(cur) ? itemOf(cur, seg.item) : undefined\n }\n return cur\n}\n\n/** Écrit `value` au chemin dans `doc` (modifié sur place). Faux si le chemin n'existe pas. */\nexport function setAtKey(doc: Rec, path: string, value: unknown): boolean {\n const segs = parsePathKey(path)\n let cur: unknown = doc\n for (let n = 0; n < segs.length - 1; n++) {\n const seg = segs[n]!\n cur = 'field' in seg ? (isObj(cur) ? cur[seg.field] : undefined) : Array.isArray(cur) ? itemOf(cur, seg.item) : undefined\n if (cur == null) return false\n }\n const last = segs[segs.length - 1]\n if (!last || !('field' in last) || !isObj(cur)) return false\n cur[last.field] = value\n return true\n}\n","/**\n * Assemble le TEXTE d'un document Sanity pour la génération de JSON-LD par IA :\n * titres, descriptions, corps (texte riche compris). On parcourt le document en\n * profondeur et on ne garde que les chaînes lisibles, en écartant la plomberie\n * (identifiants, slugs, styles de texte, références d'images...).\n */\n\ntype Rec = Record<string, unknown>\nconst isObj = (v: unknown): v is Rec => typeof v === 'object' && v !== null && !Array.isArray(v)\n\n/** Clés dont la valeur n'apporte pas de contenu lisible (bruit ou plomberie). */\nconst SKIP_KEYS = new Set([\n '_type',\n '_id',\n '_rev',\n '_key',\n '_ref',\n '_weak',\n '_createdAt',\n '_updatedAt',\n '_originalId',\n 'slug',\n 'language',\n 'hotspot',\n 'crop',\n 'asset',\n 'marks',\n 'markDefs',\n 'style',\n 'listItem',\n 'level',\n 'href',\n 'noindex',\n])\n\nconst MAX_CHARS = 30_000\n\n/** Nom du champ JSON-LD par défaut (écarté du contenu envoyé, pour ne pas boucler). */\nexport const DEFAULT_JSONLD_FIELD = 'jsonLd'\n\nfunction walk(value: unknown, out: string[], skip: Set<string>, depth: number): void {\n if (depth > 12) return\n if (typeof value === 'string') {\n const text = value.trim()\n if (text) out.push(text)\n return\n }\n if (Array.isArray(value)) {\n for (const item of value) walk(item, out, skip, depth + 1)\n return\n }\n if (isObj(value)) {\n for (const [key, val] of Object.entries(value)) {\n if (skip.has(key)) continue\n walk(val, out, skip, depth + 1)\n }\n }\n}\n\n/**\n * Texte lisible d'un document, dans l'ordre, prêt à être envoyé à l'IA.\n * `extraSkip` : champs supplémentaires à ignorer (au moins le champ JSON-LD\n * lui-même, pour ne pas renvoyer l'ancien JSON-LD au modèle).\n */\nexport function collectDocumentText(doc: unknown, extraSkip: readonly string[] = [DEFAULT_JSONLD_FIELD]): string {\n const skip = new Set(SKIP_KEYS)\n for (const field of extraSkip) skip.add(field)\n const out: string[] = []\n walk(doc, out, skip, 0)\n // Dédoublonne en gardant l'ordre : un même libellé répété n'aide pas le modèle.\n const seen = new Set<string>()\n const lines: string[] = []\n let size = 0\n for (const text of out) {\n if (seen.has(text)) continue\n seen.add(text)\n if (size + text.length > MAX_CHARS) break\n lines.push(text)\n size += text.length\n }\n return lines.join('\\n')\n}\n\n/** Titre probable d'un document (pour aider le modèle), sinon chaîne vide. */\nexport function guessDocumentTitle(doc: unknown): string {\n if (!isObj(doc)) return ''\n const seo = isObj(doc.seo) ? doc.seo : undefined\n const candidates = [doc.title, doc.name, doc.heading, seo?.metaTitle]\n for (const candidate of candidates) if (typeof candidate === 'string' && candidate.trim()) return candidate.trim()\n return ''\n}\n","/** Service du kit (même clé de projet et même adresse que l'historique et la traduction). */\nexport interface JsonLdService {\n endpoint: string\n projectKey: string\n}\n\n/** Ce que le Studio envoie pour décrire la page à l'IA. */\nexport interface JsonLdRequest {\n /** URL absolue de la page en ligne (sert d'`url`/`@id`). */\n url: string\n /** Langue de la page (BCP 47), devient `inLanguage`. */\n locale?: string\n /** Indice sur la nature de la page (type Sanity, ou « article »...). */\n type?: string\n /** Titre de la page. */\n title?: string\n /** Texte de la page (titres, descriptions, corps), assemblé par le Studio. */\n content: string\n}\n\nconst MESSAGES: Record<string, string> = {\n daily_limit: 'Limite IA quotidienne atteinte pour ce projet.',\n project_inactive: \"Ce projet n'est pas actif dans le kit NCF.\",\n bad_key: \"Ce projet n'est pas enregistré dans le kit NCF (npx ncf-kit setup).\",\n not_configured: \"L'IA n'est pas configurée sur le service du kit NCF.\",\n too_long: 'Contenu trop long pour générer le JSON-LD en une fois.',\n empty_content: 'Aucun contenu à décrire sur cette page.',\n missing_url: \"L'URL de la page est introuvable (slug ou URL du site manquant).\",\n}\n\n/**\n * Demande à l'IA le JSON-LD d'une page, à partir de son contenu. Renvoie l'objet\n * JSON-LD (jamais une chaîne). L'appel passe par l'Edge Function `jsonld` du kit,\n * qui détient la clé Anthropic : le Studio ne transmet que sa clé de projet.\n */\nexport async function generateJsonLd(service: JsonLdService, input: JsonLdRequest): Promise<Record<string, unknown>> {\n const response = await fetch(`${service.endpoint}/jsonld`, {\n method: 'POST',\n headers: {'content-type': 'application/json'},\n body: JSON.stringify({\n key: service.projectKey,\n url: input.url,\n locale: input.locale ?? '',\n type: input.type ?? '',\n title: input.title ?? '',\n content: input.content,\n }),\n })\n const body = (await response.json().catch(() => ({}))) as {jsonld?: Record<string, unknown>; error?: string}\n if (!response.ok || !body.jsonld || typeof body.jsonld !== 'object')\n throw new Error(MESSAGES[body.error ?? ''] ?? `Génération JSON-LD échouée (${body.error ?? response.status}).`)\n return body.jsonld\n}\n"],"mappings":";;AAGA,MAAM,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AI,IAAI,MAAM,KAAA,GACjC,aAAa;EAAC,IAAI;EAAO,IAAI;EAAM,IAAI;EAAS,KAAK;CAAS;CACpE,KAAK,IAAM,aAAa,YAAY,IAAI,OAAO,aAAc,YAAY,UAAU,KAAK,GAAG,OAAO,UAAU,KAAK;CACjH,OAAO;AACT;ACtEA,MAAM,WAAmC;CACvC,aAAa;CACb,kBAAkB;CAClB,SAAS;CACT,gBAAgB;CAChB,UAAU;CACV,eAAe;CACf,aAAa;AACf;;;;;;AAOA,eAAsB,eAAe,SAAwB,OAAwD;CACnH,IAAM,WAAW,MAAM,MAAM,GAAG,QAAQ,SAAS,UAAU;EACzD,QAAQ;EACR,SAAS,EAAC,gBAAgB,mBAAkB;EAC5C,MAAM,KAAK,UAAU;GACnB,KAAK,QAAQ;GACb,KAAK,MAAM;GACX,QAAQ,MAAM,UAAU;GACxB,MAAM,MAAM,QAAQ;GACpB,OAAO,MAAM,SAAS;GACtB,SAAS,MAAM;EACjB,CAAC;CACH,CAAC,GACK,OAAQ,MAAM,SAAS,KAAK,CAAC,CAAC,aAAa,CAAC,EAAE;CACpD,IAAI,CAAC,SAAS,MAAM,CAAC,KAAK,UAAU,OAAO,KAAK,UAAW,UACzD,MAAU,MAAM,SAAS,KAAK,SAAS,OAAO,+BAA+B,KAAK,SAAS,SAAS,OAAO,GAAG;CAChH,OAAO,KAAK;AACd"}
|
|
@@ -0,0 +1,273 @@
|
|
|
1
|
+
const DEFAULT_PAGE_BUILDER_FIELD = "sections", DEFAULT_SLUG_FIELD = "slug", DEFAULT_TITLE_FIELD = "title", DEFAULT_NOINDEX_FIELDS = ["seo.noindex", "noindex"], DEFAULT_I18N = {
|
|
2
|
+
field: "language",
|
|
3
|
+
locales: []
|
|
4
|
+
}, DEFAULT_COMPONENT_PREVIEW = {
|
|
5
|
+
provider: "designSystemPage",
|
|
6
|
+
path: "/design-system",
|
|
7
|
+
anchor: "{name}",
|
|
8
|
+
thumbnail: "/sections/{name}.png",
|
|
9
|
+
defaultsType: "componentDefaults",
|
|
10
|
+
live: "/design-system/composant?type={name}"
|
|
11
|
+
}, DEFAULT_TOOLS = {
|
|
12
|
+
pages: !0,
|
|
13
|
+
components: !0,
|
|
14
|
+
history: !0,
|
|
15
|
+
designSystem: !0
|
|
16
|
+
}, DEFAULT_TOOLBAR_MORE = [
|
|
17
|
+
"vision",
|
|
18
|
+
"releases",
|
|
19
|
+
"schedules"
|
|
20
|
+
], DEFAULT_BOARD_TAGS = [
|
|
21
|
+
{
|
|
22
|
+
id: "en-cours",
|
|
23
|
+
label: "In progress",
|
|
24
|
+
color: "#f5a623"
|
|
25
|
+
},
|
|
26
|
+
{
|
|
27
|
+
id: "fait",
|
|
28
|
+
label: "Done",
|
|
29
|
+
color: "#43d675"
|
|
30
|
+
},
|
|
31
|
+
{
|
|
32
|
+
id: "a-relire",
|
|
33
|
+
label: "To review",
|
|
34
|
+
color: "#2276fc"
|
|
35
|
+
},
|
|
36
|
+
{
|
|
37
|
+
id: "a-refondre",
|
|
38
|
+
label: "To rework",
|
|
39
|
+
color: "#f03e3e"
|
|
40
|
+
}
|
|
41
|
+
], DEFAULT_INTERNAL_FIELDS = [
|
|
42
|
+
{
|
|
43
|
+
id: "owner",
|
|
44
|
+
label: "Owner",
|
|
45
|
+
type: "text"
|
|
46
|
+
},
|
|
47
|
+
{
|
|
48
|
+
id: "audience",
|
|
49
|
+
label: "Audience",
|
|
50
|
+
type: "text"
|
|
51
|
+
},
|
|
52
|
+
{
|
|
53
|
+
id: "role",
|
|
54
|
+
label: "Page role",
|
|
55
|
+
type: "text"
|
|
56
|
+
}
|
|
57
|
+
], trimTrailingSlash = (url) => url.replace(/\/+$/, ""), normalizePath = (path) => {
|
|
58
|
+
let trimmed = path.trim();
|
|
59
|
+
if (!trimmed || trimmed === "/") return "/";
|
|
60
|
+
let withSlash = trimmed.startsWith("/") ? trimmed : `/${trimmed}`;
|
|
61
|
+
return withSlash.length > 1 ? trimTrailingSlash(withSlash) : withSlash;
|
|
62
|
+
};
|
|
63
|
+
function resolvePageType(entry, defaults) {
|
|
64
|
+
if (typeof entry == "string") return {
|
|
65
|
+
type: entry.trim(),
|
|
66
|
+
slugField: defaults.slugField,
|
|
67
|
+
path: null,
|
|
68
|
+
pathPrefix: null,
|
|
69
|
+
localizedPrefixes: null,
|
|
70
|
+
titleField: defaults.titleField
|
|
71
|
+
};
|
|
72
|
+
let path = typeof entry.path == "string" ? normalizePath(entry.path) : null, slugField = entry.slugField === null ? null : entry.slugField?.trim() || defaults.slugField, prefix = typeof entry.pathPrefix == "string" ? normalizePath(entry.pathPrefix) : "/";
|
|
73
|
+
return {
|
|
74
|
+
type: (entry.type ?? "").trim(),
|
|
75
|
+
slugField: path ? null : slugField,
|
|
76
|
+
path,
|
|
77
|
+
pathPrefix: prefix === "/" ? null : prefix,
|
|
78
|
+
localizedPrefixes: entry.localizedPrefixes ? Object.fromEntries(Object.entries(entry.localizedPrefixes).map(([l, p]) => [l, normalizePath(p) === "/" ? "" : normalizePath(p)])) : null,
|
|
79
|
+
titleField: entry.titleField?.trim() || defaults.titleField
|
|
80
|
+
};
|
|
81
|
+
}
|
|
82
|
+
/** Applique les valeurs par défaut. Ne valide rien : voir `validateConfig`. */
|
|
83
|
+
function resolveConfig(input) {
|
|
84
|
+
let slugField = input.slugField?.trim() || "slug", titleField = input.titleField?.trim() || "title", pageTypes = (Array.isArray(input.pageTypes) ? input.pageTypes : []).map((entry) => resolvePageType(entry, {
|
|
85
|
+
slugField,
|
|
86
|
+
titleField
|
|
87
|
+
})), i18n = input.i18n === !1 || input.i18n === void 0 ? null : (() => {
|
|
88
|
+
let locales = (input.i18n.locales ?? DEFAULT_I18N.locales).map((l) => l.trim()).filter(Boolean), defaultLocale = input.i18n.defaultLocale?.trim() || locales[0] || "";
|
|
89
|
+
return {
|
|
90
|
+
field: input.i18n.field?.trim() || DEFAULT_I18N.field,
|
|
91
|
+
defaultLocale,
|
|
92
|
+
locales,
|
|
93
|
+
defaultsSourceLocale: input.i18n.defaultsSourceLocale?.trim() || defaultLocale
|
|
94
|
+
};
|
|
95
|
+
})();
|
|
96
|
+
return {
|
|
97
|
+
pageTypes,
|
|
98
|
+
codedPages: (input.siteRoutes?.fixed ?? []).filter((f) => f.pageSlug && !f.homePage && !f.system && !f.notFound).map((f) => ({
|
|
99
|
+
pageSlug: f.pageSlug,
|
|
100
|
+
path: normalizePath(f.path),
|
|
101
|
+
localized: f.localized ?? null
|
|
102
|
+
})),
|
|
103
|
+
redirectType: input.redirectType?.trim() || "redirect",
|
|
104
|
+
pageTypeNames: pageTypes.map((p) => p.type).filter(Boolean),
|
|
105
|
+
pageBuilderField: input.pageBuilderField?.trim() || "sections",
|
|
106
|
+
blockNamespace: input.blockNamespace ?? "",
|
|
107
|
+
noindexFields: input.noindexField ? [input.noindexField].flat().map((field) => field.trim()).filter(Boolean) : DEFAULT_NOINDEX_FIELDS,
|
|
108
|
+
previewUrl: input.previewUrl ? trimTrailingSlash(input.previewUrl.trim()) : null,
|
|
109
|
+
environments: resolveEnvironments(input),
|
|
110
|
+
pageThumbnail: input.pageThumbnail?.trim() || null,
|
|
111
|
+
i18n,
|
|
112
|
+
componentPreview: {
|
|
113
|
+
provider: input.componentPreview?.provider ?? DEFAULT_COMPONENT_PREVIEW.provider,
|
|
114
|
+
path: input.componentPreview?.path ?? DEFAULT_COMPONENT_PREVIEW.path,
|
|
115
|
+
anchor: input.componentPreview?.anchor ?? DEFAULT_COMPONENT_PREVIEW.anchor,
|
|
116
|
+
thumbnail: input.componentPreview?.thumbnail ?? DEFAULT_COMPONENT_PREVIEW.thumbnail,
|
|
117
|
+
defaultsType: input.componentPreview?.defaultsType ?? DEFAULT_COMPONENT_PREVIEW.defaultsType,
|
|
118
|
+
live: input.componentPreview?.live ?? DEFAULT_COMPONENT_PREVIEW.live
|
|
119
|
+
},
|
|
120
|
+
serviceEndpoint: input.serviceEndpoint === !1 ? null : trimTrailingSlash((input.serviceEndpoint || "https://dkoxgivytgsmvqmjvmjt.supabase.co/functions/v1").trim()),
|
|
121
|
+
history: input.history?.projectKey?.trim() ? {
|
|
122
|
+
projectKey: input.history.projectKey.trim(),
|
|
123
|
+
endpoint: trimTrailingSlash((input.history.endpoint || input.serviceEndpoint || "https://dkoxgivytgsmvqmjvmjt.supabase.co/functions/v1").trim())
|
|
124
|
+
} : null,
|
|
125
|
+
jsonLd: input.jsonLd?.enabled && input.history?.projectKey?.trim() ? { field: input.jsonLd.field?.trim() || "jsonLd" } : null,
|
|
126
|
+
tools: {
|
|
127
|
+
...DEFAULT_TOOLS,
|
|
128
|
+
...input.tools
|
|
129
|
+
},
|
|
130
|
+
moreTools: input.moreTools === !1 ? [] : input.moreTools ?? DEFAULT_TOOLBAR_MORE,
|
|
131
|
+
boardTags: input.boardTags?.length ? input.boardTags : DEFAULT_BOARD_TAGS,
|
|
132
|
+
internalFields: input.internalFields?.length ? input.internalFields : DEFAULT_INTERNAL_FIELDS,
|
|
133
|
+
documentColumns: (input.documentColumns ?? []).map((column) => ({
|
|
134
|
+
key: column.key.trim(),
|
|
135
|
+
label: column.label?.trim() || column.key.trim(),
|
|
136
|
+
paths: [column.path].flat().map((path) => path.trim()).filter(Boolean),
|
|
137
|
+
type: column.type ?? "text"
|
|
138
|
+
}))
|
|
139
|
+
};
|
|
140
|
+
}
|
|
141
|
+
/**
|
|
142
|
+
* Préproduction déduite de la production, par convention.
|
|
143
|
+
*
|
|
144
|
+
* NoCode Factory assigne à chaque projet un domaine Vercel **fixe** pour la
|
|
145
|
+
* branche `preprod`, de la forme `preview-<projet>.vercel.app`. Fixe parce
|
|
146
|
+
* qu'un lien de partage doit survivre au commit suivant : une URL de
|
|
147
|
+
* déploiement change à chaque poussée, un domaine assigné non.
|
|
148
|
+
*
|
|
149
|
+
* La déduire évite de la déclarer neuf fois. Elle n'est proposée que pour un
|
|
150
|
+
* hôte Vercel — ailleurs la convention ne s'applique pas — et `environments`
|
|
151
|
+
* la remplace dès qu'on la déclare explicitement.
|
|
152
|
+
*/
|
|
153
|
+
function conventionalPreprodUrl(previewUrl) {
|
|
154
|
+
if (!previewUrl) return null;
|
|
155
|
+
try {
|
|
156
|
+
let url = new URL(previewUrl);
|
|
157
|
+
return !url.hostname.endsWith(".vercel.app") || url.hostname.startsWith("preview-") ? null : `${url.protocol}//preview-${url.hostname}`;
|
|
158
|
+
} catch {
|
|
159
|
+
return null;
|
|
160
|
+
}
|
|
161
|
+
}
|
|
162
|
+
/**
|
|
163
|
+
* Environnements d'aperçu.
|
|
164
|
+
*
|
|
165
|
+
* `previewUrl` en fournit toujours un, nommé « Production » : un projet qui
|
|
166
|
+
* n'en déclare pas d'autres doit quand même pouvoir basculer entre brouillons
|
|
167
|
+
* et contenu en ligne.
|
|
168
|
+
*
|
|
169
|
+
* Quand `environments` mentionne déjà `previewUrl`, on ne le double pas.
|
|
170
|
+
*/
|
|
171
|
+
function resolveEnvironments(input) {
|
|
172
|
+
let declared = (input.environments ?? []).map((environment) => ({
|
|
173
|
+
id: environment.id.trim(),
|
|
174
|
+
label: environment.label?.trim() || environment.id.trim(),
|
|
175
|
+
url: trimTrailingSlash((environment.url ?? "").trim())
|
|
176
|
+
})).filter((environment) => environment.id && environment.url), preview = input.previewUrl ? trimTrailingSlash(input.previewUrl.trim()) : null;
|
|
177
|
+
if (!preview) return declared;
|
|
178
|
+
let production = declared.some((environment) => environment.url === preview) ? [] : [{
|
|
179
|
+
id: "production",
|
|
180
|
+
label: "Production",
|
|
181
|
+
url: preview
|
|
182
|
+
}], conventional = conventionalPreprodUrl(preview), hasPreprod = declared.some((environment) => environment.url === conventional || environment.id === "preprod") || input.preprodUrl === !1, preprod = conventional && !hasPreprod ? [{
|
|
183
|
+
id: "preprod",
|
|
184
|
+
label: "Staging",
|
|
185
|
+
url: conventional
|
|
186
|
+
}] : [];
|
|
187
|
+
return [
|
|
188
|
+
...production,
|
|
189
|
+
...preprod,
|
|
190
|
+
...declared
|
|
191
|
+
];
|
|
192
|
+
}
|
|
193
|
+
/**
|
|
194
|
+
* Chemin d'une page sur le site. Le chemin fixe l'emporte sur le slug, le
|
|
195
|
+
* préfixe du type se place devant le slug ('/blog' + 'mon-article'), et la
|
|
196
|
+
* langue par défaut n'est pas préfixée (convention Next.js du starter).
|
|
197
|
+
*/
|
|
198
|
+
function toPath(input, i18n) {
|
|
199
|
+
let localized = input.locale ? input.localizedPrefixes?.[input.locale] : void 0, raw = localized === void 0 ? input.pathPrefix : localized, prefix = typeof raw == "string" && raw ? normalizePath(raw) : "/", base = typeof input.path == "string" && input.path ? normalizePath(input.path) : input.slug ? normalizePath(prefix === "/" ? input.slug : `${prefix}/${input.slug.replace(/^\/+/, "")}`) : null;
|
|
200
|
+
return base === null ? null : !i18n || !input.locale || input.locale === i18n.defaultLocale ? base : base === "/" ? `/${input.locale}` : `/${input.locale}${base}`;
|
|
201
|
+
}
|
|
202
|
+
/** URL absolue d'une page, ou `null` si le front n'est pas configuré. */
|
|
203
|
+
function toUrl(previewUrl, path) {
|
|
204
|
+
return !previewUrl || path === null ? null : path === "/" ? previewUrl : `${previewUrl}${path}`;
|
|
205
|
+
}
|
|
206
|
+
/** Segments d'un chemin : '/services/plomberie' -> ['services', 'plomberie']. */
|
|
207
|
+
function segments(path) {
|
|
208
|
+
return path.split("/").filter(Boolean);
|
|
209
|
+
}
|
|
210
|
+
/** Profondeur dans l'arborescence. '/' vaut 0. */
|
|
211
|
+
function depth(path) {
|
|
212
|
+
return segments(path).length;
|
|
213
|
+
}
|
|
214
|
+
/**
|
|
215
|
+
* Chemin du parent, ou `null` à la racine. Sert au placement automatique du
|
|
216
|
+
* board : '/services/plomberie' -> '/services'.
|
|
217
|
+
*/
|
|
218
|
+
function parentPath(path) {
|
|
219
|
+
let parts = segments(path);
|
|
220
|
+
return parts.length === 0 ? null : parts.length === 1 ? "/" : `/${parts.slice(0, -1).join("/")}`;
|
|
221
|
+
}
|
|
222
|
+
/** Le type de page correspondant à un document. */
|
|
223
|
+
function pageTypeFor(type, pageTypes) {
|
|
224
|
+
return pageTypes.find((p) => p.type === type);
|
|
225
|
+
}
|
|
226
|
+
/** Clé de comparaison des redirections (comme le site) : minuscules, sans « / » final, sans ? ni #. */
|
|
227
|
+
const redirectKey = (path) => {
|
|
228
|
+
let clean = (path.trim().split(/[?#]/)[0] ?? "").toLowerCase();
|
|
229
|
+
return clean.length > 1 ? clean.replace(/\/+$/, "") : clean;
|
|
230
|
+
};
|
|
231
|
+
function redirectMapOf(rows) {
|
|
232
|
+
let map = /* @__PURE__ */ new Map();
|
|
233
|
+
for (let r of rows) {
|
|
234
|
+
if (!r.from?.startsWith("/") || !r.to) continue;
|
|
235
|
+
let key = redirectKey(r.from);
|
|
236
|
+
key !== redirectKey(r.to) && !map.has(key) && map.set(key, r.to.trim());
|
|
237
|
+
}
|
|
238
|
+
return map;
|
|
239
|
+
}
|
|
240
|
+
/** Destination finale d'une adresse (chaîne de redirections suivie, boucles ignorées). */
|
|
241
|
+
function followRedirects(path, redirects) {
|
|
242
|
+
if (!redirects?.size) return path;
|
|
243
|
+
let current = path, seen = /* @__PURE__ */ new Set();
|
|
244
|
+
for (let hop = 0; hop < 5; hop++) {
|
|
245
|
+
let next = redirects.get(redirectKey(current));
|
|
246
|
+
if (!next || seen.has(next)) break;
|
|
247
|
+
seen.add(next), current = next;
|
|
248
|
+
}
|
|
249
|
+
return current;
|
|
250
|
+
}
|
|
251
|
+
/**
|
|
252
|
+
* URL FINALE d'une page (celle qui répond 200, sans redirection) : adresse réelle
|
|
253
|
+
* d'une page codée (registre `siteRoutes`, dossier de la langue), sinon dossier et
|
|
254
|
+
* slug de la langue ; puis destination si l'adresse est le départ d'une redirection
|
|
255
|
+
* du Studio. Affichée partout dans le kit (onglet Pages, board, Presentation, slug).
|
|
256
|
+
*/
|
|
257
|
+
function finalPath(input, pageType, config, redirects) {
|
|
258
|
+
if (!pageType) return null;
|
|
259
|
+
let coded = !pageType.path && !pageType.pathPrefix && !pageType.localizedPrefixes && input.slug ? config.codedPages.find((c) => c.pageSlug === input.slug) : void 0, path = toPath(coded ? {
|
|
260
|
+
path: input.locale && coded.localized?.[input.locale] || coded.path,
|
|
261
|
+
locale: input.locale
|
|
262
|
+
} : {
|
|
263
|
+
slug: input.slug,
|
|
264
|
+
path: pageType.path,
|
|
265
|
+
pathPrefix: pageType.pathPrefix,
|
|
266
|
+
localizedPrefixes: pageType.localizedPrefixes,
|
|
267
|
+
locale: input.locale
|
|
268
|
+
}, config.i18n);
|
|
269
|
+
return path === null ? null : followRedirects(path, redirects);
|
|
270
|
+
}
|
|
271
|
+
export { DEFAULT_PAGE_BUILDER_FIELD as _, depth as a, segments as c, normalizePath as d, resolveConfig as f, DEFAULT_INTERNAL_FIELDS as g, DEFAULT_I18N as h, redirectMapOf as i, toPath as l, DEFAULT_COMPONENT_PREVIEW as m, followRedirects as n, pageTypeFor as o, DEFAULT_BOARD_TAGS as p, redirectKey as r, parentPath as s, finalPath as t, toUrl as u, DEFAULT_SLUG_FIELD as v, DEFAULT_TITLE_FIELD as y };
|
|
272
|
+
|
|
273
|
+
//# sourceMappingURL=finalUrl-C1kzYMzQ.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"finalUrl-C1kzYMzQ.js","names":[],"sources":["../src/config/defaults.ts","../src/config/resolve.ts","../src/lib/paths.ts","../src/lib/finalUrl.ts"],"sourcesContent":["import type {\n NcfBoardTag,\n NcfInternalField,\n NcfComponentPreviewConfig,\n NcfI18nConfig,\n NcfToolsConfig,\n} from './types'\n\nexport const DEFAULT_PAGE_BUILDER_FIELD = 'sections'\nexport const DEFAULT_SLUG_FIELD = 'slug'\nexport const DEFAULT_TITLE_FIELD = 'title'\nexport const DEFAULT_BLOCK_NAMESPACE = ''\n\n/**\n * Chemins essayés pour savoir si une page est indexable. Le premier\n * correspond à la convention du starter (`seo.noindex`), le second couvre les\n * schémas qui portent le drapeau à la racine.\n */\nexport const DEFAULT_NOINDEX_FIELDS = ['seo.noindex', 'noindex']\n\n// Aucune langue par défaut : la langue principale (master) vient TOUJOURS du projet\n// (`defaultLocale`, sinon la première de `locales`). Un site peut avoir le français,\n// l'anglais ou toute autre langue comme master.\nexport const DEFAULT_I18N: Omit<Required<NcfI18nConfig>, 'defaultsSourceLocale' | 'defaultLocale'> = {\n field: 'language',\n locales: [],\n}\n\n/**\n * Convention NoCode Factory : page `/design-system` dans le front, captures\n * dans `/sections/<nom>.png` générées au push par GitHub Actions.\n */\nexport const DEFAULT_COMPONENT_PREVIEW: Required<NcfComponentPreviewConfig> = {\n provider: 'designSystemPage',\n path: '/design-system',\n anchor: '{name}',\n thumbnail: '/sections/{name}.png',\n defaultsType: 'componentDefaults',\n live: '/design-system/composant?type={name}',\n}\n\nexport const DEFAULT_TOOLS: Required<NcfToolsConfig> = {\n pages: true,\n components: true,\n history: true,\n designSystem: true,\n}\n\n/**\n * Outils rangés dans « Plus » : Vision (console GROQ) et la planification\n * (« Scheduled drafts » quand les Releases sont désactivées, « Releases » sinon :\n * le même outil, nommé `releases` ; `schedules` couvre les anciennes versions).\n */\nexport const DEFAULT_TOOLBAR_MORE = ['vision', 'releases', 'schedules']\n\n/**\n * Étiquettes de suivi par défaut : l'avancement d'une refonte, pas un statut\n * de publication. Elles vivent dans le document de disposition du kit, donc\n * aucun schéma client n'est modifié.\n */\nexport const DEFAULT_BOARD_TAGS: NcfBoardTag[] = [\n {id: 'en-cours', label: 'In progress', color: '#f5a623'},\n {id: 'fait', label: 'Done', color: '#43d675'},\n {id: 'a-relire', label: 'To review', color: '#2276fc'},\n {id: 'a-refondre', label: 'To rework', color: '#f03e3e'},\n]\n\n/**\n * Colonnes de gestion interne par défaut. Volontairement peu nombreuses : ce\n * sont celles qu'on redemande sur tous les projets. `internalFields` les\n * remplace entièrement.\n */\nexport const DEFAULT_INTERNAL_FIELDS: NcfInternalField[] = [\n {id: 'owner', label: 'Owner', type: 'text'},\n {id: 'audience', label: 'Audience', type: 'text'},\n {id: 'role', label: 'Page role', type: 'text'},\n]\n\n/**\n * Service du kit, hébergé par NoCode Factory.\n *\n * Renseigné d'office pour qu'un Studio n'ait rien à configurer : il se\n * signale au démarrage, et c'est ce qui permet de savoir quels projets\n * utilisent le kit. `endpoint` le remplace pour une instance privée.\n */\nexport const DEFAULT_SERVICE_ENDPOINT = 'https://dkoxgivytgsmvqmjvmjt.supabase.co/functions/v1'\n","import {\n DEFAULT_BLOCK_NAMESPACE,\n DEFAULT_BOARD_TAGS,\n DEFAULT_INTERNAL_FIELDS,\n DEFAULT_SERVICE_ENDPOINT,\n DEFAULT_COMPONENT_PREVIEW,\n DEFAULT_I18N,\n DEFAULT_NOINDEX_FIELDS,\n DEFAULT_PAGE_BUILDER_FIELD,\n DEFAULT_SLUG_FIELD,\n DEFAULT_TITLE_FIELD,\n DEFAULT_TOOLBAR_MORE, DEFAULT_TOOLS,\n} from './defaults'\nimport type {\n NcfEnvironment,\n NcfKitConfig,\n NcfPageTypeConfig,\n ResolvedKitConfig,\n ResolvedPageType,\n} from './types'\n\nconst trimTrailingSlash = (url: string) => url.replace(/\\/+$/, '')\n\n/** Garantit un chemin absolu ('accueil' -> '/accueil', '' -> '/'). */\nexport const normalizePath = (path: string): string => {\n const trimmed = path.trim()\n if (!trimmed || trimmed === '/') return '/'\n const withSlash = trimmed.startsWith('/') ? trimmed : `/${trimmed}`\n return withSlash.length > 1 ? trimTrailingSlash(withSlash) : withSlash\n}\n\nfunction resolvePageType(\n entry: NcfPageTypeConfig,\n defaults: {slugField: string; titleField: string},\n): ResolvedPageType {\n if (typeof entry === 'string') {\n return {\n type: entry.trim(),\n slugField: defaults.slugField,\n path: null,\n pathPrefix: null,\n localizedPrefixes: null,\n titleField: defaults.titleField,\n }\n }\n\n // `path` gagne sur `slugField` : une page à chemin fixe (l'accueil) n'a pas\n // de slug à lire, même si le type en porte un par ailleurs.\n const path = typeof entry.path === 'string' ? normalizePath(entry.path) : null\n const slugField =\n entry.slugField === null ? null : (entry.slugField?.trim() || defaults.slugField)\n\n // Un préfixe vide ou '/' vaut « à la racine » : pas de préfixe.\n const prefix = typeof entry.pathPrefix === 'string' ? normalizePath(entry.pathPrefix) : '/'\n\n return {\n type: (entry.type ?? '').trim(),\n slugField: path ? null : slugField,\n path,\n // Conservé même avec `path` (qui gagne au calcul du chemin) : la validation\n // peut ainsi signaler le préfixe inutile.\n pathPrefix: prefix === '/' ? null : prefix,\n localizedPrefixes: entry.localizedPrefixes\n ? Object.fromEntries(Object.entries(entry.localizedPrefixes).map(([l, p]) => [l, normalizePath(p) === '/' ? '' : normalizePath(p)]))\n : null,\n titleField: entry.titleField?.trim() || defaults.titleField,\n }\n}\n\n/** Applique les valeurs par défaut. Ne valide rien : voir `validateConfig`. */\nexport function resolveConfig(input: NcfKitConfig): ResolvedKitConfig {\n const slugField = input.slugField?.trim() || DEFAULT_SLUG_FIELD\n const titleField = input.titleField?.trim() || DEFAULT_TITLE_FIELD\n\n const pageTypes = (Array.isArray(input.pageTypes) ? input.pageTypes : []).map((entry) =>\n resolvePageType(entry, {slugField, titleField}),\n )\n\n const i18n =\n input.i18n === false || input.i18n === undefined\n ? null\n : (() => {\n const locales = (input.i18n.locales ?? DEFAULT_I18N.locales).map((l) => l.trim()).filter(Boolean)\n // Master : `defaultLocale`, sinon la première langue. Jamais une langue écrite\n // dans le kit (absente : signalé par validateConfig).\n const defaultLocale = input.i18n.defaultLocale?.trim() || locales[0] || ''\n return {\n field: input.i18n.field?.trim() || DEFAULT_I18N.field,\n defaultLocale,\n locales,\n // Valeurs par défaut des composants : écrites dans la langue master,\n // traduites vers les autres (sauf choix explicite du projet).\n defaultsSourceLocale: input.i18n.defaultsSourceLocale?.trim() || defaultLocale,\n }\n })()\n\n return {\n pageTypes,\n codedPages: (input.siteRoutes?.fixed ?? [])\n .filter((f) => f.pageSlug && !f.homePage && !f.system && !f.notFound)\n .map((f) => ({pageSlug: f.pageSlug as string, path: normalizePath(f.path), localized: f.localized ?? null})),\n redirectType: input.redirectType?.trim() || 'redirect',\n pageTypeNames: pageTypes.map((p) => p.type).filter(Boolean),\n pageBuilderField: input.pageBuilderField?.trim() || DEFAULT_PAGE_BUILDER_FIELD,\n blockNamespace: input.blockNamespace ?? DEFAULT_BLOCK_NAMESPACE,\n noindexFields: input.noindexField\n ? [input.noindexField].flat().map((field) => field.trim()).filter(Boolean)\n : DEFAULT_NOINDEX_FIELDS,\n previewUrl: input.previewUrl ? trimTrailingSlash(input.previewUrl.trim()) : null,\n environments: resolveEnvironments(input),\n pageThumbnail: input.pageThumbnail?.trim() || null,\n i18n,\n componentPreview: {\n provider: input.componentPreview?.provider ?? DEFAULT_COMPONENT_PREVIEW.provider,\n path: input.componentPreview?.path ?? DEFAULT_COMPONENT_PREVIEW.path,\n anchor: input.componentPreview?.anchor ?? DEFAULT_COMPONENT_PREVIEW.anchor,\n thumbnail: input.componentPreview?.thumbnail ?? DEFAULT_COMPONENT_PREVIEW.thumbnail,\n defaultsType: input.componentPreview?.defaultsType ?? DEFAULT_COMPONENT_PREVIEW.defaultsType,\n live: input.componentPreview?.live ?? DEFAULT_COMPONENT_PREVIEW.live,\n },\n serviceEndpoint:\n input.serviceEndpoint === false\n ? null\n : trimTrailingSlash((input.serviceEndpoint || DEFAULT_SERVICE_ENDPOINT).trim()),\n history: input.history?.projectKey?.trim()\n ? {\n projectKey: input.history.projectKey.trim(),\n endpoint: trimTrailingSlash(\n (input.history.endpoint || input.serviceEndpoint || DEFAULT_SERVICE_ENDPOINT).trim(),\n ),\n }\n : null,\n // Le JSON-LD IA s'appuie sur le même service que la traduction : sans\n // `history.projectKey`, il n'y a pas d'IA à brancher.\n jsonLd:\n input.jsonLd?.enabled && input.history?.projectKey?.trim()\n ? {field: input.jsonLd.field?.trim() || 'jsonLd'}\n : null,\n tools: {...DEFAULT_TOOLS, ...input.tools},\n moreTools: input.moreTools === false ? [] : (input.moreTools ?? DEFAULT_TOOLBAR_MORE),\n boardTags: input.boardTags?.length ? input.boardTags : DEFAULT_BOARD_TAGS,\n internalFields: input.internalFields?.length\n ? input.internalFields\n : DEFAULT_INTERNAL_FIELDS,\n // Additif : le schéma du client fournit déjà l'essentiel, ceci ne sert\n // qu'à ce qu'un parcours de schéma ne sait pas exprimer.\n documentColumns: (input.documentColumns ?? []).map((column) => ({\n key: column.key.trim(),\n label: column.label?.trim() || column.key.trim(),\n paths: [column.path].flat().map((path) => path.trim()).filter(Boolean),\n type: column.type ?? 'text',\n })),\n }\n}\n\n\n/**\n * Préproduction déduite de la production, par convention.\n *\n * NoCode Factory assigne à chaque projet un domaine Vercel **fixe** pour la\n * branche `preprod`, de la forme `preview-<projet>.vercel.app`. Fixe parce\n * qu'un lien de partage doit survivre au commit suivant : une URL de\n * déploiement change à chaque poussée, un domaine assigné non.\n *\n * La déduire évite de la déclarer neuf fois. Elle n'est proposée que pour un\n * hôte Vercel — ailleurs la convention ne s'applique pas — et `environments`\n * la remplace dès qu'on la déclare explicitement.\n */\nexport function conventionalPreprodUrl(previewUrl: string | null): string | null {\n if (!previewUrl) return null\n try {\n const url = new URL(previewUrl)\n if (!url.hostname.endsWith('.vercel.app')) return null\n // Une préproduction ne se dérive pas d'une préproduction.\n if (url.hostname.startsWith('preview-')) return null\n return `${url.protocol}//preview-${url.hostname}`\n } catch {\n return null\n }\n}\n\n/**\n * Environnements d'aperçu.\n *\n * `previewUrl` en fournit toujours un, nommé « Production » : un projet qui\n * n'en déclare pas d'autres doit quand même pouvoir basculer entre brouillons\n * et contenu en ligne.\n *\n * Quand `environments` mentionne déjà `previewUrl`, on ne le double pas.\n */\nfunction resolveEnvironments(input: NcfKitConfig): NcfEnvironment[] {\n const declared = (input.environments ?? [])\n .map((environment) => ({\n id: environment.id.trim(),\n label: environment.label?.trim() || environment.id.trim(),\n url: trimTrailingSlash((environment.url ?? '').trim()),\n }))\n .filter((environment) => environment.id && environment.url)\n\n const preview = input.previewUrl ? trimTrailingSlash(input.previewUrl.trim()) : null\n if (!preview) return declared\n\n const production = declared.some((environment) => environment.url === preview)\n ? []\n : [{id: 'production', label: 'Production', url: preview}]\n\n // La préproduction conventionnelle complète la liste, sauf si le projet en\n // a déjà déclaré une — sa déclaration explicite fait foi.\n //\n // On compare l'identifiant autant que l'URL : un projet dont le domaine ne\n // suit pas exactement la convention déclare bien un `preprod`, à une autre\n // adresse. En n'écartant que par l'URL, on en ajoutait un second portant le\n // même identifiant, et la configuration devenait invalide.\n const conventional = conventionalPreprodUrl(preview)\n const hasPreprod =\n declared.some(\n (environment) => environment.url === conventional || environment.id === 'preprod',\n ) || input.preprodUrl === false\n\n const preprod =\n conventional && !hasPreprod\n ? [{id: 'preprod', label: 'Staging', url: conventional}]\n : []\n\n return [...production, ...preprod, ...declared]\n}\n","import {normalizePath} from '../config/resolve'\nimport type {ResolvedI18n, ResolvedPageType} from '../config/types'\n\nexport interface PathInput {\n /** Valeur du champ slug (`slug.current`). Peut contenir des `/`. */\n slug?: string | null\n /** Chemin fixe du type de page, s'il en a un. */\n path?: string | null\n /** Préfixe d'URL du type de page ('/blog'), devant le slug. */\n pathPrefix?: string | null\n /** Préfixe par langue (dossiers traduits) : celui de `locale` gagne sur `pathPrefix`. */\n localizedPrefixes?: Record<string, string> | null\n /** Langue du document. */\n locale?: string | null\n}\n\n/**\n * Chemin d'une page sur le site. Le chemin fixe l'emporte sur le slug, le\n * préfixe du type se place devant le slug ('/blog' + 'mon-article'), et la\n * langue par défaut n'est pas préfixée (convention Next.js du starter).\n */\nexport function toPath(input: PathInput, i18n: ResolvedI18n | null): string | null {\n const localized = input.locale ? input.localizedPrefixes?.[input.locale] : undefined\n const raw = localized !== undefined ? localized : input.pathPrefix\n const prefix = typeof raw === 'string' && raw ? normalizePath(raw) : '/'\n const base =\n typeof input.path === 'string' && input.path\n ? normalizePath(input.path)\n : input.slug\n ? normalizePath(prefix === '/' ? input.slug : `${prefix}/${input.slug.replace(/^\\/+/, '')}`)\n : null\n\n if (base === null) return null\n if (!i18n || !input.locale || input.locale === i18n.defaultLocale) return base\n return base === '/' ? `/${input.locale}` : `/${input.locale}${base}`\n}\n\n/** URL absolue d'une page, ou `null` si le front n'est pas configuré. */\nexport function toUrl(previewUrl: string | null, path: string | null): string | null {\n if (!previewUrl || path === null) return null\n return path === '/' ? previewUrl : `${previewUrl}${path}`\n}\n\n/** Segments d'un chemin : '/services/plomberie' -> ['services', 'plomberie']. */\nexport function segments(path: string): string[] {\n return path.split('/').filter(Boolean)\n}\n\n/** Profondeur dans l'arborescence. '/' vaut 0. */\nexport function depth(path: string): number {\n return segments(path).length\n}\n\n/**\n * Chemin du parent, ou `null` à la racine. Sert au placement automatique du\n * board : '/services/plomberie' -> '/services'.\n */\nexport function parentPath(path: string): string | null {\n const parts = segments(path)\n if (parts.length === 0) return null\n if (parts.length === 1) return '/'\n return `/${parts.slice(0, -1).join('/')}`\n}\n\n/** Le type de page correspondant à un document. */\nexport function pageTypeFor(\n type: string,\n pageTypes: ResolvedPageType[],\n): ResolvedPageType | undefined {\n return pageTypes.find((p) => p.type === type)\n}\n","import type {ResolvedKitConfig, ResolvedPageType} from '../config/types'\nimport {toPath} from './paths'\n\n/** Clé de comparaison des redirections (comme le site) : minuscules, sans « / » final, sans ? ni #. */\nexport const redirectKey = (path: string) => {\n const clean = (path.trim().split(/[?#]/)[0] ?? '').toLowerCase()\n return clean.length > 1 ? clean.replace(/\\/+$/, '') : clean\n}\n\n/** Table des redirections du Studio : départ (normalisé) -> destination. */\nexport type RedirectMap = Map<string, string>\n\nexport function redirectMapOf(rows: readonly {from?: string | null; to?: string | null}[]): RedirectMap {\n const map: RedirectMap = new Map()\n for (const r of rows) {\n if (!r.from?.startsWith('/') || !r.to) continue\n const key = redirectKey(r.from)\n if (key !== redirectKey(r.to) && !map.has(key)) map.set(key, r.to.trim())\n }\n return map\n}\n\n/** Destination finale d'une adresse (chaîne de redirections suivie, boucles ignorées). */\nexport function followRedirects(path: string, redirects: RedirectMap | null | undefined): string {\n if (!redirects?.size) return path\n let current = path\n const seen = new Set<string>()\n for (let hop = 0; hop < 5; hop++) {\n const next = redirects.get(redirectKey(current))\n if (!next || seen.has(next)) break\n seen.add(next)\n current = next\n }\n return current\n}\n\n/**\n * URL FINALE d'une page (celle qui répond 200, sans redirection) : adresse réelle\n * d'une page codée (registre `siteRoutes`, dossier de la langue), sinon dossier et\n * slug de la langue ; puis destination si l'adresse est le départ d'une redirection\n * du Studio. Affichée partout dans le kit (onglet Pages, board, Presentation, slug).\n */\nexport function finalPath(\n input: {slug: string | null; locale: string | null},\n pageType: ResolvedPageType | null | undefined,\n config: Pick<ResolvedKitConfig, 'i18n' | 'codedPages'>,\n redirects?: RedirectMap | null,\n): string | null {\n if (!pageType) return null\n const atRoot = !pageType.path && !pageType.pathPrefix && !pageType.localizedPrefixes\n const coded = atRoot && input.slug ? config.codedPages.find((c) => c.pageSlug === input.slug) : undefined\n const path = coded\n ? toPath({path: (input.locale && coded.localized?.[input.locale]) || coded.path, locale: input.locale}, config.i18n)\n : toPath(\n {slug: input.slug, path: pageType.path, pathPrefix: pageType.pathPrefix, localizedPrefixes: pageType.localizedPrefixes, locale: input.locale},\n config.i18n,\n )\n return path === null ? null : followRedirects(path, redirects)\n}\n"],"mappings":"AAQA,MAAa,6BAA6B,YAC7B,qBAAqB,QACrB,sBAAsB,SAQtB,yBAAyB,CAAC,eAAe,SAAS,GAKlD,eAAwF;CACnG,OAAO;CACP,SAAS,CAAC;AACZ,GAMa,4BAAiE;CAC5E,UAAU;CACV,MAAM;CACN,QAAQ;CACR,WAAW;CACX,cAAc;CACd,MAAM;AACR,GAEa,gBAA0C;CACrD,OAAO;CACP,YAAY;CACZ,SAAS;CACT,cAAc;AAChB,GAOa,uBAAuB;CAAC;CAAU;CAAY;AAAW,GAOzD,qBAAoC;CAC/C;EAAC,IAAI;EAAY,OAAO;EAAe,OAAO;CAAS;CACvD;EAAC,IAAI;EAAQ,OAAO;EAAQ,OAAO;CAAS;CAC5C;EAAC,IAAI;EAAY,OAAO;EAAa,OAAO;CAAS;CACrD;EAAC,IAAI;EAAc,OAAO;EAAa,OAAO;CAAS;AACzD,GAOa,0BAA8C;CACz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