@nuxtseo/pro-search 0.1.12 → 0.1.14
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/README.md +2 -2
- package/app/components/BingSearchPerformance.vue +39 -35
- package/app/components/RankedSearchTable.vue +7 -2
- package/app/components/SearchConsoleTrend.vue +50 -30
- package/package.json +7 -7
- package/shared/bing-performance.ts +7 -0
- package/shared/compare-align.ts +2 -2
- package/shared/navigation.ts +2 -2
- package/shared/search-console-trend.ts +3 -1
package/README.md
CHANGED
|
@@ -3,6 +3,6 @@
|
|
|
3
3
|
Install `@nuxtseo/pro-search` with its design system peer. Add the package to the host Nuxt config's `extends`.
|
|
4
4
|
|
|
5
5
|
- Use `SearchConsoleTrend.vue` from `@nuxtseo/pro-search/components/` for daily Search Console metrics and comparison overlays. Pass the current and previous series and the requested date range. A host can provide a connection link and a classified read failure.
|
|
6
|
-
- Use `RankedSearchTable.vue` and `RankedSearchRow.vue` from `@nuxtseo/pro-search/components/` for the ranked Search Console cards. Pass Top, Rising, and Falling rows. The row slot supplies the label and any host links or query variants.
|
|
7
|
-
- Use `BingSearchPerformance.vue` from the same path for the Bing traffic chart and ranked Pages and Keywords. Pass the traffic response and the current breakdown response. Bind `entityKind` and `page` and handle `retry` to drive the host reads. Use `BING_PERFORMANCE_PAGE_SIZE` when requesting breakdown rows.
|
|
6
|
+
- Use `RankedSearchTable.vue` and `RankedSearchRow.vue` from `@nuxtseo/pro-search/components/` for the ranked Search Console cards. Pass Top, Rising, and Falling rows. If a source has no comparison period, pass `sets` with only `top`. The row slot supplies the label and any host links or query variants.
|
|
7
|
+
- Use `BingSearchPerformance.vue` from the same path for the Bing traffic chart and ranked Pages and Keywords. Pass the traffic response and the current breakdown response. Bind `entityKind` and `page` and handle `retry` to drive the host reads. Use `BING_PERFORMANCE_PAGE_SIZE` when requesting breakdown rows. `BING_TRAFFIC_METRICS` lists the traffic metric chips.
|
|
8
8
|
- Import labels, icons, and Webmaster Tools tabs from `@nuxtseo/pro-search/shared/navigation`. The host owns its routes, access checks, and data reads.
|
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
<script setup lang="ts">
|
|
2
2
|
import type { BingDataV1 } from '@gscdump/contracts/v1/http'
|
|
3
3
|
import type { BingEntityKind } from '../../shared/bing-performance'
|
|
4
|
-
import { gscMetricColors } from '@nuxtseo/design-system/app/composables/dataVizColors'
|
|
5
|
-
import { computed,
|
|
6
|
-
import { UiAlert, UiDataTableSection, UiEmptyState, UiIcon,
|
|
7
|
-
import { BING_PERFORMANCE_PAGE_SIZE, bingTrafficTotals, formatBingCtr, formatBingNumber
|
|
4
|
+
import { gscMetricColors, metricIcon } from '@nuxtseo/design-system/app/composables/dataVizColors'
|
|
5
|
+
import { computed, watch } from 'vue'
|
|
6
|
+
import { UiAlert, UiDataTableSection, UiEmptyState, UiIcon, UiMetricsRow, UiMetricToggle, UiRelativeTime, UiSectionHeader, UiTableMetricCell, UiTablePathCell, UiTableShell, UiTableTd, UiTableTh, UiTogglePill } from '#components'
|
|
7
|
+
import { BING_PERFORMANCE_PAGE_SIZE, BING_TRAFFIC_METRICS, bingTrafficTotals, formatBingCtr, formatBingNumber } from '../../shared/bing-performance'
|
|
8
|
+
import SearchConsoleTrend from './SearchConsoleTrend.vue'
|
|
8
9
|
|
|
9
|
-
const { data, startDate, endDate, entities, pending, error, view } = defineProps<{
|
|
10
|
+
const { data, startDate, endDate, entities, pending, error, view, hideReportingWindow = false, hideMetricControls = false } = defineProps<{
|
|
10
11
|
data: Extract<BingDataV1, { dataset: 'traffic' }> | null
|
|
11
12
|
startDate: string
|
|
12
13
|
endDate: string
|
|
@@ -14,21 +15,30 @@ const { data, startDate, endDate, entities, pending, error, view } = defineProps
|
|
|
14
15
|
pending: boolean
|
|
15
16
|
error: boolean
|
|
16
17
|
view?: 'overview' | 'queries' | 'pages'
|
|
18
|
+
hideReportingWindow?: boolean
|
|
19
|
+
hideMetricControls?: boolean
|
|
17
20
|
}>()
|
|
18
21
|
const emit = defineEmits<{ retry: [] }>()
|
|
22
|
+
defineSlots<{ 'chart-overlay'?: () => unknown }>()
|
|
19
23
|
const entityKind = defineModel<BingEntityKind>('entityKind', { required: true })
|
|
20
24
|
const page = defineModel<number>('page', { required: true })
|
|
21
25
|
|
|
22
|
-
const metrics =
|
|
23
|
-
const metricOptions =
|
|
24
|
-
{ key: 'clicks', label: 'Clicks', color: 'blue' },
|
|
25
|
-
{ key: 'impressions', label: 'Impressions', color: 'purple' },
|
|
26
|
-
] as const
|
|
27
|
-
// The chips are the chart legend, so each line draws in its chip's identity colour.
|
|
28
|
-
const chartSeries = computed(() => metricOptions
|
|
29
|
-
.filter(option => metrics.value.includes(option.key))
|
|
30
|
-
.map(option => ({ key: option.key, label: option.label, color: gscMetricColors[option.key].color })))
|
|
26
|
+
const metrics = defineModel<string[]>('metrics', { default: () => ['clicks', 'impressions'] })
|
|
27
|
+
const metricOptions = BING_TRAFFIC_METRICS
|
|
31
28
|
const totals = computed(() => bingTrafficTotals(data?.rows ?? []))
|
|
29
|
+
const metricItems = computed(() => metricOptions
|
|
30
|
+
.filter(option => metrics.value.includes(option.key))
|
|
31
|
+
.map(option => ({
|
|
32
|
+
label: option.label,
|
|
33
|
+
icon: metricIcon(option.key),
|
|
34
|
+
iconClass: gscMetricColors[option.key].text,
|
|
35
|
+
value: option.key === 'ctr' ? formatBingCtr(totals.value.ctr) : formatBingNumber(totals.value[option.key]),
|
|
36
|
+
})))
|
|
37
|
+
const chartRows = computed(() => (data?.rows ?? []).map(row => ({
|
|
38
|
+
...row,
|
|
39
|
+
ctr: row.impressions > 0 ? row.clicks / row.impressions : 0,
|
|
40
|
+
position: null,
|
|
41
|
+
})))
|
|
32
42
|
const lastCollection = computed(() => {
|
|
33
43
|
const sync = (view === 'pages' || view === 'queries' ? entities : data)?.sync
|
|
34
44
|
return sync && sync._tag !== 'missing' ? sync.observedAt : null
|
|
@@ -86,12 +96,12 @@ function rowCtr(row: EntityRow): string {
|
|
|
86
96
|
/>
|
|
87
97
|
|
|
88
98
|
<template v-if="data && (!view || view === 'overview')">
|
|
89
|
-
<div role="group" aria-label="Bing Search Performance filters" class="flex min-w-0 flex-col gap-2">
|
|
90
|
-
<span class="inline-flex items-center gap-1.5 text-xs text-muted">
|
|
99
|
+
<div v-if="!hideReportingWindow || !hideMetricControls" role="group" aria-label="Bing Search Performance filters" class="flex min-w-0 flex-col gap-2">
|
|
100
|
+
<span v-if="!hideReportingWindow" class="inline-flex items-center gap-1.5 text-xs text-muted">
|
|
91
101
|
<UiIcon name="calendar" class="size-3.5 shrink-0 text-dimmed" aria-hidden="true" />
|
|
92
102
|
{{ startDate }} to {{ endDate }}
|
|
93
103
|
</span>
|
|
94
|
-
<UiMetricToggle v-if="data.rows.length" v-model="metrics" :options="[...metricOptions]" chip :colors="gscMetricColors" />
|
|
104
|
+
<UiMetricToggle v-if="!hideMetricControls && data.rows.length" v-model="metrics" :options="[...metricOptions]" chip :colors="gscMetricColors" />
|
|
95
105
|
</div>
|
|
96
106
|
|
|
97
107
|
<div class="flex flex-col gap-3 sm:flex-row sm:items-start sm:justify-between">
|
|
@@ -106,24 +116,18 @@ function rowCtr(row: EntityRow): string {
|
|
|
106
116
|
|
|
107
117
|
<UiEmptyState v-if="!data.rows.length && !unavailable" icon="search" title="No Bing traffic in this date range" :description="view ? undefined : 'Pages and Keywords can still have data below.'" />
|
|
108
118
|
|
|
109
|
-
<div v-if="
|
|
110
|
-
<
|
|
111
|
-
<
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
x-key="date"
|
|
122
|
-
:series="chartSeries"
|
|
123
|
-
:height="220"
|
|
124
|
-
:x-format="value => formatBingReportingDay(String(value))"
|
|
125
|
-
:y-format="value => formatBingNumber(value)"
|
|
126
|
-
/>
|
|
119
|
+
<div v-if="chartRows.length">
|
|
120
|
+
<UiMetricsRow :items="metricItems" :show-trends="false" />
|
|
121
|
+
<div class="relative">
|
|
122
|
+
<SearchConsoleTrend
|
|
123
|
+
:value="chartRows"
|
|
124
|
+
:date-range="{ start: startDate, end: endDate }"
|
|
125
|
+
:prev-value="null"
|
|
126
|
+
:columns="metrics"
|
|
127
|
+
reporting-days="observed"
|
|
128
|
+
/>
|
|
129
|
+
<slot v-if="chartRows.length > 1" name="chart-overlay" />
|
|
130
|
+
</div>
|
|
127
131
|
</div>
|
|
128
132
|
</template>
|
|
129
133
|
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
<script setup lang="ts" generic="Row extends RankedSearchRow">
|
|
2
2
|
import type { RankedSearchRow } from '../../shared/ranked-search'
|
|
3
|
+
import { computed } from 'vue'
|
|
3
4
|
import { UiMetricLabel, UiSeverityDot, UiSkeleton } from '#components'
|
|
4
5
|
|
|
5
6
|
type EntitySort = 'top' | 'rising' | 'falling'
|
|
6
7
|
|
|
7
|
-
const { entityPlural, top = [], rising = [], falling = [], loading = false, pending = [], failed = [] } = defineProps<{
|
|
8
|
+
const { entityPlural, top = [], rising = [], falling = [], loading = false, pending = [], failed = [], sets = ['top', 'rising', 'falling'] } = defineProps<{
|
|
8
9
|
entityPlural: 'queries' | 'pages' | 'countries'
|
|
9
10
|
top?: Row[]
|
|
10
11
|
rising?: Row[]
|
|
@@ -12,6 +13,8 @@ const { entityPlural, top = [], rising = [], falling = [], loading = false, pend
|
|
|
12
13
|
loading?: boolean
|
|
13
14
|
pending?: readonly EntitySort[]
|
|
14
15
|
failed?: readonly EntitySort[]
|
|
16
|
+
/** The sections to show. A source with no comparison period has no Rising or Falling to state. */
|
|
17
|
+
sets?: readonly EntitySort[]
|
|
15
18
|
}>()
|
|
16
19
|
|
|
17
20
|
defineSlots<{
|
|
@@ -25,6 +28,8 @@ const SETS: SetMeta[] = [
|
|
|
25
28
|
{ value: 'falling', label: 'Falling', barClass: 'bg-error/8', sparkColor: 'red' },
|
|
26
29
|
]
|
|
27
30
|
|
|
31
|
+
const shownSets = computed(() => SETS.filter(set => sets.includes(set.value)))
|
|
32
|
+
|
|
28
33
|
function rowsFor(s: EntitySort): Row[] {
|
|
29
34
|
return s === 'top' ? top : s === 'rising' ? rising : falling
|
|
30
35
|
}
|
|
@@ -54,7 +59,7 @@ function rowKey(row: Row, i: number): string {
|
|
|
54
59
|
|
|
55
60
|
<template>
|
|
56
61
|
<div class="@container grid min-w-0 grid-cols-1 gap-3">
|
|
57
|
-
<template v-for="set in
|
|
62
|
+
<template v-for="set in shownSets" :key="set.value">
|
|
58
63
|
<div v-if="isPending(set.value)" class="min-w-0">
|
|
59
64
|
<!-- `block` keeps the caller's box: the self-sizing `text` type writes an
|
|
60
65
|
inline pixel width that beat `w-20`/`w-full`, so every placeholder came
|
|
@@ -1,18 +1,20 @@
|
|
|
1
1
|
<script lang="ts" setup>
|
|
2
2
|
import type { SearchConsoleTrendDay as DataRow, SearchConsoleTrendProps } from '../../shared/search-console-trend'
|
|
3
3
|
import { getGscUnstableCutoffDate } from '@gscdump/sdk/period'
|
|
4
|
+
import { renderLineTooltip } from '@nuxtseo/design-system/app/components/data/UiLineChart.vue'
|
|
4
5
|
import { gscMetricColors } from '@nuxtseo/design-system/app/composables/dataVizColors'
|
|
5
|
-
import { formatGroupedNumber } from '@nuxtseo/design-system/app/composables/formatting'
|
|
6
|
+
import { formatGroupedNumber, formatReportingDay } from '@nuxtseo/design-system/app/composables/formatting'
|
|
6
7
|
import { useChartTickPlan } from '@nuxtseo/design-system/app/composables/useChartTickPlan'
|
|
7
8
|
import { Scale, TextAlign } from '@unovis/ts'
|
|
8
|
-
import { VisArea, VisAxis, VisCrosshair, VisLine, VisScatter, VisXYContainer } from '@unovis/vue'
|
|
9
|
+
import { VisArea, VisAxis, VisCrosshair, VisLine, VisScatter, VisTooltip, VisXYContainer } from '@unovis/vue'
|
|
9
10
|
import { useElementSize } from '@vueuse/core'
|
|
10
11
|
import { computed, useTemplateRef } from 'vue'
|
|
11
|
-
import { ClientOnly, UiButton, UiIcon, UiSkeleton } from '#components'
|
|
12
|
+
import { ClientOnly, UiButton, UiChartDataReveal, UiIcon, UiSkeleton } from '#components'
|
|
12
13
|
import { alignPrev, anchorOffsetDays, calendarChartRows, isolatedChartValue, resolveCompareAligner, toUtcDay } from '../../shared/compare-align'
|
|
13
14
|
|
|
14
|
-
const { value, dateRange, prevValue, fullValue, fullPrevValue, compareMode, compareOffsetDays, columns, height, loading, failure, connectionTo } = defineProps<SearchConsoleTrendProps>()
|
|
15
|
+
const { value, dateRange, prevValue, fullValue, fullPrevValue, compareMode, compareOffsetDays, columns, height, loading, failure, connectionTo, reportingDays = 'gsc-provisional' } = defineProps<SearchConsoleTrendProps>()
|
|
15
16
|
const chartFailure = computed(() => value.length ? null : failure)
|
|
17
|
+
const showReadout = computed(() => reportingDays === 'observed')
|
|
16
18
|
|
|
17
19
|
// The metric colour is a CSS custom property a site may override, so mix it
|
|
18
20
|
// rather than parse hex. Mixing with `transparent` in srgb sets only the alpha.
|
|
@@ -78,7 +80,7 @@ const prevImpressions = (d: MergedRow) => d.prev?.impressions ?? Number.NaN
|
|
|
78
80
|
// Rate and rank values require impressions. Missing observations leave gaps.
|
|
79
81
|
function observedMetric(row: DataRow, metric: 'ctr' | 'position'): number | undefined {
|
|
80
82
|
const value = row[metric]
|
|
81
|
-
if (!(row.impressions > 0) || !Number.isFinite(value) || (metric === 'position' && value < 1))
|
|
83
|
+
if (!(row.impressions > 0) || value == null || !Number.isFinite(value) || (metric === 'position' && value < 1))
|
|
82
84
|
return undefined
|
|
83
85
|
return value
|
|
84
86
|
}
|
|
@@ -100,12 +102,12 @@ const firstTickAtEdge = computed(() => tickPlan.value.indices[0] === 0)
|
|
|
100
102
|
const lastTickAtEdge = computed(() => tickPlan.value.indices.at(-1) === calendarValue.value.length - 1)
|
|
101
103
|
|
|
102
104
|
// --- Unstable/estimated data detection ---
|
|
103
|
-
const unstableCutoffDate = computed(() => getGscUnstableCutoffDate())
|
|
105
|
+
const unstableCutoffDate = computed(() => reportingDays === 'gsc-provisional' ? getGscUnstableCutoffDate() : null)
|
|
104
106
|
|
|
105
107
|
const unstableCount = computed(() => {
|
|
106
|
-
if (!calendarValue.value.length)
|
|
107
|
-
return 0
|
|
108
108
|
const cutoff = unstableCutoffDate.value
|
|
109
|
+
if (!cutoff || !calendarValue.value.length)
|
|
110
|
+
return 0
|
|
109
111
|
let count = 0
|
|
110
112
|
for (let i = calendarValue.value.length - 1; i >= 0; i--) {
|
|
111
113
|
if ((calendarValue.value[i]?.date ?? '') > cutoff)
|
|
@@ -158,7 +160,7 @@ const ctrScale = computed(() => {
|
|
|
158
160
|
|
|
159
161
|
// Position scale inverted: lower position = higher on chart
|
|
160
162
|
const positionScale = computed(() => {
|
|
161
|
-
const positions = allData.value.
|
|
163
|
+
const positions = allData.value.map(row => observedMetric(row, 'position')).filter(value => value != null)
|
|
162
164
|
const min = positions.length ? Math.min(...positions) : 1
|
|
163
165
|
const max = positions.length ? Math.max(...positions) : 100
|
|
164
166
|
const padding = (max - min) * 0.1 || 1
|
|
@@ -187,8 +189,18 @@ const position = (d: DataRow) => observedMetric(d, 'position') ?? Number.NaN
|
|
|
187
189
|
// Keep observed provisional values distinct from the solid stable segment.
|
|
188
190
|
// Both segments share the cutoff point so adjacent observations connect;
|
|
189
191
|
// calendar NaNs still break either line instead of inventing a zero or bridge.
|
|
190
|
-
|
|
191
|
-
|
|
192
|
+
function stableMetric(metric: (row: DataRow) => number) {
|
|
193
|
+
return (row: DataRow) => {
|
|
194
|
+
const cutoff = unstableCutoffDate.value
|
|
195
|
+
return !cutoff || row.date <= cutoff ? metric(row) : Number.NaN
|
|
196
|
+
}
|
|
197
|
+
}
|
|
198
|
+
function provisionalMetric(metric: (row: DataRow) => number) {
|
|
199
|
+
return (row: DataRow) => {
|
|
200
|
+
const cutoff = unstableCutoffDate.value
|
|
201
|
+
return cutoff && row.date >= cutoff ? metric(row) : Number.NaN
|
|
202
|
+
}
|
|
203
|
+
}
|
|
192
204
|
const stableClicks = stableMetric(clicks)
|
|
193
205
|
const stableImpressions = stableMetric(impressions)
|
|
194
206
|
const stableCtr = stableMetric(ctr)
|
|
@@ -224,6 +236,16 @@ function accessibleValue(row: DataRow, metric: Metric): string {
|
|
|
224
236
|
return value.toFixed(1)
|
|
225
237
|
return formatGroupedNumber(value)
|
|
226
238
|
}
|
|
239
|
+
|
|
240
|
+
function tooltipTemplate(row: DataRow): string {
|
|
241
|
+
if (!showReadout.value)
|
|
242
|
+
return ''
|
|
243
|
+
return renderLineTooltip(formatReportingDay(row.date), visibleMetrics.value.map(metric => ({
|
|
244
|
+
label: metricLabels[metric],
|
|
245
|
+
color: gscMetricColors[metric].color,
|
|
246
|
+
value: accessibleValue(row, metric),
|
|
247
|
+
})))
|
|
248
|
+
}
|
|
227
249
|
</script>
|
|
228
250
|
|
|
229
251
|
<template>
|
|
@@ -280,10 +302,10 @@ function accessibleValue(row: DataRow, metric: Metric): string {
|
|
|
280
302
|
branch only knows the window came back empty. Asserting "~5 min after
|
|
281
303
|
connect" here told a user with ten days of synced data to go wait. -->
|
|
282
304
|
<p class="text-sm text-muted">
|
|
283
|
-
{{ value.length === 0 ? 'No search impressions in this period.' : 'First day of GSC data is in; trend renders once we have 2+' }}
|
|
305
|
+
{{ value.length === 0 ? 'No search impressions in this period.' : showReadout ? 'Not enough data to chart.' : 'First day of GSC data is in; trend renders once we have 2+' }}
|
|
284
306
|
</p>
|
|
285
307
|
<p class="text-xs text-dimmed">
|
|
286
|
-
{{ value.length === 0 ? 'Try a wider date range.' : 'Check back tomorrow for the trend line.' }}
|
|
308
|
+
{{ value.length === 0 || showReadout ? 'Try a wider date range.' : 'Check back tomorrow for the trend line.' }}
|
|
287
309
|
</p>
|
|
288
310
|
</div>
|
|
289
311
|
|
|
@@ -515,12 +537,9 @@ function accessibleValue(row: DataRow, metric: Metric): string {
|
|
|
515
537
|
tick-text-font-size="11px"
|
|
516
538
|
tick-text-color="var(--ui-text-dimmed)"
|
|
517
539
|
/>
|
|
518
|
-
<!--
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
because Unovis portals it to document.body and the empty box leaks
|
|
522
|
-
through as a second tooltip on top of UiChartTooltip. -->
|
|
523
|
-
<VisCrosshair :x="x" :y="clicks" color="none" :template="() => ''" />
|
|
540
|
+
<!-- Search Console's parent card handles its annotated tooltip. -->
|
|
541
|
+
<VisCrosshair :x="x" :y="clicks" color="none" :template="tooltipTemplate" />
|
|
542
|
+
<VisTooltip v-if="showReadout" class-name="search-trend-tooltip" />
|
|
524
543
|
</VisXYContainer>
|
|
525
544
|
|
|
526
545
|
<template #fallback>
|
|
@@ -536,17 +555,21 @@ function accessibleValue(row: DataRow, metric: Metric): string {
|
|
|
536
555
|
</div>
|
|
537
556
|
</template>
|
|
538
557
|
</ClientOnly>
|
|
539
|
-
<
|
|
540
|
-
|
|
558
|
+
<component
|
|
559
|
+
:is="showReadout ? UiChartDataReveal : 'div'"
|
|
560
|
+
v-if="!loading && value.length >= 2"
|
|
561
|
+
:class="showReadout ? undefined : 'sr-only'"
|
|
562
|
+
>
|
|
563
|
+
<!-- Text equivalent of the visual chart, permitted raw table exception. -->
|
|
541
564
|
<!-- eslint-disable-next-line vue/no-restricted-syntax -->
|
|
542
565
|
<table>
|
|
543
|
-
<caption>Search console performance chart</caption>
|
|
566
|
+
<caption>{{ showReadout ? 'Bing Search Performance' : 'Search console performance chart' }}</caption>
|
|
544
567
|
<thead>
|
|
545
568
|
<tr>
|
|
546
569
|
<th scope="col">
|
|
547
570
|
Date
|
|
548
571
|
</th>
|
|
549
|
-
<th scope="col">
|
|
572
|
+
<th v-if="!showReadout" scope="col">
|
|
550
573
|
Period
|
|
551
574
|
</th>
|
|
552
575
|
<th v-for="metric in visibleMetrics" :key="metric" scope="col">
|
|
@@ -559,14 +582,16 @@ function accessibleValue(row: DataRow, metric: Metric): string {
|
|
|
559
582
|
<th scope="row">
|
|
560
583
|
{{ row.value.date }}
|
|
561
584
|
</th>
|
|
562
|
-
<td
|
|
585
|
+
<td v-if="!showReadout">
|
|
586
|
+
{{ row.period }}
|
|
587
|
+
</td>
|
|
563
588
|
<td v-for="metric in visibleMetrics" :key="metric">
|
|
564
589
|
{{ accessibleValue(row.value, metric) }}
|
|
565
590
|
</td>
|
|
566
591
|
</tr>
|
|
567
592
|
</tbody>
|
|
568
593
|
</table>
|
|
569
|
-
</
|
|
594
|
+
</component>
|
|
570
595
|
</div>
|
|
571
596
|
</template>
|
|
572
597
|
|
|
@@ -606,11 +631,6 @@ function accessibleValue(row: DataRow, metric: Metric): string {
|
|
|
606
631
|
--vis-crosshair-line-stroke-opacity: 0.6;
|
|
607
632
|
}
|
|
608
633
|
|
|
609
|
-
/* Hide the empty tooltip container (we render tooltip in the parent) */
|
|
610
|
-
.gsc-chart .chart-layer--interactive :deep(.unovis-tooltip) {
|
|
611
|
-
display: none;
|
|
612
|
-
}
|
|
613
|
-
|
|
614
634
|
/* Zero horizontal margin: anchor edge tick labels inward so they don't clip at
|
|
615
635
|
the svg boundary. Unovis sets text-anchor as an SVG attribute, which CSS
|
|
616
636
|
outranks; d3-axis keeps tick <g>s DOM-ordered by value, so first/last-of-type
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nuxtseo/pro-search",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.1.
|
|
4
|
+
"version": "0.1.14",
|
|
5
5
|
"description": "Shared Search Console and Webmaster Tools views for Nuxt dashboards.",
|
|
6
6
|
"license": "MIT",
|
|
7
7
|
"exports": {
|
|
@@ -20,7 +20,7 @@
|
|
|
20
20
|
"peerDependencies": {
|
|
21
21
|
"@gscdump/contracts": "^7.16.0",
|
|
22
22
|
"@gscdump/sdk": "^7.16.0",
|
|
23
|
-
"@nuxtseo/design-system": "^0.1.
|
|
23
|
+
"@nuxtseo/design-system": "^0.1.14",
|
|
24
24
|
"@vueuse/core": "^14.0.0 || ^15.0.0",
|
|
25
25
|
"nuxt": "^4.6.0",
|
|
26
26
|
"vue": "^3.5.0"
|
|
@@ -33,13 +33,13 @@
|
|
|
33
33
|
"@unovis/vue": "^1.6.7"
|
|
34
34
|
},
|
|
35
35
|
"devDependencies": {
|
|
36
|
-
"@gscdump/contracts": "7.
|
|
37
|
-
"@gscdump/sdk": "7.
|
|
38
|
-
"@nuxtseo/design-system": "0.1.
|
|
36
|
+
"@gscdump/contracts": "7.19.0",
|
|
37
|
+
"@gscdump/sdk": "7.19.0",
|
|
38
|
+
"@nuxtseo/design-system": "0.1.14",
|
|
39
39
|
"@vueuse/core": "^14.4.0",
|
|
40
|
-
"nuxt": "4.
|
|
40
|
+
"nuxt": "4.7.0",
|
|
41
41
|
"site-typecheck": "0.0.0",
|
|
42
|
-
"vue": "
|
|
42
|
+
"vue": "3.5.46"
|
|
43
43
|
},
|
|
44
44
|
"scripts": {
|
|
45
45
|
"nuxt:prepare": "nuxt prepare",
|
|
@@ -3,6 +3,13 @@ import type { BingDataV1 } from '@gscdump/contracts/v1/http'
|
|
|
3
3
|
export type BingEntityKind = 'pages' | 'keywords'
|
|
4
4
|
export const BING_PERFORMANCE_PAGE_SIZE = 10
|
|
5
5
|
|
|
6
|
+
/** The Bing traffic metrics as chart chips. Bing reports no position for site traffic. */
|
|
7
|
+
export const BING_TRAFFIC_METRICS = [
|
|
8
|
+
{ key: 'clicks', label: 'Clicks', color: 'blue' },
|
|
9
|
+
{ key: 'impressions', label: 'Impressions', color: 'purple' },
|
|
10
|
+
{ key: 'ctr', label: 'CTR', color: 'green' },
|
|
11
|
+
] as const
|
|
12
|
+
|
|
6
13
|
const bingNumberFormat = new Intl.NumberFormat('en-US', { notation: 'compact', maximumFractionDigits: 1 })
|
|
7
14
|
const bingCtrFormat = new Intl.NumberFormat('en-US', { style: 'percent', minimumFractionDigits: 1, maximumFractionDigits: 1 })
|
|
8
15
|
const bingReportingDayFormat = new Intl.DateTimeFormat('en-US', { month: 'short', day: 'numeric', timeZone: 'UTC' })
|
package/shared/compare-align.ts
CHANGED
|
@@ -93,12 +93,12 @@ interface CalendarChartRow {
|
|
|
93
93
|
date: string
|
|
94
94
|
clicks: number
|
|
95
95
|
impressions: number
|
|
96
|
-
position: number
|
|
96
|
+
position: number | null
|
|
97
97
|
ctr: number
|
|
98
98
|
}
|
|
99
99
|
|
|
100
100
|
/** Keep elapsed reporting days without inventing observations. */
|
|
101
|
-
export function calendarChartRows(rows: readonly
|
|
101
|
+
export function calendarChartRows<T extends CalendarChartRow>(rows: readonly T[], dateRange?: { start: string, end: string }) {
|
|
102
102
|
if (!rows.length)
|
|
103
103
|
return []
|
|
104
104
|
const byDate = new Map(rows.map(row => [row.date, row]))
|
package/shared/navigation.ts
CHANGED
|
@@ -4,7 +4,7 @@ export interface SearchConsoleTrendDay {
|
|
|
4
4
|
date: string
|
|
5
5
|
clicks: number
|
|
6
6
|
impressions: number
|
|
7
|
-
position: number
|
|
7
|
+
position: number | null
|
|
8
8
|
ctr: number
|
|
9
9
|
}
|
|
10
10
|
|
|
@@ -21,6 +21,8 @@ export interface SearchConsoleTrendProps {
|
|
|
21
21
|
height?: number | string
|
|
22
22
|
/** Show loading skeleton */
|
|
23
23
|
loading?: boolean
|
|
24
|
+
/** How to style recent provider observations. */
|
|
25
|
+
reportingDays?: 'gsc-provisional' | 'observed'
|
|
24
26
|
/**
|
|
25
27
|
* Full (unzoomed) current series. When provided, y-domains are computed against this
|
|
26
28
|
* so zoomed views stay anchored to the full period's scale.
|