sanity-plugin-seofields 1.8.0 → 1.9.0

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 (113) hide show
  1. package/README.md +437 -26
  2. package/dist/SeoHealthTool-2COI27KI.cjs +8 -0
  3. package/dist/SeoHealthTool-2COI27KI.cjs.map +1 -0
  4. package/dist/SeoHealthTool-CWI3KB2V.js +8 -0
  5. package/dist/SeoHealthTool-CWI3KB2V.js.map +1 -0
  6. package/dist/{SeoPreview-3EXR6FD4.cjs → SeoPreview-LMZAWWOE.cjs} +35 -38
  7. package/dist/SeoPreview-LMZAWWOE.cjs.map +1 -0
  8. package/dist/{SeoPreview-4PPAF4NO.js → SeoPreview-UNQBKTQO.js} +14 -11
  9. package/dist/SeoPreview-UNQBKTQO.js.map +1 -0
  10. package/dist/chunk-3OK3S2F7.cjs +673 -0
  11. package/dist/chunk-3OK3S2F7.cjs.map +1 -0
  12. package/dist/{chunk-B5IVI5LP.cjs → chunk-5XTQRILL.cjs} +286 -236
  13. package/dist/chunk-5XTQRILL.cjs.map +1 -0
  14. package/dist/{chunk-254YHUN3.cjs → chunk-7N4MLTMR.js} +8 -6
  15. package/dist/chunk-7N4MLTMR.js.map +1 -0
  16. package/dist/{chunk-DDAAVRWG.js → chunk-A57XNQC7.cjs} +9 -4
  17. package/dist/chunk-A57XNQC7.cjs.map +1 -0
  18. package/dist/chunk-BWLJDK5J.js +624 -0
  19. package/dist/chunk-BWLJDK5J.js.map +1 -0
  20. package/dist/chunk-FUUWBQE2.cjs +195 -0
  21. package/dist/chunk-FUUWBQE2.cjs.map +1 -0
  22. package/dist/{chunk-ZBHLMQTS.cjs → chunk-HHO2AKAP.js} +44 -17
  23. package/dist/chunk-HHO2AKAP.js.map +1 -0
  24. package/dist/chunk-KIEO6QG3.js +195 -0
  25. package/dist/chunk-KIEO6QG3.js.map +1 -0
  26. package/dist/chunk-R2U7JF7U.cjs +624 -0
  27. package/dist/chunk-R2U7JF7U.cjs.map +1 -0
  28. package/dist/{chunk-VR44E62I.js → chunk-XZKQWV2H.js} +204 -33
  29. package/dist/chunk-XZKQWV2H.js.map +1 -0
  30. package/dist/{chunk-HDZZQCH7.js → chunk-Y46ACXM4.cjs} +45 -5
  31. package/dist/chunk-Y46ACXM4.cjs.map +1 -0
  32. package/dist/chunk-Z5AOUU4H.js +673 -0
  33. package/dist/chunk-Z5AOUU4H.js.map +1 -0
  34. package/dist/cli.js +27 -27
  35. package/dist/{component-DEXwtemT.d.ts → component-CjT1hvxh.d.ts} +2 -2
  36. package/dist/{component-BzI-LHPw.d.cts → component-WYh0z8as.d.cts} +2 -2
  37. package/dist/define-cli.cjs +2 -4
  38. package/dist/define-cli.cjs.map +1 -1
  39. package/dist/define-cli.js +4 -4
  40. package/dist/define-cli.js.map +1 -1
  41. package/dist/head.cjs +14 -0
  42. package/dist/head.cjs.map +1 -0
  43. package/dist/head.d.cts +254 -0
  44. package/dist/head.d.ts +254 -0
  45. package/dist/head.js +14 -0
  46. package/dist/head.js.map +1 -0
  47. package/dist/index.cjs +978 -367
  48. package/dist/index.cjs.map +1 -1
  49. package/dist/index.d.cts +6 -374
  50. package/dist/index.d.ts +6 -374
  51. package/dist/index.js +920 -286
  52. package/dist/index.js.map +1 -1
  53. package/dist/next.cjs +204 -455
  54. package/dist/next.cjs.map +1 -1
  55. package/dist/next.d.cts +8 -206
  56. package/dist/next.d.ts +8 -206
  57. package/dist/next.js +181 -111
  58. package/dist/next.js.map +1 -1
  59. package/dist/plugin-DQdThyxG.d.ts +449 -0
  60. package/dist/plugin-DoGeZP79.d.cts +449 -0
  61. package/dist/schema/next.cjs +173 -327
  62. package/dist/schema/next.cjs.map +1 -1
  63. package/dist/schema/next.d.cts +4 -4
  64. package/dist/schema/next.d.ts +4 -4
  65. package/dist/schema/next.js +172 -8
  66. package/dist/schema/next.js.map +1 -1
  67. package/dist/schema.cjs +376 -517
  68. package/dist/schema.cjs.map +1 -1
  69. package/dist/schema.d.cts +5 -5
  70. package/dist/schema.d.ts +5 -5
  71. package/dist/schema.js +216 -11
  72. package/dist/schema.js.map +1 -1
  73. package/dist/server.cjs +149 -0
  74. package/dist/server.cjs.map +1 -0
  75. package/dist/server.d.cts +102 -0
  76. package/dist/server.d.ts +102 -0
  77. package/dist/server.js +149 -0
  78. package/dist/server.js.map +1 -0
  79. package/dist/{types-CW8qFdAn.d.ts → types-BAdN1RMu.d.ts} +2 -2
  80. package/dist/{types-B_vjMPtM.d.cts → types-C5i3KMgs.d.cts} +2 -2
  81. package/dist/{types-BXSCbl6p.d.cts → types-DP-DiW6f.d.cts} +2 -2
  82. package/dist/{types-C19cQx5D.d.ts → types-DRLUGLtX.d.ts} +2 -2
  83. package/dist/{types-yVmQfby9.d.cts → types-DxlPXihz.d.cts} +1 -1
  84. package/dist/{types-yVmQfby9.d.ts → types-DxlPXihz.d.ts} +1 -1
  85. package/package.json +25 -4
  86. package/dist/SeoHealthDashboard-AEKVVMUR-7NWV3C3Y.js +0 -4
  87. package/dist/SeoHealthDashboard-AEKVVMUR-7NWV3C3Y.js.map +0 -1
  88. package/dist/SeoHealthDashboard-AEKVVMUR-XWKJUH24.cjs +0 -10
  89. package/dist/SeoHealthDashboard-AEKVVMUR-XWKJUH24.cjs.map +0 -1
  90. package/dist/SeoHealthTool-2KKQJLJL.cjs +0 -11
  91. package/dist/SeoHealthTool-2KKQJLJL.cjs.map +0 -1
  92. package/dist/SeoHealthTool-3CUKGADZ.js +0 -5
  93. package/dist/SeoHealthTool-3CUKGADZ.js.map +0 -1
  94. package/dist/SeoPreview-3EXR6FD4.cjs.map +0 -1
  95. package/dist/SeoPreview-4PPAF4NO.js.map +0 -1
  96. package/dist/chunk-254YHUN3.cjs.map +0 -1
  97. package/dist/chunk-27XSYENH.js +0 -2215
  98. package/dist/chunk-27XSYENH.js.map +0 -1
  99. package/dist/chunk-B5IVI5LP.cjs.map +0 -1
  100. package/dist/chunk-BNXMFD3T.cjs +0 -431
  101. package/dist/chunk-BNXMFD3T.cjs.map +0 -1
  102. package/dist/chunk-DDAAVRWG.js.map +0 -1
  103. package/dist/chunk-HDZZQCH7.js.map +0 -1
  104. package/dist/chunk-P6IOWIO2.cjs +0 -480
  105. package/dist/chunk-P6IOWIO2.cjs.map +0 -1
  106. package/dist/chunk-UOCZFYYP.js +0 -407
  107. package/dist/chunk-UOCZFYYP.js.map +0 -1
  108. package/dist/chunk-VR44E62I.js.map +0 -1
  109. package/dist/chunk-WKXHX3GO.js +0 -424
  110. package/dist/chunk-WKXHX3GO.js.map +0 -1
  111. package/dist/chunk-XZDLJ2N6.cjs +0 -2224
  112. package/dist/chunk-XZDLJ2N6.cjs.map +0 -1
  113. package/dist/chunk-ZBHLMQTS.cjs.map +0 -1
@@ -0,0 +1,449 @@
1
+ import * as sanity from 'sanity';
2
+ import { ComponentType } from 'react';
3
+ import { D as DocumentWithSeoHealth } from './types-DxlPXihz.cjs';
4
+
5
+ type AiIndustry = 'blog' | 'ecommerce' | 'healthcare' | 'pharmacy' | 'saas' | 'finance' | 'realestate' | 'education' | 'restaurant' | 'travel' | 'fitness' | 'hospitality' | 'nonprofit' | 'legal' | 'insurance' | 'automotive' | 'homeServices';
6
+ interface AiConfig {
7
+ /** AI provider to use for text generation. */
8
+ provider?: 'openai' | 'anthropic' | 'groq' | 'gemini' | 'ollama';
9
+ /**
10
+ * API key for the provider. Not required for ollama or when using a proxy endpoint.
11
+ * Warning: this is bundled into Studio's client-side JS and readable by anyone with Studio
12
+ * access. For production, use `endpoint` instead — see `sanity-plugin-seofields/server`
13
+ * for ready-made proxy handlers (Next.js, Express, Node, Cloudflare Workers, etc.).
14
+ */
15
+ apiKey?: string;
16
+ /** Override the provider's default model. */
17
+ model?: string;
18
+ /** Override the provider's base URL. Accepts any OpenAI-compatible endpoint (DeepSeek, xAI Grok, Azure OpenAI, etc.). */
19
+ baseUrl?: string;
20
+ /**
21
+ * Proxy endpoint — POST { field, content, focusKeyword, keywords, meta } → { result: string }.
22
+ * Key stays server-side. Build one with `sanity-plugin-seofields/server`, e.g.
23
+ * `createNextRouteHandler({ provider: 'openai', apiKey: process.env.OPENAI_API_KEY })`.
24
+ */
25
+ endpoint?: string;
26
+ /** Sampling temperature. Defaults to 0.7. */
27
+ temperature?: number;
28
+ /**
29
+ * Root document field(s) used as content for the AI prompt. Defaults to 'body'.
30
+ *
31
+ * - `string` — one field, used for every document type
32
+ * - `string[]` — multiple fields in priority order, used for every document type
33
+ * - `Record<string, string | string[]>` — per-document-type field(s); use a `default`
34
+ * key for unlisted types (falls back to `'body'` if omitted)
35
+ *
36
+ * @example
37
+ * content: ['title', 'excerpt', 'body']
38
+ *
39
+ * @example
40
+ * content: {
41
+ * page: ['sections'],
42
+ * news: 'content',
43
+ * work: ['content', 'contentExtended'],
44
+ * author: 'bio',
45
+ * default: 'body',
46
+ * }
47
+ */
48
+ content?: string | string[] | Record<string, string | string[]>;
49
+ /** Industry context for prompts. When set, uses domain-specific vocabulary. Omit for generic prompts. */
50
+ industry?: AiIndustry;
51
+ /** Enable test mode — uses static pre-written outputs without any API call. Shows test warning in UI. */
52
+ testMode?: boolean;
53
+ /** Number of full generation attempts before giving up. Defaults to 2. */
54
+ maxRetries?: number;
55
+ /**
56
+ * Controls what is returned when all attempts fail validation:
57
+ * - true: returns the first raw response (before refinement passes)
58
+ * - false / undefined (default): returns the last attempt's output
59
+ */
60
+ keepFirstOnValidationFail?: boolean;
61
+ /**
62
+ * Width of the "Generate with AI" button.
63
+ * - 'full' (default): stretches to the field's full width.
64
+ * - 'auto': normal button width, left-aligned.
65
+ */
66
+ buttonWidth?: 'full' | 'auto';
67
+ /** @internal — forwarded from root licenseKey at plugin setup time. Do not set manually. */
68
+ _licenseKey?: string;
69
+ /** @internal — Sanity project ID used for pro feature validation. Do not set manually. */
70
+ _projectId?: string;
71
+ }
72
+
73
+ interface SeoFieldConfig {
74
+ title?: string;
75
+ description?: string;
76
+ }
77
+ type SeoFieldKeys = 'title' | 'description' | 'canonicalUrl' | 'metaImage' | 'keywords' | 'metaAttributes' | 'robots' | 'focusKeyword' | 'hreflangs' | 'geoChecklist' | 'metaTagsPreview';
78
+ type openGraphFieldKeys = 'openGraphUrl' | 'openGraphTitle' | 'openGraphDescription' | 'openGraphSiteName' | 'openGraphType' | 'openGraphImageType' | 'openGraphImage' | 'openGraphImageUrl';
79
+ type twitterFieldKeys = 'twitterCard' | 'twitterSite' | 'twitterCreator' | 'twitterTitle' | 'twitterDescription' | 'twitterImageType' | 'twitterImage' | 'twitterImageUrl';
80
+ type AllFieldKeys = SeoFieldKeys | openGraphFieldKeys | twitterFieldKeys;
81
+ /**
82
+ * Names of top-level fields inside the `seoFields` object type.
83
+ * Use these when assigning fields to groups in `fieldGroups`.
84
+ */
85
+ type SeoObjectFieldName = 'robots' | 'preview' | 'title' | 'description' | 'metaImage' | 'metaAttributes' | 'keywords' | 'canonicalUrl' | 'openGraph' | 'twitter' | 'focusKeyword' | 'hreflangs' | 'geoChecklist' | 'metaTagsPreview';
86
+ /**
87
+ * Defines a single tab/group within the `seoFields` object.
88
+ */
89
+ interface SeoFieldGroup {
90
+ /** Unique key for this group (used internally by Sanity). */
91
+ name: string;
92
+ /** Human-readable label shown as the tab title. */
93
+ title: string;
94
+ /** Whether this tab is selected by default. Only one group should be `true`. */
95
+ default?: boolean;
96
+ /**
97
+ * Field names to include in this group.
98
+ * Use the top-level seoFields field names: `'title'`, `'description'`, `'metaImage'`,
99
+ * `'keywords'`, `'canonicalUrl'`, `'metaAttributes'`, `'robots'`, `'preview'`,
100
+ * `'openGraph'`, `'twitter'`.
101
+ */
102
+ fields: SeoObjectFieldName[];
103
+ /** Optional icon displayed next to the tab title. Must be a React component. */
104
+ icon?: ComponentType;
105
+ }
106
+ type ValidHiddenFieldKeys = Exclude<AllFieldKeys, 'openGraphImageUrl' | 'twitterImageUrl' | 'openGraphImageType' | 'twitterImageType'>;
107
+ interface FieldVisibilityConfig {
108
+ hiddenFields?: ValidHiddenFieldKeys[];
109
+ }
110
+ /**
111
+ * Individual SEO fields that must be non-empty before publishing.
112
+ * Dot-notation for nested fields (e.g. 'openGraph.title').
113
+ */
114
+ type PublishGateRequiredField = 'title' | 'description' | 'metaImage' | 'keywords' | 'canonicalUrl' | 'openGraph.title' | 'openGraph.description' | 'openGraph.image' | 'openGraph.type' | 'twitter.title' | 'twitter.description' | 'twitter.image' | 'twitter.card';
115
+ interface SeoFieldsPluginConfig {
116
+ /**
117
+ * License key for pro features (SEO Health Dashboard, Publish Gate).
118
+ * Obtain at https://sanity-plugin-seofields.thehardik.in
119
+ */
120
+ licenseKey?: string;
121
+ /**
122
+ * Enable or configure the SEO preview feature.
123
+ * If set to `true`, the SEO preview will be enabled with default settings.
124
+ * If set to an object, you can provide a custom `prefix` function to modify the URL prefix
125
+ * and/or a `titleSuffix` to append text (e.g. a brand name) after the meta title in the preview.
126
+ * The plugin automatically adds a `|` separator — only provide the suffix text itself.
127
+ *
128
+ * Example:
129
+ * ```
130
+ * seoPreview: {
131
+ * prefix: (doc) => `/${doc.slug?.current || 'untitled'}`,
132
+ * titleSuffix: 'Acme Corp',
133
+ * // or dynamically:
134
+ * titleSuffix: (doc) => doc.brandName || 'Acme Corp',
135
+ * }
136
+ * ```
137
+ */
138
+ seoPreview?: boolean | {
139
+ prefix?: (doc: {
140
+ _type?: string;
141
+ } & Record<string, unknown>) => string;
142
+ /**
143
+ * A static string or function appended to the meta title in the Live Preview.
144
+ * Useful for showing a brand suffix (e.g. `'Acme Corp'`) that is added
145
+ * via your Next.js title template but not stored in the Sanity field.
146
+ * The plugin automatically prepends a `|` separator so only provide the
147
+ * text itself. The suffix is rendered in a muted style so editors can
148
+ * distinguish it from the typed title. The combined length (including the
149
+ * separator) is checked against the 60-character SERP limit.
150
+ */
151
+ titleSuffix?: string | ((doc: {
152
+ _type?: string;
153
+ } & Record<string, unknown>) => string);
154
+ /**
155
+ * When `true`, the `titleSuffix` is rendered in the same color and weight
156
+ * as the main title (`#1a0dab`, `fontWeight: 500`) instead of the default
157
+ * muted style (`#70757a`, `fontWeight: 400`).
158
+ *
159
+ * @default false
160
+ */
161
+ titleSuffixInheritColor?: boolean;
162
+ /**
163
+ * A GROQ query string whose result is used as the title suffix in the Live Preview.
164
+ * The query runs against your dataset at Studio load time, making it useful for
165
+ * fetching a dynamic value from another document (e.g. a settings singleton).
166
+ * Takes priority over `titleSuffix` when both are provided.
167
+ *
168
+ * @example
169
+ * ```ts
170
+ * titleSuffixQuery: '*[_type == "siteSettings"][0].siteName'
171
+ * ```
172
+ */
173
+ titleSuffixQuery?: string;
174
+ };
175
+ /**
176
+ * A mapping of field keys to their configuration settings.
177
+ * This allows customization of field titles and descriptions.
178
+ * For example, to change the title of the 'title' field:
179
+ */
180
+ fieldOverrides?: Partial<Record<AllFieldKeys, SeoFieldConfig>>;
181
+ /**
182
+ * A mapping of document types to field visibility configurations.
183
+ * This allows you to specify which fields should be hidden for specific document types.
184
+ */
185
+ fieldVisibility?: Record<string, FieldVisibilityConfig>;
186
+ /**
187
+ * A list of fields that should be hidden by default in all document types.
188
+ * This can be overridden by specific document type settings in `fieldVisibility`.
189
+ */
190
+ defaultHiddenFields?: ValidHiddenFieldKeys[];
191
+ /**
192
+ * Group the SEO fields into tabbed sections inside the `seoFields` object.
193
+ * When configured, the Studio shows tabs (Sanity groups) so editors can
194
+ * switch between e.g. "Meta", "Open Graph", and "Twitter Card" panels.
195
+ *
196
+ * @example
197
+ * fieldGroups: [
198
+ * { name: 'meta', title: 'Meta', default: true,
199
+ * fields: ['title', 'description', 'metaImage', 'keywords', 'canonicalUrl', 'metaAttributes', 'robots', 'preview'] },
200
+ * { name: 'openGraph', title: 'Open Graph', fields: ['openGraph'] },
201
+ * { name: 'twitter', title: 'Twitter Card', fields: ['twitter'] },
202
+ * ]
203
+ */
204
+ fieldGroups?: SeoFieldGroup[];
205
+ /**
206
+ * Show the GEO / AI Overview readiness checklist inside seoFields.
207
+ * Defaults to `true`.
208
+ */
209
+ geo?: boolean;
210
+ /**
211
+ * Show the Meta Tags HTML preview inside seoFields.
212
+ * Defaults to `true`.
213
+ */
214
+ metaTagsPreview?: boolean;
215
+ /**
216
+ * The base URL of your website, used for generating full URLs in the SEO preview.
217
+ * Defaults to 'https://www.example.com' if not provided.
218
+ */
219
+ baseUrl?: string;
220
+ /**
221
+ * The Sanity API version to use for all plugin clients (SEO Preview, Health Dashboard).
222
+ * Defaults to '2024-01-01'.
223
+ * @example '2024-01-01'
224
+ */
225
+ apiVersion?: string;
226
+ /**
227
+ * Enable or configure the SEO Health Dashboard tool.
228
+ * If set to `true`, the dashboard is enabled with all defaults.
229
+ * If set to an object, you can customise the tool and dashboard settings.
230
+ * Defaults to `true`.
231
+ * Example:
232
+ * ```
233
+ * healthDashboard: {
234
+ * toolTitle: 'SEO Overview', // Studio nav tab label
235
+ * content: {
236
+ * icon: '🔍', // Emoji icon shown before the page heading
237
+ * title: 'My SEO Dashboard',// Page heading inside the tool (no emoji)
238
+ * description: 'Track SEO across all documents', // Subtitle under the heading
239
+ * },
240
+ * display: {
241
+ * typeColumn: false, // Hide the document type column (default: true)
242
+ * documentId: false, // Hide the document ID under titles (default: true)
243
+ * },
244
+ * query: {
245
+ * // Option 1 – filter by specific document types
246
+ * types: ['post', 'page'],
247
+ * // Option 2 – provide a full custom GROQ query (takes precedence over `types`)
248
+ * // Must return documents with at least: _id, _type, title, seo, _updatedAt
249
+ * groq: `*[seo != null && defined(slug.current)]{ _id, _type, title, slug, seo, _updatedAt }`,
250
+ * },
251
+ * }
252
+ * ```
253
+ */
254
+ healthDashboard?: boolean | {
255
+ tool?: {
256
+ title?: string;
257
+ name?: string;
258
+ };
259
+ toolTitle?: string;
260
+ content?: {
261
+ icon?: string;
262
+ title?: string;
263
+ description?: string;
264
+ /** Text shown while the license key is being verified. Defaults to "Verifying license…" */
265
+ loadingLicense?: string;
266
+ /** Text shown while documents are being fetched. Defaults to "Loading documents…" */
267
+ loadingDocuments?: string;
268
+ /** Text shown when the query returns zero results. Defaults to "No documents found" */
269
+ noDocuments?: string;
270
+ };
271
+ /**
272
+ * Show or hide the document type column in the results table.
273
+ * Defaults to `true`.
274
+ */
275
+ showTypeColumn?: boolean;
276
+ /**
277
+ * Show or hide the Sanity document `_id` under each title.
278
+ * Defaults to `true`.
279
+ */
280
+ showDocumentId?: boolean;
281
+ query?: {
282
+ /**
283
+ * Limit the dashboard to specific document types.
284
+ * Example: `['post', 'page']`
285
+ */
286
+ types?: string[];
287
+ /**
288
+ * When using `types`, also require the `seo` field to be non-null.
289
+ * Set to `false` to include documents of those types even if `seo` is missing.
290
+ * Defaults to `true`.
291
+ */
292
+ requireSeo?: boolean;
293
+ /**
294
+ * Provide a fully custom GROQ query. Takes precedence over `types`.
295
+ * The query must return documents with at least: _id, _type, title, seo, _updatedAt
296
+ */
297
+ groq?: string;
298
+ };
299
+ /**
300
+ * The Sanity API version to use for the client (e.g. '2023-01-01').
301
+ * Defaults to '2023-01-01'.
302
+ * @deprecated Use the root-level `apiVersion` option instead.
303
+ * @example
304
+ * // Before (deprecated):
305
+ * healthDashboard: { apiVersion: '2024-01-01' }
306
+ * // After:
307
+ * apiVersion: '2024-01-01'
308
+ */
309
+ apiVersion?: string;
310
+ /**
311
+ * License key for the SEO Health Dashboard pro feature.
312
+ * @deprecated Use the root-level `licenseKey` option instead.
313
+ */
314
+ licenseKey?: string;
315
+ /**
316
+ * Map raw `_type` values to human-readable display labels.
317
+ * Used in both the Type column and the Type filter dropdown.
318
+ * Any type without an entry falls back to the raw `_type` string.
319
+ *
320
+ * @example
321
+ * typeDisplayLabels: { productDrug: 'Products', singleCondition: 'Condition' }
322
+ */
323
+ typeDisplayLabels?: Record<string, string>;
324
+ /**
325
+ * Controls how the document type is rendered in the Type column.
326
+ * - `'badge'` (default) — coloured pill
327
+ * - `'text'` — plain text, useful for dense layouts
328
+ */
329
+ typeColumnMode?: 'badge' | 'text';
330
+ /**
331
+ * The document field to use as the display title in the dashboard.
332
+ *
333
+ * - `string` — use this field for every document type (e.g. `'name'`)
334
+ * - `Record<string, string>` — per-type mapping; unmapped types fall back to `title`
335
+ *
336
+ * @example
337
+ * titleField: 'name'
338
+ *
339
+ * @example
340
+ * titleField: { post: 'title', product: 'name', category: 'label' }
341
+ */
342
+ titleField?: string | Record<string, string>;
343
+ /**
344
+ * Callback function to render a custom badge next to the document title.
345
+ * Receives the full document and should return badge data or undefined.
346
+ *
347
+ * @example
348
+ * getDocumentBadge: (doc) => {
349
+ * if (doc.services === 'NHS')
350
+ * return { label: 'NHS', bgColor: '#e0f2fe', textColor: '#0369a1' }
351
+ * if (doc.services === 'Private')
352
+ * return { label: 'Private', bgColor: '#fef3c7', textColor: '#92400e' }
353
+ * }
354
+ */
355
+ getDocumentBadge?: (doc: DocumentWithSeoHealth & Record<string, unknown>) => {
356
+ label: string;
357
+ bgColor?: string;
358
+ textColor?: string;
359
+ fontSize?: string;
360
+ } | undefined;
361
+ /**
362
+ * The `name` of the Sanity structure tool that contains the monitored documents.
363
+ * Required when you have multiple structure tools and the documents live in a
364
+ * non-default one. Clicking a title will navigate to
365
+ * `/{basePath}/{structureTool}/intent/edit/…` directly.
366
+ *
367
+ * @example
368
+ * structureTool: 'common'
369
+ */
370
+ structureTool?: string;
371
+ /**
372
+ * Enable preview/demo mode to show dummy data.
373
+ * Useful for testing, documentation, or showcasing the dashboard.
374
+ * When enabled, displays realistic sample documents with various SEO scores.
375
+ * Defaults to `false`.
376
+ *
377
+ * @example
378
+ * previewMode: true
379
+ */
380
+ previewMode?: boolean;
381
+ /**
382
+ * Export options for the SEO Health Dashboard.
383
+ * Set to `true` (default) to enable both CSV and JSON export,
384
+ * or configure per-format.
385
+ */
386
+ export?: boolean | {
387
+ enabled?: boolean;
388
+ formats?: Array<'csv' | 'json'>;
389
+ };
390
+ /**
391
+ * Show compact inline stat pills in the header row instead of the
392
+ * full 6-card stats grid. Useful for saving vertical space.
393
+ * Defaults to `false`.
394
+ */
395
+ compactStats?: boolean;
396
+ };
397
+ /**
398
+ * Gate publishing based on SEO score or required field presence.
399
+ * Requires a valid root-level `licenseKey` — silently disabled if key is absent or invalid.
400
+ *
401
+ * @example
402
+ * ```ts
403
+ * publishGate: {
404
+ * mode: 'warn',
405
+ * minScore: 70,
406
+ * requiredFields: ['title', 'description', 'openGraph.title'],
407
+ * types: ['post', 'page'],
408
+ * }
409
+ * ```
410
+ */
411
+ /**
412
+ * AI text generation configuration.
413
+ * Supports OpenAI, Anthropic, Groq, Gemini, Ollama, or a custom proxy endpoint.
414
+ * Set `testMode: true` to preview generation without an API key.
415
+ */
416
+ ai?: AiConfig;
417
+ publishGate?: {
418
+ /**
419
+ * 'block' — disables the Publish button with a tooltip reason (default).
420
+ * 'warn' — shows a confirm dialog; editor can bypass and publish anyway.
421
+ * @default 'block'
422
+ */
423
+ mode?: 'block' | 'warn';
424
+ /**
425
+ * Minimum overall SEO health score (0–100) required to publish.
426
+ * Gate fires when the document's score is below this threshold.
427
+ * @default 60
428
+ */
429
+ minScore?: number;
430
+ /**
431
+ * Individual fields that MUST be non-empty. Gate fires if any are missing.
432
+ * Use dot-notation for nested fields: 'openGraph.title', 'twitter.image', etc.
433
+ */
434
+ requiredFields?: PublishGateRequiredField[];
435
+ /**
436
+ * Restrict the gate to specific document types.
437
+ * Omit to apply to all document types that have an `seo` field.
438
+ */
439
+ types?: string[];
440
+ /**
441
+ * Custom message shown in the block tooltip or warn dialog.
442
+ * Accepts a string or a function receiving (score, issues[]).
443
+ */
444
+ message?: string | ((score: number, issues: string[]) => string);
445
+ };
446
+ }
447
+ declare const seofields: sanity.Plugin<void | SeoFieldsPluginConfig>;
448
+
449
+ export { type AiConfig as A, type FieldVisibilityConfig as F, type PublishGateRequiredField as P, type SeoFieldsPluginConfig as S, type ValidHiddenFieldKeys as V, type AiIndustry as a, type AllFieldKeys as b, type SeoFieldConfig as c, type SeoFieldGroup as d, type SeoFieldKeys as e, type SeoObjectFieldName as f, type openGraphFieldKeys as o, seofields as s, type twitterFieldKeys as t };