sanity-plugin-seofields 1.9.0 → 1.10.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +71 -0
- package/dist/chunk-CRCXC45D.js +56 -0
- package/dist/chunk-CRCXC45D.js.map +1 -0
- package/dist/{chunk-3OK3S2F7.cjs → chunk-EUG4MNRC.cjs} +60 -20
- package/dist/chunk-EUG4MNRC.cjs.map +1 -0
- package/dist/{chunk-Z5AOUU4H.js → chunk-NLEB47UV.js} +60 -20
- package/dist/chunk-NLEB47UV.js.map +1 -0
- package/dist/{chunk-FUUWBQE2.cjs → chunk-OULUDJPI.cjs} +66 -7
- package/dist/chunk-OULUDJPI.cjs.map +1 -0
- package/dist/{chunk-KIEO6QG3.js → chunk-XD4HKLEA.js} +66 -7
- package/dist/chunk-XD4HKLEA.js.map +1 -0
- package/dist/chunk-XYAZJ3WX.cjs +56 -0
- package/dist/chunk-XYAZJ3WX.cjs.map +1 -0
- package/dist/cli.js +1 -1
- package/dist/head.cjs +10 -2
- package/dist/head.cjs.map +1 -1
- package/dist/head.d.cts +61 -1
- package/dist/head.d.ts +61 -1
- package/dist/head.js +9 -1
- package/dist/hreflang-_VbSuWYD.d.cts +29 -0
- package/dist/hreflang-_VbSuWYD.d.ts +29 -0
- package/dist/index.cjs +101 -8
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +3 -2
- package/dist/index.d.ts +3 -2
- package/dist/index.js +273 -180
- package/dist/index.js.map +1 -1
- package/dist/next.cjs +11 -3
- package/dist/next.cjs.map +1 -1
- package/dist/next.d.cts +2 -1
- package/dist/next.d.ts +2 -1
- package/dist/next.js +9 -1
- package/dist/next.js.map +1 -1
- package/dist/{plugin-DoGeZP79.d.cts → plugin-HFuWZsJu.d.cts} +68 -1
- package/dist/{plugin-DQdThyxG.d.ts → plugin-oQUCim56.d.ts} +68 -1
- package/dist/server.cjs +2 -2
- package/dist/server.cjs.map +1 -1
- package/dist/server.d.cts +6 -8
- package/dist/server.d.ts +6 -8
- package/dist/server.js +1 -1
- package/dist/server.js.map +1 -1
- package/package.json +2 -2
- package/dist/chunk-3OK3S2F7.cjs.map +0 -1
- package/dist/chunk-FUUWBQE2.cjs.map +0 -1
- package/dist/chunk-KIEO6QG3.js.map +0 -1
- package/dist/chunk-Z5AOUU4H.js.map +0 -1
package/dist/index.js
CHANGED
|
@@ -1,8 +1,11 @@
|
|
|
1
|
+
import {
|
|
2
|
+
buildHreflangs
|
|
3
|
+
} from "./chunk-CRCXC45D.js";
|
|
1
4
|
import {
|
|
2
5
|
analyzeReadability,
|
|
3
6
|
generateSeoText,
|
|
4
7
|
pickTestOutput
|
|
5
|
-
} from "./chunk-
|
|
8
|
+
} from "./chunk-NLEB47UV.js";
|
|
6
9
|
import {
|
|
7
10
|
SchemaOrgJsonLdPreview,
|
|
8
11
|
tokenizeHtml
|
|
@@ -611,16 +614,97 @@ var FocusKeywordInput = (props) => {
|
|
|
611
614
|
};
|
|
612
615
|
var FocusKeywordInput_default = FocusKeywordInput;
|
|
613
616
|
|
|
617
|
+
// src/components/meta/HreflangInput.tsx
|
|
618
|
+
import { TranslateIcon } from "@sanity/icons";
|
|
619
|
+
import { Button as Button2, Card as Card2, Flex as Flex2, Stack as Stack2, Text as Text3 } from "@sanity/ui";
|
|
620
|
+
import { useCallback as useCallback2, useState as useState3 } from "react";
|
|
621
|
+
import { PatchEvent as PatchEvent2, set as set2, useClient, useFormValue as useFormValue4 } from "sanity";
|
|
622
|
+
import { jsx as jsx4, jsxs as jsxs4 } from "react/jsx-runtime";
|
|
623
|
+
var DEFAULT_LOCALE_FIELD = "language";
|
|
624
|
+
var DEFAULT_API_VERSION = "2024-01-01";
|
|
625
|
+
function safeField(name) {
|
|
626
|
+
return name && /^[A-Za-z_][A-Za-z0-9_]*$/.test(name) ? name : DEFAULT_LOCALE_FIELD;
|
|
627
|
+
}
|
|
628
|
+
var HreflangInput = (props) => {
|
|
629
|
+
const { schemaType, onChange, renderDefault } = props;
|
|
630
|
+
const { options } = schemaType;
|
|
631
|
+
const { hreflang, baseUrl, apiVersion } = options != null ? options : {};
|
|
632
|
+
const rootDoc = useFormValue4([]);
|
|
633
|
+
const client = useClient({ apiVersion: apiVersion != null ? apiVersion : DEFAULT_API_VERSION });
|
|
634
|
+
const [state, setState] = useState3("idle");
|
|
635
|
+
const [message, setMessage] = useState3(null);
|
|
636
|
+
const localeField = safeField(hreflang == null ? void 0 : hreflang.localeField);
|
|
637
|
+
const handleSync = useCallback2(async () => {
|
|
638
|
+
var _a;
|
|
639
|
+
const rawId = rootDoc == null ? void 0 : rootDoc._id;
|
|
640
|
+
if (!rawId) {
|
|
641
|
+
setState("error");
|
|
642
|
+
setMessage("Save the document once before syncing translations.");
|
|
643
|
+
return;
|
|
644
|
+
}
|
|
645
|
+
setState("loading");
|
|
646
|
+
setMessage(null);
|
|
647
|
+
try {
|
|
648
|
+
const publishedId = rawId.replace(/^drafts\./, "");
|
|
649
|
+
const query = `*[_type == "translation.metadata" && references($id)][0].translations[].value->{
|
|
650
|
+
"language": ${localeField},
|
|
651
|
+
"slug": slug.current
|
|
652
|
+
}`;
|
|
653
|
+
const translations = (_a = await client.fetch(query, { id: publishedId })) != null ? _a : [];
|
|
654
|
+
const entries = buildHreflangs(translations, {
|
|
655
|
+
baseUrl,
|
|
656
|
+
resolvePath: hreflang == null ? void 0 : hreflang.resolvePath
|
|
657
|
+
});
|
|
658
|
+
if (entries.length === 0) {
|
|
659
|
+
setState("error");
|
|
660
|
+
setMessage("No translations with a resolvable URL were found for this document.");
|
|
661
|
+
return;
|
|
662
|
+
}
|
|
663
|
+
const items = entries.map((e) => ({
|
|
664
|
+
_type: "hreflangEntry",
|
|
665
|
+
_key: e.locale,
|
|
666
|
+
locale: e.locale,
|
|
667
|
+
url: e.url
|
|
668
|
+
}));
|
|
669
|
+
onChange(PatchEvent2.from(set2(items)));
|
|
670
|
+
setState("done");
|
|
671
|
+
setMessage(
|
|
672
|
+
`Synced ${items.length} alternate${items.length === 1 ? "" : "s"} from translations.`
|
|
673
|
+
);
|
|
674
|
+
} catch (err) {
|
|
675
|
+
setState("error");
|
|
676
|
+
setMessage(err instanceof Error ? err.message : "Failed to sync translations.");
|
|
677
|
+
}
|
|
678
|
+
}, [rootDoc == null ? void 0 : rootDoc._id, client, localeField, baseUrl, hreflang, onChange]);
|
|
679
|
+
return /* @__PURE__ */ jsxs4(Stack2, { space: 3, children: [
|
|
680
|
+
/* @__PURE__ */ jsx4(Flex2, { children: /* @__PURE__ */ jsx4(
|
|
681
|
+
Button2,
|
|
682
|
+
{
|
|
683
|
+
mode: "ghost",
|
|
684
|
+
tone: "primary",
|
|
685
|
+
fontSize: 1,
|
|
686
|
+
icon: TranslateIcon,
|
|
687
|
+
text: state === "loading" ? "Syncing\u2026" : "Sync from translations",
|
|
688
|
+
onClick: handleSync,
|
|
689
|
+
disabled: state === "loading"
|
|
690
|
+
}
|
|
691
|
+
) }),
|
|
692
|
+
message && /* @__PURE__ */ jsx4(Card2, { padding: 2, radius: 2, tone: state === "error" ? "critical" : "positive", children: /* @__PURE__ */ jsx4(Text3, { size: 1, children: message }) }),
|
|
693
|
+
renderDefault(props)
|
|
694
|
+
] });
|
|
695
|
+
};
|
|
696
|
+
var HreflangInput_default = HreflangInput;
|
|
697
|
+
|
|
614
698
|
// src/components/meta/KeywordsInput.tsx
|
|
615
|
-
import { Stack as
|
|
616
|
-
import { PatchEvent as
|
|
699
|
+
import { Stack as Stack4 } from "@sanity/ui";
|
|
700
|
+
import { PatchEvent as PatchEvent3, set as set3 } from "sanity";
|
|
617
701
|
|
|
618
702
|
// src/components/ai/KeywordSuggestions.tsx
|
|
619
703
|
import { SparklesIcon as SparklesIcon2 } from "@sanity/icons";
|
|
620
|
-
import { Badge, Box, Button as
|
|
621
|
-
import { useCallback as
|
|
622
|
-
import { useFormValue as
|
|
623
|
-
import { jsx as
|
|
704
|
+
import { Badge, Box, Button as Button3, Card as Card3, Flex as Flex3, Spinner, Stack as Stack3, Text as Text4 } from "@sanity/ui";
|
|
705
|
+
import { useCallback as useCallback3, useEffect as useEffect2, useRef as useRef2, useState as useState4 } from "react";
|
|
706
|
+
import { useFormValue as useFormValue5, useWorkspace as useWorkspace2 } from "sanity";
|
|
707
|
+
import { jsx as jsx5, jsxs as jsxs5 } from "react/jsx-runtime";
|
|
624
708
|
function KeywordSuggestions({
|
|
625
709
|
ai,
|
|
626
710
|
seoFieldPath,
|
|
@@ -629,17 +713,17 @@ function KeywordSuggestions({
|
|
|
629
713
|
onAddAll
|
|
630
714
|
}) {
|
|
631
715
|
var _a;
|
|
632
|
-
const [panelState, setPanelState] =
|
|
633
|
-
const [suggestions, setSuggestions] =
|
|
634
|
-
const [errorMsg, setErrorMsg] =
|
|
716
|
+
const [panelState, setPanelState] = useState4("idle");
|
|
717
|
+
const [suggestions, setSuggestions] = useState4([]);
|
|
718
|
+
const [errorMsg, setErrorMsg] = useState4(null);
|
|
635
719
|
const abortRef = useRef2(null);
|
|
636
|
-
const rootDoc =
|
|
720
|
+
const rootDoc = useFormValue5([]);
|
|
637
721
|
const workspace = useWorkspace2();
|
|
638
|
-
const seoObj =
|
|
722
|
+
const seoObj = useFormValue5([seoFieldPath]);
|
|
639
723
|
const focusKeyword = (_a = seoObj == null ? void 0 : seoObj.focusKeyword) != null ? _a : "";
|
|
640
724
|
const bodyField = resolveContentFields(ai == null ? void 0 : ai.content, rootDoc == null ? void 0 : rootDoc._type);
|
|
641
725
|
const content = rootDoc ? extractDocText(rootDoc, bodyField) : "";
|
|
642
|
-
const handleSuggest =
|
|
726
|
+
const handleSuggest = useCallback3(async () => {
|
|
643
727
|
var _a2;
|
|
644
728
|
if (!ai) return;
|
|
645
729
|
(_a2 = abortRef.current) == null ? void 0 : _a2.abort();
|
|
@@ -675,7 +759,7 @@ function KeywordSuggestions({
|
|
|
675
759
|
setPanelState("error");
|
|
676
760
|
}
|
|
677
761
|
}, [ai, content, focusKeyword, existing, workspace.projectId]);
|
|
678
|
-
const handleAdd =
|
|
762
|
+
const handleAdd = useCallback3(
|
|
679
763
|
(kw) => {
|
|
680
764
|
onAdd(kw);
|
|
681
765
|
setSuggestions((prev) => prev.filter((s) => s !== kw));
|
|
@@ -683,13 +767,13 @@ function KeywordSuggestions({
|
|
|
683
767
|
},
|
|
684
768
|
[onAdd, suggestions.length]
|
|
685
769
|
);
|
|
686
|
-
const handleAddAll =
|
|
770
|
+
const handleAddAll = useCallback3(() => {
|
|
687
771
|
const toAdd = suggestions.filter((kw) => !existing.includes(kw));
|
|
688
772
|
if (toAdd.length > 0) onAddAll(toAdd);
|
|
689
773
|
setSuggestions([]);
|
|
690
774
|
setPanelState("idle");
|
|
691
775
|
}, [suggestions, existing, onAddAll]);
|
|
692
|
-
const handleDismiss =
|
|
776
|
+
const handleDismiss = useCallback3(() => {
|
|
693
777
|
var _a2;
|
|
694
778
|
(_a2 = abortRef.current) == null ? void 0 : _a2.abort();
|
|
695
779
|
setSuggestions([]);
|
|
@@ -707,9 +791,9 @@ function KeywordSuggestions({
|
|
|
707
791
|
);
|
|
708
792
|
if (!isConfigured) return null;
|
|
709
793
|
if (panelState === "idle" || panelState === "error") {
|
|
710
|
-
return /* @__PURE__ */
|
|
711
|
-
/* @__PURE__ */
|
|
712
|
-
|
|
794
|
+
return /* @__PURE__ */ jsxs5(Stack3, { space: 2, children: [
|
|
795
|
+
/* @__PURE__ */ jsx5(
|
|
796
|
+
Button3,
|
|
713
797
|
{
|
|
714
798
|
mode: "ghost",
|
|
715
799
|
tone: "primary",
|
|
@@ -721,23 +805,23 @@ function KeywordSuggestions({
|
|
|
721
805
|
onClick: handleSuggest
|
|
722
806
|
}
|
|
723
807
|
),
|
|
724
|
-
panelState === "error" && errorMsg && /* @__PURE__ */
|
|
808
|
+
panelState === "error" && errorMsg && /* @__PURE__ */ jsx5(Card3, { padding: 2, tone: "critical", radius: 2, children: /* @__PURE__ */ jsx5(Text4, { size: 1, children: errorMsg }) })
|
|
725
809
|
] });
|
|
726
810
|
}
|
|
727
811
|
if (panelState === "loading") {
|
|
728
|
-
return /* @__PURE__ */
|
|
729
|
-
/* @__PURE__ */
|
|
730
|
-
/* @__PURE__ */
|
|
812
|
+
return /* @__PURE__ */ jsxs5(Flex3, { align: "center", gap: 2, paddingY: 2, children: [
|
|
813
|
+
/* @__PURE__ */ jsx5(Spinner, { muted: true }),
|
|
814
|
+
/* @__PURE__ */ jsx5(Text4, { size: 1, muted: true, children: "Finding keywords\u2026" })
|
|
731
815
|
] });
|
|
732
816
|
}
|
|
733
817
|
const pendingSuggestions = suggestions.filter((kw) => !existing.includes(kw));
|
|
734
818
|
const alreadyAdded = suggestions.filter((kw) => existing.includes(kw));
|
|
735
|
-
return /* @__PURE__ */
|
|
736
|
-
/* @__PURE__ */
|
|
737
|
-
/* @__PURE__ */
|
|
738
|
-
/* @__PURE__ */
|
|
739
|
-
pendingSuggestions.length > 1 && /* @__PURE__ */
|
|
740
|
-
|
|
819
|
+
return /* @__PURE__ */ jsx5(Card3, { padding: 3, radius: 2, tone: "transparent", border: true, children: /* @__PURE__ */ jsxs5(Stack3, { space: 3, children: [
|
|
820
|
+
/* @__PURE__ */ jsxs5(Flex3, { align: "center", justify: "space-between", children: [
|
|
821
|
+
/* @__PURE__ */ jsx5(Text4, { size: 1, weight: "semibold", muted: true, children: "AI keyword suggestions" }),
|
|
822
|
+
/* @__PURE__ */ jsxs5(Flex3, { gap: 2, children: [
|
|
823
|
+
pendingSuggestions.length > 1 && /* @__PURE__ */ jsx5(
|
|
824
|
+
Button3,
|
|
741
825
|
{
|
|
742
826
|
mode: "ghost",
|
|
743
827
|
tone: "primary",
|
|
@@ -748,8 +832,8 @@ function KeywordSuggestions({
|
|
|
748
832
|
onClick: handleAddAll
|
|
749
833
|
}
|
|
750
834
|
),
|
|
751
|
-
/* @__PURE__ */
|
|
752
|
-
|
|
835
|
+
/* @__PURE__ */ jsx5(
|
|
836
|
+
Button3,
|
|
753
837
|
{
|
|
754
838
|
mode: "ghost",
|
|
755
839
|
tone: "default",
|
|
@@ -762,9 +846,9 @@ function KeywordSuggestions({
|
|
|
762
846
|
)
|
|
763
847
|
] })
|
|
764
848
|
] }),
|
|
765
|
-
pendingSuggestions.length > 0 && /* @__PURE__ */
|
|
766
|
-
/* @__PURE__ */
|
|
767
|
-
/* @__PURE__ */
|
|
849
|
+
pendingSuggestions.length > 0 && /* @__PURE__ */ jsxs5(Box, { children: [
|
|
850
|
+
/* @__PURE__ */ jsx5(Text4, { size: 0, muted: true, style: { marginBottom: 8 }, children: "Click to add:" }),
|
|
851
|
+
/* @__PURE__ */ jsx5(Flex3, { gap: 2, wrap: "wrap", style: { marginTop: 6 }, children: pendingSuggestions.map((kw) => /* @__PURE__ */ jsxs5(
|
|
768
852
|
"button",
|
|
769
853
|
{
|
|
770
854
|
type: "button",
|
|
@@ -796,34 +880,34 @@ function KeywordSuggestions({
|
|
|
796
880
|
kw
|
|
797
881
|
)) })
|
|
798
882
|
] }),
|
|
799
|
-
alreadyAdded.length > 0 && /* @__PURE__ */
|
|
800
|
-
/* @__PURE__ */
|
|
801
|
-
/* @__PURE__ */
|
|
883
|
+
alreadyAdded.length > 0 && /* @__PURE__ */ jsxs5(Box, { children: [
|
|
884
|
+
/* @__PURE__ */ jsx5(Text4, { size: 0, muted: true, style: { marginBottom: 6 }, children: "Already added:" }),
|
|
885
|
+
/* @__PURE__ */ jsx5(Flex3, { gap: 2, wrap: "wrap", style: { marginTop: 4 }, children: alreadyAdded.map((kw) => /* @__PURE__ */ jsxs5(Badge, { tone: "positive", radius: 5, fontSize: 0, padding: 2, children: [
|
|
802
886
|
"\u2713 ",
|
|
803
887
|
kw
|
|
804
888
|
] }, kw)) })
|
|
805
889
|
] }),
|
|
806
|
-
pendingSuggestions.length === 0 && /* @__PURE__ */
|
|
890
|
+
pendingSuggestions.length === 0 && /* @__PURE__ */ jsx5(Text4, { size: 1, muted: true, children: "All suggested keywords added." })
|
|
807
891
|
] }) });
|
|
808
892
|
}
|
|
809
893
|
|
|
810
894
|
// src/components/meta/KeywordsInput.tsx
|
|
811
|
-
import { jsx as
|
|
895
|
+
import { jsx as jsx6, jsxs as jsxs6 } from "react/jsx-runtime";
|
|
812
896
|
var KeywordsInput = (props) => {
|
|
813
897
|
const { value, renderDefault, path, schemaType, onChange } = props;
|
|
814
898
|
const { options } = schemaType;
|
|
815
899
|
const existing = value != null ? value : [];
|
|
816
900
|
const handleAdd = (kw) => {
|
|
817
901
|
if (existing.includes(kw)) return;
|
|
818
|
-
onChange(
|
|
902
|
+
onChange(PatchEvent3.from(set3([...existing, kw])));
|
|
819
903
|
};
|
|
820
904
|
const handleAddAll = (keywords) => {
|
|
821
905
|
const merged = [.../* @__PURE__ */ new Set([...existing, ...keywords])];
|
|
822
|
-
onChange(
|
|
906
|
+
onChange(PatchEvent3.from(set3(merged)));
|
|
823
907
|
};
|
|
824
|
-
return /* @__PURE__ */
|
|
908
|
+
return /* @__PURE__ */ jsxs6(Stack4, { space: 3, children: [
|
|
825
909
|
renderDefault(props),
|
|
826
|
-
/* @__PURE__ */
|
|
910
|
+
/* @__PURE__ */ jsx6(
|
|
827
911
|
KeywordSuggestions,
|
|
828
912
|
{
|
|
829
913
|
ai: options == null ? void 0 : options.ai,
|
|
@@ -838,14 +922,14 @@ var KeywordsInput = (props) => {
|
|
|
838
922
|
var KeywordsInput_default = KeywordsInput;
|
|
839
923
|
|
|
840
924
|
// src/components/meta/MetaDescription.tsx
|
|
841
|
-
import { Stack as
|
|
925
|
+
import { Stack as Stack5, Text as Text5 } from "@sanity/ui";
|
|
842
926
|
import { useMemo as useMemo3 } from "react";
|
|
843
|
-
import { PatchEvent as
|
|
844
|
-
import { jsx as
|
|
927
|
+
import { PatchEvent as PatchEvent4, set as set4, useFormValue as useFormValue6 } from "sanity";
|
|
928
|
+
import { jsx as jsx7, jsxs as jsxs7 } from "react/jsx-runtime";
|
|
845
929
|
var MetaDescription = (props) => {
|
|
846
930
|
const { value, renderDefault, path, schemaType, onChange } = props;
|
|
847
931
|
const { options } = schemaType;
|
|
848
|
-
const parent =
|
|
932
|
+
const parent = useFormValue6([path[0]]);
|
|
849
933
|
const isParentseoField = parent && (parent == null ? void 0 : parent._type) === "seoFields";
|
|
850
934
|
const keywords = useMemo3(() => (parent == null ? void 0 : parent.keywords) || [], [parent == null ? void 0 : parent.keywords]);
|
|
851
935
|
const feedbackItems = useMemo3(
|
|
@@ -853,28 +937,28 @@ var MetaDescription = (props) => {
|
|
|
853
937
|
[value, keywords, isParentseoField]
|
|
854
938
|
);
|
|
855
939
|
const readability = useMemo3(() => analyzeReadability(value || ""), [value]);
|
|
856
|
-
return /* @__PURE__ */
|
|
940
|
+
return /* @__PURE__ */ jsxs7(Stack5, { space: 3, children: [
|
|
857
941
|
renderDefault(props),
|
|
858
|
-
/* @__PURE__ */
|
|
942
|
+
/* @__PURE__ */ jsx7(
|
|
859
943
|
SeoGenButton,
|
|
860
944
|
{
|
|
861
945
|
field: "description",
|
|
862
946
|
ai: options == null ? void 0 : options.ai,
|
|
863
947
|
seoFieldPath: String(path[0]),
|
|
864
|
-
onGenerate: (v) => onChange(
|
|
948
|
+
onGenerate: (v) => onChange(PatchEvent4.from(set4(v)))
|
|
865
949
|
}
|
|
866
950
|
),
|
|
867
|
-
/* @__PURE__ */
|
|
868
|
-
/* @__PURE__ */
|
|
951
|
+
/* @__PURE__ */ jsx7(Stack5, { space: 2, children: feedbackItems.map((item) => /* @__PURE__ */ jsxs7("div", { style: { display: "flex", alignItems: "center", gap: 7 }, children: [
|
|
952
|
+
/* @__PURE__ */ jsx7(
|
|
869
953
|
"div",
|
|
870
954
|
{
|
|
871
955
|
style: { width: 10, height: 10, borderRadius: "50%", backgroundColor: item.color }
|
|
872
956
|
}
|
|
873
957
|
),
|
|
874
|
-
/* @__PURE__ */
|
|
958
|
+
/* @__PURE__ */ jsx7(Text5, { weight: "bold", muted: true, size: 14, children: item.text })
|
|
875
959
|
] }, item.text)) }),
|
|
876
|
-
readability && /* @__PURE__ */
|
|
877
|
-
/* @__PURE__ */
|
|
960
|
+
readability && /* @__PURE__ */ jsxs7("div", { style: { display: "flex", alignItems: "center", gap: 7 }, children: [
|
|
961
|
+
/* @__PURE__ */ jsx7(
|
|
878
962
|
"div",
|
|
879
963
|
{
|
|
880
964
|
style: {
|
|
@@ -885,7 +969,7 @@ var MetaDescription = (props) => {
|
|
|
885
969
|
}
|
|
886
970
|
}
|
|
887
971
|
),
|
|
888
|
-
/* @__PURE__ */
|
|
972
|
+
/* @__PURE__ */ jsxs7(Text5, { weight: "bold", muted: true, size: 14, children: [
|
|
889
973
|
"Readability: ",
|
|
890
974
|
readability.label,
|
|
891
975
|
" (Flesch ",
|
|
@@ -901,22 +985,22 @@ var MetaDescription = (props) => {
|
|
|
901
985
|
var MetaDescription_default = MetaDescription;
|
|
902
986
|
|
|
903
987
|
// src/components/meta/MetaImage.tsx
|
|
904
|
-
import { Stack as
|
|
988
|
+
import { Stack as Stack6, Text as Text6 } from "@sanity/ui";
|
|
905
989
|
import { useMemo as useMemo4 } from "react";
|
|
906
|
-
import { useFormValue as
|
|
907
|
-
import { jsx as
|
|
990
|
+
import { useFormValue as useFormValue7 } from "sanity";
|
|
991
|
+
import { jsx as jsx8, jsxs as jsxs8 } from "react/jsx-runtime";
|
|
908
992
|
var MetaImage = (props) => {
|
|
909
993
|
const { value, renderDefault, path } = props;
|
|
910
|
-
const seoParent =
|
|
994
|
+
const seoParent = useFormValue7([path[0]]);
|
|
911
995
|
const hasImage = !!(value == null ? void 0 : value.asset);
|
|
912
996
|
const feedbackItems = useMemo4(
|
|
913
997
|
() => getMetaImageValidation(hasImage, seoParent),
|
|
914
998
|
[hasImage, seoParent]
|
|
915
999
|
);
|
|
916
|
-
return /* @__PURE__ */
|
|
1000
|
+
return /* @__PURE__ */ jsxs8(Stack6, { space: 3, children: [
|
|
917
1001
|
renderDefault(props),
|
|
918
|
-
/* @__PURE__ */
|
|
919
|
-
/* @__PURE__ */
|
|
1002
|
+
/* @__PURE__ */ jsx8(Stack6, { space: 2, children: feedbackItems.map((item) => /* @__PURE__ */ jsxs8("div", { style: { display: "flex", alignItems: "center", gap: 7 }, children: [
|
|
1003
|
+
/* @__PURE__ */ jsx8(
|
|
920
1004
|
"div",
|
|
921
1005
|
{
|
|
922
1006
|
style: {
|
|
@@ -927,17 +1011,17 @@ var MetaImage = (props) => {
|
|
|
927
1011
|
}
|
|
928
1012
|
}
|
|
929
1013
|
),
|
|
930
|
-
/* @__PURE__ */
|
|
1014
|
+
/* @__PURE__ */ jsx8(Text6, { weight: "bold", muted: true, size: 14, children: item.text })
|
|
931
1015
|
] }, item.text)) })
|
|
932
1016
|
] });
|
|
933
1017
|
};
|
|
934
1018
|
var MetaImage_default = MetaImage;
|
|
935
1019
|
|
|
936
1020
|
// src/components/meta/MetaTagsPreview.tsx
|
|
937
|
-
import { Box as Box2, Button as
|
|
938
|
-
import { useMemo as useMemo5, useState as
|
|
939
|
-
import { useClient, useColorScheme, useFormValue as
|
|
940
|
-
import { jsx as
|
|
1021
|
+
import { Box as Box2, Button as Button4, Card as Card4, Flex as Flex4, Stack as Stack7, Text as Text7 } from "@sanity/ui";
|
|
1022
|
+
import { useMemo as useMemo5, useState as useState5 } from "react";
|
|
1023
|
+
import { useClient as useClient2, useColorScheme, useFormValue as useFormValue8 } from "sanity";
|
|
1024
|
+
import { jsx as jsx9, jsxs as jsxs9 } from "react/jsx-runtime";
|
|
941
1025
|
function resolveImageUrl(asset, projectId, dataset) {
|
|
942
1026
|
const ref = asset == null ? void 0 : asset._ref;
|
|
943
1027
|
if (!ref) return null;
|
|
@@ -949,11 +1033,11 @@ function resolveImageUrl(asset, projectId, dataset) {
|
|
|
949
1033
|
}
|
|
950
1034
|
var MetaTagsPreview = (props) => {
|
|
951
1035
|
const { path } = props;
|
|
952
|
-
const [expanded, setExpanded] =
|
|
953
|
-
const [copyLabel, setCopyLabel] =
|
|
1036
|
+
const [expanded, setExpanded] = useState5(false);
|
|
1037
|
+
const [copyLabel, setCopyLabel] = useState5("Copy");
|
|
954
1038
|
const { scheme } = useColorScheme();
|
|
955
|
-
const seoFields =
|
|
956
|
-
const client =
|
|
1039
|
+
const seoFields = useFormValue8([path[0]]);
|
|
1040
|
+
const client = useClient2({ apiVersion: "2024-01-01" });
|
|
957
1041
|
const { projectId = "", dataset = "" } = client.config();
|
|
958
1042
|
const rawHtml = useMemo5(() => {
|
|
959
1043
|
var _a, _b, _c, _d, _e, _f, _g;
|
|
@@ -1025,16 +1109,16 @@ var MetaTagsPreview = (props) => {
|
|
|
1025
1109
|
const headerBg = isDark ? "#21262d" : "#f0f2f4";
|
|
1026
1110
|
const headerBorder = isDark ? "#30363d" : "#d0d7de";
|
|
1027
1111
|
const headerText = isDark ? "#e6edf3" : "#24292f";
|
|
1028
|
-
return /* @__PURE__ */
|
|
1029
|
-
/* @__PURE__ */
|
|
1030
|
-
/* @__PURE__ */
|
|
1031
|
-
/* @__PURE__ */
|
|
1032
|
-
/* @__PURE__ */
|
|
1112
|
+
return /* @__PURE__ */ jsx9(Card4, { padding: 3, radius: 2, tone: "default", border: true, children: /* @__PURE__ */ jsxs9(Stack7, { space: 3, children: [
|
|
1113
|
+
/* @__PURE__ */ jsxs9(Flex4, { align: "center", justify: "space-between", gap: 3, children: [
|
|
1114
|
+
/* @__PURE__ */ jsx9(Text7, { weight: "semibold", size: 1, children: "Meta Tags Preview" }),
|
|
1115
|
+
/* @__PURE__ */ jsxs9(Flex4, { gap: 2, align: "center", children: [
|
|
1116
|
+
/* @__PURE__ */ jsxs9(Text7, { size: 0, muted: true, children: [
|
|
1033
1117
|
tagCount,
|
|
1034
1118
|
" tags generated"
|
|
1035
1119
|
] }),
|
|
1036
|
-
/* @__PURE__ */
|
|
1037
|
-
|
|
1120
|
+
/* @__PURE__ */ jsx9(
|
|
1121
|
+
Button4,
|
|
1038
1122
|
{
|
|
1039
1123
|
text: copyLabel,
|
|
1040
1124
|
tone: "default",
|
|
@@ -1046,7 +1130,7 @@ var MetaTagsPreview = (props) => {
|
|
|
1046
1130
|
)
|
|
1047
1131
|
] })
|
|
1048
1132
|
] }),
|
|
1049
|
-
/* @__PURE__ */
|
|
1133
|
+
/* @__PURE__ */ jsxs9(
|
|
1050
1134
|
"button",
|
|
1051
1135
|
{
|
|
1052
1136
|
type: "button",
|
|
@@ -1067,12 +1151,12 @@ var MetaTagsPreview = (props) => {
|
|
|
1067
1151
|
color: headerText
|
|
1068
1152
|
},
|
|
1069
1153
|
children: [
|
|
1070
|
-
/* @__PURE__ */
|
|
1154
|
+
/* @__PURE__ */ jsx9("span", { style: { fontSize: 10 }, children: expanded ? "\u25B2" : "\u25BC" }),
|
|
1071
1155
|
expanded ? "Hide tags" : "Show tags"
|
|
1072
1156
|
]
|
|
1073
1157
|
}
|
|
1074
1158
|
),
|
|
1075
|
-
expanded && /* @__PURE__ */
|
|
1159
|
+
expanded && /* @__PURE__ */ jsxs9(
|
|
1076
1160
|
"div",
|
|
1077
1161
|
{
|
|
1078
1162
|
style: {
|
|
@@ -1081,7 +1165,7 @@ var MetaTagsPreview = (props) => {
|
|
|
1081
1165
|
overflow: "hidden"
|
|
1082
1166
|
},
|
|
1083
1167
|
children: [
|
|
1084
|
-
/* @__PURE__ */
|
|
1168
|
+
/* @__PURE__ */ jsxs9(
|
|
1085
1169
|
"div",
|
|
1086
1170
|
{
|
|
1087
1171
|
style: {
|
|
@@ -1093,7 +1177,7 @@ var MetaTagsPreview = (props) => {
|
|
|
1093
1177
|
gap: 6
|
|
1094
1178
|
},
|
|
1095
1179
|
children: [
|
|
1096
|
-
/* @__PURE__ */
|
|
1180
|
+
/* @__PURE__ */ jsx9(
|
|
1097
1181
|
"span",
|
|
1098
1182
|
{
|
|
1099
1183
|
style: {
|
|
@@ -1105,11 +1189,11 @@ var MetaTagsPreview = (props) => {
|
|
|
1105
1189
|
}
|
|
1106
1190
|
}
|
|
1107
1191
|
),
|
|
1108
|
-
/* @__PURE__ */
|
|
1192
|
+
/* @__PURE__ */ jsx9("span", { style: { fontSize: 11, color: headerText, fontFamily: "monospace" }, children: "HTML" })
|
|
1109
1193
|
]
|
|
1110
1194
|
}
|
|
1111
1195
|
),
|
|
1112
|
-
/* @__PURE__ */
|
|
1196
|
+
/* @__PURE__ */ jsx9(
|
|
1113
1197
|
Box2,
|
|
1114
1198
|
{
|
|
1115
1199
|
as: "pre",
|
|
@@ -1125,7 +1209,7 @@ var MetaTagsPreview = (props) => {
|
|
|
1125
1209
|
wordBreak: "break-word",
|
|
1126
1210
|
backgroundColor: codeBg
|
|
1127
1211
|
},
|
|
1128
|
-
children: tokens.map((token, idx) => /* @__PURE__ */
|
|
1212
|
+
children: tokens.map((token, idx) => /* @__PURE__ */ jsx9("span", { style: { color: token.color }, children: token.text }, idx))
|
|
1129
1213
|
}
|
|
1130
1214
|
)
|
|
1131
1215
|
]
|
|
@@ -1136,21 +1220,21 @@ var MetaTagsPreview = (props) => {
|
|
|
1136
1220
|
var MetaTagsPreview_default = MetaTagsPreview;
|
|
1137
1221
|
|
|
1138
1222
|
// src/components/meta/MetaTitle.tsx
|
|
1139
|
-
import { Stack as
|
|
1140
|
-
import { useEffect as useEffect3, useMemo as useMemo6, useState as
|
|
1141
|
-
import { PatchEvent as
|
|
1142
|
-
import { jsx as
|
|
1223
|
+
import { Stack as Stack8, Text as Text8 } from "@sanity/ui";
|
|
1224
|
+
import { useEffect as useEffect3, useMemo as useMemo6, useState as useState6 } from "react";
|
|
1225
|
+
import { PatchEvent as PatchEvent5, set as set5, useClient as useClient3, useFormValue as useFormValue9 } from "sanity";
|
|
1226
|
+
import { jsx as jsx10, jsxs as jsxs10 } from "react/jsx-runtime";
|
|
1143
1227
|
var MetaTitle = (props) => {
|
|
1144
1228
|
var _a, _b, _c;
|
|
1145
1229
|
const { value, renderDefault, path, schemaType, onChange } = props;
|
|
1146
1230
|
const { options } = schemaType;
|
|
1147
|
-
const parent =
|
|
1231
|
+
const parent = useFormValue9([path[0]]);
|
|
1148
1232
|
const isParentseoField = parent && (parent == null ? void 0 : parent._type) === "seoFields";
|
|
1149
1233
|
const keywords = useMemo6(() => (parent == null ? void 0 : parent.keywords) || [], [parent == null ? void 0 : parent.keywords]);
|
|
1150
|
-
const rootDoc = (_a =
|
|
1151
|
-
const client =
|
|
1152
|
-
const [groqTitleSuffix, setGroqTitleSuffix] =
|
|
1153
|
-
const [isDuplicateTitle, setIsDuplicateTitle] =
|
|
1234
|
+
const rootDoc = (_a = useFormValue9([])) != null ? _a : {};
|
|
1235
|
+
const client = useClient3({ apiVersion: (_b = options == null ? void 0 : options.apiVersion) != null ? _b : "2024-01-01" });
|
|
1236
|
+
const [groqTitleSuffix, setGroqTitleSuffix] = useState6("");
|
|
1237
|
+
const [isDuplicateTitle, setIsDuplicateTitle] = useState6(false);
|
|
1154
1238
|
const titleSuffixQuery = options == null ? void 0 : options.titleSuffixQuery;
|
|
1155
1239
|
const titleSuffixOption = options == null ? void 0 : options.titleSuffix;
|
|
1156
1240
|
useEffect3(() => {
|
|
@@ -1189,20 +1273,20 @@ var MetaTitle = (props) => {
|
|
|
1189
1273
|
() => getMetaTitleValidationMessages(value || "", keywords, isParentseoField, suffixLength),
|
|
1190
1274
|
[value, keywords, isParentseoField, suffixLength]
|
|
1191
1275
|
);
|
|
1192
|
-
return /* @__PURE__ */
|
|
1276
|
+
return /* @__PURE__ */ jsxs10(Stack8, { space: 3, children: [
|
|
1193
1277
|
renderDefault(props),
|
|
1194
|
-
/* @__PURE__ */
|
|
1278
|
+
/* @__PURE__ */ jsx10(
|
|
1195
1279
|
SeoGenButton,
|
|
1196
1280
|
{
|
|
1197
1281
|
field: "title",
|
|
1198
1282
|
ai: options == null ? void 0 : options.ai,
|
|
1199
1283
|
seoFieldPath: String(path[0]),
|
|
1200
|
-
onGenerate: (v) => onChange(
|
|
1284
|
+
onGenerate: (v) => onChange(PatchEvent5.from(set5(v)))
|
|
1201
1285
|
}
|
|
1202
1286
|
),
|
|
1203
|
-
/* @__PURE__ */
|
|
1204
|
-
feedbackItems.map((item) => /* @__PURE__ */
|
|
1205
|
-
/* @__PURE__ */
|
|
1287
|
+
/* @__PURE__ */ jsxs10(Stack8, { space: 2, children: [
|
|
1288
|
+
feedbackItems.map((item) => /* @__PURE__ */ jsxs10("div", { style: { display: "flex", alignItems: "center", gap: 7 }, children: [
|
|
1289
|
+
/* @__PURE__ */ jsx10(
|
|
1206
1290
|
"div",
|
|
1207
1291
|
{
|
|
1208
1292
|
style: {
|
|
@@ -1213,10 +1297,10 @@ var MetaTitle = (props) => {
|
|
|
1213
1297
|
}
|
|
1214
1298
|
}
|
|
1215
1299
|
),
|
|
1216
|
-
/* @__PURE__ */
|
|
1300
|
+
/* @__PURE__ */ jsx10(Text8, { weight: "bold", muted: true, size: 14, children: item.text })
|
|
1217
1301
|
] }, item.text)),
|
|
1218
|
-
isDuplicateTitle && /* @__PURE__ */
|
|
1219
|
-
/* @__PURE__ */
|
|
1302
|
+
isDuplicateTitle && /* @__PURE__ */ jsxs10("div", { style: { display: "flex", alignItems: "center", gap: 7 }, children: [
|
|
1303
|
+
/* @__PURE__ */ jsx10(
|
|
1220
1304
|
"div",
|
|
1221
1305
|
{
|
|
1222
1306
|
style: {
|
|
@@ -1227,7 +1311,7 @@ var MetaTitle = (props) => {
|
|
|
1227
1311
|
}
|
|
1228
1312
|
}
|
|
1229
1313
|
),
|
|
1230
|
-
/* @__PURE__ */
|
|
1314
|
+
/* @__PURE__ */ jsx10(Text8, { weight: "bold", muted: true, size: 14, children: "Duplicate meta title \u2014 another published document uses this exact title." })
|
|
1231
1315
|
] })
|
|
1232
1316
|
] })
|
|
1233
1317
|
] });
|
|
@@ -1381,33 +1465,33 @@ var isEmpty = (value) => {
|
|
|
1381
1465
|
import { defineField, defineType } from "sanity";
|
|
1382
1466
|
|
|
1383
1467
|
// src/components/openGraph/OgDescription.tsx
|
|
1384
|
-
import { Stack as
|
|
1468
|
+
import { Stack as Stack9, Text as Text9 } from "@sanity/ui";
|
|
1385
1469
|
import { useMemo as useMemo7 } from "react";
|
|
1386
|
-
import { PatchEvent as
|
|
1387
|
-
import { jsx as
|
|
1470
|
+
import { PatchEvent as PatchEvent6, set as set6, useFormValue as useFormValue10 } from "sanity";
|
|
1471
|
+
import { jsx as jsx11, jsxs as jsxs11 } from "react/jsx-runtime";
|
|
1388
1472
|
var OgDescription = (props) => {
|
|
1389
1473
|
const { value, renderDefault, path, schemaType, onChange } = props;
|
|
1390
1474
|
const { options } = schemaType;
|
|
1391
|
-
const parent =
|
|
1475
|
+
const parent = useFormValue10([path[0]]);
|
|
1392
1476
|
const isParentseoField = parent && (parent == null ? void 0 : parent._type) === "seoFields";
|
|
1393
1477
|
const keywords = useMemo7(() => (parent == null ? void 0 : parent.keywords) || [], [parent == null ? void 0 : parent.keywords]);
|
|
1394
1478
|
const feedbackItems = useMemo7(
|
|
1395
1479
|
() => getOgDescriptionValidation(value || "", keywords, isParentseoField),
|
|
1396
1480
|
[value, keywords, isParentseoField]
|
|
1397
1481
|
);
|
|
1398
|
-
return /* @__PURE__ */
|
|
1482
|
+
return /* @__PURE__ */ jsxs11(Stack9, { space: 3, children: [
|
|
1399
1483
|
renderDefault(props),
|
|
1400
|
-
/* @__PURE__ */
|
|
1484
|
+
/* @__PURE__ */ jsx11(
|
|
1401
1485
|
SeoGenButton,
|
|
1402
1486
|
{
|
|
1403
1487
|
field: "ogDescription",
|
|
1404
1488
|
ai: options == null ? void 0 : options.ai,
|
|
1405
1489
|
seoFieldPath: String(path[0]),
|
|
1406
|
-
onGenerate: (v) => onChange(
|
|
1490
|
+
onGenerate: (v) => onChange(PatchEvent6.from(set6(v)))
|
|
1407
1491
|
}
|
|
1408
1492
|
),
|
|
1409
|
-
/* @__PURE__ */
|
|
1410
|
-
/* @__PURE__ */
|
|
1493
|
+
/* @__PURE__ */ jsx11(Stack9, { space: 2, children: feedbackItems.map((item) => /* @__PURE__ */ jsxs11("div", { style: { display: "flex", alignItems: "center", gap: 7 }, children: [
|
|
1494
|
+
/* @__PURE__ */ jsx11(
|
|
1411
1495
|
"div",
|
|
1412
1496
|
{
|
|
1413
1497
|
style: {
|
|
@@ -1418,20 +1502,20 @@ var OgDescription = (props) => {
|
|
|
1418
1502
|
}
|
|
1419
1503
|
}
|
|
1420
1504
|
),
|
|
1421
|
-
/* @__PURE__ */
|
|
1505
|
+
/* @__PURE__ */ jsx11(Text9, { weight: "bold", muted: true, size: 14, children: item.text })
|
|
1422
1506
|
] }, item.text)) })
|
|
1423
1507
|
] });
|
|
1424
1508
|
};
|
|
1425
1509
|
var OgDescription_default = OgDescription;
|
|
1426
1510
|
|
|
1427
1511
|
// src/components/openGraph/OgImage.tsx
|
|
1428
|
-
import { Stack as
|
|
1512
|
+
import { Stack as Stack10, Text as Text10 } from "@sanity/ui";
|
|
1429
1513
|
import { useMemo as useMemo8 } from "react";
|
|
1430
|
-
import { useFormValue as
|
|
1431
|
-
import { jsx as
|
|
1514
|
+
import { useFormValue as useFormValue11 } from "sanity";
|
|
1515
|
+
import { jsx as jsx12, jsxs as jsxs12 } from "react/jsx-runtime";
|
|
1432
1516
|
var OgImage = (props) => {
|
|
1433
1517
|
const { value, renderDefault, path } = props;
|
|
1434
|
-
const seoParent =
|
|
1518
|
+
const seoParent = useFormValue11([path[0]]);
|
|
1435
1519
|
const imgValue = value;
|
|
1436
1520
|
const hasImage = !!(imgValue == null ? void 0 : imgValue.asset);
|
|
1437
1521
|
const altText = imgValue == null ? void 0 : imgValue.alt;
|
|
@@ -1439,10 +1523,10 @@ var OgImage = (props) => {
|
|
|
1439
1523
|
() => getOgImageValidation(hasImage, altText, seoParent),
|
|
1440
1524
|
[hasImage, altText, seoParent]
|
|
1441
1525
|
);
|
|
1442
|
-
return /* @__PURE__ */
|
|
1526
|
+
return /* @__PURE__ */ jsxs12(Stack10, { space: 3, children: [
|
|
1443
1527
|
renderDefault(props),
|
|
1444
|
-
/* @__PURE__ */
|
|
1445
|
-
/* @__PURE__ */
|
|
1528
|
+
/* @__PURE__ */ jsx12(Stack10, { space: 2, children: feedbackItems.map((item) => /* @__PURE__ */ jsxs12("div", { style: { display: "flex", alignItems: "center", gap: 7 }, children: [
|
|
1529
|
+
/* @__PURE__ */ jsx12(
|
|
1446
1530
|
"div",
|
|
1447
1531
|
{
|
|
1448
1532
|
style: {
|
|
@@ -1453,25 +1537,25 @@ var OgImage = (props) => {
|
|
|
1453
1537
|
}
|
|
1454
1538
|
}
|
|
1455
1539
|
),
|
|
1456
|
-
/* @__PURE__ */
|
|
1540
|
+
/* @__PURE__ */ jsx12(Text10, { weight: "bold", muted: true, size: 14, children: item.text })
|
|
1457
1541
|
] }, item.text)) })
|
|
1458
1542
|
] });
|
|
1459
1543
|
};
|
|
1460
1544
|
var OgImage_default = OgImage;
|
|
1461
1545
|
|
|
1462
1546
|
// src/components/openGraph/OgImageUrl.tsx
|
|
1463
|
-
import { Stack as
|
|
1547
|
+
import { Stack as Stack11, Text as Text11 } from "@sanity/ui";
|
|
1464
1548
|
import { useMemo as useMemo9 } from "react";
|
|
1465
|
-
import { useFormValue as
|
|
1466
|
-
import { jsx as
|
|
1549
|
+
import { useFormValue as useFormValue12 } from "sanity";
|
|
1550
|
+
import { jsx as jsx13, jsxs as jsxs13 } from "react/jsx-runtime";
|
|
1467
1551
|
var OgImageUrl = (props) => {
|
|
1468
1552
|
const { value, renderDefault, path } = props;
|
|
1469
|
-
const seoParent =
|
|
1553
|
+
const seoParent = useFormValue12([path[0]]);
|
|
1470
1554
|
const feedbackItems = useMemo9(() => getOgImageUrlValidation(value, seoParent), [value, seoParent]);
|
|
1471
|
-
return /* @__PURE__ */
|
|
1555
|
+
return /* @__PURE__ */ jsxs13(Stack11, { space: 3, children: [
|
|
1472
1556
|
renderDefault(props),
|
|
1473
|
-
/* @__PURE__ */
|
|
1474
|
-
/* @__PURE__ */
|
|
1557
|
+
/* @__PURE__ */ jsx13(Stack11, { space: 2, children: feedbackItems.map((item) => /* @__PURE__ */ jsxs13("div", { style: { display: "flex", alignItems: "center", gap: 7 }, children: [
|
|
1558
|
+
/* @__PURE__ */ jsx13(
|
|
1475
1559
|
"div",
|
|
1476
1560
|
{
|
|
1477
1561
|
style: {
|
|
@@ -1482,40 +1566,40 @@ var OgImageUrl = (props) => {
|
|
|
1482
1566
|
}
|
|
1483
1567
|
}
|
|
1484
1568
|
),
|
|
1485
|
-
/* @__PURE__ */
|
|
1569
|
+
/* @__PURE__ */ jsx13(Text11, { weight: "bold", muted: true, size: 14, children: item.text })
|
|
1486
1570
|
] }, item.text)) })
|
|
1487
1571
|
] });
|
|
1488
1572
|
};
|
|
1489
1573
|
var OgImageUrl_default = OgImageUrl;
|
|
1490
1574
|
|
|
1491
1575
|
// src/components/openGraph/OgTitle.tsx
|
|
1492
|
-
import { Stack as
|
|
1576
|
+
import { Stack as Stack12, Text as Text12 } from "@sanity/ui";
|
|
1493
1577
|
import { useMemo as useMemo10 } from "react";
|
|
1494
|
-
import { PatchEvent as
|
|
1495
|
-
import { jsx as
|
|
1578
|
+
import { PatchEvent as PatchEvent7, set as set7, useFormValue as useFormValue13 } from "sanity";
|
|
1579
|
+
import { jsx as jsx14, jsxs as jsxs14 } from "react/jsx-runtime";
|
|
1496
1580
|
var OgTitle = (props) => {
|
|
1497
1581
|
const { value, renderDefault, path, schemaType, onChange } = props;
|
|
1498
1582
|
const { options } = schemaType;
|
|
1499
|
-
const parent =
|
|
1583
|
+
const parent = useFormValue13([path[0]]);
|
|
1500
1584
|
const isParentseoField = parent && (parent == null ? void 0 : parent._type) === "seoFields";
|
|
1501
1585
|
const keywords = useMemo10(() => (parent == null ? void 0 : parent.keywords) || [], [parent == null ? void 0 : parent.keywords]);
|
|
1502
1586
|
const feedbackItems = useMemo10(
|
|
1503
1587
|
() => getOgTitleValidation(value || "", keywords, isParentseoField),
|
|
1504
1588
|
[value, keywords, isParentseoField]
|
|
1505
1589
|
);
|
|
1506
|
-
return /* @__PURE__ */
|
|
1590
|
+
return /* @__PURE__ */ jsxs14(Stack12, { space: 3, children: [
|
|
1507
1591
|
renderDefault(props),
|
|
1508
|
-
/* @__PURE__ */
|
|
1592
|
+
/* @__PURE__ */ jsx14(
|
|
1509
1593
|
SeoGenButton,
|
|
1510
1594
|
{
|
|
1511
1595
|
field: "ogTitle",
|
|
1512
1596
|
ai: options == null ? void 0 : options.ai,
|
|
1513
1597
|
seoFieldPath: String(path[0]),
|
|
1514
|
-
onGenerate: (v) => onChange(
|
|
1598
|
+
onGenerate: (v) => onChange(PatchEvent7.from(set7(v)))
|
|
1515
1599
|
}
|
|
1516
1600
|
),
|
|
1517
|
-
/* @__PURE__ */
|
|
1518
|
-
/* @__PURE__ */
|
|
1601
|
+
/* @__PURE__ */ jsx14(Stack12, { space: 2, children: feedbackItems.map((item) => /* @__PURE__ */ jsxs14("div", { style: { display: "flex", alignItems: "center", gap: 7 }, children: [
|
|
1602
|
+
/* @__PURE__ */ jsx14(
|
|
1519
1603
|
"div",
|
|
1520
1604
|
{
|
|
1521
1605
|
style: {
|
|
@@ -1526,7 +1610,7 @@ var OgTitle = (props) => {
|
|
|
1526
1610
|
}
|
|
1527
1611
|
}
|
|
1528
1612
|
),
|
|
1529
|
-
/* @__PURE__ */
|
|
1613
|
+
/* @__PURE__ */ jsx14(Text12, { weight: "bold", muted: true, size: 14, children: item.text })
|
|
1530
1614
|
] }, item.text)) })
|
|
1531
1615
|
] });
|
|
1532
1616
|
};
|
|
@@ -1652,33 +1736,33 @@ function openGraph(config = {}) {
|
|
|
1652
1736
|
import { defineField as defineField2, defineType as defineType2 } from "sanity";
|
|
1653
1737
|
|
|
1654
1738
|
// src/components/twitter/twitterDescription.tsx
|
|
1655
|
-
import { Stack as
|
|
1739
|
+
import { Stack as Stack13, Text as Text13 } from "@sanity/ui";
|
|
1656
1740
|
import { useMemo as useMemo11 } from "react";
|
|
1657
|
-
import { PatchEvent as
|
|
1658
|
-
import { jsx as
|
|
1741
|
+
import { PatchEvent as PatchEvent8, set as set8, useFormValue as useFormValue14 } from "sanity";
|
|
1742
|
+
import { jsx as jsx15, jsxs as jsxs15 } from "react/jsx-runtime";
|
|
1659
1743
|
var TwitterDescription = (props) => {
|
|
1660
1744
|
const { value, renderDefault, path, schemaType, onChange } = props;
|
|
1661
1745
|
const { options } = schemaType;
|
|
1662
|
-
const parent =
|
|
1746
|
+
const parent = useFormValue14([path[0]]);
|
|
1663
1747
|
const isParentseoField = parent && (parent == null ? void 0 : parent._type) === "seoFields";
|
|
1664
1748
|
const keywords = useMemo11(() => (parent == null ? void 0 : parent.keywords) || [], [parent == null ? void 0 : parent.keywords]);
|
|
1665
1749
|
const feedbackItems = useMemo11(
|
|
1666
1750
|
() => getTwitterDescriptionValidation(value || "", keywords, isParentseoField),
|
|
1667
1751
|
[value, keywords, isParentseoField]
|
|
1668
1752
|
);
|
|
1669
|
-
return /* @__PURE__ */
|
|
1753
|
+
return /* @__PURE__ */ jsxs15(Stack13, { space: 3, children: [
|
|
1670
1754
|
renderDefault(props),
|
|
1671
|
-
/* @__PURE__ */
|
|
1755
|
+
/* @__PURE__ */ jsx15(
|
|
1672
1756
|
SeoGenButton,
|
|
1673
1757
|
{
|
|
1674
1758
|
field: "twitterDescription",
|
|
1675
1759
|
ai: options == null ? void 0 : options.ai,
|
|
1676
1760
|
seoFieldPath: String(path[0]),
|
|
1677
|
-
onGenerate: (v) => onChange(
|
|
1761
|
+
onGenerate: (v) => onChange(PatchEvent8.from(set8(v)))
|
|
1678
1762
|
}
|
|
1679
1763
|
),
|
|
1680
|
-
/* @__PURE__ */
|
|
1681
|
-
/* @__PURE__ */
|
|
1764
|
+
/* @__PURE__ */ jsx15(Stack13, { space: 2, children: feedbackItems.map((item) => /* @__PURE__ */ jsxs15("div", { style: { display: "flex", alignItems: "center", gap: 7 }, children: [
|
|
1765
|
+
/* @__PURE__ */ jsx15(
|
|
1682
1766
|
"div",
|
|
1683
1767
|
{
|
|
1684
1768
|
style: {
|
|
@@ -1689,20 +1773,20 @@ var TwitterDescription = (props) => {
|
|
|
1689
1773
|
}
|
|
1690
1774
|
}
|
|
1691
1775
|
),
|
|
1692
|
-
/* @__PURE__ */
|
|
1776
|
+
/* @__PURE__ */ jsx15(Text13, { weight: "bold", muted: true, size: 14, children: item.text })
|
|
1693
1777
|
] }, item.text)) })
|
|
1694
1778
|
] });
|
|
1695
1779
|
};
|
|
1696
1780
|
var twitterDescription_default = TwitterDescription;
|
|
1697
1781
|
|
|
1698
1782
|
// src/components/twitter/TwitterImage.tsx
|
|
1699
|
-
import { Stack as
|
|
1783
|
+
import { Stack as Stack14, Text as Text14 } from "@sanity/ui";
|
|
1700
1784
|
import { useMemo as useMemo12 } from "react";
|
|
1701
|
-
import { useFormValue as
|
|
1702
|
-
import { jsx as
|
|
1785
|
+
import { useFormValue as useFormValue15 } from "sanity";
|
|
1786
|
+
import { jsx as jsx16, jsxs as jsxs16 } from "react/jsx-runtime";
|
|
1703
1787
|
var TwitterImage = (props) => {
|
|
1704
1788
|
const { value, renderDefault, path } = props;
|
|
1705
|
-
const seoParent =
|
|
1789
|
+
const seoParent = useFormValue15([path[0]]);
|
|
1706
1790
|
const imgValue = value;
|
|
1707
1791
|
const hasImage = !!(imgValue == null ? void 0 : imgValue.asset);
|
|
1708
1792
|
const altText = imgValue == null ? void 0 : imgValue.alt;
|
|
@@ -1710,10 +1794,10 @@ var TwitterImage = (props) => {
|
|
|
1710
1794
|
() => getTwitterImageValidation(hasImage, altText, seoParent),
|
|
1711
1795
|
[hasImage, altText, seoParent]
|
|
1712
1796
|
);
|
|
1713
|
-
return /* @__PURE__ */
|
|
1797
|
+
return /* @__PURE__ */ jsxs16(Stack14, { space: 3, children: [
|
|
1714
1798
|
renderDefault(props),
|
|
1715
|
-
/* @__PURE__ */
|
|
1716
|
-
/* @__PURE__ */
|
|
1799
|
+
/* @__PURE__ */ jsx16(Stack14, { space: 2, children: feedbackItems.map((item) => /* @__PURE__ */ jsxs16("div", { style: { display: "flex", alignItems: "center", gap: 7 }, children: [
|
|
1800
|
+
/* @__PURE__ */ jsx16(
|
|
1717
1801
|
"div",
|
|
1718
1802
|
{
|
|
1719
1803
|
style: {
|
|
@@ -1724,28 +1808,28 @@ var TwitterImage = (props) => {
|
|
|
1724
1808
|
}
|
|
1725
1809
|
}
|
|
1726
1810
|
),
|
|
1727
|
-
/* @__PURE__ */
|
|
1811
|
+
/* @__PURE__ */ jsx16(Text14, { weight: "bold", muted: true, size: 14, children: item.text })
|
|
1728
1812
|
] }, item.text)) })
|
|
1729
1813
|
] });
|
|
1730
1814
|
};
|
|
1731
1815
|
var TwitterImage_default = TwitterImage;
|
|
1732
1816
|
|
|
1733
1817
|
// src/components/twitter/TwitterImageUrl.tsx
|
|
1734
|
-
import { Stack as
|
|
1818
|
+
import { Stack as Stack15, Text as Text15 } from "@sanity/ui";
|
|
1735
1819
|
import { useMemo as useMemo13 } from "react";
|
|
1736
|
-
import { useFormValue as
|
|
1737
|
-
import { jsx as
|
|
1820
|
+
import { useFormValue as useFormValue16 } from "sanity";
|
|
1821
|
+
import { jsx as jsx17, jsxs as jsxs17 } from "react/jsx-runtime";
|
|
1738
1822
|
var TwitterImageUrl = (props) => {
|
|
1739
1823
|
const { value, renderDefault, path } = props;
|
|
1740
|
-
const seoParent =
|
|
1824
|
+
const seoParent = useFormValue16([path[0]]);
|
|
1741
1825
|
const feedbackItems = useMemo13(
|
|
1742
1826
|
() => getTwitterImageUrlValidation(value, seoParent),
|
|
1743
1827
|
[value, seoParent]
|
|
1744
1828
|
);
|
|
1745
|
-
return /* @__PURE__ */
|
|
1829
|
+
return /* @__PURE__ */ jsxs17(Stack15, { space: 3, children: [
|
|
1746
1830
|
renderDefault(props),
|
|
1747
|
-
/* @__PURE__ */
|
|
1748
|
-
/* @__PURE__ */
|
|
1831
|
+
/* @__PURE__ */ jsx17(Stack15, { space: 2, children: feedbackItems.map((item) => /* @__PURE__ */ jsxs17("div", { style: { display: "flex", alignItems: "center", gap: 7 }, children: [
|
|
1832
|
+
/* @__PURE__ */ jsx17(
|
|
1749
1833
|
"div",
|
|
1750
1834
|
{
|
|
1751
1835
|
style: {
|
|
@@ -1756,40 +1840,40 @@ var TwitterImageUrl = (props) => {
|
|
|
1756
1840
|
}
|
|
1757
1841
|
}
|
|
1758
1842
|
),
|
|
1759
|
-
/* @__PURE__ */
|
|
1843
|
+
/* @__PURE__ */ jsx17(Text15, { weight: "bold", muted: true, size: 14, children: item.text })
|
|
1760
1844
|
] }, item.text)) })
|
|
1761
1845
|
] });
|
|
1762
1846
|
};
|
|
1763
1847
|
var TwitterImageUrl_default = TwitterImageUrl;
|
|
1764
1848
|
|
|
1765
1849
|
// src/components/twitter/twitterTitle.tsx
|
|
1766
|
-
import { Stack as
|
|
1850
|
+
import { Stack as Stack16, Text as Text16 } from "@sanity/ui";
|
|
1767
1851
|
import { useMemo as useMemo14 } from "react";
|
|
1768
|
-
import { PatchEvent as
|
|
1769
|
-
import { jsx as
|
|
1852
|
+
import { PatchEvent as PatchEvent9, set as set9, useFormValue as useFormValue17 } from "sanity";
|
|
1853
|
+
import { jsx as jsx18, jsxs as jsxs18 } from "react/jsx-runtime";
|
|
1770
1854
|
var TwitterTitle = (props) => {
|
|
1771
1855
|
const { value, renderDefault, path, schemaType, onChange } = props;
|
|
1772
1856
|
const { options } = schemaType;
|
|
1773
|
-
const parent =
|
|
1857
|
+
const parent = useFormValue17([path[0]]);
|
|
1774
1858
|
const isParentseoField = parent && (parent == null ? void 0 : parent._type) === "seoFields";
|
|
1775
1859
|
const keywords = useMemo14(() => (parent == null ? void 0 : parent.keywords) || [], [parent == null ? void 0 : parent.keywords]);
|
|
1776
1860
|
const feedbackItems = useMemo14(
|
|
1777
1861
|
() => getTwitterTitleValidation(value || "", keywords, isParentseoField),
|
|
1778
1862
|
[value, keywords, isParentseoField]
|
|
1779
1863
|
);
|
|
1780
|
-
return /* @__PURE__ */
|
|
1864
|
+
return /* @__PURE__ */ jsxs18(Stack16, { space: 3, children: [
|
|
1781
1865
|
renderDefault(props),
|
|
1782
|
-
/* @__PURE__ */
|
|
1866
|
+
/* @__PURE__ */ jsx18(
|
|
1783
1867
|
SeoGenButton,
|
|
1784
1868
|
{
|
|
1785
1869
|
field: "twitterTitle",
|
|
1786
1870
|
ai: options == null ? void 0 : options.ai,
|
|
1787
1871
|
seoFieldPath: String(path[0]),
|
|
1788
|
-
onGenerate: (v) => onChange(
|
|
1872
|
+
onGenerate: (v) => onChange(PatchEvent9.from(set9(v)))
|
|
1789
1873
|
}
|
|
1790
1874
|
),
|
|
1791
|
-
/* @__PURE__ */
|
|
1792
|
-
/* @__PURE__ */
|
|
1875
|
+
/* @__PURE__ */ jsx18(Stack16, { space: 2, children: feedbackItems.map((item) => /* @__PURE__ */ jsxs18("div", { style: { display: "flex", alignItems: "center", gap: 7 }, children: [
|
|
1876
|
+
/* @__PURE__ */ jsx18(
|
|
1793
1877
|
"div",
|
|
1794
1878
|
{
|
|
1795
1879
|
style: {
|
|
@@ -1800,7 +1884,7 @@ var TwitterTitle = (props) => {
|
|
|
1800
1884
|
}
|
|
1801
1885
|
}
|
|
1802
1886
|
),
|
|
1803
|
-
/* @__PURE__ */
|
|
1887
|
+
/* @__PURE__ */ jsx18(Text16, { weight: "bold", muted: true, size: 14, children: item.text })
|
|
1804
1888
|
] }, item.text)) })
|
|
1805
1889
|
] });
|
|
1806
1890
|
};
|
|
@@ -2023,6 +2107,7 @@ function buildMetaTagsPreviewField(config, fieldGroupMap) {
|
|
|
2023
2107
|
];
|
|
2024
2108
|
}
|
|
2025
2109
|
function seoFieldsSchema(config = {}) {
|
|
2110
|
+
var _a;
|
|
2026
2111
|
const groupsCfg = config.fieldGroups;
|
|
2027
2112
|
const fieldGroupMap = (groupsCfg == null ? void 0 : groupsCfg.length) ? buildFieldGroupMap(groupsCfg) : void 0;
|
|
2028
2113
|
const sanityGroups = (groupsCfg == null ? void 0 : groupsCfg.length) ? toSanityGroups(groupsCfg) : void 0;
|
|
@@ -2147,12 +2232,20 @@ function seoFieldsSchema(config = {}) {
|
|
|
2147
2232
|
fieldGroupMap
|
|
2148
2233
|
),
|
|
2149
2234
|
withGroup(
|
|
2150
|
-
defineField3(__spreadProps(__spreadValues({
|
|
2235
|
+
defineField3(__spreadProps(__spreadValues(__spreadProps(__spreadValues({
|
|
2151
2236
|
name: "hreflangs"
|
|
2152
2237
|
}, getFieldInfo("hreflangs", config.fieldOverrides)), {
|
|
2153
2238
|
type: "array",
|
|
2154
2239
|
of: [{ type: "hreflangEntry" }],
|
|
2155
|
-
description: "Add alternate language/region versions. Include x-default for the fallback URL."
|
|
2240
|
+
description: "Add alternate language/region versions. Include x-default for the fallback URL."
|
|
2241
|
+
}), ((_a = config.hreflang) == null ? void 0 : _a.autoFill) ? {
|
|
2242
|
+
components: { input: HreflangInput_default },
|
|
2243
|
+
options: {
|
|
2244
|
+
hreflang: config.hreflang,
|
|
2245
|
+
baseUrl: config.baseUrl,
|
|
2246
|
+
apiVersion: config.apiVersion
|
|
2247
|
+
}
|
|
2248
|
+
} : {}), {
|
|
2156
2249
|
hidden: getFieldHiddenFunction("hreflangs", config)
|
|
2157
2250
|
})),
|
|
2158
2251
|
fieldGroupMap
|