@nuxtseo/pro-indexing 0.0.0-stage → 0.1.4

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.
@@ -0,0 +1,208 @@
1
+ <script setup lang="ts">
2
+ import type { RouteLocationRaw } from 'vue-router'
3
+ import { NuxtLink, UiIcon, UiMetricLabel, UiSeverityDot, UiSparkline, UiTooltip } from '#components'
4
+
5
+ type StepStatus = 'success' | 'error' | 'warning' | 'neutral'
6
+
7
+ interface PipelineStep {
8
+ label: string
9
+ status: StepStatus
10
+ value: string
11
+ /** Large display value (e.g. "275" or "74.7%") — hero variant only */
12
+ displayValue?: string
13
+ /** Icon name for the step (Lucide/Carbon) */
14
+ icon?: string
15
+ tooltip?: string
16
+ sparkline?: number[]
17
+ to?: RouteLocationRaw
18
+ }
19
+
20
+ const { steps, variant = 'hero' } = defineProps<{
21
+ steps: PipelineStep[]
22
+ /** hero: full grid with sparklines. inline: compact horizontal row */
23
+ variant?: 'hero' | 'inline'
24
+ }>()
25
+
26
+ /** Status-tinted icon container classes (matches UiNavIcon pattern) */
27
+ const statusContainerColors: Record<StepStatus, string> = {
28
+ success: 'bg-success/10 border-success/15',
29
+ error: 'bg-error/10 border-error/15',
30
+ warning: 'bg-warning/10 border-warning/15',
31
+ neutral: 'bg-primary-300/10 border-primary-300/15 dark:bg-primary-900/10 dark:border-primary-950/15',
32
+ }
33
+
34
+ const statusIconColors: Record<StepStatus, string> = {
35
+ success: 'text-success',
36
+ error: 'text-error',
37
+ warning: 'text-warning',
38
+ neutral: 'text-dimmed',
39
+ }
40
+
41
+ const statusSparklineColors: Record<StepStatus, string> = {
42
+ success: '#22c55e',
43
+ error: '#ef4444',
44
+ warning: '#eab308',
45
+ neutral: '#94a3b8',
46
+ }
47
+ </script>
48
+
49
+ <template>
50
+ <!-- ═══ HERO variant: 4-col grid with sparklines ═══ -->
51
+ <div v-if="variant === 'hero'" class="grid grid-cols-2 gap-4 sm:gap-0 sm:grid-cols-4 divide-default sm:divide-x" role="list" aria-label="Crawl pipeline">
52
+ <component
53
+ :is="step.to ? NuxtLink : 'div'"
54
+ v-for="(step, i) in steps"
55
+ :key="step.label"
56
+ :to="step.to || undefined"
57
+ role="listitem"
58
+ class="hero-step group"
59
+ :class="{ 'hero-step--link': !!step.to }"
60
+ >
61
+ <!-- Label row -->
62
+ <div class="flex items-center gap-1.5 mb-1">
63
+ <div
64
+ v-if="step.icon"
65
+ class="border size-4.5 flex items-center justify-center rounded shrink-0"
66
+ :class="statusContainerColors[step.status]"
67
+ >
68
+ <UiIcon :name="step.icon" class="size-2.5 shrink-0" :class="statusIconColors[step.status]" />
69
+ </div>
70
+ <div
71
+ v-else
72
+ class="size-1.5 rounded-full shrink-0"
73
+ :class="step.status === 'success' ? 'bg-success' : step.status === 'error' ? 'bg-error' : step.status === 'warning' ? 'bg-warning' : 'bg-muted'"
74
+ />
75
+ <UiMetricLabel>{{ step.label }}</UiMetricLabel>
76
+ <UiIcon
77
+ v-if="i < steps.length - 1"
78
+ name="chevron-right"
79
+ class="size-2.5 text-dimmed ml-auto shrink-0 opacity-30"
80
+ />
81
+ </div>
82
+
83
+ <!-- Value -->
84
+ <UiTooltip v-if="step.tooltip" :text="step.tooltip">
85
+ <div class="flex items-baseline gap-1.5">
86
+ <span v-if="step.displayValue" class="text-2xl font-bold text-default">{{ step.displayValue }}</span>
87
+ <span class="text-xs" :class="step.displayValue ? 'text-dimmed' : 'text-lg font-semibold tabular-nums text-default'">{{ step.value }}</span>
88
+ </div>
89
+ </UiTooltip>
90
+ <div v-else class="flex items-baseline gap-1.5">
91
+ <span v-if="step.displayValue" class="text-2xl font-bold text-default">{{ step.displayValue }}</span>
92
+ <span class="text-xs" :class="step.displayValue ? 'text-dimmed' : 'text-lg font-semibold tabular-nums text-default'">{{ step.value }}</span>
93
+ </div>
94
+
95
+ <!-- Sparkline -->
96
+ <UiSparkline
97
+ v-if="step.sparkline?.length && step.sparkline.length > 2"
98
+ :data="step.sparkline"
99
+ :color="statusSparklineColors[step.status]"
100
+ :width="120"
101
+ :height="28"
102
+ :stroke-width="1.5"
103
+ class="mt-2"
104
+ />
105
+ <div v-else class="mt-2 h-[28px]" />
106
+ </component>
107
+ </div>
108
+
109
+ <!-- ═══ INLINE variant: compact horizontal flow ═══ -->
110
+ <div v-else class="inline-pipeline" role="list" aria-label="Crawl pipeline">
111
+ <template v-for="(step, i) in steps" :key="step.label">
112
+ <component
113
+ :is="step.to ? NuxtLink : 'div'"
114
+ :to="step.to || undefined"
115
+ role="listitem"
116
+ class="inline-step"
117
+ :class="{ 'inline-step--link': !!step.to }"
118
+ >
119
+ <span class="inline-label">{{ step.label }}</span>
120
+ <UiTooltip v-if="step.tooltip" :text="step.tooltip">
121
+ <UiSeverityDot :severity="step.status" :label="step.value" />
122
+ </UiTooltip>
123
+ <UiSeverityDot v-else :severity="step.status" :label="step.value" />
124
+ </component>
125
+ <UiIcon v-if="i < steps.length - 1" name="chevron-right" class="inline-arrow" />
126
+ </template>
127
+ </div>
128
+ </template>
129
+
130
+ <style scoped>
131
+ /* ─── Hero variant ─── */
132
+ .hero-step {
133
+ display: flex;
134
+ flex-direction: column;
135
+ padding: 0.75rem 1rem;
136
+ min-width: 0;
137
+ }
138
+
139
+ .hero-step:first-child {
140
+ padding-left: 0;
141
+ }
142
+
143
+ .hero-step:last-child {
144
+ padding-right: 0;
145
+ }
146
+
147
+ .hero-step--link {
148
+ cursor: pointer;
149
+ }
150
+
151
+ @media (prefers-reduced-motion: no-preference) {
152
+ .hero-step--link {
153
+ transition: opacity 0.15s;
154
+ }
155
+ }
156
+
157
+ .hero-step--link:hover {
158
+ opacity: 0.7;
159
+ }
160
+
161
+ /* ─── Inline variant ─── */
162
+ .inline-pipeline {
163
+ display: flex;
164
+ align-items: flex-start;
165
+ gap: 0.375rem;
166
+ overflow-x: auto;
167
+ }
168
+
169
+ .inline-step {
170
+ display: flex;
171
+ flex-direction: column;
172
+ gap: 0.25rem;
173
+ min-width: 0;
174
+ padding: 0.375rem 0.5rem;
175
+ border-radius: 0.375rem;
176
+ }
177
+
178
+ .inline-step--link {
179
+ cursor: pointer;
180
+ }
181
+
182
+ @media (prefers-reduced-motion: no-preference) {
183
+ .inline-step--link {
184
+ transition: opacity 0.15s;
185
+ }
186
+ }
187
+
188
+ .inline-step--link:hover {
189
+ opacity: 0.75;
190
+ }
191
+
192
+ .inline-label {
193
+ font-size: 10px;
194
+ font-weight: 600;
195
+ text-transform: uppercase;
196
+ letter-spacing: 0.06em;
197
+ color: var(--ui-text-dimmed);
198
+ }
199
+
200
+ .inline-arrow {
201
+ width: 0.75rem;
202
+ height: 0.75rem;
203
+ color: var(--ui-text-dimmed);
204
+ flex-shrink: 0;
205
+ margin-top: 1rem;
206
+ opacity: 0.35;
207
+ }
208
+ </style>
@@ -0,0 +1,226 @@
1
+ <script setup lang="ts">
2
+ import type { IndexCohortLead, IndexingOverviewModel } from '@gscdump/sdk/indexing'
3
+ import type { IndexingSiteDiagnosis } from '../../shared/source'
4
+ import { formatGroupedNumber } from '@nuxtseo/design-system/app/composables/formatting'
5
+ import { computed } from 'vue'
6
+ import { UiButton, UiCard, UiSkeleton, UiStatusBadge } from '#components'
7
+
8
+ export type IndexingDiagnosisPanelState
9
+ = | { _tag: 'loading' }
10
+ | { _tag: 'ready', model: IndexingOverviewModel<IndexingSiteDiagnosis> }
11
+
12
+ const { state, lead } = defineProps<{
13
+ state: IndexingDiagnosisPanelState
14
+ actionTo: string
15
+ sitemapTo: string
16
+ freshness: string | null
17
+ /**
18
+ * A cohort that cleared the significance test. When present it replaces the
19
+ * reason-derived headline and next step: "21 of 76 pages under /docs/og-image
20
+ * are missing" locates the failure, where "Google crawled 38 URLs but chose
21
+ * not to keep them" only names it. Absent when no cohort separates, and the
22
+ * reason-led headline is then still the most specific true statement.
23
+ */
24
+ lead?: IndexCohortLead
25
+ /** Where the lead's action goes. Required whenever `lead` is a `lead`. */
26
+ leadTo?: string
27
+ }>()
28
+
29
+ const cohortLead = computed(() => lead?._tag === 'lead' ? lead : null)
30
+
31
+ const model = computed(() => state._tag === 'ready' ? state.model : null)
32
+
33
+ const status = computed(() => {
34
+ if (model.value?._tag !== 'diagnosis')
35
+ return null
36
+ return model.value.diagnosis.severity === 'severe'
37
+ ? { tone: 'error' as const, label: 'Action needed' }
38
+ : model.value.diagnosis.severity === 'watch' || model.value.diagnosis.reason !== 'none'
39
+ ? { tone: 'warning' as const, label: 'Review' }
40
+ : { tone: 'success' as const, label: 'Healthy' }
41
+ })
42
+ </script>
43
+
44
+ <template>
45
+ <UiCard emphasis size="lg" data-pro-indexing-section="diagnosis">
46
+ <div v-if="state._tag === 'loading'" class="flex min-h-56 flex-col justify-center gap-6" aria-live="polite">
47
+ <div class="space-y-3">
48
+ <UiSkeleton type="text" :base="100" :range="16" />
49
+ <UiSkeleton type="text" :base="520" :range="80" class="!h-8" />
50
+ <UiSkeleton type="text" :base="280" :range="60" />
51
+ </div>
52
+ <div class="flex flex-col gap-4 border-t border-default pt-5 sm:flex-row sm:items-start sm:justify-between">
53
+ <div class="min-w-0 flex-1 space-y-2">
54
+ <UiSkeleton type="text" :base="70" :range="12" />
55
+ <UiSkeleton type="text" :base="240" :range="50" />
56
+ <UiSkeleton type="text" :base="440" :range="80" />
57
+ </div>
58
+ <UiSkeleton type="text" :base="150" :range="20" class="!h-11 shrink-0" />
59
+ </div>
60
+ </div>
61
+
62
+ <template v-else-if="model">
63
+ <div v-if="model._tag === 'waiting'" class="flex min-h-56 flex-col justify-center gap-4">
64
+ <UiStatusBadge
65
+ status="neutral"
66
+ :label="model.progress
67
+ ? model.progress.inspected > 0 ? 'Inspection in progress' : 'Waiting for Google'
68
+ : 'Setup needed'"
69
+ />
70
+ <div>
71
+ <h2 class="max-w-2xl text-2xl font-strong text-default">
72
+ <template v-if="model.progress">
73
+ {{ formatGroupedNumber(model.progress.inspected) }} of {{ formatGroupedNumber(model.progress.total) }} sitemap URLs inspected
74
+ </template>
75
+ <template v-else>
76
+ Connect Search Console to collect indexing evidence
77
+ </template>
78
+ </h2>
79
+ <p class="mt-2 max-w-2xl text-sm text-muted">
80
+ {{ model.reason }}
81
+ </p>
82
+ </div>
83
+ <div v-if="model.progress" class="max-w-sm">
84
+ <div
85
+ class="h-2 overflow-hidden rounded-full bg-accented"
86
+ role="progressbar"
87
+ aria-label="Sitemap inspection progress"
88
+ :aria-valuenow="model.progress.inspected"
89
+ aria-valuemin="0"
90
+ :aria-valuemax="model.progress.total"
91
+ >
92
+ <div
93
+ class="h-full bg-primary"
94
+ :style="{ width: `${Math.min(100, model.progress.inspected / model.progress.total * 100)}%` }"
95
+ />
96
+ </div>
97
+ </div>
98
+ </div>
99
+
100
+ <div v-else-if="model._tag === 'trust_failure'" class="flex min-h-56 flex-col justify-center gap-4">
101
+ <UiStatusBadge status="error" label="Cannot confirm indexing" />
102
+ <div>
103
+ <h2 class="max-w-2xl text-2xl font-strong text-default">
104
+ Fix the sitemap signal before trusting coverage
105
+ </h2>
106
+ <p class="mt-2 max-w-2xl text-sm text-muted">
107
+ {{ model.reason }}
108
+ </p>
109
+ </div>
110
+ <UiButton :to="sitemapTo" purpose="cta" trailing-icon="next" class="min-h-11 self-start">
111
+ Review sitemap
112
+ </UiButton>
113
+ </div>
114
+
115
+ <div v-else-if="model._tag === 'verify_scope'" class="flex min-h-56 flex-col justify-center gap-4">
116
+ <UiStatusBadge status="warning" label="Verify scope" />
117
+ <div>
118
+ <h2 class="max-w-2xl text-2xl font-strong text-default">
119
+ Indexing scope may have collapsed
120
+ </h2>
121
+ <!-- The button already says to verify the inventory; the sentence that
122
+ used to repeat it here was the action twice. -->
123
+ <p class="mt-2 max-w-2xl text-sm text-muted">
124
+ {{ model.reason }}
125
+ </p>
126
+ </div>
127
+ <UiButton :to="sitemapTo" purpose="cta" trailing-icon="next" class="min-h-11 self-start">
128
+ Verify sitemap inventory
129
+ </UiButton>
130
+ </div>
131
+
132
+ <div v-else-if="model._tag === 'partial_scope'" class="flex min-h-56 flex-col justify-center gap-4">
133
+ <UiStatusBadge status="neutral" label="Inspection in progress" />
134
+ <div>
135
+ <h2 class="max-w-2xl text-2xl font-strong text-default">
136
+ The inspected sample looks indexed
137
+ </h2>
138
+ <p class="mt-2 max-w-2xl text-sm text-muted">
139
+ {{ model.reason }}
140
+ </p>
141
+ </div>
142
+ <UiButton :to="actionTo" purpose="secondary" trailing-icon="next" class="min-h-11 self-start">
143
+ View inspected URLs
144
+ </UiButton>
145
+ </div>
146
+
147
+ <div v-else class="flex flex-col gap-6">
148
+ <div class="min-w-0">
149
+ <UiStatusBadge
150
+ v-if="status"
151
+ :status="status.tone"
152
+ :label="status.label"
153
+ />
154
+ <h2 class="mt-3 max-w-2xl text-2xl font-strong text-default">
155
+ {{ cohortLead ? cohortLead.title : model.diagnosis.summary }}
156
+ </h2>
157
+ <p v-if="model.trustNote" class="mt-2 max-w-2xl text-sm text-warning">
158
+ {{ model.trustNote }}
159
+ </p>
160
+ </div>
161
+
162
+ <div
163
+ v-if="cohortLead"
164
+ class="flex flex-col gap-4 border-t border-default pt-5 sm:flex-row sm:items-start sm:justify-between"
165
+ >
166
+ <div class="min-w-0">
167
+ <p class="text-label">
168
+ Next step
169
+ </p>
170
+ <h3 class="mt-1 text-base font-semibold text-default">
171
+ {{ model.primaryAction ? model.primaryAction.label : 'Review this section' }}
172
+ </h3>
173
+ </div>
174
+ <UiButton
175
+ :to="leadTo ?? actionTo"
176
+ purpose="cta"
177
+ trailing-icon="next"
178
+ class="min-h-11 shrink-0 self-start"
179
+ >
180
+ {{ cohortLead.actionLabel }}
181
+ </UiButton>
182
+ </div>
183
+
184
+ <div
185
+ v-else-if="model.primaryAction"
186
+ class="flex flex-col gap-4 border-t border-default pt-5 sm:flex-row sm:items-start sm:justify-between"
187
+ >
188
+ <div class="min-w-0">
189
+ <p class="text-label">
190
+ Next step
191
+ </p>
192
+ <h3 class="mt-1 text-base font-semibold text-default">
193
+ {{ model.primaryAction.label }}
194
+ </h3>
195
+ <p class="mt-1 max-w-2xl text-sm text-muted">
196
+ {{ model.primaryAction.detail }}
197
+ </p>
198
+ </div>
199
+ <UiButton
200
+ :to="actionTo"
201
+ purpose="cta"
202
+ trailing-icon="next"
203
+ class="min-h-11 shrink-0 self-start"
204
+ >
205
+ {{ model.primaryAction.buttonLabel }}
206
+ </UiButton>
207
+ </div>
208
+
209
+ <UiButton
210
+ v-else
211
+ :to="actionTo"
212
+ purpose="secondary"
213
+ trailing-icon="next"
214
+ class="min-h-11 self-start"
215
+ >
216
+ View inspected URLs
217
+ </UiButton>
218
+
219
+ <!-- Freshness is metadata about the verdict, not part of it. -->
220
+ <p v-if="freshness" class="text-mini text-dimmed">
221
+ Diagnosis {{ freshness }}
222
+ </p>
223
+ </div>
224
+ </template>
225
+ </UiCard>
226
+ </template>