@nuxtseo/pro-search 0.1.10 → 0.1.11
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/app/components/BingSearchPerformance.vue +119 -103
- package/package.json +5 -5
|
@@ -6,13 +6,14 @@ import { computed, ref, watch } from 'vue'
|
|
|
6
6
|
import { UiAlert, UiDataTableSection, UiEmptyState, UiIcon, UiLineChart, UiMetricStat, UiMetricToggle, UiRelativeTime, UiSectionHeader, UiTableMetricCell, UiTablePathCell, UiTableShell, UiTableTd, UiTableTh, UiTogglePill } from '#components'
|
|
7
7
|
import { BING_PERFORMANCE_PAGE_SIZE, bingTrafficTotals, formatBingCtr, formatBingNumber, formatBingReportingDay } from '../../shared/bing-performance'
|
|
8
8
|
|
|
9
|
-
const { data, startDate, endDate, entities, pending, error } = defineProps<{
|
|
10
|
-
data: Extract<BingDataV1, { dataset: 'traffic' }>
|
|
9
|
+
const { data, startDate, endDate, entities, pending, error, view } = defineProps<{
|
|
10
|
+
data: Extract<BingDataV1, { dataset: 'traffic' }> | null
|
|
11
11
|
startDate: string
|
|
12
12
|
endDate: string
|
|
13
13
|
entities: BingDataV1 | null
|
|
14
14
|
pending: boolean
|
|
15
15
|
error: boolean
|
|
16
|
+
view?: 'overview' | 'queries' | 'pages'
|
|
16
17
|
}>()
|
|
17
18
|
const emit = defineEmits<{ retry: [] }>()
|
|
18
19
|
const entityKind = defineModel<BingEntityKind>('entityKind', { required: true })
|
|
@@ -27,9 +28,17 @@ const metricOptions = [
|
|
|
27
28
|
const chartSeries = computed(() => metricOptions
|
|
28
29
|
.filter(option => metrics.value.includes(option.key))
|
|
29
30
|
.map(option => ({ key: option.key, label: option.label, color: gscMetricColors[option.key].color })))
|
|
30
|
-
const totals = computed(() => bingTrafficTotals(data
|
|
31
|
-
const lastCollection = computed(() =>
|
|
32
|
-
const
|
|
31
|
+
const totals = computed(() => bingTrafficTotals(data?.rows ?? []))
|
|
32
|
+
const lastCollection = computed(() => {
|
|
33
|
+
const sync = (view === 'pages' || view === 'queries' ? entities : data)?.sync
|
|
34
|
+
return sync && sync._tag !== 'missing' ? sync.observedAt : null
|
|
35
|
+
})
|
|
36
|
+
const unavailable = computed(() => data?.sync._tag === 'unavailable' || entities?.sync._tag === 'unavailable')
|
|
37
|
+
const entityTitle = computed(() => {
|
|
38
|
+
if (entityKind.value === 'pages')
|
|
39
|
+
return 'Top Pages'
|
|
40
|
+
return view === 'queries' ? 'Top Queries' : 'Top Keywords'
|
|
41
|
+
})
|
|
33
42
|
|
|
34
43
|
interface EntityRow extends Record<string, unknown> {
|
|
35
44
|
key: string
|
|
@@ -76,110 +85,117 @@ function rowCtr(row: EntityRow): string {
|
|
|
76
85
|
description="The last successful collection stays visible while the next daily sync retries."
|
|
77
86
|
/>
|
|
78
87
|
|
|
79
|
-
<
|
|
80
|
-
<
|
|
81
|
-
<
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
88
|
+
<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">
|
|
91
|
+
<UiIcon name="calendar" class="size-3.5 shrink-0 text-dimmed" aria-hidden="true" />
|
|
92
|
+
{{ startDate }} to {{ endDate }}
|
|
93
|
+
</span>
|
|
94
|
+
<UiMetricToggle v-if="data.rows.length" v-model="metrics" :options="[...metricOptions]" chip :colors="gscMetricColors" />
|
|
95
|
+
</div>
|
|
86
96
|
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
97
|
+
<div class="flex flex-col gap-3 sm:flex-row sm:items-start sm:justify-between">
|
|
98
|
+
<UiSectionHeader
|
|
99
|
+
title="Bing Search Performance"
|
|
100
|
+
tooltip="Bing reports total traffic across its search surfaces. It does not provide a separate Chat source."
|
|
101
|
+
/>
|
|
102
|
+
<div v-if="lastCollection" class="text-xs text-muted">
|
|
103
|
+
Collected <UiRelativeTime :date="lastCollection" />
|
|
104
|
+
</div>
|
|
94
105
|
</div>
|
|
95
|
-
</div>
|
|
96
106
|
|
|
97
|
-
|
|
107
|
+
<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.'" />
|
|
98
108
|
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
109
|
+
<div v-if="data.rows.length" class="flex flex-wrap gap-x-6 gap-y-3 rounded-xl border border-default bg-elevated/30 px-4 py-3">
|
|
110
|
+
<UiMetricStat :value="formatBingNumber(totals.clicks)" label="clicks" />
|
|
111
|
+
<UiMetricStat :value="formatBingNumber(totals.impressions)" label="impressions" />
|
|
112
|
+
<UiMetricStat :value="formatBingCtr(totals.ctr)" label="CTR" />
|
|
113
|
+
</div>
|
|
104
114
|
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
115
|
+
<div v-if="data.rows.length" class="rounded-xl border border-default bg-default p-4">
|
|
116
|
+
<h3 class="mb-3 text-sm font-strong text-highlighted">
|
|
117
|
+
Traffic over time
|
|
118
|
+
</h3>
|
|
119
|
+
<UiLineChart
|
|
120
|
+
:data="data.rows"
|
|
121
|
+
x-key="date"
|
|
122
|
+
:series="chartSeries"
|
|
123
|
+
:height="220"
|
|
124
|
+
:x-format="value => formatBingReportingDay(String(value))"
|
|
125
|
+
:y-format="value => formatBingNumber(value)"
|
|
126
|
+
/>
|
|
127
|
+
</div>
|
|
128
|
+
</template>
|
|
118
129
|
|
|
119
|
-
<
|
|
120
|
-
<
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
130
|
+
<template v-if="view !== 'overview'">
|
|
131
|
+
<div class="flex items-center justify-between gap-3">
|
|
132
|
+
<UiSectionHeader
|
|
133
|
+
:title="entityTitle"
|
|
134
|
+
tooltip="Bing updates its top Pages and Keywords data weekly."
|
|
135
|
+
/>
|
|
136
|
+
<UiTogglePill v-if="!view" v-model="entityKind" :options="entityOptions" label="Bing breakdown" />
|
|
137
|
+
<div v-else-if="lastCollection" class="text-xs text-muted">
|
|
138
|
+
Collected <UiRelativeTime :date="lastCollection" />
|
|
139
|
+
</div>
|
|
140
|
+
</div>
|
|
126
141
|
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
142
|
+
<UiDataTableSection
|
|
143
|
+
v-model:page="page"
|
|
144
|
+
:rows="visibleRows"
|
|
145
|
+
:total="totalRows"
|
|
146
|
+
:pending="pending"
|
|
147
|
+
:error="error ? 'Bing data could not be loaded. Retry the request.' : undefined"
|
|
148
|
+
:searchable="false"
|
|
149
|
+
:columns="[]"
|
|
150
|
+
:page-size="BING_PERFORMANCE_PAGE_SIZE"
|
|
151
|
+
item-label="rows"
|
|
152
|
+
:label="entityTitle"
|
|
153
|
+
@retry="emit('retry')"
|
|
154
|
+
>
|
|
155
|
+
<template #body>
|
|
156
|
+
<UiTableShell bordered row-hover size="xs" :label="entityTitle">
|
|
157
|
+
<template #head>
|
|
158
|
+
<UiTableTh>
|
|
159
|
+
{{ entityKind === 'pages' ? 'Page' : view === 'queries' ? 'Query' : 'Keyword' }}
|
|
160
|
+
</UiTableTh>
|
|
161
|
+
<UiTableTh>Date</UiTableTh>
|
|
162
|
+
<UiTableTh numeric>
|
|
163
|
+
Clicks
|
|
164
|
+
</UiTableTh>
|
|
165
|
+
<UiTableTh numeric>
|
|
166
|
+
Impressions
|
|
167
|
+
</UiTableTh>
|
|
168
|
+
<UiTableTh numeric visible-from="md">
|
|
169
|
+
CTR
|
|
170
|
+
</UiTableTh>
|
|
171
|
+
<UiTableTh numeric visible-from="lg">
|
|
172
|
+
Avg position
|
|
173
|
+
</UiTableTh>
|
|
174
|
+
</template>
|
|
175
|
+
<tr v-for="row in visibleRows" :key="row.key">
|
|
176
|
+
<UiTableTd row-header class="max-w-0 w-full">
|
|
177
|
+
<UiTablePathCell v-if="row.url" :url="row.url" />
|
|
178
|
+
<span v-else class="block truncate font-sans text-xs text-default" :title="row.label">{{ row.label }}</span>
|
|
179
|
+
</UiTableTd>
|
|
180
|
+
<UiTableTd class="whitespace-nowrap">
|
|
181
|
+
{{ row.date }}
|
|
182
|
+
</UiTableTd>
|
|
183
|
+
<UiTableTd numeric>
|
|
184
|
+
<UiTableMetricCell :value="row.clicks" :display="formatBingNumber(row.clicks)" />
|
|
185
|
+
</UiTableTd>
|
|
186
|
+
<UiTableTd numeric>
|
|
187
|
+
<UiTableMetricCell :value="row.impressions" :display="formatBingNumber(row.impressions)" muted />
|
|
188
|
+
</UiTableTd>
|
|
189
|
+
<UiTableTd numeric visible-from="md">
|
|
190
|
+
<UiTableMetricCell :value="row.impressions ? row.clicks / row.impressions : 0" :display="rowCtr(row)" muted />
|
|
191
|
+
</UiTableTd>
|
|
192
|
+
<UiTableTd numeric visible-from="lg">
|
|
193
|
+
<UiTableMetricCell :value="row.averagePosition" :display="row.averagePosition == null ? null : row.averagePosition.toFixed(1)" muted />
|
|
194
|
+
</UiTableTd>
|
|
195
|
+
</tr>
|
|
196
|
+
</UiTableShell>
|
|
197
|
+
</template>
|
|
198
|
+
</UiDataTableSection>
|
|
199
|
+
</template>
|
|
184
200
|
</div>
|
|
185
201
|
</template>
|
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.11",
|
|
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.11",
|
|
24
24
|
"@vueuse/core": "^14.0.0 || ^15.0.0",
|
|
25
25
|
"nuxt": "^4.6.0",
|
|
26
26
|
"vue": "^3.5.0"
|
|
@@ -33,9 +33,9 @@
|
|
|
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.18.0",
|
|
37
|
+
"@gscdump/sdk": "7.18.0",
|
|
38
|
+
"@nuxtseo/design-system": "0.1.11",
|
|
39
39
|
"@vueuse/core": "^14.4.0",
|
|
40
40
|
"nuxt": "4.6.1",
|
|
41
41
|
"site-typecheck": "0.0.0",
|