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
|
@@ -0,0 +1,573 @@
|
|
|
1
|
+
import { useMemo, useState } from "react";
|
|
2
|
+
import { LoadingBars } from "../SEOCopilotPanel";
|
|
3
|
+
import { FeedbackButton } from "../FeedbackButton";
|
|
4
|
+
import { analyzeGEO } from "../../lib/geoAnalysis";
|
|
5
|
+
import { usePersistentState } from "../../lib/persistence";
|
|
6
|
+
import type { DeepAnalysis, ContentSuggestions } from "../../lib/types";
|
|
7
|
+
|
|
8
|
+
const AEO_PURPLE = "#005DAC";
|
|
9
|
+
const GEO_TEAL = "#C9A716";
|
|
10
|
+
|
|
11
|
+
interface AEOTabProps {
|
|
12
|
+
text: string;
|
|
13
|
+
deepAnalysis: DeepAnalysis | null;
|
|
14
|
+
isDeepLoading: boolean;
|
|
15
|
+
primaryKeyword: string;
|
|
16
|
+
publication?: string;
|
|
17
|
+
runDeepAnalysis: () => void;
|
|
18
|
+
aeoContentChanged: boolean;
|
|
19
|
+
headings?: string[];
|
|
20
|
+
contentSuggestions: ContentSuggestions | null;
|
|
21
|
+
isCSLoading: boolean;
|
|
22
|
+
csError: string | null;
|
|
23
|
+
loadContentSuggestions: () => void;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
const cardStyle: React.CSSProperties = {
|
|
27
|
+
borderRadius: 14,
|
|
28
|
+
background: "rgba(255,255,255,0.55)",
|
|
29
|
+
backdropFilter: "blur(16px) saturate(170%)",
|
|
30
|
+
WebkitBackdropFilter: "blur(16px) saturate(170%)",
|
|
31
|
+
boxShadow: "inset 0 0 0 1px rgba(255,255,255,0.85), inset 1.5px 2px 1px -1px rgba(255,255,255,1), inset -2px -3px 2px -1px rgba(255,255,255,0.6), 0 2px 6px rgba(0,0,0,0.07), 0 10px 26px rgba(0,0,0,0.08)",
|
|
32
|
+
padding: "14px",
|
|
33
|
+
};
|
|
34
|
+
|
|
35
|
+
// Small "AI" pill - inline label marking generative content at the point of generation.
|
|
36
|
+
function AiPill() {
|
|
37
|
+
return (
|
|
38
|
+
<span
|
|
39
|
+
style={{
|
|
40
|
+
fontSize: 8.5,
|
|
41
|
+
fontWeight: 700,
|
|
42
|
+
letterSpacing: "0.06em",
|
|
43
|
+
padding: "1px 5px",
|
|
44
|
+
borderRadius: 99,
|
|
45
|
+
background: "rgba(0,0,0,0.06)",
|
|
46
|
+
color: "#4b5563",
|
|
47
|
+
flexShrink: 0,
|
|
48
|
+
}}
|
|
49
|
+
title="Generated by AI - verify before publishing"
|
|
50
|
+
>
|
|
51
|
+
AI
|
|
52
|
+
</span>
|
|
53
|
+
);
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
function SectionHeader({ label, iconColor, ai }: { label: string; iconColor: string; ai?: boolean }) {
|
|
57
|
+
return (
|
|
58
|
+
<div style={{ display: "flex", alignItems: "center", gap: 7, marginBottom: 4 }}>
|
|
59
|
+
<div style={{ width: 7, height: 7, borderRadius: "50%", background: iconColor, flexShrink: 0 }} />
|
|
60
|
+
<span style={{ fontSize: 10.5, textTransform: "uppercase", letterSpacing: "0.06em", color: "#4b5563", fontWeight: 600, flex: 1 }}>
|
|
61
|
+
{label}
|
|
62
|
+
</span>
|
|
63
|
+
{ai && <AiPill />}
|
|
64
|
+
</div>
|
|
65
|
+
);
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
function CopyButton({ text }: { text: string }) {
|
|
69
|
+
const [copied, setCopied] = useState(false);
|
|
70
|
+
const handleCopy = async () => {
|
|
71
|
+
try {
|
|
72
|
+
await navigator.clipboard.writeText(text);
|
|
73
|
+
setCopied(true);
|
|
74
|
+
setTimeout(() => setCopied(false), 1500);
|
|
75
|
+
} catch {
|
|
76
|
+
// silent
|
|
77
|
+
}
|
|
78
|
+
};
|
|
79
|
+
return (
|
|
80
|
+
<button
|
|
81
|
+
onClick={handleCopy}
|
|
82
|
+
style={{
|
|
83
|
+
background: "none",
|
|
84
|
+
border: "none",
|
|
85
|
+
cursor: "pointer",
|
|
86
|
+
padding: 2,
|
|
87
|
+
display: "flex",
|
|
88
|
+
alignItems: "center",
|
|
89
|
+
gap: 3,
|
|
90
|
+
color: copied ? "#16a34a" : "#9ca3af",
|
|
91
|
+
fontSize: 10,
|
|
92
|
+
fontWeight: 600,
|
|
93
|
+
flexShrink: 0,
|
|
94
|
+
transition: "color 150ms",
|
|
95
|
+
}}
|
|
96
|
+
title={copied ? "Copied!" : "Copy to clipboard"}
|
|
97
|
+
>
|
|
98
|
+
{copied ? (
|
|
99
|
+
<svg width="11" height="11" viewBox="0 0 20 20" fill="currentColor">
|
|
100
|
+
<path fillRule="evenodd" d="M16.704 4.153a.75.75 0 01.143 1.052l-8 10.5a.75.75 0 01-1.127.075l-4.5-4.5a.75.75 0 011.06-1.06l3.894 3.893 7.48-9.817a.75.75 0 011.05-.143z" clipRule="evenodd" />
|
|
101
|
+
</svg>
|
|
102
|
+
) : (
|
|
103
|
+
<svg width="11" height="11" viewBox="0 0 20 20" fill="currentColor">
|
|
104
|
+
<path d="M7 3.5A1.5 1.5 0 018.5 2h3.879a1.5 1.5 0 011.06.44l3.122 3.12A1.5 1.5 0 0117 6.622V12.5a1.5 1.5 0 01-1.5 1.5h-1v-3.379a3 3 0 00-.879-2.121L10.5 5.379A3 3 0 008.379 4.5H7v-1z" />
|
|
105
|
+
<path d="M4.5 6A1.5 1.5 0 003 7.5v9A1.5 1.5 0 004.5 18h7a1.5 1.5 0 001.5-1.5v-5.879a1.5 1.5 0 00-.44-1.06L9.44 6.439A1.5 1.5 0 008.378 6H4.5z" />
|
|
106
|
+
</svg>
|
|
107
|
+
)}
|
|
108
|
+
</button>
|
|
109
|
+
);
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
function GEOCard({ geo, publication }: { geo: ReturnType<typeof analyzeGEO>; publication?: string }) {
|
|
113
|
+
const [showDetails, setShowDetails] = usePersistentState<boolean>("seo-copilot-ui-geo-details", false);
|
|
114
|
+
const fd = geo.factDensity;
|
|
115
|
+
const fdColor = fd.status === "strong" ? "#16a34a" : fd.status === "moderate" ? "#8B7310" : "#dc2626";
|
|
116
|
+
const fdLabel = fd.status === "strong" ? "Strong" : fd.status === "moderate" ? "Moderate" : "Weak";
|
|
117
|
+
const fdBg = fd.status === "strong" ? "rgba(22,163,74,0.1)" : fd.status === "moderate" ? "rgba(230,192,27,0.15)" : "rgba(220,38,38,0.08)";
|
|
118
|
+
|
|
119
|
+
const goodCount = geo.headingAudit.filter((h) => h.status === "good").length;
|
|
120
|
+
const totalHeadings = geo.headingAudit.length;
|
|
121
|
+
|
|
122
|
+
return (
|
|
123
|
+
<div style={cardStyle}>
|
|
124
|
+
<div style={{ display: "flex", alignItems: "center", justifyContent: "space-between", marginBottom: 4 }}>
|
|
125
|
+
<SectionHeader label="AI Citation Readiness" iconColor={GEO_TEAL} />
|
|
126
|
+
<FeedbackButton suggestionType="geo_summary" suggestionText={`facts/1k: ${fd.factsPerThousandWords}; short-answer headings: ${goodCount}/${totalHeadings}`} publication={publication} />
|
|
127
|
+
</div>
|
|
128
|
+
<div style={{ fontSize: 10, color: "#4b5563", marginBottom: 10, lineHeight: 1.5 }}>
|
|
129
|
+
How easy this article is for ChatGPT, Perplexity, Gemini, and Google's AI Overviews to cite.
|
|
130
|
+
</div>
|
|
131
|
+
|
|
132
|
+
{/* Fact density - the single most predictive GEO signal per 2026 research.
|
|
133
|
+
The badge shows the RATE (per 1,000 words); the description gives total count
|
|
134
|
+
+ guidance. Two consistent numbers with explicit units, not one bare integer. */}
|
|
135
|
+
<div
|
|
136
|
+
style={{
|
|
137
|
+
display: "flex",
|
|
138
|
+
alignItems: "center",
|
|
139
|
+
gap: 12,
|
|
140
|
+
padding: "10px 12px",
|
|
141
|
+
background: fdBg,
|
|
142
|
+
borderRadius: 10,
|
|
143
|
+
marginBottom: 8,
|
|
144
|
+
}}
|
|
145
|
+
>
|
|
146
|
+
<div
|
|
147
|
+
style={{
|
|
148
|
+
width: 56,
|
|
149
|
+
height: 56,
|
|
150
|
+
borderRadius: "50%",
|
|
151
|
+
background: "#ffffff",
|
|
152
|
+
display: "flex",
|
|
153
|
+
flexDirection: "column",
|
|
154
|
+
alignItems: "center",
|
|
155
|
+
justifyContent: "center",
|
|
156
|
+
flexShrink: 0,
|
|
157
|
+
boxShadow: "0 1px 2px rgba(0,0,0,0.06)",
|
|
158
|
+
}}
|
|
159
|
+
>
|
|
160
|
+
<span style={{ fontSize: 18, fontWeight: 700, color: fdColor, lineHeight: 1 }}>{fd.factsPerThousandWords}</span>
|
|
161
|
+
<span style={{ fontSize: 7.5, fontWeight: 700, color: fdColor, opacity: 0.75, letterSpacing: "0.05em", marginTop: 2 }}>
|
|
162
|
+
PER 1K
|
|
163
|
+
</span>
|
|
164
|
+
</div>
|
|
165
|
+
<div style={{ flex: 1, minWidth: 0 }}>
|
|
166
|
+
<div style={{ fontSize: 11, fontWeight: 700, color: fdColor, marginBottom: 2 }}>Fact density: {fdLabel}</div>
|
|
167
|
+
<div style={{ fontSize: 11, color: "#1f2937", lineHeight: 1.45 }}>
|
|
168
|
+
{fd.factCount} specific stat{fd.factCount === 1 ? "" : "s"} or citation{fd.factCount === 1 ? "" : "s"} in this article ({fd.factsPerThousandWords} per 1,000 words).{" "}
|
|
169
|
+
{fd.status === "strong"
|
|
170
|
+
? "AI engines prefer this density."
|
|
171
|
+
: fd.status === "moderate"
|
|
172
|
+
? "Aim for 8+ per 1,000 words with named sources (NEJM, JAMA, FDA, trial numbers, p-values)."
|
|
173
|
+
: "Vague claims get skipped. Add specific numbers, trial citations, or dates."}
|
|
174
|
+
</div>
|
|
175
|
+
</div>
|
|
176
|
+
</div>
|
|
177
|
+
|
|
178
|
+
{/* Long passages without concrete stats */}
|
|
179
|
+
{fd.driftPassages > 0 && (
|
|
180
|
+
<div
|
|
181
|
+
style={{
|
|
182
|
+
padding: "8px 10px",
|
|
183
|
+
background: "rgba(220,38,38,0.04)",
|
|
184
|
+
border: "1px solid rgba(220,38,38,0.12)",
|
|
185
|
+
borderRadius: 8,
|
|
186
|
+
marginBottom: 8,
|
|
187
|
+
fontSize: 11,
|
|
188
|
+
color: "#7f1d1d",
|
|
189
|
+
lineHeight: 1.45,
|
|
190
|
+
}}
|
|
191
|
+
>
|
|
192
|
+
<strong>{fd.driftPassages}</strong> passage{fd.driftPassages === 1 ? "" : "s"} over 200 words with no specific stats or citations. AI engines tend to skip these.
|
|
193
|
+
</div>
|
|
194
|
+
)}
|
|
195
|
+
|
|
196
|
+
{/* Short-answer paragraphs after headings */}
|
|
197
|
+
{totalHeadings > 0 && (
|
|
198
|
+
<div style={{ marginTop: 4 }}>
|
|
199
|
+
<button
|
|
200
|
+
onClick={() => setShowDetails((v) => !v)}
|
|
201
|
+
style={{
|
|
202
|
+
width: "100%",
|
|
203
|
+
display: "flex",
|
|
204
|
+
alignItems: "center",
|
|
205
|
+
justifyContent: "space-between",
|
|
206
|
+
padding: "8px 10px",
|
|
207
|
+
background: "rgba(201,167,22,0.06)",
|
|
208
|
+
border: "1px solid rgba(201,167,22,0.15)",
|
|
209
|
+
borderRadius: 8,
|
|
210
|
+
cursor: "pointer",
|
|
211
|
+
fontSize: 11,
|
|
212
|
+
fontWeight: 600,
|
|
213
|
+
color: GEO_TEAL,
|
|
214
|
+
}}
|
|
215
|
+
>
|
|
216
|
+
<span>
|
|
217
|
+
Short-answer paragraphs: {goodCount}/{totalHeadings} headings have one
|
|
218
|
+
</span>
|
|
219
|
+
<svg width="11" height="11" viewBox="0 0 20 20" fill="currentColor" style={{ transform: showDetails ? "rotate(180deg)" : "none", transition: "transform 150ms" }}>
|
|
220
|
+
<path fillRule="evenodd" d="M5.23 7.21a.75.75 0 011.06.02L10 11.168l3.71-3.938a.75.75 0 111.08 1.04l-4.25 4.5a.75.75 0 01-1.08 0l-4.25-4.5a.75.75 0 01.02-1.06z" clipRule="evenodd" />
|
|
221
|
+
</svg>
|
|
222
|
+
</button>
|
|
223
|
+
{showDetails && (
|
|
224
|
+
<div style={{ marginTop: 6, display: "flex", flexDirection: "column", gap: 4 }}>
|
|
225
|
+
<div style={{ fontSize: 10, color: "#4b5563", marginBottom: 4 }}>
|
|
226
|
+
Aim for a 40-60 word answer right after each heading. That's the chunk AI engines extract.
|
|
227
|
+
</div>
|
|
228
|
+
{geo.headingAudit.map((h, i) => {
|
|
229
|
+
const c =
|
|
230
|
+
h.status === "good"
|
|
231
|
+
? { bg: "rgba(22,163,74,0.08)", color: "#16a34a", label: `${h.words} words ✓` }
|
|
232
|
+
: h.status === "too-short"
|
|
233
|
+
? { bg: "rgba(230,192,27,0.12)", color: "#8B7310", label: `${h.words} words - too short` }
|
|
234
|
+
: h.status === "too-long"
|
|
235
|
+
? { bg: "rgba(230,192,27,0.12)", color: "#8B7310", label: `${h.words} words - condense to 40-60` }
|
|
236
|
+
: { bg: "rgba(220,38,38,0.06)", color: "#dc2626", label: "no body content" };
|
|
237
|
+
return (
|
|
238
|
+
<div
|
|
239
|
+
key={i}
|
|
240
|
+
style={{
|
|
241
|
+
display: "flex",
|
|
242
|
+
alignItems: "center",
|
|
243
|
+
justifyContent: "space-between",
|
|
244
|
+
padding: "5px 10px",
|
|
245
|
+
background: c.bg,
|
|
246
|
+
borderRadius: 6,
|
|
247
|
+
fontSize: 11,
|
|
248
|
+
gap: 8,
|
|
249
|
+
}}
|
|
250
|
+
>
|
|
251
|
+
<span style={{ flex: 1, minWidth: 0, color: "#1f2937", overflow: "hidden", textOverflow: "ellipsis", whiteSpace: "nowrap" }}>
|
|
252
|
+
{h.heading}
|
|
253
|
+
</span>
|
|
254
|
+
<span style={{ fontSize: 10, fontWeight: 600, color: c.color, flexShrink: 0 }}>{c.label}</span>
|
|
255
|
+
</div>
|
|
256
|
+
);
|
|
257
|
+
})}
|
|
258
|
+
</div>
|
|
259
|
+
)}
|
|
260
|
+
</div>
|
|
261
|
+
)}
|
|
262
|
+
</div>
|
|
263
|
+
);
|
|
264
|
+
}
|
|
265
|
+
|
|
266
|
+
export function AEOTab({
|
|
267
|
+
text,
|
|
268
|
+
deepAnalysis,
|
|
269
|
+
isDeepLoading,
|
|
270
|
+
publication,
|
|
271
|
+
runDeepAnalysis,
|
|
272
|
+
aeoContentChanged,
|
|
273
|
+
headings = [],
|
|
274
|
+
contentSuggestions,
|
|
275
|
+
isCSLoading,
|
|
276
|
+
csError,
|
|
277
|
+
loadContentSuggestions,
|
|
278
|
+
}: AEOTabProps) {
|
|
279
|
+
const geo = useMemo(() => analyzeGEO(text, headings), [text, headings]);
|
|
280
|
+
// GEO needs ~150+ words to produce meaningful density readings - below that, factsPer1k
|
|
281
|
+
// is dominated by sample noise. Allow AEO sections to render with less text though.
|
|
282
|
+
const geoWordCount = text ? text.trim().split(/\s+/).filter(Boolean).length : 0;
|
|
283
|
+
const hasEnoughTextForGEO = geoWordCount >= 150;
|
|
284
|
+
const hasEnoughText = text && text.trim().length >= 50;
|
|
285
|
+
|
|
286
|
+
const aeo = deepAnalysis?.aeo;
|
|
287
|
+
const questionHeadings =
|
|
288
|
+
aeo?.questionHeadings?.map((qh) => ({
|
|
289
|
+
heading: qh.suggestedHeading,
|
|
290
|
+
originalHeading: qh.originalHeading,
|
|
291
|
+
rationale: qh.rationale,
|
|
292
|
+
})) ??
|
|
293
|
+
aeo?.headingSuggestions?.map((h) => ({
|
|
294
|
+
heading: h.heading,
|
|
295
|
+
originalHeading: undefined as string | undefined,
|
|
296
|
+
rationale: h.rationale,
|
|
297
|
+
})) ??
|
|
298
|
+
[];
|
|
299
|
+
|
|
300
|
+
return (
|
|
301
|
+
<div style={{ padding: 12, display: "flex", flexDirection: "column", gap: 12 }}>
|
|
302
|
+
{/* The AI-generated disclaimer lives in the panel-level notice now, above
|
|
303
|
+
the tab bar - so every tab shows it once, not per-tab. */}
|
|
304
|
+
|
|
305
|
+
{/* Content changed banner */}
|
|
306
|
+
{aeoContentChanged && (
|
|
307
|
+
<div
|
|
308
|
+
onClick={runDeepAnalysis}
|
|
309
|
+
style={{
|
|
310
|
+
padding: "8px 12px",
|
|
311
|
+
background: "#fffbeb",
|
|
312
|
+
border: "1px solid #fde68a",
|
|
313
|
+
borderRadius: 8,
|
|
314
|
+
display: "flex",
|
|
315
|
+
alignItems: "center",
|
|
316
|
+
justifyContent: "space-between",
|
|
317
|
+
cursor: "pointer",
|
|
318
|
+
}}
|
|
319
|
+
>
|
|
320
|
+
<span style={{ fontSize: 11, color: "#92400e" }}>Content has changed since this was generated.</span>
|
|
321
|
+
<span style={{ fontSize: 11, fontWeight: 600, color: AEO_PURPLE, textDecoration: "underline" }}>Update</span>
|
|
322
|
+
</div>
|
|
323
|
+
)}
|
|
324
|
+
|
|
325
|
+
{/* GEO (Generative Engine Optimization) - client-side, needs ~150 words to be meaningful */}
|
|
326
|
+
{hasEnoughTextForGEO && <GEOCard geo={geo} publication={publication} />}
|
|
327
|
+
{hasEnoughText && !hasEnoughTextForGEO && (
|
|
328
|
+
<div style={{ ...cardStyle, textAlign: "center" }}>
|
|
329
|
+
<div style={{ fontSize: 11, color: "#4b5563", lineHeight: 1.5 }}>
|
|
330
|
+
<strong style={{ color: "#C9A716" }}>AI citation analysis</strong> needs at least 150 words to read fact density.
|
|
331
|
+
<br />
|
|
332
|
+
<span style={{ color: "#4b5563" }}>Current: {geoWordCount} word{geoWordCount === 1 ? "" : "s"}</span>
|
|
333
|
+
</div>
|
|
334
|
+
</div>
|
|
335
|
+
)}
|
|
336
|
+
|
|
337
|
+
{/* AEO loading / empty states */}
|
|
338
|
+
{!deepAnalysis && isDeepLoading && (
|
|
339
|
+
<div style={{ ...cardStyle, display: "flex", alignItems: "center", justifyContent: "center", gap: 8 }}>
|
|
340
|
+
<LoadingBars size="xs" color={AEO_PURPLE} />
|
|
341
|
+
<span style={{ fontSize: 12, color: "#4b5563" }}>Generating AEO insights...</span>
|
|
342
|
+
</div>
|
|
343
|
+
)}
|
|
344
|
+
|
|
345
|
+
{!deepAnalysis && !isDeepLoading && (
|
|
346
|
+
<div style={{ ...cardStyle, textAlign: "center" }}>
|
|
347
|
+
<div style={{ fontSize: 12, color: "#4b5563" }}>AI citation readiness and question-style heading suggestions appear here once analysis runs.</div>
|
|
348
|
+
<button
|
|
349
|
+
onClick={runDeepAnalysis}
|
|
350
|
+
disabled={!hasEnoughText}
|
|
351
|
+
style={{
|
|
352
|
+
marginTop: 10,
|
|
353
|
+
padding: "6px 14px",
|
|
354
|
+
fontSize: 11,
|
|
355
|
+
fontWeight: 600,
|
|
356
|
+
color: !hasEnoughText ? "#9ca3af" : "#ffffff",
|
|
357
|
+
background: !hasEnoughText ? "#e5e7eb" : AEO_PURPLE,
|
|
358
|
+
border: "none",
|
|
359
|
+
borderRadius: 6,
|
|
360
|
+
cursor: !hasEnoughText ? "not-allowed" : "pointer",
|
|
361
|
+
}}
|
|
362
|
+
>
|
|
363
|
+
Run analysis
|
|
364
|
+
</button>
|
|
365
|
+
</div>
|
|
366
|
+
)}
|
|
367
|
+
|
|
368
|
+
{deepAnalysis && !aeo && (
|
|
369
|
+
<div style={{ ...cardStyle, textAlign: "center" }}>
|
|
370
|
+
<span style={{ fontSize: 12, color: "#4b5563" }}>
|
|
371
|
+
No insights came back. Try again - the analysis may have timed out.
|
|
372
|
+
</span>
|
|
373
|
+
</div>
|
|
374
|
+
)}
|
|
375
|
+
|
|
376
|
+
{/* Question-style headings */}
|
|
377
|
+
{questionHeadings.length > 0 && (
|
|
378
|
+
<div style={cardStyle}>
|
|
379
|
+
<SectionHeader label="Question-Style Headings" iconColor={AEO_PURPLE} />
|
|
380
|
+
<div style={{ fontSize: 10, color: "#4b5563", marginBottom: 8 }}>
|
|
381
|
+
Rewrites of your existing headings as questions. Google often pulls these into featured snippets.
|
|
382
|
+
</div>
|
|
383
|
+
<div style={{ display: "flex", flexDirection: "column", gap: 8 }}>
|
|
384
|
+
{questionHeadings.map((h, i) => (
|
|
385
|
+
<div
|
|
386
|
+
key={i}
|
|
387
|
+
style={{
|
|
388
|
+
padding: "8px 10px",
|
|
389
|
+
background: "rgba(0,93,172,0.03)",
|
|
390
|
+
borderRadius: 10,
|
|
391
|
+
borderLeft: `3px solid ${AEO_PURPLE}`,
|
|
392
|
+
}}
|
|
393
|
+
>
|
|
394
|
+
<div style={{ display: "flex", alignItems: "flex-start", justifyContent: "space-between", gap: 8 }}>
|
|
395
|
+
<div style={{ flex: 1 }}>
|
|
396
|
+
{h.originalHeading && (
|
|
397
|
+
<div style={{ fontSize: 11, color: "#4b5563", textDecoration: "line-through", marginBottom: 2 }}>
|
|
398
|
+
{h.originalHeading}
|
|
399
|
+
</div>
|
|
400
|
+
)}
|
|
401
|
+
<div style={{ fontSize: 12, fontWeight: 700, color: AEO_PURPLE, lineHeight: 1.5 }}>{h.heading}</div>
|
|
402
|
+
</div>
|
|
403
|
+
<div style={{ display: "flex", alignItems: "center", gap: 4 }}>
|
|
404
|
+
<CopyButton text={h.heading} />
|
|
405
|
+
<FeedbackButton suggestionType="aeo_heading" suggestionText={h.heading} publication={publication} />
|
|
406
|
+
</div>
|
|
407
|
+
</div>
|
|
408
|
+
<div style={{ fontSize: 10, color: "#4b5563", marginTop: 4, fontStyle: "italic" }}>{h.rationale}</div>
|
|
409
|
+
</div>
|
|
410
|
+
))}
|
|
411
|
+
</div>
|
|
412
|
+
</div>
|
|
413
|
+
)}
|
|
414
|
+
|
|
415
|
+
{/* Generated content blocks - inline summaries / infographics / bullets that travel
|
|
416
|
+
alongside the article and increase its chance of getting cited. */}
|
|
417
|
+
<div style={cardStyle}>
|
|
418
|
+
<SectionHeader label="Content Block Suggestions" iconColor={AEO_PURPLE} />
|
|
419
|
+
<div style={{ fontSize: 10, color: "#4b5563", marginBottom: 10 }}>
|
|
420
|
+
Short, citable blocks to use inside or alongside the article - takeaways, infographic ideas, and bullet points.
|
|
421
|
+
</div>
|
|
422
|
+
|
|
423
|
+
{!contentSuggestions && !isCSLoading && (
|
|
424
|
+
<button
|
|
425
|
+
onClick={loadContentSuggestions}
|
|
426
|
+
disabled={!text || text.trim().length < 100}
|
|
427
|
+
style={{
|
|
428
|
+
width: "100%",
|
|
429
|
+
padding: "8px 12px",
|
|
430
|
+
fontSize: 11,
|
|
431
|
+
fontWeight: 600,
|
|
432
|
+
color: !text || text.trim().length < 100 ? "#9ca3af" : "#ffffff",
|
|
433
|
+
background: !text || text.trim().length < 100 ? "#e5e7eb" : AEO_PURPLE,
|
|
434
|
+
border: "none",
|
|
435
|
+
borderRadius: 6,
|
|
436
|
+
cursor: !text || text.trim().length < 100 ? "not-allowed" : "pointer",
|
|
437
|
+
display: "flex",
|
|
438
|
+
alignItems: "center",
|
|
439
|
+
justifyContent: "center",
|
|
440
|
+
gap: 6,
|
|
441
|
+
transition: "all 150ms",
|
|
442
|
+
}}
|
|
443
|
+
>
|
|
444
|
+
Generate suggestions
|
|
445
|
+
</button>
|
|
446
|
+
)}
|
|
447
|
+
|
|
448
|
+
{isCSLoading && (
|
|
449
|
+
<div style={{ display: "flex", alignItems: "center", justifyContent: "center", gap: 8, padding: "8px 0" }}>
|
|
450
|
+
<LoadingBars size="xs" color={AEO_PURPLE} />
|
|
451
|
+
<span style={{ fontSize: 11, color: "#4b5563" }}>Generating content suggestions...</span>
|
|
452
|
+
</div>
|
|
453
|
+
)}
|
|
454
|
+
|
|
455
|
+
{csError && (
|
|
456
|
+
<div style={{ marginTop: 6, fontSize: 11, color: "#dc2626" }}>{csError}</div>
|
|
457
|
+
)}
|
|
458
|
+
|
|
459
|
+
{contentSuggestions && (
|
|
460
|
+
<div style={{ display: "flex", flexDirection: "column", gap: 14, marginTop: 8 }}>
|
|
461
|
+
{/* Key Takeaways */}
|
|
462
|
+
{contentSuggestions.keyTakeaways.length > 0 && (
|
|
463
|
+
<div>
|
|
464
|
+
<div style={{ fontSize: 10, fontWeight: 700, textTransform: "uppercase", letterSpacing: "0.06em", color: AEO_PURPLE, marginBottom: 6 }}>
|
|
465
|
+
Key Takeaways
|
|
466
|
+
</div>
|
|
467
|
+
<div style={{ display: "flex", flexDirection: "column", gap: 6 }}>
|
|
468
|
+
{contentSuggestions.keyTakeaways.map((kt, i) => (
|
|
469
|
+
<div
|
|
470
|
+
key={i}
|
|
471
|
+
style={{
|
|
472
|
+
padding: "6px 10px",
|
|
473
|
+
background: "rgba(0,93,172,0.03)",
|
|
474
|
+
borderRadius: 8,
|
|
475
|
+
borderLeft: `2px solid ${AEO_PURPLE}`,
|
|
476
|
+
display: "flex",
|
|
477
|
+
gap: 8,
|
|
478
|
+
alignItems: "flex-start",
|
|
479
|
+
}}
|
|
480
|
+
>
|
|
481
|
+
<span style={{ fontSize: 12, color: "#1f2937", lineHeight: 1.55, flex: 1 }}>{kt}</span>
|
|
482
|
+
<div style={{ display: "flex", alignItems: "center", gap: 4 }}>
|
|
483
|
+
<CopyButton text={kt} />
|
|
484
|
+
<FeedbackButton suggestionType="aeo_takeaway" suggestionText={kt} publication={publication} />
|
|
485
|
+
</div>
|
|
486
|
+
</div>
|
|
487
|
+
))}
|
|
488
|
+
</div>
|
|
489
|
+
</div>
|
|
490
|
+
)}
|
|
491
|
+
|
|
492
|
+
{/* Infographic Opportunities */}
|
|
493
|
+
{contentSuggestions.infographicOpportunities.length > 0 && (
|
|
494
|
+
<div>
|
|
495
|
+
<div style={{ fontSize: 10, fontWeight: 700, textTransform: "uppercase", letterSpacing: "0.06em", color: AEO_PURPLE, marginBottom: 6 }}>
|
|
496
|
+
Infographic Ideas
|
|
497
|
+
</div>
|
|
498
|
+
<div style={{ display: "flex", flexDirection: "column", gap: 6 }}>
|
|
499
|
+
{contentSuggestions.infographicOpportunities.map((io, i) => (
|
|
500
|
+
<div
|
|
501
|
+
key={i}
|
|
502
|
+
style={{
|
|
503
|
+
padding: "8px 10px",
|
|
504
|
+
background: "rgba(0,93,172,0.03)",
|
|
505
|
+
borderRadius: 8,
|
|
506
|
+
borderLeft: `2px solid ${AEO_PURPLE}`,
|
|
507
|
+
}}
|
|
508
|
+
>
|
|
509
|
+
<div style={{ display: "flex", alignItems: "flex-start", justifyContent: "space-between", gap: 8 }}>
|
|
510
|
+
<span style={{ fontSize: 12, fontWeight: 700, color: AEO_PURPLE }}>{io.concept}</span>
|
|
511
|
+
<FeedbackButton suggestionType="aeo_infographic" suggestionText={io.concept} publication={publication} />
|
|
512
|
+
</div>
|
|
513
|
+
<div style={{ fontSize: 11, color: "#1f2937", lineHeight: 1.5, marginTop: 3 }}>{io.description}</div>
|
|
514
|
+
</div>
|
|
515
|
+
))}
|
|
516
|
+
</div>
|
|
517
|
+
</div>
|
|
518
|
+
)}
|
|
519
|
+
|
|
520
|
+
{/* Bullet List Items */}
|
|
521
|
+
{contentSuggestions.bulletListItems.length > 0 && (
|
|
522
|
+
<div>
|
|
523
|
+
<div style={{ fontSize: 10, fontWeight: 700, textTransform: "uppercase", letterSpacing: "0.06em", color: AEO_PURPLE, marginBottom: 6 }}>
|
|
524
|
+
Bullets for Featured Snippets
|
|
525
|
+
</div>
|
|
526
|
+
<div style={{ display: "flex", alignItems: "flex-start", justifyContent: "space-between", gap: 8 }}>
|
|
527
|
+
<ul style={{ margin: 0, paddingLeft: 18, flex: 1 }}>
|
|
528
|
+
{contentSuggestions.bulletListItems.map((b, i) => (
|
|
529
|
+
<li key={i} style={{ fontSize: 12, color: "#1f2937", lineHeight: 1.55, marginBottom: 4 }}>
|
|
530
|
+
{b}
|
|
531
|
+
</li>
|
|
532
|
+
))}
|
|
533
|
+
</ul>
|
|
534
|
+
<div style={{ display: "flex", alignItems: "center", gap: 4 }}>
|
|
535
|
+
<CopyButton text={contentSuggestions.bulletListItems.map((b) => "- " + b).join("\n")} />
|
|
536
|
+
<FeedbackButton
|
|
537
|
+
suggestionType="aeo_bullets"
|
|
538
|
+
suggestionText={contentSuggestions.bulletListItems.join(" | ")}
|
|
539
|
+
publication={publication}
|
|
540
|
+
/>
|
|
541
|
+
</div>
|
|
542
|
+
</div>
|
|
543
|
+
</div>
|
|
544
|
+
)}
|
|
545
|
+
|
|
546
|
+
{/* Regenerate */}
|
|
547
|
+
<button
|
|
548
|
+
onClick={loadContentSuggestions}
|
|
549
|
+
disabled={isCSLoading}
|
|
550
|
+
style={{
|
|
551
|
+
marginTop: 4,
|
|
552
|
+
padding: "6px 12px",
|
|
553
|
+
fontSize: 11,
|
|
554
|
+
fontWeight: 600,
|
|
555
|
+
color: AEO_PURPLE,
|
|
556
|
+
background: "rgba(0,93,172,0.06)",
|
|
557
|
+
border: "1px solid rgba(0,93,172,0.15)",
|
|
558
|
+
borderRadius: 6,
|
|
559
|
+
cursor: isCSLoading ? "wait" : "pointer",
|
|
560
|
+
display: "flex",
|
|
561
|
+
alignItems: "center",
|
|
562
|
+
justifyContent: "center",
|
|
563
|
+
gap: 6,
|
|
564
|
+
}}
|
|
565
|
+
>
|
|
566
|
+
Regenerate
|
|
567
|
+
</button>
|
|
568
|
+
</div>
|
|
569
|
+
)}
|
|
570
|
+
</div>
|
|
571
|
+
</div>
|
|
572
|
+
);
|
|
573
|
+
}
|