sanity-plugin-seo-copilot 0.2.12 → 0.2.14
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 +1506 -1086
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +1474 -1054
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
- package/src/components/KeywordPanel.tsx +190 -176
- package/src/components/ReportProblemButton.tsx +212 -0
- package/src/components/SEOCopilotPanel.tsx +37 -9
- package/src/components/styles.ts +7 -0
- package/src/components/tabs/AEOTab.tsx +5 -1
- package/src/components/tabs/LinkingTab.tsx +39 -13
- package/src/components/tabs/MetaTab.tsx +122 -24
- package/src/components/tabs/SummaryTab.tsx +21 -15
- package/src/components/tabs/TechnicalTab.tsx +276 -269
- package/src/hooks/useKeywordAnalysis.ts +8 -7
- package/src/lib/api.ts +21 -52
- package/src/lib/documentExtract.ts +168 -14
- package/src/lib/scoring.ts +4 -4
- package/src/lib/summary.ts +23 -14
- package/src/lib/types.ts +12 -0
package/dist/index.mjs
CHANGED
|
@@ -5,7 +5,7 @@ import { definePlugin } from "sanity";
|
|
|
5
5
|
import { createElement } from "react";
|
|
6
6
|
|
|
7
7
|
// src/components/SEOCopilotPanel.tsx
|
|
8
|
-
import { useState as
|
|
8
|
+
import { useState as useState17, useRef as useRef12, useCallback as useCallback5, useEffect as useEffect12, useMemo as useMemo5, Suspense } from "react";
|
|
9
9
|
import { useWorkspace } from "sanity";
|
|
10
10
|
import { createPortal } from "react-dom";
|
|
11
11
|
|
|
@@ -50,30 +50,83 @@ function extractHeadingsDetailed(blocks) {
|
|
|
50
50
|
}
|
|
51
51
|
return out;
|
|
52
52
|
}
|
|
53
|
-
function
|
|
54
|
-
const
|
|
53
|
+
function normalizeLink(raw) {
|
|
54
|
+
const s = raw.trim().replace(/[.,;:!?]+$/, "");
|
|
55
|
+
if (!s) return null;
|
|
56
|
+
if (/^https?:\/\//i.test(s)) return s;
|
|
57
|
+
if (/^www\.\S+\.\S+/i.test(s) || /^[a-z0-9-]+(\.[a-z0-9-]+)+(\/|$)/i.test(s)) return `https://${s}`;
|
|
58
|
+
return null;
|
|
59
|
+
}
|
|
60
|
+
var UNSTYLED_HEADING_SCAN_CAP = 600;
|
|
61
|
+
function extractUnstyledHeadings(blocks) {
|
|
62
|
+
if (!Array.isArray(blocks)) return [];
|
|
63
|
+
const items = blocks.slice(0, UNSTYLED_HEADING_SCAN_CAP).map((b) => {
|
|
64
|
+
if (!b || b._type !== "block") return null;
|
|
65
|
+
const style = b.style || "normal";
|
|
66
|
+
const text = (b.children || []).map((c) => c.text || "").join("").trim();
|
|
67
|
+
return {
|
|
68
|
+
isHeading: /^h[1-6]$/.test(style),
|
|
69
|
+
isPlain: style === "normal",
|
|
70
|
+
isList: typeof b.listItem === "string" && b.listItem.length > 0,
|
|
71
|
+
text,
|
|
72
|
+
words: text ? text.split(/\s+/).filter(Boolean).length : 0
|
|
73
|
+
};
|
|
74
|
+
});
|
|
75
|
+
const out = [];
|
|
76
|
+
for (let i = 0; i < items.length; i++) {
|
|
77
|
+
const it = items[i];
|
|
78
|
+
if (!it || it.isHeading || it.isList || !it.isPlain) continue;
|
|
79
|
+
if (it.words < 2 || it.words > 9) continue;
|
|
80
|
+
if (/[.!?]$/.test(it.text)) continue;
|
|
81
|
+
if (!/[A-Za-z]/.test(it.text)) continue;
|
|
82
|
+
if (/https?:\/\/|doi:|\baccessed\b|image credit|stock\.adobe|^figure\b|^table\b|^source[:s]?\b|^references?\b/i.test(it.text)) continue;
|
|
83
|
+
let next = null;
|
|
84
|
+
for (let j = i + 1; j < items.length; j++) {
|
|
85
|
+
if (items[j] && items[j].text) {
|
|
86
|
+
next = items[j];
|
|
87
|
+
break;
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
if (!next || next.isHeading || next.words < 12) continue;
|
|
91
|
+
out.push(it.text);
|
|
92
|
+
if (out.length >= 8) break;
|
|
93
|
+
}
|
|
94
|
+
return out;
|
|
95
|
+
}
|
|
96
|
+
function extractBodyLinksDetailed(blocks) {
|
|
97
|
+
const linked = /* @__PURE__ */ new Set();
|
|
98
|
+
const all = /* @__PURE__ */ new Set();
|
|
99
|
+
const anchorByUrl = /* @__PURE__ */ new Map();
|
|
55
100
|
if (Array.isArray(blocks)) {
|
|
56
101
|
for (const block of blocks) {
|
|
57
102
|
if (block._type === "block" && Array.isArray(block.markDefs)) {
|
|
58
103
|
for (const md of block.markDefs) {
|
|
59
104
|
const href = md.href || md.url;
|
|
60
|
-
if (typeof href
|
|
61
|
-
|
|
62
|
-
|
|
105
|
+
if (typeof href !== "string") continue;
|
|
106
|
+
const n = normalizeLink(href);
|
|
107
|
+
if (!n) continue;
|
|
108
|
+
linked.add(n);
|
|
109
|
+
all.add(n);
|
|
110
|
+
const anchor = (block.children || []).filter((c) => Array.isArray(c.marks) && md._key && c.marks.includes(md._key)).map((c) => c.text || "").join("").trim();
|
|
111
|
+
if (anchor && !anchorByUrl.has(n)) anchorByUrl.set(n, anchor);
|
|
63
112
|
}
|
|
64
113
|
}
|
|
65
114
|
}
|
|
66
|
-
}
|
|
67
|
-
if (Array.isArray(blocks)) {
|
|
68
115
|
for (const block of blocks) {
|
|
69
116
|
if (block._type === "block" && Array.isArray(block.children)) {
|
|
70
117
|
const blockText = block.children.map((c) => c.text || "").join(" ");
|
|
71
|
-
const matches = blockText.match(/https
|
|
72
|
-
if (matches)
|
|
118
|
+
const matches = blockText.match(/(?:https?:\/\/|www\.)[^\s"'<>)\]]+/gi);
|
|
119
|
+
if (matches) for (const u of matches) {
|
|
120
|
+
const n = normalizeLink(u);
|
|
121
|
+
if (n) all.add(n);
|
|
122
|
+
}
|
|
73
123
|
}
|
|
74
124
|
}
|
|
75
125
|
}
|
|
76
|
-
return
|
|
126
|
+
return [...all].map((url) => ({ url, hyperlinked: linked.has(url), anchorText: anchorByUrl.get(url) }));
|
|
127
|
+
}
|
|
128
|
+
function extractBodyLinks(blocks) {
|
|
129
|
+
return extractBodyLinksDetailed(blocks).map((l) => l.url);
|
|
77
130
|
}
|
|
78
131
|
function detectSlug(val) {
|
|
79
132
|
if (!val) return void 0;
|
|
@@ -148,6 +201,86 @@ function detectAuthor(val) {
|
|
|
148
201
|
}
|
|
149
202
|
return { authorIsReference: false };
|
|
150
203
|
}
|
|
204
|
+
var FACT_CHECK_STATUS_WORDS = /* @__PURE__ */ new Set([
|
|
205
|
+
"pending",
|
|
206
|
+
"approved",
|
|
207
|
+
"rejected",
|
|
208
|
+
"done",
|
|
209
|
+
"complete",
|
|
210
|
+
"completed",
|
|
211
|
+
"in review",
|
|
212
|
+
"in progress",
|
|
213
|
+
"not started",
|
|
214
|
+
"draft",
|
|
215
|
+
"review",
|
|
216
|
+
"reviewed",
|
|
217
|
+
"unreviewed",
|
|
218
|
+
"checked",
|
|
219
|
+
"unchecked",
|
|
220
|
+
"verified",
|
|
221
|
+
"unverified",
|
|
222
|
+
"true",
|
|
223
|
+
"false",
|
|
224
|
+
"yes",
|
|
225
|
+
"no",
|
|
226
|
+
"n/a",
|
|
227
|
+
"na",
|
|
228
|
+
"none",
|
|
229
|
+
"tbd",
|
|
230
|
+
"todo",
|
|
231
|
+
"to do"
|
|
232
|
+
]);
|
|
233
|
+
function isLikelyPersonName(s) {
|
|
234
|
+
const t = s.trim().toLowerCase();
|
|
235
|
+
if (!t || FACT_CHECK_STATUS_WORDS.has(t)) return false;
|
|
236
|
+
return /[a-z]/i.test(s);
|
|
237
|
+
}
|
|
238
|
+
function detectFactChecker(val) {
|
|
239
|
+
if (!val) return { factCheckerIsReference: false };
|
|
240
|
+
const candidateFields = [
|
|
241
|
+
"factChecker",
|
|
242
|
+
"factCheckers",
|
|
243
|
+
"factCheckedBy",
|
|
244
|
+
"reviewer",
|
|
245
|
+
"reviewers",
|
|
246
|
+
"reviewedBy",
|
|
247
|
+
"medicalReviewer",
|
|
248
|
+
"medicallyReviewedBy"
|
|
249
|
+
];
|
|
250
|
+
const dynamic = Object.keys(val).filter(
|
|
251
|
+
(k) => (
|
|
252
|
+
// Require "checker"/"checked by"/"reviewer"/"reviewed by" - NOT a bare "check" flag.
|
|
253
|
+
/factchecker|fact.?checked.?by|reviewer|reviewed.?by/i.test(k) && // never date/timestamp fields (lastReviewedAt, medicallyReviewedAt, reviewedDate),
|
|
254
|
+
// free-text/status/flag sidecars (reviewerNotes, reviewStatus), nor image/url/id fields.
|
|
255
|
+
!/at$|date$|on$|url|link|count|note|comment|status|flag|bool|photo|image|avatar|picture|id$/i.test(k)
|
|
256
|
+
)
|
|
257
|
+
);
|
|
258
|
+
const fields = Array.from(/* @__PURE__ */ new Set([...candidateFields, ...dynamic]));
|
|
259
|
+
for (const f of fields) {
|
|
260
|
+
const raw = val[f];
|
|
261
|
+
if (!raw) continue;
|
|
262
|
+
if (Array.isArray(raw)) {
|
|
263
|
+
const names = raw.filter((x) => typeof x === "string" && isLikelyPersonName(x)).map((x) => x.trim());
|
|
264
|
+
if (names.length > 0) return { factCheckerName: names.slice(0, 3).join(", "), factCheckerIsReference: false };
|
|
265
|
+
}
|
|
266
|
+
const first = Array.isArray(raw) ? raw[0] : raw;
|
|
267
|
+
if (!first) continue;
|
|
268
|
+
if (typeof first === "string") {
|
|
269
|
+
const trimmed = first.trim();
|
|
270
|
+
if (trimmed && isLikelyPersonName(trimmed)) return { factCheckerName: trimmed, factCheckerIsReference: false };
|
|
271
|
+
continue;
|
|
272
|
+
}
|
|
273
|
+
if (typeof first === "object" && first !== null) {
|
|
274
|
+
const o = first;
|
|
275
|
+
const name = [o.name, o.fullName, o.displayName].find((v) => typeof v === "string" && isLikelyPersonName(v));
|
|
276
|
+
if (name) return { factCheckerName: name, factCheckerIsReference: false };
|
|
277
|
+
if (typeof o._ref === "string" || o._type === "reference") {
|
|
278
|
+
return { factCheckerIsReference: true };
|
|
279
|
+
}
|
|
280
|
+
}
|
|
281
|
+
}
|
|
282
|
+
return { factCheckerIsReference: false };
|
|
283
|
+
}
|
|
151
284
|
function extractImageMeta(value) {
|
|
152
285
|
const names = [];
|
|
153
286
|
const titles = [];
|
|
@@ -186,6 +319,7 @@ function buildDocumentFields(value) {
|
|
|
186
319
|
const title = typeof val?.title === "string" ? val.title : void 0;
|
|
187
320
|
const body = val?.body;
|
|
188
321
|
const { authorName, authorCredentials, authorBioUrl, authorIsReference } = detectAuthor(val);
|
|
322
|
+
const { factCheckerName, factCheckerIsReference } = detectFactChecker(val);
|
|
189
323
|
const imageMeta = val ? extractImageMeta(val) : { names: [], titles: [], count: 0 };
|
|
190
324
|
return {
|
|
191
325
|
title: title || void 0,
|
|
@@ -197,13 +331,17 @@ function buildDocumentFields(value) {
|
|
|
197
331
|
imageCount: imageMeta.count,
|
|
198
332
|
headings: extractHeadings(body),
|
|
199
333
|
headingsDetailed: extractHeadingsDetailed(body),
|
|
334
|
+
unstyledHeadings: extractUnstyledHeadings(body),
|
|
200
335
|
bodyLinks: extractBodyLinks(body),
|
|
336
|
+
bodyLinksDetailed: extractBodyLinksDetailed(body),
|
|
201
337
|
contentCategory: typeof val?.contentCategory === "string" ? val.contentCategory : typeof val?.category === "string" ? val.category : void 0,
|
|
202
338
|
contentPlacement: Array.isArray(val?.contentPlacement) ? val.contentPlacement : void 0,
|
|
203
339
|
authorName,
|
|
204
340
|
authorCredentials,
|
|
205
341
|
authorBioUrl,
|
|
206
342
|
authorIsReference,
|
|
343
|
+
factCheckerName,
|
|
344
|
+
factCheckerIsReference,
|
|
207
345
|
// `published` is MJH's date field; `publishedAt`/`publishDate` cover other schemas
|
|
208
346
|
publishedAt: [val?.publishedAt, val?.publishDate, val?.published, val?._createdAt].find((v) => typeof v === "string" && v.trim().length > 0),
|
|
209
347
|
// `updatedOn` is MJH's "Updated On" field. `updatedAt` is the standard Sanity convention.
|
|
@@ -268,16 +406,15 @@ function safeParseJson(text) {
|
|
|
268
406
|
throw new Error("Invalid JSON response from server");
|
|
269
407
|
}
|
|
270
408
|
}
|
|
271
|
-
async function fetchAnalysis(apiUrl, content, mode, publication, seedKeywords, documentFields, focusKeyword, signal) {
|
|
409
|
+
async function fetchAnalysis(apiUrl, content, mode, publication, seedKeywords, documentFields, focusKeyword, secondaryKeyword, signal) {
|
|
272
410
|
const response = await fetch(`${apiUrl}/api/seo-copilot/analyze`, {
|
|
273
411
|
method: "POST",
|
|
274
412
|
headers: { "Content-Type": "application/json" },
|
|
275
|
-
body: JSON.stringify({ content, mode, publication, seedKeywords, documentFields, focusKeyword }),
|
|
413
|
+
body: JSON.stringify({ content, mode, publication, seedKeywords, documentFields, focusKeyword, secondaryKeyword }),
|
|
276
414
|
signal
|
|
277
415
|
});
|
|
278
416
|
const text = await response.text();
|
|
279
417
|
if (!response.ok) {
|
|
280
|
-
const err = safeParseJson(text);
|
|
281
418
|
if (response.status === 429) throw new Error("Analysis service is busy. Please try again.");
|
|
282
419
|
if (response.status >= 500) throw new Error("Could not reach the SEO service.");
|
|
283
420
|
throw new Error("Something went wrong analyzing this document.");
|
|
@@ -292,7 +429,6 @@ async function fetchChatStream(apiUrl, messages, documentContext, publication, k
|
|
|
292
429
|
signal
|
|
293
430
|
});
|
|
294
431
|
if (!response.ok) {
|
|
295
|
-
const err = await response.json().catch(() => ({ error: "Request failed" }));
|
|
296
432
|
if (response.status === 429) throw new Error("Analysis service is busy. Please try again.");
|
|
297
433
|
if (response.status >= 500) throw new Error("Could not reach the SEO service.");
|
|
298
434
|
throw new Error("Something went wrong. Please try again.");
|
|
@@ -300,11 +436,12 @@ async function fetchChatStream(apiUrl, messages, documentContext, publication, k
|
|
|
300
436
|
return response.body;
|
|
301
437
|
}
|
|
302
438
|
async function submitFeedback(apiUrl, data) {
|
|
303
|
-
await fetch(`${apiUrl}/api/seo-copilot/feedback`, {
|
|
439
|
+
const res = await fetch(`${apiUrl}/api/seo-copilot/feedback`, {
|
|
304
440
|
method: "POST",
|
|
305
441
|
headers: { "Content-Type": "application/json" },
|
|
306
442
|
body: JSON.stringify(data)
|
|
307
443
|
});
|
|
444
|
+
if (!res.ok) throw new Error(`Feedback submit failed: HTTP ${res.status}`);
|
|
308
445
|
}
|
|
309
446
|
async function lookupKeywords(apiUrl, keywords, signal) {
|
|
310
447
|
const response = await fetch(`${apiUrl}/api/seo-copilot/keywords`, {
|
|
@@ -314,7 +451,6 @@ async function lookupKeywords(apiUrl, keywords, signal) {
|
|
|
314
451
|
signal
|
|
315
452
|
});
|
|
316
453
|
if (!response.ok) {
|
|
317
|
-
const err = await response.json().catch(() => ({ error: "Request failed" }));
|
|
318
454
|
if (response.status === 429) throw new Error("Analysis service is busy. Please try again.");
|
|
319
455
|
if (response.status >= 500) throw new Error("Could not reach the SEO service.");
|
|
320
456
|
throw new Error("Something went wrong. Please try again.");
|
|
@@ -427,7 +563,7 @@ function mergeVolumes(analysis, volumeMap) {
|
|
|
427
563
|
});
|
|
428
564
|
return updated;
|
|
429
565
|
}
|
|
430
|
-
function useKeywordAnalysis(text, apiUrl, publication, seedKeywords, documentFields, focusPrimary, documentId) {
|
|
566
|
+
function useKeywordAnalysis(text, apiUrl, publication, seedKeywords, documentFields, focusPrimary, documentId, focusSecondary) {
|
|
431
567
|
const cacheKey = documentId ? `seo-copilot-cache-${documentId}` : "seo-copilot-cache-v2";
|
|
432
568
|
const loadCached = useCallback(() => {
|
|
433
569
|
try {
|
|
@@ -480,7 +616,7 @@ function useKeywordAnalysis(text, apiUrl, publication, seedKeywords, documentFie
|
|
|
480
616
|
localStorage.setItem(cacheKey, JSON.stringify({ ...prev, analysis: withVolumes }));
|
|
481
617
|
} catch {
|
|
482
618
|
}
|
|
483
|
-
}, [cacheKey]);
|
|
619
|
+
}, [cacheKey, loadCached]);
|
|
484
620
|
const setDeepAnalysis = useCallback((val) => {
|
|
485
621
|
setDeepAnalysisRaw(val);
|
|
486
622
|
try {
|
|
@@ -488,7 +624,7 @@ function useKeywordAnalysis(text, apiUrl, publication, seedKeywords, documentFie
|
|
|
488
624
|
localStorage.setItem(cacheKey, JSON.stringify({ ...prev, deepAnalysis: val }));
|
|
489
625
|
} catch {
|
|
490
626
|
}
|
|
491
|
-
}, [cacheKey]);
|
|
627
|
+
}, [cacheKey, loadCached]);
|
|
492
628
|
const effectiveSeeds = seedKeywords;
|
|
493
629
|
useEffect2(() => {
|
|
494
630
|
if (deepAnalysis && aeoTextSnapshot && text !== aeoTextSnapshot) {
|
|
@@ -556,7 +692,7 @@ function useKeywordAnalysis(text, apiUrl, publication, seedKeywords, documentFie
|
|
|
556
692
|
const controller = new AbortController();
|
|
557
693
|
setIsLoading(true);
|
|
558
694
|
setError(null);
|
|
559
|
-
fetchAnalysis(apiUrl, text, "realtime", publication, effectiveSeeds, documentFields, focusPrimary, controller.signal).then((result) => {
|
|
695
|
+
fetchAnalysis(apiUrl, text, "realtime", publication, effectiveSeeds, documentFields, focusPrimary, focusSecondary, controller.signal).then((result) => {
|
|
560
696
|
if (cancelled) return;
|
|
561
697
|
const analysisResult = result;
|
|
562
698
|
lastAnalysisRef.current = analysisResult;
|
|
@@ -586,7 +722,7 @@ function useKeywordAnalysis(text, apiUrl, publication, seedKeywords, documentFie
|
|
|
586
722
|
cancelled = true;
|
|
587
723
|
controller.abort();
|
|
588
724
|
};
|
|
589
|
-
}, [text, apiUrl, publication, effectiveSeeds?.join(","), focusPrimary, JSON.stringify(documentFields)]);
|
|
725
|
+
}, [text, apiUrl, publication, effectiveSeeds?.join(","), focusPrimary, focusSecondary, JSON.stringify(documentFields)]);
|
|
590
726
|
const refreshVolumes = useCallback(() => {
|
|
591
727
|
const current = lastAnalysisRef.current || analysis;
|
|
592
728
|
if (!current) return;
|
|
@@ -602,7 +738,7 @@ function useKeywordAnalysis(text, apiUrl, publication, seedKeywords, documentFie
|
|
|
602
738
|
deepAbortRef.current?.abort();
|
|
603
739
|
const deepController = new AbortController();
|
|
604
740
|
deepAbortRef.current = deepController;
|
|
605
|
-
fetchAnalysis(apiUrl, text, "deep", publication, effectiveSeeds, documentFields, focusPrimary, deepController.signal).then((result) => {
|
|
741
|
+
fetchAnalysis(apiUrl, text, "deep", publication, effectiveSeeds, documentFields, focusPrimary, focusSecondary, deepController.signal).then((result) => {
|
|
606
742
|
if (docVersionRef.current !== myVersion) return;
|
|
607
743
|
setDeepAnalysis(result);
|
|
608
744
|
setIsDeepLoading(false);
|
|
@@ -612,7 +748,7 @@ function useKeywordAnalysis(text, apiUrl, publication, seedKeywords, documentFie
|
|
|
612
748
|
setError(err.message);
|
|
613
749
|
setIsDeepLoading(false);
|
|
614
750
|
});
|
|
615
|
-
}, [text, apiUrl, publication, effectiveSeeds?.join(","), documentFields, focusPrimary]);
|
|
751
|
+
}, [text, apiUrl, publication, effectiveSeeds?.join(","), documentFields, focusPrimary, focusSecondary]);
|
|
616
752
|
return {
|
|
617
753
|
analysis,
|
|
618
754
|
isLoading,
|
|
@@ -957,6 +1093,13 @@ var INJECTED_CSS = `
|
|
|
957
1093
|
from { opacity: 1; transform: translateY(0) scale(1); }
|
|
958
1094
|
to { opacity: 0; transform: translateY(-6px) scale(0.97); }
|
|
959
1095
|
}
|
|
1096
|
+
@keyframes seo-copilot-sec-float {
|
|
1097
|
+
0%, 100% { transform: translateY(0); }
|
|
1098
|
+
50% { transform: translateY(-1.5px); }
|
|
1099
|
+
}
|
|
1100
|
+
@media (prefers-reduced-motion: reduce) {
|
|
1101
|
+
.seo-copilot-sec-circle { animation: none !important; }
|
|
1102
|
+
}
|
|
960
1103
|
.prose-chat { font-size: 12.5px; line-height: 1.65; color: #475569; font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif; }
|
|
961
1104
|
.prose-chat h1 { font-size: 14px; font-weight: 700; color: #1e293b; margin: 10px 0 5px 0; line-height: 1.35; }
|
|
962
1105
|
.prose-chat h2, .prose-chat h3 { font-size: 13px; font-weight: 700; color: #1e293b; margin: 10px 0 5px 0; line-height: 1.35; }
|
|
@@ -1706,119 +1849,6 @@ function PrimaryKeywordSelector({
|
|
|
1706
1849
|
}) })
|
|
1707
1850
|
] });
|
|
1708
1851
|
}
|
|
1709
|
-
function SecondaryKeywordSelector({
|
|
1710
|
-
options,
|
|
1711
|
-
selectedTerm,
|
|
1712
|
-
onSelect
|
|
1713
|
-
}) {
|
|
1714
|
-
const [customInputOpen, setCustomInputOpen] = useState8(false);
|
|
1715
|
-
const [customValue, setCustomValue] = useState8("");
|
|
1716
|
-
const handleCustomSubmit = () => {
|
|
1717
|
-
const trimmed = customValue.trim();
|
|
1718
|
-
if (trimmed) {
|
|
1719
|
-
onSelect(trimmed);
|
|
1720
|
-
setCustomValue("");
|
|
1721
|
-
setCustomInputOpen(false);
|
|
1722
|
-
}
|
|
1723
|
-
};
|
|
1724
|
-
const opts = selectedTerm && !options.some((o) => o.term.toLowerCase() === selectedTerm.toLowerCase()) ? [...options, { term: selectedTerm, volume: null }] : options;
|
|
1725
|
-
return /* @__PURE__ */ jsxs4("div", { style: cardStyle, children: [
|
|
1726
|
-
/* @__PURE__ */ jsx5(
|
|
1727
|
-
SectionHeader,
|
|
1728
|
-
{
|
|
1729
|
-
label: "Secondary Keyword",
|
|
1730
|
-
iconColor: MJH_BLUE,
|
|
1731
|
-
actionButton: /* @__PURE__ */ jsxs4("div", { style: { display: "flex", alignItems: "center", gap: 6 }, children: [
|
|
1732
|
-
/* @__PURE__ */ jsx5("span", { style: { fontSize: 9, fontWeight: 700, letterSpacing: "0.05em", textTransform: "uppercase", color: "#9ca3af" }, children: "Optional" }),
|
|
1733
|
-
/* @__PURE__ */ jsx5(PencilButton, { onClick: () => setCustomInputOpen(!customInputOpen), active: customInputOpen })
|
|
1734
|
-
] })
|
|
1735
|
-
}
|
|
1736
|
-
),
|
|
1737
|
-
/* @__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." }),
|
|
1738
|
-
customInputOpen && /* @__PURE__ */ jsxs4("div", { style: { marginBottom: 8, display: "flex", gap: 6 }, children: [
|
|
1739
|
-
/* @__PURE__ */ jsx5(
|
|
1740
|
-
"input",
|
|
1741
|
-
{
|
|
1742
|
-
type: "text",
|
|
1743
|
-
value: customValue,
|
|
1744
|
-
onChange: (e) => setCustomValue(e.target.value),
|
|
1745
|
-
onKeyDown: (e) => {
|
|
1746
|
-
if (e.key === "Enter") handleCustomSubmit();
|
|
1747
|
-
},
|
|
1748
|
-
placeholder: "Type a custom secondary keyword",
|
|
1749
|
-
autoFocus: true,
|
|
1750
|
-
style: { flex: 1, padding: "5px 8px", fontSize: 12, borderRadius: 8, border: "1px solid #e5e7eb", outline: "none", fontFamily: "inherit" }
|
|
1751
|
-
}
|
|
1752
|
-
),
|
|
1753
|
-
/* @__PURE__ */ jsx5(
|
|
1754
|
-
"button",
|
|
1755
|
-
{
|
|
1756
|
-
onClick: handleCustomSubmit,
|
|
1757
|
-
disabled: !customValue.trim(),
|
|
1758
|
-
style: {
|
|
1759
|
-
padding: "5px 10px",
|
|
1760
|
-
fontSize: 11,
|
|
1761
|
-
fontWeight: 600,
|
|
1762
|
-
borderRadius: 6,
|
|
1763
|
-
border: "none",
|
|
1764
|
-
background: customValue.trim() ? MJH_BLUE : "#e5e7eb",
|
|
1765
|
-
color: customValue.trim() ? "#ffffff" : "#9ca3af",
|
|
1766
|
-
cursor: customValue.trim() ? "pointer" : "not-allowed"
|
|
1767
|
-
},
|
|
1768
|
-
children: "Set"
|
|
1769
|
-
}
|
|
1770
|
-
)
|
|
1771
|
-
] }),
|
|
1772
|
-
/* @__PURE__ */ jsxs4("div", { style: { display: "flex", flexDirection: "column", gap: 6 }, children: [
|
|
1773
|
-
/* @__PURE__ */ jsx5(SecondaryOptionRow, { term: "", label: "None", selected: !selectedTerm, onSelect: () => onSelect("") }),
|
|
1774
|
-
opts.map((o) => /* @__PURE__ */ jsx5(
|
|
1775
|
-
SecondaryOptionRow,
|
|
1776
|
-
{
|
|
1777
|
-
term: o.term,
|
|
1778
|
-
label: o.term,
|
|
1779
|
-
volume: o.volume,
|
|
1780
|
-
selected: o.term === selectedTerm,
|
|
1781
|
-
onSelect: () => onSelect(o.term)
|
|
1782
|
-
},
|
|
1783
|
-
o.term
|
|
1784
|
-
))
|
|
1785
|
-
] })
|
|
1786
|
-
] });
|
|
1787
|
-
}
|
|
1788
|
-
function SecondaryOptionRow({ term, label, volume, selected, onSelect }) {
|
|
1789
|
-
return /* @__PURE__ */ jsxs4(
|
|
1790
|
-
"div",
|
|
1791
|
-
{
|
|
1792
|
-
onClick: onSelect,
|
|
1793
|
-
style: {
|
|
1794
|
-
display: "flex",
|
|
1795
|
-
alignItems: "center",
|
|
1796
|
-
gap: 8,
|
|
1797
|
-
padding: "6px 8px",
|
|
1798
|
-
borderRadius: 8,
|
|
1799
|
-
cursor: "pointer",
|
|
1800
|
-
background: selected ? "rgba(0,93,172,0.06)" : "transparent",
|
|
1801
|
-
border: selected ? "1px solid rgba(0,93,172,0.2)" : "1px solid transparent",
|
|
1802
|
-
transition: "all 150ms"
|
|
1803
|
-
},
|
|
1804
|
-
children: [
|
|
1805
|
-
/* @__PURE__ */ jsx5("div", { style: {
|
|
1806
|
-
width: 14,
|
|
1807
|
-
height: 14,
|
|
1808
|
-
borderRadius: "50%",
|
|
1809
|
-
border: selected ? "none" : "2px solid #d1d5db",
|
|
1810
|
-
background: selected ? MJH_BLUE : "transparent",
|
|
1811
|
-
flexShrink: 0,
|
|
1812
|
-
display: "flex",
|
|
1813
|
-
alignItems: "center",
|
|
1814
|
-
justifyContent: "center"
|
|
1815
|
-
}, children: selected && /* @__PURE__ */ jsx5("div", { style: { width: 6, height: 6, borderRadius: "50%", background: "#ffffff" } }) }),
|
|
1816
|
-
/* @__PURE__ */ jsx5("span", { style: { fontSize: 12, fontWeight: selected ? 600 : 400, color: term ? selected ? "#00468a" : "#374151" : "#6b7280", flex: 1, minWidth: 0 }, children: label }),
|
|
1817
|
-
volume != null && /* @__PURE__ */ jsx5("span", { style: { fontSize: 11, fontWeight: 600, color: "#1f2937" }, children: volume === 0 ? "N/A" : `${abbrevVol(volume)}/mo` })
|
|
1818
|
-
]
|
|
1819
|
-
}
|
|
1820
|
-
);
|
|
1821
|
-
}
|
|
1822
1852
|
var PLACEMENT_FILTERS = [
|
|
1823
1853
|
{ key: "inBody", label: "Body", letter: "B" },
|
|
1824
1854
|
{ key: "inTitle", label: "Title", letter: "T" },
|
|
@@ -1837,6 +1867,8 @@ function computePlacementClient(term, content, fields) {
|
|
|
1837
1867
|
inUrl: fields?.slug?.toLowerCase().includes(lower) ?? false
|
|
1838
1868
|
};
|
|
1839
1869
|
}
|
|
1870
|
+
var SECONDARY_PURPLE = "#9B59B6";
|
|
1871
|
+
var SECONDARY_PURPLE_TEXT = "#7D3C98";
|
|
1840
1872
|
function SuggestedKeywordsCard({
|
|
1841
1873
|
keywords,
|
|
1842
1874
|
text,
|
|
@@ -1845,7 +1877,10 @@ function SuggestedKeywordsCard({
|
|
|
1845
1877
|
documentFields,
|
|
1846
1878
|
refreshVolumes,
|
|
1847
1879
|
isVolumesLoading,
|
|
1848
|
-
documentId
|
|
1880
|
+
documentId,
|
|
1881
|
+
secondaryKeyword,
|
|
1882
|
+
onSelectSecondary,
|
|
1883
|
+
primaryTerm
|
|
1849
1884
|
}) {
|
|
1850
1885
|
const docScope = documentId || "default";
|
|
1851
1886
|
const [helpData, setHelpData] = usePersistentState(
|
|
@@ -1866,6 +1901,11 @@ function SuggestedKeywordsCard({
|
|
|
1866
1901
|
[]
|
|
1867
1902
|
);
|
|
1868
1903
|
const [isGeneratingMore, setIsGeneratingMore] = useState8(false);
|
|
1904
|
+
const [secSelecting, setSecSelecting] = useState8(false);
|
|
1905
|
+
const startSecSelecting = () => {
|
|
1906
|
+
setExpanded(true);
|
|
1907
|
+
setSecSelecting(true);
|
|
1908
|
+
};
|
|
1869
1909
|
const [sortAsc, setSortAsc] = usePersistentState("seo-copilot-ui-keywords-sort-asc", false);
|
|
1870
1910
|
const filtersKey = `seo-copilot-ui-keywords-filters-${docScope}`;
|
|
1871
1911
|
const [activeFilters, setActiveFiltersRaw] = useState8(
|
|
@@ -1992,10 +2032,18 @@ function SuggestedKeywordsCard({
|
|
|
1992
2032
|
if (pA !== pB) return pB - pA;
|
|
1993
2033
|
return b.volume - a.volume;
|
|
1994
2034
|
});
|
|
1995
|
-
const
|
|
2035
|
+
const merged = [...sorted, ...extraKeywords.filter((ek) => !sorted.some((s) => s.term.toLowerCase() === ek.term.toLowerCase()))];
|
|
2036
|
+
const hasVol = (k) => k.volume != null && k.volume > 0;
|
|
2037
|
+
const withVol = merged.filter(hasVol);
|
|
2038
|
+
const allKeywords = isVolumesLoading || withVol.length === 0 ? merged : withVol;
|
|
1996
2039
|
const visible = expanded ? allKeywords : allKeywords.slice(0, INITIAL_SHOW);
|
|
1997
2040
|
const hiddenCount = allKeywords.length - INITIAL_SHOW;
|
|
1998
2041
|
const missingCount = keywords.filter((kw) => !kw.inContent).length;
|
|
2042
|
+
const secLower = (secondaryKeyword || "").toLowerCase();
|
|
2043
|
+
const primaryLower = (primaryTerm || "").toLowerCase();
|
|
2044
|
+
const isSecondaryRow = (term) => secLower !== "" && term.toLowerCase() === secLower;
|
|
2045
|
+
const isPrimaryRow = (term) => primaryLower !== "" && term.toLowerCase() === primaryLower;
|
|
2046
|
+
const secondaryInList = secLower !== "" && allKeywords.some((k) => k.term.toLowerCase() === secLower);
|
|
1999
2047
|
const generateMoreKeywords = async () => {
|
|
2000
2048
|
setIsGeneratingMore(true);
|
|
2001
2049
|
try {
|
|
@@ -2018,7 +2066,15 @@ function SuggestedKeywordsCard({
|
|
|
2018
2066
|
}
|
|
2019
2067
|
setIsGeneratingMore(false);
|
|
2020
2068
|
};
|
|
2021
|
-
|
|
2069
|
+
const didBackfillRef = useRef7(false);
|
|
2070
|
+
useEffect6(() => {
|
|
2071
|
+
if (didBackfillRef.current) return;
|
|
2072
|
+
if (isVolumesLoading || isGeneratingMore || keywords.length === 0) return;
|
|
2073
|
+
didBackfillRef.current = true;
|
|
2074
|
+
const volCount = [...keywords, ...extraKeywords].filter((k) => k.volume != null && k.volume > 0).length;
|
|
2075
|
+
if (volCount < 8) generateMoreKeywords();
|
|
2076
|
+
}, [keywords, isVolumesLoading]);
|
|
2077
|
+
return /* @__PURE__ */ jsxs4("div", { style: secSelecting ? { ...cardStyle, border: `1.5px solid ${SECONDARY_PURPLE}`, boxShadow: [cardStyle.boxShadow, `0 0 0 1px rgba(155,89,182,0.25)`].filter(Boolean).join(", ") } : cardStyle, children: [
|
|
2022
2078
|
/* @__PURE__ */ jsxs4("div", { style: { display: "flex", alignItems: "center", gap: 6, marginBottom: 8 }, children: [
|
|
2023
2079
|
/* @__PURE__ */ jsx5("div", { style: { width: 6, height: 6, borderRadius: "50%", background: MJH_BLUE, flexShrink: 0 } }),
|
|
2024
2080
|
/* @__PURE__ */ jsx5("span", { style: { fontSize: 10, textTransform: "uppercase", letterSpacing: "0.05em", color: "#4b5563", fontWeight: 600, flex: 1 }, children: "Supporting Keywords" }),
|
|
@@ -2173,6 +2229,86 @@ function SuggestedKeywordsCard({
|
|
|
2173
2229
|
] }),
|
|
2174
2230
|
/* @__PURE__ */ jsx5(PencilButton, { onClick: () => setManualInputOpen(!manualInputOpen), active: manualInputOpen })
|
|
2175
2231
|
] }),
|
|
2232
|
+
/* @__PURE__ */ jsx5("span", { "aria-live": "polite", style: { position: "absolute", width: 1, height: 1, padding: 0, margin: -1, overflow: "hidden", clip: "rect(0 0 0 0)", whiteSpace: "nowrap", border: 0 }, children: secSelecting ? "Selection mode on. Pick a keyword below to set it as the secondary keyword." : "" }),
|
|
2233
|
+
onSelectSecondary && (secSelecting ? /* @__PURE__ */ jsxs4("div", { style: {
|
|
2234
|
+
display: "flex",
|
|
2235
|
+
alignItems: "center",
|
|
2236
|
+
justifyContent: "space-between",
|
|
2237
|
+
gap: 8,
|
|
2238
|
+
marginBottom: 8,
|
|
2239
|
+
padding: "5px 10px",
|
|
2240
|
+
borderRadius: 8,
|
|
2241
|
+
background: "rgba(155,89,182,0.08)",
|
|
2242
|
+
border: `1px solid rgba(155,89,182,0.35)`
|
|
2243
|
+
}, children: [
|
|
2244
|
+
/* @__PURE__ */ jsx5("span", { style: { fontSize: 11, fontWeight: 600, color: SECONDARY_PURPLE_TEXT }, children: "Pick a keyword below to set as secondary." }),
|
|
2245
|
+
/* @__PURE__ */ jsx5(
|
|
2246
|
+
"button",
|
|
2247
|
+
{
|
|
2248
|
+
onClick: () => setSecSelecting(false),
|
|
2249
|
+
style: { background: "none", border: "none", cursor: "pointer", fontSize: 11, fontWeight: 600, color: "#6b7280", padding: 2, fontFamily: "inherit" },
|
|
2250
|
+
children: "Cancel"
|
|
2251
|
+
}
|
|
2252
|
+
)
|
|
2253
|
+
] }) : secondaryKeyword ? /* @__PURE__ */ jsxs4("div", { style: {
|
|
2254
|
+
display: "flex",
|
|
2255
|
+
alignItems: "center",
|
|
2256
|
+
gap: 8,
|
|
2257
|
+
marginBottom: 8,
|
|
2258
|
+
padding: "5px 10px",
|
|
2259
|
+
borderRadius: 8,
|
|
2260
|
+
background: "rgba(155,89,182,0.08)",
|
|
2261
|
+
border: `1px solid rgba(155,89,182,0.35)`
|
|
2262
|
+
}, children: [
|
|
2263
|
+
/* @__PURE__ */ jsx5("div", { style: { width: 8, height: 8, borderRadius: "50%", background: SECONDARY_PURPLE, flexShrink: 0 } }),
|
|
2264
|
+
/* @__PURE__ */ jsxs4("span", { style: { fontSize: 11, fontWeight: 600, color: SECONDARY_PURPLE_TEXT, flex: 1, minWidth: 0, overflow: "hidden", textOverflow: "ellipsis", whiteSpace: "nowrap" }, children: [
|
|
2265
|
+
"Secondary: ",
|
|
2266
|
+
secondaryKeyword
|
|
2267
|
+
] }),
|
|
2268
|
+
!secondaryInList && /* @__PURE__ */ jsx5("span", { title: "This keyword is no longer in the list below - re-pick or clear it.", style: { fontSize: 9.5, fontWeight: 600, fontStyle: "italic", color: "#9ca3af", flexShrink: 0 }, children: "not in list" }),
|
|
2269
|
+
/* @__PURE__ */ jsx5(
|
|
2270
|
+
"button",
|
|
2271
|
+
{
|
|
2272
|
+
onClick: startSecSelecting,
|
|
2273
|
+
style: { background: "none", border: "none", cursor: "pointer", fontSize: 11, fontWeight: 600, color: SECONDARY_PURPLE_TEXT, padding: 2, fontFamily: "inherit" },
|
|
2274
|
+
children: "Change"
|
|
2275
|
+
}
|
|
2276
|
+
),
|
|
2277
|
+
/* @__PURE__ */ jsx5(
|
|
2278
|
+
"button",
|
|
2279
|
+
{
|
|
2280
|
+
onClick: () => onSelectSecondary(""),
|
|
2281
|
+
title: "Clear secondary keyword",
|
|
2282
|
+
"aria-label": "Clear secondary keyword",
|
|
2283
|
+
style: { background: "none", border: "none", cursor: "pointer", fontSize: 14, lineHeight: 1, color: "#9ca3af", padding: 2, fontFamily: "inherit" },
|
|
2284
|
+
children: "\xD7"
|
|
2285
|
+
}
|
|
2286
|
+
)
|
|
2287
|
+
] }) : /* @__PURE__ */ jsxs4(
|
|
2288
|
+
"button",
|
|
2289
|
+
{
|
|
2290
|
+
onClick: startSecSelecting,
|
|
2291
|
+
style: {
|
|
2292
|
+
display: "inline-flex",
|
|
2293
|
+
alignItems: "center",
|
|
2294
|
+
gap: 6,
|
|
2295
|
+
marginBottom: 8,
|
|
2296
|
+
padding: "4px 10px",
|
|
2297
|
+
borderRadius: 8,
|
|
2298
|
+
cursor: "pointer",
|
|
2299
|
+
background: "rgba(155,89,182,0.08)",
|
|
2300
|
+
border: `1px solid rgba(155,89,182,0.4)`,
|
|
2301
|
+
color: SECONDARY_PURPLE_TEXT,
|
|
2302
|
+
fontSize: 11,
|
|
2303
|
+
fontWeight: 600,
|
|
2304
|
+
fontFamily: "inherit"
|
|
2305
|
+
},
|
|
2306
|
+
children: [
|
|
2307
|
+
/* @__PURE__ */ jsx5("div", { style: { width: 11, height: 11, borderRadius: "50%", border: `2px solid ${SECONDARY_PURPLE}`, flexShrink: 0 } }),
|
|
2308
|
+
"Click to choose a secondary keyword."
|
|
2309
|
+
]
|
|
2310
|
+
}
|
|
2311
|
+
)),
|
|
2176
2312
|
manualInputOpen && /* @__PURE__ */ jsxs4("div", { style: { marginBottom: 8, display: "flex", gap: 6 }, children: [
|
|
2177
2313
|
/* @__PURE__ */ jsx5(
|
|
2178
2314
|
"input",
|
|
@@ -2216,14 +2352,46 @@ function SuggestedKeywordsCard({
|
|
|
2216
2352
|
borderBottom: i < visible.length - 1 ? "1px solid #f3f4f6" : "none",
|
|
2217
2353
|
minHeight: 28
|
|
2218
2354
|
}, children: [
|
|
2219
|
-
|
|
2355
|
+
secSelecting && onSelectSecondary ? isPrimaryRow(kw.term) ? (
|
|
2356
|
+
// The active primary keyword cannot also be the secondary - show a muted,
|
|
2357
|
+
// non-selectable marker instead of a pickable circle.
|
|
2358
|
+
/* @__PURE__ */ jsx5("div", { title: "Already your primary keyword", style: { width: 14, height: 14, borderRadius: "50%", flexShrink: 0, border: "2px solid #e5e7eb", background: "transparent" } })
|
|
2359
|
+
) : /* @__PURE__ */ jsx5(
|
|
2360
|
+
"button",
|
|
2361
|
+
{
|
|
2362
|
+
className: "seo-copilot-sec-circle",
|
|
2363
|
+
onClick: () => {
|
|
2364
|
+
onSelectSecondary(kw.term);
|
|
2365
|
+
setSecSelecting(false);
|
|
2366
|
+
},
|
|
2367
|
+
"aria-label": `Set ${kw.term} as the secondary keyword`,
|
|
2368
|
+
title: `Set "${kw.term}" as the secondary keyword`,
|
|
2369
|
+
style: {
|
|
2370
|
+
width: 14,
|
|
2371
|
+
height: 14,
|
|
2372
|
+
borderRadius: "50%",
|
|
2373
|
+
flexShrink: 0,
|
|
2374
|
+
padding: 0,
|
|
2375
|
+
border: `2px solid ${SECONDARY_PURPLE}`,
|
|
2376
|
+
background: "transparent",
|
|
2377
|
+
cursor: "pointer",
|
|
2378
|
+
animation: "seo-copilot-sec-float 1.8s ease-in-out infinite",
|
|
2379
|
+
animationDelay: `${i % 5 * 0.12}s`
|
|
2380
|
+
}
|
|
2381
|
+
}
|
|
2382
|
+
) : isSecondaryRow(kw.term) ? /* @__PURE__ */ jsx5("div", { style: { width: 8, height: 8, borderRadius: "50%", background: SECONDARY_PURPLE, flexShrink: 0 } }) : secondaryKeyword ? /* @__PURE__ */ jsx5("div", { style: { width: 8, height: 8, flexShrink: 0 } }) : /* @__PURE__ */ jsx5("div", { style: {
|
|
2220
2383
|
width: 8,
|
|
2221
2384
|
height: 8,
|
|
2222
2385
|
borderRadius: "50%",
|
|
2223
2386
|
flexShrink: 0,
|
|
2224
2387
|
background: kw.inContent ? "#16a34a" : "#d1d5db"
|
|
2225
2388
|
} }),
|
|
2226
|
-
/* @__PURE__ */ jsx5("span", { style: {
|
|
2389
|
+
/* @__PURE__ */ jsx5("span", { style: {
|
|
2390
|
+
fontSize: 12,
|
|
2391
|
+
fontWeight: isSecondaryRow(kw.term) ? 700 : kw.inContent ? 500 : 600,
|
|
2392
|
+
flexGrow: 1,
|
|
2393
|
+
color: !secSelecting && isSecondaryRow(kw.term) ? SECONDARY_PURPLE_TEXT : "#1f2937"
|
|
2394
|
+
}, children: kw.term }),
|
|
2227
2395
|
enrichingTerms.has(kw.term) && /* @__PURE__ */ jsx5(LoadingBars, { size: "xs", color: "#6b7280" }),
|
|
2228
2396
|
!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` }),
|
|
2229
2397
|
kw.placement && /* @__PURE__ */ jsx5(PlacementIndicators, { placement: kw.placement }),
|
|
@@ -2362,26 +2530,10 @@ function KeywordPanel({
|
|
|
2362
2530
|
...c,
|
|
2363
2531
|
placement: computePlacementClient(c.term, text, documentFields)
|
|
2364
2532
|
}));
|
|
2365
|
-
const
|
|
2366
|
-
const
|
|
2367
|
-
const
|
|
2368
|
-
const
|
|
2369
|
-
for (const c of candidates) {
|
|
2370
|
-
const key = c.term.toLowerCase();
|
|
2371
|
-
if (key === activeTermLower) continue;
|
|
2372
|
-
if (!seenSecondary.has(key)) {
|
|
2373
|
-
seenSecondary.add(key);
|
|
2374
|
-
secondaryOptions.push({ term: c.term, volume: c.volume });
|
|
2375
|
-
}
|
|
2376
|
-
}
|
|
2377
|
-
for (const kw of suggestedKeywords) {
|
|
2378
|
-
const key = kw.term.toLowerCase();
|
|
2379
|
-
if (key === activeTermLower) continue;
|
|
2380
|
-
if (!seenSecondary.has(key)) {
|
|
2381
|
-
seenSecondary.add(key);
|
|
2382
|
-
secondaryOptions.push({ term: kw.term, volume: kw.volume });
|
|
2383
|
-
}
|
|
2384
|
-
}
|
|
2533
|
+
const candHasVol = (c) => c.volume != null && c.volume > 0;
|
|
2534
|
+
const candWithVol = candidates.filter(candHasVol);
|
|
2535
|
+
const visibleCandidates = isVolumesLoading || candWithVol.length === 0 ? candidates : candWithVol;
|
|
2536
|
+
const activeTerm = visibleCandidates.find((c) => c.term === selectedPrimaryTerm) ? selectedPrimaryTerm : visibleCandidates[0]?.term ?? "";
|
|
2385
2537
|
return /* @__PURE__ */ jsxs4("div", { style: { padding: 12, display: "flex", flexDirection: "column", gap: 12 }, children: [
|
|
2386
2538
|
/* @__PURE__ */ jsx5("div", { style: {
|
|
2387
2539
|
...cardStyle,
|
|
@@ -2394,13 +2546,13 @@ function KeywordPanel({
|
|
|
2394
2546
|
/* @__PURE__ */ jsx5("strong", { children: "Primary" }),
|
|
2395
2547
|
" keyword (required) and, optionally, one ",
|
|
2396
2548
|
/* @__PURE__ */ jsx5("strong", { children: "Secondary" }),
|
|
2397
|
-
" keyword. Copilot optimizes
|
|
2549
|
+
" keyword. Copilot then optimizes its recommendations toward both."
|
|
2398
2550
|
] }) }),
|
|
2399
2551
|
onSeedsChange && /* @__PURE__ */ jsx5(SeedKeywordInput, { seeds: seedKeywords, onSeedsChange }),
|
|
2400
2552
|
/* @__PURE__ */ jsx5(
|
|
2401
2553
|
PrimaryKeywordSelector,
|
|
2402
2554
|
{
|
|
2403
|
-
candidates,
|
|
2555
|
+
candidates: visibleCandidates,
|
|
2404
2556
|
selectedTerm: activeTerm,
|
|
2405
2557
|
onSelect: (term) => {
|
|
2406
2558
|
setSelectedPrimaryTerm(term);
|
|
@@ -2409,15 +2561,7 @@ function KeywordPanel({
|
|
|
2409
2561
|
publication
|
|
2410
2562
|
}
|
|
2411
2563
|
),
|
|
2412
|
-
|
|
2413
|
-
SecondaryKeywordSelector,
|
|
2414
|
-
{
|
|
2415
|
-
options: secondaryOptions,
|
|
2416
|
-
selectedTerm: secondaryKeyword,
|
|
2417
|
-
onSelect: (term) => onSelectSecondary(term)
|
|
2418
|
-
}
|
|
2419
|
-
),
|
|
2420
|
-
suggestedKeywords.length > 0 && /* @__PURE__ */ jsx5(
|
|
2564
|
+
(suggestedKeywords.length > 0 || !!onSelectSecondary) && /* @__PURE__ */ jsx5(
|
|
2421
2565
|
SuggestedKeywordsCard,
|
|
2422
2566
|
{
|
|
2423
2567
|
keywords: suggestedKeywords,
|
|
@@ -2427,7 +2571,10 @@ function KeywordPanel({
|
|
|
2427
2571
|
documentFields,
|
|
2428
2572
|
refreshVolumes,
|
|
2429
2573
|
isVolumesLoading,
|
|
2430
|
-
documentId
|
|
2574
|
+
documentId,
|
|
2575
|
+
secondaryKeyword,
|
|
2576
|
+
onSelectSecondary,
|
|
2577
|
+
primaryTerm: activeTerm
|
|
2431
2578
|
},
|
|
2432
2579
|
documentId || "default"
|
|
2433
2580
|
),
|
|
@@ -2435,6 +2582,10 @@ function KeywordPanel({
|
|
|
2435
2582
|
/* @__PURE__ */ jsx5(LoadingBars, { size: "xs", color: MJH_GOLD }),
|
|
2436
2583
|
/* @__PURE__ */ jsx5("span", { style: { fontSize: 10, color: "#4b5563" }, children: "Checking search volumes..." })
|
|
2437
2584
|
] }),
|
|
2585
|
+
error && analysis && /* @__PURE__ */ jsxs4("div", { style: { padding: "4px 12px", fontSize: 11, color: "#dc2626" }, children: [
|
|
2586
|
+
"Could not refresh analysis: ",
|
|
2587
|
+
error
|
|
2588
|
+
] }),
|
|
2438
2589
|
isLoading && analysis && /* @__PURE__ */ jsxs4("div", { style: { display: "flex", alignItems: "center", gap: 6, justifyContent: "center" }, children: [
|
|
2439
2590
|
/* @__PURE__ */ jsx5(LoadingBars, { size: "xs", color: "#9ca3af" }),
|
|
2440
2591
|
/* @__PURE__ */ jsx5("span", { style: { fontSize: 10, color: "#4b5563" }, children: "Updating insights..." })
|
|
@@ -3107,82 +3258,289 @@ function OnboardingCard({ onDismiss, closing }) {
|
|
|
3107
3258
|
] });
|
|
3108
3259
|
}
|
|
3109
3260
|
|
|
3110
|
-
// src/components/
|
|
3111
|
-
import {
|
|
3112
|
-
|
|
3113
|
-
|
|
3114
|
-
|
|
3115
|
-
|
|
3116
|
-
|
|
3117
|
-
|
|
3118
|
-
|
|
3119
|
-
|
|
3120
|
-
|
|
3121
|
-
|
|
3122
|
-
|
|
3123
|
-
|
|
3124
|
-
|
|
3125
|
-
|
|
3126
|
-
|
|
3127
|
-
|
|
3128
|
-
|
|
3129
|
-
style: { display: "inline-flex", alignItems: "flex-end", gap: 2, height: 14, flexShrink: 0 },
|
|
3130
|
-
children: [1, 2, 3].map((i) => /* @__PURE__ */ jsx9(
|
|
3131
|
-
"div",
|
|
3132
|
-
{
|
|
3133
|
-
style: {
|
|
3134
|
-
width: 6,
|
|
3135
|
-
height: 8,
|
|
3136
|
-
borderRadius: 2,
|
|
3137
|
-
background: color,
|
|
3138
|
-
animation: `bar-shift-${i} 1.4s ease-in-out infinite`
|
|
3139
|
-
}
|
|
3140
|
-
},
|
|
3141
|
-
i
|
|
3142
|
-
))
|
|
3143
|
-
}
|
|
3144
|
-
);
|
|
3145
|
-
}
|
|
3146
|
-
function ShimmerLoader({
|
|
3147
|
-
messages,
|
|
3148
|
-
intervalMs = 1500,
|
|
3149
|
-
textSize = 14,
|
|
3150
|
-
iconColor = MJH_GOLD
|
|
3151
|
-
}) {
|
|
3152
|
-
const [idx, setIdx] = useState11(0);
|
|
3153
|
-
useEffect9(() => {
|
|
3154
|
-
if (typeof window !== "undefined" && !keyframesInjected) {
|
|
3155
|
-
keyframesInjected = true;
|
|
3156
|
-
const style = document.createElement("style");
|
|
3157
|
-
style.dataset.seoCopilotKeyframes = "1";
|
|
3158
|
-
style.innerHTML = KEYFRAMES;
|
|
3159
|
-
document.head.appendChild(style);
|
|
3160
|
-
}
|
|
3261
|
+
// src/components/ReportProblemButton.tsx
|
|
3262
|
+
import { useState as useState11, useRef as useRef10, useEffect as useEffect9 } from "react";
|
|
3263
|
+
import { useCurrentUser as useCurrentUser3 } from "sanity";
|
|
3264
|
+
import { Fragment as Fragment5, jsx as jsx9, jsxs as jsxs8 } from "react/jsx-runtime";
|
|
3265
|
+
function ReportProblemButton({ activeTab, publication, documentId, documentType, primaryKeyword }) {
|
|
3266
|
+
const { apiUrl } = useConfig();
|
|
3267
|
+
const sanityUser = useCurrentUser3();
|
|
3268
|
+
const [open, setOpen] = useState11(false);
|
|
3269
|
+
const [text, setText] = useState11("");
|
|
3270
|
+
const [submitting, setSubmitting] = useState11(false);
|
|
3271
|
+
const [submitted, setSubmitted] = useState11(false);
|
|
3272
|
+
const [failed, setFailed] = useState11(false);
|
|
3273
|
+
const popRef = useRef10(null);
|
|
3274
|
+
const textareaRef = useRef10(null);
|
|
3275
|
+
const closeTimer = useRef10(null);
|
|
3276
|
+
const mounted = useRef10(true);
|
|
3277
|
+
useEffect9(() => () => {
|
|
3278
|
+
mounted.current = false;
|
|
3279
|
+
if (closeTimer.current) clearTimeout(closeTimer.current);
|
|
3161
3280
|
}, []);
|
|
3162
3281
|
useEffect9(() => {
|
|
3163
|
-
if (
|
|
3164
|
-
const
|
|
3165
|
-
|
|
3166
|
-
}
|
|
3167
|
-
|
|
3168
|
-
|
|
3169
|
-
|
|
3170
|
-
|
|
3171
|
-
|
|
3172
|
-
|
|
3173
|
-
|
|
3174
|
-
|
|
3175
|
-
|
|
3176
|
-
|
|
3177
|
-
|
|
3178
|
-
|
|
3179
|
-
|
|
3180
|
-
|
|
3181
|
-
|
|
3182
|
-
|
|
3183
|
-
|
|
3184
|
-
|
|
3185
|
-
|
|
3282
|
+
if (!open) return;
|
|
3283
|
+
const handler = (e) => {
|
|
3284
|
+
if (popRef.current && !popRef.current.contains(e.target)) setOpen(false);
|
|
3285
|
+
};
|
|
3286
|
+
document.addEventListener("mousedown", handler);
|
|
3287
|
+
return () => document.removeEventListener("mousedown", handler);
|
|
3288
|
+
}, [open]);
|
|
3289
|
+
useEffect9(() => {
|
|
3290
|
+
if (open) setTimeout(() => textareaRef.current?.focus(), 50);
|
|
3291
|
+
}, [open]);
|
|
3292
|
+
const handleSubmit = async () => {
|
|
3293
|
+
const trimmed = text.trim();
|
|
3294
|
+
if (!trimmed || submitting) return;
|
|
3295
|
+
setFailed(false);
|
|
3296
|
+
setSubmitting(true);
|
|
3297
|
+
try {
|
|
3298
|
+
await submitFeedback(apiUrl, {
|
|
3299
|
+
suggestion_type: "bug_report",
|
|
3300
|
+
suggestion_text: trimmed.slice(0, 1e4),
|
|
3301
|
+
vote: "down",
|
|
3302
|
+
document_id: documentId,
|
|
3303
|
+
publication,
|
|
3304
|
+
user_id: sanityUser?.id,
|
|
3305
|
+
context: {
|
|
3306
|
+
surface: "sanity-plugin",
|
|
3307
|
+
activeTab,
|
|
3308
|
+
primaryKeyword: primaryKeyword || void 0,
|
|
3309
|
+
documentType,
|
|
3310
|
+
url: typeof window !== "undefined" && /^https?:\/\//i.test(window.location.href) ? window.location.href.slice(0, 500) : void 0,
|
|
3311
|
+
userAgent: typeof navigator !== "undefined" ? navigator.userAgent.slice(0, 500) : void 0,
|
|
3312
|
+
timestamp: (/* @__PURE__ */ new Date()).toISOString()
|
|
3313
|
+
}
|
|
3314
|
+
});
|
|
3315
|
+
} catch (e) {
|
|
3316
|
+
console.error("[SEO Copilot] failed to send problem report:", e);
|
|
3317
|
+
if (mounted.current) {
|
|
3318
|
+
setSubmitting(false);
|
|
3319
|
+
setFailed(true);
|
|
3320
|
+
}
|
|
3321
|
+
return;
|
|
3322
|
+
}
|
|
3323
|
+
if (!mounted.current) return;
|
|
3324
|
+
setSubmitting(false);
|
|
3325
|
+
setSubmitted(true);
|
|
3326
|
+
closeTimer.current = setTimeout(() => {
|
|
3327
|
+
if (!mounted.current) return;
|
|
3328
|
+
setOpen(false);
|
|
3329
|
+
setSubmitted(false);
|
|
3330
|
+
setText("");
|
|
3331
|
+
}, 1500);
|
|
3332
|
+
};
|
|
3333
|
+
return /* @__PURE__ */ jsxs8("div", { style: { position: "relative", display: "flex" }, children: [
|
|
3334
|
+
/* @__PURE__ */ jsxs8(
|
|
3335
|
+
"button",
|
|
3336
|
+
{
|
|
3337
|
+
type: "button",
|
|
3338
|
+
onClick: (e) => {
|
|
3339
|
+
e.stopPropagation();
|
|
3340
|
+
if (closeTimer.current) {
|
|
3341
|
+
clearTimeout(closeTimer.current);
|
|
3342
|
+
closeTimer.current = null;
|
|
3343
|
+
}
|
|
3344
|
+
setOpen((o) => !o);
|
|
3345
|
+
},
|
|
3346
|
+
onMouseDown: (e) => e.stopPropagation(),
|
|
3347
|
+
"aria-label": "Report a problem",
|
|
3348
|
+
title: "Report a problem",
|
|
3349
|
+
style: {
|
|
3350
|
+
display: "inline-flex",
|
|
3351
|
+
alignItems: "center",
|
|
3352
|
+
gap: 4,
|
|
3353
|
+
padding: "3px 8px",
|
|
3354
|
+
borderRadius: 99,
|
|
3355
|
+
border: `1px solid ${open ? MJH_BLUE : "#d1d5db"}`,
|
|
3356
|
+
background: open ? "rgba(0,93,172,0.08)" : "rgba(255,255,255,0.6)",
|
|
3357
|
+
cursor: "pointer",
|
|
3358
|
+
fontSize: 10,
|
|
3359
|
+
fontWeight: 600,
|
|
3360
|
+
color: open ? MJH_BLUE : "#6b7280",
|
|
3361
|
+
whiteSpace: "nowrap",
|
|
3362
|
+
transition: "all 150ms"
|
|
3363
|
+
},
|
|
3364
|
+
children: [
|
|
3365
|
+
/* @__PURE__ */ jsx9("svg", { width: "11", height: "11", viewBox: "0 0 20 20", fill: "currentColor", "aria-hidden": "true", children: /* @__PURE__ */ jsx9("path", { d: "M3 2.75a.75.75 0 00-1.5 0v14.5a.75.75 0 001.5 0v-4.392l1.657-.348a6.449 6.449 0 014.271.572 7.948 7.948 0 005.965.524l2.078-.64A.75.75 0 0017.5 12.25v-8.5a.75.75 0 00-.904-.734l-1.74.348a7.948 7.948 0 01-5.965-.524 6.449 6.449 0 00-4.271-.572L3 2.842V2.75z" }) }),
|
|
3366
|
+
"Report a problem"
|
|
3367
|
+
]
|
|
3368
|
+
}
|
|
3369
|
+
),
|
|
3370
|
+
open && /* @__PURE__ */ jsx9(
|
|
3371
|
+
"div",
|
|
3372
|
+
{
|
|
3373
|
+
ref: popRef,
|
|
3374
|
+
onMouseDown: (e) => e.stopPropagation(),
|
|
3375
|
+
style: {
|
|
3376
|
+
position: "absolute",
|
|
3377
|
+
top: "100%",
|
|
3378
|
+
right: 0,
|
|
3379
|
+
marginTop: 6,
|
|
3380
|
+
width: 260,
|
|
3381
|
+
padding: 12,
|
|
3382
|
+
borderRadius: 10,
|
|
3383
|
+
background: "#ffffff",
|
|
3384
|
+
boxShadow: "0 6px 22px rgba(0,0,0,0.16), 0 1px 4px rgba(0,0,0,0.1)",
|
|
3385
|
+
border: "1px solid #e5e7eb",
|
|
3386
|
+
zIndex: 100
|
|
3387
|
+
},
|
|
3388
|
+
children: submitted ? /* @__PURE__ */ jsx9("div", { style: { fontSize: 12, color: "#16a34a", textAlign: "center", padding: "6px 0", fontWeight: 600 }, children: "Thanks - we got it." }) : /* @__PURE__ */ jsxs8(Fragment5, { children: [
|
|
3389
|
+
/* @__PURE__ */ jsx9("div", { style: { fontSize: 12, fontWeight: 700, color: "#1f2937", marginBottom: 3 }, children: "Report a problem" }),
|
|
3390
|
+
/* @__PURE__ */ jsx9("div", { style: { fontSize: 10.5, color: "#6b7280", marginBottom: 8, lineHeight: 1.45 }, children: "Beta - tell us what went wrong. We also note which tab you're on to help us track it down." }),
|
|
3391
|
+
failed && /* @__PURE__ */ jsx9("div", { style: { fontSize: 10.5, color: "#dc2626", marginBottom: 8, lineHeight: 1.45, fontWeight: 600 }, children: "Couldn't send - please try again." }),
|
|
3392
|
+
/* @__PURE__ */ jsx9(
|
|
3393
|
+
"textarea",
|
|
3394
|
+
{
|
|
3395
|
+
ref: textareaRef,
|
|
3396
|
+
value: text,
|
|
3397
|
+
onChange: (e) => setText(e.target.value),
|
|
3398
|
+
onKeyDown: (e) => {
|
|
3399
|
+
if (e.key === "Enter" && (e.metaKey || e.ctrlKey)) {
|
|
3400
|
+
e.preventDefault();
|
|
3401
|
+
handleSubmit();
|
|
3402
|
+
}
|
|
3403
|
+
},
|
|
3404
|
+
placeholder: "What happened? The more detail, the better.",
|
|
3405
|
+
rows: 4,
|
|
3406
|
+
maxLength: 4e3,
|
|
3407
|
+
style: {
|
|
3408
|
+
width: "100%",
|
|
3409
|
+
padding: "6px 8px",
|
|
3410
|
+
fontSize: 11,
|
|
3411
|
+
borderRadius: 6,
|
|
3412
|
+
border: "1px solid #e5e7eb",
|
|
3413
|
+
outline: "none",
|
|
3414
|
+
fontFamily: "inherit",
|
|
3415
|
+
resize: "vertical",
|
|
3416
|
+
boxSizing: "border-box",
|
|
3417
|
+
lineHeight: 1.5
|
|
3418
|
+
}
|
|
3419
|
+
}
|
|
3420
|
+
),
|
|
3421
|
+
/* @__PURE__ */ jsxs8("div", { style: { display: "flex", justifyContent: "flex-end", marginTop: 8, gap: 6 }, children: [
|
|
3422
|
+
/* @__PURE__ */ jsx9(
|
|
3423
|
+
"button",
|
|
3424
|
+
{
|
|
3425
|
+
type: "button",
|
|
3426
|
+
onClick: () => {
|
|
3427
|
+
setOpen(false);
|
|
3428
|
+
setText("");
|
|
3429
|
+
},
|
|
3430
|
+
style: {
|
|
3431
|
+
padding: "4px 10px",
|
|
3432
|
+
fontSize: 10.5,
|
|
3433
|
+
borderRadius: 5,
|
|
3434
|
+
border: "1px solid #e5e7eb",
|
|
3435
|
+
background: "#ffffff",
|
|
3436
|
+
color: "#4b5563",
|
|
3437
|
+
cursor: "pointer"
|
|
3438
|
+
},
|
|
3439
|
+
children: "Cancel"
|
|
3440
|
+
}
|
|
3441
|
+
),
|
|
3442
|
+
/* @__PURE__ */ jsx9(
|
|
3443
|
+
"button",
|
|
3444
|
+
{
|
|
3445
|
+
type: "button",
|
|
3446
|
+
onClick: handleSubmit,
|
|
3447
|
+
disabled: !text.trim() || submitting,
|
|
3448
|
+
style: {
|
|
3449
|
+
padding: "4px 12px",
|
|
3450
|
+
fontSize: 10.5,
|
|
3451
|
+
borderRadius: 5,
|
|
3452
|
+
border: "none",
|
|
3453
|
+
background: !text.trim() || submitting ? "#cbd5e1" : MJH_BLUE,
|
|
3454
|
+
color: "#ffffff",
|
|
3455
|
+
cursor: !text.trim() || submitting ? "default" : "pointer",
|
|
3456
|
+
fontWeight: 700
|
|
3457
|
+
},
|
|
3458
|
+
children: submitting ? "Sending..." : "Send"
|
|
3459
|
+
}
|
|
3460
|
+
)
|
|
3461
|
+
] })
|
|
3462
|
+
] })
|
|
3463
|
+
}
|
|
3464
|
+
)
|
|
3465
|
+
] });
|
|
3466
|
+
}
|
|
3467
|
+
|
|
3468
|
+
// src/components/tabs/SummaryTab.tsx
|
|
3469
|
+
import { useMemo, useState as useState13 } from "react";
|
|
3470
|
+
|
|
3471
|
+
// src/components/ShimmerLoader.tsx
|
|
3472
|
+
import { useEffect as useEffect10, useState as useState12 } from "react";
|
|
3473
|
+
import { jsx as jsx10, jsxs as jsxs9 } from "react/jsx-runtime";
|
|
3474
|
+
var keyframesInjected = false;
|
|
3475
|
+
var KEYFRAMES = `
|
|
3476
|
+
@keyframes seo-copilot-text-shimmer {
|
|
3477
|
+
0% { background-position: -100% center; }
|
|
3478
|
+
100% { background-position: 100% center; }
|
|
3479
|
+
}
|
|
3480
|
+
`;
|
|
3481
|
+
function LoaderBars({ color = MJH_GOLD }) {
|
|
3482
|
+
return /* @__PURE__ */ jsx10(
|
|
3483
|
+
"div",
|
|
3484
|
+
{
|
|
3485
|
+
role: "status",
|
|
3486
|
+
"aria-label": "Loading",
|
|
3487
|
+
style: { display: "inline-flex", alignItems: "flex-end", gap: 2, height: 14, flexShrink: 0 },
|
|
3488
|
+
children: [1, 2, 3].map((i) => /* @__PURE__ */ jsx10(
|
|
3489
|
+
"div",
|
|
3490
|
+
{
|
|
3491
|
+
style: {
|
|
3492
|
+
width: 6,
|
|
3493
|
+
height: 8,
|
|
3494
|
+
borderRadius: 2,
|
|
3495
|
+
background: color,
|
|
3496
|
+
animation: `bar-shift-${i} 1.4s ease-in-out infinite`
|
|
3497
|
+
}
|
|
3498
|
+
},
|
|
3499
|
+
i
|
|
3500
|
+
))
|
|
3501
|
+
}
|
|
3502
|
+
);
|
|
3503
|
+
}
|
|
3504
|
+
function ShimmerLoader({
|
|
3505
|
+
messages,
|
|
3506
|
+
intervalMs = 1500,
|
|
3507
|
+
textSize = 14,
|
|
3508
|
+
iconColor = MJH_GOLD
|
|
3509
|
+
}) {
|
|
3510
|
+
const [idx, setIdx] = useState12(0);
|
|
3511
|
+
useEffect10(() => {
|
|
3512
|
+
if (typeof window !== "undefined" && !keyframesInjected) {
|
|
3513
|
+
keyframesInjected = true;
|
|
3514
|
+
const style = document.createElement("style");
|
|
3515
|
+
style.dataset.seoCopilotKeyframes = "1";
|
|
3516
|
+
style.innerHTML = KEYFRAMES;
|
|
3517
|
+
document.head.appendChild(style);
|
|
3518
|
+
}
|
|
3519
|
+
}, []);
|
|
3520
|
+
useEffect10(() => {
|
|
3521
|
+
if (messages.length <= 1) return;
|
|
3522
|
+
const id = setInterval(() => {
|
|
3523
|
+
setIdx((i) => (i + 1) % messages.length);
|
|
3524
|
+
}, intervalMs);
|
|
3525
|
+
return () => clearInterval(id);
|
|
3526
|
+
}, [messages.length, intervalMs]);
|
|
3527
|
+
const text = messages[idx] || messages[0] || "";
|
|
3528
|
+
return /* @__PURE__ */ jsxs9(
|
|
3529
|
+
"div",
|
|
3530
|
+
{
|
|
3531
|
+
style: {
|
|
3532
|
+
display: "inline-flex",
|
|
3533
|
+
alignItems: "center",
|
|
3534
|
+
gap: 8,
|
|
3535
|
+
fontSize: textSize,
|
|
3536
|
+
fontWeight: 500,
|
|
3537
|
+
letterSpacing: "0.01em"
|
|
3538
|
+
},
|
|
3539
|
+
children: [
|
|
3540
|
+
/* @__PURE__ */ jsx10(LoaderBars, { color: iconColor }),
|
|
3541
|
+
/* @__PURE__ */ jsx10(
|
|
3542
|
+
"span",
|
|
3543
|
+
{
|
|
3186
3544
|
style: {
|
|
3187
3545
|
backgroundImage: "linear-gradient(90deg, rgb(113 113 122) 0%, rgb(113 113 122) 40%, rgb(24 24 27) 50%, rgb(113 113 122) 60%, rgb(113 113 122) 100%)",
|
|
3188
3546
|
backgroundSize: "200% auto",
|
|
@@ -3258,9 +3616,9 @@ function calculateContentScoreDetailed(content, analysis, documentFields) {
|
|
|
3258
3616
|
detail = `Primary keyword over-used at ${density.toFixed(2)}% density - reduce to 0.5-2.5%`;
|
|
3259
3617
|
}
|
|
3260
3618
|
}
|
|
3261
|
-
components.push({ label: "Primary keyword", points: pts, max: 25, detail });
|
|
3619
|
+
components.push({ label: "Primary keyword usage", points: pts, max: 25, detail });
|
|
3262
3620
|
} else {
|
|
3263
|
-
components.push({ label: "Primary keyword", points: 0, max: 25, detail: "No primary keyword identified yet" });
|
|
3621
|
+
components.push({ label: "Primary keyword usage", points: 0, max: 25, detail: "No primary keyword identified yet" });
|
|
3264
3622
|
}
|
|
3265
3623
|
const supportingKws = analysis.supportingKeywords || [];
|
|
3266
3624
|
if (supportingKws.length > 0) {
|
|
@@ -3268,13 +3626,13 @@ function calculateContentScoreDetailed(content, analysis, documentFields) {
|
|
|
3268
3626
|
const coverageRatio = inContentCount / supportingKws.length;
|
|
3269
3627
|
const pts = Math.round(coverageRatio * 25);
|
|
3270
3628
|
components.push({
|
|
3271
|
-
label: "Supporting
|
|
3629
|
+
label: "Supporting keyword coverage",
|
|
3272
3630
|
points: pts,
|
|
3273
3631
|
max: 25,
|
|
3274
3632
|
detail: `${inContentCount} of ${supportingKws.length} supporting keywords present (${Math.round(coverageRatio * 100)}%)`
|
|
3275
3633
|
});
|
|
3276
3634
|
} else {
|
|
3277
|
-
components.push({ label: "Supporting
|
|
3635
|
+
components.push({ label: "Supporting keyword coverage", points: 0, max: 25, detail: "No supporting keywords yet" });
|
|
3278
3636
|
}
|
|
3279
3637
|
let wcPts = 0;
|
|
3280
3638
|
let wcDetail;
|
|
@@ -3453,7 +3811,7 @@ function buildSummaryItems(input) {
|
|
|
3453
3811
|
severity: "warning",
|
|
3454
3812
|
label: "Meta description is short",
|
|
3455
3813
|
description: `Meta description is ${len} characters - below the 120-160 ideal.`,
|
|
3456
|
-
howToFix: "Expand the description to 120-160 characters so
|
|
3814
|
+
howToFix: "Expand the description to 120-160 characters so the full description shows in search.",
|
|
3457
3815
|
jumpTo: { tab: "meta", anchorId: "anchor-meta-description" }
|
|
3458
3816
|
});
|
|
3459
3817
|
} else if (len > 160) {
|
|
@@ -3584,18 +3942,6 @@ function buildSummaryItems(input) {
|
|
|
3584
3942
|
});
|
|
3585
3943
|
}
|
|
3586
3944
|
if (headingsDetailed) {
|
|
3587
|
-
const bodyH1 = headingsDetailed.filter((h) => h.level === 1).length;
|
|
3588
|
-
if (bodyH1 > 0) {
|
|
3589
|
-
items.push({
|
|
3590
|
-
id: "headings-h1-in-body",
|
|
3591
|
-
category: "headings",
|
|
3592
|
-
severity: "warning",
|
|
3593
|
-
label: "H1 inside the body",
|
|
3594
|
-
description: `${bodyH1} H1 heading${bodyH1 === 1 ? "" : "s"} in the body of the article.`,
|
|
3595
|
-
howToFix: "The article title is your H1. Body headings should start at H2 so the outline isn't ambiguous.",
|
|
3596
|
-
jumpTo: { tab: "technical", anchorId: "anchor-headings-structure" }
|
|
3597
|
-
});
|
|
3598
|
-
}
|
|
3599
3945
|
let prevLevel = 0;
|
|
3600
3946
|
let skips = 0;
|
|
3601
3947
|
for (const h of headingsDetailed) {
|
|
@@ -3625,6 +3971,23 @@ function buildSummaryItems(input) {
|
|
|
3625
3971
|
jumpTo: { tab: "technical", anchorId: "anchor-headings-structure" }
|
|
3626
3972
|
});
|
|
3627
3973
|
}
|
|
3974
|
+
const subheads = headingsDetailed.filter((h) => h.level >= 2);
|
|
3975
|
+
if (subheads.length > 0 && (primaryKeyword || secondaryKeyword)) {
|
|
3976
|
+
const subText = subheads.map((h) => h.text).join(" ");
|
|
3977
|
+
const hasP = primaryKeyword ? containsKeywordTokens(subText, primaryKeyword) : false;
|
|
3978
|
+
const hasS = secondaryKeyword ? containsKeywordTokens(subText, secondaryKeyword) : false;
|
|
3979
|
+
if (!hasP && !hasS) {
|
|
3980
|
+
items.push({
|
|
3981
|
+
id: "headings-keyword-missing",
|
|
3982
|
+
category: "headings",
|
|
3983
|
+
severity: "opportunity",
|
|
3984
|
+
label: "Keyword missing from subheadings",
|
|
3985
|
+
description: "No H2/H3 subheading uses your primary or secondary keyword.",
|
|
3986
|
+
howToFix: "Work your primary or secondary keyword into at least one subheading - keywords in headers reinforce relevance for readers and search.",
|
|
3987
|
+
jumpTo: { tab: "technical", anchorId: "anchor-headings-keyword" }
|
|
3988
|
+
});
|
|
3989
|
+
}
|
|
3990
|
+
}
|
|
3628
3991
|
}
|
|
3629
3992
|
const images = documentFields?.imageNames || [];
|
|
3630
3993
|
if (images.length === 0 && wordCount2 > 300) {
|
|
@@ -3877,7 +4240,7 @@ function buildSummaryItems(input) {
|
|
|
3877
4240
|
}
|
|
3878
4241
|
|
|
3879
4242
|
// src/components/tabs/SummaryTab.tsx
|
|
3880
|
-
import { Fragment as
|
|
4243
|
+
import { Fragment as Fragment6, jsx as jsx11, jsxs as jsxs10 } from "react/jsx-runtime";
|
|
3881
4244
|
var cardStyle2 = {
|
|
3882
4245
|
borderRadius: 14,
|
|
3883
4246
|
background: "rgba(255,255,255,0.55)",
|
|
@@ -3899,11 +4262,16 @@ function scoreColors(score) {
|
|
|
3899
4262
|
if (score >= 40) return { bg: "rgba(230,192,27,0.15)", text: "#8B7310", label: "Decent" };
|
|
3900
4263
|
return { bg: "rgba(220,38,38,0.08)", text: "#dc2626", label: "Needs work" };
|
|
3901
4264
|
}
|
|
4265
|
+
function componentTier(pct) {
|
|
4266
|
+
if (pct >= 75) return { label: "Strong", color: "#16a34a", bar: "#16a34a" };
|
|
4267
|
+
if (pct >= 40) return { label: "OK", color: "#8B7310", bar: "#E6C01B" };
|
|
4268
|
+
return { label: "Low", color: "#dc2626", bar: "#dc2626" };
|
|
4269
|
+
}
|
|
3902
4270
|
function ScoreBadge({ score, breakdown }) {
|
|
3903
4271
|
const c = scoreColors(score);
|
|
3904
|
-
return /* @__PURE__ */
|
|
3905
|
-
/* @__PURE__ */
|
|
3906
|
-
/* @__PURE__ */
|
|
4272
|
+
return /* @__PURE__ */ jsxs10("div", { style: cardStyle2, children: [
|
|
4273
|
+
/* @__PURE__ */ jsxs10("div", { style: { display: "flex", alignItems: "center", gap: 14 }, children: [
|
|
4274
|
+
/* @__PURE__ */ jsx11(
|
|
3907
4275
|
"div",
|
|
3908
4276
|
{
|
|
3909
4277
|
style: {
|
|
@@ -3912,37 +4280,28 @@ function ScoreBadge({ score, breakdown }) {
|
|
|
3912
4280
|
borderRadius: "50%",
|
|
3913
4281
|
background: c.bg,
|
|
3914
4282
|
display: "flex",
|
|
3915
|
-
flexDirection: "column",
|
|
3916
4283
|
alignItems: "center",
|
|
3917
4284
|
justifyContent: "center",
|
|
3918
|
-
flexShrink: 0
|
|
3919
|
-
lineHeight: 1
|
|
4285
|
+
flexShrink: 0
|
|
3920
4286
|
},
|
|
3921
|
-
children:
|
|
3922
|
-
/* @__PURE__ */ jsx10("span", { style: { fontSize: 20, fontWeight: 700, color: c.text }, children: score }),
|
|
3923
|
-
/* @__PURE__ */ jsx10("span", { style: { fontSize: 8, fontWeight: 700, color: c.text, opacity: 0.7, letterSpacing: "0.06em", marginTop: 2 }, children: "/ 100" })
|
|
3924
|
-
]
|
|
4287
|
+
children: /* @__PURE__ */ jsx11("div", { style: { width: 22, height: 22, borderRadius: "50%", background: c.text, opacity: 0.9 } })
|
|
3925
4288
|
}
|
|
3926
4289
|
),
|
|
3927
|
-
/* @__PURE__ */
|
|
3928
|
-
/* @__PURE__ */
|
|
3929
|
-
/* @__PURE__ */
|
|
4290
|
+
/* @__PURE__ */ jsxs10("div", { style: { flex: 1, minWidth: 0 }, children: [
|
|
4291
|
+
/* @__PURE__ */ jsx11("div", { style: { fontSize: 10.5, textTransform: "uppercase", letterSpacing: "0.06em", color: "#4b5563", fontWeight: 600, marginBottom: 2 }, children: "Content Score" }),
|
|
4292
|
+
/* @__PURE__ */ jsx11("div", { style: { fontSize: 16, fontWeight: 700, color: c.text }, children: c.label })
|
|
3930
4293
|
] })
|
|
3931
4294
|
] }),
|
|
3932
|
-
breakdown.length > 0 && /* @__PURE__ */
|
|
4295
|
+
breakdown.length > 0 && /* @__PURE__ */ jsx11("div", { style: { marginTop: 12, display: "flex", flexDirection: "column", gap: 8 }, children: breakdown.map((comp, i) => {
|
|
3933
4296
|
const pct = comp.max > 0 ? comp.points / comp.max * 100 : 0;
|
|
3934
|
-
const
|
|
3935
|
-
return /* @__PURE__ */
|
|
3936
|
-
/* @__PURE__ */
|
|
3937
|
-
/* @__PURE__ */
|
|
3938
|
-
/* @__PURE__ */
|
|
3939
|
-
comp.points,
|
|
3940
|
-
" / ",
|
|
3941
|
-
comp.max
|
|
3942
|
-
] })
|
|
4297
|
+
const tier = componentTier(pct);
|
|
4298
|
+
return /* @__PURE__ */ jsxs10("div", { children: [
|
|
4299
|
+
/* @__PURE__ */ jsxs10("div", { style: { display: "flex", justifyContent: "space-between", alignItems: "baseline", marginBottom: 3 }, children: [
|
|
4300
|
+
/* @__PURE__ */ jsx11("span", { style: { fontSize: 11, fontWeight: 600, color: "#1f2937" }, children: comp.label }),
|
|
4301
|
+
/* @__PURE__ */ jsx11("span", { style: { fontSize: 9.5, fontWeight: 700, textTransform: "uppercase", letterSpacing: "0.04em", color: tier.color }, children: tier.label })
|
|
3943
4302
|
] }),
|
|
3944
|
-
/* @__PURE__ */
|
|
3945
|
-
/* @__PURE__ */
|
|
4303
|
+
/* @__PURE__ */ jsx11("div", { style: { height: 4, background: "#f1f5f9", borderRadius: 99, overflow: "hidden", marginBottom: 4 }, children: /* @__PURE__ */ jsx11("div", { style: { width: `${pct}%`, height: "100%", background: tier.bar, transition: "width 200ms" } }) }),
|
|
4304
|
+
/* @__PURE__ */ jsx11("div", { style: { fontSize: 10.5, color: "#4b5563", lineHeight: 1.4 }, children: comp.detail })
|
|
3946
4305
|
] }, i);
|
|
3947
4306
|
}) })
|
|
3948
4307
|
] });
|
|
@@ -3956,7 +4315,7 @@ function ItemCard({ item, onClick }) {
|
|
|
3956
4315
|
const v = severityVisual(item.severity);
|
|
3957
4316
|
const tab = item.jumpTo.tab;
|
|
3958
4317
|
const tabLabel = TAB_LABEL[tab] ?? tab.charAt(0).toUpperCase() + tab.slice(1);
|
|
3959
|
-
return /* @__PURE__ */
|
|
4318
|
+
return /* @__PURE__ */ jsxs10(
|
|
3960
4319
|
"div",
|
|
3961
4320
|
{
|
|
3962
4321
|
onClick,
|
|
@@ -3973,8 +4332,8 @@ function ItemCard({ item, onClick }) {
|
|
|
3973
4332
|
cursor: "pointer"
|
|
3974
4333
|
},
|
|
3975
4334
|
children: [
|
|
3976
|
-
/* @__PURE__ */
|
|
3977
|
-
/* @__PURE__ */
|
|
4335
|
+
/* @__PURE__ */ jsxs10("div", { style: { display: "flex", alignItems: "flex-start", gap: 9 }, children: [
|
|
4336
|
+
/* @__PURE__ */ jsx11(
|
|
3978
4337
|
"div",
|
|
3979
4338
|
{
|
|
3980
4339
|
style: {
|
|
@@ -3987,12 +4346,12 @@ function ItemCard({ item, onClick }) {
|
|
|
3987
4346
|
}
|
|
3988
4347
|
}
|
|
3989
4348
|
),
|
|
3990
|
-
/* @__PURE__ */
|
|
3991
|
-
/* @__PURE__ */
|
|
3992
|
-
/* @__PURE__ */
|
|
4349
|
+
/* @__PURE__ */ jsxs10("div", { style: { flex: 1, minWidth: 0 }, children: [
|
|
4350
|
+
/* @__PURE__ */ jsx11("div", { style: { fontSize: 12, fontWeight: 700, color: "#1f2937", marginBottom: 2 }, children: item.label }),
|
|
4351
|
+
/* @__PURE__ */ jsx11("div", { style: { fontSize: 11, color: "#374151", lineHeight: 1.5 }, children: item.description })
|
|
3993
4352
|
] })
|
|
3994
4353
|
] }),
|
|
3995
|
-
/* @__PURE__ */
|
|
4354
|
+
/* @__PURE__ */ jsxs10(
|
|
3996
4355
|
"div",
|
|
3997
4356
|
{
|
|
3998
4357
|
style: {
|
|
@@ -4004,12 +4363,12 @@ function ItemCard({ item, onClick }) {
|
|
|
4004
4363
|
lineHeight: 1.55
|
|
4005
4364
|
},
|
|
4006
4365
|
children: [
|
|
4007
|
-
/* @__PURE__ */
|
|
4366
|
+
/* @__PURE__ */ jsx11("span", { style: { fontWeight: 700, color: "#4b5563", letterSpacing: "0.04em", fontSize: 9.5, textTransform: "uppercase", marginRight: 6 }, children: "Fix" }),
|
|
4008
4367
|
item.howToFix
|
|
4009
4368
|
]
|
|
4010
4369
|
}
|
|
4011
4370
|
),
|
|
4012
|
-
item.jumpTo.tab !== "summary" && /* @__PURE__ */
|
|
4371
|
+
item.jumpTo.tab !== "summary" && /* @__PURE__ */ jsx11("div", { style: { display: "flex", justifyContent: "flex-end" }, children: /* @__PURE__ */ jsxs10("span", { style: { fontSize: 10, fontWeight: 700, color: MJH_BLUE }, children: [
|
|
4013
4372
|
"Go to ",
|
|
4014
4373
|
tabLabel,
|
|
4015
4374
|
" \u203A"
|
|
@@ -4025,7 +4384,7 @@ function FilterChip({
|
|
|
4025
4384
|
count,
|
|
4026
4385
|
dotColor
|
|
4027
4386
|
}) {
|
|
4028
|
-
return /* @__PURE__ */
|
|
4387
|
+
return /* @__PURE__ */ jsxs10(
|
|
4029
4388
|
"button",
|
|
4030
4389
|
{
|
|
4031
4390
|
onClick,
|
|
@@ -4044,9 +4403,9 @@ function FilterChip({
|
|
|
4044
4403
|
transition: "all 150ms"
|
|
4045
4404
|
},
|
|
4046
4405
|
children: [
|
|
4047
|
-
dotColor && /* @__PURE__ */
|
|
4048
|
-
/* @__PURE__ */
|
|
4049
|
-
/* @__PURE__ */
|
|
4406
|
+
dotColor && /* @__PURE__ */ jsx11("span", { style: { width: 6, height: 6, borderRadius: "50%", background: dotColor, display: "inline-block" } }),
|
|
4407
|
+
/* @__PURE__ */ jsx11("span", { children: label }),
|
|
4408
|
+
/* @__PURE__ */ jsx11("span", { style: { fontSize: 10, opacity: 0.8 }, children: count })
|
|
4050
4409
|
]
|
|
4051
4410
|
}
|
|
4052
4411
|
);
|
|
@@ -4084,7 +4443,7 @@ function SummaryTab({
|
|
|
4084
4443
|
}),
|
|
4085
4444
|
[analysis, deepAnalysis, documentFields, score, linkingSuggestions, linkCheckResults, text, primaryKeyword, secondaryKeyword]
|
|
4086
4445
|
);
|
|
4087
|
-
const [filter, setFilter] =
|
|
4446
|
+
const [filter, setFilter] = useState13("all");
|
|
4088
4447
|
const counts = useMemo(
|
|
4089
4448
|
() => ({
|
|
4090
4449
|
all: items.length,
|
|
@@ -4096,15 +4455,15 @@ function SummaryTab({
|
|
|
4096
4455
|
);
|
|
4097
4456
|
const filtered = filter === "all" ? items : items.filter((i) => i.severity === filter);
|
|
4098
4457
|
if (!analysis) {
|
|
4099
|
-
return /* @__PURE__ */
|
|
4100
|
-
/* @__PURE__ */
|
|
4101
|
-
/* @__PURE__ */
|
|
4458
|
+
return /* @__PURE__ */ jsxs10("div", { style: { padding: 24, textAlign: "center" }, children: [
|
|
4459
|
+
/* @__PURE__ */ jsx11("div", { style: { fontSize: 13, color: "#4b5563", fontWeight: 500 }, children: "Start with the Keywords tab" }),
|
|
4460
|
+
/* @__PURE__ */ jsx11("div", { style: { fontSize: 11, color: "#4b5563", marginTop: 4 }, children: "Once keywords are analyzed, the summary appears here." })
|
|
4102
4461
|
] });
|
|
4103
4462
|
}
|
|
4104
|
-
return /* @__PURE__ */
|
|
4105
|
-
score != null && scoreDetail && /* @__PURE__ */
|
|
4106
|
-
/* @__PURE__ */
|
|
4107
|
-
isAnyLoading ? /* @__PURE__ */
|
|
4463
|
+
return /* @__PURE__ */ jsxs10("div", { style: { padding: 12, display: "flex", flexDirection: "column", gap: 12 }, children: [
|
|
4464
|
+
score != null && scoreDetail && /* @__PURE__ */ jsx11(ScoreBadge, { score, breakdown: scoreDetail.components }),
|
|
4465
|
+
/* @__PURE__ */ jsxs10("div", { style: cardStyle2, children: [
|
|
4466
|
+
isAnyLoading ? /* @__PURE__ */ jsx11("div", { style: { display: "flex", alignItems: "center", justifyContent: "center", padding: "4px 0" }, children: /* @__PURE__ */ jsx11(ShimmerLoader, { messages: DEFAULT_GENERATE_ALL_MESSAGES }) }) : /* @__PURE__ */ jsx11(
|
|
4108
4467
|
"button",
|
|
4109
4468
|
{
|
|
4110
4469
|
onClick: onGenerateAll,
|
|
@@ -4132,24 +4491,24 @@ function SummaryTab({
|
|
|
4132
4491
|
children: "Run all analyses"
|
|
4133
4492
|
}
|
|
4134
4493
|
),
|
|
4135
|
-
/* @__PURE__ */
|
|
4494
|
+
/* @__PURE__ */ jsxs10("div", { style: { fontSize: 10.5, color: "#4b5563", marginTop: 8, lineHeight: 1.5 }, children: [
|
|
4136
4495
|
"Runs the analyses that fill the ",
|
|
4137
|
-
/* @__PURE__ */
|
|
4496
|
+
/* @__PURE__ */ jsx11("strong", { children: "AEO/GEO" }),
|
|
4138
4497
|
", ",
|
|
4139
|
-
/* @__PURE__ */
|
|
4498
|
+
/* @__PURE__ */ jsx11("strong", { children: "Linking" }),
|
|
4140
4499
|
", and ",
|
|
4141
|
-
/* @__PURE__ */
|
|
4500
|
+
/* @__PURE__ */ jsx11("strong", { children: "Other Recs" }),
|
|
4142
4501
|
" tabs. New issues they find appear in this Summary as each one finishes."
|
|
4143
4502
|
] })
|
|
4144
4503
|
] }),
|
|
4145
|
-
/* @__PURE__ */
|
|
4146
|
-
/* @__PURE__ */
|
|
4147
|
-
/* @__PURE__ */
|
|
4148
|
-
/* @__PURE__ */
|
|
4149
|
-
/* @__PURE__ */
|
|
4504
|
+
/* @__PURE__ */ jsxs10("div", { style: { display: "flex", flexWrap: "wrap", gap: 6 }, children: [
|
|
4505
|
+
/* @__PURE__ */ jsx11(FilterChip, { active: filter === "all", onClick: () => setFilter("all"), label: "All", count: counts.all }),
|
|
4506
|
+
/* @__PURE__ */ jsx11(FilterChip, { active: filter === "error", onClick: () => setFilter("error"), label: "Errors", count: counts.error, dotColor: "#dc2626" }),
|
|
4507
|
+
/* @__PURE__ */ jsx11(FilterChip, { active: filter === "warning", onClick: () => setFilter("warning"), label: "Warnings", count: counts.warning, dotColor: "#E6C01B" }),
|
|
4508
|
+
/* @__PURE__ */ jsx11(FilterChip, { active: filter === "opportunity", onClick: () => setFilter("opportunity"), label: "Opportunities", count: counts.opportunity, dotColor: MJH_BLUE })
|
|
4150
4509
|
] }),
|
|
4151
|
-
/* @__PURE__ */
|
|
4152
|
-
/* @__PURE__ */
|
|
4510
|
+
/* @__PURE__ */ jsx11("div", { id: "anchor-summary-issues", style: { display: "flex", flexDirection: "column", gap: 8 }, children: filtered.length === 0 ? /* @__PURE__ */ jsx11("div", { style: { ...cardStyle2, textAlign: "center", padding: "20px 14px" }, children: items.length === 0 ? /* @__PURE__ */ jsxs10(Fragment6, { children: [
|
|
4511
|
+
/* @__PURE__ */ jsx11(
|
|
4153
4512
|
"div",
|
|
4154
4513
|
{
|
|
4155
4514
|
style: {
|
|
@@ -4162,21 +4521,21 @@ function SummaryTab({
|
|
|
4162
4521
|
justifyContent: "center",
|
|
4163
4522
|
margin: "0 auto 8px"
|
|
4164
4523
|
},
|
|
4165
|
-
children: /* @__PURE__ */
|
|
4524
|
+
children: /* @__PURE__ */ jsx11("svg", { width: "20", height: "20", viewBox: "0 0 20 20", fill: "#16a34a", 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" }) })
|
|
4166
4525
|
}
|
|
4167
4526
|
),
|
|
4168
|
-
/* @__PURE__ */
|
|
4169
|
-
/* @__PURE__ */
|
|
4170
|
-
] }) : /* @__PURE__ */
|
|
4171
|
-
isAnyLoading && items.length > 0 && /* @__PURE__ */
|
|
4172
|
-
/* @__PURE__ */
|
|
4173
|
-
/* @__PURE__ */
|
|
4527
|
+
/* @__PURE__ */ jsx11("div", { style: { fontSize: 13, color: "#16a34a", fontWeight: 700 }, children: "Looking good" }),
|
|
4528
|
+
/* @__PURE__ */ jsx11("div", { style: { fontSize: 11, color: "#4b5563", marginTop: 2 }, children: "No issues found for this article." })
|
|
4529
|
+
] }) : /* @__PURE__ */ jsx11("div", { style: { fontSize: 12, color: "#4b5563" }, children: "Nothing in this category." }) }) : filtered.map((item) => /* @__PURE__ */ jsx11(ItemCard, { item, onClick: () => onItemClick(item) }, item.id)) }),
|
|
4530
|
+
isAnyLoading && items.length > 0 && /* @__PURE__ */ jsxs10("div", { style: { display: "flex", alignItems: "center", justifyContent: "center", gap: 6, padding: "4px 0" }, children: [
|
|
4531
|
+
/* @__PURE__ */ jsx11(LoadingBars, { size: "xs", color: MJH_BLUE }),
|
|
4532
|
+
/* @__PURE__ */ jsx11("span", { style: { fontSize: 10, color: "#4b5563" }, children: "Still checking..." })
|
|
4174
4533
|
] })
|
|
4175
4534
|
] });
|
|
4176
4535
|
}
|
|
4177
4536
|
|
|
4178
4537
|
// src/components/tabs/AEOTab.tsx
|
|
4179
|
-
import { useEffect as
|
|
4538
|
+
import { useEffect as useEffect11, useMemo as useMemo2, useRef as useRef11, useState as useState14 } from "react";
|
|
4180
4539
|
|
|
4181
4540
|
// src/lib/geoAnalysis.ts
|
|
4182
4541
|
var FACT_PATTERN = /\d+(?:\.\d+)?\s*%|\b\d{1,3}(?:,\d{3})+\b|\bn\s*=\s*\d+\b|\bp\s*[<=]\s*0?\.\d+\b|\b\d+(?:\.\d+)?\s*(?:patients|participants|subjects|cases|deaths|adverse events|mg|mcg|hours|days|weeks|months|years|fold|x)\b|\b(?:NEJM|JAMA|FDA|EMA|CDC|WHO|NIH|ACC|ASCO|ASH|ESMO|AHA|ACS)\b|\bet al\.?\b|\b(?:phase|stage)\s+(?:I{1,3}V?|1|2|3|4)\b/i;
|
|
@@ -4250,7 +4609,7 @@ function analyzeGEO(text, headings) {
|
|
|
4250
4609
|
}
|
|
4251
4610
|
|
|
4252
4611
|
// src/components/tabs/AEOTab.tsx
|
|
4253
|
-
import { jsx as
|
|
4612
|
+
import { jsx as jsx12, jsxs as jsxs11 } from "react/jsx-runtime";
|
|
4254
4613
|
var AEO_PURPLE = "#005DAC";
|
|
4255
4614
|
var GEO_TEAL = "#C9A716";
|
|
4256
4615
|
var cardStyle3 = {
|
|
@@ -4262,7 +4621,7 @@ var cardStyle3 = {
|
|
|
4262
4621
|
padding: "14px"
|
|
4263
4622
|
};
|
|
4264
4623
|
function AiPill() {
|
|
4265
|
-
return /* @__PURE__ */
|
|
4624
|
+
return /* @__PURE__ */ jsx12(
|
|
4266
4625
|
"span",
|
|
4267
4626
|
{
|
|
4268
4627
|
style: {
|
|
@@ -4281,16 +4640,16 @@ function AiPill() {
|
|
|
4281
4640
|
);
|
|
4282
4641
|
}
|
|
4283
4642
|
function SectionHeader2({ label, iconColor, ai }) {
|
|
4284
|
-
return /* @__PURE__ */
|
|
4285
|
-
/* @__PURE__ */
|
|
4286
|
-
/* @__PURE__ */
|
|
4287
|
-
ai && /* @__PURE__ */
|
|
4643
|
+
return /* @__PURE__ */ jsxs11("div", { style: { display: "flex", alignItems: "center", gap: 7, marginBottom: 4 }, children: [
|
|
4644
|
+
/* @__PURE__ */ jsx12("div", { style: { width: 7, height: 7, borderRadius: "50%", background: iconColor, flexShrink: 0 } }),
|
|
4645
|
+
/* @__PURE__ */ jsx12("span", { style: { fontSize: 10.5, textTransform: "uppercase", letterSpacing: "0.06em", color: "#4b5563", fontWeight: 600, flex: 1 }, children: label }),
|
|
4646
|
+
ai && /* @__PURE__ */ jsx12(AiPill, {})
|
|
4288
4647
|
] });
|
|
4289
4648
|
}
|
|
4290
4649
|
function CopyButton({ text }) {
|
|
4291
|
-
const [copied, setCopied] =
|
|
4292
|
-
const copyTimerRef =
|
|
4293
|
-
|
|
4650
|
+
const [copied, setCopied] = useState14(false);
|
|
4651
|
+
const copyTimerRef = useRef11(null);
|
|
4652
|
+
useEffect11(() => {
|
|
4294
4653
|
return () => {
|
|
4295
4654
|
if (copyTimerRef.current) clearTimeout(copyTimerRef.current);
|
|
4296
4655
|
};
|
|
@@ -4303,7 +4662,7 @@ function CopyButton({ text }) {
|
|
|
4303
4662
|
} catch {
|
|
4304
4663
|
}
|
|
4305
4664
|
};
|
|
4306
|
-
return /* @__PURE__ */
|
|
4665
|
+
return /* @__PURE__ */ jsx12(
|
|
4307
4666
|
"button",
|
|
4308
4667
|
{
|
|
4309
4668
|
onClick: handleCopy,
|
|
@@ -4322,9 +4681,9 @@ function CopyButton({ text }) {
|
|
|
4322
4681
|
transition: "color 150ms"
|
|
4323
4682
|
},
|
|
4324
4683
|
title: copied ? "Copied!" : "Copy to clipboard",
|
|
4325
|
-
children: copied ? /* @__PURE__ */
|
|
4326
|
-
/* @__PURE__ */
|
|
4327
|
-
/* @__PURE__ */
|
|
4684
|
+
children: copied ? /* @__PURE__ */ jsx12("svg", { width: "11", height: "11", viewBox: "0 0 20 20", fill: "currentColor", children: /* @__PURE__ */ jsx12("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__ */ jsxs11("svg", { width: "11", height: "11", viewBox: "0 0 20 20", fill: "currentColor", children: [
|
|
4685
|
+
/* @__PURE__ */ jsx12("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" }),
|
|
4686
|
+
/* @__PURE__ */ jsx12("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" })
|
|
4328
4687
|
] })
|
|
4329
4688
|
}
|
|
4330
4689
|
);
|
|
@@ -4339,13 +4698,13 @@ function GEOCard({ geo, publication }) {
|
|
|
4339
4698
|
const fdBg = effectiveStatus === "strong" ? "rgba(22,163,74,0.1)" : effectiveStatus === "moderate" ? "rgba(230,192,27,0.15)" : "rgba(220,38,38,0.08)";
|
|
4340
4699
|
const goodCount = geo.headingAudit.filter((h) => h.status === "good").length;
|
|
4341
4700
|
const totalHeadings = geo.headingAudit.length;
|
|
4342
|
-
return /* @__PURE__ */
|
|
4343
|
-
/* @__PURE__ */
|
|
4344
|
-
/* @__PURE__ */
|
|
4345
|
-
/* @__PURE__ */
|
|
4701
|
+
return /* @__PURE__ */ jsxs11("div", { style: cardStyle3, children: [
|
|
4702
|
+
/* @__PURE__ */ jsxs11("div", { style: { display: "flex", alignItems: "center", justifyContent: "space-between", marginBottom: 4 }, children: [
|
|
4703
|
+
/* @__PURE__ */ jsx12(SectionHeader2, { label: "AI Citation Readiness", iconColor: GEO_TEAL }),
|
|
4704
|
+
/* @__PURE__ */ jsx12(FeedbackButton, { suggestionType: "geo_summary", suggestionText: `facts/1k: ${fd.factsPerThousandWords}; short-answer headings: ${goodCount}/${totalHeadings}`, publication })
|
|
4346
4705
|
] }),
|
|
4347
|
-
/* @__PURE__ */
|
|
4348
|
-
/* @__PURE__ */
|
|
4706
|
+
/* @__PURE__ */ jsx12("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." }),
|
|
4707
|
+
/* @__PURE__ */ jsxs11(
|
|
4349
4708
|
"div",
|
|
4350
4709
|
{
|
|
4351
4710
|
style: {
|
|
@@ -4358,7 +4717,7 @@ function GEOCard({ geo, publication }) {
|
|
|
4358
4717
|
marginBottom: 8
|
|
4359
4718
|
},
|
|
4360
4719
|
children: [
|
|
4361
|
-
/* @__PURE__ */
|
|
4720
|
+
/* @__PURE__ */ jsxs11(
|
|
4362
4721
|
"div",
|
|
4363
4722
|
{
|
|
4364
4723
|
style: {
|
|
@@ -4374,17 +4733,17 @@ function GEOCard({ geo, publication }) {
|
|
|
4374
4733
|
boxShadow: "0 1px 2px rgba(0,0,0,0.06)"
|
|
4375
4734
|
},
|
|
4376
4735
|
children: [
|
|
4377
|
-
/* @__PURE__ */
|
|
4378
|
-
/* @__PURE__ */
|
|
4736
|
+
/* @__PURE__ */ jsx12("span", { style: { fontSize: 18, fontWeight: 700, color: fdColor, lineHeight: 1 }, children: fd.factsPerThousandWords }),
|
|
4737
|
+
/* @__PURE__ */ jsx12("span", { style: { fontSize: 7.5, fontWeight: 700, color: fdColor, opacity: 0.75, letterSpacing: "0.05em", marginTop: 2 }, children: "PER 1K" })
|
|
4379
4738
|
]
|
|
4380
4739
|
}
|
|
4381
4740
|
),
|
|
4382
|
-
/* @__PURE__ */
|
|
4383
|
-
/* @__PURE__ */
|
|
4741
|
+
/* @__PURE__ */ jsxs11("div", { style: { flex: 1, minWidth: 0 }, children: [
|
|
4742
|
+
/* @__PURE__ */ jsxs11("div", { style: { fontSize: 11, fontWeight: 700, color: fdColor, marginBottom: 2 }, children: [
|
|
4384
4743
|
"Fact density: ",
|
|
4385
4744
|
fdLabel
|
|
4386
4745
|
] }),
|
|
4387
|
-
/* @__PURE__ */
|
|
4746
|
+
/* @__PURE__ */ jsxs11("div", { style: { fontSize: 11, color: "#1f2937", lineHeight: 1.45 }, children: [
|
|
4388
4747
|
fd.factCount,
|
|
4389
4748
|
" specific stat",
|
|
4390
4749
|
fd.factCount === 1 ? "" : "s",
|
|
@@ -4400,7 +4759,7 @@ function GEOCard({ geo, publication }) {
|
|
|
4400
4759
|
]
|
|
4401
4760
|
}
|
|
4402
4761
|
),
|
|
4403
|
-
fd.driftPassages > 0 && /* @__PURE__ */
|
|
4762
|
+
fd.driftPassages > 0 && /* @__PURE__ */ jsxs11(
|
|
4404
4763
|
"div",
|
|
4405
4764
|
{
|
|
4406
4765
|
style: {
|
|
@@ -4414,15 +4773,15 @@ function GEOCard({ geo, publication }) {
|
|
|
4414
4773
|
lineHeight: 1.45
|
|
4415
4774
|
},
|
|
4416
4775
|
children: [
|
|
4417
|
-
/* @__PURE__ */
|
|
4776
|
+
/* @__PURE__ */ jsx12("strong", { children: fd.driftPassages }),
|
|
4418
4777
|
" passage",
|
|
4419
4778
|
fd.driftPassages === 1 ? "" : "s",
|
|
4420
4779
|
" over 200 words with no specific stats or citations. AI engines tend to skip these."
|
|
4421
4780
|
]
|
|
4422
4781
|
}
|
|
4423
4782
|
),
|
|
4424
|
-
totalHeadings > 0 && /* @__PURE__ */
|
|
4425
|
-
/* @__PURE__ */
|
|
4783
|
+
totalHeadings > 0 && /* @__PURE__ */ jsxs11("div", { style: { marginTop: 4 }, children: [
|
|
4784
|
+
/* @__PURE__ */ jsxs11(
|
|
4426
4785
|
"button",
|
|
4427
4786
|
{
|
|
4428
4787
|
onClick: () => setShowDetails((v) => !v),
|
|
@@ -4441,22 +4800,22 @@ function GEOCard({ geo, publication }) {
|
|
|
4441
4800
|
color: GEO_TEAL
|
|
4442
4801
|
},
|
|
4443
4802
|
children: [
|
|
4444
|
-
/* @__PURE__ */
|
|
4803
|
+
/* @__PURE__ */ jsxs11("span", { children: [
|
|
4445
4804
|
"Short-answer paragraphs: ",
|
|
4446
4805
|
goodCount,
|
|
4447
4806
|
"/",
|
|
4448
4807
|
totalHeadings,
|
|
4449
4808
|
" headings have one"
|
|
4450
4809
|
] }),
|
|
4451
|
-
/* @__PURE__ */
|
|
4810
|
+
/* @__PURE__ */ jsx12("svg", { width: "11", height: "11", viewBox: "0 0 20 20", fill: "currentColor", style: { transform: showDetails ? "rotate(180deg)" : "none", transition: "transform 150ms" }, children: /* @__PURE__ */ jsx12("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" }) })
|
|
4452
4811
|
]
|
|
4453
4812
|
}
|
|
4454
4813
|
),
|
|
4455
|
-
showDetails && /* @__PURE__ */
|
|
4456
|
-
/* @__PURE__ */
|
|
4814
|
+
showDetails && /* @__PURE__ */ jsxs11("div", { style: { marginTop: 6, display: "flex", flexDirection: "column", gap: 4 }, children: [
|
|
4815
|
+
/* @__PURE__ */ jsx12("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." }),
|
|
4457
4816
|
geo.headingAudit.map((h, i) => {
|
|
4458
4817
|
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" };
|
|
4459
|
-
return /* @__PURE__ */
|
|
4818
|
+
return /* @__PURE__ */ jsxs11(
|
|
4460
4819
|
"div",
|
|
4461
4820
|
{
|
|
4462
4821
|
style: {
|
|
@@ -4470,8 +4829,8 @@ function GEOCard({ geo, publication }) {
|
|
|
4470
4829
|
gap: 8
|
|
4471
4830
|
},
|
|
4472
4831
|
children: [
|
|
4473
|
-
/* @__PURE__ */
|
|
4474
|
-
/* @__PURE__ */
|
|
4832
|
+
/* @__PURE__ */ jsx12("span", { style: { flex: 1, minWidth: 0, color: "#1f2937", overflow: "hidden", textOverflow: "ellipsis", whiteSpace: "nowrap" }, children: h.heading }),
|
|
4833
|
+
/* @__PURE__ */ jsx12("span", { style: { fontSize: 10, fontWeight: 600, color: c.color, flexShrink: 0 }, children: c.label })
|
|
4475
4834
|
]
|
|
4476
4835
|
},
|
|
4477
4836
|
i
|
|
@@ -4508,11 +4867,19 @@ function AEOTab({
|
|
|
4508
4867
|
originalHeading: void 0,
|
|
4509
4868
|
rationale: h.rationale
|
|
4510
4869
|
})) ?? [];
|
|
4511
|
-
return /* @__PURE__ */
|
|
4512
|
-
aeoContentChanged && /* @__PURE__ */
|
|
4870
|
+
return /* @__PURE__ */ jsxs11("div", { style: { padding: 12, display: "flex", flexDirection: "column", gap: 12 }, children: [
|
|
4871
|
+
aeoContentChanged && /* @__PURE__ */ jsxs11(
|
|
4513
4872
|
"div",
|
|
4514
4873
|
{
|
|
4515
4874
|
onClick: runDeepAnalysis,
|
|
4875
|
+
role: "button",
|
|
4876
|
+
tabIndex: 0,
|
|
4877
|
+
onKeyDown: (e) => {
|
|
4878
|
+
if (e.key === "Enter" || e.key === " ") {
|
|
4879
|
+
e.preventDefault();
|
|
4880
|
+
runDeepAnalysis();
|
|
4881
|
+
}
|
|
4882
|
+
},
|
|
4516
4883
|
style: {
|
|
4517
4884
|
padding: "8px 12px",
|
|
4518
4885
|
background: "#fffbeb",
|
|
@@ -4524,30 +4891,30 @@ function AEOTab({
|
|
|
4524
4891
|
cursor: "pointer"
|
|
4525
4892
|
},
|
|
4526
4893
|
children: [
|
|
4527
|
-
/* @__PURE__ */
|
|
4528
|
-
/* @__PURE__ */
|
|
4894
|
+
/* @__PURE__ */ jsx12("span", { style: { fontSize: 11, color: "#92400e" }, children: "Content has changed since this was generated." }),
|
|
4895
|
+
/* @__PURE__ */ jsx12("span", { style: { fontSize: 11, fontWeight: 600, color: AEO_PURPLE, textDecoration: "underline" }, children: "Update" })
|
|
4529
4896
|
]
|
|
4530
4897
|
}
|
|
4531
4898
|
),
|
|
4532
|
-
hasEnoughTextForGEO && /* @__PURE__ */
|
|
4533
|
-
hasEnoughText && !hasEnoughTextForGEO && /* @__PURE__ */
|
|
4534
|
-
/* @__PURE__ */
|
|
4899
|
+
hasEnoughTextForGEO && /* @__PURE__ */ jsx12(GEOCard, { geo, publication }),
|
|
4900
|
+
hasEnoughText && !hasEnoughTextForGEO && /* @__PURE__ */ jsx12("div", { style: { ...cardStyle3, textAlign: "center" }, children: /* @__PURE__ */ jsxs11("div", { style: { fontSize: 11, color: "#4b5563", lineHeight: 1.5 }, children: [
|
|
4901
|
+
/* @__PURE__ */ jsx12("strong", { style: { color: "#C9A716" }, children: "AI citation analysis" }),
|
|
4535
4902
|
" needs at least 150 words to read fact density.",
|
|
4536
|
-
/* @__PURE__ */
|
|
4537
|
-
/* @__PURE__ */
|
|
4903
|
+
/* @__PURE__ */ jsx12("br", {}),
|
|
4904
|
+
/* @__PURE__ */ jsxs11("span", { style: { color: "#4b5563" }, children: [
|
|
4538
4905
|
"Current: ",
|
|
4539
4906
|
geoWordCount,
|
|
4540
4907
|
" word",
|
|
4541
4908
|
geoWordCount === 1 ? "" : "s"
|
|
4542
4909
|
] })
|
|
4543
4910
|
] }) }),
|
|
4544
|
-
!deepAnalysis && isDeepLoading && /* @__PURE__ */
|
|
4545
|
-
/* @__PURE__ */
|
|
4546
|
-
/* @__PURE__ */
|
|
4911
|
+
!deepAnalysis && isDeepLoading && /* @__PURE__ */ jsxs11("div", { style: { ...cardStyle3, display: "flex", alignItems: "center", justifyContent: "center", gap: 8 }, children: [
|
|
4912
|
+
/* @__PURE__ */ jsx12(LoadingBars, { size: "xs", color: AEO_PURPLE }),
|
|
4913
|
+
/* @__PURE__ */ jsx12("span", { style: { fontSize: 12, color: "#4b5563" }, children: "Generating AEO insights..." })
|
|
4547
4914
|
] }),
|
|
4548
|
-
!deepAnalysis && !isDeepLoading && /* @__PURE__ */
|
|
4549
|
-
/* @__PURE__ */
|
|
4550
|
-
/* @__PURE__ */
|
|
4915
|
+
!deepAnalysis && !isDeepLoading && /* @__PURE__ */ jsxs11("div", { style: { ...cardStyle3, textAlign: "center" }, children: [
|
|
4916
|
+
/* @__PURE__ */ jsx12("div", { style: { fontSize: 12, color: "#4b5563" }, children: "AI citation readiness and question-style heading suggestions appear here once analysis runs." }),
|
|
4917
|
+
/* @__PURE__ */ jsx12(
|
|
4551
4918
|
"button",
|
|
4552
4919
|
{
|
|
4553
4920
|
onClick: runDeepAnalysis,
|
|
@@ -4567,11 +4934,11 @@ function AEOTab({
|
|
|
4567
4934
|
}
|
|
4568
4935
|
)
|
|
4569
4936
|
] }),
|
|
4570
|
-
deepAnalysis && !aeo && /* @__PURE__ */
|
|
4571
|
-
questionHeadings.length > 0 && /* @__PURE__ */
|
|
4572
|
-
/* @__PURE__ */
|
|
4573
|
-
/* @__PURE__ */
|
|
4574
|
-
/* @__PURE__ */
|
|
4937
|
+
deepAnalysis && !aeo && /* @__PURE__ */ jsx12("div", { style: { ...cardStyle3, textAlign: "center" }, children: /* @__PURE__ */ jsx12("span", { style: { fontSize: 12, color: "#4b5563" }, children: "No insights came back. Try again - the analysis may have timed out." }) }),
|
|
4938
|
+
questionHeadings.length > 0 && /* @__PURE__ */ jsxs11("div", { style: cardStyle3, children: [
|
|
4939
|
+
/* @__PURE__ */ jsx12(SectionHeader2, { label: "Question-Style Headings", iconColor: AEO_PURPLE }),
|
|
4940
|
+
/* @__PURE__ */ jsx12("div", { style: { fontSize: 10, color: "#4b5563", marginBottom: 8 }, children: "Rewrites of your existing headings as questions. Google often pulls these into featured snippets." }),
|
|
4941
|
+
/* @__PURE__ */ jsx12("div", { style: { display: "flex", flexDirection: "column", gap: 8 }, children: questionHeadings.map((h, i) => /* @__PURE__ */ jsxs11(
|
|
4575
4942
|
"div",
|
|
4576
4943
|
{
|
|
4577
4944
|
style: {
|
|
@@ -4581,26 +4948,26 @@ function AEOTab({
|
|
|
4581
4948
|
borderLeft: `3px solid ${AEO_PURPLE}`
|
|
4582
4949
|
},
|
|
4583
4950
|
children: [
|
|
4584
|
-
/* @__PURE__ */
|
|
4585
|
-
/* @__PURE__ */
|
|
4586
|
-
h.originalHeading && /* @__PURE__ */
|
|
4587
|
-
/* @__PURE__ */
|
|
4951
|
+
/* @__PURE__ */ jsxs11("div", { style: { display: "flex", alignItems: "flex-start", justifyContent: "space-between", gap: 8 }, children: [
|
|
4952
|
+
/* @__PURE__ */ jsxs11("div", { style: { flex: 1 }, children: [
|
|
4953
|
+
h.originalHeading && /* @__PURE__ */ jsx12("div", { style: { fontSize: 11, color: "#4b5563", textDecoration: "line-through", marginBottom: 2 }, children: h.originalHeading }),
|
|
4954
|
+
/* @__PURE__ */ jsx12("div", { style: { fontSize: 12, fontWeight: 700, color: AEO_PURPLE, lineHeight: 1.5 }, children: h.heading })
|
|
4588
4955
|
] }),
|
|
4589
|
-
/* @__PURE__ */
|
|
4590
|
-
/* @__PURE__ */
|
|
4591
|
-
/* @__PURE__ */
|
|
4956
|
+
/* @__PURE__ */ jsxs11("div", { style: { display: "flex", alignItems: "center", gap: 4 }, children: [
|
|
4957
|
+
/* @__PURE__ */ jsx12(CopyButton, { text: h.heading }),
|
|
4958
|
+
/* @__PURE__ */ jsx12(FeedbackButton, { suggestionType: "aeo_heading", suggestionText: h.heading, publication })
|
|
4592
4959
|
] })
|
|
4593
4960
|
] }),
|
|
4594
|
-
/* @__PURE__ */
|
|
4961
|
+
/* @__PURE__ */ jsx12("div", { style: { fontSize: 10, color: "#4b5563", marginTop: 4, fontStyle: "italic" }, children: h.rationale })
|
|
4595
4962
|
]
|
|
4596
4963
|
},
|
|
4597
4964
|
i
|
|
4598
4965
|
)) })
|
|
4599
4966
|
] }),
|
|
4600
|
-
/* @__PURE__ */
|
|
4601
|
-
/* @__PURE__ */
|
|
4602
|
-
/* @__PURE__ */
|
|
4603
|
-
!contentSuggestions && !isCSLoading && /* @__PURE__ */
|
|
4967
|
+
/* @__PURE__ */ jsxs11("div", { style: cardStyle3, children: [
|
|
4968
|
+
/* @__PURE__ */ jsx12(SectionHeader2, { label: "Content Block Suggestions", iconColor: AEO_PURPLE }),
|
|
4969
|
+
/* @__PURE__ */ jsx12("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." }),
|
|
4970
|
+
!contentSuggestions && !isCSLoading && /* @__PURE__ */ jsx12(
|
|
4604
4971
|
"button",
|
|
4605
4972
|
{
|
|
4606
4973
|
onClick: loadContentSuggestions,
|
|
@@ -4624,15 +4991,15 @@ function AEOTab({
|
|
|
4624
4991
|
children: "Generate suggestions"
|
|
4625
4992
|
}
|
|
4626
4993
|
),
|
|
4627
|
-
isCSLoading && /* @__PURE__ */
|
|
4628
|
-
/* @__PURE__ */
|
|
4629
|
-
/* @__PURE__ */
|
|
4994
|
+
isCSLoading && /* @__PURE__ */ jsxs11("div", { style: { display: "flex", alignItems: "center", justifyContent: "center", gap: 8, padding: "8px 0" }, children: [
|
|
4995
|
+
/* @__PURE__ */ jsx12(LoadingBars, { size: "xs", color: AEO_PURPLE }),
|
|
4996
|
+
/* @__PURE__ */ jsx12("span", { style: { fontSize: 11, color: "#4b5563" }, children: "Generating content suggestions..." })
|
|
4630
4997
|
] }),
|
|
4631
|
-
csError && /* @__PURE__ */
|
|
4632
|
-
contentSuggestions && /* @__PURE__ */
|
|
4633
|
-
contentSuggestions.keyTakeaways.length > 0 && /* @__PURE__ */
|
|
4634
|
-
/* @__PURE__ */
|
|
4635
|
-
/* @__PURE__ */
|
|
4998
|
+
csError && /* @__PURE__ */ jsx12("div", { style: { marginTop: 6, fontSize: 11, color: "#dc2626" }, children: csError }),
|
|
4999
|
+
contentSuggestions && /* @__PURE__ */ jsxs11("div", { style: { display: "flex", flexDirection: "column", gap: 14, marginTop: 8 }, children: [
|
|
5000
|
+
contentSuggestions.keyTakeaways.length > 0 && /* @__PURE__ */ jsxs11("div", { children: [
|
|
5001
|
+
/* @__PURE__ */ jsx12("div", { style: { fontSize: 10, fontWeight: 700, textTransform: "uppercase", letterSpacing: "0.06em", color: AEO_PURPLE, marginBottom: 6 }, children: "Key Takeaways" }),
|
|
5002
|
+
/* @__PURE__ */ jsx12("div", { style: { display: "flex", flexDirection: "column", gap: 6 }, children: contentSuggestions.keyTakeaways.map((kt, i) => /* @__PURE__ */ jsxs11(
|
|
4636
5003
|
"div",
|
|
4637
5004
|
{
|
|
4638
5005
|
style: {
|
|
@@ -4645,19 +5012,19 @@ function AEOTab({
|
|
|
4645
5012
|
alignItems: "flex-start"
|
|
4646
5013
|
},
|
|
4647
5014
|
children: [
|
|
4648
|
-
/* @__PURE__ */
|
|
4649
|
-
/* @__PURE__ */
|
|
4650
|
-
/* @__PURE__ */
|
|
4651
|
-
/* @__PURE__ */
|
|
5015
|
+
/* @__PURE__ */ jsx12("span", { style: { fontSize: 12, color: "#1f2937", lineHeight: 1.55, flex: 1 }, children: kt }),
|
|
5016
|
+
/* @__PURE__ */ jsxs11("div", { style: { display: "flex", alignItems: "center", gap: 4 }, children: [
|
|
5017
|
+
/* @__PURE__ */ jsx12(CopyButton, { text: kt }),
|
|
5018
|
+
/* @__PURE__ */ jsx12(FeedbackButton, { suggestionType: "aeo_takeaway", suggestionText: kt, publication })
|
|
4652
5019
|
] })
|
|
4653
5020
|
]
|
|
4654
5021
|
},
|
|
4655
5022
|
i
|
|
4656
5023
|
)) })
|
|
4657
5024
|
] }),
|
|
4658
|
-
contentSuggestions.infographicOpportunities.length > 0 && /* @__PURE__ */
|
|
4659
|
-
/* @__PURE__ */
|
|
4660
|
-
/* @__PURE__ */
|
|
5025
|
+
contentSuggestions.infographicOpportunities.length > 0 && /* @__PURE__ */ jsxs11("div", { children: [
|
|
5026
|
+
/* @__PURE__ */ jsx12("div", { style: { fontSize: 10, fontWeight: 700, textTransform: "uppercase", letterSpacing: "0.06em", color: AEO_PURPLE, marginBottom: 6 }, children: "Infographic Ideas" }),
|
|
5027
|
+
/* @__PURE__ */ jsx12("div", { style: { display: "flex", flexDirection: "column", gap: 6 }, children: contentSuggestions.infographicOpportunities.map((io, i) => /* @__PURE__ */ jsxs11(
|
|
4661
5028
|
"div",
|
|
4662
5029
|
{
|
|
4663
5030
|
style: {
|
|
@@ -4667,23 +5034,23 @@ function AEOTab({
|
|
|
4667
5034
|
borderLeft: `2px solid ${AEO_PURPLE}`
|
|
4668
5035
|
},
|
|
4669
5036
|
children: [
|
|
4670
|
-
/* @__PURE__ */
|
|
4671
|
-
/* @__PURE__ */
|
|
4672
|
-
/* @__PURE__ */
|
|
5037
|
+
/* @__PURE__ */ jsxs11("div", { style: { display: "flex", alignItems: "flex-start", justifyContent: "space-between", gap: 8 }, children: [
|
|
5038
|
+
/* @__PURE__ */ jsx12("span", { style: { fontSize: 12, fontWeight: 700, color: AEO_PURPLE }, children: io.concept }),
|
|
5039
|
+
/* @__PURE__ */ jsx12(FeedbackButton, { suggestionType: "aeo_infographic", suggestionText: io.concept, publication })
|
|
4673
5040
|
] }),
|
|
4674
|
-
/* @__PURE__ */
|
|
5041
|
+
/* @__PURE__ */ jsx12("div", { style: { fontSize: 11, color: "#1f2937", lineHeight: 1.5, marginTop: 3 }, children: io.description })
|
|
4675
5042
|
]
|
|
4676
5043
|
},
|
|
4677
5044
|
i
|
|
4678
5045
|
)) })
|
|
4679
5046
|
] }),
|
|
4680
|
-
contentSuggestions.bulletListItems.length > 0 && /* @__PURE__ */
|
|
4681
|
-
/* @__PURE__ */
|
|
4682
|
-
/* @__PURE__ */
|
|
4683
|
-
/* @__PURE__ */
|
|
4684
|
-
/* @__PURE__ */
|
|
4685
|
-
/* @__PURE__ */
|
|
4686
|
-
/* @__PURE__ */
|
|
5047
|
+
contentSuggestions.bulletListItems.length > 0 && /* @__PURE__ */ jsxs11("div", { children: [
|
|
5048
|
+
/* @__PURE__ */ jsx12("div", { style: { fontSize: 10, fontWeight: 700, textTransform: "uppercase", letterSpacing: "0.06em", color: AEO_PURPLE, marginBottom: 6 }, children: "Bullets for Featured Snippets" }),
|
|
5049
|
+
/* @__PURE__ */ jsxs11("div", { style: { display: "flex", alignItems: "flex-start", justifyContent: "space-between", gap: 8 }, children: [
|
|
5050
|
+
/* @__PURE__ */ jsx12("ul", { style: { margin: 0, paddingLeft: 18, flex: 1 }, children: contentSuggestions.bulletListItems.map((b, i) => /* @__PURE__ */ jsx12("li", { style: { fontSize: 12, color: "#1f2937", lineHeight: 1.55, marginBottom: 4 }, children: b }, i)) }),
|
|
5051
|
+
/* @__PURE__ */ jsxs11("div", { style: { display: "flex", alignItems: "center", gap: 4 }, children: [
|
|
5052
|
+
/* @__PURE__ */ jsx12(CopyButton, { text: contentSuggestions.bulletListItems.map((b) => "- " + b).join("\n") }),
|
|
5053
|
+
/* @__PURE__ */ jsx12(
|
|
4687
5054
|
FeedbackButton,
|
|
4688
5055
|
{
|
|
4689
5056
|
suggestionType: "aeo_bullets",
|
|
@@ -4694,7 +5061,7 @@ function AEOTab({
|
|
|
4694
5061
|
] })
|
|
4695
5062
|
] })
|
|
4696
5063
|
] }),
|
|
4697
|
-
/* @__PURE__ */
|
|
5064
|
+
/* @__PURE__ */ jsx12(
|
|
4698
5065
|
"button",
|
|
4699
5066
|
{
|
|
4700
5067
|
onClick: loadContentSuggestions,
|
|
@@ -4723,8 +5090,8 @@ function AEOTab({
|
|
|
4723
5090
|
}
|
|
4724
5091
|
|
|
4725
5092
|
// src/components/ScoreDonut.tsx
|
|
4726
|
-
import { useState as
|
|
4727
|
-
import { jsx as
|
|
5093
|
+
import { useState as useState15 } from "react";
|
|
5094
|
+
import { jsx as jsx13, jsxs as jsxs12 } from "react/jsx-runtime";
|
|
4728
5095
|
var W = { topic: 0.6, freshness: 0.25, sectionFit: 0.15 };
|
|
4729
5096
|
var COLORS = { topic: MJH_BLUE, freshness: MJH_GOLD, sectionFit: "#9B59B6" };
|
|
4730
5097
|
var TRACK = "#eef2f7";
|
|
@@ -4736,7 +5103,7 @@ function ScoreDonut({
|
|
|
4736
5103
|
sectionFit,
|
|
4737
5104
|
composite
|
|
4738
5105
|
}) {
|
|
4739
|
-
const [hovered, setHovered] =
|
|
5106
|
+
const [hovered, setHovered] = useState15(false);
|
|
4740
5107
|
const radius = (size - strokeWidth) / 2;
|
|
4741
5108
|
const circumference = 2 * Math.PI * radius;
|
|
4742
5109
|
const cTopic = topic * W.topic;
|
|
@@ -4749,7 +5116,7 @@ function ScoreDonut({
|
|
|
4749
5116
|
const topicLen = seg(cTopic);
|
|
4750
5117
|
const freshLen = seg(cFresh);
|
|
4751
5118
|
const sectionLen = seg(cSection);
|
|
4752
|
-
const Slice = ({ color, fullLen, offset }) => /* @__PURE__ */
|
|
5119
|
+
const Slice = ({ color, fullLen, offset }) => /* @__PURE__ */ jsx13(
|
|
4753
5120
|
"circle",
|
|
4754
5121
|
{
|
|
4755
5122
|
cx: size / 2,
|
|
@@ -4763,20 +5130,20 @@ function ScoreDonut({
|
|
|
4763
5130
|
strokeDashoffset: -offset
|
|
4764
5131
|
}
|
|
4765
5132
|
);
|
|
4766
|
-
return /* @__PURE__ */
|
|
5133
|
+
return /* @__PURE__ */ jsxs12(
|
|
4767
5134
|
"div",
|
|
4768
5135
|
{
|
|
4769
5136
|
style: { position: "relative", width: size, height: size, flexShrink: 0 },
|
|
4770
5137
|
onMouseEnter: () => setHovered(true),
|
|
4771
5138
|
onMouseLeave: () => setHovered(false),
|
|
4772
5139
|
children: [
|
|
4773
|
-
/* @__PURE__ */
|
|
4774
|
-
/* @__PURE__ */
|
|
4775
|
-
/* @__PURE__ */
|
|
4776
|
-
/* @__PURE__ */
|
|
4777
|
-
/* @__PURE__ */
|
|
5140
|
+
/* @__PURE__ */ jsxs12("svg", { width: size, height: size, viewBox: `0 0 ${size} ${size}`, style: { transform: "rotate(-90deg)" }, children: [
|
|
5141
|
+
/* @__PURE__ */ jsx13("circle", { cx: size / 2, cy: size / 2, r: radius, fill: "none", stroke: TRACK, strokeWidth }),
|
|
5142
|
+
/* @__PURE__ */ jsx13(Slice, { color: COLORS.topic, fullLen: topicLen, offset: 0 }),
|
|
5143
|
+
/* @__PURE__ */ jsx13(Slice, { color: COLORS.freshness, fullLen: freshLen, offset: topicLen }),
|
|
5144
|
+
/* @__PURE__ */ jsx13(Slice, { color: COLORS.sectionFit, fullLen: sectionLen, offset: topicLen + freshLen })
|
|
4778
5145
|
] }),
|
|
4779
|
-
/* @__PURE__ */
|
|
5146
|
+
/* @__PURE__ */ jsxs12(
|
|
4780
5147
|
"div",
|
|
4781
5148
|
{
|
|
4782
5149
|
style: {
|
|
@@ -4790,15 +5157,15 @@ function ScoreDonut({
|
|
|
4790
5157
|
lineHeight: 1
|
|
4791
5158
|
},
|
|
4792
5159
|
children: [
|
|
4793
|
-
/* @__PURE__ */
|
|
5160
|
+
/* @__PURE__ */ jsxs12("span", { style: { fontSize: Math.max(11, size / 5.5), fontWeight: 700, color: "#1f2937" }, children: [
|
|
4794
5161
|
compositeValue,
|
|
4795
5162
|
"%"
|
|
4796
5163
|
] }),
|
|
4797
|
-
/* @__PURE__ */
|
|
5164
|
+
/* @__PURE__ */ jsx13("span", { style: { fontSize: Math.max(7, size / 11), fontWeight: 700, color: "#4b5563", letterSpacing: "0.05em", marginTop: 1 }, children: "MATCH" })
|
|
4798
5165
|
]
|
|
4799
5166
|
}
|
|
4800
5167
|
),
|
|
4801
|
-
hovered && /* @__PURE__ */
|
|
5168
|
+
hovered && /* @__PURE__ */ jsxs12(
|
|
4802
5169
|
"div",
|
|
4803
5170
|
{
|
|
4804
5171
|
role: "tooltip",
|
|
@@ -4819,9 +5186,9 @@ function ScoreDonut({
|
|
|
4819
5186
|
pointerEvents: "none"
|
|
4820
5187
|
},
|
|
4821
5188
|
children: [
|
|
4822
|
-
/* @__PURE__ */
|
|
4823
|
-
/* @__PURE__ */
|
|
4824
|
-
/* @__PURE__ */
|
|
5189
|
+
/* @__PURE__ */ jsx13(SubScoreRow, { color: COLORS.topic, label: "Topic", value: topic }),
|
|
5190
|
+
/* @__PURE__ */ jsx13(SubScoreRow, { color: COLORS.freshness, label: "Freshness", value: freshness }),
|
|
5191
|
+
/* @__PURE__ */ jsx13(SubScoreRow, { color: COLORS.sectionFit, label: "Section fit", value: sectionFit })
|
|
4825
5192
|
]
|
|
4826
5193
|
}
|
|
4827
5194
|
)
|
|
@@ -4830,31 +5197,31 @@ function ScoreDonut({
|
|
|
4830
5197
|
);
|
|
4831
5198
|
}
|
|
4832
5199
|
function SubScoreRow({ color, label, value }) {
|
|
4833
|
-
return /* @__PURE__ */
|
|
4834
|
-
/* @__PURE__ */
|
|
4835
|
-
/* @__PURE__ */
|
|
4836
|
-
/* @__PURE__ */
|
|
5200
|
+
return /* @__PURE__ */ jsxs12("div", { style: { display: "flex", alignItems: "center", gap: 6 }, children: [
|
|
5201
|
+
/* @__PURE__ */ jsx13("span", { style: { width: 7, height: 7, borderRadius: "50%", background: color, display: "inline-block", flexShrink: 0 } }),
|
|
5202
|
+
/* @__PURE__ */ jsx13("span", { style: { flex: 1 }, children: label }),
|
|
5203
|
+
/* @__PURE__ */ jsxs12("span", { style: { fontWeight: 700, fontVariantNumeric: "tabular-nums" }, children: [
|
|
4837
5204
|
Math.round(value),
|
|
4838
5205
|
"/100"
|
|
4839
5206
|
] })
|
|
4840
5207
|
] });
|
|
4841
5208
|
}
|
|
4842
5209
|
function ScoreDonutLegend() {
|
|
4843
|
-
return /* @__PURE__ */
|
|
4844
|
-
/* @__PURE__ */
|
|
4845
|
-
/* @__PURE__ */
|
|
4846
|
-
/* @__PURE__ */
|
|
5210
|
+
return /* @__PURE__ */ jsxs12("div", { style: { display: "flex", gap: 10, fontSize: 9, color: "rgba(0,0,0,0.55)", alignItems: "center", flexWrap: "wrap" }, children: [
|
|
5211
|
+
/* @__PURE__ */ jsx13(LegendDot, { color: COLORS.topic, label: "Topic match (60% of score)" }),
|
|
5212
|
+
/* @__PURE__ */ jsx13(LegendDot, { color: COLORS.freshness, label: "Freshness (25%)" }),
|
|
5213
|
+
/* @__PURE__ */ jsx13(LegendDot, { color: COLORS.sectionFit, label: "Section fit (15%)" })
|
|
4847
5214
|
] });
|
|
4848
5215
|
}
|
|
4849
5216
|
function LegendDot({ color, label }) {
|
|
4850
|
-
return /* @__PURE__ */
|
|
4851
|
-
/* @__PURE__ */
|
|
5217
|
+
return /* @__PURE__ */ jsxs12("span", { style: { display: "inline-flex", alignItems: "center", gap: 4 }, children: [
|
|
5218
|
+
/* @__PURE__ */ jsx13("span", { style: { width: 7, height: 7, borderRadius: "50%", background: color, display: "inline-block" } }),
|
|
4852
5219
|
label
|
|
4853
5220
|
] });
|
|
4854
5221
|
}
|
|
4855
5222
|
|
|
4856
5223
|
// src/components/tabs/LinkingTab.tsx
|
|
4857
|
-
import { Fragment as
|
|
5224
|
+
import { Fragment as Fragment7, jsx as jsx14, jsxs as jsxs13 } from "react/jsx-runtime";
|
|
4858
5225
|
function buildLiveUrl(publication, slug) {
|
|
4859
5226
|
if (!slug) return null;
|
|
4860
5227
|
const pub = (publication || "").trim().toLowerCase();
|
|
@@ -4870,7 +5237,7 @@ function buildSanityUrl(baseUrl, id, type) {
|
|
|
4870
5237
|
return `${base}/intent/edit/id=${encodeURIComponent(cleanId)}${typePart}/`;
|
|
4871
5238
|
}
|
|
4872
5239
|
function LinkChip({ href, label, color }) {
|
|
4873
|
-
return /* @__PURE__ */
|
|
5240
|
+
return /* @__PURE__ */ jsxs13(
|
|
4874
5241
|
"a",
|
|
4875
5242
|
{
|
|
4876
5243
|
href,
|
|
@@ -4892,14 +5259,38 @@ function LinkChip({ href, label, color }) {
|
|
|
4892
5259
|
},
|
|
4893
5260
|
children: [
|
|
4894
5261
|
label,
|
|
4895
|
-
/* @__PURE__ */
|
|
4896
|
-
/* @__PURE__ */
|
|
4897
|
-
/* @__PURE__ */
|
|
5262
|
+
/* @__PURE__ */ jsxs13("svg", { width: "9", height: "9", viewBox: "0 0 20 20", fill: "currentColor", "aria-hidden": "true", children: [
|
|
5263
|
+
/* @__PURE__ */ jsx14("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" }),
|
|
5264
|
+
/* @__PURE__ */ jsx14("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" })
|
|
4898
5265
|
] })
|
|
4899
5266
|
]
|
|
4900
5267
|
}
|
|
4901
5268
|
);
|
|
4902
5269
|
}
|
|
5270
|
+
function ClickableBadge({ clickable }) {
|
|
5271
|
+
return /* @__PURE__ */ jsxs13(
|
|
5272
|
+
"span",
|
|
5273
|
+
{
|
|
5274
|
+
style: {
|
|
5275
|
+
fontSize: 9,
|
|
5276
|
+
fontWeight: 700,
|
|
5277
|
+
textTransform: "uppercase",
|
|
5278
|
+
letterSpacing: "0.04em",
|
|
5279
|
+
padding: "2px 7px",
|
|
5280
|
+
borderRadius: 99,
|
|
5281
|
+
display: "inline-flex",
|
|
5282
|
+
alignItems: "center",
|
|
5283
|
+
gap: 4,
|
|
5284
|
+
background: clickable ? "rgba(22,163,74,0.12)" : "rgba(0,0,0,0.05)",
|
|
5285
|
+
color: clickable ? "#16a34a" : "#9ca3af"
|
|
5286
|
+
},
|
|
5287
|
+
children: [
|
|
5288
|
+
/* @__PURE__ */ jsx14("span", { style: { width: 5, height: 5, borderRadius: "50%", background: "currentColor" } }),
|
|
5289
|
+
clickable ? "Clickable link" : "No live link"
|
|
5290
|
+
]
|
|
5291
|
+
}
|
|
5292
|
+
);
|
|
5293
|
+
}
|
|
4903
5294
|
var cardStyle4 = {
|
|
4904
5295
|
borderRadius: 14,
|
|
4905
5296
|
background: "rgba(255,255,255,0.55)",
|
|
@@ -4909,7 +5300,7 @@ var cardStyle4 = {
|
|
|
4909
5300
|
padding: "14px"
|
|
4910
5301
|
};
|
|
4911
5302
|
function AiPill2() {
|
|
4912
|
-
return /* @__PURE__ */
|
|
5303
|
+
return /* @__PURE__ */ jsx14(
|
|
4913
5304
|
"span",
|
|
4914
5305
|
{
|
|
4915
5306
|
style: {
|
|
@@ -4933,10 +5324,10 @@ function SectionHeader3({
|
|
|
4933
5324
|
ai,
|
|
4934
5325
|
action
|
|
4935
5326
|
}) {
|
|
4936
|
-
return /* @__PURE__ */
|
|
4937
|
-
/* @__PURE__ */
|
|
4938
|
-
/* @__PURE__ */
|
|
4939
|
-
ai && /* @__PURE__ */
|
|
5327
|
+
return /* @__PURE__ */ jsxs13("div", { style: { display: "flex", alignItems: "center", gap: 7, marginBottom: 8 }, children: [
|
|
5328
|
+
/* @__PURE__ */ jsx14("div", { style: { width: 7, height: 7, borderRadius: "50%", background: iconColor, flexShrink: 0 } }),
|
|
5329
|
+
/* @__PURE__ */ jsx14("span", { style: { fontSize: 10.5, textTransform: "uppercase", letterSpacing: "0.06em", color: "#4b5563", fontWeight: 600, flex: 1 }, children: label }),
|
|
5330
|
+
ai && /* @__PURE__ */ jsx14(AiPill2, {}),
|
|
4940
5331
|
action
|
|
4941
5332
|
] });
|
|
4942
5333
|
}
|
|
@@ -4957,7 +5348,7 @@ function freshnessChip(label, score) {
|
|
|
4957
5348
|
};
|
|
4958
5349
|
const c = map[label];
|
|
4959
5350
|
if (!c) return null;
|
|
4960
|
-
return /* @__PURE__ */
|
|
5351
|
+
return /* @__PURE__ */ jsx14(
|
|
4961
5352
|
"span",
|
|
4962
5353
|
{
|
|
4963
5354
|
style: {
|
|
@@ -4977,8 +5368,8 @@ function freshnessChip(label, score) {
|
|
|
4977
5368
|
);
|
|
4978
5369
|
}
|
|
4979
5370
|
function RefreshIcon({ spinning }) {
|
|
4980
|
-
if (spinning) return /* @__PURE__ */
|
|
4981
|
-
return /* @__PURE__ */
|
|
5371
|
+
if (spinning) return /* @__PURE__ */ jsx14(LoadingBars, { size: "xs", color: "#9ca3af" });
|
|
5372
|
+
return /* @__PURE__ */ jsx14("svg", { width: "12", height: "12", viewBox: "0 0 20 20", fill: "currentColor", children: /* @__PURE__ */ jsx14("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" }) });
|
|
4982
5373
|
}
|
|
4983
5374
|
function LinkingTab({
|
|
4984
5375
|
analysis,
|
|
@@ -4994,21 +5385,21 @@ function LinkingTab({
|
|
|
4994
5385
|
documentType
|
|
4995
5386
|
}) {
|
|
4996
5387
|
if (!analysis) {
|
|
4997
|
-
return /* @__PURE__ */
|
|
4998
|
-
/* @__PURE__ */
|
|
4999
|
-
/* @__PURE__ */
|
|
5388
|
+
return /* @__PURE__ */ jsxs13("div", { style: { padding: 24, textAlign: "center" }, children: [
|
|
5389
|
+
/* @__PURE__ */ jsx14("div", { style: { fontSize: 13, color: "#4b5563", fontWeight: 500 }, children: "Waiting for keyword analysis" }),
|
|
5390
|
+
/* @__PURE__ */ jsx14("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." })
|
|
5000
5391
|
] });
|
|
5001
5392
|
}
|
|
5002
5393
|
const wordCount2 = text ? text.split(/\s+/).filter(Boolean).length : 0;
|
|
5003
5394
|
const recommendedMin = Math.max(1, Math.round(wordCount2 / 1e3 * 2));
|
|
5004
5395
|
const recommendedMax = Math.max(2, Math.round(wordCount2 / 1e3 * 5));
|
|
5005
|
-
return /* @__PURE__ */
|
|
5006
|
-
/* @__PURE__ */
|
|
5396
|
+
return /* @__PURE__ */ jsx14("div", { style: { padding: 12, display: "flex", flexDirection: "column", gap: 12 }, children: /* @__PURE__ */ jsxs13("div", { id: "anchor-linking-suggestions", style: cardStyle4, children: [
|
|
5397
|
+
/* @__PURE__ */ jsx14(
|
|
5007
5398
|
SectionHeader3,
|
|
5008
5399
|
{
|
|
5009
5400
|
label: "Suggested Links",
|
|
5010
5401
|
iconColor: MJH_BLUE,
|
|
5011
|
-
action: /* @__PURE__ */
|
|
5402
|
+
action: /* @__PURE__ */ jsx14(
|
|
5012
5403
|
"button",
|
|
5013
5404
|
{
|
|
5014
5405
|
onClick: onRefresh,
|
|
@@ -5023,20 +5414,20 @@ function LinkingTab({
|
|
|
5023
5414
|
fontSize: 10
|
|
5024
5415
|
},
|
|
5025
5416
|
title: "Refresh",
|
|
5026
|
-
children: /* @__PURE__ */
|
|
5417
|
+
children: /* @__PURE__ */ jsx14(RefreshIcon, { spinning: isLoading })
|
|
5027
5418
|
}
|
|
5028
5419
|
)
|
|
5029
5420
|
}
|
|
5030
5421
|
),
|
|
5031
|
-
/* @__PURE__ */
|
|
5422
|
+
/* @__PURE__ */ jsxs13("div", { style: { fontSize: 11, color: "#1f2937", marginBottom: 8, lineHeight: 1.55 }, children: [
|
|
5032
5423
|
"Other articles on this site that fit this topic.",
|
|
5033
|
-
wordCount2 > 0 && /* @__PURE__ */
|
|
5424
|
+
wordCount2 > 0 && /* @__PURE__ */ jsxs13(Fragment7, { children: [
|
|
5034
5425
|
" ",
|
|
5035
5426
|
"For a ",
|
|
5036
5427
|
wordCount2.toLocaleString(),
|
|
5037
5428
|
"-word article, aim for",
|
|
5038
5429
|
" ",
|
|
5039
|
-
/* @__PURE__ */
|
|
5430
|
+
/* @__PURE__ */ jsxs13("strong", { children: [
|
|
5040
5431
|
recommendedMin,
|
|
5041
5432
|
"-",
|
|
5042
5433
|
recommendedMax,
|
|
@@ -5045,17 +5436,17 @@ function LinkingTab({
|
|
|
5045
5436
|
"."
|
|
5046
5437
|
] })
|
|
5047
5438
|
] }),
|
|
5048
|
-
/* @__PURE__ */
|
|
5439
|
+
/* @__PURE__ */ jsxs13("div", { style: { fontSize: 10, color: "#4b5563", marginBottom: 6, lineHeight: 1.5 }, children: [
|
|
5049
5440
|
"Each suggestion gets a 0-100% match score from three signals - ",
|
|
5050
|
-
/* @__PURE__ */
|
|
5441
|
+
/* @__PURE__ */ jsx14("strong", { children: "topic match" }),
|
|
5051
5442
|
", ",
|
|
5052
|
-
/* @__PURE__ */
|
|
5443
|
+
/* @__PURE__ */ jsx14("strong", { children: "freshness" }),
|
|
5053
5444
|
", and ",
|
|
5054
|
-
/* @__PURE__ */
|
|
5445
|
+
/* @__PURE__ */ jsx14("strong", { children: "section fit" }),
|
|
5055
5446
|
" (where in your article the link belongs). The percentage on each card is the weighted total:"
|
|
5056
5447
|
] }),
|
|
5057
|
-
/* @__PURE__ */
|
|
5058
|
-
isStale && suggestions.length > 0 && !isLoading && /* @__PURE__ */
|
|
5448
|
+
/* @__PURE__ */ jsx14("div", { style: { marginBottom: 10 }, children: /* @__PURE__ */ jsx14(ScoreDonutLegend, {}) }),
|
|
5449
|
+
isStale && suggestions.length > 0 && !isLoading && /* @__PURE__ */ jsxs13(
|
|
5059
5450
|
"div",
|
|
5060
5451
|
{
|
|
5061
5452
|
role: "button",
|
|
@@ -5080,16 +5471,16 @@ function LinkingTab({
|
|
|
5080
5471
|
cursor: "pointer"
|
|
5081
5472
|
},
|
|
5082
5473
|
children: [
|
|
5083
|
-
/* @__PURE__ */
|
|
5084
|
-
/* @__PURE__ */
|
|
5474
|
+
/* @__PURE__ */ jsx14("span", { style: { fontSize: 11, color: "#92400e" }, children: "Your article changed since these were generated." }),
|
|
5475
|
+
/* @__PURE__ */ jsx14("span", { style: { fontSize: 11, fontWeight: 700, color: "#8B7310", textDecoration: "underline", flexShrink: 0 }, children: "Refresh" })
|
|
5085
5476
|
]
|
|
5086
5477
|
}
|
|
5087
5478
|
),
|
|
5088
|
-
isLoading && suggestions.length === 0 && /* @__PURE__ */
|
|
5089
|
-
/* @__PURE__ */
|
|
5090
|
-
/* @__PURE__ */
|
|
5479
|
+
isLoading && suggestions.length === 0 && /* @__PURE__ */ jsxs13("div", { style: { display: "flex", alignItems: "center", justifyContent: "center", gap: 8, padding: "16px 0" }, children: [
|
|
5480
|
+
/* @__PURE__ */ jsx14(LoadingBars, { size: "xs", color: MJH_BLUE }),
|
|
5481
|
+
/* @__PURE__ */ jsx14("span", { style: { fontSize: 11, color: "#4b5563" }, children: "Ranking candidates..." })
|
|
5091
5482
|
] }),
|
|
5092
|
-
!isLoading && error && /* @__PURE__ */
|
|
5483
|
+
!isLoading && error && /* @__PURE__ */ jsxs13(
|
|
5093
5484
|
"div",
|
|
5094
5485
|
{
|
|
5095
5486
|
style: {
|
|
@@ -5100,9 +5491,9 @@ function LinkingTab({
|
|
|
5100
5491
|
textAlign: "center"
|
|
5101
5492
|
},
|
|
5102
5493
|
children: [
|
|
5103
|
-
/* @__PURE__ */
|
|
5104
|
-
/* @__PURE__ */
|
|
5105
|
-
/* @__PURE__ */
|
|
5494
|
+
/* @__PURE__ */ jsx14("div", { style: { fontSize: 11.5, color: "#b91c1c", fontWeight: 600, marginBottom: 2 }, children: "Couldn't load suggestions" }),
|
|
5495
|
+
/* @__PURE__ */ jsx14("div", { style: { fontSize: 10.5, color: "#4b5563", marginBottom: 8 }, children: error }),
|
|
5496
|
+
/* @__PURE__ */ jsx14(
|
|
5106
5497
|
"button",
|
|
5107
5498
|
{
|
|
5108
5499
|
onClick: onRefresh,
|
|
@@ -5122,104 +5513,162 @@ function LinkingTab({
|
|
|
5122
5513
|
]
|
|
5123
5514
|
}
|
|
5124
5515
|
),
|
|
5125
|
-
!isLoading && !error && suggestions.length === 0 && /* @__PURE__ */
|
|
5126
|
-
/* @__PURE__ */
|
|
5127
|
-
/* @__PURE__ */
|
|
5516
|
+
!isLoading && !error && suggestions.length === 0 && /* @__PURE__ */ jsxs13("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: [
|
|
5517
|
+
/* @__PURE__ */ jsx14("div", { style: { fontWeight: 700, marginBottom: 4, color: "#1f2937" }, children: "No closely related articles found." }),
|
|
5518
|
+
/* @__PURE__ */ jsx14("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." })
|
|
5128
5519
|
] }),
|
|
5129
|
-
suggestions.length > 0 && /* @__PURE__ */
|
|
5130
|
-
|
|
5131
|
-
|
|
5132
|
-
|
|
5133
|
-
|
|
5134
|
-
|
|
5135
|
-
|
|
5136
|
-
|
|
5137
|
-
|
|
5138
|
-
|
|
5139
|
-
|
|
5140
|
-
|
|
5141
|
-
|
|
5142
|
-
|
|
5143
|
-
|
|
5144
|
-
|
|
5145
|
-
|
|
5146
|
-
|
|
5147
|
-
|
|
5148
|
-
|
|
5149
|
-
|
|
5150
|
-
|
|
5151
|
-
|
|
5152
|
-
|
|
5153
|
-
|
|
5154
|
-
|
|
5155
|
-
|
|
5156
|
-
|
|
5157
|
-
|
|
5158
|
-
|
|
5159
|
-
|
|
5160
|
-
|
|
5161
|
-
|
|
5162
|
-
|
|
5163
|
-
|
|
5164
|
-
|
|
5165
|
-
|
|
5166
|
-
|
|
5167
|
-
sanityUrl && /* @__PURE__ */
|
|
5168
|
-
liveUrl && /* @__PURE__ */
|
|
5169
|
-
] })
|
|
5170
|
-
|
|
5171
|
-
|
|
5172
|
-
|
|
5173
|
-
|
|
5174
|
-
|
|
5520
|
+
suggestions.length > 0 && /* @__PURE__ */ jsx14("div", { style: { display: "flex", flexDirection: "column", gap: 10 }, children: suggestions.map((s) => {
|
|
5521
|
+
const liveUrl = buildLiveUrl(publication, s.slug);
|
|
5522
|
+
const sanityUrl = buildSanityUrl(sanityBaseUrl, s._id);
|
|
5523
|
+
return /* @__PURE__ */ jsxs13(
|
|
5524
|
+
"div",
|
|
5525
|
+
{
|
|
5526
|
+
style: {
|
|
5527
|
+
padding: "10px 12px",
|
|
5528
|
+
background: "rgba(0,93,172,0.03)",
|
|
5529
|
+
borderRadius: 10,
|
|
5530
|
+
borderLeft: `2px solid ${MJH_BLUE}`,
|
|
5531
|
+
display: "flex",
|
|
5532
|
+
gap: 12,
|
|
5533
|
+
alignItems: "flex-start"
|
|
5534
|
+
},
|
|
5535
|
+
children: [
|
|
5536
|
+
/* @__PURE__ */ jsx14(
|
|
5537
|
+
ScoreDonut,
|
|
5538
|
+
{
|
|
5539
|
+
size: 64,
|
|
5540
|
+
topic: Math.max(0, Math.min(100, s.topicScore)),
|
|
5541
|
+
freshness: Math.max(0, Math.min(100, s.freshnessScore)),
|
|
5542
|
+
sectionFit: Math.max(0, Math.min(100, s.sectionFitScore)),
|
|
5543
|
+
composite: Math.max(0, Math.min(100, s.compositeScore))
|
|
5544
|
+
}
|
|
5545
|
+
),
|
|
5546
|
+
/* @__PURE__ */ jsxs13("div", { style: { flex: 1, minWidth: 0 }, children: [
|
|
5547
|
+
/* @__PURE__ */ jsxs13("div", { style: { display: "flex", alignItems: "center", gap: 6, marginBottom: 3, flexWrap: "wrap" }, children: [
|
|
5548
|
+
freshnessChip(s.freshnessLabel, s.freshnessScore),
|
|
5549
|
+
s.publishedAt && /* @__PURE__ */ jsx14("span", { style: { fontSize: 10, color: "#4b5563" }, children: formatDate(s.publishedAt) }),
|
|
5550
|
+
/* @__PURE__ */ jsx14(ClickableBadge, { clickable: !!liveUrl })
|
|
5551
|
+
] }),
|
|
5552
|
+
/* @__PURE__ */ jsx14("div", { style: { fontSize: 12, fontWeight: 700, color: "#1f2937", lineHeight: 1.4, marginBottom: 2 }, children: s.title }),
|
|
5553
|
+
/* @__PURE__ */ jsxs13("div", { style: { fontSize: 10, color: "#4b5563", fontFamily: "ui-monospace, SFMono-Regular, monospace", marginBottom: 6 }, children: [
|
|
5554
|
+
"/",
|
|
5555
|
+
s.slug
|
|
5556
|
+
] }),
|
|
5557
|
+
(liveUrl || sanityUrl) && /* @__PURE__ */ jsxs13("div", { style: { display: "flex", flexWrap: "wrap", gap: 6, marginBottom: 6 }, children: [
|
|
5558
|
+
sanityUrl && /* @__PURE__ */ jsx14(LinkChip, { href: sanityUrl, label: "Inside Sanity", color: MJH_BLUE }),
|
|
5559
|
+
liveUrl && /* @__PURE__ */ jsx14(LinkChip, { href: liveUrl, label: "Live site", color: "#4b5563" })
|
|
5560
|
+
] }),
|
|
5561
|
+
s.relevanceReason && /* @__PURE__ */ jsxs13("div", { style: { fontSize: 11, color: "#1f2937", marginBottom: 6, lineHeight: 1.45 }, children: [
|
|
5562
|
+
/* @__PURE__ */ jsx14("span", { style: { fontWeight: 700, color: "#4b5563" }, children: "Why it fits:" }),
|
|
5563
|
+
" ",
|
|
5564
|
+
/* @__PURE__ */ jsx14("span", { style: { fontStyle: "italic" }, children: s.relevanceReason })
|
|
5565
|
+
] }),
|
|
5566
|
+
s.anchorQuote && /* @__PURE__ */ jsxs13(
|
|
5567
|
+
"div",
|
|
5568
|
+
{
|
|
5569
|
+
style: {
|
|
5570
|
+
marginTop: 4,
|
|
5571
|
+
padding: "6px 9px",
|
|
5572
|
+
background: "rgba(0,0,0,0.025)",
|
|
5573
|
+
borderRadius: 6,
|
|
5574
|
+
borderLeft: "2px solid #cbd5e1",
|
|
5575
|
+
fontSize: 11,
|
|
5576
|
+
color: "#1f2937",
|
|
5577
|
+
lineHeight: 1.5
|
|
5578
|
+
},
|
|
5579
|
+
children: [
|
|
5580
|
+
/* @__PURE__ */ jsxs13("div", { style: { fontSize: 9, fontWeight: 700, color: "#4b5563", textTransform: "uppercase", letterSpacing: "0.05em", marginBottom: 3 }, children: [
|
|
5581
|
+
"Where to link from - paragraph ",
|
|
5582
|
+
s.anchorParagraph
|
|
5583
|
+
] }),
|
|
5584
|
+
/* @__PURE__ */ jsxs13("div", { style: { fontStyle: "italic" }, children: [
|
|
5585
|
+
'"',
|
|
5586
|
+
s.anchorQuote,
|
|
5587
|
+
'"'
|
|
5588
|
+
] }),
|
|
5589
|
+
s.anchorReason && /* @__PURE__ */ jsx14("div", { style: { fontSize: 10, color: "#4b5563", marginTop: 3, lineHeight: 1.45 }, children: s.anchorReason })
|
|
5590
|
+
]
|
|
5591
|
+
}
|
|
5592
|
+
)
|
|
5175
5593
|
] }),
|
|
5176
|
-
|
|
5177
|
-
|
|
5594
|
+
/* @__PURE__ */ jsx14("div", { style: { flexShrink: 0 }, children: /* @__PURE__ */ jsx14(
|
|
5595
|
+
FeedbackButton,
|
|
5178
5596
|
{
|
|
5179
|
-
|
|
5180
|
-
|
|
5181
|
-
|
|
5182
|
-
|
|
5183
|
-
borderRadius: 6,
|
|
5184
|
-
borderLeft: "2px solid #cbd5e1",
|
|
5185
|
-
fontSize: 11,
|
|
5186
|
-
color: "#1f2937",
|
|
5187
|
-
lineHeight: 1.5
|
|
5188
|
-
},
|
|
5189
|
-
children: [
|
|
5190
|
-
/* @__PURE__ */ jsxs12("div", { style: { fontSize: 9, fontWeight: 700, color: "#4b5563", textTransform: "uppercase", letterSpacing: "0.05em", marginBottom: 3 }, children: [
|
|
5191
|
-
"Where to link from - paragraph ",
|
|
5192
|
-
s.anchorParagraph
|
|
5193
|
-
] }),
|
|
5194
|
-
/* @__PURE__ */ jsxs12("div", { style: { fontStyle: "italic" }, children: [
|
|
5195
|
-
'"',
|
|
5196
|
-
s.anchorQuote,
|
|
5197
|
-
'"'
|
|
5198
|
-
] }),
|
|
5199
|
-
s.anchorReason && /* @__PURE__ */ jsx13("div", { style: { fontSize: 10, color: "#4b5563", marginTop: 3, lineHeight: 1.45 }, children: s.anchorReason })
|
|
5200
|
-
]
|
|
5597
|
+
suggestionType: "internal_link",
|
|
5598
|
+
suggestionText: s.title,
|
|
5599
|
+
publication,
|
|
5600
|
+
documentId
|
|
5201
5601
|
}
|
|
5202
|
-
)
|
|
5203
|
-
]
|
|
5204
|
-
|
|
5205
|
-
|
|
5206
|
-
|
|
5207
|
-
|
|
5208
|
-
suggestionText: s.title,
|
|
5209
|
-
publication,
|
|
5210
|
-
documentId
|
|
5211
|
-
}
|
|
5212
|
-
) })
|
|
5213
|
-
]
|
|
5214
|
-
},
|
|
5215
|
-
s._id
|
|
5216
|
-
)) })
|
|
5602
|
+
) })
|
|
5603
|
+
]
|
|
5604
|
+
},
|
|
5605
|
+
s._id
|
|
5606
|
+
);
|
|
5607
|
+
}) })
|
|
5217
5608
|
] }) });
|
|
5218
5609
|
}
|
|
5219
5610
|
|
|
5220
5611
|
// src/components/tabs/MetaTab.tsx
|
|
5221
5612
|
import { useMemo as useMemo3 } from "react";
|
|
5222
|
-
import { Fragment as
|
|
5613
|
+
import { Fragment as Fragment8, jsx as jsx15, jsxs as jsxs14 } from "react/jsx-runtime";
|
|
5614
|
+
var GOOGLE_EEAT_URL = "https://developers.google.com/search/docs/fundamentals/creating-helpful-content#eat";
|
|
5615
|
+
function ExternalLinkChip({ href, label }) {
|
|
5616
|
+
return /* @__PURE__ */ jsxs14(
|
|
5617
|
+
"a",
|
|
5618
|
+
{
|
|
5619
|
+
href,
|
|
5620
|
+
target: "_blank",
|
|
5621
|
+
rel: "noopener noreferrer",
|
|
5622
|
+
style: {
|
|
5623
|
+
display: "inline-flex",
|
|
5624
|
+
alignItems: "center",
|
|
5625
|
+
gap: 4,
|
|
5626
|
+
marginTop: 8,
|
|
5627
|
+
padding: "3px 9px",
|
|
5628
|
+
borderRadius: 99,
|
|
5629
|
+
fontSize: 10.5,
|
|
5630
|
+
fontWeight: 700,
|
|
5631
|
+
color: MJH_BLUE,
|
|
5632
|
+
background: "rgba(255,255,255,0.7)",
|
|
5633
|
+
border: `1px solid ${MJH_BLUE}33`,
|
|
5634
|
+
textDecoration: "none",
|
|
5635
|
+
lineHeight: 1.2
|
|
5636
|
+
},
|
|
5637
|
+
children: [
|
|
5638
|
+
label,
|
|
5639
|
+
/* @__PURE__ */ jsxs14("svg", { width: "9", height: "9", viewBox: "0 0 20 20", fill: "currentColor", "aria-hidden": "true", children: [
|
|
5640
|
+
/* @__PURE__ */ jsx15("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" }),
|
|
5641
|
+
/* @__PURE__ */ jsx15("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" })
|
|
5642
|
+
] })
|
|
5643
|
+
]
|
|
5644
|
+
}
|
|
5645
|
+
);
|
|
5646
|
+
}
|
|
5647
|
+
function FreshnessNotice() {
|
|
5648
|
+
return /* @__PURE__ */ jsxs14(
|
|
5649
|
+
"div",
|
|
5650
|
+
{
|
|
5651
|
+
style: {
|
|
5652
|
+
padding: "9px 12px",
|
|
5653
|
+
background: "rgba(0,93,172,0.05)",
|
|
5654
|
+
border: "1px solid rgba(0,93,172,0.15)",
|
|
5655
|
+
borderLeft: `3px solid ${MJH_BLUE}`,
|
|
5656
|
+
borderRadius: 8,
|
|
5657
|
+
fontSize: 11,
|
|
5658
|
+
color: "#1f2937",
|
|
5659
|
+
lineHeight: 1.5
|
|
5660
|
+
},
|
|
5661
|
+
children: [
|
|
5662
|
+
/* @__PURE__ */ jsx15("span", { style: { fontWeight: 700, color: MJH_BLUE }, children: "Keep it fresh. " }),
|
|
5663
|
+
"Planning to update this article after it's published? Set the ",
|
|
5664
|
+
/* @__PURE__ */ jsx15("strong", { children: "Updated on" }),
|
|
5665
|
+
" date in Sanity (e.g. \u201CUpdated: February 19, 2026\u201D). It surfaces the article in ",
|
|
5666
|
+
/* @__PURE__ */ jsx15("strong", { children: "Latest Updated Articles" }),
|
|
5667
|
+
" and increases its visibility in search engine results."
|
|
5668
|
+
]
|
|
5669
|
+
}
|
|
5670
|
+
);
|
|
5671
|
+
}
|
|
5223
5672
|
var cardStyle5 = {
|
|
5224
5673
|
borderRadius: 14,
|
|
5225
5674
|
background: "rgba(255,255,255,0.55)",
|
|
@@ -5235,7 +5684,7 @@ function StatusBadge({ status }) {
|
|
|
5235
5684
|
error: { bg: "rgba(220,38,38,0.1)", color: "#dc2626", label: "Fix" }
|
|
5236
5685
|
};
|
|
5237
5686
|
const c = map[status];
|
|
5238
|
-
return /* @__PURE__ */
|
|
5687
|
+
return /* @__PURE__ */ jsx15(
|
|
5239
5688
|
"span",
|
|
5240
5689
|
{
|
|
5241
5690
|
style: {
|
|
@@ -5254,12 +5703,12 @@ function StatusBadge({ status }) {
|
|
|
5254
5703
|
);
|
|
5255
5704
|
}
|
|
5256
5705
|
function AuditCard({ label, value, status, recommendation, anchorId, footer }) {
|
|
5257
|
-
return /* @__PURE__ */
|
|
5258
|
-
/* @__PURE__ */
|
|
5259
|
-
/* @__PURE__ */
|
|
5260
|
-
/* @__PURE__ */
|
|
5706
|
+
return /* @__PURE__ */ jsxs14("div", { id: anchorId, style: cardStyle5, children: [
|
|
5707
|
+
/* @__PURE__ */ jsxs14("div", { style: { display: "flex", alignItems: "center", justifyContent: "space-between", gap: 8, marginBottom: 6 }, children: [
|
|
5708
|
+
/* @__PURE__ */ jsx15("span", { style: { fontSize: 10.5, textTransform: "uppercase", letterSpacing: "0.06em", color: "#4b5563", fontWeight: 600 }, children: label }),
|
|
5709
|
+
/* @__PURE__ */ jsx15(StatusBadge, { status })
|
|
5261
5710
|
] }),
|
|
5262
|
-
/* @__PURE__ */
|
|
5711
|
+
/* @__PURE__ */ jsx15(
|
|
5263
5712
|
"div",
|
|
5264
5713
|
{
|
|
5265
5714
|
style: {
|
|
@@ -5272,7 +5721,7 @@ function AuditCard({ label, value, status, recommendation, anchorId, footer }) {
|
|
|
5272
5721
|
children: value
|
|
5273
5722
|
}
|
|
5274
5723
|
),
|
|
5275
|
-
recommendation && /* @__PURE__ */
|
|
5724
|
+
recommendation && /* @__PURE__ */ jsx15(
|
|
5276
5725
|
"div",
|
|
5277
5726
|
{
|
|
5278
5727
|
style: {
|
|
@@ -5421,41 +5870,66 @@ function MetaTab({ documentFields, primaryKeyword, secondaryKeyword, isLoading }
|
|
|
5421
5870
|
} else {
|
|
5422
5871
|
items.push({ label: "Author Byline", value: `${author}, ${creds}`, status: "good" });
|
|
5423
5872
|
}
|
|
5424
|
-
|
|
5425
|
-
const
|
|
5426
|
-
const
|
|
5427
|
-
|
|
5428
|
-
|
|
5429
|
-
|
|
5430
|
-
|
|
5431
|
-
if (!published) {
|
|
5432
|
-
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." });
|
|
5433
|
-
} else if (daysPub === null) {
|
|
5434
|
-
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." });
|
|
5873
|
+
items[0].footer = /* @__PURE__ */ jsx15(ExternalLinkChip, { href: GOOGLE_EEAT_URL, label: "Google's E-E-A-T guidelines" });
|
|
5874
|
+
const factChecker = documentFields?.factCheckerName;
|
|
5875
|
+
const factCheckerRef = documentFields?.factCheckerIsReference;
|
|
5876
|
+
if (factChecker) {
|
|
5877
|
+
items.push({ label: "Fact-Checker", value: factChecker, status: "good" });
|
|
5878
|
+
} else if (factCheckerRef) {
|
|
5879
|
+
items.push({ label: "Fact-Checker", value: "Set (reference)", status: "good", recommendation: "A fact-checker is linked as a reference. Open the linked person to confirm the name shows on the published page." });
|
|
5435
5880
|
} else {
|
|
5436
|
-
items.push({ label: "
|
|
5881
|
+
items.push({ label: "Fact-Checker", value: "Not set", status: "warning", recommendation: 'Add a second named person as a fact-checker, separate from the author. A visible "Fact checked by" line is a strong trust signal for healthcare content.' });
|
|
5437
5882
|
}
|
|
5438
|
-
|
|
5439
|
-
|
|
5440
|
-
|
|
5441
|
-
|
|
5442
|
-
|
|
5883
|
+
const dated = [];
|
|
5884
|
+
const addDate = (verb, days) => {
|
|
5885
|
+
if (days !== null) dated.push({ verb, days });
|
|
5886
|
+
};
|
|
5887
|
+
addDate("Updated", daysSince(documentFields?.updatedAt));
|
|
5888
|
+
addDate("Reviewed", daysSince(documentFields?.lastReviewedAt));
|
|
5889
|
+
addDate("Published", daysSince(documentFields?.publishedAt));
|
|
5890
|
+
if (dated.length > 0) {
|
|
5891
|
+
const freshest = dated.reduce((a, b) => b.days < a.days ? b : a);
|
|
5892
|
+
const days = freshest.days;
|
|
5893
|
+
const ago = days <= 0 ? "today" : days === 1 ? "1 day ago" : `${days} days ago`;
|
|
5894
|
+
const value = `${freshest.verb} ${ago}`;
|
|
5895
|
+
if (days <= 14) {
|
|
5896
|
+
items.push({ label: "Content Freshness", value, status: "good", recommendation: "Recent content gets cited and ranked more. Re-set the Updated-on date whenever you revise to keep it fresh." });
|
|
5897
|
+
} else if (days <= 90) {
|
|
5898
|
+
items.push({ label: "Content Freshness", value, status: "warning", recommendation: "Content older than two weeks gets cited less by AI search. If it's still accurate, refresh a stat and set the Updated-on date in Sanity." });
|
|
5443
5899
|
} else {
|
|
5444
|
-
items.push({ label: "
|
|
5900
|
+
items.push({ label: "Content Freshness", value, status: "error", recommendation: "Over 90 days old. Review the facts, update what's stale, and set the Updated-on date in Sanity." });
|
|
5445
5901
|
}
|
|
5446
5902
|
}
|
|
5447
5903
|
return items;
|
|
5448
5904
|
}, [documentFields]);
|
|
5905
|
+
const publishDateItem = useMemo3(() => {
|
|
5906
|
+
const published = documentFields?.publishedAt;
|
|
5907
|
+
const daysPub = daysSince(published);
|
|
5908
|
+
if (!published) return { 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." };
|
|
5909
|
+
if (daysPub === null) return { 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." };
|
|
5910
|
+
return { label: "Publish Date", value: formatDateShort(published), status: "good" };
|
|
5911
|
+
}, [documentFields]);
|
|
5449
5912
|
const hasAnyField = !!documentFields && (documentFields.title !== void 0 || documentFields.metaDescription !== void 0 || documentFields.slug !== void 0);
|
|
5450
5913
|
if (isLoading && !hasAnyField) {
|
|
5451
|
-
return /* @__PURE__ */
|
|
5452
|
-
/* @__PURE__ */
|
|
5453
|
-
/* @__PURE__ */
|
|
5914
|
+
return /* @__PURE__ */ jsxs14("div", { style: { padding: 24, textAlign: "center" }, children: [
|
|
5915
|
+
/* @__PURE__ */ jsx15("div", { style: { fontSize: 13, color: "#4b5563", fontWeight: 500 }, children: "Reading document fields..." }),
|
|
5916
|
+
/* @__PURE__ */ jsx15("div", { style: { fontSize: 11, color: "#4b5563", marginTop: 4 }, children: "Audit will run once content loads" })
|
|
5454
5917
|
] });
|
|
5455
5918
|
}
|
|
5456
5919
|
const auditAnchors = ["anchor-meta-title", "anchor-meta-description"];
|
|
5457
|
-
return /* @__PURE__ */
|
|
5458
|
-
|
|
5920
|
+
return /* @__PURE__ */ jsxs14("div", { style: { padding: 12, display: "flex", flexDirection: "column", gap: 10 }, children: [
|
|
5921
|
+
/* @__PURE__ */ jsx15(FreshnessNotice, {}),
|
|
5922
|
+
/* @__PURE__ */ jsx15(
|
|
5923
|
+
AuditCard,
|
|
5924
|
+
{
|
|
5925
|
+
anchorId: "anchor-publish-date",
|
|
5926
|
+
label: publishDateItem.label,
|
|
5927
|
+
value: publishDateItem.value,
|
|
5928
|
+
status: publishDateItem.status,
|
|
5929
|
+
recommendation: publishDateItem.recommendation
|
|
5930
|
+
}
|
|
5931
|
+
),
|
|
5932
|
+
audits.map((a, i) => /* @__PURE__ */ jsx15(
|
|
5459
5933
|
AuditCard,
|
|
5460
5934
|
{
|
|
5461
5935
|
anchorId: auditAnchors[i],
|
|
@@ -5466,20 +5940,21 @@ function MetaTab({ documentFields, primaryKeyword, secondaryKeyword, isLoading }
|
|
|
5466
5940
|
},
|
|
5467
5941
|
i
|
|
5468
5942
|
)),
|
|
5469
|
-
eeatItems.length > 0 && /* @__PURE__ */
|
|
5470
|
-
/* @__PURE__ */
|
|
5471
|
-
/* @__PURE__ */
|
|
5472
|
-
/* @__PURE__ */
|
|
5473
|
-
/* @__PURE__ */
|
|
5943
|
+
eeatItems.length > 0 && /* @__PURE__ */ jsxs14(Fragment8, { children: [
|
|
5944
|
+
/* @__PURE__ */ jsxs14("div", { style: { display: "flex", alignItems: "center", gap: 8, margin: "6px 4px 0" }, children: [
|
|
5945
|
+
/* @__PURE__ */ jsx15("div", { style: { height: 1, flex: 1, background: "rgba(0,0,0,0.06)" } }),
|
|
5946
|
+
/* @__PURE__ */ jsx15("span", { style: { fontSize: 10, fontWeight: 700, color: "#4b5563", textTransform: "uppercase", letterSpacing: "0.08em" }, children: "Author & Freshness" }),
|
|
5947
|
+
/* @__PURE__ */ jsx15("div", { style: { height: 1, flex: 1, background: "rgba(0,0,0,0.06)" } })
|
|
5474
5948
|
] }),
|
|
5475
|
-
/* @__PURE__ */
|
|
5476
|
-
eeatItems.map((item, i) => /* @__PURE__ */
|
|
5949
|
+
/* @__PURE__ */ jsx15("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." }),
|
|
5950
|
+
eeatItems.map((item, i) => /* @__PURE__ */ jsx15(
|
|
5477
5951
|
AuditCard,
|
|
5478
5952
|
{
|
|
5479
5953
|
label: item.label,
|
|
5480
5954
|
value: item.value,
|
|
5481
5955
|
status: item.status,
|
|
5482
|
-
recommendation: item.recommendation
|
|
5956
|
+
recommendation: item.recommendation,
|
|
5957
|
+
footer: item.footer
|
|
5483
5958
|
},
|
|
5484
5959
|
`eeat-${i}`
|
|
5485
5960
|
))
|
|
@@ -5488,8 +5963,8 @@ function MetaTab({ documentFields, primaryKeyword, secondaryKeyword, isLoading }
|
|
|
5488
5963
|
}
|
|
5489
5964
|
|
|
5490
5965
|
// src/components/tabs/TechnicalTab.tsx
|
|
5491
|
-
import { useMemo as useMemo4, useState as
|
|
5492
|
-
import { Fragment as
|
|
5966
|
+
import { useMemo as useMemo4, useState as useState16 } from "react";
|
|
5967
|
+
import { Fragment as Fragment9, jsx as jsx16, jsxs as jsxs15 } from "react/jsx-runtime";
|
|
5493
5968
|
function urlAudit(slug, primaryKeyword, secondaryKeyword) {
|
|
5494
5969
|
const SHORT_DESC = "Keep the URL short and descriptive - concise URLs are easier to read - and avoid trailing, duplicate, or excessive spaces.";
|
|
5495
5970
|
if (!slug) {
|
|
@@ -5524,28 +5999,28 @@ function urlAudit(slug, primaryKeyword, secondaryKeyword) {
|
|
|
5524
5999
|
return { label: "URL Slug", value: `/${slug}`, status: "good" };
|
|
5525
6000
|
}
|
|
5526
6001
|
function SlugRedirectNotice() {
|
|
5527
|
-
const [expanded, setExpanded] =
|
|
5528
|
-
return /* @__PURE__ */
|
|
5529
|
-
/* @__PURE__ */
|
|
5530
|
-
/* @__PURE__ */
|
|
5531
|
-
/* @__PURE__ */
|
|
6002
|
+
const [expanded, setExpanded] = useState16(false);
|
|
6003
|
+
return /* @__PURE__ */ jsx16("div", { style: { marginTop: 10, paddingTop: 10, borderTop: "1px solid rgba(0,0,0,0.07)" }, children: /* @__PURE__ */ jsxs15("div", { style: { padding: "8px 10px", background: "rgba(245,158,11,0.08)", borderLeft: "2px solid #f59e0b", borderRadius: 6 }, children: [
|
|
6004
|
+
/* @__PURE__ */ jsxs15("div", { style: { display: "flex", alignItems: "center", gap: 6, marginBottom: 4 }, children: [
|
|
6005
|
+
/* @__PURE__ */ jsx16("svg", { width: "12", height: "12", viewBox: "0 0 20 20", fill: "#f59e0b", "aria-hidden": "true", children: /* @__PURE__ */ jsx16("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" }) }),
|
|
6006
|
+
/* @__PURE__ */ jsx16("span", { style: { fontSize: 10.5, fontWeight: 700, color: "#b45309", textTransform: "uppercase", letterSpacing: "0.06em" }, children: "Changing a URL?" })
|
|
5532
6007
|
] }),
|
|
5533
|
-
/* @__PURE__ */
|
|
5534
|
-
/* @__PURE__ */
|
|
6008
|
+
/* @__PURE__ */ jsx16("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." }),
|
|
6009
|
+
/* @__PURE__ */ jsxs15(
|
|
5535
6010
|
"button",
|
|
5536
6011
|
{
|
|
5537
6012
|
onClick: () => setExpanded((v) => !v),
|
|
5538
6013
|
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" },
|
|
5539
6014
|
children: [
|
|
5540
6015
|
expanded ? "Show less" : "Learn more",
|
|
5541
|
-
/* @__PURE__ */
|
|
6016
|
+
/* @__PURE__ */ jsx16("svg", { width: "10", height: "10", viewBox: "0 0 20 20", fill: "currentColor", style: { transform: expanded ? "rotate(180deg)" : "none", transition: "transform 150ms" }, children: /* @__PURE__ */ jsx16("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" }) })
|
|
5542
6017
|
]
|
|
5543
6018
|
}
|
|
5544
6019
|
),
|
|
5545
|
-
expanded && /* @__PURE__ */
|
|
5546
|
-
/* @__PURE__ */
|
|
5547
|
-
/* @__PURE__ */
|
|
5548
|
-
/* @__PURE__ */
|
|
6020
|
+
expanded && /* @__PURE__ */ jsxs15("ul", { style: { margin: "6px 0 0", paddingLeft: 16, fontSize: 11, color: "#1f2937", lineHeight: 1.55 }, children: [
|
|
6021
|
+
/* @__PURE__ */ jsx16("li", { children: "Without the 301, the page loses every search ranking and every external link to it breaks." }),
|
|
6022
|
+
/* @__PURE__ */ jsx16("li", { children: "A 301 preserves the rankings and link equity built up on the old URL." }),
|
|
6023
|
+
/* @__PURE__ */ jsx16("li", { children: "Set this up using vanity redirects in Sanity." })
|
|
5549
6024
|
] })
|
|
5550
6025
|
] }) });
|
|
5551
6026
|
}
|
|
@@ -5564,7 +6039,7 @@ function StatusBadge2({ status }) {
|
|
|
5564
6039
|
error: { bg: "rgba(220,38,38,0.1)", color: "#dc2626", label: "Fix" }
|
|
5565
6040
|
};
|
|
5566
6041
|
const c = map[status];
|
|
5567
|
-
return /* @__PURE__ */
|
|
6042
|
+
return /* @__PURE__ */ jsx16(
|
|
5568
6043
|
"span",
|
|
5569
6044
|
{
|
|
5570
6045
|
style: {
|
|
@@ -5590,12 +6065,12 @@ function AuditCard2({
|
|
|
5590
6065
|
anchorId,
|
|
5591
6066
|
footer
|
|
5592
6067
|
}) {
|
|
5593
|
-
return /* @__PURE__ */
|
|
5594
|
-
/* @__PURE__ */
|
|
5595
|
-
/* @__PURE__ */
|
|
5596
|
-
/* @__PURE__ */
|
|
6068
|
+
return /* @__PURE__ */ jsxs15("div", { id: anchorId, style: cardStyle6, children: [
|
|
6069
|
+
/* @__PURE__ */ jsxs15("div", { style: { display: "flex", alignItems: "center", justifyContent: "space-between", gap: 8, marginBottom: 6 }, children: [
|
|
6070
|
+
/* @__PURE__ */ jsx16("span", { style: { fontSize: 10.5, textTransform: "uppercase", letterSpacing: "0.06em", color: "#4b5563", fontWeight: 600 }, children: label }),
|
|
6071
|
+
/* @__PURE__ */ jsx16(StatusBadge2, { status })
|
|
5597
6072
|
] }),
|
|
5598
|
-
/* @__PURE__ */
|
|
6073
|
+
/* @__PURE__ */ jsx16(
|
|
5599
6074
|
"div",
|
|
5600
6075
|
{
|
|
5601
6076
|
style: {
|
|
@@ -5608,7 +6083,7 @@ function AuditCard2({
|
|
|
5608
6083
|
children: value
|
|
5609
6084
|
}
|
|
5610
6085
|
),
|
|
5611
|
-
recommendation && /* @__PURE__ */
|
|
6086
|
+
recommendation && /* @__PURE__ */ jsx16(
|
|
5612
6087
|
"div",
|
|
5613
6088
|
{
|
|
5614
6089
|
style: {
|
|
@@ -5740,7 +6215,7 @@ function imageTitleAudit(titles, imageCount) {
|
|
|
5740
6215
|
status: "good"
|
|
5741
6216
|
};
|
|
5742
6217
|
}
|
|
5743
|
-
function computeHeadingStructureAudits(headings, wordCount2) {
|
|
6218
|
+
function computeHeadingStructureAudits(headings, wordCount2, primaryKeyword, secondaryKeyword, unstyledHeadings) {
|
|
5744
6219
|
const audits = [];
|
|
5745
6220
|
const sectionCount = headings.filter((h) => h.level === 2 || h.level === 3).length;
|
|
5746
6221
|
let densityFired = false;
|
|
@@ -5769,26 +6244,27 @@ function computeHeadingStructureAudits(headings, wordCount2) {
|
|
|
5769
6244
|
});
|
|
5770
6245
|
densityFired = true;
|
|
5771
6246
|
}
|
|
6247
|
+
if (unstyledHeadings && unstyledHeadings.length > 0) {
|
|
6248
|
+
const n = unstyledHeadings.length;
|
|
6249
|
+
const examples = unstyledHeadings.slice(0, 2).map((t) => `"${t}"`).join(", ");
|
|
6250
|
+
audits.push({
|
|
6251
|
+
label: "Looks Like a Heading",
|
|
6252
|
+
value: `${n} line${n === 1 ? "" : "s"} read${n === 1 ? "s" : ""} like a heading but ${n === 1 ? "isn't" : "aren't"} styled`,
|
|
6253
|
+
status: "warning",
|
|
6254
|
+
recommendation: `${examples}${n > 2 ? ", and more," : ""} ${n === 1 ? "looks" : "look"} like a section heading typed as plain text. In Sanity, select the line and apply the "Heading 2" style so it counts as a real heading.`
|
|
6255
|
+
});
|
|
6256
|
+
}
|
|
5772
6257
|
if (headings.length === 0) {
|
|
5773
6258
|
if (!densityFired) {
|
|
5774
6259
|
audits.push({
|
|
5775
6260
|
label: "Heading Structure",
|
|
5776
6261
|
value: "No headings in body",
|
|
5777
6262
|
status: "warning",
|
|
5778
|
-
recommendation: "
|
|
6263
|
+
recommendation: "Consider adding H2-H6 subheadings to structure the article into scannable sections."
|
|
5779
6264
|
});
|
|
5780
6265
|
}
|
|
5781
6266
|
return audits;
|
|
5782
6267
|
}
|
|
5783
|
-
const h1s = headings.filter((h) => h.level === 1);
|
|
5784
|
-
if (h1s.length > 0) {
|
|
5785
|
-
audits.push({
|
|
5786
|
-
label: "H1 in body",
|
|
5787
|
-
value: `${h1s.length} H1 heading${h1s.length === 1 ? "" : "s"} in the body`,
|
|
5788
|
-
status: "warning",
|
|
5789
|
-
recommendation: "The article title is your H1. Body headings should start at H2 so the outline isn't ambiguous."
|
|
5790
|
-
});
|
|
5791
|
-
}
|
|
5792
6268
|
let prevLevel = 0;
|
|
5793
6269
|
const skips = [];
|
|
5794
6270
|
for (const h of headings) {
|
|
@@ -5822,266 +6298,171 @@ function computeHeadingStructureAudits(headings, wordCount2) {
|
|
|
5822
6298
|
status: "good"
|
|
5823
6299
|
});
|
|
5824
6300
|
}
|
|
6301
|
+
const subheads = headings.filter((h) => h.level >= 2);
|
|
6302
|
+
const subheadingText = subheads.map((h) => h.text).join(" ");
|
|
6303
|
+
const hasPrimaryInHeads = primaryKeyword ? containsKeywordTokens(subheadingText, primaryKeyword) : false;
|
|
6304
|
+
const hasSecondaryInHeads = secondaryKeyword ? containsKeywordTokens(subheadingText, secondaryKeyword) : false;
|
|
6305
|
+
if (subheads.length > 0 && (primaryKeyword || secondaryKeyword) && !hasPrimaryInHeads && !hasSecondaryInHeads) {
|
|
6306
|
+
const kw = [
|
|
6307
|
+
primaryKeyword ? `primary keyword "${primaryKeyword}"` : "",
|
|
6308
|
+
secondaryKeyword ? `secondary keyword "${secondaryKeyword}"` : ""
|
|
6309
|
+
].filter(Boolean).join(" or ");
|
|
6310
|
+
audits.push({
|
|
6311
|
+
label: "Keywords in Headings",
|
|
6312
|
+
value: "No subheading uses your target keyword",
|
|
6313
|
+
status: "warning",
|
|
6314
|
+
recommendation: `Work your ${kw} into at least one H2 or H3. Keywords in headers reinforce relevance for readers and search engines.`
|
|
6315
|
+
});
|
|
6316
|
+
}
|
|
5825
6317
|
return audits;
|
|
5826
6318
|
}
|
|
6319
|
+
function HealthBadge({ result }) {
|
|
6320
|
+
const map = {
|
|
6321
|
+
ok: { color: "#16a34a", label: "OK" },
|
|
6322
|
+
redirect: { color: "#8B7310", label: result.status > 0 ? String(result.status) : "REDIR" },
|
|
6323
|
+
broken: { color: "#dc2626", label: result.status > 0 ? String(result.status) : "404" },
|
|
6324
|
+
unverified: { color: "#b45309", label: result.status > 0 ? String(result.status) : "BLOCKED" },
|
|
6325
|
+
error: { color: "#dc2626", label: "ERR" }
|
|
6326
|
+
};
|
|
6327
|
+
const c = map[result.category];
|
|
6328
|
+
return /* @__PURE__ */ jsx16("span", { style: { fontSize: 9, fontWeight: 700, letterSpacing: "0.04em", padding: "2px 6px", borderRadius: 99, background: "#ffffff", color: c.color, fontVariantNumeric: "tabular-nums", flexShrink: 0, marginTop: 1 }, children: c.label });
|
|
6329
|
+
}
|
|
5827
6330
|
function LinkCheckCard({
|
|
5828
6331
|
urls,
|
|
6332
|
+
linksDetailed,
|
|
5829
6333
|
results,
|
|
5830
6334
|
isLoading,
|
|
5831
6335
|
error,
|
|
5832
6336
|
hasRun,
|
|
5833
6337
|
onCheck
|
|
5834
6338
|
}) {
|
|
5835
|
-
const
|
|
5836
|
-
|
|
5837
|
-
|
|
5838
|
-
|
|
5839
|
-
|
|
5840
|
-
|
|
5841
|
-
|
|
5842
|
-
|
|
5843
|
-
|
|
5844
|
-
|
|
5845
|
-
|
|
5846
|
-
|
|
5847
|
-
|
|
5848
|
-
|
|
5849
|
-
|
|
5850
|
-
|
|
5851
|
-
|
|
5852
|
-
|
|
5853
|
-
|
|
5854
|
-
|
|
5855
|
-
|
|
5856
|
-
|
|
5857
|
-
|
|
5858
|
-
|
|
5859
|
-
|
|
5860
|
-
|
|
5861
|
-
title: "Run again",
|
|
5862
|
-
children: "Re-check"
|
|
5863
|
-
}
|
|
5864
|
-
)
|
|
5865
|
-
] }),
|
|
5866
|
-
/* @__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.` }),
|
|
5867
|
-
urls.length > 0 && !hasRun && !isLoading && /* @__PURE__ */ jsxs14(
|
|
5868
|
-
"button",
|
|
6339
|
+
const [openBucket, setOpenBucket] = useState16(null);
|
|
6340
|
+
const haveTypes = !!linksDetailed;
|
|
6341
|
+
const detailByUrl = useMemo4(
|
|
6342
|
+
() => new Map((linksDetailed || []).map((d) => [d.url, d])),
|
|
6343
|
+
[linksDetailed]
|
|
6344
|
+
);
|
|
6345
|
+
const resultByUrl = useMemo4(() => new Map(results.map((r) => [r.url, r])), [results]);
|
|
6346
|
+
const blockedUrls = results.filter((r) => r.category === "unverified").map((r) => r.url);
|
|
6347
|
+
const tiles = useMemo4(() => {
|
|
6348
|
+
const hyper = (linksDetailed || []).filter((l) => l.hyperlinked).map((l) => l.url);
|
|
6349
|
+
const plain = (linksDetailed || []).filter((l) => !l.hyperlinked).map((l) => l.url);
|
|
6350
|
+
const working = results.filter((r) => r.category === "ok" || r.category === "redirect").map((r) => r.url);
|
|
6351
|
+
const broken = results.filter((r) => r.category === "broken" || r.category === "error").map((r) => r.url);
|
|
6352
|
+
const t = [];
|
|
6353
|
+
if (hasRun) t.push({ key: "working", label: "Working", color: "#16a34a", urls: working });
|
|
6354
|
+
if (haveTypes) t.push({ key: "linked", label: "Linked", color: "#16a34a", urls: hyper });
|
|
6355
|
+
if (hasRun) t.push({ key: "broken", label: "Broken", color: "#dc2626", urls: broken });
|
|
6356
|
+
if (haveTypes) t.push({ key: "notlinked", label: "Not linked", color: "#dc2626", urls: plain, note: "Not links yet - hyperlink these so readers can click them and search engines can follow them." });
|
|
6357
|
+
return t;
|
|
6358
|
+
}, [haveTypes, linksDetailed, hasRun, results]);
|
|
6359
|
+
const open = tiles.find((t) => t.key === openBucket) || null;
|
|
6360
|
+
const renderLinkRow = (url) => {
|
|
6361
|
+
const d = detailByUrl.get(url);
|
|
6362
|
+
const r = resultByUrl.get(url);
|
|
6363
|
+
return /* @__PURE__ */ jsxs15(
|
|
6364
|
+
"a",
|
|
5869
6365
|
{
|
|
5870
|
-
|
|
5871
|
-
|
|
5872
|
-
|
|
5873
|
-
|
|
5874
|
-
fontSize: 11,
|
|
5875
|
-
fontWeight: 700,
|
|
5876
|
-
color: "#1f2937",
|
|
5877
|
-
background: MJH_GOLD,
|
|
5878
|
-
border: "none",
|
|
5879
|
-
borderRadius: 6,
|
|
5880
|
-
cursor: "pointer",
|
|
5881
|
-
letterSpacing: "0.01em"
|
|
5882
|
-
},
|
|
6366
|
+
href: url,
|
|
6367
|
+
target: "_blank",
|
|
6368
|
+
rel: "noopener noreferrer",
|
|
6369
|
+
style: { display: "flex", gap: 8, alignItems: "flex-start", padding: "6px 8px", background: "rgba(0,0,0,0.025)", borderRadius: 6, textDecoration: "none", marginTop: 4 },
|
|
5883
6370
|
children: [
|
|
5884
|
-
|
|
5885
|
-
|
|
5886
|
-
|
|
5887
|
-
|
|
5888
|
-
|
|
6371
|
+
r && /* @__PURE__ */ jsx16(HealthBadge, { result: r }),
|
|
6372
|
+
/* @__PURE__ */ jsxs15("div", { style: { minWidth: 0, flex: 1 }, children: [
|
|
6373
|
+
d?.anchorText && /* @__PURE__ */ jsxs15("div", { style: { fontSize: 11, color: "#1f2937", fontWeight: 600, lineHeight: 1.3, overflow: "hidden", textOverflow: "ellipsis", whiteSpace: "nowrap" }, children: [
|
|
6374
|
+
"\u201C",
|
|
6375
|
+
d.anchorText,
|
|
6376
|
+
"\u201D"
|
|
6377
|
+
] }),
|
|
6378
|
+
/* @__PURE__ */ jsx16("div", { style: { fontSize: 10, color: "#4b5563", fontFamily: "ui-monospace, SFMono-Regular, monospace", wordBreak: "break-all", lineHeight: 1.35 }, children: url })
|
|
6379
|
+
] })
|
|
5889
6380
|
]
|
|
5890
|
-
}
|
|
5891
|
-
|
|
5892
|
-
|
|
5893
|
-
|
|
5894
|
-
|
|
5895
|
-
|
|
6381
|
+
},
|
|
6382
|
+
url
|
|
6383
|
+
);
|
|
6384
|
+
};
|
|
6385
|
+
return /* @__PURE__ */ jsxs15("div", { id: "anchor-link-check", style: cardStyle6, children: [
|
|
6386
|
+
/* @__PURE__ */ jsxs15("div", { style: { display: "flex", alignItems: "center", justifyContent: "space-between", gap: 8, marginBottom: 6 }, children: [
|
|
6387
|
+
/* @__PURE__ */ jsx16("span", { style: { fontSize: 10.5, textTransform: "uppercase", letterSpacing: "0.06em", color: "#4b5563", fontWeight: 600 }, children: "Link Health" }),
|
|
6388
|
+
hasRun && !isLoading && /* @__PURE__ */ jsx16("button", { onClick: onCheck, style: { background: "none", border: "none", fontSize: 10, fontWeight: 600, color: MJH_BLUE, cursor: "pointer", padding: "2px 4px" }, title: "Run again", children: "Re-check" })
|
|
6389
|
+
] }),
|
|
6390
|
+
urls.length === 0 ? /* @__PURE__ */ jsx16("div", { style: { fontSize: 11, color: "#4b5563", lineHeight: 1.5 }, children: "No links found in the body." }) : /* @__PURE__ */ jsxs15(Fragment9, { children: [
|
|
6391
|
+
/* @__PURE__ */ jsxs15("div", { style: { fontSize: 11, color: "#4b5563", lineHeight: 1.5, marginBottom: 10 }, children: [
|
|
5896
6392
|
urls.length,
|
|
5897
6393
|
" link",
|
|
5898
6394
|
urls.length === 1 ? "" : "s",
|
|
5899
|
-
"
|
|
5900
|
-
|
|
5901
|
-
] }),
|
|
5902
|
-
error && !isLoading && /* @__PURE__ */ jsxs14(
|
|
5903
|
-
"div",
|
|
5904
|
-
{
|
|
5905
|
-
style: {
|
|
5906
|
-
padding: "10px 12px",
|
|
5907
|
-
background: "rgba(220,38,38,0.04)",
|
|
5908
|
-
border: "1px solid rgba(220,38,38,0.18)",
|
|
5909
|
-
borderRadius: 8,
|
|
5910
|
-
fontSize: 11,
|
|
5911
|
-
color: "#b91c1c",
|
|
5912
|
-
lineHeight: 1.5
|
|
5913
|
-
},
|
|
5914
|
-
children: [
|
|
5915
|
-
error,
|
|
5916
|
-
/* @__PURE__ */ jsx15(
|
|
5917
|
-
"button",
|
|
5918
|
-
{
|
|
5919
|
-
onClick: onCheck,
|
|
5920
|
-
style: {
|
|
5921
|
-
display: "block",
|
|
5922
|
-
marginTop: 6,
|
|
5923
|
-
padding: "4px 10px",
|
|
5924
|
-
fontSize: 11,
|
|
5925
|
-
fontWeight: 700,
|
|
5926
|
-
color: "#ffffff",
|
|
5927
|
-
background: "#dc2626",
|
|
5928
|
-
border: "none",
|
|
5929
|
-
borderRadius: 5,
|
|
5930
|
-
cursor: "pointer"
|
|
5931
|
-
},
|
|
5932
|
-
children: "Try again"
|
|
5933
|
-
}
|
|
5934
|
-
)
|
|
5935
|
-
]
|
|
5936
|
-
}
|
|
5937
|
-
),
|
|
5938
|
-
hasRun && !isLoading && !error && /* @__PURE__ */ jsxs14(Fragment8, { children: [
|
|
5939
|
-
/* @__PURE__ */ jsxs14("div", { style: { display: "grid", gridTemplateColumns: counts.unverified > 0 ? "repeat(5, 1fr)" : "repeat(4, 1fr)", gap: 6 }, children: [
|
|
5940
|
-
/* @__PURE__ */ jsx15(StatTile, { label: "Checked", value: counts.total, color: "#475569" }),
|
|
5941
|
-
/* @__PURE__ */ jsx15(StatTile, { label: "Valid", value: counts.valid, color: "#16a34a" }),
|
|
5942
|
-
/* @__PURE__ */ jsx15(StatTile, { label: "Redirects", value: counts.redirects, color: "#8B7310" }),
|
|
5943
|
-
/* @__PURE__ */ jsx15(StatTile, { label: "Broken", value: counts.broken + counts.errored, color: "#dc2626" }),
|
|
5944
|
-
counts.unverified > 0 && /* @__PURE__ */ jsx15(StatTile, { label: "Blocked", value: counts.unverified, color: "#b45309" })
|
|
6395
|
+
" in the body.",
|
|
6396
|
+
tiles.length > 0 ? " Tap a box to see which." : ""
|
|
5945
6397
|
] }),
|
|
5946
|
-
|
|
5947
|
-
|
|
5948
|
-
|
|
5949
|
-
|
|
5950
|
-
|
|
5951
|
-
|
|
5952
|
-
|
|
5953
|
-
|
|
5954
|
-
|
|
5955
|
-
|
|
5956
|
-
|
|
5957
|
-
|
|
6398
|
+
tiles.length > 0 && /* @__PURE__ */ jsx16("div", { style: { display: "grid", gridTemplateColumns: "repeat(2, 1fr)", gap: 6 }, children: tiles.map((t) => {
|
|
6399
|
+
const empty = t.urls.length === 0;
|
|
6400
|
+
const active = openBucket === t.key && !empty;
|
|
6401
|
+
return /* @__PURE__ */ jsxs15(
|
|
6402
|
+
"button",
|
|
6403
|
+
{
|
|
6404
|
+
type: "button",
|
|
6405
|
+
onClick: () => !empty && setOpenBucket(active ? null : t.key),
|
|
6406
|
+
"aria-expanded": active,
|
|
6407
|
+
"aria-label": `${t.urls.length} ${t.label} links`,
|
|
6408
|
+
style: {
|
|
6409
|
+
padding: "8px 4px",
|
|
6410
|
+
background: active ? "rgba(0,93,172,0.08)" : "rgba(0,0,0,0.025)",
|
|
6411
|
+
border: active ? `1px solid ${MJH_BLUE}55` : "1px solid transparent",
|
|
6412
|
+
borderRadius: 8,
|
|
6413
|
+
textAlign: "center",
|
|
6414
|
+
cursor: empty ? "default" : "pointer",
|
|
6415
|
+
opacity: empty ? 0.5 : 1
|
|
6416
|
+
},
|
|
6417
|
+
children: [
|
|
6418
|
+
/* @__PURE__ */ jsx16("div", { style: { fontSize: 18, fontWeight: 700, color: t.color, fontVariantNumeric: "tabular-nums", lineHeight: 1 }, children: t.urls.length }),
|
|
6419
|
+
/* @__PURE__ */ jsx16("div", { style: { fontSize: 9, fontWeight: 700, color: "#4b5563", textTransform: "uppercase", letterSpacing: "0.05em", marginTop: 4 }, children: t.label })
|
|
6420
|
+
]
|
|
5958
6421
|
},
|
|
6422
|
+
t.key
|
|
6423
|
+
);
|
|
6424
|
+
}) }),
|
|
6425
|
+
open && open.urls.length > 0 && /* @__PURE__ */ jsxs15("div", { style: { marginTop: 8 }, children: [
|
|
6426
|
+
open.note && /* @__PURE__ */ jsx16("div", { style: { fontSize: 10.5, color: "#92400e", background: "rgba(245,158,11,0.08)", border: "1px solid rgba(245,158,11,0.25)", borderRadius: 6, padding: "6px 9px", lineHeight: 1.45, marginBottom: 2 }, children: open.note }),
|
|
6427
|
+
open.urls.map(renderLinkRow)
|
|
6428
|
+
] }),
|
|
6429
|
+
hasRun && blockedUrls.length > 0 && /* @__PURE__ */ jsxs15("div", { style: { marginTop: 8, padding: "6px 10px", background: "rgba(245,158,11,0.08)", border: "1px solid rgba(245,158,11,0.25)", borderRadius: 6, fontSize: 10.5, color: "#92400e", lineHeight: 1.45 }, children: [
|
|
6430
|
+
blockedUrls.length,
|
|
6431
|
+
" link",
|
|
6432
|
+
blockedUrls.length === 1 ? "" : "s",
|
|
6433
|
+
" couldn't be auto-checked (the destination blocks our checker) - open them to confirm."
|
|
6434
|
+
] }),
|
|
6435
|
+
!hasRun && !isLoading && /* @__PURE__ */ jsxs15(
|
|
6436
|
+
"button",
|
|
6437
|
+
{
|
|
6438
|
+
onClick: onCheck,
|
|
6439
|
+
style: { width: "100%", marginTop: 10, padding: "8px 12px", fontSize: 11, fontWeight: 700, color: "#1f2937", background: MJH_GOLD, border: "none", borderRadius: 6, cursor: "pointer", letterSpacing: "0.01em" },
|
|
5959
6440
|
children: [
|
|
5960
|
-
|
|
6441
|
+
"Check ",
|
|
6442
|
+
urls.length,
|
|
5961
6443
|
" link",
|
|
5962
|
-
|
|
5963
|
-
"
|
|
6444
|
+
urls.length === 1 ? "" : "s",
|
|
6445
|
+
" for broken / redirects"
|
|
5964
6446
|
]
|
|
5965
6447
|
}
|
|
5966
6448
|
),
|
|
5967
|
-
|
|
5968
|
-
/* @__PURE__ */
|
|
5969
|
-
|
|
6449
|
+
isLoading && /* @__PURE__ */ jsxs15("div", { style: { display: "flex", alignItems: "center", justifyContent: "center", gap: 8, padding: "16px 0" }, children: [
|
|
6450
|
+
/* @__PURE__ */ jsx16(LoadingBars, { size: "xs", color: MJH_BLUE }),
|
|
6451
|
+
/* @__PURE__ */ jsxs15("span", { style: { fontSize: 11, color: "#4b5563" }, children: [
|
|
6452
|
+
"Checking ",
|
|
6453
|
+
urls.length,
|
|
5970
6454
|
" link",
|
|
5971
|
-
|
|
5972
|
-
"
|
|
5973
|
-
|
|
5974
|
-
|
|
5975
|
-
|
|
5976
|
-
|
|
5977
|
-
|
|
5978
|
-
|
|
5979
|
-
{
|
|
5980
|
-
style: {
|
|
5981
|
-
marginTop: 12,
|
|
5982
|
-
padding: "8px 10px",
|
|
5983
|
-
background: "rgba(22,163,74,0.05)",
|
|
5984
|
-
border: "1px solid rgba(22,163,74,0.15)",
|
|
5985
|
-
borderRadius: 8,
|
|
5986
|
-
fontSize: 11,
|
|
5987
|
-
color: "#16a34a",
|
|
5988
|
-
fontWeight: 600,
|
|
5989
|
-
textAlign: "center"
|
|
5990
|
-
},
|
|
5991
|
-
children: [
|
|
5992
|
-
"All ",
|
|
5993
|
-
counts.total,
|
|
5994
|
-
" link",
|
|
5995
|
-
counts.total === 1 ? "" : "s",
|
|
5996
|
-
" resolve cleanly."
|
|
5997
|
-
]
|
|
5998
|
-
}
|
|
5999
|
-
)
|
|
6455
|
+
urls.length === 1 ? "" : "s",
|
|
6456
|
+
"..."
|
|
6457
|
+
] })
|
|
6458
|
+
] }),
|
|
6459
|
+
error && !isLoading && /* @__PURE__ */ jsxs15("div", { style: { marginTop: 10, padding: "10px 12px", background: "rgba(220,38,38,0.04)", border: "1px solid rgba(220,38,38,0.18)", borderRadius: 8, fontSize: 11, color: "#b91c1c", lineHeight: 1.5 }, children: [
|
|
6460
|
+
error,
|
|
6461
|
+
/* @__PURE__ */ jsx16("button", { onClick: onCheck, style: { display: "block", marginTop: 6, padding: "4px 10px", fontSize: 11, fontWeight: 700, color: "#ffffff", background: "#dc2626", border: "none", borderRadius: 5, cursor: "pointer" }, children: "Try again" })
|
|
6462
|
+
] })
|
|
6000
6463
|
] })
|
|
6001
6464
|
] });
|
|
6002
6465
|
}
|
|
6003
|
-
function StatTile({ label, value, color }) {
|
|
6004
|
-
return /* @__PURE__ */ jsxs14(
|
|
6005
|
-
"div",
|
|
6006
|
-
{
|
|
6007
|
-
style: {
|
|
6008
|
-
padding: "8px 4px",
|
|
6009
|
-
background: "rgba(0,0,0,0.025)",
|
|
6010
|
-
borderRadius: 8,
|
|
6011
|
-
textAlign: "center"
|
|
6012
|
-
},
|
|
6013
|
-
children: [
|
|
6014
|
-
/* @__PURE__ */ jsx15("div", { style: { fontSize: 18, fontWeight: 700, color, fontVariantNumeric: "tabular-nums", lineHeight: 1 }, children: value }),
|
|
6015
|
-
/* @__PURE__ */ jsx15("div", { style: { fontSize: 9, fontWeight: 700, color: "#4b5563", textTransform: "uppercase", letterSpacing: "0.06em", marginTop: 4 }, children: label })
|
|
6016
|
-
]
|
|
6017
|
-
}
|
|
6018
|
-
);
|
|
6019
|
-
}
|
|
6020
|
-
function LinkIssueRow({ result }) {
|
|
6021
|
-
const map = {
|
|
6022
|
-
ok: { bg: "rgba(22,163,74,0.06)", color: "#16a34a", label: "OK" },
|
|
6023
|
-
redirect: { bg: "rgba(230,192,27,0.12)", color: "#8B7310", label: result.status > 0 ? String(result.status) : "REDIR" },
|
|
6024
|
-
broken: { bg: "rgba(220,38,38,0.06)", color: "#dc2626", label: result.status > 0 ? String(result.status) : "404" },
|
|
6025
|
-
// Amber for unverified - the link may work fine, our server just couldn't confirm.
|
|
6026
|
-
unverified: { bg: "rgba(245,158,11,0.10)", color: "#b45309", label: result.status > 0 ? String(result.status) : "BLOCKED" },
|
|
6027
|
-
error: { bg: "rgba(220,38,38,0.06)", color: "#dc2626", label: "ERR" }
|
|
6028
|
-
};
|
|
6029
|
-
const c = map[result.category];
|
|
6030
|
-
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;
|
|
6031
|
-
return /* @__PURE__ */ jsxs14(
|
|
6032
|
-
"a",
|
|
6033
|
-
{
|
|
6034
|
-
href: result.url,
|
|
6035
|
-
target: "_blank",
|
|
6036
|
-
rel: "noopener noreferrer",
|
|
6037
|
-
style: {
|
|
6038
|
-
display: "flex",
|
|
6039
|
-
alignItems: "center",
|
|
6040
|
-
gap: 8,
|
|
6041
|
-
padding: "6px 10px",
|
|
6042
|
-
background: c.bg,
|
|
6043
|
-
borderRadius: 6,
|
|
6044
|
-
textDecoration: "none"
|
|
6045
|
-
},
|
|
6046
|
-
children: [
|
|
6047
|
-
/* @__PURE__ */ jsx15(
|
|
6048
|
-
"span",
|
|
6049
|
-
{
|
|
6050
|
-
style: {
|
|
6051
|
-
fontSize: 9,
|
|
6052
|
-
fontWeight: 700,
|
|
6053
|
-
letterSpacing: "0.04em",
|
|
6054
|
-
padding: "2px 6px",
|
|
6055
|
-
borderRadius: 99,
|
|
6056
|
-
background: "#ffffff",
|
|
6057
|
-
color: c.color,
|
|
6058
|
-
fontVariantNumeric: "tabular-nums",
|
|
6059
|
-
flexShrink: 0
|
|
6060
|
-
},
|
|
6061
|
-
children: c.label
|
|
6062
|
-
}
|
|
6063
|
-
),
|
|
6064
|
-
/* @__PURE__ */ jsx15(
|
|
6065
|
-
"span",
|
|
6066
|
-
{
|
|
6067
|
-
style: {
|
|
6068
|
-
fontSize: 11,
|
|
6069
|
-
color: "#1f2937",
|
|
6070
|
-
fontFamily: "ui-monospace, SFMono-Regular, monospace",
|
|
6071
|
-
flex: 1,
|
|
6072
|
-
minWidth: 0,
|
|
6073
|
-
overflow: "hidden",
|
|
6074
|
-
textOverflow: "ellipsis",
|
|
6075
|
-
whiteSpace: "nowrap"
|
|
6076
|
-
},
|
|
6077
|
-
title: tooltip,
|
|
6078
|
-
children: result.url
|
|
6079
|
-
}
|
|
6080
|
-
)
|
|
6081
|
-
]
|
|
6082
|
-
}
|
|
6083
|
-
);
|
|
6084
|
-
}
|
|
6085
6466
|
function TechnicalTab({
|
|
6086
6467
|
text,
|
|
6087
6468
|
documentFields,
|
|
@@ -6106,8 +6487,8 @@ function TechnicalTab({
|
|
|
6106
6487
|
);
|
|
6107
6488
|
const wordCount2 = text ? text.split(/\s+/).filter(Boolean).length : 0;
|
|
6108
6489
|
const structureAudits = useMemo4(
|
|
6109
|
-
() => computeHeadingStructureAudits(headingsForStructure, wordCount2),
|
|
6110
|
-
[headingsForStructure, wordCount2]
|
|
6490
|
+
() => computeHeadingStructureAudits(headingsForStructure, wordCount2, primaryKeyword, secondaryKeyword, documentFields?.unstyledHeadings),
|
|
6491
|
+
[headingsForStructure, wordCount2, primaryKeyword, secondaryKeyword, documentFields?.unstyledHeadings]
|
|
6111
6492
|
);
|
|
6112
6493
|
const imageNames = documentFields?.imageNames || [];
|
|
6113
6494
|
const { filenames: imageFilenames, altTexts: imageAltTexts } = useMemo4(
|
|
@@ -6148,15 +6529,16 @@ function TechnicalTab({
|
|
|
6148
6529
|
recommendation: "Above the 450-word floor. For competitive clinical content, push past 1,500 words."
|
|
6149
6530
|
} : { label: "Word Count", value: `${wordCount2} words`, status: "good" };
|
|
6150
6531
|
const bodyLinks = documentFields?.bodyLinks || [];
|
|
6532
|
+
const bodyLinksDetailed = documentFields?.bodyLinksDetailed;
|
|
6151
6533
|
const hasAnyField = !!documentFields && (documentFields.title !== void 0 || documentFields.headings && documentFields.headings.length > 0 || documentFields.imageNames && documentFields.imageNames.length > 0 || wordCount2 > 0);
|
|
6152
6534
|
if (isLoading && !hasAnyField) {
|
|
6153
|
-
return /* @__PURE__ */
|
|
6154
|
-
/* @__PURE__ */
|
|
6155
|
-
/* @__PURE__ */
|
|
6535
|
+
return /* @__PURE__ */ jsxs15("div", { style: { padding: 24, textAlign: "center" }, children: [
|
|
6536
|
+
/* @__PURE__ */ jsx16("div", { style: { fontSize: 13, color: "#4b5563", fontWeight: 500 }, children: "Reading document fields..." }),
|
|
6537
|
+
/* @__PURE__ */ jsx16("div", { style: { fontSize: 11, color: "#4b5563", marginTop: 4 }, children: "Audit will run once content loads" })
|
|
6156
6538
|
] });
|
|
6157
6539
|
}
|
|
6158
|
-
return /* @__PURE__ */
|
|
6159
|
-
/* @__PURE__ */
|
|
6540
|
+
return /* @__PURE__ */ jsxs15("div", { style: { padding: 12, display: "flex", flexDirection: "column", gap: 10 }, children: [
|
|
6541
|
+
/* @__PURE__ */ jsx16(
|
|
6160
6542
|
AuditCard2,
|
|
6161
6543
|
{
|
|
6162
6544
|
anchorId: "anchor-url-slug",
|
|
@@ -6164,10 +6546,22 @@ function TechnicalTab({
|
|
|
6164
6546
|
value: urlSlugAudit.value,
|
|
6165
6547
|
status: urlSlugAudit.status,
|
|
6166
6548
|
recommendation: urlSlugAudit.recommendation,
|
|
6167
|
-
footer: /* @__PURE__ */
|
|
6549
|
+
footer: /* @__PURE__ */ jsx16(SlugRedirectNotice, {})
|
|
6550
|
+
}
|
|
6551
|
+
),
|
|
6552
|
+
/* @__PURE__ */ jsx16(
|
|
6553
|
+
LinkCheckCard,
|
|
6554
|
+
{
|
|
6555
|
+
urls: bodyLinks,
|
|
6556
|
+
linksDetailed: bodyLinksDetailed,
|
|
6557
|
+
results: linkCheckResults,
|
|
6558
|
+
isLoading: isLinkCheckLoading,
|
|
6559
|
+
error: linkCheckError,
|
|
6560
|
+
hasRun: hasRunLinkCheck,
|
|
6561
|
+
onCheck: onCheckLinks
|
|
6168
6562
|
}
|
|
6169
6563
|
),
|
|
6170
|
-
wordAudit && /* @__PURE__ */
|
|
6564
|
+
wordAudit && /* @__PURE__ */ jsx16(
|
|
6171
6565
|
AuditCard2,
|
|
6172
6566
|
{
|
|
6173
6567
|
anchorId: "anchor-word-count",
|
|
@@ -6177,48 +6571,63 @@ function TechnicalTab({
|
|
|
6177
6571
|
recommendation: wordAudit.recommendation
|
|
6178
6572
|
}
|
|
6179
6573
|
),
|
|
6180
|
-
|
|
6181
|
-
|
|
6182
|
-
|
|
6183
|
-
|
|
6184
|
-
|
|
6185
|
-
|
|
6186
|
-
|
|
6187
|
-
|
|
6188
|
-
|
|
6189
|
-
|
|
6190
|
-
|
|
6191
|
-
|
|
6192
|
-
|
|
6193
|
-
|
|
6194
|
-
|
|
6195
|
-
|
|
6196
|
-
|
|
6197
|
-
|
|
6198
|
-
|
|
6199
|
-
|
|
6200
|
-
|
|
6201
|
-
|
|
6202
|
-
|
|
6574
|
+
(() => {
|
|
6575
|
+
const structIdx = structureAudits.findIndex(
|
|
6576
|
+
(a) => a.label !== "Keywords in Headings" && a.label !== "Looks Like a Heading"
|
|
6577
|
+
);
|
|
6578
|
+
return structureAudits.map((a, i) => /* @__PURE__ */ jsx16(
|
|
6579
|
+
AuditCard2,
|
|
6580
|
+
{
|
|
6581
|
+
anchorId: a.label === "Keywords in Headings" ? "anchor-headings-keyword" : a.label === "Looks Like a Heading" ? "anchor-headings-unstyled" : i === structIdx ? "anchor-headings-structure" : void 0,
|
|
6582
|
+
label: a.label,
|
|
6583
|
+
value: a.value,
|
|
6584
|
+
status: a.status,
|
|
6585
|
+
recommendation: a.recommendation
|
|
6586
|
+
},
|
|
6587
|
+
`structure-${i}`
|
|
6588
|
+
));
|
|
6589
|
+
})(),
|
|
6590
|
+
(headings.length > 0 || !!documentFields?.title) && /* @__PURE__ */ jsxs15("div", { id: "anchor-headings-outline", style: { ...cardStyle6, padding: "8px 14px" }, children: [
|
|
6591
|
+
/* @__PURE__ */ jsx16("div", { style: { fontSize: 10, color: "#4b5563", textTransform: "uppercase", letterSpacing: "0.06em", fontWeight: 600, marginBottom: 6 }, children: "Heading Outline" }),
|
|
6592
|
+
/* @__PURE__ */ jsxs15("div", { style: { display: "flex", flexDirection: "column", gap: 4 }, children: [
|
|
6593
|
+
documentFields?.title && /* @__PURE__ */ jsxs15("div", { style: { fontSize: 11, color: MJH_BLUE, fontWeight: 700, lineHeight: 1.4 }, children: [
|
|
6594
|
+
/* @__PURE__ */ jsx16("span", { style: { fontSize: 9, fontWeight: 700, color: MJH_BLUE, marginRight: 6 }, children: "H1" }),
|
|
6595
|
+
documentFields.title,
|
|
6596
|
+
/* @__PURE__ */ jsx16("span", { style: { fontSize: 9, color: "#6b7280", fontWeight: 500, marginLeft: 6 }, children: "(article title)" })
|
|
6597
|
+
] }),
|
|
6598
|
+
(headingsDetailed ? headingsDetailed.slice(0, 12) : headings.slice(0, 12).map((h) => ({ text: h, level: 2 }))).map((h, i) => {
|
|
6599
|
+
const isH1 = h.level === 1;
|
|
6600
|
+
return /* @__PURE__ */ jsxs15(
|
|
6601
|
+
"div",
|
|
6602
|
+
{
|
|
6603
|
+
style: {
|
|
6604
|
+
fontSize: 11,
|
|
6605
|
+
color: !h.text ? "#dc2626" : isH1 ? MJH_BLUE : "#4b5563",
|
|
6606
|
+
fontWeight: isH1 ? 700 : 400,
|
|
6607
|
+
fontStyle: h.text ? "normal" : "italic",
|
|
6608
|
+
lineHeight: 1.4,
|
|
6609
|
+
paddingLeft: Math.max(0, (h.level - 2) * 12)
|
|
6610
|
+
},
|
|
6611
|
+
children: [
|
|
6612
|
+
/* @__PURE__ */ jsxs15("span", { style: { fontSize: 9, fontWeight: 700, color: isH1 ? MJH_BLUE : "#4b5563", marginRight: 6 }, children: [
|
|
6613
|
+
"H",
|
|
6614
|
+
h.level
|
|
6615
|
+
] }),
|
|
6616
|
+
h.text || "(empty)"
|
|
6617
|
+
]
|
|
6203
6618
|
},
|
|
6204
|
-
|
|
6205
|
-
|
|
6206
|
-
|
|
6207
|
-
|
|
6208
|
-
] }),
|
|
6209
|
-
h.text || "(empty)"
|
|
6210
|
-
]
|
|
6211
|
-
},
|
|
6212
|
-
i
|
|
6213
|
-
)),
|
|
6214
|
-
(headingsDetailed ?? headings).length > 12 && /* @__PURE__ */ jsxs14("div", { style: { fontSize: 10, color: "#4b5563" }, children: [
|
|
6619
|
+
i
|
|
6620
|
+
);
|
|
6621
|
+
}),
|
|
6622
|
+
(headingsDetailed ?? headings).length > 12 && /* @__PURE__ */ jsxs15("div", { style: { fontSize: 10, color: "#4b5563" }, children: [
|
|
6215
6623
|
"+ ",
|
|
6216
6624
|
(headingsDetailed ?? headings).length - 12,
|
|
6217
6625
|
" more"
|
|
6218
6626
|
] })
|
|
6219
|
-
] })
|
|
6627
|
+
] }),
|
|
6628
|
+
/* @__PURE__ */ jsx16("div", { style: { fontSize: 10, color: "#6b7280", marginTop: 8, lineHeight: 1.4 }, children: headings.length > 0 ? "The title above is your H1; the tool scans the H2-H6 tags below it. Tip: work your primary and/or secondary keyword into a header where it reads naturally." : "The title above is your H1, and there are no H2-H6 subheadings yet. Tip: work your primary and/or secondary keyword into the title where it reads naturally." })
|
|
6220
6629
|
] }),
|
|
6221
|
-
imagesAudit && /* @__PURE__ */
|
|
6630
|
+
imagesAudit && /* @__PURE__ */ jsx16(
|
|
6222
6631
|
AuditCard2,
|
|
6223
6632
|
{
|
|
6224
6633
|
anchorId: "anchor-images",
|
|
@@ -6228,7 +6637,7 @@ function TechnicalTab({
|
|
|
6228
6637
|
recommendation: imagesAudit.recommendation
|
|
6229
6638
|
}
|
|
6230
6639
|
),
|
|
6231
|
-
filenameAudit && /* @__PURE__ */
|
|
6640
|
+
filenameAudit && /* @__PURE__ */ jsx16(
|
|
6232
6641
|
AuditCard2,
|
|
6233
6642
|
{
|
|
6234
6643
|
anchorId: "anchor-image-filenames",
|
|
@@ -6238,7 +6647,7 @@ function TechnicalTab({
|
|
|
6238
6647
|
recommendation: filenameAudit.recommendation
|
|
6239
6648
|
}
|
|
6240
6649
|
),
|
|
6241
|
-
altTextAudit && /* @__PURE__ */
|
|
6650
|
+
altTextAudit && /* @__PURE__ */ jsx16(
|
|
6242
6651
|
AuditCard2,
|
|
6243
6652
|
{
|
|
6244
6653
|
anchorId: "anchor-image-alt",
|
|
@@ -6248,7 +6657,7 @@ function TechnicalTab({
|
|
|
6248
6657
|
recommendation: altTextAudit.recommendation
|
|
6249
6658
|
}
|
|
6250
6659
|
),
|
|
6251
|
-
imgTitleAudit && /* @__PURE__ */
|
|
6660
|
+
imgTitleAudit && /* @__PURE__ */ jsx16(
|
|
6252
6661
|
AuditCard2,
|
|
6253
6662
|
{
|
|
6254
6663
|
anchorId: "anchor-image-titles",
|
|
@@ -6257,28 +6666,17 @@ function TechnicalTab({
|
|
|
6257
6666
|
status: imgTitleAudit.status,
|
|
6258
6667
|
recommendation: imgTitleAudit.recommendation
|
|
6259
6668
|
}
|
|
6260
|
-
),
|
|
6261
|
-
/* @__PURE__ */ jsx15(
|
|
6262
|
-
LinkCheckCard,
|
|
6263
|
-
{
|
|
6264
|
-
urls: bodyLinks,
|
|
6265
|
-
results: linkCheckResults,
|
|
6266
|
-
isLoading: isLinkCheckLoading,
|
|
6267
|
-
error: linkCheckError,
|
|
6268
|
-
hasRun: hasRunLinkCheck,
|
|
6269
|
-
onCheck: onCheckLinks
|
|
6270
|
-
}
|
|
6271
6669
|
)
|
|
6272
6670
|
] });
|
|
6273
6671
|
}
|
|
6274
6672
|
|
|
6275
6673
|
// src/components/SEOCopilotPanel.tsx
|
|
6276
|
-
import { Fragment as
|
|
6674
|
+
import { Fragment as Fragment10, jsx as jsx17, jsxs as jsxs16 } from "react/jsx-runtime";
|
|
6277
6675
|
function LogoIcon2() {
|
|
6278
|
-
return /* @__PURE__ */
|
|
6279
|
-
/* @__PURE__ */
|
|
6280
|
-
/* @__PURE__ */
|
|
6281
|
-
/* @__PURE__ */
|
|
6676
|
+
return /* @__PURE__ */ jsxs16("svg", { width: "16", height: "16", viewBox: "0 0 16 16", fill: "none", children: [
|
|
6677
|
+
/* @__PURE__ */ jsx17("rect", { x: "1", y: "3", width: "4", height: "10", rx: "1", fill: MJH_GOLD, opacity: "1" }),
|
|
6678
|
+
/* @__PURE__ */ jsx17("rect", { x: "6", y: "1", width: "4", height: "14", rx: "1", fill: MJH_GOLD, opacity: "0.85" }),
|
|
6679
|
+
/* @__PURE__ */ jsx17("rect", { x: "11", y: "5", width: "4", height: "8", rx: "1", fill: MJH_GOLD, opacity: "0.6" })
|
|
6282
6680
|
] });
|
|
6283
6681
|
}
|
|
6284
6682
|
function PanelContent({
|
|
@@ -6320,14 +6718,14 @@ function PanelContent({
|
|
|
6320
6718
|
const keywordAnalysisState = externalAnalysis;
|
|
6321
6719
|
const effectivePrimary = selectedPrimary || externalAnalysis.analysis?.primaryKeyword?.term || "";
|
|
6322
6720
|
const effectiveSecondary = selectedSecondary || "";
|
|
6323
|
-
const containerRef =
|
|
6324
|
-
const dragging =
|
|
6721
|
+
const containerRef = useRef12(null);
|
|
6722
|
+
const dragging = useRef12(false);
|
|
6325
6723
|
const onMouseDown = useCallback5(() => {
|
|
6326
6724
|
dragging.current = true;
|
|
6327
6725
|
document.body.style.cursor = "row-resize";
|
|
6328
6726
|
document.body.style.userSelect = "none";
|
|
6329
6727
|
}, []);
|
|
6330
|
-
|
|
6728
|
+
useEffect12(() => {
|
|
6331
6729
|
const onMouseMove = (e) => {
|
|
6332
6730
|
if (!dragging.current || !containerRef.current) return;
|
|
6333
6731
|
const rect = containerRef.current.getBoundingClientRect();
|
|
@@ -6350,11 +6748,11 @@ function PanelContent({
|
|
|
6350
6748
|
const onboardSite = publication || "default";
|
|
6351
6749
|
const onboardKey = `seo-copilot-onboarded-${onboardSite}`;
|
|
6352
6750
|
const onboardSessionKey = `seo-copilot-onboard-shown-${onboardSite}`;
|
|
6353
|
-
const [popupMode, setPopupMode] =
|
|
6354
|
-
const [popupClosing, setPopupClosing] =
|
|
6355
|
-
const onboardTimerRef =
|
|
6356
|
-
const onboardFadeRef =
|
|
6357
|
-
|
|
6751
|
+
const [popupMode, setPopupMode] = useState17("hidden");
|
|
6752
|
+
const [popupClosing, setPopupClosing] = useState17(false);
|
|
6753
|
+
const onboardTimerRef = useRef12(null);
|
|
6754
|
+
const onboardFadeRef = useRef12(null);
|
|
6755
|
+
useEffect12(() => {
|
|
6358
6756
|
let onboarded = false;
|
|
6359
6757
|
let shownThisSession = false;
|
|
6360
6758
|
try {
|
|
@@ -6426,7 +6824,7 @@ function PanelContent({
|
|
|
6426
6824
|
{ id: "meta", label: "Meta", beta: true },
|
|
6427
6825
|
{ id: "technical", label: "Other Recs", beta: true, loading: technicalOps.isLinkCheckLoading }
|
|
6428
6826
|
];
|
|
6429
|
-
return /* @__PURE__ */
|
|
6827
|
+
return /* @__PURE__ */ jsxs16(
|
|
6430
6828
|
"div",
|
|
6431
6829
|
{
|
|
6432
6830
|
className: "seo-copilot-panel",
|
|
@@ -6441,9 +6839,9 @@ function PanelContent({
|
|
|
6441
6839
|
position: "relative"
|
|
6442
6840
|
},
|
|
6443
6841
|
children: [
|
|
6444
|
-
/* @__PURE__ */
|
|
6445
|
-
popupMode !== "hidden" && /* @__PURE__ */
|
|
6446
|
-
/* @__PURE__ */
|
|
6842
|
+
/* @__PURE__ */ jsx17("style", { dangerouslySetInnerHTML: { __html: INJECTED_CSS } }),
|
|
6843
|
+
popupMode !== "hidden" && /* @__PURE__ */ jsx17(OnboardingCard, { onDismiss: dismissPopup, closing: popupClosing }),
|
|
6844
|
+
/* @__PURE__ */ jsxs16(
|
|
6447
6845
|
"div",
|
|
6448
6846
|
{
|
|
6449
6847
|
onMouseDown: isFloating ? onDragStart : void 0,
|
|
@@ -6461,16 +6859,26 @@ function PanelContent({
|
|
|
6461
6859
|
flexShrink: 0
|
|
6462
6860
|
},
|
|
6463
6861
|
children: [
|
|
6464
|
-
/* @__PURE__ */
|
|
6465
|
-
/* @__PURE__ */
|
|
6466
|
-
/* @__PURE__ */
|
|
6467
|
-
/* @__PURE__ */
|
|
6468
|
-
/* @__PURE__ */
|
|
6862
|
+
/* @__PURE__ */ jsxs16("div", { style: { display: "flex", alignItems: "center", gap: 6 }, children: [
|
|
6863
|
+
/* @__PURE__ */ jsx17(LogoIcon2, {}),
|
|
6864
|
+
/* @__PURE__ */ jsxs16("span", { style: { fontWeight: 700, fontSize: 15, letterSpacing: "-0.01em" }, children: [
|
|
6865
|
+
/* @__PURE__ */ jsx17("span", { style: { color: MJH_GOLD }, children: "SEO" }),
|
|
6866
|
+
/* @__PURE__ */ jsx17("span", { style: { color: MJH_SLATE }, children: " copilot" })
|
|
6469
6867
|
] })
|
|
6470
6868
|
] }),
|
|
6471
|
-
/* @__PURE__ */
|
|
6472
|
-
/* @__PURE__ */
|
|
6473
|
-
|
|
6869
|
+
/* @__PURE__ */ jsxs16("div", { style: { display: "flex", alignItems: "center", gap: isFloating ? 4 : 6 }, children: [
|
|
6870
|
+
/* @__PURE__ */ jsx17(OnboardingInfoButton, { onClick: openPopupPersistent }),
|
|
6871
|
+
/* @__PURE__ */ jsx17(
|
|
6872
|
+
ReportProblemButton,
|
|
6873
|
+
{
|
|
6874
|
+
activeTab,
|
|
6875
|
+
publication,
|
|
6876
|
+
documentId,
|
|
6877
|
+
documentType,
|
|
6878
|
+
primaryKeyword: effectivePrimary
|
|
6879
|
+
}
|
|
6880
|
+
),
|
|
6881
|
+
isFloating && onToggleFullscreen && /* @__PURE__ */ jsx17(
|
|
6474
6882
|
"button",
|
|
6475
6883
|
{
|
|
6476
6884
|
onClick: (e) => {
|
|
@@ -6492,16 +6900,16 @@ function PanelContent({
|
|
|
6492
6900
|
fontWeight: 600,
|
|
6493
6901
|
transition: "all 150ms"
|
|
6494
6902
|
},
|
|
6495
|
-
children: isFullscreen ? /* @__PURE__ */
|
|
6496
|
-
/* @__PURE__ */
|
|
6903
|
+
children: isFullscreen ? /* @__PURE__ */ jsxs16(Fragment10, { children: [
|
|
6904
|
+
/* @__PURE__ */ jsx17("svg", { width: "12", height: "12", viewBox: "0 0 20 20", fill: "currentColor", children: /* @__PURE__ */ jsx17("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" }) }),
|
|
6497
6905
|
"Exit fullscreen"
|
|
6498
|
-
] }) : /* @__PURE__ */
|
|
6499
|
-
/* @__PURE__ */
|
|
6906
|
+
] }) : /* @__PURE__ */ jsxs16(Fragment10, { children: [
|
|
6907
|
+
/* @__PURE__ */ jsx17("svg", { width: "12", height: "12", viewBox: "0 0 20 20", fill: "currentColor", children: /* @__PURE__ */ jsx17("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" }) }),
|
|
6500
6908
|
"Fullscreen"
|
|
6501
6909
|
] })
|
|
6502
6910
|
}
|
|
6503
6911
|
),
|
|
6504
|
-
isFloating && onToggleFloat && /* @__PURE__ */
|
|
6912
|
+
isFloating && onToggleFloat && /* @__PURE__ */ jsxs16(
|
|
6505
6913
|
"button",
|
|
6506
6914
|
{
|
|
6507
6915
|
onClick: (e) => {
|
|
@@ -6524,7 +6932,7 @@ function PanelContent({
|
|
|
6524
6932
|
transition: "all 150ms"
|
|
6525
6933
|
},
|
|
6526
6934
|
children: [
|
|
6527
|
-
/* @__PURE__ */
|
|
6935
|
+
/* @__PURE__ */ jsx17("svg", { width: "12", height: "12", viewBox: "0 0 20 20", fill: "currentColor", children: /* @__PURE__ */ jsx17(
|
|
6528
6936
|
"path",
|
|
6529
6937
|
{
|
|
6530
6938
|
fillRule: "evenodd",
|
|
@@ -6536,7 +6944,7 @@ function PanelContent({
|
|
|
6536
6944
|
]
|
|
6537
6945
|
}
|
|
6538
6946
|
),
|
|
6539
|
-
!isFloating && onToggleFloat && /* @__PURE__ */
|
|
6947
|
+
!isFloating && onToggleFloat && /* @__PURE__ */ jsx17(
|
|
6540
6948
|
"button",
|
|
6541
6949
|
{
|
|
6542
6950
|
onClick: (e) => {
|
|
@@ -6555,13 +6963,13 @@ function PanelContent({
|
|
|
6555
6963
|
transition: "color 150ms"
|
|
6556
6964
|
},
|
|
6557
6965
|
title: "Pop out",
|
|
6558
|
-
children: /* @__PURE__ */
|
|
6559
|
-
/* @__PURE__ */
|
|
6560
|
-
/* @__PURE__ */
|
|
6966
|
+
children: /* @__PURE__ */ jsxs16("svg", { width: "14", height: "14", viewBox: "0 0 20 20", fill: "currentColor", children: [
|
|
6967
|
+
/* @__PURE__ */ jsx17("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" }),
|
|
6968
|
+
/* @__PURE__ */ jsx17("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" })
|
|
6561
6969
|
] })
|
|
6562
6970
|
}
|
|
6563
6971
|
),
|
|
6564
|
-
isLoading && /* @__PURE__ */
|
|
6972
|
+
isLoading && /* @__PURE__ */ jsx17(
|
|
6565
6973
|
"div",
|
|
6566
6974
|
{
|
|
6567
6975
|
style: {
|
|
@@ -6573,7 +6981,7 @@ function PanelContent({
|
|
|
6573
6981
|
}
|
|
6574
6982
|
}
|
|
6575
6983
|
),
|
|
6576
|
-
onClose && /* @__PURE__ */
|
|
6984
|
+
onClose && /* @__PURE__ */ jsx17(
|
|
6577
6985
|
"button",
|
|
6578
6986
|
{
|
|
6579
6987
|
onClick: (e) => {
|
|
@@ -6592,11 +7000,11 @@ function PanelContent({
|
|
|
6592
7000
|
transition: "color 150ms"
|
|
6593
7001
|
},
|
|
6594
7002
|
title: "Close",
|
|
6595
|
-
children: /* @__PURE__ */
|
|
7003
|
+
children: /* @__PURE__ */ jsx17("svg", { width: "14", height: "14", viewBox: "0 0 20 20", fill: "currentColor", children: /* @__PURE__ */ jsx17("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" }) })
|
|
6596
7004
|
}
|
|
6597
7005
|
)
|
|
6598
7006
|
] }),
|
|
6599
|
-
/* @__PURE__ */
|
|
7007
|
+
/* @__PURE__ */ jsx17(
|
|
6600
7008
|
"div",
|
|
6601
7009
|
{
|
|
6602
7010
|
style: {
|
|
@@ -6615,8 +7023,8 @@ function PanelContent({
|
|
|
6615
7023
|
]
|
|
6616
7024
|
}
|
|
6617
7025
|
),
|
|
6618
|
-
/* @__PURE__ */
|
|
6619
|
-
/* @__PURE__ */
|
|
7026
|
+
/* @__PURE__ */ jsx17(TabBar, { tabs: tabDefs, activeTab, onTabChange: handleTabChange }),
|
|
7027
|
+
/* @__PURE__ */ jsx17(
|
|
6620
7028
|
"div",
|
|
6621
7029
|
{
|
|
6622
7030
|
style: {
|
|
@@ -6632,8 +7040,8 @@ function PanelContent({
|
|
|
6632
7040
|
children: "Recommendations are generated by AI. Verify details before publishing."
|
|
6633
7041
|
}
|
|
6634
7042
|
),
|
|
6635
|
-
/* @__PURE__ */
|
|
6636
|
-
/* @__PURE__ */
|
|
7043
|
+
/* @__PURE__ */ jsxs16("div", { ref: containerRef, style: { flex: 1, display: "flex", flexDirection: "column", overflow: "hidden" }, children: [
|
|
7044
|
+
/* @__PURE__ */ jsxs16(
|
|
6637
7045
|
"div",
|
|
6638
7046
|
{
|
|
6639
7047
|
style: {
|
|
@@ -6644,7 +7052,7 @@ function PanelContent({
|
|
|
6644
7052
|
background: RECS_ZONE_BG
|
|
6645
7053
|
},
|
|
6646
7054
|
children: [
|
|
6647
|
-
/* @__PURE__ */
|
|
7055
|
+
/* @__PURE__ */ jsx17("div", { style: { display: activeTab === "keywords" ? "block" : "none" }, children: /* @__PURE__ */ jsx17(
|
|
6648
7056
|
KeywordPanel,
|
|
6649
7057
|
{
|
|
6650
7058
|
text,
|
|
@@ -6660,7 +7068,7 @@ function PanelContent({
|
|
|
6660
7068
|
},
|
|
6661
7069
|
documentId || "default"
|
|
6662
7070
|
) }),
|
|
6663
|
-
/* @__PURE__ */
|
|
7071
|
+
/* @__PURE__ */ jsx17("div", { style: { display: activeTab === "summary" ? "block" : "none" }, children: /* @__PURE__ */ jsx17(
|
|
6664
7072
|
SummaryTab,
|
|
6665
7073
|
{
|
|
6666
7074
|
text,
|
|
@@ -6676,13 +7084,12 @@ function PanelContent({
|
|
|
6676
7084
|
onItemClick: summaryOps.onItemClick
|
|
6677
7085
|
}
|
|
6678
7086
|
) }),
|
|
6679
|
-
/* @__PURE__ */
|
|
7087
|
+
/* @__PURE__ */ jsx17("div", { style: { display: activeTab === "aeo" ? "block" : "none" }, children: /* @__PURE__ */ jsx17(
|
|
6680
7088
|
AEOTab,
|
|
6681
7089
|
{
|
|
6682
7090
|
text,
|
|
6683
7091
|
deepAnalysis: keywordAnalysisState.deepAnalysis,
|
|
6684
7092
|
isDeepLoading: keywordAnalysisState.isDeepLoading,
|
|
6685
|
-
primaryKeyword: effectivePrimary,
|
|
6686
7093
|
publication,
|
|
6687
7094
|
runDeepAnalysis: keywordAnalysisState.runDeepAnalysis,
|
|
6688
7095
|
aeoContentChanged: keywordAnalysisState.aeoContentChanged,
|
|
@@ -6693,7 +7100,7 @@ function PanelContent({
|
|
|
6693
7100
|
loadContentSuggestions: aeoOps.loadContentSuggestions
|
|
6694
7101
|
}
|
|
6695
7102
|
) }),
|
|
6696
|
-
/* @__PURE__ */
|
|
7103
|
+
/* @__PURE__ */ jsx17("div", { style: { display: activeTab === "linking" ? "block" : "none" }, children: /* @__PURE__ */ jsx17(
|
|
6697
7104
|
LinkingTab,
|
|
6698
7105
|
{
|
|
6699
7106
|
analysis: keywordAnalysisState.analysis,
|
|
@@ -6709,8 +7116,8 @@ function PanelContent({
|
|
|
6709
7116
|
documentType
|
|
6710
7117
|
}
|
|
6711
7118
|
) }),
|
|
6712
|
-
/* @__PURE__ */
|
|
6713
|
-
/* @__PURE__ */
|
|
7119
|
+
/* @__PURE__ */ jsx17("div", { style: { display: activeTab === "meta" ? "block" : "none" }, children: /* @__PURE__ */ jsx17(MetaTab, { documentFields, primaryKeyword: effectivePrimary, secondaryKeyword: effectiveSecondary, isLoading: docLoading }) }),
|
|
7120
|
+
/* @__PURE__ */ jsx17("div", { style: { display: activeTab === "technical" ? "block" : "none" }, children: /* @__PURE__ */ jsx17(
|
|
6714
7121
|
TechnicalTab,
|
|
6715
7122
|
{
|
|
6716
7123
|
text,
|
|
@@ -6728,7 +7135,7 @@ function PanelContent({
|
|
|
6728
7135
|
]
|
|
6729
7136
|
}
|
|
6730
7137
|
),
|
|
6731
|
-
chatOpen && /* @__PURE__ */
|
|
7138
|
+
chatOpen && /* @__PURE__ */ jsx17(
|
|
6732
7139
|
"div",
|
|
6733
7140
|
{
|
|
6734
7141
|
onMouseDown,
|
|
@@ -6741,10 +7148,10 @@ function PanelContent({
|
|
|
6741
7148
|
justifyContent: "center",
|
|
6742
7149
|
flexShrink: 0
|
|
6743
7150
|
},
|
|
6744
|
-
children: /* @__PURE__ */
|
|
7151
|
+
children: /* @__PURE__ */ jsx17("div", { style: { width: 32, height: 2, borderRadius: 1, background: "#d1d5db" } })
|
|
6745
7152
|
}
|
|
6746
7153
|
),
|
|
6747
|
-
/* @__PURE__ */
|
|
7154
|
+
/* @__PURE__ */ jsxs16(
|
|
6748
7155
|
"div",
|
|
6749
7156
|
{
|
|
6750
7157
|
style: {
|
|
@@ -6757,7 +7164,7 @@ function PanelContent({
|
|
|
6757
7164
|
background: CHAT_ZONE_BG
|
|
6758
7165
|
},
|
|
6759
7166
|
children: [
|
|
6760
|
-
/* @__PURE__ */
|
|
7167
|
+
/* @__PURE__ */ jsxs16(
|
|
6761
7168
|
"button",
|
|
6762
7169
|
{
|
|
6763
7170
|
onClick: () => onChatOpenChange(!chatOpen),
|
|
@@ -6778,7 +7185,7 @@ function PanelContent({
|
|
|
6778
7185
|
flexShrink: 0
|
|
6779
7186
|
},
|
|
6780
7187
|
children: [
|
|
6781
|
-
/* @__PURE__ */
|
|
7188
|
+
/* @__PURE__ */ jsx17(
|
|
6782
7189
|
"span",
|
|
6783
7190
|
{
|
|
6784
7191
|
style: {
|
|
@@ -6791,7 +7198,7 @@ function PanelContent({
|
|
|
6791
7198
|
children: "Chat"
|
|
6792
7199
|
}
|
|
6793
7200
|
),
|
|
6794
|
-
/* @__PURE__ */
|
|
7201
|
+
/* @__PURE__ */ jsx17(
|
|
6795
7202
|
"svg",
|
|
6796
7203
|
{
|
|
6797
7204
|
width: "12",
|
|
@@ -6799,7 +7206,7 @@ function PanelContent({
|
|
|
6799
7206
|
viewBox: "0 0 20 20",
|
|
6800
7207
|
fill: "rgba(0,0,0,0.55)",
|
|
6801
7208
|
style: { transform: chatOpen ? "rotate(0deg)" : "rotate(-90deg)", transition: "transform 200ms" },
|
|
6802
|
-
children: /* @__PURE__ */
|
|
7209
|
+
children: /* @__PURE__ */ jsx17(
|
|
6803
7210
|
"path",
|
|
6804
7211
|
{
|
|
6805
7212
|
fillRule: "evenodd",
|
|
@@ -6812,7 +7219,7 @@ function PanelContent({
|
|
|
6812
7219
|
]
|
|
6813
7220
|
}
|
|
6814
7221
|
),
|
|
6815
|
-
/* @__PURE__ */
|
|
7222
|
+
/* @__PURE__ */ jsx17(
|
|
6816
7223
|
"div",
|
|
6817
7224
|
{
|
|
6818
7225
|
style: {
|
|
@@ -6822,7 +7229,7 @@ function PanelContent({
|
|
|
6822
7229
|
flexDirection: "column",
|
|
6823
7230
|
minHeight: 0
|
|
6824
7231
|
},
|
|
6825
|
-
children: /* @__PURE__ */
|
|
7232
|
+
children: /* @__PURE__ */ jsx17(
|
|
6826
7233
|
ChatPanel,
|
|
6827
7234
|
{
|
|
6828
7235
|
messages: chatState.messages,
|
|
@@ -6853,10 +7260,10 @@ function SEOCopilotInner({ config, onClose }) {
|
|
|
6853
7260
|
"seo-copilot-ui-float-size",
|
|
6854
7261
|
{ width: 380, height: typeof window !== "undefined" ? Math.round(window.innerHeight * 0.8) : 600 }
|
|
6855
7262
|
);
|
|
6856
|
-
const dragOffset =
|
|
6857
|
-
const resizeStart =
|
|
6858
|
-
const activeDragCleanupRef =
|
|
6859
|
-
const activeResizeCleanupRef =
|
|
7263
|
+
const dragOffset = useRef12(null);
|
|
7264
|
+
const resizeStart = useRef12(null);
|
|
7265
|
+
const activeDragCleanupRef = useRef12(null);
|
|
7266
|
+
const activeResizeCleanupRef = useRef12(null);
|
|
6860
7267
|
const { text, isLoading: docLoading, documentFields, documentId, documentType } = useDocumentContent();
|
|
6861
7268
|
const { apiUrl } = useConfig();
|
|
6862
7269
|
const workspace = useWorkspace();
|
|
@@ -6875,7 +7282,7 @@ function SEOCopilotInner({ config, onClose }) {
|
|
|
6875
7282
|
}
|
|
6876
7283
|
return [];
|
|
6877
7284
|
}, [seedCacheKey]);
|
|
6878
|
-
const [seedKeywords, setSeedKeywordsRaw] =
|
|
7285
|
+
const [seedKeywords, setSeedKeywordsRaw] = useState17(loadSeedsFromCache);
|
|
6879
7286
|
const setSeedKeywords = useCallback5(
|
|
6880
7287
|
(seeds) => {
|
|
6881
7288
|
setSeedKeywordsRaw(seeds);
|
|
@@ -6891,20 +7298,20 @@ function SEOCopilotInner({ config, onClose }) {
|
|
|
6891
7298
|
const [selectedPrimary, setSelectedPrimary] = usePersistentState(selectedPrimaryKey, void 0);
|
|
6892
7299
|
const selectedSecondaryKey = documentId ? `seo-copilot-secondary-${documentId}` : "seo-copilot-secondary-default";
|
|
6893
7300
|
const [selectedSecondary, setSelectedSecondary] = usePersistentState(selectedSecondaryKey, "");
|
|
6894
|
-
const seedsInitializedRef =
|
|
6895
|
-
|
|
7301
|
+
const seedsInitializedRef = useRef12(false);
|
|
7302
|
+
useEffect12(() => {
|
|
6896
7303
|
if (!seedsInitializedRef.current) {
|
|
6897
7304
|
seedsInitializedRef.current = true;
|
|
6898
7305
|
return;
|
|
6899
7306
|
}
|
|
6900
7307
|
setSeedKeywordsRaw(loadSeedsFromCache());
|
|
6901
7308
|
}, [documentId, loadSeedsFromCache]);
|
|
6902
|
-
const [activeTab, setActiveTab] =
|
|
7309
|
+
const [activeTab, setActiveTab] = useState17("keywords");
|
|
6903
7310
|
const [chatOpen, setChatOpen] = usePersistentState("seo-copilot-ui-chat-open-v35", false);
|
|
6904
7311
|
const [splitPercent, setSplitPercent] = usePersistentState("seo-copilot-ui-split", 70);
|
|
6905
|
-
const keywordAnalysisState = useKeywordAnalysis(text, apiUrl, effectivePublication, seedKeywords, documentFields, selectedPrimary, documentId);
|
|
7312
|
+
const keywordAnalysisState = useKeywordAnalysis(text, apiUrl, effectivePublication, seedKeywords, documentFields, selectedPrimary, documentId, selectedSecondary);
|
|
6906
7313
|
const effectivePrimary = selectedPrimary || keywordAnalysisState.analysis?.primaryKeyword?.term || "";
|
|
6907
|
-
|
|
7314
|
+
useEffect12(() => {
|
|
6908
7315
|
if (selectedSecondary && effectivePrimary && selectedSecondary.toLowerCase() === effectivePrimary.toLowerCase()) {
|
|
6909
7316
|
setSelectedSecondary("");
|
|
6910
7317
|
}
|
|
@@ -6927,12 +7334,12 @@ function SEOCopilotInner({ config, onClose }) {
|
|
|
6927
7334
|
const chatHookState = useSEOChat(apiUrl, text, effectivePublication, keywordPanelData, documentId);
|
|
6928
7335
|
const contentSuggestionsKey = documentId ? `seo-copilot-content-suggestions-${documentId}` : "seo-copilot-content-suggestions-default";
|
|
6929
7336
|
const [contentSuggestions, setContentSuggestions] = usePersistentState(contentSuggestionsKey, null);
|
|
6930
|
-
const [isCSLoading, setIsCSLoading] =
|
|
6931
|
-
const [csError, setCsError] =
|
|
6932
|
-
const aeoOpVersionRef =
|
|
6933
|
-
const csAbortRef =
|
|
6934
|
-
const didInitAeoRef =
|
|
6935
|
-
|
|
7337
|
+
const [isCSLoading, setIsCSLoading] = useState17(false);
|
|
7338
|
+
const [csError, setCsError] = useState17(null);
|
|
7339
|
+
const aeoOpVersionRef = useRef12(0);
|
|
7340
|
+
const csAbortRef = useRef12(null);
|
|
7341
|
+
const didInitAeoRef = useRef12(false);
|
|
7342
|
+
useEffect12(() => {
|
|
6936
7343
|
if (!didInitAeoRef.current) {
|
|
6937
7344
|
didInitAeoRef.current = true;
|
|
6938
7345
|
return;
|
|
@@ -6966,14 +7373,14 @@ function SEOCopilotInner({ config, onClose }) {
|
|
|
6966
7373
|
}, [apiUrl, text, effectivePrimary, effectivePublication]);
|
|
6967
7374
|
const linkingKey = documentId ? `seo-copilot-linking-${documentId}` : "seo-copilot-linking-default";
|
|
6968
7375
|
const [linkingSuggestions, setLinkingSuggestions] = usePersistentState(linkingKey, []);
|
|
6969
|
-
const [isLinkingLoading, setIsLinkingLoading] =
|
|
6970
|
-
const [linkingError, setLinkingError] =
|
|
6971
|
-
const [linkingFetchedText, setLinkingFetchedText] =
|
|
6972
|
-
const linkingVersionRef =
|
|
6973
|
-
const linkingAbortRef =
|
|
6974
|
-
const didInitLinkingRef =
|
|
6975
|
-
const lastLinkingFetchKey =
|
|
6976
|
-
|
|
7376
|
+
const [isLinkingLoading, setIsLinkingLoading] = useState17(false);
|
|
7377
|
+
const [linkingError, setLinkingError] = useState17(null);
|
|
7378
|
+
const [linkingFetchedText, setLinkingFetchedText] = useState17("");
|
|
7379
|
+
const linkingVersionRef = useRef12(0);
|
|
7380
|
+
const linkingAbortRef = useRef12(null);
|
|
7381
|
+
const didInitLinkingRef = useRef12(false);
|
|
7382
|
+
const lastLinkingFetchKey = useRef12("");
|
|
7383
|
+
useEffect12(() => {
|
|
6977
7384
|
if (!didInitLinkingRef.current) {
|
|
6978
7385
|
didInitLinkingRef.current = true;
|
|
6979
7386
|
return;
|
|
@@ -7023,7 +7430,7 @@ function SEOCopilotInner({ config, onClose }) {
|
|
|
7023
7430
|
if (Math.abs(text.length - linkingFetchedText.length) > 150) return true;
|
|
7024
7431
|
return text.slice(0, 300) !== linkingFetchedText.slice(0, 300);
|
|
7025
7432
|
}, [text, linkingFetchedText, linkingSuggestions.length]);
|
|
7026
|
-
|
|
7433
|
+
useEffect12(() => {
|
|
7027
7434
|
if (!text || text.trim().length < 50 || !effectivePrimary) return;
|
|
7028
7435
|
const fetchKey = `${documentId || "_"}|${effectivePrimary}|${supportingKeywordsForLinking.join(",")}`;
|
|
7029
7436
|
if (fetchKey === lastLinkingFetchKey.current) return;
|
|
@@ -7037,11 +7444,11 @@ function SEOCopilotInner({ config, onClose }) {
|
|
|
7037
7444
|
const linkCheckKey = documentId ? `seo-copilot-link-check-${documentId}` : "seo-copilot-link-check-default";
|
|
7038
7445
|
const [linkCheckResults, setLinkCheckResults] = usePersistentState(linkCheckKey, []);
|
|
7039
7446
|
const [hasRunLinkCheck, setHasRunLinkCheck] = usePersistentState(`${linkCheckKey}-ran`, false);
|
|
7040
|
-
const [isLinkCheckLoading, setIsLinkCheckLoading] =
|
|
7041
|
-
const [linkCheckError, setLinkCheckError] =
|
|
7042
|
-
const linkCheckVersionRef =
|
|
7043
|
-
const didInitLinkCheckRef =
|
|
7044
|
-
|
|
7447
|
+
const [isLinkCheckLoading, setIsLinkCheckLoading] = useState17(false);
|
|
7448
|
+
const [linkCheckError, setLinkCheckError] = useState17(null);
|
|
7449
|
+
const linkCheckVersionRef = useRef12(0);
|
|
7450
|
+
const didInitLinkCheckRef = useRef12(false);
|
|
7451
|
+
useEffect12(() => {
|
|
7045
7452
|
if (!didInitLinkCheckRef.current) {
|
|
7046
7453
|
didInitLinkCheckRef.current = true;
|
|
7047
7454
|
return;
|
|
@@ -7076,7 +7483,7 @@ function SEOCopilotInner({ config, onClose }) {
|
|
|
7076
7483
|
if (linkCheckVersionRef.current !== myVersion) return;
|
|
7077
7484
|
setIsLinkCheckLoading(false);
|
|
7078
7485
|
}, [apiUrl, documentFields?.bodyLinks, setHasRunLinkCheck, setLinkCheckResults]);
|
|
7079
|
-
|
|
7486
|
+
useEffect12(() => {
|
|
7080
7487
|
return () => {
|
|
7081
7488
|
activeDragCleanupRef.current?.();
|
|
7082
7489
|
activeResizeCleanupRef.current?.();
|
|
@@ -7084,6 +7491,24 @@ function SEOCopilotInner({ config, onClose }) {
|
|
|
7084
7491
|
linkingAbortRef.current?.abort();
|
|
7085
7492
|
};
|
|
7086
7493
|
}, []);
|
|
7494
|
+
const runAllAnalyses = () => {
|
|
7495
|
+
keywordAnalysisState.runDeepAnalysis();
|
|
7496
|
+
if (text && text.trim().length >= 100) loadContentSuggestions();
|
|
7497
|
+
if (text && text.trim().length >= 50 && effectivePrimary) refreshLinkingSuggestions();
|
|
7498
|
+
if ((documentFields?.bodyLinks || []).length > 0) runLinkCheck();
|
|
7499
|
+
};
|
|
7500
|
+
const runAllRef = useRef12(runAllAnalyses);
|
|
7501
|
+
runAllRef.current = runAllAnalyses;
|
|
7502
|
+
const secAutoRunRef = useRef12({ doc: documentId, sec: selectedSecondary, init: true });
|
|
7503
|
+
useEffect12(() => {
|
|
7504
|
+
const prev = secAutoRunRef.current;
|
|
7505
|
+
const docChanged = prev.doc !== documentId;
|
|
7506
|
+
const secChanged = prev.sec !== selectedSecondary;
|
|
7507
|
+
secAutoRunRef.current = { doc: documentId, sec: selectedSecondary, init: false };
|
|
7508
|
+
if (prev.init || docChanged || !secChanged) return;
|
|
7509
|
+
const t = setTimeout(() => runAllRef.current(), 1500);
|
|
7510
|
+
return () => clearTimeout(t);
|
|
7511
|
+
}, [selectedSecondary, documentId]);
|
|
7087
7512
|
const handleDragStart = useCallback5(
|
|
7088
7513
|
(e) => {
|
|
7089
7514
|
dragOffset.current = {
|
|
@@ -7150,7 +7575,7 @@ function SEOCopilotInner({ config, onClose }) {
|
|
|
7150
7575
|
},
|
|
7151
7576
|
[floatSize]
|
|
7152
7577
|
);
|
|
7153
|
-
const panelContent = /* @__PURE__ */
|
|
7578
|
+
const panelContent = /* @__PURE__ */ jsx17(
|
|
7154
7579
|
PanelContent,
|
|
7155
7580
|
{
|
|
7156
7581
|
initialPublication: effectivePublication,
|
|
@@ -7216,12 +7641,7 @@ function SEOCopilotInner({ config, onClose }) {
|
|
|
7216
7641
|
},
|
|
7217
7642
|
summaryOps: {
|
|
7218
7643
|
isAnyLoading: keywordAnalysisState.isLoading || keywordAnalysisState.isVolumesLoading || keywordAnalysisState.isDeepLoading || isCSLoading || isLinkingLoading || isLinkCheckLoading,
|
|
7219
|
-
onGenerateAll:
|
|
7220
|
-
keywordAnalysisState.runDeepAnalysis();
|
|
7221
|
-
if (text && text.trim().length >= 100) loadContentSuggestions();
|
|
7222
|
-
if (text && text.trim().length >= 50 && effectivePrimary) refreshLinkingSuggestions();
|
|
7223
|
-
if ((documentFields?.bodyLinks || []).length > 0) runLinkCheck();
|
|
7224
|
-
},
|
|
7644
|
+
onGenerateAll: runAllAnalyses,
|
|
7225
7645
|
onItemClick: (item) => {
|
|
7226
7646
|
setActiveTab(item.jumpTo.tab);
|
|
7227
7647
|
const id = item.jumpTo.anchorId;
|
|
@@ -7237,7 +7657,7 @@ function SEOCopilotInner({ config, onClose }) {
|
|
|
7237
7657
|
}
|
|
7238
7658
|
}
|
|
7239
7659
|
);
|
|
7240
|
-
const floatingPanel = /* @__PURE__ */
|
|
7660
|
+
const floatingPanel = /* @__PURE__ */ jsxs16(
|
|
7241
7661
|
"div",
|
|
7242
7662
|
{
|
|
7243
7663
|
style: {
|
|
@@ -7255,7 +7675,7 @@ function SEOCopilotInner({ config, onClose }) {
|
|
|
7255
7675
|
},
|
|
7256
7676
|
children: [
|
|
7257
7677
|
panelContent,
|
|
7258
|
-
!isFullscreen && /* @__PURE__ */
|
|
7678
|
+
!isFullscreen && /* @__PURE__ */ jsx17(
|
|
7259
7679
|
"div",
|
|
7260
7680
|
{
|
|
7261
7681
|
onMouseDown: handleResizeStart,
|
|
@@ -7270,9 +7690,9 @@ function SEOCopilotInner({ config, onClose }) {
|
|
|
7270
7690
|
alignItems: "center",
|
|
7271
7691
|
justifyContent: "center"
|
|
7272
7692
|
},
|
|
7273
|
-
children: /* @__PURE__ */
|
|
7274
|
-
/* @__PURE__ */
|
|
7275
|
-
/* @__PURE__ */
|
|
7693
|
+
children: /* @__PURE__ */ jsxs16("svg", { width: "10", height: "10", viewBox: "0 0 10 10", fill: "#9ca3af", children: [
|
|
7694
|
+
/* @__PURE__ */ jsx17("path", { d: "M9 1v8H1", fill: "none", stroke: "#9ca3af", strokeWidth: "1.5", strokeLinecap: "round" }),
|
|
7695
|
+
/* @__PURE__ */ jsx17("path", { d: "M9 5v4H5", fill: "none", stroke: "#9ca3af", strokeWidth: "1.5", strokeLinecap: "round" })
|
|
7276
7696
|
] })
|
|
7277
7697
|
}
|
|
7278
7698
|
)
|
|
@@ -7280,8 +7700,8 @@ function SEOCopilotInner({ config, onClose }) {
|
|
|
7280
7700
|
}
|
|
7281
7701
|
);
|
|
7282
7702
|
if (isFloating) {
|
|
7283
|
-
return /* @__PURE__ */
|
|
7284
|
-
/* @__PURE__ */
|
|
7703
|
+
return /* @__PURE__ */ jsxs16(Fragment10, { children: [
|
|
7704
|
+
/* @__PURE__ */ jsx17(
|
|
7285
7705
|
"div",
|
|
7286
7706
|
{
|
|
7287
7707
|
style: {
|
|
@@ -7291,30 +7711,30 @@ function SEOCopilotInner({ config, onClose }) {
|
|
|
7291
7711
|
alignItems: "center",
|
|
7292
7712
|
justifyContent: "center"
|
|
7293
7713
|
},
|
|
7294
|
-
children: /* @__PURE__ */
|
|
7714
|
+
children: /* @__PURE__ */ jsx17("span", { style: { fontSize: 12, color: "rgba(0,0,0,0.5)" }, children: "SEO Copilot is floating" })
|
|
7295
7715
|
}
|
|
7296
7716
|
),
|
|
7297
7717
|
typeof document !== "undefined" && createPortal(floatingPanel, document.body)
|
|
7298
7718
|
] });
|
|
7299
7719
|
}
|
|
7300
|
-
return /* @__PURE__ */
|
|
7720
|
+
return /* @__PURE__ */ jsx17("div", { style: { height: "100%", background: PANEL_BG, position: "relative", zIndex: 1 }, children: panelContent });
|
|
7301
7721
|
}
|
|
7302
7722
|
function SEOCopilotPanel({ config, onClose }) {
|
|
7303
|
-
return /* @__PURE__ */
|
|
7723
|
+
return /* @__PURE__ */ jsx17(
|
|
7304
7724
|
Suspense,
|
|
7305
7725
|
{
|
|
7306
|
-
fallback: /* @__PURE__ */
|
|
7307
|
-
/* @__PURE__ */
|
|
7308
|
-
/* @__PURE__ */
|
|
7726
|
+
fallback: /* @__PURE__ */ jsxs16("div", { style: { padding: 16, display: "flex", alignItems: "center", gap: 12 }, children: [
|
|
7727
|
+
/* @__PURE__ */ jsx17(LoadingBars, {}),
|
|
7728
|
+
/* @__PURE__ */ jsx17("span", { style: { fontSize: 12, color: "#4b5563" }, children: "Loading SEO Copilot..." })
|
|
7309
7729
|
] }),
|
|
7310
|
-
children: /* @__PURE__ */
|
|
7730
|
+
children: /* @__PURE__ */ jsx17(ConfigProvider, { config, children: /* @__PURE__ */ jsx17(SEOCopilotInner, { config, onClose }) })
|
|
7311
7731
|
}
|
|
7312
7732
|
);
|
|
7313
7733
|
}
|
|
7314
7734
|
function LoadingBars({ size = "sm", color = MJH_GOLD }) {
|
|
7315
7735
|
const barWidth = size === "xs" ? 4 : 6;
|
|
7316
7736
|
const containerHeight = size === "xs" ? 10 : 14;
|
|
7317
|
-
return /* @__PURE__ */
|
|
7737
|
+
return /* @__PURE__ */ jsx17("div", { style: { display: "inline-flex", alignItems: "flex-end", gap: 2, height: containerHeight }, children: [1, 2, 3].map((i) => /* @__PURE__ */ jsx17(
|
|
7318
7738
|
"div",
|
|
7319
7739
|
{
|
|
7320
7740
|
style: {
|