sanity-plugin-seo-copilot 0.2.5 → 0.2.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +1123 -537
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +1125 -539
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
- package/src/components/KeywordPanel.tsx +164 -1
- package/src/components/OnboardingPopup.tsx +108 -0
- package/src/components/SEOCopilotPanel.tsx +105 -7
- package/src/components/styles.ts +8 -0
- package/src/components/tabs/LinkingTab.tsx +77 -4
- package/src/components/tabs/MetaTab.tsx +31 -109
- package/src/components/tabs/SummaryTab.tsx +19 -4
- package/src/components/tabs/TechnicalTab.tsx +132 -1
- package/src/hooks/useDocumentContent.ts +48 -47
- package/src/hooks/useKeywordAnalysis.ts +21 -4
- package/src/hooks/useSEOChat.ts +45 -9
- package/src/lib/api.ts +25 -7
- package/src/lib/documentExtract.ts +268 -257
- package/src/lib/scoring.ts +41 -14
- package/src/lib/summary.ts +116 -27
package/dist/index.mjs
CHANGED
|
@@ -115,7 +115,14 @@ function detectAuthor(val) {
|
|
|
115
115
|
"Authors"
|
|
116
116
|
// PascalCase variants
|
|
117
117
|
];
|
|
118
|
-
|
|
118
|
+
const dynamic = Object.keys(val).filter(
|
|
119
|
+
// Author/byline-ish names, but never fact-check/reviewer fields, nor image/url/
|
|
120
|
+
// id sidecars (e.g. authorPhoto, authorImageUrl, authorId) that could otherwise
|
|
121
|
+
// be mistaken for a reference-typed author.
|
|
122
|
+
(k) => /author|byline/i.test(k) && !/fact|check|review|photo|image|avatar|picture|url|link|count|id$/i.test(k)
|
|
123
|
+
);
|
|
124
|
+
const fields = Array.from(/* @__PURE__ */ new Set([...candidateFields, ...dynamic]));
|
|
125
|
+
for (const f of fields) {
|
|
119
126
|
const raw = val[f];
|
|
120
127
|
if (!raw) continue;
|
|
121
128
|
const first = Array.isArray(raw) ? raw[0] : raw;
|
|
@@ -210,6 +217,7 @@ function buildDocumentFields(value) {
|
|
|
210
217
|
function useDocumentContent() {
|
|
211
218
|
const { value, ready } = useDocumentPane();
|
|
212
219
|
const documentId = value?._id || void 0;
|
|
220
|
+
const documentType = value?._type || void 0;
|
|
213
221
|
const title = value?.title;
|
|
214
222
|
const body = value?.body;
|
|
215
223
|
const [debouncedText, setDebouncedText] = useState("");
|
|
@@ -237,7 +245,7 @@ function useDocumentContent() {
|
|
|
237
245
|
if (timerRef.current) clearTimeout(timerRef.current);
|
|
238
246
|
};
|
|
239
247
|
}, [title, body, value]);
|
|
240
|
-
return { text: debouncedText, isLoading, documentFields, documentId };
|
|
248
|
+
return { text: debouncedText, isLoading, documentFields, documentId, documentType };
|
|
241
249
|
}
|
|
242
250
|
|
|
243
251
|
// src/hooks/useKeywordAnalysis.ts
|
|
@@ -260,28 +268,36 @@ function safeParseJson(text) {
|
|
|
260
268
|
throw new Error("Invalid JSON response from server");
|
|
261
269
|
}
|
|
262
270
|
}
|
|
263
|
-
async function fetchAnalysis(apiUrl, content, mode, publication, seedKeywords, documentFields, focusKeyword) {
|
|
271
|
+
async function fetchAnalysis(apiUrl, content, mode, publication, seedKeywords, documentFields, focusKeyword, signal) {
|
|
264
272
|
const response = await fetch(`${apiUrl}/api/seo-copilot/analyze`, {
|
|
265
273
|
method: "POST",
|
|
266
274
|
headers: { "Content-Type": "application/json" },
|
|
267
|
-
body: JSON.stringify({ content, mode, publication, seedKeywords, documentFields, focusKeyword })
|
|
275
|
+
body: JSON.stringify({ content, mode, publication, seedKeywords, documentFields, focusKeyword }),
|
|
276
|
+
signal
|
|
268
277
|
});
|
|
269
278
|
const text = await response.text();
|
|
270
279
|
if (!response.ok) {
|
|
271
280
|
const err = safeParseJson(text);
|
|
272
|
-
|
|
281
|
+
console.error("[seo-copilot] analyze error", response.status, err.error);
|
|
282
|
+
if (response.status === 429) throw new Error("Analysis service is busy. Please try again.");
|
|
283
|
+
if (response.status >= 500) throw new Error("Could not reach the SEO service.");
|
|
284
|
+
throw new Error("Something went wrong analyzing this document.");
|
|
273
285
|
}
|
|
274
286
|
return safeParseJson(text);
|
|
275
287
|
}
|
|
276
|
-
async function fetchChatStream(apiUrl, messages, documentContext, publication, keywordPanelData) {
|
|
288
|
+
async function fetchChatStream(apiUrl, messages, documentContext, publication, keywordPanelData, signal) {
|
|
277
289
|
const response = await fetch(`${apiUrl}/api/seo-copilot/chat`, {
|
|
278
290
|
method: "POST",
|
|
279
291
|
headers: { "Content-Type": "application/json" },
|
|
280
|
-
body: JSON.stringify({ messages, documentContext, publication, keywordPanelData })
|
|
292
|
+
body: JSON.stringify({ messages, documentContext, publication, keywordPanelData }),
|
|
293
|
+
signal
|
|
281
294
|
});
|
|
282
295
|
if (!response.ok) {
|
|
283
296
|
const err = await response.json().catch(() => ({ error: "Request failed" }));
|
|
284
|
-
|
|
297
|
+
console.error("[seo-copilot] chat error", response.status, err.error);
|
|
298
|
+
if (response.status === 429) throw new Error("Analysis service is busy. Please try again.");
|
|
299
|
+
if (response.status >= 500) throw new Error("Could not reach the SEO service.");
|
|
300
|
+
throw new Error("Something went wrong. Please try again.");
|
|
285
301
|
}
|
|
286
302
|
return response.body;
|
|
287
303
|
}
|
|
@@ -292,15 +308,19 @@ async function submitFeedback(apiUrl, data) {
|
|
|
292
308
|
body: JSON.stringify(data)
|
|
293
309
|
});
|
|
294
310
|
}
|
|
295
|
-
async function lookupKeywords(apiUrl, keywords) {
|
|
311
|
+
async function lookupKeywords(apiUrl, keywords, signal) {
|
|
296
312
|
const response = await fetch(`${apiUrl}/api/seo-copilot/keywords`, {
|
|
297
313
|
method: "POST",
|
|
298
314
|
headers: { "Content-Type": "application/json" },
|
|
299
|
-
body: JSON.stringify({ keywords })
|
|
315
|
+
body: JSON.stringify({ keywords }),
|
|
316
|
+
signal
|
|
300
317
|
});
|
|
301
318
|
if (!response.ok) {
|
|
302
319
|
const err = await response.json().catch(() => ({ error: "Request failed" }));
|
|
303
|
-
|
|
320
|
+
console.error("[seo-copilot] keywords error", response.status, err.error);
|
|
321
|
+
if (response.status === 429) throw new Error("Analysis service is busy. Please try again.");
|
|
322
|
+
if (response.status >= 500) throw new Error("Could not reach the SEO service.");
|
|
323
|
+
throw new Error("Something went wrong. Please try again.");
|
|
304
324
|
}
|
|
305
325
|
return response.json();
|
|
306
326
|
}
|
|
@@ -437,6 +457,8 @@ function useKeywordAnalysis(text, apiUrl, publication, seedKeywords, documentFie
|
|
|
437
457
|
return;
|
|
438
458
|
}
|
|
439
459
|
docVersionRef.current += 1;
|
|
460
|
+
volumeAbortRef.current?.abort();
|
|
461
|
+
volumeAbortRef.current = null;
|
|
440
462
|
const fresh = loadCached();
|
|
441
463
|
cached.current = fresh;
|
|
442
464
|
setAnalysisRaw(fresh.analysis);
|
|
@@ -474,15 +496,17 @@ function useKeywordAnalysis(text, apiUrl, publication, seedKeywords, documentFie
|
|
|
474
496
|
}, [text, deepAnalysis, aeoTextSnapshot]);
|
|
475
497
|
const lastAnalysisRef = useRef2(null);
|
|
476
498
|
const docVersionRef = useRef2(0);
|
|
499
|
+
const volumeAbortRef = useRef2(null);
|
|
477
500
|
useEffect2(() => {
|
|
478
501
|
if ((!text || text.trim().length < 20) && (!effectiveSeeds || effectiveSeeds.length === 0)) {
|
|
479
502
|
setAnalysis(null);
|
|
480
503
|
return;
|
|
481
504
|
}
|
|
482
505
|
let cancelled = false;
|
|
506
|
+
const controller = new AbortController();
|
|
483
507
|
setIsLoading(true);
|
|
484
508
|
setError(null);
|
|
485
|
-
fetchAnalysis(apiUrl, text, "realtime", publication, effectiveSeeds, documentFields, focusPrimary).then((result) => {
|
|
509
|
+
fetchAnalysis(apiUrl, text, "realtime", publication, effectiveSeeds, documentFields, focusPrimary, controller.signal).then((result) => {
|
|
486
510
|
if (cancelled) return;
|
|
487
511
|
const analysisResult = result;
|
|
488
512
|
lastAnalysisRef.current = analysisResult;
|
|
@@ -502,6 +526,7 @@ function useKeywordAnalysis(text, apiUrl, publication, seedKeywords, documentFie
|
|
|
502
526
|
doVolumeLookup(analysisResult, uncachedTerms);
|
|
503
527
|
}
|
|
504
528
|
}).catch((err) => {
|
|
529
|
+
if (err instanceof Error && err.name === "AbortError") return;
|
|
505
530
|
if (!cancelled) {
|
|
506
531
|
setError(err.message);
|
|
507
532
|
setIsLoading(false);
|
|
@@ -509,8 +534,9 @@ function useKeywordAnalysis(text, apiUrl, publication, seedKeywords, documentFie
|
|
|
509
534
|
});
|
|
510
535
|
return () => {
|
|
511
536
|
cancelled = true;
|
|
537
|
+
controller.abort();
|
|
512
538
|
};
|
|
513
|
-
}, [text, apiUrl, publication, effectiveSeeds?.join(","), focusPrimary]);
|
|
539
|
+
}, [text, apiUrl, publication, effectiveSeeds?.join(","), focusPrimary, JSON.stringify(documentFields)]);
|
|
514
540
|
const doVolumeLookup = useCallback((analysisResult, terms) => {
|
|
515
541
|
setIsVolumesLoading(true);
|
|
516
542
|
const myVersion = docVersionRef.current;
|
|
@@ -529,7 +555,10 @@ function useKeywordAnalysis(text, apiUrl, publication, seedKeywords, documentFie
|
|
|
529
555
|
setIsVolumesLoading(false);
|
|
530
556
|
return;
|
|
531
557
|
}
|
|
532
|
-
|
|
558
|
+
volumeAbortRef.current?.abort();
|
|
559
|
+
const controller = new AbortController();
|
|
560
|
+
volumeAbortRef.current = controller;
|
|
561
|
+
lookupKeywords(apiUrl, lookupTerms, controller.signal).then(({ results }) => {
|
|
533
562
|
if (docVersionRef.current !== myVersion) return;
|
|
534
563
|
results.forEach((r) => volumeMapRef.current.set(r.keyword.toLowerCase(), r));
|
|
535
564
|
const current = lastAnalysisRef.current || analysisResult;
|
|
@@ -542,7 +571,8 @@ function useKeywordAnalysis(text, apiUrl, publication, seedKeywords, documentFie
|
|
|
542
571
|
} catch {
|
|
543
572
|
}
|
|
544
573
|
setIsVolumesLoading(false);
|
|
545
|
-
}).catch(() => {
|
|
574
|
+
}).catch((err) => {
|
|
575
|
+
if (err instanceof Error && err.name === "AbortError") return;
|
|
546
576
|
if (docVersionRef.current !== myVersion) return;
|
|
547
577
|
setIsVolumesLoading(false);
|
|
548
578
|
});
|
|
@@ -609,16 +639,10 @@ function useSEOChat(apiUrl, documentText, publication, keywordPanelData, documen
|
|
|
609
639
|
}
|
|
610
640
|
}, [chatCacheKey]);
|
|
611
641
|
const [messages, setMessagesRaw] = useState3(loadCachedMessages);
|
|
642
|
+
const messagesRef = useRef3([]);
|
|
612
643
|
const setMessages = useCallback2((msgs) => {
|
|
613
|
-
setMessagesRaw(
|
|
614
|
-
|
|
615
|
-
try {
|
|
616
|
-
localStorage.setItem(chatCacheKey, JSON.stringify(next));
|
|
617
|
-
} catch {
|
|
618
|
-
}
|
|
619
|
-
return next;
|
|
620
|
-
});
|
|
621
|
-
}, [chatCacheKey]);
|
|
644
|
+
setMessagesRaw(msgs);
|
|
645
|
+
}, []);
|
|
622
646
|
const [isStreaming, setIsStreaming] = useState3(false);
|
|
623
647
|
const [historyLoaded, setHistoryLoaded] = useState3(false);
|
|
624
648
|
const sanityUser = useCurrentUser();
|
|
@@ -628,6 +652,24 @@ function useSEOChat(apiUrl, documentText, publication, keywordPanelData, documen
|
|
|
628
652
|
userId.current = sanityUser.id;
|
|
629
653
|
}
|
|
630
654
|
}, [sanityUser?.id]);
|
|
655
|
+
useEffect3(() => {
|
|
656
|
+
messagesRef.current = messages;
|
|
657
|
+
}, [messages]);
|
|
658
|
+
useEffect3(() => {
|
|
659
|
+
const timer = setTimeout(() => {
|
|
660
|
+
try {
|
|
661
|
+
localStorage.setItem(chatCacheKey, JSON.stringify(messages));
|
|
662
|
+
} catch {
|
|
663
|
+
}
|
|
664
|
+
}, 500);
|
|
665
|
+
return () => clearTimeout(timer);
|
|
666
|
+
}, [messages, chatCacheKey]);
|
|
667
|
+
const streamAbortRef = useRef3(null);
|
|
668
|
+
useEffect3(() => {
|
|
669
|
+
return () => {
|
|
670
|
+
streamAbortRef.current?.abort();
|
|
671
|
+
};
|
|
672
|
+
}, []);
|
|
631
673
|
const saveTimerRef = useRef3(null);
|
|
632
674
|
const opVersionRef = useRef3(0);
|
|
633
675
|
const didInitRef = useRef3(false);
|
|
@@ -637,6 +679,8 @@ function useSEOChat(apiUrl, documentText, publication, keywordPanelData, documen
|
|
|
637
679
|
return;
|
|
638
680
|
}
|
|
639
681
|
opVersionRef.current += 1;
|
|
682
|
+
streamAbortRef.current?.abort();
|
|
683
|
+
streamAbortRef.current = null;
|
|
640
684
|
setMessagesRaw(loadCachedMessages());
|
|
641
685
|
setIsStreaming(false);
|
|
642
686
|
setHistoryLoaded(false);
|
|
@@ -671,16 +715,19 @@ function useSEOChat(apiUrl, documentText, publication, keywordPanelData, documen
|
|
|
671
715
|
async (text) => {
|
|
672
716
|
const myVersion = opVersionRef.current;
|
|
673
717
|
const userMessage = { role: "user", content: text };
|
|
674
|
-
const updatedMessages = [...
|
|
718
|
+
const updatedMessages = [...messagesRef.current, userMessage];
|
|
675
719
|
setMessages(updatedMessages);
|
|
676
720
|
setIsStreaming(true);
|
|
721
|
+
const controller = new AbortController();
|
|
722
|
+
streamAbortRef.current = controller;
|
|
677
723
|
try {
|
|
678
724
|
const stream = await fetchChatStream(
|
|
679
725
|
apiUrl,
|
|
680
726
|
updatedMessages,
|
|
681
727
|
documentText,
|
|
682
728
|
publication,
|
|
683
|
-
keywordPanelData
|
|
729
|
+
keywordPanelData,
|
|
730
|
+
controller.signal
|
|
684
731
|
);
|
|
685
732
|
if (!stream) {
|
|
686
733
|
setIsStreaming(false);
|
|
@@ -740,6 +787,10 @@ function useSEOChat(apiUrl, documentText, publication, keywordPanelData, documen
|
|
|
740
787
|
scheduleSave(finalMessages);
|
|
741
788
|
}
|
|
742
789
|
} catch (err) {
|
|
790
|
+
if (err instanceof Error && err.name === "AbortError") {
|
|
791
|
+
setIsStreaming(false);
|
|
792
|
+
return;
|
|
793
|
+
}
|
|
743
794
|
if (opVersionRef.current !== myVersion) {
|
|
744
795
|
setIsStreaming(false);
|
|
745
796
|
return;
|
|
@@ -752,7 +803,7 @@ function useSEOChat(apiUrl, documentText, publication, keywordPanelData, documen
|
|
|
752
803
|
}
|
|
753
804
|
if (opVersionRef.current === myVersion) setIsStreaming(false);
|
|
754
805
|
},
|
|
755
|
-
[
|
|
806
|
+
[apiUrl, documentText, publication, keywordPanelData, scheduleSave]
|
|
756
807
|
);
|
|
757
808
|
const clearChat = useCallback2(() => {
|
|
758
809
|
setMessages([]);
|
|
@@ -882,6 +933,14 @@ var INJECTED_CSS = `
|
|
|
882
933
|
0%, 100% { opacity: 0.5; }
|
|
883
934
|
50% { opacity: 1; }
|
|
884
935
|
}
|
|
936
|
+
@keyframes onboard-in {
|
|
937
|
+
from { opacity: 0; transform: translateY(-6px) scale(0.97); }
|
|
938
|
+
to { opacity: 1; transform: translateY(0) scale(1); }
|
|
939
|
+
}
|
|
940
|
+
@keyframes onboard-out {
|
|
941
|
+
from { opacity: 1; transform: translateY(0) scale(1); }
|
|
942
|
+
to { opacity: 0; transform: translateY(-6px) scale(0.97); }
|
|
943
|
+
}
|
|
885
944
|
.prose-chat { font-size: 12.5px; line-height: 1.65; color: #475569; font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif; }
|
|
886
945
|
.prose-chat h1 { font-size: 14px; font-weight: 700; color: #1e293b; margin: 10px 0 5px 0; line-height: 1.35; }
|
|
887
946
|
.prose-chat h2, .prose-chat h3 { font-size: 13px; font-weight: 700; color: #1e293b; margin: 10px 0 5px 0; line-height: 1.35; }
|
|
@@ -1420,7 +1479,7 @@ function LightbulbButton({ onClick, isLoading }) {
|
|
|
1420
1479
|
whiteSpace: "nowrap",
|
|
1421
1480
|
pointerEvents: "none",
|
|
1422
1481
|
zIndex: 10
|
|
1423
|
-
}, children: "
|
|
1482
|
+
}, children: "See suggestion" })
|
|
1424
1483
|
]
|
|
1425
1484
|
}
|
|
1426
1485
|
);
|
|
@@ -1623,6 +1682,119 @@ function PrimaryKeywordSelector({
|
|
|
1623
1682
|
}) })
|
|
1624
1683
|
] });
|
|
1625
1684
|
}
|
|
1685
|
+
function SecondaryKeywordSelector({
|
|
1686
|
+
options,
|
|
1687
|
+
selectedTerm,
|
|
1688
|
+
onSelect
|
|
1689
|
+
}) {
|
|
1690
|
+
const [customInputOpen, setCustomInputOpen] = useState8(false);
|
|
1691
|
+
const [customValue, setCustomValue] = useState8("");
|
|
1692
|
+
const handleCustomSubmit = () => {
|
|
1693
|
+
const trimmed = customValue.trim();
|
|
1694
|
+
if (trimmed) {
|
|
1695
|
+
onSelect(trimmed);
|
|
1696
|
+
setCustomValue("");
|
|
1697
|
+
setCustomInputOpen(false);
|
|
1698
|
+
}
|
|
1699
|
+
};
|
|
1700
|
+
const opts = selectedTerm && !options.some((o) => o.term === selectedTerm) ? [...options, { term: selectedTerm, volume: null }] : options;
|
|
1701
|
+
return /* @__PURE__ */ jsxs4("div", { style: cardStyle, children: [
|
|
1702
|
+
/* @__PURE__ */ jsx5(
|
|
1703
|
+
SectionHeader,
|
|
1704
|
+
{
|
|
1705
|
+
label: "Secondary Keyword",
|
|
1706
|
+
iconColor: MJH_BLUE,
|
|
1707
|
+
actionButton: /* @__PURE__ */ jsxs4("div", { style: { display: "flex", alignItems: "center", gap: 6 }, children: [
|
|
1708
|
+
/* @__PURE__ */ jsx5("span", { style: { fontSize: 9, fontWeight: 700, letterSpacing: "0.05em", textTransform: "uppercase", color: "#9ca3af" }, children: "Optional" }),
|
|
1709
|
+
/* @__PURE__ */ jsx5(PencilButton, { onClick: () => setCustomInputOpen(!customInputOpen), active: customInputOpen })
|
|
1710
|
+
] })
|
|
1711
|
+
}
|
|
1712
|
+
),
|
|
1713
|
+
/* @__PURE__ */ jsx5("div", { style: { fontSize: 11, color: "#4b5563", lineHeight: 1.5, marginBottom: 8 }, children: "Pick one more keyword to optimize for. Copilot then checks your title, meta, URL, headings, and images against both keywords." }),
|
|
1714
|
+
customInputOpen && /* @__PURE__ */ jsxs4("div", { style: { marginBottom: 8, display: "flex", gap: 6 }, children: [
|
|
1715
|
+
/* @__PURE__ */ jsx5(
|
|
1716
|
+
"input",
|
|
1717
|
+
{
|
|
1718
|
+
type: "text",
|
|
1719
|
+
value: customValue,
|
|
1720
|
+
onChange: (e) => setCustomValue(e.target.value),
|
|
1721
|
+
onKeyDown: (e) => {
|
|
1722
|
+
if (e.key === "Enter") handleCustomSubmit();
|
|
1723
|
+
},
|
|
1724
|
+
placeholder: "Type a custom secondary keyword",
|
|
1725
|
+
autoFocus: true,
|
|
1726
|
+
style: { flex: 1, padding: "5px 8px", fontSize: 12, borderRadius: 8, border: "1px solid #e5e7eb", outline: "none", fontFamily: "inherit" }
|
|
1727
|
+
}
|
|
1728
|
+
),
|
|
1729
|
+
/* @__PURE__ */ jsx5(
|
|
1730
|
+
"button",
|
|
1731
|
+
{
|
|
1732
|
+
onClick: handleCustomSubmit,
|
|
1733
|
+
disabled: !customValue.trim(),
|
|
1734
|
+
style: {
|
|
1735
|
+
padding: "5px 10px",
|
|
1736
|
+
fontSize: 11,
|
|
1737
|
+
fontWeight: 600,
|
|
1738
|
+
borderRadius: 6,
|
|
1739
|
+
border: "none",
|
|
1740
|
+
background: customValue.trim() ? MJH_BLUE : "#e5e7eb",
|
|
1741
|
+
color: customValue.trim() ? "#ffffff" : "#9ca3af",
|
|
1742
|
+
cursor: customValue.trim() ? "pointer" : "not-allowed"
|
|
1743
|
+
},
|
|
1744
|
+
children: "Set"
|
|
1745
|
+
}
|
|
1746
|
+
)
|
|
1747
|
+
] }),
|
|
1748
|
+
/* @__PURE__ */ jsxs4("div", { style: { display: "flex", flexDirection: "column", gap: 6 }, children: [
|
|
1749
|
+
/* @__PURE__ */ jsx5(SecondaryOptionRow, { term: "", label: "None", selected: !selectedTerm, onSelect: () => onSelect("") }),
|
|
1750
|
+
opts.map((o) => /* @__PURE__ */ jsx5(
|
|
1751
|
+
SecondaryOptionRow,
|
|
1752
|
+
{
|
|
1753
|
+
term: o.term,
|
|
1754
|
+
label: o.term,
|
|
1755
|
+
volume: o.volume,
|
|
1756
|
+
selected: o.term === selectedTerm,
|
|
1757
|
+
onSelect: () => onSelect(o.term)
|
|
1758
|
+
},
|
|
1759
|
+
o.term
|
|
1760
|
+
))
|
|
1761
|
+
] })
|
|
1762
|
+
] });
|
|
1763
|
+
}
|
|
1764
|
+
function SecondaryOptionRow({ term, label, volume, selected, onSelect }) {
|
|
1765
|
+
return /* @__PURE__ */ jsxs4(
|
|
1766
|
+
"div",
|
|
1767
|
+
{
|
|
1768
|
+
onClick: onSelect,
|
|
1769
|
+
style: {
|
|
1770
|
+
display: "flex",
|
|
1771
|
+
alignItems: "center",
|
|
1772
|
+
gap: 8,
|
|
1773
|
+
padding: "6px 8px",
|
|
1774
|
+
borderRadius: 8,
|
|
1775
|
+
cursor: "pointer",
|
|
1776
|
+
background: selected ? "rgba(0,93,172,0.06)" : "transparent",
|
|
1777
|
+
border: selected ? "1px solid rgba(0,93,172,0.2)" : "1px solid transparent",
|
|
1778
|
+
transition: "all 150ms"
|
|
1779
|
+
},
|
|
1780
|
+
children: [
|
|
1781
|
+
/* @__PURE__ */ jsx5("div", { style: {
|
|
1782
|
+
width: 14,
|
|
1783
|
+
height: 14,
|
|
1784
|
+
borderRadius: "50%",
|
|
1785
|
+
border: selected ? "none" : "2px solid #d1d5db",
|
|
1786
|
+
background: selected ? MJH_BLUE : "transparent",
|
|
1787
|
+
flexShrink: 0,
|
|
1788
|
+
display: "flex",
|
|
1789
|
+
alignItems: "center",
|
|
1790
|
+
justifyContent: "center"
|
|
1791
|
+
}, children: selected && /* @__PURE__ */ jsx5("div", { style: { width: 6, height: 6, borderRadius: "50%", background: "#ffffff" } }) }),
|
|
1792
|
+
/* @__PURE__ */ jsx5("span", { style: { fontSize: 12, fontWeight: selected ? 600 : 400, color: term ? selected ? "#00468a" : "#374151" : "#6b7280", flex: 1, minWidth: 0 }, children: label }),
|
|
1793
|
+
volume != null && /* @__PURE__ */ jsx5("span", { style: { fontSize: 11, fontWeight: 600, color: "#1f2937" }, children: volume === 0 ? "N/A" : `${abbrevVol(volume)}/mo` })
|
|
1794
|
+
]
|
|
1795
|
+
}
|
|
1796
|
+
);
|
|
1797
|
+
}
|
|
1626
1798
|
var PLACEMENT_FILTERS = [
|
|
1627
1799
|
{ key: "inBody", label: "Body", letter: "B" },
|
|
1628
1800
|
{ key: "inTitle", label: "Title", letter: "T" },
|
|
@@ -2103,6 +2275,8 @@ function KeywordPanel({
|
|
|
2103
2275
|
seedKeywords = [],
|
|
2104
2276
|
onSeedsChange,
|
|
2105
2277
|
onSelectPrimary,
|
|
2278
|
+
secondaryKeyword = "",
|
|
2279
|
+
onSelectSecondary,
|
|
2106
2280
|
documentFields,
|
|
2107
2281
|
documentId,
|
|
2108
2282
|
externalAnalysis
|
|
@@ -2162,7 +2336,36 @@ function KeywordPanel({
|
|
|
2162
2336
|
placement: computePlacementClient(c.term, text, documentFields)
|
|
2163
2337
|
}));
|
|
2164
2338
|
const activeTerm = candidates.find((c) => c.term === selectedPrimaryTerm) ? selectedPrimaryTerm : candidates[0]?.term ?? "";
|
|
2339
|
+
const secondaryOptions = [];
|
|
2340
|
+
const seenSecondary = /* @__PURE__ */ new Set();
|
|
2341
|
+
for (const c of candidates) {
|
|
2342
|
+
const key = c.term.toLowerCase();
|
|
2343
|
+
if (!seenSecondary.has(key)) {
|
|
2344
|
+
seenSecondary.add(key);
|
|
2345
|
+
secondaryOptions.push({ term: c.term, volume: c.volume });
|
|
2346
|
+
}
|
|
2347
|
+
}
|
|
2348
|
+
for (const kw of suggestedKeywords) {
|
|
2349
|
+
const key = kw.term.toLowerCase();
|
|
2350
|
+
if (!seenSecondary.has(key)) {
|
|
2351
|
+
seenSecondary.add(key);
|
|
2352
|
+
secondaryOptions.push({ term: kw.term, volume: kw.volume });
|
|
2353
|
+
}
|
|
2354
|
+
}
|
|
2165
2355
|
return /* @__PURE__ */ jsxs4("div", { style: { padding: 12, display: "flex", flexDirection: "column", gap: 12 }, children: [
|
|
2356
|
+
/* @__PURE__ */ jsx5("div", { style: {
|
|
2357
|
+
...cardStyle,
|
|
2358
|
+
padding: "11px 13px",
|
|
2359
|
+
background: "rgba(0,93,172,0.05)",
|
|
2360
|
+
boxShadow: "inset 0 0 0 1px rgba(0,93,172,0.12)"
|
|
2361
|
+
}, children: /* @__PURE__ */ jsxs4("div", { style: { fontSize: 11.5, color: "#1f2937", lineHeight: 1.55 }, children: [
|
|
2362
|
+
/* @__PURE__ */ jsx5("strong", { style: { color: "#00468a" }, children: "Choose your target keywords." }),
|
|
2363
|
+
" Pick one ",
|
|
2364
|
+
/* @__PURE__ */ jsx5("strong", { children: "Primary" }),
|
|
2365
|
+
" keyword (required) and, optionally, one ",
|
|
2366
|
+
/* @__PURE__ */ jsx5("strong", { children: "Secondary" }),
|
|
2367
|
+
" keyword. Copilot optimizes the whole article - title, meta, URL, headings, and images - toward both."
|
|
2368
|
+
] }) }),
|
|
2166
2369
|
onSeedsChange && /* @__PURE__ */ jsx5(SeedKeywordInput, { seeds: seedKeywords, onSeedsChange }),
|
|
2167
2370
|
/* @__PURE__ */ jsx5(
|
|
2168
2371
|
PrimaryKeywordSelector,
|
|
@@ -2176,6 +2379,14 @@ function KeywordPanel({
|
|
|
2176
2379
|
publication
|
|
2177
2380
|
}
|
|
2178
2381
|
),
|
|
2382
|
+
onSelectSecondary && secondaryOptions.length > 0 && /* @__PURE__ */ jsx5(
|
|
2383
|
+
SecondaryKeywordSelector,
|
|
2384
|
+
{
|
|
2385
|
+
options: secondaryOptions,
|
|
2386
|
+
selectedTerm: secondaryKeyword,
|
|
2387
|
+
onSelect: (term) => onSelectSecondary(term)
|
|
2388
|
+
}
|
|
2389
|
+
),
|
|
2179
2390
|
suggestedKeywords.length > 0 && /* @__PURE__ */ jsx5(
|
|
2180
2391
|
SuggestedKeywordsCard,
|
|
2181
2392
|
{
|
|
@@ -2746,12 +2957,127 @@ function TabBar({ tabs, activeTab, onTabChange }) {
|
|
|
2746
2957
|
);
|
|
2747
2958
|
}
|
|
2748
2959
|
|
|
2960
|
+
// src/components/OnboardingPopup.tsx
|
|
2961
|
+
import { Fragment as Fragment4, jsx as jsx8, jsxs as jsxs7 } from "react/jsx-runtime";
|
|
2962
|
+
function OnboardingInfoButton({ onClick }) {
|
|
2963
|
+
return /* @__PURE__ */ jsx8(
|
|
2964
|
+
"button",
|
|
2965
|
+
{
|
|
2966
|
+
onClick: (e) => {
|
|
2967
|
+
e.stopPropagation();
|
|
2968
|
+
onClick();
|
|
2969
|
+
},
|
|
2970
|
+
onMouseDown: (e) => e.stopPropagation(),
|
|
2971
|
+
style: {
|
|
2972
|
+
background: "rgba(0,93,172,0.08)",
|
|
2973
|
+
border: "none",
|
|
2974
|
+
borderRadius: "50%",
|
|
2975
|
+
width: 20,
|
|
2976
|
+
height: 20,
|
|
2977
|
+
cursor: "pointer",
|
|
2978
|
+
padding: 0,
|
|
2979
|
+
display: "flex",
|
|
2980
|
+
alignItems: "center",
|
|
2981
|
+
justifyContent: "center",
|
|
2982
|
+
color: MJH_BLUE,
|
|
2983
|
+
flexShrink: 0
|
|
2984
|
+
},
|
|
2985
|
+
title: "How SEO Copilot works",
|
|
2986
|
+
"aria-label": "How SEO Copilot works",
|
|
2987
|
+
children: /* @__PURE__ */ jsx8("svg", { width: "13", height: "13", viewBox: "0 0 20 20", fill: "currentColor", "aria-hidden": "true", children: /* @__PURE__ */ jsx8("path", { fillRule: "evenodd", d: "M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-7-4a1 1 0 11-2 0 1 1 0 012 0zM9 9a.75.75 0 000 1.5h.253a.25.25 0 01.244.304l-.459 2.066A1.75 1.75 0 0010.747 15H11a.75.75 0 000-1.5h-.253a.25.25 0 01-.244-.304l.459-2.066A1.75 1.75 0 009.253 9H9z", clipRule: "evenodd" }) })
|
|
2988
|
+
}
|
|
2989
|
+
);
|
|
2990
|
+
}
|
|
2991
|
+
function OnboardingCard({ onDismiss, closing }) {
|
|
2992
|
+
return /* @__PURE__ */ jsxs7(Fragment4, { children: [
|
|
2993
|
+
/* @__PURE__ */ jsx8(
|
|
2994
|
+
"div",
|
|
2995
|
+
{
|
|
2996
|
+
onClick: onDismiss,
|
|
2997
|
+
style: {
|
|
2998
|
+
position: "absolute",
|
|
2999
|
+
inset: 0,
|
|
3000
|
+
zIndex: 60,
|
|
3001
|
+
background: "transparent",
|
|
3002
|
+
cursor: "pointer"
|
|
3003
|
+
}
|
|
3004
|
+
}
|
|
3005
|
+
),
|
|
3006
|
+
/* @__PURE__ */ jsxs7(
|
|
3007
|
+
"div",
|
|
3008
|
+
{
|
|
3009
|
+
onClick: (e) => e.stopPropagation(),
|
|
3010
|
+
style: {
|
|
3011
|
+
position: "absolute",
|
|
3012
|
+
top: 50,
|
|
3013
|
+
right: 10,
|
|
3014
|
+
left: 10,
|
|
3015
|
+
maxWidth: 320,
|
|
3016
|
+
marginLeft: "auto",
|
|
3017
|
+
zIndex: 61,
|
|
3018
|
+
borderRadius: 18,
|
|
3019
|
+
padding: "14px 16px 16px",
|
|
3020
|
+
// Amorphous blue glass
|
|
3021
|
+
background: "linear-gradient(155deg, rgba(0,93,172,0.16), rgba(0,93,172,0.08))",
|
|
3022
|
+
backdropFilter: "blur(20px) saturate(170%)",
|
|
3023
|
+
WebkitBackdropFilter: "blur(20px) saturate(170%)",
|
|
3024
|
+
boxShadow: "inset 0 0 0 1px rgba(255,255,255,0.55), inset 1.5px 2px 1px -1px rgba(255,255,255,0.9), 0 10px 30px rgba(0,93,172,0.22), 0 2px 8px rgba(0,0,0,0.12)",
|
|
3025
|
+
animation: `${closing ? "onboard-out" : "onboard-in"} ${closing ? 180 : 240}ms ease-out forwards`
|
|
3026
|
+
},
|
|
3027
|
+
children: [
|
|
3028
|
+
/* @__PURE__ */ jsxs7("div", { style: { display: "flex", alignItems: "center", justifyContent: "space-between", gap: 8, marginBottom: 6 }, children: [
|
|
3029
|
+
/* @__PURE__ */ jsx8("span", { style: { fontSize: 13, fontWeight: 800, color: "#00468a", letterSpacing: "-0.01em" }, children: "Welcome to SEO Copilot" }),
|
|
3030
|
+
/* @__PURE__ */ jsx8(
|
|
3031
|
+
"button",
|
|
3032
|
+
{
|
|
3033
|
+
onClick: onDismiss,
|
|
3034
|
+
style: { background: "none", border: "none", cursor: "pointer", padding: 2, display: "flex", color: "#00468a", opacity: 0.7 },
|
|
3035
|
+
title: "Dismiss",
|
|
3036
|
+
"aria-label": "Dismiss",
|
|
3037
|
+
children: /* @__PURE__ */ jsx8("svg", { width: "14", height: "14", viewBox: "0 0 20 20", fill: "currentColor", children: /* @__PURE__ */ jsx8("path", { d: "M6.28 5.22a.75.75 0 00-1.06 1.06L8.94 10l-3.72 3.72a.75.75 0 101.06 1.06L10 11.06l3.72 3.72a.75.75 0 101.06-1.06L11.06 10l3.72-3.72a.75.75 0 00-1.06-1.06L10 8.94 6.28 5.22z" }) })
|
|
3038
|
+
}
|
|
3039
|
+
)
|
|
3040
|
+
] }),
|
|
3041
|
+
/* @__PURE__ */ jsxs7("div", { style: { fontSize: 11.5, color: "#13335a", lineHeight: 1.6 }, children: [
|
|
3042
|
+
"Start on the ",
|
|
3043
|
+
/* @__PURE__ */ jsx8("strong", { children: "Keywords" }),
|
|
3044
|
+
" tab. Choose one ",
|
|
3045
|
+
/* @__PURE__ */ jsx8("strong", { children: "Primary" }),
|
|
3046
|
+
" keyword (required) and, optionally, one ",
|
|
3047
|
+
/* @__PURE__ */ jsx8("strong", { children: "Secondary" }),
|
|
3048
|
+
" keyword. Copilot then optimizes the whole article - title, meta, URL, headings, and images - toward both."
|
|
3049
|
+
] }),
|
|
3050
|
+
/* @__PURE__ */ jsx8(
|
|
3051
|
+
"button",
|
|
3052
|
+
{
|
|
3053
|
+
onClick: onDismiss,
|
|
3054
|
+
style: {
|
|
3055
|
+
marginTop: 12,
|
|
3056
|
+
width: "100%",
|
|
3057
|
+
padding: "7px 12px",
|
|
3058
|
+
fontSize: 11.5,
|
|
3059
|
+
fontWeight: 700,
|
|
3060
|
+
color: "#ffffff",
|
|
3061
|
+
background: MJH_BLUE,
|
|
3062
|
+
border: "none",
|
|
3063
|
+
borderRadius: 8,
|
|
3064
|
+
cursor: "pointer"
|
|
3065
|
+
},
|
|
3066
|
+
children: "Got it"
|
|
3067
|
+
}
|
|
3068
|
+
)
|
|
3069
|
+
]
|
|
3070
|
+
}
|
|
3071
|
+
)
|
|
3072
|
+
] });
|
|
3073
|
+
}
|
|
3074
|
+
|
|
2749
3075
|
// src/components/tabs/SummaryTab.tsx
|
|
2750
3076
|
import { useMemo, useState as useState12 } from "react";
|
|
2751
3077
|
|
|
2752
3078
|
// src/components/ShimmerLoader.tsx
|
|
2753
3079
|
import { useEffect as useEffect9, useState as useState11 } from "react";
|
|
2754
|
-
import { jsx as
|
|
3080
|
+
import { jsx as jsx9, jsxs as jsxs8 } from "react/jsx-runtime";
|
|
2755
3081
|
var keyframesInjected = false;
|
|
2756
3082
|
var KEYFRAMES = `
|
|
2757
3083
|
@keyframes seo-copilot-text-shimmer {
|
|
@@ -2760,13 +3086,13 @@ var KEYFRAMES = `
|
|
|
2760
3086
|
}
|
|
2761
3087
|
`;
|
|
2762
3088
|
function LoaderBars({ color = MJH_GOLD }) {
|
|
2763
|
-
return /* @__PURE__ */
|
|
3089
|
+
return /* @__PURE__ */ jsx9(
|
|
2764
3090
|
"div",
|
|
2765
3091
|
{
|
|
2766
3092
|
role: "status",
|
|
2767
3093
|
"aria-label": "Loading",
|
|
2768
3094
|
style: { display: "inline-flex", alignItems: "flex-end", gap: 2, height: 14, flexShrink: 0 },
|
|
2769
|
-
children: [1, 2, 3].map((i) => /* @__PURE__ */
|
|
3095
|
+
children: [1, 2, 3].map((i) => /* @__PURE__ */ jsx9(
|
|
2770
3096
|
"div",
|
|
2771
3097
|
{
|
|
2772
3098
|
style: {
|
|
@@ -2806,7 +3132,7 @@ function ShimmerLoader({
|
|
|
2806
3132
|
return () => clearInterval(id);
|
|
2807
3133
|
}, [messages.length, intervalMs]);
|
|
2808
3134
|
const text = messages[idx] || messages[0] || "";
|
|
2809
|
-
return /* @__PURE__ */
|
|
3135
|
+
return /* @__PURE__ */ jsxs8(
|
|
2810
3136
|
"div",
|
|
2811
3137
|
{
|
|
2812
3138
|
style: {
|
|
@@ -2818,8 +3144,8 @@ function ShimmerLoader({
|
|
|
2818
3144
|
letterSpacing: "0.01em"
|
|
2819
3145
|
},
|
|
2820
3146
|
children: [
|
|
2821
|
-
/* @__PURE__ */
|
|
2822
|
-
/* @__PURE__ */
|
|
3147
|
+
/* @__PURE__ */ jsx9(LoaderBars, { color: iconColor }),
|
|
3148
|
+
/* @__PURE__ */ jsx9(
|
|
2823
3149
|
"span",
|
|
2824
3150
|
{
|
|
2825
3151
|
style: {
|
|
@@ -2849,6 +3175,12 @@ var DEFAULT_GENERATE_ALL_MESSAGES = [
|
|
|
2849
3175
|
];
|
|
2850
3176
|
|
|
2851
3177
|
// src/lib/scoring.ts
|
|
3178
|
+
function countWholeMatches(haystack, needle) {
|
|
3179
|
+
if (!needle) return 0;
|
|
3180
|
+
const esc = needle.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
3181
|
+
const m = haystack.match(new RegExp(`\\b${esc}\\b`, "g"));
|
|
3182
|
+
return m ? m.length : 0;
|
|
3183
|
+
}
|
|
2852
3184
|
function calculateContentScoreDetailed(content, analysis, documentFields) {
|
|
2853
3185
|
if (!content || !analysis) {
|
|
2854
3186
|
return { total: 0, components: [] };
|
|
@@ -2858,24 +3190,34 @@ function calculateContentScoreDetailed(content, analysis, documentFields) {
|
|
|
2858
3190
|
const components = [];
|
|
2859
3191
|
const primaryTerm = (analysis.primaryKeyword?.term || "").toLowerCase();
|
|
2860
3192
|
if (primaryTerm) {
|
|
2861
|
-
const
|
|
2862
|
-
const
|
|
2863
|
-
|
|
2864
|
-
|
|
3193
|
+
const tokens = primaryTerm.split(/\s+/).filter((t) => t.length > 1);
|
|
3194
|
+
const phraseCount = countWholeMatches(lowerContent, primaryTerm);
|
|
3195
|
+
let occurrences = phraseCount;
|
|
3196
|
+
let viaTokens = false;
|
|
3197
|
+
if (phraseCount === 0 && tokens.length > 0) {
|
|
3198
|
+
const counts = tokens.map((t) => countWholeMatches(lowerContent, t));
|
|
3199
|
+
if (counts.every((c) => c > 0)) {
|
|
3200
|
+
occurrences = Math.min(...counts);
|
|
3201
|
+
viaTokens = true;
|
|
3202
|
+
}
|
|
3203
|
+
}
|
|
2865
3204
|
const primaryWordCount = Math.max(1, primaryTerm.split(/\s+/).filter(Boolean).length);
|
|
2866
3205
|
let pts = 0;
|
|
2867
3206
|
let detail;
|
|
2868
|
-
if (
|
|
3207
|
+
if (occurrences === 0) {
|
|
2869
3208
|
detail = `Primary keyword "${primaryTerm}" not found in content`;
|
|
2870
3209
|
} else {
|
|
2871
3210
|
pts += 12;
|
|
2872
|
-
const density = words > 0 ?
|
|
3211
|
+
const density = words > 0 ? (viaTokens ? occurrences : occurrences * primaryWordCount) / words * 100 : 0;
|
|
2873
3212
|
if (density >= 0.5 && density <= 2.5) {
|
|
2874
3213
|
pts += 13;
|
|
2875
3214
|
detail = `Primary keyword present, density ${density.toFixed(2)}% (ideal range)`;
|
|
2876
3215
|
} else if (density < 0.5) {
|
|
2877
3216
|
pts += 7;
|
|
2878
3217
|
detail = `Primary keyword present but density only ${density.toFixed(2)}% - aim for 0.5-2.5%`;
|
|
3218
|
+
} else if (viaTokens && density <= 6) {
|
|
3219
|
+
pts += 11;
|
|
3220
|
+
detail = `Primary keyword strongly represented (${density.toFixed(2)}%)`;
|
|
2879
3221
|
} else {
|
|
2880
3222
|
pts += 4;
|
|
2881
3223
|
detail = `Primary keyword over-used at ${density.toFixed(2)}% density - reduce to 0.5-2.5%`;
|
|
@@ -2919,7 +3261,8 @@ function calculateContentScoreDetailed(content, analysis, documentFields) {
|
|
|
2919
3261
|
if (documentFields) {
|
|
2920
3262
|
hasH1orTitle = !!(documentFields.title && documentFields.title.trim());
|
|
2921
3263
|
const det = documentFields.headingsDetailed;
|
|
2922
|
-
|
|
3264
|
+
const detHasSub = Array.isArray(det) && det.some((h) => h.level >= 2);
|
|
3265
|
+
hasSubheadings = detHasSub || (documentFields.headings?.length || 0) > 0;
|
|
2923
3266
|
} else {
|
|
2924
3267
|
hasH1orTitle = /^#\s|<h1/im.test(content);
|
|
2925
3268
|
hasSubheadings = /^##\s|^###\s|<h2|<h3/im.test(content);
|
|
@@ -2947,8 +3290,7 @@ function calculateContentScoreDetailed(content, analysis, documentFields) {
|
|
|
2947
3290
|
if (documentFields) {
|
|
2948
3291
|
qCount = (documentFields.headings || []).filter((h) => h.trim().endsWith("?")).length;
|
|
2949
3292
|
} else {
|
|
2950
|
-
|
|
2951
|
-
qCount = questionHeadings?.length || 0;
|
|
3293
|
+
qCount = (content.match(/^#{1,6}\s+.*\?$/gm) || []).length + (content.match(/<h[1-6][^>]*>.*\?<\/h[1-6]>/gi) || []).length;
|
|
2952
3294
|
}
|
|
2953
3295
|
let aeoPts = 0;
|
|
2954
3296
|
if (qCount >= 3) aeoPts = 10;
|
|
@@ -2968,9 +3310,22 @@ function tokensContain(haystack, needle) {
|
|
|
2968
3310
|
const lower = haystack.toLowerCase();
|
|
2969
3311
|
return tokens.every((t) => lower.includes(t));
|
|
2970
3312
|
}
|
|
3313
|
+
function keywordLeadsSlug(slug, primaryKeyword) {
|
|
3314
|
+
const slugWords = slug.toLowerCase().replace(/[^a-z0-9]+/g, " ").trim().split(/\s+/).filter(Boolean);
|
|
3315
|
+
const tokens = primaryKeyword.toLowerCase().split(/\s+/).filter((t) => t.length > 1);
|
|
3316
|
+
if (tokens.length === 0 || slugWords.length === 0) return true;
|
|
3317
|
+
let earliest = Infinity;
|
|
3318
|
+
for (const t of tokens) {
|
|
3319
|
+
const idx = slugWords.findIndex((w) => w.includes(t));
|
|
3320
|
+
if (idx >= 0) earliest = Math.min(earliest, idx);
|
|
3321
|
+
}
|
|
3322
|
+
return earliest <= 2;
|
|
3323
|
+
}
|
|
2971
3324
|
function isShortFormContent(documentFields, title) {
|
|
3325
|
+
const cat = (documentFields?.contentCategory || "").toLowerCase().trim();
|
|
3326
|
+
if (/^(videos?|podcasts?|episodes?|webinars?|video series|peer exchange)$/.test(cat)) return true;
|
|
2972
3327
|
const shortFormCats = /* @__PURE__ */ new Set(["news", "brief", "preview", "recap", "update", "announcement", "roundup", "digest", "interview"]);
|
|
2973
|
-
const catTokens =
|
|
3328
|
+
const catTokens = cat.split(/[^a-z]+/).filter(Boolean);
|
|
2974
3329
|
if (catTokens.some((tok) => shortFormCats.has(tok))) return true;
|
|
2975
3330
|
const t = (title || "").toLowerCase();
|
|
2976
3331
|
if (/\b(preview|recap|roundup|digest)\b/.test(t)) return true;
|
|
@@ -2980,7 +3335,8 @@ function isShortFormContent(documentFields, title) {
|
|
|
2980
3335
|
function buildSummaryItems(input) {
|
|
2981
3336
|
const items = [];
|
|
2982
3337
|
const { analysis, deepAnalysis, documentFields, linkingSuggestions, linkCheckResults, text } = input;
|
|
2983
|
-
const primaryKeyword = analysis?.primaryKeyword?.term;
|
|
3338
|
+
const primaryKeyword = input.primaryKeyword || analysis?.primaryKeyword?.term;
|
|
3339
|
+
const secondaryKeyword = input.secondaryKeyword || "";
|
|
2984
3340
|
const title = documentFields?.title;
|
|
2985
3341
|
if (!title) {
|
|
2986
3342
|
items.push({
|
|
@@ -3076,39 +3432,40 @@ function buildSummaryItems(input) {
|
|
|
3076
3432
|
items.push({
|
|
3077
3433
|
id: "meta-slug-missing",
|
|
3078
3434
|
category: "meta",
|
|
3079
|
-
severity: "
|
|
3435
|
+
severity: "warning",
|
|
3080
3436
|
label: "URL slug missing",
|
|
3081
3437
|
description: "No URL slug set.",
|
|
3082
|
-
howToFix: "Add a
|
|
3083
|
-
jumpTo: { tab: "
|
|
3438
|
+
howToFix: "Add a short, descriptive slug that leads with your primary keyword.",
|
|
3439
|
+
jumpTo: { tab: "technical", anchorId: "anchor-url-slug" }
|
|
3084
3440
|
});
|
|
3085
3441
|
} else {
|
|
3086
|
-
|
|
3442
|
+
const slugAsWords = slug.replace(/-/g, " ");
|
|
3443
|
+
if (primaryKeyword && !tokensContain(slugAsWords, primaryKeyword)) {
|
|
3087
3444
|
items.push({
|
|
3088
|
-
id: "meta-slug-
|
|
3445
|
+
id: "meta-slug-no-keyword",
|
|
3089
3446
|
category: "meta",
|
|
3090
|
-
severity: "
|
|
3091
|
-
label: "
|
|
3092
|
-
description: `
|
|
3093
|
-
howToFix: "
|
|
3094
|
-
jumpTo: { tab: "
|
|
3447
|
+
severity: "opportunity",
|
|
3448
|
+
label: "Primary keyword not in URL",
|
|
3449
|
+
description: `The URL doesn't include "${primaryKeyword}".`,
|
|
3450
|
+
howToFix: "Work the primary keyword into the URL, ideally at the start. Keep the URL short and descriptive.",
|
|
3451
|
+
jumpTo: { tab: "technical", anchorId: "anchor-url-slug" }
|
|
3095
3452
|
});
|
|
3096
|
-
}
|
|
3097
|
-
if (primaryKeyword && !tokensContain(slug.replace(/-/g, " "), primaryKeyword)) {
|
|
3453
|
+
} else if (primaryKeyword && !keywordLeadsSlug(slug, primaryKeyword)) {
|
|
3098
3454
|
items.push({
|
|
3099
|
-
id: "meta-slug-
|
|
3455
|
+
id: "meta-slug-keyword-late",
|
|
3100
3456
|
category: "meta",
|
|
3101
3457
|
severity: "opportunity",
|
|
3102
|
-
label: "Primary keyword
|
|
3103
|
-
description: `
|
|
3104
|
-
howToFix: "
|
|
3105
|
-
jumpTo: { tab: "
|
|
3458
|
+
label: "Primary keyword late in URL",
|
|
3459
|
+
description: `"${primaryKeyword}" is in the URL but not near the start.`,
|
|
3460
|
+
howToFix: "Lead the URL with the primary keyword so it stays visible if the address gets shortened.",
|
|
3461
|
+
jumpTo: { tab: "technical", anchorId: "anchor-url-slug" }
|
|
3106
3462
|
});
|
|
3107
3463
|
}
|
|
3108
3464
|
}
|
|
3109
3465
|
const wordCount2 = text ? text.trim().split(/\s+/).filter(Boolean).length : 0;
|
|
3466
|
+
const isShortForm = isShortFormContent(documentFields, title);
|
|
3110
3467
|
if (wordCount2 === 0) {
|
|
3111
|
-
} else if (wordCount2 < 450) {
|
|
3468
|
+
} else if (wordCount2 < 450 && !isShortForm) {
|
|
3112
3469
|
items.push({
|
|
3113
3470
|
id: "content-too-short",
|
|
3114
3471
|
category: "content",
|
|
@@ -3118,7 +3475,7 @@ function buildSummaryItems(input) {
|
|
|
3118
3475
|
howToFix: "Add more body text. A link or image on its own doesn't count - the article needs real written substance.",
|
|
3119
3476
|
jumpTo: { tab: "technical", anchorId: "anchor-word-count" }
|
|
3120
3477
|
});
|
|
3121
|
-
} else if (wordCount2 < 1500 && !
|
|
3478
|
+
} else if (wordCount2 < 1500 && !isShortForm) {
|
|
3122
3479
|
items.push({
|
|
3123
3480
|
id: "content-short-for-clinical",
|
|
3124
3481
|
category: "content",
|
|
@@ -3271,7 +3628,7 @@ function buildSummaryItems(input) {
|
|
|
3271
3628
|
}
|
|
3272
3629
|
const imageTitleCount = (documentFields?.imageTitles || []).length;
|
|
3273
3630
|
const totalImageCount = documentFields?.imageCount ?? 0;
|
|
3274
|
-
const missingTitles = totalImageCount > 0 ? totalImageCount - imageTitleCount : 0;
|
|
3631
|
+
const missingTitles = totalImageCount > 0 && imageTitleCount > 0 ? totalImageCount - imageTitleCount : 0;
|
|
3275
3632
|
if (missingTitles > 0) {
|
|
3276
3633
|
items.push({
|
|
3277
3634
|
id: "images-titles-missing",
|
|
@@ -3297,7 +3654,7 @@ function buildSummaryItems(input) {
|
|
|
3297
3654
|
});
|
|
3298
3655
|
}
|
|
3299
3656
|
const primaryVolume = analysis?.primaryKeyword?.volume;
|
|
3300
|
-
if (deepAnalysis &&
|
|
3657
|
+
if (deepAnalysis && primaryVolume === 0) {
|
|
3301
3658
|
items.push({
|
|
3302
3659
|
id: "keywords-primary-zero-volume",
|
|
3303
3660
|
category: "keywords",
|
|
@@ -3309,6 +3666,55 @@ function buildSummaryItems(input) {
|
|
|
3309
3666
|
});
|
|
3310
3667
|
}
|
|
3311
3668
|
}
|
|
3669
|
+
if (secondaryKeyword) {
|
|
3670
|
+
if (text && !tokensContain(text, secondaryKeyword)) {
|
|
3671
|
+
items.push({
|
|
3672
|
+
id: "secondary-not-in-body",
|
|
3673
|
+
category: "keywords",
|
|
3674
|
+
severity: "opportunity",
|
|
3675
|
+
label: "Secondary keyword not in body",
|
|
3676
|
+
description: `Your secondary keyword "${secondaryKeyword}" doesn't appear in the article body.`,
|
|
3677
|
+
howToFix: "Work the secondary keyword into a body paragraph or two where it reads naturally.",
|
|
3678
|
+
jumpTo: { tab: "keywords" }
|
|
3679
|
+
});
|
|
3680
|
+
}
|
|
3681
|
+
const titleVal = documentFields?.title;
|
|
3682
|
+
if (titleVal && !tokensContain(titleVal, secondaryKeyword)) {
|
|
3683
|
+
items.push({
|
|
3684
|
+
id: "secondary-not-in-title",
|
|
3685
|
+
category: "meta",
|
|
3686
|
+
severity: "opportunity",
|
|
3687
|
+
label: "Secondary keyword not in title",
|
|
3688
|
+
description: `The title leads with the primary keyword but doesn't include "${secondaryKeyword}".`,
|
|
3689
|
+
howToFix: "If it fits naturally, include the secondary keyword in the title too - but never at the cost of the primary leading.",
|
|
3690
|
+
jumpTo: { tab: "meta", anchorId: "anchor-meta-title" }
|
|
3691
|
+
});
|
|
3692
|
+
}
|
|
3693
|
+
const metaVal = documentFields?.metaDescription;
|
|
3694
|
+
if (metaVal && !tokensContain(metaVal, secondaryKeyword)) {
|
|
3695
|
+
items.push({
|
|
3696
|
+
id: "secondary-not-in-meta",
|
|
3697
|
+
category: "meta",
|
|
3698
|
+
severity: "opportunity",
|
|
3699
|
+
label: "Secondary keyword not in meta description",
|
|
3700
|
+
description: `The meta description doesn't include "${secondaryKeyword}".`,
|
|
3701
|
+
howToFix: "Add the secondary keyword to the meta description if it reads naturally.",
|
|
3702
|
+
jumpTo: { tab: "meta", anchorId: "anchor-meta-description" }
|
|
3703
|
+
});
|
|
3704
|
+
}
|
|
3705
|
+
const slugVal = documentFields?.slug;
|
|
3706
|
+
if (slugVal && !tokensContain(slugVal.replace(/-/g, " "), secondaryKeyword)) {
|
|
3707
|
+
items.push({
|
|
3708
|
+
id: "secondary-not-in-url",
|
|
3709
|
+
category: "meta",
|
|
3710
|
+
severity: "opportunity",
|
|
3711
|
+
label: "Secondary keyword not in URL",
|
|
3712
|
+
description: `The URL doesn't include "${secondaryKeyword}".`,
|
|
3713
|
+
howToFix: "Optionally include the secondary keyword in the URL after the primary - only if the slug stays short and clean.",
|
|
3714
|
+
jumpTo: { tab: "technical", anchorId: "anchor-url-slug" }
|
|
3715
|
+
});
|
|
3716
|
+
}
|
|
3717
|
+
}
|
|
3312
3718
|
const actualQuestionHeadings = (documentFields?.headings || []).filter((h) => h.trim().endsWith("?"));
|
|
3313
3719
|
if (deepAnalysis && actualQuestionHeadings.length === 0 && wordCount2 > 300) {
|
|
3314
3720
|
items.push({
|
|
@@ -3419,7 +3825,7 @@ function buildSummaryItems(input) {
|
|
|
3419
3825
|
}
|
|
3420
3826
|
|
|
3421
3827
|
// src/components/tabs/SummaryTab.tsx
|
|
3422
|
-
import { Fragment as
|
|
3828
|
+
import { Fragment as Fragment5, jsx as jsx10, jsxs as jsxs9 } from "react/jsx-runtime";
|
|
3423
3829
|
var cardStyle2 = {
|
|
3424
3830
|
borderRadius: 14,
|
|
3425
3831
|
background: "rgba(255,255,255,0.55)",
|
|
@@ -3443,9 +3849,9 @@ function scoreColors(score) {
|
|
|
3443
3849
|
}
|
|
3444
3850
|
function ScoreBadge({ score, breakdown }) {
|
|
3445
3851
|
const c = scoreColors(score);
|
|
3446
|
-
return /* @__PURE__ */
|
|
3447
|
-
/* @__PURE__ */
|
|
3448
|
-
/* @__PURE__ */
|
|
3852
|
+
return /* @__PURE__ */ jsxs9("div", { style: cardStyle2, children: [
|
|
3853
|
+
/* @__PURE__ */ jsxs9("div", { style: { display: "flex", alignItems: "center", gap: 14 }, children: [
|
|
3854
|
+
/* @__PURE__ */ jsxs9(
|
|
3449
3855
|
"div",
|
|
3450
3856
|
{
|
|
3451
3857
|
style: {
|
|
@@ -3461,30 +3867,30 @@ function ScoreBadge({ score, breakdown }) {
|
|
|
3461
3867
|
lineHeight: 1
|
|
3462
3868
|
},
|
|
3463
3869
|
children: [
|
|
3464
|
-
/* @__PURE__ */
|
|
3465
|
-
/* @__PURE__ */
|
|
3870
|
+
/* @__PURE__ */ jsx10("span", { style: { fontSize: 20, fontWeight: 700, color: c.text }, children: score }),
|
|
3871
|
+
/* @__PURE__ */ jsx10("span", { style: { fontSize: 8, fontWeight: 700, color: c.text, opacity: 0.7, letterSpacing: "0.06em", marginTop: 2 }, children: "/ 100" })
|
|
3466
3872
|
]
|
|
3467
3873
|
}
|
|
3468
3874
|
),
|
|
3469
|
-
/* @__PURE__ */
|
|
3470
|
-
/* @__PURE__ */
|
|
3471
|
-
/* @__PURE__ */
|
|
3875
|
+
/* @__PURE__ */ jsxs9("div", { style: { flex: 1, minWidth: 0 }, children: [
|
|
3876
|
+
/* @__PURE__ */ jsx10("div", { style: { fontSize: 10.5, textTransform: "uppercase", letterSpacing: "0.06em", color: "#4b5563", fontWeight: 600, marginBottom: 2 }, children: "Content Score" }),
|
|
3877
|
+
/* @__PURE__ */ jsx10("div", { style: { fontSize: 14, fontWeight: 700, color: c.text }, children: c.label })
|
|
3472
3878
|
] })
|
|
3473
3879
|
] }),
|
|
3474
|
-
breakdown.length > 0 && /* @__PURE__ */
|
|
3880
|
+
breakdown.length > 0 && /* @__PURE__ */ jsx10("div", { style: { marginTop: 12, display: "flex", flexDirection: "column", gap: 8 }, children: breakdown.map((comp, i) => {
|
|
3475
3881
|
const pct = comp.max > 0 ? comp.points / comp.max * 100 : 0;
|
|
3476
3882
|
const barColor = pct >= 75 ? "#16a34a" : pct >= 40 ? "#E6C01B" : "#dc2626";
|
|
3477
|
-
return /* @__PURE__ */
|
|
3478
|
-
/* @__PURE__ */
|
|
3479
|
-
/* @__PURE__ */
|
|
3480
|
-
/* @__PURE__ */
|
|
3883
|
+
return /* @__PURE__ */ jsxs9("div", { children: [
|
|
3884
|
+
/* @__PURE__ */ jsxs9("div", { style: { display: "flex", justifyContent: "space-between", alignItems: "baseline", marginBottom: 3 }, children: [
|
|
3885
|
+
/* @__PURE__ */ jsx10("span", { style: { fontSize: 11, fontWeight: 600, color: "#1f2937" }, children: comp.label }),
|
|
3886
|
+
/* @__PURE__ */ jsxs9("span", { style: { fontSize: 11, color: "#4b5563", fontVariantNumeric: "tabular-nums" }, children: [
|
|
3481
3887
|
comp.points,
|
|
3482
3888
|
" / ",
|
|
3483
3889
|
comp.max
|
|
3484
3890
|
] })
|
|
3485
3891
|
] }),
|
|
3486
|
-
/* @__PURE__ */
|
|
3487
|
-
/* @__PURE__ */
|
|
3892
|
+
/* @__PURE__ */ jsx10("div", { style: { height: 4, background: "#f1f5f9", borderRadius: 99, overflow: "hidden", marginBottom: 4 }, children: /* @__PURE__ */ jsx10("div", { style: { width: `${pct}%`, height: "100%", background: barColor, transition: "width 200ms" } }) }),
|
|
3893
|
+
/* @__PURE__ */ jsx10("div", { style: { fontSize: 10.5, color: "#4b5563", lineHeight: 1.4 }, children: comp.detail })
|
|
3488
3894
|
] }, i);
|
|
3489
3895
|
}) })
|
|
3490
3896
|
] });
|
|
@@ -3498,7 +3904,7 @@ function ItemCard({ item, onClick }) {
|
|
|
3498
3904
|
const v = severityVisual(item.severity);
|
|
3499
3905
|
const tab = item.jumpTo.tab;
|
|
3500
3906
|
const tabLabel = TAB_LABEL[tab] ?? tab.charAt(0).toUpperCase() + tab.slice(1);
|
|
3501
|
-
return /* @__PURE__ */
|
|
3907
|
+
return /* @__PURE__ */ jsxs9(
|
|
3502
3908
|
"div",
|
|
3503
3909
|
{
|
|
3504
3910
|
onClick,
|
|
@@ -3515,8 +3921,8 @@ function ItemCard({ item, onClick }) {
|
|
|
3515
3921
|
cursor: "pointer"
|
|
3516
3922
|
},
|
|
3517
3923
|
children: [
|
|
3518
|
-
/* @__PURE__ */
|
|
3519
|
-
/* @__PURE__ */
|
|
3924
|
+
/* @__PURE__ */ jsxs9("div", { style: { display: "flex", alignItems: "flex-start", gap: 9 }, children: [
|
|
3925
|
+
/* @__PURE__ */ jsx10(
|
|
3520
3926
|
"div",
|
|
3521
3927
|
{
|
|
3522
3928
|
style: {
|
|
@@ -3529,12 +3935,12 @@ function ItemCard({ item, onClick }) {
|
|
|
3529
3935
|
}
|
|
3530
3936
|
}
|
|
3531
3937
|
),
|
|
3532
|
-
/* @__PURE__ */
|
|
3533
|
-
/* @__PURE__ */
|
|
3534
|
-
/* @__PURE__ */
|
|
3938
|
+
/* @__PURE__ */ jsxs9("div", { style: { flex: 1, minWidth: 0 }, children: [
|
|
3939
|
+
/* @__PURE__ */ jsx10("div", { style: { fontSize: 12, fontWeight: 700, color: "#1f2937", marginBottom: 2 }, children: item.label }),
|
|
3940
|
+
/* @__PURE__ */ jsx10("div", { style: { fontSize: 11, color: "#374151", lineHeight: 1.5 }, children: item.description })
|
|
3535
3941
|
] })
|
|
3536
3942
|
] }),
|
|
3537
|
-
/* @__PURE__ */
|
|
3943
|
+
/* @__PURE__ */ jsxs9(
|
|
3538
3944
|
"div",
|
|
3539
3945
|
{
|
|
3540
3946
|
style: {
|
|
@@ -3546,12 +3952,12 @@ function ItemCard({ item, onClick }) {
|
|
|
3546
3952
|
lineHeight: 1.55
|
|
3547
3953
|
},
|
|
3548
3954
|
children: [
|
|
3549
|
-
/* @__PURE__ */
|
|
3955
|
+
/* @__PURE__ */ jsx10("span", { style: { fontWeight: 700, color: "#4b5563", letterSpacing: "0.04em", fontSize: 9.5, textTransform: "uppercase", marginRight: 6 }, children: "Fix" }),
|
|
3550
3956
|
item.howToFix
|
|
3551
3957
|
]
|
|
3552
3958
|
}
|
|
3553
3959
|
),
|
|
3554
|
-
item.jumpTo.tab !== "summary" && /* @__PURE__ */
|
|
3960
|
+
item.jumpTo.tab !== "summary" && /* @__PURE__ */ jsx10("div", { style: { display: "flex", justifyContent: "flex-end" }, children: /* @__PURE__ */ jsxs9("span", { style: { fontSize: 10, fontWeight: 700, color: MJH_BLUE }, children: [
|
|
3555
3961
|
"Go to ",
|
|
3556
3962
|
tabLabel,
|
|
3557
3963
|
" \u203A"
|
|
@@ -3567,7 +3973,7 @@ function FilterChip({
|
|
|
3567
3973
|
count,
|
|
3568
3974
|
dotColor
|
|
3569
3975
|
}) {
|
|
3570
|
-
return /* @__PURE__ */
|
|
3976
|
+
return /* @__PURE__ */ jsxs9(
|
|
3571
3977
|
"button",
|
|
3572
3978
|
{
|
|
3573
3979
|
onClick,
|
|
@@ -3586,9 +3992,9 @@ function FilterChip({
|
|
|
3586
3992
|
transition: "all 150ms"
|
|
3587
3993
|
},
|
|
3588
3994
|
children: [
|
|
3589
|
-
dotColor && /* @__PURE__ */
|
|
3590
|
-
/* @__PURE__ */
|
|
3591
|
-
/* @__PURE__ */
|
|
3995
|
+
dotColor && /* @__PURE__ */ jsx10("span", { style: { width: 6, height: 6, borderRadius: "50%", background: dotColor, display: "inline-block" } }),
|
|
3996
|
+
/* @__PURE__ */ jsx10("span", { children: label }),
|
|
3997
|
+
/* @__PURE__ */ jsx10("span", { style: { fontSize: 10, opacity: 0.8 }, children: count })
|
|
3592
3998
|
]
|
|
3593
3999
|
}
|
|
3594
4000
|
);
|
|
@@ -3600,14 +4006,17 @@ function SummaryTab({
|
|
|
3600
4006
|
documentFields,
|
|
3601
4007
|
linkingSuggestions,
|
|
3602
4008
|
linkCheckResults,
|
|
4009
|
+
primaryKeyword,
|
|
4010
|
+
secondaryKeyword,
|
|
3603
4011
|
isAnyLoading,
|
|
3604
4012
|
onGenerateAll,
|
|
3605
4013
|
onItemClick
|
|
3606
4014
|
}) {
|
|
3607
4015
|
const scoreDetail = useMemo(() => {
|
|
3608
4016
|
if (!analysis) return null;
|
|
3609
|
-
|
|
3610
|
-
|
|
4017
|
+
const scored = primaryKeyword && primaryKeyword !== analysis.primaryKeyword?.term ? { ...analysis, primaryKeyword: { ...analysis.primaryKeyword, term: primaryKeyword } } : analysis;
|
|
4018
|
+
return calculateContentScoreDetailed(text, scored, documentFields);
|
|
4019
|
+
}, [text, analysis, documentFields, primaryKeyword]);
|
|
3611
4020
|
const score = scoreDetail?.total ?? null;
|
|
3612
4021
|
const items = useMemo(
|
|
3613
4022
|
() => buildSummaryItems({
|
|
@@ -3617,9 +4026,11 @@ function SummaryTab({
|
|
|
3617
4026
|
contentScore: score,
|
|
3618
4027
|
linkingSuggestions,
|
|
3619
4028
|
linkCheckResults,
|
|
3620
|
-
text
|
|
4029
|
+
text,
|
|
4030
|
+
primaryKeyword,
|
|
4031
|
+
secondaryKeyword
|
|
3621
4032
|
}),
|
|
3622
|
-
[analysis, deepAnalysis, documentFields, score, linkingSuggestions, linkCheckResults, text]
|
|
4033
|
+
[analysis, deepAnalysis, documentFields, score, linkingSuggestions, linkCheckResults, text, primaryKeyword, secondaryKeyword]
|
|
3623
4034
|
);
|
|
3624
4035
|
const [filter, setFilter] = useState12("all");
|
|
3625
4036
|
const counts = useMemo(
|
|
@@ -3633,15 +4044,15 @@ function SummaryTab({
|
|
|
3633
4044
|
);
|
|
3634
4045
|
const filtered = filter === "all" ? items : items.filter((i) => i.severity === filter);
|
|
3635
4046
|
if (!analysis) {
|
|
3636
|
-
return /* @__PURE__ */
|
|
3637
|
-
/* @__PURE__ */
|
|
3638
|
-
/* @__PURE__ */
|
|
4047
|
+
return /* @__PURE__ */ jsxs9("div", { style: { padding: 24, textAlign: "center" }, children: [
|
|
4048
|
+
/* @__PURE__ */ jsx10("div", { style: { fontSize: 13, color: "#4b5563", fontWeight: 500 }, children: "Start with the Keywords tab" }),
|
|
4049
|
+
/* @__PURE__ */ jsx10("div", { style: { fontSize: 11, color: "#4b5563", marginTop: 4 }, children: "Once keywords are analyzed, the summary appears here." })
|
|
3639
4050
|
] });
|
|
3640
4051
|
}
|
|
3641
|
-
return /* @__PURE__ */
|
|
3642
|
-
score != null && scoreDetail && /* @__PURE__ */
|
|
3643
|
-
/* @__PURE__ */
|
|
3644
|
-
isAnyLoading ? /* @__PURE__ */
|
|
4052
|
+
return /* @__PURE__ */ jsxs9("div", { style: { padding: 12, display: "flex", flexDirection: "column", gap: 12 }, children: [
|
|
4053
|
+
score != null && scoreDetail && /* @__PURE__ */ jsx10(ScoreBadge, { score, breakdown: scoreDetail.components }),
|
|
4054
|
+
/* @__PURE__ */ jsxs9("div", { style: cardStyle2, children: [
|
|
4055
|
+
isAnyLoading ? /* @__PURE__ */ jsx10("div", { style: { display: "flex", alignItems: "center", justifyContent: "center", padding: "4px 0" }, children: /* @__PURE__ */ jsx10(ShimmerLoader, { messages: DEFAULT_GENERATE_ALL_MESSAGES }) }) : /* @__PURE__ */ jsx10(
|
|
3645
4056
|
"button",
|
|
3646
4057
|
{
|
|
3647
4058
|
onClick: onGenerateAll,
|
|
@@ -3666,27 +4077,27 @@ function SummaryTab({
|
|
|
3666
4077
|
transition: "all 150ms",
|
|
3667
4078
|
letterSpacing: "0.01em"
|
|
3668
4079
|
},
|
|
3669
|
-
children: "
|
|
4080
|
+
children: "Run all analyses"
|
|
3670
4081
|
}
|
|
3671
4082
|
),
|
|
3672
|
-
/* @__PURE__ */
|
|
4083
|
+
/* @__PURE__ */ jsxs9("div", { style: { fontSize: 10.5, color: "#4b5563", marginTop: 8, lineHeight: 1.5 }, children: [
|
|
3673
4084
|
"Runs the analyses that fill the ",
|
|
3674
|
-
/* @__PURE__ */
|
|
4085
|
+
/* @__PURE__ */ jsx10("strong", { children: "AEO/GEO" }),
|
|
3675
4086
|
", ",
|
|
3676
|
-
/* @__PURE__ */
|
|
4087
|
+
/* @__PURE__ */ jsx10("strong", { children: "Linking" }),
|
|
3677
4088
|
", and ",
|
|
3678
|
-
/* @__PURE__ */
|
|
4089
|
+
/* @__PURE__ */ jsx10("strong", { children: "Other Recs" }),
|
|
3679
4090
|
" tabs. New issues they find appear in this Summary as each one finishes."
|
|
3680
4091
|
] })
|
|
3681
4092
|
] }),
|
|
3682
|
-
/* @__PURE__ */
|
|
3683
|
-
/* @__PURE__ */
|
|
3684
|
-
/* @__PURE__ */
|
|
3685
|
-
/* @__PURE__ */
|
|
3686
|
-
/* @__PURE__ */
|
|
4093
|
+
/* @__PURE__ */ jsxs9("div", { style: { display: "flex", flexWrap: "wrap", gap: 6 }, children: [
|
|
4094
|
+
/* @__PURE__ */ jsx10(FilterChip, { active: filter === "all", onClick: () => setFilter("all"), label: "All", count: counts.all }),
|
|
4095
|
+
/* @__PURE__ */ jsx10(FilterChip, { active: filter === "error", onClick: () => setFilter("error"), label: "Errors", count: counts.error, dotColor: "#dc2626" }),
|
|
4096
|
+
/* @__PURE__ */ jsx10(FilterChip, { active: filter === "warning", onClick: () => setFilter("warning"), label: "Warnings", count: counts.warning, dotColor: "#E6C01B" }),
|
|
4097
|
+
/* @__PURE__ */ jsx10(FilterChip, { active: filter === "opportunity", onClick: () => setFilter("opportunity"), label: "Opportunities", count: counts.opportunity, dotColor: MJH_BLUE })
|
|
3687
4098
|
] }),
|
|
3688
|
-
/* @__PURE__ */
|
|
3689
|
-
/* @__PURE__ */
|
|
4099
|
+
/* @__PURE__ */ jsx10("div", { id: "anchor-summary-issues", style: { display: "flex", flexDirection: "column", gap: 8 }, children: filtered.length === 0 ? /* @__PURE__ */ jsx10("div", { style: { ...cardStyle2, textAlign: "center", padding: "20px 14px" }, children: items.length === 0 ? /* @__PURE__ */ jsxs9(Fragment5, { children: [
|
|
4100
|
+
/* @__PURE__ */ jsx10(
|
|
3690
4101
|
"div",
|
|
3691
4102
|
{
|
|
3692
4103
|
style: {
|
|
@@ -3699,15 +4110,15 @@ function SummaryTab({
|
|
|
3699
4110
|
justifyContent: "center",
|
|
3700
4111
|
margin: "0 auto 8px"
|
|
3701
4112
|
},
|
|
3702
|
-
children: /* @__PURE__ */
|
|
4113
|
+
children: /* @__PURE__ */ jsx10("svg", { width: "20", height: "20", viewBox: "0 0 20 20", fill: "#16a34a", children: /* @__PURE__ */ jsx10("path", { fillRule: "evenodd", d: "M16.704 4.153a.75.75 0 01.143 1.052l-8 10.5a.75.75 0 01-1.127.075l-4.5-4.5a.75.75 0 011.06-1.06l3.894 3.893 7.48-9.817a.75.75 0 011.05-.143z", clipRule: "evenodd" }) })
|
|
3703
4114
|
}
|
|
3704
4115
|
),
|
|
3705
|
-
/* @__PURE__ */
|
|
3706
|
-
/* @__PURE__ */
|
|
3707
|
-
] }) : /* @__PURE__ */
|
|
3708
|
-
isAnyLoading && items.length > 0 && /* @__PURE__ */
|
|
3709
|
-
/* @__PURE__ */
|
|
3710
|
-
/* @__PURE__ */
|
|
4116
|
+
/* @__PURE__ */ jsx10("div", { style: { fontSize: 13, color: "#16a34a", fontWeight: 700 }, children: "Looking good" }),
|
|
4117
|
+
/* @__PURE__ */ jsx10("div", { style: { fontSize: 11, color: "#4b5563", marginTop: 2 }, children: "No issues found for this article." })
|
|
4118
|
+
] }) : /* @__PURE__ */ jsx10("div", { style: { fontSize: 12, color: "#4b5563" }, children: "Nothing in this category." }) }) : filtered.map((item) => /* @__PURE__ */ jsx10(ItemCard, { item, onClick: () => onItemClick(item) }, item.id)) }),
|
|
4119
|
+
isAnyLoading && items.length > 0 && /* @__PURE__ */ jsxs9("div", { style: { display: "flex", alignItems: "center", justifyContent: "center", gap: 6, padding: "4px 0" }, children: [
|
|
4120
|
+
/* @__PURE__ */ jsx10(LoadingBars, { size: "xs", color: MJH_BLUE }),
|
|
4121
|
+
/* @__PURE__ */ jsx10("span", { style: { fontSize: 10, color: "#4b5563" }, children: "Still checking..." })
|
|
3711
4122
|
] })
|
|
3712
4123
|
] });
|
|
3713
4124
|
}
|
|
@@ -3787,7 +4198,7 @@ function analyzeGEO(text, headings) {
|
|
|
3787
4198
|
}
|
|
3788
4199
|
|
|
3789
4200
|
// src/components/tabs/AEOTab.tsx
|
|
3790
|
-
import { jsx as
|
|
4201
|
+
import { jsx as jsx11, jsxs as jsxs10 } from "react/jsx-runtime";
|
|
3791
4202
|
var AEO_PURPLE = "#005DAC";
|
|
3792
4203
|
var GEO_TEAL = "#C9A716";
|
|
3793
4204
|
var cardStyle3 = {
|
|
@@ -3799,7 +4210,7 @@ var cardStyle3 = {
|
|
|
3799
4210
|
padding: "14px"
|
|
3800
4211
|
};
|
|
3801
4212
|
function AiPill() {
|
|
3802
|
-
return /* @__PURE__ */
|
|
4213
|
+
return /* @__PURE__ */ jsx11(
|
|
3803
4214
|
"span",
|
|
3804
4215
|
{
|
|
3805
4216
|
style: {
|
|
@@ -3818,10 +4229,10 @@ function AiPill() {
|
|
|
3818
4229
|
);
|
|
3819
4230
|
}
|
|
3820
4231
|
function SectionHeader2({ label, iconColor, ai }) {
|
|
3821
|
-
return /* @__PURE__ */
|
|
3822
|
-
/* @__PURE__ */
|
|
3823
|
-
/* @__PURE__ */
|
|
3824
|
-
ai && /* @__PURE__ */
|
|
4232
|
+
return /* @__PURE__ */ jsxs10("div", { style: { display: "flex", alignItems: "center", gap: 7, marginBottom: 4 }, children: [
|
|
4233
|
+
/* @__PURE__ */ jsx11("div", { style: { width: 7, height: 7, borderRadius: "50%", background: iconColor, flexShrink: 0 } }),
|
|
4234
|
+
/* @__PURE__ */ jsx11("span", { style: { fontSize: 10.5, textTransform: "uppercase", letterSpacing: "0.06em", color: "#4b5563", fontWeight: 600, flex: 1 }, children: label }),
|
|
4235
|
+
ai && /* @__PURE__ */ jsx11(AiPill, {})
|
|
3825
4236
|
] });
|
|
3826
4237
|
}
|
|
3827
4238
|
function CopyButton({ text }) {
|
|
@@ -3834,7 +4245,7 @@ function CopyButton({ text }) {
|
|
|
3834
4245
|
} catch {
|
|
3835
4246
|
}
|
|
3836
4247
|
};
|
|
3837
|
-
return /* @__PURE__ */
|
|
4248
|
+
return /* @__PURE__ */ jsx11(
|
|
3838
4249
|
"button",
|
|
3839
4250
|
{
|
|
3840
4251
|
onClick: handleCopy,
|
|
@@ -3853,9 +4264,9 @@ function CopyButton({ text }) {
|
|
|
3853
4264
|
transition: "color 150ms"
|
|
3854
4265
|
},
|
|
3855
4266
|
title: copied ? "Copied!" : "Copy to clipboard",
|
|
3856
|
-
children: copied ? /* @__PURE__ */
|
|
3857
|
-
/* @__PURE__ */
|
|
3858
|
-
/* @__PURE__ */
|
|
4267
|
+
children: copied ? /* @__PURE__ */ jsx11("svg", { width: "11", height: "11", viewBox: "0 0 20 20", fill: "currentColor", children: /* @__PURE__ */ jsx11("path", { fillRule: "evenodd", d: "M16.704 4.153a.75.75 0 01.143 1.052l-8 10.5a.75.75 0 01-1.127.075l-4.5-4.5a.75.75 0 011.06-1.06l3.894 3.893 7.48-9.817a.75.75 0 011.05-.143z", clipRule: "evenodd" }) }) : /* @__PURE__ */ jsxs10("svg", { width: "11", height: "11", viewBox: "0 0 20 20", fill: "currentColor", children: [
|
|
4268
|
+
/* @__PURE__ */ jsx11("path", { d: "M7 3.5A1.5 1.5 0 018.5 2h3.879a1.5 1.5 0 011.06.44l3.122 3.12A1.5 1.5 0 0117 6.622V12.5a1.5 1.5 0 01-1.5 1.5h-1v-3.379a3 3 0 00-.879-2.121L10.5 5.379A3 3 0 008.379 4.5H7v-1z" }),
|
|
4269
|
+
/* @__PURE__ */ jsx11("path", { d: "M4.5 6A1.5 1.5 0 003 7.5v9A1.5 1.5 0 004.5 18h7a1.5 1.5 0 001.5-1.5v-5.879a1.5 1.5 0 00-.44-1.06L9.44 6.439A1.5 1.5 0 008.378 6H4.5z" })
|
|
3859
4270
|
] })
|
|
3860
4271
|
}
|
|
3861
4272
|
);
|
|
@@ -3870,13 +4281,13 @@ function GEOCard({ geo, publication }) {
|
|
|
3870
4281
|
const fdBg = effectiveStatus === "strong" ? "rgba(22,163,74,0.1)" : effectiveStatus === "moderate" ? "rgba(230,192,27,0.15)" : "rgba(220,38,38,0.08)";
|
|
3871
4282
|
const goodCount = geo.headingAudit.filter((h) => h.status === "good").length;
|
|
3872
4283
|
const totalHeadings = geo.headingAudit.length;
|
|
3873
|
-
return /* @__PURE__ */
|
|
3874
|
-
/* @__PURE__ */
|
|
3875
|
-
/* @__PURE__ */
|
|
3876
|
-
/* @__PURE__ */
|
|
4284
|
+
return /* @__PURE__ */ jsxs10("div", { style: cardStyle3, children: [
|
|
4285
|
+
/* @__PURE__ */ jsxs10("div", { style: { display: "flex", alignItems: "center", justifyContent: "space-between", marginBottom: 4 }, children: [
|
|
4286
|
+
/* @__PURE__ */ jsx11(SectionHeader2, { label: "AI Citation Readiness", iconColor: GEO_TEAL }),
|
|
4287
|
+
/* @__PURE__ */ jsx11(FeedbackButton, { suggestionType: "geo_summary", suggestionText: `facts/1k: ${fd.factsPerThousandWords}; short-answer headings: ${goodCount}/${totalHeadings}`, publication })
|
|
3877
4288
|
] }),
|
|
3878
|
-
/* @__PURE__ */
|
|
3879
|
-
/* @__PURE__ */
|
|
4289
|
+
/* @__PURE__ */ jsx11("div", { style: { fontSize: 10, color: "#4b5563", marginBottom: 10, lineHeight: 1.5 }, children: "How easy this article is for ChatGPT, Perplexity, Gemini, and Google's AI Overviews to cite." }),
|
|
4290
|
+
/* @__PURE__ */ jsxs10(
|
|
3880
4291
|
"div",
|
|
3881
4292
|
{
|
|
3882
4293
|
style: {
|
|
@@ -3889,7 +4300,7 @@ function GEOCard({ geo, publication }) {
|
|
|
3889
4300
|
marginBottom: 8
|
|
3890
4301
|
},
|
|
3891
4302
|
children: [
|
|
3892
|
-
/* @__PURE__ */
|
|
4303
|
+
/* @__PURE__ */ jsxs10(
|
|
3893
4304
|
"div",
|
|
3894
4305
|
{
|
|
3895
4306
|
style: {
|
|
@@ -3905,17 +4316,17 @@ function GEOCard({ geo, publication }) {
|
|
|
3905
4316
|
boxShadow: "0 1px 2px rgba(0,0,0,0.06)"
|
|
3906
4317
|
},
|
|
3907
4318
|
children: [
|
|
3908
|
-
/* @__PURE__ */
|
|
3909
|
-
/* @__PURE__ */
|
|
4319
|
+
/* @__PURE__ */ jsx11("span", { style: { fontSize: 18, fontWeight: 700, color: fdColor, lineHeight: 1 }, children: fd.factsPerThousandWords }),
|
|
4320
|
+
/* @__PURE__ */ jsx11("span", { style: { fontSize: 7.5, fontWeight: 700, color: fdColor, opacity: 0.75, letterSpacing: "0.05em", marginTop: 2 }, children: "PER 1K" })
|
|
3910
4321
|
]
|
|
3911
4322
|
}
|
|
3912
4323
|
),
|
|
3913
|
-
/* @__PURE__ */
|
|
3914
|
-
/* @__PURE__ */
|
|
4324
|
+
/* @__PURE__ */ jsxs10("div", { style: { flex: 1, minWidth: 0 }, children: [
|
|
4325
|
+
/* @__PURE__ */ jsxs10("div", { style: { fontSize: 11, fontWeight: 700, color: fdColor, marginBottom: 2 }, children: [
|
|
3915
4326
|
"Fact density: ",
|
|
3916
4327
|
fdLabel
|
|
3917
4328
|
] }),
|
|
3918
|
-
/* @__PURE__ */
|
|
4329
|
+
/* @__PURE__ */ jsxs10("div", { style: { fontSize: 11, color: "#1f2937", lineHeight: 1.45 }, children: [
|
|
3919
4330
|
fd.factCount,
|
|
3920
4331
|
" specific stat",
|
|
3921
4332
|
fd.factCount === 1 ? "" : "s",
|
|
@@ -3931,7 +4342,7 @@ function GEOCard({ geo, publication }) {
|
|
|
3931
4342
|
]
|
|
3932
4343
|
}
|
|
3933
4344
|
),
|
|
3934
|
-
fd.driftPassages > 0 && /* @__PURE__ */
|
|
4345
|
+
fd.driftPassages > 0 && /* @__PURE__ */ jsxs10(
|
|
3935
4346
|
"div",
|
|
3936
4347
|
{
|
|
3937
4348
|
style: {
|
|
@@ -3945,15 +4356,15 @@ function GEOCard({ geo, publication }) {
|
|
|
3945
4356
|
lineHeight: 1.45
|
|
3946
4357
|
},
|
|
3947
4358
|
children: [
|
|
3948
|
-
/* @__PURE__ */
|
|
4359
|
+
/* @__PURE__ */ jsx11("strong", { children: fd.driftPassages }),
|
|
3949
4360
|
" passage",
|
|
3950
4361
|
fd.driftPassages === 1 ? "" : "s",
|
|
3951
4362
|
" over 200 words with no specific stats or citations. AI engines tend to skip these."
|
|
3952
4363
|
]
|
|
3953
4364
|
}
|
|
3954
4365
|
),
|
|
3955
|
-
totalHeadings > 0 && /* @__PURE__ */
|
|
3956
|
-
/* @__PURE__ */
|
|
4366
|
+
totalHeadings > 0 && /* @__PURE__ */ jsxs10("div", { style: { marginTop: 4 }, children: [
|
|
4367
|
+
/* @__PURE__ */ jsxs10(
|
|
3957
4368
|
"button",
|
|
3958
4369
|
{
|
|
3959
4370
|
onClick: () => setShowDetails((v) => !v),
|
|
@@ -3972,22 +4383,22 @@ function GEOCard({ geo, publication }) {
|
|
|
3972
4383
|
color: GEO_TEAL
|
|
3973
4384
|
},
|
|
3974
4385
|
children: [
|
|
3975
|
-
/* @__PURE__ */
|
|
4386
|
+
/* @__PURE__ */ jsxs10("span", { children: [
|
|
3976
4387
|
"Short-answer paragraphs: ",
|
|
3977
4388
|
goodCount,
|
|
3978
4389
|
"/",
|
|
3979
4390
|
totalHeadings,
|
|
3980
4391
|
" headings have one"
|
|
3981
4392
|
] }),
|
|
3982
|
-
/* @__PURE__ */
|
|
4393
|
+
/* @__PURE__ */ jsx11("svg", { width: "11", height: "11", viewBox: "0 0 20 20", fill: "currentColor", style: { transform: showDetails ? "rotate(180deg)" : "none", transition: "transform 150ms" }, children: /* @__PURE__ */ jsx11("path", { fillRule: "evenodd", d: "M5.23 7.21a.75.75 0 011.06.02L10 11.168l3.71-3.938a.75.75 0 111.08 1.04l-4.25 4.5a.75.75 0 01-1.08 0l-4.25-4.5a.75.75 0 01.02-1.06z", clipRule: "evenodd" }) })
|
|
3983
4394
|
]
|
|
3984
4395
|
}
|
|
3985
4396
|
),
|
|
3986
|
-
showDetails && /* @__PURE__ */
|
|
3987
|
-
/* @__PURE__ */
|
|
4397
|
+
showDetails && /* @__PURE__ */ jsxs10("div", { style: { marginTop: 6, display: "flex", flexDirection: "column", gap: 4 }, children: [
|
|
4398
|
+
/* @__PURE__ */ jsx11("div", { style: { fontSize: 10, color: "#4b5563", marginBottom: 4 }, children: "Aim for a 40-60 word answer right after each heading. That's the chunk AI engines extract." }),
|
|
3988
4399
|
geo.headingAudit.map((h, i) => {
|
|
3989
4400
|
const c = h.status === "good" ? { bg: "rgba(22,163,74,0.08)", color: "#16a34a", label: `${h.words} words \u2713` } : h.status === "too-short" ? { bg: "rgba(230,192,27,0.12)", color: "#8B7310", label: `${h.words} words - too short` } : h.status === "too-long" ? { bg: "rgba(230,192,27,0.12)", color: "#8B7310", label: `${h.words} words - condense to 40-60` } : { bg: "rgba(220,38,38,0.06)", color: "#dc2626", label: "no body content" };
|
|
3990
|
-
return /* @__PURE__ */
|
|
4401
|
+
return /* @__PURE__ */ jsxs10(
|
|
3991
4402
|
"div",
|
|
3992
4403
|
{
|
|
3993
4404
|
style: {
|
|
@@ -4001,8 +4412,8 @@ function GEOCard({ geo, publication }) {
|
|
|
4001
4412
|
gap: 8
|
|
4002
4413
|
},
|
|
4003
4414
|
children: [
|
|
4004
|
-
/* @__PURE__ */
|
|
4005
|
-
/* @__PURE__ */
|
|
4415
|
+
/* @__PURE__ */ jsx11("span", { style: { flex: 1, minWidth: 0, color: "#1f2937", overflow: "hidden", textOverflow: "ellipsis", whiteSpace: "nowrap" }, children: h.heading }),
|
|
4416
|
+
/* @__PURE__ */ jsx11("span", { style: { fontSize: 10, fontWeight: 600, color: c.color, flexShrink: 0 }, children: c.label })
|
|
4006
4417
|
]
|
|
4007
4418
|
},
|
|
4008
4419
|
i
|
|
@@ -4039,8 +4450,8 @@ function AEOTab({
|
|
|
4039
4450
|
originalHeading: void 0,
|
|
4040
4451
|
rationale: h.rationale
|
|
4041
4452
|
})) ?? [];
|
|
4042
|
-
return /* @__PURE__ */
|
|
4043
|
-
aeoContentChanged && /* @__PURE__ */
|
|
4453
|
+
return /* @__PURE__ */ jsxs10("div", { style: { padding: 12, display: "flex", flexDirection: "column", gap: 12 }, children: [
|
|
4454
|
+
aeoContentChanged && /* @__PURE__ */ jsxs10(
|
|
4044
4455
|
"div",
|
|
4045
4456
|
{
|
|
4046
4457
|
onClick: runDeepAnalysis,
|
|
@@ -4055,30 +4466,30 @@ function AEOTab({
|
|
|
4055
4466
|
cursor: "pointer"
|
|
4056
4467
|
},
|
|
4057
4468
|
children: [
|
|
4058
|
-
/* @__PURE__ */
|
|
4059
|
-
/* @__PURE__ */
|
|
4469
|
+
/* @__PURE__ */ jsx11("span", { style: { fontSize: 11, color: "#92400e" }, children: "Content has changed since this was generated." }),
|
|
4470
|
+
/* @__PURE__ */ jsx11("span", { style: { fontSize: 11, fontWeight: 600, color: AEO_PURPLE, textDecoration: "underline" }, children: "Update" })
|
|
4060
4471
|
]
|
|
4061
4472
|
}
|
|
4062
4473
|
),
|
|
4063
|
-
hasEnoughTextForGEO && /* @__PURE__ */
|
|
4064
|
-
hasEnoughText && !hasEnoughTextForGEO && /* @__PURE__ */
|
|
4065
|
-
/* @__PURE__ */
|
|
4474
|
+
hasEnoughTextForGEO && /* @__PURE__ */ jsx11(GEOCard, { geo, publication }),
|
|
4475
|
+
hasEnoughText && !hasEnoughTextForGEO && /* @__PURE__ */ jsx11("div", { style: { ...cardStyle3, textAlign: "center" }, children: /* @__PURE__ */ jsxs10("div", { style: { fontSize: 11, color: "#4b5563", lineHeight: 1.5 }, children: [
|
|
4476
|
+
/* @__PURE__ */ jsx11("strong", { style: { color: "#C9A716" }, children: "AI citation analysis" }),
|
|
4066
4477
|
" needs at least 150 words to read fact density.",
|
|
4067
|
-
/* @__PURE__ */
|
|
4068
|
-
/* @__PURE__ */
|
|
4478
|
+
/* @__PURE__ */ jsx11("br", {}),
|
|
4479
|
+
/* @__PURE__ */ jsxs10("span", { style: { color: "#4b5563" }, children: [
|
|
4069
4480
|
"Current: ",
|
|
4070
4481
|
geoWordCount,
|
|
4071
4482
|
" word",
|
|
4072
4483
|
geoWordCount === 1 ? "" : "s"
|
|
4073
4484
|
] })
|
|
4074
4485
|
] }) }),
|
|
4075
|
-
!deepAnalysis && isDeepLoading && /* @__PURE__ */
|
|
4076
|
-
/* @__PURE__ */
|
|
4077
|
-
/* @__PURE__ */
|
|
4486
|
+
!deepAnalysis && isDeepLoading && /* @__PURE__ */ jsxs10("div", { style: { ...cardStyle3, display: "flex", alignItems: "center", justifyContent: "center", gap: 8 }, children: [
|
|
4487
|
+
/* @__PURE__ */ jsx11(LoadingBars, { size: "xs", color: AEO_PURPLE }),
|
|
4488
|
+
/* @__PURE__ */ jsx11("span", { style: { fontSize: 12, color: "#4b5563" }, children: "Generating AEO insights..." })
|
|
4078
4489
|
] }),
|
|
4079
|
-
!deepAnalysis && !isDeepLoading && /* @__PURE__ */
|
|
4080
|
-
/* @__PURE__ */
|
|
4081
|
-
/* @__PURE__ */
|
|
4490
|
+
!deepAnalysis && !isDeepLoading && /* @__PURE__ */ jsxs10("div", { style: { ...cardStyle3, textAlign: "center" }, children: [
|
|
4491
|
+
/* @__PURE__ */ jsx11("div", { style: { fontSize: 12, color: "#4b5563" }, children: "AI citation readiness and question-style heading suggestions appear here once analysis runs." }),
|
|
4492
|
+
/* @__PURE__ */ jsx11(
|
|
4082
4493
|
"button",
|
|
4083
4494
|
{
|
|
4084
4495
|
onClick: runDeepAnalysis,
|
|
@@ -4098,11 +4509,11 @@ function AEOTab({
|
|
|
4098
4509
|
}
|
|
4099
4510
|
)
|
|
4100
4511
|
] }),
|
|
4101
|
-
deepAnalysis && !aeo && /* @__PURE__ */
|
|
4102
|
-
questionHeadings.length > 0 && /* @__PURE__ */
|
|
4103
|
-
/* @__PURE__ */
|
|
4104
|
-
/* @__PURE__ */
|
|
4105
|
-
/* @__PURE__ */
|
|
4512
|
+
deepAnalysis && !aeo && /* @__PURE__ */ jsx11("div", { style: { ...cardStyle3, textAlign: "center" }, children: /* @__PURE__ */ jsx11("span", { style: { fontSize: 12, color: "#4b5563" }, children: "No insights came back. Try again - the analysis may have timed out." }) }),
|
|
4513
|
+
questionHeadings.length > 0 && /* @__PURE__ */ jsxs10("div", { style: cardStyle3, children: [
|
|
4514
|
+
/* @__PURE__ */ jsx11(SectionHeader2, { label: "Question-Style Headings", iconColor: AEO_PURPLE }),
|
|
4515
|
+
/* @__PURE__ */ jsx11("div", { style: { fontSize: 10, color: "#4b5563", marginBottom: 8 }, children: "Rewrites of your existing headings as questions. Google often pulls these into featured snippets." }),
|
|
4516
|
+
/* @__PURE__ */ jsx11("div", { style: { display: "flex", flexDirection: "column", gap: 8 }, children: questionHeadings.map((h, i) => /* @__PURE__ */ jsxs10(
|
|
4106
4517
|
"div",
|
|
4107
4518
|
{
|
|
4108
4519
|
style: {
|
|
@@ -4112,26 +4523,26 @@ function AEOTab({
|
|
|
4112
4523
|
borderLeft: `3px solid ${AEO_PURPLE}`
|
|
4113
4524
|
},
|
|
4114
4525
|
children: [
|
|
4115
|
-
/* @__PURE__ */
|
|
4116
|
-
/* @__PURE__ */
|
|
4117
|
-
h.originalHeading && /* @__PURE__ */
|
|
4118
|
-
/* @__PURE__ */
|
|
4526
|
+
/* @__PURE__ */ jsxs10("div", { style: { display: "flex", alignItems: "flex-start", justifyContent: "space-between", gap: 8 }, children: [
|
|
4527
|
+
/* @__PURE__ */ jsxs10("div", { style: { flex: 1 }, children: [
|
|
4528
|
+
h.originalHeading && /* @__PURE__ */ jsx11("div", { style: { fontSize: 11, color: "#4b5563", textDecoration: "line-through", marginBottom: 2 }, children: h.originalHeading }),
|
|
4529
|
+
/* @__PURE__ */ jsx11("div", { style: { fontSize: 12, fontWeight: 700, color: AEO_PURPLE, lineHeight: 1.5 }, children: h.heading })
|
|
4119
4530
|
] }),
|
|
4120
|
-
/* @__PURE__ */
|
|
4121
|
-
/* @__PURE__ */
|
|
4122
|
-
/* @__PURE__ */
|
|
4531
|
+
/* @__PURE__ */ jsxs10("div", { style: { display: "flex", alignItems: "center", gap: 4 }, children: [
|
|
4532
|
+
/* @__PURE__ */ jsx11(CopyButton, { text: h.heading }),
|
|
4533
|
+
/* @__PURE__ */ jsx11(FeedbackButton, { suggestionType: "aeo_heading", suggestionText: h.heading, publication })
|
|
4123
4534
|
] })
|
|
4124
4535
|
] }),
|
|
4125
|
-
/* @__PURE__ */
|
|
4536
|
+
/* @__PURE__ */ jsx11("div", { style: { fontSize: 10, color: "#4b5563", marginTop: 4, fontStyle: "italic" }, children: h.rationale })
|
|
4126
4537
|
]
|
|
4127
4538
|
},
|
|
4128
4539
|
i
|
|
4129
4540
|
)) })
|
|
4130
4541
|
] }),
|
|
4131
|
-
/* @__PURE__ */
|
|
4132
|
-
/* @__PURE__ */
|
|
4133
|
-
/* @__PURE__ */
|
|
4134
|
-
!contentSuggestions && !isCSLoading && /* @__PURE__ */
|
|
4542
|
+
/* @__PURE__ */ jsxs10("div", { style: cardStyle3, children: [
|
|
4543
|
+
/* @__PURE__ */ jsx11(SectionHeader2, { label: "Content Block Suggestions", iconColor: AEO_PURPLE }),
|
|
4544
|
+
/* @__PURE__ */ jsx11("div", { style: { fontSize: 10, color: "#4b5563", marginBottom: 10 }, children: "Short, citable blocks to use inside or alongside the article - takeaways, infographic ideas, and bullet points." }),
|
|
4545
|
+
!contentSuggestions && !isCSLoading && /* @__PURE__ */ jsx11(
|
|
4135
4546
|
"button",
|
|
4136
4547
|
{
|
|
4137
4548
|
onClick: loadContentSuggestions,
|
|
@@ -4155,15 +4566,15 @@ function AEOTab({
|
|
|
4155
4566
|
children: "Generate suggestions"
|
|
4156
4567
|
}
|
|
4157
4568
|
),
|
|
4158
|
-
isCSLoading && /* @__PURE__ */
|
|
4159
|
-
/* @__PURE__ */
|
|
4160
|
-
/* @__PURE__ */
|
|
4569
|
+
isCSLoading && /* @__PURE__ */ jsxs10("div", { style: { display: "flex", alignItems: "center", justifyContent: "center", gap: 8, padding: "8px 0" }, children: [
|
|
4570
|
+
/* @__PURE__ */ jsx11(LoadingBars, { size: "xs", color: AEO_PURPLE }),
|
|
4571
|
+
/* @__PURE__ */ jsx11("span", { style: { fontSize: 11, color: "#4b5563" }, children: "Generating content suggestions..." })
|
|
4161
4572
|
] }),
|
|
4162
|
-
csError && /* @__PURE__ */
|
|
4163
|
-
contentSuggestions && /* @__PURE__ */
|
|
4164
|
-
contentSuggestions.keyTakeaways.length > 0 && /* @__PURE__ */
|
|
4165
|
-
/* @__PURE__ */
|
|
4166
|
-
/* @__PURE__ */
|
|
4573
|
+
csError && /* @__PURE__ */ jsx11("div", { style: { marginTop: 6, fontSize: 11, color: "#dc2626" }, children: csError }),
|
|
4574
|
+
contentSuggestions && /* @__PURE__ */ jsxs10("div", { style: { display: "flex", flexDirection: "column", gap: 14, marginTop: 8 }, children: [
|
|
4575
|
+
contentSuggestions.keyTakeaways.length > 0 && /* @__PURE__ */ jsxs10("div", { children: [
|
|
4576
|
+
/* @__PURE__ */ jsx11("div", { style: { fontSize: 10, fontWeight: 700, textTransform: "uppercase", letterSpacing: "0.06em", color: AEO_PURPLE, marginBottom: 6 }, children: "Key Takeaways" }),
|
|
4577
|
+
/* @__PURE__ */ jsx11("div", { style: { display: "flex", flexDirection: "column", gap: 6 }, children: contentSuggestions.keyTakeaways.map((kt, i) => /* @__PURE__ */ jsxs10(
|
|
4167
4578
|
"div",
|
|
4168
4579
|
{
|
|
4169
4580
|
style: {
|
|
@@ -4176,19 +4587,19 @@ function AEOTab({
|
|
|
4176
4587
|
alignItems: "flex-start"
|
|
4177
4588
|
},
|
|
4178
4589
|
children: [
|
|
4179
|
-
/* @__PURE__ */
|
|
4180
|
-
/* @__PURE__ */
|
|
4181
|
-
/* @__PURE__ */
|
|
4182
|
-
/* @__PURE__ */
|
|
4590
|
+
/* @__PURE__ */ jsx11("span", { style: { fontSize: 12, color: "#1f2937", lineHeight: 1.55, flex: 1 }, children: kt }),
|
|
4591
|
+
/* @__PURE__ */ jsxs10("div", { style: { display: "flex", alignItems: "center", gap: 4 }, children: [
|
|
4592
|
+
/* @__PURE__ */ jsx11(CopyButton, { text: kt }),
|
|
4593
|
+
/* @__PURE__ */ jsx11(FeedbackButton, { suggestionType: "aeo_takeaway", suggestionText: kt, publication })
|
|
4183
4594
|
] })
|
|
4184
4595
|
]
|
|
4185
4596
|
},
|
|
4186
4597
|
i
|
|
4187
4598
|
)) })
|
|
4188
4599
|
] }),
|
|
4189
|
-
contentSuggestions.infographicOpportunities.length > 0 && /* @__PURE__ */
|
|
4190
|
-
/* @__PURE__ */
|
|
4191
|
-
/* @__PURE__ */
|
|
4600
|
+
contentSuggestions.infographicOpportunities.length > 0 && /* @__PURE__ */ jsxs10("div", { children: [
|
|
4601
|
+
/* @__PURE__ */ jsx11("div", { style: { fontSize: 10, fontWeight: 700, textTransform: "uppercase", letterSpacing: "0.06em", color: AEO_PURPLE, marginBottom: 6 }, children: "Infographic Ideas" }),
|
|
4602
|
+
/* @__PURE__ */ jsx11("div", { style: { display: "flex", flexDirection: "column", gap: 6 }, children: contentSuggestions.infographicOpportunities.map((io, i) => /* @__PURE__ */ jsxs10(
|
|
4192
4603
|
"div",
|
|
4193
4604
|
{
|
|
4194
4605
|
style: {
|
|
@@ -4198,23 +4609,23 @@ function AEOTab({
|
|
|
4198
4609
|
borderLeft: `2px solid ${AEO_PURPLE}`
|
|
4199
4610
|
},
|
|
4200
4611
|
children: [
|
|
4201
|
-
/* @__PURE__ */
|
|
4202
|
-
/* @__PURE__ */
|
|
4203
|
-
/* @__PURE__ */
|
|
4612
|
+
/* @__PURE__ */ jsxs10("div", { style: { display: "flex", alignItems: "flex-start", justifyContent: "space-between", gap: 8 }, children: [
|
|
4613
|
+
/* @__PURE__ */ jsx11("span", { style: { fontSize: 12, fontWeight: 700, color: AEO_PURPLE }, children: io.concept }),
|
|
4614
|
+
/* @__PURE__ */ jsx11(FeedbackButton, { suggestionType: "aeo_infographic", suggestionText: io.concept, publication })
|
|
4204
4615
|
] }),
|
|
4205
|
-
/* @__PURE__ */
|
|
4616
|
+
/* @__PURE__ */ jsx11("div", { style: { fontSize: 11, color: "#1f2937", lineHeight: 1.5, marginTop: 3 }, children: io.description })
|
|
4206
4617
|
]
|
|
4207
4618
|
},
|
|
4208
4619
|
i
|
|
4209
4620
|
)) })
|
|
4210
4621
|
] }),
|
|
4211
|
-
contentSuggestions.bulletListItems.length > 0 && /* @__PURE__ */
|
|
4212
|
-
/* @__PURE__ */
|
|
4213
|
-
/* @__PURE__ */
|
|
4214
|
-
/* @__PURE__ */
|
|
4215
|
-
/* @__PURE__ */
|
|
4216
|
-
/* @__PURE__ */
|
|
4217
|
-
/* @__PURE__ */
|
|
4622
|
+
contentSuggestions.bulletListItems.length > 0 && /* @__PURE__ */ jsxs10("div", { children: [
|
|
4623
|
+
/* @__PURE__ */ jsx11("div", { style: { fontSize: 10, fontWeight: 700, textTransform: "uppercase", letterSpacing: "0.06em", color: AEO_PURPLE, marginBottom: 6 }, children: "Bullets for Featured Snippets" }),
|
|
4624
|
+
/* @__PURE__ */ jsxs10("div", { style: { display: "flex", alignItems: "flex-start", justifyContent: "space-between", gap: 8 }, children: [
|
|
4625
|
+
/* @__PURE__ */ jsx11("ul", { style: { margin: 0, paddingLeft: 18, flex: 1 }, children: contentSuggestions.bulletListItems.map((b, i) => /* @__PURE__ */ jsx11("li", { style: { fontSize: 12, color: "#1f2937", lineHeight: 1.55, marginBottom: 4 }, children: b }, i)) }),
|
|
4626
|
+
/* @__PURE__ */ jsxs10("div", { style: { display: "flex", alignItems: "center", gap: 4 }, children: [
|
|
4627
|
+
/* @__PURE__ */ jsx11(CopyButton, { text: contentSuggestions.bulletListItems.map((b) => "- " + b).join("\n") }),
|
|
4628
|
+
/* @__PURE__ */ jsx11(
|
|
4218
4629
|
FeedbackButton,
|
|
4219
4630
|
{
|
|
4220
4631
|
suggestionType: "aeo_bullets",
|
|
@@ -4225,7 +4636,7 @@ function AEOTab({
|
|
|
4225
4636
|
] })
|
|
4226
4637
|
] })
|
|
4227
4638
|
] }),
|
|
4228
|
-
/* @__PURE__ */
|
|
4639
|
+
/* @__PURE__ */ jsx11(
|
|
4229
4640
|
"button",
|
|
4230
4641
|
{
|
|
4231
4642
|
onClick: loadContentSuggestions,
|
|
@@ -4255,7 +4666,7 @@ function AEOTab({
|
|
|
4255
4666
|
|
|
4256
4667
|
// src/components/ScoreDonut.tsx
|
|
4257
4668
|
import { useState as useState14 } from "react";
|
|
4258
|
-
import { jsx as
|
|
4669
|
+
import { jsx as jsx12, jsxs as jsxs11 } from "react/jsx-runtime";
|
|
4259
4670
|
var W = { topic: 0.6, freshness: 0.25, sectionFit: 0.15 };
|
|
4260
4671
|
var COLORS = { topic: MJH_BLUE, freshness: MJH_GOLD, sectionFit: "#9B59B6" };
|
|
4261
4672
|
var TRACK = "#eef2f7";
|
|
@@ -4280,7 +4691,7 @@ function ScoreDonut({
|
|
|
4280
4691
|
const topicLen = seg(cTopic);
|
|
4281
4692
|
const freshLen = seg(cFresh);
|
|
4282
4693
|
const sectionLen = seg(cSection);
|
|
4283
|
-
const Slice = ({ color, fullLen, offset }) => /* @__PURE__ */
|
|
4694
|
+
const Slice = ({ color, fullLen, offset }) => /* @__PURE__ */ jsx12(
|
|
4284
4695
|
"circle",
|
|
4285
4696
|
{
|
|
4286
4697
|
cx: size / 2,
|
|
@@ -4294,20 +4705,20 @@ function ScoreDonut({
|
|
|
4294
4705
|
strokeDashoffset: -offset
|
|
4295
4706
|
}
|
|
4296
4707
|
);
|
|
4297
|
-
return /* @__PURE__ */
|
|
4708
|
+
return /* @__PURE__ */ jsxs11(
|
|
4298
4709
|
"div",
|
|
4299
4710
|
{
|
|
4300
4711
|
style: { position: "relative", width: size, height: size, flexShrink: 0 },
|
|
4301
4712
|
onMouseEnter: () => setHovered(true),
|
|
4302
4713
|
onMouseLeave: () => setHovered(false),
|
|
4303
4714
|
children: [
|
|
4304
|
-
/* @__PURE__ */
|
|
4305
|
-
/* @__PURE__ */
|
|
4306
|
-
/* @__PURE__ */
|
|
4307
|
-
/* @__PURE__ */
|
|
4308
|
-
/* @__PURE__ */
|
|
4715
|
+
/* @__PURE__ */ jsxs11("svg", { width: size, height: size, viewBox: `0 0 ${size} ${size}`, style: { transform: "rotate(-90deg)" }, children: [
|
|
4716
|
+
/* @__PURE__ */ jsx12("circle", { cx: size / 2, cy: size / 2, r: radius, fill: "none", stroke: TRACK, strokeWidth }),
|
|
4717
|
+
/* @__PURE__ */ jsx12(Slice, { color: COLORS.topic, fullLen: topicLen, offset: 0 }),
|
|
4718
|
+
/* @__PURE__ */ jsx12(Slice, { color: COLORS.freshness, fullLen: freshLen, offset: topicLen }),
|
|
4719
|
+
/* @__PURE__ */ jsx12(Slice, { color: COLORS.sectionFit, fullLen: sectionLen, offset: topicLen + freshLen })
|
|
4309
4720
|
] }),
|
|
4310
|
-
/* @__PURE__ */
|
|
4721
|
+
/* @__PURE__ */ jsxs11(
|
|
4311
4722
|
"div",
|
|
4312
4723
|
{
|
|
4313
4724
|
style: {
|
|
@@ -4321,15 +4732,15 @@ function ScoreDonut({
|
|
|
4321
4732
|
lineHeight: 1
|
|
4322
4733
|
},
|
|
4323
4734
|
children: [
|
|
4324
|
-
/* @__PURE__ */
|
|
4735
|
+
/* @__PURE__ */ jsxs11("span", { style: { fontSize: Math.max(11, size / 5.5), fontWeight: 700, color: "#1f2937" }, children: [
|
|
4325
4736
|
compositeValue,
|
|
4326
4737
|
"%"
|
|
4327
4738
|
] }),
|
|
4328
|
-
/* @__PURE__ */
|
|
4739
|
+
/* @__PURE__ */ jsx12("span", { style: { fontSize: Math.max(7, size / 11), fontWeight: 700, color: "#4b5563", letterSpacing: "0.05em", marginTop: 1 }, children: "MATCH" })
|
|
4329
4740
|
]
|
|
4330
4741
|
}
|
|
4331
4742
|
),
|
|
4332
|
-
hovered && /* @__PURE__ */
|
|
4743
|
+
hovered && /* @__PURE__ */ jsxs11(
|
|
4333
4744
|
"div",
|
|
4334
4745
|
{
|
|
4335
4746
|
role: "tooltip",
|
|
@@ -4350,9 +4761,9 @@ function ScoreDonut({
|
|
|
4350
4761
|
pointerEvents: "none"
|
|
4351
4762
|
},
|
|
4352
4763
|
children: [
|
|
4353
|
-
/* @__PURE__ */
|
|
4354
|
-
/* @__PURE__ */
|
|
4355
|
-
/* @__PURE__ */
|
|
4764
|
+
/* @__PURE__ */ jsx12(SubScoreRow, { color: COLORS.topic, label: "Topic", value: topic }),
|
|
4765
|
+
/* @__PURE__ */ jsx12(SubScoreRow, { color: COLORS.freshness, label: "Freshness", value: freshness }),
|
|
4766
|
+
/* @__PURE__ */ jsx12(SubScoreRow, { color: COLORS.sectionFit, label: "Section fit", value: sectionFit })
|
|
4356
4767
|
]
|
|
4357
4768
|
}
|
|
4358
4769
|
)
|
|
@@ -4361,31 +4772,76 @@ function ScoreDonut({
|
|
|
4361
4772
|
);
|
|
4362
4773
|
}
|
|
4363
4774
|
function SubScoreRow({ color, label, value }) {
|
|
4364
|
-
return /* @__PURE__ */
|
|
4365
|
-
/* @__PURE__ */
|
|
4366
|
-
/* @__PURE__ */
|
|
4367
|
-
/* @__PURE__ */
|
|
4775
|
+
return /* @__PURE__ */ jsxs11("div", { style: { display: "flex", alignItems: "center", gap: 6 }, children: [
|
|
4776
|
+
/* @__PURE__ */ jsx12("span", { style: { width: 7, height: 7, borderRadius: "50%", background: color, display: "inline-block", flexShrink: 0 } }),
|
|
4777
|
+
/* @__PURE__ */ jsx12("span", { style: { flex: 1 }, children: label }),
|
|
4778
|
+
/* @__PURE__ */ jsxs11("span", { style: { fontWeight: 700, fontVariantNumeric: "tabular-nums" }, children: [
|
|
4368
4779
|
Math.round(value),
|
|
4369
4780
|
"/100"
|
|
4370
4781
|
] })
|
|
4371
4782
|
] });
|
|
4372
4783
|
}
|
|
4373
4784
|
function ScoreDonutLegend() {
|
|
4374
|
-
return /* @__PURE__ */
|
|
4375
|
-
/* @__PURE__ */
|
|
4376
|
-
/* @__PURE__ */
|
|
4377
|
-
/* @__PURE__ */
|
|
4785
|
+
return /* @__PURE__ */ jsxs11("div", { style: { display: "flex", gap: 10, fontSize: 9, color: "rgba(0,0,0,0.55)", alignItems: "center", flexWrap: "wrap" }, children: [
|
|
4786
|
+
/* @__PURE__ */ jsx12(LegendDot, { color: COLORS.topic, label: "Topic match (60% of score)" }),
|
|
4787
|
+
/* @__PURE__ */ jsx12(LegendDot, { color: COLORS.freshness, label: "Freshness (25%)" }),
|
|
4788
|
+
/* @__PURE__ */ jsx12(LegendDot, { color: COLORS.sectionFit, label: "Section fit (15%)" })
|
|
4378
4789
|
] });
|
|
4379
4790
|
}
|
|
4380
4791
|
function LegendDot({ color, label }) {
|
|
4381
|
-
return /* @__PURE__ */
|
|
4382
|
-
/* @__PURE__ */
|
|
4792
|
+
return /* @__PURE__ */ jsxs11("span", { style: { display: "inline-flex", alignItems: "center", gap: 4 }, children: [
|
|
4793
|
+
/* @__PURE__ */ jsx12("span", { style: { width: 7, height: 7, borderRadius: "50%", background: color, display: "inline-block" } }),
|
|
4383
4794
|
label
|
|
4384
4795
|
] });
|
|
4385
4796
|
}
|
|
4386
4797
|
|
|
4387
4798
|
// src/components/tabs/LinkingTab.tsx
|
|
4388
|
-
import { Fragment as
|
|
4799
|
+
import { Fragment as Fragment6, jsx as jsx13, jsxs as jsxs12 } from "react/jsx-runtime";
|
|
4800
|
+
function buildLiveUrl(publication, slug) {
|
|
4801
|
+
if (!slug) return null;
|
|
4802
|
+
const pub = (publication || "").trim().toLowerCase();
|
|
4803
|
+
if (!/^[a-z0-9-]+$/.test(pub)) return null;
|
|
4804
|
+
const cleanSlug = slug.replace(/^\/+/, "");
|
|
4805
|
+
return `https://www.${pub}.com/view/${cleanSlug}`;
|
|
4806
|
+
}
|
|
4807
|
+
function buildSanityUrl(baseUrl, id, type) {
|
|
4808
|
+
if (!baseUrl || !id) return null;
|
|
4809
|
+
const cleanId = id.replace(/^drafts\./, "");
|
|
4810
|
+
const base = baseUrl.replace(/\/+$/, "");
|
|
4811
|
+
const typePart = type ? `;type=${encodeURIComponent(type)}` : "";
|
|
4812
|
+
return `${base}/intent/edit/id=${encodeURIComponent(cleanId)}${typePart}/`;
|
|
4813
|
+
}
|
|
4814
|
+
function LinkChip({ href, label, color }) {
|
|
4815
|
+
return /* @__PURE__ */ jsxs12(
|
|
4816
|
+
"a",
|
|
4817
|
+
{
|
|
4818
|
+
href,
|
|
4819
|
+
target: "_blank",
|
|
4820
|
+
rel: "noopener noreferrer",
|
|
4821
|
+
style: {
|
|
4822
|
+
display: "inline-flex",
|
|
4823
|
+
alignItems: "center",
|
|
4824
|
+
gap: 4,
|
|
4825
|
+
padding: "3px 9px",
|
|
4826
|
+
borderRadius: 99,
|
|
4827
|
+
fontSize: 10.5,
|
|
4828
|
+
fontWeight: 700,
|
|
4829
|
+
color,
|
|
4830
|
+
background: "rgba(255,255,255,0.7)",
|
|
4831
|
+
border: `1px solid ${color}33`,
|
|
4832
|
+
textDecoration: "none",
|
|
4833
|
+
lineHeight: 1.2
|
|
4834
|
+
},
|
|
4835
|
+
children: [
|
|
4836
|
+
label,
|
|
4837
|
+
/* @__PURE__ */ jsxs12("svg", { width: "9", height: "9", viewBox: "0 0 20 20", fill: "currentColor", "aria-hidden": "true", children: [
|
|
4838
|
+
/* @__PURE__ */ jsx13("path", { d: "M12.5 2a.75.75 0 000 1.5h2.44l-6.97 6.97a.75.75 0 101.06 1.06L16 4.56V7a.75.75 0 001.5 0V2.75A.75.75 0 0016.75 2H12.5z" }),
|
|
4839
|
+
/* @__PURE__ */ jsx13("path", { d: "M4.75 4.5A2.75 2.75 0 002 7.25v8A2.75 2.75 0 004.75 18h8A2.75 2.75 0 0015.5 15.25v-3a.75.75 0 00-1.5 0v3c0 .69-.56 1.25-1.25 1.25h-8c-.69 0-1.25-.56-1.25-1.25v-8c0-.69.56-1.25 1.25-1.25h3a.75.75 0 000-1.5h-3z" })
|
|
4840
|
+
] })
|
|
4841
|
+
]
|
|
4842
|
+
}
|
|
4843
|
+
);
|
|
4844
|
+
}
|
|
4389
4845
|
var cardStyle4 = {
|
|
4390
4846
|
borderRadius: 14,
|
|
4391
4847
|
background: "rgba(255,255,255,0.55)",
|
|
@@ -4395,7 +4851,7 @@ var cardStyle4 = {
|
|
|
4395
4851
|
padding: "14px"
|
|
4396
4852
|
};
|
|
4397
4853
|
function AiPill2() {
|
|
4398
|
-
return /* @__PURE__ */
|
|
4854
|
+
return /* @__PURE__ */ jsx13(
|
|
4399
4855
|
"span",
|
|
4400
4856
|
{
|
|
4401
4857
|
style: {
|
|
@@ -4419,10 +4875,10 @@ function SectionHeader3({
|
|
|
4419
4875
|
ai,
|
|
4420
4876
|
action
|
|
4421
4877
|
}) {
|
|
4422
|
-
return /* @__PURE__ */
|
|
4423
|
-
/* @__PURE__ */
|
|
4424
|
-
/* @__PURE__ */
|
|
4425
|
-
ai && /* @__PURE__ */
|
|
4878
|
+
return /* @__PURE__ */ jsxs12("div", { style: { display: "flex", alignItems: "center", gap: 7, marginBottom: 8 }, children: [
|
|
4879
|
+
/* @__PURE__ */ jsx13("div", { style: { width: 7, height: 7, borderRadius: "50%", background: iconColor, flexShrink: 0 } }),
|
|
4880
|
+
/* @__PURE__ */ jsx13("span", { style: { fontSize: 10.5, textTransform: "uppercase", letterSpacing: "0.06em", color: "#4b5563", fontWeight: 600, flex: 1 }, children: label }),
|
|
4881
|
+
ai && /* @__PURE__ */ jsx13(AiPill2, {}),
|
|
4426
4882
|
action
|
|
4427
4883
|
] });
|
|
4428
4884
|
}
|
|
@@ -4442,7 +4898,7 @@ function freshnessChip(label, score) {
|
|
|
4442
4898
|
"very-old": { bg: "rgba(220,38,38,0.1)", color: "#dc2626", text: "Very old" }
|
|
4443
4899
|
};
|
|
4444
4900
|
const c = map[label];
|
|
4445
|
-
return /* @__PURE__ */
|
|
4901
|
+
return /* @__PURE__ */ jsx13(
|
|
4446
4902
|
"span",
|
|
4447
4903
|
{
|
|
4448
4904
|
style: {
|
|
@@ -4462,8 +4918,8 @@ function freshnessChip(label, score) {
|
|
|
4462
4918
|
);
|
|
4463
4919
|
}
|
|
4464
4920
|
function RefreshIcon({ spinning }) {
|
|
4465
|
-
if (spinning) return /* @__PURE__ */
|
|
4466
|
-
return /* @__PURE__ */
|
|
4921
|
+
if (spinning) return /* @__PURE__ */ jsx13(LoadingBars, { size: "xs", color: "#9ca3af" });
|
|
4922
|
+
return /* @__PURE__ */ jsx13("svg", { width: "12", height: "12", viewBox: "0 0 20 20", fill: "currentColor", children: /* @__PURE__ */ jsx13("path", { fillRule: "evenodd", d: "M15.312 11.424a5.5 5.5 0 01-9.201 2.466l-.312-.311h2.433a.75.75 0 000-1.5H4.598a.75.75 0 00-.75.75v3.634a.75.75 0 001.5 0v-2.033l.312.311a7 7 0 0011.712-3.138.75.75 0 00-1.449-.39zm-10.624-2.85a5.5 5.5 0 019.201-2.466l.312.311h-2.433a.75.75 0 000 1.5h3.634a.75.75 0 00.75-.75V3.535a.75.75 0 00-1.5 0v2.033l-.312-.311A7 7 0 002.628 8.395a.75.75 0 001.449.39z", clipRule: "evenodd" }) });
|
|
4467
4923
|
}
|
|
4468
4924
|
function LinkingTab({
|
|
4469
4925
|
analysis,
|
|
@@ -4474,24 +4930,26 @@ function LinkingTab({
|
|
|
4474
4930
|
onRefresh,
|
|
4475
4931
|
text,
|
|
4476
4932
|
documentId,
|
|
4477
|
-
publication
|
|
4933
|
+
publication,
|
|
4934
|
+
sanityBaseUrl,
|
|
4935
|
+
documentType
|
|
4478
4936
|
}) {
|
|
4479
4937
|
if (!analysis) {
|
|
4480
|
-
return /* @__PURE__ */
|
|
4481
|
-
/* @__PURE__ */
|
|
4482
|
-
/* @__PURE__ */
|
|
4938
|
+
return /* @__PURE__ */ jsxs12("div", { style: { padding: 24, textAlign: "center" }, children: [
|
|
4939
|
+
/* @__PURE__ */ jsx13("div", { style: { fontSize: 13, color: "#4b5563", fontWeight: 500 }, children: "Waiting for keyword analysis" }),
|
|
4940
|
+
/* @__PURE__ */ jsx13("div", { style: { fontSize: 11, color: "#4b5563", marginTop: 4 }, children: "Linking reads the article keywords and topic to find related published articles. It starts on its own once the Keywords tab finishes." })
|
|
4483
4941
|
] });
|
|
4484
4942
|
}
|
|
4485
4943
|
const wordCount2 = text ? text.split(/\s+/).filter(Boolean).length : 0;
|
|
4486
4944
|
const recommendedMin = Math.max(1, Math.round(wordCount2 / 1e3 * 2));
|
|
4487
4945
|
const recommendedMax = Math.max(2, Math.round(wordCount2 / 1e3 * 5));
|
|
4488
|
-
return /* @__PURE__ */
|
|
4489
|
-
/* @__PURE__ */
|
|
4946
|
+
return /* @__PURE__ */ jsx13("div", { style: { padding: 12, display: "flex", flexDirection: "column", gap: 12 }, children: /* @__PURE__ */ jsxs12("div", { id: "anchor-linking-suggestions", style: cardStyle4, children: [
|
|
4947
|
+
/* @__PURE__ */ jsx13(
|
|
4490
4948
|
SectionHeader3,
|
|
4491
4949
|
{
|
|
4492
4950
|
label: "Suggested Links",
|
|
4493
4951
|
iconColor: MJH_BLUE,
|
|
4494
|
-
action: /* @__PURE__ */
|
|
4952
|
+
action: /* @__PURE__ */ jsx13(
|
|
4495
4953
|
"button",
|
|
4496
4954
|
{
|
|
4497
4955
|
onClick: onRefresh,
|
|
@@ -4506,20 +4964,20 @@ function LinkingTab({
|
|
|
4506
4964
|
fontSize: 10
|
|
4507
4965
|
},
|
|
4508
4966
|
title: "Refresh",
|
|
4509
|
-
children: /* @__PURE__ */
|
|
4967
|
+
children: /* @__PURE__ */ jsx13(RefreshIcon, { spinning: isLoading })
|
|
4510
4968
|
}
|
|
4511
4969
|
)
|
|
4512
4970
|
}
|
|
4513
4971
|
),
|
|
4514
|
-
/* @__PURE__ */
|
|
4972
|
+
/* @__PURE__ */ jsxs12("div", { style: { fontSize: 11, color: "#1f2937", marginBottom: 8, lineHeight: 1.55 }, children: [
|
|
4515
4973
|
"Other articles on this site that fit this topic.",
|
|
4516
|
-
wordCount2 > 0 && /* @__PURE__ */
|
|
4974
|
+
wordCount2 > 0 && /* @__PURE__ */ jsxs12(Fragment6, { children: [
|
|
4517
4975
|
" ",
|
|
4518
4976
|
"For a ",
|
|
4519
4977
|
wordCount2.toLocaleString(),
|
|
4520
4978
|
"-word article, aim for",
|
|
4521
4979
|
" ",
|
|
4522
|
-
/* @__PURE__ */
|
|
4980
|
+
/* @__PURE__ */ jsxs12("strong", { children: [
|
|
4523
4981
|
recommendedMin,
|
|
4524
4982
|
"-",
|
|
4525
4983
|
recommendedMax,
|
|
@@ -4528,17 +4986,17 @@ function LinkingTab({
|
|
|
4528
4986
|
"."
|
|
4529
4987
|
] })
|
|
4530
4988
|
] }),
|
|
4531
|
-
/* @__PURE__ */
|
|
4989
|
+
/* @__PURE__ */ jsxs12("div", { style: { fontSize: 10, color: "#4b5563", marginBottom: 6, lineHeight: 1.5 }, children: [
|
|
4532
4990
|
"Each suggestion gets a 0-100% match score from three signals - ",
|
|
4533
|
-
/* @__PURE__ */
|
|
4991
|
+
/* @__PURE__ */ jsx13("strong", { children: "topic match" }),
|
|
4534
4992
|
", ",
|
|
4535
|
-
/* @__PURE__ */
|
|
4993
|
+
/* @__PURE__ */ jsx13("strong", { children: "freshness" }),
|
|
4536
4994
|
", and ",
|
|
4537
|
-
/* @__PURE__ */
|
|
4995
|
+
/* @__PURE__ */ jsx13("strong", { children: "section fit" }),
|
|
4538
4996
|
" (where in your article the link belongs). The percentage on each card is the weighted total:"
|
|
4539
4997
|
] }),
|
|
4540
|
-
/* @__PURE__ */
|
|
4541
|
-
isStale && suggestions.length > 0 && !isLoading && /* @__PURE__ */
|
|
4998
|
+
/* @__PURE__ */ jsx13("div", { style: { marginBottom: 10 }, children: /* @__PURE__ */ jsx13(ScoreDonutLegend, {}) }),
|
|
4999
|
+
isStale && suggestions.length > 0 && !isLoading && /* @__PURE__ */ jsxs12(
|
|
4542
5000
|
"div",
|
|
4543
5001
|
{
|
|
4544
5002
|
onClick: onRefresh,
|
|
@@ -4555,16 +5013,16 @@ function LinkingTab({
|
|
|
4555
5013
|
cursor: "pointer"
|
|
4556
5014
|
},
|
|
4557
5015
|
children: [
|
|
4558
|
-
/* @__PURE__ */
|
|
4559
|
-
/* @__PURE__ */
|
|
5016
|
+
/* @__PURE__ */ jsx13("span", { style: { fontSize: 11, color: "#92400e" }, children: "Your article changed since these were generated." }),
|
|
5017
|
+
/* @__PURE__ */ jsx13("span", { style: { fontSize: 11, fontWeight: 700, color: "#8B7310", textDecoration: "underline", flexShrink: 0 }, children: "Refresh" })
|
|
4560
5018
|
]
|
|
4561
5019
|
}
|
|
4562
5020
|
),
|
|
4563
|
-
isLoading && suggestions.length === 0 && /* @__PURE__ */
|
|
4564
|
-
/* @__PURE__ */
|
|
4565
|
-
/* @__PURE__ */
|
|
5021
|
+
isLoading && suggestions.length === 0 && /* @__PURE__ */ jsxs12("div", { style: { display: "flex", alignItems: "center", justifyContent: "center", gap: 8, padding: "16px 0" }, children: [
|
|
5022
|
+
/* @__PURE__ */ jsx13(LoadingBars, { size: "xs", color: MJH_BLUE }),
|
|
5023
|
+
/* @__PURE__ */ jsx13("span", { style: { fontSize: 11, color: "#4b5563" }, children: "Ranking candidates..." })
|
|
4566
5024
|
] }),
|
|
4567
|
-
!isLoading && error && /* @__PURE__ */
|
|
5025
|
+
!isLoading && error && /* @__PURE__ */ jsxs12(
|
|
4568
5026
|
"div",
|
|
4569
5027
|
{
|
|
4570
5028
|
style: {
|
|
@@ -4575,9 +5033,9 @@ function LinkingTab({
|
|
|
4575
5033
|
textAlign: "center"
|
|
4576
5034
|
},
|
|
4577
5035
|
children: [
|
|
4578
|
-
/* @__PURE__ */
|
|
4579
|
-
/* @__PURE__ */
|
|
4580
|
-
/* @__PURE__ */
|
|
5036
|
+
/* @__PURE__ */ jsx13("div", { style: { fontSize: 11.5, color: "#b91c1c", fontWeight: 600, marginBottom: 2 }, children: "Couldn't load suggestions" }),
|
|
5037
|
+
/* @__PURE__ */ jsx13("div", { style: { fontSize: 10.5, color: "#4b5563", marginBottom: 8 }, children: error }),
|
|
5038
|
+
/* @__PURE__ */ jsx13(
|
|
4581
5039
|
"button",
|
|
4582
5040
|
{
|
|
4583
5041
|
onClick: onRefresh,
|
|
@@ -4597,11 +5055,11 @@ function LinkingTab({
|
|
|
4597
5055
|
]
|
|
4598
5056
|
}
|
|
4599
5057
|
),
|
|
4600
|
-
!isLoading && !error && suggestions.length === 0 && /* @__PURE__ */
|
|
4601
|
-
/* @__PURE__ */
|
|
4602
|
-
/* @__PURE__ */
|
|
5058
|
+
!isLoading && !error && suggestions.length === 0 && /* @__PURE__ */ jsxs12("div", { style: { fontSize: 11, color: "#1f2937", padding: "10px 12px", lineHeight: 1.55, background: "rgba(0,93,172,0.04)", borderRadius: 8, border: "1px solid rgba(0,93,172,0.12)" }, children: [
|
|
5059
|
+
/* @__PURE__ */ jsx13("div", { style: { fontWeight: 700, marginBottom: 4, color: "#1f2937" }, children: "No closely related articles found." }),
|
|
5060
|
+
/* @__PURE__ */ jsx13("div", { style: { color: "#4b5563" }, children: "Linking searched your publication for articles on this topic and did not find a strong match. As more related content is published, suggestions will appear here." })
|
|
4603
5061
|
] }),
|
|
4604
|
-
suggestions.length > 0 && /* @__PURE__ */
|
|
5062
|
+
suggestions.length > 0 && /* @__PURE__ */ jsx13("div", { style: { display: "flex", flexDirection: "column", gap: 10 }, children: suggestions.map((s) => /* @__PURE__ */ jsxs12(
|
|
4605
5063
|
"div",
|
|
4606
5064
|
{
|
|
4607
5065
|
style: {
|
|
@@ -4614,7 +5072,7 @@ function LinkingTab({
|
|
|
4614
5072
|
alignItems: "flex-start"
|
|
4615
5073
|
},
|
|
4616
5074
|
children: [
|
|
4617
|
-
/* @__PURE__ */
|
|
5075
|
+
/* @__PURE__ */ jsx13(
|
|
4618
5076
|
ScoreDonut,
|
|
4619
5077
|
{
|
|
4620
5078
|
size: 64,
|
|
@@ -4624,22 +5082,31 @@ function LinkingTab({
|
|
|
4624
5082
|
composite: s.compositeScore
|
|
4625
5083
|
}
|
|
4626
5084
|
),
|
|
4627
|
-
/* @__PURE__ */
|
|
4628
|
-
/* @__PURE__ */
|
|
5085
|
+
/* @__PURE__ */ jsxs12("div", { style: { flex: 1, minWidth: 0 }, children: [
|
|
5086
|
+
/* @__PURE__ */ jsxs12("div", { style: { display: "flex", alignItems: "center", gap: 6, marginBottom: 3, flexWrap: "wrap" }, children: [
|
|
4629
5087
|
freshnessChip(s.freshnessLabel, s.freshnessScore),
|
|
4630
|
-
s.publishedAt && /* @__PURE__ */
|
|
5088
|
+
s.publishedAt && /* @__PURE__ */ jsx13("span", { style: { fontSize: 10, color: "#4b5563" }, children: formatDate(s.publishedAt) })
|
|
4631
5089
|
] }),
|
|
4632
|
-
/* @__PURE__ */
|
|
4633
|
-
/* @__PURE__ */
|
|
5090
|
+
/* @__PURE__ */ jsx13("div", { style: { fontSize: 12, fontWeight: 700, color: "#1f2937", lineHeight: 1.4, marginBottom: 2 }, children: s.title }),
|
|
5091
|
+
/* @__PURE__ */ jsxs12("div", { style: { fontSize: 10, color: "#4b5563", fontFamily: "ui-monospace, SFMono-Regular, monospace", marginBottom: 6 }, children: [
|
|
4634
5092
|
"/",
|
|
4635
5093
|
s.slug
|
|
4636
5094
|
] }),
|
|
4637
|
-
|
|
4638
|
-
|
|
5095
|
+
(() => {
|
|
5096
|
+
const liveUrl = buildLiveUrl(publication, s.slug);
|
|
5097
|
+
const sanityUrl = buildSanityUrl(sanityBaseUrl, s._id, documentType);
|
|
5098
|
+
if (!liveUrl && !sanityUrl) return null;
|
|
5099
|
+
return /* @__PURE__ */ jsxs12("div", { style: { display: "flex", flexWrap: "wrap", gap: 6, marginBottom: 6 }, children: [
|
|
5100
|
+
sanityUrl && /* @__PURE__ */ jsx13(LinkChip, { href: sanityUrl, label: "Inside Sanity", color: MJH_BLUE }),
|
|
5101
|
+
liveUrl && /* @__PURE__ */ jsx13(LinkChip, { href: liveUrl, label: "Live site", color: "#4b5563" })
|
|
5102
|
+
] });
|
|
5103
|
+
})(),
|
|
5104
|
+
s.relevanceReason && /* @__PURE__ */ jsxs12("div", { style: { fontSize: 11, color: "#1f2937", marginBottom: 6, lineHeight: 1.45 }, children: [
|
|
5105
|
+
/* @__PURE__ */ jsx13("span", { style: { fontWeight: 700, color: "#4b5563" }, children: "Why it fits:" }),
|
|
4639
5106
|
" ",
|
|
4640
|
-
/* @__PURE__ */
|
|
5107
|
+
/* @__PURE__ */ jsx13("span", { style: { fontStyle: "italic" }, children: s.relevanceReason })
|
|
4641
5108
|
] }),
|
|
4642
|
-
s.anchorQuote && /* @__PURE__ */
|
|
5109
|
+
s.anchorQuote && /* @__PURE__ */ jsxs12(
|
|
4643
5110
|
"div",
|
|
4644
5111
|
{
|
|
4645
5112
|
style: {
|
|
@@ -4653,21 +5120,21 @@ function LinkingTab({
|
|
|
4653
5120
|
lineHeight: 1.5
|
|
4654
5121
|
},
|
|
4655
5122
|
children: [
|
|
4656
|
-
/* @__PURE__ */
|
|
5123
|
+
/* @__PURE__ */ jsxs12("div", { style: { fontSize: 9, fontWeight: 700, color: "#4b5563", textTransform: "uppercase", letterSpacing: "0.05em", marginBottom: 3 }, children: [
|
|
4657
5124
|
"Where to link from - paragraph ",
|
|
4658
5125
|
s.anchorParagraph
|
|
4659
5126
|
] }),
|
|
4660
|
-
/* @__PURE__ */
|
|
5127
|
+
/* @__PURE__ */ jsxs12("div", { style: { fontStyle: "italic" }, children: [
|
|
4661
5128
|
'"',
|
|
4662
5129
|
s.anchorQuote,
|
|
4663
5130
|
'"'
|
|
4664
5131
|
] }),
|
|
4665
|
-
s.anchorReason && /* @__PURE__ */
|
|
5132
|
+
s.anchorReason && /* @__PURE__ */ jsx13("div", { style: { fontSize: 10, color: "#4b5563", marginTop: 3, lineHeight: 1.45 }, children: s.anchorReason })
|
|
4666
5133
|
]
|
|
4667
5134
|
}
|
|
4668
5135
|
)
|
|
4669
5136
|
] }),
|
|
4670
|
-
/* @__PURE__ */
|
|
5137
|
+
/* @__PURE__ */ jsx13("div", { style: { flexShrink: 0 }, children: /* @__PURE__ */ jsx13(
|
|
4671
5138
|
FeedbackButton,
|
|
4672
5139
|
{
|
|
4673
5140
|
suggestionType: "internal_link",
|
|
@@ -4684,8 +5151,8 @@ function LinkingTab({
|
|
|
4684
5151
|
}
|
|
4685
5152
|
|
|
4686
5153
|
// src/components/tabs/MetaTab.tsx
|
|
4687
|
-
import { useMemo as useMemo3
|
|
4688
|
-
import { Fragment as
|
|
5154
|
+
import { useMemo as useMemo3 } from "react";
|
|
5155
|
+
import { Fragment as Fragment7, jsx as jsx14, jsxs as jsxs13 } from "react/jsx-runtime";
|
|
4689
5156
|
function containsKeywordTokens(haystack, needle) {
|
|
4690
5157
|
if (!needle) return true;
|
|
4691
5158
|
const tokens = needle.toLowerCase().split(/\s+/).filter((t) => t.length > 1);
|
|
@@ -4708,7 +5175,7 @@ function StatusBadge({ status }) {
|
|
|
4708
5175
|
error: { bg: "rgba(220,38,38,0.1)", color: "#dc2626", label: "Fix" }
|
|
4709
5176
|
};
|
|
4710
5177
|
const c = map[status];
|
|
4711
|
-
return /* @__PURE__ */
|
|
5178
|
+
return /* @__PURE__ */ jsx14(
|
|
4712
5179
|
"span",
|
|
4713
5180
|
{
|
|
4714
5181
|
style: {
|
|
@@ -4727,12 +5194,12 @@ function StatusBadge({ status }) {
|
|
|
4727
5194
|
);
|
|
4728
5195
|
}
|
|
4729
5196
|
function AuditCard({ label, value, status, recommendation, anchorId, footer }) {
|
|
4730
|
-
return /* @__PURE__ */
|
|
4731
|
-
/* @__PURE__ */
|
|
4732
|
-
/* @__PURE__ */
|
|
4733
|
-
/* @__PURE__ */
|
|
5197
|
+
return /* @__PURE__ */ jsxs13("div", { id: anchorId, style: cardStyle5, children: [
|
|
5198
|
+
/* @__PURE__ */ jsxs13("div", { style: { display: "flex", alignItems: "center", justifyContent: "space-between", gap: 8, marginBottom: 6 }, children: [
|
|
5199
|
+
/* @__PURE__ */ jsx14("span", { style: { fontSize: 10.5, textTransform: "uppercase", letterSpacing: "0.06em", color: "#4b5563", fontWeight: 600 }, children: label }),
|
|
5200
|
+
/* @__PURE__ */ jsx14(StatusBadge, { status })
|
|
4734
5201
|
] }),
|
|
4735
|
-
/* @__PURE__ */
|
|
5202
|
+
/* @__PURE__ */ jsx14(
|
|
4736
5203
|
"div",
|
|
4737
5204
|
{
|
|
4738
5205
|
style: {
|
|
@@ -4745,7 +5212,7 @@ function AuditCard({ label, value, status, recommendation, anchorId, footer }) {
|
|
|
4745
5212
|
children: value
|
|
4746
5213
|
}
|
|
4747
5214
|
),
|
|
4748
|
-
recommendation && /* @__PURE__ */
|
|
5215
|
+
recommendation && /* @__PURE__ */ jsx14(
|
|
4749
5216
|
"div",
|
|
4750
5217
|
{
|
|
4751
5218
|
style: {
|
|
@@ -4764,23 +5231,37 @@ function AuditCard({ label, value, status, recommendation, anchorId, footer }) {
|
|
|
4764
5231
|
footer
|
|
4765
5232
|
] });
|
|
4766
5233
|
}
|
|
4767
|
-
function
|
|
5234
|
+
function keywordCoverageNote(haystack, primaryKeyword, secondaryKeyword) {
|
|
5235
|
+
const hasPrimary = primaryKeyword ? containsKeywordTokens(haystack, primaryKeyword) : true;
|
|
5236
|
+
const hasSecondary = secondaryKeyword ? containsKeywordTokens(haystack, secondaryKeyword) : true;
|
|
5237
|
+
if (primaryKeyword && !hasPrimary && secondaryKeyword && !hasSecondary) {
|
|
5238
|
+
return `Neither your primary keyword "${primaryKeyword}" nor your secondary keyword "${secondaryKeyword}" appears here.`;
|
|
5239
|
+
}
|
|
5240
|
+
if (primaryKeyword && !hasPrimary) {
|
|
5241
|
+
return `Your primary keyword "${primaryKeyword}" isn't included${secondaryKeyword ? ` (secondary keyword "${secondaryKeyword}" ${hasSecondary ? "is" : "isn't"}).` : "."}`;
|
|
5242
|
+
}
|
|
5243
|
+
if (secondaryKeyword && !hasSecondary) {
|
|
5244
|
+
return `Your primary keyword "${primaryKeyword}" is included, but your secondary keyword "${secondaryKeyword}" is not. Work it in if it reads naturally.`;
|
|
5245
|
+
}
|
|
5246
|
+
return "";
|
|
5247
|
+
}
|
|
5248
|
+
function metaDescriptionAudit(meta, primaryKeyword, secondaryKeyword) {
|
|
4768
5249
|
if (!meta) {
|
|
4769
5250
|
return {
|
|
4770
5251
|
label: "Meta Description",
|
|
4771
5252
|
value: "Missing",
|
|
4772
5253
|
status: "error",
|
|
4773
|
-
recommendation:
|
|
5254
|
+
recommendation: `Add a 120-160 character meta description that includes your primary keyword${secondaryKeyword ? " (and your secondary keyword if it fits)" : ""}.`
|
|
4774
5255
|
};
|
|
4775
5256
|
}
|
|
4776
5257
|
const len = meta.length;
|
|
4777
|
-
const
|
|
5258
|
+
const kwNote = keywordCoverageNote(meta, primaryKeyword, secondaryKeyword);
|
|
4778
5259
|
if (len < 120) {
|
|
4779
5260
|
return {
|
|
4780
5261
|
label: "Meta Description",
|
|
4781
5262
|
value: `${meta} (${len} chars)`,
|
|
4782
5263
|
status: "warning",
|
|
4783
|
-
recommendation: `
|
|
5264
|
+
recommendation: `A little short - aim for 120-160 characters.${kwNote ? ` ${kwNote}` : ""}`
|
|
4784
5265
|
};
|
|
4785
5266
|
}
|
|
4786
5267
|
if (len > 160) {
|
|
@@ -4788,15 +5269,15 @@ function metaDescriptionAudit(meta, primaryKeyword) {
|
|
|
4788
5269
|
label: "Meta Description",
|
|
4789
5270
|
value: `${meta} (${len} chars)`,
|
|
4790
5271
|
status: "warning",
|
|
4791
|
-
recommendation: `
|
|
5272
|
+
recommendation: `Over 160 characters - Google may shorten it in search, so trim it a little.${kwNote ? ` ${kwNote}` : ""}`
|
|
4792
5273
|
};
|
|
4793
5274
|
}
|
|
4794
|
-
if (
|
|
5275
|
+
if (kwNote) {
|
|
4795
5276
|
return {
|
|
4796
5277
|
label: "Meta Description",
|
|
4797
5278
|
value: `${meta} (${len} chars)`,
|
|
4798
5279
|
status: "warning",
|
|
4799
|
-
recommendation: `Length is good
|
|
5280
|
+
recommendation: `Length is good. ${kwNote}`
|
|
4800
5281
|
};
|
|
4801
5282
|
}
|
|
4802
5283
|
return {
|
|
@@ -4844,88 +5325,6 @@ function titleAudit(title, primaryKeyword) {
|
|
|
4844
5325
|
}
|
|
4845
5326
|
return { label: "Title Tag", value: `${title} (${len} chars)`, status: "good" };
|
|
4846
5327
|
}
|
|
4847
|
-
function urlAudit(slug, primaryKeyword) {
|
|
4848
|
-
if (!slug) {
|
|
4849
|
-
return { label: "URL Slug", value: "Missing", status: "error", recommendation: "Add a clean, hyphenated URL slug containing the primary keyword. Aim for 3-5 words." };
|
|
4850
|
-
}
|
|
4851
|
-
const issues = [];
|
|
4852
|
-
if (slug.length > 60) issues.push("longer than 60 characters - aim for 3-5 words");
|
|
4853
|
-
if (/[A-Z]/.test(slug)) issues.push("contains uppercase letters");
|
|
4854
|
-
if (/_/.test(slug)) issues.push("uses underscores instead of hyphens");
|
|
4855
|
-
if (/[^a-zA-Z0-9-/]/.test(slug.replace(/^\//, ""))) issues.push("contains special characters");
|
|
4856
|
-
if (primaryKeyword && !containsKeywordTokens(slug.replace(/-/g, " "), primaryKeyword)) {
|
|
4857
|
-
issues.push(`missing primary keyword "${primaryKeyword}"`);
|
|
4858
|
-
}
|
|
4859
|
-
if (issues.length === 0) {
|
|
4860
|
-
return { label: "URL Slug", value: `/${slug}`, status: "good" };
|
|
4861
|
-
}
|
|
4862
|
-
return {
|
|
4863
|
-
label: "URL Slug",
|
|
4864
|
-
value: `/${slug}`,
|
|
4865
|
-
status: "warning",
|
|
4866
|
-
recommendation: `Issues: ${issues.join(", ")}.`
|
|
4867
|
-
};
|
|
4868
|
-
}
|
|
4869
|
-
function SlugRedirectNotice() {
|
|
4870
|
-
const [expanded, setExpanded] = useState15(false);
|
|
4871
|
-
return /* @__PURE__ */ jsx13(
|
|
4872
|
-
"div",
|
|
4873
|
-
{
|
|
4874
|
-
style: {
|
|
4875
|
-
marginTop: 10,
|
|
4876
|
-
paddingTop: 10,
|
|
4877
|
-
borderTop: "1px solid rgba(0,0,0,0.07)"
|
|
4878
|
-
},
|
|
4879
|
-
children: /* @__PURE__ */ jsxs12(
|
|
4880
|
-
"div",
|
|
4881
|
-
{
|
|
4882
|
-
style: {
|
|
4883
|
-
padding: "8px 10px",
|
|
4884
|
-
background: "rgba(245,158,11,0.08)",
|
|
4885
|
-
borderLeft: "2px solid #f59e0b",
|
|
4886
|
-
borderRadius: 6
|
|
4887
|
-
},
|
|
4888
|
-
children: [
|
|
4889
|
-
/* @__PURE__ */ jsxs12("div", { style: { display: "flex", alignItems: "center", gap: 6, marginBottom: 4 }, children: [
|
|
4890
|
-
/* @__PURE__ */ jsx13("svg", { width: "12", height: "12", viewBox: "0 0 20 20", fill: "#f59e0b", "aria-hidden": "true", children: /* @__PURE__ */ jsx13("path", { fillRule: "evenodd", d: "M8.485 2.495c.673-1.167 2.357-1.167 3.03 0l6.28 10.875c.673 1.167-.17 2.625-1.516 2.625H3.72c-1.347 0-2.189-1.458-1.515-2.625L8.485 2.495zM10 5a.75.75 0 01.75.75v3.5a.75.75 0 01-1.5 0v-3.5A.75.75 0 0110 5zm0 9a1 1 0 100-2 1 1 0 000 2z", clipRule: "evenodd" }) }),
|
|
4891
|
-
/* @__PURE__ */ jsx13("span", { style: { fontSize: 10.5, fontWeight: 700, color: "#b45309", textTransform: "uppercase", letterSpacing: "0.06em" }, children: "Changing a URL?" })
|
|
4892
|
-
] }),
|
|
4893
|
-
/* @__PURE__ */ jsx13("div", { style: { fontSize: 11, color: "#1f2937", lineHeight: 1.55 }, children: "If the page has been published and indexed, you MUST add a 301 redirect from the old slug to the new one before changing it. For a brand-new page that's never been published, no redirect needed." }),
|
|
4894
|
-
/* @__PURE__ */ jsxs12(
|
|
4895
|
-
"button",
|
|
4896
|
-
{
|
|
4897
|
-
onClick: () => setExpanded((v) => !v),
|
|
4898
|
-
style: {
|
|
4899
|
-
display: "flex",
|
|
4900
|
-
alignItems: "center",
|
|
4901
|
-
gap: 3,
|
|
4902
|
-
marginTop: 6,
|
|
4903
|
-
padding: 0,
|
|
4904
|
-
background: "none",
|
|
4905
|
-
border: "none",
|
|
4906
|
-
cursor: "pointer",
|
|
4907
|
-
fontSize: 10.5,
|
|
4908
|
-
fontWeight: 700,
|
|
4909
|
-
color: "#b45309",
|
|
4910
|
-
fontFamily: "inherit"
|
|
4911
|
-
},
|
|
4912
|
-
children: [
|
|
4913
|
-
expanded ? "Show less" : "Learn more",
|
|
4914
|
-
/* @__PURE__ */ jsx13("svg", { width: "10", height: "10", viewBox: "0 0 20 20", fill: "currentColor", style: { transform: expanded ? "rotate(180deg)" : "none", transition: "transform 150ms" }, children: /* @__PURE__ */ jsx13("path", { fillRule: "evenodd", d: "M5.23 7.21a.75.75 0 011.06.02L10 11.168l3.71-3.938a.75.75 0 111.08 1.04l-4.25 4.5a.75.75 0 01-1.08 0l-4.25-4.5a.75.75 0 01.02-1.06z", clipRule: "evenodd" }) })
|
|
4915
|
-
]
|
|
4916
|
-
}
|
|
4917
|
-
),
|
|
4918
|
-
expanded && /* @__PURE__ */ jsxs12("ul", { style: { margin: "6px 0 0", paddingLeft: 16, fontSize: 11, color: "#1f2937", lineHeight: 1.55 }, children: [
|
|
4919
|
-
/* @__PURE__ */ jsx13("li", { children: "Without the 301, the page loses every search ranking and every external link to it breaks." }),
|
|
4920
|
-
/* @__PURE__ */ jsx13("li", { children: "A 301 preserves the rankings and link equity built up on the old URL." }),
|
|
4921
|
-
/* @__PURE__ */ jsx13("li", { children: "Set this up using vanity redirects in Sanity." })
|
|
4922
|
-
] })
|
|
4923
|
-
]
|
|
4924
|
-
}
|
|
4925
|
-
)
|
|
4926
|
-
}
|
|
4927
|
-
);
|
|
4928
|
-
}
|
|
4929
5328
|
function daysSince(iso) {
|
|
4930
5329
|
if (!iso) return null;
|
|
4931
5330
|
const t = new Date(iso).getTime();
|
|
@@ -4938,14 +5337,13 @@ function formatDateShort(iso) {
|
|
|
4938
5337
|
if (isNaN(d.getTime())) return "";
|
|
4939
5338
|
return d.toLocaleDateString(void 0, { year: "numeric", month: "short", day: "numeric" });
|
|
4940
5339
|
}
|
|
4941
|
-
function MetaTab({ documentFields, primaryKeyword, isLoading }) {
|
|
5340
|
+
function MetaTab({ documentFields, primaryKeyword, secondaryKeyword, isLoading }) {
|
|
4942
5341
|
const audits = useMemo3(() => {
|
|
4943
5342
|
const list = [];
|
|
4944
5343
|
list.push(titleAudit(documentFields?.title, primaryKeyword));
|
|
4945
|
-
list.push(metaDescriptionAudit(documentFields?.metaDescription, primaryKeyword));
|
|
4946
|
-
list.push(urlAudit(documentFields?.slug, primaryKeyword));
|
|
5344
|
+
list.push(metaDescriptionAudit(documentFields?.metaDescription, primaryKeyword, secondaryKeyword));
|
|
4947
5345
|
return list;
|
|
4948
|
-
}, [documentFields, primaryKeyword]);
|
|
5346
|
+
}, [documentFields, primaryKeyword, secondaryKeyword]);
|
|
4949
5347
|
const eeatItems = useMemo3(() => {
|
|
4950
5348
|
const items = [];
|
|
4951
5349
|
const author = documentFields?.authorName;
|
|
@@ -4990,33 +5388,32 @@ function MetaTab({ documentFields, primaryKeyword, isLoading }) {
|
|
|
4990
5388
|
}, [documentFields]);
|
|
4991
5389
|
const hasAnyField = !!documentFields && (documentFields.title !== void 0 || documentFields.metaDescription !== void 0 || documentFields.slug !== void 0);
|
|
4992
5390
|
if (isLoading && !hasAnyField) {
|
|
4993
|
-
return /* @__PURE__ */
|
|
4994
|
-
/* @__PURE__ */
|
|
4995
|
-
/* @__PURE__ */
|
|
5391
|
+
return /* @__PURE__ */ jsxs13("div", { style: { padding: 24, textAlign: "center" }, children: [
|
|
5392
|
+
/* @__PURE__ */ jsx14("div", { style: { fontSize: 13, color: "#4b5563", fontWeight: 500 }, children: "Reading document fields..." }),
|
|
5393
|
+
/* @__PURE__ */ jsx14("div", { style: { fontSize: 11, color: "#4b5563", marginTop: 4 }, children: "Audit will run once content loads" })
|
|
4996
5394
|
] });
|
|
4997
5395
|
}
|
|
4998
|
-
const auditAnchors = ["anchor-meta-title", "anchor-meta-description"
|
|
4999
|
-
return /* @__PURE__ */
|
|
5000
|
-
audits.map((a, i) => /* @__PURE__ */
|
|
5396
|
+
const auditAnchors = ["anchor-meta-title", "anchor-meta-description"];
|
|
5397
|
+
return /* @__PURE__ */ jsxs13("div", { style: { padding: 12, display: "flex", flexDirection: "column", gap: 10 }, children: [
|
|
5398
|
+
audits.map((a, i) => /* @__PURE__ */ jsx14(
|
|
5001
5399
|
AuditCard,
|
|
5002
5400
|
{
|
|
5003
5401
|
anchorId: auditAnchors[i],
|
|
5004
5402
|
label: a.label,
|
|
5005
5403
|
value: a.value,
|
|
5006
5404
|
status: a.status,
|
|
5007
|
-
recommendation: a.recommendation
|
|
5008
|
-
footer: a.label === "URL Slug" ? /* @__PURE__ */ jsx13(SlugRedirectNotice, {}) : void 0
|
|
5405
|
+
recommendation: a.recommendation
|
|
5009
5406
|
},
|
|
5010
5407
|
i
|
|
5011
5408
|
)),
|
|
5012
|
-
eeatItems.length > 0 && /* @__PURE__ */
|
|
5013
|
-
/* @__PURE__ */
|
|
5014
|
-
/* @__PURE__ */
|
|
5015
|
-
/* @__PURE__ */
|
|
5016
|
-
/* @__PURE__ */
|
|
5409
|
+
eeatItems.length > 0 && /* @__PURE__ */ jsxs13(Fragment7, { children: [
|
|
5410
|
+
/* @__PURE__ */ jsxs13("div", { style: { display: "flex", alignItems: "center", gap: 8, margin: "6px 4px 0" }, children: [
|
|
5411
|
+
/* @__PURE__ */ jsx14("div", { style: { height: 1, flex: 1, background: "rgba(0,0,0,0.06)" } }),
|
|
5412
|
+
/* @__PURE__ */ jsx14("span", { style: { fontSize: 10, fontWeight: 700, color: "#4b5563", textTransform: "uppercase", letterSpacing: "0.08em" }, children: "Author & Freshness" }),
|
|
5413
|
+
/* @__PURE__ */ jsx14("div", { style: { height: 1, flex: 1, background: "rgba(0,0,0,0.06)" } })
|
|
5017
5414
|
] }),
|
|
5018
|
-
/* @__PURE__ */
|
|
5019
|
-
eeatItems.map((item, i) => /* @__PURE__ */
|
|
5415
|
+
/* @__PURE__ */ jsx14("div", { style: { fontSize: 10, color: "#4b5563", padding: "0 4px", marginTop: -4 }, children: "Google looks for a named author with credentials and recent updates on healthcare content." }),
|
|
5416
|
+
eeatItems.map((item, i) => /* @__PURE__ */ jsx14(
|
|
5020
5417
|
AuditCard,
|
|
5021
5418
|
{
|
|
5022
5419
|
label: item.label,
|
|
@@ -5031,8 +5428,86 @@ function MetaTab({ documentFields, primaryKeyword, isLoading }) {
|
|
|
5031
5428
|
}
|
|
5032
5429
|
|
|
5033
5430
|
// src/components/tabs/TechnicalTab.tsx
|
|
5034
|
-
import { useMemo as useMemo4 } from "react";
|
|
5035
|
-
import { Fragment as
|
|
5431
|
+
import { useMemo as useMemo4, useState as useState15 } from "react";
|
|
5432
|
+
import { Fragment as Fragment8, jsx as jsx15, jsxs as jsxs14 } from "react/jsx-runtime";
|
|
5433
|
+
function containsKeywordTokens2(haystack, needle) {
|
|
5434
|
+
if (!needle) return true;
|
|
5435
|
+
const tokens = needle.toLowerCase().split(/\s+/).filter((t) => t.length > 1);
|
|
5436
|
+
if (tokens.length === 0) return true;
|
|
5437
|
+
const lower = haystack.toLowerCase();
|
|
5438
|
+
return tokens.every((t) => lower.includes(t));
|
|
5439
|
+
}
|
|
5440
|
+
function keywordLeadsUrl(slug, primaryKeyword) {
|
|
5441
|
+
if (!primaryKeyword) return true;
|
|
5442
|
+
const slugWords = slug.toLowerCase().replace(/[^a-z0-9]+/g, " ").trim().split(/\s+/).filter(Boolean);
|
|
5443
|
+
const tokens = primaryKeyword.toLowerCase().split(/\s+/).filter((t) => t.length > 1);
|
|
5444
|
+
if (tokens.length === 0 || slugWords.length === 0) return true;
|
|
5445
|
+
let earliest = Infinity;
|
|
5446
|
+
for (const t of tokens) {
|
|
5447
|
+
const idx = slugWords.findIndex((w) => w.includes(t));
|
|
5448
|
+
if (idx >= 0) earliest = Math.min(earliest, idx);
|
|
5449
|
+
}
|
|
5450
|
+
return earliest <= 2;
|
|
5451
|
+
}
|
|
5452
|
+
function urlAudit(slug, primaryKeyword, secondaryKeyword) {
|
|
5453
|
+
const SHORT_DESC = "Keep the URL short and descriptive - concise URLs are easier to read - and avoid trailing, duplicate, or excessive spaces.";
|
|
5454
|
+
if (!slug) {
|
|
5455
|
+
return {
|
|
5456
|
+
label: "URL Slug",
|
|
5457
|
+
value: "Missing",
|
|
5458
|
+
status: "warning",
|
|
5459
|
+
recommendation: `Add a URL slug that leads with your primary keyword. ${SHORT_DESC}`
|
|
5460
|
+
};
|
|
5461
|
+
}
|
|
5462
|
+
const slugAsWords = slug.replace(/-/g, " ");
|
|
5463
|
+
const hasPrimary = primaryKeyword ? containsKeywordTokens2(slugAsWords, primaryKeyword) : true;
|
|
5464
|
+
const leads = primaryKeyword ? keywordLeadsUrl(slug, primaryKeyword) : true;
|
|
5465
|
+
const hasSecondary = secondaryKeyword ? containsKeywordTokens2(slugAsWords, secondaryKeyword) : true;
|
|
5466
|
+
if (primaryKeyword && !hasPrimary) {
|
|
5467
|
+
const secNote = secondaryKeyword && !hasSecondary ? ` Your secondary keyword "${secondaryKeyword}" could follow it.` : "";
|
|
5468
|
+
return {
|
|
5469
|
+
label: "URL Slug",
|
|
5470
|
+
value: `/${slug}`,
|
|
5471
|
+
status: "warning",
|
|
5472
|
+
recommendation: `Work your primary keyword "${primaryKeyword}" into the URL, ideally at the start - if the address gets shortened, a leading keyword still shows.${secNote} ${SHORT_DESC}`
|
|
5473
|
+
};
|
|
5474
|
+
}
|
|
5475
|
+
if (primaryKeyword && hasPrimary && !leads) {
|
|
5476
|
+
return {
|
|
5477
|
+
label: "URL Slug",
|
|
5478
|
+
value: `/${slug}`,
|
|
5479
|
+
status: "warning",
|
|
5480
|
+
recommendation: `Your primary keyword is in the URL but not at the start. Leading with it reads better and holds up if the address gets shortened. ${SHORT_DESC}`
|
|
5481
|
+
};
|
|
5482
|
+
}
|
|
5483
|
+
return { label: "URL Slug", value: `/${slug}`, status: "good" };
|
|
5484
|
+
}
|
|
5485
|
+
function SlugRedirectNotice() {
|
|
5486
|
+
const [expanded, setExpanded] = useState15(false);
|
|
5487
|
+
return /* @__PURE__ */ jsx15("div", { style: { marginTop: 10, paddingTop: 10, borderTop: "1px solid rgba(0,0,0,0.07)" }, children: /* @__PURE__ */ jsxs14("div", { style: { padding: "8px 10px", background: "rgba(245,158,11,0.08)", borderLeft: "2px solid #f59e0b", borderRadius: 6 }, children: [
|
|
5488
|
+
/* @__PURE__ */ jsxs14("div", { style: { display: "flex", alignItems: "center", gap: 6, marginBottom: 4 }, children: [
|
|
5489
|
+
/* @__PURE__ */ jsx15("svg", { width: "12", height: "12", viewBox: "0 0 20 20", fill: "#f59e0b", "aria-hidden": "true", children: /* @__PURE__ */ jsx15("path", { fillRule: "evenodd", d: "M8.485 2.495c.673-1.167 2.357-1.167 3.03 0l6.28 10.875c.673 1.167-.17 2.625-1.516 2.625H3.72c-1.347 0-2.189-1.458-1.515-2.625L8.485 2.495zM10 5a.75.75 0 01.75.75v3.5a.75.75 0 01-1.5 0v-3.5A.75.75 0 0110 5zm0 9a1 1 0 100-2 1 1 0 000 2z", clipRule: "evenodd" }) }),
|
|
5490
|
+
/* @__PURE__ */ jsx15("span", { style: { fontSize: 10.5, fontWeight: 700, color: "#b45309", textTransform: "uppercase", letterSpacing: "0.06em" }, children: "Changing a URL?" })
|
|
5491
|
+
] }),
|
|
5492
|
+
/* @__PURE__ */ jsx15("div", { style: { fontSize: 11, color: "#1f2937", lineHeight: 1.55 }, children: "If the page has been published and indexed, you MUST add a 301 redirect from the old slug to the new one before changing it. For a brand-new page that's never been published, no redirect needed." }),
|
|
5493
|
+
/* @__PURE__ */ jsxs14(
|
|
5494
|
+
"button",
|
|
5495
|
+
{
|
|
5496
|
+
onClick: () => setExpanded((v) => !v),
|
|
5497
|
+
style: { display: "flex", alignItems: "center", gap: 3, marginTop: 6, padding: 0, background: "none", border: "none", cursor: "pointer", fontSize: 10.5, fontWeight: 700, color: "#b45309", fontFamily: "inherit" },
|
|
5498
|
+
children: [
|
|
5499
|
+
expanded ? "Show less" : "Learn more",
|
|
5500
|
+
/* @__PURE__ */ jsx15("svg", { width: "10", height: "10", viewBox: "0 0 20 20", fill: "currentColor", style: { transform: expanded ? "rotate(180deg)" : "none", transition: "transform 150ms" }, children: /* @__PURE__ */ jsx15("path", { fillRule: "evenodd", d: "M5.23 7.21a.75.75 0 011.06.02L10 11.168l3.71-3.938a.75.75 0 111.08 1.04l-4.25 4.5a.75.75 0 01-1.08 0l-4.25-4.5a.75.75 0 01.02-1.06z", clipRule: "evenodd" }) })
|
|
5501
|
+
]
|
|
5502
|
+
}
|
|
5503
|
+
),
|
|
5504
|
+
expanded && /* @__PURE__ */ jsxs14("ul", { style: { margin: "6px 0 0", paddingLeft: 16, fontSize: 11, color: "#1f2937", lineHeight: 1.55 }, children: [
|
|
5505
|
+
/* @__PURE__ */ jsx15("li", { children: "Without the 301, the page loses every search ranking and every external link to it breaks." }),
|
|
5506
|
+
/* @__PURE__ */ jsx15("li", { children: "A 301 preserves the rankings and link equity built up on the old URL." }),
|
|
5507
|
+
/* @__PURE__ */ jsx15("li", { children: "Set this up using vanity redirects in Sanity." })
|
|
5508
|
+
] })
|
|
5509
|
+
] }) });
|
|
5510
|
+
}
|
|
5036
5511
|
var cardStyle6 = {
|
|
5037
5512
|
borderRadius: 14,
|
|
5038
5513
|
background: "rgba(255,255,255,0.55)",
|
|
@@ -5048,7 +5523,7 @@ function StatusBadge2({ status }) {
|
|
|
5048
5523
|
error: { bg: "rgba(220,38,38,0.1)", color: "#dc2626", label: "Fix" }
|
|
5049
5524
|
};
|
|
5050
5525
|
const c = map[status];
|
|
5051
|
-
return /* @__PURE__ */
|
|
5526
|
+
return /* @__PURE__ */ jsx15(
|
|
5052
5527
|
"span",
|
|
5053
5528
|
{
|
|
5054
5529
|
style: {
|
|
@@ -5071,14 +5546,15 @@ function AuditCard2({
|
|
|
5071
5546
|
value,
|
|
5072
5547
|
status,
|
|
5073
5548
|
recommendation,
|
|
5074
|
-
anchorId
|
|
5549
|
+
anchorId,
|
|
5550
|
+
footer
|
|
5075
5551
|
}) {
|
|
5076
|
-
return /* @__PURE__ */
|
|
5077
|
-
/* @__PURE__ */
|
|
5078
|
-
/* @__PURE__ */
|
|
5079
|
-
/* @__PURE__ */
|
|
5552
|
+
return /* @__PURE__ */ jsxs14("div", { id: anchorId, style: cardStyle6, children: [
|
|
5553
|
+
/* @__PURE__ */ jsxs14("div", { style: { display: "flex", alignItems: "center", justifyContent: "space-between", gap: 8, marginBottom: 6 }, children: [
|
|
5554
|
+
/* @__PURE__ */ jsx15("span", { style: { fontSize: 10.5, textTransform: "uppercase", letterSpacing: "0.06em", color: "#4b5563", fontWeight: 600 }, children: label }),
|
|
5555
|
+
/* @__PURE__ */ jsx15(StatusBadge2, { status })
|
|
5080
5556
|
] }),
|
|
5081
|
-
/* @__PURE__ */
|
|
5557
|
+
/* @__PURE__ */ jsx15(
|
|
5082
5558
|
"div",
|
|
5083
5559
|
{
|
|
5084
5560
|
style: {
|
|
@@ -5091,7 +5567,7 @@ function AuditCard2({
|
|
|
5091
5567
|
children: value
|
|
5092
5568
|
}
|
|
5093
5569
|
),
|
|
5094
|
-
recommendation && /* @__PURE__ */
|
|
5570
|
+
recommendation && /* @__PURE__ */ jsx15(
|
|
5095
5571
|
"div",
|
|
5096
5572
|
{
|
|
5097
5573
|
style: {
|
|
@@ -5106,7 +5582,8 @@ function AuditCard2({
|
|
|
5106
5582
|
},
|
|
5107
5583
|
children: recommendation
|
|
5108
5584
|
}
|
|
5109
|
-
)
|
|
5585
|
+
),
|
|
5586
|
+
footer
|
|
5110
5587
|
] });
|
|
5111
5588
|
}
|
|
5112
5589
|
var IMAGE_EXT_RE = /\.(jpe?g|png|gif|webp|svg|tiff?|bmp)$/i;
|
|
@@ -5324,10 +5801,10 @@ function LinkCheckCard({
|
|
|
5324
5801
|
const issues = results.filter((r) => r.category !== "ok");
|
|
5325
5802
|
return { total, valid, redirects, broken, errored, unverified, issues };
|
|
5326
5803
|
}, [results]);
|
|
5327
|
-
return /* @__PURE__ */
|
|
5328
|
-
/* @__PURE__ */
|
|
5329
|
-
/* @__PURE__ */
|
|
5330
|
-
hasRun && !isLoading && /* @__PURE__ */
|
|
5804
|
+
return /* @__PURE__ */ jsxs14("div", { id: "anchor-link-check", style: cardStyle6, children: [
|
|
5805
|
+
/* @__PURE__ */ jsxs14("div", { style: { display: "flex", alignItems: "center", justifyContent: "space-between", gap: 8, marginBottom: 6 }, children: [
|
|
5806
|
+
/* @__PURE__ */ jsx15("span", { style: { fontSize: 10.5, textTransform: "uppercase", letterSpacing: "0.06em", color: "#4b5563", fontWeight: 600 }, children: "Link Health" }),
|
|
5807
|
+
hasRun && !isLoading && /* @__PURE__ */ jsx15(
|
|
5331
5808
|
"button",
|
|
5332
5809
|
{
|
|
5333
5810
|
onClick: onCheck,
|
|
@@ -5345,8 +5822,8 @@ function LinkCheckCard({
|
|
|
5345
5822
|
}
|
|
5346
5823
|
)
|
|
5347
5824
|
] }),
|
|
5348
|
-
/* @__PURE__ */
|
|
5349
|
-
urls.length > 0 && !hasRun && !isLoading && /* @__PURE__ */
|
|
5825
|
+
/* @__PURE__ */ jsx15("div", { style: { fontSize: 11, color: "#1f2937", lineHeight: 1.5, marginBottom: 10 }, children: urls.length === 0 ? "No external links found in the body." : `${urls.length} link${urls.length === 1 ? "" : "s"} found in the body.` }),
|
|
5826
|
+
urls.length > 0 && !hasRun && !isLoading && /* @__PURE__ */ jsxs14(
|
|
5350
5827
|
"button",
|
|
5351
5828
|
{
|
|
5352
5829
|
onClick: onCheck,
|
|
@@ -5371,9 +5848,9 @@ function LinkCheckCard({
|
|
|
5371
5848
|
]
|
|
5372
5849
|
}
|
|
5373
5850
|
),
|
|
5374
|
-
isLoading && /* @__PURE__ */
|
|
5375
|
-
/* @__PURE__ */
|
|
5376
|
-
/* @__PURE__ */
|
|
5851
|
+
isLoading && /* @__PURE__ */ jsxs14("div", { style: { display: "flex", alignItems: "center", justifyContent: "center", gap: 8, padding: "16px 0" }, children: [
|
|
5852
|
+
/* @__PURE__ */ jsx15(LoadingBars, { size: "xs", color: MJH_BLUE }),
|
|
5853
|
+
/* @__PURE__ */ jsxs14("span", { style: { fontSize: 11, color: "#4b5563" }, children: [
|
|
5377
5854
|
"Checking ",
|
|
5378
5855
|
urls.length,
|
|
5379
5856
|
" link",
|
|
@@ -5381,7 +5858,7 @@ function LinkCheckCard({
|
|
|
5381
5858
|
"..."
|
|
5382
5859
|
] })
|
|
5383
5860
|
] }),
|
|
5384
|
-
error && !isLoading && /* @__PURE__ */
|
|
5861
|
+
error && !isLoading && /* @__PURE__ */ jsxs14(
|
|
5385
5862
|
"div",
|
|
5386
5863
|
{
|
|
5387
5864
|
style: {
|
|
@@ -5395,7 +5872,7 @@ function LinkCheckCard({
|
|
|
5395
5872
|
},
|
|
5396
5873
|
children: [
|
|
5397
5874
|
error,
|
|
5398
|
-
/* @__PURE__ */
|
|
5875
|
+
/* @__PURE__ */ jsx15(
|
|
5399
5876
|
"button",
|
|
5400
5877
|
{
|
|
5401
5878
|
onClick: onCheck,
|
|
@@ -5417,15 +5894,15 @@ function LinkCheckCard({
|
|
|
5417
5894
|
]
|
|
5418
5895
|
}
|
|
5419
5896
|
),
|
|
5420
|
-
hasRun && !isLoading && !error && /* @__PURE__ */
|
|
5421
|
-
/* @__PURE__ */
|
|
5422
|
-
/* @__PURE__ */
|
|
5423
|
-
/* @__PURE__ */
|
|
5424
|
-
/* @__PURE__ */
|
|
5425
|
-
/* @__PURE__ */
|
|
5426
|
-
counts.unverified > 0 && /* @__PURE__ */
|
|
5897
|
+
hasRun && !isLoading && !error && /* @__PURE__ */ jsxs14(Fragment8, { children: [
|
|
5898
|
+
/* @__PURE__ */ jsxs14("div", { style: { display: "grid", gridTemplateColumns: counts.unverified > 0 ? "repeat(5, 1fr)" : "repeat(4, 1fr)", gap: 6 }, children: [
|
|
5899
|
+
/* @__PURE__ */ jsx15(StatTile, { label: "Checked", value: counts.total, color: "#475569" }),
|
|
5900
|
+
/* @__PURE__ */ jsx15(StatTile, { label: "Valid", value: counts.valid, color: "#16a34a" }),
|
|
5901
|
+
/* @__PURE__ */ jsx15(StatTile, { label: "Redirects", value: counts.redirects, color: "#8B7310" }),
|
|
5902
|
+
/* @__PURE__ */ jsx15(StatTile, { label: "Broken", value: counts.broken + counts.errored, color: "#dc2626" }),
|
|
5903
|
+
counts.unverified > 0 && /* @__PURE__ */ jsx15(StatTile, { label: "Blocked", value: counts.unverified, color: "#b45309" })
|
|
5427
5904
|
] }),
|
|
5428
|
-
counts.unverified > 0 && /* @__PURE__ */
|
|
5905
|
+
counts.unverified > 0 && /* @__PURE__ */ jsxs14(
|
|
5429
5906
|
"div",
|
|
5430
5907
|
{
|
|
5431
5908
|
style: {
|
|
@@ -5446,8 +5923,8 @@ function LinkCheckCard({
|
|
|
5446
5923
|
]
|
|
5447
5924
|
}
|
|
5448
5925
|
),
|
|
5449
|
-
counts.issues.length > 0 ? /* @__PURE__ */
|
|
5450
|
-
/* @__PURE__ */
|
|
5926
|
+
counts.issues.length > 0 ? /* @__PURE__ */ jsxs14("div", { style: { marginTop: 12, display: "flex", flexDirection: "column", gap: 6 }, children: [
|
|
5927
|
+
/* @__PURE__ */ jsxs14("div", { style: { fontSize: 10, fontWeight: 700, color: "#4b5563", textTransform: "uppercase", letterSpacing: "0.06em" }, children: [
|
|
5451
5928
|
counts.issues.length,
|
|
5452
5929
|
" link",
|
|
5453
5930
|
counts.issues.length === 1 ? "" : "s",
|
|
@@ -5455,8 +5932,8 @@ function LinkCheckCard({
|
|
|
5455
5932
|
counts.issues.length === 1 ? "s" : "",
|
|
5456
5933
|
" attention"
|
|
5457
5934
|
] }),
|
|
5458
|
-
counts.issues.map((r) => /* @__PURE__ */
|
|
5459
|
-
] }) : /* @__PURE__ */
|
|
5935
|
+
counts.issues.map((r) => /* @__PURE__ */ jsx15(LinkIssueRow, { result: r }, r.url))
|
|
5936
|
+
] }) : /* @__PURE__ */ jsxs14(
|
|
5460
5937
|
"div",
|
|
5461
5938
|
{
|
|
5462
5939
|
style: {
|
|
@@ -5483,7 +5960,7 @@ function LinkCheckCard({
|
|
|
5483
5960
|
] });
|
|
5484
5961
|
}
|
|
5485
5962
|
function StatTile({ label, value, color }) {
|
|
5486
|
-
return /* @__PURE__ */
|
|
5963
|
+
return /* @__PURE__ */ jsxs14(
|
|
5487
5964
|
"div",
|
|
5488
5965
|
{
|
|
5489
5966
|
style: {
|
|
@@ -5493,8 +5970,8 @@ function StatTile({ label, value, color }) {
|
|
|
5493
5970
|
textAlign: "center"
|
|
5494
5971
|
},
|
|
5495
5972
|
children: [
|
|
5496
|
-
/* @__PURE__ */
|
|
5497
|
-
/* @__PURE__ */
|
|
5973
|
+
/* @__PURE__ */ jsx15("div", { style: { fontSize: 18, fontWeight: 700, color, fontVariantNumeric: "tabular-nums", lineHeight: 1 }, children: value }),
|
|
5974
|
+
/* @__PURE__ */ jsx15("div", { style: { fontSize: 9, fontWeight: 700, color: "#4b5563", textTransform: "uppercase", letterSpacing: "0.06em", marginTop: 4 }, children: label })
|
|
5498
5975
|
]
|
|
5499
5976
|
}
|
|
5500
5977
|
);
|
|
@@ -5510,7 +5987,7 @@ function LinkIssueRow({ result }) {
|
|
|
5510
5987
|
};
|
|
5511
5988
|
const c = map[result.category];
|
|
5512
5989
|
const tooltip = result.category === "unverified" ? `${result.url} (couldn't auto-check; likely anti-bot blocking - open manually to verify)` : result.error ? `${result.url} (${result.error})` : result.url;
|
|
5513
|
-
return /* @__PURE__ */
|
|
5990
|
+
return /* @__PURE__ */ jsxs14(
|
|
5514
5991
|
"a",
|
|
5515
5992
|
{
|
|
5516
5993
|
href: result.url,
|
|
@@ -5526,7 +6003,7 @@ function LinkIssueRow({ result }) {
|
|
|
5526
6003
|
textDecoration: "none"
|
|
5527
6004
|
},
|
|
5528
6005
|
children: [
|
|
5529
|
-
/* @__PURE__ */
|
|
6006
|
+
/* @__PURE__ */ jsx15(
|
|
5530
6007
|
"span",
|
|
5531
6008
|
{
|
|
5532
6009
|
style: {
|
|
@@ -5543,7 +6020,7 @@ function LinkIssueRow({ result }) {
|
|
|
5543
6020
|
children: c.label
|
|
5544
6021
|
}
|
|
5545
6022
|
),
|
|
5546
|
-
/* @__PURE__ */
|
|
6023
|
+
/* @__PURE__ */ jsx15(
|
|
5547
6024
|
"span",
|
|
5548
6025
|
{
|
|
5549
6026
|
style: {
|
|
@@ -5567,6 +6044,8 @@ function LinkIssueRow({ result }) {
|
|
|
5567
6044
|
function TechnicalTab({
|
|
5568
6045
|
text,
|
|
5569
6046
|
documentFields,
|
|
6047
|
+
primaryKeyword,
|
|
6048
|
+
secondaryKeyword,
|
|
5570
6049
|
isLoading,
|
|
5571
6050
|
linkCheckResults,
|
|
5572
6051
|
isLinkCheckLoading,
|
|
@@ -5574,6 +6053,10 @@ function TechnicalTab({
|
|
|
5574
6053
|
hasRunLinkCheck,
|
|
5575
6054
|
onCheckLinks
|
|
5576
6055
|
}) {
|
|
6056
|
+
const urlSlugAudit = useMemo4(
|
|
6057
|
+
() => urlAudit(documentFields?.slug, primaryKeyword, secondaryKeyword),
|
|
6058
|
+
[documentFields?.slug, primaryKeyword, secondaryKeyword]
|
|
6059
|
+
);
|
|
5577
6060
|
const headings = documentFields?.headings || [];
|
|
5578
6061
|
const headingsDetailed = documentFields?.headingsDetailed;
|
|
5579
6062
|
const headingsForStructure = headingsDetailed ? headingsDetailed : headings.map((text2) => ({ text: text2, level: 2 }));
|
|
@@ -5608,7 +6091,8 @@ function TechnicalTab({
|
|
|
5608
6091
|
status: "warning",
|
|
5609
6092
|
recommendation: "Add at least one hero image with descriptive alt text. Articles with images perform better on both reader engagement and search."
|
|
5610
6093
|
} : null;
|
|
5611
|
-
const
|
|
6094
|
+
const isShortForm = isShortFormContent(documentFields, documentFields?.title);
|
|
6095
|
+
const wordAudit = wordCount2 === 0 ? null : isShortForm ? { label: "Word Count", value: `${wordCount2} words`, status: "good" } : wordCount2 < 450 ? {
|
|
5612
6096
|
label: "Word Count",
|
|
5613
6097
|
value: `${wordCount2} words`,
|
|
5614
6098
|
status: "error",
|
|
@@ -5622,13 +6106,24 @@ function TechnicalTab({
|
|
|
5622
6106
|
const bodyLinks = documentFields?.bodyLinks || [];
|
|
5623
6107
|
const hasAnyField = !!documentFields && (documentFields.title !== void 0 || documentFields.headings && documentFields.headings.length > 0 || documentFields.imageNames && documentFields.imageNames.length > 0 || wordCount2 > 0);
|
|
5624
6108
|
if (isLoading && !hasAnyField) {
|
|
5625
|
-
return /* @__PURE__ */
|
|
5626
|
-
/* @__PURE__ */
|
|
5627
|
-
/* @__PURE__ */
|
|
6109
|
+
return /* @__PURE__ */ jsxs14("div", { style: { padding: 24, textAlign: "center" }, children: [
|
|
6110
|
+
/* @__PURE__ */ jsx15("div", { style: { fontSize: 13, color: "#4b5563", fontWeight: 500 }, children: "Reading document fields..." }),
|
|
6111
|
+
/* @__PURE__ */ jsx15("div", { style: { fontSize: 11, color: "#4b5563", marginTop: 4 }, children: "Audit will run once content loads" })
|
|
5628
6112
|
] });
|
|
5629
6113
|
}
|
|
5630
|
-
return /* @__PURE__ */
|
|
5631
|
-
|
|
6114
|
+
return /* @__PURE__ */ jsxs14("div", { style: { padding: 12, display: "flex", flexDirection: "column", gap: 10 }, children: [
|
|
6115
|
+
/* @__PURE__ */ jsx15(
|
|
6116
|
+
AuditCard2,
|
|
6117
|
+
{
|
|
6118
|
+
anchorId: "anchor-url-slug",
|
|
6119
|
+
label: urlSlugAudit.label,
|
|
6120
|
+
value: urlSlugAudit.value,
|
|
6121
|
+
status: urlSlugAudit.status,
|
|
6122
|
+
recommendation: urlSlugAudit.recommendation,
|
|
6123
|
+
footer: /* @__PURE__ */ jsx15(SlugRedirectNotice, {})
|
|
6124
|
+
}
|
|
6125
|
+
),
|
|
6126
|
+
wordAudit && /* @__PURE__ */ jsx15(
|
|
5632
6127
|
AuditCard2,
|
|
5633
6128
|
{
|
|
5634
6129
|
anchorId: "anchor-word-count",
|
|
@@ -5638,7 +6133,7 @@ function TechnicalTab({
|
|
|
5638
6133
|
recommendation: wordAudit.recommendation
|
|
5639
6134
|
}
|
|
5640
6135
|
),
|
|
5641
|
-
structureAudits.map((a, i) => /* @__PURE__ */
|
|
6136
|
+
structureAudits.map((a, i) => /* @__PURE__ */ jsx15(
|
|
5642
6137
|
AuditCard2,
|
|
5643
6138
|
{
|
|
5644
6139
|
anchorId: i === 0 ? "anchor-headings-structure" : void 0,
|
|
@@ -5649,10 +6144,10 @@ function TechnicalTab({
|
|
|
5649
6144
|
},
|
|
5650
6145
|
`structure-${i}`
|
|
5651
6146
|
)),
|
|
5652
|
-
headings.length > 0 && /* @__PURE__ */
|
|
5653
|
-
/* @__PURE__ */
|
|
5654
|
-
/* @__PURE__ */
|
|
5655
|
-
(headingsDetailed ? headingsDetailed.slice(0, 12) : headings.slice(0, 12).map((h) => ({ text: h, level: 2 }))).map((h, i) => /* @__PURE__ */
|
|
6147
|
+
headings.length > 0 && /* @__PURE__ */ jsxs14("div", { id: "anchor-headings-outline", style: { ...cardStyle6, padding: "8px 14px" }, children: [
|
|
6148
|
+
/* @__PURE__ */ jsx15("div", { style: { fontSize: 10, color: "#4b5563", textTransform: "uppercase", letterSpacing: "0.06em", fontWeight: 600, marginBottom: 6 }, children: "Heading Outline" }),
|
|
6149
|
+
/* @__PURE__ */ jsxs14("div", { style: { display: "flex", flexDirection: "column", gap: 4 }, children: [
|
|
6150
|
+
(headingsDetailed ? headingsDetailed.slice(0, 12) : headings.slice(0, 12).map((h) => ({ text: h, level: 2 }))).map((h, i) => /* @__PURE__ */ jsxs14(
|
|
5656
6151
|
"div",
|
|
5657
6152
|
{
|
|
5658
6153
|
style: {
|
|
@@ -5663,7 +6158,7 @@ function TechnicalTab({
|
|
|
5663
6158
|
paddingLeft: Math.max(0, (h.level - 2) * 12)
|
|
5664
6159
|
},
|
|
5665
6160
|
children: [
|
|
5666
|
-
/* @__PURE__ */
|
|
6161
|
+
/* @__PURE__ */ jsxs14("span", { style: { fontSize: 9, fontWeight: 700, color: "#4b5563", marginRight: 6 }, children: [
|
|
5667
6162
|
"H",
|
|
5668
6163
|
h.level
|
|
5669
6164
|
] }),
|
|
@@ -5672,14 +6167,14 @@ function TechnicalTab({
|
|
|
5672
6167
|
},
|
|
5673
6168
|
i
|
|
5674
6169
|
)),
|
|
5675
|
-
headings.length > 12 && /* @__PURE__ */
|
|
6170
|
+
headings.length > 12 && /* @__PURE__ */ jsxs14("div", { style: { fontSize: 10, color: "#4b5563" }, children: [
|
|
5676
6171
|
"+ ",
|
|
5677
6172
|
headings.length - 12,
|
|
5678
6173
|
" more"
|
|
5679
6174
|
] })
|
|
5680
6175
|
] })
|
|
5681
6176
|
] }),
|
|
5682
|
-
imagesAudit && /* @__PURE__ */
|
|
6177
|
+
imagesAudit && /* @__PURE__ */ jsx15(
|
|
5683
6178
|
AuditCard2,
|
|
5684
6179
|
{
|
|
5685
6180
|
anchorId: "anchor-images",
|
|
@@ -5689,7 +6184,7 @@ function TechnicalTab({
|
|
|
5689
6184
|
recommendation: imagesAudit.recommendation
|
|
5690
6185
|
}
|
|
5691
6186
|
),
|
|
5692
|
-
filenameAudit && /* @__PURE__ */
|
|
6187
|
+
filenameAudit && /* @__PURE__ */ jsx15(
|
|
5693
6188
|
AuditCard2,
|
|
5694
6189
|
{
|
|
5695
6190
|
anchorId: "anchor-image-filenames",
|
|
@@ -5699,7 +6194,7 @@ function TechnicalTab({
|
|
|
5699
6194
|
recommendation: filenameAudit.recommendation
|
|
5700
6195
|
}
|
|
5701
6196
|
),
|
|
5702
|
-
altTextAudit && /* @__PURE__ */
|
|
6197
|
+
altTextAudit && /* @__PURE__ */ jsx15(
|
|
5703
6198
|
AuditCard2,
|
|
5704
6199
|
{
|
|
5705
6200
|
anchorId: "anchor-image-alt",
|
|
@@ -5709,7 +6204,7 @@ function TechnicalTab({
|
|
|
5709
6204
|
recommendation: altTextAudit.recommendation
|
|
5710
6205
|
}
|
|
5711
6206
|
),
|
|
5712
|
-
imgTitleAudit && /* @__PURE__ */
|
|
6207
|
+
imgTitleAudit && /* @__PURE__ */ jsx15(
|
|
5713
6208
|
AuditCard2,
|
|
5714
6209
|
{
|
|
5715
6210
|
anchorId: "anchor-image-titles",
|
|
@@ -5719,7 +6214,7 @@ function TechnicalTab({
|
|
|
5719
6214
|
recommendation: imgTitleAudit.recommendation
|
|
5720
6215
|
}
|
|
5721
6216
|
),
|
|
5722
|
-
/* @__PURE__ */
|
|
6217
|
+
/* @__PURE__ */ jsx15(
|
|
5723
6218
|
LinkCheckCard,
|
|
5724
6219
|
{
|
|
5725
6220
|
urls: bodyLinks,
|
|
@@ -5734,12 +6229,12 @@ function TechnicalTab({
|
|
|
5734
6229
|
}
|
|
5735
6230
|
|
|
5736
6231
|
// src/components/SEOCopilotPanel.tsx
|
|
5737
|
-
import { Fragment as
|
|
6232
|
+
import { Fragment as Fragment9, jsx as jsx16, jsxs as jsxs15 } from "react/jsx-runtime";
|
|
5738
6233
|
function LogoIcon2() {
|
|
5739
|
-
return /* @__PURE__ */
|
|
5740
|
-
/* @__PURE__ */
|
|
5741
|
-
/* @__PURE__ */
|
|
5742
|
-
/* @__PURE__ */
|
|
6234
|
+
return /* @__PURE__ */ jsxs15("svg", { width: "16", height: "16", viewBox: "0 0 16 16", fill: "none", children: [
|
|
6235
|
+
/* @__PURE__ */ jsx16("rect", { x: "1", y: "3", width: "4", height: "10", rx: "1", fill: MJH_GOLD, opacity: "1" }),
|
|
6236
|
+
/* @__PURE__ */ jsx16("rect", { x: "6", y: "1", width: "4", height: "14", rx: "1", fill: MJH_GOLD, opacity: "0.85" }),
|
|
6237
|
+
/* @__PURE__ */ jsx16("rect", { x: "11", y: "5", width: "4", height: "8", rx: "1", fill: MJH_GOLD, opacity: "0.6" })
|
|
5743
6238
|
] });
|
|
5744
6239
|
}
|
|
5745
6240
|
function PanelContent({
|
|
@@ -5757,8 +6252,12 @@ function PanelContent({
|
|
|
5757
6252
|
docLoading,
|
|
5758
6253
|
documentFields,
|
|
5759
6254
|
documentId,
|
|
6255
|
+
documentType,
|
|
6256
|
+
sanityBaseUrl,
|
|
5760
6257
|
selectedPrimary,
|
|
5761
6258
|
onSelectPrimary,
|
|
6259
|
+
selectedSecondary,
|
|
6260
|
+
onSelectSecondary,
|
|
5762
6261
|
activeTab,
|
|
5763
6262
|
onActiveTabChange,
|
|
5764
6263
|
chatOpen,
|
|
@@ -5776,6 +6275,7 @@ function PanelContent({
|
|
|
5776
6275
|
const isLoading = externalAnalysis.isLoading;
|
|
5777
6276
|
const keywordAnalysisState = externalAnalysis;
|
|
5778
6277
|
const effectivePrimary = selectedPrimary || externalAnalysis.analysis?.primaryKeyword?.term || "";
|
|
6278
|
+
const effectiveSecondary = selectedSecondary || "";
|
|
5779
6279
|
const containerRef = useRef10(null);
|
|
5780
6280
|
const dragging = useRef10(false);
|
|
5781
6281
|
const onMouseDown = useCallback5(() => {
|
|
@@ -5803,6 +6303,68 @@ function PanelContent({
|
|
|
5803
6303
|
};
|
|
5804
6304
|
}, [onSplitPercentChange]);
|
|
5805
6305
|
const headerCursor = isFloating ? "grab" : "default";
|
|
6306
|
+
const onboardSite = publication || "default";
|
|
6307
|
+
const onboardKey = `seo-copilot-onboarded-${onboardSite}`;
|
|
6308
|
+
const onboardSessionKey = `seo-copilot-onboard-shown-${onboardSite}`;
|
|
6309
|
+
const [popupMode, setPopupMode] = useState16("hidden");
|
|
6310
|
+
const [popupClosing, setPopupClosing] = useState16(false);
|
|
6311
|
+
const onboardTimerRef = useRef10(null);
|
|
6312
|
+
useEffect10(() => {
|
|
6313
|
+
let onboarded = false;
|
|
6314
|
+
let shownThisSession = false;
|
|
6315
|
+
try {
|
|
6316
|
+
onboarded = localStorage.getItem(onboardKey) === "1";
|
|
6317
|
+
} catch {
|
|
6318
|
+
}
|
|
6319
|
+
try {
|
|
6320
|
+
shownThisSession = sessionStorage.getItem(onboardSessionKey) === "1";
|
|
6321
|
+
} catch {
|
|
6322
|
+
}
|
|
6323
|
+
if (!onboarded && !shownThisSession) {
|
|
6324
|
+
setPopupMode("auto");
|
|
6325
|
+
try {
|
|
6326
|
+
sessionStorage.setItem(onboardSessionKey, "1");
|
|
6327
|
+
} catch {
|
|
6328
|
+
}
|
|
6329
|
+
onboardTimerRef.current = setTimeout(() => {
|
|
6330
|
+
setPopupClosing(true);
|
|
6331
|
+
setTimeout(() => {
|
|
6332
|
+
setPopupMode("hidden");
|
|
6333
|
+
setPopupClosing(false);
|
|
6334
|
+
}, 180);
|
|
6335
|
+
}, 5e3);
|
|
6336
|
+
}
|
|
6337
|
+
return () => {
|
|
6338
|
+
if (onboardTimerRef.current) clearTimeout(onboardTimerRef.current);
|
|
6339
|
+
};
|
|
6340
|
+
}, [onboardKey, onboardSessionKey]);
|
|
6341
|
+
const markOnboarded = useCallback5(() => {
|
|
6342
|
+
try {
|
|
6343
|
+
localStorage.setItem(onboardKey, "1");
|
|
6344
|
+
} catch {
|
|
6345
|
+
}
|
|
6346
|
+
}, [onboardKey]);
|
|
6347
|
+
const dismissPopup = useCallback5(() => {
|
|
6348
|
+
if (onboardTimerRef.current) clearTimeout(onboardTimerRef.current);
|
|
6349
|
+
markOnboarded();
|
|
6350
|
+
setPopupClosing(true);
|
|
6351
|
+
setTimeout(() => {
|
|
6352
|
+
setPopupMode("hidden");
|
|
6353
|
+
setPopupClosing(false);
|
|
6354
|
+
}, 180);
|
|
6355
|
+
}, [markOnboarded]);
|
|
6356
|
+
const openPopupPersistent = useCallback5(() => {
|
|
6357
|
+
if (onboardTimerRef.current) clearTimeout(onboardTimerRef.current);
|
|
6358
|
+
markOnboarded();
|
|
6359
|
+
setPopupClosing(false);
|
|
6360
|
+
setPopupMode("persistent");
|
|
6361
|
+
}, [markOnboarded]);
|
|
6362
|
+
const handleTabChange = useCallback5((id) => {
|
|
6363
|
+
markOnboarded();
|
|
6364
|
+
if (onboardTimerRef.current) clearTimeout(onboardTimerRef.current);
|
|
6365
|
+
setPopupMode((m) => m === "hidden" ? m : "hidden");
|
|
6366
|
+
onActiveTabChange(id);
|
|
6367
|
+
}, [markOnboarded, onActiveTabChange]);
|
|
5806
6368
|
const tabDefs = [
|
|
5807
6369
|
{ id: "summary", label: "Summary", isHub: true, loading: summaryOps.isAnyLoading },
|
|
5808
6370
|
{ id: "keywords", label: "Keywords", loading: keywordAnalysisState.isLoading || keywordAnalysisState.isVolumesLoading },
|
|
@@ -5811,7 +6373,7 @@ function PanelContent({
|
|
|
5811
6373
|
{ id: "meta", label: "Meta", beta: true },
|
|
5812
6374
|
{ id: "technical", label: "Other Recs", beta: true, loading: technicalOps.isLinkCheckLoading }
|
|
5813
6375
|
];
|
|
5814
|
-
return /* @__PURE__ */
|
|
6376
|
+
return /* @__PURE__ */ jsxs15(
|
|
5815
6377
|
"div",
|
|
5816
6378
|
{
|
|
5817
6379
|
className: "seo-copilot-panel",
|
|
@@ -5822,11 +6384,13 @@ function PanelContent({
|
|
|
5822
6384
|
// backgroundColor (longhand) so the sheen background-image in INJECTED_CSS isn't reset
|
|
5823
6385
|
backgroundColor: PANEL_BG,
|
|
5824
6386
|
fontFamily: "-apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif",
|
|
5825
|
-
opacity: 1
|
|
6387
|
+
opacity: 1,
|
|
6388
|
+
position: "relative"
|
|
5826
6389
|
},
|
|
5827
6390
|
children: [
|
|
5828
|
-
/* @__PURE__ */
|
|
5829
|
-
/* @__PURE__ */
|
|
6391
|
+
/* @__PURE__ */ jsx16("style", { dangerouslySetInnerHTML: { __html: INJECTED_CSS } }),
|
|
6392
|
+
popupMode !== "hidden" && /* @__PURE__ */ jsx16(OnboardingCard, { onDismiss: dismissPopup, closing: popupClosing }),
|
|
6393
|
+
/* @__PURE__ */ jsxs15(
|
|
5830
6394
|
"div",
|
|
5831
6395
|
{
|
|
5832
6396
|
onMouseDown: isFloating ? onDragStart : void 0,
|
|
@@ -5844,15 +6408,16 @@ function PanelContent({
|
|
|
5844
6408
|
flexShrink: 0
|
|
5845
6409
|
},
|
|
5846
6410
|
children: [
|
|
5847
|
-
/* @__PURE__ */
|
|
5848
|
-
/* @__PURE__ */
|
|
5849
|
-
/* @__PURE__ */
|
|
5850
|
-
/* @__PURE__ */
|
|
5851
|
-
/* @__PURE__ */
|
|
6411
|
+
/* @__PURE__ */ jsxs15("div", { style: { display: "flex", alignItems: "center", gap: 6 }, children: [
|
|
6412
|
+
/* @__PURE__ */ jsx16(LogoIcon2, {}),
|
|
6413
|
+
/* @__PURE__ */ jsxs15("span", { style: { fontWeight: 700, fontSize: 15, letterSpacing: "-0.01em" }, children: [
|
|
6414
|
+
/* @__PURE__ */ jsx16("span", { style: { color: MJH_GOLD }, children: "SEO" }),
|
|
6415
|
+
/* @__PURE__ */ jsx16("span", { style: { color: MJH_SLATE }, children: " copilot" })
|
|
5852
6416
|
] })
|
|
5853
6417
|
] }),
|
|
5854
|
-
/* @__PURE__ */
|
|
5855
|
-
|
|
6418
|
+
/* @__PURE__ */ jsxs15("div", { style: { display: "flex", alignItems: "center", gap: isFloating ? 4 : 6 }, children: [
|
|
6419
|
+
/* @__PURE__ */ jsx16(OnboardingInfoButton, { onClick: openPopupPersistent }),
|
|
6420
|
+
isFloating && onToggleFullscreen && /* @__PURE__ */ jsx16(
|
|
5856
6421
|
"button",
|
|
5857
6422
|
{
|
|
5858
6423
|
onClick: (e) => {
|
|
@@ -5874,16 +6439,16 @@ function PanelContent({
|
|
|
5874
6439
|
fontWeight: 600,
|
|
5875
6440
|
transition: "all 150ms"
|
|
5876
6441
|
},
|
|
5877
|
-
children: isFullscreen ? /* @__PURE__ */
|
|
5878
|
-
/* @__PURE__ */
|
|
6442
|
+
children: isFullscreen ? /* @__PURE__ */ jsxs15(Fragment9, { children: [
|
|
6443
|
+
/* @__PURE__ */ jsx16("svg", { width: "12", height: "12", viewBox: "0 0 20 20", fill: "currentColor", children: /* @__PURE__ */ jsx16("path", { d: "M3.28 2.22a.75.75 0 00-1.06 1.06L5.44 6.5H3.75a.75.75 0 000 1.5h4.5A.75.75 0 009 7.25v-4.5a.75.75 0 00-1.5 0v1.69L4.28 1.22a.75.75 0 00-1 1zM16.72 17.78a.75.75 0 001.06-1.06L14.56 13.5h1.69a.75.75 0 000-1.5h-4.5a.75.75 0 00-.75.75v4.5a.75.75 0 001.5 0v-1.69l3.22 3.22z" }) }),
|
|
5879
6444
|
"Exit fullscreen"
|
|
5880
|
-
] }) : /* @__PURE__ */
|
|
5881
|
-
/* @__PURE__ */
|
|
6445
|
+
] }) : /* @__PURE__ */ jsxs15(Fragment9, { children: [
|
|
6446
|
+
/* @__PURE__ */ jsx16("svg", { width: "12", height: "12", viewBox: "0 0 20 20", fill: "currentColor", children: /* @__PURE__ */ jsx16("path", { d: "M13.28 7.78l3.22-3.22v1.69a.75.75 0 001.5 0v-4.5a.75.75 0 00-.75-.75h-4.5a.75.75 0 000 1.5h1.69l-3.22 3.22a.75.75 0 001.06 1.06zM2 17.25a.75.75 0 001.5 0v-1.69l3.22 3.22a.75.75 0 001.06-1.06L4.56 14.5h1.69a.75.75 0 000-1.5h-4.5a.75.75 0 00-.75.75v4.5z" }) }),
|
|
5882
6447
|
"Fullscreen"
|
|
5883
6448
|
] })
|
|
5884
6449
|
}
|
|
5885
6450
|
),
|
|
5886
|
-
isFloating && onToggleFloat && /* @__PURE__ */
|
|
6451
|
+
isFloating && onToggleFloat && /* @__PURE__ */ jsxs15(
|
|
5887
6452
|
"button",
|
|
5888
6453
|
{
|
|
5889
6454
|
onClick: (e) => {
|
|
@@ -5906,7 +6471,7 @@ function PanelContent({
|
|
|
5906
6471
|
transition: "all 150ms"
|
|
5907
6472
|
},
|
|
5908
6473
|
children: [
|
|
5909
|
-
/* @__PURE__ */
|
|
6474
|
+
/* @__PURE__ */ jsx16("svg", { width: "12", height: "12", viewBox: "0 0 20 20", fill: "currentColor", children: /* @__PURE__ */ jsx16(
|
|
5910
6475
|
"path",
|
|
5911
6476
|
{
|
|
5912
6477
|
fillRule: "evenodd",
|
|
@@ -5918,7 +6483,7 @@ function PanelContent({
|
|
|
5918
6483
|
]
|
|
5919
6484
|
}
|
|
5920
6485
|
),
|
|
5921
|
-
!isFloating && onToggleFloat && /* @__PURE__ */
|
|
6486
|
+
!isFloating && onToggleFloat && /* @__PURE__ */ jsx16(
|
|
5922
6487
|
"button",
|
|
5923
6488
|
{
|
|
5924
6489
|
onClick: (e) => {
|
|
@@ -5937,13 +6502,13 @@ function PanelContent({
|
|
|
5937
6502
|
transition: "color 150ms"
|
|
5938
6503
|
},
|
|
5939
6504
|
title: "Pop out",
|
|
5940
|
-
children: /* @__PURE__ */
|
|
5941
|
-
/* @__PURE__ */
|
|
5942
|
-
/* @__PURE__ */
|
|
6505
|
+
children: /* @__PURE__ */ jsxs15("svg", { width: "14", height: "14", viewBox: "0 0 20 20", fill: "currentColor", children: [
|
|
6506
|
+
/* @__PURE__ */ jsx16("path", { d: "M4.25 5.5a.75.75 0 00-.75.75v8.5c0 .414.336.75.75.75h8.5a.75.75 0 00.75-.75v-4a.75.75 0 011.5 0v4A2.25 2.25 0 0112.75 17h-8.5A2.25 2.25 0 012 14.75v-8.5A2.25 2.25 0 014.25 4h5a.75.75 0 010 1.5h-5z" }),
|
|
6507
|
+
/* @__PURE__ */ jsx16("path", { d: "M6.194 12.753a.75.75 0 001.06.053L16.5 4.44v2.81a.75.75 0 001.5 0v-4.5a.75.75 0 00-.75-.75h-4.5a.75.75 0 000 1.5h2.553l-9.056 8.194a.75.75 0 00-.053 1.06z" })
|
|
5943
6508
|
] })
|
|
5944
6509
|
}
|
|
5945
6510
|
),
|
|
5946
|
-
isLoading && /* @__PURE__ */
|
|
6511
|
+
isLoading && /* @__PURE__ */ jsx16(
|
|
5947
6512
|
"div",
|
|
5948
6513
|
{
|
|
5949
6514
|
style: {
|
|
@@ -5955,7 +6520,7 @@ function PanelContent({
|
|
|
5955
6520
|
}
|
|
5956
6521
|
}
|
|
5957
6522
|
),
|
|
5958
|
-
onClose && /* @__PURE__ */
|
|
6523
|
+
onClose && /* @__PURE__ */ jsx16(
|
|
5959
6524
|
"button",
|
|
5960
6525
|
{
|
|
5961
6526
|
onClick: (e) => {
|
|
@@ -5974,11 +6539,11 @@ function PanelContent({
|
|
|
5974
6539
|
transition: "color 150ms"
|
|
5975
6540
|
},
|
|
5976
6541
|
title: "Close",
|
|
5977
|
-
children: /* @__PURE__ */
|
|
6542
|
+
children: /* @__PURE__ */ jsx16("svg", { width: "14", height: "14", viewBox: "0 0 20 20", fill: "currentColor", children: /* @__PURE__ */ jsx16("path", { d: "M6.28 5.22a.75.75 0 00-1.06 1.06L8.94 10l-3.72 3.72a.75.75 0 101.06 1.06L10 11.06l3.72 3.72a.75.75 0 101.06-1.06L11.06 10l3.72-3.72a.75.75 0 00-1.06-1.06L10 8.94 6.28 5.22z" }) })
|
|
5978
6543
|
}
|
|
5979
6544
|
)
|
|
5980
6545
|
] }),
|
|
5981
|
-
/* @__PURE__ */
|
|
6546
|
+
/* @__PURE__ */ jsx16(
|
|
5982
6547
|
"div",
|
|
5983
6548
|
{
|
|
5984
6549
|
style: {
|
|
@@ -5997,8 +6562,8 @@ function PanelContent({
|
|
|
5997
6562
|
]
|
|
5998
6563
|
}
|
|
5999
6564
|
),
|
|
6000
|
-
/* @__PURE__ */
|
|
6001
|
-
/* @__PURE__ */
|
|
6565
|
+
/* @__PURE__ */ jsx16(TabBar, { tabs: tabDefs, activeTab, onTabChange: handleTabChange }),
|
|
6566
|
+
/* @__PURE__ */ jsx16(
|
|
6002
6567
|
"div",
|
|
6003
6568
|
{
|
|
6004
6569
|
style: {
|
|
@@ -6014,8 +6579,8 @@ function PanelContent({
|
|
|
6014
6579
|
children: "Recommendations are generated by AI. Verify details before publishing."
|
|
6015
6580
|
}
|
|
6016
6581
|
),
|
|
6017
|
-
/* @__PURE__ */
|
|
6018
|
-
/* @__PURE__ */
|
|
6582
|
+
/* @__PURE__ */ jsxs15("div", { ref: containerRef, style: { flex: 1, display: "flex", flexDirection: "column", overflow: "hidden" }, children: [
|
|
6583
|
+
/* @__PURE__ */ jsxs15(
|
|
6019
6584
|
"div",
|
|
6020
6585
|
{
|
|
6021
6586
|
style: {
|
|
@@ -6026,7 +6591,7 @@ function PanelContent({
|
|
|
6026
6591
|
background: RECS_ZONE_BG
|
|
6027
6592
|
},
|
|
6028
6593
|
children: [
|
|
6029
|
-
/* @__PURE__ */
|
|
6594
|
+
/* @__PURE__ */ jsx16("div", { style: { display: activeTab === "keywords" ? "block" : "none" }, children: /* @__PURE__ */ jsx16(
|
|
6030
6595
|
KeywordPanel,
|
|
6031
6596
|
{
|
|
6032
6597
|
text,
|
|
@@ -6034,19 +6599,23 @@ function PanelContent({
|
|
|
6034
6599
|
seedKeywords,
|
|
6035
6600
|
onSeedsChange,
|
|
6036
6601
|
onSelectPrimary,
|
|
6602
|
+
secondaryKeyword: effectiveSecondary,
|
|
6603
|
+
onSelectSecondary,
|
|
6037
6604
|
documentFields,
|
|
6038
6605
|
documentId,
|
|
6039
6606
|
externalAnalysis: keywordAnalysisState
|
|
6040
6607
|
},
|
|
6041
6608
|
documentId || "default"
|
|
6042
6609
|
) }),
|
|
6043
|
-
/* @__PURE__ */
|
|
6610
|
+
/* @__PURE__ */ jsx16("div", { style: { display: activeTab === "summary" ? "block" : "none" }, children: /* @__PURE__ */ jsx16(
|
|
6044
6611
|
SummaryTab,
|
|
6045
6612
|
{
|
|
6046
6613
|
text,
|
|
6047
6614
|
analysis: keywordAnalysisState.analysis,
|
|
6048
6615
|
deepAnalysis: keywordAnalysisState.deepAnalysis,
|
|
6049
6616
|
documentFields,
|
|
6617
|
+
primaryKeyword: effectivePrimary,
|
|
6618
|
+
secondaryKeyword: effectiveSecondary,
|
|
6050
6619
|
linkingSuggestions: linkingOps.suggestions,
|
|
6051
6620
|
linkCheckResults: technicalOps.linkCheckResults,
|
|
6052
6621
|
isAnyLoading: summaryOps.isAnyLoading,
|
|
@@ -6054,7 +6623,7 @@ function PanelContent({
|
|
|
6054
6623
|
onItemClick: summaryOps.onItemClick
|
|
6055
6624
|
}
|
|
6056
6625
|
) }),
|
|
6057
|
-
/* @__PURE__ */
|
|
6626
|
+
/* @__PURE__ */ jsx16("div", { style: { display: activeTab === "aeo" ? "block" : "none" }, children: /* @__PURE__ */ jsx16(
|
|
6058
6627
|
AEOTab,
|
|
6059
6628
|
{
|
|
6060
6629
|
text,
|
|
@@ -6071,7 +6640,7 @@ function PanelContent({
|
|
|
6071
6640
|
loadContentSuggestions: aeoOps.loadContentSuggestions
|
|
6072
6641
|
}
|
|
6073
6642
|
) }),
|
|
6074
|
-
/* @__PURE__ */
|
|
6643
|
+
/* @__PURE__ */ jsx16("div", { style: { display: activeTab === "linking" ? "block" : "none" }, children: /* @__PURE__ */ jsx16(
|
|
6075
6644
|
LinkingTab,
|
|
6076
6645
|
{
|
|
6077
6646
|
analysis: keywordAnalysisState.analysis,
|
|
@@ -6082,16 +6651,20 @@ function PanelContent({
|
|
|
6082
6651
|
onRefresh: linkingOps.refresh,
|
|
6083
6652
|
documentId,
|
|
6084
6653
|
publication,
|
|
6085
|
-
text
|
|
6654
|
+
text,
|
|
6655
|
+
sanityBaseUrl,
|
|
6656
|
+
documentType
|
|
6086
6657
|
}
|
|
6087
6658
|
) }),
|
|
6088
|
-
/* @__PURE__ */
|
|
6089
|
-
/* @__PURE__ */
|
|
6659
|
+
/* @__PURE__ */ jsx16("div", { style: { display: activeTab === "meta" ? "block" : "none" }, children: /* @__PURE__ */ jsx16(MetaTab, { documentFields, primaryKeyword: effectivePrimary, secondaryKeyword: effectiveSecondary, isLoading: docLoading }) }),
|
|
6660
|
+
/* @__PURE__ */ jsx16("div", { style: { display: activeTab === "technical" ? "block" : "none" }, children: /* @__PURE__ */ jsx16(
|
|
6090
6661
|
TechnicalTab,
|
|
6091
6662
|
{
|
|
6092
6663
|
text,
|
|
6093
6664
|
documentFields,
|
|
6094
6665
|
isLoading: docLoading,
|
|
6666
|
+
primaryKeyword: effectivePrimary,
|
|
6667
|
+
secondaryKeyword: effectiveSecondary,
|
|
6095
6668
|
linkCheckResults: technicalOps.linkCheckResults,
|
|
6096
6669
|
isLinkCheckLoading: technicalOps.isLinkCheckLoading,
|
|
6097
6670
|
linkCheckError: technicalOps.linkCheckError,
|
|
@@ -6102,7 +6675,7 @@ function PanelContent({
|
|
|
6102
6675
|
]
|
|
6103
6676
|
}
|
|
6104
6677
|
),
|
|
6105
|
-
chatOpen && /* @__PURE__ */
|
|
6678
|
+
chatOpen && /* @__PURE__ */ jsx16(
|
|
6106
6679
|
"div",
|
|
6107
6680
|
{
|
|
6108
6681
|
onMouseDown,
|
|
@@ -6115,10 +6688,10 @@ function PanelContent({
|
|
|
6115
6688
|
justifyContent: "center",
|
|
6116
6689
|
flexShrink: 0
|
|
6117
6690
|
},
|
|
6118
|
-
children: /* @__PURE__ */
|
|
6691
|
+
children: /* @__PURE__ */ jsx16("div", { style: { width: 32, height: 2, borderRadius: 1, background: "#d1d5db" } })
|
|
6119
6692
|
}
|
|
6120
6693
|
),
|
|
6121
|
-
/* @__PURE__ */
|
|
6694
|
+
/* @__PURE__ */ jsxs15(
|
|
6122
6695
|
"div",
|
|
6123
6696
|
{
|
|
6124
6697
|
style: {
|
|
@@ -6131,7 +6704,7 @@ function PanelContent({
|
|
|
6131
6704
|
background: CHAT_ZONE_BG
|
|
6132
6705
|
},
|
|
6133
6706
|
children: [
|
|
6134
|
-
/* @__PURE__ */
|
|
6707
|
+
/* @__PURE__ */ jsxs15(
|
|
6135
6708
|
"button",
|
|
6136
6709
|
{
|
|
6137
6710
|
onClick: () => onChatOpenChange(!chatOpen),
|
|
@@ -6152,7 +6725,7 @@ function PanelContent({
|
|
|
6152
6725
|
flexShrink: 0
|
|
6153
6726
|
},
|
|
6154
6727
|
children: [
|
|
6155
|
-
/* @__PURE__ */
|
|
6728
|
+
/* @__PURE__ */ jsx16(
|
|
6156
6729
|
"span",
|
|
6157
6730
|
{
|
|
6158
6731
|
style: {
|
|
@@ -6165,7 +6738,7 @@ function PanelContent({
|
|
|
6165
6738
|
children: "Chat"
|
|
6166
6739
|
}
|
|
6167
6740
|
),
|
|
6168
|
-
/* @__PURE__ */
|
|
6741
|
+
/* @__PURE__ */ jsx16(
|
|
6169
6742
|
"svg",
|
|
6170
6743
|
{
|
|
6171
6744
|
width: "12",
|
|
@@ -6173,7 +6746,7 @@ function PanelContent({
|
|
|
6173
6746
|
viewBox: "0 0 20 20",
|
|
6174
6747
|
fill: "rgba(0,0,0,0.55)",
|
|
6175
6748
|
style: { transform: chatOpen ? "rotate(0deg)" : "rotate(-90deg)", transition: "transform 200ms" },
|
|
6176
|
-
children: /* @__PURE__ */
|
|
6749
|
+
children: /* @__PURE__ */ jsx16(
|
|
6177
6750
|
"path",
|
|
6178
6751
|
{
|
|
6179
6752
|
fillRule: "evenodd",
|
|
@@ -6186,7 +6759,7 @@ function PanelContent({
|
|
|
6186
6759
|
]
|
|
6187
6760
|
}
|
|
6188
6761
|
),
|
|
6189
|
-
/* @__PURE__ */
|
|
6762
|
+
/* @__PURE__ */ jsx16(
|
|
6190
6763
|
"div",
|
|
6191
6764
|
{
|
|
6192
6765
|
style: {
|
|
@@ -6196,7 +6769,7 @@ function PanelContent({
|
|
|
6196
6769
|
flexDirection: "column",
|
|
6197
6770
|
minHeight: 0
|
|
6198
6771
|
},
|
|
6199
|
-
children: /* @__PURE__ */
|
|
6772
|
+
children: /* @__PURE__ */ jsx16(
|
|
6200
6773
|
ChatPanel,
|
|
6201
6774
|
{
|
|
6202
6775
|
messages: chatState.messages,
|
|
@@ -6229,10 +6802,15 @@ function SEOCopilotInner({ config, onClose }) {
|
|
|
6229
6802
|
);
|
|
6230
6803
|
const dragOffset = useRef10(null);
|
|
6231
6804
|
const resizeStart = useRef10(null);
|
|
6232
|
-
const { text, isLoading: docLoading, documentFields, documentId } = useDocumentContent();
|
|
6805
|
+
const { text, isLoading: docLoading, documentFields, documentId, documentType } = useDocumentContent();
|
|
6233
6806
|
const { apiUrl } = useConfig();
|
|
6234
6807
|
const workspace = useWorkspace();
|
|
6235
6808
|
const effectivePublication = config.publication || workspace?.dataset;
|
|
6809
|
+
const sanityBaseUrl = useMemo5(() => {
|
|
6810
|
+
if (typeof window === "undefined") return void 0;
|
|
6811
|
+
const basePath = (workspace?.basePath || "/").replace(/\/+$/, "");
|
|
6812
|
+
return `${window.location.origin}${basePath}`;
|
|
6813
|
+
}, [workspace?.basePath]);
|
|
6236
6814
|
const seedCacheKey = documentId ? `seo-copilot-cache-${documentId}` : "seo-copilot-cache-v2";
|
|
6237
6815
|
const loadSeedsFromCache = useCallback5(() => {
|
|
6238
6816
|
try {
|
|
@@ -6256,6 +6834,8 @@ function SEOCopilotInner({ config, onClose }) {
|
|
|
6256
6834
|
);
|
|
6257
6835
|
const selectedPrimaryKey = documentId ? `seo-copilot-primary-${documentId}` : "seo-copilot-primary-default";
|
|
6258
6836
|
const [selectedPrimary, setSelectedPrimary] = usePersistentState(selectedPrimaryKey, void 0);
|
|
6837
|
+
const selectedSecondaryKey = documentId ? `seo-copilot-secondary-${documentId}` : "seo-copilot-secondary-default";
|
|
6838
|
+
const [selectedSecondary, setSelectedSecondary] = usePersistentState(selectedSecondaryKey, "");
|
|
6259
6839
|
const seedsInitializedRef = useRef10(false);
|
|
6260
6840
|
useEffect10(() => {
|
|
6261
6841
|
if (!seedsInitializedRef.current) {
|
|
@@ -6338,8 +6918,10 @@ function SEOCopilotInner({ config, onClose }) {
|
|
|
6338
6918
|
lastLinkingFetchKey.current = "";
|
|
6339
6919
|
}, [documentId]);
|
|
6340
6920
|
const supportingKeywordsForLinking = useMemo5(() => {
|
|
6341
|
-
|
|
6342
|
-
|
|
6921
|
+
const base = (keywordAnalysisState.analysis?.supportingKeywords || []).map((kw) => kw.term).filter(Boolean);
|
|
6922
|
+
const merged = selectedSecondary ? [selectedSecondary, ...base.filter((t) => t.toLowerCase() !== selectedSecondary.toLowerCase())] : base;
|
|
6923
|
+
return merged.slice(0, 5);
|
|
6924
|
+
}, [keywordAnalysisState.analysis, selectedSecondary]);
|
|
6343
6925
|
const refreshLinkingSuggestions = useCallback5(async () => {
|
|
6344
6926
|
if (!text || text.trim().length < 50) return;
|
|
6345
6927
|
if (!effectivePrimary) return;
|
|
@@ -6475,7 +7057,7 @@ function SEOCopilotInner({ config, onClose }) {
|
|
|
6475
7057
|
},
|
|
6476
7058
|
[floatSize]
|
|
6477
7059
|
);
|
|
6478
|
-
const panelContent = /* @__PURE__ */
|
|
7060
|
+
const panelContent = /* @__PURE__ */ jsx16(
|
|
6479
7061
|
PanelContent,
|
|
6480
7062
|
{
|
|
6481
7063
|
initialPublication: effectivePublication,
|
|
@@ -6495,8 +7077,12 @@ function SEOCopilotInner({ config, onClose }) {
|
|
|
6495
7077
|
docLoading,
|
|
6496
7078
|
documentFields,
|
|
6497
7079
|
documentId,
|
|
7080
|
+
documentType,
|
|
7081
|
+
sanityBaseUrl,
|
|
6498
7082
|
selectedPrimary,
|
|
6499
7083
|
onSelectPrimary: setSelectedPrimary,
|
|
7084
|
+
selectedSecondary,
|
|
7085
|
+
onSelectSecondary: setSelectedSecondary,
|
|
6500
7086
|
activeTab,
|
|
6501
7087
|
onActiveTabChange: setActiveTab,
|
|
6502
7088
|
chatOpen,
|
|
@@ -6558,7 +7144,7 @@ function SEOCopilotInner({ config, onClose }) {
|
|
|
6558
7144
|
}
|
|
6559
7145
|
}
|
|
6560
7146
|
);
|
|
6561
|
-
const floatingPanel = /* @__PURE__ */
|
|
7147
|
+
const floatingPanel = /* @__PURE__ */ jsxs15(
|
|
6562
7148
|
"div",
|
|
6563
7149
|
{
|
|
6564
7150
|
style: {
|
|
@@ -6576,7 +7162,7 @@ function SEOCopilotInner({ config, onClose }) {
|
|
|
6576
7162
|
},
|
|
6577
7163
|
children: [
|
|
6578
7164
|
panelContent,
|
|
6579
|
-
!isFullscreen && /* @__PURE__ */
|
|
7165
|
+
!isFullscreen && /* @__PURE__ */ jsx16(
|
|
6580
7166
|
"div",
|
|
6581
7167
|
{
|
|
6582
7168
|
onMouseDown: handleResizeStart,
|
|
@@ -6591,9 +7177,9 @@ function SEOCopilotInner({ config, onClose }) {
|
|
|
6591
7177
|
alignItems: "center",
|
|
6592
7178
|
justifyContent: "center"
|
|
6593
7179
|
},
|
|
6594
|
-
children: /* @__PURE__ */
|
|
6595
|
-
/* @__PURE__ */
|
|
6596
|
-
/* @__PURE__ */
|
|
7180
|
+
children: /* @__PURE__ */ jsxs15("svg", { width: "10", height: "10", viewBox: "0 0 10 10", fill: "#9ca3af", children: [
|
|
7181
|
+
/* @__PURE__ */ jsx16("path", { d: "M9 1v8H1", fill: "none", stroke: "#9ca3af", strokeWidth: "1.5", strokeLinecap: "round" }),
|
|
7182
|
+
/* @__PURE__ */ jsx16("path", { d: "M9 5v4H5", fill: "none", stroke: "#9ca3af", strokeWidth: "1.5", strokeLinecap: "round" })
|
|
6597
7183
|
] })
|
|
6598
7184
|
}
|
|
6599
7185
|
)
|
|
@@ -6601,8 +7187,8 @@ function SEOCopilotInner({ config, onClose }) {
|
|
|
6601
7187
|
}
|
|
6602
7188
|
);
|
|
6603
7189
|
if (isFloating) {
|
|
6604
|
-
return /* @__PURE__ */
|
|
6605
|
-
/* @__PURE__ */
|
|
7190
|
+
return /* @__PURE__ */ jsxs15(Fragment9, { children: [
|
|
7191
|
+
/* @__PURE__ */ jsx16(
|
|
6606
7192
|
"div",
|
|
6607
7193
|
{
|
|
6608
7194
|
style: {
|
|
@@ -6612,30 +7198,30 @@ function SEOCopilotInner({ config, onClose }) {
|
|
|
6612
7198
|
alignItems: "center",
|
|
6613
7199
|
justifyContent: "center"
|
|
6614
7200
|
},
|
|
6615
|
-
children: /* @__PURE__ */
|
|
7201
|
+
children: /* @__PURE__ */ jsx16("span", { style: { fontSize: 12, color: "rgba(0,0,0,0.5)" }, children: "SEO Copilot is floating" })
|
|
6616
7202
|
}
|
|
6617
7203
|
),
|
|
6618
7204
|
typeof document !== "undefined" && createPortal(floatingPanel, document.body)
|
|
6619
7205
|
] });
|
|
6620
7206
|
}
|
|
6621
|
-
return /* @__PURE__ */
|
|
7207
|
+
return /* @__PURE__ */ jsx16("div", { style: { height: "100%", background: PANEL_BG, position: "relative", zIndex: 1 }, children: panelContent });
|
|
6622
7208
|
}
|
|
6623
7209
|
function SEOCopilotPanel({ config, onClose }) {
|
|
6624
|
-
return /* @__PURE__ */
|
|
7210
|
+
return /* @__PURE__ */ jsx16(
|
|
6625
7211
|
Suspense,
|
|
6626
7212
|
{
|
|
6627
|
-
fallback: /* @__PURE__ */
|
|
6628
|
-
/* @__PURE__ */
|
|
6629
|
-
/* @__PURE__ */
|
|
7213
|
+
fallback: /* @__PURE__ */ jsxs15("div", { style: { padding: 16, display: "flex", alignItems: "center", gap: 12 }, children: [
|
|
7214
|
+
/* @__PURE__ */ jsx16(LoadingBars, {}),
|
|
7215
|
+
/* @__PURE__ */ jsx16("span", { style: { fontSize: 12, color: "#4b5563" }, children: "Loading SEO Copilot..." })
|
|
6630
7216
|
] }),
|
|
6631
|
-
children: /* @__PURE__ */
|
|
7217
|
+
children: /* @__PURE__ */ jsx16(ConfigProvider, { config, children: /* @__PURE__ */ jsx16(SEOCopilotInner, { config, onClose }) })
|
|
6632
7218
|
}
|
|
6633
7219
|
);
|
|
6634
7220
|
}
|
|
6635
7221
|
function LoadingBars({ size = "sm", color = MJH_GOLD }) {
|
|
6636
7222
|
const barWidth = size === "xs" ? 4 : 6;
|
|
6637
7223
|
const containerHeight = size === "xs" ? 10 : 14;
|
|
6638
|
-
return /* @__PURE__ */
|
|
7224
|
+
return /* @__PURE__ */ jsx16("div", { style: { display: "inline-flex", alignItems: "flex-end", gap: 2, height: containerHeight }, children: [1, 2, 3].map((i) => /* @__PURE__ */ jsx16(
|
|
6639
7225
|
"div",
|
|
6640
7226
|
{
|
|
6641
7227
|
style: {
|