@prenta/admin 1.15.0 → 1.17.0
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/CHANGELOG.md +16 -0
- package/dist/__tests__/components/faq-proposal-preview.render.test.d.ts +2 -0
- package/dist/__tests__/components/faq-proposal-preview.render.test.d.ts.map +1 -0
- package/dist/__tests__/components/faq-proposal-preview.render.test.js +97 -0
- package/dist/__tests__/components/faq-proposal-preview.render.test.js.map +1 -0
- package/dist/__tests__/components/seo-issue-fix-panel.render.test.js +37 -11
- package/dist/__tests__/components/seo-issue-fix-panel.render.test.js.map +1 -1
- package/dist/__tests__/lib/seo-service-errors.test.js +3 -0
- package/dist/__tests__/lib/seo-service-errors.test.js.map +1 -1
- package/dist/__tests__/lib/seo-service-geo.test.d.ts +2 -0
- package/dist/__tests__/lib/seo-service-geo.test.d.ts.map +1 -0
- package/dist/__tests__/lib/seo-service-geo.test.js +103 -0
- package/dist/__tests__/lib/seo-service-geo.test.js.map +1 -0
- package/dist/__tests__/lib/seo-service-proposals.test.js +24 -0
- package/dist/__tests__/lib/seo-service-proposals.test.js.map +1 -1
- package/dist/__tests__/router/seo-tab-for-path.test.js +4 -0
- package/dist/__tests__/router/seo-tab-for-path.test.js.map +1 -1
- package/dist/__tests__/views/seo-ai-visibility.render.test.d.ts +2 -0
- package/dist/__tests__/views/seo-ai-visibility.render.test.d.ts.map +1 -0
- package/dist/__tests__/views/seo-ai-visibility.render.test.js +244 -0
- package/dist/__tests__/views/seo-ai-visibility.render.test.js.map +1 -0
- package/dist/__tests__/views/seo-geo-settings-card.render.test.d.ts +2 -0
- package/dist/__tests__/views/seo-geo-settings-card.render.test.d.ts.map +1 -0
- package/dist/__tests__/views/seo-geo-settings-card.render.test.js +227 -0
- package/dist/__tests__/views/seo-geo-settings-card.render.test.js.map +1 -0
- package/dist/__tests__/views/seo-proposals-tab.render.test.js +277 -0
- package/dist/__tests__/views/seo-proposals-tab.render.test.js.map +1 -1
- package/dist/__tests__/views/seo-settings.render.test.js +16 -4
- package/dist/__tests__/views/seo-settings.render.test.js.map +1 -1
- package/dist/__tests__/views/seo-technical-tab.render.test.js +13 -0
- package/dist/__tests__/views/seo-technical-tab.render.test.js.map +1 -1
- package/dist/components/seo/FaqProposalPreview.d.ts +39 -0
- package/dist/components/seo/FaqProposalPreview.d.ts.map +1 -0
- package/dist/components/seo/FaqProposalPreview.js +62 -0
- package/dist/components/seo/FaqProposalPreview.js.map +1 -0
- package/dist/components/seo/SeoIssueFixPanel.d.ts.map +1 -1
- package/dist/components/seo/SeoIssueFixPanel.js +7 -2
- package/dist/components/seo/SeoIssueFixPanel.js.map +1 -1
- package/dist/lib/seo-service.d.ts +155 -2
- package/dist/lib/seo-service.d.ts.map +1 -1
- package/dist/lib/seo-service.js +42 -2
- package/dist/lib/seo-service.js.map +1 -1
- package/dist/prenta-admin.css +1 -1
- package/dist/views/SEO.d.ts +5 -1
- package/dist/views/SEO.d.ts.map +1 -1
- package/dist/views/SEO.js +12 -7
- package/dist/views/SEO.js.map +1 -1
- package/dist/views/seo/AiVisibilityTab.d.ts +4 -0
- package/dist/views/seo/AiVisibilityTab.d.ts.map +1 -0
- package/dist/views/seo/AiVisibilityTab.js +165 -0
- package/dist/views/seo/AiVisibilityTab.js.map +1 -0
- package/dist/views/seo/ProposalsTab.d.ts.map +1 -1
- package/dist/views/seo/ProposalsTab.js +160 -7
- package/dist/views/seo/ProposalsTab.js.map +1 -1
- package/dist/views/seo/TechnicalTab.d.ts +3 -1
- package/dist/views/seo/TechnicalTab.d.ts.map +1 -1
- package/dist/views/seo/TechnicalTab.js +4 -4
- package/dist/views/seo/TechnicalTab.js.map +1 -1
- package/dist/views/settings/SeoAutopilotCard.d.ts.map +1 -1
- package/dist/views/settings/SeoAutopilotCard.js +6 -0
- package/dist/views/settings/SeoAutopilotCard.js.map +1 -1
- package/dist/views/settings/SeoGeoSettingsCard.d.ts +12 -0
- package/dist/views/settings/SeoGeoSettingsCard.d.ts.map +1 -0
- package/dist/views/settings/SeoGeoSettingsCard.js +178 -0
- package/dist/views/settings/SeoGeoSettingsCard.js.map +1 -0
- package/dist/views/settings/SeoSettingsTab.d.ts.map +1 -1
- package/dist/views/settings/SeoSettingsTab.js +2 -1
- package/dist/views/settings/SeoSettingsTab.js.map +1 -1
- package/package.json +3 -3
- package/src/__tests__/components/faq-proposal-preview.render.test.tsx +137 -0
- package/src/__tests__/components/seo-issue-fix-panel.render.test.tsx +42 -11
- package/src/__tests__/lib/seo-service-errors.test.ts +4 -0
- package/src/__tests__/lib/seo-service-geo.test.ts +118 -0
- package/src/__tests__/lib/seo-service-proposals.test.ts +30 -0
- package/src/__tests__/router/seo-tab-for-path.test.ts +5 -0
- package/src/__tests__/views/seo-ai-visibility.render.test.tsx +279 -0
- package/src/__tests__/views/seo-geo-settings-card.render.test.tsx +253 -0
- package/src/__tests__/views/seo-proposals-tab.render.test.tsx +358 -0
- package/src/__tests__/views/seo-settings.render.test.tsx +28 -7
- package/src/__tests__/views/seo-technical-tab.render.test.tsx +15 -0
- package/src/components/seo/FaqProposalPreview.tsx +134 -0
- package/src/components/seo/SeoIssueFixPanel.tsx +7 -2
- package/src/lib/seo-service.ts +162 -1
- package/src/views/SEO.tsx +15 -6
- package/src/views/seo/AiVisibilityTab.tsx +616 -0
- package/src/views/seo/ProposalsTab.tsx +279 -13
- package/src/views/seo/TechnicalTab.tsx +27 -8
- package/src/views/settings/SeoAutopilotCard.tsx +6 -0
- package/src/views/settings/SeoGeoSettingsCard.tsx +310 -0
- package/src/views/settings/SeoSettingsTab.tsx +2 -0
|
@@ -5,9 +5,11 @@
|
|
|
5
5
|
* in one review surface. Batch approve honours server governance
|
|
6
6
|
* (`allowBulkApply`); the UI only pre-disables the button using the flags the
|
|
7
7
|
* list payload exposes. Generation is human-triggered, capped per pass, and
|
|
8
|
-
* loops client-side while the server reports `remaining > 0`.
|
|
8
|
+
* loops client-side while the server reports `remaining > 0`. FAQ
|
|
9
|
+
* (`add-section`) rows expand into a per-question preview and approve one at
|
|
10
|
+
* a time through `apply-fix`; in a batch they apply the whole drafted section.
|
|
9
11
|
*/
|
|
10
|
-
import { useCallback, useEffect, useMemo, useRef, useState } from 'react'
|
|
12
|
+
import { useCallback, useEffect, useId, useMemo, useRef, useState, type ReactNode } from 'react'
|
|
11
13
|
import {
|
|
12
14
|
AlertTriangle,
|
|
13
15
|
ArrowRightLeft,
|
|
@@ -22,11 +24,13 @@ import {
|
|
|
22
24
|
} from 'lucide-react'
|
|
23
25
|
import { toast } from 'sonner'
|
|
24
26
|
import {
|
|
27
|
+
applySeoIssueFix,
|
|
25
28
|
bulkApplySeoProposals,
|
|
26
29
|
dismissRedirectSuggestion,
|
|
27
30
|
dismissSeoIssueFix,
|
|
28
31
|
fetchSeoProposals,
|
|
29
32
|
generateSeoProposals,
|
|
33
|
+
type SeoApplyFixOptions,
|
|
30
34
|
type SeoProposal,
|
|
31
35
|
type SeoProposalBulkApplyItem,
|
|
32
36
|
type SeoProposalsPayload,
|
|
@@ -35,6 +39,11 @@ import { hasPlanFeature, type PlanInfo } from '../../lib/plan.js'
|
|
|
35
39
|
import { brandAlignmentLabel, brandAlignmentTone } from '../../lib/brand-voice-client.js'
|
|
36
40
|
import { PlanUpgradeCallout } from '../../components/PlanUpgradeCallout.js'
|
|
37
41
|
import { ChangePreview } from '../../components/seo/ChangePreview.js'
|
|
42
|
+
import {
|
|
43
|
+
FaqProposalPreview,
|
|
44
|
+
faqDraftBlocker,
|
|
45
|
+
faqSignalLine,
|
|
46
|
+
} from '../../components/seo/FaqProposalPreview.js'
|
|
38
47
|
import {
|
|
39
48
|
SectionCard,
|
|
40
49
|
SeoEmptyState,
|
|
@@ -76,6 +85,77 @@ function toBulkItem(p: SeoProposal): SeoProposalBulkApplyItem {
|
|
|
76
85
|
: { kind: 'issue-fix', id: p.issueId ?? '', fingerprint: p.fingerprint ?? undefined }
|
|
77
86
|
}
|
|
78
87
|
|
|
88
|
+
/** An `add-section` (FAQ) proposal; `p.section` may still be `null` when the cache was unreadable. */
|
|
89
|
+
function isFaqProposal(p: SeoProposal): boolean {
|
|
90
|
+
return p.fixStrategy === 'add-section'
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
/**
|
|
94
|
+
* Reviewer edits to a FAQ proposal before approval. `selected` is parallel to
|
|
95
|
+
* `section.content.items`; `heading` is the raw input value (trimmed on send).
|
|
96
|
+
*/
|
|
97
|
+
interface FaqDraft {
|
|
98
|
+
selected: boolean[]
|
|
99
|
+
heading: string
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
/**
|
|
103
|
+
* Drafts are keyed by the drafted content, not just the issue: `fingerprint`
|
|
104
|
+
* tracks the page (`updatedAt`), so dismiss + regenerate on an unchanged page
|
|
105
|
+
* keeps the same id and fingerprint while the questions change. Folding the
|
|
106
|
+
* questions (and `generatedAt`) into the key makes a regenerated proposal
|
|
107
|
+
* start clean instead of inheriting stale ticks or a stale heading edit.
|
|
108
|
+
*/
|
|
109
|
+
function faqDraftKey(p: SeoProposal): string {
|
|
110
|
+
const questions = p.section?.content.items.map((i) => i.question).join('\u0001') ?? ''
|
|
111
|
+
return `${p.id}:${p.generatedAt ?? ''}:${questions}`
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
function initialFaqDraft(p: SeoProposal): FaqDraft {
|
|
115
|
+
const section = p.section
|
|
116
|
+
return {
|
|
117
|
+
selected: section ? section.content.items.map(() => true) : [],
|
|
118
|
+
heading: section?.content.heading ?? '',
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
/**
|
|
123
|
+
* The row's stored draft when it still fits the section (one `selected` flag
|
|
124
|
+
* per item), otherwise the untouched default. Every reader *and* writer goes
|
|
125
|
+
* through this so a mismatched draft is replaced rather than mutated.
|
|
126
|
+
*/
|
|
127
|
+
function currentFaqDraft(drafts: Record<string, FaqDraft>, p: SeoProposal): FaqDraft {
|
|
128
|
+
const draft = drafts[faqDraftKey(p)]
|
|
129
|
+
if (draft && draft.selected.length === (p.section?.content.items.length ?? 0)) return draft
|
|
130
|
+
return initialFaqDraft(p)
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
/**
|
|
134
|
+
* Body of the single-row `apply-fix` call. `includeItems` only when the
|
|
135
|
+
* reviewer dropped a question; `headingOverride` only when the trimmed heading
|
|
136
|
+
* is non-empty and differs from the draft — so an untouched row sends exactly
|
|
137
|
+
* `{ fingerprint }`, the same request the Audit tab makes.
|
|
138
|
+
*/
|
|
139
|
+
function faqApplyOptions(p: SeoProposal, draft: FaqDraft): SeoApplyFixOptions {
|
|
140
|
+
const opts: SeoApplyFixOptions = {}
|
|
141
|
+
const includeItems = draft.selected.flatMap((on, i) => (on ? [i] : []))
|
|
142
|
+
if (includeItems.length < draft.selected.length) opts.includeItems = includeItems
|
|
143
|
+
const heading = draft.heading.trim()
|
|
144
|
+
if (heading !== '' && heading !== p.section?.content.heading) opts.headingOverride = heading
|
|
145
|
+
return opts
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
/** Change-column text for a FAQ row: question count plus the strongest signal. */
|
|
149
|
+
function faqSummary(p: SeoProposal): string {
|
|
150
|
+
const signal = faqSignalLine(p.signals)
|
|
151
|
+
if (!p.section) return signal ?? p.justification
|
|
152
|
+
const count = plural(p.section.content.items.length, 'question')
|
|
153
|
+
return signal ? `${count} · ${signal}` : count
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
const FAQ_UNREADABLE_HINT =
|
|
157
|
+
'The drafted section could not be read from the cache. Dismiss this proposal and generate again to get a fresh draft.'
|
|
158
|
+
|
|
79
159
|
function BrandScoreBadge({ score }: { score: number }) {
|
|
80
160
|
return (
|
|
81
161
|
<span
|
|
@@ -187,6 +267,8 @@ export function ProposalsTab({
|
|
|
187
267
|
const [confirmGenerate, setConfirmGenerate] = useState(false)
|
|
188
268
|
const [mutation, setMutation] = useState<Mutation | null>(null)
|
|
189
269
|
const [pendingItems, setPendingItems] = useState<SeoProposalBulkApplyItem[]>([])
|
|
270
|
+
/** Per-row FAQ review edits, created lazily on first interaction (see `faqDraftKey`). */
|
|
271
|
+
const [faqDrafts, setFaqDrafts] = useState<Record<string, FaqDraft>>({})
|
|
190
272
|
const [generating, setGenerating] = useState<{ done: number; total: number } | null>(null)
|
|
191
273
|
/** Bumped after every mutation so the autopilot ledger below refetches with the inbox. */
|
|
192
274
|
const [refreshKey, setRefreshKey] = useState(0)
|
|
@@ -305,6 +387,70 @@ export function ProposalsTab({
|
|
|
305
387
|
[afterMutation, beginMutation, endMutation],
|
|
306
388
|
)
|
|
307
389
|
|
|
390
|
+
/** The row's current draft, or the untouched default when the reviewer has not edited it. */
|
|
391
|
+
const faqDraftFor = useCallback(
|
|
392
|
+
(p: SeoProposal): FaqDraft => currentFaqDraft(faqDrafts, p),
|
|
393
|
+
[faqDrafts],
|
|
394
|
+
)
|
|
395
|
+
const toggleFaqItem = useCallback((p: SeoProposal, index: number) => {
|
|
396
|
+
setFaqDrafts((cur) => {
|
|
397
|
+
const base = currentFaqDraft(cur, p)
|
|
398
|
+
const selected = base.selected.map((on, i) => (i === index ? !on : on))
|
|
399
|
+
return { ...cur, [faqDraftKey(p)]: { ...base, selected } }
|
|
400
|
+
})
|
|
401
|
+
}, [])
|
|
402
|
+
const setFaqHeading = useCallback((p: SeoProposal, heading: string) => {
|
|
403
|
+
setFaqDrafts((cur) => ({ ...cur, [faqDraftKey(p)]: { ...currentFaqDraft(cur, p), heading } }))
|
|
404
|
+
}, [])
|
|
405
|
+
|
|
406
|
+
// Drop drafts whose proposal is gone or was regenerated, so the map cannot grow across refetches.
|
|
407
|
+
useEffect(() => {
|
|
408
|
+
const liveKeys = new Set(proposals.filter(isFaqProposal).map(faqDraftKey))
|
|
409
|
+
setFaqDrafts((cur) => {
|
|
410
|
+
const stale = Object.keys(cur).filter((key) => !liveKeys.has(key))
|
|
411
|
+
if (stale.length === 0) return cur
|
|
412
|
+
const next = { ...cur }
|
|
413
|
+
for (const key of stale) delete next[key]
|
|
414
|
+
return next
|
|
415
|
+
})
|
|
416
|
+
}, [proposals])
|
|
417
|
+
|
|
418
|
+
/**
|
|
419
|
+
* Single-row approve for a FAQ proposal. Goes through `apply-fix` (not
|
|
420
|
+
* bulk-apply) so the reviewer's per-question selection and heading edit are
|
|
421
|
+
* honoured; the bulk path applies the whole drafted section unchanged.
|
|
422
|
+
*/
|
|
423
|
+
const handleApproveFaq = useCallback(
|
|
424
|
+
async (p: SeoProposal) => {
|
|
425
|
+
if (!p.issueId || !p.fingerprint || !p.section) return
|
|
426
|
+
const draft = faqDraftFor(p)
|
|
427
|
+
if (faqDraftBlocker(draft.selected) !== null) return
|
|
428
|
+
if (!beginMutation('apply')) return
|
|
429
|
+
try {
|
|
430
|
+
const res = await applySeoIssueFix(p.issueId, p.fingerprint, faqApplyOptions(p, draft))
|
|
431
|
+
if (!mountedRef.current) return
|
|
432
|
+
if (res.error) {
|
|
433
|
+
toast.error(res.error)
|
|
434
|
+
return
|
|
435
|
+
}
|
|
436
|
+
toast.success('FAQ section added.')
|
|
437
|
+
setFaqDrafts((cur) => {
|
|
438
|
+
const key = faqDraftKey(p)
|
|
439
|
+
if (!(key in cur)) return cur
|
|
440
|
+
const rest = { ...cur }
|
|
441
|
+
delete rest[key]
|
|
442
|
+
return rest
|
|
443
|
+
})
|
|
444
|
+
afterMutation()
|
|
445
|
+
} catch (err) {
|
|
446
|
+
if (mountedRef.current) toast.error(errorMessage(err))
|
|
447
|
+
} finally {
|
|
448
|
+
endMutation()
|
|
449
|
+
}
|
|
450
|
+
},
|
|
451
|
+
[afterMutation, beginMutation, endMutation, faqDraftFor],
|
|
452
|
+
)
|
|
453
|
+
|
|
308
454
|
const handleDismissSelected = useCallback(async () => {
|
|
309
455
|
const targets = selectedProposals
|
|
310
456
|
if (targets.length === 0) return
|
|
@@ -573,6 +719,41 @@ export function ProposalsTab({
|
|
|
573
719
|
<tbody className="divide-border divide-y">
|
|
574
720
|
{proposals.map((p) => {
|
|
575
721
|
const first = p.changes[0]
|
|
722
|
+
const canApply = inlineApplyEnabled || p.kind === 'redirect'
|
|
723
|
+
if (isFaqProposal(p)) {
|
|
724
|
+
const draft = faqDraftFor(p)
|
|
725
|
+
const blocker = p.section
|
|
726
|
+
? faqDraftBlocker(draft.selected)
|
|
727
|
+
: FAQ_UNREADABLE_HINT
|
|
728
|
+
return (
|
|
729
|
+
<ProposalRow
|
|
730
|
+
key={p.id}
|
|
731
|
+
proposal={p}
|
|
732
|
+
selected={selected.has(p.id)}
|
|
733
|
+
expanded={expanded.has(p.id)}
|
|
734
|
+
summary={faqSummary(p)}
|
|
735
|
+
onToggleSelect={() => toggleSelect(p.id)}
|
|
736
|
+
onToggleExpanded={() => toggleExpanded(p.id)}
|
|
737
|
+
onApprove={() => void handleApproveFaq(p)}
|
|
738
|
+
onDismiss={() => void handleDismissOne(p)}
|
|
739
|
+
busy={busy}
|
|
740
|
+
canApply={canApply}
|
|
741
|
+
approveBlocker={blocker}
|
|
742
|
+
details={
|
|
743
|
+
<FaqProposalDetails
|
|
744
|
+
proposal={p}
|
|
745
|
+
draft={draft}
|
|
746
|
+
blocker={blocker}
|
|
747
|
+
busy={busy}
|
|
748
|
+
canApply={canApply}
|
|
749
|
+
onToggle={(i) => toggleFaqItem(p, i)}
|
|
750
|
+
onHeadingChange={(h) => setFaqHeading(p, h)}
|
|
751
|
+
onApprove={() => void handleApproveFaq(p)}
|
|
752
|
+
/>
|
|
753
|
+
}
|
|
754
|
+
/>
|
|
755
|
+
)
|
|
756
|
+
}
|
|
576
757
|
return (
|
|
577
758
|
<ProposalRow
|
|
578
759
|
key={p.id}
|
|
@@ -589,7 +770,7 @@ export function ProposalsTab({
|
|
|
589
770
|
onApprove={() => void runApply([toBulkItem(p)])}
|
|
590
771
|
onDismiss={() => void handleDismissOne(p)}
|
|
591
772
|
busy={busy}
|
|
592
|
-
canApply={
|
|
773
|
+
canApply={canApply}
|
|
593
774
|
/>
|
|
594
775
|
)
|
|
595
776
|
})}
|
|
@@ -637,6 +818,8 @@ function ProposalRow({
|
|
|
637
818
|
onDismiss,
|
|
638
819
|
busy,
|
|
639
820
|
canApply,
|
|
821
|
+
approveBlocker = null,
|
|
822
|
+
details,
|
|
640
823
|
}: {
|
|
641
824
|
proposal: SeoProposal
|
|
642
825
|
selected: boolean
|
|
@@ -648,7 +831,16 @@ function ProposalRow({
|
|
|
648
831
|
onDismiss: () => void
|
|
649
832
|
busy: boolean
|
|
650
833
|
canApply: boolean
|
|
834
|
+
/**
|
|
835
|
+
* Why the row-level Approve is disabled (FAQ rows). Exposed as the button's
|
|
836
|
+
* tooltip and accessible description so the reason is available while the
|
|
837
|
+
* row is collapsed, not only in the expanded body.
|
|
838
|
+
*/
|
|
839
|
+
approveBlocker?: string | null
|
|
840
|
+
/** Replaces the default before/after table in the expanded row. */
|
|
841
|
+
details?: ReactNode
|
|
651
842
|
}) {
|
|
843
|
+
const approveHintId = `${useId()}-approve-hint`
|
|
652
844
|
return (
|
|
653
845
|
<>
|
|
654
846
|
<tr className={`${selected ? 'bg-accent/30' : ''} hover:bg-accent/20 transition-colors`}>
|
|
@@ -666,6 +858,7 @@ function ProposalRow({
|
|
|
666
858
|
<td className="px-3 py-3 align-top">
|
|
667
859
|
<div className="flex flex-wrap items-center gap-2">
|
|
668
860
|
<span className="text-foreground font-medium">{p.title}</span>
|
|
861
|
+
{isFaqProposal(p) ? <SeoStatusBadge label="FAQ section" tone="neutral" /> : null}
|
|
669
862
|
{p.severity ? (
|
|
670
863
|
<SeoStatusBadge
|
|
671
864
|
label={p.severity}
|
|
@@ -724,15 +917,24 @@ function ProposalRow({
|
|
|
724
917
|
<td className="px-3 py-3 align-top">
|
|
725
918
|
<div className="flex items-center justify-end gap-1">
|
|
726
919
|
{!p.stale && canApply ? (
|
|
727
|
-
|
|
728
|
-
|
|
729
|
-
|
|
730
|
-
|
|
731
|
-
|
|
732
|
-
|
|
733
|
-
|
|
734
|
-
|
|
735
|
-
|
|
920
|
+
<>
|
|
921
|
+
<button
|
|
922
|
+
type="button"
|
|
923
|
+
onClick={onApprove}
|
|
924
|
+
disabled={busy || approveBlocker !== null}
|
|
925
|
+
className="text-success hover:bg-accent focus-visible:ring-ring rounded-md p-1.5 focus-visible:ring-2 focus-visible:outline-none disabled:opacity-60"
|
|
926
|
+
aria-label={`Approve ${p.title}`}
|
|
927
|
+
title={approveBlocker ?? undefined}
|
|
928
|
+
aria-describedby={approveBlocker ? approveHintId : undefined}
|
|
929
|
+
>
|
|
930
|
+
<Check className="h-4 w-4" aria-hidden />
|
|
931
|
+
</button>
|
|
932
|
+
{approveBlocker ? (
|
|
933
|
+
<span id={approveHintId} className="sr-only">
|
|
934
|
+
{approveBlocker}
|
|
935
|
+
</span>
|
|
936
|
+
) : null}
|
|
937
|
+
</>
|
|
736
938
|
) : null}
|
|
737
939
|
<button
|
|
738
940
|
type="button"
|
|
@@ -751,7 +953,7 @@ function ProposalRow({
|
|
|
751
953
|
<td colSpan={6} className="bg-muted/30 px-4 py-4">
|
|
752
954
|
<div className="space-y-3">
|
|
753
955
|
<p className="text-foreground text-sm">{p.justification}</p>
|
|
754
|
-
<ChangePreview changes={p.changes} />
|
|
956
|
+
{details ?? <ChangePreview changes={p.changes} />}
|
|
755
957
|
</div>
|
|
756
958
|
</td>
|
|
757
959
|
</tr>
|
|
@@ -759,3 +961,67 @@ function ProposalRow({
|
|
|
759
961
|
</>
|
|
760
962
|
)
|
|
761
963
|
}
|
|
964
|
+
|
|
965
|
+
/**
|
|
966
|
+
* Expanded body of a FAQ row: the per-question preview plus a reviewed
|
|
967
|
+
* Approve button. When core could not read the cached section the row shows
|
|
968
|
+
* the recovery hint instead of a preview and offers no approve at all.
|
|
969
|
+
*/
|
|
970
|
+
function FaqProposalDetails({
|
|
971
|
+
proposal: p,
|
|
972
|
+
draft,
|
|
973
|
+
blocker,
|
|
974
|
+
busy,
|
|
975
|
+
canApply,
|
|
976
|
+
onToggle,
|
|
977
|
+
onHeadingChange,
|
|
978
|
+
onApprove,
|
|
979
|
+
}: {
|
|
980
|
+
proposal: SeoProposal
|
|
981
|
+
draft: FaqDraft
|
|
982
|
+
blocker: string | null
|
|
983
|
+
busy: boolean
|
|
984
|
+
canApply: boolean
|
|
985
|
+
onToggle: (index: number) => void
|
|
986
|
+
onHeadingChange: (value: string) => void
|
|
987
|
+
onApprove: () => void
|
|
988
|
+
}) {
|
|
989
|
+
const section = p.section
|
|
990
|
+
if (!section) {
|
|
991
|
+
return (
|
|
992
|
+
<p className="text-muted-foreground flex items-start gap-2 text-sm">
|
|
993
|
+
<AlertTriangle className="text-warning mt-0.5 h-4 w-4 shrink-0" aria-hidden />
|
|
994
|
+
<span>{FAQ_UNREADABLE_HINT}</span>
|
|
995
|
+
</p>
|
|
996
|
+
)
|
|
997
|
+
}
|
|
998
|
+
const items = section.content.items.map((item, i) => ({
|
|
999
|
+
...item,
|
|
1000
|
+
sourceQuote: p.grounding?.[i]?.sourceQuote || undefined,
|
|
1001
|
+
}))
|
|
1002
|
+
return (
|
|
1003
|
+
<div className="space-y-4">
|
|
1004
|
+
<FaqProposalPreview
|
|
1005
|
+
heading={section.content.heading}
|
|
1006
|
+
items={items}
|
|
1007
|
+
signals={p.signals}
|
|
1008
|
+
selected={draft.selected}
|
|
1009
|
+
onToggle={onToggle}
|
|
1010
|
+
headingValue={draft.heading}
|
|
1011
|
+
onHeadingChange={onHeadingChange}
|
|
1012
|
+
disabled={busy}
|
|
1013
|
+
/>
|
|
1014
|
+
{!p.stale && canApply ? (
|
|
1015
|
+
<button
|
|
1016
|
+
type="button"
|
|
1017
|
+
className={btnPrimary}
|
|
1018
|
+
onClick={onApprove}
|
|
1019
|
+
disabled={busy || blocker !== null}
|
|
1020
|
+
>
|
|
1021
|
+
<Check className="h-4 w-4" aria-hidden />
|
|
1022
|
+
Approve
|
|
1023
|
+
</button>
|
|
1024
|
+
) : null}
|
|
1025
|
+
</div>
|
|
1026
|
+
)
|
|
1027
|
+
}
|
|
@@ -323,18 +323,37 @@ const CATEGORY_LABELS: Record<string, string> = {
|
|
|
323
323
|
other: 'Other',
|
|
324
324
|
}
|
|
325
325
|
|
|
326
|
-
function AiCrawlerCard() {
|
|
326
|
+
function AiCrawlerCard({ onNavigate }: { onNavigate?: (path: string) => void }) {
|
|
327
327
|
const { data, loading, error, refetch } = useSeoResource(fetchAiCrawlerActivity, [])
|
|
328
328
|
|
|
329
329
|
return (
|
|
330
330
|
<SectionCard
|
|
331
331
|
title="AI crawler activity"
|
|
332
|
-
description="
|
|
332
|
+
description="Lifetime fetches of llms.txt, llms-full.txt, and .md pages by known AI crawlers. Daily trends across all pages and AI referrals live in the AI visibility tab."
|
|
333
333
|
action={
|
|
334
|
-
<
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
334
|
+
<div className="flex shrink-0 items-center gap-2">
|
|
335
|
+
{onNavigate && (
|
|
336
|
+
<button
|
|
337
|
+
type="button"
|
|
338
|
+
className={btnSecondary}
|
|
339
|
+
onClick={() => onNavigate('/seo/ai-visibility')}
|
|
340
|
+
>
|
|
341
|
+
View trends
|
|
342
|
+
</button>
|
|
343
|
+
)}
|
|
344
|
+
<button
|
|
345
|
+
type="button"
|
|
346
|
+
className={btnSecondary}
|
|
347
|
+
onClick={() => refetch()}
|
|
348
|
+
disabled={loading}
|
|
349
|
+
>
|
|
350
|
+
<RefreshCw
|
|
351
|
+
className={`h-4 w-4 ${loading ? 'motion-safe:animate-spin' : ''}`}
|
|
352
|
+
aria-hidden
|
|
353
|
+
/>
|
|
354
|
+
Refresh
|
|
355
|
+
</button>
|
|
356
|
+
</div>
|
|
338
357
|
}
|
|
339
358
|
>
|
|
340
359
|
{loading ? (
|
|
@@ -412,7 +431,7 @@ function AiCrawlerCard() {
|
|
|
412
431
|
)
|
|
413
432
|
}
|
|
414
433
|
|
|
415
|
-
export function TechnicalTab() {
|
|
434
|
+
export function TechnicalTab({ onNavigate }: { onNavigate?: (path: string) => void }) {
|
|
416
435
|
return (
|
|
417
436
|
<div className="space-y-4">
|
|
418
437
|
<div className="grid grid-cols-1 gap-4 lg:grid-cols-2">
|
|
@@ -420,7 +439,7 @@ export function TechnicalTab() {
|
|
|
420
439
|
<CrawlCard />
|
|
421
440
|
</div>
|
|
422
441
|
<RobotsCard />
|
|
423
|
-
<AiCrawlerCard />
|
|
442
|
+
<AiCrawlerCard onNavigate={onNavigate} />
|
|
424
443
|
</div>
|
|
425
444
|
)
|
|
426
445
|
}
|
|
@@ -120,6 +120,12 @@ export const AUTOPILOT_TYPE_GROUPS: ReadonlyArray<{
|
|
|
120
120
|
help: 'Adds the collection’s default Schema.org type.',
|
|
121
121
|
producer: 'Rule-based',
|
|
122
122
|
},
|
|
123
|
+
{
|
|
124
|
+
id: 'faq-schema-missing',
|
|
125
|
+
label: 'FAQ schema for visible FAQ sections',
|
|
126
|
+
help: 'Adds a FAQPage node to a page’s stored structured data when a visible FAQ section has none — typically pages published before the section was added. Re-publishing the page clears it too.',
|
|
127
|
+
producer: 'Rule-based',
|
|
128
|
+
},
|
|
123
129
|
],
|
|
124
130
|
},
|
|
125
131
|
{
|