sanity-plugin-seo-copilot 0.1.2 → 0.2.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/dist/index.js +4729 -895
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +4722 -888
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
- package/src/components/ChatPanel.tsx +87 -69
- package/src/components/FeedbackButton.tsx +2 -2
- package/src/components/KeywordBadge.tsx +50 -50
- package/src/components/KeywordPanel.tsx +97 -226
- package/src/components/PlacementIndicators.tsx +80 -76
- package/src/components/SEOCopilotPanel.tsx +712 -165
- package/src/components/ScoreDonut.tsx +158 -0
- package/src/components/SeedKeywordInput.tsx +128 -125
- package/src/components/ShimmerLoader.tsx +119 -0
- package/src/components/TabBar.tsx +370 -0
- package/src/components/styles.ts +66 -0
- package/src/components/tabs/AEOTab.tsx +573 -0
- package/src/components/tabs/LinkingTab.tsx +343 -0
- package/src/components/tabs/MetaTab.tsx +417 -0
- package/src/components/tabs/SummaryTab.tsx +384 -0
- package/src/components/tabs/TechnicalTab.tsx +776 -0
- package/src/hooks/useDocumentContent.ts +216 -99
- package/src/hooks/useKeywordAnalysis.ts +28 -8
- package/src/hooks/useSEOChat.ts +38 -11
- package/src/lib/api.ts +109 -13
- package/src/lib/geoAnalysis.ts +109 -0
- package/src/lib/persistence.ts +69 -0
- package/src/lib/scoring.ts +147 -0
- package/src/lib/summary.ts +504 -0
- package/src/lib/types.ts +197 -108
package/src/lib/types.ts
CHANGED
|
@@ -1,108 +1,197 @@
|
|
|
1
|
-
// SEO Copilot V2 - Plugin Types
|
|
2
|
-
|
|
3
|
-
export interface KeywordPlacement {
|
|
4
|
-
inBody: boolean;
|
|
5
|
-
inTitle: boolean;
|
|
6
|
-
inMetaDescription: boolean;
|
|
7
|
-
inImages: boolean;
|
|
8
|
-
inUrl: boolean;
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
export interface PrimaryKeywordCandidate {
|
|
12
|
-
term: string;
|
|
13
|
-
volume: number | null;
|
|
14
|
-
cpc: number | null;
|
|
15
|
-
competition: number | null;
|
|
16
|
-
confidence: number;
|
|
17
|
-
placement?: KeywordPlacement;
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
export interface SEOAnalysis {
|
|
21
|
-
primaryKeywordCandidates: PrimaryKeywordCandidate[];
|
|
22
|
-
primaryKeyword: PrimaryKeywordCandidate; // legacy compat
|
|
23
|
-
supportingKeywords: {
|
|
24
|
-
term: string;
|
|
25
|
-
volume: number | null;
|
|
26
|
-
relevance: number;
|
|
27
|
-
inContent: boolean;
|
|
28
|
-
placement?: KeywordPlacement;
|
|
29
|
-
}[];
|
|
30
|
-
missingKeywords: {
|
|
31
|
-
term: string;
|
|
32
|
-
volume: number | null;
|
|
33
|
-
reason: string;
|
|
34
|
-
placement?: KeywordPlacement;
|
|
35
|
-
}[];
|
|
36
|
-
keywordDensity?: {
|
|
37
|
-
term: string;
|
|
38
|
-
count: number;
|
|
39
|
-
density: number;
|
|
40
|
-
}[];
|
|
41
|
-
suggestions?: string[];
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
export interface AEOQuestion {
|
|
45
|
-
question: string;
|
|
46
|
-
volume: number;
|
|
47
|
-
cpc: number;
|
|
48
|
-
competition: number;
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
export interface AEORecommendations {
|
|
52
|
-
questions: AEOQuestion[];
|
|
53
|
-
questionHeadings: {
|
|
54
|
-
originalHeading?: string;
|
|
55
|
-
suggestedHeading: string;
|
|
56
|
-
rationale: string;
|
|
57
|
-
}[];
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
1
|
+
// SEO Copilot V2 - Plugin Types
|
|
2
|
+
|
|
3
|
+
export interface KeywordPlacement {
|
|
4
|
+
inBody: boolean;
|
|
5
|
+
inTitle: boolean;
|
|
6
|
+
inMetaDescription: boolean;
|
|
7
|
+
inImages: boolean;
|
|
8
|
+
inUrl: boolean;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
export interface PrimaryKeywordCandidate {
|
|
12
|
+
term: string;
|
|
13
|
+
volume: number | null;
|
|
14
|
+
cpc: number | null;
|
|
15
|
+
competition: number | null;
|
|
16
|
+
confidence: number;
|
|
17
|
+
placement?: KeywordPlacement;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
export interface SEOAnalysis {
|
|
21
|
+
primaryKeywordCandidates: PrimaryKeywordCandidate[];
|
|
22
|
+
primaryKeyword: PrimaryKeywordCandidate; // legacy compat
|
|
23
|
+
supportingKeywords: {
|
|
24
|
+
term: string;
|
|
25
|
+
volume: number | null;
|
|
26
|
+
relevance: number;
|
|
27
|
+
inContent: boolean;
|
|
28
|
+
placement?: KeywordPlacement;
|
|
29
|
+
}[];
|
|
30
|
+
missingKeywords: {
|
|
31
|
+
term: string;
|
|
32
|
+
volume: number | null;
|
|
33
|
+
reason: string;
|
|
34
|
+
placement?: KeywordPlacement;
|
|
35
|
+
}[];
|
|
36
|
+
keywordDensity?: {
|
|
37
|
+
term: string;
|
|
38
|
+
count: number;
|
|
39
|
+
density: number;
|
|
40
|
+
}[];
|
|
41
|
+
suggestions?: string[];
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
export interface AEOQuestion {
|
|
45
|
+
question: string;
|
|
46
|
+
volume: number;
|
|
47
|
+
cpc: number;
|
|
48
|
+
competition: number;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
export interface AEORecommendations {
|
|
52
|
+
questions: AEOQuestion[];
|
|
53
|
+
questionHeadings: {
|
|
54
|
+
originalHeading?: string;
|
|
55
|
+
suggestedHeading: string;
|
|
56
|
+
rationale: string;
|
|
57
|
+
}[];
|
|
58
|
+
// Legacy field for backward compat with persisted client state. FAQ output removed
|
|
59
|
+
// 2026-05 after Google sunset FAQ rich results.
|
|
60
|
+
headingSuggestions?: {
|
|
61
|
+
heading: string;
|
|
62
|
+
answer: string;
|
|
63
|
+
rationale: string;
|
|
64
|
+
}[];
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
export interface DeepAnalysis extends SEOAnalysis {
|
|
68
|
+
keywordDensity: {
|
|
69
|
+
term: string;
|
|
70
|
+
count: number;
|
|
71
|
+
density: number;
|
|
72
|
+
}[];
|
|
73
|
+
readabilityNotes: string[];
|
|
74
|
+
competitiveGaps: string[];
|
|
75
|
+
structureRecommendations: string[];
|
|
76
|
+
aeo?: AEORecommendations;
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
export interface ChatMessage {
|
|
80
|
+
role: "user" | "assistant";
|
|
81
|
+
content: string;
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
export interface HeadingItem {
|
|
85
|
+
text: string;
|
|
86
|
+
level: number; // 1-6
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
export interface DocumentFields {
|
|
90
|
+
title?: string;
|
|
91
|
+
metaDescription?: string;
|
|
92
|
+
slug?: string;
|
|
93
|
+
imageNames?: string[];
|
|
94
|
+
// Title attributes found on body/hero images (the hover tooltip). Used by the
|
|
95
|
+
// Other Recs image-title audit. imageCount is the total number of images found
|
|
96
|
+
// so the audit can report "X of N images have a title".
|
|
97
|
+
imageTitles?: string[];
|
|
98
|
+
imageCount?: number;
|
|
99
|
+
headings?: string[];
|
|
100
|
+
// Headings with their H-level, used by the Technical tab for hierarchy checks.
|
|
101
|
+
headingsDetailed?: HeadingItem[];
|
|
102
|
+
// All URL links found in the body (from Portable Text markDefs + inline URL regex).
|
|
103
|
+
// Used by the Technical tab's broken-link checker.
|
|
104
|
+
bodyLinks?: string[];
|
|
105
|
+
contentCategory?: string;
|
|
106
|
+
contentPlacement?: string[];
|
|
107
|
+
// E-E-A-T fields - 2026 healthcare content scrutiny
|
|
108
|
+
authorName?: string;
|
|
109
|
+
authorCredentials?: string;
|
|
110
|
+
authorBioUrl?: string;
|
|
111
|
+
// True when the author field is set as a Sanity reference we can't resolve client-side
|
|
112
|
+
// (vs. truly missing). Lets the audit distinguish "schema uses refs, looks fine" from "no author".
|
|
113
|
+
authorIsReference?: boolean;
|
|
114
|
+
publishedAt?: string;
|
|
115
|
+
updatedAt?: string;
|
|
116
|
+
lastReviewedAt?: string;
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
// V3 - Tabbed UI additions
|
|
120
|
+
|
|
121
|
+
export interface ContentSuggestions {
|
|
122
|
+
keyTakeaways: string[];
|
|
123
|
+
infographicOpportunities: { concept: string; description: string }[];
|
|
124
|
+
bulletListItems: string[];
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
export interface InternalLink {
|
|
128
|
+
_id?: string;
|
|
129
|
+
title: string;
|
|
130
|
+
slug: string;
|
|
131
|
+
publishedAt?: string;
|
|
132
|
+
relevanceReason: string;
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
// V3.5 - Smart Linking
|
|
136
|
+
export interface LinkingSuggestion {
|
|
137
|
+
_id: string;
|
|
138
|
+
title: string;
|
|
139
|
+
slug: string;
|
|
140
|
+
publishedAt: string;
|
|
141
|
+
compositeScore: number;
|
|
142
|
+
topicScore: number;
|
|
143
|
+
freshnessScore: number;
|
|
144
|
+
sectionFitScore: number;
|
|
145
|
+
anchorParagraph: number;
|
|
146
|
+
anchorQuote: string;
|
|
147
|
+
anchorReason: string;
|
|
148
|
+
relevanceReason: string;
|
|
149
|
+
freshnessLabel: "fresh" | "recent" | "older" | "very-old";
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
export interface TechnicalAuditItem {
|
|
153
|
+
label: string;
|
|
154
|
+
value: string;
|
|
155
|
+
status: "good" | "warning" | "error";
|
|
156
|
+
recommendation?: string;
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
export type TabId = "summary" | "keywords" | "aeo" | "linking" | "meta" | "technical";
|
|
160
|
+
|
|
161
|
+
export type SummaryCategory =
|
|
162
|
+
| "meta"
|
|
163
|
+
| "headings"
|
|
164
|
+
| "content"
|
|
165
|
+
| "images"
|
|
166
|
+
| "keywords"
|
|
167
|
+
| "aeo"
|
|
168
|
+
| "geo"
|
|
169
|
+
| "internal-linking"
|
|
170
|
+
| "technical";
|
|
171
|
+
|
|
172
|
+
// Result of one URL check performed server-side.
|
|
173
|
+
export interface LinkCheckResult {
|
|
174
|
+
url: string;
|
|
175
|
+
// HTTP status code (200, 301, 404, etc.) or 0 if the request errored before getting a status.
|
|
176
|
+
status: number;
|
|
177
|
+
// Final URL after redirects (may equal `url` if no redirect happened).
|
|
178
|
+
finalUrl?: string;
|
|
179
|
+
// True when the request landed on a different URL than the original.
|
|
180
|
+
redirected: boolean;
|
|
181
|
+
// One-word category for the badge in the UI.
|
|
182
|
+
category: "ok" | "redirect" | "broken" | "error";
|
|
183
|
+
// Human-friendly message used when category is "error" (timeout, DNS fail, etc.).
|
|
184
|
+
error?: string;
|
|
185
|
+
}
|
|
186
|
+
|
|
187
|
+
export type SummarySeverity = "error" | "warning" | "opportunity";
|
|
188
|
+
|
|
189
|
+
export interface SummaryItem {
|
|
190
|
+
id: string;
|
|
191
|
+
category: SummaryCategory;
|
|
192
|
+
severity: SummarySeverity;
|
|
193
|
+
label: string;
|
|
194
|
+
description: string;
|
|
195
|
+
howToFix: string;
|
|
196
|
+
jumpTo: { tab: TabId; anchorId?: string };
|
|
197
|
+
}
|