sanity-plugin-seo-copilot 0.2.1 → 0.2.7
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 +1407 -638
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +1407 -638
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
- package/src/components/KeywordPanel.tsx +170 -5
- package/src/components/OnboardingPopup.tsx +108 -0
- package/src/components/SEOCopilotPanel.tsx +123 -14
- package/src/components/styles.ts +8 -0
- package/src/components/tabs/AEOTab.tsx +9 -3
- package/src/components/tabs/LinkingTab.tsx +77 -4
- package/src/components/tabs/MetaTab.tsx +40 -115
- package/src/components/tabs/SummaryTab.tsx +19 -4
- package/src/components/tabs/TechnicalTab.tsx +200 -29
- package/src/hooks/useDocumentContent.ts +6 -174
- package/src/hooks/useKeywordAnalysis.ts +33 -4
- package/src/hooks/useSEOChat.ts +61 -16
- package/src/lib/api.ts +25 -7
- package/src/lib/documentExtract.ts +268 -0
- package/src/lib/geoAnalysis.ts +16 -3
- package/src/lib/scoring.ts +69 -19
- package/src/lib/summary.ts +169 -28
- package/src/lib/types.ts +4 -1
package/dist/index.mjs
CHANGED
|
@@ -6,11 +6,14 @@ import { createElement } from "react";
|
|
|
6
6
|
|
|
7
7
|
// src/components/SEOCopilotPanel.tsx
|
|
8
8
|
import { useState as useState16, useRef as useRef10, useCallback as useCallback5, useEffect as useEffect10, useMemo as useMemo5, Suspense } from "react";
|
|
9
|
+
import { useWorkspace } from "sanity";
|
|
9
10
|
import { createPortal } from "react-dom";
|
|
10
11
|
|
|
11
12
|
// src/hooks/useDocumentContent.ts
|
|
12
13
|
import { useState, useEffect, useRef } from "react";
|
|
13
14
|
import { useDocumentPane } from "sanity/structure";
|
|
15
|
+
|
|
16
|
+
// src/lib/documentExtract.ts
|
|
14
17
|
function extractText(blocks) {
|
|
15
18
|
if (!blocks || !Array.isArray(blocks)) return "";
|
|
16
19
|
const parts = [];
|
|
@@ -72,6 +75,79 @@ function extractBodyLinks(blocks) {
|
|
|
72
75
|
}
|
|
73
76
|
return Array.from(urls);
|
|
74
77
|
}
|
|
78
|
+
function detectSlug(val) {
|
|
79
|
+
if (!val) return void 0;
|
|
80
|
+
const slugTypeFields = ["slug", "url", "urlSlug", "permalink", "pathname"];
|
|
81
|
+
for (const f of slugTypeFields) {
|
|
82
|
+
const obj = val[f];
|
|
83
|
+
if (obj && typeof obj === "object" && typeof obj.current === "string" && obj.current.trim()) {
|
|
84
|
+
return obj.current.trim();
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
const stringFields = ["urlSlug", "url", "URL", "path", "permalink", "pathname"];
|
|
88
|
+
const slugShape = /^[a-z0-9._~-]+(?:\/[a-z0-9._~-]+)*\/?$/i;
|
|
89
|
+
for (const f of stringFields) {
|
|
90
|
+
const v = val[f];
|
|
91
|
+
if (typeof v === "string") {
|
|
92
|
+
const trimmed = v.trim();
|
|
93
|
+
if (trimmed && !/^https?:\/\//i.test(trimmed) && slugShape.test(trimmed)) {
|
|
94
|
+
return trimmed;
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
return void 0;
|
|
99
|
+
}
|
|
100
|
+
function detectAuthor(val) {
|
|
101
|
+
if (!val) return { authorIsReference: false };
|
|
102
|
+
const candidateFields = [
|
|
103
|
+
"author",
|
|
104
|
+
"authors",
|
|
105
|
+
"byline",
|
|
106
|
+
"articleAuthor",
|
|
107
|
+
"primaryAuthor",
|
|
108
|
+
"writer",
|
|
109
|
+
"writers",
|
|
110
|
+
"contributor",
|
|
111
|
+
"contributors",
|
|
112
|
+
"authorMapping",
|
|
113
|
+
// MJH schema - array of author references
|
|
114
|
+
"Author",
|
|
115
|
+
"Authors"
|
|
116
|
+
// PascalCase variants
|
|
117
|
+
];
|
|
118
|
+
const dynamic = Object.keys(val).filter(
|
|
119
|
+
// Author/byline-ish names, but never fact-check/reviewer fields, nor image/url/
|
|
120
|
+
// id sidecars (e.g. authorPhoto, authorImageUrl, authorId) that could otherwise
|
|
121
|
+
// be mistaken for a reference-typed author.
|
|
122
|
+
(k) => /author|byline/i.test(k) && !/fact|check|review|photo|image|avatar|picture|url|link|count|id$/i.test(k)
|
|
123
|
+
);
|
|
124
|
+
const fields = Array.from(/* @__PURE__ */ new Set([...candidateFields, ...dynamic]));
|
|
125
|
+
for (const f of fields) {
|
|
126
|
+
const raw = val[f];
|
|
127
|
+
if (!raw) continue;
|
|
128
|
+
const first = Array.isArray(raw) ? raw[0] : raw;
|
|
129
|
+
if (!first) continue;
|
|
130
|
+
if (typeof first === "string") {
|
|
131
|
+
const trimmed = first.trim();
|
|
132
|
+
if (trimmed) return { authorName: trimmed, authorIsReference: false };
|
|
133
|
+
continue;
|
|
134
|
+
}
|
|
135
|
+
if (typeof first === "object" && first !== null) {
|
|
136
|
+
const o = first;
|
|
137
|
+
const name = o.name || o.fullName || o.displayName;
|
|
138
|
+
const creds = o.credentials || o.title || o.suffix;
|
|
139
|
+
const slug = o.slug?.current;
|
|
140
|
+
const bio = o.bioUrl || (slug ? `/author/${slug}` : void 0);
|
|
141
|
+
if (name) {
|
|
142
|
+
return { authorName: name, authorCredentials: creds, authorBioUrl: bio, authorIsReference: false };
|
|
143
|
+
}
|
|
144
|
+
if (typeof o._ref === "string" || o._type === "reference") {
|
|
145
|
+
return { authorIsReference: true };
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
return { authorIsReference: false };
|
|
150
|
+
}
|
|
75
151
|
function extractImageMeta(value) {
|
|
76
152
|
const names = [];
|
|
77
153
|
const titles = [];
|
|
@@ -88,11 +164,60 @@ function extractImageMeta(value) {
|
|
|
88
164
|
if (typeof img.title === "string" && img.title) titles.push(img.title);
|
|
89
165
|
else if (asset && typeof asset.title === "string" && asset.title) titles.push(asset.title);
|
|
90
166
|
}
|
|
167
|
+
const body = value.body;
|
|
168
|
+
if (Array.isArray(body)) {
|
|
169
|
+
for (const blk of body) {
|
|
170
|
+
if (!blk || typeof blk !== "object") continue;
|
|
171
|
+
const b = blk;
|
|
172
|
+
if (b._type !== "figure" && b._type !== "image") continue;
|
|
173
|
+
const asset = b.asset && typeof b.asset === "object" ? b.asset : void 0;
|
|
174
|
+
if (!asset && b._type !== "image") continue;
|
|
175
|
+
count++;
|
|
176
|
+
if (typeof b.alt === "string" && b.alt) names.push(b.alt);
|
|
177
|
+
if (asset && typeof asset.originalFilename === "string" && asset.originalFilename) names.push(asset.originalFilename);
|
|
178
|
+
if (typeof b.title === "string" && b.title) titles.push(b.title);
|
|
179
|
+
else if (asset && typeof asset.title === "string" && asset.title) titles.push(asset.title);
|
|
180
|
+
}
|
|
181
|
+
}
|
|
91
182
|
return { names, titles, count };
|
|
92
183
|
}
|
|
184
|
+
function buildDocumentFields(value) {
|
|
185
|
+
const val = value;
|
|
186
|
+
const title = val?.title;
|
|
187
|
+
const body = val?.body;
|
|
188
|
+
const { authorName, authorCredentials, authorBioUrl, authorIsReference } = detectAuthor(val);
|
|
189
|
+
const imageMeta = val ? extractImageMeta(val) : { names: [], titles: [], count: 0 };
|
|
190
|
+
return {
|
|
191
|
+
title: title || void 0,
|
|
192
|
+
// MJH uses `summary`; standard Sanity SEO plugins use `metaDescription`
|
|
193
|
+
metaDescription: val?.metaDescription || val?.summary || val?.description || val?.seoDescription,
|
|
194
|
+
slug: detectSlug(val),
|
|
195
|
+
imageNames: imageMeta.names,
|
|
196
|
+
imageTitles: imageMeta.titles,
|
|
197
|
+
imageCount: imageMeta.count,
|
|
198
|
+
headings: extractHeadings(body),
|
|
199
|
+
headingsDetailed: extractHeadingsDetailed(body),
|
|
200
|
+
bodyLinks: extractBodyLinks(body),
|
|
201
|
+
contentCategory: val?.contentCategory || val?.category,
|
|
202
|
+
contentPlacement: Array.isArray(val?.contentPlacement) ? val.contentPlacement : void 0,
|
|
203
|
+
authorName,
|
|
204
|
+
authorCredentials,
|
|
205
|
+
authorBioUrl,
|
|
206
|
+
authorIsReference,
|
|
207
|
+
// `published` is MJH's date field; `publishedAt`/`publishDate` cover other schemas
|
|
208
|
+
publishedAt: val?.published || val?.publishedAt || val?.publishDate || val?._createdAt,
|
|
209
|
+
// `updatedOn` is MJH's "Updated On" field. `updatedAt` is the standard Sanity convention.
|
|
210
|
+
// `_updatedAt` is the Sanity-managed timestamp as a final fallback.
|
|
211
|
+
updatedAt: val?.updatedOn || val?.updatedAt || val?._updatedAt,
|
|
212
|
+
lastReviewedAt: val?.lastReviewedAt || val?.lastReviewed || val?.medicallyReviewedAt
|
|
213
|
+
};
|
|
214
|
+
}
|
|
215
|
+
|
|
216
|
+
// src/hooks/useDocumentContent.ts
|
|
93
217
|
function useDocumentContent() {
|
|
94
218
|
const { value, ready } = useDocumentPane();
|
|
95
219
|
const documentId = value?._id || void 0;
|
|
220
|
+
const documentType = value?._type || void 0;
|
|
96
221
|
const title = value?.title;
|
|
97
222
|
const body = value?.body;
|
|
98
223
|
const [debouncedText, setDebouncedText] = useState("");
|
|
@@ -109,43 +234,7 @@ function useDocumentContent() {
|
|
|
109
234
|
useEffect(() => {
|
|
110
235
|
const bodyText = extractText(body);
|
|
111
236
|
const fullText = [title, bodyText].filter(Boolean).join("\n\n");
|
|
112
|
-
const
|
|
113
|
-
let authorName;
|
|
114
|
-
let authorCredentials;
|
|
115
|
-
let authorBioUrl;
|
|
116
|
-
let authorIsReference = false;
|
|
117
|
-
const author = val?.author || Array.isArray(val?.authors) && val.authors[0] || val?.byline;
|
|
118
|
-
if (typeof author === "string") {
|
|
119
|
-
authorName = author;
|
|
120
|
-
} else if (author && typeof author === "object") {
|
|
121
|
-
authorName = author.name || author.fullName || author.displayName;
|
|
122
|
-
authorCredentials = author.credentials || author.title || author.suffix;
|
|
123
|
-
authorBioUrl = author.bioUrl || (author.slug?.current ? `/author/${author.slug.current}` : void 0);
|
|
124
|
-
if (!authorName && typeof author._ref === "string") {
|
|
125
|
-
authorIsReference = true;
|
|
126
|
-
}
|
|
127
|
-
}
|
|
128
|
-
const imageMeta = val ? extractImageMeta(val) : { names: [], titles: [], count: 0 };
|
|
129
|
-
const fields = {
|
|
130
|
-
title: title || void 0,
|
|
131
|
-
metaDescription: val?.metaDescription || val?.summary || val?.description || val?.seoDescription,
|
|
132
|
-
slug: val?.slug?.current || void 0,
|
|
133
|
-
imageNames: imageMeta.names,
|
|
134
|
-
imageTitles: imageMeta.titles,
|
|
135
|
-
imageCount: imageMeta.count,
|
|
136
|
-
headings: extractHeadings(body),
|
|
137
|
-
headingsDetailed: extractHeadingsDetailed(body),
|
|
138
|
-
bodyLinks: extractBodyLinks(body),
|
|
139
|
-
contentCategory: val?.contentCategory || val?.category,
|
|
140
|
-
contentPlacement: Array.isArray(val?.contentPlacement) ? val.contentPlacement : void 0,
|
|
141
|
-
authorName,
|
|
142
|
-
authorCredentials,
|
|
143
|
-
authorBioUrl,
|
|
144
|
-
authorIsReference,
|
|
145
|
-
publishedAt: val?.publishedAt || val?.publishDate || val?._createdAt,
|
|
146
|
-
updatedAt: val?.updatedAt || val?._updatedAt,
|
|
147
|
-
lastReviewedAt: val?.lastReviewedAt || val?.lastReviewed || val?.medicallyReviewedAt
|
|
148
|
-
};
|
|
237
|
+
const fields = buildDocumentFields(value);
|
|
149
238
|
setDocumentFields(fields);
|
|
150
239
|
if (timerRef.current) clearTimeout(timerRef.current);
|
|
151
240
|
timerRef.current = setTimeout(() => {
|
|
@@ -156,7 +245,7 @@ function useDocumentContent() {
|
|
|
156
245
|
if (timerRef.current) clearTimeout(timerRef.current);
|
|
157
246
|
};
|
|
158
247
|
}, [title, body, value]);
|
|
159
|
-
return { text: debouncedText, isLoading, documentFields, documentId };
|
|
248
|
+
return { text: debouncedText, isLoading, documentFields, documentId, documentType };
|
|
160
249
|
}
|
|
161
250
|
|
|
162
251
|
// src/hooks/useKeywordAnalysis.ts
|
|
@@ -179,28 +268,36 @@ function safeParseJson(text) {
|
|
|
179
268
|
throw new Error("Invalid JSON response from server");
|
|
180
269
|
}
|
|
181
270
|
}
|
|
182
|
-
async function fetchAnalysis(apiUrl, content, mode, publication, seedKeywords, documentFields, focusKeyword) {
|
|
271
|
+
async function fetchAnalysis(apiUrl, content, mode, publication, seedKeywords, documentFields, focusKeyword, signal) {
|
|
183
272
|
const response = await fetch(`${apiUrl}/api/seo-copilot/analyze`, {
|
|
184
273
|
method: "POST",
|
|
185
274
|
headers: { "Content-Type": "application/json" },
|
|
186
|
-
body: JSON.stringify({ content, mode, publication, seedKeywords, documentFields, focusKeyword })
|
|
275
|
+
body: JSON.stringify({ content, mode, publication, seedKeywords, documentFields, focusKeyword }),
|
|
276
|
+
signal
|
|
187
277
|
});
|
|
188
278
|
const text = await response.text();
|
|
189
279
|
if (!response.ok) {
|
|
190
280
|
const err = safeParseJson(text);
|
|
191
|
-
|
|
281
|
+
console.error("[seo-copilot] analyze error", response.status, err.error);
|
|
282
|
+
if (response.status === 429) throw new Error("Analysis service is busy. Please try again.");
|
|
283
|
+
if (response.status >= 500) throw new Error("Could not reach the SEO service.");
|
|
284
|
+
throw new Error("Something went wrong analyzing this document.");
|
|
192
285
|
}
|
|
193
286
|
return safeParseJson(text);
|
|
194
287
|
}
|
|
195
|
-
async function fetchChatStream(apiUrl, messages, documentContext, publication, keywordPanelData) {
|
|
288
|
+
async function fetchChatStream(apiUrl, messages, documentContext, publication, keywordPanelData, signal) {
|
|
196
289
|
const response = await fetch(`${apiUrl}/api/seo-copilot/chat`, {
|
|
197
290
|
method: "POST",
|
|
198
291
|
headers: { "Content-Type": "application/json" },
|
|
199
|
-
body: JSON.stringify({ messages, documentContext, publication, keywordPanelData })
|
|
292
|
+
body: JSON.stringify({ messages, documentContext, publication, keywordPanelData }),
|
|
293
|
+
signal
|
|
200
294
|
});
|
|
201
295
|
if (!response.ok) {
|
|
202
296
|
const err = await response.json().catch(() => ({ error: "Request failed" }));
|
|
203
|
-
|
|
297
|
+
console.error("[seo-copilot] chat error", response.status, err.error);
|
|
298
|
+
if (response.status === 429) throw new Error("Analysis service is busy. Please try again.");
|
|
299
|
+
if (response.status >= 500) throw new Error("Could not reach the SEO service.");
|
|
300
|
+
throw new Error("Something went wrong. Please try again.");
|
|
204
301
|
}
|
|
205
302
|
return response.body;
|
|
206
303
|
}
|
|
@@ -211,15 +308,19 @@ async function submitFeedback(apiUrl, data) {
|
|
|
211
308
|
body: JSON.stringify(data)
|
|
212
309
|
});
|
|
213
310
|
}
|
|
214
|
-
async function lookupKeywords(apiUrl, keywords) {
|
|
311
|
+
async function lookupKeywords(apiUrl, keywords, signal) {
|
|
215
312
|
const response = await fetch(`${apiUrl}/api/seo-copilot/keywords`, {
|
|
216
313
|
method: "POST",
|
|
217
314
|
headers: { "Content-Type": "application/json" },
|
|
218
|
-
body: JSON.stringify({ keywords })
|
|
315
|
+
body: JSON.stringify({ keywords }),
|
|
316
|
+
signal
|
|
219
317
|
});
|
|
220
318
|
if (!response.ok) {
|
|
221
319
|
const err = await response.json().catch(() => ({ error: "Request failed" }));
|
|
222
|
-
|
|
320
|
+
console.error("[seo-copilot] keywords error", response.status, err.error);
|
|
321
|
+
if (response.status === 429) throw new Error("Analysis service is busy. Please try again.");
|
|
322
|
+
if (response.status >= 500) throw new Error("Could not reach the SEO service.");
|
|
323
|
+
throw new Error("Something went wrong. Please try again.");
|
|
223
324
|
}
|
|
224
325
|
return response.json();
|
|
225
326
|
}
|
|
@@ -355,6 +456,9 @@ function useKeywordAnalysis(text, apiUrl, publication, seedKeywords, documentFie
|
|
|
355
456
|
cacheInitializedRef.current = true;
|
|
356
457
|
return;
|
|
357
458
|
}
|
|
459
|
+
docVersionRef.current += 1;
|
|
460
|
+
volumeAbortRef.current?.abort();
|
|
461
|
+
volumeAbortRef.current = null;
|
|
358
462
|
const fresh = loadCached();
|
|
359
463
|
cached.current = fresh;
|
|
360
464
|
setAnalysisRaw(fresh.analysis);
|
|
@@ -391,15 +495,18 @@ function useKeywordAnalysis(text, apiUrl, publication, seedKeywords, documentFie
|
|
|
391
495
|
}
|
|
392
496
|
}, [text, deepAnalysis, aeoTextSnapshot]);
|
|
393
497
|
const lastAnalysisRef = useRef2(null);
|
|
498
|
+
const docVersionRef = useRef2(0);
|
|
499
|
+
const volumeAbortRef = useRef2(null);
|
|
394
500
|
useEffect2(() => {
|
|
395
501
|
if ((!text || text.trim().length < 20) && (!effectiveSeeds || effectiveSeeds.length === 0)) {
|
|
396
502
|
setAnalysis(null);
|
|
397
503
|
return;
|
|
398
504
|
}
|
|
399
505
|
let cancelled = false;
|
|
506
|
+
const controller = new AbortController();
|
|
400
507
|
setIsLoading(true);
|
|
401
508
|
setError(null);
|
|
402
|
-
fetchAnalysis(apiUrl, text, "realtime", publication, effectiveSeeds, documentFields, focusPrimary).then((result) => {
|
|
509
|
+
fetchAnalysis(apiUrl, text, "realtime", publication, effectiveSeeds, documentFields, focusPrimary, controller.signal).then((result) => {
|
|
403
510
|
if (cancelled) return;
|
|
404
511
|
const analysisResult = result;
|
|
405
512
|
lastAnalysisRef.current = analysisResult;
|
|
@@ -419,6 +526,7 @@ function useKeywordAnalysis(text, apiUrl, publication, seedKeywords, documentFie
|
|
|
419
526
|
doVolumeLookup(analysisResult, uncachedTerms);
|
|
420
527
|
}
|
|
421
528
|
}).catch((err) => {
|
|
529
|
+
if (err instanceof Error && err.name === "AbortError") return;
|
|
422
530
|
if (!cancelled) {
|
|
423
531
|
setError(err.message);
|
|
424
532
|
setIsLoading(false);
|
|
@@ -426,10 +534,12 @@ function useKeywordAnalysis(text, apiUrl, publication, seedKeywords, documentFie
|
|
|
426
534
|
});
|
|
427
535
|
return () => {
|
|
428
536
|
cancelled = true;
|
|
537
|
+
controller.abort();
|
|
429
538
|
};
|
|
430
|
-
}, [text, apiUrl, publication, effectiveSeeds?.join(","), focusPrimary]);
|
|
539
|
+
}, [text, apiUrl, publication, effectiveSeeds?.join(","), focusPrimary, JSON.stringify(documentFields)]);
|
|
431
540
|
const doVolumeLookup = useCallback((analysisResult, terms) => {
|
|
432
541
|
setIsVolumesLoading(true);
|
|
542
|
+
const myVersion = docVersionRef.current;
|
|
433
543
|
const lookupTerms = terms || (() => {
|
|
434
544
|
const candidateTerms = (analysisResult.primaryKeywordCandidates || []).map((c) => c.term);
|
|
435
545
|
return [
|
|
@@ -445,7 +555,11 @@ function useKeywordAnalysis(text, apiUrl, publication, seedKeywords, documentFie
|
|
|
445
555
|
setIsVolumesLoading(false);
|
|
446
556
|
return;
|
|
447
557
|
}
|
|
448
|
-
|
|
558
|
+
volumeAbortRef.current?.abort();
|
|
559
|
+
const controller = new AbortController();
|
|
560
|
+
volumeAbortRef.current = controller;
|
|
561
|
+
lookupKeywords(apiUrl, lookupTerms, controller.signal).then(({ results }) => {
|
|
562
|
+
if (docVersionRef.current !== myVersion) return;
|
|
449
563
|
results.forEach((r) => volumeMapRef.current.set(r.keyword.toLowerCase(), r));
|
|
450
564
|
const current = lastAnalysisRef.current || analysisResult;
|
|
451
565
|
const merged = mergeVolumes(current, volumeMapRef.current);
|
|
@@ -457,7 +571,9 @@ function useKeywordAnalysis(text, apiUrl, publication, seedKeywords, documentFie
|
|
|
457
571
|
} catch {
|
|
458
572
|
}
|
|
459
573
|
setIsVolumesLoading(false);
|
|
460
|
-
}).catch(() => {
|
|
574
|
+
}).catch((err) => {
|
|
575
|
+
if (err instanceof Error && err.name === "AbortError") return;
|
|
576
|
+
if (docVersionRef.current !== myVersion) return;
|
|
461
577
|
setIsVolumesLoading(false);
|
|
462
578
|
});
|
|
463
579
|
}, [apiUrl, cacheKey]);
|
|
@@ -472,10 +588,13 @@ function useKeywordAnalysis(text, apiUrl, publication, seedKeywords, documentFie
|
|
|
472
588
|
setError(null);
|
|
473
589
|
setAeoContentChanged(false);
|
|
474
590
|
setAeoTextSnapshot(text);
|
|
591
|
+
const myVersion = docVersionRef.current;
|
|
475
592
|
fetchAnalysis(apiUrl, text, "deep", publication, effectiveSeeds, documentFields, focusPrimary).then((result) => {
|
|
593
|
+
if (docVersionRef.current !== myVersion) return;
|
|
476
594
|
setDeepAnalysis(result);
|
|
477
595
|
setIsDeepLoading(false);
|
|
478
596
|
}).catch((err) => {
|
|
597
|
+
if (docVersionRef.current !== myVersion) return;
|
|
479
598
|
setError(err.message);
|
|
480
599
|
setIsDeepLoading(false);
|
|
481
600
|
});
|
|
@@ -520,16 +639,10 @@ function useSEOChat(apiUrl, documentText, publication, keywordPanelData, documen
|
|
|
520
639
|
}
|
|
521
640
|
}, [chatCacheKey]);
|
|
522
641
|
const [messages, setMessagesRaw] = useState3(loadCachedMessages);
|
|
642
|
+
const messagesRef = useRef3([]);
|
|
523
643
|
const setMessages = useCallback2((msgs) => {
|
|
524
|
-
setMessagesRaw(
|
|
525
|
-
|
|
526
|
-
try {
|
|
527
|
-
localStorage.setItem(chatCacheKey, JSON.stringify(next));
|
|
528
|
-
} catch {
|
|
529
|
-
}
|
|
530
|
-
return next;
|
|
531
|
-
});
|
|
532
|
-
}, [chatCacheKey]);
|
|
644
|
+
setMessagesRaw(msgs);
|
|
645
|
+
}, []);
|
|
533
646
|
const [isStreaming, setIsStreaming] = useState3(false);
|
|
534
647
|
const [historyLoaded, setHistoryLoaded] = useState3(false);
|
|
535
648
|
const sanityUser = useCurrentUser();
|
|
@@ -539,6 +652,24 @@ function useSEOChat(apiUrl, documentText, publication, keywordPanelData, documen
|
|
|
539
652
|
userId.current = sanityUser.id;
|
|
540
653
|
}
|
|
541
654
|
}, [sanityUser?.id]);
|
|
655
|
+
useEffect3(() => {
|
|
656
|
+
messagesRef.current = messages;
|
|
657
|
+
}, [messages]);
|
|
658
|
+
useEffect3(() => {
|
|
659
|
+
const timer = setTimeout(() => {
|
|
660
|
+
try {
|
|
661
|
+
localStorage.setItem(chatCacheKey, JSON.stringify(messages));
|
|
662
|
+
} catch {
|
|
663
|
+
}
|
|
664
|
+
}, 500);
|
|
665
|
+
return () => clearTimeout(timer);
|
|
666
|
+
}, [messages, chatCacheKey]);
|
|
667
|
+
const streamAbortRef = useRef3(null);
|
|
668
|
+
useEffect3(() => {
|
|
669
|
+
return () => {
|
|
670
|
+
streamAbortRef.current?.abort();
|
|
671
|
+
};
|
|
672
|
+
}, []);
|
|
542
673
|
const saveTimerRef = useRef3(null);
|
|
543
674
|
const opVersionRef = useRef3(0);
|
|
544
675
|
const didInitRef = useRef3(false);
|
|
@@ -548,6 +679,8 @@ function useSEOChat(apiUrl, documentText, publication, keywordPanelData, documen
|
|
|
548
679
|
return;
|
|
549
680
|
}
|
|
550
681
|
opVersionRef.current += 1;
|
|
682
|
+
streamAbortRef.current?.abort();
|
|
683
|
+
streamAbortRef.current = null;
|
|
551
684
|
setMessagesRaw(loadCachedMessages());
|
|
552
685
|
setIsStreaming(false);
|
|
553
686
|
setHistoryLoaded(false);
|
|
@@ -580,17 +713,21 @@ function useSEOChat(apiUrl, documentText, publication, keywordPanelData, documen
|
|
|
580
713
|
}, [apiUrl, documentId, publication]);
|
|
581
714
|
const sendMessage = useCallback2(
|
|
582
715
|
async (text) => {
|
|
716
|
+
const myVersion = opVersionRef.current;
|
|
583
717
|
const userMessage = { role: "user", content: text };
|
|
584
|
-
const updatedMessages = [...
|
|
718
|
+
const updatedMessages = [...messagesRef.current, userMessage];
|
|
585
719
|
setMessages(updatedMessages);
|
|
586
720
|
setIsStreaming(true);
|
|
721
|
+
const controller = new AbortController();
|
|
722
|
+
streamAbortRef.current = controller;
|
|
587
723
|
try {
|
|
588
724
|
const stream = await fetchChatStream(
|
|
589
725
|
apiUrl,
|
|
590
726
|
updatedMessages,
|
|
591
727
|
documentText,
|
|
592
728
|
publication,
|
|
593
|
-
keywordPanelData
|
|
729
|
+
keywordPanelData,
|
|
730
|
+
controller.signal
|
|
594
731
|
);
|
|
595
732
|
if (!stream) {
|
|
596
733
|
setIsStreaming(false);
|
|
@@ -599,10 +736,25 @@ function useSEOChat(apiUrl, documentText, publication, keywordPanelData, documen
|
|
|
599
736
|
const reader = stream.getReader();
|
|
600
737
|
const decoder = new TextDecoder();
|
|
601
738
|
let assistantContent = "";
|
|
739
|
+
if (opVersionRef.current !== myVersion) {
|
|
740
|
+
try {
|
|
741
|
+
await reader.cancel();
|
|
742
|
+
} catch {
|
|
743
|
+
}
|
|
744
|
+
setIsStreaming(false);
|
|
745
|
+
return;
|
|
746
|
+
}
|
|
602
747
|
setMessages((prev) => [...prev, { role: "assistant", content: "" }]);
|
|
603
748
|
while (true) {
|
|
604
749
|
const { done, value } = await reader.read();
|
|
605
750
|
if (done) break;
|
|
751
|
+
if (opVersionRef.current !== myVersion) {
|
|
752
|
+
try {
|
|
753
|
+
await reader.cancel();
|
|
754
|
+
} catch {
|
|
755
|
+
}
|
|
756
|
+
break;
|
|
757
|
+
}
|
|
606
758
|
const chunk = decoder.decode(value, { stream: true });
|
|
607
759
|
const lines = chunk.split("\n");
|
|
608
760
|
for (const line of lines) {
|
|
@@ -627,21 +779,31 @@ function useSEOChat(apiUrl, documentText, publication, keywordPanelData, documen
|
|
|
627
779
|
}
|
|
628
780
|
}
|
|
629
781
|
}
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
|
|
634
|
-
|
|
782
|
+
if (opVersionRef.current === myVersion) {
|
|
783
|
+
const finalMessages = [
|
|
784
|
+
...updatedMessages,
|
|
785
|
+
{ role: "assistant", content: assistantContent }
|
|
786
|
+
];
|
|
787
|
+
scheduleSave(finalMessages);
|
|
788
|
+
}
|
|
635
789
|
} catch (err) {
|
|
790
|
+
if (err instanceof Error && err.name === "AbortError") {
|
|
791
|
+
setIsStreaming(false);
|
|
792
|
+
return;
|
|
793
|
+
}
|
|
794
|
+
if (opVersionRef.current !== myVersion) {
|
|
795
|
+
setIsStreaming(false);
|
|
796
|
+
return;
|
|
797
|
+
}
|
|
636
798
|
const errorMsg = err instanceof Error ? err.message : "Chat failed";
|
|
637
799
|
setMessages((prev) => [
|
|
638
800
|
...prev,
|
|
639
801
|
{ role: "assistant", content: `Error: ${errorMsg}` }
|
|
640
802
|
]);
|
|
641
803
|
}
|
|
642
|
-
setIsStreaming(false);
|
|
804
|
+
if (opVersionRef.current === myVersion) setIsStreaming(false);
|
|
643
805
|
},
|
|
644
|
-
[
|
|
806
|
+
[apiUrl, documentText, publication, keywordPanelData, scheduleSave]
|
|
645
807
|
);
|
|
646
808
|
const clearChat = useCallback2(() => {
|
|
647
809
|
setMessages([]);
|
|
@@ -771,6 +933,14 @@ var INJECTED_CSS = `
|
|
|
771
933
|
0%, 100% { opacity: 0.5; }
|
|
772
934
|
50% { opacity: 1; }
|
|
773
935
|
}
|
|
936
|
+
@keyframes onboard-in {
|
|
937
|
+
from { opacity: 0; transform: translateY(-6px) scale(0.97); }
|
|
938
|
+
to { opacity: 1; transform: translateY(0) scale(1); }
|
|
939
|
+
}
|
|
940
|
+
@keyframes onboard-out {
|
|
941
|
+
from { opacity: 1; transform: translateY(0) scale(1); }
|
|
942
|
+
to { opacity: 0; transform: translateY(-6px) scale(0.97); }
|
|
943
|
+
}
|
|
774
944
|
.prose-chat { font-size: 12.5px; line-height: 1.65; color: #475569; font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif; }
|
|
775
945
|
.prose-chat h1 { font-size: 14px; font-weight: 700; color: #1e293b; margin: 10px 0 5px 0; line-height: 1.35; }
|
|
776
946
|
.prose-chat h2, .prose-chat h3 { font-size: 13px; font-weight: 700; color: #1e293b; margin: 10px 0 5px 0; line-height: 1.35; }
|
|
@@ -1309,7 +1479,7 @@ function LightbulbButton({ onClick, isLoading }) {
|
|
|
1309
1479
|
whiteSpace: "nowrap",
|
|
1310
1480
|
pointerEvents: "none",
|
|
1311
1481
|
zIndex: 10
|
|
1312
|
-
}, children: "
|
|
1482
|
+
}, children: "See suggestion" })
|
|
1313
1483
|
]
|
|
1314
1484
|
}
|
|
1315
1485
|
);
|
|
@@ -1497,12 +1667,9 @@ function PrimaryKeywordSelector({
|
|
|
1497
1667
|
fontWeight: isSelected ? 600 : 400,
|
|
1498
1668
|
color: isSelected ? "#166534" : "#374151"
|
|
1499
1669
|
}, children: candidate.term }),
|
|
1500
|
-
candidate.volume != null && /* @__PURE__ */
|
|
1501
|
-
abbrevVol(candidate.volume),
|
|
1502
|
-
"/mo"
|
|
1503
|
-
] }),
|
|
1670
|
+
candidate.volume != null && /* @__PURE__ */ jsx5("span", { style: { fontSize: 11, fontWeight: 600, color: "#1f2937" }, children: candidate.volume === 0 ? "N/A" : `${abbrevVol(candidate.volume)}/mo` }),
|
|
1504
1671
|
/* @__PURE__ */ jsxs4("span", { style: { fontSize: 10, color: "#1f2937" }, children: [
|
|
1505
|
-
Math.round(candidate.confidence * 100),
|
|
1672
|
+
Math.round((candidate.confidence ?? 0) * 100),
|
|
1506
1673
|
"% confidence"
|
|
1507
1674
|
] })
|
|
1508
1675
|
] }),
|
|
@@ -1515,6 +1682,119 @@ function PrimaryKeywordSelector({
|
|
|
1515
1682
|
}) })
|
|
1516
1683
|
] });
|
|
1517
1684
|
}
|
|
1685
|
+
function SecondaryKeywordSelector({
|
|
1686
|
+
options,
|
|
1687
|
+
selectedTerm,
|
|
1688
|
+
onSelect
|
|
1689
|
+
}) {
|
|
1690
|
+
const [customInputOpen, setCustomInputOpen] = useState8(false);
|
|
1691
|
+
const [customValue, setCustomValue] = useState8("");
|
|
1692
|
+
const handleCustomSubmit = () => {
|
|
1693
|
+
const trimmed = customValue.trim();
|
|
1694
|
+
if (trimmed) {
|
|
1695
|
+
onSelect(trimmed);
|
|
1696
|
+
setCustomValue("");
|
|
1697
|
+
setCustomInputOpen(false);
|
|
1698
|
+
}
|
|
1699
|
+
};
|
|
1700
|
+
const opts = selectedTerm && !options.some((o) => o.term === selectedTerm) ? [...options, { term: selectedTerm, volume: null }] : options;
|
|
1701
|
+
return /* @__PURE__ */ jsxs4("div", { style: cardStyle, children: [
|
|
1702
|
+
/* @__PURE__ */ jsx5(
|
|
1703
|
+
SectionHeader,
|
|
1704
|
+
{
|
|
1705
|
+
label: "Secondary Keyword",
|
|
1706
|
+
iconColor: MJH_BLUE,
|
|
1707
|
+
actionButton: /* @__PURE__ */ jsxs4("div", { style: { display: "flex", alignItems: "center", gap: 6 }, children: [
|
|
1708
|
+
/* @__PURE__ */ jsx5("span", { style: { fontSize: 9, fontWeight: 700, letterSpacing: "0.05em", textTransform: "uppercase", color: "#9ca3af" }, children: "Optional" }),
|
|
1709
|
+
/* @__PURE__ */ jsx5(PencilButton, { onClick: () => setCustomInputOpen(!customInputOpen), active: customInputOpen })
|
|
1710
|
+
] })
|
|
1711
|
+
}
|
|
1712
|
+
),
|
|
1713
|
+
/* @__PURE__ */ jsx5("div", { style: { fontSize: 11, color: "#4b5563", lineHeight: 1.5, marginBottom: 8 }, children: "Pick one more keyword to optimize for. Copilot then checks your title, meta, URL, headings, and images against both keywords." }),
|
|
1714
|
+
customInputOpen && /* @__PURE__ */ jsxs4("div", { style: { marginBottom: 8, display: "flex", gap: 6 }, children: [
|
|
1715
|
+
/* @__PURE__ */ jsx5(
|
|
1716
|
+
"input",
|
|
1717
|
+
{
|
|
1718
|
+
type: "text",
|
|
1719
|
+
value: customValue,
|
|
1720
|
+
onChange: (e) => setCustomValue(e.target.value),
|
|
1721
|
+
onKeyDown: (e) => {
|
|
1722
|
+
if (e.key === "Enter") handleCustomSubmit();
|
|
1723
|
+
},
|
|
1724
|
+
placeholder: "Type a custom secondary keyword",
|
|
1725
|
+
autoFocus: true,
|
|
1726
|
+
style: { flex: 1, padding: "5px 8px", fontSize: 12, borderRadius: 8, border: "1px solid #e5e7eb", outline: "none", fontFamily: "inherit" }
|
|
1727
|
+
}
|
|
1728
|
+
),
|
|
1729
|
+
/* @__PURE__ */ jsx5(
|
|
1730
|
+
"button",
|
|
1731
|
+
{
|
|
1732
|
+
onClick: handleCustomSubmit,
|
|
1733
|
+
disabled: !customValue.trim(),
|
|
1734
|
+
style: {
|
|
1735
|
+
padding: "5px 10px",
|
|
1736
|
+
fontSize: 11,
|
|
1737
|
+
fontWeight: 600,
|
|
1738
|
+
borderRadius: 6,
|
|
1739
|
+
border: "none",
|
|
1740
|
+
background: customValue.trim() ? MJH_BLUE : "#e5e7eb",
|
|
1741
|
+
color: customValue.trim() ? "#ffffff" : "#9ca3af",
|
|
1742
|
+
cursor: customValue.trim() ? "pointer" : "not-allowed"
|
|
1743
|
+
},
|
|
1744
|
+
children: "Set"
|
|
1745
|
+
}
|
|
1746
|
+
)
|
|
1747
|
+
] }),
|
|
1748
|
+
/* @__PURE__ */ jsxs4("div", { style: { display: "flex", flexDirection: "column", gap: 6 }, children: [
|
|
1749
|
+
/* @__PURE__ */ jsx5(SecondaryOptionRow, { term: "", label: "None", selected: !selectedTerm, onSelect: () => onSelect("") }),
|
|
1750
|
+
opts.map((o) => /* @__PURE__ */ jsx5(
|
|
1751
|
+
SecondaryOptionRow,
|
|
1752
|
+
{
|
|
1753
|
+
term: o.term,
|
|
1754
|
+
label: o.term,
|
|
1755
|
+
volume: o.volume,
|
|
1756
|
+
selected: o.term === selectedTerm,
|
|
1757
|
+
onSelect: () => onSelect(o.term)
|
|
1758
|
+
},
|
|
1759
|
+
o.term
|
|
1760
|
+
))
|
|
1761
|
+
] })
|
|
1762
|
+
] });
|
|
1763
|
+
}
|
|
1764
|
+
function SecondaryOptionRow({ term, label, volume, selected, onSelect }) {
|
|
1765
|
+
return /* @__PURE__ */ jsxs4(
|
|
1766
|
+
"div",
|
|
1767
|
+
{
|
|
1768
|
+
onClick: onSelect,
|
|
1769
|
+
style: {
|
|
1770
|
+
display: "flex",
|
|
1771
|
+
alignItems: "center",
|
|
1772
|
+
gap: 8,
|
|
1773
|
+
padding: "6px 8px",
|
|
1774
|
+
borderRadius: 8,
|
|
1775
|
+
cursor: "pointer",
|
|
1776
|
+
background: selected ? "rgba(0,93,172,0.06)" : "transparent",
|
|
1777
|
+
border: selected ? "1px solid rgba(0,93,172,0.2)" : "1px solid transparent",
|
|
1778
|
+
transition: "all 150ms"
|
|
1779
|
+
},
|
|
1780
|
+
children: [
|
|
1781
|
+
/* @__PURE__ */ jsx5("div", { style: {
|
|
1782
|
+
width: 14,
|
|
1783
|
+
height: 14,
|
|
1784
|
+
borderRadius: "50%",
|
|
1785
|
+
border: selected ? "none" : "2px solid #d1d5db",
|
|
1786
|
+
background: selected ? MJH_BLUE : "transparent",
|
|
1787
|
+
flexShrink: 0,
|
|
1788
|
+
display: "flex",
|
|
1789
|
+
alignItems: "center",
|
|
1790
|
+
justifyContent: "center"
|
|
1791
|
+
}, children: selected && /* @__PURE__ */ jsx5("div", { style: { width: 6, height: 6, borderRadius: "50%", background: "#ffffff" } }) }),
|
|
1792
|
+
/* @__PURE__ */ jsx5("span", { style: { fontSize: 12, fontWeight: selected ? 600 : 400, color: term ? selected ? "#00468a" : "#374151" : "#6b7280", flex: 1, minWidth: 0 }, children: label }),
|
|
1793
|
+
volume != null && /* @__PURE__ */ jsx5("span", { style: { fontSize: 11, fontWeight: 600, color: "#1f2937" }, children: volume === 0 ? "N/A" : `${abbrevVol(volume)}/mo` })
|
|
1794
|
+
]
|
|
1795
|
+
}
|
|
1796
|
+
);
|
|
1797
|
+
}
|
|
1518
1798
|
var PLACEMENT_FILTERS = [
|
|
1519
1799
|
{ key: "inBody", label: "Body", letter: "B" },
|
|
1520
1800
|
{ key: "inTitle", label: "Title", letter: "T" },
|
|
@@ -1919,10 +2199,7 @@ function SuggestedKeywordsCard({
|
|
|
1919
2199
|
} }),
|
|
1920
2200
|
/* @__PURE__ */ jsx5("span", { style: { fontSize: 12, fontWeight: kw.inContent ? 500 : 600, flexGrow: 1, color: "#1f2937" }, children: kw.term }),
|
|
1921
2201
|
enrichingTerms.has(kw.term) && /* @__PURE__ */ jsx5(LoadingBars, { size: "xs", color: "#6b7280" }),
|
|
1922
|
-
!enrichingTerms.has(kw.term) && kw.volume != null && /* @__PURE__ */
|
|
1923
|
-
abbrevVol(kw.volume),
|
|
1924
|
-
"/mo"
|
|
1925
|
-
] }),
|
|
2202
|
+
!enrichingTerms.has(kw.term) && kw.volume != null && /* @__PURE__ */ jsx5("span", { style: { fontSize: 10.5, fontWeight: 600, color: "#1f2937", flexShrink: 0 }, title: "Monthly searches", children: kw.volume === 0 ? "N/A" : `${abbrevVol(kw.volume)}/mo` }),
|
|
1926
2203
|
kw.placement && /* @__PURE__ */ jsx5(PlacementIndicators, { placement: kw.placement }),
|
|
1927
2204
|
!kw.inContent && /* @__PURE__ */ jsx5(LightbulbButton, { onClick: () => fetchHelp(kw.term), isLoading: loadingTerm === kw.term })
|
|
1928
2205
|
] }),
|
|
@@ -1998,6 +2275,8 @@ function KeywordPanel({
|
|
|
1998
2275
|
seedKeywords = [],
|
|
1999
2276
|
onSeedsChange,
|
|
2000
2277
|
onSelectPrimary,
|
|
2278
|
+
secondaryKeyword = "",
|
|
2279
|
+
onSelectSecondary,
|
|
2001
2280
|
documentFields,
|
|
2002
2281
|
documentId,
|
|
2003
2282
|
externalAnalysis
|
|
@@ -2057,7 +2336,36 @@ function KeywordPanel({
|
|
|
2057
2336
|
placement: computePlacementClient(c.term, text, documentFields)
|
|
2058
2337
|
}));
|
|
2059
2338
|
const activeTerm = candidates.find((c) => c.term === selectedPrimaryTerm) ? selectedPrimaryTerm : candidates[0]?.term ?? "";
|
|
2339
|
+
const secondaryOptions = [];
|
|
2340
|
+
const seenSecondary = /* @__PURE__ */ new Set();
|
|
2341
|
+
for (const c of candidates) {
|
|
2342
|
+
const key = c.term.toLowerCase();
|
|
2343
|
+
if (!seenSecondary.has(key)) {
|
|
2344
|
+
seenSecondary.add(key);
|
|
2345
|
+
secondaryOptions.push({ term: c.term, volume: c.volume });
|
|
2346
|
+
}
|
|
2347
|
+
}
|
|
2348
|
+
for (const kw of suggestedKeywords) {
|
|
2349
|
+
const key = kw.term.toLowerCase();
|
|
2350
|
+
if (!seenSecondary.has(key)) {
|
|
2351
|
+
seenSecondary.add(key);
|
|
2352
|
+
secondaryOptions.push({ term: kw.term, volume: kw.volume });
|
|
2353
|
+
}
|
|
2354
|
+
}
|
|
2060
2355
|
return /* @__PURE__ */ jsxs4("div", { style: { padding: 12, display: "flex", flexDirection: "column", gap: 12 }, children: [
|
|
2356
|
+
/* @__PURE__ */ jsx5("div", { style: {
|
|
2357
|
+
...cardStyle,
|
|
2358
|
+
padding: "11px 13px",
|
|
2359
|
+
background: "rgba(0,93,172,0.05)",
|
|
2360
|
+
boxShadow: "inset 0 0 0 1px rgba(0,93,172,0.12)"
|
|
2361
|
+
}, children: /* @__PURE__ */ jsxs4("div", { style: { fontSize: 11.5, color: "#1f2937", lineHeight: 1.55 }, children: [
|
|
2362
|
+
/* @__PURE__ */ jsx5("strong", { style: { color: "#00468a" }, children: "Choose your target keywords." }),
|
|
2363
|
+
" Pick one ",
|
|
2364
|
+
/* @__PURE__ */ jsx5("strong", { children: "Primary" }),
|
|
2365
|
+
" keyword (required) and, optionally, one ",
|
|
2366
|
+
/* @__PURE__ */ jsx5("strong", { children: "Secondary" }),
|
|
2367
|
+
" keyword. Copilot optimizes the whole article - title, meta, URL, headings, and images - toward both."
|
|
2368
|
+
] }) }),
|
|
2061
2369
|
onSeedsChange && /* @__PURE__ */ jsx5(SeedKeywordInput, { seeds: seedKeywords, onSeedsChange }),
|
|
2062
2370
|
/* @__PURE__ */ jsx5(
|
|
2063
2371
|
PrimaryKeywordSelector,
|
|
@@ -2071,6 +2379,14 @@ function KeywordPanel({
|
|
|
2071
2379
|
publication
|
|
2072
2380
|
}
|
|
2073
2381
|
),
|
|
2382
|
+
onSelectSecondary && secondaryOptions.length > 0 && /* @__PURE__ */ jsx5(
|
|
2383
|
+
SecondaryKeywordSelector,
|
|
2384
|
+
{
|
|
2385
|
+
options: secondaryOptions,
|
|
2386
|
+
selectedTerm: secondaryKeyword,
|
|
2387
|
+
onSelect: (term) => onSelectSecondary(term)
|
|
2388
|
+
}
|
|
2389
|
+
),
|
|
2074
2390
|
suggestedKeywords.length > 0 && /* @__PURE__ */ jsx5(
|
|
2075
2391
|
SuggestedKeywordsCard,
|
|
2076
2392
|
{
|
|
@@ -2641,12 +2957,127 @@ function TabBar({ tabs, activeTab, onTabChange }) {
|
|
|
2641
2957
|
);
|
|
2642
2958
|
}
|
|
2643
2959
|
|
|
2960
|
+
// src/components/OnboardingPopup.tsx
|
|
2961
|
+
import { Fragment as Fragment4, jsx as jsx8, jsxs as jsxs7 } from "react/jsx-runtime";
|
|
2962
|
+
function OnboardingInfoButton({ onClick }) {
|
|
2963
|
+
return /* @__PURE__ */ jsx8(
|
|
2964
|
+
"button",
|
|
2965
|
+
{
|
|
2966
|
+
onClick: (e) => {
|
|
2967
|
+
e.stopPropagation();
|
|
2968
|
+
onClick();
|
|
2969
|
+
},
|
|
2970
|
+
onMouseDown: (e) => e.stopPropagation(),
|
|
2971
|
+
style: {
|
|
2972
|
+
background: "rgba(0,93,172,0.08)",
|
|
2973
|
+
border: "none",
|
|
2974
|
+
borderRadius: "50%",
|
|
2975
|
+
width: 20,
|
|
2976
|
+
height: 20,
|
|
2977
|
+
cursor: "pointer",
|
|
2978
|
+
padding: 0,
|
|
2979
|
+
display: "flex",
|
|
2980
|
+
alignItems: "center",
|
|
2981
|
+
justifyContent: "center",
|
|
2982
|
+
color: MJH_BLUE,
|
|
2983
|
+
flexShrink: 0
|
|
2984
|
+
},
|
|
2985
|
+
title: "How SEO Copilot works",
|
|
2986
|
+
"aria-label": "How SEO Copilot works",
|
|
2987
|
+
children: /* @__PURE__ */ jsx8("svg", { width: "13", height: "13", viewBox: "0 0 20 20", fill: "currentColor", "aria-hidden": "true", children: /* @__PURE__ */ jsx8("path", { fillRule: "evenodd", d: "M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-7-4a1 1 0 11-2 0 1 1 0 012 0zM9 9a.75.75 0 000 1.5h.253a.25.25 0 01.244.304l-.459 2.066A1.75 1.75 0 0010.747 15H11a.75.75 0 000-1.5h-.253a.25.25 0 01-.244-.304l.459-2.066A1.75 1.75 0 009.253 9H9z", clipRule: "evenodd" }) })
|
|
2988
|
+
}
|
|
2989
|
+
);
|
|
2990
|
+
}
|
|
2991
|
+
function OnboardingCard({ onDismiss, closing }) {
|
|
2992
|
+
return /* @__PURE__ */ jsxs7(Fragment4, { children: [
|
|
2993
|
+
/* @__PURE__ */ jsx8(
|
|
2994
|
+
"div",
|
|
2995
|
+
{
|
|
2996
|
+
onClick: onDismiss,
|
|
2997
|
+
style: {
|
|
2998
|
+
position: "absolute",
|
|
2999
|
+
inset: 0,
|
|
3000
|
+
zIndex: 60,
|
|
3001
|
+
background: "transparent",
|
|
3002
|
+
cursor: "pointer"
|
|
3003
|
+
}
|
|
3004
|
+
}
|
|
3005
|
+
),
|
|
3006
|
+
/* @__PURE__ */ jsxs7(
|
|
3007
|
+
"div",
|
|
3008
|
+
{
|
|
3009
|
+
onClick: (e) => e.stopPropagation(),
|
|
3010
|
+
style: {
|
|
3011
|
+
position: "absolute",
|
|
3012
|
+
top: 50,
|
|
3013
|
+
right: 10,
|
|
3014
|
+
left: 10,
|
|
3015
|
+
maxWidth: 320,
|
|
3016
|
+
marginLeft: "auto",
|
|
3017
|
+
zIndex: 61,
|
|
3018
|
+
borderRadius: 18,
|
|
3019
|
+
padding: "14px 16px 16px",
|
|
3020
|
+
// Amorphous blue glass
|
|
3021
|
+
background: "linear-gradient(155deg, rgba(0,93,172,0.16), rgba(0,93,172,0.08))",
|
|
3022
|
+
backdropFilter: "blur(20px) saturate(170%)",
|
|
3023
|
+
WebkitBackdropFilter: "blur(20px) saturate(170%)",
|
|
3024
|
+
boxShadow: "inset 0 0 0 1px rgba(255,255,255,0.55), inset 1.5px 2px 1px -1px rgba(255,255,255,0.9), 0 10px 30px rgba(0,93,172,0.22), 0 2px 8px rgba(0,0,0,0.12)",
|
|
3025
|
+
animation: `${closing ? "onboard-out" : "onboard-in"} ${closing ? 180 : 240}ms ease-out forwards`
|
|
3026
|
+
},
|
|
3027
|
+
children: [
|
|
3028
|
+
/* @__PURE__ */ jsxs7("div", { style: { display: "flex", alignItems: "center", justifyContent: "space-between", gap: 8, marginBottom: 6 }, children: [
|
|
3029
|
+
/* @__PURE__ */ jsx8("span", { style: { fontSize: 13, fontWeight: 800, color: "#00468a", letterSpacing: "-0.01em" }, children: "Welcome to SEO Copilot" }),
|
|
3030
|
+
/* @__PURE__ */ jsx8(
|
|
3031
|
+
"button",
|
|
3032
|
+
{
|
|
3033
|
+
onClick: onDismiss,
|
|
3034
|
+
style: { background: "none", border: "none", cursor: "pointer", padding: 2, display: "flex", color: "#00468a", opacity: 0.7 },
|
|
3035
|
+
title: "Dismiss",
|
|
3036
|
+
"aria-label": "Dismiss",
|
|
3037
|
+
children: /* @__PURE__ */ jsx8("svg", { width: "14", height: "14", viewBox: "0 0 20 20", fill: "currentColor", children: /* @__PURE__ */ jsx8("path", { d: "M6.28 5.22a.75.75 0 00-1.06 1.06L8.94 10l-3.72 3.72a.75.75 0 101.06 1.06L10 11.06l3.72 3.72a.75.75 0 101.06-1.06L11.06 10l3.72-3.72a.75.75 0 00-1.06-1.06L10 8.94 6.28 5.22z" }) })
|
|
3038
|
+
}
|
|
3039
|
+
)
|
|
3040
|
+
] }),
|
|
3041
|
+
/* @__PURE__ */ jsxs7("div", { style: { fontSize: 11.5, color: "#13335a", lineHeight: 1.6 }, children: [
|
|
3042
|
+
"Start on the ",
|
|
3043
|
+
/* @__PURE__ */ jsx8("strong", { children: "Keywords" }),
|
|
3044
|
+
" tab. Choose one ",
|
|
3045
|
+
/* @__PURE__ */ jsx8("strong", { children: "Primary" }),
|
|
3046
|
+
" keyword (required) and, optionally, one ",
|
|
3047
|
+
/* @__PURE__ */ jsx8("strong", { children: "Secondary" }),
|
|
3048
|
+
" keyword. Copilot then optimizes the whole article - title, meta, URL, headings, and images - toward both."
|
|
3049
|
+
] }),
|
|
3050
|
+
/* @__PURE__ */ jsx8(
|
|
3051
|
+
"button",
|
|
3052
|
+
{
|
|
3053
|
+
onClick: onDismiss,
|
|
3054
|
+
style: {
|
|
3055
|
+
marginTop: 12,
|
|
3056
|
+
width: "100%",
|
|
3057
|
+
padding: "7px 12px",
|
|
3058
|
+
fontSize: 11.5,
|
|
3059
|
+
fontWeight: 700,
|
|
3060
|
+
color: "#ffffff",
|
|
3061
|
+
background: MJH_BLUE,
|
|
3062
|
+
border: "none",
|
|
3063
|
+
borderRadius: 8,
|
|
3064
|
+
cursor: "pointer"
|
|
3065
|
+
},
|
|
3066
|
+
children: "Got it"
|
|
3067
|
+
}
|
|
3068
|
+
)
|
|
3069
|
+
]
|
|
3070
|
+
}
|
|
3071
|
+
)
|
|
3072
|
+
] });
|
|
3073
|
+
}
|
|
3074
|
+
|
|
2644
3075
|
// src/components/tabs/SummaryTab.tsx
|
|
2645
3076
|
import { useMemo, useState as useState12 } from "react";
|
|
2646
3077
|
|
|
2647
3078
|
// src/components/ShimmerLoader.tsx
|
|
2648
3079
|
import { useEffect as useEffect9, useState as useState11 } from "react";
|
|
2649
|
-
import { jsx as
|
|
3080
|
+
import { jsx as jsx9, jsxs as jsxs8 } from "react/jsx-runtime";
|
|
2650
3081
|
var keyframesInjected = false;
|
|
2651
3082
|
var KEYFRAMES = `
|
|
2652
3083
|
@keyframes seo-copilot-text-shimmer {
|
|
@@ -2655,13 +3086,13 @@ var KEYFRAMES = `
|
|
|
2655
3086
|
}
|
|
2656
3087
|
`;
|
|
2657
3088
|
function LoaderBars({ color = MJH_GOLD }) {
|
|
2658
|
-
return /* @__PURE__ */
|
|
3089
|
+
return /* @__PURE__ */ jsx9(
|
|
2659
3090
|
"div",
|
|
2660
3091
|
{
|
|
2661
3092
|
role: "status",
|
|
2662
3093
|
"aria-label": "Loading",
|
|
2663
3094
|
style: { display: "inline-flex", alignItems: "flex-end", gap: 2, height: 14, flexShrink: 0 },
|
|
2664
|
-
children: [1, 2, 3].map((i) => /* @__PURE__ */
|
|
3095
|
+
children: [1, 2, 3].map((i) => /* @__PURE__ */ jsx9(
|
|
2665
3096
|
"div",
|
|
2666
3097
|
{
|
|
2667
3098
|
style: {
|
|
@@ -2701,7 +3132,7 @@ function ShimmerLoader({
|
|
|
2701
3132
|
return () => clearInterval(id);
|
|
2702
3133
|
}, [messages.length, intervalMs]);
|
|
2703
3134
|
const text = messages[idx] || messages[0] || "";
|
|
2704
|
-
return /* @__PURE__ */
|
|
3135
|
+
return /* @__PURE__ */ jsxs8(
|
|
2705
3136
|
"div",
|
|
2706
3137
|
{
|
|
2707
3138
|
style: {
|
|
@@ -2713,8 +3144,8 @@ function ShimmerLoader({
|
|
|
2713
3144
|
letterSpacing: "0.01em"
|
|
2714
3145
|
},
|
|
2715
3146
|
children: [
|
|
2716
|
-
/* @__PURE__ */
|
|
2717
|
-
/* @__PURE__ */
|
|
3147
|
+
/* @__PURE__ */ jsx9(LoaderBars, { color: iconColor }),
|
|
3148
|
+
/* @__PURE__ */ jsx9(
|
|
2718
3149
|
"span",
|
|
2719
3150
|
{
|
|
2720
3151
|
style: {
|
|
@@ -2744,7 +3175,13 @@ var DEFAULT_GENERATE_ALL_MESSAGES = [
|
|
|
2744
3175
|
];
|
|
2745
3176
|
|
|
2746
3177
|
// src/lib/scoring.ts
|
|
2747
|
-
function
|
|
3178
|
+
function countWholeMatches(haystack, needle) {
|
|
3179
|
+
if (!needle) return 0;
|
|
3180
|
+
const esc = needle.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
3181
|
+
const m = haystack.match(new RegExp(`\\b${esc}\\b`, "g"));
|
|
3182
|
+
return m ? m.length : 0;
|
|
3183
|
+
}
|
|
3184
|
+
function calculateContentScoreDetailed(content, analysis, documentFields) {
|
|
2748
3185
|
if (!content || !analysis) {
|
|
2749
3186
|
return { total: 0, components: [] };
|
|
2750
3187
|
}
|
|
@@ -2753,23 +3190,34 @@ function calculateContentScoreDetailed(content, analysis) {
|
|
|
2753
3190
|
const components = [];
|
|
2754
3191
|
const primaryTerm = (analysis.primaryKeyword?.term || "").toLowerCase();
|
|
2755
3192
|
if (primaryTerm) {
|
|
2756
|
-
const
|
|
2757
|
-
const
|
|
2758
|
-
|
|
2759
|
-
|
|
3193
|
+
const tokens = primaryTerm.split(/\s+/).filter((t) => t.length > 1);
|
|
3194
|
+
const phraseCount = countWholeMatches(lowerContent, primaryTerm);
|
|
3195
|
+
let occurrences = phraseCount;
|
|
3196
|
+
let viaTokens = false;
|
|
3197
|
+
if (phraseCount === 0 && tokens.length > 0) {
|
|
3198
|
+
const counts = tokens.map((t) => countWholeMatches(lowerContent, t));
|
|
3199
|
+
if (counts.every((c) => c > 0)) {
|
|
3200
|
+
occurrences = Math.min(...counts);
|
|
3201
|
+
viaTokens = true;
|
|
3202
|
+
}
|
|
3203
|
+
}
|
|
3204
|
+
const primaryWordCount = Math.max(1, primaryTerm.split(/\s+/).filter(Boolean).length);
|
|
2760
3205
|
let pts = 0;
|
|
2761
3206
|
let detail;
|
|
2762
|
-
if (
|
|
3207
|
+
if (occurrences === 0) {
|
|
2763
3208
|
detail = `Primary keyword "${primaryTerm}" not found in content`;
|
|
2764
3209
|
} else {
|
|
2765
3210
|
pts += 12;
|
|
2766
|
-
const density = words > 0 ?
|
|
3211
|
+
const density = words > 0 ? (viaTokens ? occurrences : occurrences * primaryWordCount) / words * 100 : 0;
|
|
2767
3212
|
if (density >= 0.5 && density <= 2.5) {
|
|
2768
3213
|
pts += 13;
|
|
2769
3214
|
detail = `Primary keyword present, density ${density.toFixed(2)}% (ideal range)`;
|
|
2770
3215
|
} else if (density < 0.5) {
|
|
2771
3216
|
pts += 7;
|
|
2772
3217
|
detail = `Primary keyword present but density only ${density.toFixed(2)}% - aim for 0.5-2.5%`;
|
|
3218
|
+
} else if (viaTokens && density <= 6) {
|
|
3219
|
+
pts += 11;
|
|
3220
|
+
detail = `Primary keyword strongly represented (${density.toFixed(2)}%)`;
|
|
2773
3221
|
} else {
|
|
2774
3222
|
pts += 4;
|
|
2775
3223
|
detail = `Primary keyword over-used at ${density.toFixed(2)}% density - reduce to 0.5-2.5%`;
|
|
@@ -2808,10 +3256,19 @@ function calculateContentScoreDetailed(content, analysis) {
|
|
|
2808
3256
|
wcDetail = `${words} words - start writing`;
|
|
2809
3257
|
}
|
|
2810
3258
|
components.push({ label: "Word count", points: wcPts, max: 15, detail: wcDetail });
|
|
2811
|
-
|
|
2812
|
-
|
|
3259
|
+
let hasH1orTitle;
|
|
3260
|
+
let hasSubheadings;
|
|
3261
|
+
if (documentFields) {
|
|
3262
|
+
hasH1orTitle = !!(documentFields.title && documentFields.title.trim());
|
|
3263
|
+
const det = documentFields.headingsDetailed;
|
|
3264
|
+
const detHasSub = Array.isArray(det) && det.some((h) => h.level >= 2);
|
|
3265
|
+
hasSubheadings = detHasSub || (documentFields.headings?.length || 0) > 0;
|
|
3266
|
+
} else {
|
|
3267
|
+
hasH1orTitle = /^#\s|<h1/im.test(content);
|
|
3268
|
+
hasSubheadings = /^##\s|^###\s|<h2|<h3/im.test(content);
|
|
3269
|
+
}
|
|
2813
3270
|
const structurePts = (hasH1orTitle ? 5 : 0) + (hasSubheadings ? 5 : 0);
|
|
2814
|
-
const structureDetail = !hasH1orTitle && !hasSubheadings ? "No
|
|
3271
|
+
const structureDetail = !hasH1orTitle && !hasSubheadings ? "No title or subheadings detected" : !hasSubheadings ? "Has a title but no H2/H3 subheadings - add section headings" : !hasH1orTitle ? "Has subheadings but no title" : "Title and subheadings present";
|
|
2815
3272
|
components.push({ label: "Heading structure", points: structurePts, max: 10, detail: structureDetail });
|
|
2816
3273
|
const missingCount = (analysis.missingKeywords || []).length;
|
|
2817
3274
|
let mPts = 0;
|
|
@@ -2829,13 +3286,16 @@ function calculateContentScoreDetailed(content, analysis) {
|
|
|
2829
3286
|
mDetail = `${missingCount} suggested keywords missing - significant gaps`;
|
|
2830
3287
|
}
|
|
2831
3288
|
components.push({ label: "Missing keyword gap", points: mPts, max: 15, detail: mDetail });
|
|
3289
|
+
let qCount;
|
|
3290
|
+
if (documentFields) {
|
|
3291
|
+
qCount = (documentFields.headings || []).filter((h) => h.trim().endsWith("?")).length;
|
|
3292
|
+
} else {
|
|
3293
|
+
qCount = (content.match(/^#{1,6}\s+.*\?$/gm) || []).length + (content.match(/<h[1-6][^>]*>.*\?<\/h[1-6]>/gi) || []).length;
|
|
3294
|
+
}
|
|
2832
3295
|
let aeoPts = 0;
|
|
2833
|
-
|
|
2834
|
-
|
|
2835
|
-
if (qCount
|
|
2836
|
-
else if (qCount === 2) aeoPts += 4;
|
|
2837
|
-
else if (qCount === 1) aeoPts += 2;
|
|
2838
|
-
if (qCount > 0) aeoPts += 4;
|
|
3296
|
+
if (qCount >= 3) aeoPts = 10;
|
|
3297
|
+
else if (qCount === 2) aeoPts = 7;
|
|
3298
|
+
else if (qCount === 1) aeoPts = 4;
|
|
2839
3299
|
const aeoDetail = qCount === 0 ? "No question-style headings - AI answer engines favor them" : `${qCount} question heading${qCount === 1 ? "" : "s"}`;
|
|
2840
3300
|
components.push({ label: "AEO signals", points: aeoPts, max: 10, detail: aeoDetail });
|
|
2841
3301
|
const total = components.reduce((sum, c) => sum + c.points, 0);
|
|
@@ -2850,10 +3310,33 @@ function tokensContain(haystack, needle) {
|
|
|
2850
3310
|
const lower = haystack.toLowerCase();
|
|
2851
3311
|
return tokens.every((t) => lower.includes(t));
|
|
2852
3312
|
}
|
|
3313
|
+
function keywordLeadsSlug(slug, primaryKeyword) {
|
|
3314
|
+
const slugWords = slug.toLowerCase().replace(/[^a-z0-9]+/g, " ").trim().split(/\s+/).filter(Boolean);
|
|
3315
|
+
const tokens = primaryKeyword.toLowerCase().split(/\s+/).filter((t) => t.length > 1);
|
|
3316
|
+
if (tokens.length === 0 || slugWords.length === 0) return true;
|
|
3317
|
+
let earliest = Infinity;
|
|
3318
|
+
for (const t of tokens) {
|
|
3319
|
+
const idx = slugWords.findIndex((w) => w.includes(t));
|
|
3320
|
+
if (idx >= 0) earliest = Math.min(earliest, idx);
|
|
3321
|
+
}
|
|
3322
|
+
return earliest <= 2;
|
|
3323
|
+
}
|
|
3324
|
+
function isShortFormContent(documentFields, title) {
|
|
3325
|
+
const cat = (documentFields?.contentCategory || "").toLowerCase().trim();
|
|
3326
|
+
if (/^(videos?|podcasts?|episodes?|webinars?|video series|peer exchange)$/.test(cat)) return true;
|
|
3327
|
+
const shortFormCats = /* @__PURE__ */ new Set(["news", "brief", "preview", "recap", "update", "announcement", "roundup", "digest", "interview"]);
|
|
3328
|
+
const catTokens = cat.split(/[^a-z]+/).filter(Boolean);
|
|
3329
|
+
if (catTokens.some((tok) => shortFormCats.has(tok))) return true;
|
|
3330
|
+
const t = (title || "").toLowerCase();
|
|
3331
|
+
if (/\b(preview|recap|roundup|digest)\b/.test(t)) return true;
|
|
3332
|
+
if (/:\s*\d+\s+(trials|things|takeaways|highlights|tips|questions|charts)/.test(t)) return true;
|
|
3333
|
+
return false;
|
|
3334
|
+
}
|
|
2853
3335
|
function buildSummaryItems(input) {
|
|
2854
3336
|
const items = [];
|
|
2855
3337
|
const { analysis, deepAnalysis, documentFields, linkingSuggestions, linkCheckResults, text } = input;
|
|
2856
|
-
const primaryKeyword = analysis?.primaryKeyword?.term;
|
|
3338
|
+
const primaryKeyword = input.primaryKeyword || analysis?.primaryKeyword?.term;
|
|
3339
|
+
const secondaryKeyword = input.secondaryKeyword || "";
|
|
2857
3340
|
const title = documentFields?.title;
|
|
2858
3341
|
if (!title) {
|
|
2859
3342
|
items.push({
|
|
@@ -2949,39 +3432,40 @@ function buildSummaryItems(input) {
|
|
|
2949
3432
|
items.push({
|
|
2950
3433
|
id: "meta-slug-missing",
|
|
2951
3434
|
category: "meta",
|
|
2952
|
-
severity: "
|
|
3435
|
+
severity: "warning",
|
|
2953
3436
|
label: "URL slug missing",
|
|
2954
3437
|
description: "No URL slug set.",
|
|
2955
|
-
howToFix: "Add a
|
|
2956
|
-
jumpTo: { tab: "
|
|
3438
|
+
howToFix: "Add a short, descriptive slug that leads with your primary keyword.",
|
|
3439
|
+
jumpTo: { tab: "technical", anchorId: "anchor-url-slug" }
|
|
2957
3440
|
});
|
|
2958
3441
|
} else {
|
|
2959
|
-
|
|
3442
|
+
const slugAsWords = slug.replace(/-/g, " ");
|
|
3443
|
+
if (primaryKeyword && !tokensContain(slugAsWords, primaryKeyword)) {
|
|
2960
3444
|
items.push({
|
|
2961
|
-
id: "meta-slug-
|
|
3445
|
+
id: "meta-slug-no-keyword",
|
|
2962
3446
|
category: "meta",
|
|
2963
|
-
severity: "
|
|
2964
|
-
label: "
|
|
2965
|
-
description: `
|
|
2966
|
-
howToFix: "
|
|
2967
|
-
jumpTo: { tab: "
|
|
3447
|
+
severity: "opportunity",
|
|
3448
|
+
label: "Primary keyword not in URL",
|
|
3449
|
+
description: `The URL doesn't include "${primaryKeyword}".`,
|
|
3450
|
+
howToFix: "Work the primary keyword into the URL, ideally at the start. Keep the URL short and descriptive.",
|
|
3451
|
+
jumpTo: { tab: "technical", anchorId: "anchor-url-slug" }
|
|
2968
3452
|
});
|
|
2969
|
-
}
|
|
2970
|
-
if (primaryKeyword && !tokensContain(slug.replace(/-/g, " "), primaryKeyword)) {
|
|
3453
|
+
} else if (primaryKeyword && !keywordLeadsSlug(slug, primaryKeyword)) {
|
|
2971
3454
|
items.push({
|
|
2972
|
-
id: "meta-slug-
|
|
3455
|
+
id: "meta-slug-keyword-late",
|
|
2973
3456
|
category: "meta",
|
|
2974
3457
|
severity: "opportunity",
|
|
2975
|
-
label: "Primary keyword
|
|
2976
|
-
description: `
|
|
2977
|
-
howToFix: "
|
|
2978
|
-
jumpTo: { tab: "
|
|
3458
|
+
label: "Primary keyword late in URL",
|
|
3459
|
+
description: `"${primaryKeyword}" is in the URL but not near the start.`,
|
|
3460
|
+
howToFix: "Lead the URL with the primary keyword so it stays visible if the address gets shortened.",
|
|
3461
|
+
jumpTo: { tab: "technical", anchorId: "anchor-url-slug" }
|
|
2979
3462
|
});
|
|
2980
3463
|
}
|
|
2981
3464
|
}
|
|
2982
3465
|
const wordCount2 = text ? text.trim().split(/\s+/).filter(Boolean).length : 0;
|
|
3466
|
+
const isShortForm = isShortFormContent(documentFields, title);
|
|
2983
3467
|
if (wordCount2 === 0) {
|
|
2984
|
-
} else if (wordCount2 < 450) {
|
|
3468
|
+
} else if (wordCount2 < 450 && !isShortForm) {
|
|
2985
3469
|
items.push({
|
|
2986
3470
|
id: "content-too-short",
|
|
2987
3471
|
category: "content",
|
|
@@ -2991,20 +3475,20 @@ function buildSummaryItems(input) {
|
|
|
2991
3475
|
howToFix: "Add more body text. A link or image on its own doesn't count - the article needs real written substance.",
|
|
2992
3476
|
jumpTo: { tab: "technical", anchorId: "anchor-word-count" }
|
|
2993
3477
|
});
|
|
2994
|
-
} else if (wordCount2 < 1500) {
|
|
3478
|
+
} else if (wordCount2 < 1500 && !isShortForm) {
|
|
2995
3479
|
items.push({
|
|
2996
3480
|
id: "content-short-for-clinical",
|
|
2997
3481
|
category: "content",
|
|
2998
|
-
severity: "
|
|
3482
|
+
severity: "opportunity",
|
|
2999
3483
|
label: "Article could be longer",
|
|
3000
|
-
description: `${wordCount2} words. 1,500+
|
|
3001
|
-
howToFix: "
|
|
3484
|
+
description: `${wordCount2} words. For evergreen clinical topics 1,500+ tends to rank better - news, previews, and briefs are fine shorter.`,
|
|
3485
|
+
howToFix: "If this is an in-depth clinical piece, expand with citations, comparative data, or guideline references. For news or previews, this length is appropriate.",
|
|
3002
3486
|
jumpTo: { tab: "technical", anchorId: "anchor-word-count" }
|
|
3003
3487
|
});
|
|
3004
3488
|
}
|
|
3005
3489
|
const headings = documentFields?.headings || [];
|
|
3006
3490
|
const headingsDetailed = documentFields?.headingsDetailed;
|
|
3007
|
-
const h2Count = headingsDetailed ? headingsDetailed.filter((h) => h.level === 2).length : headings.length;
|
|
3491
|
+
const h2Count = headingsDetailed ? headingsDetailed.filter((h) => h.level === 2 || h.level === 3).length : headings.length;
|
|
3008
3492
|
if (headings.length === 0 && wordCount2 > 200 && wordCount2 < 1e3) {
|
|
3009
3493
|
items.push({
|
|
3010
3494
|
id: "headings-missing",
|
|
@@ -3144,7 +3628,7 @@ function buildSummaryItems(input) {
|
|
|
3144
3628
|
}
|
|
3145
3629
|
const imageTitleCount = (documentFields?.imageTitles || []).length;
|
|
3146
3630
|
const totalImageCount = documentFields?.imageCount ?? 0;
|
|
3147
|
-
const missingTitles = totalImageCount > 0 ? totalImageCount - imageTitleCount : 0;
|
|
3631
|
+
const missingTitles = totalImageCount > 0 && imageTitleCount > 0 ? totalImageCount - imageTitleCount : 0;
|
|
3148
3632
|
if (missingTitles > 0) {
|
|
3149
3633
|
items.push({
|
|
3150
3634
|
id: "images-titles-missing",
|
|
@@ -3169,9 +3653,70 @@ function buildSummaryItems(input) {
|
|
|
3169
3653
|
jumpTo: { tab: "keywords" }
|
|
3170
3654
|
});
|
|
3171
3655
|
}
|
|
3656
|
+
const primaryVolume = analysis?.primaryKeyword?.volume;
|
|
3657
|
+
if (deepAnalysis && primaryVolume === 0) {
|
|
3658
|
+
items.push({
|
|
3659
|
+
id: "keywords-primary-zero-volume",
|
|
3660
|
+
category: "keywords",
|
|
3661
|
+
severity: "warning",
|
|
3662
|
+
label: "Primary keyword has no search volume",
|
|
3663
|
+
description: `"${primaryKeyword}" shows no measurable monthly searches, so even ranking #1 brings little traffic.`,
|
|
3664
|
+
howToFix: "Pick a primary people actually search for - check your supporting keywords for higher-volume options, or set a new primary on the Keywords tab.",
|
|
3665
|
+
jumpTo: { tab: "keywords" }
|
|
3666
|
+
});
|
|
3667
|
+
}
|
|
3172
3668
|
}
|
|
3173
|
-
|
|
3174
|
-
|
|
3669
|
+
if (secondaryKeyword) {
|
|
3670
|
+
if (text && !tokensContain(text, secondaryKeyword)) {
|
|
3671
|
+
items.push({
|
|
3672
|
+
id: "secondary-not-in-body",
|
|
3673
|
+
category: "keywords",
|
|
3674
|
+
severity: "opportunity",
|
|
3675
|
+
label: "Secondary keyword not in body",
|
|
3676
|
+
description: `Your secondary keyword "${secondaryKeyword}" doesn't appear in the article body.`,
|
|
3677
|
+
howToFix: "Work the secondary keyword into a body paragraph or two where it reads naturally.",
|
|
3678
|
+
jumpTo: { tab: "keywords" }
|
|
3679
|
+
});
|
|
3680
|
+
}
|
|
3681
|
+
const titleVal = documentFields?.title;
|
|
3682
|
+
if (titleVal && !tokensContain(titleVal, secondaryKeyword)) {
|
|
3683
|
+
items.push({
|
|
3684
|
+
id: "secondary-not-in-title",
|
|
3685
|
+
category: "meta",
|
|
3686
|
+
severity: "opportunity",
|
|
3687
|
+
label: "Secondary keyword not in title",
|
|
3688
|
+
description: `The title leads with the primary keyword but doesn't include "${secondaryKeyword}".`,
|
|
3689
|
+
howToFix: "If it fits naturally, include the secondary keyword in the title too - but never at the cost of the primary leading.",
|
|
3690
|
+
jumpTo: { tab: "meta", anchorId: "anchor-meta-title" }
|
|
3691
|
+
});
|
|
3692
|
+
}
|
|
3693
|
+
const metaVal = documentFields?.metaDescription;
|
|
3694
|
+
if (metaVal && !tokensContain(metaVal, secondaryKeyword)) {
|
|
3695
|
+
items.push({
|
|
3696
|
+
id: "secondary-not-in-meta",
|
|
3697
|
+
category: "meta",
|
|
3698
|
+
severity: "opportunity",
|
|
3699
|
+
label: "Secondary keyword not in meta description",
|
|
3700
|
+
description: `The meta description doesn't include "${secondaryKeyword}".`,
|
|
3701
|
+
howToFix: "Add the secondary keyword to the meta description if it reads naturally.",
|
|
3702
|
+
jumpTo: { tab: "meta", anchorId: "anchor-meta-description" }
|
|
3703
|
+
});
|
|
3704
|
+
}
|
|
3705
|
+
const slugVal = documentFields?.slug;
|
|
3706
|
+
if (slugVal && !tokensContain(slugVal.replace(/-/g, " "), secondaryKeyword)) {
|
|
3707
|
+
items.push({
|
|
3708
|
+
id: "secondary-not-in-url",
|
|
3709
|
+
category: "meta",
|
|
3710
|
+
severity: "opportunity",
|
|
3711
|
+
label: "Secondary keyword not in URL",
|
|
3712
|
+
description: `The URL doesn't include "${secondaryKeyword}".`,
|
|
3713
|
+
howToFix: "Optionally include the secondary keyword in the URL after the primary - only if the slug stays short and clean.",
|
|
3714
|
+
jumpTo: { tab: "technical", anchorId: "anchor-url-slug" }
|
|
3715
|
+
});
|
|
3716
|
+
}
|
|
3717
|
+
}
|
|
3718
|
+
const actualQuestionHeadings = (documentFields?.headings || []).filter((h) => h.trim().endsWith("?"));
|
|
3719
|
+
if (deepAnalysis && actualQuestionHeadings.length === 0 && wordCount2 > 300) {
|
|
3175
3720
|
items.push({
|
|
3176
3721
|
id: "aeo-no-question-headings",
|
|
3177
3722
|
category: "aeo",
|
|
@@ -3219,6 +3764,18 @@ function buildSummaryItems(input) {
|
|
|
3219
3764
|
jumpTo: { tab: "technical", anchorId: "anchor-link-check" }
|
|
3220
3765
|
});
|
|
3221
3766
|
}
|
|
3767
|
+
const unverified = linkCheckResults.filter((r) => r.category === "unverified");
|
|
3768
|
+
if (unverified.length > 0) {
|
|
3769
|
+
items.push({
|
|
3770
|
+
id: "unverified-links",
|
|
3771
|
+
category: "technical",
|
|
3772
|
+
severity: "warning",
|
|
3773
|
+
label: `${unverified.length} link${unverified.length === 1 ? "" : "s"} couldn't be auto-verified`,
|
|
3774
|
+
description: `${unverified.length} link${unverified.length === 1 ? " was" : "s were"} blocked by an anti-bot wall (401/403/429) - the URLs may work fine for readers, our server just couldn't confirm.`,
|
|
3775
|
+
howToFix: "Open each one manually in a new tab to confirm it loads, then ignore the warning if it does.",
|
|
3776
|
+
jumpTo: { tab: "technical", anchorId: "anchor-link-check" }
|
|
3777
|
+
});
|
|
3778
|
+
}
|
|
3222
3779
|
}
|
|
3223
3780
|
if (deepAnalysis) {
|
|
3224
3781
|
const readability = deepAnalysis.readabilityNotes || [];
|
|
@@ -3268,7 +3825,7 @@ function buildSummaryItems(input) {
|
|
|
3268
3825
|
}
|
|
3269
3826
|
|
|
3270
3827
|
// src/components/tabs/SummaryTab.tsx
|
|
3271
|
-
import { Fragment as
|
|
3828
|
+
import { Fragment as Fragment5, jsx as jsx10, jsxs as jsxs9 } from "react/jsx-runtime";
|
|
3272
3829
|
var cardStyle2 = {
|
|
3273
3830
|
borderRadius: 14,
|
|
3274
3831
|
background: "rgba(255,255,255,0.55)",
|
|
@@ -3292,9 +3849,9 @@ function scoreColors(score) {
|
|
|
3292
3849
|
}
|
|
3293
3850
|
function ScoreBadge({ score, breakdown }) {
|
|
3294
3851
|
const c = scoreColors(score);
|
|
3295
|
-
return /* @__PURE__ */
|
|
3296
|
-
/* @__PURE__ */
|
|
3297
|
-
/* @__PURE__ */
|
|
3852
|
+
return /* @__PURE__ */ jsxs9("div", { style: cardStyle2, children: [
|
|
3853
|
+
/* @__PURE__ */ jsxs9("div", { style: { display: "flex", alignItems: "center", gap: 14 }, children: [
|
|
3854
|
+
/* @__PURE__ */ jsxs9(
|
|
3298
3855
|
"div",
|
|
3299
3856
|
{
|
|
3300
3857
|
style: {
|
|
@@ -3310,30 +3867,30 @@ function ScoreBadge({ score, breakdown }) {
|
|
|
3310
3867
|
lineHeight: 1
|
|
3311
3868
|
},
|
|
3312
3869
|
children: [
|
|
3313
|
-
/* @__PURE__ */
|
|
3314
|
-
/* @__PURE__ */
|
|
3870
|
+
/* @__PURE__ */ jsx10("span", { style: { fontSize: 20, fontWeight: 700, color: c.text }, children: score }),
|
|
3871
|
+
/* @__PURE__ */ jsx10("span", { style: { fontSize: 8, fontWeight: 700, color: c.text, opacity: 0.7, letterSpacing: "0.06em", marginTop: 2 }, children: "/ 100" })
|
|
3315
3872
|
]
|
|
3316
3873
|
}
|
|
3317
3874
|
),
|
|
3318
|
-
/* @__PURE__ */
|
|
3319
|
-
/* @__PURE__ */
|
|
3320
|
-
/* @__PURE__ */
|
|
3875
|
+
/* @__PURE__ */ jsxs9("div", { style: { flex: 1, minWidth: 0 }, children: [
|
|
3876
|
+
/* @__PURE__ */ jsx10("div", { style: { fontSize: 10.5, textTransform: "uppercase", letterSpacing: "0.06em", color: "#4b5563", fontWeight: 600, marginBottom: 2 }, children: "Content Score" }),
|
|
3877
|
+
/* @__PURE__ */ jsx10("div", { style: { fontSize: 14, fontWeight: 700, color: c.text }, children: c.label })
|
|
3321
3878
|
] })
|
|
3322
3879
|
] }),
|
|
3323
|
-
breakdown.length > 0 && /* @__PURE__ */
|
|
3880
|
+
breakdown.length > 0 && /* @__PURE__ */ jsx10("div", { style: { marginTop: 12, display: "flex", flexDirection: "column", gap: 8 }, children: breakdown.map((comp, i) => {
|
|
3324
3881
|
const pct = comp.max > 0 ? comp.points / comp.max * 100 : 0;
|
|
3325
3882
|
const barColor = pct >= 75 ? "#16a34a" : pct >= 40 ? "#E6C01B" : "#dc2626";
|
|
3326
|
-
return /* @__PURE__ */
|
|
3327
|
-
/* @__PURE__ */
|
|
3328
|
-
/* @__PURE__ */
|
|
3329
|
-
/* @__PURE__ */
|
|
3883
|
+
return /* @__PURE__ */ jsxs9("div", { children: [
|
|
3884
|
+
/* @__PURE__ */ jsxs9("div", { style: { display: "flex", justifyContent: "space-between", alignItems: "baseline", marginBottom: 3 }, children: [
|
|
3885
|
+
/* @__PURE__ */ jsx10("span", { style: { fontSize: 11, fontWeight: 600, color: "#1f2937" }, children: comp.label }),
|
|
3886
|
+
/* @__PURE__ */ jsxs9("span", { style: { fontSize: 11, color: "#4b5563", fontVariantNumeric: "tabular-nums" }, children: [
|
|
3330
3887
|
comp.points,
|
|
3331
3888
|
" / ",
|
|
3332
3889
|
comp.max
|
|
3333
3890
|
] })
|
|
3334
3891
|
] }),
|
|
3335
|
-
/* @__PURE__ */
|
|
3336
|
-
/* @__PURE__ */
|
|
3892
|
+
/* @__PURE__ */ jsx10("div", { style: { height: 4, background: "#f1f5f9", borderRadius: 99, overflow: "hidden", marginBottom: 4 }, children: /* @__PURE__ */ jsx10("div", { style: { width: `${pct}%`, height: "100%", background: barColor, transition: "width 200ms" } }) }),
|
|
3893
|
+
/* @__PURE__ */ jsx10("div", { style: { fontSize: 10.5, color: "#4b5563", lineHeight: 1.4 }, children: comp.detail })
|
|
3337
3894
|
] }, i);
|
|
3338
3895
|
}) })
|
|
3339
3896
|
] });
|
|
@@ -3347,7 +3904,7 @@ function ItemCard({ item, onClick }) {
|
|
|
3347
3904
|
const v = severityVisual(item.severity);
|
|
3348
3905
|
const tab = item.jumpTo.tab;
|
|
3349
3906
|
const tabLabel = TAB_LABEL[tab] ?? tab.charAt(0).toUpperCase() + tab.slice(1);
|
|
3350
|
-
return /* @__PURE__ */
|
|
3907
|
+
return /* @__PURE__ */ jsxs9(
|
|
3351
3908
|
"div",
|
|
3352
3909
|
{
|
|
3353
3910
|
onClick,
|
|
@@ -3364,8 +3921,8 @@ function ItemCard({ item, onClick }) {
|
|
|
3364
3921
|
cursor: "pointer"
|
|
3365
3922
|
},
|
|
3366
3923
|
children: [
|
|
3367
|
-
/* @__PURE__ */
|
|
3368
|
-
/* @__PURE__ */
|
|
3924
|
+
/* @__PURE__ */ jsxs9("div", { style: { display: "flex", alignItems: "flex-start", gap: 9 }, children: [
|
|
3925
|
+
/* @__PURE__ */ jsx10(
|
|
3369
3926
|
"div",
|
|
3370
3927
|
{
|
|
3371
3928
|
style: {
|
|
@@ -3378,12 +3935,12 @@ function ItemCard({ item, onClick }) {
|
|
|
3378
3935
|
}
|
|
3379
3936
|
}
|
|
3380
3937
|
),
|
|
3381
|
-
/* @__PURE__ */
|
|
3382
|
-
/* @__PURE__ */
|
|
3383
|
-
/* @__PURE__ */
|
|
3938
|
+
/* @__PURE__ */ jsxs9("div", { style: { flex: 1, minWidth: 0 }, children: [
|
|
3939
|
+
/* @__PURE__ */ jsx10("div", { style: { fontSize: 12, fontWeight: 700, color: "#1f2937", marginBottom: 2 }, children: item.label }),
|
|
3940
|
+
/* @__PURE__ */ jsx10("div", { style: { fontSize: 11, color: "#374151", lineHeight: 1.5 }, children: item.description })
|
|
3384
3941
|
] })
|
|
3385
3942
|
] }),
|
|
3386
|
-
/* @__PURE__ */
|
|
3943
|
+
/* @__PURE__ */ jsxs9(
|
|
3387
3944
|
"div",
|
|
3388
3945
|
{
|
|
3389
3946
|
style: {
|
|
@@ -3395,12 +3952,12 @@ function ItemCard({ item, onClick }) {
|
|
|
3395
3952
|
lineHeight: 1.55
|
|
3396
3953
|
},
|
|
3397
3954
|
children: [
|
|
3398
|
-
/* @__PURE__ */
|
|
3955
|
+
/* @__PURE__ */ jsx10("span", { style: { fontWeight: 700, color: "#4b5563", letterSpacing: "0.04em", fontSize: 9.5, textTransform: "uppercase", marginRight: 6 }, children: "Fix" }),
|
|
3399
3956
|
item.howToFix
|
|
3400
3957
|
]
|
|
3401
3958
|
}
|
|
3402
3959
|
),
|
|
3403
|
-
item.jumpTo.tab !== "summary" && /* @__PURE__ */
|
|
3960
|
+
item.jumpTo.tab !== "summary" && /* @__PURE__ */ jsx10("div", { style: { display: "flex", justifyContent: "flex-end" }, children: /* @__PURE__ */ jsxs9("span", { style: { fontSize: 10, fontWeight: 700, color: MJH_BLUE }, children: [
|
|
3404
3961
|
"Go to ",
|
|
3405
3962
|
tabLabel,
|
|
3406
3963
|
" \u203A"
|
|
@@ -3416,7 +3973,7 @@ function FilterChip({
|
|
|
3416
3973
|
count,
|
|
3417
3974
|
dotColor
|
|
3418
3975
|
}) {
|
|
3419
|
-
return /* @__PURE__ */
|
|
3976
|
+
return /* @__PURE__ */ jsxs9(
|
|
3420
3977
|
"button",
|
|
3421
3978
|
{
|
|
3422
3979
|
onClick,
|
|
@@ -3435,9 +3992,9 @@ function FilterChip({
|
|
|
3435
3992
|
transition: "all 150ms"
|
|
3436
3993
|
},
|
|
3437
3994
|
children: [
|
|
3438
|
-
dotColor && /* @__PURE__ */
|
|
3439
|
-
/* @__PURE__ */
|
|
3440
|
-
/* @__PURE__ */
|
|
3995
|
+
dotColor && /* @__PURE__ */ jsx10("span", { style: { width: 6, height: 6, borderRadius: "50%", background: dotColor, display: "inline-block" } }),
|
|
3996
|
+
/* @__PURE__ */ jsx10("span", { children: label }),
|
|
3997
|
+
/* @__PURE__ */ jsx10("span", { style: { fontSize: 10, opacity: 0.8 }, children: count })
|
|
3441
3998
|
]
|
|
3442
3999
|
}
|
|
3443
4000
|
);
|
|
@@ -3449,14 +4006,17 @@ function SummaryTab({
|
|
|
3449
4006
|
documentFields,
|
|
3450
4007
|
linkingSuggestions,
|
|
3451
4008
|
linkCheckResults,
|
|
4009
|
+
primaryKeyword,
|
|
4010
|
+
secondaryKeyword,
|
|
3452
4011
|
isAnyLoading,
|
|
3453
4012
|
onGenerateAll,
|
|
3454
4013
|
onItemClick
|
|
3455
4014
|
}) {
|
|
3456
4015
|
const scoreDetail = useMemo(() => {
|
|
3457
4016
|
if (!analysis) return null;
|
|
3458
|
-
|
|
3459
|
-
|
|
4017
|
+
const scored = primaryKeyword && primaryKeyword !== analysis.primaryKeyword?.term ? { ...analysis, primaryKeyword: { ...analysis.primaryKeyword, term: primaryKeyword } } : analysis;
|
|
4018
|
+
return calculateContentScoreDetailed(text, scored, documentFields);
|
|
4019
|
+
}, [text, analysis, documentFields, primaryKeyword]);
|
|
3460
4020
|
const score = scoreDetail?.total ?? null;
|
|
3461
4021
|
const items = useMemo(
|
|
3462
4022
|
() => buildSummaryItems({
|
|
@@ -3466,9 +4026,11 @@ function SummaryTab({
|
|
|
3466
4026
|
contentScore: score,
|
|
3467
4027
|
linkingSuggestions,
|
|
3468
4028
|
linkCheckResults,
|
|
3469
|
-
text
|
|
4029
|
+
text,
|
|
4030
|
+
primaryKeyword,
|
|
4031
|
+
secondaryKeyword
|
|
3470
4032
|
}),
|
|
3471
|
-
[analysis, deepAnalysis, documentFields, score, linkingSuggestions, linkCheckResults, text]
|
|
4033
|
+
[analysis, deepAnalysis, documentFields, score, linkingSuggestions, linkCheckResults, text, primaryKeyword, secondaryKeyword]
|
|
3472
4034
|
);
|
|
3473
4035
|
const [filter, setFilter] = useState12("all");
|
|
3474
4036
|
const counts = useMemo(
|
|
@@ -3482,15 +4044,15 @@ function SummaryTab({
|
|
|
3482
4044
|
);
|
|
3483
4045
|
const filtered = filter === "all" ? items : items.filter((i) => i.severity === filter);
|
|
3484
4046
|
if (!analysis) {
|
|
3485
|
-
return /* @__PURE__ */
|
|
3486
|
-
/* @__PURE__ */
|
|
3487
|
-
/* @__PURE__ */
|
|
4047
|
+
return /* @__PURE__ */ jsxs9("div", { style: { padding: 24, textAlign: "center" }, children: [
|
|
4048
|
+
/* @__PURE__ */ jsx10("div", { style: { fontSize: 13, color: "#4b5563", fontWeight: 500 }, children: "Start with the Keywords tab" }),
|
|
4049
|
+
/* @__PURE__ */ jsx10("div", { style: { fontSize: 11, color: "#4b5563", marginTop: 4 }, children: "Once keywords are analyzed, the summary appears here." })
|
|
3488
4050
|
] });
|
|
3489
4051
|
}
|
|
3490
|
-
return /* @__PURE__ */
|
|
3491
|
-
score != null && scoreDetail && /* @__PURE__ */
|
|
3492
|
-
/* @__PURE__ */
|
|
3493
|
-
isAnyLoading ? /* @__PURE__ */
|
|
4052
|
+
return /* @__PURE__ */ jsxs9("div", { style: { padding: 12, display: "flex", flexDirection: "column", gap: 12 }, children: [
|
|
4053
|
+
score != null && scoreDetail && /* @__PURE__ */ jsx10(ScoreBadge, { score, breakdown: scoreDetail.components }),
|
|
4054
|
+
/* @__PURE__ */ jsxs9("div", { style: cardStyle2, children: [
|
|
4055
|
+
isAnyLoading ? /* @__PURE__ */ jsx10("div", { style: { display: "flex", alignItems: "center", justifyContent: "center", padding: "4px 0" }, children: /* @__PURE__ */ jsx10(ShimmerLoader, { messages: DEFAULT_GENERATE_ALL_MESSAGES }) }) : /* @__PURE__ */ jsx10(
|
|
3494
4056
|
"button",
|
|
3495
4057
|
{
|
|
3496
4058
|
onClick: onGenerateAll,
|
|
@@ -3515,27 +4077,27 @@ function SummaryTab({
|
|
|
3515
4077
|
transition: "all 150ms",
|
|
3516
4078
|
letterSpacing: "0.01em"
|
|
3517
4079
|
},
|
|
3518
|
-
children: "
|
|
4080
|
+
children: "Run all analyses"
|
|
3519
4081
|
}
|
|
3520
4082
|
),
|
|
3521
|
-
/* @__PURE__ */
|
|
4083
|
+
/* @__PURE__ */ jsxs9("div", { style: { fontSize: 10.5, color: "#4b5563", marginTop: 8, lineHeight: 1.5 }, children: [
|
|
3522
4084
|
"Runs the analyses that fill the ",
|
|
3523
|
-
/* @__PURE__ */
|
|
4085
|
+
/* @__PURE__ */ jsx10("strong", { children: "AEO/GEO" }),
|
|
3524
4086
|
", ",
|
|
3525
|
-
/* @__PURE__ */
|
|
4087
|
+
/* @__PURE__ */ jsx10("strong", { children: "Linking" }),
|
|
3526
4088
|
", and ",
|
|
3527
|
-
/* @__PURE__ */
|
|
4089
|
+
/* @__PURE__ */ jsx10("strong", { children: "Other Recs" }),
|
|
3528
4090
|
" tabs. New issues they find appear in this Summary as each one finishes."
|
|
3529
4091
|
] })
|
|
3530
4092
|
] }),
|
|
3531
|
-
/* @__PURE__ */
|
|
3532
|
-
/* @__PURE__ */
|
|
3533
|
-
/* @__PURE__ */
|
|
3534
|
-
/* @__PURE__ */
|
|
3535
|
-
/* @__PURE__ */
|
|
4093
|
+
/* @__PURE__ */ jsxs9("div", { style: { display: "flex", flexWrap: "wrap", gap: 6 }, children: [
|
|
4094
|
+
/* @__PURE__ */ jsx10(FilterChip, { active: filter === "all", onClick: () => setFilter("all"), label: "All", count: counts.all }),
|
|
4095
|
+
/* @__PURE__ */ jsx10(FilterChip, { active: filter === "error", onClick: () => setFilter("error"), label: "Errors", count: counts.error, dotColor: "#dc2626" }),
|
|
4096
|
+
/* @__PURE__ */ jsx10(FilterChip, { active: filter === "warning", onClick: () => setFilter("warning"), label: "Warnings", count: counts.warning, dotColor: "#E6C01B" }),
|
|
4097
|
+
/* @__PURE__ */ jsx10(FilterChip, { active: filter === "opportunity", onClick: () => setFilter("opportunity"), label: "Opportunities", count: counts.opportunity, dotColor: MJH_BLUE })
|
|
3536
4098
|
] }),
|
|
3537
|
-
/* @__PURE__ */
|
|
3538
|
-
/* @__PURE__ */
|
|
4099
|
+
/* @__PURE__ */ jsx10("div", { id: "anchor-summary-issues", style: { display: "flex", flexDirection: "column", gap: 8 }, children: filtered.length === 0 ? /* @__PURE__ */ jsx10("div", { style: { ...cardStyle2, textAlign: "center", padding: "20px 14px" }, children: items.length === 0 ? /* @__PURE__ */ jsxs9(Fragment5, { children: [
|
|
4100
|
+
/* @__PURE__ */ jsx10(
|
|
3539
4101
|
"div",
|
|
3540
4102
|
{
|
|
3541
4103
|
style: {
|
|
@@ -3548,15 +4110,15 @@ function SummaryTab({
|
|
|
3548
4110
|
justifyContent: "center",
|
|
3549
4111
|
margin: "0 auto 8px"
|
|
3550
4112
|
},
|
|
3551
|
-
children: /* @__PURE__ */
|
|
4113
|
+
children: /* @__PURE__ */ jsx10("svg", { width: "20", height: "20", viewBox: "0 0 20 20", fill: "#16a34a", children: /* @__PURE__ */ jsx10("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" }) })
|
|
3552
4114
|
}
|
|
3553
4115
|
),
|
|
3554
|
-
/* @__PURE__ */
|
|
3555
|
-
/* @__PURE__ */
|
|
3556
|
-
] }) : /* @__PURE__ */
|
|
3557
|
-
isAnyLoading && items.length > 0 && /* @__PURE__ */
|
|
3558
|
-
/* @__PURE__ */
|
|
3559
|
-
/* @__PURE__ */
|
|
4116
|
+
/* @__PURE__ */ jsx10("div", { style: { fontSize: 13, color: "#16a34a", fontWeight: 700 }, children: "Looking good" }),
|
|
4117
|
+
/* @__PURE__ */ jsx10("div", { style: { fontSize: 11, color: "#4b5563", marginTop: 2 }, children: "No issues found for this article." })
|
|
4118
|
+
] }) : /* @__PURE__ */ jsx10("div", { style: { fontSize: 12, color: "#4b5563" }, children: "Nothing in this category." }) }) : filtered.map((item) => /* @__PURE__ */ jsx10(ItemCard, { item, onClick: () => onItemClick(item) }, item.id)) }),
|
|
4119
|
+
isAnyLoading && items.length > 0 && /* @__PURE__ */ jsxs9("div", { style: { display: "flex", alignItems: "center", justifyContent: "center", gap: 6, padding: "4px 0" }, children: [
|
|
4120
|
+
/* @__PURE__ */ jsx10(LoadingBars, { size: "xs", color: MJH_BLUE }),
|
|
4121
|
+
/* @__PURE__ */ jsx10("span", { style: { fontSize: 10, color: "#4b5563" }, children: "Still checking..." })
|
|
3560
4122
|
] })
|
|
3561
4123
|
] });
|
|
3562
4124
|
}
|
|
@@ -3571,9 +4133,12 @@ function wordCount(s) {
|
|
|
3571
4133
|
}
|
|
3572
4134
|
function analyzeHeadings(text, headings) {
|
|
3573
4135
|
if (!text || headings.length === 0) return [];
|
|
4136
|
+
const isQuestion = (h) => /\?\s*$/.test(h.trim());
|
|
4137
|
+
const questionHeadings = headings.filter(isQuestion);
|
|
4138
|
+
if (questionHeadings.length === 0) return [];
|
|
3574
4139
|
const headingSet = new Set(headings.map((h) => h.trim().toLowerCase()));
|
|
3575
4140
|
const lower = text.toLowerCase();
|
|
3576
|
-
return
|
|
4141
|
+
return questionHeadings.map((heading) => {
|
|
3577
4142
|
const needle = heading.trim().toLowerCase();
|
|
3578
4143
|
const idx = lower.indexOf(needle);
|
|
3579
4144
|
if (idx === -1) {
|
|
@@ -3605,7 +4170,7 @@ function analyzeFactDensity(text) {
|
|
|
3605
4170
|
const matches = text.match(new RegExp(FACT_PATTERN.source, "gi")) || [];
|
|
3606
4171
|
const factCount = matches.length;
|
|
3607
4172
|
const factsPer1000 = Math.round(factCount / total * 1e3);
|
|
3608
|
-
const sentences = text.split(/
|
|
4173
|
+
const sentences = text.split(/[.!?]+\s+/).filter((s) => s.trim().length > 0);
|
|
3609
4174
|
let drift = 0;
|
|
3610
4175
|
let runWords = 0;
|
|
3611
4176
|
let runHasFact = false;
|
|
@@ -3620,7 +4185,7 @@ function analyzeFactDensity(text) {
|
|
|
3620
4185
|
}
|
|
3621
4186
|
}
|
|
3622
4187
|
let status;
|
|
3623
|
-
if (factsPer1000 >= 8
|
|
4188
|
+
if (factsPer1000 >= 8) status = "strong";
|
|
3624
4189
|
else if (factsPer1000 >= 4) status = "moderate";
|
|
3625
4190
|
else status = "weak";
|
|
3626
4191
|
return { totalWords: total, factCount, factsPerThousandWords: factsPer1000, driftPassages: drift, status };
|
|
@@ -3633,7 +4198,7 @@ function analyzeGEO(text, headings) {
|
|
|
3633
4198
|
}
|
|
3634
4199
|
|
|
3635
4200
|
// src/components/tabs/AEOTab.tsx
|
|
3636
|
-
import { jsx as
|
|
4201
|
+
import { jsx as jsx11, jsxs as jsxs10 } from "react/jsx-runtime";
|
|
3637
4202
|
var AEO_PURPLE = "#005DAC";
|
|
3638
4203
|
var GEO_TEAL = "#C9A716";
|
|
3639
4204
|
var cardStyle3 = {
|
|
@@ -3645,7 +4210,7 @@ var cardStyle3 = {
|
|
|
3645
4210
|
padding: "14px"
|
|
3646
4211
|
};
|
|
3647
4212
|
function AiPill() {
|
|
3648
|
-
return /* @__PURE__ */
|
|
4213
|
+
return /* @__PURE__ */ jsx11(
|
|
3649
4214
|
"span",
|
|
3650
4215
|
{
|
|
3651
4216
|
style: {
|
|
@@ -3664,10 +4229,10 @@ function AiPill() {
|
|
|
3664
4229
|
);
|
|
3665
4230
|
}
|
|
3666
4231
|
function SectionHeader2({ label, iconColor, ai }) {
|
|
3667
|
-
return /* @__PURE__ */
|
|
3668
|
-
/* @__PURE__ */
|
|
3669
|
-
/* @__PURE__ */
|
|
3670
|
-
ai && /* @__PURE__ */
|
|
4232
|
+
return /* @__PURE__ */ jsxs10("div", { style: { display: "flex", alignItems: "center", gap: 7, marginBottom: 4 }, children: [
|
|
4233
|
+
/* @__PURE__ */ jsx11("div", { style: { width: 7, height: 7, borderRadius: "50%", background: iconColor, flexShrink: 0 } }),
|
|
4234
|
+
/* @__PURE__ */ jsx11("span", { style: { fontSize: 10.5, textTransform: "uppercase", letterSpacing: "0.06em", color: "#4b5563", fontWeight: 600, flex: 1 }, children: label }),
|
|
4235
|
+
ai && /* @__PURE__ */ jsx11(AiPill, {})
|
|
3671
4236
|
] });
|
|
3672
4237
|
}
|
|
3673
4238
|
function CopyButton({ text }) {
|
|
@@ -3680,7 +4245,7 @@ function CopyButton({ text }) {
|
|
|
3680
4245
|
} catch {
|
|
3681
4246
|
}
|
|
3682
4247
|
};
|
|
3683
|
-
return /* @__PURE__ */
|
|
4248
|
+
return /* @__PURE__ */ jsx11(
|
|
3684
4249
|
"button",
|
|
3685
4250
|
{
|
|
3686
4251
|
onClick: handleCopy,
|
|
@@ -3699,9 +4264,9 @@ function CopyButton({ text }) {
|
|
|
3699
4264
|
transition: "color 150ms"
|
|
3700
4265
|
},
|
|
3701
4266
|
title: copied ? "Copied!" : "Copy to clipboard",
|
|
3702
|
-
children: copied ? /* @__PURE__ */
|
|
3703
|
-
/* @__PURE__ */
|
|
3704
|
-
/* @__PURE__ */
|
|
4267
|
+
children: copied ? /* @__PURE__ */ jsx11("svg", { width: "11", height: "11", viewBox: "0 0 20 20", fill: "currentColor", children: /* @__PURE__ */ jsx11("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" }) }) : /* @__PURE__ */ jsxs10("svg", { width: "11", height: "11", viewBox: "0 0 20 20", fill: "currentColor", children: [
|
|
4268
|
+
/* @__PURE__ */ jsx11("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" }),
|
|
4269
|
+
/* @__PURE__ */ jsx11("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" })
|
|
3705
4270
|
] })
|
|
3706
4271
|
}
|
|
3707
4272
|
);
|
|
@@ -3709,18 +4274,20 @@ function CopyButton({ text }) {
|
|
|
3709
4274
|
function GEOCard({ geo, publication }) {
|
|
3710
4275
|
const [showDetails, setShowDetails] = usePersistentState("seo-copilot-ui-geo-details", false);
|
|
3711
4276
|
const fd = geo.factDensity;
|
|
3712
|
-
const
|
|
3713
|
-
const
|
|
3714
|
-
const
|
|
4277
|
+
const isShort = fd.totalWords > 0 && fd.totalWords < 600;
|
|
4278
|
+
const effectiveStatus = fd.status === "weak" && isShort ? "moderate" : fd.status;
|
|
4279
|
+
const fdColor = effectiveStatus === "strong" ? "#16a34a" : effectiveStatus === "moderate" ? "#8B7310" : "#dc2626";
|
|
4280
|
+
const fdLabel = fd.status === "strong" ? "Strong" : fd.status === "moderate" ? "Moderate" : isShort ? "Light (short-form)" : "Weak";
|
|
4281
|
+
const fdBg = effectiveStatus === "strong" ? "rgba(22,163,74,0.1)" : effectiveStatus === "moderate" ? "rgba(230,192,27,0.15)" : "rgba(220,38,38,0.08)";
|
|
3715
4282
|
const goodCount = geo.headingAudit.filter((h) => h.status === "good").length;
|
|
3716
4283
|
const totalHeadings = geo.headingAudit.length;
|
|
3717
|
-
return /* @__PURE__ */
|
|
3718
|
-
/* @__PURE__ */
|
|
3719
|
-
/* @__PURE__ */
|
|
3720
|
-
/* @__PURE__ */
|
|
4284
|
+
return /* @__PURE__ */ jsxs10("div", { style: cardStyle3, children: [
|
|
4285
|
+
/* @__PURE__ */ jsxs10("div", { style: { display: "flex", alignItems: "center", justifyContent: "space-between", marginBottom: 4 }, children: [
|
|
4286
|
+
/* @__PURE__ */ jsx11(SectionHeader2, { label: "AI Citation Readiness", iconColor: GEO_TEAL }),
|
|
4287
|
+
/* @__PURE__ */ jsx11(FeedbackButton, { suggestionType: "geo_summary", suggestionText: `facts/1k: ${fd.factsPerThousandWords}; short-answer headings: ${goodCount}/${totalHeadings}`, publication })
|
|
3721
4288
|
] }),
|
|
3722
|
-
/* @__PURE__ */
|
|
3723
|
-
/* @__PURE__ */
|
|
4289
|
+
/* @__PURE__ */ jsx11("div", { style: { fontSize: 10, color: "#4b5563", marginBottom: 10, lineHeight: 1.5 }, children: "How easy this article is for ChatGPT, Perplexity, Gemini, and Google's AI Overviews to cite." }),
|
|
4290
|
+
/* @__PURE__ */ jsxs10(
|
|
3724
4291
|
"div",
|
|
3725
4292
|
{
|
|
3726
4293
|
style: {
|
|
@@ -3733,7 +4300,7 @@ function GEOCard({ geo, publication }) {
|
|
|
3733
4300
|
marginBottom: 8
|
|
3734
4301
|
},
|
|
3735
4302
|
children: [
|
|
3736
|
-
/* @__PURE__ */
|
|
4303
|
+
/* @__PURE__ */ jsxs10(
|
|
3737
4304
|
"div",
|
|
3738
4305
|
{
|
|
3739
4306
|
style: {
|
|
@@ -3749,17 +4316,17 @@ function GEOCard({ geo, publication }) {
|
|
|
3749
4316
|
boxShadow: "0 1px 2px rgba(0,0,0,0.06)"
|
|
3750
4317
|
},
|
|
3751
4318
|
children: [
|
|
3752
|
-
/* @__PURE__ */
|
|
3753
|
-
/* @__PURE__ */
|
|
4319
|
+
/* @__PURE__ */ jsx11("span", { style: { fontSize: 18, fontWeight: 700, color: fdColor, lineHeight: 1 }, children: fd.factsPerThousandWords }),
|
|
4320
|
+
/* @__PURE__ */ jsx11("span", { style: { fontSize: 7.5, fontWeight: 700, color: fdColor, opacity: 0.75, letterSpacing: "0.05em", marginTop: 2 }, children: "PER 1K" })
|
|
3754
4321
|
]
|
|
3755
4322
|
}
|
|
3756
4323
|
),
|
|
3757
|
-
/* @__PURE__ */
|
|
3758
|
-
/* @__PURE__ */
|
|
4324
|
+
/* @__PURE__ */ jsxs10("div", { style: { flex: 1, minWidth: 0 }, children: [
|
|
4325
|
+
/* @__PURE__ */ jsxs10("div", { style: { fontSize: 11, fontWeight: 700, color: fdColor, marginBottom: 2 }, children: [
|
|
3759
4326
|
"Fact density: ",
|
|
3760
4327
|
fdLabel
|
|
3761
4328
|
] }),
|
|
3762
|
-
/* @__PURE__ */
|
|
4329
|
+
/* @__PURE__ */ jsxs10("div", { style: { fontSize: 11, color: "#1f2937", lineHeight: 1.45 }, children: [
|
|
3763
4330
|
fd.factCount,
|
|
3764
4331
|
" specific stat",
|
|
3765
4332
|
fd.factCount === 1 ? "" : "s",
|
|
@@ -3769,13 +4336,13 @@ function GEOCard({ geo, publication }) {
|
|
|
3769
4336
|
fd.factsPerThousandWords,
|
|
3770
4337
|
" per 1,000 words).",
|
|
3771
4338
|
" ",
|
|
3772
|
-
fd.status === "strong" ? "AI engines prefer this density." : fd.status === "moderate" ? "Aim for 8+ per 1,000 words with named sources (NEJM, JAMA, FDA, trial numbers, p-values)." : "Vague claims get skipped. Add specific numbers, trial citations, or dates."
|
|
4339
|
+
fd.status === "strong" ? "AI engines prefer this density." : fd.status === "moderate" ? "Aim for 8+ per 1,000 words with named sources (NEJM, JAMA, FDA, trial numbers, p-values)." : isShort ? "Short-form content naturally has fewer stats - fine for news and previews. Add a citation or two where you can." : "Vague claims get skipped. Add specific numbers, trial citations, or dates."
|
|
3773
4340
|
] })
|
|
3774
4341
|
] })
|
|
3775
4342
|
]
|
|
3776
4343
|
}
|
|
3777
4344
|
),
|
|
3778
|
-
fd.driftPassages > 0 && /* @__PURE__ */
|
|
4345
|
+
fd.driftPassages > 0 && /* @__PURE__ */ jsxs10(
|
|
3779
4346
|
"div",
|
|
3780
4347
|
{
|
|
3781
4348
|
style: {
|
|
@@ -3789,15 +4356,15 @@ function GEOCard({ geo, publication }) {
|
|
|
3789
4356
|
lineHeight: 1.45
|
|
3790
4357
|
},
|
|
3791
4358
|
children: [
|
|
3792
|
-
/* @__PURE__ */
|
|
4359
|
+
/* @__PURE__ */ jsx11("strong", { children: fd.driftPassages }),
|
|
3793
4360
|
" passage",
|
|
3794
4361
|
fd.driftPassages === 1 ? "" : "s",
|
|
3795
4362
|
" over 200 words with no specific stats or citations. AI engines tend to skip these."
|
|
3796
4363
|
]
|
|
3797
4364
|
}
|
|
3798
4365
|
),
|
|
3799
|
-
totalHeadings > 0 && /* @__PURE__ */
|
|
3800
|
-
/* @__PURE__ */
|
|
4366
|
+
totalHeadings > 0 && /* @__PURE__ */ jsxs10("div", { style: { marginTop: 4 }, children: [
|
|
4367
|
+
/* @__PURE__ */ jsxs10(
|
|
3801
4368
|
"button",
|
|
3802
4369
|
{
|
|
3803
4370
|
onClick: () => setShowDetails((v) => !v),
|
|
@@ -3816,22 +4383,22 @@ function GEOCard({ geo, publication }) {
|
|
|
3816
4383
|
color: GEO_TEAL
|
|
3817
4384
|
},
|
|
3818
4385
|
children: [
|
|
3819
|
-
/* @__PURE__ */
|
|
4386
|
+
/* @__PURE__ */ jsxs10("span", { children: [
|
|
3820
4387
|
"Short-answer paragraphs: ",
|
|
3821
4388
|
goodCount,
|
|
3822
4389
|
"/",
|
|
3823
4390
|
totalHeadings,
|
|
3824
4391
|
" headings have one"
|
|
3825
4392
|
] }),
|
|
3826
|
-
/* @__PURE__ */
|
|
4393
|
+
/* @__PURE__ */ jsx11("svg", { width: "11", height: "11", viewBox: "0 0 20 20", fill: "currentColor", style: { transform: showDetails ? "rotate(180deg)" : "none", transition: "transform 150ms" }, children: /* @__PURE__ */ jsx11("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" }) })
|
|
3827
4394
|
]
|
|
3828
4395
|
}
|
|
3829
4396
|
),
|
|
3830
|
-
showDetails && /* @__PURE__ */
|
|
3831
|
-
/* @__PURE__ */
|
|
4397
|
+
showDetails && /* @__PURE__ */ jsxs10("div", { style: { marginTop: 6, display: "flex", flexDirection: "column", gap: 4 }, children: [
|
|
4398
|
+
/* @__PURE__ */ jsx11("div", { style: { fontSize: 10, color: "#4b5563", marginBottom: 4 }, children: "Aim for a 40-60 word answer right after each heading. That's the chunk AI engines extract." }),
|
|
3832
4399
|
geo.headingAudit.map((h, i) => {
|
|
3833
4400
|
const c = h.status === "good" ? { bg: "rgba(22,163,74,0.08)", color: "#16a34a", label: `${h.words} words \u2713` } : h.status === "too-short" ? { bg: "rgba(230,192,27,0.12)", color: "#8B7310", label: `${h.words} words - too short` } : h.status === "too-long" ? { bg: "rgba(230,192,27,0.12)", color: "#8B7310", label: `${h.words} words - condense to 40-60` } : { bg: "rgba(220,38,38,0.06)", color: "#dc2626", label: "no body content" };
|
|
3834
|
-
return /* @__PURE__ */
|
|
4401
|
+
return /* @__PURE__ */ jsxs10(
|
|
3835
4402
|
"div",
|
|
3836
4403
|
{
|
|
3837
4404
|
style: {
|
|
@@ -3845,8 +4412,8 @@ function GEOCard({ geo, publication }) {
|
|
|
3845
4412
|
gap: 8
|
|
3846
4413
|
},
|
|
3847
4414
|
children: [
|
|
3848
|
-
/* @__PURE__ */
|
|
3849
|
-
/* @__PURE__ */
|
|
4415
|
+
/* @__PURE__ */ jsx11("span", { style: { flex: 1, minWidth: 0, color: "#1f2937", overflow: "hidden", textOverflow: "ellipsis", whiteSpace: "nowrap" }, children: h.heading }),
|
|
4416
|
+
/* @__PURE__ */ jsx11("span", { style: { fontSize: 10, fontWeight: 600, color: c.color, flexShrink: 0 }, children: c.label })
|
|
3850
4417
|
]
|
|
3851
4418
|
},
|
|
3852
4419
|
i
|
|
@@ -3883,8 +4450,8 @@ function AEOTab({
|
|
|
3883
4450
|
originalHeading: void 0,
|
|
3884
4451
|
rationale: h.rationale
|
|
3885
4452
|
})) ?? [];
|
|
3886
|
-
return /* @__PURE__ */
|
|
3887
|
-
aeoContentChanged && /* @__PURE__ */
|
|
4453
|
+
return /* @__PURE__ */ jsxs10("div", { style: { padding: 12, display: "flex", flexDirection: "column", gap: 12 }, children: [
|
|
4454
|
+
aeoContentChanged && /* @__PURE__ */ jsxs10(
|
|
3888
4455
|
"div",
|
|
3889
4456
|
{
|
|
3890
4457
|
onClick: runDeepAnalysis,
|
|
@@ -3899,30 +4466,30 @@ function AEOTab({
|
|
|
3899
4466
|
cursor: "pointer"
|
|
3900
4467
|
},
|
|
3901
4468
|
children: [
|
|
3902
|
-
/* @__PURE__ */
|
|
3903
|
-
/* @__PURE__ */
|
|
4469
|
+
/* @__PURE__ */ jsx11("span", { style: { fontSize: 11, color: "#92400e" }, children: "Content has changed since this was generated." }),
|
|
4470
|
+
/* @__PURE__ */ jsx11("span", { style: { fontSize: 11, fontWeight: 600, color: AEO_PURPLE, textDecoration: "underline" }, children: "Update" })
|
|
3904
4471
|
]
|
|
3905
4472
|
}
|
|
3906
4473
|
),
|
|
3907
|
-
hasEnoughTextForGEO && /* @__PURE__ */
|
|
3908
|
-
hasEnoughText && !hasEnoughTextForGEO && /* @__PURE__ */
|
|
3909
|
-
/* @__PURE__ */
|
|
4474
|
+
hasEnoughTextForGEO && /* @__PURE__ */ jsx11(GEOCard, { geo, publication }),
|
|
4475
|
+
hasEnoughText && !hasEnoughTextForGEO && /* @__PURE__ */ jsx11("div", { style: { ...cardStyle3, textAlign: "center" }, children: /* @__PURE__ */ jsxs10("div", { style: { fontSize: 11, color: "#4b5563", lineHeight: 1.5 }, children: [
|
|
4476
|
+
/* @__PURE__ */ jsx11("strong", { style: { color: "#C9A716" }, children: "AI citation analysis" }),
|
|
3910
4477
|
" needs at least 150 words to read fact density.",
|
|
3911
|
-
/* @__PURE__ */
|
|
3912
|
-
/* @__PURE__ */
|
|
4478
|
+
/* @__PURE__ */ jsx11("br", {}),
|
|
4479
|
+
/* @__PURE__ */ jsxs10("span", { style: { color: "#4b5563" }, children: [
|
|
3913
4480
|
"Current: ",
|
|
3914
4481
|
geoWordCount,
|
|
3915
4482
|
" word",
|
|
3916
4483
|
geoWordCount === 1 ? "" : "s"
|
|
3917
4484
|
] })
|
|
3918
4485
|
] }) }),
|
|
3919
|
-
!deepAnalysis && isDeepLoading && /* @__PURE__ */
|
|
3920
|
-
/* @__PURE__ */
|
|
3921
|
-
/* @__PURE__ */
|
|
4486
|
+
!deepAnalysis && isDeepLoading && /* @__PURE__ */ jsxs10("div", { style: { ...cardStyle3, display: "flex", alignItems: "center", justifyContent: "center", gap: 8 }, children: [
|
|
4487
|
+
/* @__PURE__ */ jsx11(LoadingBars, { size: "xs", color: AEO_PURPLE }),
|
|
4488
|
+
/* @__PURE__ */ jsx11("span", { style: { fontSize: 12, color: "#4b5563" }, children: "Generating AEO insights..." })
|
|
3922
4489
|
] }),
|
|
3923
|
-
!deepAnalysis && !isDeepLoading && /* @__PURE__ */
|
|
3924
|
-
/* @__PURE__ */
|
|
3925
|
-
/* @__PURE__ */
|
|
4490
|
+
!deepAnalysis && !isDeepLoading && /* @__PURE__ */ jsxs10("div", { style: { ...cardStyle3, textAlign: "center" }, children: [
|
|
4491
|
+
/* @__PURE__ */ jsx11("div", { style: { fontSize: 12, color: "#4b5563" }, children: "AI citation readiness and question-style heading suggestions appear here once analysis runs." }),
|
|
4492
|
+
/* @__PURE__ */ jsx11(
|
|
3926
4493
|
"button",
|
|
3927
4494
|
{
|
|
3928
4495
|
onClick: runDeepAnalysis,
|
|
@@ -3942,11 +4509,11 @@ function AEOTab({
|
|
|
3942
4509
|
}
|
|
3943
4510
|
)
|
|
3944
4511
|
] }),
|
|
3945
|
-
deepAnalysis && !aeo && /* @__PURE__ */
|
|
3946
|
-
questionHeadings.length > 0 && /* @__PURE__ */
|
|
3947
|
-
/* @__PURE__ */
|
|
3948
|
-
/* @__PURE__ */
|
|
3949
|
-
/* @__PURE__ */
|
|
4512
|
+
deepAnalysis && !aeo && /* @__PURE__ */ jsx11("div", { style: { ...cardStyle3, textAlign: "center" }, children: /* @__PURE__ */ jsx11("span", { style: { fontSize: 12, color: "#4b5563" }, children: "No insights came back. Try again - the analysis may have timed out." }) }),
|
|
4513
|
+
questionHeadings.length > 0 && /* @__PURE__ */ jsxs10("div", { style: cardStyle3, children: [
|
|
4514
|
+
/* @__PURE__ */ jsx11(SectionHeader2, { label: "Question-Style Headings", iconColor: AEO_PURPLE }),
|
|
4515
|
+
/* @__PURE__ */ jsx11("div", { style: { fontSize: 10, color: "#4b5563", marginBottom: 8 }, children: "Rewrites of your existing headings as questions. Google often pulls these into featured snippets." }),
|
|
4516
|
+
/* @__PURE__ */ jsx11("div", { style: { display: "flex", flexDirection: "column", gap: 8 }, children: questionHeadings.map((h, i) => /* @__PURE__ */ jsxs10(
|
|
3950
4517
|
"div",
|
|
3951
4518
|
{
|
|
3952
4519
|
style: {
|
|
@@ -3956,26 +4523,26 @@ function AEOTab({
|
|
|
3956
4523
|
borderLeft: `3px solid ${AEO_PURPLE}`
|
|
3957
4524
|
},
|
|
3958
4525
|
children: [
|
|
3959
|
-
/* @__PURE__ */
|
|
3960
|
-
/* @__PURE__ */
|
|
3961
|
-
h.originalHeading && /* @__PURE__ */
|
|
3962
|
-
/* @__PURE__ */
|
|
4526
|
+
/* @__PURE__ */ jsxs10("div", { style: { display: "flex", alignItems: "flex-start", justifyContent: "space-between", gap: 8 }, children: [
|
|
4527
|
+
/* @__PURE__ */ jsxs10("div", { style: { flex: 1 }, children: [
|
|
4528
|
+
h.originalHeading && /* @__PURE__ */ jsx11("div", { style: { fontSize: 11, color: "#4b5563", textDecoration: "line-through", marginBottom: 2 }, children: h.originalHeading }),
|
|
4529
|
+
/* @__PURE__ */ jsx11("div", { style: { fontSize: 12, fontWeight: 700, color: AEO_PURPLE, lineHeight: 1.5 }, children: h.heading })
|
|
3963
4530
|
] }),
|
|
3964
|
-
/* @__PURE__ */
|
|
3965
|
-
/* @__PURE__ */
|
|
3966
|
-
/* @__PURE__ */
|
|
4531
|
+
/* @__PURE__ */ jsxs10("div", { style: { display: "flex", alignItems: "center", gap: 4 }, children: [
|
|
4532
|
+
/* @__PURE__ */ jsx11(CopyButton, { text: h.heading }),
|
|
4533
|
+
/* @__PURE__ */ jsx11(FeedbackButton, { suggestionType: "aeo_heading", suggestionText: h.heading, publication })
|
|
3967
4534
|
] })
|
|
3968
4535
|
] }),
|
|
3969
|
-
/* @__PURE__ */
|
|
4536
|
+
/* @__PURE__ */ jsx11("div", { style: { fontSize: 10, color: "#4b5563", marginTop: 4, fontStyle: "italic" }, children: h.rationale })
|
|
3970
4537
|
]
|
|
3971
4538
|
},
|
|
3972
4539
|
i
|
|
3973
4540
|
)) })
|
|
3974
4541
|
] }),
|
|
3975
|
-
/* @__PURE__ */
|
|
3976
|
-
/* @__PURE__ */
|
|
3977
|
-
/* @__PURE__ */
|
|
3978
|
-
!contentSuggestions && !isCSLoading && /* @__PURE__ */
|
|
4542
|
+
/* @__PURE__ */ jsxs10("div", { style: cardStyle3, children: [
|
|
4543
|
+
/* @__PURE__ */ jsx11(SectionHeader2, { label: "Content Block Suggestions", iconColor: AEO_PURPLE }),
|
|
4544
|
+
/* @__PURE__ */ jsx11("div", { style: { fontSize: 10, color: "#4b5563", marginBottom: 10 }, children: "Short, citable blocks to use inside or alongside the article - takeaways, infographic ideas, and bullet points." }),
|
|
4545
|
+
!contentSuggestions && !isCSLoading && /* @__PURE__ */ jsx11(
|
|
3979
4546
|
"button",
|
|
3980
4547
|
{
|
|
3981
4548
|
onClick: loadContentSuggestions,
|
|
@@ -3999,15 +4566,15 @@ function AEOTab({
|
|
|
3999
4566
|
children: "Generate suggestions"
|
|
4000
4567
|
}
|
|
4001
4568
|
),
|
|
4002
|
-
isCSLoading && /* @__PURE__ */
|
|
4003
|
-
/* @__PURE__ */
|
|
4004
|
-
/* @__PURE__ */
|
|
4569
|
+
isCSLoading && /* @__PURE__ */ jsxs10("div", { style: { display: "flex", alignItems: "center", justifyContent: "center", gap: 8, padding: "8px 0" }, children: [
|
|
4570
|
+
/* @__PURE__ */ jsx11(LoadingBars, { size: "xs", color: AEO_PURPLE }),
|
|
4571
|
+
/* @__PURE__ */ jsx11("span", { style: { fontSize: 11, color: "#4b5563" }, children: "Generating content suggestions..." })
|
|
4005
4572
|
] }),
|
|
4006
|
-
csError && /* @__PURE__ */
|
|
4007
|
-
contentSuggestions && /* @__PURE__ */
|
|
4008
|
-
contentSuggestions.keyTakeaways.length > 0 && /* @__PURE__ */
|
|
4009
|
-
/* @__PURE__ */
|
|
4010
|
-
/* @__PURE__ */
|
|
4573
|
+
csError && /* @__PURE__ */ jsx11("div", { style: { marginTop: 6, fontSize: 11, color: "#dc2626" }, children: csError }),
|
|
4574
|
+
contentSuggestions && /* @__PURE__ */ jsxs10("div", { style: { display: "flex", flexDirection: "column", gap: 14, marginTop: 8 }, children: [
|
|
4575
|
+
contentSuggestions.keyTakeaways.length > 0 && /* @__PURE__ */ jsxs10("div", { children: [
|
|
4576
|
+
/* @__PURE__ */ jsx11("div", { style: { fontSize: 10, fontWeight: 700, textTransform: "uppercase", letterSpacing: "0.06em", color: AEO_PURPLE, marginBottom: 6 }, children: "Key Takeaways" }),
|
|
4577
|
+
/* @__PURE__ */ jsx11("div", { style: { display: "flex", flexDirection: "column", gap: 6 }, children: contentSuggestions.keyTakeaways.map((kt, i) => /* @__PURE__ */ jsxs10(
|
|
4011
4578
|
"div",
|
|
4012
4579
|
{
|
|
4013
4580
|
style: {
|
|
@@ -4020,19 +4587,19 @@ function AEOTab({
|
|
|
4020
4587
|
alignItems: "flex-start"
|
|
4021
4588
|
},
|
|
4022
4589
|
children: [
|
|
4023
|
-
/* @__PURE__ */
|
|
4024
|
-
/* @__PURE__ */
|
|
4025
|
-
/* @__PURE__ */
|
|
4026
|
-
/* @__PURE__ */
|
|
4590
|
+
/* @__PURE__ */ jsx11("span", { style: { fontSize: 12, color: "#1f2937", lineHeight: 1.55, flex: 1 }, children: kt }),
|
|
4591
|
+
/* @__PURE__ */ jsxs10("div", { style: { display: "flex", alignItems: "center", gap: 4 }, children: [
|
|
4592
|
+
/* @__PURE__ */ jsx11(CopyButton, { text: kt }),
|
|
4593
|
+
/* @__PURE__ */ jsx11(FeedbackButton, { suggestionType: "aeo_takeaway", suggestionText: kt, publication })
|
|
4027
4594
|
] })
|
|
4028
4595
|
]
|
|
4029
4596
|
},
|
|
4030
4597
|
i
|
|
4031
4598
|
)) })
|
|
4032
4599
|
] }),
|
|
4033
|
-
contentSuggestions.infographicOpportunities.length > 0 && /* @__PURE__ */
|
|
4034
|
-
/* @__PURE__ */
|
|
4035
|
-
/* @__PURE__ */
|
|
4600
|
+
contentSuggestions.infographicOpportunities.length > 0 && /* @__PURE__ */ jsxs10("div", { children: [
|
|
4601
|
+
/* @__PURE__ */ jsx11("div", { style: { fontSize: 10, fontWeight: 700, textTransform: "uppercase", letterSpacing: "0.06em", color: AEO_PURPLE, marginBottom: 6 }, children: "Infographic Ideas" }),
|
|
4602
|
+
/* @__PURE__ */ jsx11("div", { style: { display: "flex", flexDirection: "column", gap: 6 }, children: contentSuggestions.infographicOpportunities.map((io, i) => /* @__PURE__ */ jsxs10(
|
|
4036
4603
|
"div",
|
|
4037
4604
|
{
|
|
4038
4605
|
style: {
|
|
@@ -4042,23 +4609,23 @@ function AEOTab({
|
|
|
4042
4609
|
borderLeft: `2px solid ${AEO_PURPLE}`
|
|
4043
4610
|
},
|
|
4044
4611
|
children: [
|
|
4045
|
-
/* @__PURE__ */
|
|
4046
|
-
/* @__PURE__ */
|
|
4047
|
-
/* @__PURE__ */
|
|
4612
|
+
/* @__PURE__ */ jsxs10("div", { style: { display: "flex", alignItems: "flex-start", justifyContent: "space-between", gap: 8 }, children: [
|
|
4613
|
+
/* @__PURE__ */ jsx11("span", { style: { fontSize: 12, fontWeight: 700, color: AEO_PURPLE }, children: io.concept }),
|
|
4614
|
+
/* @__PURE__ */ jsx11(FeedbackButton, { suggestionType: "aeo_infographic", suggestionText: io.concept, publication })
|
|
4048
4615
|
] }),
|
|
4049
|
-
/* @__PURE__ */
|
|
4616
|
+
/* @__PURE__ */ jsx11("div", { style: { fontSize: 11, color: "#1f2937", lineHeight: 1.5, marginTop: 3 }, children: io.description })
|
|
4050
4617
|
]
|
|
4051
4618
|
},
|
|
4052
4619
|
i
|
|
4053
4620
|
)) })
|
|
4054
4621
|
] }),
|
|
4055
|
-
contentSuggestions.bulletListItems.length > 0 && /* @__PURE__ */
|
|
4056
|
-
/* @__PURE__ */
|
|
4057
|
-
/* @__PURE__ */
|
|
4058
|
-
/* @__PURE__ */
|
|
4059
|
-
/* @__PURE__ */
|
|
4060
|
-
/* @__PURE__ */
|
|
4061
|
-
/* @__PURE__ */
|
|
4622
|
+
contentSuggestions.bulletListItems.length > 0 && /* @__PURE__ */ jsxs10("div", { children: [
|
|
4623
|
+
/* @__PURE__ */ jsx11("div", { style: { fontSize: 10, fontWeight: 700, textTransform: "uppercase", letterSpacing: "0.06em", color: AEO_PURPLE, marginBottom: 6 }, children: "Bullets for Featured Snippets" }),
|
|
4624
|
+
/* @__PURE__ */ jsxs10("div", { style: { display: "flex", alignItems: "flex-start", justifyContent: "space-between", gap: 8 }, children: [
|
|
4625
|
+
/* @__PURE__ */ jsx11("ul", { style: { margin: 0, paddingLeft: 18, flex: 1 }, children: contentSuggestions.bulletListItems.map((b, i) => /* @__PURE__ */ jsx11("li", { style: { fontSize: 12, color: "#1f2937", lineHeight: 1.55, marginBottom: 4 }, children: b }, i)) }),
|
|
4626
|
+
/* @__PURE__ */ jsxs10("div", { style: { display: "flex", alignItems: "center", gap: 4 }, children: [
|
|
4627
|
+
/* @__PURE__ */ jsx11(CopyButton, { text: contentSuggestions.bulletListItems.map((b) => "- " + b).join("\n") }),
|
|
4628
|
+
/* @__PURE__ */ jsx11(
|
|
4062
4629
|
FeedbackButton,
|
|
4063
4630
|
{
|
|
4064
4631
|
suggestionType: "aeo_bullets",
|
|
@@ -4069,7 +4636,7 @@ function AEOTab({
|
|
|
4069
4636
|
] })
|
|
4070
4637
|
] })
|
|
4071
4638
|
] }),
|
|
4072
|
-
/* @__PURE__ */
|
|
4639
|
+
/* @__PURE__ */ jsx11(
|
|
4073
4640
|
"button",
|
|
4074
4641
|
{
|
|
4075
4642
|
onClick: loadContentSuggestions,
|
|
@@ -4099,7 +4666,7 @@ function AEOTab({
|
|
|
4099
4666
|
|
|
4100
4667
|
// src/components/ScoreDonut.tsx
|
|
4101
4668
|
import { useState as useState14 } from "react";
|
|
4102
|
-
import { jsx as
|
|
4669
|
+
import { jsx as jsx12, jsxs as jsxs11 } from "react/jsx-runtime";
|
|
4103
4670
|
var W = { topic: 0.6, freshness: 0.25, sectionFit: 0.15 };
|
|
4104
4671
|
var COLORS = { topic: MJH_BLUE, freshness: MJH_GOLD, sectionFit: "#9B59B6" };
|
|
4105
4672
|
var TRACK = "#eef2f7";
|
|
@@ -4124,7 +4691,7 @@ function ScoreDonut({
|
|
|
4124
4691
|
const topicLen = seg(cTopic);
|
|
4125
4692
|
const freshLen = seg(cFresh);
|
|
4126
4693
|
const sectionLen = seg(cSection);
|
|
4127
|
-
const Slice = ({ color, fullLen, offset }) => /* @__PURE__ */
|
|
4694
|
+
const Slice = ({ color, fullLen, offset }) => /* @__PURE__ */ jsx12(
|
|
4128
4695
|
"circle",
|
|
4129
4696
|
{
|
|
4130
4697
|
cx: size / 2,
|
|
@@ -4138,20 +4705,20 @@ function ScoreDonut({
|
|
|
4138
4705
|
strokeDashoffset: -offset
|
|
4139
4706
|
}
|
|
4140
4707
|
);
|
|
4141
|
-
return /* @__PURE__ */
|
|
4708
|
+
return /* @__PURE__ */ jsxs11(
|
|
4142
4709
|
"div",
|
|
4143
4710
|
{
|
|
4144
4711
|
style: { position: "relative", width: size, height: size, flexShrink: 0 },
|
|
4145
4712
|
onMouseEnter: () => setHovered(true),
|
|
4146
4713
|
onMouseLeave: () => setHovered(false),
|
|
4147
4714
|
children: [
|
|
4148
|
-
/* @__PURE__ */
|
|
4149
|
-
/* @__PURE__ */
|
|
4150
|
-
/* @__PURE__ */
|
|
4151
|
-
/* @__PURE__ */
|
|
4152
|
-
/* @__PURE__ */
|
|
4715
|
+
/* @__PURE__ */ jsxs11("svg", { width: size, height: size, viewBox: `0 0 ${size} ${size}`, style: { transform: "rotate(-90deg)" }, children: [
|
|
4716
|
+
/* @__PURE__ */ jsx12("circle", { cx: size / 2, cy: size / 2, r: radius, fill: "none", stroke: TRACK, strokeWidth }),
|
|
4717
|
+
/* @__PURE__ */ jsx12(Slice, { color: COLORS.topic, fullLen: topicLen, offset: 0 }),
|
|
4718
|
+
/* @__PURE__ */ jsx12(Slice, { color: COLORS.freshness, fullLen: freshLen, offset: topicLen }),
|
|
4719
|
+
/* @__PURE__ */ jsx12(Slice, { color: COLORS.sectionFit, fullLen: sectionLen, offset: topicLen + freshLen })
|
|
4153
4720
|
] }),
|
|
4154
|
-
/* @__PURE__ */
|
|
4721
|
+
/* @__PURE__ */ jsxs11(
|
|
4155
4722
|
"div",
|
|
4156
4723
|
{
|
|
4157
4724
|
style: {
|
|
@@ -4165,15 +4732,15 @@ function ScoreDonut({
|
|
|
4165
4732
|
lineHeight: 1
|
|
4166
4733
|
},
|
|
4167
4734
|
children: [
|
|
4168
|
-
/* @__PURE__ */
|
|
4735
|
+
/* @__PURE__ */ jsxs11("span", { style: { fontSize: Math.max(11, size / 5.5), fontWeight: 700, color: "#1f2937" }, children: [
|
|
4169
4736
|
compositeValue,
|
|
4170
4737
|
"%"
|
|
4171
4738
|
] }),
|
|
4172
|
-
/* @__PURE__ */
|
|
4739
|
+
/* @__PURE__ */ jsx12("span", { style: { fontSize: Math.max(7, size / 11), fontWeight: 700, color: "#4b5563", letterSpacing: "0.05em", marginTop: 1 }, children: "MATCH" })
|
|
4173
4740
|
]
|
|
4174
4741
|
}
|
|
4175
4742
|
),
|
|
4176
|
-
hovered && /* @__PURE__ */
|
|
4743
|
+
hovered && /* @__PURE__ */ jsxs11(
|
|
4177
4744
|
"div",
|
|
4178
4745
|
{
|
|
4179
4746
|
role: "tooltip",
|
|
@@ -4194,9 +4761,9 @@ function ScoreDonut({
|
|
|
4194
4761
|
pointerEvents: "none"
|
|
4195
4762
|
},
|
|
4196
4763
|
children: [
|
|
4197
|
-
/* @__PURE__ */
|
|
4198
|
-
/* @__PURE__ */
|
|
4199
|
-
/* @__PURE__ */
|
|
4764
|
+
/* @__PURE__ */ jsx12(SubScoreRow, { color: COLORS.topic, label: "Topic", value: topic }),
|
|
4765
|
+
/* @__PURE__ */ jsx12(SubScoreRow, { color: COLORS.freshness, label: "Freshness", value: freshness }),
|
|
4766
|
+
/* @__PURE__ */ jsx12(SubScoreRow, { color: COLORS.sectionFit, label: "Section fit", value: sectionFit })
|
|
4200
4767
|
]
|
|
4201
4768
|
}
|
|
4202
4769
|
)
|
|
@@ -4205,31 +4772,76 @@ function ScoreDonut({
|
|
|
4205
4772
|
);
|
|
4206
4773
|
}
|
|
4207
4774
|
function SubScoreRow({ color, label, value }) {
|
|
4208
|
-
return /* @__PURE__ */
|
|
4209
|
-
/* @__PURE__ */
|
|
4210
|
-
/* @__PURE__ */
|
|
4211
|
-
/* @__PURE__ */
|
|
4775
|
+
return /* @__PURE__ */ jsxs11("div", { style: { display: "flex", alignItems: "center", gap: 6 }, children: [
|
|
4776
|
+
/* @__PURE__ */ jsx12("span", { style: { width: 7, height: 7, borderRadius: "50%", background: color, display: "inline-block", flexShrink: 0 } }),
|
|
4777
|
+
/* @__PURE__ */ jsx12("span", { style: { flex: 1 }, children: label }),
|
|
4778
|
+
/* @__PURE__ */ jsxs11("span", { style: { fontWeight: 700, fontVariantNumeric: "tabular-nums" }, children: [
|
|
4212
4779
|
Math.round(value),
|
|
4213
4780
|
"/100"
|
|
4214
4781
|
] })
|
|
4215
4782
|
] });
|
|
4216
4783
|
}
|
|
4217
4784
|
function ScoreDonutLegend() {
|
|
4218
|
-
return /* @__PURE__ */
|
|
4219
|
-
/* @__PURE__ */
|
|
4220
|
-
/* @__PURE__ */
|
|
4221
|
-
/* @__PURE__ */
|
|
4785
|
+
return /* @__PURE__ */ jsxs11("div", { style: { display: "flex", gap: 10, fontSize: 9, color: "rgba(0,0,0,0.55)", alignItems: "center", flexWrap: "wrap" }, children: [
|
|
4786
|
+
/* @__PURE__ */ jsx12(LegendDot, { color: COLORS.topic, label: "Topic match (60% of score)" }),
|
|
4787
|
+
/* @__PURE__ */ jsx12(LegendDot, { color: COLORS.freshness, label: "Freshness (25%)" }),
|
|
4788
|
+
/* @__PURE__ */ jsx12(LegendDot, { color: COLORS.sectionFit, label: "Section fit (15%)" })
|
|
4222
4789
|
] });
|
|
4223
4790
|
}
|
|
4224
4791
|
function LegendDot({ color, label }) {
|
|
4225
|
-
return /* @__PURE__ */
|
|
4226
|
-
/* @__PURE__ */
|
|
4792
|
+
return /* @__PURE__ */ jsxs11("span", { style: { display: "inline-flex", alignItems: "center", gap: 4 }, children: [
|
|
4793
|
+
/* @__PURE__ */ jsx12("span", { style: { width: 7, height: 7, borderRadius: "50%", background: color, display: "inline-block" } }),
|
|
4227
4794
|
label
|
|
4228
4795
|
] });
|
|
4229
4796
|
}
|
|
4230
4797
|
|
|
4231
4798
|
// src/components/tabs/LinkingTab.tsx
|
|
4232
|
-
import { Fragment as
|
|
4799
|
+
import { Fragment as Fragment6, jsx as jsx13, jsxs as jsxs12 } from "react/jsx-runtime";
|
|
4800
|
+
function buildLiveUrl(publication, slug) {
|
|
4801
|
+
if (!slug) return null;
|
|
4802
|
+
const pub = (publication || "").trim().toLowerCase();
|
|
4803
|
+
if (!/^[a-z0-9-]+$/.test(pub)) return null;
|
|
4804
|
+
const cleanSlug = slug.replace(/^\/+/, "");
|
|
4805
|
+
return `https://www.${pub}.com/view/${cleanSlug}`;
|
|
4806
|
+
}
|
|
4807
|
+
function buildSanityUrl(baseUrl, id, type) {
|
|
4808
|
+
if (!baseUrl || !id) return null;
|
|
4809
|
+
const cleanId = id.replace(/^drafts\./, "");
|
|
4810
|
+
const base = baseUrl.replace(/\/+$/, "");
|
|
4811
|
+
const typePart = type ? `;type=${encodeURIComponent(type)}` : "";
|
|
4812
|
+
return `${base}/intent/edit/id=${encodeURIComponent(cleanId)}${typePart}/`;
|
|
4813
|
+
}
|
|
4814
|
+
function LinkChip({ href, label, color }) {
|
|
4815
|
+
return /* @__PURE__ */ jsxs12(
|
|
4816
|
+
"a",
|
|
4817
|
+
{
|
|
4818
|
+
href,
|
|
4819
|
+
target: "_blank",
|
|
4820
|
+
rel: "noopener noreferrer",
|
|
4821
|
+
style: {
|
|
4822
|
+
display: "inline-flex",
|
|
4823
|
+
alignItems: "center",
|
|
4824
|
+
gap: 4,
|
|
4825
|
+
padding: "3px 9px",
|
|
4826
|
+
borderRadius: 99,
|
|
4827
|
+
fontSize: 10.5,
|
|
4828
|
+
fontWeight: 700,
|
|
4829
|
+
color,
|
|
4830
|
+
background: "rgba(255,255,255,0.7)",
|
|
4831
|
+
border: `1px solid ${color}33`,
|
|
4832
|
+
textDecoration: "none",
|
|
4833
|
+
lineHeight: 1.2
|
|
4834
|
+
},
|
|
4835
|
+
children: [
|
|
4836
|
+
label,
|
|
4837
|
+
/* @__PURE__ */ jsxs12("svg", { width: "9", height: "9", viewBox: "0 0 20 20", fill: "currentColor", "aria-hidden": "true", children: [
|
|
4838
|
+
/* @__PURE__ */ jsx13("path", { d: "M12.5 2a.75.75 0 000 1.5h2.44l-6.97 6.97a.75.75 0 101.06 1.06L16 4.56V7a.75.75 0 001.5 0V2.75A.75.75 0 0016.75 2H12.5z" }),
|
|
4839
|
+
/* @__PURE__ */ jsx13("path", { d: "M4.75 4.5A2.75 2.75 0 002 7.25v8A2.75 2.75 0 004.75 18h8A2.75 2.75 0 0015.5 15.25v-3a.75.75 0 00-1.5 0v3c0 .69-.56 1.25-1.25 1.25h-8c-.69 0-1.25-.56-1.25-1.25v-8c0-.69.56-1.25 1.25-1.25h3a.75.75 0 000-1.5h-3z" })
|
|
4840
|
+
] })
|
|
4841
|
+
]
|
|
4842
|
+
}
|
|
4843
|
+
);
|
|
4844
|
+
}
|
|
4233
4845
|
var cardStyle4 = {
|
|
4234
4846
|
borderRadius: 14,
|
|
4235
4847
|
background: "rgba(255,255,255,0.55)",
|
|
@@ -4239,7 +4851,7 @@ var cardStyle4 = {
|
|
|
4239
4851
|
padding: "14px"
|
|
4240
4852
|
};
|
|
4241
4853
|
function AiPill2() {
|
|
4242
|
-
return /* @__PURE__ */
|
|
4854
|
+
return /* @__PURE__ */ jsx13(
|
|
4243
4855
|
"span",
|
|
4244
4856
|
{
|
|
4245
4857
|
style: {
|
|
@@ -4263,10 +4875,10 @@ function SectionHeader3({
|
|
|
4263
4875
|
ai,
|
|
4264
4876
|
action
|
|
4265
4877
|
}) {
|
|
4266
|
-
return /* @__PURE__ */
|
|
4267
|
-
/* @__PURE__ */
|
|
4268
|
-
/* @__PURE__ */
|
|
4269
|
-
ai && /* @__PURE__ */
|
|
4878
|
+
return /* @__PURE__ */ jsxs12("div", { style: { display: "flex", alignItems: "center", gap: 7, marginBottom: 8 }, children: [
|
|
4879
|
+
/* @__PURE__ */ jsx13("div", { style: { width: 7, height: 7, borderRadius: "50%", background: iconColor, flexShrink: 0 } }),
|
|
4880
|
+
/* @__PURE__ */ jsx13("span", { style: { fontSize: 10.5, textTransform: "uppercase", letterSpacing: "0.06em", color: "#4b5563", fontWeight: 600, flex: 1 }, children: label }),
|
|
4881
|
+
ai && /* @__PURE__ */ jsx13(AiPill2, {}),
|
|
4270
4882
|
action
|
|
4271
4883
|
] });
|
|
4272
4884
|
}
|
|
@@ -4286,7 +4898,7 @@ function freshnessChip(label, score) {
|
|
|
4286
4898
|
"very-old": { bg: "rgba(220,38,38,0.1)", color: "#dc2626", text: "Very old" }
|
|
4287
4899
|
};
|
|
4288
4900
|
const c = map[label];
|
|
4289
|
-
return /* @__PURE__ */
|
|
4901
|
+
return /* @__PURE__ */ jsx13(
|
|
4290
4902
|
"span",
|
|
4291
4903
|
{
|
|
4292
4904
|
style: {
|
|
@@ -4306,8 +4918,8 @@ function freshnessChip(label, score) {
|
|
|
4306
4918
|
);
|
|
4307
4919
|
}
|
|
4308
4920
|
function RefreshIcon({ spinning }) {
|
|
4309
|
-
if (spinning) return /* @__PURE__ */
|
|
4310
|
-
return /* @__PURE__ */
|
|
4921
|
+
if (spinning) return /* @__PURE__ */ jsx13(LoadingBars, { size: "xs", color: "#9ca3af" });
|
|
4922
|
+
return /* @__PURE__ */ jsx13("svg", { width: "12", height: "12", viewBox: "0 0 20 20", fill: "currentColor", children: /* @__PURE__ */ jsx13("path", { fillRule: "evenodd", d: "M15.312 11.424a5.5 5.5 0 01-9.201 2.466l-.312-.311h2.433a.75.75 0 000-1.5H4.598a.75.75 0 00-.75.75v3.634a.75.75 0 001.5 0v-2.033l.312.311a7 7 0 0011.712-3.138.75.75 0 00-1.449-.39zm-10.624-2.85a5.5 5.5 0 019.201-2.466l.312.311h-2.433a.75.75 0 000 1.5h3.634a.75.75 0 00.75-.75V3.535a.75.75 0 00-1.5 0v2.033l-.312-.311A7 7 0 002.628 8.395a.75.75 0 001.449.39z", clipRule: "evenodd" }) });
|
|
4311
4923
|
}
|
|
4312
4924
|
function LinkingTab({
|
|
4313
4925
|
analysis,
|
|
@@ -4318,24 +4930,26 @@ function LinkingTab({
|
|
|
4318
4930
|
onRefresh,
|
|
4319
4931
|
text,
|
|
4320
4932
|
documentId,
|
|
4321
|
-
publication
|
|
4933
|
+
publication,
|
|
4934
|
+
sanityBaseUrl,
|
|
4935
|
+
documentType
|
|
4322
4936
|
}) {
|
|
4323
4937
|
if (!analysis) {
|
|
4324
|
-
return /* @__PURE__ */
|
|
4325
|
-
/* @__PURE__ */
|
|
4326
|
-
/* @__PURE__ */
|
|
4938
|
+
return /* @__PURE__ */ jsxs12("div", { style: { padding: 24, textAlign: "center" }, children: [
|
|
4939
|
+
/* @__PURE__ */ jsx13("div", { style: { fontSize: 13, color: "#4b5563", fontWeight: 500 }, children: "Waiting for keyword analysis" }),
|
|
4940
|
+
/* @__PURE__ */ jsx13("div", { style: { fontSize: 11, color: "#4b5563", marginTop: 4 }, children: "Linking reads the article keywords and topic to find related published articles. It starts on its own once the Keywords tab finishes." })
|
|
4327
4941
|
] });
|
|
4328
4942
|
}
|
|
4329
4943
|
const wordCount2 = text ? text.split(/\s+/).filter(Boolean).length : 0;
|
|
4330
4944
|
const recommendedMin = Math.max(1, Math.round(wordCount2 / 1e3 * 2));
|
|
4331
4945
|
const recommendedMax = Math.max(2, Math.round(wordCount2 / 1e3 * 5));
|
|
4332
|
-
return /* @__PURE__ */
|
|
4333
|
-
/* @__PURE__ */
|
|
4946
|
+
return /* @__PURE__ */ jsx13("div", { style: { padding: 12, display: "flex", flexDirection: "column", gap: 12 }, children: /* @__PURE__ */ jsxs12("div", { id: "anchor-linking-suggestions", style: cardStyle4, children: [
|
|
4947
|
+
/* @__PURE__ */ jsx13(
|
|
4334
4948
|
SectionHeader3,
|
|
4335
4949
|
{
|
|
4336
4950
|
label: "Suggested Links",
|
|
4337
4951
|
iconColor: MJH_BLUE,
|
|
4338
|
-
action: /* @__PURE__ */
|
|
4952
|
+
action: /* @__PURE__ */ jsx13(
|
|
4339
4953
|
"button",
|
|
4340
4954
|
{
|
|
4341
4955
|
onClick: onRefresh,
|
|
@@ -4350,20 +4964,20 @@ function LinkingTab({
|
|
|
4350
4964
|
fontSize: 10
|
|
4351
4965
|
},
|
|
4352
4966
|
title: "Refresh",
|
|
4353
|
-
children: /* @__PURE__ */
|
|
4967
|
+
children: /* @__PURE__ */ jsx13(RefreshIcon, { spinning: isLoading })
|
|
4354
4968
|
}
|
|
4355
4969
|
)
|
|
4356
4970
|
}
|
|
4357
4971
|
),
|
|
4358
|
-
/* @__PURE__ */
|
|
4972
|
+
/* @__PURE__ */ jsxs12("div", { style: { fontSize: 11, color: "#1f2937", marginBottom: 8, lineHeight: 1.55 }, children: [
|
|
4359
4973
|
"Other articles on this site that fit this topic.",
|
|
4360
|
-
wordCount2 > 0 && /* @__PURE__ */
|
|
4974
|
+
wordCount2 > 0 && /* @__PURE__ */ jsxs12(Fragment6, { children: [
|
|
4361
4975
|
" ",
|
|
4362
4976
|
"For a ",
|
|
4363
4977
|
wordCount2.toLocaleString(),
|
|
4364
4978
|
"-word article, aim for",
|
|
4365
4979
|
" ",
|
|
4366
|
-
/* @__PURE__ */
|
|
4980
|
+
/* @__PURE__ */ jsxs12("strong", { children: [
|
|
4367
4981
|
recommendedMin,
|
|
4368
4982
|
"-",
|
|
4369
4983
|
recommendedMax,
|
|
@@ -4372,17 +4986,17 @@ function LinkingTab({
|
|
|
4372
4986
|
"."
|
|
4373
4987
|
] })
|
|
4374
4988
|
] }),
|
|
4375
|
-
/* @__PURE__ */
|
|
4989
|
+
/* @__PURE__ */ jsxs12("div", { style: { fontSize: 10, color: "#4b5563", marginBottom: 6, lineHeight: 1.5 }, children: [
|
|
4376
4990
|
"Each suggestion gets a 0-100% match score from three signals - ",
|
|
4377
|
-
/* @__PURE__ */
|
|
4991
|
+
/* @__PURE__ */ jsx13("strong", { children: "topic match" }),
|
|
4378
4992
|
", ",
|
|
4379
|
-
/* @__PURE__ */
|
|
4993
|
+
/* @__PURE__ */ jsx13("strong", { children: "freshness" }),
|
|
4380
4994
|
", and ",
|
|
4381
|
-
/* @__PURE__ */
|
|
4995
|
+
/* @__PURE__ */ jsx13("strong", { children: "section fit" }),
|
|
4382
4996
|
" (where in your article the link belongs). The percentage on each card is the weighted total:"
|
|
4383
4997
|
] }),
|
|
4384
|
-
/* @__PURE__ */
|
|
4385
|
-
isStale && suggestions.length > 0 && !isLoading && /* @__PURE__ */
|
|
4998
|
+
/* @__PURE__ */ jsx13("div", { style: { marginBottom: 10 }, children: /* @__PURE__ */ jsx13(ScoreDonutLegend, {}) }),
|
|
4999
|
+
isStale && suggestions.length > 0 && !isLoading && /* @__PURE__ */ jsxs12(
|
|
4386
5000
|
"div",
|
|
4387
5001
|
{
|
|
4388
5002
|
onClick: onRefresh,
|
|
@@ -4399,16 +5013,16 @@ function LinkingTab({
|
|
|
4399
5013
|
cursor: "pointer"
|
|
4400
5014
|
},
|
|
4401
5015
|
children: [
|
|
4402
|
-
/* @__PURE__ */
|
|
4403
|
-
/* @__PURE__ */
|
|
5016
|
+
/* @__PURE__ */ jsx13("span", { style: { fontSize: 11, color: "#92400e" }, children: "Your article changed since these were generated." }),
|
|
5017
|
+
/* @__PURE__ */ jsx13("span", { style: { fontSize: 11, fontWeight: 700, color: "#8B7310", textDecoration: "underline", flexShrink: 0 }, children: "Refresh" })
|
|
4404
5018
|
]
|
|
4405
5019
|
}
|
|
4406
5020
|
),
|
|
4407
|
-
isLoading && suggestions.length === 0 && /* @__PURE__ */
|
|
4408
|
-
/* @__PURE__ */
|
|
4409
|
-
/* @__PURE__ */
|
|
5021
|
+
isLoading && suggestions.length === 0 && /* @__PURE__ */ jsxs12("div", { style: { display: "flex", alignItems: "center", justifyContent: "center", gap: 8, padding: "16px 0" }, children: [
|
|
5022
|
+
/* @__PURE__ */ jsx13(LoadingBars, { size: "xs", color: MJH_BLUE }),
|
|
5023
|
+
/* @__PURE__ */ jsx13("span", { style: { fontSize: 11, color: "#4b5563" }, children: "Ranking candidates..." })
|
|
4410
5024
|
] }),
|
|
4411
|
-
!isLoading && error && /* @__PURE__ */
|
|
5025
|
+
!isLoading && error && /* @__PURE__ */ jsxs12(
|
|
4412
5026
|
"div",
|
|
4413
5027
|
{
|
|
4414
5028
|
style: {
|
|
@@ -4419,9 +5033,9 @@ function LinkingTab({
|
|
|
4419
5033
|
textAlign: "center"
|
|
4420
5034
|
},
|
|
4421
5035
|
children: [
|
|
4422
|
-
/* @__PURE__ */
|
|
4423
|
-
/* @__PURE__ */
|
|
4424
|
-
/* @__PURE__ */
|
|
5036
|
+
/* @__PURE__ */ jsx13("div", { style: { fontSize: 11.5, color: "#b91c1c", fontWeight: 600, marginBottom: 2 }, children: "Couldn't load suggestions" }),
|
|
5037
|
+
/* @__PURE__ */ jsx13("div", { style: { fontSize: 10.5, color: "#4b5563", marginBottom: 8 }, children: error }),
|
|
5038
|
+
/* @__PURE__ */ jsx13(
|
|
4425
5039
|
"button",
|
|
4426
5040
|
{
|
|
4427
5041
|
onClick: onRefresh,
|
|
@@ -4441,11 +5055,11 @@ function LinkingTab({
|
|
|
4441
5055
|
]
|
|
4442
5056
|
}
|
|
4443
5057
|
),
|
|
4444
|
-
!isLoading && !error && suggestions.length === 0 && /* @__PURE__ */
|
|
4445
|
-
/* @__PURE__ */
|
|
4446
|
-
/* @__PURE__ */
|
|
5058
|
+
!isLoading && !error && suggestions.length === 0 && /* @__PURE__ */ jsxs12("div", { style: { fontSize: 11, color: "#1f2937", padding: "10px 12px", lineHeight: 1.55, background: "rgba(0,93,172,0.04)", borderRadius: 8, border: "1px solid rgba(0,93,172,0.12)" }, children: [
|
|
5059
|
+
/* @__PURE__ */ jsx13("div", { style: { fontWeight: 700, marginBottom: 4, color: "#1f2937" }, children: "No closely related articles found." }),
|
|
5060
|
+
/* @__PURE__ */ jsx13("div", { style: { color: "#4b5563" }, children: "Linking searched your publication for articles on this topic and did not find a strong match. As more related content is published, suggestions will appear here." })
|
|
4447
5061
|
] }),
|
|
4448
|
-
suggestions.length > 0 && /* @__PURE__ */
|
|
5062
|
+
suggestions.length > 0 && /* @__PURE__ */ jsx13("div", { style: { display: "flex", flexDirection: "column", gap: 10 }, children: suggestions.map((s) => /* @__PURE__ */ jsxs12(
|
|
4449
5063
|
"div",
|
|
4450
5064
|
{
|
|
4451
5065
|
style: {
|
|
@@ -4458,7 +5072,7 @@ function LinkingTab({
|
|
|
4458
5072
|
alignItems: "flex-start"
|
|
4459
5073
|
},
|
|
4460
5074
|
children: [
|
|
4461
|
-
/* @__PURE__ */
|
|
5075
|
+
/* @__PURE__ */ jsx13(
|
|
4462
5076
|
ScoreDonut,
|
|
4463
5077
|
{
|
|
4464
5078
|
size: 64,
|
|
@@ -4468,22 +5082,31 @@ function LinkingTab({
|
|
|
4468
5082
|
composite: s.compositeScore
|
|
4469
5083
|
}
|
|
4470
5084
|
),
|
|
4471
|
-
/* @__PURE__ */
|
|
4472
|
-
/* @__PURE__ */
|
|
5085
|
+
/* @__PURE__ */ jsxs12("div", { style: { flex: 1, minWidth: 0 }, children: [
|
|
5086
|
+
/* @__PURE__ */ jsxs12("div", { style: { display: "flex", alignItems: "center", gap: 6, marginBottom: 3, flexWrap: "wrap" }, children: [
|
|
4473
5087
|
freshnessChip(s.freshnessLabel, s.freshnessScore),
|
|
4474
|
-
s.publishedAt && /* @__PURE__ */
|
|
5088
|
+
s.publishedAt && /* @__PURE__ */ jsx13("span", { style: { fontSize: 10, color: "#4b5563" }, children: formatDate(s.publishedAt) })
|
|
4475
5089
|
] }),
|
|
4476
|
-
/* @__PURE__ */
|
|
4477
|
-
/* @__PURE__ */
|
|
5090
|
+
/* @__PURE__ */ jsx13("div", { style: { fontSize: 12, fontWeight: 700, color: "#1f2937", lineHeight: 1.4, marginBottom: 2 }, children: s.title }),
|
|
5091
|
+
/* @__PURE__ */ jsxs12("div", { style: { fontSize: 10, color: "#4b5563", fontFamily: "ui-monospace, SFMono-Regular, monospace", marginBottom: 6 }, children: [
|
|
4478
5092
|
"/",
|
|
4479
5093
|
s.slug
|
|
4480
5094
|
] }),
|
|
4481
|
-
|
|
4482
|
-
|
|
5095
|
+
(() => {
|
|
5096
|
+
const liveUrl = buildLiveUrl(publication, s.slug);
|
|
5097
|
+
const sanityUrl = buildSanityUrl(sanityBaseUrl, s._id, documentType);
|
|
5098
|
+
if (!liveUrl && !sanityUrl) return null;
|
|
5099
|
+
return /* @__PURE__ */ jsxs12("div", { style: { display: "flex", flexWrap: "wrap", gap: 6, marginBottom: 6 }, children: [
|
|
5100
|
+
sanityUrl && /* @__PURE__ */ jsx13(LinkChip, { href: sanityUrl, label: "Inside Sanity", color: MJH_BLUE }),
|
|
5101
|
+
liveUrl && /* @__PURE__ */ jsx13(LinkChip, { href: liveUrl, label: "Live site", color: "#4b5563" })
|
|
5102
|
+
] });
|
|
5103
|
+
})(),
|
|
5104
|
+
s.relevanceReason && /* @__PURE__ */ jsxs12("div", { style: { fontSize: 11, color: "#1f2937", marginBottom: 6, lineHeight: 1.45 }, children: [
|
|
5105
|
+
/* @__PURE__ */ jsx13("span", { style: { fontWeight: 700, color: "#4b5563" }, children: "Why it fits:" }),
|
|
4483
5106
|
" ",
|
|
4484
|
-
/* @__PURE__ */
|
|
5107
|
+
/* @__PURE__ */ jsx13("span", { style: { fontStyle: "italic" }, children: s.relevanceReason })
|
|
4485
5108
|
] }),
|
|
4486
|
-
s.anchorQuote && /* @__PURE__ */
|
|
5109
|
+
s.anchorQuote && /* @__PURE__ */ jsxs12(
|
|
4487
5110
|
"div",
|
|
4488
5111
|
{
|
|
4489
5112
|
style: {
|
|
@@ -4497,21 +5120,21 @@ function LinkingTab({
|
|
|
4497
5120
|
lineHeight: 1.5
|
|
4498
5121
|
},
|
|
4499
5122
|
children: [
|
|
4500
|
-
/* @__PURE__ */
|
|
5123
|
+
/* @__PURE__ */ jsxs12("div", { style: { fontSize: 9, fontWeight: 700, color: "#4b5563", textTransform: "uppercase", letterSpacing: "0.05em", marginBottom: 3 }, children: [
|
|
4501
5124
|
"Where to link from - paragraph ",
|
|
4502
5125
|
s.anchorParagraph
|
|
4503
5126
|
] }),
|
|
4504
|
-
/* @__PURE__ */
|
|
5127
|
+
/* @__PURE__ */ jsxs12("div", { style: { fontStyle: "italic" }, children: [
|
|
4505
5128
|
'"',
|
|
4506
5129
|
s.anchorQuote,
|
|
4507
5130
|
'"'
|
|
4508
5131
|
] }),
|
|
4509
|
-
s.anchorReason && /* @__PURE__ */
|
|
5132
|
+
s.anchorReason && /* @__PURE__ */ jsx13("div", { style: { fontSize: 10, color: "#4b5563", marginTop: 3, lineHeight: 1.45 }, children: s.anchorReason })
|
|
4510
5133
|
]
|
|
4511
5134
|
}
|
|
4512
5135
|
)
|
|
4513
5136
|
] }),
|
|
4514
|
-
/* @__PURE__ */
|
|
5137
|
+
/* @__PURE__ */ jsx13("div", { style: { flexShrink: 0 }, children: /* @__PURE__ */ jsx13(
|
|
4515
5138
|
FeedbackButton,
|
|
4516
5139
|
{
|
|
4517
5140
|
suggestionType: "internal_link",
|
|
@@ -4528,8 +5151,8 @@ function LinkingTab({
|
|
|
4528
5151
|
}
|
|
4529
5152
|
|
|
4530
5153
|
// src/components/tabs/MetaTab.tsx
|
|
4531
|
-
import { useMemo as useMemo3
|
|
4532
|
-
import { Fragment as
|
|
5154
|
+
import { useMemo as useMemo3 } from "react";
|
|
5155
|
+
import { Fragment as Fragment7, jsx as jsx14, jsxs as jsxs13 } from "react/jsx-runtime";
|
|
4533
5156
|
function containsKeywordTokens(haystack, needle) {
|
|
4534
5157
|
if (!needle) return true;
|
|
4535
5158
|
const tokens = needle.toLowerCase().split(/\s+/).filter((t) => t.length > 1);
|
|
@@ -4552,7 +5175,7 @@ function StatusBadge({ status }) {
|
|
|
4552
5175
|
error: { bg: "rgba(220,38,38,0.1)", color: "#dc2626", label: "Fix" }
|
|
4553
5176
|
};
|
|
4554
5177
|
const c = map[status];
|
|
4555
|
-
return /* @__PURE__ */
|
|
5178
|
+
return /* @__PURE__ */ jsx14(
|
|
4556
5179
|
"span",
|
|
4557
5180
|
{
|
|
4558
5181
|
style: {
|
|
@@ -4571,12 +5194,12 @@ function StatusBadge({ status }) {
|
|
|
4571
5194
|
);
|
|
4572
5195
|
}
|
|
4573
5196
|
function AuditCard({ label, value, status, recommendation, anchorId, footer }) {
|
|
4574
|
-
return /* @__PURE__ */
|
|
4575
|
-
/* @__PURE__ */
|
|
4576
|
-
/* @__PURE__ */
|
|
4577
|
-
/* @__PURE__ */
|
|
5197
|
+
return /* @__PURE__ */ jsxs13("div", { id: anchorId, style: cardStyle5, children: [
|
|
5198
|
+
/* @__PURE__ */ jsxs13("div", { style: { display: "flex", alignItems: "center", justifyContent: "space-between", gap: 8, marginBottom: 6 }, children: [
|
|
5199
|
+
/* @__PURE__ */ jsx14("span", { style: { fontSize: 10.5, textTransform: "uppercase", letterSpacing: "0.06em", color: "#4b5563", fontWeight: 600 }, children: label }),
|
|
5200
|
+
/* @__PURE__ */ jsx14(StatusBadge, { status })
|
|
4578
5201
|
] }),
|
|
4579
|
-
/* @__PURE__ */
|
|
5202
|
+
/* @__PURE__ */ jsx14(
|
|
4580
5203
|
"div",
|
|
4581
5204
|
{
|
|
4582
5205
|
style: {
|
|
@@ -4589,7 +5212,7 @@ function AuditCard({ label, value, status, recommendation, anchorId, footer }) {
|
|
|
4589
5212
|
children: value
|
|
4590
5213
|
}
|
|
4591
5214
|
),
|
|
4592
|
-
recommendation && /* @__PURE__ */
|
|
5215
|
+
recommendation && /* @__PURE__ */ jsx14(
|
|
4593
5216
|
"div",
|
|
4594
5217
|
{
|
|
4595
5218
|
style: {
|
|
@@ -4608,23 +5231,37 @@ function AuditCard({ label, value, status, recommendation, anchorId, footer }) {
|
|
|
4608
5231
|
footer
|
|
4609
5232
|
] });
|
|
4610
5233
|
}
|
|
4611
|
-
function
|
|
5234
|
+
function keywordCoverageNote(haystack, primaryKeyword, secondaryKeyword) {
|
|
5235
|
+
const hasPrimary = primaryKeyword ? containsKeywordTokens(haystack, primaryKeyword) : true;
|
|
5236
|
+
const hasSecondary = secondaryKeyword ? containsKeywordTokens(haystack, secondaryKeyword) : true;
|
|
5237
|
+
if (primaryKeyword && !hasPrimary && secondaryKeyword && !hasSecondary) {
|
|
5238
|
+
return `Neither your primary keyword "${primaryKeyword}" nor your secondary keyword "${secondaryKeyword}" appears here.`;
|
|
5239
|
+
}
|
|
5240
|
+
if (primaryKeyword && !hasPrimary) {
|
|
5241
|
+
return `Your primary keyword "${primaryKeyword}" isn't included${secondaryKeyword ? ` (secondary keyword "${secondaryKeyword}" ${hasSecondary ? "is" : "isn't"}).` : "."}`;
|
|
5242
|
+
}
|
|
5243
|
+
if (secondaryKeyword && !hasSecondary) {
|
|
5244
|
+
return `Your primary keyword "${primaryKeyword}" is included, but your secondary keyword "${secondaryKeyword}" is not. Work it in if it reads naturally.`;
|
|
5245
|
+
}
|
|
5246
|
+
return "";
|
|
5247
|
+
}
|
|
5248
|
+
function metaDescriptionAudit(meta, primaryKeyword, secondaryKeyword) {
|
|
4612
5249
|
if (!meta) {
|
|
4613
5250
|
return {
|
|
4614
5251
|
label: "Meta Description",
|
|
4615
5252
|
value: "Missing",
|
|
4616
5253
|
status: "error",
|
|
4617
|
-
recommendation:
|
|
5254
|
+
recommendation: `Add a 120-160 character meta description that includes your primary keyword${secondaryKeyword ? " (and your secondary keyword if it fits)" : ""}.`
|
|
4618
5255
|
};
|
|
4619
5256
|
}
|
|
4620
5257
|
const len = meta.length;
|
|
4621
|
-
const
|
|
5258
|
+
const kwNote = keywordCoverageNote(meta, primaryKeyword, secondaryKeyword);
|
|
4622
5259
|
if (len < 120) {
|
|
4623
5260
|
return {
|
|
4624
5261
|
label: "Meta Description",
|
|
4625
5262
|
value: `${meta} (${len} chars)`,
|
|
4626
5263
|
status: "warning",
|
|
4627
|
-
recommendation: `
|
|
5264
|
+
recommendation: `A little short - aim for 120-160 characters.${kwNote ? ` ${kwNote}` : ""}`
|
|
4628
5265
|
};
|
|
4629
5266
|
}
|
|
4630
5267
|
if (len > 160) {
|
|
@@ -4632,15 +5269,15 @@ function metaDescriptionAudit(meta, primaryKeyword) {
|
|
|
4632
5269
|
label: "Meta Description",
|
|
4633
5270
|
value: `${meta} (${len} chars)`,
|
|
4634
5271
|
status: "warning",
|
|
4635
|
-
recommendation: `
|
|
5272
|
+
recommendation: `Over 160 characters - Google may shorten it in search, so trim it a little.${kwNote ? ` ${kwNote}` : ""}`
|
|
4636
5273
|
};
|
|
4637
5274
|
}
|
|
4638
|
-
if (
|
|
5275
|
+
if (kwNote) {
|
|
4639
5276
|
return {
|
|
4640
5277
|
label: "Meta Description",
|
|
4641
5278
|
value: `${meta} (${len} chars)`,
|
|
4642
5279
|
status: "warning",
|
|
4643
|
-
recommendation: `Length is good
|
|
5280
|
+
recommendation: `Length is good. ${kwNote}`
|
|
4644
5281
|
};
|
|
4645
5282
|
}
|
|
4646
5283
|
return {
|
|
@@ -4688,88 +5325,6 @@ function titleAudit(title, primaryKeyword) {
|
|
|
4688
5325
|
}
|
|
4689
5326
|
return { label: "Title Tag", value: `${title} (${len} chars)`, status: "good" };
|
|
4690
5327
|
}
|
|
4691
|
-
function urlAudit(slug, primaryKeyword) {
|
|
4692
|
-
if (!slug) {
|
|
4693
|
-
return { label: "URL Slug", value: "Missing", status: "error", recommendation: "Add a clean, hyphenated URL slug containing the primary keyword. Aim for 3-5 words." };
|
|
4694
|
-
}
|
|
4695
|
-
const issues = [];
|
|
4696
|
-
if (slug.length > 60) issues.push("longer than 60 characters - aim for 3-5 words");
|
|
4697
|
-
if (/[A-Z]/.test(slug)) issues.push("contains uppercase letters");
|
|
4698
|
-
if (/_/.test(slug)) issues.push("uses underscores instead of hyphens");
|
|
4699
|
-
if (/[^a-zA-Z0-9-/]/.test(slug.replace(/^\//, ""))) issues.push("contains special characters");
|
|
4700
|
-
if (primaryKeyword && !containsKeywordTokens(slug.replace(/-/g, " "), primaryKeyword)) {
|
|
4701
|
-
issues.push(`missing primary keyword "${primaryKeyword}"`);
|
|
4702
|
-
}
|
|
4703
|
-
if (issues.length === 0) {
|
|
4704
|
-
return { label: "URL Slug", value: `/${slug}`, status: "good" };
|
|
4705
|
-
}
|
|
4706
|
-
return {
|
|
4707
|
-
label: "URL Slug",
|
|
4708
|
-
value: `/${slug}`,
|
|
4709
|
-
status: "warning",
|
|
4710
|
-
recommendation: `Issues: ${issues.join(", ")}.`
|
|
4711
|
-
};
|
|
4712
|
-
}
|
|
4713
|
-
function SlugRedirectNotice() {
|
|
4714
|
-
const [expanded, setExpanded] = useState15(false);
|
|
4715
|
-
return /* @__PURE__ */ jsx13(
|
|
4716
|
-
"div",
|
|
4717
|
-
{
|
|
4718
|
-
style: {
|
|
4719
|
-
marginTop: 10,
|
|
4720
|
-
paddingTop: 10,
|
|
4721
|
-
borderTop: "1px solid rgba(0,0,0,0.07)"
|
|
4722
|
-
},
|
|
4723
|
-
children: /* @__PURE__ */ jsxs12(
|
|
4724
|
-
"div",
|
|
4725
|
-
{
|
|
4726
|
-
style: {
|
|
4727
|
-
padding: "8px 10px",
|
|
4728
|
-
background: "rgba(245,158,11,0.08)",
|
|
4729
|
-
borderLeft: "2px solid #f59e0b",
|
|
4730
|
-
borderRadius: 6
|
|
4731
|
-
},
|
|
4732
|
-
children: [
|
|
4733
|
-
/* @__PURE__ */ jsxs12("div", { style: { display: "flex", alignItems: "center", gap: 6, marginBottom: 4 }, children: [
|
|
4734
|
-
/* @__PURE__ */ jsx13("svg", { width: "12", height: "12", viewBox: "0 0 20 20", fill: "#f59e0b", "aria-hidden": "true", children: /* @__PURE__ */ jsx13("path", { fillRule: "evenodd", d: "M8.485 2.495c.673-1.167 2.357-1.167 3.03 0l6.28 10.875c.673 1.167-.17 2.625-1.516 2.625H3.72c-1.347 0-2.189-1.458-1.515-2.625L8.485 2.495zM10 5a.75.75 0 01.75.75v3.5a.75.75 0 01-1.5 0v-3.5A.75.75 0 0110 5zm0 9a1 1 0 100-2 1 1 0 000 2z", clipRule: "evenodd" }) }),
|
|
4735
|
-
/* @__PURE__ */ jsx13("span", { style: { fontSize: 10.5, fontWeight: 700, color: "#b45309", textTransform: "uppercase", letterSpacing: "0.06em" }, children: "Changing a URL?" })
|
|
4736
|
-
] }),
|
|
4737
|
-
/* @__PURE__ */ jsx13("div", { style: { fontSize: 11, color: "#1f2937", lineHeight: 1.55 }, children: "If the page has been published and indexed, you MUST add a 301 redirect from the old slug to the new one before changing it. For a brand-new page that's never been published, no redirect needed." }),
|
|
4738
|
-
/* @__PURE__ */ jsxs12(
|
|
4739
|
-
"button",
|
|
4740
|
-
{
|
|
4741
|
-
onClick: () => setExpanded((v) => !v),
|
|
4742
|
-
style: {
|
|
4743
|
-
display: "flex",
|
|
4744
|
-
alignItems: "center",
|
|
4745
|
-
gap: 3,
|
|
4746
|
-
marginTop: 6,
|
|
4747
|
-
padding: 0,
|
|
4748
|
-
background: "none",
|
|
4749
|
-
border: "none",
|
|
4750
|
-
cursor: "pointer",
|
|
4751
|
-
fontSize: 10.5,
|
|
4752
|
-
fontWeight: 700,
|
|
4753
|
-
color: "#b45309",
|
|
4754
|
-
fontFamily: "inherit"
|
|
4755
|
-
},
|
|
4756
|
-
children: [
|
|
4757
|
-
expanded ? "Show less" : "Learn more",
|
|
4758
|
-
/* @__PURE__ */ jsx13("svg", { width: "10", height: "10", viewBox: "0 0 20 20", fill: "currentColor", style: { transform: expanded ? "rotate(180deg)" : "none", transition: "transform 150ms" }, children: /* @__PURE__ */ jsx13("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" }) })
|
|
4759
|
-
]
|
|
4760
|
-
}
|
|
4761
|
-
),
|
|
4762
|
-
expanded && /* @__PURE__ */ jsxs12("ul", { style: { margin: "6px 0 0", paddingLeft: 16, fontSize: 11, color: "#1f2937", lineHeight: 1.55 }, children: [
|
|
4763
|
-
/* @__PURE__ */ jsx13("li", { children: "Without the 301, the page loses every search ranking and every external link to it breaks." }),
|
|
4764
|
-
/* @__PURE__ */ jsx13("li", { children: "A 301 preserves the rankings and link equity built up on the old URL." }),
|
|
4765
|
-
/* @__PURE__ */ jsx13("li", { children: "Set this up using vanity redirects in Sanity." })
|
|
4766
|
-
] })
|
|
4767
|
-
]
|
|
4768
|
-
}
|
|
4769
|
-
)
|
|
4770
|
-
}
|
|
4771
|
-
);
|
|
4772
|
-
}
|
|
4773
5328
|
function daysSince(iso) {
|
|
4774
5329
|
if (!iso) return null;
|
|
4775
5330
|
const t = new Date(iso).getTime();
|
|
@@ -4778,20 +5333,17 @@ function daysSince(iso) {
|
|
|
4778
5333
|
}
|
|
4779
5334
|
function formatDateShort(iso) {
|
|
4780
5335
|
if (!iso) return "";
|
|
4781
|
-
|
|
4782
|
-
|
|
4783
|
-
|
|
4784
|
-
return "";
|
|
4785
|
-
}
|
|
5336
|
+
const d = new Date(iso);
|
|
5337
|
+
if (isNaN(d.getTime())) return "";
|
|
5338
|
+
return d.toLocaleDateString(void 0, { year: "numeric", month: "short", day: "numeric" });
|
|
4786
5339
|
}
|
|
4787
|
-
function MetaTab({ documentFields, primaryKeyword, isLoading }) {
|
|
5340
|
+
function MetaTab({ documentFields, primaryKeyword, secondaryKeyword, isLoading }) {
|
|
4788
5341
|
const audits = useMemo3(() => {
|
|
4789
5342
|
const list = [];
|
|
4790
5343
|
list.push(titleAudit(documentFields?.title, primaryKeyword));
|
|
4791
|
-
list.push(metaDescriptionAudit(documentFields?.metaDescription, primaryKeyword));
|
|
4792
|
-
list.push(urlAudit(documentFields?.slug, primaryKeyword));
|
|
5344
|
+
list.push(metaDescriptionAudit(documentFields?.metaDescription, primaryKeyword, secondaryKeyword));
|
|
4793
5345
|
return list;
|
|
4794
|
-
}, [documentFields, primaryKeyword]);
|
|
5346
|
+
}, [documentFields, primaryKeyword, secondaryKeyword]);
|
|
4795
5347
|
const eeatItems = useMemo3(() => {
|
|
4796
5348
|
const items = [];
|
|
4797
5349
|
const author = documentFields?.authorName;
|
|
@@ -4801,7 +5353,7 @@ function MetaTab({ documentFields, primaryKeyword, isLoading }) {
|
|
|
4801
5353
|
if (!author && authorIsRef) {
|
|
4802
5354
|
items.push({ label: "Author Byline", value: "Set (reference)", status: "good", recommendation: "Author is linked as a reference, so we can't read credentials from this view. Open the linked author page to confirm name, credentials, and bio are set." });
|
|
4803
5355
|
} else if (!author) {
|
|
4804
|
-
items.push({ label: "Author Byline", value: "Missing", status: "
|
|
5356
|
+
items.push({ label: "Author Byline", value: "Missing", status: "warning", recommendation: "Add a named author with credentials - healthcare (YMYL) content with visible authorship earns more trust from Google's E-E-A-T signals. Wire or news briefs published without a byline can disregard this." });
|
|
4805
5357
|
} else if (!creds) {
|
|
4806
5358
|
items.push({ label: "Author Byline", value: author, status: "warning", recommendation: "Author shown but credentials (MD, PharmD, RN, etc.) aren't visible. Add credential suffixes." });
|
|
4807
5359
|
} else if (!bio) {
|
|
@@ -4818,6 +5370,8 @@ function MetaTab({ documentFields, primaryKeyword, isLoading }) {
|
|
|
4818
5370
|
const freshness = Math.min(...[daysUpd, daysRev, daysPub].filter((d) => d !== null));
|
|
4819
5371
|
if (!published) {
|
|
4820
5372
|
items.push({ label: "Publish Date", value: "Missing", status: "error", recommendation: "Add a visible publish date. Required for healthcare content to be cited by Google and AI search." });
|
|
5373
|
+
} else if (daysPub === null) {
|
|
5374
|
+
items.push({ label: "Publish Date", value: "Unrecognized format", status: "warning", recommendation: "A publish date is set but couldn't be read as a valid date. Check the field value." });
|
|
4821
5375
|
} else {
|
|
4822
5376
|
items.push({ label: "Publish Date", value: formatDateShort(published), status: "good" });
|
|
4823
5377
|
}
|
|
@@ -4834,33 +5388,32 @@ function MetaTab({ documentFields, primaryKeyword, isLoading }) {
|
|
|
4834
5388
|
}, [documentFields]);
|
|
4835
5389
|
const hasAnyField = !!documentFields && (documentFields.title !== void 0 || documentFields.metaDescription !== void 0 || documentFields.slug !== void 0);
|
|
4836
5390
|
if (isLoading && !hasAnyField) {
|
|
4837
|
-
return /* @__PURE__ */
|
|
4838
|
-
/* @__PURE__ */
|
|
4839
|
-
/* @__PURE__ */
|
|
5391
|
+
return /* @__PURE__ */ jsxs13("div", { style: { padding: 24, textAlign: "center" }, children: [
|
|
5392
|
+
/* @__PURE__ */ jsx14("div", { style: { fontSize: 13, color: "#4b5563", fontWeight: 500 }, children: "Reading document fields..." }),
|
|
5393
|
+
/* @__PURE__ */ jsx14("div", { style: { fontSize: 11, color: "#4b5563", marginTop: 4 }, children: "Audit will run once content loads" })
|
|
4840
5394
|
] });
|
|
4841
5395
|
}
|
|
4842
|
-
const auditAnchors = ["anchor-meta-title", "anchor-meta-description"
|
|
4843
|
-
return /* @__PURE__ */
|
|
4844
|
-
audits.map((a, i) => /* @__PURE__ */
|
|
5396
|
+
const auditAnchors = ["anchor-meta-title", "anchor-meta-description"];
|
|
5397
|
+
return /* @__PURE__ */ jsxs13("div", { style: { padding: 12, display: "flex", flexDirection: "column", gap: 10 }, children: [
|
|
5398
|
+
audits.map((a, i) => /* @__PURE__ */ jsx14(
|
|
4845
5399
|
AuditCard,
|
|
4846
5400
|
{
|
|
4847
5401
|
anchorId: auditAnchors[i],
|
|
4848
5402
|
label: a.label,
|
|
4849
5403
|
value: a.value,
|
|
4850
5404
|
status: a.status,
|
|
4851
|
-
recommendation: a.recommendation
|
|
4852
|
-
footer: a.label === "URL Slug" ? /* @__PURE__ */ jsx13(SlugRedirectNotice, {}) : void 0
|
|
5405
|
+
recommendation: a.recommendation
|
|
4853
5406
|
},
|
|
4854
5407
|
i
|
|
4855
5408
|
)),
|
|
4856
|
-
eeatItems.length > 0 && /* @__PURE__ */
|
|
4857
|
-
/* @__PURE__ */
|
|
4858
|
-
/* @__PURE__ */
|
|
4859
|
-
/* @__PURE__ */
|
|
4860
|
-
/* @__PURE__ */
|
|
5409
|
+
eeatItems.length > 0 && /* @__PURE__ */ jsxs13(Fragment7, { children: [
|
|
5410
|
+
/* @__PURE__ */ jsxs13("div", { style: { display: "flex", alignItems: "center", gap: 8, margin: "6px 4px 0" }, children: [
|
|
5411
|
+
/* @__PURE__ */ jsx14("div", { style: { height: 1, flex: 1, background: "rgba(0,0,0,0.06)" } }),
|
|
5412
|
+
/* @__PURE__ */ jsx14("span", { style: { fontSize: 10, fontWeight: 700, color: "#4b5563", textTransform: "uppercase", letterSpacing: "0.08em" }, children: "Author & Freshness" }),
|
|
5413
|
+
/* @__PURE__ */ jsx14("div", { style: { height: 1, flex: 1, background: "rgba(0,0,0,0.06)" } })
|
|
4861
5414
|
] }),
|
|
4862
|
-
/* @__PURE__ */
|
|
4863
|
-
eeatItems.map((item, i) => /* @__PURE__ */
|
|
5415
|
+
/* @__PURE__ */ jsx14("div", { style: { fontSize: 10, color: "#4b5563", padding: "0 4px", marginTop: -4 }, children: "Google looks for a named author with credentials and recent updates on healthcare content." }),
|
|
5416
|
+
eeatItems.map((item, i) => /* @__PURE__ */ jsx14(
|
|
4864
5417
|
AuditCard,
|
|
4865
5418
|
{
|
|
4866
5419
|
label: item.label,
|
|
@@ -4875,8 +5428,86 @@ function MetaTab({ documentFields, primaryKeyword, isLoading }) {
|
|
|
4875
5428
|
}
|
|
4876
5429
|
|
|
4877
5430
|
// src/components/tabs/TechnicalTab.tsx
|
|
4878
|
-
import { useMemo as useMemo4 } from "react";
|
|
4879
|
-
import { Fragment as
|
|
5431
|
+
import { useMemo as useMemo4, useState as useState15 } from "react";
|
|
5432
|
+
import { Fragment as Fragment8, jsx as jsx15, jsxs as jsxs14 } from "react/jsx-runtime";
|
|
5433
|
+
function containsKeywordTokens2(haystack, needle) {
|
|
5434
|
+
if (!needle) return true;
|
|
5435
|
+
const tokens = needle.toLowerCase().split(/\s+/).filter((t) => t.length > 1);
|
|
5436
|
+
if (tokens.length === 0) return true;
|
|
5437
|
+
const lower = haystack.toLowerCase();
|
|
5438
|
+
return tokens.every((t) => lower.includes(t));
|
|
5439
|
+
}
|
|
5440
|
+
function keywordLeadsUrl(slug, primaryKeyword) {
|
|
5441
|
+
if (!primaryKeyword) return true;
|
|
5442
|
+
const slugWords = slug.toLowerCase().replace(/[^a-z0-9]+/g, " ").trim().split(/\s+/).filter(Boolean);
|
|
5443
|
+
const tokens = primaryKeyword.toLowerCase().split(/\s+/).filter((t) => t.length > 1);
|
|
5444
|
+
if (tokens.length === 0 || slugWords.length === 0) return true;
|
|
5445
|
+
let earliest = Infinity;
|
|
5446
|
+
for (const t of tokens) {
|
|
5447
|
+
const idx = slugWords.findIndex((w) => w.includes(t));
|
|
5448
|
+
if (idx >= 0) earliest = Math.min(earliest, idx);
|
|
5449
|
+
}
|
|
5450
|
+
return earliest <= 2;
|
|
5451
|
+
}
|
|
5452
|
+
function urlAudit(slug, primaryKeyword, secondaryKeyword) {
|
|
5453
|
+
const SHORT_DESC = "Keep the URL short and descriptive - concise URLs are easier to read - and avoid trailing, duplicate, or excessive spaces.";
|
|
5454
|
+
if (!slug) {
|
|
5455
|
+
return {
|
|
5456
|
+
label: "URL Slug",
|
|
5457
|
+
value: "Missing",
|
|
5458
|
+
status: "warning",
|
|
5459
|
+
recommendation: `Add a URL slug that leads with your primary keyword. ${SHORT_DESC}`
|
|
5460
|
+
};
|
|
5461
|
+
}
|
|
5462
|
+
const slugAsWords = slug.replace(/-/g, " ");
|
|
5463
|
+
const hasPrimary = primaryKeyword ? containsKeywordTokens2(slugAsWords, primaryKeyword) : true;
|
|
5464
|
+
const leads = primaryKeyword ? keywordLeadsUrl(slug, primaryKeyword) : true;
|
|
5465
|
+
const hasSecondary = secondaryKeyword ? containsKeywordTokens2(slugAsWords, secondaryKeyword) : true;
|
|
5466
|
+
if (primaryKeyword && !hasPrimary) {
|
|
5467
|
+
const secNote = secondaryKeyword && !hasSecondary ? ` Your secondary keyword "${secondaryKeyword}" could follow it.` : "";
|
|
5468
|
+
return {
|
|
5469
|
+
label: "URL Slug",
|
|
5470
|
+
value: `/${slug}`,
|
|
5471
|
+
status: "warning",
|
|
5472
|
+
recommendation: `Work your primary keyword "${primaryKeyword}" into the URL, ideally at the start - if the address gets shortened, a leading keyword still shows.${secNote} ${SHORT_DESC}`
|
|
5473
|
+
};
|
|
5474
|
+
}
|
|
5475
|
+
if (primaryKeyword && hasPrimary && !leads) {
|
|
5476
|
+
return {
|
|
5477
|
+
label: "URL Slug",
|
|
5478
|
+
value: `/${slug}`,
|
|
5479
|
+
status: "warning",
|
|
5480
|
+
recommendation: `Your primary keyword is in the URL but not at the start. Leading with it reads better and holds up if the address gets shortened. ${SHORT_DESC}`
|
|
5481
|
+
};
|
|
5482
|
+
}
|
|
5483
|
+
return { label: "URL Slug", value: `/${slug}`, status: "good" };
|
|
5484
|
+
}
|
|
5485
|
+
function SlugRedirectNotice() {
|
|
5486
|
+
const [expanded, setExpanded] = useState15(false);
|
|
5487
|
+
return /* @__PURE__ */ jsx15("div", { style: { marginTop: 10, paddingTop: 10, borderTop: "1px solid rgba(0,0,0,0.07)" }, children: /* @__PURE__ */ jsxs14("div", { style: { padding: "8px 10px", background: "rgba(245,158,11,0.08)", borderLeft: "2px solid #f59e0b", borderRadius: 6 }, children: [
|
|
5488
|
+
/* @__PURE__ */ jsxs14("div", { style: { display: "flex", alignItems: "center", gap: 6, marginBottom: 4 }, children: [
|
|
5489
|
+
/* @__PURE__ */ jsx15("svg", { width: "12", height: "12", viewBox: "0 0 20 20", fill: "#f59e0b", "aria-hidden": "true", children: /* @__PURE__ */ jsx15("path", { fillRule: "evenodd", d: "M8.485 2.495c.673-1.167 2.357-1.167 3.03 0l6.28 10.875c.673 1.167-.17 2.625-1.516 2.625H3.72c-1.347 0-2.189-1.458-1.515-2.625L8.485 2.495zM10 5a.75.75 0 01.75.75v3.5a.75.75 0 01-1.5 0v-3.5A.75.75 0 0110 5zm0 9a1 1 0 100-2 1 1 0 000 2z", clipRule: "evenodd" }) }),
|
|
5490
|
+
/* @__PURE__ */ jsx15("span", { style: { fontSize: 10.5, fontWeight: 700, color: "#b45309", textTransform: "uppercase", letterSpacing: "0.06em" }, children: "Changing a URL?" })
|
|
5491
|
+
] }),
|
|
5492
|
+
/* @__PURE__ */ jsx15("div", { style: { fontSize: 11, color: "#1f2937", lineHeight: 1.55 }, children: "If the page has been published and indexed, you MUST add a 301 redirect from the old slug to the new one before changing it. For a brand-new page that's never been published, no redirect needed." }),
|
|
5493
|
+
/* @__PURE__ */ jsxs14(
|
|
5494
|
+
"button",
|
|
5495
|
+
{
|
|
5496
|
+
onClick: () => setExpanded((v) => !v),
|
|
5497
|
+
style: { display: "flex", alignItems: "center", gap: 3, marginTop: 6, padding: 0, background: "none", border: "none", cursor: "pointer", fontSize: 10.5, fontWeight: 700, color: "#b45309", fontFamily: "inherit" },
|
|
5498
|
+
children: [
|
|
5499
|
+
expanded ? "Show less" : "Learn more",
|
|
5500
|
+
/* @__PURE__ */ jsx15("svg", { width: "10", height: "10", viewBox: "0 0 20 20", fill: "currentColor", style: { transform: expanded ? "rotate(180deg)" : "none", transition: "transform 150ms" }, children: /* @__PURE__ */ jsx15("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" }) })
|
|
5501
|
+
]
|
|
5502
|
+
}
|
|
5503
|
+
),
|
|
5504
|
+
expanded && /* @__PURE__ */ jsxs14("ul", { style: { margin: "6px 0 0", paddingLeft: 16, fontSize: 11, color: "#1f2937", lineHeight: 1.55 }, children: [
|
|
5505
|
+
/* @__PURE__ */ jsx15("li", { children: "Without the 301, the page loses every search ranking and every external link to it breaks." }),
|
|
5506
|
+
/* @__PURE__ */ jsx15("li", { children: "A 301 preserves the rankings and link equity built up on the old URL." }),
|
|
5507
|
+
/* @__PURE__ */ jsx15("li", { children: "Set this up using vanity redirects in Sanity." })
|
|
5508
|
+
] })
|
|
5509
|
+
] }) });
|
|
5510
|
+
}
|
|
4880
5511
|
var cardStyle6 = {
|
|
4881
5512
|
borderRadius: 14,
|
|
4882
5513
|
background: "rgba(255,255,255,0.55)",
|
|
@@ -4892,7 +5523,7 @@ function StatusBadge2({ status }) {
|
|
|
4892
5523
|
error: { bg: "rgba(220,38,38,0.1)", color: "#dc2626", label: "Fix" }
|
|
4893
5524
|
};
|
|
4894
5525
|
const c = map[status];
|
|
4895
|
-
return /* @__PURE__ */
|
|
5526
|
+
return /* @__PURE__ */ jsx15(
|
|
4896
5527
|
"span",
|
|
4897
5528
|
{
|
|
4898
5529
|
style: {
|
|
@@ -4915,14 +5546,15 @@ function AuditCard2({
|
|
|
4915
5546
|
value,
|
|
4916
5547
|
status,
|
|
4917
5548
|
recommendation,
|
|
4918
|
-
anchorId
|
|
5549
|
+
anchorId,
|
|
5550
|
+
footer
|
|
4919
5551
|
}) {
|
|
4920
|
-
return /* @__PURE__ */
|
|
4921
|
-
/* @__PURE__ */
|
|
4922
|
-
/* @__PURE__ */
|
|
4923
|
-
/* @__PURE__ */
|
|
5552
|
+
return /* @__PURE__ */ jsxs14("div", { id: anchorId, style: cardStyle6, children: [
|
|
5553
|
+
/* @__PURE__ */ jsxs14("div", { style: { display: "flex", alignItems: "center", justifyContent: "space-between", gap: 8, marginBottom: 6 }, children: [
|
|
5554
|
+
/* @__PURE__ */ jsx15("span", { style: { fontSize: 10.5, textTransform: "uppercase", letterSpacing: "0.06em", color: "#4b5563", fontWeight: 600 }, children: label }),
|
|
5555
|
+
/* @__PURE__ */ jsx15(StatusBadge2, { status })
|
|
4924
5556
|
] }),
|
|
4925
|
-
/* @__PURE__ */
|
|
5557
|
+
/* @__PURE__ */ jsx15(
|
|
4926
5558
|
"div",
|
|
4927
5559
|
{
|
|
4928
5560
|
style: {
|
|
@@ -4935,7 +5567,7 @@ function AuditCard2({
|
|
|
4935
5567
|
children: value
|
|
4936
5568
|
}
|
|
4937
5569
|
),
|
|
4938
|
-
recommendation && /* @__PURE__ */
|
|
5570
|
+
recommendation && /* @__PURE__ */ jsx15(
|
|
4939
5571
|
"div",
|
|
4940
5572
|
{
|
|
4941
5573
|
style: {
|
|
@@ -4950,7 +5582,8 @@ function AuditCard2({
|
|
|
4950
5582
|
},
|
|
4951
5583
|
children: recommendation
|
|
4952
5584
|
}
|
|
4953
|
-
)
|
|
5585
|
+
),
|
|
5586
|
+
footer
|
|
4954
5587
|
] });
|
|
4955
5588
|
}
|
|
4956
5589
|
var IMAGE_EXT_RE = /\.(jpe?g|png|gif|webp|svg|tiff?|bmp)$/i;
|
|
@@ -5006,9 +5639,11 @@ function imageFilenameAudit(filenames) {
|
|
|
5006
5639
|
function imageAltTextAudit(altTexts) {
|
|
5007
5640
|
if (altTexts.length === 0) return null;
|
|
5008
5641
|
const issues = [];
|
|
5642
|
+
let audited = 0;
|
|
5009
5643
|
for (const alt of altTexts) {
|
|
5010
5644
|
const trimmed = alt.trim();
|
|
5011
5645
|
if (!trimmed) continue;
|
|
5646
|
+
audited++;
|
|
5012
5647
|
const len = trimmed.length;
|
|
5013
5648
|
const wc = trimmed.split(/\s+/).filter(Boolean).length;
|
|
5014
5649
|
if (len > 125) {
|
|
@@ -5017,10 +5652,11 @@ function imageAltTextAudit(altTexts) {
|
|
|
5017
5652
|
issues.push({ alt: trimmed, reason: "just one word - use 2-5 descriptive keywords" });
|
|
5018
5653
|
}
|
|
5019
5654
|
}
|
|
5655
|
+
if (audited === 0) return null;
|
|
5020
5656
|
if (issues.length === 0) {
|
|
5021
5657
|
return {
|
|
5022
5658
|
label: "Image Alt Text",
|
|
5023
|
-
value: `${
|
|
5659
|
+
value: `${audited} alt text${audited === 1 ? "" : "s"} look well-formed`,
|
|
5024
5660
|
status: "good"
|
|
5025
5661
|
};
|
|
5026
5662
|
}
|
|
@@ -5030,7 +5666,7 @@ function imageAltTextAudit(altTexts) {
|
|
|
5030
5666
|
}).join("; ");
|
|
5031
5667
|
return {
|
|
5032
5668
|
label: "Image Alt Text",
|
|
5033
|
-
value: `${issues.length} of ${
|
|
5669
|
+
value: `${issues.length} of ${audited} alt text${audited === 1 ? "" : "s"} need attention`,
|
|
5034
5670
|
status: "warning",
|
|
5035
5671
|
recommendation: `${examples}. Alt text should be 2-5 descriptive keywords that describe the image, ideally including the primary keyword, and stay under 125 characters.`
|
|
5036
5672
|
};
|
|
@@ -5038,6 +5674,7 @@ function imageAltTextAudit(altTexts) {
|
|
|
5038
5674
|
function imageTitleAudit(titles, imageCount) {
|
|
5039
5675
|
if (imageCount <= 0) return null;
|
|
5040
5676
|
const withTitle = titles.length;
|
|
5677
|
+
if (withTitle === 0) return null;
|
|
5041
5678
|
const missing = imageCount - withTitle;
|
|
5042
5679
|
if (missing > 0) {
|
|
5043
5680
|
return {
|
|
@@ -5064,30 +5701,30 @@ function imageTitleAudit(titles, imageCount) {
|
|
|
5064
5701
|
}
|
|
5065
5702
|
function computeHeadingStructureAudits(headings, wordCount2) {
|
|
5066
5703
|
const audits = [];
|
|
5067
|
-
const
|
|
5704
|
+
const sectionCount = headings.filter((h) => h.level === 2 || h.level === 3).length;
|
|
5068
5705
|
let densityFired = false;
|
|
5069
|
-
if (wordCount2 >= 1e3 &&
|
|
5706
|
+
if (wordCount2 >= 1e3 && sectionCount === 0) {
|
|
5070
5707
|
audits.push({
|
|
5071
5708
|
label: "Section Headings",
|
|
5072
|
-
value: `No
|
|
5709
|
+
value: `No section headings in a ${wordCount2}-word article`,
|
|
5073
5710
|
status: "error",
|
|
5074
|
-
recommendation: "Articles this long need section headings. Add 2-3 H2 headings to break the body into scannable sections."
|
|
5711
|
+
recommendation: "Articles this long need section headings. Add 2-3 H2 (or H3) headings to break the body into scannable sections."
|
|
5075
5712
|
});
|
|
5076
5713
|
densityFired = true;
|
|
5077
|
-
} else if (wordCount2 >= 2500 &&
|
|
5714
|
+
} else if (wordCount2 >= 2500 && sectionCount < 5) {
|
|
5078
5715
|
audits.push({
|
|
5079
5716
|
label: "Section Headings",
|
|
5080
|
-
value: `${
|
|
5717
|
+
value: `${sectionCount} section heading${sectionCount === 1 ? "" : "s"} for a ${wordCount2}-word article`,
|
|
5081
5718
|
status: "warning",
|
|
5082
|
-
recommendation: "Long articles read best with 1
|
|
5719
|
+
recommendation: "Long articles read best with 1 section heading per 300-400 words. Break the content into more named sections so readers and search engines can navigate it."
|
|
5083
5720
|
});
|
|
5084
5721
|
densityFired = true;
|
|
5085
|
-
} else if (wordCount2 >= 1500 &&
|
|
5722
|
+
} else if (wordCount2 >= 1500 && sectionCount < 3) {
|
|
5086
5723
|
audits.push({
|
|
5087
5724
|
label: "Section Headings",
|
|
5088
|
-
value: `${
|
|
5725
|
+
value: `${sectionCount} section heading${sectionCount === 1 ? "" : "s"} for a ${wordCount2}-word article`,
|
|
5089
5726
|
status: "warning",
|
|
5090
|
-
recommendation: "Articles above 1,500 words usually need at least 3
|
|
5727
|
+
recommendation: "Articles above 1,500 words usually need at least 3 named sections. Add section breaks so the outline is scannable."
|
|
5091
5728
|
});
|
|
5092
5729
|
densityFired = true;
|
|
5093
5730
|
}
|
|
@@ -5160,13 +5797,14 @@ function LinkCheckCard({
|
|
|
5160
5797
|
const redirects = results.filter((r) => r.category === "redirect").length;
|
|
5161
5798
|
const broken = results.filter((r) => r.category === "broken").length;
|
|
5162
5799
|
const errored = results.filter((r) => r.category === "error").length;
|
|
5800
|
+
const unverified = results.filter((r) => r.category === "unverified").length;
|
|
5163
5801
|
const issues = results.filter((r) => r.category !== "ok");
|
|
5164
|
-
return { total, valid, redirects, broken, errored, issues };
|
|
5802
|
+
return { total, valid, redirects, broken, errored, unverified, issues };
|
|
5165
5803
|
}, [results]);
|
|
5166
|
-
return /* @__PURE__ */
|
|
5167
|
-
/* @__PURE__ */
|
|
5168
|
-
/* @__PURE__ */
|
|
5169
|
-
hasRun && !isLoading && /* @__PURE__ */
|
|
5804
|
+
return /* @__PURE__ */ jsxs14("div", { id: "anchor-link-check", style: cardStyle6, children: [
|
|
5805
|
+
/* @__PURE__ */ jsxs14("div", { style: { display: "flex", alignItems: "center", justifyContent: "space-between", gap: 8, marginBottom: 6 }, children: [
|
|
5806
|
+
/* @__PURE__ */ jsx15("span", { style: { fontSize: 10.5, textTransform: "uppercase", letterSpacing: "0.06em", color: "#4b5563", fontWeight: 600 }, children: "Link Health" }),
|
|
5807
|
+
hasRun && !isLoading && /* @__PURE__ */ jsx15(
|
|
5170
5808
|
"button",
|
|
5171
5809
|
{
|
|
5172
5810
|
onClick: onCheck,
|
|
@@ -5184,8 +5822,8 @@ function LinkCheckCard({
|
|
|
5184
5822
|
}
|
|
5185
5823
|
)
|
|
5186
5824
|
] }),
|
|
5187
|
-
/* @__PURE__ */
|
|
5188
|
-
urls.length > 0 && !hasRun && !isLoading && /* @__PURE__ */
|
|
5825
|
+
/* @__PURE__ */ jsx15("div", { style: { fontSize: 11, color: "#1f2937", lineHeight: 1.5, marginBottom: 10 }, children: urls.length === 0 ? "No external links found in the body." : `${urls.length} link${urls.length === 1 ? "" : "s"} found in the body.` }),
|
|
5826
|
+
urls.length > 0 && !hasRun && !isLoading && /* @__PURE__ */ jsxs14(
|
|
5189
5827
|
"button",
|
|
5190
5828
|
{
|
|
5191
5829
|
onClick: onCheck,
|
|
@@ -5210,9 +5848,9 @@ function LinkCheckCard({
|
|
|
5210
5848
|
]
|
|
5211
5849
|
}
|
|
5212
5850
|
),
|
|
5213
|
-
isLoading && /* @__PURE__ */
|
|
5214
|
-
/* @__PURE__ */
|
|
5215
|
-
/* @__PURE__ */
|
|
5851
|
+
isLoading && /* @__PURE__ */ jsxs14("div", { style: { display: "flex", alignItems: "center", justifyContent: "center", gap: 8, padding: "16px 0" }, children: [
|
|
5852
|
+
/* @__PURE__ */ jsx15(LoadingBars, { size: "xs", color: MJH_BLUE }),
|
|
5853
|
+
/* @__PURE__ */ jsxs14("span", { style: { fontSize: 11, color: "#4b5563" }, children: [
|
|
5216
5854
|
"Checking ",
|
|
5217
5855
|
urls.length,
|
|
5218
5856
|
" link",
|
|
@@ -5220,7 +5858,7 @@ function LinkCheckCard({
|
|
|
5220
5858
|
"..."
|
|
5221
5859
|
] })
|
|
5222
5860
|
] }),
|
|
5223
|
-
error && !isLoading && /* @__PURE__ */
|
|
5861
|
+
error && !isLoading && /* @__PURE__ */ jsxs14(
|
|
5224
5862
|
"div",
|
|
5225
5863
|
{
|
|
5226
5864
|
style: {
|
|
@@ -5234,7 +5872,7 @@ function LinkCheckCard({
|
|
|
5234
5872
|
},
|
|
5235
5873
|
children: [
|
|
5236
5874
|
error,
|
|
5237
|
-
/* @__PURE__ */
|
|
5875
|
+
/* @__PURE__ */ jsx15(
|
|
5238
5876
|
"button",
|
|
5239
5877
|
{
|
|
5240
5878
|
onClick: onCheck,
|
|
@@ -5256,15 +5894,37 @@ function LinkCheckCard({
|
|
|
5256
5894
|
]
|
|
5257
5895
|
}
|
|
5258
5896
|
),
|
|
5259
|
-
hasRun && !isLoading && !error && /* @__PURE__ */
|
|
5260
|
-
/* @__PURE__ */
|
|
5261
|
-
/* @__PURE__ */
|
|
5262
|
-
/* @__PURE__ */
|
|
5263
|
-
/* @__PURE__ */
|
|
5264
|
-
/* @__PURE__ */
|
|
5897
|
+
hasRun && !isLoading && !error && /* @__PURE__ */ jsxs14(Fragment8, { children: [
|
|
5898
|
+
/* @__PURE__ */ jsxs14("div", { style: { display: "grid", gridTemplateColumns: counts.unverified > 0 ? "repeat(5, 1fr)" : "repeat(4, 1fr)", gap: 6 }, children: [
|
|
5899
|
+
/* @__PURE__ */ jsx15(StatTile, { label: "Checked", value: counts.total, color: "#475569" }),
|
|
5900
|
+
/* @__PURE__ */ jsx15(StatTile, { label: "Valid", value: counts.valid, color: "#16a34a" }),
|
|
5901
|
+
/* @__PURE__ */ jsx15(StatTile, { label: "Redirects", value: counts.redirects, color: "#8B7310" }),
|
|
5902
|
+
/* @__PURE__ */ jsx15(StatTile, { label: "Broken", value: counts.broken + counts.errored, color: "#dc2626" }),
|
|
5903
|
+
counts.unverified > 0 && /* @__PURE__ */ jsx15(StatTile, { label: "Blocked", value: counts.unverified, color: "#b45309" })
|
|
5265
5904
|
] }),
|
|
5266
|
-
counts.
|
|
5267
|
-
|
|
5905
|
+
counts.unverified > 0 && /* @__PURE__ */ jsxs14(
|
|
5906
|
+
"div",
|
|
5907
|
+
{
|
|
5908
|
+
style: {
|
|
5909
|
+
marginTop: 8,
|
|
5910
|
+
padding: "6px 10px",
|
|
5911
|
+
background: "rgba(245,158,11,0.08)",
|
|
5912
|
+
border: "1px solid rgba(245,158,11,0.25)",
|
|
5913
|
+
borderRadius: 6,
|
|
5914
|
+
fontSize: 10.5,
|
|
5915
|
+
color: "#92400e",
|
|
5916
|
+
lineHeight: 1.45
|
|
5917
|
+
},
|
|
5918
|
+
children: [
|
|
5919
|
+
counts.unverified,
|
|
5920
|
+
" link",
|
|
5921
|
+
counts.unverified === 1 ? "" : "s",
|
|
5922
|
+
" were blocked from our auto-check (likely anti-bot rules on the destination site). They may still work fine for human readers - click each to confirm."
|
|
5923
|
+
]
|
|
5924
|
+
}
|
|
5925
|
+
),
|
|
5926
|
+
counts.issues.length > 0 ? /* @__PURE__ */ jsxs14("div", { style: { marginTop: 12, display: "flex", flexDirection: "column", gap: 6 }, children: [
|
|
5927
|
+
/* @__PURE__ */ jsxs14("div", { style: { fontSize: 10, fontWeight: 700, color: "#4b5563", textTransform: "uppercase", letterSpacing: "0.06em" }, children: [
|
|
5268
5928
|
counts.issues.length,
|
|
5269
5929
|
" link",
|
|
5270
5930
|
counts.issues.length === 1 ? "" : "s",
|
|
@@ -5272,8 +5932,8 @@ function LinkCheckCard({
|
|
|
5272
5932
|
counts.issues.length === 1 ? "s" : "",
|
|
5273
5933
|
" attention"
|
|
5274
5934
|
] }),
|
|
5275
|
-
counts.issues.map((r) => /* @__PURE__ */
|
|
5276
|
-
] }) : /* @__PURE__ */
|
|
5935
|
+
counts.issues.map((r) => /* @__PURE__ */ jsx15(LinkIssueRow, { result: r }, r.url))
|
|
5936
|
+
] }) : /* @__PURE__ */ jsxs14(
|
|
5277
5937
|
"div",
|
|
5278
5938
|
{
|
|
5279
5939
|
style: {
|
|
@@ -5300,7 +5960,7 @@ function LinkCheckCard({
|
|
|
5300
5960
|
] });
|
|
5301
5961
|
}
|
|
5302
5962
|
function StatTile({ label, value, color }) {
|
|
5303
|
-
return /* @__PURE__ */
|
|
5963
|
+
return /* @__PURE__ */ jsxs14(
|
|
5304
5964
|
"div",
|
|
5305
5965
|
{
|
|
5306
5966
|
style: {
|
|
@@ -5310,8 +5970,8 @@ function StatTile({ label, value, color }) {
|
|
|
5310
5970
|
textAlign: "center"
|
|
5311
5971
|
},
|
|
5312
5972
|
children: [
|
|
5313
|
-
/* @__PURE__ */
|
|
5314
|
-
/* @__PURE__ */
|
|
5973
|
+
/* @__PURE__ */ jsx15("div", { style: { fontSize: 18, fontWeight: 700, color, fontVariantNumeric: "tabular-nums", lineHeight: 1 }, children: value }),
|
|
5974
|
+
/* @__PURE__ */ jsx15("div", { style: { fontSize: 9, fontWeight: 700, color: "#4b5563", textTransform: "uppercase", letterSpacing: "0.06em", marginTop: 4 }, children: label })
|
|
5315
5975
|
]
|
|
5316
5976
|
}
|
|
5317
5977
|
);
|
|
@@ -5321,10 +5981,13 @@ function LinkIssueRow({ result }) {
|
|
|
5321
5981
|
ok: { bg: "rgba(22,163,74,0.06)", color: "#16a34a", label: "OK" },
|
|
5322
5982
|
redirect: { bg: "rgba(230,192,27,0.12)", color: "#8B7310", label: result.status > 0 ? String(result.status) : "REDIR" },
|
|
5323
5983
|
broken: { bg: "rgba(220,38,38,0.06)", color: "#dc2626", label: result.status > 0 ? String(result.status) : "404" },
|
|
5984
|
+
// Amber for unverified - the link may work fine, our server just couldn't confirm.
|
|
5985
|
+
unverified: { bg: "rgba(245,158,11,0.10)", color: "#b45309", label: result.status > 0 ? String(result.status) : "BLOCKED" },
|
|
5324
5986
|
error: { bg: "rgba(220,38,38,0.06)", color: "#dc2626", label: "ERR" }
|
|
5325
5987
|
};
|
|
5326
5988
|
const c = map[result.category];
|
|
5327
|
-
|
|
5989
|
+
const tooltip = result.category === "unverified" ? `${result.url} (couldn't auto-check; likely anti-bot blocking - open manually to verify)` : result.error ? `${result.url} (${result.error})` : result.url;
|
|
5990
|
+
return /* @__PURE__ */ jsxs14(
|
|
5328
5991
|
"a",
|
|
5329
5992
|
{
|
|
5330
5993
|
href: result.url,
|
|
@@ -5340,7 +6003,7 @@ function LinkIssueRow({ result }) {
|
|
|
5340
6003
|
textDecoration: "none"
|
|
5341
6004
|
},
|
|
5342
6005
|
children: [
|
|
5343
|
-
/* @__PURE__ */
|
|
6006
|
+
/* @__PURE__ */ jsx15(
|
|
5344
6007
|
"span",
|
|
5345
6008
|
{
|
|
5346
6009
|
style: {
|
|
@@ -5357,7 +6020,7 @@ function LinkIssueRow({ result }) {
|
|
|
5357
6020
|
children: c.label
|
|
5358
6021
|
}
|
|
5359
6022
|
),
|
|
5360
|
-
/* @__PURE__ */
|
|
6023
|
+
/* @__PURE__ */ jsx15(
|
|
5361
6024
|
"span",
|
|
5362
6025
|
{
|
|
5363
6026
|
style: {
|
|
@@ -5370,7 +6033,7 @@ function LinkIssueRow({ result }) {
|
|
|
5370
6033
|
textOverflow: "ellipsis",
|
|
5371
6034
|
whiteSpace: "nowrap"
|
|
5372
6035
|
},
|
|
5373
|
-
title:
|
|
6036
|
+
title: tooltip,
|
|
5374
6037
|
children: result.url
|
|
5375
6038
|
}
|
|
5376
6039
|
)
|
|
@@ -5381,6 +6044,8 @@ function LinkIssueRow({ result }) {
|
|
|
5381
6044
|
function TechnicalTab({
|
|
5382
6045
|
text,
|
|
5383
6046
|
documentFields,
|
|
6047
|
+
primaryKeyword,
|
|
6048
|
+
secondaryKeyword,
|
|
5384
6049
|
isLoading,
|
|
5385
6050
|
linkCheckResults,
|
|
5386
6051
|
isLinkCheckLoading,
|
|
@@ -5388,6 +6053,10 @@ function TechnicalTab({
|
|
|
5388
6053
|
hasRunLinkCheck,
|
|
5389
6054
|
onCheckLinks
|
|
5390
6055
|
}) {
|
|
6056
|
+
const urlSlugAudit = useMemo4(
|
|
6057
|
+
() => urlAudit(documentFields?.slug, primaryKeyword, secondaryKeyword),
|
|
6058
|
+
[documentFields?.slug, primaryKeyword, secondaryKeyword]
|
|
6059
|
+
);
|
|
5391
6060
|
const headings = documentFields?.headings || [];
|
|
5392
6061
|
const headingsDetailed = documentFields?.headingsDetailed;
|
|
5393
6062
|
const headingsForStructure = headingsDetailed ? headingsDetailed : headings.map((text2) => ({ text: text2, level: 2 }));
|
|
@@ -5422,12 +6091,8 @@ function TechnicalTab({
|
|
|
5422
6091
|
status: "warning",
|
|
5423
6092
|
recommendation: "Add at least one hero image with descriptive alt text. Articles with images perform better on both reader engagement and search."
|
|
5424
6093
|
} : null;
|
|
5425
|
-
const
|
|
5426
|
-
|
|
5427
|
-
value: "0 words",
|
|
5428
|
-
status: "error",
|
|
5429
|
-
recommendation: "Start writing. A link or image on its own doesn't count - the body needs real written substance."
|
|
5430
|
-
} : wordCount2 < 450 ? {
|
|
6094
|
+
const isShortForm = isShortFormContent(documentFields, documentFields?.title);
|
|
6095
|
+
const wordAudit = wordCount2 === 0 ? null : isShortForm ? { label: "Word Count", value: `${wordCount2} words`, status: "good" } : wordCount2 < 450 ? {
|
|
5431
6096
|
label: "Word Count",
|
|
5432
6097
|
value: `${wordCount2} words`,
|
|
5433
6098
|
status: "error",
|
|
@@ -5441,13 +6106,24 @@ function TechnicalTab({
|
|
|
5441
6106
|
const bodyLinks = documentFields?.bodyLinks || [];
|
|
5442
6107
|
const hasAnyField = !!documentFields && (documentFields.title !== void 0 || documentFields.headings && documentFields.headings.length > 0 || documentFields.imageNames && documentFields.imageNames.length > 0 || wordCount2 > 0);
|
|
5443
6108
|
if (isLoading && !hasAnyField) {
|
|
5444
|
-
return /* @__PURE__ */
|
|
5445
|
-
/* @__PURE__ */
|
|
5446
|
-
/* @__PURE__ */
|
|
6109
|
+
return /* @__PURE__ */ jsxs14("div", { style: { padding: 24, textAlign: "center" }, children: [
|
|
6110
|
+
/* @__PURE__ */ jsx15("div", { style: { fontSize: 13, color: "#4b5563", fontWeight: 500 }, children: "Reading document fields..." }),
|
|
6111
|
+
/* @__PURE__ */ jsx15("div", { style: { fontSize: 11, color: "#4b5563", marginTop: 4 }, children: "Audit will run once content loads" })
|
|
5447
6112
|
] });
|
|
5448
6113
|
}
|
|
5449
|
-
return /* @__PURE__ */
|
|
5450
|
-
/* @__PURE__ */
|
|
6114
|
+
return /* @__PURE__ */ jsxs14("div", { style: { padding: 12, display: "flex", flexDirection: "column", gap: 10 }, children: [
|
|
6115
|
+
/* @__PURE__ */ jsx15(
|
|
6116
|
+
AuditCard2,
|
|
6117
|
+
{
|
|
6118
|
+
anchorId: "anchor-url-slug",
|
|
6119
|
+
label: urlSlugAudit.label,
|
|
6120
|
+
value: urlSlugAudit.value,
|
|
6121
|
+
status: urlSlugAudit.status,
|
|
6122
|
+
recommendation: urlSlugAudit.recommendation,
|
|
6123
|
+
footer: /* @__PURE__ */ jsx15(SlugRedirectNotice, {})
|
|
6124
|
+
}
|
|
6125
|
+
),
|
|
6126
|
+
wordAudit && /* @__PURE__ */ jsx15(
|
|
5451
6127
|
AuditCard2,
|
|
5452
6128
|
{
|
|
5453
6129
|
anchorId: "anchor-word-count",
|
|
@@ -5457,7 +6133,7 @@ function TechnicalTab({
|
|
|
5457
6133
|
recommendation: wordAudit.recommendation
|
|
5458
6134
|
}
|
|
5459
6135
|
),
|
|
5460
|
-
structureAudits.map((a, i) => /* @__PURE__ */
|
|
6136
|
+
structureAudits.map((a, i) => /* @__PURE__ */ jsx15(
|
|
5461
6137
|
AuditCard2,
|
|
5462
6138
|
{
|
|
5463
6139
|
anchorId: i === 0 ? "anchor-headings-structure" : void 0,
|
|
@@ -5468,10 +6144,10 @@ function TechnicalTab({
|
|
|
5468
6144
|
},
|
|
5469
6145
|
`structure-${i}`
|
|
5470
6146
|
)),
|
|
5471
|
-
headings.length > 0 && /* @__PURE__ */
|
|
5472
|
-
/* @__PURE__ */
|
|
5473
|
-
/* @__PURE__ */
|
|
5474
|
-
(headingsDetailed ? headingsDetailed.slice(0, 12) : headings.slice(0, 12).map((h) => ({ text: h, level: 2 }))).map((h, i) => /* @__PURE__ */
|
|
6147
|
+
headings.length > 0 && /* @__PURE__ */ jsxs14("div", { id: "anchor-headings-outline", style: { ...cardStyle6, padding: "8px 14px" }, children: [
|
|
6148
|
+
/* @__PURE__ */ jsx15("div", { style: { fontSize: 10, color: "#4b5563", textTransform: "uppercase", letterSpacing: "0.06em", fontWeight: 600, marginBottom: 6 }, children: "Heading Outline" }),
|
|
6149
|
+
/* @__PURE__ */ jsxs14("div", { style: { display: "flex", flexDirection: "column", gap: 4 }, children: [
|
|
6150
|
+
(headingsDetailed ? headingsDetailed.slice(0, 12) : headings.slice(0, 12).map((h) => ({ text: h, level: 2 }))).map((h, i) => /* @__PURE__ */ jsxs14(
|
|
5475
6151
|
"div",
|
|
5476
6152
|
{
|
|
5477
6153
|
style: {
|
|
@@ -5482,7 +6158,7 @@ function TechnicalTab({
|
|
|
5482
6158
|
paddingLeft: Math.max(0, (h.level - 2) * 12)
|
|
5483
6159
|
},
|
|
5484
6160
|
children: [
|
|
5485
|
-
/* @__PURE__ */
|
|
6161
|
+
/* @__PURE__ */ jsxs14("span", { style: { fontSize: 9, fontWeight: 700, color: "#4b5563", marginRight: 6 }, children: [
|
|
5486
6162
|
"H",
|
|
5487
6163
|
h.level
|
|
5488
6164
|
] }),
|
|
@@ -5491,14 +6167,14 @@ function TechnicalTab({
|
|
|
5491
6167
|
},
|
|
5492
6168
|
i
|
|
5493
6169
|
)),
|
|
5494
|
-
headings.length > 12 && /* @__PURE__ */
|
|
6170
|
+
headings.length > 12 && /* @__PURE__ */ jsxs14("div", { style: { fontSize: 10, color: "#4b5563" }, children: [
|
|
5495
6171
|
"+ ",
|
|
5496
6172
|
headings.length - 12,
|
|
5497
6173
|
" more"
|
|
5498
6174
|
] })
|
|
5499
6175
|
] })
|
|
5500
6176
|
] }),
|
|
5501
|
-
imagesAudit && /* @__PURE__ */
|
|
6177
|
+
imagesAudit && /* @__PURE__ */ jsx15(
|
|
5502
6178
|
AuditCard2,
|
|
5503
6179
|
{
|
|
5504
6180
|
anchorId: "anchor-images",
|
|
@@ -5508,7 +6184,7 @@ function TechnicalTab({
|
|
|
5508
6184
|
recommendation: imagesAudit.recommendation
|
|
5509
6185
|
}
|
|
5510
6186
|
),
|
|
5511
|
-
filenameAudit && /* @__PURE__ */
|
|
6187
|
+
filenameAudit && /* @__PURE__ */ jsx15(
|
|
5512
6188
|
AuditCard2,
|
|
5513
6189
|
{
|
|
5514
6190
|
anchorId: "anchor-image-filenames",
|
|
@@ -5518,7 +6194,7 @@ function TechnicalTab({
|
|
|
5518
6194
|
recommendation: filenameAudit.recommendation
|
|
5519
6195
|
}
|
|
5520
6196
|
),
|
|
5521
|
-
altTextAudit && /* @__PURE__ */
|
|
6197
|
+
altTextAudit && /* @__PURE__ */ jsx15(
|
|
5522
6198
|
AuditCard2,
|
|
5523
6199
|
{
|
|
5524
6200
|
anchorId: "anchor-image-alt",
|
|
@@ -5528,7 +6204,7 @@ function TechnicalTab({
|
|
|
5528
6204
|
recommendation: altTextAudit.recommendation
|
|
5529
6205
|
}
|
|
5530
6206
|
),
|
|
5531
|
-
imgTitleAudit && /* @__PURE__ */
|
|
6207
|
+
imgTitleAudit && /* @__PURE__ */ jsx15(
|
|
5532
6208
|
AuditCard2,
|
|
5533
6209
|
{
|
|
5534
6210
|
anchorId: "anchor-image-titles",
|
|
@@ -5538,7 +6214,7 @@ function TechnicalTab({
|
|
|
5538
6214
|
recommendation: imgTitleAudit.recommendation
|
|
5539
6215
|
}
|
|
5540
6216
|
),
|
|
5541
|
-
/* @__PURE__ */
|
|
6217
|
+
/* @__PURE__ */ jsx15(
|
|
5542
6218
|
LinkCheckCard,
|
|
5543
6219
|
{
|
|
5544
6220
|
urls: bodyLinks,
|
|
@@ -5553,12 +6229,12 @@ function TechnicalTab({
|
|
|
5553
6229
|
}
|
|
5554
6230
|
|
|
5555
6231
|
// src/components/SEOCopilotPanel.tsx
|
|
5556
|
-
import { Fragment as
|
|
6232
|
+
import { Fragment as Fragment9, jsx as jsx16, jsxs as jsxs15 } from "react/jsx-runtime";
|
|
5557
6233
|
function LogoIcon2() {
|
|
5558
|
-
return /* @__PURE__ */
|
|
5559
|
-
/* @__PURE__ */
|
|
5560
|
-
/* @__PURE__ */
|
|
5561
|
-
/* @__PURE__ */
|
|
6234
|
+
return /* @__PURE__ */ jsxs15("svg", { width: "16", height: "16", viewBox: "0 0 16 16", fill: "none", children: [
|
|
6235
|
+
/* @__PURE__ */ jsx16("rect", { x: "1", y: "3", width: "4", height: "10", rx: "1", fill: MJH_GOLD, opacity: "1" }),
|
|
6236
|
+
/* @__PURE__ */ jsx16("rect", { x: "6", y: "1", width: "4", height: "14", rx: "1", fill: MJH_GOLD, opacity: "0.85" }),
|
|
6237
|
+
/* @__PURE__ */ jsx16("rect", { x: "11", y: "5", width: "4", height: "8", rx: "1", fill: MJH_GOLD, opacity: "0.6" })
|
|
5562
6238
|
] });
|
|
5563
6239
|
}
|
|
5564
6240
|
function PanelContent({
|
|
@@ -5576,8 +6252,12 @@ function PanelContent({
|
|
|
5576
6252
|
docLoading,
|
|
5577
6253
|
documentFields,
|
|
5578
6254
|
documentId,
|
|
6255
|
+
documentType,
|
|
6256
|
+
sanityBaseUrl,
|
|
5579
6257
|
selectedPrimary,
|
|
5580
6258
|
onSelectPrimary,
|
|
6259
|
+
selectedSecondary,
|
|
6260
|
+
onSelectSecondary,
|
|
5581
6261
|
activeTab,
|
|
5582
6262
|
onActiveTabChange,
|
|
5583
6263
|
chatOpen,
|
|
@@ -5595,6 +6275,7 @@ function PanelContent({
|
|
|
5595
6275
|
const isLoading = externalAnalysis.isLoading;
|
|
5596
6276
|
const keywordAnalysisState = externalAnalysis;
|
|
5597
6277
|
const effectivePrimary = selectedPrimary || externalAnalysis.analysis?.primaryKeyword?.term || "";
|
|
6278
|
+
const effectiveSecondary = selectedSecondary || "";
|
|
5598
6279
|
const containerRef = useRef10(null);
|
|
5599
6280
|
const dragging = useRef10(false);
|
|
5600
6281
|
const onMouseDown = useCallback5(() => {
|
|
@@ -5622,6 +6303,68 @@ function PanelContent({
|
|
|
5622
6303
|
};
|
|
5623
6304
|
}, [onSplitPercentChange]);
|
|
5624
6305
|
const headerCursor = isFloating ? "grab" : "default";
|
|
6306
|
+
const onboardSite = publication || "default";
|
|
6307
|
+
const onboardKey = `seo-copilot-onboarded-${onboardSite}`;
|
|
6308
|
+
const onboardSessionKey = `seo-copilot-onboard-shown-${onboardSite}`;
|
|
6309
|
+
const [popupMode, setPopupMode] = useState16("hidden");
|
|
6310
|
+
const [popupClosing, setPopupClosing] = useState16(false);
|
|
6311
|
+
const onboardTimerRef = useRef10(null);
|
|
6312
|
+
useEffect10(() => {
|
|
6313
|
+
let onboarded = false;
|
|
6314
|
+
let shownThisSession = false;
|
|
6315
|
+
try {
|
|
6316
|
+
onboarded = localStorage.getItem(onboardKey) === "1";
|
|
6317
|
+
} catch {
|
|
6318
|
+
}
|
|
6319
|
+
try {
|
|
6320
|
+
shownThisSession = sessionStorage.getItem(onboardSessionKey) === "1";
|
|
6321
|
+
} catch {
|
|
6322
|
+
}
|
|
6323
|
+
if (!onboarded && !shownThisSession) {
|
|
6324
|
+
setPopupMode("auto");
|
|
6325
|
+
try {
|
|
6326
|
+
sessionStorage.setItem(onboardSessionKey, "1");
|
|
6327
|
+
} catch {
|
|
6328
|
+
}
|
|
6329
|
+
onboardTimerRef.current = setTimeout(() => {
|
|
6330
|
+
setPopupClosing(true);
|
|
6331
|
+
setTimeout(() => {
|
|
6332
|
+
setPopupMode("hidden");
|
|
6333
|
+
setPopupClosing(false);
|
|
6334
|
+
}, 180);
|
|
6335
|
+
}, 5e3);
|
|
6336
|
+
}
|
|
6337
|
+
return () => {
|
|
6338
|
+
if (onboardTimerRef.current) clearTimeout(onboardTimerRef.current);
|
|
6339
|
+
};
|
|
6340
|
+
}, [onboardKey, onboardSessionKey]);
|
|
6341
|
+
const markOnboarded = useCallback5(() => {
|
|
6342
|
+
try {
|
|
6343
|
+
localStorage.setItem(onboardKey, "1");
|
|
6344
|
+
} catch {
|
|
6345
|
+
}
|
|
6346
|
+
}, [onboardKey]);
|
|
6347
|
+
const dismissPopup = useCallback5(() => {
|
|
6348
|
+
if (onboardTimerRef.current) clearTimeout(onboardTimerRef.current);
|
|
6349
|
+
markOnboarded();
|
|
6350
|
+
setPopupClosing(true);
|
|
6351
|
+
setTimeout(() => {
|
|
6352
|
+
setPopupMode("hidden");
|
|
6353
|
+
setPopupClosing(false);
|
|
6354
|
+
}, 180);
|
|
6355
|
+
}, [markOnboarded]);
|
|
6356
|
+
const openPopupPersistent = useCallback5(() => {
|
|
6357
|
+
if (onboardTimerRef.current) clearTimeout(onboardTimerRef.current);
|
|
6358
|
+
markOnboarded();
|
|
6359
|
+
setPopupClosing(false);
|
|
6360
|
+
setPopupMode("persistent");
|
|
6361
|
+
}, [markOnboarded]);
|
|
6362
|
+
const handleTabChange = useCallback5((id) => {
|
|
6363
|
+
markOnboarded();
|
|
6364
|
+
if (onboardTimerRef.current) clearTimeout(onboardTimerRef.current);
|
|
6365
|
+
setPopupMode((m) => m === "hidden" ? m : "hidden");
|
|
6366
|
+
onActiveTabChange(id);
|
|
6367
|
+
}, [markOnboarded, onActiveTabChange]);
|
|
5625
6368
|
const tabDefs = [
|
|
5626
6369
|
{ id: "summary", label: "Summary", isHub: true, loading: summaryOps.isAnyLoading },
|
|
5627
6370
|
{ id: "keywords", label: "Keywords", loading: keywordAnalysisState.isLoading || keywordAnalysisState.isVolumesLoading },
|
|
@@ -5630,7 +6373,7 @@ function PanelContent({
|
|
|
5630
6373
|
{ id: "meta", label: "Meta", beta: true },
|
|
5631
6374
|
{ id: "technical", label: "Other Recs", beta: true, loading: technicalOps.isLinkCheckLoading }
|
|
5632
6375
|
];
|
|
5633
|
-
return /* @__PURE__ */
|
|
6376
|
+
return /* @__PURE__ */ jsxs15(
|
|
5634
6377
|
"div",
|
|
5635
6378
|
{
|
|
5636
6379
|
className: "seo-copilot-panel",
|
|
@@ -5641,11 +6384,13 @@ function PanelContent({
|
|
|
5641
6384
|
// backgroundColor (longhand) so the sheen background-image in INJECTED_CSS isn't reset
|
|
5642
6385
|
backgroundColor: PANEL_BG,
|
|
5643
6386
|
fontFamily: "-apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif",
|
|
5644
|
-
opacity: 1
|
|
6387
|
+
opacity: 1,
|
|
6388
|
+
position: "relative"
|
|
5645
6389
|
},
|
|
5646
6390
|
children: [
|
|
5647
|
-
/* @__PURE__ */
|
|
5648
|
-
/* @__PURE__ */
|
|
6391
|
+
/* @__PURE__ */ jsx16("style", { dangerouslySetInnerHTML: { __html: INJECTED_CSS } }),
|
|
6392
|
+
popupMode !== "hidden" && /* @__PURE__ */ jsx16(OnboardingCard, { onDismiss: dismissPopup, closing: popupClosing }),
|
|
6393
|
+
/* @__PURE__ */ jsxs15(
|
|
5649
6394
|
"div",
|
|
5650
6395
|
{
|
|
5651
6396
|
onMouseDown: isFloating ? onDragStart : void 0,
|
|
@@ -5663,15 +6408,16 @@ function PanelContent({
|
|
|
5663
6408
|
flexShrink: 0
|
|
5664
6409
|
},
|
|
5665
6410
|
children: [
|
|
5666
|
-
/* @__PURE__ */
|
|
5667
|
-
/* @__PURE__ */
|
|
5668
|
-
/* @__PURE__ */
|
|
5669
|
-
/* @__PURE__ */
|
|
5670
|
-
/* @__PURE__ */
|
|
6411
|
+
/* @__PURE__ */ jsxs15("div", { style: { display: "flex", alignItems: "center", gap: 6 }, children: [
|
|
6412
|
+
/* @__PURE__ */ jsx16(LogoIcon2, {}),
|
|
6413
|
+
/* @__PURE__ */ jsxs15("span", { style: { fontWeight: 700, fontSize: 15, letterSpacing: "-0.01em" }, children: [
|
|
6414
|
+
/* @__PURE__ */ jsx16("span", { style: { color: MJH_GOLD }, children: "SEO" }),
|
|
6415
|
+
/* @__PURE__ */ jsx16("span", { style: { color: MJH_SLATE }, children: " copilot" })
|
|
5671
6416
|
] })
|
|
5672
6417
|
] }),
|
|
5673
|
-
/* @__PURE__ */
|
|
5674
|
-
|
|
6418
|
+
/* @__PURE__ */ jsxs15("div", { style: { display: "flex", alignItems: "center", gap: isFloating ? 4 : 6 }, children: [
|
|
6419
|
+
/* @__PURE__ */ jsx16(OnboardingInfoButton, { onClick: openPopupPersistent }),
|
|
6420
|
+
isFloating && onToggleFullscreen && /* @__PURE__ */ jsx16(
|
|
5675
6421
|
"button",
|
|
5676
6422
|
{
|
|
5677
6423
|
onClick: (e) => {
|
|
@@ -5693,16 +6439,16 @@ function PanelContent({
|
|
|
5693
6439
|
fontWeight: 600,
|
|
5694
6440
|
transition: "all 150ms"
|
|
5695
6441
|
},
|
|
5696
|
-
children: isFullscreen ? /* @__PURE__ */
|
|
5697
|
-
/* @__PURE__ */
|
|
6442
|
+
children: isFullscreen ? /* @__PURE__ */ jsxs15(Fragment9, { children: [
|
|
6443
|
+
/* @__PURE__ */ jsx16("svg", { width: "12", height: "12", viewBox: "0 0 20 20", fill: "currentColor", children: /* @__PURE__ */ jsx16("path", { d: "M3.28 2.22a.75.75 0 00-1.06 1.06L5.44 6.5H3.75a.75.75 0 000 1.5h4.5A.75.75 0 009 7.25v-4.5a.75.75 0 00-1.5 0v1.69L4.28 1.22a.75.75 0 00-1 1zM16.72 17.78a.75.75 0 001.06-1.06L14.56 13.5h1.69a.75.75 0 000-1.5h-4.5a.75.75 0 00-.75.75v4.5a.75.75 0 001.5 0v-1.69l3.22 3.22z" }) }),
|
|
5698
6444
|
"Exit fullscreen"
|
|
5699
|
-
] }) : /* @__PURE__ */
|
|
5700
|
-
/* @__PURE__ */
|
|
6445
|
+
] }) : /* @__PURE__ */ jsxs15(Fragment9, { children: [
|
|
6446
|
+
/* @__PURE__ */ jsx16("svg", { width: "12", height: "12", viewBox: "0 0 20 20", fill: "currentColor", children: /* @__PURE__ */ jsx16("path", { d: "M13.28 7.78l3.22-3.22v1.69a.75.75 0 001.5 0v-4.5a.75.75 0 00-.75-.75h-4.5a.75.75 0 000 1.5h1.69l-3.22 3.22a.75.75 0 001.06 1.06zM2 17.25a.75.75 0 001.5 0v-1.69l3.22 3.22a.75.75 0 001.06-1.06L4.56 14.5h1.69a.75.75 0 000-1.5h-4.5a.75.75 0 00-.75.75v4.5z" }) }),
|
|
5701
6447
|
"Fullscreen"
|
|
5702
6448
|
] })
|
|
5703
6449
|
}
|
|
5704
6450
|
),
|
|
5705
|
-
isFloating && onToggleFloat && /* @__PURE__ */
|
|
6451
|
+
isFloating && onToggleFloat && /* @__PURE__ */ jsxs15(
|
|
5706
6452
|
"button",
|
|
5707
6453
|
{
|
|
5708
6454
|
onClick: (e) => {
|
|
@@ -5725,7 +6471,7 @@ function PanelContent({
|
|
|
5725
6471
|
transition: "all 150ms"
|
|
5726
6472
|
},
|
|
5727
6473
|
children: [
|
|
5728
|
-
/* @__PURE__ */
|
|
6474
|
+
/* @__PURE__ */ jsx16("svg", { width: "12", height: "12", viewBox: "0 0 20 20", fill: "currentColor", children: /* @__PURE__ */ jsx16(
|
|
5729
6475
|
"path",
|
|
5730
6476
|
{
|
|
5731
6477
|
fillRule: "evenodd",
|
|
@@ -5737,7 +6483,7 @@ function PanelContent({
|
|
|
5737
6483
|
]
|
|
5738
6484
|
}
|
|
5739
6485
|
),
|
|
5740
|
-
!isFloating && onToggleFloat && /* @__PURE__ */
|
|
6486
|
+
!isFloating && onToggleFloat && /* @__PURE__ */ jsx16(
|
|
5741
6487
|
"button",
|
|
5742
6488
|
{
|
|
5743
6489
|
onClick: (e) => {
|
|
@@ -5756,13 +6502,13 @@ function PanelContent({
|
|
|
5756
6502
|
transition: "color 150ms"
|
|
5757
6503
|
},
|
|
5758
6504
|
title: "Pop out",
|
|
5759
|
-
children: /* @__PURE__ */
|
|
5760
|
-
/* @__PURE__ */
|
|
5761
|
-
/* @__PURE__ */
|
|
6505
|
+
children: /* @__PURE__ */ jsxs15("svg", { width: "14", height: "14", viewBox: "0 0 20 20", fill: "currentColor", children: [
|
|
6506
|
+
/* @__PURE__ */ jsx16("path", { d: "M4.25 5.5a.75.75 0 00-.75.75v8.5c0 .414.336.75.75.75h8.5a.75.75 0 00.75-.75v-4a.75.75 0 011.5 0v4A2.25 2.25 0 0112.75 17h-8.5A2.25 2.25 0 012 14.75v-8.5A2.25 2.25 0 014.25 4h5a.75.75 0 010 1.5h-5z" }),
|
|
6507
|
+
/* @__PURE__ */ jsx16("path", { d: "M6.194 12.753a.75.75 0 001.06.053L16.5 4.44v2.81a.75.75 0 001.5 0v-4.5a.75.75 0 00-.75-.75h-4.5a.75.75 0 000 1.5h2.553l-9.056 8.194a.75.75 0 00-.053 1.06z" })
|
|
5762
6508
|
] })
|
|
5763
6509
|
}
|
|
5764
6510
|
),
|
|
5765
|
-
isLoading && /* @__PURE__ */
|
|
6511
|
+
isLoading && /* @__PURE__ */ jsx16(
|
|
5766
6512
|
"div",
|
|
5767
6513
|
{
|
|
5768
6514
|
style: {
|
|
@@ -5774,7 +6520,7 @@ function PanelContent({
|
|
|
5774
6520
|
}
|
|
5775
6521
|
}
|
|
5776
6522
|
),
|
|
5777
|
-
onClose && /* @__PURE__ */
|
|
6523
|
+
onClose && /* @__PURE__ */ jsx16(
|
|
5778
6524
|
"button",
|
|
5779
6525
|
{
|
|
5780
6526
|
onClick: (e) => {
|
|
@@ -5793,11 +6539,11 @@ function PanelContent({
|
|
|
5793
6539
|
transition: "color 150ms"
|
|
5794
6540
|
},
|
|
5795
6541
|
title: "Close",
|
|
5796
|
-
children: /* @__PURE__ */
|
|
6542
|
+
children: /* @__PURE__ */ jsx16("svg", { width: "14", height: "14", viewBox: "0 0 20 20", fill: "currentColor", children: /* @__PURE__ */ jsx16("path", { d: "M6.28 5.22a.75.75 0 00-1.06 1.06L8.94 10l-3.72 3.72a.75.75 0 101.06 1.06L10 11.06l3.72 3.72a.75.75 0 101.06-1.06L11.06 10l3.72-3.72a.75.75 0 00-1.06-1.06L10 8.94 6.28 5.22z" }) })
|
|
5797
6543
|
}
|
|
5798
6544
|
)
|
|
5799
6545
|
] }),
|
|
5800
|
-
/* @__PURE__ */
|
|
6546
|
+
/* @__PURE__ */ jsx16(
|
|
5801
6547
|
"div",
|
|
5802
6548
|
{
|
|
5803
6549
|
style: {
|
|
@@ -5816,8 +6562,8 @@ function PanelContent({
|
|
|
5816
6562
|
]
|
|
5817
6563
|
}
|
|
5818
6564
|
),
|
|
5819
|
-
/* @__PURE__ */
|
|
5820
|
-
/* @__PURE__ */
|
|
6565
|
+
/* @__PURE__ */ jsx16(TabBar, { tabs: tabDefs, activeTab, onTabChange: handleTabChange }),
|
|
6566
|
+
/* @__PURE__ */ jsx16(
|
|
5821
6567
|
"div",
|
|
5822
6568
|
{
|
|
5823
6569
|
style: {
|
|
@@ -5833,8 +6579,8 @@ function PanelContent({
|
|
|
5833
6579
|
children: "Recommendations are generated by AI. Verify details before publishing."
|
|
5834
6580
|
}
|
|
5835
6581
|
),
|
|
5836
|
-
/* @__PURE__ */
|
|
5837
|
-
/* @__PURE__ */
|
|
6582
|
+
/* @__PURE__ */ jsxs15("div", { ref: containerRef, style: { flex: 1, display: "flex", flexDirection: "column", overflow: "hidden" }, children: [
|
|
6583
|
+
/* @__PURE__ */ jsxs15(
|
|
5838
6584
|
"div",
|
|
5839
6585
|
{
|
|
5840
6586
|
style: {
|
|
@@ -5845,7 +6591,7 @@ function PanelContent({
|
|
|
5845
6591
|
background: RECS_ZONE_BG
|
|
5846
6592
|
},
|
|
5847
6593
|
children: [
|
|
5848
|
-
/* @__PURE__ */
|
|
6594
|
+
/* @__PURE__ */ jsx16("div", { style: { display: activeTab === "keywords" ? "block" : "none" }, children: /* @__PURE__ */ jsx16(
|
|
5849
6595
|
KeywordPanel,
|
|
5850
6596
|
{
|
|
5851
6597
|
text,
|
|
@@ -5853,19 +6599,23 @@ function PanelContent({
|
|
|
5853
6599
|
seedKeywords,
|
|
5854
6600
|
onSeedsChange,
|
|
5855
6601
|
onSelectPrimary,
|
|
6602
|
+
secondaryKeyword: effectiveSecondary,
|
|
6603
|
+
onSelectSecondary,
|
|
5856
6604
|
documentFields,
|
|
5857
6605
|
documentId,
|
|
5858
6606
|
externalAnalysis: keywordAnalysisState
|
|
5859
6607
|
},
|
|
5860
6608
|
documentId || "default"
|
|
5861
6609
|
) }),
|
|
5862
|
-
/* @__PURE__ */
|
|
6610
|
+
/* @__PURE__ */ jsx16("div", { style: { display: activeTab === "summary" ? "block" : "none" }, children: /* @__PURE__ */ jsx16(
|
|
5863
6611
|
SummaryTab,
|
|
5864
6612
|
{
|
|
5865
6613
|
text,
|
|
5866
6614
|
analysis: keywordAnalysisState.analysis,
|
|
5867
6615
|
deepAnalysis: keywordAnalysisState.deepAnalysis,
|
|
5868
6616
|
documentFields,
|
|
6617
|
+
primaryKeyword: effectivePrimary,
|
|
6618
|
+
secondaryKeyword: effectiveSecondary,
|
|
5869
6619
|
linkingSuggestions: linkingOps.suggestions,
|
|
5870
6620
|
linkCheckResults: technicalOps.linkCheckResults,
|
|
5871
6621
|
isAnyLoading: summaryOps.isAnyLoading,
|
|
@@ -5873,7 +6623,7 @@ function PanelContent({
|
|
|
5873
6623
|
onItemClick: summaryOps.onItemClick
|
|
5874
6624
|
}
|
|
5875
6625
|
) }),
|
|
5876
|
-
/* @__PURE__ */
|
|
6626
|
+
/* @__PURE__ */ jsx16("div", { style: { display: activeTab === "aeo" ? "block" : "none" }, children: /* @__PURE__ */ jsx16(
|
|
5877
6627
|
AEOTab,
|
|
5878
6628
|
{
|
|
5879
6629
|
text,
|
|
@@ -5890,7 +6640,7 @@ function PanelContent({
|
|
|
5890
6640
|
loadContentSuggestions: aeoOps.loadContentSuggestions
|
|
5891
6641
|
}
|
|
5892
6642
|
) }),
|
|
5893
|
-
/* @__PURE__ */
|
|
6643
|
+
/* @__PURE__ */ jsx16("div", { style: { display: activeTab === "linking" ? "block" : "none" }, children: /* @__PURE__ */ jsx16(
|
|
5894
6644
|
LinkingTab,
|
|
5895
6645
|
{
|
|
5896
6646
|
analysis: keywordAnalysisState.analysis,
|
|
@@ -5901,16 +6651,20 @@ function PanelContent({
|
|
|
5901
6651
|
onRefresh: linkingOps.refresh,
|
|
5902
6652
|
documentId,
|
|
5903
6653
|
publication,
|
|
5904
|
-
text
|
|
6654
|
+
text,
|
|
6655
|
+
sanityBaseUrl,
|
|
6656
|
+
documentType
|
|
5905
6657
|
}
|
|
5906
6658
|
) }),
|
|
5907
|
-
/* @__PURE__ */
|
|
5908
|
-
/* @__PURE__ */
|
|
6659
|
+
/* @__PURE__ */ jsx16("div", { style: { display: activeTab === "meta" ? "block" : "none" }, children: /* @__PURE__ */ jsx16(MetaTab, { documentFields, primaryKeyword: effectivePrimary, secondaryKeyword: effectiveSecondary, isLoading: docLoading }) }),
|
|
6660
|
+
/* @__PURE__ */ jsx16("div", { style: { display: activeTab === "technical" ? "block" : "none" }, children: /* @__PURE__ */ jsx16(
|
|
5909
6661
|
TechnicalTab,
|
|
5910
6662
|
{
|
|
5911
6663
|
text,
|
|
5912
6664
|
documentFields,
|
|
5913
6665
|
isLoading: docLoading,
|
|
6666
|
+
primaryKeyword: effectivePrimary,
|
|
6667
|
+
secondaryKeyword: effectiveSecondary,
|
|
5914
6668
|
linkCheckResults: technicalOps.linkCheckResults,
|
|
5915
6669
|
isLinkCheckLoading: technicalOps.isLinkCheckLoading,
|
|
5916
6670
|
linkCheckError: technicalOps.linkCheckError,
|
|
@@ -5921,7 +6675,7 @@ function PanelContent({
|
|
|
5921
6675
|
]
|
|
5922
6676
|
}
|
|
5923
6677
|
),
|
|
5924
|
-
chatOpen && /* @__PURE__ */
|
|
6678
|
+
chatOpen && /* @__PURE__ */ jsx16(
|
|
5925
6679
|
"div",
|
|
5926
6680
|
{
|
|
5927
6681
|
onMouseDown,
|
|
@@ -5934,10 +6688,10 @@ function PanelContent({
|
|
|
5934
6688
|
justifyContent: "center",
|
|
5935
6689
|
flexShrink: 0
|
|
5936
6690
|
},
|
|
5937
|
-
children: /* @__PURE__ */
|
|
6691
|
+
children: /* @__PURE__ */ jsx16("div", { style: { width: 32, height: 2, borderRadius: 1, background: "#d1d5db" } })
|
|
5938
6692
|
}
|
|
5939
6693
|
),
|
|
5940
|
-
/* @__PURE__ */
|
|
6694
|
+
/* @__PURE__ */ jsxs15(
|
|
5941
6695
|
"div",
|
|
5942
6696
|
{
|
|
5943
6697
|
style: {
|
|
@@ -5950,7 +6704,7 @@ function PanelContent({
|
|
|
5950
6704
|
background: CHAT_ZONE_BG
|
|
5951
6705
|
},
|
|
5952
6706
|
children: [
|
|
5953
|
-
/* @__PURE__ */
|
|
6707
|
+
/* @__PURE__ */ jsxs15(
|
|
5954
6708
|
"button",
|
|
5955
6709
|
{
|
|
5956
6710
|
onClick: () => onChatOpenChange(!chatOpen),
|
|
@@ -5971,7 +6725,7 @@ function PanelContent({
|
|
|
5971
6725
|
flexShrink: 0
|
|
5972
6726
|
},
|
|
5973
6727
|
children: [
|
|
5974
|
-
/* @__PURE__ */
|
|
6728
|
+
/* @__PURE__ */ jsx16(
|
|
5975
6729
|
"span",
|
|
5976
6730
|
{
|
|
5977
6731
|
style: {
|
|
@@ -5984,7 +6738,7 @@ function PanelContent({
|
|
|
5984
6738
|
children: "Chat"
|
|
5985
6739
|
}
|
|
5986
6740
|
),
|
|
5987
|
-
/* @__PURE__ */
|
|
6741
|
+
/* @__PURE__ */ jsx16(
|
|
5988
6742
|
"svg",
|
|
5989
6743
|
{
|
|
5990
6744
|
width: "12",
|
|
@@ -5992,7 +6746,7 @@ function PanelContent({
|
|
|
5992
6746
|
viewBox: "0 0 20 20",
|
|
5993
6747
|
fill: "rgba(0,0,0,0.55)",
|
|
5994
6748
|
style: { transform: chatOpen ? "rotate(0deg)" : "rotate(-90deg)", transition: "transform 200ms" },
|
|
5995
|
-
children: /* @__PURE__ */
|
|
6749
|
+
children: /* @__PURE__ */ jsx16(
|
|
5996
6750
|
"path",
|
|
5997
6751
|
{
|
|
5998
6752
|
fillRule: "evenodd",
|
|
@@ -6005,7 +6759,7 @@ function PanelContent({
|
|
|
6005
6759
|
]
|
|
6006
6760
|
}
|
|
6007
6761
|
),
|
|
6008
|
-
/* @__PURE__ */
|
|
6762
|
+
/* @__PURE__ */ jsx16(
|
|
6009
6763
|
"div",
|
|
6010
6764
|
{
|
|
6011
6765
|
style: {
|
|
@@ -6015,7 +6769,7 @@ function PanelContent({
|
|
|
6015
6769
|
flexDirection: "column",
|
|
6016
6770
|
minHeight: 0
|
|
6017
6771
|
},
|
|
6018
|
-
children: /* @__PURE__ */
|
|
6772
|
+
children: /* @__PURE__ */ jsx16(
|
|
6019
6773
|
ChatPanel,
|
|
6020
6774
|
{
|
|
6021
6775
|
messages: chatState.messages,
|
|
@@ -6048,8 +6802,15 @@ function SEOCopilotInner({ config, onClose }) {
|
|
|
6048
6802
|
);
|
|
6049
6803
|
const dragOffset = useRef10(null);
|
|
6050
6804
|
const resizeStart = useRef10(null);
|
|
6051
|
-
const { text, isLoading: docLoading, documentFields, documentId } = useDocumentContent();
|
|
6805
|
+
const { text, isLoading: docLoading, documentFields, documentId, documentType } = useDocumentContent();
|
|
6052
6806
|
const { apiUrl } = useConfig();
|
|
6807
|
+
const workspace = useWorkspace();
|
|
6808
|
+
const effectivePublication = config.publication || workspace?.dataset;
|
|
6809
|
+
const sanityBaseUrl = useMemo5(() => {
|
|
6810
|
+
if (typeof window === "undefined") return void 0;
|
|
6811
|
+
const basePath = (workspace?.basePath || "/").replace(/\/+$/, "");
|
|
6812
|
+
return `${window.location.origin}${basePath}`;
|
|
6813
|
+
}, [workspace?.basePath]);
|
|
6053
6814
|
const seedCacheKey = documentId ? `seo-copilot-cache-${documentId}` : "seo-copilot-cache-v2";
|
|
6054
6815
|
const loadSeedsFromCache = useCallback5(() => {
|
|
6055
6816
|
try {
|
|
@@ -6073,6 +6834,8 @@ function SEOCopilotInner({ config, onClose }) {
|
|
|
6073
6834
|
);
|
|
6074
6835
|
const selectedPrimaryKey = documentId ? `seo-copilot-primary-${documentId}` : "seo-copilot-primary-default";
|
|
6075
6836
|
const [selectedPrimary, setSelectedPrimary] = usePersistentState(selectedPrimaryKey, void 0);
|
|
6837
|
+
const selectedSecondaryKey = documentId ? `seo-copilot-secondary-${documentId}` : "seo-copilot-secondary-default";
|
|
6838
|
+
const [selectedSecondary, setSelectedSecondary] = usePersistentState(selectedSecondaryKey, "");
|
|
6076
6839
|
const seedsInitializedRef = useRef10(false);
|
|
6077
6840
|
useEffect10(() => {
|
|
6078
6841
|
if (!seedsInitializedRef.current) {
|
|
@@ -6084,7 +6847,7 @@ function SEOCopilotInner({ config, onClose }) {
|
|
|
6084
6847
|
const [activeTab, setActiveTab] = useState16("keywords");
|
|
6085
6848
|
const [chatOpen, setChatOpen] = usePersistentState("seo-copilot-ui-chat-open-v35", false);
|
|
6086
6849
|
const [splitPercent, setSplitPercent] = usePersistentState("seo-copilot-ui-split", 70);
|
|
6087
|
-
const keywordAnalysisState = useKeywordAnalysis(text, apiUrl,
|
|
6850
|
+
const keywordAnalysisState = useKeywordAnalysis(text, apiUrl, effectivePublication, seedKeywords, documentFields, selectedPrimary, documentId);
|
|
6088
6851
|
const effectivePrimary = selectedPrimary || keywordAnalysisState.analysis?.primaryKeyword?.term || "";
|
|
6089
6852
|
const keywordPanelData = useMemo5(() => {
|
|
6090
6853
|
const analysis = keywordAnalysisState.analysis;
|
|
@@ -6101,7 +6864,7 @@ function SEOCopilotInner({ config, onClose }) {
|
|
|
6101
6864
|
} : void 0
|
|
6102
6865
|
};
|
|
6103
6866
|
}, [keywordAnalysisState.analysis, keywordAnalysisState.deepAnalysis]);
|
|
6104
|
-
const chatHookState = useSEOChat(apiUrl, text,
|
|
6867
|
+
const chatHookState = useSEOChat(apiUrl, text, effectivePublication, keywordPanelData, documentId);
|
|
6105
6868
|
const contentSuggestionsKey = documentId ? `seo-copilot-content-suggestions-${documentId}` : "seo-copilot-content-suggestions-default";
|
|
6106
6869
|
const [contentSuggestions, setContentSuggestions] = usePersistentState(contentSuggestionsKey, null);
|
|
6107
6870
|
const [isCSLoading, setIsCSLoading] = useState16(false);
|
|
@@ -6122,7 +6885,7 @@ function SEOCopilotInner({ config, onClose }) {
|
|
|
6122
6885
|
setIsCSLoading(true);
|
|
6123
6886
|
setCsError(null);
|
|
6124
6887
|
try {
|
|
6125
|
-
const data = await fetchContentSuggestions(apiUrl, text, effectivePrimary,
|
|
6888
|
+
const data = await fetchContentSuggestions(apiUrl, text, effectivePrimary, effectivePublication);
|
|
6126
6889
|
if (aeoOpVersionRef.current !== myVersion) return;
|
|
6127
6890
|
if (data.keyTakeaways.length === 0 && data.infographicOpportunities.length === 0 && data.bulletListItems.length === 0) {
|
|
6128
6891
|
setCsError("No suggestions returned. Try again with more content.");
|
|
@@ -6135,7 +6898,7 @@ function SEOCopilotInner({ config, onClose }) {
|
|
|
6135
6898
|
}
|
|
6136
6899
|
if (aeoOpVersionRef.current !== myVersion) return;
|
|
6137
6900
|
setIsCSLoading(false);
|
|
6138
|
-
}, [apiUrl, text, effectivePrimary,
|
|
6901
|
+
}, [apiUrl, text, effectivePrimary, effectivePublication]);
|
|
6139
6902
|
const linkingKey = documentId ? `seo-copilot-linking-${documentId}` : "seo-copilot-linking-default";
|
|
6140
6903
|
const [linkingSuggestions, setLinkingSuggestions] = usePersistentState(linkingKey, []);
|
|
6141
6904
|
const [isLinkingLoading, setIsLinkingLoading] = useState16(false);
|
|
@@ -6155,8 +6918,10 @@ function SEOCopilotInner({ config, onClose }) {
|
|
|
6155
6918
|
lastLinkingFetchKey.current = "";
|
|
6156
6919
|
}, [documentId]);
|
|
6157
6920
|
const supportingKeywordsForLinking = useMemo5(() => {
|
|
6158
|
-
|
|
6159
|
-
|
|
6921
|
+
const base = (keywordAnalysisState.analysis?.supportingKeywords || []).map((kw) => kw.term).filter(Boolean);
|
|
6922
|
+
const merged = selectedSecondary ? [selectedSecondary, ...base.filter((t) => t.toLowerCase() !== selectedSecondary.toLowerCase())] : base;
|
|
6923
|
+
return merged.slice(0, 5);
|
|
6924
|
+
}, [keywordAnalysisState.analysis, selectedSecondary]);
|
|
6160
6925
|
const refreshLinkingSuggestions = useCallback5(async () => {
|
|
6161
6926
|
if (!text || text.trim().length < 50) return;
|
|
6162
6927
|
if (!effectivePrimary) return;
|
|
@@ -6170,7 +6935,7 @@ function SEOCopilotInner({ config, onClose }) {
|
|
|
6170
6935
|
effectivePrimary,
|
|
6171
6936
|
supportingKeywordsForLinking,
|
|
6172
6937
|
documentId,
|
|
6173
|
-
|
|
6938
|
+
effectivePublication
|
|
6174
6939
|
);
|
|
6175
6940
|
if (linkingVersionRef.current !== myVersion) return;
|
|
6176
6941
|
setLinkingSuggestions(suggestions);
|
|
@@ -6181,7 +6946,7 @@ function SEOCopilotInner({ config, onClose }) {
|
|
|
6181
6946
|
}
|
|
6182
6947
|
if (linkingVersionRef.current !== myVersion) return;
|
|
6183
6948
|
setIsLinkingLoading(false);
|
|
6184
|
-
}, [apiUrl, text, effectivePrimary, supportingKeywordsForLinking, documentId,
|
|
6949
|
+
}, [apiUrl, text, effectivePrimary, supportingKeywordsForLinking, documentId, effectivePublication]);
|
|
6185
6950
|
const isLinkingStale = useMemo5(() => {
|
|
6186
6951
|
if (!linkingFetchedText || linkingSuggestions.length === 0) return false;
|
|
6187
6952
|
if (Math.abs(text.length - linkingFetchedText.length) > 150) return true;
|
|
@@ -6292,10 +7057,10 @@ function SEOCopilotInner({ config, onClose }) {
|
|
|
6292
7057
|
},
|
|
6293
7058
|
[floatSize]
|
|
6294
7059
|
);
|
|
6295
|
-
const panelContent = /* @__PURE__ */
|
|
7060
|
+
const panelContent = /* @__PURE__ */ jsx16(
|
|
6296
7061
|
PanelContent,
|
|
6297
7062
|
{
|
|
6298
|
-
initialPublication:
|
|
7063
|
+
initialPublication: effectivePublication,
|
|
6299
7064
|
isFloating,
|
|
6300
7065
|
isFullscreen,
|
|
6301
7066
|
onToggleFloat: () => {
|
|
@@ -6312,8 +7077,12 @@ function SEOCopilotInner({ config, onClose }) {
|
|
|
6312
7077
|
docLoading,
|
|
6313
7078
|
documentFields,
|
|
6314
7079
|
documentId,
|
|
7080
|
+
documentType,
|
|
7081
|
+
sanityBaseUrl,
|
|
6315
7082
|
selectedPrimary,
|
|
6316
7083
|
onSelectPrimary: setSelectedPrimary,
|
|
7084
|
+
selectedSecondary,
|
|
7085
|
+
onSelectSecondary: setSelectedSecondary,
|
|
6317
7086
|
activeTab,
|
|
6318
7087
|
onActiveTabChange: setActiveTab,
|
|
6319
7088
|
chatOpen,
|
|
@@ -6375,7 +7144,7 @@ function SEOCopilotInner({ config, onClose }) {
|
|
|
6375
7144
|
}
|
|
6376
7145
|
}
|
|
6377
7146
|
);
|
|
6378
|
-
const floatingPanel = /* @__PURE__ */
|
|
7147
|
+
const floatingPanel = /* @__PURE__ */ jsxs15(
|
|
6379
7148
|
"div",
|
|
6380
7149
|
{
|
|
6381
7150
|
style: {
|
|
@@ -6393,7 +7162,7 @@ function SEOCopilotInner({ config, onClose }) {
|
|
|
6393
7162
|
},
|
|
6394
7163
|
children: [
|
|
6395
7164
|
panelContent,
|
|
6396
|
-
!isFullscreen && /* @__PURE__ */
|
|
7165
|
+
!isFullscreen && /* @__PURE__ */ jsx16(
|
|
6397
7166
|
"div",
|
|
6398
7167
|
{
|
|
6399
7168
|
onMouseDown: handleResizeStart,
|
|
@@ -6408,9 +7177,9 @@ function SEOCopilotInner({ config, onClose }) {
|
|
|
6408
7177
|
alignItems: "center",
|
|
6409
7178
|
justifyContent: "center"
|
|
6410
7179
|
},
|
|
6411
|
-
children: /* @__PURE__ */
|
|
6412
|
-
/* @__PURE__ */
|
|
6413
|
-
/* @__PURE__ */
|
|
7180
|
+
children: /* @__PURE__ */ jsxs15("svg", { width: "10", height: "10", viewBox: "0 0 10 10", fill: "#9ca3af", children: [
|
|
7181
|
+
/* @__PURE__ */ jsx16("path", { d: "M9 1v8H1", fill: "none", stroke: "#9ca3af", strokeWidth: "1.5", strokeLinecap: "round" }),
|
|
7182
|
+
/* @__PURE__ */ jsx16("path", { d: "M9 5v4H5", fill: "none", stroke: "#9ca3af", strokeWidth: "1.5", strokeLinecap: "round" })
|
|
6414
7183
|
] })
|
|
6415
7184
|
}
|
|
6416
7185
|
)
|
|
@@ -6418,8 +7187,8 @@ function SEOCopilotInner({ config, onClose }) {
|
|
|
6418
7187
|
}
|
|
6419
7188
|
);
|
|
6420
7189
|
if (isFloating) {
|
|
6421
|
-
return /* @__PURE__ */
|
|
6422
|
-
/* @__PURE__ */
|
|
7190
|
+
return /* @__PURE__ */ jsxs15(Fragment9, { children: [
|
|
7191
|
+
/* @__PURE__ */ jsx16(
|
|
6423
7192
|
"div",
|
|
6424
7193
|
{
|
|
6425
7194
|
style: {
|
|
@@ -6429,30 +7198,30 @@ function SEOCopilotInner({ config, onClose }) {
|
|
|
6429
7198
|
alignItems: "center",
|
|
6430
7199
|
justifyContent: "center"
|
|
6431
7200
|
},
|
|
6432
|
-
children: /* @__PURE__ */
|
|
7201
|
+
children: /* @__PURE__ */ jsx16("span", { style: { fontSize: 12, color: "rgba(0,0,0,0.5)" }, children: "SEO Copilot is floating" })
|
|
6433
7202
|
}
|
|
6434
7203
|
),
|
|
6435
7204
|
typeof document !== "undefined" && createPortal(floatingPanel, document.body)
|
|
6436
7205
|
] });
|
|
6437
7206
|
}
|
|
6438
|
-
return /* @__PURE__ */
|
|
7207
|
+
return /* @__PURE__ */ jsx16("div", { style: { height: "100%", background: PANEL_BG, position: "relative", zIndex: 1 }, children: panelContent });
|
|
6439
7208
|
}
|
|
6440
7209
|
function SEOCopilotPanel({ config, onClose }) {
|
|
6441
|
-
return /* @__PURE__ */
|
|
7210
|
+
return /* @__PURE__ */ jsx16(
|
|
6442
7211
|
Suspense,
|
|
6443
7212
|
{
|
|
6444
|
-
fallback: /* @__PURE__ */
|
|
6445
|
-
/* @__PURE__ */
|
|
6446
|
-
/* @__PURE__ */
|
|
7213
|
+
fallback: /* @__PURE__ */ jsxs15("div", { style: { padding: 16, display: "flex", alignItems: "center", gap: 12 }, children: [
|
|
7214
|
+
/* @__PURE__ */ jsx16(LoadingBars, {}),
|
|
7215
|
+
/* @__PURE__ */ jsx16("span", { style: { fontSize: 12, color: "#4b5563" }, children: "Loading SEO Copilot..." })
|
|
6447
7216
|
] }),
|
|
6448
|
-
children: /* @__PURE__ */
|
|
7217
|
+
children: /* @__PURE__ */ jsx16(ConfigProvider, { config, children: /* @__PURE__ */ jsx16(SEOCopilotInner, { config, onClose }) })
|
|
6449
7218
|
}
|
|
6450
7219
|
);
|
|
6451
7220
|
}
|
|
6452
7221
|
function LoadingBars({ size = "sm", color = MJH_GOLD }) {
|
|
6453
7222
|
const barWidth = size === "xs" ? 4 : 6;
|
|
6454
7223
|
const containerHeight = size === "xs" ? 10 : 14;
|
|
6455
|
-
return /* @__PURE__ */
|
|
7224
|
+
return /* @__PURE__ */ jsx16("div", { style: { display: "inline-flex", alignItems: "flex-end", gap: 2, height: containerHeight }, children: [1, 2, 3].map((i) => /* @__PURE__ */ jsx16(
|
|
6456
7225
|
"div",
|
|
6457
7226
|
{
|
|
6458
7227
|
style: {
|