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.js
CHANGED
|
@@ -149,7 +149,14 @@ function detectAuthor(val) {
|
|
|
149
149
|
"Authors"
|
|
150
150
|
// PascalCase variants
|
|
151
151
|
];
|
|
152
|
-
|
|
152
|
+
const dynamic = Object.keys(val).filter(
|
|
153
|
+
// Author/byline-ish names, but never fact-check/reviewer fields, nor image/url/
|
|
154
|
+
// id sidecars (e.g. authorPhoto, authorImageUrl, authorId) that could otherwise
|
|
155
|
+
// be mistaken for a reference-typed author.
|
|
156
|
+
(k) => /author|byline/i.test(k) && !/fact|check|review|photo|image|avatar|picture|url|link|count|id$/i.test(k)
|
|
157
|
+
);
|
|
158
|
+
const fields = Array.from(/* @__PURE__ */ new Set([...candidateFields, ...dynamic]));
|
|
159
|
+
for (const f of fields) {
|
|
153
160
|
const raw = val[f];
|
|
154
161
|
if (!raw) continue;
|
|
155
162
|
const first = Array.isArray(raw) ? raw[0] : raw;
|
|
@@ -244,6 +251,7 @@ function buildDocumentFields(value) {
|
|
|
244
251
|
function useDocumentContent() {
|
|
245
252
|
const { value, ready } = (0, import_structure.useDocumentPane)();
|
|
246
253
|
const documentId = value?._id || void 0;
|
|
254
|
+
const documentType = value?._type || void 0;
|
|
247
255
|
const title = value?.title;
|
|
248
256
|
const body = value?.body;
|
|
249
257
|
const [debouncedText, setDebouncedText] = (0, import_react.useState)("");
|
|
@@ -271,7 +279,7 @@ function useDocumentContent() {
|
|
|
271
279
|
if (timerRef.current) clearTimeout(timerRef.current);
|
|
272
280
|
};
|
|
273
281
|
}, [title, body, value]);
|
|
274
|
-
return { text: debouncedText, isLoading, documentFields, documentId };
|
|
282
|
+
return { text: debouncedText, isLoading, documentFields, documentId, documentType };
|
|
275
283
|
}
|
|
276
284
|
|
|
277
285
|
// src/hooks/useKeywordAnalysis.ts
|
|
@@ -294,28 +302,36 @@ function safeParseJson(text) {
|
|
|
294
302
|
throw new Error("Invalid JSON response from server");
|
|
295
303
|
}
|
|
296
304
|
}
|
|
297
|
-
async function fetchAnalysis(apiUrl, content, mode, publication, seedKeywords, documentFields, focusKeyword) {
|
|
305
|
+
async function fetchAnalysis(apiUrl, content, mode, publication, seedKeywords, documentFields, focusKeyword, signal) {
|
|
298
306
|
const response = await fetch(`${apiUrl}/api/seo-copilot/analyze`, {
|
|
299
307
|
method: "POST",
|
|
300
308
|
headers: { "Content-Type": "application/json" },
|
|
301
|
-
body: JSON.stringify({ content, mode, publication, seedKeywords, documentFields, focusKeyword })
|
|
309
|
+
body: JSON.stringify({ content, mode, publication, seedKeywords, documentFields, focusKeyword }),
|
|
310
|
+
signal
|
|
302
311
|
});
|
|
303
312
|
const text = await response.text();
|
|
304
313
|
if (!response.ok) {
|
|
305
314
|
const err = safeParseJson(text);
|
|
306
|
-
|
|
315
|
+
console.error("[seo-copilot] analyze error", response.status, err.error);
|
|
316
|
+
if (response.status === 429) throw new Error("Analysis service is busy. Please try again.");
|
|
317
|
+
if (response.status >= 500) throw new Error("Could not reach the SEO service.");
|
|
318
|
+
throw new Error("Something went wrong analyzing this document.");
|
|
307
319
|
}
|
|
308
320
|
return safeParseJson(text);
|
|
309
321
|
}
|
|
310
|
-
async function fetchChatStream(apiUrl, messages, documentContext, publication, keywordPanelData) {
|
|
322
|
+
async function fetchChatStream(apiUrl, messages, documentContext, publication, keywordPanelData, signal) {
|
|
311
323
|
const response = await fetch(`${apiUrl}/api/seo-copilot/chat`, {
|
|
312
324
|
method: "POST",
|
|
313
325
|
headers: { "Content-Type": "application/json" },
|
|
314
|
-
body: JSON.stringify({ messages, documentContext, publication, keywordPanelData })
|
|
326
|
+
body: JSON.stringify({ messages, documentContext, publication, keywordPanelData }),
|
|
327
|
+
signal
|
|
315
328
|
});
|
|
316
329
|
if (!response.ok) {
|
|
317
330
|
const err = await response.json().catch(() => ({ error: "Request failed" }));
|
|
318
|
-
|
|
331
|
+
console.error("[seo-copilot] chat error", response.status, err.error);
|
|
332
|
+
if (response.status === 429) throw new Error("Analysis service is busy. Please try again.");
|
|
333
|
+
if (response.status >= 500) throw new Error("Could not reach the SEO service.");
|
|
334
|
+
throw new Error("Something went wrong. Please try again.");
|
|
319
335
|
}
|
|
320
336
|
return response.body;
|
|
321
337
|
}
|
|
@@ -326,15 +342,19 @@ async function submitFeedback(apiUrl, data) {
|
|
|
326
342
|
body: JSON.stringify(data)
|
|
327
343
|
});
|
|
328
344
|
}
|
|
329
|
-
async function lookupKeywords(apiUrl, keywords) {
|
|
345
|
+
async function lookupKeywords(apiUrl, keywords, signal) {
|
|
330
346
|
const response = await fetch(`${apiUrl}/api/seo-copilot/keywords`, {
|
|
331
347
|
method: "POST",
|
|
332
348
|
headers: { "Content-Type": "application/json" },
|
|
333
|
-
body: JSON.stringify({ keywords })
|
|
349
|
+
body: JSON.stringify({ keywords }),
|
|
350
|
+
signal
|
|
334
351
|
});
|
|
335
352
|
if (!response.ok) {
|
|
336
353
|
const err = await response.json().catch(() => ({ error: "Request failed" }));
|
|
337
|
-
|
|
354
|
+
console.error("[seo-copilot] keywords error", response.status, err.error);
|
|
355
|
+
if (response.status === 429) throw new Error("Analysis service is busy. Please try again.");
|
|
356
|
+
if (response.status >= 500) throw new Error("Could not reach the SEO service.");
|
|
357
|
+
throw new Error("Something went wrong. Please try again.");
|
|
338
358
|
}
|
|
339
359
|
return response.json();
|
|
340
360
|
}
|
|
@@ -471,6 +491,8 @@ function useKeywordAnalysis(text, apiUrl, publication, seedKeywords, documentFie
|
|
|
471
491
|
return;
|
|
472
492
|
}
|
|
473
493
|
docVersionRef.current += 1;
|
|
494
|
+
volumeAbortRef.current?.abort();
|
|
495
|
+
volumeAbortRef.current = null;
|
|
474
496
|
const fresh = loadCached();
|
|
475
497
|
cached.current = fresh;
|
|
476
498
|
setAnalysisRaw(fresh.analysis);
|
|
@@ -508,15 +530,17 @@ function useKeywordAnalysis(text, apiUrl, publication, seedKeywords, documentFie
|
|
|
508
530
|
}, [text, deepAnalysis, aeoTextSnapshot]);
|
|
509
531
|
const lastAnalysisRef = (0, import_react2.useRef)(null);
|
|
510
532
|
const docVersionRef = (0, import_react2.useRef)(0);
|
|
533
|
+
const volumeAbortRef = (0, import_react2.useRef)(null);
|
|
511
534
|
(0, import_react2.useEffect)(() => {
|
|
512
535
|
if ((!text || text.trim().length < 20) && (!effectiveSeeds || effectiveSeeds.length === 0)) {
|
|
513
536
|
setAnalysis(null);
|
|
514
537
|
return;
|
|
515
538
|
}
|
|
516
539
|
let cancelled = false;
|
|
540
|
+
const controller = new AbortController();
|
|
517
541
|
setIsLoading(true);
|
|
518
542
|
setError(null);
|
|
519
|
-
fetchAnalysis(apiUrl, text, "realtime", publication, effectiveSeeds, documentFields, focusPrimary).then((result) => {
|
|
543
|
+
fetchAnalysis(apiUrl, text, "realtime", publication, effectiveSeeds, documentFields, focusPrimary, controller.signal).then((result) => {
|
|
520
544
|
if (cancelled) return;
|
|
521
545
|
const analysisResult = result;
|
|
522
546
|
lastAnalysisRef.current = analysisResult;
|
|
@@ -536,6 +560,7 @@ function useKeywordAnalysis(text, apiUrl, publication, seedKeywords, documentFie
|
|
|
536
560
|
doVolumeLookup(analysisResult, uncachedTerms);
|
|
537
561
|
}
|
|
538
562
|
}).catch((err) => {
|
|
563
|
+
if (err instanceof Error && err.name === "AbortError") return;
|
|
539
564
|
if (!cancelled) {
|
|
540
565
|
setError(err.message);
|
|
541
566
|
setIsLoading(false);
|
|
@@ -543,8 +568,9 @@ function useKeywordAnalysis(text, apiUrl, publication, seedKeywords, documentFie
|
|
|
543
568
|
});
|
|
544
569
|
return () => {
|
|
545
570
|
cancelled = true;
|
|
571
|
+
controller.abort();
|
|
546
572
|
};
|
|
547
|
-
}, [text, apiUrl, publication, effectiveSeeds?.join(","), focusPrimary]);
|
|
573
|
+
}, [text, apiUrl, publication, effectiveSeeds?.join(","), focusPrimary, JSON.stringify(documentFields)]);
|
|
548
574
|
const doVolumeLookup = (0, import_react2.useCallback)((analysisResult, terms) => {
|
|
549
575
|
setIsVolumesLoading(true);
|
|
550
576
|
const myVersion = docVersionRef.current;
|
|
@@ -563,7 +589,10 @@ function useKeywordAnalysis(text, apiUrl, publication, seedKeywords, documentFie
|
|
|
563
589
|
setIsVolumesLoading(false);
|
|
564
590
|
return;
|
|
565
591
|
}
|
|
566
|
-
|
|
592
|
+
volumeAbortRef.current?.abort();
|
|
593
|
+
const controller = new AbortController();
|
|
594
|
+
volumeAbortRef.current = controller;
|
|
595
|
+
lookupKeywords(apiUrl, lookupTerms, controller.signal).then(({ results }) => {
|
|
567
596
|
if (docVersionRef.current !== myVersion) return;
|
|
568
597
|
results.forEach((r) => volumeMapRef.current.set(r.keyword.toLowerCase(), r));
|
|
569
598
|
const current = lastAnalysisRef.current || analysisResult;
|
|
@@ -576,7 +605,8 @@ function useKeywordAnalysis(text, apiUrl, publication, seedKeywords, documentFie
|
|
|
576
605
|
} catch {
|
|
577
606
|
}
|
|
578
607
|
setIsVolumesLoading(false);
|
|
579
|
-
}).catch(() => {
|
|
608
|
+
}).catch((err) => {
|
|
609
|
+
if (err instanceof Error && err.name === "AbortError") return;
|
|
580
610
|
if (docVersionRef.current !== myVersion) return;
|
|
581
611
|
setIsVolumesLoading(false);
|
|
582
612
|
});
|
|
@@ -643,16 +673,10 @@ function useSEOChat(apiUrl, documentText, publication, keywordPanelData, documen
|
|
|
643
673
|
}
|
|
644
674
|
}, [chatCacheKey]);
|
|
645
675
|
const [messages, setMessagesRaw] = (0, import_react3.useState)(loadCachedMessages);
|
|
676
|
+
const messagesRef = (0, import_react3.useRef)([]);
|
|
646
677
|
const setMessages = (0, import_react3.useCallback)((msgs) => {
|
|
647
|
-
setMessagesRaw(
|
|
648
|
-
|
|
649
|
-
try {
|
|
650
|
-
localStorage.setItem(chatCacheKey, JSON.stringify(next));
|
|
651
|
-
} catch {
|
|
652
|
-
}
|
|
653
|
-
return next;
|
|
654
|
-
});
|
|
655
|
-
}, [chatCacheKey]);
|
|
678
|
+
setMessagesRaw(msgs);
|
|
679
|
+
}, []);
|
|
656
680
|
const [isStreaming, setIsStreaming] = (0, import_react3.useState)(false);
|
|
657
681
|
const [historyLoaded, setHistoryLoaded] = (0, import_react3.useState)(false);
|
|
658
682
|
const sanityUser = (0, import_sanity.useCurrentUser)();
|
|
@@ -662,6 +686,24 @@ function useSEOChat(apiUrl, documentText, publication, keywordPanelData, documen
|
|
|
662
686
|
userId.current = sanityUser.id;
|
|
663
687
|
}
|
|
664
688
|
}, [sanityUser?.id]);
|
|
689
|
+
(0, import_react3.useEffect)(() => {
|
|
690
|
+
messagesRef.current = messages;
|
|
691
|
+
}, [messages]);
|
|
692
|
+
(0, import_react3.useEffect)(() => {
|
|
693
|
+
const timer = setTimeout(() => {
|
|
694
|
+
try {
|
|
695
|
+
localStorage.setItem(chatCacheKey, JSON.stringify(messages));
|
|
696
|
+
} catch {
|
|
697
|
+
}
|
|
698
|
+
}, 500);
|
|
699
|
+
return () => clearTimeout(timer);
|
|
700
|
+
}, [messages, chatCacheKey]);
|
|
701
|
+
const streamAbortRef = (0, import_react3.useRef)(null);
|
|
702
|
+
(0, import_react3.useEffect)(() => {
|
|
703
|
+
return () => {
|
|
704
|
+
streamAbortRef.current?.abort();
|
|
705
|
+
};
|
|
706
|
+
}, []);
|
|
665
707
|
const saveTimerRef = (0, import_react3.useRef)(null);
|
|
666
708
|
const opVersionRef = (0, import_react3.useRef)(0);
|
|
667
709
|
const didInitRef = (0, import_react3.useRef)(false);
|
|
@@ -671,6 +713,8 @@ function useSEOChat(apiUrl, documentText, publication, keywordPanelData, documen
|
|
|
671
713
|
return;
|
|
672
714
|
}
|
|
673
715
|
opVersionRef.current += 1;
|
|
716
|
+
streamAbortRef.current?.abort();
|
|
717
|
+
streamAbortRef.current = null;
|
|
674
718
|
setMessagesRaw(loadCachedMessages());
|
|
675
719
|
setIsStreaming(false);
|
|
676
720
|
setHistoryLoaded(false);
|
|
@@ -705,16 +749,19 @@ function useSEOChat(apiUrl, documentText, publication, keywordPanelData, documen
|
|
|
705
749
|
async (text) => {
|
|
706
750
|
const myVersion = opVersionRef.current;
|
|
707
751
|
const userMessage = { role: "user", content: text };
|
|
708
|
-
const updatedMessages = [...
|
|
752
|
+
const updatedMessages = [...messagesRef.current, userMessage];
|
|
709
753
|
setMessages(updatedMessages);
|
|
710
754
|
setIsStreaming(true);
|
|
755
|
+
const controller = new AbortController();
|
|
756
|
+
streamAbortRef.current = controller;
|
|
711
757
|
try {
|
|
712
758
|
const stream = await fetchChatStream(
|
|
713
759
|
apiUrl,
|
|
714
760
|
updatedMessages,
|
|
715
761
|
documentText,
|
|
716
762
|
publication,
|
|
717
|
-
keywordPanelData
|
|
763
|
+
keywordPanelData,
|
|
764
|
+
controller.signal
|
|
718
765
|
);
|
|
719
766
|
if (!stream) {
|
|
720
767
|
setIsStreaming(false);
|
|
@@ -774,6 +821,10 @@ function useSEOChat(apiUrl, documentText, publication, keywordPanelData, documen
|
|
|
774
821
|
scheduleSave(finalMessages);
|
|
775
822
|
}
|
|
776
823
|
} catch (err) {
|
|
824
|
+
if (err instanceof Error && err.name === "AbortError") {
|
|
825
|
+
setIsStreaming(false);
|
|
826
|
+
return;
|
|
827
|
+
}
|
|
777
828
|
if (opVersionRef.current !== myVersion) {
|
|
778
829
|
setIsStreaming(false);
|
|
779
830
|
return;
|
|
@@ -786,7 +837,7 @@ function useSEOChat(apiUrl, documentText, publication, keywordPanelData, documen
|
|
|
786
837
|
}
|
|
787
838
|
if (opVersionRef.current === myVersion) setIsStreaming(false);
|
|
788
839
|
},
|
|
789
|
-
[
|
|
840
|
+
[apiUrl, documentText, publication, keywordPanelData, scheduleSave]
|
|
790
841
|
);
|
|
791
842
|
const clearChat = (0, import_react3.useCallback)(() => {
|
|
792
843
|
setMessages([]);
|
|
@@ -916,6 +967,14 @@ var INJECTED_CSS = `
|
|
|
916
967
|
0%, 100% { opacity: 0.5; }
|
|
917
968
|
50% { opacity: 1; }
|
|
918
969
|
}
|
|
970
|
+
@keyframes onboard-in {
|
|
971
|
+
from { opacity: 0; transform: translateY(-6px) scale(0.97); }
|
|
972
|
+
to { opacity: 1; transform: translateY(0) scale(1); }
|
|
973
|
+
}
|
|
974
|
+
@keyframes onboard-out {
|
|
975
|
+
from { opacity: 1; transform: translateY(0) scale(1); }
|
|
976
|
+
to { opacity: 0; transform: translateY(-6px) scale(0.97); }
|
|
977
|
+
}
|
|
919
978
|
.prose-chat { font-size: 12.5px; line-height: 1.65; color: #475569; font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif; }
|
|
920
979
|
.prose-chat h1 { font-size: 14px; font-weight: 700; color: #1e293b; margin: 10px 0 5px 0; line-height: 1.35; }
|
|
921
980
|
.prose-chat h2, .prose-chat h3 { font-size: 13px; font-weight: 700; color: #1e293b; margin: 10px 0 5px 0; line-height: 1.35; }
|
|
@@ -1454,7 +1513,7 @@ function LightbulbButton({ onClick, isLoading }) {
|
|
|
1454
1513
|
whiteSpace: "nowrap",
|
|
1455
1514
|
pointerEvents: "none",
|
|
1456
1515
|
zIndex: 10
|
|
1457
|
-
}, children: "
|
|
1516
|
+
}, children: "See suggestion" })
|
|
1458
1517
|
]
|
|
1459
1518
|
}
|
|
1460
1519
|
);
|
|
@@ -1657,6 +1716,119 @@ function PrimaryKeywordSelector({
|
|
|
1657
1716
|
}) })
|
|
1658
1717
|
] });
|
|
1659
1718
|
}
|
|
1719
|
+
function SecondaryKeywordSelector({
|
|
1720
|
+
options,
|
|
1721
|
+
selectedTerm,
|
|
1722
|
+
onSelect
|
|
1723
|
+
}) {
|
|
1724
|
+
const [customInputOpen, setCustomInputOpen] = (0, import_react9.useState)(false);
|
|
1725
|
+
const [customValue, setCustomValue] = (0, import_react9.useState)("");
|
|
1726
|
+
const handleCustomSubmit = () => {
|
|
1727
|
+
const trimmed = customValue.trim();
|
|
1728
|
+
if (trimmed) {
|
|
1729
|
+
onSelect(trimmed);
|
|
1730
|
+
setCustomValue("");
|
|
1731
|
+
setCustomInputOpen(false);
|
|
1732
|
+
}
|
|
1733
|
+
};
|
|
1734
|
+
const opts = selectedTerm && !options.some((o) => o.term === selectedTerm) ? [...options, { term: selectedTerm, volume: null }] : options;
|
|
1735
|
+
return /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { style: cardStyle, children: [
|
|
1736
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
1737
|
+
SectionHeader,
|
|
1738
|
+
{
|
|
1739
|
+
label: "Secondary Keyword",
|
|
1740
|
+
iconColor: MJH_BLUE,
|
|
1741
|
+
actionButton: /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { style: { display: "flex", alignItems: "center", gap: 6 }, children: [
|
|
1742
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("span", { style: { fontSize: 9, fontWeight: 700, letterSpacing: "0.05em", textTransform: "uppercase", color: "#9ca3af" }, children: "Optional" }),
|
|
1743
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(PencilButton, { onClick: () => setCustomInputOpen(!customInputOpen), active: customInputOpen })
|
|
1744
|
+
] })
|
|
1745
|
+
}
|
|
1746
|
+
),
|
|
1747
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("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." }),
|
|
1748
|
+
customInputOpen && /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { style: { marginBottom: 8, display: "flex", gap: 6 }, children: [
|
|
1749
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
1750
|
+
"input",
|
|
1751
|
+
{
|
|
1752
|
+
type: "text",
|
|
1753
|
+
value: customValue,
|
|
1754
|
+
onChange: (e) => setCustomValue(e.target.value),
|
|
1755
|
+
onKeyDown: (e) => {
|
|
1756
|
+
if (e.key === "Enter") handleCustomSubmit();
|
|
1757
|
+
},
|
|
1758
|
+
placeholder: "Type a custom secondary keyword",
|
|
1759
|
+
autoFocus: true,
|
|
1760
|
+
style: { flex: 1, padding: "5px 8px", fontSize: 12, borderRadius: 8, border: "1px solid #e5e7eb", outline: "none", fontFamily: "inherit" }
|
|
1761
|
+
}
|
|
1762
|
+
),
|
|
1763
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
1764
|
+
"button",
|
|
1765
|
+
{
|
|
1766
|
+
onClick: handleCustomSubmit,
|
|
1767
|
+
disabled: !customValue.trim(),
|
|
1768
|
+
style: {
|
|
1769
|
+
padding: "5px 10px",
|
|
1770
|
+
fontSize: 11,
|
|
1771
|
+
fontWeight: 600,
|
|
1772
|
+
borderRadius: 6,
|
|
1773
|
+
border: "none",
|
|
1774
|
+
background: customValue.trim() ? MJH_BLUE : "#e5e7eb",
|
|
1775
|
+
color: customValue.trim() ? "#ffffff" : "#9ca3af",
|
|
1776
|
+
cursor: customValue.trim() ? "pointer" : "not-allowed"
|
|
1777
|
+
},
|
|
1778
|
+
children: "Set"
|
|
1779
|
+
}
|
|
1780
|
+
)
|
|
1781
|
+
] }),
|
|
1782
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { style: { display: "flex", flexDirection: "column", gap: 6 }, children: [
|
|
1783
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(SecondaryOptionRow, { term: "", label: "None", selected: !selectedTerm, onSelect: () => onSelect("") }),
|
|
1784
|
+
opts.map((o) => /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
1785
|
+
SecondaryOptionRow,
|
|
1786
|
+
{
|
|
1787
|
+
term: o.term,
|
|
1788
|
+
label: o.term,
|
|
1789
|
+
volume: o.volume,
|
|
1790
|
+
selected: o.term === selectedTerm,
|
|
1791
|
+
onSelect: () => onSelect(o.term)
|
|
1792
|
+
},
|
|
1793
|
+
o.term
|
|
1794
|
+
))
|
|
1795
|
+
] })
|
|
1796
|
+
] });
|
|
1797
|
+
}
|
|
1798
|
+
function SecondaryOptionRow({ term, label, volume, selected, onSelect }) {
|
|
1799
|
+
return /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(
|
|
1800
|
+
"div",
|
|
1801
|
+
{
|
|
1802
|
+
onClick: onSelect,
|
|
1803
|
+
style: {
|
|
1804
|
+
display: "flex",
|
|
1805
|
+
alignItems: "center",
|
|
1806
|
+
gap: 8,
|
|
1807
|
+
padding: "6px 8px",
|
|
1808
|
+
borderRadius: 8,
|
|
1809
|
+
cursor: "pointer",
|
|
1810
|
+
background: selected ? "rgba(0,93,172,0.06)" : "transparent",
|
|
1811
|
+
border: selected ? "1px solid rgba(0,93,172,0.2)" : "1px solid transparent",
|
|
1812
|
+
transition: "all 150ms"
|
|
1813
|
+
},
|
|
1814
|
+
children: [
|
|
1815
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("div", { style: {
|
|
1816
|
+
width: 14,
|
|
1817
|
+
height: 14,
|
|
1818
|
+
borderRadius: "50%",
|
|
1819
|
+
border: selected ? "none" : "2px solid #d1d5db",
|
|
1820
|
+
background: selected ? MJH_BLUE : "transparent",
|
|
1821
|
+
flexShrink: 0,
|
|
1822
|
+
display: "flex",
|
|
1823
|
+
alignItems: "center",
|
|
1824
|
+
justifyContent: "center"
|
|
1825
|
+
}, children: selected && /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("div", { style: { width: 6, height: 6, borderRadius: "50%", background: "#ffffff" } }) }),
|
|
1826
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("span", { style: { fontSize: 12, fontWeight: selected ? 600 : 400, color: term ? selected ? "#00468a" : "#374151" : "#6b7280", flex: 1, minWidth: 0 }, children: label }),
|
|
1827
|
+
volume != null && /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("span", { style: { fontSize: 11, fontWeight: 600, color: "#1f2937" }, children: volume === 0 ? "N/A" : `${abbrevVol(volume)}/mo` })
|
|
1828
|
+
]
|
|
1829
|
+
}
|
|
1830
|
+
);
|
|
1831
|
+
}
|
|
1660
1832
|
var PLACEMENT_FILTERS = [
|
|
1661
1833
|
{ key: "inBody", label: "Body", letter: "B" },
|
|
1662
1834
|
{ key: "inTitle", label: "Title", letter: "T" },
|
|
@@ -2137,6 +2309,8 @@ function KeywordPanel({
|
|
|
2137
2309
|
seedKeywords = [],
|
|
2138
2310
|
onSeedsChange,
|
|
2139
2311
|
onSelectPrimary,
|
|
2312
|
+
secondaryKeyword = "",
|
|
2313
|
+
onSelectSecondary,
|
|
2140
2314
|
documentFields,
|
|
2141
2315
|
documentId,
|
|
2142
2316
|
externalAnalysis
|
|
@@ -2196,7 +2370,36 @@ function KeywordPanel({
|
|
|
2196
2370
|
placement: computePlacementClient(c.term, text, documentFields)
|
|
2197
2371
|
}));
|
|
2198
2372
|
const activeTerm = candidates.find((c) => c.term === selectedPrimaryTerm) ? selectedPrimaryTerm : candidates[0]?.term ?? "";
|
|
2373
|
+
const secondaryOptions = [];
|
|
2374
|
+
const seenSecondary = /* @__PURE__ */ new Set();
|
|
2375
|
+
for (const c of candidates) {
|
|
2376
|
+
const key = c.term.toLowerCase();
|
|
2377
|
+
if (!seenSecondary.has(key)) {
|
|
2378
|
+
seenSecondary.add(key);
|
|
2379
|
+
secondaryOptions.push({ term: c.term, volume: c.volume });
|
|
2380
|
+
}
|
|
2381
|
+
}
|
|
2382
|
+
for (const kw of suggestedKeywords) {
|
|
2383
|
+
const key = kw.term.toLowerCase();
|
|
2384
|
+
if (!seenSecondary.has(key)) {
|
|
2385
|
+
seenSecondary.add(key);
|
|
2386
|
+
secondaryOptions.push({ term: kw.term, volume: kw.volume });
|
|
2387
|
+
}
|
|
2388
|
+
}
|
|
2199
2389
|
return /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { style: { padding: 12, display: "flex", flexDirection: "column", gap: 12 }, children: [
|
|
2390
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("div", { style: {
|
|
2391
|
+
...cardStyle,
|
|
2392
|
+
padding: "11px 13px",
|
|
2393
|
+
background: "rgba(0,93,172,0.05)",
|
|
2394
|
+
boxShadow: "inset 0 0 0 1px rgba(0,93,172,0.12)"
|
|
2395
|
+
}, children: /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { style: { fontSize: 11.5, color: "#1f2937", lineHeight: 1.55 }, children: [
|
|
2396
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("strong", { style: { color: "#00468a" }, children: "Choose your target keywords." }),
|
|
2397
|
+
" Pick one ",
|
|
2398
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("strong", { children: "Primary" }),
|
|
2399
|
+
" keyword (required) and, optionally, one ",
|
|
2400
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("strong", { children: "Secondary" }),
|
|
2401
|
+
" keyword. Copilot optimizes the whole article - title, meta, URL, headings, and images - toward both."
|
|
2402
|
+
] }) }),
|
|
2200
2403
|
onSeedsChange && /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(SeedKeywordInput, { seeds: seedKeywords, onSeedsChange }),
|
|
2201
2404
|
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
2202
2405
|
PrimaryKeywordSelector,
|
|
@@ -2210,6 +2413,14 @@ function KeywordPanel({
|
|
|
2210
2413
|
publication
|
|
2211
2414
|
}
|
|
2212
2415
|
),
|
|
2416
|
+
onSelectSecondary && secondaryOptions.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
2417
|
+
SecondaryKeywordSelector,
|
|
2418
|
+
{
|
|
2419
|
+
options: secondaryOptions,
|
|
2420
|
+
selectedTerm: secondaryKeyword,
|
|
2421
|
+
onSelect: (term) => onSelectSecondary(term)
|
|
2422
|
+
}
|
|
2423
|
+
),
|
|
2213
2424
|
suggestedKeywords.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
2214
2425
|
SuggestedKeywordsCard,
|
|
2215
2426
|
{
|
|
@@ -2780,12 +2991,127 @@ function TabBar({ tabs, activeTab, onTabChange }) {
|
|
|
2780
2991
|
);
|
|
2781
2992
|
}
|
|
2782
2993
|
|
|
2994
|
+
// src/components/OnboardingPopup.tsx
|
|
2995
|
+
var import_jsx_runtime8 = require("react/jsx-runtime");
|
|
2996
|
+
function OnboardingInfoButton({ onClick }) {
|
|
2997
|
+
return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
2998
|
+
"button",
|
|
2999
|
+
{
|
|
3000
|
+
onClick: (e) => {
|
|
3001
|
+
e.stopPropagation();
|
|
3002
|
+
onClick();
|
|
3003
|
+
},
|
|
3004
|
+
onMouseDown: (e) => e.stopPropagation(),
|
|
3005
|
+
style: {
|
|
3006
|
+
background: "rgba(0,93,172,0.08)",
|
|
3007
|
+
border: "none",
|
|
3008
|
+
borderRadius: "50%",
|
|
3009
|
+
width: 20,
|
|
3010
|
+
height: 20,
|
|
3011
|
+
cursor: "pointer",
|
|
3012
|
+
padding: 0,
|
|
3013
|
+
display: "flex",
|
|
3014
|
+
alignItems: "center",
|
|
3015
|
+
justifyContent: "center",
|
|
3016
|
+
color: MJH_BLUE,
|
|
3017
|
+
flexShrink: 0
|
|
3018
|
+
},
|
|
3019
|
+
title: "How SEO Copilot works",
|
|
3020
|
+
"aria-label": "How SEO Copilot works",
|
|
3021
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("svg", { width: "13", height: "13", viewBox: "0 0 20 20", fill: "currentColor", "aria-hidden": "true", children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("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" }) })
|
|
3022
|
+
}
|
|
3023
|
+
);
|
|
3024
|
+
}
|
|
3025
|
+
function OnboardingCard({ onDismiss, closing }) {
|
|
3026
|
+
return /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(import_jsx_runtime8.Fragment, { children: [
|
|
3027
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
3028
|
+
"div",
|
|
3029
|
+
{
|
|
3030
|
+
onClick: onDismiss,
|
|
3031
|
+
style: {
|
|
3032
|
+
position: "absolute",
|
|
3033
|
+
inset: 0,
|
|
3034
|
+
zIndex: 60,
|
|
3035
|
+
background: "transparent",
|
|
3036
|
+
cursor: "pointer"
|
|
3037
|
+
}
|
|
3038
|
+
}
|
|
3039
|
+
),
|
|
3040
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(
|
|
3041
|
+
"div",
|
|
3042
|
+
{
|
|
3043
|
+
onClick: (e) => e.stopPropagation(),
|
|
3044
|
+
style: {
|
|
3045
|
+
position: "absolute",
|
|
3046
|
+
top: 50,
|
|
3047
|
+
right: 10,
|
|
3048
|
+
left: 10,
|
|
3049
|
+
maxWidth: 320,
|
|
3050
|
+
marginLeft: "auto",
|
|
3051
|
+
zIndex: 61,
|
|
3052
|
+
borderRadius: 18,
|
|
3053
|
+
padding: "14px 16px 16px",
|
|
3054
|
+
// Amorphous blue glass
|
|
3055
|
+
background: "linear-gradient(155deg, rgba(0,93,172,0.16), rgba(0,93,172,0.08))",
|
|
3056
|
+
backdropFilter: "blur(20px) saturate(170%)",
|
|
3057
|
+
WebkitBackdropFilter: "blur(20px) saturate(170%)",
|
|
3058
|
+
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)",
|
|
3059
|
+
animation: `${closing ? "onboard-out" : "onboard-in"} ${closing ? 180 : 240}ms ease-out forwards`
|
|
3060
|
+
},
|
|
3061
|
+
children: [
|
|
3062
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("div", { style: { display: "flex", alignItems: "center", justifyContent: "space-between", gap: 8, marginBottom: 6 }, children: [
|
|
3063
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)("span", { style: { fontSize: 13, fontWeight: 800, color: "#00468a", letterSpacing: "-0.01em" }, children: "Welcome to SEO Copilot" }),
|
|
3064
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
3065
|
+
"button",
|
|
3066
|
+
{
|
|
3067
|
+
onClick: onDismiss,
|
|
3068
|
+
style: { background: "none", border: "none", cursor: "pointer", padding: 2, display: "flex", color: "#00468a", opacity: 0.7 },
|
|
3069
|
+
title: "Dismiss",
|
|
3070
|
+
"aria-label": "Dismiss",
|
|
3071
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("svg", { width: "14", height: "14", viewBox: "0 0 20 20", fill: "currentColor", children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("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" }) })
|
|
3072
|
+
}
|
|
3073
|
+
)
|
|
3074
|
+
] }),
|
|
3075
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("div", { style: { fontSize: 11.5, color: "#13335a", lineHeight: 1.6 }, children: [
|
|
3076
|
+
"Start on the ",
|
|
3077
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)("strong", { children: "Keywords" }),
|
|
3078
|
+
" tab. Choose one ",
|
|
3079
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)("strong", { children: "Primary" }),
|
|
3080
|
+
" keyword (required) and, optionally, one ",
|
|
3081
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)("strong", { children: "Secondary" }),
|
|
3082
|
+
" keyword. Copilot then optimizes the whole article - title, meta, URL, headings, and images - toward both."
|
|
3083
|
+
] }),
|
|
3084
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
3085
|
+
"button",
|
|
3086
|
+
{
|
|
3087
|
+
onClick: onDismiss,
|
|
3088
|
+
style: {
|
|
3089
|
+
marginTop: 12,
|
|
3090
|
+
width: "100%",
|
|
3091
|
+
padding: "7px 12px",
|
|
3092
|
+
fontSize: 11.5,
|
|
3093
|
+
fontWeight: 700,
|
|
3094
|
+
color: "#ffffff",
|
|
3095
|
+
background: MJH_BLUE,
|
|
3096
|
+
border: "none",
|
|
3097
|
+
borderRadius: 8,
|
|
3098
|
+
cursor: "pointer"
|
|
3099
|
+
},
|
|
3100
|
+
children: "Got it"
|
|
3101
|
+
}
|
|
3102
|
+
)
|
|
3103
|
+
]
|
|
3104
|
+
}
|
|
3105
|
+
)
|
|
3106
|
+
] });
|
|
3107
|
+
}
|
|
3108
|
+
|
|
2783
3109
|
// src/components/tabs/SummaryTab.tsx
|
|
2784
3110
|
var import_react13 = require("react");
|
|
2785
3111
|
|
|
2786
3112
|
// src/components/ShimmerLoader.tsx
|
|
2787
3113
|
var import_react12 = require("react");
|
|
2788
|
-
var
|
|
3114
|
+
var import_jsx_runtime9 = require("react/jsx-runtime");
|
|
2789
3115
|
var keyframesInjected = false;
|
|
2790
3116
|
var KEYFRAMES = `
|
|
2791
3117
|
@keyframes seo-copilot-text-shimmer {
|
|
@@ -2794,13 +3120,13 @@ var KEYFRAMES = `
|
|
|
2794
3120
|
}
|
|
2795
3121
|
`;
|
|
2796
3122
|
function LoaderBars({ color = MJH_GOLD }) {
|
|
2797
|
-
return /* @__PURE__ */ (0,
|
|
3123
|
+
return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
2798
3124
|
"div",
|
|
2799
3125
|
{
|
|
2800
3126
|
role: "status",
|
|
2801
3127
|
"aria-label": "Loading",
|
|
2802
3128
|
style: { display: "inline-flex", alignItems: "flex-end", gap: 2, height: 14, flexShrink: 0 },
|
|
2803
|
-
children: [1, 2, 3].map((i) => /* @__PURE__ */ (0,
|
|
3129
|
+
children: [1, 2, 3].map((i) => /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
2804
3130
|
"div",
|
|
2805
3131
|
{
|
|
2806
3132
|
style: {
|
|
@@ -2840,7 +3166,7 @@ function ShimmerLoader({
|
|
|
2840
3166
|
return () => clearInterval(id);
|
|
2841
3167
|
}, [messages.length, intervalMs]);
|
|
2842
3168
|
const text = messages[idx] || messages[0] || "";
|
|
2843
|
-
return /* @__PURE__ */ (0,
|
|
3169
|
+
return /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(
|
|
2844
3170
|
"div",
|
|
2845
3171
|
{
|
|
2846
3172
|
style: {
|
|
@@ -2852,8 +3178,8 @@ function ShimmerLoader({
|
|
|
2852
3178
|
letterSpacing: "0.01em"
|
|
2853
3179
|
},
|
|
2854
3180
|
children: [
|
|
2855
|
-
/* @__PURE__ */ (0,
|
|
2856
|
-
/* @__PURE__ */ (0,
|
|
3181
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(LoaderBars, { color: iconColor }),
|
|
3182
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
2857
3183
|
"span",
|
|
2858
3184
|
{
|
|
2859
3185
|
style: {
|
|
@@ -2883,6 +3209,12 @@ var DEFAULT_GENERATE_ALL_MESSAGES = [
|
|
|
2883
3209
|
];
|
|
2884
3210
|
|
|
2885
3211
|
// src/lib/scoring.ts
|
|
3212
|
+
function countWholeMatches(haystack, needle) {
|
|
3213
|
+
if (!needle) return 0;
|
|
3214
|
+
const esc = needle.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
3215
|
+
const m = haystack.match(new RegExp(`\\b${esc}\\b`, "g"));
|
|
3216
|
+
return m ? m.length : 0;
|
|
3217
|
+
}
|
|
2886
3218
|
function calculateContentScoreDetailed(content, analysis, documentFields) {
|
|
2887
3219
|
if (!content || !analysis) {
|
|
2888
3220
|
return { total: 0, components: [] };
|
|
@@ -2892,24 +3224,34 @@ function calculateContentScoreDetailed(content, analysis, documentFields) {
|
|
|
2892
3224
|
const components = [];
|
|
2893
3225
|
const primaryTerm = (analysis.primaryKeyword?.term || "").toLowerCase();
|
|
2894
3226
|
if (primaryTerm) {
|
|
2895
|
-
const
|
|
2896
|
-
const
|
|
2897
|
-
|
|
2898
|
-
|
|
3227
|
+
const tokens = primaryTerm.split(/\s+/).filter((t) => t.length > 1);
|
|
3228
|
+
const phraseCount = countWholeMatches(lowerContent, primaryTerm);
|
|
3229
|
+
let occurrences = phraseCount;
|
|
3230
|
+
let viaTokens = false;
|
|
3231
|
+
if (phraseCount === 0 && tokens.length > 0) {
|
|
3232
|
+
const counts = tokens.map((t) => countWholeMatches(lowerContent, t));
|
|
3233
|
+
if (counts.every((c) => c > 0)) {
|
|
3234
|
+
occurrences = Math.min(...counts);
|
|
3235
|
+
viaTokens = true;
|
|
3236
|
+
}
|
|
3237
|
+
}
|
|
2899
3238
|
const primaryWordCount = Math.max(1, primaryTerm.split(/\s+/).filter(Boolean).length);
|
|
2900
3239
|
let pts = 0;
|
|
2901
3240
|
let detail;
|
|
2902
|
-
if (
|
|
3241
|
+
if (occurrences === 0) {
|
|
2903
3242
|
detail = `Primary keyword "${primaryTerm}" not found in content`;
|
|
2904
3243
|
} else {
|
|
2905
3244
|
pts += 12;
|
|
2906
|
-
const density = words > 0 ?
|
|
3245
|
+
const density = words > 0 ? (viaTokens ? occurrences : occurrences * primaryWordCount) / words * 100 : 0;
|
|
2907
3246
|
if (density >= 0.5 && density <= 2.5) {
|
|
2908
3247
|
pts += 13;
|
|
2909
3248
|
detail = `Primary keyword present, density ${density.toFixed(2)}% (ideal range)`;
|
|
2910
3249
|
} else if (density < 0.5) {
|
|
2911
3250
|
pts += 7;
|
|
2912
3251
|
detail = `Primary keyword present but density only ${density.toFixed(2)}% - aim for 0.5-2.5%`;
|
|
3252
|
+
} else if (viaTokens && density <= 6) {
|
|
3253
|
+
pts += 11;
|
|
3254
|
+
detail = `Primary keyword strongly represented (${density.toFixed(2)}%)`;
|
|
2913
3255
|
} else {
|
|
2914
3256
|
pts += 4;
|
|
2915
3257
|
detail = `Primary keyword over-used at ${density.toFixed(2)}% density - reduce to 0.5-2.5%`;
|
|
@@ -2953,7 +3295,8 @@ function calculateContentScoreDetailed(content, analysis, documentFields) {
|
|
|
2953
3295
|
if (documentFields) {
|
|
2954
3296
|
hasH1orTitle = !!(documentFields.title && documentFields.title.trim());
|
|
2955
3297
|
const det = documentFields.headingsDetailed;
|
|
2956
|
-
|
|
3298
|
+
const detHasSub = Array.isArray(det) && det.some((h) => h.level >= 2);
|
|
3299
|
+
hasSubheadings = detHasSub || (documentFields.headings?.length || 0) > 0;
|
|
2957
3300
|
} else {
|
|
2958
3301
|
hasH1orTitle = /^#\s|<h1/im.test(content);
|
|
2959
3302
|
hasSubheadings = /^##\s|^###\s|<h2|<h3/im.test(content);
|
|
@@ -2981,8 +3324,7 @@ function calculateContentScoreDetailed(content, analysis, documentFields) {
|
|
|
2981
3324
|
if (documentFields) {
|
|
2982
3325
|
qCount = (documentFields.headings || []).filter((h) => h.trim().endsWith("?")).length;
|
|
2983
3326
|
} else {
|
|
2984
|
-
|
|
2985
|
-
qCount = questionHeadings?.length || 0;
|
|
3327
|
+
qCount = (content.match(/^#{1,6}\s+.*\?$/gm) || []).length + (content.match(/<h[1-6][^>]*>.*\?<\/h[1-6]>/gi) || []).length;
|
|
2986
3328
|
}
|
|
2987
3329
|
let aeoPts = 0;
|
|
2988
3330
|
if (qCount >= 3) aeoPts = 10;
|
|
@@ -3002,9 +3344,22 @@ function tokensContain(haystack, needle) {
|
|
|
3002
3344
|
const lower = haystack.toLowerCase();
|
|
3003
3345
|
return tokens.every((t) => lower.includes(t));
|
|
3004
3346
|
}
|
|
3347
|
+
function keywordLeadsSlug(slug, primaryKeyword) {
|
|
3348
|
+
const slugWords = slug.toLowerCase().replace(/[^a-z0-9]+/g, " ").trim().split(/\s+/).filter(Boolean);
|
|
3349
|
+
const tokens = primaryKeyword.toLowerCase().split(/\s+/).filter((t) => t.length > 1);
|
|
3350
|
+
if (tokens.length === 0 || slugWords.length === 0) return true;
|
|
3351
|
+
let earliest = Infinity;
|
|
3352
|
+
for (const t of tokens) {
|
|
3353
|
+
const idx = slugWords.findIndex((w) => w.includes(t));
|
|
3354
|
+
if (idx >= 0) earliest = Math.min(earliest, idx);
|
|
3355
|
+
}
|
|
3356
|
+
return earliest <= 2;
|
|
3357
|
+
}
|
|
3005
3358
|
function isShortFormContent(documentFields, title) {
|
|
3359
|
+
const cat = (documentFields?.contentCategory || "").toLowerCase().trim();
|
|
3360
|
+
if (/^(videos?|podcasts?|episodes?|webinars?|video series|peer exchange)$/.test(cat)) return true;
|
|
3006
3361
|
const shortFormCats = /* @__PURE__ */ new Set(["news", "brief", "preview", "recap", "update", "announcement", "roundup", "digest", "interview"]);
|
|
3007
|
-
const catTokens =
|
|
3362
|
+
const catTokens = cat.split(/[^a-z]+/).filter(Boolean);
|
|
3008
3363
|
if (catTokens.some((tok) => shortFormCats.has(tok))) return true;
|
|
3009
3364
|
const t = (title || "").toLowerCase();
|
|
3010
3365
|
if (/\b(preview|recap|roundup|digest)\b/.test(t)) return true;
|
|
@@ -3014,7 +3369,8 @@ function isShortFormContent(documentFields, title) {
|
|
|
3014
3369
|
function buildSummaryItems(input) {
|
|
3015
3370
|
const items = [];
|
|
3016
3371
|
const { analysis, deepAnalysis, documentFields, linkingSuggestions, linkCheckResults, text } = input;
|
|
3017
|
-
const primaryKeyword = analysis?.primaryKeyword?.term;
|
|
3372
|
+
const primaryKeyword = input.primaryKeyword || analysis?.primaryKeyword?.term;
|
|
3373
|
+
const secondaryKeyword = input.secondaryKeyword || "";
|
|
3018
3374
|
const title = documentFields?.title;
|
|
3019
3375
|
if (!title) {
|
|
3020
3376
|
items.push({
|
|
@@ -3110,39 +3466,40 @@ function buildSummaryItems(input) {
|
|
|
3110
3466
|
items.push({
|
|
3111
3467
|
id: "meta-slug-missing",
|
|
3112
3468
|
category: "meta",
|
|
3113
|
-
severity: "
|
|
3469
|
+
severity: "warning",
|
|
3114
3470
|
label: "URL slug missing",
|
|
3115
3471
|
description: "No URL slug set.",
|
|
3116
|
-
howToFix: "Add a
|
|
3117
|
-
jumpTo: { tab: "
|
|
3472
|
+
howToFix: "Add a short, descriptive slug that leads with your primary keyword.",
|
|
3473
|
+
jumpTo: { tab: "technical", anchorId: "anchor-url-slug" }
|
|
3118
3474
|
});
|
|
3119
3475
|
} else {
|
|
3120
|
-
|
|
3476
|
+
const slugAsWords = slug.replace(/-/g, " ");
|
|
3477
|
+
if (primaryKeyword && !tokensContain(slugAsWords, primaryKeyword)) {
|
|
3121
3478
|
items.push({
|
|
3122
|
-
id: "meta-slug-
|
|
3479
|
+
id: "meta-slug-no-keyword",
|
|
3123
3480
|
category: "meta",
|
|
3124
|
-
severity: "
|
|
3125
|
-
label: "
|
|
3126
|
-
description: `
|
|
3127
|
-
howToFix: "
|
|
3128
|
-
jumpTo: { tab: "
|
|
3481
|
+
severity: "opportunity",
|
|
3482
|
+
label: "Primary keyword not in URL",
|
|
3483
|
+
description: `The URL doesn't include "${primaryKeyword}".`,
|
|
3484
|
+
howToFix: "Work the primary keyword into the URL, ideally at the start. Keep the URL short and descriptive.",
|
|
3485
|
+
jumpTo: { tab: "technical", anchorId: "anchor-url-slug" }
|
|
3129
3486
|
});
|
|
3130
|
-
}
|
|
3131
|
-
if (primaryKeyword && !tokensContain(slug.replace(/-/g, " "), primaryKeyword)) {
|
|
3487
|
+
} else if (primaryKeyword && !keywordLeadsSlug(slug, primaryKeyword)) {
|
|
3132
3488
|
items.push({
|
|
3133
|
-
id: "meta-slug-
|
|
3489
|
+
id: "meta-slug-keyword-late",
|
|
3134
3490
|
category: "meta",
|
|
3135
3491
|
severity: "opportunity",
|
|
3136
|
-
label: "Primary keyword
|
|
3137
|
-
description: `
|
|
3138
|
-
howToFix: "
|
|
3139
|
-
jumpTo: { tab: "
|
|
3492
|
+
label: "Primary keyword late in URL",
|
|
3493
|
+
description: `"${primaryKeyword}" is in the URL but not near the start.`,
|
|
3494
|
+
howToFix: "Lead the URL with the primary keyword so it stays visible if the address gets shortened.",
|
|
3495
|
+
jumpTo: { tab: "technical", anchorId: "anchor-url-slug" }
|
|
3140
3496
|
});
|
|
3141
3497
|
}
|
|
3142
3498
|
}
|
|
3143
3499
|
const wordCount2 = text ? text.trim().split(/\s+/).filter(Boolean).length : 0;
|
|
3500
|
+
const isShortForm = isShortFormContent(documentFields, title);
|
|
3144
3501
|
if (wordCount2 === 0) {
|
|
3145
|
-
} else if (wordCount2 < 450) {
|
|
3502
|
+
} else if (wordCount2 < 450 && !isShortForm) {
|
|
3146
3503
|
items.push({
|
|
3147
3504
|
id: "content-too-short",
|
|
3148
3505
|
category: "content",
|
|
@@ -3152,7 +3509,7 @@ function buildSummaryItems(input) {
|
|
|
3152
3509
|
howToFix: "Add more body text. A link or image on its own doesn't count - the article needs real written substance.",
|
|
3153
3510
|
jumpTo: { tab: "technical", anchorId: "anchor-word-count" }
|
|
3154
3511
|
});
|
|
3155
|
-
} else if (wordCount2 < 1500 && !
|
|
3512
|
+
} else if (wordCount2 < 1500 && !isShortForm) {
|
|
3156
3513
|
items.push({
|
|
3157
3514
|
id: "content-short-for-clinical",
|
|
3158
3515
|
category: "content",
|
|
@@ -3305,7 +3662,7 @@ function buildSummaryItems(input) {
|
|
|
3305
3662
|
}
|
|
3306
3663
|
const imageTitleCount = (documentFields?.imageTitles || []).length;
|
|
3307
3664
|
const totalImageCount = documentFields?.imageCount ?? 0;
|
|
3308
|
-
const missingTitles = totalImageCount > 0 ? totalImageCount - imageTitleCount : 0;
|
|
3665
|
+
const missingTitles = totalImageCount > 0 && imageTitleCount > 0 ? totalImageCount - imageTitleCount : 0;
|
|
3309
3666
|
if (missingTitles > 0) {
|
|
3310
3667
|
items.push({
|
|
3311
3668
|
id: "images-titles-missing",
|
|
@@ -3331,7 +3688,7 @@ function buildSummaryItems(input) {
|
|
|
3331
3688
|
});
|
|
3332
3689
|
}
|
|
3333
3690
|
const primaryVolume = analysis?.primaryKeyword?.volume;
|
|
3334
|
-
if (deepAnalysis &&
|
|
3691
|
+
if (deepAnalysis && primaryVolume === 0) {
|
|
3335
3692
|
items.push({
|
|
3336
3693
|
id: "keywords-primary-zero-volume",
|
|
3337
3694
|
category: "keywords",
|
|
@@ -3343,6 +3700,55 @@ function buildSummaryItems(input) {
|
|
|
3343
3700
|
});
|
|
3344
3701
|
}
|
|
3345
3702
|
}
|
|
3703
|
+
if (secondaryKeyword) {
|
|
3704
|
+
if (text && !tokensContain(text, secondaryKeyword)) {
|
|
3705
|
+
items.push({
|
|
3706
|
+
id: "secondary-not-in-body",
|
|
3707
|
+
category: "keywords",
|
|
3708
|
+
severity: "opportunity",
|
|
3709
|
+
label: "Secondary keyword not in body",
|
|
3710
|
+
description: `Your secondary keyword "${secondaryKeyword}" doesn't appear in the article body.`,
|
|
3711
|
+
howToFix: "Work the secondary keyword into a body paragraph or two where it reads naturally.",
|
|
3712
|
+
jumpTo: { tab: "keywords" }
|
|
3713
|
+
});
|
|
3714
|
+
}
|
|
3715
|
+
const titleVal = documentFields?.title;
|
|
3716
|
+
if (titleVal && !tokensContain(titleVal, secondaryKeyword)) {
|
|
3717
|
+
items.push({
|
|
3718
|
+
id: "secondary-not-in-title",
|
|
3719
|
+
category: "meta",
|
|
3720
|
+
severity: "opportunity",
|
|
3721
|
+
label: "Secondary keyword not in title",
|
|
3722
|
+
description: `The title leads with the primary keyword but doesn't include "${secondaryKeyword}".`,
|
|
3723
|
+
howToFix: "If it fits naturally, include the secondary keyword in the title too - but never at the cost of the primary leading.",
|
|
3724
|
+
jumpTo: { tab: "meta", anchorId: "anchor-meta-title" }
|
|
3725
|
+
});
|
|
3726
|
+
}
|
|
3727
|
+
const metaVal = documentFields?.metaDescription;
|
|
3728
|
+
if (metaVal && !tokensContain(metaVal, secondaryKeyword)) {
|
|
3729
|
+
items.push({
|
|
3730
|
+
id: "secondary-not-in-meta",
|
|
3731
|
+
category: "meta",
|
|
3732
|
+
severity: "opportunity",
|
|
3733
|
+
label: "Secondary keyword not in meta description",
|
|
3734
|
+
description: `The meta description doesn't include "${secondaryKeyword}".`,
|
|
3735
|
+
howToFix: "Add the secondary keyword to the meta description if it reads naturally.",
|
|
3736
|
+
jumpTo: { tab: "meta", anchorId: "anchor-meta-description" }
|
|
3737
|
+
});
|
|
3738
|
+
}
|
|
3739
|
+
const slugVal = documentFields?.slug;
|
|
3740
|
+
if (slugVal && !tokensContain(slugVal.replace(/-/g, " "), secondaryKeyword)) {
|
|
3741
|
+
items.push({
|
|
3742
|
+
id: "secondary-not-in-url",
|
|
3743
|
+
category: "meta",
|
|
3744
|
+
severity: "opportunity",
|
|
3745
|
+
label: "Secondary keyword not in URL",
|
|
3746
|
+
description: `The URL doesn't include "${secondaryKeyword}".`,
|
|
3747
|
+
howToFix: "Optionally include the secondary keyword in the URL after the primary - only if the slug stays short and clean.",
|
|
3748
|
+
jumpTo: { tab: "technical", anchorId: "anchor-url-slug" }
|
|
3749
|
+
});
|
|
3750
|
+
}
|
|
3751
|
+
}
|
|
3346
3752
|
const actualQuestionHeadings = (documentFields?.headings || []).filter((h) => h.trim().endsWith("?"));
|
|
3347
3753
|
if (deepAnalysis && actualQuestionHeadings.length === 0 && wordCount2 > 300) {
|
|
3348
3754
|
items.push({
|
|
@@ -3453,7 +3859,7 @@ function buildSummaryItems(input) {
|
|
|
3453
3859
|
}
|
|
3454
3860
|
|
|
3455
3861
|
// src/components/tabs/SummaryTab.tsx
|
|
3456
|
-
var
|
|
3862
|
+
var import_jsx_runtime10 = require("react/jsx-runtime");
|
|
3457
3863
|
var cardStyle2 = {
|
|
3458
3864
|
borderRadius: 14,
|
|
3459
3865
|
background: "rgba(255,255,255,0.55)",
|
|
@@ -3477,9 +3883,9 @@ function scoreColors(score) {
|
|
|
3477
3883
|
}
|
|
3478
3884
|
function ScoreBadge({ score, breakdown }) {
|
|
3479
3885
|
const c = scoreColors(score);
|
|
3480
|
-
return /* @__PURE__ */ (0,
|
|
3481
|
-
/* @__PURE__ */ (0,
|
|
3482
|
-
/* @__PURE__ */ (0,
|
|
3886
|
+
return /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { style: cardStyle2, children: [
|
|
3887
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { style: { display: "flex", alignItems: "center", gap: 14 }, children: [
|
|
3888
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(
|
|
3483
3889
|
"div",
|
|
3484
3890
|
{
|
|
3485
3891
|
style: {
|
|
@@ -3495,30 +3901,30 @@ function ScoreBadge({ score, breakdown }) {
|
|
|
3495
3901
|
lineHeight: 1
|
|
3496
3902
|
},
|
|
3497
3903
|
children: [
|
|
3498
|
-
/* @__PURE__ */ (0,
|
|
3499
|
-
/* @__PURE__ */ (0,
|
|
3904
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)("span", { style: { fontSize: 20, fontWeight: 700, color: c.text }, children: score }),
|
|
3905
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)("span", { style: { fontSize: 8, fontWeight: 700, color: c.text, opacity: 0.7, letterSpacing: "0.06em", marginTop: 2 }, children: "/ 100" })
|
|
3500
3906
|
]
|
|
3501
3907
|
}
|
|
3502
3908
|
),
|
|
3503
|
-
/* @__PURE__ */ (0,
|
|
3504
|
-
/* @__PURE__ */ (0,
|
|
3505
|
-
/* @__PURE__ */ (0,
|
|
3909
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { style: { flex: 1, minWidth: 0 }, children: [
|
|
3910
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)("div", { style: { fontSize: 10.5, textTransform: "uppercase", letterSpacing: "0.06em", color: "#4b5563", fontWeight: 600, marginBottom: 2 }, children: "Content Score" }),
|
|
3911
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)("div", { style: { fontSize: 14, fontWeight: 700, color: c.text }, children: c.label })
|
|
3506
3912
|
] })
|
|
3507
3913
|
] }),
|
|
3508
|
-
breakdown.length > 0 && /* @__PURE__ */ (0,
|
|
3914
|
+
breakdown.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("div", { style: { marginTop: 12, display: "flex", flexDirection: "column", gap: 8 }, children: breakdown.map((comp, i) => {
|
|
3509
3915
|
const pct = comp.max > 0 ? comp.points / comp.max * 100 : 0;
|
|
3510
3916
|
const barColor = pct >= 75 ? "#16a34a" : pct >= 40 ? "#E6C01B" : "#dc2626";
|
|
3511
|
-
return /* @__PURE__ */ (0,
|
|
3512
|
-
/* @__PURE__ */ (0,
|
|
3513
|
-
/* @__PURE__ */ (0,
|
|
3514
|
-
/* @__PURE__ */ (0,
|
|
3917
|
+
return /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { children: [
|
|
3918
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { style: { display: "flex", justifyContent: "space-between", alignItems: "baseline", marginBottom: 3 }, children: [
|
|
3919
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)("span", { style: { fontSize: 11, fontWeight: 600, color: "#1f2937" }, children: comp.label }),
|
|
3920
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("span", { style: { fontSize: 11, color: "#4b5563", fontVariantNumeric: "tabular-nums" }, children: [
|
|
3515
3921
|
comp.points,
|
|
3516
3922
|
" / ",
|
|
3517
3923
|
comp.max
|
|
3518
3924
|
] })
|
|
3519
3925
|
] }),
|
|
3520
|
-
/* @__PURE__ */ (0,
|
|
3521
|
-
/* @__PURE__ */ (0,
|
|
3926
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)("div", { style: { height: 4, background: "#f1f5f9", borderRadius: 99, overflow: "hidden", marginBottom: 4 }, children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("div", { style: { width: `${pct}%`, height: "100%", background: barColor, transition: "width 200ms" } }) }),
|
|
3927
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)("div", { style: { fontSize: 10.5, color: "#4b5563", lineHeight: 1.4 }, children: comp.detail })
|
|
3522
3928
|
] }, i);
|
|
3523
3929
|
}) })
|
|
3524
3930
|
] });
|
|
@@ -3532,7 +3938,7 @@ function ItemCard({ item, onClick }) {
|
|
|
3532
3938
|
const v = severityVisual(item.severity);
|
|
3533
3939
|
const tab = item.jumpTo.tab;
|
|
3534
3940
|
const tabLabel = TAB_LABEL[tab] ?? tab.charAt(0).toUpperCase() + tab.slice(1);
|
|
3535
|
-
return /* @__PURE__ */ (0,
|
|
3941
|
+
return /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(
|
|
3536
3942
|
"div",
|
|
3537
3943
|
{
|
|
3538
3944
|
onClick,
|
|
@@ -3549,8 +3955,8 @@ function ItemCard({ item, onClick }) {
|
|
|
3549
3955
|
cursor: "pointer"
|
|
3550
3956
|
},
|
|
3551
3957
|
children: [
|
|
3552
|
-
/* @__PURE__ */ (0,
|
|
3553
|
-
/* @__PURE__ */ (0,
|
|
3958
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { style: { display: "flex", alignItems: "flex-start", gap: 9 }, children: [
|
|
3959
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
3554
3960
|
"div",
|
|
3555
3961
|
{
|
|
3556
3962
|
style: {
|
|
@@ -3563,12 +3969,12 @@ function ItemCard({ item, onClick }) {
|
|
|
3563
3969
|
}
|
|
3564
3970
|
}
|
|
3565
3971
|
),
|
|
3566
|
-
/* @__PURE__ */ (0,
|
|
3567
|
-
/* @__PURE__ */ (0,
|
|
3568
|
-
/* @__PURE__ */ (0,
|
|
3972
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { style: { flex: 1, minWidth: 0 }, children: [
|
|
3973
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)("div", { style: { fontSize: 12, fontWeight: 700, color: "#1f2937", marginBottom: 2 }, children: item.label }),
|
|
3974
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)("div", { style: { fontSize: 11, color: "#374151", lineHeight: 1.5 }, children: item.description })
|
|
3569
3975
|
] })
|
|
3570
3976
|
] }),
|
|
3571
|
-
/* @__PURE__ */ (0,
|
|
3977
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(
|
|
3572
3978
|
"div",
|
|
3573
3979
|
{
|
|
3574
3980
|
style: {
|
|
@@ -3580,12 +3986,12 @@ function ItemCard({ item, onClick }) {
|
|
|
3580
3986
|
lineHeight: 1.55
|
|
3581
3987
|
},
|
|
3582
3988
|
children: [
|
|
3583
|
-
/* @__PURE__ */ (0,
|
|
3989
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)("span", { style: { fontWeight: 700, color: "#4b5563", letterSpacing: "0.04em", fontSize: 9.5, textTransform: "uppercase", marginRight: 6 }, children: "Fix" }),
|
|
3584
3990
|
item.howToFix
|
|
3585
3991
|
]
|
|
3586
3992
|
}
|
|
3587
3993
|
),
|
|
3588
|
-
item.jumpTo.tab !== "summary" && /* @__PURE__ */ (0,
|
|
3994
|
+
item.jumpTo.tab !== "summary" && /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("div", { style: { display: "flex", justifyContent: "flex-end" }, children: /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("span", { style: { fontSize: 10, fontWeight: 700, color: MJH_BLUE }, children: [
|
|
3589
3995
|
"Go to ",
|
|
3590
3996
|
tabLabel,
|
|
3591
3997
|
" \u203A"
|
|
@@ -3601,7 +4007,7 @@ function FilterChip({
|
|
|
3601
4007
|
count,
|
|
3602
4008
|
dotColor
|
|
3603
4009
|
}) {
|
|
3604
|
-
return /* @__PURE__ */ (0,
|
|
4010
|
+
return /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(
|
|
3605
4011
|
"button",
|
|
3606
4012
|
{
|
|
3607
4013
|
onClick,
|
|
@@ -3620,9 +4026,9 @@ function FilterChip({
|
|
|
3620
4026
|
transition: "all 150ms"
|
|
3621
4027
|
},
|
|
3622
4028
|
children: [
|
|
3623
|
-
dotColor && /* @__PURE__ */ (0,
|
|
3624
|
-
/* @__PURE__ */ (0,
|
|
3625
|
-
/* @__PURE__ */ (0,
|
|
4029
|
+
dotColor && /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("span", { style: { width: 6, height: 6, borderRadius: "50%", background: dotColor, display: "inline-block" } }),
|
|
4030
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)("span", { children: label }),
|
|
4031
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)("span", { style: { fontSize: 10, opacity: 0.8 }, children: count })
|
|
3626
4032
|
]
|
|
3627
4033
|
}
|
|
3628
4034
|
);
|
|
@@ -3634,14 +4040,17 @@ function SummaryTab({
|
|
|
3634
4040
|
documentFields,
|
|
3635
4041
|
linkingSuggestions,
|
|
3636
4042
|
linkCheckResults,
|
|
4043
|
+
primaryKeyword,
|
|
4044
|
+
secondaryKeyword,
|
|
3637
4045
|
isAnyLoading,
|
|
3638
4046
|
onGenerateAll,
|
|
3639
4047
|
onItemClick
|
|
3640
4048
|
}) {
|
|
3641
4049
|
const scoreDetail = (0, import_react13.useMemo)(() => {
|
|
3642
4050
|
if (!analysis) return null;
|
|
3643
|
-
|
|
3644
|
-
|
|
4051
|
+
const scored = primaryKeyword && primaryKeyword !== analysis.primaryKeyword?.term ? { ...analysis, primaryKeyword: { ...analysis.primaryKeyword, term: primaryKeyword } } : analysis;
|
|
4052
|
+
return calculateContentScoreDetailed(text, scored, documentFields);
|
|
4053
|
+
}, [text, analysis, documentFields, primaryKeyword]);
|
|
3645
4054
|
const score = scoreDetail?.total ?? null;
|
|
3646
4055
|
const items = (0, import_react13.useMemo)(
|
|
3647
4056
|
() => buildSummaryItems({
|
|
@@ -3651,9 +4060,11 @@ function SummaryTab({
|
|
|
3651
4060
|
contentScore: score,
|
|
3652
4061
|
linkingSuggestions,
|
|
3653
4062
|
linkCheckResults,
|
|
3654
|
-
text
|
|
4063
|
+
text,
|
|
4064
|
+
primaryKeyword,
|
|
4065
|
+
secondaryKeyword
|
|
3655
4066
|
}),
|
|
3656
|
-
[analysis, deepAnalysis, documentFields, score, linkingSuggestions, linkCheckResults, text]
|
|
4067
|
+
[analysis, deepAnalysis, documentFields, score, linkingSuggestions, linkCheckResults, text, primaryKeyword, secondaryKeyword]
|
|
3657
4068
|
);
|
|
3658
4069
|
const [filter, setFilter] = (0, import_react13.useState)("all");
|
|
3659
4070
|
const counts = (0, import_react13.useMemo)(
|
|
@@ -3667,15 +4078,15 @@ function SummaryTab({
|
|
|
3667
4078
|
);
|
|
3668
4079
|
const filtered = filter === "all" ? items : items.filter((i) => i.severity === filter);
|
|
3669
4080
|
if (!analysis) {
|
|
3670
|
-
return /* @__PURE__ */ (0,
|
|
3671
|
-
/* @__PURE__ */ (0,
|
|
3672
|
-
/* @__PURE__ */ (0,
|
|
4081
|
+
return /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { style: { padding: 24, textAlign: "center" }, children: [
|
|
4082
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)("div", { style: { fontSize: 13, color: "#4b5563", fontWeight: 500 }, children: "Start with the Keywords tab" }),
|
|
4083
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)("div", { style: { fontSize: 11, color: "#4b5563", marginTop: 4 }, children: "Once keywords are analyzed, the summary appears here." })
|
|
3673
4084
|
] });
|
|
3674
4085
|
}
|
|
3675
|
-
return /* @__PURE__ */ (0,
|
|
3676
|
-
score != null && scoreDetail && /* @__PURE__ */ (0,
|
|
3677
|
-
/* @__PURE__ */ (0,
|
|
3678
|
-
isAnyLoading ? /* @__PURE__ */ (0,
|
|
4086
|
+
return /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { style: { padding: 12, display: "flex", flexDirection: "column", gap: 12 }, children: [
|
|
4087
|
+
score != null && scoreDetail && /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(ScoreBadge, { score, breakdown: scoreDetail.components }),
|
|
4088
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { style: cardStyle2, children: [
|
|
4089
|
+
isAnyLoading ? /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("div", { style: { display: "flex", alignItems: "center", justifyContent: "center", padding: "4px 0" }, children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(ShimmerLoader, { messages: DEFAULT_GENERATE_ALL_MESSAGES }) }) : /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
3679
4090
|
"button",
|
|
3680
4091
|
{
|
|
3681
4092
|
onClick: onGenerateAll,
|
|
@@ -3700,27 +4111,27 @@ function SummaryTab({
|
|
|
3700
4111
|
transition: "all 150ms",
|
|
3701
4112
|
letterSpacing: "0.01em"
|
|
3702
4113
|
},
|
|
3703
|
-
children: "
|
|
4114
|
+
children: "Run all analyses"
|
|
3704
4115
|
}
|
|
3705
4116
|
),
|
|
3706
|
-
/* @__PURE__ */ (0,
|
|
4117
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { style: { fontSize: 10.5, color: "#4b5563", marginTop: 8, lineHeight: 1.5 }, children: [
|
|
3707
4118
|
"Runs the analyses that fill the ",
|
|
3708
|
-
/* @__PURE__ */ (0,
|
|
4119
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)("strong", { children: "AEO/GEO" }),
|
|
3709
4120
|
", ",
|
|
3710
|
-
/* @__PURE__ */ (0,
|
|
4121
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)("strong", { children: "Linking" }),
|
|
3711
4122
|
", and ",
|
|
3712
|
-
/* @__PURE__ */ (0,
|
|
4123
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)("strong", { children: "Other Recs" }),
|
|
3713
4124
|
" tabs. New issues they find appear in this Summary as each one finishes."
|
|
3714
4125
|
] })
|
|
3715
4126
|
] }),
|
|
3716
|
-
/* @__PURE__ */ (0,
|
|
3717
|
-
/* @__PURE__ */ (0,
|
|
3718
|
-
/* @__PURE__ */ (0,
|
|
3719
|
-
/* @__PURE__ */ (0,
|
|
3720
|
-
/* @__PURE__ */ (0,
|
|
4127
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { style: { display: "flex", flexWrap: "wrap", gap: 6 }, children: [
|
|
4128
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)(FilterChip, { active: filter === "all", onClick: () => setFilter("all"), label: "All", count: counts.all }),
|
|
4129
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)(FilterChip, { active: filter === "error", onClick: () => setFilter("error"), label: "Errors", count: counts.error, dotColor: "#dc2626" }),
|
|
4130
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)(FilterChip, { active: filter === "warning", onClick: () => setFilter("warning"), label: "Warnings", count: counts.warning, dotColor: "#E6C01B" }),
|
|
4131
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)(FilterChip, { active: filter === "opportunity", onClick: () => setFilter("opportunity"), label: "Opportunities", count: counts.opportunity, dotColor: MJH_BLUE })
|
|
3721
4132
|
] }),
|
|
3722
|
-
/* @__PURE__ */ (0,
|
|
3723
|
-
/* @__PURE__ */ (0,
|
|
4133
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)("div", { id: "anchor-summary-issues", style: { display: "flex", flexDirection: "column", gap: 8 }, children: filtered.length === 0 ? /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("div", { style: { ...cardStyle2, textAlign: "center", padding: "20px 14px" }, children: items.length === 0 ? /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(import_jsx_runtime10.Fragment, { children: [
|
|
4134
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
3724
4135
|
"div",
|
|
3725
4136
|
{
|
|
3726
4137
|
style: {
|
|
@@ -3733,15 +4144,15 @@ function SummaryTab({
|
|
|
3733
4144
|
justifyContent: "center",
|
|
3734
4145
|
margin: "0 auto 8px"
|
|
3735
4146
|
},
|
|
3736
|
-
children: /* @__PURE__ */ (0,
|
|
4147
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("svg", { width: "20", height: "20", viewBox: "0 0 20 20", fill: "#16a34a", children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("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" }) })
|
|
3737
4148
|
}
|
|
3738
4149
|
),
|
|
3739
|
-
/* @__PURE__ */ (0,
|
|
3740
|
-
/* @__PURE__ */ (0,
|
|
3741
|
-
] }) : /* @__PURE__ */ (0,
|
|
3742
|
-
isAnyLoading && items.length > 0 && /* @__PURE__ */ (0,
|
|
3743
|
-
/* @__PURE__ */ (0,
|
|
3744
|
-
/* @__PURE__ */ (0,
|
|
4150
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)("div", { style: { fontSize: 13, color: "#16a34a", fontWeight: 700 }, children: "Looking good" }),
|
|
4151
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)("div", { style: { fontSize: 11, color: "#4b5563", marginTop: 2 }, children: "No issues found for this article." })
|
|
4152
|
+
] }) : /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("div", { style: { fontSize: 12, color: "#4b5563" }, children: "Nothing in this category." }) }) : filtered.map((item) => /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(ItemCard, { item, onClick: () => onItemClick(item) }, item.id)) }),
|
|
4153
|
+
isAnyLoading && items.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { style: { display: "flex", alignItems: "center", justifyContent: "center", gap: 6, padding: "4px 0" }, children: [
|
|
4154
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)(LoadingBars, { size: "xs", color: MJH_BLUE }),
|
|
4155
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)("span", { style: { fontSize: 10, color: "#4b5563" }, children: "Still checking..." })
|
|
3745
4156
|
] })
|
|
3746
4157
|
] });
|
|
3747
4158
|
}
|
|
@@ -3821,7 +4232,7 @@ function analyzeGEO(text, headings) {
|
|
|
3821
4232
|
}
|
|
3822
4233
|
|
|
3823
4234
|
// src/components/tabs/AEOTab.tsx
|
|
3824
|
-
var
|
|
4235
|
+
var import_jsx_runtime11 = require("react/jsx-runtime");
|
|
3825
4236
|
var AEO_PURPLE = "#005DAC";
|
|
3826
4237
|
var GEO_TEAL = "#C9A716";
|
|
3827
4238
|
var cardStyle3 = {
|
|
@@ -3833,7 +4244,7 @@ var cardStyle3 = {
|
|
|
3833
4244
|
padding: "14px"
|
|
3834
4245
|
};
|
|
3835
4246
|
function AiPill() {
|
|
3836
|
-
return /* @__PURE__ */ (0,
|
|
4247
|
+
return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
|
|
3837
4248
|
"span",
|
|
3838
4249
|
{
|
|
3839
4250
|
style: {
|
|
@@ -3852,10 +4263,10 @@ function AiPill() {
|
|
|
3852
4263
|
);
|
|
3853
4264
|
}
|
|
3854
4265
|
function SectionHeader2({ label, iconColor, ai }) {
|
|
3855
|
-
return /* @__PURE__ */ (0,
|
|
3856
|
-
/* @__PURE__ */ (0,
|
|
3857
|
-
/* @__PURE__ */ (0,
|
|
3858
|
-
ai && /* @__PURE__ */ (0,
|
|
4266
|
+
return /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("div", { style: { display: "flex", alignItems: "center", gap: 7, marginBottom: 4 }, children: [
|
|
4267
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)("div", { style: { width: 7, height: 7, borderRadius: "50%", background: iconColor, flexShrink: 0 } }),
|
|
4268
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)("span", { style: { fontSize: 10.5, textTransform: "uppercase", letterSpacing: "0.06em", color: "#4b5563", fontWeight: 600, flex: 1 }, children: label }),
|
|
4269
|
+
ai && /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(AiPill, {})
|
|
3859
4270
|
] });
|
|
3860
4271
|
}
|
|
3861
4272
|
function CopyButton({ text }) {
|
|
@@ -3868,7 +4279,7 @@ function CopyButton({ text }) {
|
|
|
3868
4279
|
} catch {
|
|
3869
4280
|
}
|
|
3870
4281
|
};
|
|
3871
|
-
return /* @__PURE__ */ (0,
|
|
4282
|
+
return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
|
|
3872
4283
|
"button",
|
|
3873
4284
|
{
|
|
3874
4285
|
onClick: handleCopy,
|
|
@@ -3887,9 +4298,9 @@ function CopyButton({ text }) {
|
|
|
3887
4298
|
transition: "color 150ms"
|
|
3888
4299
|
},
|
|
3889
4300
|
title: copied ? "Copied!" : "Copy to clipboard",
|
|
3890
|
-
children: copied ? /* @__PURE__ */ (0,
|
|
3891
|
-
/* @__PURE__ */ (0,
|
|
3892
|
-
/* @__PURE__ */ (0,
|
|
4301
|
+
children: copied ? /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("svg", { width: "11", height: "11", viewBox: "0 0 20 20", fill: "currentColor", children: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("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__ */ (0, import_jsx_runtime11.jsxs)("svg", { width: "11", height: "11", viewBox: "0 0 20 20", fill: "currentColor", children: [
|
|
4302
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)("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" }),
|
|
4303
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)("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" })
|
|
3893
4304
|
] })
|
|
3894
4305
|
}
|
|
3895
4306
|
);
|
|
@@ -3904,13 +4315,13 @@ function GEOCard({ geo, publication }) {
|
|
|
3904
4315
|
const fdBg = effectiveStatus === "strong" ? "rgba(22,163,74,0.1)" : effectiveStatus === "moderate" ? "rgba(230,192,27,0.15)" : "rgba(220,38,38,0.08)";
|
|
3905
4316
|
const goodCount = geo.headingAudit.filter((h) => h.status === "good").length;
|
|
3906
4317
|
const totalHeadings = geo.headingAudit.length;
|
|
3907
|
-
return /* @__PURE__ */ (0,
|
|
3908
|
-
/* @__PURE__ */ (0,
|
|
3909
|
-
/* @__PURE__ */ (0,
|
|
3910
|
-
/* @__PURE__ */ (0,
|
|
4318
|
+
return /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("div", { style: cardStyle3, children: [
|
|
4319
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("div", { style: { display: "flex", alignItems: "center", justifyContent: "space-between", marginBottom: 4 }, children: [
|
|
4320
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)(SectionHeader2, { label: "AI Citation Readiness", iconColor: GEO_TEAL }),
|
|
4321
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)(FeedbackButton, { suggestionType: "geo_summary", suggestionText: `facts/1k: ${fd.factsPerThousandWords}; short-answer headings: ${goodCount}/${totalHeadings}`, publication })
|
|
3911
4322
|
] }),
|
|
3912
|
-
/* @__PURE__ */ (0,
|
|
3913
|
-
/* @__PURE__ */ (0,
|
|
4323
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)("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." }),
|
|
4324
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(
|
|
3914
4325
|
"div",
|
|
3915
4326
|
{
|
|
3916
4327
|
style: {
|
|
@@ -3923,7 +4334,7 @@ function GEOCard({ geo, publication }) {
|
|
|
3923
4334
|
marginBottom: 8
|
|
3924
4335
|
},
|
|
3925
4336
|
children: [
|
|
3926
|
-
/* @__PURE__ */ (0,
|
|
4337
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(
|
|
3927
4338
|
"div",
|
|
3928
4339
|
{
|
|
3929
4340
|
style: {
|
|
@@ -3939,17 +4350,17 @@ function GEOCard({ geo, publication }) {
|
|
|
3939
4350
|
boxShadow: "0 1px 2px rgba(0,0,0,0.06)"
|
|
3940
4351
|
},
|
|
3941
4352
|
children: [
|
|
3942
|
-
/* @__PURE__ */ (0,
|
|
3943
|
-
/* @__PURE__ */ (0,
|
|
4353
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)("span", { style: { fontSize: 18, fontWeight: 700, color: fdColor, lineHeight: 1 }, children: fd.factsPerThousandWords }),
|
|
4354
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)("span", { style: { fontSize: 7.5, fontWeight: 700, color: fdColor, opacity: 0.75, letterSpacing: "0.05em", marginTop: 2 }, children: "PER 1K" })
|
|
3944
4355
|
]
|
|
3945
4356
|
}
|
|
3946
4357
|
),
|
|
3947
|
-
/* @__PURE__ */ (0,
|
|
3948
|
-
/* @__PURE__ */ (0,
|
|
4358
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("div", { style: { flex: 1, minWidth: 0 }, children: [
|
|
4359
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("div", { style: { fontSize: 11, fontWeight: 700, color: fdColor, marginBottom: 2 }, children: [
|
|
3949
4360
|
"Fact density: ",
|
|
3950
4361
|
fdLabel
|
|
3951
4362
|
] }),
|
|
3952
|
-
/* @__PURE__ */ (0,
|
|
4363
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("div", { style: { fontSize: 11, color: "#1f2937", lineHeight: 1.45 }, children: [
|
|
3953
4364
|
fd.factCount,
|
|
3954
4365
|
" specific stat",
|
|
3955
4366
|
fd.factCount === 1 ? "" : "s",
|
|
@@ -3965,7 +4376,7 @@ function GEOCard({ geo, publication }) {
|
|
|
3965
4376
|
]
|
|
3966
4377
|
}
|
|
3967
4378
|
),
|
|
3968
|
-
fd.driftPassages > 0 && /* @__PURE__ */ (0,
|
|
4379
|
+
fd.driftPassages > 0 && /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(
|
|
3969
4380
|
"div",
|
|
3970
4381
|
{
|
|
3971
4382
|
style: {
|
|
@@ -3979,15 +4390,15 @@ function GEOCard({ geo, publication }) {
|
|
|
3979
4390
|
lineHeight: 1.45
|
|
3980
4391
|
},
|
|
3981
4392
|
children: [
|
|
3982
|
-
/* @__PURE__ */ (0,
|
|
4393
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)("strong", { children: fd.driftPassages }),
|
|
3983
4394
|
" passage",
|
|
3984
4395
|
fd.driftPassages === 1 ? "" : "s",
|
|
3985
4396
|
" over 200 words with no specific stats or citations. AI engines tend to skip these."
|
|
3986
4397
|
]
|
|
3987
4398
|
}
|
|
3988
4399
|
),
|
|
3989
|
-
totalHeadings > 0 && /* @__PURE__ */ (0,
|
|
3990
|
-
/* @__PURE__ */ (0,
|
|
4400
|
+
totalHeadings > 0 && /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("div", { style: { marginTop: 4 }, children: [
|
|
4401
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(
|
|
3991
4402
|
"button",
|
|
3992
4403
|
{
|
|
3993
4404
|
onClick: () => setShowDetails((v) => !v),
|
|
@@ -4006,22 +4417,22 @@ function GEOCard({ geo, publication }) {
|
|
|
4006
4417
|
color: GEO_TEAL
|
|
4007
4418
|
},
|
|
4008
4419
|
children: [
|
|
4009
|
-
/* @__PURE__ */ (0,
|
|
4420
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("span", { children: [
|
|
4010
4421
|
"Short-answer paragraphs: ",
|
|
4011
4422
|
goodCount,
|
|
4012
4423
|
"/",
|
|
4013
4424
|
totalHeadings,
|
|
4014
4425
|
" headings have one"
|
|
4015
4426
|
] }),
|
|
4016
|
-
/* @__PURE__ */ (0,
|
|
4427
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)("svg", { width: "11", height: "11", viewBox: "0 0 20 20", fill: "currentColor", style: { transform: showDetails ? "rotate(180deg)" : "none", transition: "transform 150ms" }, children: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("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" }) })
|
|
4017
4428
|
]
|
|
4018
4429
|
}
|
|
4019
4430
|
),
|
|
4020
|
-
showDetails && /* @__PURE__ */ (0,
|
|
4021
|
-
/* @__PURE__ */ (0,
|
|
4431
|
+
showDetails && /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("div", { style: { marginTop: 6, display: "flex", flexDirection: "column", gap: 4 }, children: [
|
|
4432
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)("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." }),
|
|
4022
4433
|
geo.headingAudit.map((h, i) => {
|
|
4023
4434
|
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" };
|
|
4024
|
-
return /* @__PURE__ */ (0,
|
|
4435
|
+
return /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(
|
|
4025
4436
|
"div",
|
|
4026
4437
|
{
|
|
4027
4438
|
style: {
|
|
@@ -4035,8 +4446,8 @@ function GEOCard({ geo, publication }) {
|
|
|
4035
4446
|
gap: 8
|
|
4036
4447
|
},
|
|
4037
4448
|
children: [
|
|
4038
|
-
/* @__PURE__ */ (0,
|
|
4039
|
-
/* @__PURE__ */ (0,
|
|
4449
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)("span", { style: { flex: 1, minWidth: 0, color: "#1f2937", overflow: "hidden", textOverflow: "ellipsis", whiteSpace: "nowrap" }, children: h.heading }),
|
|
4450
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)("span", { style: { fontSize: 10, fontWeight: 600, color: c.color, flexShrink: 0 }, children: c.label })
|
|
4040
4451
|
]
|
|
4041
4452
|
},
|
|
4042
4453
|
i
|
|
@@ -4073,8 +4484,8 @@ function AEOTab({
|
|
|
4073
4484
|
originalHeading: void 0,
|
|
4074
4485
|
rationale: h.rationale
|
|
4075
4486
|
})) ?? [];
|
|
4076
|
-
return /* @__PURE__ */ (0,
|
|
4077
|
-
aeoContentChanged && /* @__PURE__ */ (0,
|
|
4487
|
+
return /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("div", { style: { padding: 12, display: "flex", flexDirection: "column", gap: 12 }, children: [
|
|
4488
|
+
aeoContentChanged && /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(
|
|
4078
4489
|
"div",
|
|
4079
4490
|
{
|
|
4080
4491
|
onClick: runDeepAnalysis,
|
|
@@ -4089,30 +4500,30 @@ function AEOTab({
|
|
|
4089
4500
|
cursor: "pointer"
|
|
4090
4501
|
},
|
|
4091
4502
|
children: [
|
|
4092
|
-
/* @__PURE__ */ (0,
|
|
4093
|
-
/* @__PURE__ */ (0,
|
|
4503
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)("span", { style: { fontSize: 11, color: "#92400e" }, children: "Content has changed since this was generated." }),
|
|
4504
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)("span", { style: { fontSize: 11, fontWeight: 600, color: AEO_PURPLE, textDecoration: "underline" }, children: "Update" })
|
|
4094
4505
|
]
|
|
4095
4506
|
}
|
|
4096
4507
|
),
|
|
4097
|
-
hasEnoughTextForGEO && /* @__PURE__ */ (0,
|
|
4098
|
-
hasEnoughText && !hasEnoughTextForGEO && /* @__PURE__ */ (0,
|
|
4099
|
-
/* @__PURE__ */ (0,
|
|
4508
|
+
hasEnoughTextForGEO && /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(GEOCard, { geo, publication }),
|
|
4509
|
+
hasEnoughText && !hasEnoughTextForGEO && /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("div", { style: { ...cardStyle3, textAlign: "center" }, children: /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("div", { style: { fontSize: 11, color: "#4b5563", lineHeight: 1.5 }, children: [
|
|
4510
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)("strong", { style: { color: "#C9A716" }, children: "AI citation analysis" }),
|
|
4100
4511
|
" needs at least 150 words to read fact density.",
|
|
4101
|
-
/* @__PURE__ */ (0,
|
|
4102
|
-
/* @__PURE__ */ (0,
|
|
4512
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)("br", {}),
|
|
4513
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("span", { style: { color: "#4b5563" }, children: [
|
|
4103
4514
|
"Current: ",
|
|
4104
4515
|
geoWordCount,
|
|
4105
4516
|
" word",
|
|
4106
4517
|
geoWordCount === 1 ? "" : "s"
|
|
4107
4518
|
] })
|
|
4108
4519
|
] }) }),
|
|
4109
|
-
!deepAnalysis && isDeepLoading && /* @__PURE__ */ (0,
|
|
4110
|
-
/* @__PURE__ */ (0,
|
|
4111
|
-
/* @__PURE__ */ (0,
|
|
4520
|
+
!deepAnalysis && isDeepLoading && /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("div", { style: { ...cardStyle3, display: "flex", alignItems: "center", justifyContent: "center", gap: 8 }, children: [
|
|
4521
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)(LoadingBars, { size: "xs", color: AEO_PURPLE }),
|
|
4522
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)("span", { style: { fontSize: 12, color: "#4b5563" }, children: "Generating AEO insights..." })
|
|
4112
4523
|
] }),
|
|
4113
|
-
!deepAnalysis && !isDeepLoading && /* @__PURE__ */ (0,
|
|
4114
|
-
/* @__PURE__ */ (0,
|
|
4115
|
-
/* @__PURE__ */ (0,
|
|
4524
|
+
!deepAnalysis && !isDeepLoading && /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("div", { style: { ...cardStyle3, textAlign: "center" }, children: [
|
|
4525
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)("div", { style: { fontSize: 12, color: "#4b5563" }, children: "AI citation readiness and question-style heading suggestions appear here once analysis runs." }),
|
|
4526
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
|
|
4116
4527
|
"button",
|
|
4117
4528
|
{
|
|
4118
4529
|
onClick: runDeepAnalysis,
|
|
@@ -4132,11 +4543,11 @@ function AEOTab({
|
|
|
4132
4543
|
}
|
|
4133
4544
|
)
|
|
4134
4545
|
] }),
|
|
4135
|
-
deepAnalysis && !aeo && /* @__PURE__ */ (0,
|
|
4136
|
-
questionHeadings.length > 0 && /* @__PURE__ */ (0,
|
|
4137
|
-
/* @__PURE__ */ (0,
|
|
4138
|
-
/* @__PURE__ */ (0,
|
|
4139
|
-
/* @__PURE__ */ (0,
|
|
4546
|
+
deepAnalysis && !aeo && /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("div", { style: { ...cardStyle3, textAlign: "center" }, children: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("span", { style: { fontSize: 12, color: "#4b5563" }, children: "No insights came back. Try again - the analysis may have timed out." }) }),
|
|
4547
|
+
questionHeadings.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("div", { style: cardStyle3, children: [
|
|
4548
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)(SectionHeader2, { label: "Question-Style Headings", iconColor: AEO_PURPLE }),
|
|
4549
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)("div", { style: { fontSize: 10, color: "#4b5563", marginBottom: 8 }, children: "Rewrites of your existing headings as questions. Google often pulls these into featured snippets." }),
|
|
4550
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)("div", { style: { display: "flex", flexDirection: "column", gap: 8 }, children: questionHeadings.map((h, i) => /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(
|
|
4140
4551
|
"div",
|
|
4141
4552
|
{
|
|
4142
4553
|
style: {
|
|
@@ -4146,26 +4557,26 @@ function AEOTab({
|
|
|
4146
4557
|
borderLeft: `3px solid ${AEO_PURPLE}`
|
|
4147
4558
|
},
|
|
4148
4559
|
children: [
|
|
4149
|
-
/* @__PURE__ */ (0,
|
|
4150
|
-
/* @__PURE__ */ (0,
|
|
4151
|
-
h.originalHeading && /* @__PURE__ */ (0,
|
|
4152
|
-
/* @__PURE__ */ (0,
|
|
4560
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("div", { style: { display: "flex", alignItems: "flex-start", justifyContent: "space-between", gap: 8 }, children: [
|
|
4561
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("div", { style: { flex: 1 }, children: [
|
|
4562
|
+
h.originalHeading && /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("div", { style: { fontSize: 11, color: "#4b5563", textDecoration: "line-through", marginBottom: 2 }, children: h.originalHeading }),
|
|
4563
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)("div", { style: { fontSize: 12, fontWeight: 700, color: AEO_PURPLE, lineHeight: 1.5 }, children: h.heading })
|
|
4153
4564
|
] }),
|
|
4154
|
-
/* @__PURE__ */ (0,
|
|
4155
|
-
/* @__PURE__ */ (0,
|
|
4156
|
-
/* @__PURE__ */ (0,
|
|
4565
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("div", { style: { display: "flex", alignItems: "center", gap: 4 }, children: [
|
|
4566
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)(CopyButton, { text: h.heading }),
|
|
4567
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)(FeedbackButton, { suggestionType: "aeo_heading", suggestionText: h.heading, publication })
|
|
4157
4568
|
] })
|
|
4158
4569
|
] }),
|
|
4159
|
-
/* @__PURE__ */ (0,
|
|
4570
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)("div", { style: { fontSize: 10, color: "#4b5563", marginTop: 4, fontStyle: "italic" }, children: h.rationale })
|
|
4160
4571
|
]
|
|
4161
4572
|
},
|
|
4162
4573
|
i
|
|
4163
4574
|
)) })
|
|
4164
4575
|
] }),
|
|
4165
|
-
/* @__PURE__ */ (0,
|
|
4166
|
-
/* @__PURE__ */ (0,
|
|
4167
|
-
/* @__PURE__ */ (0,
|
|
4168
|
-
!contentSuggestions && !isCSLoading && /* @__PURE__ */ (0,
|
|
4576
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("div", { style: cardStyle3, children: [
|
|
4577
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)(SectionHeader2, { label: "Content Block Suggestions", iconColor: AEO_PURPLE }),
|
|
4578
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)("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." }),
|
|
4579
|
+
!contentSuggestions && !isCSLoading && /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
|
|
4169
4580
|
"button",
|
|
4170
4581
|
{
|
|
4171
4582
|
onClick: loadContentSuggestions,
|
|
@@ -4189,15 +4600,15 @@ function AEOTab({
|
|
|
4189
4600
|
children: "Generate suggestions"
|
|
4190
4601
|
}
|
|
4191
4602
|
),
|
|
4192
|
-
isCSLoading && /* @__PURE__ */ (0,
|
|
4193
|
-
/* @__PURE__ */ (0,
|
|
4194
|
-
/* @__PURE__ */ (0,
|
|
4603
|
+
isCSLoading && /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("div", { style: { display: "flex", alignItems: "center", justifyContent: "center", gap: 8, padding: "8px 0" }, children: [
|
|
4604
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)(LoadingBars, { size: "xs", color: AEO_PURPLE }),
|
|
4605
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)("span", { style: { fontSize: 11, color: "#4b5563" }, children: "Generating content suggestions..." })
|
|
4195
4606
|
] }),
|
|
4196
|
-
csError && /* @__PURE__ */ (0,
|
|
4197
|
-
contentSuggestions && /* @__PURE__ */ (0,
|
|
4198
|
-
contentSuggestions.keyTakeaways.length > 0 && /* @__PURE__ */ (0,
|
|
4199
|
-
/* @__PURE__ */ (0,
|
|
4200
|
-
/* @__PURE__ */ (0,
|
|
4607
|
+
csError && /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("div", { style: { marginTop: 6, fontSize: 11, color: "#dc2626" }, children: csError }),
|
|
4608
|
+
contentSuggestions && /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("div", { style: { display: "flex", flexDirection: "column", gap: 14, marginTop: 8 }, children: [
|
|
4609
|
+
contentSuggestions.keyTakeaways.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("div", { children: [
|
|
4610
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)("div", { style: { fontSize: 10, fontWeight: 700, textTransform: "uppercase", letterSpacing: "0.06em", color: AEO_PURPLE, marginBottom: 6 }, children: "Key Takeaways" }),
|
|
4611
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)("div", { style: { display: "flex", flexDirection: "column", gap: 6 }, children: contentSuggestions.keyTakeaways.map((kt, i) => /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(
|
|
4201
4612
|
"div",
|
|
4202
4613
|
{
|
|
4203
4614
|
style: {
|
|
@@ -4210,19 +4621,19 @@ function AEOTab({
|
|
|
4210
4621
|
alignItems: "flex-start"
|
|
4211
4622
|
},
|
|
4212
4623
|
children: [
|
|
4213
|
-
/* @__PURE__ */ (0,
|
|
4214
|
-
/* @__PURE__ */ (0,
|
|
4215
|
-
/* @__PURE__ */ (0,
|
|
4216
|
-
/* @__PURE__ */ (0,
|
|
4624
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)("span", { style: { fontSize: 12, color: "#1f2937", lineHeight: 1.55, flex: 1 }, children: kt }),
|
|
4625
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("div", { style: { display: "flex", alignItems: "center", gap: 4 }, children: [
|
|
4626
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)(CopyButton, { text: kt }),
|
|
4627
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)(FeedbackButton, { suggestionType: "aeo_takeaway", suggestionText: kt, publication })
|
|
4217
4628
|
] })
|
|
4218
4629
|
]
|
|
4219
4630
|
},
|
|
4220
4631
|
i
|
|
4221
4632
|
)) })
|
|
4222
4633
|
] }),
|
|
4223
|
-
contentSuggestions.infographicOpportunities.length > 0 && /* @__PURE__ */ (0,
|
|
4224
|
-
/* @__PURE__ */ (0,
|
|
4225
|
-
/* @__PURE__ */ (0,
|
|
4634
|
+
contentSuggestions.infographicOpportunities.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("div", { children: [
|
|
4635
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)("div", { style: { fontSize: 10, fontWeight: 700, textTransform: "uppercase", letterSpacing: "0.06em", color: AEO_PURPLE, marginBottom: 6 }, children: "Infographic Ideas" }),
|
|
4636
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)("div", { style: { display: "flex", flexDirection: "column", gap: 6 }, children: contentSuggestions.infographicOpportunities.map((io, i) => /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(
|
|
4226
4637
|
"div",
|
|
4227
4638
|
{
|
|
4228
4639
|
style: {
|
|
@@ -4232,23 +4643,23 @@ function AEOTab({
|
|
|
4232
4643
|
borderLeft: `2px solid ${AEO_PURPLE}`
|
|
4233
4644
|
},
|
|
4234
4645
|
children: [
|
|
4235
|
-
/* @__PURE__ */ (0,
|
|
4236
|
-
/* @__PURE__ */ (0,
|
|
4237
|
-
/* @__PURE__ */ (0,
|
|
4646
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("div", { style: { display: "flex", alignItems: "flex-start", justifyContent: "space-between", gap: 8 }, children: [
|
|
4647
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)("span", { style: { fontSize: 12, fontWeight: 700, color: AEO_PURPLE }, children: io.concept }),
|
|
4648
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)(FeedbackButton, { suggestionType: "aeo_infographic", suggestionText: io.concept, publication })
|
|
4238
4649
|
] }),
|
|
4239
|
-
/* @__PURE__ */ (0,
|
|
4650
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)("div", { style: { fontSize: 11, color: "#1f2937", lineHeight: 1.5, marginTop: 3 }, children: io.description })
|
|
4240
4651
|
]
|
|
4241
4652
|
},
|
|
4242
4653
|
i
|
|
4243
4654
|
)) })
|
|
4244
4655
|
] }),
|
|
4245
|
-
contentSuggestions.bulletListItems.length > 0 && /* @__PURE__ */ (0,
|
|
4246
|
-
/* @__PURE__ */ (0,
|
|
4247
|
-
/* @__PURE__ */ (0,
|
|
4248
|
-
/* @__PURE__ */ (0,
|
|
4249
|
-
/* @__PURE__ */ (0,
|
|
4250
|
-
/* @__PURE__ */ (0,
|
|
4251
|
-
/* @__PURE__ */ (0,
|
|
4656
|
+
contentSuggestions.bulletListItems.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("div", { children: [
|
|
4657
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)("div", { style: { fontSize: 10, fontWeight: 700, textTransform: "uppercase", letterSpacing: "0.06em", color: AEO_PURPLE, marginBottom: 6 }, children: "Bullets for Featured Snippets" }),
|
|
4658
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("div", { style: { display: "flex", alignItems: "flex-start", justifyContent: "space-between", gap: 8 }, children: [
|
|
4659
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)("ul", { style: { margin: 0, paddingLeft: 18, flex: 1 }, children: contentSuggestions.bulletListItems.map((b, i) => /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("li", { style: { fontSize: 12, color: "#1f2937", lineHeight: 1.55, marginBottom: 4 }, children: b }, i)) }),
|
|
4660
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("div", { style: { display: "flex", alignItems: "center", gap: 4 }, children: [
|
|
4661
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)(CopyButton, { text: contentSuggestions.bulletListItems.map((b) => "- " + b).join("\n") }),
|
|
4662
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
|
|
4252
4663
|
FeedbackButton,
|
|
4253
4664
|
{
|
|
4254
4665
|
suggestionType: "aeo_bullets",
|
|
@@ -4259,7 +4670,7 @@ function AEOTab({
|
|
|
4259
4670
|
] })
|
|
4260
4671
|
] })
|
|
4261
4672
|
] }),
|
|
4262
|
-
/* @__PURE__ */ (0,
|
|
4673
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
|
|
4263
4674
|
"button",
|
|
4264
4675
|
{
|
|
4265
4676
|
onClick: loadContentSuggestions,
|
|
@@ -4289,7 +4700,7 @@ function AEOTab({
|
|
|
4289
4700
|
|
|
4290
4701
|
// src/components/ScoreDonut.tsx
|
|
4291
4702
|
var import_react15 = require("react");
|
|
4292
|
-
var
|
|
4703
|
+
var import_jsx_runtime12 = require("react/jsx-runtime");
|
|
4293
4704
|
var W = { topic: 0.6, freshness: 0.25, sectionFit: 0.15 };
|
|
4294
4705
|
var COLORS = { topic: MJH_BLUE, freshness: MJH_GOLD, sectionFit: "#9B59B6" };
|
|
4295
4706
|
var TRACK = "#eef2f7";
|
|
@@ -4314,7 +4725,7 @@ function ScoreDonut({
|
|
|
4314
4725
|
const topicLen = seg(cTopic);
|
|
4315
4726
|
const freshLen = seg(cFresh);
|
|
4316
4727
|
const sectionLen = seg(cSection);
|
|
4317
|
-
const Slice = ({ color, fullLen, offset }) => /* @__PURE__ */ (0,
|
|
4728
|
+
const Slice = ({ color, fullLen, offset }) => /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
|
|
4318
4729
|
"circle",
|
|
4319
4730
|
{
|
|
4320
4731
|
cx: size / 2,
|
|
@@ -4328,20 +4739,20 @@ function ScoreDonut({
|
|
|
4328
4739
|
strokeDashoffset: -offset
|
|
4329
4740
|
}
|
|
4330
4741
|
);
|
|
4331
|
-
return /* @__PURE__ */ (0,
|
|
4742
|
+
return /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(
|
|
4332
4743
|
"div",
|
|
4333
4744
|
{
|
|
4334
4745
|
style: { position: "relative", width: size, height: size, flexShrink: 0 },
|
|
4335
4746
|
onMouseEnter: () => setHovered(true),
|
|
4336
4747
|
onMouseLeave: () => setHovered(false),
|
|
4337
4748
|
children: [
|
|
4338
|
-
/* @__PURE__ */ (0,
|
|
4339
|
-
/* @__PURE__ */ (0,
|
|
4340
|
-
/* @__PURE__ */ (0,
|
|
4341
|
-
/* @__PURE__ */ (0,
|
|
4342
|
-
/* @__PURE__ */ (0,
|
|
4749
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("svg", { width: size, height: size, viewBox: `0 0 ${size} ${size}`, style: { transform: "rotate(-90deg)" }, children: [
|
|
4750
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)("circle", { cx: size / 2, cy: size / 2, r: radius, fill: "none", stroke: TRACK, strokeWidth }),
|
|
4751
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)(Slice, { color: COLORS.topic, fullLen: topicLen, offset: 0 }),
|
|
4752
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)(Slice, { color: COLORS.freshness, fullLen: freshLen, offset: topicLen }),
|
|
4753
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)(Slice, { color: COLORS.sectionFit, fullLen: sectionLen, offset: topicLen + freshLen })
|
|
4343
4754
|
] }),
|
|
4344
|
-
/* @__PURE__ */ (0,
|
|
4755
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(
|
|
4345
4756
|
"div",
|
|
4346
4757
|
{
|
|
4347
4758
|
style: {
|
|
@@ -4355,15 +4766,15 @@ function ScoreDonut({
|
|
|
4355
4766
|
lineHeight: 1
|
|
4356
4767
|
},
|
|
4357
4768
|
children: [
|
|
4358
|
-
/* @__PURE__ */ (0,
|
|
4769
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("span", { style: { fontSize: Math.max(11, size / 5.5), fontWeight: 700, color: "#1f2937" }, children: [
|
|
4359
4770
|
compositeValue,
|
|
4360
4771
|
"%"
|
|
4361
4772
|
] }),
|
|
4362
|
-
/* @__PURE__ */ (0,
|
|
4773
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)("span", { style: { fontSize: Math.max(7, size / 11), fontWeight: 700, color: "#4b5563", letterSpacing: "0.05em", marginTop: 1 }, children: "MATCH" })
|
|
4363
4774
|
]
|
|
4364
4775
|
}
|
|
4365
4776
|
),
|
|
4366
|
-
hovered && /* @__PURE__ */ (0,
|
|
4777
|
+
hovered && /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(
|
|
4367
4778
|
"div",
|
|
4368
4779
|
{
|
|
4369
4780
|
role: "tooltip",
|
|
@@ -4384,9 +4795,9 @@ function ScoreDonut({
|
|
|
4384
4795
|
pointerEvents: "none"
|
|
4385
4796
|
},
|
|
4386
4797
|
children: [
|
|
4387
|
-
/* @__PURE__ */ (0,
|
|
4388
|
-
/* @__PURE__ */ (0,
|
|
4389
|
-
/* @__PURE__ */ (0,
|
|
4798
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)(SubScoreRow, { color: COLORS.topic, label: "Topic", value: topic }),
|
|
4799
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)(SubScoreRow, { color: COLORS.freshness, label: "Freshness", value: freshness }),
|
|
4800
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)(SubScoreRow, { color: COLORS.sectionFit, label: "Section fit", value: sectionFit })
|
|
4390
4801
|
]
|
|
4391
4802
|
}
|
|
4392
4803
|
)
|
|
@@ -4395,31 +4806,76 @@ function ScoreDonut({
|
|
|
4395
4806
|
);
|
|
4396
4807
|
}
|
|
4397
4808
|
function SubScoreRow({ color, label, value }) {
|
|
4398
|
-
return /* @__PURE__ */ (0,
|
|
4399
|
-
/* @__PURE__ */ (0,
|
|
4400
|
-
/* @__PURE__ */ (0,
|
|
4401
|
-
/* @__PURE__ */ (0,
|
|
4809
|
+
return /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { style: { display: "flex", alignItems: "center", gap: 6 }, children: [
|
|
4810
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)("span", { style: { width: 7, height: 7, borderRadius: "50%", background: color, display: "inline-block", flexShrink: 0 } }),
|
|
4811
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)("span", { style: { flex: 1 }, children: label }),
|
|
4812
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("span", { style: { fontWeight: 700, fontVariantNumeric: "tabular-nums" }, children: [
|
|
4402
4813
|
Math.round(value),
|
|
4403
4814
|
"/100"
|
|
4404
4815
|
] })
|
|
4405
4816
|
] });
|
|
4406
4817
|
}
|
|
4407
4818
|
function ScoreDonutLegend() {
|
|
4408
|
-
return /* @__PURE__ */ (0,
|
|
4409
|
-
/* @__PURE__ */ (0,
|
|
4410
|
-
/* @__PURE__ */ (0,
|
|
4411
|
-
/* @__PURE__ */ (0,
|
|
4819
|
+
return /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { style: { display: "flex", gap: 10, fontSize: 9, color: "rgba(0,0,0,0.55)", alignItems: "center", flexWrap: "wrap" }, children: [
|
|
4820
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)(LegendDot, { color: COLORS.topic, label: "Topic match (60% of score)" }),
|
|
4821
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)(LegendDot, { color: COLORS.freshness, label: "Freshness (25%)" }),
|
|
4822
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)(LegendDot, { color: COLORS.sectionFit, label: "Section fit (15%)" })
|
|
4412
4823
|
] });
|
|
4413
4824
|
}
|
|
4414
4825
|
function LegendDot({ color, label }) {
|
|
4415
|
-
return /* @__PURE__ */ (0,
|
|
4416
|
-
/* @__PURE__ */ (0,
|
|
4826
|
+
return /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("span", { style: { display: "inline-flex", alignItems: "center", gap: 4 }, children: [
|
|
4827
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)("span", { style: { width: 7, height: 7, borderRadius: "50%", background: color, display: "inline-block" } }),
|
|
4417
4828
|
label
|
|
4418
4829
|
] });
|
|
4419
4830
|
}
|
|
4420
4831
|
|
|
4421
4832
|
// src/components/tabs/LinkingTab.tsx
|
|
4422
|
-
var
|
|
4833
|
+
var import_jsx_runtime13 = require("react/jsx-runtime");
|
|
4834
|
+
function buildLiveUrl(publication, slug) {
|
|
4835
|
+
if (!slug) return null;
|
|
4836
|
+
const pub = (publication || "").trim().toLowerCase();
|
|
4837
|
+
if (!/^[a-z0-9-]+$/.test(pub)) return null;
|
|
4838
|
+
const cleanSlug = slug.replace(/^\/+/, "");
|
|
4839
|
+
return `https://www.${pub}.com/view/${cleanSlug}`;
|
|
4840
|
+
}
|
|
4841
|
+
function buildSanityUrl(baseUrl, id, type) {
|
|
4842
|
+
if (!baseUrl || !id) return null;
|
|
4843
|
+
const cleanId = id.replace(/^drafts\./, "");
|
|
4844
|
+
const base = baseUrl.replace(/\/+$/, "");
|
|
4845
|
+
const typePart = type ? `;type=${encodeURIComponent(type)}` : "";
|
|
4846
|
+
return `${base}/intent/edit/id=${encodeURIComponent(cleanId)}${typePart}/`;
|
|
4847
|
+
}
|
|
4848
|
+
function LinkChip({ href, label, color }) {
|
|
4849
|
+
return /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(
|
|
4850
|
+
"a",
|
|
4851
|
+
{
|
|
4852
|
+
href,
|
|
4853
|
+
target: "_blank",
|
|
4854
|
+
rel: "noopener noreferrer",
|
|
4855
|
+
style: {
|
|
4856
|
+
display: "inline-flex",
|
|
4857
|
+
alignItems: "center",
|
|
4858
|
+
gap: 4,
|
|
4859
|
+
padding: "3px 9px",
|
|
4860
|
+
borderRadius: 99,
|
|
4861
|
+
fontSize: 10.5,
|
|
4862
|
+
fontWeight: 700,
|
|
4863
|
+
color,
|
|
4864
|
+
background: "rgba(255,255,255,0.7)",
|
|
4865
|
+
border: `1px solid ${color}33`,
|
|
4866
|
+
textDecoration: "none",
|
|
4867
|
+
lineHeight: 1.2
|
|
4868
|
+
},
|
|
4869
|
+
children: [
|
|
4870
|
+
label,
|
|
4871
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("svg", { width: "9", height: "9", viewBox: "0 0 20 20", fill: "currentColor", "aria-hidden": "true", children: [
|
|
4872
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)("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" }),
|
|
4873
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)("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" })
|
|
4874
|
+
] })
|
|
4875
|
+
]
|
|
4876
|
+
}
|
|
4877
|
+
);
|
|
4878
|
+
}
|
|
4423
4879
|
var cardStyle4 = {
|
|
4424
4880
|
borderRadius: 14,
|
|
4425
4881
|
background: "rgba(255,255,255,0.55)",
|
|
@@ -4429,7 +4885,7 @@ var cardStyle4 = {
|
|
|
4429
4885
|
padding: "14px"
|
|
4430
4886
|
};
|
|
4431
4887
|
function AiPill2() {
|
|
4432
|
-
return /* @__PURE__ */ (0,
|
|
4888
|
+
return /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
|
|
4433
4889
|
"span",
|
|
4434
4890
|
{
|
|
4435
4891
|
style: {
|
|
@@ -4453,10 +4909,10 @@ function SectionHeader3({
|
|
|
4453
4909
|
ai,
|
|
4454
4910
|
action
|
|
4455
4911
|
}) {
|
|
4456
|
-
return /* @__PURE__ */ (0,
|
|
4457
|
-
/* @__PURE__ */ (0,
|
|
4458
|
-
/* @__PURE__ */ (0,
|
|
4459
|
-
ai && /* @__PURE__ */ (0,
|
|
4912
|
+
return /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("div", { style: { display: "flex", alignItems: "center", gap: 7, marginBottom: 8 }, children: [
|
|
4913
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)("div", { style: { width: 7, height: 7, borderRadius: "50%", background: iconColor, flexShrink: 0 } }),
|
|
4914
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)("span", { style: { fontSize: 10.5, textTransform: "uppercase", letterSpacing: "0.06em", color: "#4b5563", fontWeight: 600, flex: 1 }, children: label }),
|
|
4915
|
+
ai && /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(AiPill2, {}),
|
|
4460
4916
|
action
|
|
4461
4917
|
] });
|
|
4462
4918
|
}
|
|
@@ -4476,7 +4932,7 @@ function freshnessChip(label, score) {
|
|
|
4476
4932
|
"very-old": { bg: "rgba(220,38,38,0.1)", color: "#dc2626", text: "Very old" }
|
|
4477
4933
|
};
|
|
4478
4934
|
const c = map[label];
|
|
4479
|
-
return /* @__PURE__ */ (0,
|
|
4935
|
+
return /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
|
|
4480
4936
|
"span",
|
|
4481
4937
|
{
|
|
4482
4938
|
style: {
|
|
@@ -4496,8 +4952,8 @@ function freshnessChip(label, score) {
|
|
|
4496
4952
|
);
|
|
4497
4953
|
}
|
|
4498
4954
|
function RefreshIcon({ spinning }) {
|
|
4499
|
-
if (spinning) return /* @__PURE__ */ (0,
|
|
4500
|
-
return /* @__PURE__ */ (0,
|
|
4955
|
+
if (spinning) return /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(LoadingBars, { size: "xs", color: "#9ca3af" });
|
|
4956
|
+
return /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("svg", { width: "12", height: "12", viewBox: "0 0 20 20", fill: "currentColor", children: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("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" }) });
|
|
4501
4957
|
}
|
|
4502
4958
|
function LinkingTab({
|
|
4503
4959
|
analysis,
|
|
@@ -4508,24 +4964,26 @@ function LinkingTab({
|
|
|
4508
4964
|
onRefresh,
|
|
4509
4965
|
text,
|
|
4510
4966
|
documentId,
|
|
4511
|
-
publication
|
|
4967
|
+
publication,
|
|
4968
|
+
sanityBaseUrl,
|
|
4969
|
+
documentType
|
|
4512
4970
|
}) {
|
|
4513
4971
|
if (!analysis) {
|
|
4514
|
-
return /* @__PURE__ */ (0,
|
|
4515
|
-
/* @__PURE__ */ (0,
|
|
4516
|
-
/* @__PURE__ */ (0,
|
|
4972
|
+
return /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("div", { style: { padding: 24, textAlign: "center" }, children: [
|
|
4973
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)("div", { style: { fontSize: 13, color: "#4b5563", fontWeight: 500 }, children: "Waiting for keyword analysis" }),
|
|
4974
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)("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." })
|
|
4517
4975
|
] });
|
|
4518
4976
|
}
|
|
4519
4977
|
const wordCount2 = text ? text.split(/\s+/).filter(Boolean).length : 0;
|
|
4520
4978
|
const recommendedMin = Math.max(1, Math.round(wordCount2 / 1e3 * 2));
|
|
4521
4979
|
const recommendedMax = Math.max(2, Math.round(wordCount2 / 1e3 * 5));
|
|
4522
|
-
return /* @__PURE__ */ (0,
|
|
4523
|
-
/* @__PURE__ */ (0,
|
|
4980
|
+
return /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("div", { style: { padding: 12, display: "flex", flexDirection: "column", gap: 12 }, children: /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("div", { id: "anchor-linking-suggestions", style: cardStyle4, children: [
|
|
4981
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
|
|
4524
4982
|
SectionHeader3,
|
|
4525
4983
|
{
|
|
4526
4984
|
label: "Suggested Links",
|
|
4527
4985
|
iconColor: MJH_BLUE,
|
|
4528
|
-
action: /* @__PURE__ */ (0,
|
|
4986
|
+
action: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
|
|
4529
4987
|
"button",
|
|
4530
4988
|
{
|
|
4531
4989
|
onClick: onRefresh,
|
|
@@ -4540,20 +4998,20 @@ function LinkingTab({
|
|
|
4540
4998
|
fontSize: 10
|
|
4541
4999
|
},
|
|
4542
5000
|
title: "Refresh",
|
|
4543
|
-
children: /* @__PURE__ */ (0,
|
|
5001
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(RefreshIcon, { spinning: isLoading })
|
|
4544
5002
|
}
|
|
4545
5003
|
)
|
|
4546
5004
|
}
|
|
4547
5005
|
),
|
|
4548
|
-
/* @__PURE__ */ (0,
|
|
5006
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("div", { style: { fontSize: 11, color: "#1f2937", marginBottom: 8, lineHeight: 1.55 }, children: [
|
|
4549
5007
|
"Other articles on this site that fit this topic.",
|
|
4550
|
-
wordCount2 > 0 && /* @__PURE__ */ (0,
|
|
5008
|
+
wordCount2 > 0 && /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(import_jsx_runtime13.Fragment, { children: [
|
|
4551
5009
|
" ",
|
|
4552
5010
|
"For a ",
|
|
4553
5011
|
wordCount2.toLocaleString(),
|
|
4554
5012
|
"-word article, aim for",
|
|
4555
5013
|
" ",
|
|
4556
|
-
/* @__PURE__ */ (0,
|
|
5014
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("strong", { children: [
|
|
4557
5015
|
recommendedMin,
|
|
4558
5016
|
"-",
|
|
4559
5017
|
recommendedMax,
|
|
@@ -4562,17 +5020,17 @@ function LinkingTab({
|
|
|
4562
5020
|
"."
|
|
4563
5021
|
] })
|
|
4564
5022
|
] }),
|
|
4565
|
-
/* @__PURE__ */ (0,
|
|
5023
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("div", { style: { fontSize: 10, color: "#4b5563", marginBottom: 6, lineHeight: 1.5 }, children: [
|
|
4566
5024
|
"Each suggestion gets a 0-100% match score from three signals - ",
|
|
4567
|
-
/* @__PURE__ */ (0,
|
|
5025
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)("strong", { children: "topic match" }),
|
|
4568
5026
|
", ",
|
|
4569
|
-
/* @__PURE__ */ (0,
|
|
5027
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)("strong", { children: "freshness" }),
|
|
4570
5028
|
", and ",
|
|
4571
|
-
/* @__PURE__ */ (0,
|
|
5029
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)("strong", { children: "section fit" }),
|
|
4572
5030
|
" (where in your article the link belongs). The percentage on each card is the weighted total:"
|
|
4573
5031
|
] }),
|
|
4574
|
-
/* @__PURE__ */ (0,
|
|
4575
|
-
isStale && suggestions.length > 0 && !isLoading && /* @__PURE__ */ (0,
|
|
5032
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)("div", { style: { marginBottom: 10 }, children: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(ScoreDonutLegend, {}) }),
|
|
5033
|
+
isStale && suggestions.length > 0 && !isLoading && /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(
|
|
4576
5034
|
"div",
|
|
4577
5035
|
{
|
|
4578
5036
|
onClick: onRefresh,
|
|
@@ -4589,16 +5047,16 @@ function LinkingTab({
|
|
|
4589
5047
|
cursor: "pointer"
|
|
4590
5048
|
},
|
|
4591
5049
|
children: [
|
|
4592
|
-
/* @__PURE__ */ (0,
|
|
4593
|
-
/* @__PURE__ */ (0,
|
|
5050
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)("span", { style: { fontSize: 11, color: "#92400e" }, children: "Your article changed since these were generated." }),
|
|
5051
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)("span", { style: { fontSize: 11, fontWeight: 700, color: "#8B7310", textDecoration: "underline", flexShrink: 0 }, children: "Refresh" })
|
|
4594
5052
|
]
|
|
4595
5053
|
}
|
|
4596
5054
|
),
|
|
4597
|
-
isLoading && suggestions.length === 0 && /* @__PURE__ */ (0,
|
|
4598
|
-
/* @__PURE__ */ (0,
|
|
4599
|
-
/* @__PURE__ */ (0,
|
|
5055
|
+
isLoading && suggestions.length === 0 && /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("div", { style: { display: "flex", alignItems: "center", justifyContent: "center", gap: 8, padding: "16px 0" }, children: [
|
|
5056
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)(LoadingBars, { size: "xs", color: MJH_BLUE }),
|
|
5057
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)("span", { style: { fontSize: 11, color: "#4b5563" }, children: "Ranking candidates..." })
|
|
4600
5058
|
] }),
|
|
4601
|
-
!isLoading && error && /* @__PURE__ */ (0,
|
|
5059
|
+
!isLoading && error && /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(
|
|
4602
5060
|
"div",
|
|
4603
5061
|
{
|
|
4604
5062
|
style: {
|
|
@@ -4609,9 +5067,9 @@ function LinkingTab({
|
|
|
4609
5067
|
textAlign: "center"
|
|
4610
5068
|
},
|
|
4611
5069
|
children: [
|
|
4612
|
-
/* @__PURE__ */ (0,
|
|
4613
|
-
/* @__PURE__ */ (0,
|
|
4614
|
-
/* @__PURE__ */ (0,
|
|
5070
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)("div", { style: { fontSize: 11.5, color: "#b91c1c", fontWeight: 600, marginBottom: 2 }, children: "Couldn't load suggestions" }),
|
|
5071
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)("div", { style: { fontSize: 10.5, color: "#4b5563", marginBottom: 8 }, children: error }),
|
|
5072
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
|
|
4615
5073
|
"button",
|
|
4616
5074
|
{
|
|
4617
5075
|
onClick: onRefresh,
|
|
@@ -4631,11 +5089,11 @@ function LinkingTab({
|
|
|
4631
5089
|
]
|
|
4632
5090
|
}
|
|
4633
5091
|
),
|
|
4634
|
-
!isLoading && !error && suggestions.length === 0 && /* @__PURE__ */ (0,
|
|
4635
|
-
/* @__PURE__ */ (0,
|
|
4636
|
-
/* @__PURE__ */ (0,
|
|
5092
|
+
!isLoading && !error && suggestions.length === 0 && /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("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: [
|
|
5093
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)("div", { style: { fontWeight: 700, marginBottom: 4, color: "#1f2937" }, children: "No closely related articles found." }),
|
|
5094
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)("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." })
|
|
4637
5095
|
] }),
|
|
4638
|
-
suggestions.length > 0 && /* @__PURE__ */ (0,
|
|
5096
|
+
suggestions.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("div", { style: { display: "flex", flexDirection: "column", gap: 10 }, children: suggestions.map((s) => /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(
|
|
4639
5097
|
"div",
|
|
4640
5098
|
{
|
|
4641
5099
|
style: {
|
|
@@ -4648,7 +5106,7 @@ function LinkingTab({
|
|
|
4648
5106
|
alignItems: "flex-start"
|
|
4649
5107
|
},
|
|
4650
5108
|
children: [
|
|
4651
|
-
/* @__PURE__ */ (0,
|
|
5109
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
|
|
4652
5110
|
ScoreDonut,
|
|
4653
5111
|
{
|
|
4654
5112
|
size: 64,
|
|
@@ -4658,22 +5116,31 @@ function LinkingTab({
|
|
|
4658
5116
|
composite: s.compositeScore
|
|
4659
5117
|
}
|
|
4660
5118
|
),
|
|
4661
|
-
/* @__PURE__ */ (0,
|
|
4662
|
-
/* @__PURE__ */ (0,
|
|
5119
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("div", { style: { flex: 1, minWidth: 0 }, children: [
|
|
5120
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("div", { style: { display: "flex", alignItems: "center", gap: 6, marginBottom: 3, flexWrap: "wrap" }, children: [
|
|
4663
5121
|
freshnessChip(s.freshnessLabel, s.freshnessScore),
|
|
4664
|
-
s.publishedAt && /* @__PURE__ */ (0,
|
|
5122
|
+
s.publishedAt && /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("span", { style: { fontSize: 10, color: "#4b5563" }, children: formatDate(s.publishedAt) })
|
|
4665
5123
|
] }),
|
|
4666
|
-
/* @__PURE__ */ (0,
|
|
4667
|
-
/* @__PURE__ */ (0,
|
|
5124
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)("div", { style: { fontSize: 12, fontWeight: 700, color: "#1f2937", lineHeight: 1.4, marginBottom: 2 }, children: s.title }),
|
|
5125
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("div", { style: { fontSize: 10, color: "#4b5563", fontFamily: "ui-monospace, SFMono-Regular, monospace", marginBottom: 6 }, children: [
|
|
4668
5126
|
"/",
|
|
4669
5127
|
s.slug
|
|
4670
5128
|
] }),
|
|
4671
|
-
|
|
4672
|
-
|
|
5129
|
+
(() => {
|
|
5130
|
+
const liveUrl = buildLiveUrl(publication, s.slug);
|
|
5131
|
+
const sanityUrl = buildSanityUrl(sanityBaseUrl, s._id, documentType);
|
|
5132
|
+
if (!liveUrl && !sanityUrl) return null;
|
|
5133
|
+
return /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("div", { style: { display: "flex", flexWrap: "wrap", gap: 6, marginBottom: 6 }, children: [
|
|
5134
|
+
sanityUrl && /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(LinkChip, { href: sanityUrl, label: "Inside Sanity", color: MJH_BLUE }),
|
|
5135
|
+
liveUrl && /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(LinkChip, { href: liveUrl, label: "Live site", color: "#4b5563" })
|
|
5136
|
+
] });
|
|
5137
|
+
})(),
|
|
5138
|
+
s.relevanceReason && /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("div", { style: { fontSize: 11, color: "#1f2937", marginBottom: 6, lineHeight: 1.45 }, children: [
|
|
5139
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)("span", { style: { fontWeight: 700, color: "#4b5563" }, children: "Why it fits:" }),
|
|
4673
5140
|
" ",
|
|
4674
|
-
/* @__PURE__ */ (0,
|
|
5141
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)("span", { style: { fontStyle: "italic" }, children: s.relevanceReason })
|
|
4675
5142
|
] }),
|
|
4676
|
-
s.anchorQuote && /* @__PURE__ */ (0,
|
|
5143
|
+
s.anchorQuote && /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(
|
|
4677
5144
|
"div",
|
|
4678
5145
|
{
|
|
4679
5146
|
style: {
|
|
@@ -4687,21 +5154,21 @@ function LinkingTab({
|
|
|
4687
5154
|
lineHeight: 1.5
|
|
4688
5155
|
},
|
|
4689
5156
|
children: [
|
|
4690
|
-
/* @__PURE__ */ (0,
|
|
5157
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("div", { style: { fontSize: 9, fontWeight: 700, color: "#4b5563", textTransform: "uppercase", letterSpacing: "0.05em", marginBottom: 3 }, children: [
|
|
4691
5158
|
"Where to link from - paragraph ",
|
|
4692
5159
|
s.anchorParagraph
|
|
4693
5160
|
] }),
|
|
4694
|
-
/* @__PURE__ */ (0,
|
|
5161
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("div", { style: { fontStyle: "italic" }, children: [
|
|
4695
5162
|
'"',
|
|
4696
5163
|
s.anchorQuote,
|
|
4697
5164
|
'"'
|
|
4698
5165
|
] }),
|
|
4699
|
-
s.anchorReason && /* @__PURE__ */ (0,
|
|
5166
|
+
s.anchorReason && /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("div", { style: { fontSize: 10, color: "#4b5563", marginTop: 3, lineHeight: 1.45 }, children: s.anchorReason })
|
|
4700
5167
|
]
|
|
4701
5168
|
}
|
|
4702
5169
|
)
|
|
4703
5170
|
] }),
|
|
4704
|
-
/* @__PURE__ */ (0,
|
|
5171
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)("div", { style: { flexShrink: 0 }, children: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
|
|
4705
5172
|
FeedbackButton,
|
|
4706
5173
|
{
|
|
4707
5174
|
suggestionType: "internal_link",
|
|
@@ -4719,7 +5186,7 @@ function LinkingTab({
|
|
|
4719
5186
|
|
|
4720
5187
|
// src/components/tabs/MetaTab.tsx
|
|
4721
5188
|
var import_react16 = require("react");
|
|
4722
|
-
var
|
|
5189
|
+
var import_jsx_runtime14 = require("react/jsx-runtime");
|
|
4723
5190
|
function containsKeywordTokens(haystack, needle) {
|
|
4724
5191
|
if (!needle) return true;
|
|
4725
5192
|
const tokens = needle.toLowerCase().split(/\s+/).filter((t) => t.length > 1);
|
|
@@ -4742,7 +5209,7 @@ function StatusBadge({ status }) {
|
|
|
4742
5209
|
error: { bg: "rgba(220,38,38,0.1)", color: "#dc2626", label: "Fix" }
|
|
4743
5210
|
};
|
|
4744
5211
|
const c = map[status];
|
|
4745
|
-
return /* @__PURE__ */ (0,
|
|
5212
|
+
return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
|
|
4746
5213
|
"span",
|
|
4747
5214
|
{
|
|
4748
5215
|
style: {
|
|
@@ -4761,12 +5228,12 @@ function StatusBadge({ status }) {
|
|
|
4761
5228
|
);
|
|
4762
5229
|
}
|
|
4763
5230
|
function AuditCard({ label, value, status, recommendation, anchorId, footer }) {
|
|
4764
|
-
return /* @__PURE__ */ (0,
|
|
4765
|
-
/* @__PURE__ */ (0,
|
|
4766
|
-
/* @__PURE__ */ (0,
|
|
4767
|
-
/* @__PURE__ */ (0,
|
|
5231
|
+
return /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("div", { id: anchorId, style: cardStyle5, children: [
|
|
5232
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("div", { style: { display: "flex", alignItems: "center", justifyContent: "space-between", gap: 8, marginBottom: 6 }, children: [
|
|
5233
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)("span", { style: { fontSize: 10.5, textTransform: "uppercase", letterSpacing: "0.06em", color: "#4b5563", fontWeight: 600 }, children: label }),
|
|
5234
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)(StatusBadge, { status })
|
|
4768
5235
|
] }),
|
|
4769
|
-
/* @__PURE__ */ (0,
|
|
5236
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
|
|
4770
5237
|
"div",
|
|
4771
5238
|
{
|
|
4772
5239
|
style: {
|
|
@@ -4779,7 +5246,7 @@ function AuditCard({ label, value, status, recommendation, anchorId, footer }) {
|
|
|
4779
5246
|
children: value
|
|
4780
5247
|
}
|
|
4781
5248
|
),
|
|
4782
|
-
recommendation && /* @__PURE__ */ (0,
|
|
5249
|
+
recommendation && /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
|
|
4783
5250
|
"div",
|
|
4784
5251
|
{
|
|
4785
5252
|
style: {
|
|
@@ -4798,23 +5265,37 @@ function AuditCard({ label, value, status, recommendation, anchorId, footer }) {
|
|
|
4798
5265
|
footer
|
|
4799
5266
|
] });
|
|
4800
5267
|
}
|
|
4801
|
-
function
|
|
5268
|
+
function keywordCoverageNote(haystack, primaryKeyword, secondaryKeyword) {
|
|
5269
|
+
const hasPrimary = primaryKeyword ? containsKeywordTokens(haystack, primaryKeyword) : true;
|
|
5270
|
+
const hasSecondary = secondaryKeyword ? containsKeywordTokens(haystack, secondaryKeyword) : true;
|
|
5271
|
+
if (primaryKeyword && !hasPrimary && secondaryKeyword && !hasSecondary) {
|
|
5272
|
+
return `Neither your primary keyword "${primaryKeyword}" nor your secondary keyword "${secondaryKeyword}" appears here.`;
|
|
5273
|
+
}
|
|
5274
|
+
if (primaryKeyword && !hasPrimary) {
|
|
5275
|
+
return `Your primary keyword "${primaryKeyword}" isn't included${secondaryKeyword ? ` (secondary keyword "${secondaryKeyword}" ${hasSecondary ? "is" : "isn't"}).` : "."}`;
|
|
5276
|
+
}
|
|
5277
|
+
if (secondaryKeyword && !hasSecondary) {
|
|
5278
|
+
return `Your primary keyword "${primaryKeyword}" is included, but your secondary keyword "${secondaryKeyword}" is not. Work it in if it reads naturally.`;
|
|
5279
|
+
}
|
|
5280
|
+
return "";
|
|
5281
|
+
}
|
|
5282
|
+
function metaDescriptionAudit(meta, primaryKeyword, secondaryKeyword) {
|
|
4802
5283
|
if (!meta) {
|
|
4803
5284
|
return {
|
|
4804
5285
|
label: "Meta Description",
|
|
4805
5286
|
value: "Missing",
|
|
4806
5287
|
status: "error",
|
|
4807
|
-
recommendation:
|
|
5288
|
+
recommendation: `Add a 120-160 character meta description that includes your primary keyword${secondaryKeyword ? " (and your secondary keyword if it fits)" : ""}.`
|
|
4808
5289
|
};
|
|
4809
5290
|
}
|
|
4810
5291
|
const len = meta.length;
|
|
4811
|
-
const
|
|
5292
|
+
const kwNote = keywordCoverageNote(meta, primaryKeyword, secondaryKeyword);
|
|
4812
5293
|
if (len < 120) {
|
|
4813
5294
|
return {
|
|
4814
5295
|
label: "Meta Description",
|
|
4815
5296
|
value: `${meta} (${len} chars)`,
|
|
4816
5297
|
status: "warning",
|
|
4817
|
-
recommendation: `
|
|
5298
|
+
recommendation: `A little short - aim for 120-160 characters.${kwNote ? ` ${kwNote}` : ""}`
|
|
4818
5299
|
};
|
|
4819
5300
|
}
|
|
4820
5301
|
if (len > 160) {
|
|
@@ -4822,15 +5303,15 @@ function metaDescriptionAudit(meta, primaryKeyword) {
|
|
|
4822
5303
|
label: "Meta Description",
|
|
4823
5304
|
value: `${meta} (${len} chars)`,
|
|
4824
5305
|
status: "warning",
|
|
4825
|
-
recommendation: `
|
|
5306
|
+
recommendation: `Over 160 characters - Google may shorten it in search, so trim it a little.${kwNote ? ` ${kwNote}` : ""}`
|
|
4826
5307
|
};
|
|
4827
5308
|
}
|
|
4828
|
-
if (
|
|
5309
|
+
if (kwNote) {
|
|
4829
5310
|
return {
|
|
4830
5311
|
label: "Meta Description",
|
|
4831
5312
|
value: `${meta} (${len} chars)`,
|
|
4832
5313
|
status: "warning",
|
|
4833
|
-
recommendation: `Length is good
|
|
5314
|
+
recommendation: `Length is good. ${kwNote}`
|
|
4834
5315
|
};
|
|
4835
5316
|
}
|
|
4836
5317
|
return {
|
|
@@ -4878,88 +5359,6 @@ function titleAudit(title, primaryKeyword) {
|
|
|
4878
5359
|
}
|
|
4879
5360
|
return { label: "Title Tag", value: `${title} (${len} chars)`, status: "good" };
|
|
4880
5361
|
}
|
|
4881
|
-
function urlAudit(slug, primaryKeyword) {
|
|
4882
|
-
if (!slug) {
|
|
4883
|
-
return { label: "URL Slug", value: "Missing", status: "error", recommendation: "Add a clean, hyphenated URL slug containing the primary keyword. Aim for 3-5 words." };
|
|
4884
|
-
}
|
|
4885
|
-
const issues = [];
|
|
4886
|
-
if (slug.length > 60) issues.push("longer than 60 characters - aim for 3-5 words");
|
|
4887
|
-
if (/[A-Z]/.test(slug)) issues.push("contains uppercase letters");
|
|
4888
|
-
if (/_/.test(slug)) issues.push("uses underscores instead of hyphens");
|
|
4889
|
-
if (/[^a-zA-Z0-9-/]/.test(slug.replace(/^\//, ""))) issues.push("contains special characters");
|
|
4890
|
-
if (primaryKeyword && !containsKeywordTokens(slug.replace(/-/g, " "), primaryKeyword)) {
|
|
4891
|
-
issues.push(`missing primary keyword "${primaryKeyword}"`);
|
|
4892
|
-
}
|
|
4893
|
-
if (issues.length === 0) {
|
|
4894
|
-
return { label: "URL Slug", value: `/${slug}`, status: "good" };
|
|
4895
|
-
}
|
|
4896
|
-
return {
|
|
4897
|
-
label: "URL Slug",
|
|
4898
|
-
value: `/${slug}`,
|
|
4899
|
-
status: "warning",
|
|
4900
|
-
recommendation: `Issues: ${issues.join(", ")}.`
|
|
4901
|
-
};
|
|
4902
|
-
}
|
|
4903
|
-
function SlugRedirectNotice() {
|
|
4904
|
-
const [expanded, setExpanded] = (0, import_react16.useState)(false);
|
|
4905
|
-
return /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
|
|
4906
|
-
"div",
|
|
4907
|
-
{
|
|
4908
|
-
style: {
|
|
4909
|
-
marginTop: 10,
|
|
4910
|
-
paddingTop: 10,
|
|
4911
|
-
borderTop: "1px solid rgba(0,0,0,0.07)"
|
|
4912
|
-
},
|
|
4913
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(
|
|
4914
|
-
"div",
|
|
4915
|
-
{
|
|
4916
|
-
style: {
|
|
4917
|
-
padding: "8px 10px",
|
|
4918
|
-
background: "rgba(245,158,11,0.08)",
|
|
4919
|
-
borderLeft: "2px solid #f59e0b",
|
|
4920
|
-
borderRadius: 6
|
|
4921
|
-
},
|
|
4922
|
-
children: [
|
|
4923
|
-
/* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("div", { style: { display: "flex", alignItems: "center", gap: 6, marginBottom: 4 }, children: [
|
|
4924
|
-
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)("svg", { width: "12", height: "12", viewBox: "0 0 20 20", fill: "#f59e0b", "aria-hidden": "true", children: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("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" }) }),
|
|
4925
|
-
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)("span", { style: { fontSize: 10.5, fontWeight: 700, color: "#b45309", textTransform: "uppercase", letterSpacing: "0.06em" }, children: "Changing a URL?" })
|
|
4926
|
-
] }),
|
|
4927
|
-
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)("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." }),
|
|
4928
|
-
/* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(
|
|
4929
|
-
"button",
|
|
4930
|
-
{
|
|
4931
|
-
onClick: () => setExpanded((v) => !v),
|
|
4932
|
-
style: {
|
|
4933
|
-
display: "flex",
|
|
4934
|
-
alignItems: "center",
|
|
4935
|
-
gap: 3,
|
|
4936
|
-
marginTop: 6,
|
|
4937
|
-
padding: 0,
|
|
4938
|
-
background: "none",
|
|
4939
|
-
border: "none",
|
|
4940
|
-
cursor: "pointer",
|
|
4941
|
-
fontSize: 10.5,
|
|
4942
|
-
fontWeight: 700,
|
|
4943
|
-
color: "#b45309",
|
|
4944
|
-
fontFamily: "inherit"
|
|
4945
|
-
},
|
|
4946
|
-
children: [
|
|
4947
|
-
expanded ? "Show less" : "Learn more",
|
|
4948
|
-
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)("svg", { width: "10", height: "10", viewBox: "0 0 20 20", fill: "currentColor", style: { transform: expanded ? "rotate(180deg)" : "none", transition: "transform 150ms" }, children: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("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" }) })
|
|
4949
|
-
]
|
|
4950
|
-
}
|
|
4951
|
-
),
|
|
4952
|
-
expanded && /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("ul", { style: { margin: "6px 0 0", paddingLeft: 16, fontSize: 11, color: "#1f2937", lineHeight: 1.55 }, children: [
|
|
4953
|
-
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)("li", { children: "Without the 301, the page loses every search ranking and every external link to it breaks." }),
|
|
4954
|
-
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)("li", { children: "A 301 preserves the rankings and link equity built up on the old URL." }),
|
|
4955
|
-
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)("li", { children: "Set this up using vanity redirects in Sanity." })
|
|
4956
|
-
] })
|
|
4957
|
-
]
|
|
4958
|
-
}
|
|
4959
|
-
)
|
|
4960
|
-
}
|
|
4961
|
-
);
|
|
4962
|
-
}
|
|
4963
5362
|
function daysSince(iso) {
|
|
4964
5363
|
if (!iso) return null;
|
|
4965
5364
|
const t = new Date(iso).getTime();
|
|
@@ -4972,14 +5371,13 @@ function formatDateShort(iso) {
|
|
|
4972
5371
|
if (isNaN(d.getTime())) return "";
|
|
4973
5372
|
return d.toLocaleDateString(void 0, { year: "numeric", month: "short", day: "numeric" });
|
|
4974
5373
|
}
|
|
4975
|
-
function MetaTab({ documentFields, primaryKeyword, isLoading }) {
|
|
5374
|
+
function MetaTab({ documentFields, primaryKeyword, secondaryKeyword, isLoading }) {
|
|
4976
5375
|
const audits = (0, import_react16.useMemo)(() => {
|
|
4977
5376
|
const list = [];
|
|
4978
5377
|
list.push(titleAudit(documentFields?.title, primaryKeyword));
|
|
4979
|
-
list.push(metaDescriptionAudit(documentFields?.metaDescription, primaryKeyword));
|
|
4980
|
-
list.push(urlAudit(documentFields?.slug, primaryKeyword));
|
|
5378
|
+
list.push(metaDescriptionAudit(documentFields?.metaDescription, primaryKeyword, secondaryKeyword));
|
|
4981
5379
|
return list;
|
|
4982
|
-
}, [documentFields, primaryKeyword]);
|
|
5380
|
+
}, [documentFields, primaryKeyword, secondaryKeyword]);
|
|
4983
5381
|
const eeatItems = (0, import_react16.useMemo)(() => {
|
|
4984
5382
|
const items = [];
|
|
4985
5383
|
const author = documentFields?.authorName;
|
|
@@ -5024,33 +5422,32 @@ function MetaTab({ documentFields, primaryKeyword, isLoading }) {
|
|
|
5024
5422
|
}, [documentFields]);
|
|
5025
5423
|
const hasAnyField = !!documentFields && (documentFields.title !== void 0 || documentFields.metaDescription !== void 0 || documentFields.slug !== void 0);
|
|
5026
5424
|
if (isLoading && !hasAnyField) {
|
|
5027
|
-
return /* @__PURE__ */ (0,
|
|
5028
|
-
/* @__PURE__ */ (0,
|
|
5029
|
-
/* @__PURE__ */ (0,
|
|
5425
|
+
return /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("div", { style: { padding: 24, textAlign: "center" }, children: [
|
|
5426
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)("div", { style: { fontSize: 13, color: "#4b5563", fontWeight: 500 }, children: "Reading document fields..." }),
|
|
5427
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)("div", { style: { fontSize: 11, color: "#4b5563", marginTop: 4 }, children: "Audit will run once content loads" })
|
|
5030
5428
|
] });
|
|
5031
5429
|
}
|
|
5032
|
-
const auditAnchors = ["anchor-meta-title", "anchor-meta-description"
|
|
5033
|
-
return /* @__PURE__ */ (0,
|
|
5034
|
-
audits.map((a, i) => /* @__PURE__ */ (0,
|
|
5430
|
+
const auditAnchors = ["anchor-meta-title", "anchor-meta-description"];
|
|
5431
|
+
return /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("div", { style: { padding: 12, display: "flex", flexDirection: "column", gap: 10 }, children: [
|
|
5432
|
+
audits.map((a, i) => /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
|
|
5035
5433
|
AuditCard,
|
|
5036
5434
|
{
|
|
5037
5435
|
anchorId: auditAnchors[i],
|
|
5038
5436
|
label: a.label,
|
|
5039
5437
|
value: a.value,
|
|
5040
5438
|
status: a.status,
|
|
5041
|
-
recommendation: a.recommendation
|
|
5042
|
-
footer: a.label === "URL Slug" ? /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(SlugRedirectNotice, {}) : void 0
|
|
5439
|
+
recommendation: a.recommendation
|
|
5043
5440
|
},
|
|
5044
5441
|
i
|
|
5045
5442
|
)),
|
|
5046
|
-
eeatItems.length > 0 && /* @__PURE__ */ (0,
|
|
5047
|
-
/* @__PURE__ */ (0,
|
|
5048
|
-
/* @__PURE__ */ (0,
|
|
5049
|
-
/* @__PURE__ */ (0,
|
|
5050
|
-
/* @__PURE__ */ (0,
|
|
5443
|
+
eeatItems.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(import_jsx_runtime14.Fragment, { children: [
|
|
5444
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("div", { style: { display: "flex", alignItems: "center", gap: 8, margin: "6px 4px 0" }, children: [
|
|
5445
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)("div", { style: { height: 1, flex: 1, background: "rgba(0,0,0,0.06)" } }),
|
|
5446
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)("span", { style: { fontSize: 10, fontWeight: 700, color: "#4b5563", textTransform: "uppercase", letterSpacing: "0.08em" }, children: "Author & Freshness" }),
|
|
5447
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)("div", { style: { height: 1, flex: 1, background: "rgba(0,0,0,0.06)" } })
|
|
5051
5448
|
] }),
|
|
5052
|
-
/* @__PURE__ */ (0,
|
|
5053
|
-
eeatItems.map((item, i) => /* @__PURE__ */ (0,
|
|
5449
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)("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." }),
|
|
5450
|
+
eeatItems.map((item, i) => /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
|
|
5054
5451
|
AuditCard,
|
|
5055
5452
|
{
|
|
5056
5453
|
label: item.label,
|
|
@@ -5066,7 +5463,85 @@ function MetaTab({ documentFields, primaryKeyword, isLoading }) {
|
|
|
5066
5463
|
|
|
5067
5464
|
// src/components/tabs/TechnicalTab.tsx
|
|
5068
5465
|
var import_react17 = require("react");
|
|
5069
|
-
var
|
|
5466
|
+
var import_jsx_runtime15 = require("react/jsx-runtime");
|
|
5467
|
+
function containsKeywordTokens2(haystack, needle) {
|
|
5468
|
+
if (!needle) return true;
|
|
5469
|
+
const tokens = needle.toLowerCase().split(/\s+/).filter((t) => t.length > 1);
|
|
5470
|
+
if (tokens.length === 0) return true;
|
|
5471
|
+
const lower = haystack.toLowerCase();
|
|
5472
|
+
return tokens.every((t) => lower.includes(t));
|
|
5473
|
+
}
|
|
5474
|
+
function keywordLeadsUrl(slug, primaryKeyword) {
|
|
5475
|
+
if (!primaryKeyword) return true;
|
|
5476
|
+
const slugWords = slug.toLowerCase().replace(/[^a-z0-9]+/g, " ").trim().split(/\s+/).filter(Boolean);
|
|
5477
|
+
const tokens = primaryKeyword.toLowerCase().split(/\s+/).filter((t) => t.length > 1);
|
|
5478
|
+
if (tokens.length === 0 || slugWords.length === 0) return true;
|
|
5479
|
+
let earliest = Infinity;
|
|
5480
|
+
for (const t of tokens) {
|
|
5481
|
+
const idx = slugWords.findIndex((w) => w.includes(t));
|
|
5482
|
+
if (idx >= 0) earliest = Math.min(earliest, idx);
|
|
5483
|
+
}
|
|
5484
|
+
return earliest <= 2;
|
|
5485
|
+
}
|
|
5486
|
+
function urlAudit(slug, primaryKeyword, secondaryKeyword) {
|
|
5487
|
+
const SHORT_DESC = "Keep the URL short and descriptive - concise URLs are easier to read - and avoid trailing, duplicate, or excessive spaces.";
|
|
5488
|
+
if (!slug) {
|
|
5489
|
+
return {
|
|
5490
|
+
label: "URL Slug",
|
|
5491
|
+
value: "Missing",
|
|
5492
|
+
status: "warning",
|
|
5493
|
+
recommendation: `Add a URL slug that leads with your primary keyword. ${SHORT_DESC}`
|
|
5494
|
+
};
|
|
5495
|
+
}
|
|
5496
|
+
const slugAsWords = slug.replace(/-/g, " ");
|
|
5497
|
+
const hasPrimary = primaryKeyword ? containsKeywordTokens2(slugAsWords, primaryKeyword) : true;
|
|
5498
|
+
const leads = primaryKeyword ? keywordLeadsUrl(slug, primaryKeyword) : true;
|
|
5499
|
+
const hasSecondary = secondaryKeyword ? containsKeywordTokens2(slugAsWords, secondaryKeyword) : true;
|
|
5500
|
+
if (primaryKeyword && !hasPrimary) {
|
|
5501
|
+
const secNote = secondaryKeyword && !hasSecondary ? ` Your secondary keyword "${secondaryKeyword}" could follow it.` : "";
|
|
5502
|
+
return {
|
|
5503
|
+
label: "URL Slug",
|
|
5504
|
+
value: `/${slug}`,
|
|
5505
|
+
status: "warning",
|
|
5506
|
+
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}`
|
|
5507
|
+
};
|
|
5508
|
+
}
|
|
5509
|
+
if (primaryKeyword && hasPrimary && !leads) {
|
|
5510
|
+
return {
|
|
5511
|
+
label: "URL Slug",
|
|
5512
|
+
value: `/${slug}`,
|
|
5513
|
+
status: "warning",
|
|
5514
|
+
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}`
|
|
5515
|
+
};
|
|
5516
|
+
}
|
|
5517
|
+
return { label: "URL Slug", value: `/${slug}`, status: "good" };
|
|
5518
|
+
}
|
|
5519
|
+
function SlugRedirectNotice() {
|
|
5520
|
+
const [expanded, setExpanded] = (0, import_react17.useState)(false);
|
|
5521
|
+
return /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("div", { style: { marginTop: 10, paddingTop: 10, borderTop: "1px solid rgba(0,0,0,0.07)" }, children: /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("div", { style: { padding: "8px 10px", background: "rgba(245,158,11,0.08)", borderLeft: "2px solid #f59e0b", borderRadius: 6 }, children: [
|
|
5522
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("div", { style: { display: "flex", alignItems: "center", gap: 6, marginBottom: 4 }, children: [
|
|
5523
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)("svg", { width: "12", height: "12", viewBox: "0 0 20 20", fill: "#f59e0b", "aria-hidden": "true", children: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("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" }) }),
|
|
5524
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)("span", { style: { fontSize: 10.5, fontWeight: 700, color: "#b45309", textTransform: "uppercase", letterSpacing: "0.06em" }, children: "Changing a URL?" })
|
|
5525
|
+
] }),
|
|
5526
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)("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." }),
|
|
5527
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(
|
|
5528
|
+
"button",
|
|
5529
|
+
{
|
|
5530
|
+
onClick: () => setExpanded((v) => !v),
|
|
5531
|
+
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" },
|
|
5532
|
+
children: [
|
|
5533
|
+
expanded ? "Show less" : "Learn more",
|
|
5534
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)("svg", { width: "10", height: "10", viewBox: "0 0 20 20", fill: "currentColor", style: { transform: expanded ? "rotate(180deg)" : "none", transition: "transform 150ms" }, children: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("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" }) })
|
|
5535
|
+
]
|
|
5536
|
+
}
|
|
5537
|
+
),
|
|
5538
|
+
expanded && /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("ul", { style: { margin: "6px 0 0", paddingLeft: 16, fontSize: 11, color: "#1f2937", lineHeight: 1.55 }, children: [
|
|
5539
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)("li", { children: "Without the 301, the page loses every search ranking and every external link to it breaks." }),
|
|
5540
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)("li", { children: "A 301 preserves the rankings and link equity built up on the old URL." }),
|
|
5541
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)("li", { children: "Set this up using vanity redirects in Sanity." })
|
|
5542
|
+
] })
|
|
5543
|
+
] }) });
|
|
5544
|
+
}
|
|
5070
5545
|
var cardStyle6 = {
|
|
5071
5546
|
borderRadius: 14,
|
|
5072
5547
|
background: "rgba(255,255,255,0.55)",
|
|
@@ -5082,7 +5557,7 @@ function StatusBadge2({ status }) {
|
|
|
5082
5557
|
error: { bg: "rgba(220,38,38,0.1)", color: "#dc2626", label: "Fix" }
|
|
5083
5558
|
};
|
|
5084
5559
|
const c = map[status];
|
|
5085
|
-
return /* @__PURE__ */ (0,
|
|
5560
|
+
return /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
|
|
5086
5561
|
"span",
|
|
5087
5562
|
{
|
|
5088
5563
|
style: {
|
|
@@ -5105,14 +5580,15 @@ function AuditCard2({
|
|
|
5105
5580
|
value,
|
|
5106
5581
|
status,
|
|
5107
5582
|
recommendation,
|
|
5108
|
-
anchorId
|
|
5583
|
+
anchorId,
|
|
5584
|
+
footer
|
|
5109
5585
|
}) {
|
|
5110
|
-
return /* @__PURE__ */ (0,
|
|
5111
|
-
/* @__PURE__ */ (0,
|
|
5112
|
-
/* @__PURE__ */ (0,
|
|
5113
|
-
/* @__PURE__ */ (0,
|
|
5586
|
+
return /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("div", { id: anchorId, style: cardStyle6, children: [
|
|
5587
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("div", { style: { display: "flex", alignItems: "center", justifyContent: "space-between", gap: 8, marginBottom: 6 }, children: [
|
|
5588
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)("span", { style: { fontSize: 10.5, textTransform: "uppercase", letterSpacing: "0.06em", color: "#4b5563", fontWeight: 600 }, children: label }),
|
|
5589
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)(StatusBadge2, { status })
|
|
5114
5590
|
] }),
|
|
5115
|
-
/* @__PURE__ */ (0,
|
|
5591
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
|
|
5116
5592
|
"div",
|
|
5117
5593
|
{
|
|
5118
5594
|
style: {
|
|
@@ -5125,7 +5601,7 @@ function AuditCard2({
|
|
|
5125
5601
|
children: value
|
|
5126
5602
|
}
|
|
5127
5603
|
),
|
|
5128
|
-
recommendation && /* @__PURE__ */ (0,
|
|
5604
|
+
recommendation && /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
|
|
5129
5605
|
"div",
|
|
5130
5606
|
{
|
|
5131
5607
|
style: {
|
|
@@ -5140,7 +5616,8 @@ function AuditCard2({
|
|
|
5140
5616
|
},
|
|
5141
5617
|
children: recommendation
|
|
5142
5618
|
}
|
|
5143
|
-
)
|
|
5619
|
+
),
|
|
5620
|
+
footer
|
|
5144
5621
|
] });
|
|
5145
5622
|
}
|
|
5146
5623
|
var IMAGE_EXT_RE = /\.(jpe?g|png|gif|webp|svg|tiff?|bmp)$/i;
|
|
@@ -5358,10 +5835,10 @@ function LinkCheckCard({
|
|
|
5358
5835
|
const issues = results.filter((r) => r.category !== "ok");
|
|
5359
5836
|
return { total, valid, redirects, broken, errored, unverified, issues };
|
|
5360
5837
|
}, [results]);
|
|
5361
|
-
return /* @__PURE__ */ (0,
|
|
5362
|
-
/* @__PURE__ */ (0,
|
|
5363
|
-
/* @__PURE__ */ (0,
|
|
5364
|
-
hasRun && !isLoading && /* @__PURE__ */ (0,
|
|
5838
|
+
return /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("div", { id: "anchor-link-check", style: cardStyle6, children: [
|
|
5839
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("div", { style: { display: "flex", alignItems: "center", justifyContent: "space-between", gap: 8, marginBottom: 6 }, children: [
|
|
5840
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)("span", { style: { fontSize: 10.5, textTransform: "uppercase", letterSpacing: "0.06em", color: "#4b5563", fontWeight: 600 }, children: "Link Health" }),
|
|
5841
|
+
hasRun && !isLoading && /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
|
|
5365
5842
|
"button",
|
|
5366
5843
|
{
|
|
5367
5844
|
onClick: onCheck,
|
|
@@ -5379,8 +5856,8 @@ function LinkCheckCard({
|
|
|
5379
5856
|
}
|
|
5380
5857
|
)
|
|
5381
5858
|
] }),
|
|
5382
|
-
/* @__PURE__ */ (0,
|
|
5383
|
-
urls.length > 0 && !hasRun && !isLoading && /* @__PURE__ */ (0,
|
|
5859
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)("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.` }),
|
|
5860
|
+
urls.length > 0 && !hasRun && !isLoading && /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(
|
|
5384
5861
|
"button",
|
|
5385
5862
|
{
|
|
5386
5863
|
onClick: onCheck,
|
|
@@ -5405,9 +5882,9 @@ function LinkCheckCard({
|
|
|
5405
5882
|
]
|
|
5406
5883
|
}
|
|
5407
5884
|
),
|
|
5408
|
-
isLoading && /* @__PURE__ */ (0,
|
|
5409
|
-
/* @__PURE__ */ (0,
|
|
5410
|
-
/* @__PURE__ */ (0,
|
|
5885
|
+
isLoading && /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("div", { style: { display: "flex", alignItems: "center", justifyContent: "center", gap: 8, padding: "16px 0" }, children: [
|
|
5886
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)(LoadingBars, { size: "xs", color: MJH_BLUE }),
|
|
5887
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("span", { style: { fontSize: 11, color: "#4b5563" }, children: [
|
|
5411
5888
|
"Checking ",
|
|
5412
5889
|
urls.length,
|
|
5413
5890
|
" link",
|
|
@@ -5415,7 +5892,7 @@ function LinkCheckCard({
|
|
|
5415
5892
|
"..."
|
|
5416
5893
|
] })
|
|
5417
5894
|
] }),
|
|
5418
|
-
error && !isLoading && /* @__PURE__ */ (0,
|
|
5895
|
+
error && !isLoading && /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(
|
|
5419
5896
|
"div",
|
|
5420
5897
|
{
|
|
5421
5898
|
style: {
|
|
@@ -5429,7 +5906,7 @@ function LinkCheckCard({
|
|
|
5429
5906
|
},
|
|
5430
5907
|
children: [
|
|
5431
5908
|
error,
|
|
5432
|
-
/* @__PURE__ */ (0,
|
|
5909
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
|
|
5433
5910
|
"button",
|
|
5434
5911
|
{
|
|
5435
5912
|
onClick: onCheck,
|
|
@@ -5451,15 +5928,15 @@ function LinkCheckCard({
|
|
|
5451
5928
|
]
|
|
5452
5929
|
}
|
|
5453
5930
|
),
|
|
5454
|
-
hasRun && !isLoading && !error && /* @__PURE__ */ (0,
|
|
5455
|
-
/* @__PURE__ */ (0,
|
|
5456
|
-
/* @__PURE__ */ (0,
|
|
5457
|
-
/* @__PURE__ */ (0,
|
|
5458
|
-
/* @__PURE__ */ (0,
|
|
5459
|
-
/* @__PURE__ */ (0,
|
|
5460
|
-
counts.unverified > 0 && /* @__PURE__ */ (0,
|
|
5931
|
+
hasRun && !isLoading && !error && /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(import_jsx_runtime15.Fragment, { children: [
|
|
5932
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("div", { style: { display: "grid", gridTemplateColumns: counts.unverified > 0 ? "repeat(5, 1fr)" : "repeat(4, 1fr)", gap: 6 }, children: [
|
|
5933
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)(StatTile, { label: "Checked", value: counts.total, color: "#475569" }),
|
|
5934
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)(StatTile, { label: "Valid", value: counts.valid, color: "#16a34a" }),
|
|
5935
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)(StatTile, { label: "Redirects", value: counts.redirects, color: "#8B7310" }),
|
|
5936
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)(StatTile, { label: "Broken", value: counts.broken + counts.errored, color: "#dc2626" }),
|
|
5937
|
+
counts.unverified > 0 && /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(StatTile, { label: "Blocked", value: counts.unverified, color: "#b45309" })
|
|
5461
5938
|
] }),
|
|
5462
|
-
counts.unverified > 0 && /* @__PURE__ */ (0,
|
|
5939
|
+
counts.unverified > 0 && /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(
|
|
5463
5940
|
"div",
|
|
5464
5941
|
{
|
|
5465
5942
|
style: {
|
|
@@ -5480,8 +5957,8 @@ function LinkCheckCard({
|
|
|
5480
5957
|
]
|
|
5481
5958
|
}
|
|
5482
5959
|
),
|
|
5483
|
-
counts.issues.length > 0 ? /* @__PURE__ */ (0,
|
|
5484
|
-
/* @__PURE__ */ (0,
|
|
5960
|
+
counts.issues.length > 0 ? /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("div", { style: { marginTop: 12, display: "flex", flexDirection: "column", gap: 6 }, children: [
|
|
5961
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("div", { style: { fontSize: 10, fontWeight: 700, color: "#4b5563", textTransform: "uppercase", letterSpacing: "0.06em" }, children: [
|
|
5485
5962
|
counts.issues.length,
|
|
5486
5963
|
" link",
|
|
5487
5964
|
counts.issues.length === 1 ? "" : "s",
|
|
@@ -5489,8 +5966,8 @@ function LinkCheckCard({
|
|
|
5489
5966
|
counts.issues.length === 1 ? "s" : "",
|
|
5490
5967
|
" attention"
|
|
5491
5968
|
] }),
|
|
5492
|
-
counts.issues.map((r) => /* @__PURE__ */ (0,
|
|
5493
|
-
] }) : /* @__PURE__ */ (0,
|
|
5969
|
+
counts.issues.map((r) => /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(LinkIssueRow, { result: r }, r.url))
|
|
5970
|
+
] }) : /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(
|
|
5494
5971
|
"div",
|
|
5495
5972
|
{
|
|
5496
5973
|
style: {
|
|
@@ -5517,7 +5994,7 @@ function LinkCheckCard({
|
|
|
5517
5994
|
] });
|
|
5518
5995
|
}
|
|
5519
5996
|
function StatTile({ label, value, color }) {
|
|
5520
|
-
return /* @__PURE__ */ (0,
|
|
5997
|
+
return /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(
|
|
5521
5998
|
"div",
|
|
5522
5999
|
{
|
|
5523
6000
|
style: {
|
|
@@ -5527,8 +6004,8 @@ function StatTile({ label, value, color }) {
|
|
|
5527
6004
|
textAlign: "center"
|
|
5528
6005
|
},
|
|
5529
6006
|
children: [
|
|
5530
|
-
/* @__PURE__ */ (0,
|
|
5531
|
-
/* @__PURE__ */ (0,
|
|
6007
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)("div", { style: { fontSize: 18, fontWeight: 700, color, fontVariantNumeric: "tabular-nums", lineHeight: 1 }, children: value }),
|
|
6008
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)("div", { style: { fontSize: 9, fontWeight: 700, color: "#4b5563", textTransform: "uppercase", letterSpacing: "0.06em", marginTop: 4 }, children: label })
|
|
5532
6009
|
]
|
|
5533
6010
|
}
|
|
5534
6011
|
);
|
|
@@ -5544,7 +6021,7 @@ function LinkIssueRow({ result }) {
|
|
|
5544
6021
|
};
|
|
5545
6022
|
const c = map[result.category];
|
|
5546
6023
|
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;
|
|
5547
|
-
return /* @__PURE__ */ (0,
|
|
6024
|
+
return /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(
|
|
5548
6025
|
"a",
|
|
5549
6026
|
{
|
|
5550
6027
|
href: result.url,
|
|
@@ -5560,7 +6037,7 @@ function LinkIssueRow({ result }) {
|
|
|
5560
6037
|
textDecoration: "none"
|
|
5561
6038
|
},
|
|
5562
6039
|
children: [
|
|
5563
|
-
/* @__PURE__ */ (0,
|
|
6040
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
|
|
5564
6041
|
"span",
|
|
5565
6042
|
{
|
|
5566
6043
|
style: {
|
|
@@ -5577,7 +6054,7 @@ function LinkIssueRow({ result }) {
|
|
|
5577
6054
|
children: c.label
|
|
5578
6055
|
}
|
|
5579
6056
|
),
|
|
5580
|
-
/* @__PURE__ */ (0,
|
|
6057
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
|
|
5581
6058
|
"span",
|
|
5582
6059
|
{
|
|
5583
6060
|
style: {
|
|
@@ -5601,6 +6078,8 @@ function LinkIssueRow({ result }) {
|
|
|
5601
6078
|
function TechnicalTab({
|
|
5602
6079
|
text,
|
|
5603
6080
|
documentFields,
|
|
6081
|
+
primaryKeyword,
|
|
6082
|
+
secondaryKeyword,
|
|
5604
6083
|
isLoading,
|
|
5605
6084
|
linkCheckResults,
|
|
5606
6085
|
isLinkCheckLoading,
|
|
@@ -5608,6 +6087,10 @@ function TechnicalTab({
|
|
|
5608
6087
|
hasRunLinkCheck,
|
|
5609
6088
|
onCheckLinks
|
|
5610
6089
|
}) {
|
|
6090
|
+
const urlSlugAudit = (0, import_react17.useMemo)(
|
|
6091
|
+
() => urlAudit(documentFields?.slug, primaryKeyword, secondaryKeyword),
|
|
6092
|
+
[documentFields?.slug, primaryKeyword, secondaryKeyword]
|
|
6093
|
+
);
|
|
5611
6094
|
const headings = documentFields?.headings || [];
|
|
5612
6095
|
const headingsDetailed = documentFields?.headingsDetailed;
|
|
5613
6096
|
const headingsForStructure = headingsDetailed ? headingsDetailed : headings.map((text2) => ({ text: text2, level: 2 }));
|
|
@@ -5642,7 +6125,8 @@ function TechnicalTab({
|
|
|
5642
6125
|
status: "warning",
|
|
5643
6126
|
recommendation: "Add at least one hero image with descriptive alt text. Articles with images perform better on both reader engagement and search."
|
|
5644
6127
|
} : null;
|
|
5645
|
-
const
|
|
6128
|
+
const isShortForm = isShortFormContent(documentFields, documentFields?.title);
|
|
6129
|
+
const wordAudit = wordCount2 === 0 ? null : isShortForm ? { label: "Word Count", value: `${wordCount2} words`, status: "good" } : wordCount2 < 450 ? {
|
|
5646
6130
|
label: "Word Count",
|
|
5647
6131
|
value: `${wordCount2} words`,
|
|
5648
6132
|
status: "error",
|
|
@@ -5656,13 +6140,24 @@ function TechnicalTab({
|
|
|
5656
6140
|
const bodyLinks = documentFields?.bodyLinks || [];
|
|
5657
6141
|
const hasAnyField = !!documentFields && (documentFields.title !== void 0 || documentFields.headings && documentFields.headings.length > 0 || documentFields.imageNames && documentFields.imageNames.length > 0 || wordCount2 > 0);
|
|
5658
6142
|
if (isLoading && !hasAnyField) {
|
|
5659
|
-
return /* @__PURE__ */ (0,
|
|
5660
|
-
/* @__PURE__ */ (0,
|
|
5661
|
-
/* @__PURE__ */ (0,
|
|
6143
|
+
return /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("div", { style: { padding: 24, textAlign: "center" }, children: [
|
|
6144
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)("div", { style: { fontSize: 13, color: "#4b5563", fontWeight: 500 }, children: "Reading document fields..." }),
|
|
6145
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)("div", { style: { fontSize: 11, color: "#4b5563", marginTop: 4 }, children: "Audit will run once content loads" })
|
|
5662
6146
|
] });
|
|
5663
6147
|
}
|
|
5664
|
-
return /* @__PURE__ */ (0,
|
|
5665
|
-
|
|
6148
|
+
return /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("div", { style: { padding: 12, display: "flex", flexDirection: "column", gap: 10 }, children: [
|
|
6149
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
|
|
6150
|
+
AuditCard2,
|
|
6151
|
+
{
|
|
6152
|
+
anchorId: "anchor-url-slug",
|
|
6153
|
+
label: urlSlugAudit.label,
|
|
6154
|
+
value: urlSlugAudit.value,
|
|
6155
|
+
status: urlSlugAudit.status,
|
|
6156
|
+
recommendation: urlSlugAudit.recommendation,
|
|
6157
|
+
footer: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(SlugRedirectNotice, {})
|
|
6158
|
+
}
|
|
6159
|
+
),
|
|
6160
|
+
wordAudit && /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
|
|
5666
6161
|
AuditCard2,
|
|
5667
6162
|
{
|
|
5668
6163
|
anchorId: "anchor-word-count",
|
|
@@ -5672,7 +6167,7 @@ function TechnicalTab({
|
|
|
5672
6167
|
recommendation: wordAudit.recommendation
|
|
5673
6168
|
}
|
|
5674
6169
|
),
|
|
5675
|
-
structureAudits.map((a, i) => /* @__PURE__ */ (0,
|
|
6170
|
+
structureAudits.map((a, i) => /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
|
|
5676
6171
|
AuditCard2,
|
|
5677
6172
|
{
|
|
5678
6173
|
anchorId: i === 0 ? "anchor-headings-structure" : void 0,
|
|
@@ -5683,10 +6178,10 @@ function TechnicalTab({
|
|
|
5683
6178
|
},
|
|
5684
6179
|
`structure-${i}`
|
|
5685
6180
|
)),
|
|
5686
|
-
headings.length > 0 && /* @__PURE__ */ (0,
|
|
5687
|
-
/* @__PURE__ */ (0,
|
|
5688
|
-
/* @__PURE__ */ (0,
|
|
5689
|
-
(headingsDetailed ? headingsDetailed.slice(0, 12) : headings.slice(0, 12).map((h) => ({ text: h, level: 2 }))).map((h, i) => /* @__PURE__ */ (0,
|
|
6181
|
+
headings.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("div", { id: "anchor-headings-outline", style: { ...cardStyle6, padding: "8px 14px" }, children: [
|
|
6182
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)("div", { style: { fontSize: 10, color: "#4b5563", textTransform: "uppercase", letterSpacing: "0.06em", fontWeight: 600, marginBottom: 6 }, children: "Heading Outline" }),
|
|
6183
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("div", { style: { display: "flex", flexDirection: "column", gap: 4 }, children: [
|
|
6184
|
+
(headingsDetailed ? headingsDetailed.slice(0, 12) : headings.slice(0, 12).map((h) => ({ text: h, level: 2 }))).map((h, i) => /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(
|
|
5690
6185
|
"div",
|
|
5691
6186
|
{
|
|
5692
6187
|
style: {
|
|
@@ -5697,7 +6192,7 @@ function TechnicalTab({
|
|
|
5697
6192
|
paddingLeft: Math.max(0, (h.level - 2) * 12)
|
|
5698
6193
|
},
|
|
5699
6194
|
children: [
|
|
5700
|
-
/* @__PURE__ */ (0,
|
|
6195
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("span", { style: { fontSize: 9, fontWeight: 700, color: "#4b5563", marginRight: 6 }, children: [
|
|
5701
6196
|
"H",
|
|
5702
6197
|
h.level
|
|
5703
6198
|
] }),
|
|
@@ -5706,14 +6201,14 @@ function TechnicalTab({
|
|
|
5706
6201
|
},
|
|
5707
6202
|
i
|
|
5708
6203
|
)),
|
|
5709
|
-
headings.length > 12 && /* @__PURE__ */ (0,
|
|
6204
|
+
headings.length > 12 && /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("div", { style: { fontSize: 10, color: "#4b5563" }, children: [
|
|
5710
6205
|
"+ ",
|
|
5711
6206
|
headings.length - 12,
|
|
5712
6207
|
" more"
|
|
5713
6208
|
] })
|
|
5714
6209
|
] })
|
|
5715
6210
|
] }),
|
|
5716
|
-
imagesAudit && /* @__PURE__ */ (0,
|
|
6211
|
+
imagesAudit && /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
|
|
5717
6212
|
AuditCard2,
|
|
5718
6213
|
{
|
|
5719
6214
|
anchorId: "anchor-images",
|
|
@@ -5723,7 +6218,7 @@ function TechnicalTab({
|
|
|
5723
6218
|
recommendation: imagesAudit.recommendation
|
|
5724
6219
|
}
|
|
5725
6220
|
),
|
|
5726
|
-
filenameAudit && /* @__PURE__ */ (0,
|
|
6221
|
+
filenameAudit && /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
|
|
5727
6222
|
AuditCard2,
|
|
5728
6223
|
{
|
|
5729
6224
|
anchorId: "anchor-image-filenames",
|
|
@@ -5733,7 +6228,7 @@ function TechnicalTab({
|
|
|
5733
6228
|
recommendation: filenameAudit.recommendation
|
|
5734
6229
|
}
|
|
5735
6230
|
),
|
|
5736
|
-
altTextAudit && /* @__PURE__ */ (0,
|
|
6231
|
+
altTextAudit && /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
|
|
5737
6232
|
AuditCard2,
|
|
5738
6233
|
{
|
|
5739
6234
|
anchorId: "anchor-image-alt",
|
|
@@ -5743,7 +6238,7 @@ function TechnicalTab({
|
|
|
5743
6238
|
recommendation: altTextAudit.recommendation
|
|
5744
6239
|
}
|
|
5745
6240
|
),
|
|
5746
|
-
imgTitleAudit && /* @__PURE__ */ (0,
|
|
6241
|
+
imgTitleAudit && /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
|
|
5747
6242
|
AuditCard2,
|
|
5748
6243
|
{
|
|
5749
6244
|
anchorId: "anchor-image-titles",
|
|
@@ -5753,7 +6248,7 @@ function TechnicalTab({
|
|
|
5753
6248
|
recommendation: imgTitleAudit.recommendation
|
|
5754
6249
|
}
|
|
5755
6250
|
),
|
|
5756
|
-
/* @__PURE__ */ (0,
|
|
6251
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
|
|
5757
6252
|
LinkCheckCard,
|
|
5758
6253
|
{
|
|
5759
6254
|
urls: bodyLinks,
|
|
@@ -5768,12 +6263,12 @@ function TechnicalTab({
|
|
|
5768
6263
|
}
|
|
5769
6264
|
|
|
5770
6265
|
// src/components/SEOCopilotPanel.tsx
|
|
5771
|
-
var
|
|
6266
|
+
var import_jsx_runtime16 = require("react/jsx-runtime");
|
|
5772
6267
|
function LogoIcon2() {
|
|
5773
|
-
return /* @__PURE__ */ (0,
|
|
5774
|
-
/* @__PURE__ */ (0,
|
|
5775
|
-
/* @__PURE__ */ (0,
|
|
5776
|
-
/* @__PURE__ */ (0,
|
|
6268
|
+
return /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("svg", { width: "16", height: "16", viewBox: "0 0 16 16", fill: "none", children: [
|
|
6269
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)("rect", { x: "1", y: "3", width: "4", height: "10", rx: "1", fill: MJH_GOLD, opacity: "1" }),
|
|
6270
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)("rect", { x: "6", y: "1", width: "4", height: "14", rx: "1", fill: MJH_GOLD, opacity: "0.85" }),
|
|
6271
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)("rect", { x: "11", y: "5", width: "4", height: "8", rx: "1", fill: MJH_GOLD, opacity: "0.6" })
|
|
5777
6272
|
] });
|
|
5778
6273
|
}
|
|
5779
6274
|
function PanelContent({
|
|
@@ -5791,8 +6286,12 @@ function PanelContent({
|
|
|
5791
6286
|
docLoading,
|
|
5792
6287
|
documentFields,
|
|
5793
6288
|
documentId,
|
|
6289
|
+
documentType,
|
|
6290
|
+
sanityBaseUrl,
|
|
5794
6291
|
selectedPrimary,
|
|
5795
6292
|
onSelectPrimary,
|
|
6293
|
+
selectedSecondary,
|
|
6294
|
+
onSelectSecondary,
|
|
5796
6295
|
activeTab,
|
|
5797
6296
|
onActiveTabChange,
|
|
5798
6297
|
chatOpen,
|
|
@@ -5810,6 +6309,7 @@ function PanelContent({
|
|
|
5810
6309
|
const isLoading = externalAnalysis.isLoading;
|
|
5811
6310
|
const keywordAnalysisState = externalAnalysis;
|
|
5812
6311
|
const effectivePrimary = selectedPrimary || externalAnalysis.analysis?.primaryKeyword?.term || "";
|
|
6312
|
+
const effectiveSecondary = selectedSecondary || "";
|
|
5813
6313
|
const containerRef = (0, import_react18.useRef)(null);
|
|
5814
6314
|
const dragging = (0, import_react18.useRef)(false);
|
|
5815
6315
|
const onMouseDown = (0, import_react18.useCallback)(() => {
|
|
@@ -5837,6 +6337,68 @@ function PanelContent({
|
|
|
5837
6337
|
};
|
|
5838
6338
|
}, [onSplitPercentChange]);
|
|
5839
6339
|
const headerCursor = isFloating ? "grab" : "default";
|
|
6340
|
+
const onboardSite = publication || "default";
|
|
6341
|
+
const onboardKey = `seo-copilot-onboarded-${onboardSite}`;
|
|
6342
|
+
const onboardSessionKey = `seo-copilot-onboard-shown-${onboardSite}`;
|
|
6343
|
+
const [popupMode, setPopupMode] = (0, import_react18.useState)("hidden");
|
|
6344
|
+
const [popupClosing, setPopupClosing] = (0, import_react18.useState)(false);
|
|
6345
|
+
const onboardTimerRef = (0, import_react18.useRef)(null);
|
|
6346
|
+
(0, import_react18.useEffect)(() => {
|
|
6347
|
+
let onboarded = false;
|
|
6348
|
+
let shownThisSession = false;
|
|
6349
|
+
try {
|
|
6350
|
+
onboarded = localStorage.getItem(onboardKey) === "1";
|
|
6351
|
+
} catch {
|
|
6352
|
+
}
|
|
6353
|
+
try {
|
|
6354
|
+
shownThisSession = sessionStorage.getItem(onboardSessionKey) === "1";
|
|
6355
|
+
} catch {
|
|
6356
|
+
}
|
|
6357
|
+
if (!onboarded && !shownThisSession) {
|
|
6358
|
+
setPopupMode("auto");
|
|
6359
|
+
try {
|
|
6360
|
+
sessionStorage.setItem(onboardSessionKey, "1");
|
|
6361
|
+
} catch {
|
|
6362
|
+
}
|
|
6363
|
+
onboardTimerRef.current = setTimeout(() => {
|
|
6364
|
+
setPopupClosing(true);
|
|
6365
|
+
setTimeout(() => {
|
|
6366
|
+
setPopupMode("hidden");
|
|
6367
|
+
setPopupClosing(false);
|
|
6368
|
+
}, 180);
|
|
6369
|
+
}, 5e3);
|
|
6370
|
+
}
|
|
6371
|
+
return () => {
|
|
6372
|
+
if (onboardTimerRef.current) clearTimeout(onboardTimerRef.current);
|
|
6373
|
+
};
|
|
6374
|
+
}, [onboardKey, onboardSessionKey]);
|
|
6375
|
+
const markOnboarded = (0, import_react18.useCallback)(() => {
|
|
6376
|
+
try {
|
|
6377
|
+
localStorage.setItem(onboardKey, "1");
|
|
6378
|
+
} catch {
|
|
6379
|
+
}
|
|
6380
|
+
}, [onboardKey]);
|
|
6381
|
+
const dismissPopup = (0, import_react18.useCallback)(() => {
|
|
6382
|
+
if (onboardTimerRef.current) clearTimeout(onboardTimerRef.current);
|
|
6383
|
+
markOnboarded();
|
|
6384
|
+
setPopupClosing(true);
|
|
6385
|
+
setTimeout(() => {
|
|
6386
|
+
setPopupMode("hidden");
|
|
6387
|
+
setPopupClosing(false);
|
|
6388
|
+
}, 180);
|
|
6389
|
+
}, [markOnboarded]);
|
|
6390
|
+
const openPopupPersistent = (0, import_react18.useCallback)(() => {
|
|
6391
|
+
if (onboardTimerRef.current) clearTimeout(onboardTimerRef.current);
|
|
6392
|
+
markOnboarded();
|
|
6393
|
+
setPopupClosing(false);
|
|
6394
|
+
setPopupMode("persistent");
|
|
6395
|
+
}, [markOnboarded]);
|
|
6396
|
+
const handleTabChange = (0, import_react18.useCallback)((id) => {
|
|
6397
|
+
markOnboarded();
|
|
6398
|
+
if (onboardTimerRef.current) clearTimeout(onboardTimerRef.current);
|
|
6399
|
+
setPopupMode((m) => m === "hidden" ? m : "hidden");
|
|
6400
|
+
onActiveTabChange(id);
|
|
6401
|
+
}, [markOnboarded, onActiveTabChange]);
|
|
5840
6402
|
const tabDefs = [
|
|
5841
6403
|
{ id: "summary", label: "Summary", isHub: true, loading: summaryOps.isAnyLoading },
|
|
5842
6404
|
{ id: "keywords", label: "Keywords", loading: keywordAnalysisState.isLoading || keywordAnalysisState.isVolumesLoading },
|
|
@@ -5845,7 +6407,7 @@ function PanelContent({
|
|
|
5845
6407
|
{ id: "meta", label: "Meta", beta: true },
|
|
5846
6408
|
{ id: "technical", label: "Other Recs", beta: true, loading: technicalOps.isLinkCheckLoading }
|
|
5847
6409
|
];
|
|
5848
|
-
return /* @__PURE__ */ (0,
|
|
6410
|
+
return /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)(
|
|
5849
6411
|
"div",
|
|
5850
6412
|
{
|
|
5851
6413
|
className: "seo-copilot-panel",
|
|
@@ -5856,11 +6418,13 @@ function PanelContent({
|
|
|
5856
6418
|
// backgroundColor (longhand) so the sheen background-image in INJECTED_CSS isn't reset
|
|
5857
6419
|
backgroundColor: PANEL_BG,
|
|
5858
6420
|
fontFamily: "-apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif",
|
|
5859
|
-
opacity: 1
|
|
6421
|
+
opacity: 1,
|
|
6422
|
+
position: "relative"
|
|
5860
6423
|
},
|
|
5861
6424
|
children: [
|
|
5862
|
-
/* @__PURE__ */ (0,
|
|
5863
|
-
/* @__PURE__ */ (0,
|
|
6425
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)("style", { dangerouslySetInnerHTML: { __html: INJECTED_CSS } }),
|
|
6426
|
+
popupMode !== "hidden" && /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(OnboardingCard, { onDismiss: dismissPopup, closing: popupClosing }),
|
|
6427
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsxs)(
|
|
5864
6428
|
"div",
|
|
5865
6429
|
{
|
|
5866
6430
|
onMouseDown: isFloating ? onDragStart : void 0,
|
|
@@ -5878,15 +6442,16 @@ function PanelContent({
|
|
|
5878
6442
|
flexShrink: 0
|
|
5879
6443
|
},
|
|
5880
6444
|
children: [
|
|
5881
|
-
/* @__PURE__ */ (0,
|
|
5882
|
-
/* @__PURE__ */ (0,
|
|
5883
|
-
/* @__PURE__ */ (0,
|
|
5884
|
-
/* @__PURE__ */ (0,
|
|
5885
|
-
/* @__PURE__ */ (0,
|
|
6445
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("div", { style: { display: "flex", alignItems: "center", gap: 6 }, children: [
|
|
6446
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)(LogoIcon2, {}),
|
|
6447
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("span", { style: { fontWeight: 700, fontSize: 15, letterSpacing: "-0.01em" }, children: [
|
|
6448
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)("span", { style: { color: MJH_GOLD }, children: "SEO" }),
|
|
6449
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)("span", { style: { color: MJH_SLATE }, children: " copilot" })
|
|
5886
6450
|
] })
|
|
5887
6451
|
] }),
|
|
5888
|
-
/* @__PURE__ */ (0,
|
|
5889
|
-
|
|
6452
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("div", { style: { display: "flex", alignItems: "center", gap: isFloating ? 4 : 6 }, children: [
|
|
6453
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)(OnboardingInfoButton, { onClick: openPopupPersistent }),
|
|
6454
|
+
isFloating && onToggleFullscreen && /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
|
|
5890
6455
|
"button",
|
|
5891
6456
|
{
|
|
5892
6457
|
onClick: (e) => {
|
|
@@ -5908,16 +6473,16 @@ function PanelContent({
|
|
|
5908
6473
|
fontWeight: 600,
|
|
5909
6474
|
transition: "all 150ms"
|
|
5910
6475
|
},
|
|
5911
|
-
children: isFullscreen ? /* @__PURE__ */ (0,
|
|
5912
|
-
/* @__PURE__ */ (0,
|
|
6476
|
+
children: isFullscreen ? /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)(import_jsx_runtime16.Fragment, { children: [
|
|
6477
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)("svg", { width: "12", height: "12", viewBox: "0 0 20 20", fill: "currentColor", children: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("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" }) }),
|
|
5913
6478
|
"Exit fullscreen"
|
|
5914
|
-
] }) : /* @__PURE__ */ (0,
|
|
5915
|
-
/* @__PURE__ */ (0,
|
|
6479
|
+
] }) : /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)(import_jsx_runtime16.Fragment, { children: [
|
|
6480
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)("svg", { width: "12", height: "12", viewBox: "0 0 20 20", fill: "currentColor", children: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("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" }) }),
|
|
5916
6481
|
"Fullscreen"
|
|
5917
6482
|
] })
|
|
5918
6483
|
}
|
|
5919
6484
|
),
|
|
5920
|
-
isFloating && onToggleFloat && /* @__PURE__ */ (0,
|
|
6485
|
+
isFloating && onToggleFloat && /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)(
|
|
5921
6486
|
"button",
|
|
5922
6487
|
{
|
|
5923
6488
|
onClick: (e) => {
|
|
@@ -5940,7 +6505,7 @@ function PanelContent({
|
|
|
5940
6505
|
transition: "all 150ms"
|
|
5941
6506
|
},
|
|
5942
6507
|
children: [
|
|
5943
|
-
/* @__PURE__ */ (0,
|
|
6508
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)("svg", { width: "12", height: "12", viewBox: "0 0 20 20", fill: "currentColor", children: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
|
|
5944
6509
|
"path",
|
|
5945
6510
|
{
|
|
5946
6511
|
fillRule: "evenodd",
|
|
@@ -5952,7 +6517,7 @@ function PanelContent({
|
|
|
5952
6517
|
]
|
|
5953
6518
|
}
|
|
5954
6519
|
),
|
|
5955
|
-
!isFloating && onToggleFloat && /* @__PURE__ */ (0,
|
|
6520
|
+
!isFloating && onToggleFloat && /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
|
|
5956
6521
|
"button",
|
|
5957
6522
|
{
|
|
5958
6523
|
onClick: (e) => {
|
|
@@ -5971,13 +6536,13 @@ function PanelContent({
|
|
|
5971
6536
|
transition: "color 150ms"
|
|
5972
6537
|
},
|
|
5973
6538
|
title: "Pop out",
|
|
5974
|
-
children: /* @__PURE__ */ (0,
|
|
5975
|
-
/* @__PURE__ */ (0,
|
|
5976
|
-
/* @__PURE__ */ (0,
|
|
6539
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("svg", { width: "14", height: "14", viewBox: "0 0 20 20", fill: "currentColor", children: [
|
|
6540
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)("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" }),
|
|
6541
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)("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" })
|
|
5977
6542
|
] })
|
|
5978
6543
|
}
|
|
5979
6544
|
),
|
|
5980
|
-
isLoading && /* @__PURE__ */ (0,
|
|
6545
|
+
isLoading && /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
|
|
5981
6546
|
"div",
|
|
5982
6547
|
{
|
|
5983
6548
|
style: {
|
|
@@ -5989,7 +6554,7 @@ function PanelContent({
|
|
|
5989
6554
|
}
|
|
5990
6555
|
}
|
|
5991
6556
|
),
|
|
5992
|
-
onClose && /* @__PURE__ */ (0,
|
|
6557
|
+
onClose && /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
|
|
5993
6558
|
"button",
|
|
5994
6559
|
{
|
|
5995
6560
|
onClick: (e) => {
|
|
@@ -6008,11 +6573,11 @@ function PanelContent({
|
|
|
6008
6573
|
transition: "color 150ms"
|
|
6009
6574
|
},
|
|
6010
6575
|
title: "Close",
|
|
6011
|
-
children: /* @__PURE__ */ (0,
|
|
6576
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("svg", { width: "14", height: "14", viewBox: "0 0 20 20", fill: "currentColor", children: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("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" }) })
|
|
6012
6577
|
}
|
|
6013
6578
|
)
|
|
6014
6579
|
] }),
|
|
6015
|
-
/* @__PURE__ */ (0,
|
|
6580
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
|
|
6016
6581
|
"div",
|
|
6017
6582
|
{
|
|
6018
6583
|
style: {
|
|
@@ -6031,8 +6596,8 @@ function PanelContent({
|
|
|
6031
6596
|
]
|
|
6032
6597
|
}
|
|
6033
6598
|
),
|
|
6034
|
-
/* @__PURE__ */ (0,
|
|
6035
|
-
/* @__PURE__ */ (0,
|
|
6599
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)(TabBar, { tabs: tabDefs, activeTab, onTabChange: handleTabChange }),
|
|
6600
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
|
|
6036
6601
|
"div",
|
|
6037
6602
|
{
|
|
6038
6603
|
style: {
|
|
@@ -6048,8 +6613,8 @@ function PanelContent({
|
|
|
6048
6613
|
children: "Recommendations are generated by AI. Verify details before publishing."
|
|
6049
6614
|
}
|
|
6050
6615
|
),
|
|
6051
|
-
/* @__PURE__ */ (0,
|
|
6052
|
-
/* @__PURE__ */ (0,
|
|
6616
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("div", { ref: containerRef, style: { flex: 1, display: "flex", flexDirection: "column", overflow: "hidden" }, children: [
|
|
6617
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsxs)(
|
|
6053
6618
|
"div",
|
|
6054
6619
|
{
|
|
6055
6620
|
style: {
|
|
@@ -6060,7 +6625,7 @@ function PanelContent({
|
|
|
6060
6625
|
background: RECS_ZONE_BG
|
|
6061
6626
|
},
|
|
6062
6627
|
children: [
|
|
6063
|
-
/* @__PURE__ */ (0,
|
|
6628
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)("div", { style: { display: activeTab === "keywords" ? "block" : "none" }, children: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
|
|
6064
6629
|
KeywordPanel,
|
|
6065
6630
|
{
|
|
6066
6631
|
text,
|
|
@@ -6068,19 +6633,23 @@ function PanelContent({
|
|
|
6068
6633
|
seedKeywords,
|
|
6069
6634
|
onSeedsChange,
|
|
6070
6635
|
onSelectPrimary,
|
|
6636
|
+
secondaryKeyword: effectiveSecondary,
|
|
6637
|
+
onSelectSecondary,
|
|
6071
6638
|
documentFields,
|
|
6072
6639
|
documentId,
|
|
6073
6640
|
externalAnalysis: keywordAnalysisState
|
|
6074
6641
|
},
|
|
6075
6642
|
documentId || "default"
|
|
6076
6643
|
) }),
|
|
6077
|
-
/* @__PURE__ */ (0,
|
|
6644
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)("div", { style: { display: activeTab === "summary" ? "block" : "none" }, children: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
|
|
6078
6645
|
SummaryTab,
|
|
6079
6646
|
{
|
|
6080
6647
|
text,
|
|
6081
6648
|
analysis: keywordAnalysisState.analysis,
|
|
6082
6649
|
deepAnalysis: keywordAnalysisState.deepAnalysis,
|
|
6083
6650
|
documentFields,
|
|
6651
|
+
primaryKeyword: effectivePrimary,
|
|
6652
|
+
secondaryKeyword: effectiveSecondary,
|
|
6084
6653
|
linkingSuggestions: linkingOps.suggestions,
|
|
6085
6654
|
linkCheckResults: technicalOps.linkCheckResults,
|
|
6086
6655
|
isAnyLoading: summaryOps.isAnyLoading,
|
|
@@ -6088,7 +6657,7 @@ function PanelContent({
|
|
|
6088
6657
|
onItemClick: summaryOps.onItemClick
|
|
6089
6658
|
}
|
|
6090
6659
|
) }),
|
|
6091
|
-
/* @__PURE__ */ (0,
|
|
6660
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)("div", { style: { display: activeTab === "aeo" ? "block" : "none" }, children: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
|
|
6092
6661
|
AEOTab,
|
|
6093
6662
|
{
|
|
6094
6663
|
text,
|
|
@@ -6105,7 +6674,7 @@ function PanelContent({
|
|
|
6105
6674
|
loadContentSuggestions: aeoOps.loadContentSuggestions
|
|
6106
6675
|
}
|
|
6107
6676
|
) }),
|
|
6108
|
-
/* @__PURE__ */ (0,
|
|
6677
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)("div", { style: { display: activeTab === "linking" ? "block" : "none" }, children: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
|
|
6109
6678
|
LinkingTab,
|
|
6110
6679
|
{
|
|
6111
6680
|
analysis: keywordAnalysisState.analysis,
|
|
@@ -6116,16 +6685,20 @@ function PanelContent({
|
|
|
6116
6685
|
onRefresh: linkingOps.refresh,
|
|
6117
6686
|
documentId,
|
|
6118
6687
|
publication,
|
|
6119
|
-
text
|
|
6688
|
+
text,
|
|
6689
|
+
sanityBaseUrl,
|
|
6690
|
+
documentType
|
|
6120
6691
|
}
|
|
6121
6692
|
) }),
|
|
6122
|
-
/* @__PURE__ */ (0,
|
|
6123
|
-
/* @__PURE__ */ (0,
|
|
6693
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)("div", { style: { display: activeTab === "meta" ? "block" : "none" }, children: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(MetaTab, { documentFields, primaryKeyword: effectivePrimary, secondaryKeyword: effectiveSecondary, isLoading: docLoading }) }),
|
|
6694
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)("div", { style: { display: activeTab === "technical" ? "block" : "none" }, children: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
|
|
6124
6695
|
TechnicalTab,
|
|
6125
6696
|
{
|
|
6126
6697
|
text,
|
|
6127
6698
|
documentFields,
|
|
6128
6699
|
isLoading: docLoading,
|
|
6700
|
+
primaryKeyword: effectivePrimary,
|
|
6701
|
+
secondaryKeyword: effectiveSecondary,
|
|
6129
6702
|
linkCheckResults: technicalOps.linkCheckResults,
|
|
6130
6703
|
isLinkCheckLoading: technicalOps.isLinkCheckLoading,
|
|
6131
6704
|
linkCheckError: technicalOps.linkCheckError,
|
|
@@ -6136,7 +6709,7 @@ function PanelContent({
|
|
|
6136
6709
|
]
|
|
6137
6710
|
}
|
|
6138
6711
|
),
|
|
6139
|
-
chatOpen && /* @__PURE__ */ (0,
|
|
6712
|
+
chatOpen && /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
|
|
6140
6713
|
"div",
|
|
6141
6714
|
{
|
|
6142
6715
|
onMouseDown,
|
|
@@ -6149,10 +6722,10 @@ function PanelContent({
|
|
|
6149
6722
|
justifyContent: "center",
|
|
6150
6723
|
flexShrink: 0
|
|
6151
6724
|
},
|
|
6152
|
-
children: /* @__PURE__ */ (0,
|
|
6725
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("div", { style: { width: 32, height: 2, borderRadius: 1, background: "#d1d5db" } })
|
|
6153
6726
|
}
|
|
6154
6727
|
),
|
|
6155
|
-
/* @__PURE__ */ (0,
|
|
6728
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsxs)(
|
|
6156
6729
|
"div",
|
|
6157
6730
|
{
|
|
6158
6731
|
style: {
|
|
@@ -6165,7 +6738,7 @@ function PanelContent({
|
|
|
6165
6738
|
background: CHAT_ZONE_BG
|
|
6166
6739
|
},
|
|
6167
6740
|
children: [
|
|
6168
|
-
/* @__PURE__ */ (0,
|
|
6741
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsxs)(
|
|
6169
6742
|
"button",
|
|
6170
6743
|
{
|
|
6171
6744
|
onClick: () => onChatOpenChange(!chatOpen),
|
|
@@ -6186,7 +6759,7 @@ function PanelContent({
|
|
|
6186
6759
|
flexShrink: 0
|
|
6187
6760
|
},
|
|
6188
6761
|
children: [
|
|
6189
|
-
/* @__PURE__ */ (0,
|
|
6762
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
|
|
6190
6763
|
"span",
|
|
6191
6764
|
{
|
|
6192
6765
|
style: {
|
|
@@ -6199,7 +6772,7 @@ function PanelContent({
|
|
|
6199
6772
|
children: "Chat"
|
|
6200
6773
|
}
|
|
6201
6774
|
),
|
|
6202
|
-
/* @__PURE__ */ (0,
|
|
6775
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
|
|
6203
6776
|
"svg",
|
|
6204
6777
|
{
|
|
6205
6778
|
width: "12",
|
|
@@ -6207,7 +6780,7 @@ function PanelContent({
|
|
|
6207
6780
|
viewBox: "0 0 20 20",
|
|
6208
6781
|
fill: "rgba(0,0,0,0.55)",
|
|
6209
6782
|
style: { transform: chatOpen ? "rotate(0deg)" : "rotate(-90deg)", transition: "transform 200ms" },
|
|
6210
|
-
children: /* @__PURE__ */ (0,
|
|
6783
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
|
|
6211
6784
|
"path",
|
|
6212
6785
|
{
|
|
6213
6786
|
fillRule: "evenodd",
|
|
@@ -6220,7 +6793,7 @@ function PanelContent({
|
|
|
6220
6793
|
]
|
|
6221
6794
|
}
|
|
6222
6795
|
),
|
|
6223
|
-
/* @__PURE__ */ (0,
|
|
6796
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
|
|
6224
6797
|
"div",
|
|
6225
6798
|
{
|
|
6226
6799
|
style: {
|
|
@@ -6230,7 +6803,7 @@ function PanelContent({
|
|
|
6230
6803
|
flexDirection: "column",
|
|
6231
6804
|
minHeight: 0
|
|
6232
6805
|
},
|
|
6233
|
-
children: /* @__PURE__ */ (0,
|
|
6806
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
|
|
6234
6807
|
ChatPanel,
|
|
6235
6808
|
{
|
|
6236
6809
|
messages: chatState.messages,
|
|
@@ -6263,10 +6836,15 @@ function SEOCopilotInner({ config, onClose }) {
|
|
|
6263
6836
|
);
|
|
6264
6837
|
const dragOffset = (0, import_react18.useRef)(null);
|
|
6265
6838
|
const resizeStart = (0, import_react18.useRef)(null);
|
|
6266
|
-
const { text, isLoading: docLoading, documentFields, documentId } = useDocumentContent();
|
|
6839
|
+
const { text, isLoading: docLoading, documentFields, documentId, documentType } = useDocumentContent();
|
|
6267
6840
|
const { apiUrl } = useConfig();
|
|
6268
6841
|
const workspace = (0, import_sanity3.useWorkspace)();
|
|
6269
6842
|
const effectivePublication = config.publication || workspace?.dataset;
|
|
6843
|
+
const sanityBaseUrl = (0, import_react18.useMemo)(() => {
|
|
6844
|
+
if (typeof window === "undefined") return void 0;
|
|
6845
|
+
const basePath = (workspace?.basePath || "/").replace(/\/+$/, "");
|
|
6846
|
+
return `${window.location.origin}${basePath}`;
|
|
6847
|
+
}, [workspace?.basePath]);
|
|
6270
6848
|
const seedCacheKey = documentId ? `seo-copilot-cache-${documentId}` : "seo-copilot-cache-v2";
|
|
6271
6849
|
const loadSeedsFromCache = (0, import_react18.useCallback)(() => {
|
|
6272
6850
|
try {
|
|
@@ -6290,6 +6868,8 @@ function SEOCopilotInner({ config, onClose }) {
|
|
|
6290
6868
|
);
|
|
6291
6869
|
const selectedPrimaryKey = documentId ? `seo-copilot-primary-${documentId}` : "seo-copilot-primary-default";
|
|
6292
6870
|
const [selectedPrimary, setSelectedPrimary] = usePersistentState(selectedPrimaryKey, void 0);
|
|
6871
|
+
const selectedSecondaryKey = documentId ? `seo-copilot-secondary-${documentId}` : "seo-copilot-secondary-default";
|
|
6872
|
+
const [selectedSecondary, setSelectedSecondary] = usePersistentState(selectedSecondaryKey, "");
|
|
6293
6873
|
const seedsInitializedRef = (0, import_react18.useRef)(false);
|
|
6294
6874
|
(0, import_react18.useEffect)(() => {
|
|
6295
6875
|
if (!seedsInitializedRef.current) {
|
|
@@ -6372,8 +6952,10 @@ function SEOCopilotInner({ config, onClose }) {
|
|
|
6372
6952
|
lastLinkingFetchKey.current = "";
|
|
6373
6953
|
}, [documentId]);
|
|
6374
6954
|
const supportingKeywordsForLinking = (0, import_react18.useMemo)(() => {
|
|
6375
|
-
|
|
6376
|
-
|
|
6955
|
+
const base = (keywordAnalysisState.analysis?.supportingKeywords || []).map((kw) => kw.term).filter(Boolean);
|
|
6956
|
+
const merged = selectedSecondary ? [selectedSecondary, ...base.filter((t) => t.toLowerCase() !== selectedSecondary.toLowerCase())] : base;
|
|
6957
|
+
return merged.slice(0, 5);
|
|
6958
|
+
}, [keywordAnalysisState.analysis, selectedSecondary]);
|
|
6377
6959
|
const refreshLinkingSuggestions = (0, import_react18.useCallback)(async () => {
|
|
6378
6960
|
if (!text || text.trim().length < 50) return;
|
|
6379
6961
|
if (!effectivePrimary) return;
|
|
@@ -6509,7 +7091,7 @@ function SEOCopilotInner({ config, onClose }) {
|
|
|
6509
7091
|
},
|
|
6510
7092
|
[floatSize]
|
|
6511
7093
|
);
|
|
6512
|
-
const panelContent = /* @__PURE__ */ (0,
|
|
7094
|
+
const panelContent = /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
|
|
6513
7095
|
PanelContent,
|
|
6514
7096
|
{
|
|
6515
7097
|
initialPublication: effectivePublication,
|
|
@@ -6529,8 +7111,12 @@ function SEOCopilotInner({ config, onClose }) {
|
|
|
6529
7111
|
docLoading,
|
|
6530
7112
|
documentFields,
|
|
6531
7113
|
documentId,
|
|
7114
|
+
documentType,
|
|
7115
|
+
sanityBaseUrl,
|
|
6532
7116
|
selectedPrimary,
|
|
6533
7117
|
onSelectPrimary: setSelectedPrimary,
|
|
7118
|
+
selectedSecondary,
|
|
7119
|
+
onSelectSecondary: setSelectedSecondary,
|
|
6534
7120
|
activeTab,
|
|
6535
7121
|
onActiveTabChange: setActiveTab,
|
|
6536
7122
|
chatOpen,
|
|
@@ -6592,7 +7178,7 @@ function SEOCopilotInner({ config, onClose }) {
|
|
|
6592
7178
|
}
|
|
6593
7179
|
}
|
|
6594
7180
|
);
|
|
6595
|
-
const floatingPanel = /* @__PURE__ */ (0,
|
|
7181
|
+
const floatingPanel = /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)(
|
|
6596
7182
|
"div",
|
|
6597
7183
|
{
|
|
6598
7184
|
style: {
|
|
@@ -6610,7 +7196,7 @@ function SEOCopilotInner({ config, onClose }) {
|
|
|
6610
7196
|
},
|
|
6611
7197
|
children: [
|
|
6612
7198
|
panelContent,
|
|
6613
|
-
!isFullscreen && /* @__PURE__ */ (0,
|
|
7199
|
+
!isFullscreen && /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
|
|
6614
7200
|
"div",
|
|
6615
7201
|
{
|
|
6616
7202
|
onMouseDown: handleResizeStart,
|
|
@@ -6625,9 +7211,9 @@ function SEOCopilotInner({ config, onClose }) {
|
|
|
6625
7211
|
alignItems: "center",
|
|
6626
7212
|
justifyContent: "center"
|
|
6627
7213
|
},
|
|
6628
|
-
children: /* @__PURE__ */ (0,
|
|
6629
|
-
/* @__PURE__ */ (0,
|
|
6630
|
-
/* @__PURE__ */ (0,
|
|
7214
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("svg", { width: "10", height: "10", viewBox: "0 0 10 10", fill: "#9ca3af", children: [
|
|
7215
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)("path", { d: "M9 1v8H1", fill: "none", stroke: "#9ca3af", strokeWidth: "1.5", strokeLinecap: "round" }),
|
|
7216
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)("path", { d: "M9 5v4H5", fill: "none", stroke: "#9ca3af", strokeWidth: "1.5", strokeLinecap: "round" })
|
|
6631
7217
|
] })
|
|
6632
7218
|
}
|
|
6633
7219
|
)
|
|
@@ -6635,8 +7221,8 @@ function SEOCopilotInner({ config, onClose }) {
|
|
|
6635
7221
|
}
|
|
6636
7222
|
);
|
|
6637
7223
|
if (isFloating) {
|
|
6638
|
-
return /* @__PURE__ */ (0,
|
|
6639
|
-
/* @__PURE__ */ (0,
|
|
7224
|
+
return /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)(import_jsx_runtime16.Fragment, { children: [
|
|
7225
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
|
|
6640
7226
|
"div",
|
|
6641
7227
|
{
|
|
6642
7228
|
style: {
|
|
@@ -6646,30 +7232,30 @@ function SEOCopilotInner({ config, onClose }) {
|
|
|
6646
7232
|
alignItems: "center",
|
|
6647
7233
|
justifyContent: "center"
|
|
6648
7234
|
},
|
|
6649
|
-
children: /* @__PURE__ */ (0,
|
|
7235
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("span", { style: { fontSize: 12, color: "rgba(0,0,0,0.5)" }, children: "SEO Copilot is floating" })
|
|
6650
7236
|
}
|
|
6651
7237
|
),
|
|
6652
7238
|
typeof document !== "undefined" && (0, import_react_dom.createPortal)(floatingPanel, document.body)
|
|
6653
7239
|
] });
|
|
6654
7240
|
}
|
|
6655
|
-
return /* @__PURE__ */ (0,
|
|
7241
|
+
return /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("div", { style: { height: "100%", background: PANEL_BG, position: "relative", zIndex: 1 }, children: panelContent });
|
|
6656
7242
|
}
|
|
6657
7243
|
function SEOCopilotPanel({ config, onClose }) {
|
|
6658
|
-
return /* @__PURE__ */ (0,
|
|
7244
|
+
return /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
|
|
6659
7245
|
import_react18.Suspense,
|
|
6660
7246
|
{
|
|
6661
|
-
fallback: /* @__PURE__ */ (0,
|
|
6662
|
-
/* @__PURE__ */ (0,
|
|
6663
|
-
/* @__PURE__ */ (0,
|
|
7247
|
+
fallback: /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("div", { style: { padding: 16, display: "flex", alignItems: "center", gap: 12 }, children: [
|
|
7248
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)(LoadingBars, {}),
|
|
7249
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)("span", { style: { fontSize: 12, color: "#4b5563" }, children: "Loading SEO Copilot..." })
|
|
6664
7250
|
] }),
|
|
6665
|
-
children: /* @__PURE__ */ (0,
|
|
7251
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(ConfigProvider, { config, children: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(SEOCopilotInner, { config, onClose }) })
|
|
6666
7252
|
}
|
|
6667
7253
|
);
|
|
6668
7254
|
}
|
|
6669
7255
|
function LoadingBars({ size = "sm", color = MJH_GOLD }) {
|
|
6670
7256
|
const barWidth = size === "xs" ? 4 : 6;
|
|
6671
7257
|
const containerHeight = size === "xs" ? 10 : 14;
|
|
6672
|
-
return /* @__PURE__ */ (0,
|
|
7258
|
+
return /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("div", { style: { display: "inline-flex", alignItems: "flex-end", gap: 2, height: containerHeight }, children: [1, 2, 3].map((i) => /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
|
|
6673
7259
|
"div",
|
|
6674
7260
|
{
|
|
6675
7261
|
style: {
|