sanity-plugin-seofields 1.2.5 → 1.2.7

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 (50) hide show
  1. package/README.md +465 -0
  2. package/dist/index.cjs +2604 -0
  3. package/dist/index.cjs.map +1 -0
  4. package/dist/index.d.cts +422 -0
  5. package/dist/index.d.ts +339 -492
  6. package/dist/index.js +1284 -2013
  7. package/dist/index.js.map +1 -1
  8. package/dist/next.cjs +182 -0
  9. package/dist/next.cjs.map +1 -0
  10. package/dist/next.d.cts +241 -0
  11. package/dist/next.d.ts +202 -295
  12. package/dist/next.js +110 -70
  13. package/dist/next.js.map +1 -1
  14. package/dist/types-B91ena4g.d.cts +89 -0
  15. package/dist/types-B91ena4g.d.ts +89 -0
  16. package/package.json +46 -20
  17. package/dist/index.d.mts +0 -575
  18. package/dist/index.mjs +0 -3292
  19. package/dist/index.mjs.map +0 -1
  20. package/dist/next.d.mts +0 -334
  21. package/dist/next.mjs +0 -102
  22. package/dist/next.mjs.map +0 -1
  23. package/sanity.json +0 -8
  24. package/src/components/SeoHealthDashboard.tsx +0 -1568
  25. package/src/components/SeoHealthPane.tsx +0 -81
  26. package/src/components/SeoHealthTool.tsx +0 -11
  27. package/src/components/SeoPreview.tsx +0 -178
  28. package/src/components/meta/MetaDescription.tsx +0 -39
  29. package/src/components/meta/MetaTitle.tsx +0 -44
  30. package/src/components/openGraph/OgDescription.tsx +0 -46
  31. package/src/components/openGraph/OgTitle.tsx +0 -45
  32. package/src/components/twitter/twitterDescription.tsx +0 -45
  33. package/src/components/twitter/twitterTitle.tsx +0 -45
  34. package/src/helpers/SeoMetaTags.tsx +0 -154
  35. package/src/helpers/seoMeta.ts +0 -283
  36. package/src/index.ts +0 -26
  37. package/src/next.ts +0 -12
  38. package/src/plugin.ts +0 -344
  39. package/src/schemas/index.ts +0 -121
  40. package/src/schemas/types/index.ts +0 -20
  41. package/src/schemas/types/metaAttribute/index.ts +0 -60
  42. package/src/schemas/types/metaTag/index.ts +0 -17
  43. package/src/schemas/types/openGraph/index.ts +0 -114
  44. package/src/schemas/types/robots/index.ts +0 -26
  45. package/src/schemas/types/twitter/index.ts +0 -108
  46. package/src/types.ts +0 -108
  47. package/src/utils/fieldsUtils.ts +0 -160
  48. package/src/utils/seoUtils.ts +0 -423
  49. package/src/utils/utils.ts +0 -9
  50. package/v2-incompatible.js +0 -11
package/dist/index.d.ts CHANGED
@@ -1,306 +1,139 @@
1
- import type {ComponentBuilder} from 'sanity/structure'
2
- import {JSX} from 'react'
3
- import {ObjectDefinition} from 'sanity'
4
- import {Plugin as Plugin_2} from 'sanity'
5
- import {PreviewConfig} from 'sanity'
6
- import {default as React_2} from 'react'
7
- import {SchemaTypeDefinition} from 'sanity'
8
- import type {StructureBuilder} from 'sanity/structure'
9
-
10
- export declare type AllFieldKeys = SeoFieldKeys | openGraphFieldKeys | twitterFieldKeys
11
-
12
- export declare function allSchemas(config?: SeoFieldsPluginConfig): SchemaTypeDefinition[]
13
-
14
- /**
15
- * Creates a desk-structure pane for the SEO Health Dashboard.
16
- *
17
- * Returns a **`ComponentBuilder`** with a built-in `.child()` resolver so that
18
- * clicking any document row opens the document editor as a split pane to the right.
19
- *
20
- * Use it **directly** as the `.child()` value — do **not** wrap it in `S.component()`.
21
- *
22
- * ```ts
23
- * // sanity.config.ts
24
- * structure: (S) =>
25
- * S.list().items([
26
- * S.listItem()
27
- * .title('SEO Health')
28
- * .child(
29
- * createSeoHealthPane(S, {
30
- * licenseKey: 'SEOF-XXXX-XXXX-XXXX',
31
- * query: `*[_type == "post" && defined(seo)]{ _id, _type, title, slug, seo, _updatedAt }`,
32
- * })
33
- * ),
34
- * ])
35
- * ```
36
- */
37
- export declare function createSeoHealthPane(
38
- optionsOrS: StructureBuilder,
39
- optionsWhenS: SeoHealthPaneOptions,
40
- ): ComponentBuilder
41
-
42
- export declare interface DocumentWithSeoHealth {
43
- _id: string
44
- _type: string
45
- title?: string
46
- slug?: {
47
- current: string
48
- }
49
- seo?: SeoFields
50
- _updatedAt?: string
51
- health: SeoHealthMetrics
52
- }
53
-
54
- export declare interface FieldVisibilityConfig {
55
- hiddenFields?: ValidHiddenFieldKeys[]
56
- }
57
-
58
- declare interface MetaAttribute {
59
- _type: 'metaAttribute'
60
- key?: string
61
- type?: 'string' | 'image'
62
- value?: string
63
- image?: SanityImage
64
- }
65
-
66
- export declare const metaAttributeSchema: {
67
- type: 'object'
68
- name: 'metaAttribute'
69
- } & Omit<ObjectDefinition, 'preview'> & {
70
- preview?:
71
- | PreviewConfig<
72
- {
73
- attributeName: string
74
- attributeValueString: string
75
- attributeValueImage: string
76
- },
77
- Record<'attributeName' | 'attributeValueString' | 'attributeValueImage', any>
78
- >
79
- | undefined
80
- }
81
-
82
- export declare const metaTagSchema: {
83
- type: 'object'
84
- name: 'metaTag'
85
- } & Omit<ObjectDefinition, 'preview'> & {
86
- preview?: PreviewConfig<Record<string, string>, Record<never, any>> | undefined
87
- }
88
-
89
- export declare type openGraphFieldKeys =
90
- | 'openGraphUrl'
91
- | 'openGraphTitle'
92
- | 'openGraphDescription'
93
- | 'openGraphSiteName'
94
- | 'openGraphType'
95
- | 'openGraphImageType'
96
- | 'openGraphImage'
97
- | 'openGraphImageUrl'
98
-
99
- export declare function openGraphSchema(config?: SeoFieldsPluginConfig): SchemaTypeDefinition
100
-
101
- declare interface OpenGraphSettings {
102
- _type: 'openGraph'
103
- /** The canonical URL for OpenGraph (og:url). Maps to the `url` field in Sanity. */
104
- url?: string
105
- title?: string
106
- description?: string
107
- siteName?: string
108
- type?: 'website' | 'article' | 'profile' | 'book' | 'music' | 'video' | 'product'
109
- imageType?: 'upload' | 'url'
110
- image?: SanityImageWithAlt
111
- imageUrl?: string
112
- }
113
-
114
- export declare const robotsSchema: {
115
- type: 'object'
116
- name: 'robots'
117
- } & Omit<ObjectDefinition, 'preview'> & {
118
- preview?: PreviewConfig<Record<string, string>, Record<never, any>> | undefined
119
- }
120
-
121
- declare interface RobotsSettings {
122
- noIndex?: boolean
123
- noFollow?: boolean
124
- }
125
-
126
- declare interface SanityImage {
127
- _type: 'image'
128
- asset: {
129
- _ref: string
130
- _type: 'reference'
131
- }
132
- hotspot?: {
133
- x: number
134
- y: number
135
- height: number
136
- width: number
137
- }
138
- crop?: {
139
- top: number
140
- bottom: number
141
- left: number
142
- right: number
143
- }
144
- alt?: string
145
- }
146
-
147
- declare interface SanityImageWithAlt extends SanityImage {
148
- alt: string
1
+ import * as sanity from 'sanity';
2
+ import { SchemaTypeDefinition } from 'sanity';
3
+ import { D as DocumentWithSeoHealth } from './types-B91ena4g.js';
4
+ export { S as SeoHealthMetrics, a as SeoHealthStatus } from './types-B91ena4g.js';
5
+ import React from 'react';
6
+ import * as react_jsx_runtime from 'react/jsx-runtime';
7
+ import { StructureBuilder, ComponentBuilder } from 'sanity/structure';
8
+
9
+ interface SeoFieldConfig {
10
+ title?: string;
11
+ description?: string;
149
12
  }
150
-
151
- export declare interface SeoFieldConfig {
152
- title?: string
153
- description?: string
154
- }
155
-
156
- export declare type SeoFieldKeys =
157
- | 'title'
158
- | 'description'
159
- | 'canonicalUrl'
160
- | 'metaImage'
161
- | 'keywords'
162
- | 'metaAttributes'
163
- | 'robots'
164
-
165
- declare interface SeoFields {
166
- _type: 'seoFields'
167
- robots?: RobotsSettings
168
- preview?: string
169
- title?: string
170
- description?: string
171
- metaImage?: SanityImage
172
- metaAttributes?: MetaAttribute[]
173
- keywords?: string[]
174
- canonicalUrl?: string
175
- openGraph?: OpenGraphSettings
176
- twitter?: TwitterCardSettings
13
+ type SeoFieldKeys = 'title' | 'description' | 'canonicalUrl' | 'metaImage' | 'keywords' | 'metaAttributes' | 'robots';
14
+ type openGraphFieldKeys = 'openGraphUrl' | 'openGraphTitle' | 'openGraphDescription' | 'openGraphSiteName' | 'openGraphType' | 'openGraphImageType' | 'openGraphImage' | 'openGraphImageUrl';
15
+ type twitterFieldKeys = 'twitterCard' | 'twitterSite' | 'twitterCreator' | 'twitterTitle' | 'twitterDescription' | 'twitterImageType' | 'twitterImage' | 'twitterImageUrl';
16
+ type AllFieldKeys = SeoFieldKeys | openGraphFieldKeys | twitterFieldKeys;
17
+ type ValidHiddenFieldKeys = Exclude<AllFieldKeys, 'openGraphImageUrl' | 'twitterImageUrl' | 'openGraphImageType' | 'twitterImageType'>;
18
+ interface FieldVisibilityConfig {
19
+ hiddenFields?: ValidHiddenFieldKeys[];
177
20
  }
178
-
179
- declare const seofields: Plugin_2<void | SeoFieldsPluginConfig>
180
- export default seofields
181
-
182
- export declare interface SeoFieldsPluginConfig {
183
- /**
184
- * Enable or configure the SEO preview feature.
185
- * If set to `true`, the SEO preview will be enabled with default settings.
186
- * If set to an object, you can provide a custom prefix function to modify the URL prefix in the preview.
187
- * The prefix function receives the current document as an argument and should return a string.
188
- * Example:
189
- * ```
190
- * seoPreview: {
191
- * prefix: (doc) => `/${doc.slug?.current || 'untitled'}`
192
- * }
193
- * ```
194
- */
195
- seoPreview?:
196
- | boolean
197
- | {
198
- prefix?: (
199
- doc: {
200
- _type?: string
201
- } & Record<string, unknown>,
202
- ) => string
203
- }
204
- /**
205
- * A mapping of field keys to their configuration settings.
206
- * This allows customization of field titles and descriptions.
207
- * For example, to change the title of the 'title' field:
208
- */
209
- fieldOverrides?: Partial<Record<AllFieldKeys, SeoFieldConfig>>
210
- /**
211
- * A mapping of document types to field visibility configurations.
212
- * This allows you to specify which fields should be hidden for specific document types.
213
- */
214
- fieldVisibility?: Record<string, FieldVisibilityConfig>
215
- /**
216
- * A list of fields that should be hidden by default in all document types.
217
- * This can be overridden by specific document type settings in `fieldVisibility`.
218
- */
219
- defaultHiddenFields?: ValidHiddenFieldKeys[]
220
- /**
221
- * The base URL of your website, used for generating full URLs in the SEO preview.
222
- * Defaults to 'https://www.example.com' if not provided.
223
- */
224
- baseUrl?: string
225
- /**
226
- * Enable or configure the SEO Health Dashboard tool.
227
- * If set to `true`, the dashboard is enabled with all defaults.
228
- * If set to an object, you can customise the tool and dashboard settings.
229
- * Defaults to `true`.
230
- * Example:
231
- * ```
232
- * healthDashboard: {
233
- * toolTitle: 'SEO Overview', // Studio nav tab label
234
- * content: {
235
- * icon: '🔍', // Emoji icon shown before the page heading
236
- * title: 'My SEO Dashboard',// Page heading inside the tool (no emoji)
237
- * description: 'Track SEO across all documents', // Subtitle under the heading
238
- * },
239
- * display: {
240
- * typeColumn: false, // Hide the document type column (default: true)
241
- * documentId: false, // Hide the document ID under titles (default: true)
242
- * },
243
- * query: {
244
- * // Option 1 – filter by specific document types
245
- * types: ['post', 'page'],
246
- * // Option 2 – provide a full custom GROQ query (takes precedence over `types`)
247
- * // Must return documents with at least: _id, _type, title, seo, _updatedAt
248
- * groq: `*[seo != null && defined(slug.current)]{ _id, _type, title, slug, seo, _updatedAt }`,
249
- * },
250
- * }
251
- * ```
252
- */
253
- healthDashboard?:
254
- | boolean
255
- | {
21
+ interface SeoFieldsPluginConfig {
22
+ /**
23
+ * Enable or configure the SEO preview feature.
24
+ * If set to `true`, the SEO preview will be enabled with default settings.
25
+ * If set to an object, you can provide a custom prefix function to modify the URL prefix in the preview.
26
+ * The prefix function receives the current document as an argument and should return a string.
27
+ * Example:
28
+ * ```
29
+ * seoPreview: {
30
+ * prefix: (doc) => `/${doc.slug?.current || 'untitled'}`
31
+ * }
32
+ * ```
33
+ */
34
+ seoPreview?: boolean | {
35
+ prefix?: (doc: {
36
+ _type?: string;
37
+ } & Record<string, unknown>) => string;
38
+ };
39
+ /**
40
+ * A mapping of field keys to their configuration settings.
41
+ * This allows customization of field titles and descriptions.
42
+ * For example, to change the title of the 'title' field:
43
+ */
44
+ fieldOverrides?: Partial<Record<AllFieldKeys, SeoFieldConfig>>;
45
+ /**
46
+ * A mapping of document types to field visibility configurations.
47
+ * This allows you to specify which fields should be hidden for specific document types.
48
+ */
49
+ fieldVisibility?: Record<string, FieldVisibilityConfig>;
50
+ /**
51
+ * A list of fields that should be hidden by default in all document types.
52
+ * This can be overridden by specific document type settings in `fieldVisibility`.
53
+ */
54
+ defaultHiddenFields?: ValidHiddenFieldKeys[];
55
+ /**
56
+ * The base URL of your website, used for generating full URLs in the SEO preview.
57
+ * Defaults to 'https://www.example.com' if not provided.
58
+ */
59
+ baseUrl?: string;
60
+ /**
61
+ * Enable or configure the SEO Health Dashboard tool.
62
+ * If set to `true`, the dashboard is enabled with all defaults.
63
+ * If set to an object, you can customise the tool and dashboard settings.
64
+ * Defaults to `true`.
65
+ * Example:
66
+ * ```
67
+ * healthDashboard: {
68
+ * toolTitle: 'SEO Overview', // Studio nav tab label
69
+ * content: {
70
+ * icon: '🔍', // Emoji icon shown before the page heading
71
+ * title: 'My SEO Dashboard',// Page heading inside the tool (no emoji)
72
+ * description: 'Track SEO across all documents', // Subtitle under the heading
73
+ * },
74
+ * display: {
75
+ * typeColumn: false, // Hide the document type column (default: true)
76
+ * documentId: false, // Hide the document ID under titles (default: true)
77
+ * },
78
+ * query: {
79
+ * // Option 1 filter by specific document types
80
+ * types: ['post', 'page'],
81
+ * // Option 2 – provide a full custom GROQ query (takes precedence over `types`)
82
+ * // Must return documents with at least: _id, _type, title, seo, _updatedAt
83
+ * groq: `*[seo != null && defined(slug.current)]{ _id, _type, title, slug, seo, _updatedAt }`,
84
+ * },
85
+ * }
86
+ * ```
87
+ */
88
+ healthDashboard?: boolean | {
256
89
  tool?: {
257
- title?: string
258
- name?: string
259
- }
260
- toolTitle?: string
90
+ title?: string;
91
+ name?: string;
92
+ };
93
+ toolTitle?: string;
261
94
  content?: {
262
- icon?: string
263
- title?: string
264
- description?: string
265
- /** Text shown while the license key is being verified. Defaults to "Verifying license…" */
266
- loadingLicense?: string
267
- /** Text shown while documents are being fetched. Defaults to "Loading documents…" */
268
- loadingDocuments?: string
269
- /** Text shown when the query returns zero results. Defaults to "No documents found" */
270
- noDocuments?: string
271
- }
95
+ icon?: string;
96
+ title?: string;
97
+ description?: string;
98
+ /** Text shown while the license key is being verified. Defaults to "Verifying license…" */
99
+ loadingLicense?: string;
100
+ /** Text shown while documents are being fetched. Defaults to "Loading documents…" */
101
+ loadingDocuments?: string;
102
+ /** Text shown when the query returns zero results. Defaults to "No documents found" */
103
+ noDocuments?: string;
104
+ };
272
105
  display?: {
273
- typeColumn?: boolean
274
- documentId?: boolean
275
- }
106
+ typeColumn?: boolean;
107
+ documentId?: boolean;
108
+ };
276
109
  query?: {
277
- /**
278
- * Limit the dashboard to specific document types.
279
- * Example: `['post', 'page']`
280
- */
281
- types?: string[]
282
- /**
283
- * When using `types`, also require the `seo` field to be non-null.
284
- * Set to `false` to include documents of those types even if `seo` is missing.
285
- * Defaults to `true`.
286
- */
287
- requireSeo?: boolean
288
- /**
289
- * Provide a fully custom GROQ query. Takes precedence over `types`.
290
- * The query must return documents with at least: _id, _type, title, seo, _updatedAt
291
- */
292
- groq?: string
293
- }
110
+ /**
111
+ * Limit the dashboard to specific document types.
112
+ * Example: `['post', 'page']`
113
+ */
114
+ types?: string[];
115
+ /**
116
+ * When using `types`, also require the `seo` field to be non-null.
117
+ * Set to `false` to include documents of those types even if `seo` is missing.
118
+ * Defaults to `true`.
119
+ */
120
+ requireSeo?: boolean;
121
+ /**
122
+ * Provide a fully custom GROQ query. Takes precedence over `types`.
123
+ * The query must return documents with at least: _id, _type, title, seo, _updatedAt
124
+ */
125
+ groq?: string;
126
+ };
294
127
  /**
295
128
  * The Sanity API version to use for the client (e.g. '2023-01-01').
296
129
  * Defaults to '2023-01-01'.
297
130
  */
298
- apiVersion?: string
131
+ apiVersion?: string;
299
132
  /**
300
133
  * License key for the SEO Health Dashboard pro feature.
301
134
  * Obtain a license at https://sanity-plugin-seofields.thehardik.in
302
135
  */
303
- licenseKey?: string
136
+ licenseKey?: string;
304
137
  /**
305
138
  * Map raw `_type` values to human-readable display labels.
306
139
  * Used in both the Type column and the Type filter dropdown.
@@ -309,13 +142,13 @@ export declare interface SeoFieldsPluginConfig {
309
142
  * @example
310
143
  * typeLabels: { productDrug: 'Products', singleCondition: 'Condition' }
311
144
  */
312
- typeLabels?: Record<string, string>
145
+ typeLabels?: Record<string, string>;
313
146
  /**
314
147
  * Controls how the document type is rendered in the Type column.
315
148
  * - `'badge'` (default) — coloured pill
316
149
  * - `'text'` — plain text, useful for dense layouts
317
150
  */
318
- typeColumnMode?: 'badge' | 'text'
151
+ typeColumnMode?: 'badge' | 'text';
319
152
  /**
320
153
  * The document field to use as the display title in the dashboard.
321
154
  *
@@ -328,7 +161,7 @@ export declare interface SeoFieldsPluginConfig {
328
161
  * @example
329
162
  * titleField: { post: 'title', product: 'name', category: 'label' }
330
163
  */
331
- titleField?: string | Record<string, string>
164
+ titleField?: string | Record<string, string>;
332
165
  /**
333
166
  * Callback function to render a custom badge next to the document title.
334
167
  * Receives the full document and should return badge data or undefined.
@@ -341,14 +174,12 @@ export declare interface SeoFieldsPluginConfig {
341
174
  * return { label: 'Private', bgColor: '#fef3c7', textColor: '#92400e' }
342
175
  * }
343
176
  */
344
- docBadge?: (doc: DocumentWithSeoHealth & Record<string, unknown>) =>
345
- | {
346
- label: string
347
- bgColor?: string
348
- textColor?: string
349
- fontSize?: string
350
- }
351
- | undefined
177
+ docBadge?: (doc: DocumentWithSeoHealth & Record<string, unknown>) => {
178
+ label: string;
179
+ bgColor?: string;
180
+ textColor?: string;
181
+ fontSize?: string;
182
+ } | undefined;
352
183
  /**
353
184
  * The `name` of the Sanity structure tool that contains the monitored documents.
354
185
  * Required when you have multiple structure tools and the documents live in a
@@ -358,7 +189,7 @@ export declare interface SeoFieldsPluginConfig {
358
189
  * @example
359
190
  * structureTool: 'common'
360
191
  */
361
- structureTool?: string
192
+ structureTool?: string;
362
193
  /**
363
194
  * Enable preview/demo mode to show dummy data.
364
195
  * Useful for testing, documentation, or showcasing the dashboard.
@@ -368,151 +199,180 @@ export declare interface SeoFieldsPluginConfig {
368
199
  * @example
369
200
  * previewMode: true
370
201
  */
371
- previewMode?: boolean
372
- }
202
+ previewMode?: boolean;
203
+ };
373
204
  }
374
-
375
- export declare function seoFieldsSchema(config?: SeoFieldsPluginConfig): SchemaTypeDefinition
376
-
377
- export declare const SeoHealthDashboard: React_2.FC<SeoHealthDashboardProps>
378
-
379
- declare interface SeoHealthDashboardProps {
380
- icon?: string
381
- title?: string
382
- description?: string
383
- showTypeColumn?: boolean
384
- showDocumentId?: boolean
385
- /**
386
- * Limit the dashboard to specific document type names.
387
- * If both queryTypes and customQuery are provided, customQuery takes precedence.
388
- */
389
- queryTypes?: string[]
390
- /**
391
- * When using `queryTypes`, also filter by `seo != null`.
392
- * Set to `false` to include documents of those types even without an seo field.
393
- * Defaults to `true`.
394
- */
395
- queryRequireSeo?: boolean
396
- /**
397
- * A fully custom GROQ query used to fetch documents.
398
- * Must return objects with at least: _id, _type, title, seo, _updatedAt
399
- * Takes precedence over queryTypes.
400
- */
401
- customQuery?: string
402
- /**
403
- * The Sanity API version to use for the client (e.g. '2023-01-01').
404
- * Defaults to '2023-01-01'.
405
- */
406
- apiVersion?: string
407
- /**
408
- * License key for the SEO Health Dashboard.
409
- * Obtain a key at https://sanity-plugin-seofields.thehardik.in
410
- */
411
- licenseKey?: string
412
- /**
413
- * Map raw `_type` values to human-readable display labels used in the
414
- * Type column and the Type filter dropdown.
415
- * Any type without an entry falls back to the raw `_type` string.
416
- *
417
- * @example
418
- * typeLabels={{ productDrug: 'Products', singleCondition: 'Condition' }}
419
- */
420
- typeLabels?: Record<string, string>
421
- /**
422
- * Controls how the type is rendered in the Type column.
423
- * - `'badge'` (default) — coloured pill, consistent with score badges
424
- * - `'text'` — plain text, useful for dense layouts
425
- */
426
- typeColumnMode?: 'badge' | 'text'
427
- /**
428
- * The document field to use as the display title.
429
- *
430
- * - `string` — use this field for every document type (e.g. `'name'`)
431
- * - `Record<string, string>` — per-type mapping; unmapped types fall back to `title`
432
- *
433
- * @example
434
- * // Same field for all types
435
- * titleField: 'name'
436
- *
437
- * @example
438
- * // Different field per type
439
- * titleField: { post: 'title', product: 'name', category: 'label' }
440
- */
441
- titleField?: string | Record<string, string>
442
- /**
443
- * Callback function to render a custom badge next to the document title.
444
- * Receives the full document and should return badge data or undefined.
445
- *
446
- * @example
447
- * docBadge: (doc) => {
448
- * if (doc.services === 'NHS')
449
- * return { label: 'NHS', bgColor: '#e0f2fe', textColor: '#0369a1' }
450
- * if (doc.services === 'Private')
451
- * return { label: 'Private', bgColor: '#fef3c7', textColor: '#92400e' }
452
- * }
453
- */
454
- docBadge?: (doc: DocumentWithSeoHealth & Record<string, unknown>) =>
455
- | {
456
- label: string
457
- bgColor?: string
458
- textColor?: string
459
- fontSize?: string
460
- }
461
- | undefined
462
- /**
463
- * Custom text shown while the license key is being verified.
464
- * Defaults to `"Verifying license…"`.
465
- */
466
- loadingLicense?: React_2.ReactNode
467
- /**
468
- * Custom text shown while documents are being fetched.
469
- * Defaults to `"Loading documents…"`.
470
- */
471
- loadingDocuments?: React_2.ReactNode
472
- /**
473
- * Custom text shown when the query returns zero results.
474
- * Defaults to `"No documents found"`.
475
- */
476
- noDocuments?: React_2.ReactNode
477
- /**
478
- * Enable preview/demo mode to show dummy data.
479
- * Useful for testing, documentation, or showcasing the dashboard.
480
- * When enabled, displays realistic sample documents with various SEO scores.
481
- * Defaults to `false`.
482
- */
483
- previewMode?: boolean
484
- /**
485
- * When `true`, clicking a document title opens the document editor as a split
486
- * pane to the right, keeping the SEO Health pane visible on the left.
487
- * This uses Sanity's pane router and requires the component to be rendered
488
- * inside a desk-structure pane context (i.e. via `createSeoHealthPane`).
489
- *
490
- * When `false` (default), clicking navigates to the document via the standard
491
- * intent-link system (full navigation).
492
- *
493
- * This is set to `true` automatically by `createSeoHealthPane`.
494
- */
495
- openInPane?: boolean
496
- /**
497
- * The `name` of the Sanity structure tool that contains the monitored documents.
498
- * When provided, clicking a document title navigates directly to that tool's
499
- * intent URL (`/{basePath}/{structureTool}/intent/edit/id=…;type=…/`) instead of
500
- * using the generic intent resolver, which always picks the first registered tool.
501
- *
502
- * Required when you have multiple structure tools and the documents live in a
503
- * non-default one (e.g. `name: 'common'`).
504
- *
505
- * @example
506
- * structureTool: 'common'
507
- */
508
- structureTool?: string
205
+ declare const seofields: sanity.Plugin<void | SeoFieldsPluginConfig>;
206
+
207
+ declare function seoFieldsSchema(config?: SeoFieldsPluginConfig): SchemaTypeDefinition;
208
+
209
+ declare function types(config?: SeoFieldsPluginConfig): SchemaTypeDefinition[];
210
+
211
+ declare const _default$2: {
212
+ type: "object";
213
+ name: "metaAttribute";
214
+ } & Omit<sanity.ObjectDefinition, "preview"> & {
215
+ preview?: sanity.PreviewConfig<{
216
+ attributeName: string;
217
+ attributeValueString: string;
218
+ attributeValueImage: string;
219
+ }, Record<"attributeName" | "attributeValueString" | "attributeValueImage", any>> | undefined;
220
+ };
221
+
222
+ declare const _default$1: {
223
+ type: "object";
224
+ name: "metaTag";
225
+ } & Omit<sanity.ObjectDefinition, "preview"> & {
226
+ preview?: sanity.PreviewConfig<Record<string, string>, Record<never, any>> | undefined;
227
+ };
228
+
229
+ declare function openGraph(config?: SeoFieldsPluginConfig): SchemaTypeDefinition;
230
+
231
+ declare const _default: {
232
+ type: "object";
233
+ name: "robots";
234
+ } & Omit<sanity.ObjectDefinition, "preview"> & {
235
+ preview?: sanity.PreviewConfig<Record<string, string>, Record<never, any>> | undefined;
236
+ };
237
+
238
+ declare function twitter(config?: SeoFieldsPluginConfig): SchemaTypeDefinition;
239
+
240
+ interface SeoHealthDashboardProps {
241
+ icon?: string;
242
+ title?: string;
243
+ description?: string;
244
+ showTypeColumn?: boolean;
245
+ showDocumentId?: boolean;
246
+ /**
247
+ * Limit the dashboard to specific document type names.
248
+ * If both queryTypes and customQuery are provided, customQuery takes precedence.
249
+ */
250
+ queryTypes?: string[];
251
+ /**
252
+ * When using `queryTypes`, also filter by `seo != null`.
253
+ * Set to `false` to include documents of those types even without an seo field.
254
+ * Defaults to `true`.
255
+ */
256
+ queryRequireSeo?: boolean;
257
+ /**
258
+ * A fully custom GROQ query used to fetch documents.
259
+ * Must return objects with at least: _id, _type, title, seo, _updatedAt
260
+ * Takes precedence over queryTypes.
261
+ */
262
+ customQuery?: string;
263
+ /**
264
+ * The Sanity API version to use for the client (e.g. '2023-01-01').
265
+ * Defaults to '2023-01-01'.
266
+ */
267
+ apiVersion?: string;
268
+ /**
269
+ * License key for the SEO Health Dashboard.
270
+ * Obtain a key at https://sanity-plugin-seofields.thehardik.in
271
+ */
272
+ licenseKey?: string;
273
+ /**
274
+ * Map raw `_type` values to human-readable display labels used in the
275
+ * Type column and the Type filter dropdown.
276
+ * Any type without an entry falls back to the raw `_type` string.
277
+ *
278
+ * @example
279
+ * typeLabels={{ productDrug: 'Products', singleCondition: 'Condition' }}
280
+ */
281
+ typeLabels?: Record<string, string>;
282
+ /**
283
+ * Controls how the type is rendered in the Type column.
284
+ * - `'badge'` (default) — coloured pill, consistent with score badges
285
+ * - `'text'` plain text, useful for dense layouts
286
+ */
287
+ typeColumnMode?: 'badge' | 'text';
288
+ /**
289
+ * The document field to use as the display title.
290
+ *
291
+ * - `string` — use this field for every document type (e.g. `'name'`)
292
+ * - `Record<string, string>` — per-type mapping; unmapped types fall back to `title`
293
+ *
294
+ * @example
295
+ * // Same field for all types
296
+ * titleField: 'name'
297
+ *
298
+ * @example
299
+ * // Different field per type
300
+ * titleField: { post: 'title', product: 'name', category: 'label' }
301
+ */
302
+ titleField?: string | Record<string, string>;
303
+ /**
304
+ * Callback function to render a custom badge next to the document title.
305
+ * Receives the full document and should return badge data or undefined.
306
+ *
307
+ * @example
308
+ * docBadge: (doc) => {
309
+ * if (doc.services === 'NHS')
310
+ * return { label: 'NHS', bgColor: '#e0f2fe', textColor: '#0369a1' }
311
+ * if (doc.services === 'Private')
312
+ * return { label: 'Private', bgColor: '#fef3c7', textColor: '#92400e' }
313
+ * }
314
+ */
315
+ docBadge?: (doc: DocumentWithSeoHealth & Record<string, unknown>) => {
316
+ label: string;
317
+ bgColor?: string;
318
+ textColor?: string;
319
+ fontSize?: string;
320
+ } | undefined;
321
+ /**
322
+ * Custom text shown while the license key is being verified.
323
+ * Defaults to `"Verifying license…"`.
324
+ */
325
+ loadingLicense?: React.ReactNode;
326
+ /**
327
+ * Custom text shown while documents are being fetched.
328
+ * Defaults to `"Loading documents…"`.
329
+ */
330
+ loadingDocuments?: React.ReactNode;
331
+ /**
332
+ * Custom text shown when the query returns zero results.
333
+ * Defaults to `"No documents found"`.
334
+ */
335
+ noDocuments?: React.ReactNode;
336
+ /**
337
+ * Enable preview/demo mode to show dummy data.
338
+ * Useful for testing, documentation, or showcasing the dashboard.
339
+ * When enabled, displays realistic sample documents with various SEO scores.
340
+ * Defaults to `false`.
341
+ */
342
+ previewMode?: boolean;
343
+ /**
344
+ * When `true`, clicking a document title opens the document editor as a split
345
+ * pane to the right, keeping the SEO Health pane visible on the left.
346
+ * This uses Sanity's pane router and requires the component to be rendered
347
+ * inside a desk-structure pane context (i.e. via `createSeoHealthPane`).
348
+ *
349
+ * When `false` (default), clicking navigates to the document via the standard
350
+ * intent-link system (full navigation).
351
+ *
352
+ * This is set to `true` automatically by `createSeoHealthPane`.
353
+ */
354
+ openInPane?: boolean;
355
+ /**
356
+ * The `name` of the Sanity structure tool that contains the monitored documents.
357
+ * When provided, clicking a document title navigates directly to that tool's
358
+ * intent URL (`/{basePath}/{structureTool}/intent/edit/id=…;type=…/`) instead of
359
+ * using the generic intent resolver, which always picks the first registered tool.
360
+ *
361
+ * Required when you have multiple structure tools and the documents live in a
362
+ * non-default one (e.g. `name: 'common'`).
363
+ *
364
+ * @example
365
+ * structureTool: 'common'
366
+ */
367
+ structureTool?: string;
509
368
  }
369
+ declare const SeoHealthDashboard: React.FC<SeoHealthDashboardProps>;
510
370
 
511
- export declare interface SeoHealthMetrics {
512
- score: number
513
- status: SeoHealthStatus
514
- issues: string[]
515
- }
371
+ /**
372
+ * Sanity Tool component for the SEO Health Dashboard
373
+ * This component wraps the SeoHealthDashboard for use as a custom tool in Sanity Studio
374
+ */
375
+ declare const SeoHealthTool: (props: SeoHealthDashboardProps) => react_jsx_runtime.JSX.Element;
516
376
 
517
377
  /**
518
378
  * Options accepted by `createSeoHealthPane`.
@@ -520,56 +380,43 @@ export declare interface SeoHealthMetrics {
520
380
  *
521
381
  * `licenseKey` is **required** — the dashboard will not render without it.
522
382
  */
523
- export declare interface SeoHealthPaneOptions extends Omit<SeoHealthDashboardProps, 'customQuery'> {
524
- /** Required license key (format: `SEOF-XXXX-XXXX-XXXX`). */
525
- licenseKey: string
526
- /**
527
- * A fully custom GROQ query used to fetch documents for the dashboard.
528
- * The query must return documents with at least: `_id`, `_type`, `title`, `seo`, `_updatedAt`.
529
- *
530
- * Takes precedence over `queryTypes` when both are provided.
531
- *
532
- * @example
533
- * query: `*[_type in ["post","page"] && defined(seo)]{ _id, _type, title, slug, seo, _updatedAt }`
534
- */
535
- query?: string
383
+ interface SeoHealthPaneOptions extends Omit<SeoHealthDashboardProps, 'customQuery'> {
384
+ /** Required license key (format: `SEOF-XXXX-XXXX-XXXX`). */
385
+ licenseKey: string;
386
+ /**
387
+ * A fully custom GROQ query used to fetch documents for the dashboard.
388
+ * The query must return documents with at least: `_id`, `_type`, `title`, `seo`, `_updatedAt`.
389
+ *
390
+ * Takes precedence over `queryTypes` when both are provided.
391
+ *
392
+ * @example
393
+ * query: `*[_type in ["post","page"] && defined(seo)]{ _id, _type, title, slug, seo, _updatedAt }`
394
+ */
395
+ query?: string;
536
396
  }
537
-
538
- export declare type SeoHealthStatus = 'excellent' | 'good' | 'fair' | 'poor' | 'missing'
539
-
540
397
  /**
541
- * Sanity Tool component for the SEO Health Dashboard
542
- * This component wraps the SeoHealthDashboard for use as a custom tool in Sanity Studio
398
+ * Creates a desk-structure pane for the SEO Health Dashboard.
399
+ *
400
+ * Returns a **`ComponentBuilder`** with a built-in `.child()` resolver so that
401
+ * clicking any document row opens the document editor as a split pane to the right.
402
+ *
403
+ * Use it **directly** as the `.child()` value — do **not** wrap it in `S.component()`.
404
+ *
405
+ * ```ts
406
+ * // sanity.config.ts
407
+ * structure: (S) =>
408
+ * S.list().items([
409
+ * S.listItem()
410
+ * .title('SEO Health')
411
+ * .child(
412
+ * createSeoHealthPane(S, {
413
+ * licenseKey: 'SEOF-XXXX-XXXX-XXXX',
414
+ * query: `*[_type == "post" && defined(seo)]{ _id, _type, title, slug, seo, _updatedAt }`,
415
+ * })
416
+ * ),
417
+ * ])
418
+ * ```
543
419
  */
544
- export declare const SeoHealthTool: (props: SeoHealthDashboardProps) => JSX.Element
545
-
546
- declare interface TwitterCardSettings {
547
- _type: 'twitter'
548
- card?: 'summary' | 'summary_large_image' | 'app' | 'player'
549
- site?: string
550
- creator?: string
551
- title?: string
552
- description?: string
553
- imageType?: 'upload' | 'url'
554
- image?: SanityImageWithAlt
555
- imageUrl?: string
556
- }
557
-
558
- export declare type twitterFieldKeys =
559
- | 'twitterCard'
560
- | 'twitterSite'
561
- | 'twitterCreator'
562
- | 'twitterTitle'
563
- | 'twitterDescription'
564
- | 'twitterImageType'
565
- | 'twitterImage'
566
- | 'twitterImageUrl'
567
-
568
- export declare function twitterSchema(config?: SeoFieldsPluginConfig): SchemaTypeDefinition
569
-
570
- export declare type ValidHiddenFieldKeys = Exclude<
571
- AllFieldKeys,
572
- 'openGraphImageUrl' | 'twitterImageUrl' | 'openGraphImageType' | 'twitterImageType'
573
- >
420
+ declare function createSeoHealthPane(optionsOrS: StructureBuilder, optionsWhenS: SeoHealthPaneOptions): ComponentBuilder;
574
421
 
575
- export {}
422
+ export { type AllFieldKeys, DocumentWithSeoHealth, type FieldVisibilityConfig, type SeoFieldConfig, type SeoFieldKeys, type SeoFieldsPluginConfig, SeoHealthDashboard, type SeoHealthPaneOptions, SeoHealthTool, type ValidHiddenFieldKeys, types as allSchemas, createSeoHealthPane, seofields as default, _default$2 as metaAttributeSchema, _default$1 as metaTagSchema, type openGraphFieldKeys, openGraph as openGraphSchema, _default as robotsSchema, seoFieldsSchema, type twitterFieldKeys, twitter as twitterSchema };