sanity-plugin-seofields 1.1.1 → 1.2.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/dist/index.d.mts CHANGED
@@ -221,6 +221,12 @@ export declare interface SeoFieldsPluginConfig {
221
221
  icon?: string
222
222
  title?: string
223
223
  description?: string
224
+ /** Text shown while the license key is being verified. Defaults to "Verifying license…" */
225
+ loadingLicense?: string
226
+ /** Text shown while documents are being fetched. Defaults to "Loading documents…" */
227
+ loadingDocuments?: string
228
+ /** Text shown when the query returns zero results. Defaults to "No documents found" */
229
+ noDocuments?: string
224
230
  }
225
231
  display?: {
226
232
  typeColumn?: boolean
@@ -254,6 +260,64 @@ export declare interface SeoFieldsPluginConfig {
254
260
  * Obtain a license at https://sanity-plugin-seofields.thehardik.in
255
261
  */
256
262
  licenseKey?: string
263
+ /**
264
+ * Map raw `_type` values to human-readable display labels.
265
+ * Used in both the Type column and the Type filter dropdown.
266
+ * Any type without an entry falls back to the raw `_type` string.
267
+ *
268
+ * @example
269
+ * typeLabels: { productDrug: 'Products', singleCondition: 'Condition' }
270
+ */
271
+ typeLabels?: Record<string, string>
272
+ /**
273
+ * Controls how the document type is rendered in the Type column.
274
+ * - `'badge'` (default) — coloured pill
275
+ * - `'text'` — plain text, useful for dense layouts
276
+ */
277
+ typeColumnMode?: 'badge' | 'text'
278
+ /**
279
+ * The document field to use as the display title in the dashboard.
280
+ *
281
+ * - `string` — use this field for every document type (e.g. `'name'`)
282
+ * - `Record<string, string>` — per-type mapping; unmapped types fall back to `title`
283
+ *
284
+ * @example
285
+ * titleField: 'name'
286
+ *
287
+ * @example
288
+ * titleField: { post: 'title', product: 'name', category: 'label' }
289
+ */
290
+ titleField?: string | Record<string, string>
291
+ /**
292
+ * Callback function to render a custom badge next to the document title.
293
+ * Receives the full document and should return badge data or undefined.
294
+ *
295
+ * @example
296
+ * docBadge: (doc) => {
297
+ * if (doc.services === 'NHS')
298
+ * return { label: 'NHS', bgColor: '#e0f2fe', textColor: '#0369a1' }
299
+ * if (doc.services === 'Private')
300
+ * return { label: 'Private', bgColor: '#fef3c7', textColor: '#92400e' }
301
+ * }
302
+ */
303
+ docBadge?: (doc: DocumentWithSeoHealth & Record<string, unknown>) =>
304
+ | {
305
+ label: string
306
+ bgColor?: string
307
+ textColor?: string
308
+ fontSize?: string
309
+ }
310
+ | undefined
311
+ /**
312
+ * Enable preview/demo mode to show dummy data.
313
+ * Useful for testing, documentation, or showcasing the dashboard.
314
+ * When enabled, displays realistic sample documents with various SEO scores.
315
+ * Defaults to `false`.
316
+ *
317
+ * @example
318
+ * previewMode: true
319
+ */
320
+ previewMode?: boolean
257
321
  }
258
322
  }
259
323
 
@@ -294,6 +358,78 @@ declare interface SeoHealthDashboardProps {
294
358
  * Obtain a key at https://sanity-plugin-seofields.thehardik.in
295
359
  */
296
360
  licenseKey?: string
361
+ /**
362
+ * Map raw `_type` values to human-readable display labels used in the
363
+ * Type column and the Type filter dropdown.
364
+ * Any type without an entry falls back to the raw `_type` string.
365
+ *
366
+ * @example
367
+ * typeLabels={{ productDrug: 'Products', singleCondition: 'Condition' }}
368
+ */
369
+ typeLabels?: Record<string, string>
370
+ /**
371
+ * Controls how the type is rendered in the Type column.
372
+ * - `'badge'` (default) — coloured pill, consistent with score badges
373
+ * - `'text'` — plain text, useful for dense layouts
374
+ */
375
+ typeColumnMode?: 'badge' | 'text'
376
+ /**
377
+ * The document field to use as the display title.
378
+ *
379
+ * - `string` — use this field for every document type (e.g. `'name'`)
380
+ * - `Record<string, string>` — per-type mapping; unmapped types fall back to `title`
381
+ *
382
+ * @example
383
+ * // Same field for all types
384
+ * titleField: 'name'
385
+ *
386
+ * @example
387
+ * // Different field per type
388
+ * titleField: { post: 'title', product: 'name', category: 'label' }
389
+ */
390
+ titleField?: string | Record<string, string>
391
+ /**
392
+ * Callback function to render a custom badge next to the document title.
393
+ * Receives the full document and should return badge data or undefined.
394
+ *
395
+ * @example
396
+ * docBadge: (doc) => {
397
+ * if (doc.services === 'NHS')
398
+ * return { label: 'NHS', bgColor: '#e0f2fe', textColor: '#0369a1' }
399
+ * if (doc.services === 'Private')
400
+ * return { label: 'Private', bgColor: '#fef3c7', textColor: '#92400e' }
401
+ * }
402
+ */
403
+ docBadge?: (doc: DocumentWithSeoHealth & Record<string, unknown>) =>
404
+ | {
405
+ label: string
406
+ bgColor?: string
407
+ textColor?: string
408
+ fontSize?: string
409
+ }
410
+ | undefined
411
+ /**
412
+ * Custom text shown while the license key is being verified.
413
+ * Defaults to `"Verifying license…"`.
414
+ */
415
+ loadingLicense?: React_2.ReactNode
416
+ /**
417
+ * Custom text shown while documents are being fetched.
418
+ * Defaults to `"Loading documents…"`.
419
+ */
420
+ loadingDocuments?: React_2.ReactNode
421
+ /**
422
+ * Custom text shown when the query returns zero results.
423
+ * Defaults to `"No documents found"`.
424
+ */
425
+ noDocuments?: React_2.ReactNode
426
+ /**
427
+ * Enable preview/demo mode to show dummy data.
428
+ * Useful for testing, documentation, or showcasing the dashboard.
429
+ * When enabled, displays realistic sample documents with various SEO scores.
430
+ * Defaults to `false`.
431
+ */
432
+ previewMode?: boolean
297
433
  }
298
434
 
299
435
  export declare interface SeoHealthMetrics {
package/dist/index.d.ts CHANGED
@@ -221,6 +221,12 @@ export declare interface SeoFieldsPluginConfig {
221
221
  icon?: string
222
222
  title?: string
223
223
  description?: string
224
+ /** Text shown while the license key is being verified. Defaults to "Verifying license…" */
225
+ loadingLicense?: string
226
+ /** Text shown while documents are being fetched. Defaults to "Loading documents…" */
227
+ loadingDocuments?: string
228
+ /** Text shown when the query returns zero results. Defaults to "No documents found" */
229
+ noDocuments?: string
224
230
  }
225
231
  display?: {
226
232
  typeColumn?: boolean
@@ -254,6 +260,64 @@ export declare interface SeoFieldsPluginConfig {
254
260
  * Obtain a license at https://sanity-plugin-seofields.thehardik.in
255
261
  */
256
262
  licenseKey?: string
263
+ /**
264
+ * Map raw `_type` values to human-readable display labels.
265
+ * Used in both the Type column and the Type filter dropdown.
266
+ * Any type without an entry falls back to the raw `_type` string.
267
+ *
268
+ * @example
269
+ * typeLabels: { productDrug: 'Products', singleCondition: 'Condition' }
270
+ */
271
+ typeLabels?: Record<string, string>
272
+ /**
273
+ * Controls how the document type is rendered in the Type column.
274
+ * - `'badge'` (default) — coloured pill
275
+ * - `'text'` — plain text, useful for dense layouts
276
+ */
277
+ typeColumnMode?: 'badge' | 'text'
278
+ /**
279
+ * The document field to use as the display title in the dashboard.
280
+ *
281
+ * - `string` — use this field for every document type (e.g. `'name'`)
282
+ * - `Record<string, string>` — per-type mapping; unmapped types fall back to `title`
283
+ *
284
+ * @example
285
+ * titleField: 'name'
286
+ *
287
+ * @example
288
+ * titleField: { post: 'title', product: 'name', category: 'label' }
289
+ */
290
+ titleField?: string | Record<string, string>
291
+ /**
292
+ * Callback function to render a custom badge next to the document title.
293
+ * Receives the full document and should return badge data or undefined.
294
+ *
295
+ * @example
296
+ * docBadge: (doc) => {
297
+ * if (doc.services === 'NHS')
298
+ * return { label: 'NHS', bgColor: '#e0f2fe', textColor: '#0369a1' }
299
+ * if (doc.services === 'Private')
300
+ * return { label: 'Private', bgColor: '#fef3c7', textColor: '#92400e' }
301
+ * }
302
+ */
303
+ docBadge?: (doc: DocumentWithSeoHealth & Record<string, unknown>) =>
304
+ | {
305
+ label: string
306
+ bgColor?: string
307
+ textColor?: string
308
+ fontSize?: string
309
+ }
310
+ | undefined
311
+ /**
312
+ * Enable preview/demo mode to show dummy data.
313
+ * Useful for testing, documentation, or showcasing the dashboard.
314
+ * When enabled, displays realistic sample documents with various SEO scores.
315
+ * Defaults to `false`.
316
+ *
317
+ * @example
318
+ * previewMode: true
319
+ */
320
+ previewMode?: boolean
257
321
  }
258
322
  }
259
323
 
@@ -294,6 +358,78 @@ declare interface SeoHealthDashboardProps {
294
358
  * Obtain a key at https://sanity-plugin-seofields.thehardik.in
295
359
  */
296
360
  licenseKey?: string
361
+ /**
362
+ * Map raw `_type` values to human-readable display labels used in the
363
+ * Type column and the Type filter dropdown.
364
+ * Any type without an entry falls back to the raw `_type` string.
365
+ *
366
+ * @example
367
+ * typeLabels={{ productDrug: 'Products', singleCondition: 'Condition' }}
368
+ */
369
+ typeLabels?: Record<string, string>
370
+ /**
371
+ * Controls how the type is rendered in the Type column.
372
+ * - `'badge'` (default) — coloured pill, consistent with score badges
373
+ * - `'text'` — plain text, useful for dense layouts
374
+ */
375
+ typeColumnMode?: 'badge' | 'text'
376
+ /**
377
+ * The document field to use as the display title.
378
+ *
379
+ * - `string` — use this field for every document type (e.g. `'name'`)
380
+ * - `Record<string, string>` — per-type mapping; unmapped types fall back to `title`
381
+ *
382
+ * @example
383
+ * // Same field for all types
384
+ * titleField: 'name'
385
+ *
386
+ * @example
387
+ * // Different field per type
388
+ * titleField: { post: 'title', product: 'name', category: 'label' }
389
+ */
390
+ titleField?: string | Record<string, string>
391
+ /**
392
+ * Callback function to render a custom badge next to the document title.
393
+ * Receives the full document and should return badge data or undefined.
394
+ *
395
+ * @example
396
+ * docBadge: (doc) => {
397
+ * if (doc.services === 'NHS')
398
+ * return { label: 'NHS', bgColor: '#e0f2fe', textColor: '#0369a1' }
399
+ * if (doc.services === 'Private')
400
+ * return { label: 'Private', bgColor: '#fef3c7', textColor: '#92400e' }
401
+ * }
402
+ */
403
+ docBadge?: (doc: DocumentWithSeoHealth & Record<string, unknown>) =>
404
+ | {
405
+ label: string
406
+ bgColor?: string
407
+ textColor?: string
408
+ fontSize?: string
409
+ }
410
+ | undefined
411
+ /**
412
+ * Custom text shown while the license key is being verified.
413
+ * Defaults to `"Verifying license…"`.
414
+ */
415
+ loadingLicense?: React_2.ReactNode
416
+ /**
417
+ * Custom text shown while documents are being fetched.
418
+ * Defaults to `"Loading documents…"`.
419
+ */
420
+ loadingDocuments?: React_2.ReactNode
421
+ /**
422
+ * Custom text shown when the query returns zero results.
423
+ * Defaults to `"No documents found"`.
424
+ */
425
+ noDocuments?: React_2.ReactNode
426
+ /**
427
+ * Enable preview/demo mode to show dummy data.
428
+ * Useful for testing, documentation, or showcasing the dashboard.
429
+ * When enabled, displays realistic sample documents with various SEO scores.
430
+ * Defaults to `false`.
431
+ */
432
+ previewMode?: boolean
297
433
  }
298
434
 
299
435
  export declare interface SeoHealthMetrics {