@chaibuilder/sdk 4.0.0-beta.1 → 4.0.0-beta.3
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 +27 -20
- package/dist/2SSKDMRQ-BnsZi3K3.cjs +1 -0
- package/dist/2SSKDMRQ-CnSDkQcy.js +42 -0
- package/dist/AP7HFJJL-B31839PG.cjs +1228 -0
- package/dist/AP7HFJJL-CymCmW14.js +9214 -0
- package/dist/IconPicker-B1rWC-Ex.js +59 -0
- package/dist/IconPicker-DREyo007.cjs +1 -0
- package/dist/WDYDFRGG-BUVnbAci.js +33 -0
- package/dist/WDYDFRGG-BxhOCHc3.cjs +1 -0
- package/dist/_commonjsHelpers-C6fGbg64.js +6 -0
- package/dist/_commonjsHelpers-DwGv2jUC.cjs +1 -0
- package/dist/actions-registery-CZ1w0NKa.js +15545 -0
- package/dist/actions-registery-YnFmU21O.cjs +418 -0
- package/dist/actions.cjs +1 -0
- package/dist/actions.d.ts +3202 -0
- package/dist/actions.js +216 -0
- package/dist/active-in-another-tab-B47YjQGN.cjs +1 -0
- package/dist/active-in-another-tab-CyjngVA6.js +34 -0
- package/dist/add-new-language-page-88xzrUy8.cjs +1 -0
- package/dist/add-new-language-page-WmlCnytQ.js +401 -0
- package/dist/add-new-page-VW2wAYZp.js +31 -0
- package/dist/add-new-page-soZ8GAkN.cjs +1 -0
- package/dist/ai-panel-content-7zCil042.cjs +1 -0
- package/dist/ai-panel-content-D_o7Q_A-.js +61 -0
- package/dist/ai-panel-default-lang-COYaxNwn.cjs +3 -0
- package/dist/ai-panel-default-lang-DnElspF0.js +341 -0
- package/dist/ai-panel-other-lang-CkynNlAU.cjs +1 -0
- package/dist/ai-panel-other-lang-Dp0E9_Hx.js +162 -0
- package/dist/ai-prompt-input-Bhc0ds7X.js +655 -0
- package/dist/ai-prompt-input-CThbVp0_.cjs +1 -0
- package/dist/ai-translation-prompt-C2kJQFDX.cjs +1 -0
- package/dist/ai-translation-prompt-CZ55HQmo.js +28 -0
- package/dist/apply-binding-6iwlED02.js +833 -0
- package/dist/apply-binding-KKp5PnpZ.cjs +1 -0
- package/dist/code-display-BnqzqzoP.cjs +1 -0
- package/dist/{code-display-337R7Dev.js → code-display-DhD_RBcg.js} +1 -1
- package/dist/code-editor-DRIAnNbb.js +50 -0
- package/dist/code-editor-o3___nu2.cjs +1 -0
- package/dist/common-functions-B3a4xKt_.cjs +1 -0
- package/dist/common-functions-D2lMFR6K.js +13 -0
- package/dist/continue-editing-in-this-client-CS2aQ7yY.js +24 -0
- package/dist/continue-editing-in-this-client-CtMYsk-A.cjs +1 -0
- package/dist/core-BoRDjj4h.cjs +1 -0
- package/dist/core-yvI6kCyw.js +56 -0
- package/dist/core.cjs +1 -1
- package/dist/core.d.ts +51 -383
- package/dist/core.js +39 -106
- package/dist/{css-import-modal-DA2L6kwP.js → css-import-modal-Byg6wV0O.js} +36 -36
- package/dist/css-import-modal-CyqkXWCO.cjs +13 -0
- package/dist/delete-design-token-BRZZiWtQ.js +40 -0
- package/dist/delete-design-token-DkVs1oBf.cjs +1 -0
- package/dist/delete-page-BzyX9TN-.js +70 -0
- package/dist/delete-page-DxX7PFIE.cjs +1 -0
- package/dist/design-token-usage-CAHzEGgJ.cjs +1 -0
- package/dist/design-token-usage-xQs6SlaJ.js +113 -0
- package/dist/digital-asset-manager--uO8Agia.cjs +1 -0
- package/dist/digital-asset-manager-DbtwzxRz.js +876 -0
- package/dist/duplicate-page-BR7Dlo9d.js +133 -0
- package/dist/duplicate-page-CaNAbXwV.cjs +1 -0
- package/dist/dynamic-page-selector-Cb5r_W8s.js +85 -0
- package/dist/dynamic-page-selector-Cxk_gjni.cjs +1 -0
- package/dist/fonts-B-Xt29pe.cjs +1 -0
- package/dist/fonts-DRly3Wzd.js +78 -0
- package/dist/{get-chai-builder-tailwind-config-C6MHaUM0.cjs → get-chai-builder-tailwind-config-B9rCyiQo.cjs} +1 -1
- package/dist/{get-chai-builder-tailwind-config-BqaIvg8p.js → get-chai-builder-tailwind-config-DjoVOuAf.js} +13 -10
- package/dist/{get-chai-builder-theme-D0IsUvK4.js → get-chai-builder-theme-BYtp20KD.js} +4 -4
- package/dist/get-chai-builder-theme-Dl72X7cz.cjs +1 -0
- package/dist/get-seo-defaults-9zHebckY.js +65 -0
- package/dist/get-seo-defaults-Cw7vFt-B.cjs +1 -0
- package/dist/image-compression-DZ9WMmyn.cjs +1 -0
- package/dist/image-compression-DsZ1oqpb.js +37 -0
- package/dist/image-editor-DV8kUKhl.js +108 -0
- package/dist/image-editor-G-K28aTS.cjs +1 -0
- package/dist/index-B-rSiAp_.cjs +1 -0
- package/dist/index-Ct7ElCGK.js +19069 -0
- package/dist/index-DF5DEvqb.cjs +160 -0
- package/dist/index-Dxfyt4d4.js +39 -0
- package/dist/index-WQwzsC7A.cjs +5 -0
- package/dist/index-ZuacEL1j.js +4732 -0
- package/dist/json-diff-viewer-D7z4zNvv.cjs +8 -0
- package/dist/json-diff-viewer-krslPepD.js +258 -0
- package/dist/lang-panel-BwIewMyw.js +215 -0
- package/dist/lang-panel-DT96k1xg.cjs +1 -0
- package/dist/manage-design-tokens-Caz_20VK.js +240 -0
- package/dist/manage-design-tokens-CrmLe7UT.cjs +1 -0
- package/dist/mark-as-template-D295ZQtU.js +156 -0
- package/dist/mark-as-template-W3LmpiqN.cjs +1 -0
- package/dist/models-5gOsRC56.cjs +1 -0
- package/dist/models-D95ZYr_x.js +70 -0
- package/dist/nested-path-selector-content-CKYYK-C5.js +87 -0
- package/dist/nested-path-selector-content-CoS_d3dc.cjs +1 -0
- package/dist/no-language-page-content-BvqRBP6y.js +42 -0
- package/dist/no-language-page-content-DkfeMl90.cjs +1 -0
- package/dist/no-language-page-dialog-BcEoqyQB.cjs +1 -0
- package/dist/no-language-page-dialog-PjNqTUpl.js +10 -0
- package/dist/page-creator-C4gc5NSC.cjs +1 -0
- package/dist/page-creator-DiOITEMw.js +795 -0
- package/dist/page-lock-BdYmCks0.cjs +1 -0
- package/dist/page-lock-Bfbs6RgL.js +30 -0
- package/dist/page-locked-dialog-B1FAtK92.cjs +1 -0
- package/dist/page-locked-dialog-B6MKTRfY.js +133 -0
- package/dist/page-manager-new-CHDueBDk.cjs +1 -0
- package/dist/page-manager-new-CzX22g2n.js +394 -0
- package/dist/page-manager-search-and-filter-CM0UMb6U.js +201 -0
- package/dist/page-manager-search-and-filter-DkkRIH86.cjs +1 -0
- package/dist/page-revisions-content-ChY-4f2V.cjs +1 -0
- package/dist/page-revisions-content-NH9JK4Ey.js +445 -0
- package/dist/pages.cjs +1 -0
- package/dist/pages.d.ts +491 -0
- package/dist/pages.js +27 -0
- package/dist/plugin-3ZKK6RXm.js +245 -0
- package/dist/plugin-C6rgJDNQ.cjs +22 -0
- package/dist/publish-pages-content-D9aixMN5.js +178 -0
- package/dist/publish-pages-content-x-JuSFJ9.cjs +1 -0
- package/dist/register-partial-type-BjtdfKHE.js +36 -0
- package/dist/register-partial-type-ig9fUWIJ.cjs +1 -0
- package/dist/render.cjs +2 -2
- package/dist/render.d.ts +26 -13
- package/dist/render.js +130 -124
- package/dist/rte-widget-modal-BaHIuEjF.cjs +1 -0
- package/dist/rte-widget-modal-DOJEXLIf.js +38 -0
- package/dist/runtime.cjs +1 -1
- package/dist/runtime.d.ts +306 -7
- package/dist/runtime.js +44 -1
- package/dist/save-to-lib-Cgpxw8-g.cjs +1 -0
- package/dist/save-to-lib-eiOc_SSN.js +422 -0
- package/dist/sdk.css +1 -1
- package/dist/selected-block-display-BgRY82CT.cjs +16 -0
- package/dist/selected-block-display-CBFePS19.js +319 -0
- package/dist/seo-panel-C1-iMOR1.js +798 -0
- package/dist/seo-panel-DfAb8U7W.cjs +2 -0
- package/dist/shared-json-ld-B4PxAM_0.js +565 -0
- package/dist/shared-json-ld-DzG398hr.cjs +1 -0
- package/dist/slug-input-AwNJs9im.js +86 -0
- package/dist/slug-input-C_ijLQ_X.cjs +1 -0
- package/dist/supabase-actions.cjs +1 -0
- package/dist/supabase-actions.d.ts +284 -0
- package/dist/supabase-actions.js +524 -0
- package/dist/take-over-request-BNxcjY2j.cjs +1 -0
- package/dist/take-over-request-C4FeDtN_.js +63 -0
- package/dist/theme-panel-footer-Cq9pljro.cjs +1 -0
- package/dist/theme-panel-footer-uBQqSJXm.js +25 -0
- package/dist/translation-warning-modal-B64YqlbI.js +26 -0
- package/dist/translation-warning-modal-BZAcwM2_.cjs +1 -0
- package/dist/unmark-as-template-CZ9sQp_P.js +39 -0
- package/dist/unmark-as-template-EVvk0vmp.cjs +1 -0
- package/dist/unpublish-page-D4VwOlxc.js +27 -0
- package/dist/unpublish-page-bdSmwAVQ.cjs +1 -0
- package/dist/use-page-expand-manager-B6XTvk0E.cjs +1 -0
- package/dist/use-page-expand-manager-Cf4MUEJw.js +85 -0
- package/dist/{tailwind.cjs → utils.cjs} +1 -1
- package/dist/{tailwind.d.ts → utils.d.ts} +12 -11
- package/dist/utils.js +7 -0
- package/dist/web-blocks.cjs +1 -1
- package/dist/web-blocks.d.ts +0 -6
- package/dist/web-blocks.js +248 -241
- package/dist/web-preview-Cio70gk5.cjs +1 -0
- package/dist/web-preview-Djy6WIyj.js +73 -0
- package/package.json +175 -105
- package/dist/IconPicker-CGWn9C4u.cjs +0 -1
- package/dist/IconPicker-QvxJ-4Ez.js +0 -64
- package/dist/apply-binding-DCno1xQL.js +0 -711
- package/dist/apply-binding-DvHNFLQD.cjs +0 -1
- package/dist/code-display-BZ1x7SqI.cjs +0 -1
- package/dist/code-editor-B28LoECM.cjs +0 -1
- package/dist/code-editor-CfG2FhJ-.js +0 -58
- package/dist/common-functions-BGzDsf1z.js +0 -14
- package/dist/common-functions-BZmyleS1.cjs +0 -1
- package/dist/css-import-modal-CENUYvcl.cjs +0 -13
- package/dist/get-chai-builder-theme-Ck_Z4Q-M.cjs +0 -1
- package/dist/index-CaGNHF7f.js +0 -12209
- package/dist/index-Gn6pJt2v.cjs +0 -166
- package/dist/mockServiceWorker.js +0 -307
- package/dist/plugin-B5627hMN.js +0 -195
- package/dist/plugin-UxTRfDum.cjs +0 -22
- package/dist/rte-widget-modal-DL739qeQ.cjs +0 -1
- package/dist/rte-widget-modal-Dte0od04.js +0 -41
- package/dist/tailwind.js +0 -7
- package/dist/tooltip-A4qGk781.cjs +0 -1
- package/dist/tooltip-tLiIOgjq.js +0 -1067
- package/dist/ui.cjs +0 -1
- package/dist/ui.d.ts +0 -415
- package/dist/ui.js +0 -129
- package/dist/vite.svg +0 -1
|
@@ -0,0 +1,798 @@
|
|
|
1
|
+
import { jsx as t, jsxs as o } from "react/jsx-runtime";
|
|
2
|
+
import { l as ve, as as xe, ar as Ne, A as we, L as ee, aw as Se, aK as De, aL as Oe, i as be, ay as je, aM as Le, aN as Ie, aO as T, aP as Ee, aE as te } from "./index-ZuacEL1j.js";
|
|
3
|
+
import { n as z, B as R, D as ke, d as Te, e as Ce, f as Fe, p as Ae, o as Je, am as Pe, A as Re, av as Be, ax as qe, ay as Ue, az as $, L as S, I as A, T as se } from "./index-Ct7ElCGK.js";
|
|
4
|
+
import { find as _e, get as g, isEqual as ne, isEmpty as Ve } from "lodash-es";
|
|
5
|
+
import { useMemo as Ge, useRef as ae, useState as J, useEffect as oe } from "react";
|
|
6
|
+
import { useTranslation as Me } from "react-i18next";
|
|
7
|
+
import { toast as b } from "sonner";
|
|
8
|
+
import { useMutation as He } from "@tanstack/react-query";
|
|
9
|
+
import { Loader as $e, Wand2Icon as We } from "lucide-react";
|
|
10
|
+
import { g as W } from "./get-seo-defaults-9zHebckY.js";
|
|
11
|
+
const ze = () => {
|
|
12
|
+
const { selectedLang: e } = z(), { data: l, isFetching: r } = ve();
|
|
13
|
+
return { data: Ge(() => _e(l, { lang: e || "" }) || {}, [l, e]), isFetching: r };
|
|
14
|
+
}, Ke = () => {
|
|
15
|
+
var y;
|
|
16
|
+
const l = (y = document.getElementById("canvas-iframe").contentDocument) == null ? void 0 : y.body.innerHTML;
|
|
17
|
+
if (!l) return null;
|
|
18
|
+
const a = new DOMParser().parseFromString(l, "text/html");
|
|
19
|
+
a.querySelectorAll("style, script, link, svg, [data-block-type='PartialBlock']").forEach((m) => m.remove()), a.querySelectorAll("*").forEach((m) => {
|
|
20
|
+
Array.from(m.attributes).forEach((p) => m.removeAttribute(p.name));
|
|
21
|
+
});
|
|
22
|
+
const n = a.querySelectorAll("h1, h2, h3, h4, h5, h6, p");
|
|
23
|
+
return Array.from(n).map((m) => `<${m.tagName.toLowerCase()}>${m.innerHTML}</${m.tagName.toLowerCase()}>`).join(" ").replace(/<p>Partial block. Double click to edit.<\/p>/, "");
|
|
24
|
+
}, P = ({
|
|
25
|
+
keyword: e,
|
|
26
|
+
onComplete: l,
|
|
27
|
+
field: r
|
|
28
|
+
}) => {
|
|
29
|
+
const a = xe(), n = Ne(), { selectedLang: c, fallbackLang: y } = z(), { mutate: m, isPending: p } = He({
|
|
30
|
+
mutationFn: async () => {
|
|
31
|
+
const j = Ke();
|
|
32
|
+
return await a(n, {
|
|
33
|
+
action: we.GENERATE_SEO_FIELD,
|
|
34
|
+
data: {
|
|
35
|
+
pageContext: "",
|
|
36
|
+
dynamic: !1,
|
|
37
|
+
field: r,
|
|
38
|
+
lang: c || y,
|
|
39
|
+
pageContent: j,
|
|
40
|
+
keyword: e
|
|
41
|
+
}
|
|
42
|
+
});
|
|
43
|
+
},
|
|
44
|
+
onSuccess: (j) => {
|
|
45
|
+
l({ fieldValue: j.field });
|
|
46
|
+
},
|
|
47
|
+
onError: (j) => {
|
|
48
|
+
l({ fieldValue: null, error: j.message });
|
|
49
|
+
}
|
|
50
|
+
});
|
|
51
|
+
return /* @__PURE__ */ t(
|
|
52
|
+
R,
|
|
53
|
+
{
|
|
54
|
+
disabled: p,
|
|
55
|
+
type: "button",
|
|
56
|
+
className: "h-5 w-5",
|
|
57
|
+
variant: "ghost",
|
|
58
|
+
size: "sm",
|
|
59
|
+
onClick: () => m(),
|
|
60
|
+
children: p ? /* @__PURE__ */ t($e, { className: "h-3 w-3 animate-spin text-yellow-500" }) : /* @__PURE__ */ t(We, { className: "text-yellow-500" })
|
|
61
|
+
}
|
|
62
|
+
);
|
|
63
|
+
}, h = (e, l) => {
|
|
64
|
+
if (!e)
|
|
65
|
+
return { success: !1, error: "Empty response from AI" };
|
|
66
|
+
try {
|
|
67
|
+
let r = e;
|
|
68
|
+
if (typeof r == "string" && (/^".*"$/.test(r) && (r = r.replace(/^"(.*)"$/, "$1"), r = r.replace(/\\\\/g, "___DOUBLE_BACKSLASH___").replace(/\\n/g, `
|
|
69
|
+
`).replace(/\\"/g, '"').replace(/___DOUBLE_BACKSLASH___/g, "\\")), l === "jsonLD" || l === "metaOther")) {
|
|
70
|
+
r.includes("```") && (r = r.replace(/^```json\s*/i, "").replace(/^```\s*/, "").replace(/\s*```$/m, "")), r = r.trim();
|
|
71
|
+
try {
|
|
72
|
+
JSON.parse(r);
|
|
73
|
+
} catch {
|
|
74
|
+
return {
|
|
75
|
+
success: !1,
|
|
76
|
+
error: "The AI response is not valid JSON. Please try again or edit manually."
|
|
77
|
+
};
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
return { success: !0, value: r };
|
|
81
|
+
} catch (r) {
|
|
82
|
+
return {
|
|
83
|
+
success: !1,
|
|
84
|
+
error: r instanceof Error ? r.message : "Unknown error occurred"
|
|
85
|
+
};
|
|
86
|
+
}
|
|
87
|
+
};
|
|
88
|
+
if (import.meta.vitest) {
|
|
89
|
+
const { it: e, expect: l, describe: r } = import.meta.vitest;
|
|
90
|
+
r("processAiSeoResponse", () => {
|
|
91
|
+
r("Regular text fields (title, description, etc.)", () => {
|
|
92
|
+
e("should handle plain text responses", () => {
|
|
93
|
+
const a = h("SEO Title Here", "title");
|
|
94
|
+
l(a).toEqual({ success: !0, value: "SEO Title Here" });
|
|
95
|
+
}), e("should remove surrounding quotes from text fields", () => {
|
|
96
|
+
const a = h('"SEO Title Here"', "title");
|
|
97
|
+
l(a).toEqual({ success: !0, value: "SEO Title Here" });
|
|
98
|
+
}), e("should handle empty string", () => {
|
|
99
|
+
const a = h("", "title");
|
|
100
|
+
l(a).toEqual({ success: !1, error: "Empty response from AI" });
|
|
101
|
+
}), e("should handle null value", () => {
|
|
102
|
+
const a = h(null, "title");
|
|
103
|
+
l(a).toEqual({ success: !1, error: "Empty response from AI" });
|
|
104
|
+
});
|
|
105
|
+
}), r("JSON fields (jsonLD, metaOther)", () => {
|
|
106
|
+
e("should handle valid JSON without code blocks", () => {
|
|
107
|
+
const a = '{"@context": "https://schema.org", "@type": "WebPage"}', n = h(a, "jsonLD");
|
|
108
|
+
l(n).toEqual({ success: !0, value: a });
|
|
109
|
+
}), e("should remove ```json code blocks and validate JSON", () => {
|
|
110
|
+
const a = '```json\n{"@context": "https://schema.org", "@type": "WebPage"}\n```', n = '{"@context": "https://schema.org", "@type": "WebPage"}', c = h(a, "jsonLD");
|
|
111
|
+
l(c).toEqual({ success: !0, value: n });
|
|
112
|
+
}), e("should remove ``` code blocks (without json keyword) and validate JSON", () => {
|
|
113
|
+
const a = '```\n{"@context": "https://schema.org", "@type": "WebPage"}\n```', n = '{"@context": "https://schema.org", "@type": "WebPage"}', c = h(a, "jsonLD");
|
|
114
|
+
l(c).toEqual({ success: !0, value: n });
|
|
115
|
+
}), e("should handle ```JSON (uppercase) code blocks", () => {
|
|
116
|
+
const a = '```JSON\n{"@context": "https://schema.org"}\n```', n = '{"@context": "https://schema.org"}', c = h(a, "jsonLD");
|
|
117
|
+
l(c).toEqual({ success: !0, value: n });
|
|
118
|
+
}), e("should handle code blocks with extra whitespace", () => {
|
|
119
|
+
const a = '```json \n {"@context": "https://schema.org"} \n ```', n = '{"@context": "https://schema.org"}', c = h(a, "jsonLD");
|
|
120
|
+
l(c).toEqual({ success: !0, value: n });
|
|
121
|
+
}), e("should reject invalid JSON after removing code blocks", () => {
|
|
122
|
+
const n = h("```json\n{invalid json here}\n```", "jsonLD");
|
|
123
|
+
l(n).toEqual({
|
|
124
|
+
success: !1,
|
|
125
|
+
error: "The AI response is not valid JSON. Please try again or edit manually."
|
|
126
|
+
});
|
|
127
|
+
}), e("should reject invalid JSON without code blocks", () => {
|
|
128
|
+
const n = h("{invalid json}", "jsonLD");
|
|
129
|
+
l(n).toEqual({
|
|
130
|
+
success: !1,
|
|
131
|
+
error: "The AI response is not valid JSON. Please try again or edit manually."
|
|
132
|
+
});
|
|
133
|
+
}), e("should handle complex nested JSON with code blocks", () => {
|
|
134
|
+
const n = h(`\`\`\`json
|
|
135
|
+
{
|
|
136
|
+
"@context": "https://schema.org",
|
|
137
|
+
"@type": "Article",
|
|
138
|
+
"author": {
|
|
139
|
+
"@type": "Person",
|
|
140
|
+
"name": "John Doe"
|
|
141
|
+
},
|
|
142
|
+
"datePublished": "2024-01-01"
|
|
143
|
+
}
|
|
144
|
+
\`\`\``, "jsonLD");
|
|
145
|
+
if (l(n.success).toBe(!0), n.success) {
|
|
146
|
+
const c = JSON.parse(n.value);
|
|
147
|
+
l(c["@type"]).toBe("Article"), l(c.author.name).toBe("John Doe");
|
|
148
|
+
}
|
|
149
|
+
}), e("should handle metaOther field with JSON", () => {
|
|
150
|
+
const a = '```json\n{"og:type": "website", "twitter:card": "summary"}\n```', n = '{"og:type": "website", "twitter:card": "summary"}', c = h(a, "metaOther");
|
|
151
|
+
l(c).toEqual({ success: !0, value: n });
|
|
152
|
+
}), e("should handle JSON arrays", () => {
|
|
153
|
+
const a = '```json\n[{"@type": "BreadcrumbList"}]\n```', n = '[{"@type": "BreadcrumbList"}]', c = h(a, "jsonLD");
|
|
154
|
+
l(c).toEqual({ success: !0, value: n });
|
|
155
|
+
}), e("should handle empty JSON object", () => {
|
|
156
|
+
const c = h("```json\n{}\n```", "jsonLD");
|
|
157
|
+
l(c).toEqual({ success: !0, value: "{}" });
|
|
158
|
+
}), e("should handle JSON with special characters and escaping", () => {
|
|
159
|
+
const a = '```json\n{"description": "A \\"quoted\\" string with\\nnewlines"}\n```', n = '{"description": "A \\"quoted\\" string with\\nnewlines"}', c = h(a, "jsonLD");
|
|
160
|
+
l(c).toEqual({ success: !0, value: n });
|
|
161
|
+
});
|
|
162
|
+
}), r("Edge cases", () => {
|
|
163
|
+
e("should handle response with only code block markers", () => {
|
|
164
|
+
const n = h("```json\n```", "jsonLD");
|
|
165
|
+
l(n.success).toBe(!1);
|
|
166
|
+
}), e("should handle malformed code blocks (missing closing)", () => {
|
|
167
|
+
const n = h('```json\n{"@context": "https://schema.org"}', "jsonLD");
|
|
168
|
+
if (l(n.success).toBe(!0), n.success) {
|
|
169
|
+
const c = JSON.parse(n.value);
|
|
170
|
+
l(c["@context"]).toBe("https://schema.org");
|
|
171
|
+
}
|
|
172
|
+
}), e("should handle response with double-quoted JSON", () => {
|
|
173
|
+
const n = h('{"@type": "WebPage", "name": "Test"}', "jsonLD");
|
|
174
|
+
if (l(n.success).toBe(!0), n.success) {
|
|
175
|
+
const c = JSON.parse(n.value);
|
|
176
|
+
l(c["@type"]).toBe("WebPage");
|
|
177
|
+
}
|
|
178
|
+
});
|
|
179
|
+
});
|
|
180
|
+
});
|
|
181
|
+
}
|
|
182
|
+
const Qe = ({
|
|
183
|
+
isOpen: e,
|
|
184
|
+
onClose: l,
|
|
185
|
+
onSave: r,
|
|
186
|
+
onDiscard: a,
|
|
187
|
+
isSaving: n = !1,
|
|
188
|
+
fromLanguage: c,
|
|
189
|
+
toLanguage: y
|
|
190
|
+
}) => {
|
|
191
|
+
const m = ee[c] || c, p = ee[y] || y;
|
|
192
|
+
return /* @__PURE__ */ t(ke, { open: e, onOpenChange: l, children: /* @__PURE__ */ o(Te, { className: "sm:max-w-[425px]", children: [
|
|
193
|
+
/* @__PURE__ */ o(Ce, { children: [
|
|
194
|
+
/* @__PURE__ */ t(Fe, { children: "Unsaved SEO Changes" }),
|
|
195
|
+
/* @__PURE__ */ o(Ae, { children: [
|
|
196
|
+
'You have unsaved changes in the SEO for "',
|
|
197
|
+
m,
|
|
198
|
+
'" version. Do you want to save these changes before switching to "',
|
|
199
|
+
p,
|
|
200
|
+
'" version?'
|
|
201
|
+
] })
|
|
202
|
+
] }),
|
|
203
|
+
/* @__PURE__ */ o("div", { className: "flex justify-end gap-3 pt-4", children: [
|
|
204
|
+
/* @__PURE__ */ t(R, { variant: "outline", onClick: a, disabled: n, children: "Discard Changes" }),
|
|
205
|
+
/* @__PURE__ */ t(R, { onClick: r, disabled: n, children: n ? "Saving..." : "Save & Switch" })
|
|
206
|
+
] })
|
|
207
|
+
] }) });
|
|
208
|
+
}, Ye = (e) => {
|
|
209
|
+
if (!e) return !0;
|
|
210
|
+
try {
|
|
211
|
+
return JSON.parse(e), !0;
|
|
212
|
+
} catch {
|
|
213
|
+
return !1;
|
|
214
|
+
}
|
|
215
|
+
}, Xe = (e, l) => {
|
|
216
|
+
const r = e.selectionStart || 0, a = e.selectionEnd || 0, n = e.value, c = n.substring(0, r), y = n.substring(a), m = `{{${l}}}`, p = c + "" + m + y, j = r + 0 + // Account for space before if added
|
|
217
|
+
m.length;
|
|
218
|
+
return {
|
|
219
|
+
value: p,
|
|
220
|
+
newCursorPos: j
|
|
221
|
+
};
|
|
222
|
+
}, Ze = () => {
|
|
223
|
+
const { t: e } = Me(), [, l] = Je(), { data: r } = Se(), { data: a } = De(), { data: n, isFetching: c } = ze(), y = n == null ? void 0 : n.seo, m = ae(null), [p, j] = J("seo"), B = r == null ? void 0 : r.id, le = r == null ? void 0 : r.pageType, I = Oe(le), { selectedLang: K, fallbackLang: re } = z(), f = K || re, [Q, U] = J(!1), [ce, Y] = J(!1), [ie, _] = J(!1), [D, V] = J(null), [i, O] = J({
|
|
224
|
+
keyword: "",
|
|
225
|
+
title: "",
|
|
226
|
+
description: "",
|
|
227
|
+
cononicalUrl: "",
|
|
228
|
+
noIndex: !1,
|
|
229
|
+
noFollow: "",
|
|
230
|
+
ogTitle: "",
|
|
231
|
+
ogDescription: "",
|
|
232
|
+
ogImage: "",
|
|
233
|
+
ogImageId: "",
|
|
234
|
+
searchTitle: "",
|
|
235
|
+
searchDescription: "",
|
|
236
|
+
jsonLD: "{}",
|
|
237
|
+
metaOther: "{}",
|
|
238
|
+
...y
|
|
239
|
+
}), C = ae({}), { mutate: de, isPending: G } = be(), x = G || Q || ce, { hasPermission: ue } = Pe(), d = ue(je.EDIT_SEO), [he] = Le(), me = g(he, "features.canResetSeoToDefault", !1), X = !K || i.jsonLD !== "{}";
|
|
240
|
+
oe(() => {
|
|
241
|
+
if (!c && y && B) {
|
|
242
|
+
const s = {
|
|
243
|
+
keyword: "",
|
|
244
|
+
title: "",
|
|
245
|
+
description: "",
|
|
246
|
+
cononicalUrl: "",
|
|
247
|
+
noIndex: !1,
|
|
248
|
+
noFollow: "",
|
|
249
|
+
ogTitle: "",
|
|
250
|
+
ogDescription: "",
|
|
251
|
+
ogImage: "",
|
|
252
|
+
ogImageId: "",
|
|
253
|
+
searchTitle: "",
|
|
254
|
+
searchDescription: "",
|
|
255
|
+
jsonLD: "",
|
|
256
|
+
metaOther: "",
|
|
257
|
+
...y
|
|
258
|
+
};
|
|
259
|
+
O(s), C.current[f] = s;
|
|
260
|
+
}
|
|
261
|
+
}, [c, y, f, B]), oe(() => {
|
|
262
|
+
const s = (u) => {
|
|
263
|
+
const { fromLang: v, toLang: q, switchHandler: w } = u.detail, M = C.current[f];
|
|
264
|
+
(M ? !ne(M, i) : !1) ? (V({ fromLang: v, toLang: q, switchHandler: w }), _(!0)) : w();
|
|
265
|
+
};
|
|
266
|
+
return window.addEventListener("seo-language-switch-check", s), () => {
|
|
267
|
+
window.removeEventListener("seo-language-switch-check", s);
|
|
268
|
+
};
|
|
269
|
+
}, [B, i, f]);
|
|
270
|
+
const pe = async () => {
|
|
271
|
+
if (!(!I || !f))
|
|
272
|
+
try {
|
|
273
|
+
U(!0);
|
|
274
|
+
const s = W(I, f), u = {
|
|
275
|
+
...i,
|
|
276
|
+
keyword: g(s, "seo.keyword", ""),
|
|
277
|
+
title: g(s, "seo.title", ""),
|
|
278
|
+
description: g(s, "seo.description", ""),
|
|
279
|
+
cononicalUrl: g(s, "seo.canonicalUrl", ""),
|
|
280
|
+
noIndex: g(s, "seo.noIndex", !1),
|
|
281
|
+
noFollow: g(s, "seo.noFollow", !1),
|
|
282
|
+
ogTitle: g(s, "seo.ogTitle", ""),
|
|
283
|
+
ogDescription: g(s, "seo.ogDescription", "")
|
|
284
|
+
// Keep jsonLD as is
|
|
285
|
+
};
|
|
286
|
+
O(u), b.success(e("SEO fields reset to defaults"));
|
|
287
|
+
} catch (s) {
|
|
288
|
+
b.error(e("Failed to reset SEO fields")), console.error("Reset SEO error:", s);
|
|
289
|
+
} finally {
|
|
290
|
+
U(!1);
|
|
291
|
+
}
|
|
292
|
+
}, ge = async () => {
|
|
293
|
+
if (!(!I || !f))
|
|
294
|
+
try {
|
|
295
|
+
Y(!0);
|
|
296
|
+
const s = W(I, f), u = {
|
|
297
|
+
...i,
|
|
298
|
+
jsonLD: g(s, "seo.jsonLD", "")
|
|
299
|
+
};
|
|
300
|
+
O(u), b.success(e("JSON-LD reset to default"));
|
|
301
|
+
} catch (s) {
|
|
302
|
+
b.error(e("Failed to reset JSON-LD")), console.error("Reset JSON-LD error:", s);
|
|
303
|
+
} finally {
|
|
304
|
+
Y(!1);
|
|
305
|
+
}
|
|
306
|
+
}, fe = async () => {
|
|
307
|
+
if (!(!I || !f))
|
|
308
|
+
try {
|
|
309
|
+
U(!0);
|
|
310
|
+
const s = W(I, f), u = {
|
|
311
|
+
...i,
|
|
312
|
+
ogTitle: g(s, "seo.ogTitle", ""),
|
|
313
|
+
ogDescription: g(s, "seo.ogDescription", ""),
|
|
314
|
+
ogImage: g(s, "seo.ogImage", ""),
|
|
315
|
+
ogImageId: g(s, "seo.ogImageId", ""),
|
|
316
|
+
metaOther: g(s, "seo.metaOther", "{}")
|
|
317
|
+
};
|
|
318
|
+
O(u), b.success(e("Meta Tag fields reset to defaults"));
|
|
319
|
+
} catch (s) {
|
|
320
|
+
b.error(e("Failed to reset Meta Tag fields")), console.error("Reset Meta Tag error:", s);
|
|
321
|
+
} finally {
|
|
322
|
+
U(!1);
|
|
323
|
+
}
|
|
324
|
+
}, Z = async () => {
|
|
325
|
+
de(
|
|
326
|
+
{ id: n == null ? void 0 : n.id, seo: i, primaryPage: B },
|
|
327
|
+
{
|
|
328
|
+
onSuccess: () => {
|
|
329
|
+
console.log("SEO & JSON-LD updated successfully", i), C.current[f] = i, b.success("SEO & JSON-LD updated successfully");
|
|
330
|
+
}
|
|
331
|
+
}
|
|
332
|
+
);
|
|
333
|
+
}, L = (s, u) => {
|
|
334
|
+
const v = document.getElementById(u);
|
|
335
|
+
if (v) {
|
|
336
|
+
const { value: q, newCursorPos: w } = Xe(v, s);
|
|
337
|
+
m.current = {
|
|
338
|
+
id: u,
|
|
339
|
+
position: w
|
|
340
|
+
}, v.tagName.toLowerCase() === "input" ? (v.value = q, O((k) => ({
|
|
341
|
+
...k,
|
|
342
|
+
[v.name]: q
|
|
343
|
+
})), v.focus(), v.setSelectionRange(w, w), [0, 10, 50, 100, 200].forEach((k) => {
|
|
344
|
+
setTimeout(() => {
|
|
345
|
+
const H = document.getElementById(u);
|
|
346
|
+
H && (H.focus(), H.setSelectionRange(w, w));
|
|
347
|
+
}, k);
|
|
348
|
+
})) : (O((E) => ({
|
|
349
|
+
...E,
|
|
350
|
+
[v.name]: q
|
|
351
|
+
})), requestAnimationFrame(() => {
|
|
352
|
+
const E = document.getElementById(u);
|
|
353
|
+
E && (E.focus(), E.setSelectionRange(w, w), setTimeout(() => {
|
|
354
|
+
const k = document.getElementById(u);
|
|
355
|
+
k && (k.focus(), k.setSelectionRange(w, w));
|
|
356
|
+
}, 50));
|
|
357
|
+
}));
|
|
358
|
+
}
|
|
359
|
+
}, N = (s) => {
|
|
360
|
+
const u = {
|
|
361
|
+
...i,
|
|
362
|
+
[s.target.name]: s.target.name === "noIndex" || s.target.name === "noFollow" ? s.target.checked : s.target.value
|
|
363
|
+
};
|
|
364
|
+
O(u);
|
|
365
|
+
}, F = (s) => (u) => {
|
|
366
|
+
if (!Ve(u.fieldValue)) {
|
|
367
|
+
const v = h(
|
|
368
|
+
u.fieldValue,
|
|
369
|
+
s
|
|
370
|
+
);
|
|
371
|
+
v.success ? N({
|
|
372
|
+
target: {
|
|
373
|
+
name: s,
|
|
374
|
+
value: v.value
|
|
375
|
+
}
|
|
376
|
+
}) : b.error(
|
|
377
|
+
/* @__PURE__ */ o("div", { children: [
|
|
378
|
+
/* @__PURE__ */ t("h2", { children: "Failed to process AI response:" }),
|
|
379
|
+
/* @__PURE__ */ t("p", { children: v.error })
|
|
380
|
+
] })
|
|
381
|
+
);
|
|
382
|
+
}
|
|
383
|
+
u.error && b.error(
|
|
384
|
+
/* @__PURE__ */ o("div", { children: [
|
|
385
|
+
/* @__PURE__ */ t("h2", { children: "Failed to generate:" }),
|
|
386
|
+
/* @__PURE__ */ t("p", { children: u.error })
|
|
387
|
+
] })
|
|
388
|
+
);
|
|
389
|
+
}, ye = () => {
|
|
390
|
+
const s = g(r, "seo.jsonLD", "{}");
|
|
391
|
+
if ((s == null ? void 0 : s.trim()) === "{}") {
|
|
392
|
+
b.error("Default page JSON-LD is empty");
|
|
393
|
+
return;
|
|
394
|
+
}
|
|
395
|
+
N({ target: { name: "jsonLD", value: s } });
|
|
396
|
+
};
|
|
397
|
+
return /* @__PURE__ */ o("div", { className: "relative flex h-full flex-col", "data-panel-id": "seo", children: [
|
|
398
|
+
!d && /* @__PURE__ */ t("div", { className: "absolute inset-0 z-10 flex items-center justify-center backdrop-blur-sm", children: /* @__PURE__ */ t(Re, { variant: "default", className: "w-[80%] max-w-md text-xs", children: /* @__PURE__ */ t(Be, { children: e("You don't have permission to edit SEO settings. Contact your administrator for access.") }) }) }),
|
|
399
|
+
/* @__PURE__ */ o("div", { className: "no-scrollbar flex-grow overflow-y-auto px-2 pb-20", children: [
|
|
400
|
+
/* @__PURE__ */ o("div", { className: "mb-4 flex w-full items-center justify-between rounded-md bg-gray-100 px-2 py-1 text-left text-sm", children: [
|
|
401
|
+
/* @__PURE__ */ o("span", { children: [
|
|
402
|
+
/* @__PURE__ */ t("div", { className: "font-medium", children: n == null ? void 0 : n.name }),
|
|
403
|
+
/* @__PURE__ */ t("span", { className: "font-mono text-xs leading-tight text-gray-500", children: n == null ? void 0 : n.slug })
|
|
404
|
+
] }),
|
|
405
|
+
/* @__PURE__ */ t(Ie, { variant: "outline", showAdd: !1 })
|
|
406
|
+
] }),
|
|
407
|
+
/* @__PURE__ */ t("form", { className: "space-y-8", children: /* @__PURE__ */ o(qe, { value: p, onValueChange: j, className: "w-full", children: [
|
|
408
|
+
/* @__PURE__ */ o(Ue, { className: "mb-4 grid w-full grid-cols-3", children: [
|
|
409
|
+
/* @__PURE__ */ t($, { value: "seo", children: e("SEO") }),
|
|
410
|
+
/* @__PURE__ */ t($, { value: "opengraph", children: e("Meta Tags") }),
|
|
411
|
+
/* @__PURE__ */ t($, { value: "jsonld", children: e("JSON-LD") })
|
|
412
|
+
] }),
|
|
413
|
+
/* @__PURE__ */ t("div", { className: p === "seo" ? "" : "sr-only", children: /* @__PURE__ */ o("div", { className: "space-y-4", children: [
|
|
414
|
+
/* @__PURE__ */ o("div", { className: "space-y-1", children: [
|
|
415
|
+
/* @__PURE__ */ o("div", { className: "flex items-center justify-between", children: [
|
|
416
|
+
/* @__PURE__ */ t(S, { className: "text-xs", htmlFor: "keyword", children: e("Keyword") }),
|
|
417
|
+
d && /* @__PURE__ */ t(
|
|
418
|
+
T,
|
|
419
|
+
{
|
|
420
|
+
dataType: "value",
|
|
421
|
+
data: a ?? {},
|
|
422
|
+
onSelect: (s) => L(s, "keyword")
|
|
423
|
+
}
|
|
424
|
+
)
|
|
425
|
+
] }),
|
|
426
|
+
/* @__PURE__ */ t(
|
|
427
|
+
A,
|
|
428
|
+
{
|
|
429
|
+
type: "text",
|
|
430
|
+
id: "keyword",
|
|
431
|
+
name: "keyword",
|
|
432
|
+
value: i.keyword,
|
|
433
|
+
onChange: N,
|
|
434
|
+
disabled: x || !d,
|
|
435
|
+
placeholder: e("Enter keyword"),
|
|
436
|
+
readOnly: !d
|
|
437
|
+
}
|
|
438
|
+
)
|
|
439
|
+
] }),
|
|
440
|
+
/* @__PURE__ */ o("div", { className: "space-y-1", children: [
|
|
441
|
+
/* @__PURE__ */ o("div", { className: "flex items-center justify-between", children: [
|
|
442
|
+
/* @__PURE__ */ t(S, { className: "text-xs", htmlFor: "title", children: e("SEO Title") }),
|
|
443
|
+
/* @__PURE__ */ o("div", { className: "flex items-center justify-end gap-2", children: [
|
|
444
|
+
/* @__PURE__ */ t(P, { keyword: i.keyword, onComplete: F("title"), field: "title" }),
|
|
445
|
+
d && /* @__PURE__ */ t(
|
|
446
|
+
T,
|
|
447
|
+
{
|
|
448
|
+
dataType: "value",
|
|
449
|
+
data: a ?? {},
|
|
450
|
+
onSelect: (s) => L(s, "title")
|
|
451
|
+
}
|
|
452
|
+
)
|
|
453
|
+
] })
|
|
454
|
+
] }),
|
|
455
|
+
/* @__PURE__ */ t(
|
|
456
|
+
A,
|
|
457
|
+
{
|
|
458
|
+
type: "text",
|
|
459
|
+
id: "title",
|
|
460
|
+
name: "title",
|
|
461
|
+
value: i.title,
|
|
462
|
+
onChange: N,
|
|
463
|
+
disabled: x || !d,
|
|
464
|
+
placeholder: e("Enter SEO title"),
|
|
465
|
+
readOnly: !d
|
|
466
|
+
}
|
|
467
|
+
)
|
|
468
|
+
] }),
|
|
469
|
+
/* @__PURE__ */ o("div", { className: "space-y-1", children: [
|
|
470
|
+
/* @__PURE__ */ o("div", { className: "flex items-center justify-between", children: [
|
|
471
|
+
/* @__PURE__ */ t(S, { className: "text-xs", htmlFor: "description", children: e("SEO Description") }),
|
|
472
|
+
/* @__PURE__ */ o("div", { className: "flex items-center gap-2", children: [
|
|
473
|
+
/* @__PURE__ */ t(
|
|
474
|
+
P,
|
|
475
|
+
{
|
|
476
|
+
keyword: i.keyword,
|
|
477
|
+
onComplete: F("description"),
|
|
478
|
+
field: "description"
|
|
479
|
+
}
|
|
480
|
+
),
|
|
481
|
+
d && /* @__PURE__ */ t(
|
|
482
|
+
T,
|
|
483
|
+
{
|
|
484
|
+
data: a ?? {},
|
|
485
|
+
onSelect: (s) => L(s, "description")
|
|
486
|
+
}
|
|
487
|
+
)
|
|
488
|
+
] })
|
|
489
|
+
] }),
|
|
490
|
+
/* @__PURE__ */ t(
|
|
491
|
+
se,
|
|
492
|
+
{
|
|
493
|
+
id: "description",
|
|
494
|
+
name: "description",
|
|
495
|
+
rows: 5,
|
|
496
|
+
value: i.description,
|
|
497
|
+
onChange: N,
|
|
498
|
+
disabled: x || !d,
|
|
499
|
+
placeholder: e("Enter SEO description"),
|
|
500
|
+
readOnly: !d
|
|
501
|
+
}
|
|
502
|
+
)
|
|
503
|
+
] }),
|
|
504
|
+
/* @__PURE__ */ o("div", { className: "space-y-1", children: [
|
|
505
|
+
/* @__PURE__ */ o("div", { className: "flex items-center justify-between", children: [
|
|
506
|
+
/* @__PURE__ */ t(S, { className: "text-xs", htmlFor: "title", children: e("Canonical URL") }),
|
|
507
|
+
d && /* @__PURE__ */ t(
|
|
508
|
+
T,
|
|
509
|
+
{
|
|
510
|
+
dataType: "value",
|
|
511
|
+
data: a ?? {},
|
|
512
|
+
onSelect: (s) => L(s, "canonicalUrl")
|
|
513
|
+
}
|
|
514
|
+
)
|
|
515
|
+
] }),
|
|
516
|
+
/* @__PURE__ */ t(
|
|
517
|
+
A,
|
|
518
|
+
{
|
|
519
|
+
type: "text",
|
|
520
|
+
id: "canonicalUrl",
|
|
521
|
+
name: "canonicalUrl",
|
|
522
|
+
value: i.canonicalUrl,
|
|
523
|
+
onChange: N,
|
|
524
|
+
disabled: x || !d,
|
|
525
|
+
placeholder: e("Enter Canonical URL"),
|
|
526
|
+
readOnly: !d
|
|
527
|
+
}
|
|
528
|
+
)
|
|
529
|
+
] }),
|
|
530
|
+
/* @__PURE__ */ o("div", { className: "", children: [
|
|
531
|
+
/* @__PURE__ */ o("div", { className: "flex items-center gap-x-2", children: [
|
|
532
|
+
/* @__PURE__ */ t(
|
|
533
|
+
A,
|
|
534
|
+
{
|
|
535
|
+
type: "checkbox",
|
|
536
|
+
id: "noIndex",
|
|
537
|
+
name: "noIndex",
|
|
538
|
+
checked: i.noIndex,
|
|
539
|
+
onChange: N,
|
|
540
|
+
disabled: x || !d,
|
|
541
|
+
className: "h-4 w-4"
|
|
542
|
+
}
|
|
543
|
+
),
|
|
544
|
+
/* @__PURE__ */ t(S, { className: "pb-1 text-xs", htmlFor: "noIndex", children: e("No Index") })
|
|
545
|
+
] }),
|
|
546
|
+
/* @__PURE__ */ t("p", { className: "mt-0 text-[10px] font-light leading-4 text-gray-400", children: e("Check this if you don't want search engines to index this page.") })
|
|
547
|
+
] }),
|
|
548
|
+
/* @__PURE__ */ o("div", { className: "", children: [
|
|
549
|
+
/* @__PURE__ */ o("div", { className: "flex items-center gap-x-2", children: [
|
|
550
|
+
/* @__PURE__ */ t(
|
|
551
|
+
A,
|
|
552
|
+
{
|
|
553
|
+
type: "checkbox",
|
|
554
|
+
id: "noFollow",
|
|
555
|
+
name: "noFollow",
|
|
556
|
+
checked: i.noFollow,
|
|
557
|
+
onChange: N,
|
|
558
|
+
disabled: x || !d,
|
|
559
|
+
className: "h-4 w-4"
|
|
560
|
+
}
|
|
561
|
+
),
|
|
562
|
+
/* @__PURE__ */ t(S, { className: "pb-1 text-xs", htmlFor: "noIndex", children: e("No Follow") })
|
|
563
|
+
] }),
|
|
564
|
+
/* @__PURE__ */ t("p", { className: "text-[10px] font-light leading-4 text-gray-400", children: e("Check this if you don't want search engines to follow links on this page.") })
|
|
565
|
+
] })
|
|
566
|
+
] }) }),
|
|
567
|
+
/* @__PURE__ */ t("div", { className: p === "opengraph" ? "" : "sr-only", children: /* @__PURE__ */ t("div", { className: "space-y-4", children: /* @__PURE__ */ o("div", { children: [
|
|
568
|
+
/* @__PURE__ */ t("h3", { className: "mb-4 font-semibold text-slate-700", children: e("Open Graph") }),
|
|
569
|
+
/* @__PURE__ */ o("div", { className: "space-y-4", children: [
|
|
570
|
+
/* @__PURE__ */ o("div", { className: "space-y-1", children: [
|
|
571
|
+
/* @__PURE__ */ o("div", { className: "flex items-center justify-between", children: [
|
|
572
|
+
/* @__PURE__ */ t(S, { className: "text-xs", htmlFor: "ogTitle", children: e("OG Title") }),
|
|
573
|
+
/* @__PURE__ */ o("div", { className: "flex items-center gap-2", children: [
|
|
574
|
+
/* @__PURE__ */ t(
|
|
575
|
+
P,
|
|
576
|
+
{
|
|
577
|
+
keyword: i.keyword,
|
|
578
|
+
onComplete: F("ogTitle"),
|
|
579
|
+
field: "ogTitle"
|
|
580
|
+
}
|
|
581
|
+
),
|
|
582
|
+
d && /* @__PURE__ */ t(
|
|
583
|
+
T,
|
|
584
|
+
{
|
|
585
|
+
dataType: "value",
|
|
586
|
+
data: a ?? {},
|
|
587
|
+
onSelect: (s) => L(s, "ogTitle")
|
|
588
|
+
}
|
|
589
|
+
)
|
|
590
|
+
] })
|
|
591
|
+
] }),
|
|
592
|
+
/* @__PURE__ */ t(
|
|
593
|
+
A,
|
|
594
|
+
{
|
|
595
|
+
type: "text",
|
|
596
|
+
id: "ogTitle",
|
|
597
|
+
name: "ogTitle",
|
|
598
|
+
value: i.ogTitle,
|
|
599
|
+
onChange: N,
|
|
600
|
+
disabled: x || !d,
|
|
601
|
+
placeholder: e("Enter OG title"),
|
|
602
|
+
readOnly: !d
|
|
603
|
+
}
|
|
604
|
+
)
|
|
605
|
+
] }),
|
|
606
|
+
/* @__PURE__ */ o("div", { className: "space-y-1", children: [
|
|
607
|
+
/* @__PURE__ */ o("div", { className: "flex items-center justify-between", children: [
|
|
608
|
+
/* @__PURE__ */ t(S, { className: "text-xs", htmlFor: "ogDescription", children: e("OG Description") }),
|
|
609
|
+
/* @__PURE__ */ o("div", { className: "flex items-center gap-2", children: [
|
|
610
|
+
/* @__PURE__ */ t(
|
|
611
|
+
P,
|
|
612
|
+
{
|
|
613
|
+
keyword: i.keyword,
|
|
614
|
+
onComplete: F("ogDescription"),
|
|
615
|
+
field: "ogDescription"
|
|
616
|
+
}
|
|
617
|
+
),
|
|
618
|
+
d && /* @__PURE__ */ t(
|
|
619
|
+
T,
|
|
620
|
+
{
|
|
621
|
+
dataType: "value",
|
|
622
|
+
data: a ?? {},
|
|
623
|
+
onSelect: (s) => L(s, "ogDescription")
|
|
624
|
+
}
|
|
625
|
+
)
|
|
626
|
+
] })
|
|
627
|
+
] }),
|
|
628
|
+
/* @__PURE__ */ t(
|
|
629
|
+
se,
|
|
630
|
+
{
|
|
631
|
+
id: "ogDescription",
|
|
632
|
+
name: "ogDescription",
|
|
633
|
+
rows: 5,
|
|
634
|
+
value: i.ogDescription,
|
|
635
|
+
onChange: N,
|
|
636
|
+
disabled: x || !d,
|
|
637
|
+
placeholder: e("Enter OG description"),
|
|
638
|
+
readOnly: !d
|
|
639
|
+
}
|
|
640
|
+
)
|
|
641
|
+
] }),
|
|
642
|
+
/* @__PURE__ */ o("div", { className: "space-y-1", children: [
|
|
643
|
+
/* @__PURE__ */ o("div", { className: "flex items-center justify-between", children: [
|
|
644
|
+
/* @__PURE__ */ t(S, { className: "text-xs", htmlFor: "ogImage", children: e("OG Image") }),
|
|
645
|
+
d && /* @__PURE__ */ t(
|
|
646
|
+
T,
|
|
647
|
+
{
|
|
648
|
+
dataType: "value",
|
|
649
|
+
data: a ?? {},
|
|
650
|
+
onSelect: (s) => {
|
|
651
|
+
O({
|
|
652
|
+
...i,
|
|
653
|
+
ogImage: `{{${s}}}`,
|
|
654
|
+
ogImageId: ""
|
|
655
|
+
});
|
|
656
|
+
}
|
|
657
|
+
}
|
|
658
|
+
)
|
|
659
|
+
] }),
|
|
660
|
+
/* @__PURE__ */ t(
|
|
661
|
+
Ee,
|
|
662
|
+
{
|
|
663
|
+
assetId: i.ogImageId,
|
|
664
|
+
assetUrl: i.ogImage,
|
|
665
|
+
onChange: (s) => {
|
|
666
|
+
O({
|
|
667
|
+
...i,
|
|
668
|
+
ogImage: s.url,
|
|
669
|
+
ogImageId: s.id
|
|
670
|
+
});
|
|
671
|
+
},
|
|
672
|
+
disabled: x || !d,
|
|
673
|
+
placeholder: e("Select OG image"),
|
|
674
|
+
className: "mb-2"
|
|
675
|
+
}
|
|
676
|
+
)
|
|
677
|
+
] }),
|
|
678
|
+
/* @__PURE__ */ o("div", { className: "space-y-1", children: [
|
|
679
|
+
/* @__PURE__ */ o("div", { className: "flex items-center justify-between", children: [
|
|
680
|
+
/* @__PURE__ */ t(S, { className: "text-xs", htmlFor: "metaOther", children: e("Meta Tags") }),
|
|
681
|
+
/* @__PURE__ */ t("div", { className: "flex items-center gap-2", children: /* @__PURE__ */ t(
|
|
682
|
+
P,
|
|
683
|
+
{
|
|
684
|
+
keyword: i.keyword,
|
|
685
|
+
onComplete: F("metaOther"),
|
|
686
|
+
field: "metaOther"
|
|
687
|
+
}
|
|
688
|
+
) })
|
|
689
|
+
] }),
|
|
690
|
+
/* @__PURE__ */ t(
|
|
691
|
+
te,
|
|
692
|
+
{
|
|
693
|
+
id: "metaOther",
|
|
694
|
+
value: i.metaOther,
|
|
695
|
+
onChange: (s) => {
|
|
696
|
+
N({
|
|
697
|
+
target: { name: "metaOther", value: s }
|
|
698
|
+
});
|
|
699
|
+
},
|
|
700
|
+
placeholder: e("Enter Meta Tags JSON"),
|
|
701
|
+
disabled: x || !d,
|
|
702
|
+
readOnly: !d,
|
|
703
|
+
pageData: a || {},
|
|
704
|
+
rows: 8,
|
|
705
|
+
handleFieldInsert: L
|
|
706
|
+
}
|
|
707
|
+
)
|
|
708
|
+
] })
|
|
709
|
+
] })
|
|
710
|
+
] }) }) }),
|
|
711
|
+
/* @__PURE__ */ t("div", { className: p === "jsonld" ? "" : "sr-only", children: /* @__PURE__ */ t("div", { className: "space-y-4", children: /* @__PURE__ */ o("div", { className: "space-y-1", children: [
|
|
712
|
+
/* @__PURE__ */ o("div", { className: "flex items-center justify-between", children: [
|
|
713
|
+
/* @__PURE__ */ t(S, { className: "text-xs", htmlFor: "jsonLD", children: e("JSON-LD") }),
|
|
714
|
+
X && /* @__PURE__ */ t("div", { className: "flex items-center gap-2", children: /* @__PURE__ */ t(P, { keyword: i.keyword, onComplete: F("jsonLD"), field: "jsonLD" }) })
|
|
715
|
+
] }),
|
|
716
|
+
/* @__PURE__ */ t("div", { className: "hidden", children: JSON.stringify(a) }),
|
|
717
|
+
/* @__PURE__ */ t(
|
|
718
|
+
te,
|
|
719
|
+
{
|
|
720
|
+
id: "jsonLD",
|
|
721
|
+
value: i.jsonLD,
|
|
722
|
+
onChange: (s) => {
|
|
723
|
+
N({ target: { name: "jsonLD", value: s } });
|
|
724
|
+
},
|
|
725
|
+
placeholder: e("Enter JSON-LD"),
|
|
726
|
+
disabled: x || !d,
|
|
727
|
+
readOnly: !d,
|
|
728
|
+
pageData: a || {},
|
|
729
|
+
rows: 12,
|
|
730
|
+
handleFieldInsert: L,
|
|
731
|
+
hasJsonLdForSelectedLang: X,
|
|
732
|
+
copyJsonLDFromDefaultPage: ye
|
|
733
|
+
}
|
|
734
|
+
)
|
|
735
|
+
] }) }) })
|
|
736
|
+
] }) })
|
|
737
|
+
] }),
|
|
738
|
+
d && /* @__PURE__ */ o("div", { className: "fixed bottom-0 left-0 right-0 flex w-full flex-shrink-0 items-center justify-between border-t bg-background p-4", children: [
|
|
739
|
+
me ? /* @__PURE__ */ t(
|
|
740
|
+
R,
|
|
741
|
+
{
|
|
742
|
+
type: "button",
|
|
743
|
+
variant: "ghost",
|
|
744
|
+
size: "sm",
|
|
745
|
+
onClick: () => {
|
|
746
|
+
p === "jsonld" ? ge() : p === "opengraph" ? fe() : pe();
|
|
747
|
+
},
|
|
748
|
+
disabled: x || !d || !I,
|
|
749
|
+
children: e(Q ? "Resetting..." : `Reset to ${p === "jsonld" ? "Default JSON-LD" : p === "opengraph" ? "Default Open Graph" : "Default SEO"}`)
|
|
750
|
+
}
|
|
751
|
+
) : /* @__PURE__ */ t("div", {}),
|
|
752
|
+
/* @__PURE__ */ o("div", { className: "flex items-center gap-4", children: [
|
|
753
|
+
/* @__PURE__ */ t(
|
|
754
|
+
R,
|
|
755
|
+
{
|
|
756
|
+
onClick: Z,
|
|
757
|
+
disabled: !Ye(i == null ? void 0 : i.jsonLD) || (C.current[f] ? ne(C.current[f], i) : !1) || x || !d,
|
|
758
|
+
children: e(G ? "Saving..." : "Save")
|
|
759
|
+
}
|
|
760
|
+
),
|
|
761
|
+
/* @__PURE__ */ t(
|
|
762
|
+
R,
|
|
763
|
+
{
|
|
764
|
+
variant: "link",
|
|
765
|
+
className: "text-gray-500 hover:text-gray-700",
|
|
766
|
+
onClick: () => l("outline"),
|
|
767
|
+
children: e("Cancel")
|
|
768
|
+
}
|
|
769
|
+
)
|
|
770
|
+
] })
|
|
771
|
+
] }),
|
|
772
|
+
/* @__PURE__ */ t(
|
|
773
|
+
Qe,
|
|
774
|
+
{
|
|
775
|
+
isOpen: ie,
|
|
776
|
+
onClose: () => {
|
|
777
|
+
_(!1), V(null);
|
|
778
|
+
},
|
|
779
|
+
onSave: async () => {
|
|
780
|
+
D && (await Z(), D.switchHandler(), _(!1), V(null));
|
|
781
|
+
},
|
|
782
|
+
onDiscard: () => {
|
|
783
|
+
if (D) {
|
|
784
|
+
const s = C.current[f];
|
|
785
|
+
s && O(s), D.switchHandler(), _(!1), V(null);
|
|
786
|
+
}
|
|
787
|
+
},
|
|
788
|
+
isSaving: G,
|
|
789
|
+
fromLanguage: (D == null ? void 0 : D.fromLang) || f,
|
|
790
|
+
toLanguage: (D == null ? void 0 : D.toLang) || ""
|
|
791
|
+
}
|
|
792
|
+
)
|
|
793
|
+
] });
|
|
794
|
+
};
|
|
795
|
+
Ze.displayName = "SeoPanel";
|
|
796
|
+
export {
|
|
797
|
+
Ze as default
|
|
798
|
+
};
|