sanity-plugin-seofields 1.3.1 → 1.4.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.
package/dist/index.d.cts CHANGED
@@ -1,10 +1,9 @@
1
1
  import * as sanity from 'sanity';
2
2
  import { SchemaTypeDefinition } from 'sanity';
3
- import { D as DocumentWithSeoHealth } from './types-B91ena4g.cjs';
4
- export { S as SeoHealthMetrics, a as SeoHealthStatus } from './types-B91ena4g.cjs';
5
- import React from 'react';
3
+ import { D as DocumentWithSeoHealth, c as DeprecationWarning } from './types-R3n9Fu4w.cjs';
4
+ export { d as SeoHealthMetrics, e as SeoHealthStatus } from './types-R3n9Fu4w.cjs';
6
5
  import { StructureBuilder, ComponentBuilder } from 'sanity/structure';
7
- import * as react_jsx_runtime from 'react/jsx-runtime';
6
+ import React from 'react';
8
7
 
9
8
  interface SeoFieldConfig {
10
9
  title?: string;
@@ -102,10 +101,28 @@ interface SeoFieldsPluginConfig {
102
101
  /** Text shown when the query returns zero results. Defaults to "No documents found" */
103
102
  noDocuments?: string;
104
103
  };
104
+ /**
105
+ * @deprecated Use `showTypeColumn` instead. Will be removed in a future major version.
106
+ * @see https://github.com/hardik-143/sanity-plugin-seofields/blob/main/CHANGELOG.md#132--2026-03-23
107
+ */
105
108
  display?: {
109
+ /** @deprecated Use top-level `showTypeColumn` instead. */
106
110
  typeColumn?: boolean;
111
+ /** @deprecated Use top-level `showDocumentId` instead. */
107
112
  documentId?: boolean;
108
113
  };
114
+ /**
115
+ * Show or hide the document type column in the results table.
116
+ * Replaces the deprecated `display.typeColumn`.
117
+ * Defaults to `true`.
118
+ */
119
+ showTypeColumn?: boolean;
120
+ /**
121
+ * Show or hide the Sanity document `_id` under each title.
122
+ * Replaces the deprecated `display.documentId`.
123
+ * Defaults to `true`.
124
+ */
125
+ showDocumentId?: boolean;
109
126
  query?: {
110
127
  /**
111
128
  * Limit the dashboard to specific document types.
@@ -139,10 +156,23 @@ interface SeoFieldsPluginConfig {
139
156
  * Used in both the Type column and the Type filter dropdown.
140
157
  * Any type without an entry falls back to the raw `_type` string.
141
158
  *
159
+ * @deprecated Use `typeDisplayLabels` instead. Will be removed in a future major version.
160
+ * @see https://github.com/hardik-143/sanity-plugin-seofields/blob/main/CHANGELOG.md#132--2026-03-23
161
+ *
142
162
  * @example
143
163
  * typeLabels: { productDrug: 'Products', singleCondition: 'Condition' }
144
164
  */
145
165
  typeLabels?: Record<string, string>;
166
+ /**
167
+ * Map raw `_type` values to human-readable display labels.
168
+ * Replaces the deprecated `typeLabels`.
169
+ * Used in both the Type column and the Type filter dropdown.
170
+ * Any type without an entry falls back to the raw `_type` string.
171
+ *
172
+ * @example
173
+ * typeDisplayLabels: { productDrug: 'Products', singleCondition: 'Condition' }
174
+ */
175
+ typeDisplayLabels?: Record<string, string>;
146
176
  /**
147
177
  * Controls how the document type is rendered in the Type column.
148
178
  * - `'badge'` (default) — coloured pill
@@ -166,15 +196,35 @@ interface SeoFieldsPluginConfig {
166
196
  * Callback function to render a custom badge next to the document title.
167
197
  * Receives the full document and should return badge data or undefined.
168
198
  *
199
+ * @deprecated Use `getDocumentBadge` instead. Will be removed in a future major version.
200
+ * @see https://github.com/hardik-143/sanity-plugin-seofields/blob/main/CHANGELOG.md#132--2026-03-23
201
+ *
169
202
  * @example
170
203
  * docBadge: (doc) => {
171
204
  * if (doc.services === 'NHS')
172
205
  * return { label: 'NHS', bgColor: '#e0f2fe', textColor: '#0369a1' }
206
+ * }
207
+ */
208
+ docBadge?: (doc: DocumentWithSeoHealth & Record<string, unknown>) => {
209
+ label: string;
210
+ bgColor?: string;
211
+ textColor?: string;
212
+ fontSize?: string;
213
+ } | undefined;
214
+ /**
215
+ * Callback function to render a custom badge next to the document title.
216
+ * Replaces the deprecated `docBadge`.
217
+ * Receives the full document and should return badge data or undefined.
218
+ *
219
+ * @example
220
+ * getDocumentBadge: (doc) => {
221
+ * if (doc.services === 'NHS')
222
+ * return { label: 'NHS', bgColor: '#e0f2fe', textColor: '#0369a1' }
173
223
  * if (doc.services === 'Private')
174
224
  * return { label: 'Private', bgColor: '#fef3c7', textColor: '#92400e' }
175
225
  * }
176
226
  */
177
- docBadge?: (doc: DocumentWithSeoHealth & Record<string, unknown>) => {
227
+ getDocumentBadge?: (doc: DocumentWithSeoHealth & Record<string, unknown>) => {
178
228
  label: string;
179
229
  bgColor?: string;
180
230
  textColor?: string;
@@ -273,12 +323,13 @@ interface SeoHealthDashboardProps {
273
323
  /**
274
324
  * Map raw `_type` values to human-readable display labels used in the
275
325
  * Type column and the Type filter dropdown.
326
+ * Replaces the deprecated `typeLabels`.
276
327
  * Any type without an entry falls back to the raw `_type` string.
277
328
  *
278
329
  * @example
279
- * typeLabels={{ productDrug: 'Products', singleCondition: 'Condition' }}
330
+ * typeDisplayLabels={{ productDrug: 'Products', singleCondition: 'Condition' }}
280
331
  */
281
- typeLabels?: Record<string, string>;
332
+ typeDisplayLabels?: Record<string, string>;
282
333
  /**
283
334
  * Controls how the type is rendered in the Type column.
284
335
  * - `'badge'` (default) — coloured pill, consistent with score badges
@@ -302,17 +353,18 @@ interface SeoHealthDashboardProps {
302
353
  titleField?: string | Record<string, string>;
303
354
  /**
304
355
  * Callback function to render a custom badge next to the document title.
356
+ * Replaces the deprecated `docBadge`.
305
357
  * Receives the full document and should return badge data or undefined.
306
358
  *
307
359
  * @example
308
- * docBadge: (doc) => {
360
+ * getDocumentBadge: (doc) => {
309
361
  * if (doc.services === 'NHS')
310
362
  * return { label: 'NHS', bgColor: '#e0f2fe', textColor: '#0369a1' }
311
363
  * if (doc.services === 'Private')
312
364
  * return { label: 'Private', bgColor: '#fef3c7', textColor: '#92400e' }
313
365
  * }
314
366
  */
315
- docBadge?: (doc: DocumentWithSeoHealth & Record<string, unknown>) => {
367
+ getDocumentBadge?: (doc: DocumentWithSeoHealth & Record<string, unknown>) => {
316
368
  label: string;
317
369
  bgColor?: string;
318
370
  textColor?: string;
@@ -365,8 +417,13 @@ interface SeoHealthDashboardProps {
365
417
  * structureTool: 'common'
366
418
  */
367
419
  structureTool?: string;
420
+ /**
421
+ * @internal — populated by the plugin when deprecated config keys are detected.
422
+ * Each entry carries the migration hint, the version it was deprecated in, and
423
+ * the matching changelog URL so the banner can group warnings by release.
424
+ */
425
+ _deprecationWarnings?: DeprecationWarning[];
368
426
  }
369
- declare const SeoHealthDashboard: React.FC<SeoHealthDashboardProps>;
370
427
 
371
428
  /**
372
429
  * Options accepted by `createSeoHealthPane`.
@@ -413,10 +470,4 @@ interface SeoHealthPaneOptions extends Omit<SeoHealthDashboardProps, 'customQuer
413
470
  */
414
471
  declare function createSeoHealthPane(optionsOrS: StructureBuilder, optionsWhenS: SeoHealthPaneOptions): ComponentBuilder;
415
472
 
416
- /**
417
- * Sanity Tool component for the SEO Health Dashboard
418
- * This component wraps the SeoHealthDashboard for use as a custom tool in Sanity Studio
419
- */
420
- declare const SeoHealthTool: (props: SeoHealthDashboardProps) => react_jsx_runtime.JSX.Element;
421
-
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 };
473
+ export { type AllFieldKeys, DocumentWithSeoHealth, type FieldVisibilityConfig, type SeoFieldConfig, type SeoFieldKeys, type SeoFieldsPluginConfig, type SeoHealthPaneOptions, 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 };
package/dist/index.d.ts CHANGED
@@ -1,10 +1,9 @@
1
1
  import * as sanity from 'sanity';
2
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';
3
+ import { D as DocumentWithSeoHealth, c as DeprecationWarning } from './types-R3n9Fu4w.js';
4
+ export { d as SeoHealthMetrics, e as SeoHealthStatus } from './types-R3n9Fu4w.js';
6
5
  import { StructureBuilder, ComponentBuilder } from 'sanity/structure';
7
- import * as react_jsx_runtime from 'react/jsx-runtime';
6
+ import React from 'react';
8
7
 
9
8
  interface SeoFieldConfig {
10
9
  title?: string;
@@ -102,10 +101,28 @@ interface SeoFieldsPluginConfig {
102
101
  /** Text shown when the query returns zero results. Defaults to "No documents found" */
103
102
  noDocuments?: string;
104
103
  };
104
+ /**
105
+ * @deprecated Use `showTypeColumn` instead. Will be removed in a future major version.
106
+ * @see https://github.com/hardik-143/sanity-plugin-seofields/blob/main/CHANGELOG.md#132--2026-03-23
107
+ */
105
108
  display?: {
109
+ /** @deprecated Use top-level `showTypeColumn` instead. */
106
110
  typeColumn?: boolean;
111
+ /** @deprecated Use top-level `showDocumentId` instead. */
107
112
  documentId?: boolean;
108
113
  };
114
+ /**
115
+ * Show or hide the document type column in the results table.
116
+ * Replaces the deprecated `display.typeColumn`.
117
+ * Defaults to `true`.
118
+ */
119
+ showTypeColumn?: boolean;
120
+ /**
121
+ * Show or hide the Sanity document `_id` under each title.
122
+ * Replaces the deprecated `display.documentId`.
123
+ * Defaults to `true`.
124
+ */
125
+ showDocumentId?: boolean;
109
126
  query?: {
110
127
  /**
111
128
  * Limit the dashboard to specific document types.
@@ -139,10 +156,23 @@ interface SeoFieldsPluginConfig {
139
156
  * Used in both the Type column and the Type filter dropdown.
140
157
  * Any type without an entry falls back to the raw `_type` string.
141
158
  *
159
+ * @deprecated Use `typeDisplayLabels` instead. Will be removed in a future major version.
160
+ * @see https://github.com/hardik-143/sanity-plugin-seofields/blob/main/CHANGELOG.md#132--2026-03-23
161
+ *
142
162
  * @example
143
163
  * typeLabels: { productDrug: 'Products', singleCondition: 'Condition' }
144
164
  */
145
165
  typeLabels?: Record<string, string>;
166
+ /**
167
+ * Map raw `_type` values to human-readable display labels.
168
+ * Replaces the deprecated `typeLabels`.
169
+ * Used in both the Type column and the Type filter dropdown.
170
+ * Any type without an entry falls back to the raw `_type` string.
171
+ *
172
+ * @example
173
+ * typeDisplayLabels: { productDrug: 'Products', singleCondition: 'Condition' }
174
+ */
175
+ typeDisplayLabels?: Record<string, string>;
146
176
  /**
147
177
  * Controls how the document type is rendered in the Type column.
148
178
  * - `'badge'` (default) — coloured pill
@@ -166,15 +196,35 @@ interface SeoFieldsPluginConfig {
166
196
  * Callback function to render a custom badge next to the document title.
167
197
  * Receives the full document and should return badge data or undefined.
168
198
  *
199
+ * @deprecated Use `getDocumentBadge` instead. Will be removed in a future major version.
200
+ * @see https://github.com/hardik-143/sanity-plugin-seofields/blob/main/CHANGELOG.md#132--2026-03-23
201
+ *
169
202
  * @example
170
203
  * docBadge: (doc) => {
171
204
  * if (doc.services === 'NHS')
172
205
  * return { label: 'NHS', bgColor: '#e0f2fe', textColor: '#0369a1' }
206
+ * }
207
+ */
208
+ docBadge?: (doc: DocumentWithSeoHealth & Record<string, unknown>) => {
209
+ label: string;
210
+ bgColor?: string;
211
+ textColor?: string;
212
+ fontSize?: string;
213
+ } | undefined;
214
+ /**
215
+ * Callback function to render a custom badge next to the document title.
216
+ * Replaces the deprecated `docBadge`.
217
+ * Receives the full document and should return badge data or undefined.
218
+ *
219
+ * @example
220
+ * getDocumentBadge: (doc) => {
221
+ * if (doc.services === 'NHS')
222
+ * return { label: 'NHS', bgColor: '#e0f2fe', textColor: '#0369a1' }
173
223
  * if (doc.services === 'Private')
174
224
  * return { label: 'Private', bgColor: '#fef3c7', textColor: '#92400e' }
175
225
  * }
176
226
  */
177
- docBadge?: (doc: DocumentWithSeoHealth & Record<string, unknown>) => {
227
+ getDocumentBadge?: (doc: DocumentWithSeoHealth & Record<string, unknown>) => {
178
228
  label: string;
179
229
  bgColor?: string;
180
230
  textColor?: string;
@@ -273,12 +323,13 @@ interface SeoHealthDashboardProps {
273
323
  /**
274
324
  * Map raw `_type` values to human-readable display labels used in the
275
325
  * Type column and the Type filter dropdown.
326
+ * Replaces the deprecated `typeLabels`.
276
327
  * Any type without an entry falls back to the raw `_type` string.
277
328
  *
278
329
  * @example
279
- * typeLabels={{ productDrug: 'Products', singleCondition: 'Condition' }}
330
+ * typeDisplayLabels={{ productDrug: 'Products', singleCondition: 'Condition' }}
280
331
  */
281
- typeLabels?: Record<string, string>;
332
+ typeDisplayLabels?: Record<string, string>;
282
333
  /**
283
334
  * Controls how the type is rendered in the Type column.
284
335
  * - `'badge'` (default) — coloured pill, consistent with score badges
@@ -302,17 +353,18 @@ interface SeoHealthDashboardProps {
302
353
  titleField?: string | Record<string, string>;
303
354
  /**
304
355
  * Callback function to render a custom badge next to the document title.
356
+ * Replaces the deprecated `docBadge`.
305
357
  * Receives the full document and should return badge data or undefined.
306
358
  *
307
359
  * @example
308
- * docBadge: (doc) => {
360
+ * getDocumentBadge: (doc) => {
309
361
  * if (doc.services === 'NHS')
310
362
  * return { label: 'NHS', bgColor: '#e0f2fe', textColor: '#0369a1' }
311
363
  * if (doc.services === 'Private')
312
364
  * return { label: 'Private', bgColor: '#fef3c7', textColor: '#92400e' }
313
365
  * }
314
366
  */
315
- docBadge?: (doc: DocumentWithSeoHealth & Record<string, unknown>) => {
367
+ getDocumentBadge?: (doc: DocumentWithSeoHealth & Record<string, unknown>) => {
316
368
  label: string;
317
369
  bgColor?: string;
318
370
  textColor?: string;
@@ -365,8 +417,13 @@ interface SeoHealthDashboardProps {
365
417
  * structureTool: 'common'
366
418
  */
367
419
  structureTool?: string;
420
+ /**
421
+ * @internal — populated by the plugin when deprecated config keys are detected.
422
+ * Each entry carries the migration hint, the version it was deprecated in, and
423
+ * the matching changelog URL so the banner can group warnings by release.
424
+ */
425
+ _deprecationWarnings?: DeprecationWarning[];
368
426
  }
369
- declare const SeoHealthDashboard: React.FC<SeoHealthDashboardProps>;
370
427
 
371
428
  /**
372
429
  * Options accepted by `createSeoHealthPane`.
@@ -413,10 +470,4 @@ interface SeoHealthPaneOptions extends Omit<SeoHealthDashboardProps, 'customQuer
413
470
  */
414
471
  declare function createSeoHealthPane(optionsOrS: StructureBuilder, optionsWhenS: SeoHealthPaneOptions): ComponentBuilder;
415
472
 
416
- /**
417
- * Sanity Tool component for the SEO Health Dashboard
418
- * This component wraps the SeoHealthDashboard for use as a custom tool in Sanity Studio
419
- */
420
- declare const SeoHealthTool: (props: SeoHealthDashboardProps) => react_jsx_runtime.JSX.Element;
421
-
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 };
473
+ export { type AllFieldKeys, DocumentWithSeoHealth, type FieldVisibilityConfig, type SeoFieldConfig, type SeoFieldKeys, type SeoFieldsPluginConfig, type SeoHealthPaneOptions, 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 };