sanity-plugin-seo-copilot 0.2.15 → 0.2.17
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/README.md +63 -50
- package/dist/index.d.mts +1 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +898 -809
- package/dist/index.mjs +822 -733
- package/package.json +5 -7
- package/dist/index.js.map +0 -1
- package/dist/index.mjs.map +0 -1
- package/sanity.json +0 -3
- package/src/components/ChatPanel.tsx +0 -311
- package/src/components/ConfigContext.tsx +0 -22
- package/src/components/FeedbackButton.tsx +0 -218
- package/src/components/KeywordBadge.tsx +0 -50
- package/src/components/KeywordPanel.tsx +0 -1234
- package/src/components/OnboardingPopup.tsx +0 -108
- package/src/components/PlacementIndicators.tsx +0 -80
- package/src/components/ReportProblemButton.tsx +0 -212
- package/src/components/SEOCopilotPanel.tsx +0 -1287
- package/src/components/ScoreDonut.tsx +0 -158
- package/src/components/SeedKeywordInput.tsx +0 -128
- package/src/components/ShimmerLoader.tsx +0 -123
- package/src/components/TabBar.tsx +0 -373
- package/src/components/styles.ts +0 -158
- package/src/components/tabs/AEOTab.tsx +0 -585
- package/src/components/tabs/LinkingTab.tsx +0 -446
- package/src/components/tabs/MetaTab.tsx +0 -431
- package/src/components/tabs/SummaryTab.tsx +0 -405
- package/src/components/tabs/TechnicalTab.tsx +0 -933
- package/src/hooks/useDocumentContent.ts +0 -48
- package/src/hooks/useKeywordAnalysis.ts +0 -292
- package/src/hooks/useSEOChat.ts +0 -254
- package/src/index.ts +0 -18
- package/src/inspector.ts +0 -58
- package/src/lib/api.ts +0 -262
- package/src/lib/apiKey.ts +0 -30
- package/src/lib/documentExtract.ts +0 -422
- package/src/lib/geoAnalysis.ts +0 -122
- package/src/lib/persistence.ts +0 -69
- package/src/lib/scoring.ts +0 -197
- package/src/lib/summary.ts +0 -645
- package/src/lib/types.ts +0 -212
- package/src/lib/utils.ts +0 -35
- package/v2-incompatible.js +0 -10
package/src/lib/types.ts
DELETED
|
@@ -1,212 +0,0 @@
|
|
|
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
|
-
// Body paragraphs that look like section headings but were typed as plain text (not styled
|
|
103
|
-
// as H2). Drives the "this looks like a heading - style it as H2?" nudge.
|
|
104
|
-
unstyledHeadings?: string[];
|
|
105
|
-
// All URL links found in the body (from Portable Text markDefs + inline URL regex).
|
|
106
|
-
// Used by the Technical tab's broken-link checker.
|
|
107
|
-
bodyLinks?: string[];
|
|
108
|
-
// Same URLs, but flagged with whether each is an actual hyperlink (a Control-K link
|
|
109
|
-
// annotation) vs plain text the editor still needs to link, plus the visible anchor
|
|
110
|
-
// text for real links. Drives the Link Health "hyperlinked vs plain text" breakdown.
|
|
111
|
-
bodyLinksDetailed?: { url: string; hyperlinked: boolean; anchorText?: string }[];
|
|
112
|
-
contentCategory?: string;
|
|
113
|
-
contentPlacement?: string[];
|
|
114
|
-
// E-E-A-T fields - 2026 healthcare content scrutiny
|
|
115
|
-
authorName?: string;
|
|
116
|
-
authorCredentials?: string;
|
|
117
|
-
authorBioUrl?: string;
|
|
118
|
-
// True when the author field is set as a Sanity reference we can't resolve client-side
|
|
119
|
-
// (vs. truly missing). Lets the audit distinguish "schema uses refs, looks fine" from "no author".
|
|
120
|
-
authorIsReference?: boolean;
|
|
121
|
-
// Fact-checker / reviewer - a second named person who reviewed the article (MJH shows a
|
|
122
|
-
// "Fact checked by ..." line). Strong E-E-A-T trust signal for healthcare content.
|
|
123
|
-
// factCheckerIsReference mirrors the author's reference case.
|
|
124
|
-
factCheckerName?: string;
|
|
125
|
-
factCheckerIsReference?: boolean;
|
|
126
|
-
publishedAt?: string;
|
|
127
|
-
updatedAt?: string;
|
|
128
|
-
lastReviewedAt?: string;
|
|
129
|
-
}
|
|
130
|
-
|
|
131
|
-
// V3 - Tabbed UI additions
|
|
132
|
-
|
|
133
|
-
export interface ContentSuggestions {
|
|
134
|
-
keyTakeaways: string[];
|
|
135
|
-
infographicOpportunities: { concept: string; description: string }[];
|
|
136
|
-
bulletListItems: string[];
|
|
137
|
-
}
|
|
138
|
-
|
|
139
|
-
export interface InternalLink {
|
|
140
|
-
_id?: string;
|
|
141
|
-
title: string;
|
|
142
|
-
slug: string;
|
|
143
|
-
publishedAt?: string;
|
|
144
|
-
relevanceReason: string;
|
|
145
|
-
}
|
|
146
|
-
|
|
147
|
-
// V3.5 - Smart Linking
|
|
148
|
-
export interface LinkingSuggestion {
|
|
149
|
-
_id: string;
|
|
150
|
-
title: string;
|
|
151
|
-
slug: string;
|
|
152
|
-
publishedAt: string;
|
|
153
|
-
compositeScore: number;
|
|
154
|
-
topicScore: number;
|
|
155
|
-
freshnessScore: number;
|
|
156
|
-
sectionFitScore: number;
|
|
157
|
-
anchorParagraph: number;
|
|
158
|
-
anchorQuote: string;
|
|
159
|
-
anchorReason: string;
|
|
160
|
-
relevanceReason: string;
|
|
161
|
-
freshnessLabel: "fresh" | "recent" | "older" | "very-old";
|
|
162
|
-
}
|
|
163
|
-
|
|
164
|
-
export interface TechnicalAuditItem {
|
|
165
|
-
label: string;
|
|
166
|
-
value: string;
|
|
167
|
-
status: "good" | "warning" | "error";
|
|
168
|
-
recommendation?: string;
|
|
169
|
-
}
|
|
170
|
-
|
|
171
|
-
export type TabId = "summary" | "keywords" | "aeo" | "linking" | "meta" | "technical";
|
|
172
|
-
|
|
173
|
-
export type SummaryCategory =
|
|
174
|
-
| "meta"
|
|
175
|
-
| "headings"
|
|
176
|
-
| "content"
|
|
177
|
-
| "images"
|
|
178
|
-
| "keywords"
|
|
179
|
-
| "aeo"
|
|
180
|
-
| "geo"
|
|
181
|
-
| "internal-linking"
|
|
182
|
-
| "technical";
|
|
183
|
-
|
|
184
|
-
// Result of one URL check performed server-side.
|
|
185
|
-
export interface LinkCheckResult {
|
|
186
|
-
url: string;
|
|
187
|
-
// HTTP status code (200, 301, 404, etc.) or 0 if the request errored before getting a status.
|
|
188
|
-
status: number;
|
|
189
|
-
// Final URL after redirects (may equal `url` if no redirect happened).
|
|
190
|
-
finalUrl?: string;
|
|
191
|
-
// True when the request landed on a different URL than the original.
|
|
192
|
-
redirected: boolean;
|
|
193
|
-
// One-word category for the badge in the UI.
|
|
194
|
-
// "unverified" = the URL responded 401/403/429 - usually anti-bot blocking
|
|
195
|
-
// server-side fetches (e.g. Cloudflare blocking cloud-provider egress IPs).
|
|
196
|
-
// The link may work fine for human readers; editors should click to verify.
|
|
197
|
-
category: "ok" | "redirect" | "broken" | "unverified" | "error";
|
|
198
|
-
// Human-friendly message used when category is "error" (timeout, DNS fail, etc.).
|
|
199
|
-
error?: string;
|
|
200
|
-
}
|
|
201
|
-
|
|
202
|
-
export type SummarySeverity = "error" | "warning" | "opportunity";
|
|
203
|
-
|
|
204
|
-
export interface SummaryItem {
|
|
205
|
-
id: string;
|
|
206
|
-
category: SummaryCategory;
|
|
207
|
-
severity: SummarySeverity;
|
|
208
|
-
label: string;
|
|
209
|
-
description: string;
|
|
210
|
-
howToFix: string;
|
|
211
|
-
jumpTo: { tab: TabId; anchorId?: string };
|
|
212
|
-
}
|
package/src/lib/utils.ts
DELETED
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
// Token-based keyword match: "selinexor in myelofibrosis" still counts as containing
|
|
2
|
-
// "selinexor myelofibrosis" because word order and connecting words don't matter.
|
|
3
|
-
export function containsKeywordTokens(haystack: string, needle?: string): boolean {
|
|
4
|
-
if (!needle) return true;
|
|
5
|
-
const tokens = needle.toLowerCase().split(/\s+/).filter((t) => t.length > 1);
|
|
6
|
-
if (tokens.length === 0) return true;
|
|
7
|
-
const lower = haystack.toLowerCase();
|
|
8
|
-
return tokens.every((t) => lower.includes(t));
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
// True when the primary keyword sits near the start of the slug (within the first
|
|
12
|
-
// three slug words). Editors get the most SEO/CTR value when the keyword leads.
|
|
13
|
-
export function keywordLeadsSlug(slug: string, primaryKeyword?: string): boolean {
|
|
14
|
-
if (!primaryKeyword) return true;
|
|
15
|
-
const slugWords = slug.toLowerCase().replace(/[^a-z0-9]+/g, " ").trim().split(/\s+/).filter(Boolean);
|
|
16
|
-
const tokens = primaryKeyword.toLowerCase().split(/\s+/).filter((t) => t.length > 1);
|
|
17
|
-
if (tokens.length === 0 || slugWords.length === 0) return true;
|
|
18
|
-
let earliest = Infinity;
|
|
19
|
-
for (const t of tokens) {
|
|
20
|
-
const idx = slugWords.findIndex((w) => w.includes(t));
|
|
21
|
-
if (idx >= 0) earliest = Math.min(earliest, idx);
|
|
22
|
-
}
|
|
23
|
-
return earliest <= 2;
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
// MJH publications that use the /view/{slug} article route (verified via CDN probe).
|
|
27
|
-
// We only construct live URLs for known publications to avoid linking to 404s on
|
|
28
|
-
// brands that use a different route pattern.
|
|
29
|
-
export const KNOWN_MJH_PUBLICATIONS = new Set([
|
|
30
|
-
"onclive",
|
|
31
|
-
"hcplive",
|
|
32
|
-
"ajmc",
|
|
33
|
-
"pharmacytimes",
|
|
34
|
-
"cancernetwork",
|
|
35
|
-
]);
|
package/v2-incompatible.js
DELETED