@chaibuilder/sdk 4.0.0-beta.35 → 4.0.0-beta.36
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/{2SSKDMRQ-CZ0Vy6ir.cjs → 2SSKDMRQ-C3eivR9y.cjs} +1 -1
- package/dist/{2SSKDMRQ-Ce8xH_EE.js → 2SSKDMRQ-rk5vFzuv.js} +5 -5
- package/dist/{AP7HFJJL-C_GhxNzR.cjs → AP7HFJJL-2qWLZyWT.cjs} +1 -1
- package/dist/{AP7HFJJL-DxRUcy8z.js → AP7HFJJL-BMK2jPSi.js} +1 -1
- package/dist/{WDYDFRGG-JMA9G17v.js → WDYDFRGG-1zoPbvu7.js} +6 -6
- package/dist/{WDYDFRGG-DPPgf9Va.cjs → WDYDFRGG-Bfra_-3l.cjs} +1 -1
- package/dist/{actions-registery-CKEzH855.js → actions-registery-CMKfEXxX.js} +235 -301
- package/dist/{actions-registery-Byid-s6S.cjs → actions-registery-CqhNZFV3.cjs} +13 -13
- package/dist/actions.cjs +1 -1
- package/dist/actions.js +2 -2
- package/dist/{active-in-another-tab-CcCrhl7z.cjs → active-in-another-tab-DkOOxZwb.cjs} +1 -1
- package/dist/{active-in-another-tab-C-E0cjyu.js → active-in-another-tab-Zrq6x3L9.js} +1 -1
- package/dist/{add-new-language-page-DIAFT7Au.cjs → add-new-language-page-Dsze4PNK.cjs} +1 -1
- package/dist/{add-new-language-page-D93yJKtJ.js → add-new-language-page-alqCh26P.js} +1 -1
- package/dist/{add-new-page-D2IBnynJ.cjs → add-new-page-DtQYPRYM.cjs} +1 -1
- package/dist/{add-new-page-DaBpJeHK.js → add-new-page-HoFoI257.js} +1 -1
- package/dist/{ai-panel-content-DAXG0iZN.js → ai-panel-content-DZmolAf1.js} +2 -2
- package/dist/{ai-panel-content-CZO5fG_R.cjs → ai-panel-content-DcM2BBcL.cjs} +1 -1
- package/dist/{ai-panel-default-lang-CwnsdDO8.cjs → ai-panel-default-lang-BmVJcDnH.cjs} +1 -1
- package/dist/{ai-panel-default-lang-KI9kwEt7.js → ai-panel-default-lang-Bv8Fms5X.js} +1 -1
- package/dist/{ai-panel-other-lang-BpGRrcQQ.cjs → ai-panel-other-lang-BGyP45jz.cjs} +1 -1
- package/dist/{ai-panel-other-lang-DgyCpBVD.js → ai-panel-other-lang-CCGz4Tql.js} +2 -2
- package/dist/{ai-translation-prompt-BQ0OW9F_.cjs → ai-translation-prompt-DWj1gmKg.cjs} +1 -1
- package/dist/{ai-translation-prompt-Cs39rmRE.js → ai-translation-prompt-DXhM0OnM.js} +1 -1
- package/dist/{change-password-modal-CdrJct2d.cjs → change-password-modal-BcJsR8sq.cjs} +1 -1
- package/dist/{change-password-modal-CfZ3KoDT.js → change-password-modal-D4wVoj8S.js} +1 -1
- package/dist/{continue-editing-in-this-client-BkHlxvfG.cjs → continue-editing-in-this-client-BHbRZL8A.cjs} +1 -1
- package/dist/{continue-editing-in-this-client-BqgTDohA.js → continue-editing-in-this-client-CoZnDfgk.js} +1 -1
- package/dist/{delete-page-Vn6P6hEV.cjs → delete-page-DKBN4nL1.cjs} +1 -1
- package/dist/{delete-page-BIP7fPy_.js → delete-page-T2VWcbyP.js} +1 -1
- package/dist/{digital-asset-manager-aSXb6slG.js → digital-asset-manager-B1KUqVJc.js} +1 -1
- package/dist/{digital-asset-manager-BoNm3Q2W.cjs → digital-asset-manager-DYMrQhJ7.cjs} +1 -1
- package/dist/{duplicate-page-C46afThg.js → duplicate-page-Bt36erFD.js} +14 -14
- package/dist/{duplicate-page-CwFCJNwW.cjs → duplicate-page-Cop50Nuj.cjs} +1 -1
- package/dist/{dynamic-page-selector-txjqS5jX.cjs → dynamic-page-selector-DxJ80Cpv.cjs} +1 -1
- package/dist/{dynamic-page-selector-IT9LZDro.js → dynamic-page-selector-jMUcjGtc.js} +1 -1
- package/dist/index-DvOWqGdC.cjs +5 -0
- package/dist/{index-Bh0hrlXu.js → index-K4yKMKbY.js} +700 -681
- package/dist/{json-diff-viewer-CTsxzkiu.cjs → json-diff-viewer-BisiaC_I.cjs} +1 -1
- package/dist/{json-diff-viewer-D1Y_t-v4.js → json-diff-viewer-CivVPp1k.js} +33 -33
- package/dist/{lang-panel-irJl_yAH.js → lang-panel-DejZsTqE.js} +22 -22
- package/dist/{lang-panel-BUXBHMCZ.cjs → lang-panel-DoPGR_AP.cjs} +1 -1
- package/dist/{mark-as-template-DqIqHM7P.js → mark-as-template-NPUbCfae.js} +1 -1
- package/dist/{mark-as-template-Dr-qn1H7.cjs → mark-as-template-OqwiT2Zm.cjs} +1 -1
- package/dist/{no-language-page-content-Cb8CviKU.cjs → no-language-page-content-BGlAr__k.cjs} +1 -1
- package/dist/{no-language-page-content-DQK5hRDH.js → no-language-page-content-DfdMEUqE.js} +1 -1
- package/dist/{no-language-page-dialog-Bw_oSBFM.js → no-language-page-dialog-3obqd_9-.js} +2 -2
- package/dist/{no-language-page-dialog-J36heFUY.cjs → no-language-page-dialog-d1oHBURV.cjs} +1 -1
- package/dist/{page-creator-C5g7z8W6.js → page-creator-4ElxexYm.js} +51 -51
- package/dist/{page-creator-CMJ9ZDbx.cjs → page-creator-Il_h2vl4.cjs} +1 -1
- package/dist/{page-lock-C4R_Or95.js → page-lock-CT54xDQL.js} +2 -2
- package/dist/{page-lock-BWomVpCL.cjs → page-lock-s-pfopxQ.cjs} +1 -1
- package/dist/{page-locked-dialog-DMZLhad3.cjs → page-locked-dialog-BORNeoXe.cjs} +1 -1
- package/dist/{page-locked-dialog-urg4T_WZ.js → page-locked-dialog-CBL04Nga.js} +2 -2
- package/dist/{page-manager-new-myexG-Df.cjs → page-manager-new-Bp5QkZD4.cjs} +1 -1
- package/dist/{page-manager-new-D_Lwwz4w.js → page-manager-new-DqCkZnWY.js} +91 -91
- package/dist/{page-manager-search-and-filter-qv_E2tzW.cjs → page-manager-search-and-filter-BMPaoTAI.cjs} +1 -1
- package/dist/{page-manager-search-and-filter-D56yGDSe.js → page-manager-search-and-filter-CUEUB4bN.js} +1 -1
- package/dist/{page-revisions-content-BOaT_9og.cjs → page-revisions-content-1kklUJZV.cjs} +1 -1
- package/dist/{page-revisions-content-Dyi6EY_V.js → page-revisions-content-mU05KA_O.js} +7 -7
- package/dist/pages.cjs +1 -1
- package/dist/pages.d.ts +1 -0
- package/dist/pages.js +15 -15
- package/dist/{publish-pages-content-C0vWbTxI.js → publish-pages-content-CcV-xLsk.js} +80 -73
- package/dist/publish-pages-content-CpdTUAds.cjs +1 -0
- package/dist/{save-to-lib-BN2EgYkx.js → save-to-lib-CXhaKw5V.js} +57 -57
- package/dist/{save-to-lib-Bw6DefI8.cjs → save-to-lib-Uw9LqY5V.cjs} +1 -1
- package/dist/{selected-block-display-DQ_eRZxQ.cjs → selected-block-display-DZz78Kuo.cjs} +1 -1
- package/dist/{selected-block-display-BE83jvES.js → selected-block-display-_r5ZoSSD.js} +1 -1
- package/dist/{seo-panel-Bd5Yt35N.js → seo-panel-CMIMJh2W.js} +12 -12
- package/dist/{seo-panel-BZJ-bpPv.cjs → seo-panel-Cj8ky_W6.cjs} +1 -1
- package/dist/{shared-json-ld-_tOID7Vv.cjs → shared-json-ld-C28DLkns.cjs} +1 -1
- package/dist/{shared-json-ld-FApiYd-N.js → shared-json-ld-LWZfxt-V.js} +1 -1
- package/dist/supabase-actions.cjs +1 -1
- package/dist/supabase-actions.js +1 -1
- package/dist/{take-over-request-BfJbko6g.js → take-over-request-eNwLOB2Q.js} +9 -9
- package/dist/{take-over-request-CjcBgl4k.cjs → take-over-request-x9nLTelf.cjs} +1 -1
- package/dist/types.d.ts +1 -0
- package/dist/{unmark-as-template-DCoIaBeJ.cjs → unmark-as-template-GdqfA8lm.cjs} +1 -1
- package/dist/{unmark-as-template-vdqK9CiS.js → unmark-as-template-YGONVpmY.js} +1 -1
- package/dist/{unpublish-page-CKeoMtlZ.cjs → unpublish-page-CmwSkit5.cjs} +1 -1
- package/dist/{unpublish-page-5a9yi96y.js → unpublish-page-D-A9A9db.js} +1 -1
- package/dist/{web-preview-IfmBWYnZ.js → web-preview-CZVcFxwF.js} +1 -1
- package/dist/{web-preview-DbcvvsU-.cjs → web-preview-D4_3nlN-.cjs} +1 -1
- package/package.json +1 -1
- package/dist/index-D76nE1DU.cjs +0 -5
- package/dist/publish-pages-content-CqiZED9d.cjs +0 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),m=require("./index-W4Ur56bi.cjs"),L=require("./register-chai-top-bar-DyW9GPzV.cjs"),z=require("date-fns"),p=require("lodash-es"),N=require("lucide-react"),b=require("react"),M=require("react-diff-view"),O=require("./index-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),m=require("./index-W4Ur56bi.cjs"),L=require("./register-chai-top-bar-DyW9GPzV.cjs"),z=require("date-fns"),p=require("lodash-es"),N=require("lucide-react"),b=require("react"),M=require("react-diff-view"),O=require("./index-DvOWqGdC.cjs"),H=require("@tanstack/react-query");function K(t,r){const o=O.useApiUrl(),n=O.useFetch(),d=p.startsWith(t.uid,"draft:")||p.startsWith(r.uid,"live:");return H.useQuery({queryKey:["revision-comparison",t.uid,r.uid],queryFn:async()=>{if(!t.uid||!r.uid)throw new Error("Both revision IDs are required for comparison");const l=h=>h==="draft"||h==="live"?h:"revision",s=h=>p.replace(h.uid,`${h.label}:`,"");return await n(o,{action:O.ACTIONS.GET_COMPARE_DATA,data:{versions:{version1:{type:l(t.label),id:s(t)},version2:{type:l(r.label),id:s(r)}}}})},enabled:!!t.uid&&!!r.uid,staleTime:d?0:1/0,refetchOnMount:d?"always":!1,gcTime:d?0:void 0})}const V=({version:t})=>{const r=t==null?void 0:t.item,{data:o}=O.useChaiUserInfo(r==null?void 0:r.currentEditor),n=t.label==="live",d=t.label==="draft";return e.jsxs("span",{className:`flex min-h-8 items-center gap-x-2 rounded border bg-white px-2 text-xs shadow-lg ${n?"border-green-500/30":d?"border-amber-500/30":"border-purple-500/30"}`,children:[e.jsx("div",{className:"h-full items-center rounded px-1.5 py-0.5 font-medium capitalize"+(n?" bg-green-500 text-green-50":d?" bg-amber-500 text-amber-50":" bg-purple-500 text-purple-50"),children:t.label}),e.jsxs("div",{className:"py-1 text-xs font-light leading-none text-gray-800",children:[e.jsxs("div",{children:[e.jsx("span",{className:"font-light opacity-90",children:d?"Currently editing":"Published by"}),!d&&e.jsx("span",{className:"pl-1 font-medium",children:(o==null?void 0:o.name)||"Unknown"})]}),(r==null?void 0:r.createdAt)&&e.jsx("div",{className:"pt-0.5 text-[10px] leading-tight",children:z.formatDate(r.createdAt,"dd MMM yyyy, h:mm a")})]})]})},F=({version:t})=>e.jsx(V,{version:t});function U(t,r,o="data.json"){const n=JSON.stringify(t,null,2),d=JSON.stringify(r,null,2),l=n.split(`
|
|
2
2
|
`),s=d.split(`
|
|
3
3
|
`);let u=`--- a/${o}
|
|
4
4
|
`;u+=`+++ b/${o}
|
|
@@ -5,8 +5,8 @@ import { formatDate as Q } from "date-fns";
|
|
|
5
5
|
import { startsWith as T, replace as W, isString as X, trim as Y, isArray as Z, map as ee, isPlainObject as te, mapValues as re } from "lodash-es";
|
|
6
6
|
import { FileJson as B, Loader as ne, Check as F, Copy as H } from "lucide-react";
|
|
7
7
|
import { useState as D, useMemo as I } from "react";
|
|
8
|
-
import { parseDiff as se, Diff as
|
|
9
|
-
import {
|
|
8
|
+
import { parseDiff as se, Diff as ae, Hunk as le } from "react-diff-view";
|
|
9
|
+
import { ao as ie, ap as oe, A as ce, am as de } from "./index-K4yKMKbY.js";
|
|
10
10
|
import { useQuery as fe } from "@tanstack/react-query";
|
|
11
11
|
function me(t, n) {
|
|
12
12
|
const o = ie(), s = oe(), d = T(t.uid, "draft:") || T(n.uid, "live:");
|
|
@@ -15,13 +15,13 @@ function me(t, n) {
|
|
|
15
15
|
queryFn: async () => {
|
|
16
16
|
if (!t.uid || !n.uid)
|
|
17
17
|
throw new Error("Both revision IDs are required for comparison");
|
|
18
|
-
const
|
|
18
|
+
const a = (m) => m === "draft" || m === "live" ? m : "revision", r = (m) => W(m.uid, `${m.label}:`, "");
|
|
19
19
|
return await s(o, {
|
|
20
20
|
action: ce.GET_COMPARE_DATA,
|
|
21
21
|
data: {
|
|
22
22
|
versions: {
|
|
23
|
-
version1: { type:
|
|
24
|
-
version2: { type:
|
|
23
|
+
version1: { type: a(t.label), id: r(t) },
|
|
24
|
+
version2: { type: a(n.label), id: r(n) }
|
|
25
25
|
}
|
|
26
26
|
}
|
|
27
27
|
});
|
|
@@ -58,7 +58,7 @@ const he = ({ version: t }) => {
|
|
|
58
58
|
);
|
|
59
59
|
}, K = ({ version: t }) => /* @__PURE__ */ e(he, { version: t });
|
|
60
60
|
function ue(t, n, o = "data.json") {
|
|
61
|
-
const s = JSON.stringify(t, null, 2), d = JSON.stringify(n, null, 2),
|
|
61
|
+
const s = JSON.stringify(t, null, 2), d = JSON.stringify(n, null, 2), a = s.split(`
|
|
62
62
|
`), r = d.split(`
|
|
63
63
|
`);
|
|
64
64
|
let f = `--- a/${o}
|
|
@@ -67,35 +67,35 @@ function ue(t, n, o = "data.json") {
|
|
|
67
67
|
`;
|
|
68
68
|
const m = [];
|
|
69
69
|
let c = 0, p = 0;
|
|
70
|
-
for (; c <
|
|
71
|
-
const g =
|
|
70
|
+
for (; c < a.length || p < r.length; ) {
|
|
71
|
+
const g = a[c] || "", N = r[p] || "";
|
|
72
72
|
if (g === N)
|
|
73
73
|
m.push(` ${g}`), c++, p++;
|
|
74
74
|
else {
|
|
75
75
|
let h = -1, x = -1;
|
|
76
|
-
for (let
|
|
77
|
-
if (r[p] === l
|
|
78
|
-
h =
|
|
76
|
+
for (let l = c + 1; l < a.length; l++)
|
|
77
|
+
if (r[p] === a[l]) {
|
|
78
|
+
h = l;
|
|
79
79
|
break;
|
|
80
80
|
}
|
|
81
|
-
for (let
|
|
82
|
-
if (
|
|
83
|
-
x =
|
|
81
|
+
for (let l = p + 1; l < r.length; l++)
|
|
82
|
+
if (a[c] === r[l]) {
|
|
83
|
+
x = l;
|
|
84
84
|
break;
|
|
85
85
|
}
|
|
86
86
|
if (h !== -1 && (x === -1 || h - c <= x - p)) {
|
|
87
|
-
for (let
|
|
88
|
-
m.push(`-${l
|
|
87
|
+
for (let l = c; l < h; l++)
|
|
88
|
+
m.push(`-${a[l]}`);
|
|
89
89
|
c = h;
|
|
90
90
|
} else if (x !== -1) {
|
|
91
|
-
for (let
|
|
92
|
-
m.push(`+${r[
|
|
91
|
+
for (let l = p; l < x; l++)
|
|
92
|
+
m.push(`+${r[l]}`);
|
|
93
93
|
p = x;
|
|
94
94
|
} else
|
|
95
95
|
g && m.push(`-${g}`), N && m.push(`+${N}`), c++, p++;
|
|
96
96
|
}
|
|
97
97
|
}
|
|
98
|
-
const y =
|
|
98
|
+
const y = a.length, O = r.length;
|
|
99
99
|
return f += `@@ -1,${y} +1,${O} @@
|
|
100
100
|
`, f += m.join(`
|
|
101
101
|
`) + `
|
|
@@ -106,8 +106,8 @@ function S(t, n = !0, o = !1) {
|
|
|
106
106
|
const s = Y(t);
|
|
107
107
|
if (T(s, "{") || T(s, "[") || n && (s === "true" || s === "false" || s === "null" || /^-?\d+(\.\d+)?([eE][+-]?\d+)?$/.test(s)))
|
|
108
108
|
try {
|
|
109
|
-
const
|
|
110
|
-
return S(
|
|
109
|
+
const a = JSON.parse(s);
|
|
110
|
+
return S(a, n, o);
|
|
111
111
|
} catch {
|
|
112
112
|
if (o)
|
|
113
113
|
throw new Error(`Invalid JSON string: ${s}`);
|
|
@@ -140,11 +140,11 @@ const pe = (t) => {
|
|
|
140
140
|
o.add(c);
|
|
141
141
|
});
|
|
142
142
|
const d = [];
|
|
143
|
-
let
|
|
143
|
+
let a = -1;
|
|
144
144
|
return t.forEach((r, f) => {
|
|
145
145
|
if (o.has(f)) {
|
|
146
|
-
if (
|
|
147
|
-
const m = t[
|
|
146
|
+
if (a !== -1 && f - a > 1) {
|
|
147
|
+
const m = t[a].lineNumber != null ? t[a].lineNumber + 1 : a + 2, c = t[f].lineNumber != null ? t[f].lineNumber - 1 : f;
|
|
148
148
|
d.push({
|
|
149
149
|
content: /* @__PURE__ */ e(P, { className: "pointer-events-none w-60 -translate-x-1/2 cursor-default border-none bg-transparent py-1 shadow-none", children: /* @__PURE__ */ u("span", { className: "rounded border border-border bg-muted px-3 py-1 text-xs font-light leading-none text-muted-foreground", children: [
|
|
150
150
|
"No changes from ",
|
|
@@ -155,16 +155,16 @@ const pe = (t) => {
|
|
|
155
155
|
] }) })
|
|
156
156
|
});
|
|
157
157
|
}
|
|
158
|
-
d.push(r),
|
|
158
|
+
d.push(r), a = f;
|
|
159
159
|
}
|
|
160
160
|
}), d;
|
|
161
161
|
};
|
|
162
162
|
function Oe({ open: t, compare: n, onOpenChange: o }) {
|
|
163
|
-
const s = n[0], d = n[1], [
|
|
163
|
+
const s = n[0], d = n[1], [a, r] = D(null), [f, m] = D("split"), [c, p] = D(!1), [y, O] = D(!0), [g, N] = D("blocks"), { data: h, isLoading: x } = me(s, d), { leftData: l, rightData: w, options: U } = I(() => {
|
|
164
164
|
var b, R;
|
|
165
165
|
const i = (b = h == null ? void 0 : h.version1) == null ? void 0 : b[g], v = (R = h == null ? void 0 : h.version2) == null ? void 0 : R[g], k = S(i), C = S(v), J = ge(h == null ? void 0 : h.version1, h == null ? void 0 : h.version2);
|
|
166
166
|
return { leftData: k, rightData: C, options: J };
|
|
167
|
-
}, [h, g]), j = I(() => !
|
|
167
|
+
}, [h, g]), j = I(() => !l || !w ? "" : ue(l, w), [l, w]), M = I(() => {
|
|
168
168
|
if (!j) return [];
|
|
169
169
|
try {
|
|
170
170
|
return se(j);
|
|
@@ -223,15 +223,15 @@ function Oe({ open: t, compare: n, onOpenChange: o }) {
|
|
|
223
223
|
] }),
|
|
224
224
|
c ? /* @__PURE__ */ u("div", { className: "grid h-full grid-cols-2 gap-3 rounded-lg border", children: [
|
|
225
225
|
/* @__PURE__ */ u("div", { className: "relative flex min-h-0 flex-col border-r", children: [
|
|
226
|
-
/* @__PURE__ */ e("div", { className: "absolute -top-4 right-4 z-50", children: /* @__PURE__ */ u(z, { variant: "outline", size: "sm", onClick: () => E(
|
|
227
|
-
|
|
226
|
+
/* @__PURE__ */ e("div", { className: "absolute -top-4 right-4 z-50", children: /* @__PURE__ */ u(z, { variant: "outline", size: "sm", onClick: () => E(l, "left"), children: [
|
|
227
|
+
a === "left" ? /* @__PURE__ */ e(F, { className: "text-green-500" }) : /* @__PURE__ */ e(H, {}),
|
|
228
228
|
"Copy"
|
|
229
229
|
] }) }),
|
|
230
|
-
/* @__PURE__ */ e(A, { className: "flex-1 rounded-lg bg-slate-50 p-3 dark:bg-slate-900", children: /* @__PURE__ */ e("pre", { className: "whitespace-pre-wrap font-mono text-xs", children: L(
|
|
230
|
+
/* @__PURE__ */ e(A, { className: "flex-1 rounded-lg bg-slate-50 p-3 dark:bg-slate-900", children: /* @__PURE__ */ e("pre", { className: "whitespace-pre-wrap font-mono text-xs", children: L(l) }) })
|
|
231
231
|
] }),
|
|
232
232
|
/* @__PURE__ */ u("div", { className: "relative flex min-h-0 flex-col", children: [
|
|
233
233
|
/* @__PURE__ */ e("div", { className: "absolute -top-4 right-4 z-50", children: /* @__PURE__ */ u(z, { variant: "outline", size: "sm", onClick: () => E(w, "right"), children: [
|
|
234
|
-
|
|
234
|
+
a === "right" ? /* @__PURE__ */ e(F, { className: "text-green-500" }) : /* @__PURE__ */ e(H, {}),
|
|
235
235
|
"Copy"
|
|
236
236
|
] }) }),
|
|
237
237
|
/* @__PURE__ */ e(A, { className: "flex-1 rounded-lg bg-slate-50 p-3 dark:bg-slate-900", children: /* @__PURE__ */ e("pre", { className: "whitespace-pre-wrap font-mono text-xs", children: L(w) }) })
|
|
@@ -240,7 +240,7 @@ function Oe({ open: t, compare: n, onOpenChange: o }) {
|
|
|
240
240
|
/* @__PURE__ */ e(B, { className: "mx-auto mb-2 h-8 w-8 opacity-50" }),
|
|
241
241
|
/* @__PURE__ */ e("p", { children: "No differences found or unable to parse diff" })
|
|
242
242
|
] }) }) : /* @__PURE__ */ e("div", { children: M.map((i, v) => /* @__PURE__ */ e("div", { className: "relative mb-4", children: /* @__PURE__ */ e(
|
|
243
|
-
|
|
243
|
+
ae,
|
|
244
244
|
{
|
|
245
245
|
viewType: f,
|
|
246
246
|
diffType: i.type,
|
|
@@ -248,7 +248,7 @@ function Oe({ open: t, compare: n, onOpenChange: o }) {
|
|
|
248
248
|
className: "rounded-lg text-xs",
|
|
249
249
|
children: (k) => k.map((C, J) => {
|
|
250
250
|
const b = y ? xe(C.changes) : C.changes;
|
|
251
|
-
return (b == null ? void 0 : b.length) === 0 ? /* @__PURE__ */ e("div", { className: "absolute h-full w-full border-l pt-64 text-center font-sans text-sm", children: /* @__PURE__ */ e("span", { children: "No difference found" }) }) : /* @__PURE__ */ e(
|
|
251
|
+
return (b == null ? void 0 : b.length) === 0 ? /* @__PURE__ */ e("div", { className: "absolute h-full w-full border-l pt-64 text-center font-sans text-sm", children: /* @__PURE__ */ e("span", { children: "No difference found" }) }) : /* @__PURE__ */ e(le, { hunk: { ...C, changes: b } }, J);
|
|
252
252
|
})
|
|
253
253
|
},
|
|
254
254
|
y ? "hide-common-data" : "show-common-data"
|
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
import { jsx as e, jsxs as s, Fragment as M } from "react/jsx-runtime";
|
|
2
2
|
import { D as j, z as F, B as A } from "./register-chai-top-bar-D6GjnauV.js";
|
|
3
3
|
import { D as B, e as H, f as O, g as W, o as q, p as R, q as J, d as K, r as Q, s as V, t as X, v as w } from "./index-DZheQdw-.js";
|
|
4
|
-
import {
|
|
5
|
-
import { find as
|
|
4
|
+
import { ar as Y, k as T, L as I, as as Z, j as ee, at as se, h as ae, au as f, av as o } from "./index-K4yKMKbY.js";
|
|
5
|
+
import { find as G, startsWith as E, isEqual as te, filter as ne, get as D, map as le, isEmpty as ie } from "lodash-es";
|
|
6
6
|
import { AlertCircle as re, StarIcon as ce, MoreHorizontal as oe, PencilIcon as de, Power as me, TrashIcon as ue } from "lucide-react";
|
|
7
|
-
import { useState as S, useMemo as he, Suspense as L, lazy as
|
|
7
|
+
import { useState as S, useMemo as he, Suspense as L, lazy as z } from "react";
|
|
8
8
|
import { useTranslation as U } from "react-i18next";
|
|
9
9
|
import { toast as ge } from "sonner";
|
|
10
10
|
import { useSetAtom as pe } from "jotai";
|
|
11
11
|
const fe = ({ page: a, onClose: g }) => {
|
|
12
|
-
const { t: l } = U(), [i, v] = S(a.slug || ""), { mutate: N, isPending: y } = Y(), { data:
|
|
12
|
+
const { t: l } = U(), [i, v] = S(a.slug || ""), { mutate: N, isPending: y } = Y(), { data: n } = T(), r = G(n, { key: a == null ? void 0 : a.pageType }), x = (m) => {
|
|
13
13
|
if (m.preventDefault(), !(a != null && a.primaryPage) && Object.keys(I).some((p) => i === `/${p}` || E(i, `/${p}/`))) {
|
|
14
14
|
ge.error(l("Error"), {
|
|
15
15
|
description: l("Slugs cannot start with a language code for primary page")
|
|
@@ -78,24 +78,24 @@ const fe = ({ page: a, onClose: g }) => {
|
|
|
78
78
|
)
|
|
79
79
|
] })
|
|
80
80
|
] }),
|
|
81
|
-
/* @__PURE__ */ e(J, { children: /* @__PURE__ */ e(A, { type: "submit", disabled: y || !E(i, `/${d}`) ||
|
|
81
|
+
/* @__PURE__ */ e(J, { children: /* @__PURE__ */ e(A, { type: "submit", disabled: y || !E(i, `/${d}`) || te(a == null ? void 0 : a.slug, i), children: l(y ? "Changing..." : "Change Slug") }) })
|
|
82
82
|
] })
|
|
83
83
|
] }) });
|
|
84
|
-
}, Ne =
|
|
85
|
-
const { t: a } = U(), g = pe(Z), { selectedLang: l, fallbackLang: i, setSelectedLang: v } = K(), { data: N, isFetching: y } = ee(), { data:
|
|
86
|
-
const
|
|
87
|
-
return
|
|
88
|
-
}, [r,
|
|
84
|
+
}, Ne = z(() => import("./delete-page-T2VWcbyP.js")), ye = z(() => import("./unpublish-page-D-A9A9db.js")), ke = () => {
|
|
85
|
+
const { t: a } = U(), g = pe(Z), { selectedLang: l, fallbackLang: i, setSelectedLang: v } = K(), { data: N, isFetching: y } = ee(), { data: n } = se(), { data: r } = T(), x = he(() => {
|
|
86
|
+
const t = r == null ? void 0 : r.find((h) => h.key === (n == null ? void 0 : n.pageType));
|
|
87
|
+
return n != null && n.dynamic ? t == null ? void 0 : t.dynamicSlug : "";
|
|
88
|
+
}, [r, n == null ? void 0 : n.pageType, n == null ? void 0 : n.dynamic]), [d, m] = S(null), [u, b] = S(null), [p, _] = S(null), { data: P } = ae(), $ = ne(
|
|
89
89
|
D(P, "languages") || ["en"],
|
|
90
|
-
(
|
|
90
|
+
(t) => !G(N, { lang: t }) && t !== D(P, "fallbackLang")
|
|
91
91
|
);
|
|
92
92
|
return /* @__PURE__ */ s("div", { className: "space-y-4", children: [
|
|
93
93
|
/* @__PURE__ */ e("ul", { className: "space-y-2", children: y ? /* @__PURE__ */ s("div", { className: "w-full space-y-3 py-4", children: [
|
|
94
94
|
/* @__PURE__ */ e("div", { className: "h-8 w-full animate-pulse rounded bg-gray-300" }),
|
|
95
95
|
/* @__PURE__ */ e("div", { className: "h-8 w-full animate-pulse rounded bg-gray-300" }),
|
|
96
96
|
/* @__PURE__ */ e("div", { className: "h-8 w-full animate-pulse rounded bg-gray-300" })
|
|
97
|
-
] }) : le(N, (
|
|
98
|
-
const h =
|
|
97
|
+
] }) : le(N, (t) => {
|
|
98
|
+
const h = t.lang, C = t.slug, k = !t.primaryPage;
|
|
99
99
|
return /* @__PURE__ */ s(M, { children: [
|
|
100
100
|
/* @__PURE__ */ s(
|
|
101
101
|
"li",
|
|
@@ -105,7 +105,7 @@ const fe = ({ page: a, onClose: g }) => {
|
|
|
105
105
|
children: [
|
|
106
106
|
/* @__PURE__ */ s("div", { className: "flex-1 gap-x-3", children: [
|
|
107
107
|
/* @__PURE__ */ s("div", { className: "flex items-center gap-x-2 text-[13px] text-slate-800", children: [
|
|
108
|
-
/* @__PURE__ */ e("div", { className: `h-2.5 w-2.5 rounded-full ${
|
|
108
|
+
/* @__PURE__ */ e("div", { className: `h-2.5 w-2.5 rounded-full ${t.online ? "bg-green-300" : "bg-gray-300"}` }),
|
|
109
109
|
D(I, k ? i : h, h)
|
|
110
110
|
] }),
|
|
111
111
|
/* @__PURE__ */ s("div", { children: [
|
|
@@ -117,7 +117,7 @@ const fe = ({ page: a, onClose: g }) => {
|
|
|
117
117
|
"Name:",
|
|
118
118
|
/* @__PURE__ */ s("b", { className: "font-medium", children: [
|
|
119
119
|
" ",
|
|
120
|
-
|
|
120
|
+
t.name,
|
|
121
121
|
" "
|
|
122
122
|
] })
|
|
123
123
|
] })
|
|
@@ -144,8 +144,8 @@ const fe = ({ page: a, onClose: g }) => {
|
|
|
144
144
|
onClick: (c) => {
|
|
145
145
|
c.stopPropagation(), g({
|
|
146
146
|
edit: !0,
|
|
147
|
-
id:
|
|
148
|
-
primaryPage:
|
|
147
|
+
id: t.id,
|
|
148
|
+
primaryPage: t.primaryPage
|
|
149
149
|
});
|
|
150
150
|
},
|
|
151
151
|
children: [
|
|
@@ -154,12 +154,12 @@ const fe = ({ page: a, onClose: g }) => {
|
|
|
154
154
|
]
|
|
155
155
|
}
|
|
156
156
|
) }),
|
|
157
|
-
/* @__PURE__ */ e(f, { permissions: [o.UNPUBLISH_PAGE], children: (
|
|
157
|
+
/* @__PURE__ */ e(f, { permissions: [o.UNPUBLISH_PAGE], children: (t == null ? void 0 : t.online) && /* @__PURE__ */ s(
|
|
158
158
|
w,
|
|
159
159
|
{
|
|
160
160
|
className: "flex cursor-pointer items-center gap-2",
|
|
161
161
|
onClick: (c) => {
|
|
162
|
-
c.stopPropagation(), b(
|
|
162
|
+
c.stopPropagation(), b(t);
|
|
163
163
|
},
|
|
164
164
|
children: [
|
|
165
165
|
/* @__PURE__ */ e(me, { className: "size-3" }),
|
|
@@ -172,7 +172,7 @@ const fe = ({ page: a, onClose: g }) => {
|
|
|
172
172
|
{
|
|
173
173
|
className: "flex cursor-pointer items-center gap-2",
|
|
174
174
|
onClick: (c) => {
|
|
175
|
-
c.stopPropagation(), m(
|
|
175
|
+
c.stopPropagation(), m(t);
|
|
176
176
|
},
|
|
177
177
|
children: [
|
|
178
178
|
/* @__PURE__ */ e(ue, { className: "size-3" }),
|
|
@@ -186,7 +186,7 @@ const fe = ({ page: a, onClose: g }) => {
|
|
|
186
186
|
) })
|
|
187
187
|
]
|
|
188
188
|
},
|
|
189
|
-
|
|
189
|
+
t.id
|
|
190
190
|
),
|
|
191
191
|
/* @__PURE__ */ e("div", { className: "h-1 w-full border-b" })
|
|
192
192
|
] });
|
|
@@ -199,7 +199,7 @@ const fe = ({ page: a, onClose: g }) => {
|
|
|
199
199
|
disabled: ie($),
|
|
200
200
|
onClick: () => {
|
|
201
201
|
g({
|
|
202
|
-
primaryPage:
|
|
202
|
+
primaryPage: n == null ? void 0 : n.id,
|
|
203
203
|
edit: !1
|
|
204
204
|
});
|
|
205
205
|
},
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),N=require("./register-chai-top-bar-DyW9GPzV.cjs"),a=require("./index-W4Ur56bi.cjs"),n=require("./index-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),N=require("./register-chai-top-bar-DyW9GPzV.cjs"),a=require("./index-W4Ur56bi.cjs"),n=require("./index-DvOWqGdC.cjs"),r=require("lodash-es"),j=require("lucide-react"),c=require("react"),I=require("react-i18next"),L=require("sonner"),k=require("jotai"),M=({page:s,onClose:p})=>{const{t:l}=I.useTranslation(),[o,P]=c.useState(s.slug||""),{mutate:y,isPending:f}=n.useChangeSlug(),{data:i}=n.usePageTypes(),d=r.find(i,{key:s==null?void 0:s.pageType}),E=h=>{if(h.preventDefault(),!(s!=null&&s.primaryPage)&&Object.keys(n.LANGUAGES).some(S=>o===`/${S}`||r.startsWith(o,`/${S}/`))){L.toast.error(l("Error"),{description:l("Slugs cannot start with a language code for primary page")});return}y({...s,slug:o},{onSuccess:p})},m=(s==null?void 0:s.lang)||"";return e.jsx(a.Dialog,{open:!!s,onOpenChange:p,children:e.jsxs(a.DialogContent,{children:[e.jsxs(a.DialogHeader,{children:[e.jsx(a.DialogTitle,{children:l("Change Slug")}),e.jsx(a.DialogDescription,{className:"text-xs",children:e.jsxs(N.Alert,{variant:"destructive",className:"mt-2",children:[e.jsx(j.AlertCircle,{className:"h-4 w-4"}),l("Changing the slug may have impact on your SEO. Please proceed with caution.")]})})]}),e.jsxs("form",{onSubmit:E,children:[e.jsxs("div",{className:"space-y-4 py-4 text-sm",children:[e.jsxs("div",{className:"space-y-1",children:[e.jsxs("div",{children:[e.jsxs("span",{children:[l("Type"),":"]}),e.jsxs("span",{className:"font-medium text-gray-600",children:[" ",(d==null?void 0:d.name)||(s==null?void 0:s.pageType)]})]}),e.jsxs("div",{children:[e.jsxs("span",{children:[l("Name"),":"]}),e.jsxs("span",{className:"font-medium text-gray-600",children:[" ",s.name]})]})]}),e.jsxs("div",{className:"space-y-1",children:[e.jsxs(a.Label,{htmlFor:"slug",className:"text-right",children:[l("Slug")," ",e.jsxs("small",{className:"font-light text-gray-500",children:[l("Slug should start with")," /",m]})]}),e.jsx(N.Input,{id:"slug",value:o,onChange:h=>{const x=h.target.value;r.startsWith(x,`/${m}`)&&P(x)},className:"col-span-3",required:!0,pattern:"^/.*",title:l("Slug must start with /"),placeholder:l("Enter page slug")})]})]}),e.jsx(a.DialogFooter,{children:e.jsx(N.Button,{type:"submit",disabled:f||!r.startsWith(o,`/${m}`)||r.isEqual(s==null?void 0:s.slug,o),children:l(f?"Changing...":"Change Slug")})})]})]})})},T=c.lazy(()=>Promise.resolve().then(()=>require("./delete-page-DKBN4nL1.cjs"))),q=c.lazy(()=>Promise.resolve().then(()=>require("./unpublish-page-CmwSkit5.cjs"))),_=()=>{const{t:s}=I.useTranslation(),p=k.useSetAtom(n.addNewLangAtom),{selectedLang:l,fallbackLang:o,setSelectedLang:P}=a.useLanguages(),{data:y,isFetching:f}=n.useLanguagePages(),{data:i}=n.usePrimaryPage(),{data:d}=n.usePageTypes(),E=c.useMemo(()=>{const t=d==null?void 0:d.find(g=>g.key===(i==null?void 0:i.pageType));return i!=null&&i.dynamic?t==null?void 0:t.dynamicSlug:""},[d,i==null?void 0:i.pageType,i==null?void 0:i.dynamic]),[m,h]=c.useState(null),[x,v]=c.useState(null),[S,A]=c.useState(null),{data:b}=n.useWebsiteSetting(),D=r.filter(r.get(b,"languages")||["en"],t=>!r.find(y,{lang:t})&&t!==r.get(b,"fallbackLang"));return e.jsxs("div",{className:"space-y-4",children:[e.jsx("ul",{className:"space-y-2",children:f?e.jsxs("div",{className:"w-full space-y-3 py-4",children:[e.jsx("div",{className:"h-8 w-full animate-pulse rounded bg-gray-300"}),e.jsx("div",{className:"h-8 w-full animate-pulse rounded bg-gray-300"}),e.jsx("div",{className:"h-8 w-full animate-pulse rounded bg-gray-300"})]}):r.map(y,t=>{const g=t.lang,C=t.slug,w=!t.primaryPage,G=g===l;return e.jsxs(e.Fragment,{children:[e.jsxs("li",{className:`flex w-full cursor-pointer items-center justify-between rounded p-2 text-slate-500 ${G?"bg-gray-200":"hover:bg-gray-100"}`,onClick:()=>P(g),children:[e.jsxs("div",{className:"flex-1 gap-x-3",children:[e.jsxs("div",{className:"flex items-center gap-x-2 text-[13px] text-slate-800",children:[e.jsx("div",{className:`h-2.5 w-2.5 rounded-full ${t.online?"bg-green-300":"bg-gray-300"}`}),r.get(n.LANGUAGES,w?o:g,g)]}),e.jsxs("div",{children:[C&&e.jsxs("div",{className:"text-[11px] font-light text-slate-600",children:["Slug: ",e.jsx("b",{className:"font-mono font-medium",children:E?`${C}/${E}`:C})]}),e.jsxs("div",{className:"text-[11px] font-light text-slate-600",children:["Name:",e.jsxs("b",{className:"font-medium",children:[" ",t.name," "]})]})]})]}),w?e.jsxs("div",{className:"flex items-center gap-x-1 text-[11px] text-orange-500",children:[e.jsx(j.StarIcon,{fill:"orange",className:"h-3 w-3"}),e.jsx("b",{children:" Primary"})]}):e.jsx("div",{className:"flex items-center gap-x-3",children:e.jsx(n.PermissionChecker,{permissions:[n.PAGES_PERMISSIONS.EDIT_PAGE,n.PAGES_PERMISSIONS.DELETE_PAGE,n.PAGES_PERMISSIONS.UNPUBLISH_PAGE],children:e.jsxs(a.DropdownMenu,{children:[e.jsx(a.DropdownMenuTrigger,{asChild:!0,onClick:u=>u.stopPropagation(),children:e.jsx(N.Button,{variant:"ghost",size:"sm",className:"h-8 w-8 p-0",children:e.jsx(j.MoreHorizontal,{className:"h-4 w-4"})})}),e.jsxs(a.DropdownMenuContent,{align:"end",className:"z-[9999] text-sm",children:[e.jsx(n.PermissionChecker,{permissions:[n.PAGES_PERMISSIONS.EDIT_PAGE],children:e.jsxs(a.DropdownMenuItem,{className:"flex cursor-pointer items-center gap-2",onClick:u=>{u.stopPropagation(),p({edit:!0,id:t.id,primaryPage:t.primaryPage})},children:[e.jsx(j.PencilIcon,{className:"size-3"}),s("Edit")]})}),e.jsx(n.PermissionChecker,{permissions:[n.PAGES_PERMISSIONS.UNPUBLISH_PAGE],children:(t==null?void 0:t.online)&&e.jsxs(a.DropdownMenuItem,{className:"flex cursor-pointer items-center gap-2",onClick:u=>{u.stopPropagation(),v(t)},children:[e.jsx(j.Power,{className:"size-3"}),s("Unpublish")]})}),e.jsx(n.PermissionChecker,{permissions:[n.PAGES_PERMISSIONS.DELETE_PAGE],children:e.jsxs(a.DropdownMenuItem,{className:"flex cursor-pointer items-center gap-2",onClick:u=>{u.stopPropagation(),h(t)},children:[e.jsx(j.TrashIcon,{className:"size-3"}),s("Delete")]})})]})]})})})]},t.id),e.jsx("div",{className:"h-1 w-full border-b"})]})})}),e.jsx(n.PermissionChecker,{permissions:[n.PAGES_PERMISSIONS.ADD_PAGE],children:e.jsx("div",{className:"flex w-full justify-center",children:e.jsx(N.Button,{variant:"default",size:"sm",disabled:r.isEmpty(D),onClick:()=>{p({primaryPage:i==null?void 0:i.id,edit:!1})},children:s("Add new language page")})})}),m&&e.jsx(c.Suspense,{children:e.jsx(T,{page:m,onClose:()=>h(null)})}),x&&e.jsx(c.Suspense,{children:e.jsx(q,{page:x,onClose:()=>v(null)})}),S&&e.jsx(c.Suspense,{children:e.jsx(M,{page:S,onClose:()=>A(null)})})]})};exports.default=_;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { jsx as e, jsxs as t } from "react/jsx-runtime";
|
|
2
2
|
import { z, B as c } from "./register-chai-top-bar-D6GjnauV.js";
|
|
3
3
|
import { D as P, e as B, f as E, g as L, o as S, p as w, T as U, q as R } from "./index-DZheQdw-.js";
|
|
4
|
-
import { n as j, k as O } from "./index-
|
|
4
|
+
import { n as j, k as O } from "./index-K4yKMKbY.js";
|
|
5
5
|
import { startCase as y } from "lodash-es";
|
|
6
6
|
import { Tag as X, File as _, ImageIcon as $, X as q } from "lucide-react";
|
|
7
7
|
import { useState as m, useRef as H, useCallback as K } from "react";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),o=require("./register-chai-top-bar-DyW9GPzV.cjs"),t=require("./index-W4Ur56bi.cjs"),y=require("./index-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),o=require("./register-chai-top-bar-DyW9GPzV.cjs"),t=require("./index-W4Ur56bi.cjs"),y=require("./index-DvOWqGdC.cjs"),w=require("lodash-es"),m=require("lucide-react"),l=require("react"),M=require("react-i18next"),k=require("sonner"),B=1*1024*1024,A=({page:r,onClose:u})=>{const{t:s}=M.useTranslation(),[f,p]=l.useState(!1),[j,T]=l.useState(""),[c,N]=l.useState(""),[v,x]=l.useState(!1),i=l.useRef(null),C=y.useMarkAsTemplate(),{data:h}=y.usePageTypes(),g=h==null?void 0:h.find(a=>a.key===r.pageType),I=(g==null?void 0:g.name)||w.startCase(r.pageType),D=l.useCallback(a=>{var b;const d=(b=a.target.files)==null?void 0:b[0];if(d){if(d.size>B){k.toast.error(s("File too large"),{description:`${s("Maximum file size is 1MB. Selected file is")} ${(d.size/1024).toFixed(2)}KB.`}),i.current&&(i.current.value="");return}try{x(!0);const n=new FileReader;n.onloadend=()=>{N(n.result),x(!1)},n.readAsDataURL(d)}catch(n){console.error("Error reading file:",n),x(!1),k.toast.error(s("Failed to process image"),{description:n instanceof Error?n.message:s("Unknown error")})}}},[s]),F=()=>{N(""),i.current&&(i.current.value="")},S=()=>{var a;(a=i.current)==null||a.click()},q=()=>{p(!0),C.mutate({page:r,name:r.name,description:j.trim()||void 0,pageType:r.pageType,...c?{previewImage:c}:{}},{onSuccess:()=>{p(!1),u()},onError:()=>{p(!1)}})};return e.jsx(t.Dialog,{open:!0,onOpenChange:u,children:e.jsxs(t.DialogContent,{children:[e.jsxs(t.DialogHeader,{children:[e.jsx(t.DialogTitle,{children:s("Mark as template")}),e.jsxs(t.DialogDescription,{className:"space-y-1 py-4 text-xs text-slate-500",children:[s("Are you sure you want to mark this page as a template?"),e.jsx("br",{}),s("Templates can be used to create new pages with the same content.")]})]}),e.jsxs("div",{className:"mb-4 space-y-4 text-xs",children:[e.jsxs("div",{className:"space-y-3 rounded border bg-slate-50 p-4",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(m.Tag,{className:"h-4 w-4 text-slate-500"}),e.jsxs("span",{className:"font-medium text-slate-500",children:[s("Page Name"),":"]}),e.jsx("span",{className:"font-semibold",children:w.startCase(r.name)})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(m.File,{className:"h-4 w-4 text-slate-500"}),e.jsxs("span",{className:"font-medium text-slate-500",children:[s("Type"),":"]}),e.jsx("span",{className:"font-semibold",children:I})]})]}),e.jsxs("div",{children:[e.jsx(t.Label,{htmlFor:"description",className:"text-xs font-medium",children:s("Description (Optional)")}),e.jsx(t.Textarea,{id:"description",placeholder:s("Describe this template's purpose"),className:"mt-1 h-24 resize-none text-xs",value:j,onChange:a=>T(a.target.value)})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(t.Label,{htmlFor:"previewImage",className:"text-xs font-medium",children:s("Preview Image (Optional)")}),e.jsxs("div",{className:"space-y-2",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(o.Input,{type:"file",id:"previewImage",ref:i,onChange:D,accept:"image/*",className:"hidden"}),e.jsx(o.Button,{type:"button",variant:"outline",onClick:S,disabled:v,className:"w-full",children:v?e.jsxs("span",{className:"flex items-center gap-2",children:[e.jsx("div",{className:"h-4 w-4 animate-spin rounded-full border-2 border-current border-t-transparent"}),s("Uploading...")]}):e.jsxs("span",{className:"flex items-center gap-2",children:[e.jsx(m.ImageIcon,{className:"h-4 w-4"}),s("Select image")]})}),c&&e.jsx(o.Button,{type:"button",variant:"outline",size:"icon",onClick:F,children:e.jsx(m.X,{className:"h-4 w-4"})})]}),c&&e.jsx("div",{className:"aspect-video overflow-hidden rounded-md border",children:e.jsx("img",{src:c,alt:s("Preview"),className:"h-full max-h-[200px] w-full object-contain"})}),e.jsx("p",{className:"text-xs text-muted-foreground",children:s("max 1mb")})]})]})]}),e.jsxs(t.DialogFooter,{className:f?"pointer-events-none opacity-75":"",children:[e.jsx(o.Button,{variant:"outline",onClick:a=>{a.stopPropagation(),u()},children:s("Cancel")}),e.jsx(o.Button,{variant:"default",disabled:f,onClick:q,children:s("Mark as template")})]})]})})};exports.default=A;
|
package/dist/{no-language-page-content-Cb8CviKU.cjs → no-language-page-content-BGlAr__k.cjs}
RENAMED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),m=require("./register-chai-top-bar-DyW9GPzV.cjs"),t=require("./index-W4Ur56bi.cjs"),n=require("./index-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),m=require("./register-chai-top-bar-DyW9GPzV.cjs"),t=require("./index-W4Ur56bi.cjs"),n=require("./index-DvOWqGdC.cjs"),w=require("lodash-es"),x=require("lucide-react"),p=require("react-i18next"),P=()=>{const{t:a}=p.useTranslation(),[i,l]=n.useSearchParams(),c=i.get("lang"),g=n.useIsLanguagePageCreated(c),{setSelectedLang:u}=t.useLanguages(),d=()=>{const r=new URLSearchParams(window.location.search);r.delete("lang");const o=r.toString(),h=`${window.location.pathname}${o?`?${o}`:""}`;window.history.pushState({},"",h),l(r),u(""),window.dispatchEvent(new PopStateEvent("popstate"))};if(g)return null;const s=w.get(n.LANGUAGES,c);return e.jsx(n.BlurContainer,{children:e.jsxs(t.Card,{className:"mx-auto w-full max-w-md",children:[e.jsx(t.CardHeader,{className:"space-y-1",children:e.jsxs(t.CardTitle,{className:"flex items-center gap-2 text-2xl",children:[e.jsx(x.LockIcon,{className:"h-6 w-6 text-yellow-500"}),a("Page missing for"),' "',s,'" ',a("language"),"."]})}),e.jsx(t.CardContent,{className:"grid gap-4",children:e.jsxs("div",{children:[a("Page is not available in the"),' "',s,'" ',a("language. Either create the page in the"),' "',s,'"',a("language or switch to the base language.")]})}),e.jsx(t.CardFooter,{children:e.jsx(m.Button,{onClick:d,className:"w-full",variant:"destructive",children:a("Switch to default language")})})]})})};exports.default=P;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { jsx as e, jsxs as s } from "react/jsx-runtime";
|
|
2
2
|
import { B as h } from "./register-chai-top-bar-D6GjnauV.js";
|
|
3
3
|
import { d as u, F as w, G as p, H as f, I as P, J as C } from "./index-DZheQdw-.js";
|
|
4
|
-
import { c as S, d as L, L as x, B as N } from "./index-
|
|
4
|
+
import { c as S, d as L, L as x, B as N } from "./index-K4yKMKbY.js";
|
|
5
5
|
import { get as v } from "lodash-es";
|
|
6
6
|
import { LockIcon as B } from "lucide-react";
|
|
7
7
|
import { useTranslation as E } from "react-i18next";
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { jsx as a } from "react/jsx-runtime";
|
|
2
|
-
import { c as g, d as n } from "./index-
|
|
2
|
+
import { c as g, d as n } from "./index-K4yKMKbY.js";
|
|
3
3
|
import { Suspense as s, lazy as t } from "react";
|
|
4
|
-
const o = t(() => import("./no-language-page-content-
|
|
4
|
+
const o = t(() => import("./no-language-page-content-DfdMEUqE.js")), l = () => {
|
|
5
5
|
const [e] = g(), r = e.get("lang");
|
|
6
6
|
return n(r) ? null : /* @__PURE__ */ a(s, { children: /* @__PURE__ */ a(o, {}) });
|
|
7
7
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),a=require("./index-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),a=require("./index-DvOWqGdC.cjs"),n=require("react"),t=n.lazy(()=>Promise.resolve().then(()=>require("./no-language-page-content-BGlAr__k.cjs"))),g=()=>{const[r]=a.useSearchParams(),s=r.get("lang");return a.useIsLanguagePageCreated(s)?null:e.jsx(n.Suspense,{children:e.jsx(t,{})})};exports.default=g;
|