@nuxtseo/pro-indexing 0.1.4 → 0.1.6

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.
@@ -6,9 +6,11 @@ import { indexingWindowNote } from '@gscdump/sdk/indexing'
6
6
  import { DISPLAY_LOCALE, formatNumber } from '@nuxtseo/design-system/app/composables/formatting'
7
7
  import { computed } from 'vue'
8
8
  import { UiAlert, UiButton, UiEmptyState, UiStat, UiStats, UiTopEntityStackChart } from '#components'
9
+ import { indexedShareTextClass } from '../../shared/config'
9
10
  import { portfolioFetchState } from '../../shared/portfolio'
10
11
  import { buildPortfolioOverview } from '../../shared/portfolio-overview'
11
12
  import { useIndexingSource } from '../composables/useIndexingSource'
13
+ import { useProIndexingIndexedShareTone } from '../composables/useProIndexingConfig'
12
14
  import { useProIndexingCopy } from '../composables/useProIndexingCopy'
13
15
 
14
16
  // Portfolio Overview: the tiles and the not-indexed stack over one Portfolio
@@ -35,13 +37,7 @@ const model = computed(() => buildPortfolioOverview(entries, window))
35
37
  const hasGsc = computed(() => entries.some(entry => entry.site.dataId !== null))
36
38
  const windowNote = computed(() => indexingWindowNote(window, entries.map(entry => entry.trend)))
37
39
 
38
- type RateHealth = 'ok' | 'warning' | 'error'
39
- function rateHealth(percent: number): RateHealth {
40
- if (percent >= 80)
41
- return 'ok'
42
- return percent >= 50 ? 'warning' : 'error'
43
- }
44
- const rateTextClass: Record<RateHealth, string> = { ok: 'text-default', warning: 'text-warning', error: 'text-error' }
40
+ const indexedShareTone = useProIndexingIndexedShareTone()
45
41
 
46
42
  // The rollup counts only this scope's linked Sites. A failed read is unknown, never zero.
47
43
  const sitemapError = computed(() => sitemapRead?.error.value ?? null)
@@ -80,7 +76,7 @@ const stats = computed<UiStatProps[]>(() => {
80
76
  icon: 'check-circle',
81
77
  tooltip: copy.overview.indexedTooltip,
82
78
  value: indexed ? `${indexed.percent.toFixed(0)}%` : null,
83
- valueClass: indexed ? rateTextClass[rateHealth(indexed.percent)] : undefined,
79
+ valueClass: indexed ? indexedShareTextClass(indexed.percent, indexedShareTone) : undefined,
84
80
  trend: indexedChange,
85
81
  trendSuffix: copy.overview.trendSuffix,
86
82
  sparkline: statSparkline(trend.map(point => ({ x: point.date, value: point.indexedPercent }))),