sanity-plugin-seo-copilot 0.1.2 → 0.2.1

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/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
- faqSuggestions: {
59
- question: string;
60
- answer: string;
61
- volume?: number | null;
62
- }[];
63
- // Legacy fields for backward compat
64
- faqItems?: {
65
- question: string;
66
- answer: string;
67
- volume: number | null;
68
- highlightedKeywords?: { term: string; volume: number }[];
69
- }[];
70
- highVolumeQuestions?: {
71
- question: string;
72
- answer: string;
73
- volume: number | null;
74
- highlightedKeywords?: { term: string; volume: number }[];
75
- }[];
76
- headingSuggestions?: {
77
- heading: string;
78
- answer: string;
79
- rationale: string;
80
- }[];
81
- }
82
-
83
- export interface DeepAnalysis extends SEOAnalysis {
84
- keywordDensity: {
85
- term: string;
86
- count: number;
87
- density: number;
88
- }[];
89
- readabilityNotes: string[];
90
- competitiveGaps: string[];
91
- structureRecommendations: string[];
92
- aeo?: AEORecommendations;
93
- }
94
-
95
- export interface ChatMessage {
96
- role: "user" | "assistant";
97
- content: string;
98
- }
99
-
100
- export interface DocumentFields {
101
- title?: string;
102
- metaDescription?: string;
103
- slug?: string;
104
- imageNames?: string[];
105
- headings?: string[];
106
- contentCategory?: string;
107
- contentPlacement?: string[];
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
+ }