@chaibuilder/pages 0.1.0-beta.1
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 +8 -0
- package/dist/builder.cjs +1 -0
- package/dist/builder.d.ts +4 -0
- package/dist/builder.js +1 -0
- package/dist/index.cjs +30 -0
- package/dist/index.d.ts +11 -0
- package/dist/index.js +2045 -0
- package/dist/render.cjs +1 -0
- package/dist/render.d.ts +4 -0
- package/dist/render.js +1 -0
- package/dist/runtime.cjs +1 -0
- package/dist/runtime.d.ts +5 -0
- package/dist/runtime.js +2 -0
- package/dist/server.cjs +1 -0
- package/dist/server.d.ts +9 -0
- package/dist/server.js +45 -0
- package/dist/style.css +6 -0
- package/dist/tailwind.cjs +1 -0
- package/dist/tailwind.d.ts +4 -0
- package/dist/tailwind.js +1 -0
- package/dist/vite.svg +1 -0
- package/dist/web-blocks.cjs +1 -0
- package/dist/web-blocks.d.ts +4 -0
- package/dist/web-blocks.js +1 -0
- package/package.json +115 -0
package/dist/index.js
ADDED
|
@@ -0,0 +1,2045 @@
|
|
|
1
|
+
import pt, { useState as I, useEffect as Ie, useCallback as la, useMemo as je, useRef as ca } from "react";
|
|
2
|
+
import { loadWebBlocks as ua } from "@chaibuilder/sdk/web-blocks";
|
|
3
|
+
import { getBlocksFromHTML as da, useLanguages as Be, ChaiBuilderEditor as ha } from "@chaibuilder/sdk";
|
|
4
|
+
import { useQueryClient as J, useQuery as ne, useMutation as re, QueryClient as fa, QueryClientProvider as pa } from "@tanstack/react-query";
|
|
5
|
+
import { useToast as Y, Accordion as ga, AccordionItem as ge, AccordionTrigger as me, AccordionContent as ve, Label as _, Input as U, Textarea as xe, Button as B, Popover as gt, PopoverTrigger as mt, PopoverContent as vt, Dialog as xt, DialogContent as bt, DialogHeader as yt, DialogTitle as jt, DialogDescription as wt, DialogFooter as St, Tabs as ma, TabsList as va, TabsTrigger as ut, SheetHeader as xa, SheetDescription as ba, Sheet as ya, SheetContent as ja } from "@chaibuilder/sdk/ui";
|
|
6
|
+
import { StarIcon as wa, PencilIcon as Et, TrashIcon as Ct, Plus as Sa, GlobeIcon as Nt, File as kt, ArrowLeftRightIcon as Ea, RocketIcon as Ca } from "lucide-react";
|
|
7
|
+
import { get as q, find as se, isString as Ae, filter as ae, isEmpty as z, includes as be, startCase as Na, reverse as ka, sortBy as Ta, isEqual as Fe, map as Ue, toLower as Pa, trim as _a, orderBy as Oa } from "lodash-es";
|
|
8
|
+
var Le = { exports: {} }, ee = {};
|
|
9
|
+
/**
|
|
10
|
+
* @license React
|
|
11
|
+
* react-jsx-runtime.production.min.js
|
|
12
|
+
*
|
|
13
|
+
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
14
|
+
*
|
|
15
|
+
* This source code is licensed under the MIT license found in the
|
|
16
|
+
* LICENSE file in the root directory of this source tree.
|
|
17
|
+
*/
|
|
18
|
+
var dt;
|
|
19
|
+
function Ra() {
|
|
20
|
+
if (dt) return ee;
|
|
21
|
+
dt = 1;
|
|
22
|
+
var r = pt, i = Symbol.for("react.element"), o = Symbol.for("react.fragment"), a = Object.prototype.hasOwnProperty, s = r.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner, w = { key: !0, ref: !0, __self: !0, __source: !0 };
|
|
23
|
+
function c(f, u, p) {
|
|
24
|
+
var g, m = {}, h = null, S = null;
|
|
25
|
+
p !== void 0 && (h = "" + p), u.key !== void 0 && (h = "" + u.key), u.ref !== void 0 && (S = u.ref);
|
|
26
|
+
for (g in u) a.call(u, g) && !w.hasOwnProperty(g) && (m[g] = u[g]);
|
|
27
|
+
if (f && f.defaultProps) for (g in u = f.defaultProps, u) m[g] === void 0 && (m[g] = u[g]);
|
|
28
|
+
return { $$typeof: i, type: f, key: h, ref: S, props: m, _owner: s.current };
|
|
29
|
+
}
|
|
30
|
+
return ee.Fragment = o, ee.jsx = c, ee.jsxs = c, ee;
|
|
31
|
+
}
|
|
32
|
+
var te = {};
|
|
33
|
+
/**
|
|
34
|
+
* @license React
|
|
35
|
+
* react-jsx-runtime.development.js
|
|
36
|
+
*
|
|
37
|
+
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
38
|
+
*
|
|
39
|
+
* This source code is licensed under the MIT license found in the
|
|
40
|
+
* LICENSE file in the root directory of this source tree.
|
|
41
|
+
*/
|
|
42
|
+
var ht;
|
|
43
|
+
function Da() {
|
|
44
|
+
return ht || (ht = 1, process.env.NODE_ENV !== "production" && function() {
|
|
45
|
+
var r = pt, i = Symbol.for("react.element"), o = Symbol.for("react.portal"), a = Symbol.for("react.fragment"), s = Symbol.for("react.strict_mode"), w = Symbol.for("react.profiler"), c = Symbol.for("react.provider"), f = Symbol.for("react.context"), u = Symbol.for("react.forward_ref"), p = Symbol.for("react.suspense"), g = Symbol.for("react.suspense_list"), m = Symbol.for("react.memo"), h = Symbol.for("react.lazy"), S = Symbol.for("react.offscreen"), k = Symbol.iterator, E = "@@iterator";
|
|
46
|
+
function F(e) {
|
|
47
|
+
if (e === null || typeof e != "object")
|
|
48
|
+
return null;
|
|
49
|
+
var n = k && e[k] || e[E];
|
|
50
|
+
return typeof n == "function" ? n : null;
|
|
51
|
+
}
|
|
52
|
+
var D = r.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;
|
|
53
|
+
function b(e) {
|
|
54
|
+
{
|
|
55
|
+
for (var n = arguments.length, l = new Array(n > 1 ? n - 1 : 0), d = 1; d < n; d++)
|
|
56
|
+
l[d - 1] = arguments[d];
|
|
57
|
+
ie("error", e, l);
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
function ie(e, n, l) {
|
|
61
|
+
{
|
|
62
|
+
var d = D.ReactDebugCurrentFrame, y = d.getStackAddendum();
|
|
63
|
+
y !== "" && (n += "%s", l = l.concat([y]));
|
|
64
|
+
var j = l.map(function(x) {
|
|
65
|
+
return String(x);
|
|
66
|
+
});
|
|
67
|
+
j.unshift("Warning: " + n), Function.prototype.apply.call(console[e], console, j);
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
var Q = !1, we = !1, Se = !1, oe = !1, K = !1, le;
|
|
71
|
+
le = Symbol.for("react.module.reference");
|
|
72
|
+
function Ee(e) {
|
|
73
|
+
return !!(typeof e == "string" || typeof e == "function" || e === a || e === w || K || e === s || e === p || e === g || oe || e === S || Q || we || Se || typeof e == "object" && e !== null && (e.$$typeof === h || e.$$typeof === m || e.$$typeof === c || e.$$typeof === f || e.$$typeof === u || // This needs to include all possible module reference object
|
|
74
|
+
// types supported by any Flight configuration anywhere since
|
|
75
|
+
// we don't know which Flight build this will end up being used
|
|
76
|
+
// with.
|
|
77
|
+
e.$$typeof === le || e.getModuleId !== void 0));
|
|
78
|
+
}
|
|
79
|
+
function ce(e, n, l) {
|
|
80
|
+
var d = e.displayName;
|
|
81
|
+
if (d)
|
|
82
|
+
return d;
|
|
83
|
+
var y = n.displayName || n.name || "";
|
|
84
|
+
return y !== "" ? l + "(" + y + ")" : l;
|
|
85
|
+
}
|
|
86
|
+
function O(e) {
|
|
87
|
+
return e.displayName || "Context";
|
|
88
|
+
}
|
|
89
|
+
function T(e) {
|
|
90
|
+
if (e == null)
|
|
91
|
+
return null;
|
|
92
|
+
if (typeof e.tag == "number" && b("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."), typeof e == "function")
|
|
93
|
+
return e.displayName || e.name || null;
|
|
94
|
+
if (typeof e == "string")
|
|
95
|
+
return e;
|
|
96
|
+
switch (e) {
|
|
97
|
+
case a:
|
|
98
|
+
return "Fragment";
|
|
99
|
+
case o:
|
|
100
|
+
return "Portal";
|
|
101
|
+
case w:
|
|
102
|
+
return "Profiler";
|
|
103
|
+
case s:
|
|
104
|
+
return "StrictMode";
|
|
105
|
+
case p:
|
|
106
|
+
return "Suspense";
|
|
107
|
+
case g:
|
|
108
|
+
return "SuspenseList";
|
|
109
|
+
}
|
|
110
|
+
if (typeof e == "object")
|
|
111
|
+
switch (e.$$typeof) {
|
|
112
|
+
case f:
|
|
113
|
+
var n = e;
|
|
114
|
+
return O(n) + ".Consumer";
|
|
115
|
+
case c:
|
|
116
|
+
var l = e;
|
|
117
|
+
return O(l._context) + ".Provider";
|
|
118
|
+
case u:
|
|
119
|
+
return ce(e, e.render, "ForwardRef");
|
|
120
|
+
case m:
|
|
121
|
+
var d = e.displayName || null;
|
|
122
|
+
return d !== null ? d : T(e.type) || "Memo";
|
|
123
|
+
case h: {
|
|
124
|
+
var y = e, j = y._payload, x = y._init;
|
|
125
|
+
try {
|
|
126
|
+
return T(x(j));
|
|
127
|
+
} catch {
|
|
128
|
+
return null;
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
return null;
|
|
133
|
+
}
|
|
134
|
+
var G = Object.assign, M = 0, ue, $e, Ke, Ve, We, ze, Je;
|
|
135
|
+
function Ye() {
|
|
136
|
+
}
|
|
137
|
+
Ye.__reactDisabledLog = !0;
|
|
138
|
+
function Ft() {
|
|
139
|
+
{
|
|
140
|
+
if (M === 0) {
|
|
141
|
+
ue = console.log, $e = console.info, Ke = console.warn, Ve = console.error, We = console.group, ze = console.groupCollapsed, Je = console.groupEnd;
|
|
142
|
+
var e = {
|
|
143
|
+
configurable: !0,
|
|
144
|
+
enumerable: !0,
|
|
145
|
+
value: Ye,
|
|
146
|
+
writable: !0
|
|
147
|
+
};
|
|
148
|
+
Object.defineProperties(console, {
|
|
149
|
+
info: e,
|
|
150
|
+
log: e,
|
|
151
|
+
warn: e,
|
|
152
|
+
error: e,
|
|
153
|
+
group: e,
|
|
154
|
+
groupCollapsed: e,
|
|
155
|
+
groupEnd: e
|
|
156
|
+
});
|
|
157
|
+
}
|
|
158
|
+
M++;
|
|
159
|
+
}
|
|
160
|
+
}
|
|
161
|
+
function Lt() {
|
|
162
|
+
{
|
|
163
|
+
if (M--, M === 0) {
|
|
164
|
+
var e = {
|
|
165
|
+
configurable: !0,
|
|
166
|
+
enumerable: !0,
|
|
167
|
+
writable: !0
|
|
168
|
+
};
|
|
169
|
+
Object.defineProperties(console, {
|
|
170
|
+
log: G({}, e, {
|
|
171
|
+
value: ue
|
|
172
|
+
}),
|
|
173
|
+
info: G({}, e, {
|
|
174
|
+
value: $e
|
|
175
|
+
}),
|
|
176
|
+
warn: G({}, e, {
|
|
177
|
+
value: Ke
|
|
178
|
+
}),
|
|
179
|
+
error: G({}, e, {
|
|
180
|
+
value: Ve
|
|
181
|
+
}),
|
|
182
|
+
group: G({}, e, {
|
|
183
|
+
value: We
|
|
184
|
+
}),
|
|
185
|
+
groupCollapsed: G({}, e, {
|
|
186
|
+
value: ze
|
|
187
|
+
}),
|
|
188
|
+
groupEnd: G({}, e, {
|
|
189
|
+
value: Je
|
|
190
|
+
})
|
|
191
|
+
});
|
|
192
|
+
}
|
|
193
|
+
M < 0 && b("disabledDepth fell below zero. This is a bug in React. Please file an issue.");
|
|
194
|
+
}
|
|
195
|
+
}
|
|
196
|
+
var Ce = D.ReactCurrentDispatcher, Ne;
|
|
197
|
+
function de(e, n, l) {
|
|
198
|
+
{
|
|
199
|
+
if (Ne === void 0)
|
|
200
|
+
try {
|
|
201
|
+
throw Error();
|
|
202
|
+
} catch (y) {
|
|
203
|
+
var d = y.stack.trim().match(/\n( *(at )?)/);
|
|
204
|
+
Ne = d && d[1] || "";
|
|
205
|
+
}
|
|
206
|
+
return `
|
|
207
|
+
` + Ne + e;
|
|
208
|
+
}
|
|
209
|
+
}
|
|
210
|
+
var ke = !1, he;
|
|
211
|
+
{
|
|
212
|
+
var It = typeof WeakMap == "function" ? WeakMap : Map;
|
|
213
|
+
he = new It();
|
|
214
|
+
}
|
|
215
|
+
function He(e, n) {
|
|
216
|
+
if (!e || ke)
|
|
217
|
+
return "";
|
|
218
|
+
{
|
|
219
|
+
var l = he.get(e);
|
|
220
|
+
if (l !== void 0)
|
|
221
|
+
return l;
|
|
222
|
+
}
|
|
223
|
+
var d;
|
|
224
|
+
ke = !0;
|
|
225
|
+
var y = Error.prepareStackTrace;
|
|
226
|
+
Error.prepareStackTrace = void 0;
|
|
227
|
+
var j;
|
|
228
|
+
j = Ce.current, Ce.current = null, Ft();
|
|
229
|
+
try {
|
|
230
|
+
if (n) {
|
|
231
|
+
var x = function() {
|
|
232
|
+
throw Error();
|
|
233
|
+
};
|
|
234
|
+
if (Object.defineProperty(x.prototype, "props", {
|
|
235
|
+
set: function() {
|
|
236
|
+
throw Error();
|
|
237
|
+
}
|
|
238
|
+
}), typeof Reflect == "object" && Reflect.construct) {
|
|
239
|
+
try {
|
|
240
|
+
Reflect.construct(x, []);
|
|
241
|
+
} catch (R) {
|
|
242
|
+
d = R;
|
|
243
|
+
}
|
|
244
|
+
Reflect.construct(e, [], x);
|
|
245
|
+
} else {
|
|
246
|
+
try {
|
|
247
|
+
x.call();
|
|
248
|
+
} catch (R) {
|
|
249
|
+
d = R;
|
|
250
|
+
}
|
|
251
|
+
e.call(x.prototype);
|
|
252
|
+
}
|
|
253
|
+
} else {
|
|
254
|
+
try {
|
|
255
|
+
throw Error();
|
|
256
|
+
} catch (R) {
|
|
257
|
+
d = R;
|
|
258
|
+
}
|
|
259
|
+
e();
|
|
260
|
+
}
|
|
261
|
+
} catch (R) {
|
|
262
|
+
if (R && d && typeof R.stack == "string") {
|
|
263
|
+
for (var v = R.stack.split(`
|
|
264
|
+
`), P = d.stack.split(`
|
|
265
|
+
`), C = v.length - 1, N = P.length - 1; C >= 1 && N >= 0 && v[C] !== P[N]; )
|
|
266
|
+
N--;
|
|
267
|
+
for (; C >= 1 && N >= 0; C--, N--)
|
|
268
|
+
if (v[C] !== P[N]) {
|
|
269
|
+
if (C !== 1 || N !== 1)
|
|
270
|
+
do
|
|
271
|
+
if (C--, N--, N < 0 || v[C] !== P[N]) {
|
|
272
|
+
var L = `
|
|
273
|
+
` + v[C].replace(" at new ", " at ");
|
|
274
|
+
return e.displayName && L.includes("<anonymous>") && (L = L.replace("<anonymous>", e.displayName)), typeof e == "function" && he.set(e, L), L;
|
|
275
|
+
}
|
|
276
|
+
while (C >= 1 && N >= 0);
|
|
277
|
+
break;
|
|
278
|
+
}
|
|
279
|
+
}
|
|
280
|
+
} finally {
|
|
281
|
+
ke = !1, Ce.current = j, Lt(), Error.prepareStackTrace = y;
|
|
282
|
+
}
|
|
283
|
+
var W = e ? e.displayName || e.name : "", $ = W ? de(W) : "";
|
|
284
|
+
return typeof e == "function" && he.set(e, $), $;
|
|
285
|
+
}
|
|
286
|
+
function Bt(e, n, l) {
|
|
287
|
+
return He(e, !1);
|
|
288
|
+
}
|
|
289
|
+
function Ut(e) {
|
|
290
|
+
var n = e.prototype;
|
|
291
|
+
return !!(n && n.isReactComponent);
|
|
292
|
+
}
|
|
293
|
+
function fe(e, n, l) {
|
|
294
|
+
if (e == null)
|
|
295
|
+
return "";
|
|
296
|
+
if (typeof e == "function")
|
|
297
|
+
return He(e, Ut(e));
|
|
298
|
+
if (typeof e == "string")
|
|
299
|
+
return de(e);
|
|
300
|
+
switch (e) {
|
|
301
|
+
case p:
|
|
302
|
+
return de("Suspense");
|
|
303
|
+
case g:
|
|
304
|
+
return de("SuspenseList");
|
|
305
|
+
}
|
|
306
|
+
if (typeof e == "object")
|
|
307
|
+
switch (e.$$typeof) {
|
|
308
|
+
case u:
|
|
309
|
+
return Bt(e.render);
|
|
310
|
+
case m:
|
|
311
|
+
return fe(e.type, n, l);
|
|
312
|
+
case h: {
|
|
313
|
+
var d = e, y = d._payload, j = d._init;
|
|
314
|
+
try {
|
|
315
|
+
return fe(j(y), n, l);
|
|
316
|
+
} catch {
|
|
317
|
+
}
|
|
318
|
+
}
|
|
319
|
+
}
|
|
320
|
+
return "";
|
|
321
|
+
}
|
|
322
|
+
var X = Object.prototype.hasOwnProperty, Qe = {}, Xe = D.ReactDebugCurrentFrame;
|
|
323
|
+
function pe(e) {
|
|
324
|
+
if (e) {
|
|
325
|
+
var n = e._owner, l = fe(e.type, e._source, n ? n.type : null);
|
|
326
|
+
Xe.setExtraStackFrame(l);
|
|
327
|
+
} else
|
|
328
|
+
Xe.setExtraStackFrame(null);
|
|
329
|
+
}
|
|
330
|
+
function Gt(e, n, l, d, y) {
|
|
331
|
+
{
|
|
332
|
+
var j = Function.call.bind(X);
|
|
333
|
+
for (var x in e)
|
|
334
|
+
if (j(e, x)) {
|
|
335
|
+
var v = void 0;
|
|
336
|
+
try {
|
|
337
|
+
if (typeof e[x] != "function") {
|
|
338
|
+
var P = Error((d || "React class") + ": " + l + " type `" + x + "` is invalid; it must be a function, usually from the `prop-types` package, but received `" + typeof e[x] + "`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.");
|
|
339
|
+
throw P.name = "Invariant Violation", P;
|
|
340
|
+
}
|
|
341
|
+
v = e[x](n, x, d, l, null, "SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED");
|
|
342
|
+
} catch (C) {
|
|
343
|
+
v = C;
|
|
344
|
+
}
|
|
345
|
+
v && !(v instanceof Error) && (pe(y), b("%s: type specification of %s `%s` is invalid; the type checker function must return `null` or an `Error` but returned a %s. You may have forgotten to pass an argument to the type checker creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and shape all require an argument).", d || "React class", l, x, typeof v), pe(null)), v instanceof Error && !(v.message in Qe) && (Qe[v.message] = !0, pe(y), b("Failed %s type: %s", l, v.message), pe(null));
|
|
346
|
+
}
|
|
347
|
+
}
|
|
348
|
+
}
|
|
349
|
+
var qt = Array.isArray;
|
|
350
|
+
function Te(e) {
|
|
351
|
+
return qt(e);
|
|
352
|
+
}
|
|
353
|
+
function Mt(e) {
|
|
354
|
+
{
|
|
355
|
+
var n = typeof Symbol == "function" && Symbol.toStringTag, l = n && e[Symbol.toStringTag] || e.constructor.name || "Object";
|
|
356
|
+
return l;
|
|
357
|
+
}
|
|
358
|
+
}
|
|
359
|
+
function $t(e) {
|
|
360
|
+
try {
|
|
361
|
+
return Ze(e), !1;
|
|
362
|
+
} catch {
|
|
363
|
+
return !0;
|
|
364
|
+
}
|
|
365
|
+
}
|
|
366
|
+
function Ze(e) {
|
|
367
|
+
return "" + e;
|
|
368
|
+
}
|
|
369
|
+
function et(e) {
|
|
370
|
+
if ($t(e))
|
|
371
|
+
return b("The provided key is an unsupported type %s. This value must be coerced to a string before before using it here.", Mt(e)), Ze(e);
|
|
372
|
+
}
|
|
373
|
+
var Z = D.ReactCurrentOwner, Kt = {
|
|
374
|
+
key: !0,
|
|
375
|
+
ref: !0,
|
|
376
|
+
__self: !0,
|
|
377
|
+
__source: !0
|
|
378
|
+
}, tt, at, Pe;
|
|
379
|
+
Pe = {};
|
|
380
|
+
function Vt(e) {
|
|
381
|
+
if (X.call(e, "ref")) {
|
|
382
|
+
var n = Object.getOwnPropertyDescriptor(e, "ref").get;
|
|
383
|
+
if (n && n.isReactWarning)
|
|
384
|
+
return !1;
|
|
385
|
+
}
|
|
386
|
+
return e.ref !== void 0;
|
|
387
|
+
}
|
|
388
|
+
function Wt(e) {
|
|
389
|
+
if (X.call(e, "key")) {
|
|
390
|
+
var n = Object.getOwnPropertyDescriptor(e, "key").get;
|
|
391
|
+
if (n && n.isReactWarning)
|
|
392
|
+
return !1;
|
|
393
|
+
}
|
|
394
|
+
return e.key !== void 0;
|
|
395
|
+
}
|
|
396
|
+
function zt(e, n) {
|
|
397
|
+
if (typeof e.ref == "string" && Z.current && n && Z.current.stateNode !== n) {
|
|
398
|
+
var l = T(Z.current.type);
|
|
399
|
+
Pe[l] || (b('Component "%s" contains the string ref "%s". Support for string refs will be removed in a future major release. This case cannot be automatically converted to an arrow function. We ask you to manually fix this case by using useRef() or createRef() instead. Learn more about using refs safely here: https://reactjs.org/link/strict-mode-string-ref', T(Z.current.type), e.ref), Pe[l] = !0);
|
|
400
|
+
}
|
|
401
|
+
}
|
|
402
|
+
function Jt(e, n) {
|
|
403
|
+
{
|
|
404
|
+
var l = function() {
|
|
405
|
+
tt || (tt = !0, b("%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)", n));
|
|
406
|
+
};
|
|
407
|
+
l.isReactWarning = !0, Object.defineProperty(e, "key", {
|
|
408
|
+
get: l,
|
|
409
|
+
configurable: !0
|
|
410
|
+
});
|
|
411
|
+
}
|
|
412
|
+
}
|
|
413
|
+
function Yt(e, n) {
|
|
414
|
+
{
|
|
415
|
+
var l = function() {
|
|
416
|
+
at || (at = !0, b("%s: `ref` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)", n));
|
|
417
|
+
};
|
|
418
|
+
l.isReactWarning = !0, Object.defineProperty(e, "ref", {
|
|
419
|
+
get: l,
|
|
420
|
+
configurable: !0
|
|
421
|
+
});
|
|
422
|
+
}
|
|
423
|
+
}
|
|
424
|
+
var Ht = function(e, n, l, d, y, j, x) {
|
|
425
|
+
var v = {
|
|
426
|
+
// This tag allows us to uniquely identify this as a React Element
|
|
427
|
+
$$typeof: i,
|
|
428
|
+
// Built-in properties that belong on the element
|
|
429
|
+
type: e,
|
|
430
|
+
key: n,
|
|
431
|
+
ref: l,
|
|
432
|
+
props: x,
|
|
433
|
+
// Record the component responsible for creating this element.
|
|
434
|
+
_owner: j
|
|
435
|
+
};
|
|
436
|
+
return v._store = {}, Object.defineProperty(v._store, "validated", {
|
|
437
|
+
configurable: !1,
|
|
438
|
+
enumerable: !1,
|
|
439
|
+
writable: !0,
|
|
440
|
+
value: !1
|
|
441
|
+
}), Object.defineProperty(v, "_self", {
|
|
442
|
+
configurable: !1,
|
|
443
|
+
enumerable: !1,
|
|
444
|
+
writable: !1,
|
|
445
|
+
value: d
|
|
446
|
+
}), Object.defineProperty(v, "_source", {
|
|
447
|
+
configurable: !1,
|
|
448
|
+
enumerable: !1,
|
|
449
|
+
writable: !1,
|
|
450
|
+
value: y
|
|
451
|
+
}), Object.freeze && (Object.freeze(v.props), Object.freeze(v)), v;
|
|
452
|
+
};
|
|
453
|
+
function Qt(e, n, l, d, y) {
|
|
454
|
+
{
|
|
455
|
+
var j, x = {}, v = null, P = null;
|
|
456
|
+
l !== void 0 && (et(l), v = "" + l), Wt(n) && (et(n.key), v = "" + n.key), Vt(n) && (P = n.ref, zt(n, y));
|
|
457
|
+
for (j in n)
|
|
458
|
+
X.call(n, j) && !Kt.hasOwnProperty(j) && (x[j] = n[j]);
|
|
459
|
+
if (e && e.defaultProps) {
|
|
460
|
+
var C = e.defaultProps;
|
|
461
|
+
for (j in C)
|
|
462
|
+
x[j] === void 0 && (x[j] = C[j]);
|
|
463
|
+
}
|
|
464
|
+
if (v || P) {
|
|
465
|
+
var N = typeof e == "function" ? e.displayName || e.name || "Unknown" : e;
|
|
466
|
+
v && Jt(x, N), P && Yt(x, N);
|
|
467
|
+
}
|
|
468
|
+
return Ht(e, v, P, y, d, Z.current, x);
|
|
469
|
+
}
|
|
470
|
+
}
|
|
471
|
+
var _e = D.ReactCurrentOwner, nt = D.ReactDebugCurrentFrame;
|
|
472
|
+
function V(e) {
|
|
473
|
+
if (e) {
|
|
474
|
+
var n = e._owner, l = fe(e.type, e._source, n ? n.type : null);
|
|
475
|
+
nt.setExtraStackFrame(l);
|
|
476
|
+
} else
|
|
477
|
+
nt.setExtraStackFrame(null);
|
|
478
|
+
}
|
|
479
|
+
var Oe;
|
|
480
|
+
Oe = !1;
|
|
481
|
+
function Re(e) {
|
|
482
|
+
return typeof e == "object" && e !== null && e.$$typeof === i;
|
|
483
|
+
}
|
|
484
|
+
function rt() {
|
|
485
|
+
{
|
|
486
|
+
if (_e.current) {
|
|
487
|
+
var e = T(_e.current.type);
|
|
488
|
+
if (e)
|
|
489
|
+
return `
|
|
490
|
+
|
|
491
|
+
Check the render method of \`` + e + "`.";
|
|
492
|
+
}
|
|
493
|
+
return "";
|
|
494
|
+
}
|
|
495
|
+
}
|
|
496
|
+
function Xt(e) {
|
|
497
|
+
return "";
|
|
498
|
+
}
|
|
499
|
+
var st = {};
|
|
500
|
+
function Zt(e) {
|
|
501
|
+
{
|
|
502
|
+
var n = rt();
|
|
503
|
+
if (!n) {
|
|
504
|
+
var l = typeof e == "string" ? e : e.displayName || e.name;
|
|
505
|
+
l && (n = `
|
|
506
|
+
|
|
507
|
+
Check the top-level render call using <` + l + ">.");
|
|
508
|
+
}
|
|
509
|
+
return n;
|
|
510
|
+
}
|
|
511
|
+
}
|
|
512
|
+
function it(e, n) {
|
|
513
|
+
{
|
|
514
|
+
if (!e._store || e._store.validated || e.key != null)
|
|
515
|
+
return;
|
|
516
|
+
e._store.validated = !0;
|
|
517
|
+
var l = Zt(n);
|
|
518
|
+
if (st[l])
|
|
519
|
+
return;
|
|
520
|
+
st[l] = !0;
|
|
521
|
+
var d = "";
|
|
522
|
+
e && e._owner && e._owner !== _e.current && (d = " It was passed a child from " + T(e._owner.type) + "."), V(e), b('Each child in a list should have a unique "key" prop.%s%s See https://reactjs.org/link/warning-keys for more information.', l, d), V(null);
|
|
523
|
+
}
|
|
524
|
+
}
|
|
525
|
+
function ot(e, n) {
|
|
526
|
+
{
|
|
527
|
+
if (typeof e != "object")
|
|
528
|
+
return;
|
|
529
|
+
if (Te(e))
|
|
530
|
+
for (var l = 0; l < e.length; l++) {
|
|
531
|
+
var d = e[l];
|
|
532
|
+
Re(d) && it(d, n);
|
|
533
|
+
}
|
|
534
|
+
else if (Re(e))
|
|
535
|
+
e._store && (e._store.validated = !0);
|
|
536
|
+
else if (e) {
|
|
537
|
+
var y = F(e);
|
|
538
|
+
if (typeof y == "function" && y !== e.entries)
|
|
539
|
+
for (var j = y.call(e), x; !(x = j.next()).done; )
|
|
540
|
+
Re(x.value) && it(x.value, n);
|
|
541
|
+
}
|
|
542
|
+
}
|
|
543
|
+
}
|
|
544
|
+
function ea(e) {
|
|
545
|
+
{
|
|
546
|
+
var n = e.type;
|
|
547
|
+
if (n == null || typeof n == "string")
|
|
548
|
+
return;
|
|
549
|
+
var l;
|
|
550
|
+
if (typeof n == "function")
|
|
551
|
+
l = n.propTypes;
|
|
552
|
+
else if (typeof n == "object" && (n.$$typeof === u || // Note: Memo only checks outer props here.
|
|
553
|
+
// Inner props are checked in the reconciler.
|
|
554
|
+
n.$$typeof === m))
|
|
555
|
+
l = n.propTypes;
|
|
556
|
+
else
|
|
557
|
+
return;
|
|
558
|
+
if (l) {
|
|
559
|
+
var d = T(n);
|
|
560
|
+
Gt(l, e.props, "prop", d, e);
|
|
561
|
+
} else if (n.PropTypes !== void 0 && !Oe) {
|
|
562
|
+
Oe = !0;
|
|
563
|
+
var y = T(n);
|
|
564
|
+
b("Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?", y || "Unknown");
|
|
565
|
+
}
|
|
566
|
+
typeof n.getDefaultProps == "function" && !n.getDefaultProps.isReactClassApproved && b("getDefaultProps is only used on classic React.createClass definitions. Use a static property named `defaultProps` instead.");
|
|
567
|
+
}
|
|
568
|
+
}
|
|
569
|
+
function ta(e) {
|
|
570
|
+
{
|
|
571
|
+
for (var n = Object.keys(e.props), l = 0; l < n.length; l++) {
|
|
572
|
+
var d = n[l];
|
|
573
|
+
if (d !== "children" && d !== "key") {
|
|
574
|
+
V(e), b("Invalid prop `%s` supplied to `React.Fragment`. React.Fragment can only have `key` and `children` props.", d), V(null);
|
|
575
|
+
break;
|
|
576
|
+
}
|
|
577
|
+
}
|
|
578
|
+
e.ref !== null && (V(e), b("Invalid attribute `ref` supplied to `React.Fragment`."), V(null));
|
|
579
|
+
}
|
|
580
|
+
}
|
|
581
|
+
var lt = {};
|
|
582
|
+
function ct(e, n, l, d, y, j) {
|
|
583
|
+
{
|
|
584
|
+
var x = Ee(e);
|
|
585
|
+
if (!x) {
|
|
586
|
+
var v = "";
|
|
587
|
+
(e === void 0 || typeof e == "object" && e !== null && Object.keys(e).length === 0) && (v += " You likely forgot to export your component from the file it's defined in, or you might have mixed up default and named imports.");
|
|
588
|
+
var P = Xt();
|
|
589
|
+
P ? v += P : v += rt();
|
|
590
|
+
var C;
|
|
591
|
+
e === null ? C = "null" : Te(e) ? C = "array" : e !== void 0 && e.$$typeof === i ? (C = "<" + (T(e.type) || "Unknown") + " />", v = " Did you accidentally export a JSX literal instead of a component?") : C = typeof e, b("React.jsx: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s", C, v);
|
|
592
|
+
}
|
|
593
|
+
var N = Qt(e, n, l, y, j);
|
|
594
|
+
if (N == null)
|
|
595
|
+
return N;
|
|
596
|
+
if (x) {
|
|
597
|
+
var L = n.children;
|
|
598
|
+
if (L !== void 0)
|
|
599
|
+
if (d)
|
|
600
|
+
if (Te(L)) {
|
|
601
|
+
for (var W = 0; W < L.length; W++)
|
|
602
|
+
ot(L[W], e);
|
|
603
|
+
Object.freeze && Object.freeze(L);
|
|
604
|
+
} else
|
|
605
|
+
b("React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead.");
|
|
606
|
+
else
|
|
607
|
+
ot(L, e);
|
|
608
|
+
}
|
|
609
|
+
if (X.call(n, "key")) {
|
|
610
|
+
var $ = T(e), R = Object.keys(n).filter(function(oa) {
|
|
611
|
+
return oa !== "key";
|
|
612
|
+
}), De = R.length > 0 ? "{key: someKey, " + R.join(": ..., ") + ": ...}" : "{key: someKey}";
|
|
613
|
+
if (!lt[$ + De]) {
|
|
614
|
+
var ia = R.length > 0 ? "{" + R.join(": ..., ") + ": ...}" : "{}";
|
|
615
|
+
b(`A props object containing a "key" prop is being spread into JSX:
|
|
616
|
+
let props = %s;
|
|
617
|
+
<%s {...props} />
|
|
618
|
+
React keys must be passed directly to JSX without using spread:
|
|
619
|
+
let props = %s;
|
|
620
|
+
<%s key={someKey} {...props} />`, De, $, ia, $), lt[$ + De] = !0;
|
|
621
|
+
}
|
|
622
|
+
}
|
|
623
|
+
return e === a ? ta(N) : ea(N), N;
|
|
624
|
+
}
|
|
625
|
+
}
|
|
626
|
+
function aa(e, n, l) {
|
|
627
|
+
return ct(e, n, l, !0);
|
|
628
|
+
}
|
|
629
|
+
function na(e, n, l) {
|
|
630
|
+
return ct(e, n, l, !1);
|
|
631
|
+
}
|
|
632
|
+
var ra = na, sa = aa;
|
|
633
|
+
te.Fragment = a, te.jsx = ra, te.jsxs = sa;
|
|
634
|
+
}()), te;
|
|
635
|
+
}
|
|
636
|
+
process.env.NODE_ENV === "production" ? Le.exports = Ra() : Le.exports = Da();
|
|
637
|
+
var t = Le.exports;
|
|
638
|
+
const Aa = (r, i) => {
|
|
639
|
+
const a = J().getQueryData(["builder_props"]);
|
|
640
|
+
return q(a, r, i);
|
|
641
|
+
}, A = () => Aa("apiUrl", "/chai/api");
|
|
642
|
+
function H() {
|
|
643
|
+
const [r, i] = I(
|
|
644
|
+
new URLSearchParams(window.location.search)
|
|
645
|
+
);
|
|
646
|
+
return Ie(() => {
|
|
647
|
+
const o = () => {
|
|
648
|
+
i(new URLSearchParams(window.location.search));
|
|
649
|
+
};
|
|
650
|
+
return window.addEventListener("popstate", o), () => {
|
|
651
|
+
window.removeEventListener("popstate", o);
|
|
652
|
+
};
|
|
653
|
+
}, []), [r, i];
|
|
654
|
+
}
|
|
655
|
+
const Tt = () => {
|
|
656
|
+
const [r] = H(), i = r.get("page"), o = A();
|
|
657
|
+
return ne({
|
|
658
|
+
queryKey: ["page", i],
|
|
659
|
+
initialData: [],
|
|
660
|
+
queryFn: async () => (await (await fetch(`${o}`, {
|
|
661
|
+
method: "POST",
|
|
662
|
+
headers: { "Content-Type": "application/json" },
|
|
663
|
+
body: JSON.stringify({
|
|
664
|
+
action: "GET_PAGE",
|
|
665
|
+
data: { id: i, draft: !0 }
|
|
666
|
+
})
|
|
667
|
+
})).json()).blocks ?? [],
|
|
668
|
+
enabled: !!i
|
|
669
|
+
});
|
|
670
|
+
}, Pt = () => {
|
|
671
|
+
const r = A(), i = J(), { toast: o } = Y(), { data: a } = Tt(), [s] = H(), w = s.get("page"), c = q(
|
|
672
|
+
se(a, { _type: "@chai/ai-context" }),
|
|
673
|
+
"_value",
|
|
674
|
+
""
|
|
675
|
+
), { mutateAsync: f } = re({
|
|
676
|
+
mutationFn: async ({ page: u, aiContext: p }) => {
|
|
677
|
+
const g = {
|
|
678
|
+
_type: "@chai/ai-context",
|
|
679
|
+
_value: Ae(p) ? p : ""
|
|
680
|
+
}, m = ae(
|
|
681
|
+
a,
|
|
682
|
+
(S) => (S == null ? void 0 : S._type) !== g._type
|
|
683
|
+
);
|
|
684
|
+
return m.push(g), await fetch(r, {
|
|
685
|
+
method: "POST",
|
|
686
|
+
headers: { "Content-Type": "application/json" },
|
|
687
|
+
body: JSON.stringify({
|
|
688
|
+
action: "UPDATE_PAGE",
|
|
689
|
+
data: { id: u, blocks: m }
|
|
690
|
+
})
|
|
691
|
+
});
|
|
692
|
+
},
|
|
693
|
+
onSuccess: (u, { aiContext: p }) => {
|
|
694
|
+
i.setQueryData(["page", w], () => {
|
|
695
|
+
const g = {
|
|
696
|
+
_type: "@chai/ai-context",
|
|
697
|
+
_value: Ae(p) ? p : ""
|
|
698
|
+
}, m = ae(
|
|
699
|
+
a,
|
|
700
|
+
(h) => (h == null ? void 0 : h._type) !== g._type
|
|
701
|
+
);
|
|
702
|
+
return m.push(g), m;
|
|
703
|
+
}), o({ title: "AI context updated successfully." });
|
|
704
|
+
},
|
|
705
|
+
onError: (u) => {
|
|
706
|
+
o({
|
|
707
|
+
variant: "destructive",
|
|
708
|
+
title: "Failed to update AI context",
|
|
709
|
+
description: u.message
|
|
710
|
+
});
|
|
711
|
+
}
|
|
712
|
+
});
|
|
713
|
+
return { aiContext: c, updateAiContext: f };
|
|
714
|
+
}, Fa = () => {
|
|
715
|
+
const r = A(), { aiContext: i } = Pt();
|
|
716
|
+
return la(
|
|
717
|
+
async (o, a, s, w) => {
|
|
718
|
+
const f = await (await fetch(r, {
|
|
719
|
+
method: "POST",
|
|
720
|
+
headers: {
|
|
721
|
+
"Content-Type": "application/json"
|
|
722
|
+
},
|
|
723
|
+
body: JSON.stringify({
|
|
724
|
+
action: "ASK_AI",
|
|
725
|
+
data: { type: o, prompt: a, blocks: s, aiContext: i, lang: w }
|
|
726
|
+
})
|
|
727
|
+
})).json();
|
|
728
|
+
return console.log("data", f), f.error ? { error: new Error(f.error) } : f;
|
|
729
|
+
},
|
|
730
|
+
[r, i]
|
|
731
|
+
);
|
|
732
|
+
}, La = () => {
|
|
733
|
+
const r = A(), { toast: i } = Y(), o = J();
|
|
734
|
+
return { getUILibraryBlock: async (c, f) => {
|
|
735
|
+
const g = (await (await fetch(
|
|
736
|
+
c.url + (f.path ? "/blocks/" + f.path : "/" + f.uuid + ".html")
|
|
737
|
+
)).text()).replace(/---([\s\S]*?)---/g, "");
|
|
738
|
+
return da(`${g}`);
|
|
739
|
+
}, getUILibraryBlocks: async (c) => {
|
|
740
|
+
try {
|
|
741
|
+
return (await (await fetch(c.url + "/blocks.json")).json()).map((p) => ({
|
|
742
|
+
...p,
|
|
743
|
+
preview: c.url.replace("chaiblocks", "") + p.preview
|
|
744
|
+
}));
|
|
745
|
+
} catch (f) {
|
|
746
|
+
return console.error(f), [];
|
|
747
|
+
}
|
|
748
|
+
}, onSave: async ({
|
|
749
|
+
page: c,
|
|
750
|
+
blocks: f
|
|
751
|
+
}) => {
|
|
752
|
+
try {
|
|
753
|
+
return (await fetch(r, {
|
|
754
|
+
method: "POST",
|
|
755
|
+
headers: { "Content-Type": "application/json" },
|
|
756
|
+
body: JSON.stringify({
|
|
757
|
+
action: "UPDATE_PAGE",
|
|
758
|
+
data: { id: c, blocks: f }
|
|
759
|
+
})
|
|
760
|
+
})).ok ? (o.setQueryData(["page", c], f), i({
|
|
761
|
+
title: "Success",
|
|
762
|
+
description: "Page saved successfully",
|
|
763
|
+
variant: "default"
|
|
764
|
+
}), !0) : new Error("Failed to save blocks");
|
|
765
|
+
} catch (u) {
|
|
766
|
+
return u;
|
|
767
|
+
}
|
|
768
|
+
} };
|
|
769
|
+
}, Ge = () => {
|
|
770
|
+
const r = A();
|
|
771
|
+
return ne({
|
|
772
|
+
queryKey: ["project-pages"],
|
|
773
|
+
initialData: [],
|
|
774
|
+
queryFn: async () => await (await fetch(r, {
|
|
775
|
+
method: "POST",
|
|
776
|
+
headers: {
|
|
777
|
+
"Content-Type": "application/json"
|
|
778
|
+
},
|
|
779
|
+
body: JSON.stringify({
|
|
780
|
+
action: "GET_PROJECT_PAGES"
|
|
781
|
+
})
|
|
782
|
+
})).json()
|
|
783
|
+
});
|
|
784
|
+
}, _t = () => {
|
|
785
|
+
const [r] = H(), i = r.get("page"), { data: o, isFetching: a } = Ge();
|
|
786
|
+
return { data: je(
|
|
787
|
+
() => se(o, { id: i }) || {},
|
|
788
|
+
[o, i]
|
|
789
|
+
), isFetching: a };
|
|
790
|
+
}, Ia = () => ne({
|
|
791
|
+
queryKey: ["uiLibraries"],
|
|
792
|
+
initialData: [],
|
|
793
|
+
queryFn: async () => [
|
|
794
|
+
{
|
|
795
|
+
uuid: "meraki-ui",
|
|
796
|
+
name: "Meraki UI",
|
|
797
|
+
url: "https://chai-ui-blocks.vercel.app"
|
|
798
|
+
},
|
|
799
|
+
{
|
|
800
|
+
uuid: "chaiblocks",
|
|
801
|
+
name: "UI Blocks",
|
|
802
|
+
url: "https://chaibuilder.com/chaiblocks"
|
|
803
|
+
}
|
|
804
|
+
]
|
|
805
|
+
}), Ba = (r) => je(() => {
|
|
806
|
+
if (!r || z(r))
|
|
807
|
+
return {
|
|
808
|
+
blocks: [],
|
|
809
|
+
theme: {}
|
|
810
|
+
};
|
|
811
|
+
const i = se(r, { _type: "@chai/theme" }), o = q(i, "_value", {}) || {}, a = ae(
|
|
812
|
+
r,
|
|
813
|
+
(s) => !be(s == null ? void 0 : s._type, "@chai/")
|
|
814
|
+
);
|
|
815
|
+
return { theme: o, blocks: a };
|
|
816
|
+
}, [r]), Ot = () => {
|
|
817
|
+
const r = A();
|
|
818
|
+
return ne({
|
|
819
|
+
queryKey: ["project-config"],
|
|
820
|
+
initialData: { theme: {} },
|
|
821
|
+
queryFn: async () => await (await fetch(r, {
|
|
822
|
+
method: "POST",
|
|
823
|
+
headers: {
|
|
824
|
+
"Content-Type": "application/json"
|
|
825
|
+
},
|
|
826
|
+
body: JSON.stringify({ action: "GET_PROJECT_CONFIG" })
|
|
827
|
+
})).json()
|
|
828
|
+
});
|
|
829
|
+
}, Ua = () => {
|
|
830
|
+
const { data: r } = Ge(), i = A();
|
|
831
|
+
return {
|
|
832
|
+
getGlobalBlocks: async () => {
|
|
833
|
+
const o = {};
|
|
834
|
+
for (const a of r)
|
|
835
|
+
z(a == null ? void 0 : a.slug) && (o[a.id] = {
|
|
836
|
+
name: Na(a.name ?? a.slug),
|
|
837
|
+
description: ""
|
|
838
|
+
});
|
|
839
|
+
return o;
|
|
840
|
+
},
|
|
841
|
+
getGlobalBlockBlocks: async (o) => o ? (await (await fetch(`${i}`, {
|
|
842
|
+
method: "POST",
|
|
843
|
+
headers: { "Content-Type": "application/json" },
|
|
844
|
+
body: JSON.stringify({
|
|
845
|
+
action: "GET_PAGE",
|
|
846
|
+
data: { id: o, draft: !0 }
|
|
847
|
+
})
|
|
848
|
+
})).json()).blocks : []
|
|
849
|
+
};
|
|
850
|
+
}, Ga = () => {
|
|
851
|
+
const r = A();
|
|
852
|
+
return { uploadFile: async (o) => {
|
|
853
|
+
const a = new FormData();
|
|
854
|
+
return a.append("action", "UPLOAD_FILE"), a.append("file", o), (await fetch(r, {
|
|
855
|
+
method: "POST",
|
|
856
|
+
body: a
|
|
857
|
+
})).json();
|
|
858
|
+
} };
|
|
859
|
+
}, qa = () => {
|
|
860
|
+
const r = A(), { toast: i } = Y();
|
|
861
|
+
return re({
|
|
862
|
+
mutationFn: async (o) => (await fetch(`${r}`, {
|
|
863
|
+
method: "POST",
|
|
864
|
+
headers: { "Content-Type": "application/json" },
|
|
865
|
+
body: JSON.stringify({
|
|
866
|
+
action: "PUBLISH_PAGE",
|
|
867
|
+
data: { id: o }
|
|
868
|
+
})
|
|
869
|
+
})).json(),
|
|
870
|
+
onSuccess: () => {
|
|
871
|
+
i({
|
|
872
|
+
title: "Pages published",
|
|
873
|
+
description: "Your page has been published"
|
|
874
|
+
});
|
|
875
|
+
}
|
|
876
|
+
});
|
|
877
|
+
}, qe = () => {
|
|
878
|
+
const r = A(), [i] = H(), o = i.get("page");
|
|
879
|
+
return ne({
|
|
880
|
+
queryKey: ["language-pages", o],
|
|
881
|
+
initialData: [],
|
|
882
|
+
queryFn: async () => {
|
|
883
|
+
if (!o) return null;
|
|
884
|
+
const s = await (await fetch(r, {
|
|
885
|
+
method: "POST",
|
|
886
|
+
headers: { "Content-Type": "application/json" },
|
|
887
|
+
body: JSON.stringify({
|
|
888
|
+
action: "GET_LANGUAGE_PAGES",
|
|
889
|
+
data: { id: o }
|
|
890
|
+
})
|
|
891
|
+
})).json();
|
|
892
|
+
return ka(Ta(s, "primaryPage"));
|
|
893
|
+
}
|
|
894
|
+
});
|
|
895
|
+
}, ye = {
|
|
896
|
+
ab: "Abkhazian",
|
|
897
|
+
aa: "Afar",
|
|
898
|
+
af: "Afrikaans",
|
|
899
|
+
ak: "Akan",
|
|
900
|
+
sq: "Albanian",
|
|
901
|
+
am: "Amharic",
|
|
902
|
+
ar: "Arabic",
|
|
903
|
+
an: "Aragonese",
|
|
904
|
+
hy: "Armenian",
|
|
905
|
+
as: "Assamese",
|
|
906
|
+
av: "Avaric",
|
|
907
|
+
ae: "Avestan",
|
|
908
|
+
ay: "Aymara",
|
|
909
|
+
az: "Azerbaijani",
|
|
910
|
+
bm: "Bambara",
|
|
911
|
+
ba: "Bashkir",
|
|
912
|
+
eu: "Basque",
|
|
913
|
+
be: "Belarusian",
|
|
914
|
+
bn: "Bengali",
|
|
915
|
+
bh: "Bihari",
|
|
916
|
+
bi: "Bislama",
|
|
917
|
+
bs: "Bosnian",
|
|
918
|
+
br: "Breton",
|
|
919
|
+
bg: "Bulgarian",
|
|
920
|
+
my: "Burmese",
|
|
921
|
+
ca: "Catalan",
|
|
922
|
+
ch: "Chamorro",
|
|
923
|
+
ce: "Chechen",
|
|
924
|
+
ny: "Chichewa",
|
|
925
|
+
zh: "Chinese",
|
|
926
|
+
"zh-Hans": "Chinese (Simplified)",
|
|
927
|
+
"zh-Hant": "Chinese (Traditional)",
|
|
928
|
+
cv: "Chuvash",
|
|
929
|
+
kw: "Cornish",
|
|
930
|
+
co: "Corsican",
|
|
931
|
+
cr: "Cree",
|
|
932
|
+
hr: "Croatian",
|
|
933
|
+
cs: "Czech",
|
|
934
|
+
da: "Danish",
|
|
935
|
+
dv: "Maldivian",
|
|
936
|
+
nl: "Dutch",
|
|
937
|
+
dz: "Dzongkha",
|
|
938
|
+
en: "English",
|
|
939
|
+
eo: "Esperanto",
|
|
940
|
+
et: "Estonian",
|
|
941
|
+
ee: "Ewe",
|
|
942
|
+
fo: "Faroese",
|
|
943
|
+
fj: "Fijian",
|
|
944
|
+
fi: "Finnish",
|
|
945
|
+
fr: "French",
|
|
946
|
+
ff: "Fula, Pular",
|
|
947
|
+
gl: "Galician",
|
|
948
|
+
gd: "Gaelic (Scottish)",
|
|
949
|
+
gv: "Manx",
|
|
950
|
+
ka: "Georgian",
|
|
951
|
+
de: "German",
|
|
952
|
+
el: "Greek",
|
|
953
|
+
kl: "Kalaallisut",
|
|
954
|
+
gn: "Guarani",
|
|
955
|
+
gu: "Gujarati",
|
|
956
|
+
ht: "Haitian Creole",
|
|
957
|
+
ha: "Hausa",
|
|
958
|
+
he: "Hebrew",
|
|
959
|
+
hz: "Herero",
|
|
960
|
+
hi: "Hindi",
|
|
961
|
+
ho: "Hiri Motu",
|
|
962
|
+
hu: "Hungarian",
|
|
963
|
+
is: "Icelandic",
|
|
964
|
+
io: "Ido",
|
|
965
|
+
ig: "Igbo",
|
|
966
|
+
id: "Indonesian",
|
|
967
|
+
ia: "Interlingua",
|
|
968
|
+
ie: "Interlingue",
|
|
969
|
+
iu: "Inuktitut",
|
|
970
|
+
ik: "Inupiak",
|
|
971
|
+
ga: "Irish",
|
|
972
|
+
it: "Italian",
|
|
973
|
+
ja: "Japanese",
|
|
974
|
+
jv: "Javanese",
|
|
975
|
+
kn: "Kannada",
|
|
976
|
+
kr: "Kanuri",
|
|
977
|
+
ks: "Kashmiri",
|
|
978
|
+
kk: "Kazakh",
|
|
979
|
+
km: "Khmer",
|
|
980
|
+
ki: "Kikuyu",
|
|
981
|
+
rw: "Kinyarwanda",
|
|
982
|
+
rn: "Kirundi",
|
|
983
|
+
ky: "Kyrgyz",
|
|
984
|
+
kv: "Komi",
|
|
985
|
+
kg: "Kongo",
|
|
986
|
+
ko: "Korean",
|
|
987
|
+
ku: "Kurdish",
|
|
988
|
+
kj: "Kwanyama",
|
|
989
|
+
lo: "Lao",
|
|
990
|
+
la: "Latin",
|
|
991
|
+
lv: "Latvian",
|
|
992
|
+
li: "Limburgish",
|
|
993
|
+
ln: "Lingala",
|
|
994
|
+
lt: "Lithuanian",
|
|
995
|
+
lu: "Luga-Katanga",
|
|
996
|
+
lg: "Luganda, Ganda",
|
|
997
|
+
lb: "Luxembourgish",
|
|
998
|
+
mk: "Macedonian",
|
|
999
|
+
mg: "Malagasy",
|
|
1000
|
+
ms: "Malay",
|
|
1001
|
+
ml: "Malayalam",
|
|
1002
|
+
mt: "Maltese",
|
|
1003
|
+
mi: "Maori",
|
|
1004
|
+
mr: "Marathi",
|
|
1005
|
+
mh: "Marshallese",
|
|
1006
|
+
mo: "Moldavian",
|
|
1007
|
+
mn: "Mongolian",
|
|
1008
|
+
na: "Nauru",
|
|
1009
|
+
nv: "Navajo",
|
|
1010
|
+
ng: "Ndonga",
|
|
1011
|
+
nd: "Northern Ndebele",
|
|
1012
|
+
ne: "Nepali",
|
|
1013
|
+
no: "Norwegian",
|
|
1014
|
+
nb: "Norwegian bokmål",
|
|
1015
|
+
nn: "Norwegian nynorsk",
|
|
1016
|
+
ii: "Sichuan Yi",
|
|
1017
|
+
oc: "Occitan",
|
|
1018
|
+
oj: "Ojibwe",
|
|
1019
|
+
cu: "Old Church Slavonic",
|
|
1020
|
+
or: "Oriya",
|
|
1021
|
+
om: "Oromo",
|
|
1022
|
+
os: "Ossetian",
|
|
1023
|
+
pi: "Pāli",
|
|
1024
|
+
ps: "Pashto, Pushto",
|
|
1025
|
+
fa: "Persian (Farsi)",
|
|
1026
|
+
pl: "Polish",
|
|
1027
|
+
pt: "Portuguese",
|
|
1028
|
+
pa: "Punjabi (Eastern)",
|
|
1029
|
+
qu: "Quechua",
|
|
1030
|
+
rm: "Romansh",
|
|
1031
|
+
ro: "Romanian",
|
|
1032
|
+
ru: "Russian",
|
|
1033
|
+
se: "Sami",
|
|
1034
|
+
sm: "Samoan",
|
|
1035
|
+
sg: "Sango",
|
|
1036
|
+
sa: "Sanskrit",
|
|
1037
|
+
sr: "Serbian",
|
|
1038
|
+
sh: "Serbo-Croatian",
|
|
1039
|
+
st: "Sesotho",
|
|
1040
|
+
tn: "Setswana",
|
|
1041
|
+
sn: "Shona",
|
|
1042
|
+
sd: "Sindhi",
|
|
1043
|
+
si: "Sinhalese",
|
|
1044
|
+
ss: "Swati",
|
|
1045
|
+
sk: "Slovak",
|
|
1046
|
+
sl: "Slovenian",
|
|
1047
|
+
so: "Somali",
|
|
1048
|
+
nr: "Southern Ndebele",
|
|
1049
|
+
es: "Spanish",
|
|
1050
|
+
su: "Sundanese",
|
|
1051
|
+
sw: "Swahili (Kiswahili)",
|
|
1052
|
+
sv: "Swedish",
|
|
1053
|
+
tl: "Tagalog",
|
|
1054
|
+
ty: "Tahitian",
|
|
1055
|
+
tg: "Tajik",
|
|
1056
|
+
ta: "Tamil",
|
|
1057
|
+
tt: "Tatar",
|
|
1058
|
+
te: "Telugu",
|
|
1059
|
+
th: "Thai",
|
|
1060
|
+
bo: "Tibetan",
|
|
1061
|
+
ti: "Tigrinya",
|
|
1062
|
+
to: "Tonga",
|
|
1063
|
+
ts: "Tsonga",
|
|
1064
|
+
tr: "Turkish",
|
|
1065
|
+
tk: "Turkmen",
|
|
1066
|
+
tw: "Twi",
|
|
1067
|
+
ug: "Uyghur",
|
|
1068
|
+
uk: "Ukrainian",
|
|
1069
|
+
ur: "Urdu",
|
|
1070
|
+
uz: "Uzbek",
|
|
1071
|
+
ve: "Venda",
|
|
1072
|
+
vi: "Vietnamese",
|
|
1073
|
+
vo: "Volapük",
|
|
1074
|
+
wa: "Wallon",
|
|
1075
|
+
cy: "Welsh",
|
|
1076
|
+
wo: "Wolof",
|
|
1077
|
+
fy: "Western Frisian",
|
|
1078
|
+
xh: "Xhosa",
|
|
1079
|
+
yi: "Yiddish",
|
|
1080
|
+
yo: "Yoruba",
|
|
1081
|
+
za: "Zhuang, Chuang",
|
|
1082
|
+
zu: "Zulu"
|
|
1083
|
+
}, Rt = () => {
|
|
1084
|
+
const r = A(), i = J(), { toast: o } = Y();
|
|
1085
|
+
return re({
|
|
1086
|
+
mutationFn: async (a) => await (await fetch(r, {
|
|
1087
|
+
method: "POST",
|
|
1088
|
+
headers: {
|
|
1089
|
+
"Content-Type": "application/json"
|
|
1090
|
+
},
|
|
1091
|
+
body: JSON.stringify({
|
|
1092
|
+
action: "CREATE_PAGE",
|
|
1093
|
+
data: a
|
|
1094
|
+
})
|
|
1095
|
+
})).json(),
|
|
1096
|
+
onSuccess: (a, s) => {
|
|
1097
|
+
s && (s != null && s.primaryPage) ? i.invalidateQueries({
|
|
1098
|
+
queryKey: ["language-pages", s == null ? void 0 : s.primaryPage]
|
|
1099
|
+
}) : i.invalidateQueries({ queryKey: ["project-pages"] }), o({
|
|
1100
|
+
title: `New ${s.global ? "global block" : "page"} added successfully.`
|
|
1101
|
+
});
|
|
1102
|
+
},
|
|
1103
|
+
onError: (a, s) => {
|
|
1104
|
+
o({
|
|
1105
|
+
variant: "destructive",
|
|
1106
|
+
title: `Failed to add new ${s.global ? "global block" : "page"}.`,
|
|
1107
|
+
description: a.message
|
|
1108
|
+
});
|
|
1109
|
+
}
|
|
1110
|
+
});
|
|
1111
|
+
}, Me = () => {
|
|
1112
|
+
const r = A(), i = J(), { toast: o } = Y();
|
|
1113
|
+
return re({
|
|
1114
|
+
mutationFn: async (a) => (await fetch(r, {
|
|
1115
|
+
method: "POST",
|
|
1116
|
+
headers: {
|
|
1117
|
+
"Content-Type": "application/json"
|
|
1118
|
+
},
|
|
1119
|
+
body: JSON.stringify({
|
|
1120
|
+
action: "UPDATE_PAGE",
|
|
1121
|
+
data: a
|
|
1122
|
+
})
|
|
1123
|
+
})).json(),
|
|
1124
|
+
onSuccess: (a, s) => {
|
|
1125
|
+
s && (s != null && s.primaryPage || s != null && s.seo) ? i.invalidateQueries({
|
|
1126
|
+
queryKey: ["language-pages", s == null ? void 0 : s.primaryPage]
|
|
1127
|
+
}) : i.invalidateQueries({ queryKey: ["project-pages"] }), s != null && s.seo ? o({
|
|
1128
|
+
title: "SEO Settings updated successfully."
|
|
1129
|
+
}) : o({
|
|
1130
|
+
title: `${s.global ? "Global block" : "Page"} updated successfully.`
|
|
1131
|
+
});
|
|
1132
|
+
},
|
|
1133
|
+
onError: (a, s) => {
|
|
1134
|
+
o({
|
|
1135
|
+
variant: "destructive",
|
|
1136
|
+
title: `Failed to update ${s.global ? "global block" : "page"}.`,
|
|
1137
|
+
description: a.message
|
|
1138
|
+
});
|
|
1139
|
+
}
|
|
1140
|
+
});
|
|
1141
|
+
}, Dt = () => {
|
|
1142
|
+
const r = A(), i = J(), { toast: o } = Y();
|
|
1143
|
+
return re({
|
|
1144
|
+
mutationFn: async (a) => (await fetch(r, {
|
|
1145
|
+
method: "POST",
|
|
1146
|
+
headers: {
|
|
1147
|
+
"Content-Type": "application/json"
|
|
1148
|
+
},
|
|
1149
|
+
body: JSON.stringify({
|
|
1150
|
+
action: "DELETE_PAGE",
|
|
1151
|
+
data: { id: a == null ? void 0 : a.id }
|
|
1152
|
+
})
|
|
1153
|
+
})).json(),
|
|
1154
|
+
onSuccess: (a, s) => {
|
|
1155
|
+
s && (s != null && s.primaryPage) ? i.invalidateQueries({
|
|
1156
|
+
queryKey: ["language-pages", s == null ? void 0 : s.primaryPage]
|
|
1157
|
+
}) : i.invalidateQueries({ queryKey: ["project-pages"] }), o({
|
|
1158
|
+
title: `${s.global ? "Global block" : "Page"} deleted successfully.`
|
|
1159
|
+
});
|
|
1160
|
+
},
|
|
1161
|
+
onError: (a, s) => {
|
|
1162
|
+
o({
|
|
1163
|
+
variant: "destructive",
|
|
1164
|
+
title: `Failed to delete ${s.global ? "global block" : "page"}.`,
|
|
1165
|
+
description: a.message
|
|
1166
|
+
});
|
|
1167
|
+
}
|
|
1168
|
+
});
|
|
1169
|
+
}, Ma = () => {
|
|
1170
|
+
const { selectedLang: r } = Be(), { data: i, isFetching: o } = qe();
|
|
1171
|
+
return { data: je(() => se(i, { lang: r || "" }) || {}, [i, r]), isFetching: o };
|
|
1172
|
+
}, At = () => {
|
|
1173
|
+
const { data: r, isFetching: i } = Ma(), o = r == null ? void 0 : r.seo, [a, s] = I({
|
|
1174
|
+
seoTitle: "",
|
|
1175
|
+
seoDescription: "",
|
|
1176
|
+
cononicalUrl: "",
|
|
1177
|
+
noIndex: !1,
|
|
1178
|
+
noFollow: "",
|
|
1179
|
+
ogTitle: "",
|
|
1180
|
+
ogDescription: "",
|
|
1181
|
+
ogImage: "",
|
|
1182
|
+
searchTitle: "",
|
|
1183
|
+
searchDescription: "",
|
|
1184
|
+
jsonLD: "",
|
|
1185
|
+
...o
|
|
1186
|
+
}), w = ca({ initial: a, updated: a }), { selectedLang: c, fallbackLang: f } = Be(), u = c.length ? c : f, { mutate: p, isPending: g } = Me(), m = g;
|
|
1187
|
+
Ie(() => {
|
|
1188
|
+
!i && o && s({
|
|
1189
|
+
seoTitle: "",
|
|
1190
|
+
seoDescription: "",
|
|
1191
|
+
cononicalUrl: "",
|
|
1192
|
+
noIndex: !1,
|
|
1193
|
+
noFollow: "",
|
|
1194
|
+
ogTitle: "",
|
|
1195
|
+
ogDescription: "",
|
|
1196
|
+
ogImage: "",
|
|
1197
|
+
searchTitle: "",
|
|
1198
|
+
searchDescription: "",
|
|
1199
|
+
jsonLD: "",
|
|
1200
|
+
...o
|
|
1201
|
+
});
|
|
1202
|
+
}, [i, o]);
|
|
1203
|
+
const h = async () => {
|
|
1204
|
+
p({ id: r == null ? void 0 : r.id, seo: a }), w.current.initial = a, w.current.updated = a;
|
|
1205
|
+
}, S = () => {
|
|
1206
|
+
s({
|
|
1207
|
+
...a,
|
|
1208
|
+
ogTitle: a.seoTitle,
|
|
1209
|
+
ogDescription: a.seoDescription
|
|
1210
|
+
});
|
|
1211
|
+
}, k = () => {
|
|
1212
|
+
s({
|
|
1213
|
+
...a,
|
|
1214
|
+
searchTitle: a.ogTitle,
|
|
1215
|
+
searchDescription: a.ogDescription
|
|
1216
|
+
});
|
|
1217
|
+
}, E = (F) => {
|
|
1218
|
+
const D = {
|
|
1219
|
+
...a,
|
|
1220
|
+
[F.target.name]: F.target.name === "noIndex" ? F.target.checked : F.target.value
|
|
1221
|
+
};
|
|
1222
|
+
s(D), w.current.updated = D;
|
|
1223
|
+
};
|
|
1224
|
+
return /* @__PURE__ */ t.jsxs("div", { className: "relative pb-40", children: [
|
|
1225
|
+
/* @__PURE__ */ t.jsxs("div", { className: "text-xs bg-gray-100 p-2 rounded-md text-center", children: [
|
|
1226
|
+
"Current language:",
|
|
1227
|
+
" ",
|
|
1228
|
+
/* @__PURE__ */ t.jsx("span", { className: "text-blue-500 font-semibold", children: q(ye, u, u) })
|
|
1229
|
+
] }),
|
|
1230
|
+
/* @__PURE__ */ t.jsx("form", { className: "space-y-8", children: /* @__PURE__ */ t.jsxs(ga, { type: "multiple", defaultValue: ["page"], children: [
|
|
1231
|
+
/* @__PURE__ */ t.jsxs(ge, { value: "page", children: [
|
|
1232
|
+
/* @__PURE__ */ t.jsx(me, { className: "text-blue-500", children: "Seo Page" }),
|
|
1233
|
+
/* @__PURE__ */ t.jsx(ve, { children: /* @__PURE__ */ t.jsxs("div", { className: "space-y-4", children: [
|
|
1234
|
+
/* @__PURE__ */ t.jsxs("div", { children: [
|
|
1235
|
+
/* @__PURE__ */ t.jsx(_, { className: "text-xs pb-1", htmlFor: "seoTitle", children: "SEO Title" }),
|
|
1236
|
+
/* @__PURE__ */ t.jsx(
|
|
1237
|
+
U,
|
|
1238
|
+
{
|
|
1239
|
+
type: "text",
|
|
1240
|
+
id: "seoTitle",
|
|
1241
|
+
name: "seoTitle",
|
|
1242
|
+
value: a.seoTitle,
|
|
1243
|
+
onChange: E,
|
|
1244
|
+
disabled: m,
|
|
1245
|
+
placeholder: "Enter SEO title"
|
|
1246
|
+
}
|
|
1247
|
+
),
|
|
1248
|
+
/* @__PURE__ */ t.jsx("p", { className: "mt-1 text-[10px] font-light text-gray-400", children: "The title should be between 10 and 60 characters." })
|
|
1249
|
+
] }),
|
|
1250
|
+
/* @__PURE__ */ t.jsxs("div", { children: [
|
|
1251
|
+
/* @__PURE__ */ t.jsx(_, { className: "text-xs pb-1", htmlFor: "seoDescription", children: "SEO Description" }),
|
|
1252
|
+
/* @__PURE__ */ t.jsx(
|
|
1253
|
+
xe,
|
|
1254
|
+
{
|
|
1255
|
+
id: "seoDescription",
|
|
1256
|
+
name: "seoDescription",
|
|
1257
|
+
value: a.seoDescription,
|
|
1258
|
+
onChange: E,
|
|
1259
|
+
disabled: m,
|
|
1260
|
+
placeholder: "Enter SEO description"
|
|
1261
|
+
}
|
|
1262
|
+
),
|
|
1263
|
+
/* @__PURE__ */ t.jsx("p", { className: "mt-1 text-[10px] font-light text-gray-400", children: "The description should be between 50 and 160 characters." })
|
|
1264
|
+
] }),
|
|
1265
|
+
/* @__PURE__ */ t.jsxs("div", { children: [
|
|
1266
|
+
/* @__PURE__ */ t.jsx(_, { className: "text-xs pb-1", htmlFor: "seoTitle", children: "Canonical URL" }),
|
|
1267
|
+
/* @__PURE__ */ t.jsx(
|
|
1268
|
+
U,
|
|
1269
|
+
{
|
|
1270
|
+
type: "text",
|
|
1271
|
+
id: "canonicalUrl",
|
|
1272
|
+
name: "canonicalUrl",
|
|
1273
|
+
value: a.canonicalUrl,
|
|
1274
|
+
onChange: E,
|
|
1275
|
+
disabled: m,
|
|
1276
|
+
placeholder: "Enter Canonical URL"
|
|
1277
|
+
}
|
|
1278
|
+
)
|
|
1279
|
+
] }),
|
|
1280
|
+
/* @__PURE__ */ t.jsxs("div", { className: "", children: [
|
|
1281
|
+
/* @__PURE__ */ t.jsxs("div", { className: "flex items-center gap-x-2", children: [
|
|
1282
|
+
/* @__PURE__ */ t.jsx(
|
|
1283
|
+
U,
|
|
1284
|
+
{
|
|
1285
|
+
type: "checkbox",
|
|
1286
|
+
id: "noIndex",
|
|
1287
|
+
name: "noIndex",
|
|
1288
|
+
checked: a.noIndex,
|
|
1289
|
+
onChange: E,
|
|
1290
|
+
disabled: m,
|
|
1291
|
+
className: "h-4 w-4"
|
|
1292
|
+
}
|
|
1293
|
+
),
|
|
1294
|
+
/* @__PURE__ */ t.jsx(_, { className: "text-xs pb-1", htmlFor: "noIndex", children: "No Index" })
|
|
1295
|
+
] }),
|
|
1296
|
+
/* @__PURE__ */ t.jsx("p", { className: "mt-2 text-[10px] font-light text-gray-400", children: "Check this if you don't want search engines to index this page." })
|
|
1297
|
+
] }),
|
|
1298
|
+
/* @__PURE__ */ t.jsxs("div", { children: [
|
|
1299
|
+
/* @__PURE__ */ t.jsx(_, { className: "text-xs pb-1", htmlFor: "seoTitle", children: "No Follow" }),
|
|
1300
|
+
/* @__PURE__ */ t.jsx(
|
|
1301
|
+
U,
|
|
1302
|
+
{
|
|
1303
|
+
type: "text",
|
|
1304
|
+
id: "noFollow",
|
|
1305
|
+
name: "noFollow",
|
|
1306
|
+
value: a.noFollow,
|
|
1307
|
+
onChange: E,
|
|
1308
|
+
disabled: m,
|
|
1309
|
+
placeholder: "Enter No follow"
|
|
1310
|
+
}
|
|
1311
|
+
)
|
|
1312
|
+
] })
|
|
1313
|
+
] }) })
|
|
1314
|
+
] }),
|
|
1315
|
+
/* @__PURE__ */ t.jsxs(ge, { value: "og", children: [
|
|
1316
|
+
/* @__PURE__ */ t.jsx(me, { className: "text-blue-500", children: "OG" }),
|
|
1317
|
+
/* @__PURE__ */ t.jsx(ve, { children: /* @__PURE__ */ t.jsxs("div", { className: "space-y-4", children: [
|
|
1318
|
+
/* @__PURE__ */ t.jsx("div", { className: "flex items-center justify-between", children: /* @__PURE__ */ t.jsx(
|
|
1319
|
+
B,
|
|
1320
|
+
{
|
|
1321
|
+
type: "button",
|
|
1322
|
+
variant: "outline",
|
|
1323
|
+
size: "sm",
|
|
1324
|
+
onClick: S,
|
|
1325
|
+
children: "Copy from SEO Settings"
|
|
1326
|
+
}
|
|
1327
|
+
) }),
|
|
1328
|
+
/* @__PURE__ */ t.jsxs("div", { children: [
|
|
1329
|
+
/* @__PURE__ */ t.jsx(_, { className: "text-xs pb-1", htmlFor: "ogTitle", children: "OG Title" }),
|
|
1330
|
+
/* @__PURE__ */ t.jsx(
|
|
1331
|
+
U,
|
|
1332
|
+
{
|
|
1333
|
+
type: "text",
|
|
1334
|
+
id: "ogTitle",
|
|
1335
|
+
name: "ogTitle",
|
|
1336
|
+
value: a.ogTitle,
|
|
1337
|
+
onChange: E,
|
|
1338
|
+
disabled: m,
|
|
1339
|
+
placeholder: "Enter OG title"
|
|
1340
|
+
}
|
|
1341
|
+
),
|
|
1342
|
+
/* @__PURE__ */ t.jsx("p", { className: "mt-1 text-[10px] font-light text-gray-400", children: "The OG title should be between 10 and 60 characters." })
|
|
1343
|
+
] }),
|
|
1344
|
+
/* @__PURE__ */ t.jsxs("div", { className: "mt-4", children: [
|
|
1345
|
+
/* @__PURE__ */ t.jsx(_, { className: "text-xs pb-1", htmlFor: "ogDescription", children: "OG Description" }),
|
|
1346
|
+
/* @__PURE__ */ t.jsx(
|
|
1347
|
+
xe,
|
|
1348
|
+
{
|
|
1349
|
+
id: "ogDescription",
|
|
1350
|
+
name: "ogDescription",
|
|
1351
|
+
value: a.ogDescription,
|
|
1352
|
+
onChange: E,
|
|
1353
|
+
disabled: m,
|
|
1354
|
+
placeholder: "Enter OG description"
|
|
1355
|
+
}
|
|
1356
|
+
),
|
|
1357
|
+
/* @__PURE__ */ t.jsx("p", { className: "mt-1 text-[10px] font-light text-gray-400", children: "The OG description should be between 50 and 160 characters." })
|
|
1358
|
+
] }),
|
|
1359
|
+
/* @__PURE__ */ t.jsxs("div", { className: "mt-4", children: [
|
|
1360
|
+
/* @__PURE__ */ t.jsx(_, { className: "text-xs pb-1", htmlFor: "ogImage", children: "OG Image URL" }),
|
|
1361
|
+
/* @__PURE__ */ t.jsx(
|
|
1362
|
+
U,
|
|
1363
|
+
{
|
|
1364
|
+
type: "text",
|
|
1365
|
+
id: "ogImage",
|
|
1366
|
+
name: "ogImage",
|
|
1367
|
+
value: a.ogImage,
|
|
1368
|
+
onChange: E,
|
|
1369
|
+
disabled: m,
|
|
1370
|
+
placeholder: "Enter OG image URL"
|
|
1371
|
+
}
|
|
1372
|
+
),
|
|
1373
|
+
/* @__PURE__ */ t.jsx("p", { className: "mt-1 text-[10px] font-light text-gray-400", children: "Enter a valid URL for the OG image." })
|
|
1374
|
+
] })
|
|
1375
|
+
] }) })
|
|
1376
|
+
] }),
|
|
1377
|
+
/* @__PURE__ */ t.jsxs(ge, { value: "search", children: [
|
|
1378
|
+
/* @__PURE__ */ t.jsx(me, { className: "text-blue-500", children: "Search" }),
|
|
1379
|
+
/* @__PURE__ */ t.jsx(ve, { children: /* @__PURE__ */ t.jsxs("div", { className: "space-y-4", children: [
|
|
1380
|
+
/* @__PURE__ */ t.jsx("div", { className: "flex items-center justify-between", children: /* @__PURE__ */ t.jsx(
|
|
1381
|
+
B,
|
|
1382
|
+
{
|
|
1383
|
+
type: "button",
|
|
1384
|
+
variant: "outline",
|
|
1385
|
+
size: "sm",
|
|
1386
|
+
onClick: k,
|
|
1387
|
+
children: "Copy from OG Settings"
|
|
1388
|
+
}
|
|
1389
|
+
) }),
|
|
1390
|
+
/* @__PURE__ */ t.jsxs("div", { children: [
|
|
1391
|
+
/* @__PURE__ */ t.jsx(_, { className: "text-xs pb-1", htmlFor: "searchTitle", children: "Search Title" }),
|
|
1392
|
+
/* @__PURE__ */ t.jsx(
|
|
1393
|
+
U,
|
|
1394
|
+
{
|
|
1395
|
+
type: "text",
|
|
1396
|
+
id: "searchTitle",
|
|
1397
|
+
name: "searchTitle",
|
|
1398
|
+
value: a.searchTitle,
|
|
1399
|
+
onChange: E,
|
|
1400
|
+
disabled: m,
|
|
1401
|
+
placeholder: "Enter search title"
|
|
1402
|
+
}
|
|
1403
|
+
),
|
|
1404
|
+
/* @__PURE__ */ t.jsx("p", { className: "mt-1 text-[10px] font-light text-gray-400", children: "The search title should be between 10 and 60 characters." })
|
|
1405
|
+
] }),
|
|
1406
|
+
/* @__PURE__ */ t.jsxs("div", { children: [
|
|
1407
|
+
/* @__PURE__ */ t.jsx(_, { className: "text-xs pb-1", htmlFor: "searchDescription", children: "Search Description" }),
|
|
1408
|
+
/* @__PURE__ */ t.jsx(
|
|
1409
|
+
xe,
|
|
1410
|
+
{
|
|
1411
|
+
id: "searchDescription",
|
|
1412
|
+
name: "searchDescription",
|
|
1413
|
+
value: a.searchDescription,
|
|
1414
|
+
onChange: E,
|
|
1415
|
+
placeholder: "Enter search description"
|
|
1416
|
+
}
|
|
1417
|
+
),
|
|
1418
|
+
/* @__PURE__ */ t.jsx("p", { className: "mt-1 text-[10px] font-light text-gray-400", children: "The search description should be between 50 and 160 characters." })
|
|
1419
|
+
] })
|
|
1420
|
+
] }) })
|
|
1421
|
+
] }),
|
|
1422
|
+
/* @__PURE__ */ t.jsxs(ge, { value: "jsonLD", children: [
|
|
1423
|
+
/* @__PURE__ */ t.jsx(me, { className: "text-blue-500", children: "JSON-LD" }),
|
|
1424
|
+
/* @__PURE__ */ t.jsx(ve, { children: /* @__PURE__ */ t.jsx("div", { className: "space-y-4", children: /* @__PURE__ */ t.jsx("div", { children: /* @__PURE__ */ t.jsx(
|
|
1425
|
+
xe,
|
|
1426
|
+
{
|
|
1427
|
+
id: "jsonLD",
|
|
1428
|
+
name: "jsonLD",
|
|
1429
|
+
rows: 3,
|
|
1430
|
+
value: a.jsonLD,
|
|
1431
|
+
onChange: E,
|
|
1432
|
+
placeholder: "Enter JSON-LD"
|
|
1433
|
+
}
|
|
1434
|
+
) }) }) })
|
|
1435
|
+
] })
|
|
1436
|
+
] }) }),
|
|
1437
|
+
/* @__PURE__ */ t.jsx("div", { className: "w-full flex items-center justify-end mt-4", children: /* @__PURE__ */ t.jsx(
|
|
1438
|
+
B,
|
|
1439
|
+
{
|
|
1440
|
+
size: "lg",
|
|
1441
|
+
variant: "default",
|
|
1442
|
+
onClick: h,
|
|
1443
|
+
disabled: Fe(w.current.initial, a) || m,
|
|
1444
|
+
children: g ? "Saving..." : "Save"
|
|
1445
|
+
}
|
|
1446
|
+
) })
|
|
1447
|
+
] });
|
|
1448
|
+
};
|
|
1449
|
+
At.displayName = "SeoPanel";
|
|
1450
|
+
const $a = ({
|
|
1451
|
+
langProps: r,
|
|
1452
|
+
onClose: i,
|
|
1453
|
+
languagePages: o
|
|
1454
|
+
}) => {
|
|
1455
|
+
const { data: a } = _t(), [s, w] = I(r.edit ? r.name : ""), [c, f] = I(r.edit ? r.lang : ""), [u, p] = I(r.edit ? r.slug : ""), { mutate: g, isPending: m } = Rt(), { mutate: h, isPending: S } = Me(), k = m || S, { data: E } = Ot(), F = ae(
|
|
1456
|
+
q(E, "languages") || ["en"],
|
|
1457
|
+
(b) => !se(o, { lang: b }) && b !== q(E, "fallbackLang")
|
|
1458
|
+
), D = () => {
|
|
1459
|
+
r.edit ? h(
|
|
1460
|
+
{
|
|
1461
|
+
name: s,
|
|
1462
|
+
slug: u,
|
|
1463
|
+
lang: c,
|
|
1464
|
+
id: r == null ? void 0 : r.id,
|
|
1465
|
+
primaryPage: r == null ? void 0 : r.primaryPage
|
|
1466
|
+
},
|
|
1467
|
+
{ onSuccess: i }
|
|
1468
|
+
) : g(
|
|
1469
|
+
{
|
|
1470
|
+
name: s,
|
|
1471
|
+
slug: u,
|
|
1472
|
+
lang: c,
|
|
1473
|
+
primaryPage: a == null ? void 0 : a.id
|
|
1474
|
+
},
|
|
1475
|
+
{ onSuccess: i }
|
|
1476
|
+
);
|
|
1477
|
+
};
|
|
1478
|
+
return /* @__PURE__ */ t.jsx(xt, { open: !!r, onOpenChange: i, children: /* @__PURE__ */ t.jsxs(bt, { className: "sm:max-w-[425px]", children: [
|
|
1479
|
+
/* @__PURE__ */ t.jsxs(yt, { children: [
|
|
1480
|
+
/* @__PURE__ */ t.jsx(jt, { children: r.edit ? "Edit language" : "Add New language" }),
|
|
1481
|
+
/* @__PURE__ */ t.jsx(wt, { children: "Enter the details for the language" })
|
|
1482
|
+
] }),
|
|
1483
|
+
/* @__PURE__ */ t.jsxs("form", { children: [
|
|
1484
|
+
/* @__PURE__ */ t.jsxs("div", { className: "grid gap-4 py-4", children: [
|
|
1485
|
+
/* @__PURE__ */ t.jsxs("div", { className: "space-y-1", children: [
|
|
1486
|
+
/* @__PURE__ */ t.jsx(_, { htmlFor: "lang", className: "text-right", children: "Language" }),
|
|
1487
|
+
/* @__PURE__ */ t.jsxs(
|
|
1488
|
+
"select",
|
|
1489
|
+
{
|
|
1490
|
+
value: c,
|
|
1491
|
+
disabled: r.edit || z(F),
|
|
1492
|
+
onChange: (b) => f(b.target.value),
|
|
1493
|
+
className: "flex h-9 w-full rounded-md border border-border bg-background px-3 py-1 text-sm shadow-sm transition-colors file:border-0 file:bg-transparent file:text-sm file:font-medium placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50 col-span-3",
|
|
1494
|
+
children: [
|
|
1495
|
+
/* @__PURE__ */ t.jsx("option", { value: "", disabled: !0, selected: !0, children: z(F) ? "All available language page is created." : "Choose language" }),
|
|
1496
|
+
Ue(F, (b) => /* @__PURE__ */ t.jsx("option", { value: b, children: q(ye, b, b) }, b))
|
|
1497
|
+
]
|
|
1498
|
+
}
|
|
1499
|
+
)
|
|
1500
|
+
] }),
|
|
1501
|
+
/* @__PURE__ */ t.jsxs("div", { className: "space-y-1", children: [
|
|
1502
|
+
/* @__PURE__ */ t.jsx(_, { htmlFor: "slug", className: "text-right", children: "Page Name" }),
|
|
1503
|
+
/* @__PURE__ */ t.jsx(
|
|
1504
|
+
U,
|
|
1505
|
+
{
|
|
1506
|
+
id: "name",
|
|
1507
|
+
value: s,
|
|
1508
|
+
onChange: (b) => w(b.target.value),
|
|
1509
|
+
className: "col-span-3",
|
|
1510
|
+
required: !0,
|
|
1511
|
+
placeholder: "Enter page name"
|
|
1512
|
+
}
|
|
1513
|
+
)
|
|
1514
|
+
] }),
|
|
1515
|
+
/* @__PURE__ */ t.jsxs("div", { className: "space-y-1", children: [
|
|
1516
|
+
/* @__PURE__ */ t.jsxs(_, { htmlFor: "slug", className: "text-right", children: [
|
|
1517
|
+
"Slug",
|
|
1518
|
+
" ",
|
|
1519
|
+
/* @__PURE__ */ t.jsx("small", { className: "font-light", children: "(Slug should start with /)" })
|
|
1520
|
+
] }),
|
|
1521
|
+
/* @__PURE__ */ t.jsx(
|
|
1522
|
+
U,
|
|
1523
|
+
{
|
|
1524
|
+
id: "slug",
|
|
1525
|
+
value: u,
|
|
1526
|
+
onChange: (b) => p(Pa(_a(b.target.value))),
|
|
1527
|
+
className: "col-span-3",
|
|
1528
|
+
required: !0,
|
|
1529
|
+
pattern: "^/.*",
|
|
1530
|
+
title: "Slug must start with /",
|
|
1531
|
+
placeholder: "Enter page slug"
|
|
1532
|
+
}
|
|
1533
|
+
)
|
|
1534
|
+
] })
|
|
1535
|
+
] }),
|
|
1536
|
+
/* @__PURE__ */ t.jsx(St, { children: /* @__PURE__ */ t.jsx(
|
|
1537
|
+
B,
|
|
1538
|
+
{
|
|
1539
|
+
onClick: D,
|
|
1540
|
+
type: "button",
|
|
1541
|
+
disabled: k || !c || !u || !u.startsWith("/"),
|
|
1542
|
+
children: k ? r.edit ? "Updating..." : "Adding..." : r.edit ? "Update" : "Add new language"
|
|
1543
|
+
}
|
|
1544
|
+
) })
|
|
1545
|
+
] })
|
|
1546
|
+
] }) });
|
|
1547
|
+
}, Ka = () => {
|
|
1548
|
+
const [r, i] = I(null), { selectedLang: o, fallbackLang: a, setSelectedLang: s, languages: w } = Be(), { data: c, isFetching: f } = qe(), { mutate: u, isPending: p } = Dt();
|
|
1549
|
+
return /* @__PURE__ */ t.jsxs("div", { className: "space-y-4 pt-2", children: [
|
|
1550
|
+
/* @__PURE__ */ t.jsxs("ul", { className: "space-y-2 mt-4", children: [
|
|
1551
|
+
f && /* @__PURE__ */ t.jsxs("div", { className: "w-full space-y-3 py-4", children: [
|
|
1552
|
+
/* @__PURE__ */ t.jsx("div", { className: "w-full h-8 rounded bg-gray-300 animate-pulse" }),
|
|
1553
|
+
/* @__PURE__ */ t.jsx("div", { className: "w-full h-8 rounded bg-gray-300 animate-pulse" }),
|
|
1554
|
+
/* @__PURE__ */ t.jsx("div", { className: "w-full h-8 rounded bg-gray-300 animate-pulse" })
|
|
1555
|
+
] }),
|
|
1556
|
+
Ue(c, (g) => {
|
|
1557
|
+
const m = g.lang, h = g.slug, S = !g.primaryPage, k = m === o;
|
|
1558
|
+
return S ? null : /* @__PURE__ */ t.jsxs(t.Fragment, { children: [
|
|
1559
|
+
/* @__PURE__ */ t.jsxs(
|
|
1560
|
+
"li",
|
|
1561
|
+
{
|
|
1562
|
+
className: `w-full p-2 rounded cursor-pointer flex items-center justify-between ${k ? "bg-gray-200" : "hover:bg-gray-100"}`,
|
|
1563
|
+
onClick: () => s(m),
|
|
1564
|
+
children: [
|
|
1565
|
+
/* @__PURE__ */ t.jsxs("div", { className: " flex-1 gap-x-3", children: [
|
|
1566
|
+
/* @__PURE__ */ t.jsx("div", { className: "text-[13px]", children: q(ye, S ? a : m, m) }),
|
|
1567
|
+
/* @__PURE__ */ t.jsxs("div", { children: [
|
|
1568
|
+
/* @__PURE__ */ t.jsxs("div", { className: "text-[11px] text-gray-500", children: [
|
|
1569
|
+
"Slug:",
|
|
1570
|
+
/* @__PURE__ */ t.jsxs("b", { children: [
|
|
1571
|
+
" ",
|
|
1572
|
+
h
|
|
1573
|
+
] })
|
|
1574
|
+
] }),
|
|
1575
|
+
/* @__PURE__ */ t.jsxs("div", { className: "text-[11px] text-gray-500", children: [
|
|
1576
|
+
"Name:",
|
|
1577
|
+
/* @__PURE__ */ t.jsxs("b", { children: [
|
|
1578
|
+
" ",
|
|
1579
|
+
g.name,
|
|
1580
|
+
" "
|
|
1581
|
+
] })
|
|
1582
|
+
] })
|
|
1583
|
+
] })
|
|
1584
|
+
] }),
|
|
1585
|
+
S ? /* @__PURE__ */ t.jsxs("div", { className: "flex items-center text-[11px] text-orange-500 gap-x-1", children: [
|
|
1586
|
+
/* @__PURE__ */ t.jsx(wa, { fill: "orange", className: "w-3 h-3" }),
|
|
1587
|
+
/* @__PURE__ */ t.jsx("b", { children: " Default" })
|
|
1588
|
+
] }) : /* @__PURE__ */ t.jsxs("div", { className: "flex items-center gap-x-3", children: [
|
|
1589
|
+
/* @__PURE__ */ t.jsx(
|
|
1590
|
+
Et,
|
|
1591
|
+
{
|
|
1592
|
+
onClick: (E) => {
|
|
1593
|
+
E.stopPropagation(), i({ ...g, edit: !0 });
|
|
1594
|
+
},
|
|
1595
|
+
className: "w-3 h-3 hover:text-blue-500"
|
|
1596
|
+
}
|
|
1597
|
+
),
|
|
1598
|
+
/* @__PURE__ */ t.jsxs(gt, { children: [
|
|
1599
|
+
/* @__PURE__ */ t.jsx(mt, { children: /* @__PURE__ */ t.jsx(Ct, { className: "w-3 h-3 hover:text-red-500" }) }),
|
|
1600
|
+
/* @__PURE__ */ t.jsx(vt, { children: /* @__PURE__ */ t.jsxs("div", { children: [
|
|
1601
|
+
/* @__PURE__ */ t.jsxs("p", { className: "pb-2 text-sm", children: [
|
|
1602
|
+
"Are you sure you want to remove",
|
|
1603
|
+
" ",
|
|
1604
|
+
/* @__PURE__ */ t.jsx("b", { children: q(ye, m, m) }),
|
|
1605
|
+
" language?"
|
|
1606
|
+
] }),
|
|
1607
|
+
/* @__PURE__ */ t.jsx("div", { className: "flex items-center justify-end w-full", children: /* @__PURE__ */ t.jsx(
|
|
1608
|
+
B,
|
|
1609
|
+
{
|
|
1610
|
+
size: "sm",
|
|
1611
|
+
variant: "destructive",
|
|
1612
|
+
disabled: p,
|
|
1613
|
+
onClick: () => u(g),
|
|
1614
|
+
children: p ? "Deleting..." : "Delete"
|
|
1615
|
+
}
|
|
1616
|
+
) })
|
|
1617
|
+
] }) })
|
|
1618
|
+
] })
|
|
1619
|
+
] })
|
|
1620
|
+
]
|
|
1621
|
+
},
|
|
1622
|
+
g.id
|
|
1623
|
+
),
|
|
1624
|
+
/* @__PURE__ */ t.jsx("div", { className: "h-1 w-full border-b" })
|
|
1625
|
+
] });
|
|
1626
|
+
})
|
|
1627
|
+
] }),
|
|
1628
|
+
/* @__PURE__ */ t.jsx("div", { className: "flex justify-center w-full", children: ((c == null ? void 0 : c.length) || 0) >= w.length && /* @__PURE__ */ t.jsx(
|
|
1629
|
+
B,
|
|
1630
|
+
{
|
|
1631
|
+
variant: "default",
|
|
1632
|
+
size: "sm",
|
|
1633
|
+
onClick: () => i({ name: "", lang: "", slug: "", edit: !1 }),
|
|
1634
|
+
children: "+ Add new language"
|
|
1635
|
+
}
|
|
1636
|
+
) }),
|
|
1637
|
+
r && /* @__PURE__ */ t.jsx(
|
|
1638
|
+
$a,
|
|
1639
|
+
{
|
|
1640
|
+
langProps: r,
|
|
1641
|
+
languagePages: c,
|
|
1642
|
+
onClose: () => i(null)
|
|
1643
|
+
}
|
|
1644
|
+
)
|
|
1645
|
+
] });
|
|
1646
|
+
}, Va = ({
|
|
1647
|
+
activePage: r,
|
|
1648
|
+
editPage: i,
|
|
1649
|
+
onShowUpsertPage: o
|
|
1650
|
+
}) => {
|
|
1651
|
+
const [a, s] = I("pages"), { data: w, isFetching: c } = Ge(), { mutate: f, isPending: u } = Dt(), p = (g) => Oa(
|
|
1652
|
+
ae(g, (h) => a === "pages" ? h.slug : !h.slug),
|
|
1653
|
+
"name",
|
|
1654
|
+
"asc"
|
|
1655
|
+
).map((h) => /* @__PURE__ */ t.jsxs(
|
|
1656
|
+
B,
|
|
1657
|
+
{
|
|
1658
|
+
onClick: () => i(h.id),
|
|
1659
|
+
variant: h.id === r ? "default" : "ghost",
|
|
1660
|
+
className: "flex justify-between items-center w-full space-x-2 py-1",
|
|
1661
|
+
children: [
|
|
1662
|
+
/* @__PURE__ */ t.jsxs("div", { className: "flex items-center space-x-2", children: [
|
|
1663
|
+
h.global ? /* @__PURE__ */ t.jsx(Nt, { className: "h-4 w-4" }) : /* @__PURE__ */ t.jsx(kt, { className: "h-4 w-4" }),
|
|
1664
|
+
/* @__PURE__ */ t.jsx("span", { children: h.name ?? h.slug }),
|
|
1665
|
+
(h == null ? void 0 : h.slug) && /* @__PURE__ */ t.jsxs("span", { className: "text-xs font-light", children: [
|
|
1666
|
+
"( ",
|
|
1667
|
+
h.slug,
|
|
1668
|
+
" )"
|
|
1669
|
+
] })
|
|
1670
|
+
] }),
|
|
1671
|
+
/* @__PURE__ */ t.jsxs("div", { className: "flex items-center space-x-4", children: [
|
|
1672
|
+
/* @__PURE__ */ t.jsx(
|
|
1673
|
+
Et,
|
|
1674
|
+
{
|
|
1675
|
+
className: "h-3 w-3 hover:text-blue-500",
|
|
1676
|
+
onClick: (S) => {
|
|
1677
|
+
S.stopPropagation(), o({ ...h, global: a === "globalBlocks" });
|
|
1678
|
+
}
|
|
1679
|
+
}
|
|
1680
|
+
),
|
|
1681
|
+
/* @__PURE__ */ t.jsxs(gt, { children: [
|
|
1682
|
+
/* @__PURE__ */ t.jsx(mt, { onClick: (S) => S.stopPropagation(), children: /* @__PURE__ */ t.jsx(Ct, { className: "w-3 h-3 hover:text-red-500" }) }),
|
|
1683
|
+
/* @__PURE__ */ t.jsx(vt, { children: /* @__PURE__ */ t.jsxs("div", { children: [
|
|
1684
|
+
/* @__PURE__ */ t.jsxs("p", { className: "pb-2 text-sm", children: [
|
|
1685
|
+
"Are you sure you want to remove",
|
|
1686
|
+
" ",
|
|
1687
|
+
/* @__PURE__ */ t.jsx("b", { children: h.name ?? (h == null ? void 0 : h.slug) }),
|
|
1688
|
+
" ",
|
|
1689
|
+
h.global ? "global block?" : "page? This will also delete all associated language pages."
|
|
1690
|
+
] }),
|
|
1691
|
+
/* @__PURE__ */ t.jsx("div", { className: "flex items-center justify-end w-full", children: /* @__PURE__ */ t.jsx(
|
|
1692
|
+
B,
|
|
1693
|
+
{
|
|
1694
|
+
size: "sm",
|
|
1695
|
+
variant: "destructive",
|
|
1696
|
+
disabled: u,
|
|
1697
|
+
onClick: (S) => {
|
|
1698
|
+
S.stopPropagation(), f(h);
|
|
1699
|
+
},
|
|
1700
|
+
children: u ? "Deleting..." : "Delete"
|
|
1701
|
+
}
|
|
1702
|
+
) })
|
|
1703
|
+
] }) })
|
|
1704
|
+
] })
|
|
1705
|
+
] })
|
|
1706
|
+
]
|
|
1707
|
+
},
|
|
1708
|
+
h.id
|
|
1709
|
+
));
|
|
1710
|
+
return /* @__PURE__ */ t.jsxs(t.Fragment, { children: [
|
|
1711
|
+
/* @__PURE__ */ t.jsx("br", {}),
|
|
1712
|
+
/* @__PURE__ */ t.jsxs(ma, { value: a, className: "w-full", onValueChange: s, children: [
|
|
1713
|
+
/* @__PURE__ */ t.jsxs(va, { className: "w-full", children: [
|
|
1714
|
+
/* @__PURE__ */ t.jsx(ut, { value: "pages", className: "w-full", children: /* @__PURE__ */ t.jsx("div", { className: "px-4", children: "Pages" }) }),
|
|
1715
|
+
/* @__PURE__ */ t.jsx(ut, { value: "globalBlocks", className: "w-full", children: /* @__PURE__ */ t.jsx("div", { className: "px-4", children: "Global Blocks" }) })
|
|
1716
|
+
] }),
|
|
1717
|
+
c ? /* @__PURE__ */ t.jsxs("div", { className: "w-full space-y-3 py-4", children: [
|
|
1718
|
+
/* @__PURE__ */ t.jsx("div", { className: "w-full h-8 rounded bg-gray-300 animate-pulse" }),
|
|
1719
|
+
/* @__PURE__ */ t.jsx("div", { className: "w-full h-8 rounded bg-gray-300 animate-pulse" }),
|
|
1720
|
+
/* @__PURE__ */ t.jsx("div", { className: "w-full h-8 rounded bg-gray-300 animate-pulse" })
|
|
1721
|
+
] }) : /* @__PURE__ */ t.jsxs("div", { className: "py-4 space-y-3", children: [
|
|
1722
|
+
/* @__PURE__ */ t.jsx(xa, { children: /* @__PURE__ */ t.jsxs(ba, { className: "text-xs text-muted-foreground text-center text-light", children: [
|
|
1723
|
+
"Manage your ",
|
|
1724
|
+
a === "pages" ? "pages" : "global blocks"
|
|
1725
|
+
] }) }),
|
|
1726
|
+
/* @__PURE__ */ t.jsx("div", { className: "w-full flex justify-center", children: /* @__PURE__ */ t.jsxs(
|
|
1727
|
+
B,
|
|
1728
|
+
{
|
|
1729
|
+
variant: "default",
|
|
1730
|
+
size: "sm",
|
|
1731
|
+
disabled: c,
|
|
1732
|
+
onClick: () => o({
|
|
1733
|
+
slug: "",
|
|
1734
|
+
name: "",
|
|
1735
|
+
global: a === "globalBlocks"
|
|
1736
|
+
}),
|
|
1737
|
+
className: "mb-4 w-1/2 bg-blue-500 hover:bg-blue-400",
|
|
1738
|
+
children: [
|
|
1739
|
+
/* @__PURE__ */ t.jsx(Sa, { className: "h-4 w-4 mr-2" }),
|
|
1740
|
+
c ? "Loading..." : `Add new ${a === "pages" ? "page" : "global block"}`
|
|
1741
|
+
]
|
|
1742
|
+
}
|
|
1743
|
+
) }),
|
|
1744
|
+
/* @__PURE__ */ t.jsx("div", { className: "pt-4", children: /* @__PURE__ */ t.jsx("div", { className: "space-y-2", children: c ? /* @__PURE__ */ t.jsx("div", { className: "h-32 w-full flex justify-center items-center text-sm animate-pulse", children: "Loading..." }) : p(w) }) })
|
|
1745
|
+
] })
|
|
1746
|
+
] })
|
|
1747
|
+
] });
|
|
1748
|
+
}, Wa = ({
|
|
1749
|
+
editPage: r,
|
|
1750
|
+
showUpsertPage: i,
|
|
1751
|
+
setShowUpsertPage: o
|
|
1752
|
+
}) => {
|
|
1753
|
+
const a = i.id, [s, w] = I(a && i.name || ""), [c, f] = I(a && i.slug || ""), { mutate: u, isPending: p } = Rt(), { mutate: g, isPending: m } = Me(), h = p || m, S = () => {
|
|
1754
|
+
a ? g(
|
|
1755
|
+
{
|
|
1756
|
+
name: s,
|
|
1757
|
+
slug: c,
|
|
1758
|
+
id: i.id,
|
|
1759
|
+
global: !!i.global
|
|
1760
|
+
},
|
|
1761
|
+
{
|
|
1762
|
+
onSuccess: () => {
|
|
1763
|
+
o(void 0);
|
|
1764
|
+
}
|
|
1765
|
+
}
|
|
1766
|
+
) : u(
|
|
1767
|
+
{
|
|
1768
|
+
name: s,
|
|
1769
|
+
slug: c,
|
|
1770
|
+
global: !!i.global
|
|
1771
|
+
},
|
|
1772
|
+
{
|
|
1773
|
+
onSuccess: (k) => {
|
|
1774
|
+
r(k.id);
|
|
1775
|
+
}
|
|
1776
|
+
}
|
|
1777
|
+
);
|
|
1778
|
+
};
|
|
1779
|
+
return /* @__PURE__ */ t.jsx(
|
|
1780
|
+
xt,
|
|
1781
|
+
{
|
|
1782
|
+
open: !!i,
|
|
1783
|
+
onOpenChange: () => o(void 0),
|
|
1784
|
+
children: /* @__PURE__ */ t.jsxs(bt, { className: "sm:max-w-[425px]", children: [
|
|
1785
|
+
/* @__PURE__ */ t.jsxs(yt, { children: [
|
|
1786
|
+
/* @__PURE__ */ t.jsxs(jt, { children: [
|
|
1787
|
+
a ? "Edit" : "Add New",
|
|
1788
|
+
" ",
|
|
1789
|
+
i.global ? "Global Block" : "Page"
|
|
1790
|
+
] }),
|
|
1791
|
+
/* @__PURE__ */ t.jsxs(wt, { children: [
|
|
1792
|
+
"Enter the details for the new",
|
|
1793
|
+
" ",
|
|
1794
|
+
i.global ? "global block. Identifier should be unique." : "page. Slug must start with /"
|
|
1795
|
+
] })
|
|
1796
|
+
] }),
|
|
1797
|
+
/* @__PURE__ */ t.jsxs("form", { children: [
|
|
1798
|
+
/* @__PURE__ */ t.jsxs("div", { className: "grid gap-4 py-4", children: [
|
|
1799
|
+
/* @__PURE__ */ t.jsxs("div", { className: "space-y-1", children: [
|
|
1800
|
+
/* @__PURE__ */ t.jsx(_, { htmlFor: "name", className: "text-right", children: "Name" }),
|
|
1801
|
+
/* @__PURE__ */ t.jsx(
|
|
1802
|
+
U,
|
|
1803
|
+
{
|
|
1804
|
+
id: "name",
|
|
1805
|
+
value: s,
|
|
1806
|
+
placeholder: `Enter ${i.global ? "global block" : "page"} name`,
|
|
1807
|
+
onChange: (k) => w(k.target.value),
|
|
1808
|
+
className: "col-span-3",
|
|
1809
|
+
required: !0
|
|
1810
|
+
}
|
|
1811
|
+
)
|
|
1812
|
+
] }),
|
|
1813
|
+
!i.global && /* @__PURE__ */ t.jsxs("div", { className: "space-y-1", children: [
|
|
1814
|
+
/* @__PURE__ */ t.jsx(_, { htmlFor: "slug", className: "text-right", children: i.global ? "Identifier" : "Slug" }),
|
|
1815
|
+
/* @__PURE__ */ t.jsx(
|
|
1816
|
+
U,
|
|
1817
|
+
{
|
|
1818
|
+
id: "slug",
|
|
1819
|
+
value: c,
|
|
1820
|
+
onChange: (k) => {
|
|
1821
|
+
var E;
|
|
1822
|
+
return f((E = k.target.value) == null ? void 0 : E.trim().toLowerCase());
|
|
1823
|
+
},
|
|
1824
|
+
className: "col-span-3",
|
|
1825
|
+
required: !0,
|
|
1826
|
+
pattern: "^/.*",
|
|
1827
|
+
title: "Slug must start with /",
|
|
1828
|
+
placeholder: "Enter page slug"
|
|
1829
|
+
}
|
|
1830
|
+
)
|
|
1831
|
+
] })
|
|
1832
|
+
] }),
|
|
1833
|
+
/* @__PURE__ */ t.jsx(St, { children: /* @__PURE__ */ t.jsx(
|
|
1834
|
+
B,
|
|
1835
|
+
{
|
|
1836
|
+
onClick: S,
|
|
1837
|
+
type: "button",
|
|
1838
|
+
disabled: h || !s || !i.global && !c.startsWith("/") || Fe(i.name, s) && Fe(i.slug, c),
|
|
1839
|
+
children: h ? a ? "Updating..." : "Adding..." : i.global ? `${a ? "Update" : "Add"} global block` : `${a ? "Update" : "Add"} Page`
|
|
1840
|
+
}
|
|
1841
|
+
) })
|
|
1842
|
+
] })
|
|
1843
|
+
] })
|
|
1844
|
+
}
|
|
1845
|
+
);
|
|
1846
|
+
};
|
|
1847
|
+
function za(r) {
|
|
1848
|
+
const { activePage: i, canClose: o, open: a, close: s } = r, [, w] = H(), [c, f] = I(), u = (p) => {
|
|
1849
|
+
window.history.pushState({}, "", `?page=${p}`), w(new URLSearchParams({ page: p })), window.dispatchEvent(new PopStateEvent("popstate")), f(void 0), s();
|
|
1850
|
+
};
|
|
1851
|
+
return /* @__PURE__ */ t.jsx(
|
|
1852
|
+
ya,
|
|
1853
|
+
{
|
|
1854
|
+
open: a,
|
|
1855
|
+
onOpenChange: (p) => {
|
|
1856
|
+
!p && o && s();
|
|
1857
|
+
},
|
|
1858
|
+
children: /* @__PURE__ */ t.jsxs(
|
|
1859
|
+
ja,
|
|
1860
|
+
{
|
|
1861
|
+
side: "left",
|
|
1862
|
+
className: `border-border w-full ${o ? "" : "sheet-hide-close-btn"}`,
|
|
1863
|
+
children: [
|
|
1864
|
+
/* @__PURE__ */ t.jsx("div", { children: /* @__PURE__ */ t.jsx(
|
|
1865
|
+
Va,
|
|
1866
|
+
{
|
|
1867
|
+
onShowUpsertPage: (p) => f(p),
|
|
1868
|
+
activePage: i,
|
|
1869
|
+
editPage: u
|
|
1870
|
+
}
|
|
1871
|
+
) }),
|
|
1872
|
+
c && /* @__PURE__ */ t.jsx(
|
|
1873
|
+
Wa,
|
|
1874
|
+
{
|
|
1875
|
+
editPage: u,
|
|
1876
|
+
showUpsertPage: c,
|
|
1877
|
+
setShowUpsertPage: f
|
|
1878
|
+
}
|
|
1879
|
+
)
|
|
1880
|
+
]
|
|
1881
|
+
}
|
|
1882
|
+
)
|
|
1883
|
+
}
|
|
1884
|
+
);
|
|
1885
|
+
}
|
|
1886
|
+
ua();
|
|
1887
|
+
const Ja = (r) => {
|
|
1888
|
+
var ce;
|
|
1889
|
+
const [i] = H(), o = i.get("page"), { data: a, isFetching: s } = _t(), { data: w } = Ia(), { data: c } = Tt(), { blocks: f, theme: u } = Ba(c), { data: p } = Ot(), { data: g } = qe(), m = Fa(), { uploadFile: h } = Ga(), { getUILibraryBlock: S, getUILibraryBlocks: k, onSave: E } = La(), { getGlobalBlocks: F, getGlobalBlockBlocks: D } = Ua(), { mutate: b, isPending: ie } = qa(), { aiContext: Q, updateAiContext: we } = Pt(), [Se, oe] = I(!1), [K, le] = I("SAVED");
|
|
1890
|
+
Ie(() => {
|
|
1891
|
+
const O = (T) => {
|
|
1892
|
+
K === "UNSAVED" && (T.preventDefault(), T.returnValue = !1);
|
|
1893
|
+
};
|
|
1894
|
+
return K === "UNSAVED" && window.addEventListener("beforeunload", O), () => {
|
|
1895
|
+
window.removeEventListener("beforeunload", O);
|
|
1896
|
+
};
|
|
1897
|
+
}, [K]);
|
|
1898
|
+
const Ee = je(() => {
|
|
1899
|
+
const O = {};
|
|
1900
|
+
return p != null && p.theme && (O.brandingOptions = p.theme), O;
|
|
1901
|
+
}, [p]);
|
|
1902
|
+
return /* @__PURE__ */ t.jsxs(t.Fragment, { children: [
|
|
1903
|
+
/* @__PURE__ */ t.jsx(
|
|
1904
|
+
ha,
|
|
1905
|
+
{
|
|
1906
|
+
fallbackLang: r.fallbackLang || "en",
|
|
1907
|
+
languages: Ue(g, "lang") || [],
|
|
1908
|
+
translations: r.translations || {},
|
|
1909
|
+
locale: r.locale || "en",
|
|
1910
|
+
htmlDir: r.htmlDir || "ltr",
|
|
1911
|
+
autoSaveSupport: r.autoSaveSupport || !1,
|
|
1912
|
+
autoSaveInterval: r.autoSaveInterval || 15,
|
|
1913
|
+
uploadMediaCallback: h,
|
|
1914
|
+
onError: r.onError || console.error,
|
|
1915
|
+
getGlobalBlockBlocks: D,
|
|
1916
|
+
getGlobalBlocks: F,
|
|
1917
|
+
blocks: f,
|
|
1918
|
+
getUILibraryBlock: S,
|
|
1919
|
+
getUILibraryBlocks: k,
|
|
1920
|
+
brandingOptions: u,
|
|
1921
|
+
uiLibraries: w,
|
|
1922
|
+
saveAiContextCallback: async (O) => (await we({ page: o, aiContext: O }), !0),
|
|
1923
|
+
onSaveStateChange: (O) => le(O),
|
|
1924
|
+
aiContext: Q,
|
|
1925
|
+
askAiCallBack: m,
|
|
1926
|
+
onSave: async ({ blocks: O, themeConfiguration: T }) => {
|
|
1927
|
+
if (!o) return !0;
|
|
1928
|
+
const G = {
|
|
1929
|
+
_type: "@chai/theme",
|
|
1930
|
+
_value: T
|
|
1931
|
+
}, M = {
|
|
1932
|
+
_type: "@chai/ai-context",
|
|
1933
|
+
_value: Ae(Q) ? Q : ""
|
|
1934
|
+
}, ue = [...O, G, M];
|
|
1935
|
+
return await E({ page: o, blocks: ue }), !0;
|
|
1936
|
+
},
|
|
1937
|
+
topBarComponents: {
|
|
1938
|
+
left: [
|
|
1939
|
+
() => /* @__PURE__ */ t.jsxs(
|
|
1940
|
+
B,
|
|
1941
|
+
{
|
|
1942
|
+
variant: "default",
|
|
1943
|
+
className: "flex justify-start max-w-[250px] items-center w-full space-x-2 py-1",
|
|
1944
|
+
onClick: () => oe(!0),
|
|
1945
|
+
children: [
|
|
1946
|
+
be(a.slug, "/") ? /* @__PURE__ */ t.jsx(kt, { className: "h-4 w-4" }) : /* @__PURE__ */ t.jsx(Nt, { className: "h-4 w-4" }),
|
|
1947
|
+
/* @__PURE__ */ t.jsx("span", { className: "truncate", children: (a == null ? void 0 : a.name) ?? "" }),
|
|
1948
|
+
/* @__PURE__ */ t.jsx(Ea, { className: "h-4 w-4" })
|
|
1949
|
+
]
|
|
1950
|
+
},
|
|
1951
|
+
"template-viewer"
|
|
1952
|
+
)
|
|
1953
|
+
],
|
|
1954
|
+
right: [
|
|
1955
|
+
() => /* @__PURE__ */ t.jsxs(
|
|
1956
|
+
B,
|
|
1957
|
+
{
|
|
1958
|
+
disabled: ie || K !== "SAVED",
|
|
1959
|
+
size: "sm",
|
|
1960
|
+
variant: "default",
|
|
1961
|
+
onClick: () => b(o),
|
|
1962
|
+
children: [
|
|
1963
|
+
/* @__PURE__ */ t.jsx(Ca, { className: "h-4 w-4" }),
|
|
1964
|
+
" ",
|
|
1965
|
+
" ",
|
|
1966
|
+
ie ? "Publishing..." : "Publish"
|
|
1967
|
+
]
|
|
1968
|
+
}
|
|
1969
|
+
)
|
|
1970
|
+
]
|
|
1971
|
+
},
|
|
1972
|
+
sideBarComponents: {
|
|
1973
|
+
top: [
|
|
1974
|
+
...be(a.slug, "/") ? [
|
|
1975
|
+
{
|
|
1976
|
+
label: "SEO Setting",
|
|
1977
|
+
component: At,
|
|
1978
|
+
icon: /* @__PURE__ */ t.jsx(t.Fragment, { children: /* @__PURE__ */ t.jsxs(
|
|
1979
|
+
"svg",
|
|
1980
|
+
{
|
|
1981
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
1982
|
+
viewBox: "0 0 21 21",
|
|
1983
|
+
fill: "currentColor",
|
|
1984
|
+
width: "21",
|
|
1985
|
+
height: "21",
|
|
1986
|
+
children: [
|
|
1987
|
+
/* @__PURE__ */ t.jsx("path", { d: "M9.931 6.818c-1.238 0-2.136.925-2.136 2.2 0 1.279.898 2.207 2.136 2.207.664 0 1.257-.246 1.67-.694a.15.15 0 0 0-.009-.213l-.311-.286a.15.15 0 0 0-.213.009c-.273.297-.677.46-1.137.46-.699 0-1.233-.444-1.375-1.12h3.295a.15.15 0 0 0 .151-.151v-.211c0-1.295-.852-2.2-2.072-2.2m0 .724c.697 0 1.188.422 1.315 1.113h-2.69c.142-.673.676-1.113 1.374-1.113m4.332-.724c-1.246 0-2.15.925-2.15 2.2 0 1.279.904 2.207 2.15 2.207.596 0 1.143-.223 1.538-.628s.612-.965.612-1.579c0-1.275-.904-2.2-2.15-2.2m0 3.683c-.826 0-1.426-.624-1.426-1.483 0-.855.6-1.475 1.426-1.475s1.426.621 1.426 1.476c0 .423-.144.804-.406 1.073-.258.264-.62.41-1.019.41M6.318 8.71c-.665-.206-.902-.335-.902-.645 0-.47.564-.521.806-.521.29 0 .552.07.801.215a.15.15 0 0 0 .206-.055l.212-.366a.15.15 0 0 0-.055-.206 2.27 2.27 0 0 0-1.165-.312c-.915 0-1.53.501-1.53 1.245 0 .899.816 1.152 1.411 1.336.655.203.812.307.804.53-.016.398-.567.429-.735.429-.386 0-.722-.129-.972-.374q-.043-.042-.107-.043a.15.15 0 0 0-.106.045l-.295.302a.15.15 0 0 0 .002.213c.383.374.908.58 1.478.58.859 0 1.432-.441 1.459-1.125.031-.833-.746-1.074-1.313-1.249" }),
|
|
1988
|
+
/* @__PURE__ */ t.jsx("path", { d: "M20.396 2.049H.604A.604.604 0 0 0 0 2.653v12.7c0 .333.27.604.604.604h6.941c-.266 1.296-.881 1.966-.886 1.971a.604.604 0 0 0 .434 1.024h6.815a.604.604 0 0 0 .434-1.024c-.007-.007-.621-.675-.886-1.971h6.941c.333 0 .604-.27.604-.604V2.652a.604.604 0 0 0-.604-.604m-.604 12.701h-.985v-.17a.604.604 0 0 0-1.208 0v.17h-.63v-.17a.604.604 0 0 0-1.208 0v.17H1.207V3.256h18.585z" })
|
|
1989
|
+
]
|
|
1990
|
+
}
|
|
1991
|
+
) })
|
|
1992
|
+
}
|
|
1993
|
+
] : [],
|
|
1994
|
+
...(ce = r.languages) != null && ce.length && be(a.slug, "/") ? [
|
|
1995
|
+
{
|
|
1996
|
+
label: "Language Pages",
|
|
1997
|
+
component: Ka,
|
|
1998
|
+
icon: /* @__PURE__ */ t.jsx(t.Fragment, { children: /* @__PURE__ */ t.jsx(
|
|
1999
|
+
"svg",
|
|
2000
|
+
{
|
|
2001
|
+
width: "21",
|
|
2002
|
+
height: "21",
|
|
2003
|
+
viewBox: "0 0 21 21",
|
|
2004
|
+
fill: "currentColor",
|
|
2005
|
+
children: /* @__PURE__ */ t.jsxs(
|
|
2006
|
+
"g",
|
|
2007
|
+
{
|
|
2008
|
+
fill: "none",
|
|
2009
|
+
"fill-rule": "evenodd",
|
|
2010
|
+
stroke: "currentColor",
|
|
2011
|
+
"stroke-linecap": "round",
|
|
2012
|
+
"stroke-linejoin": "round",
|
|
2013
|
+
children: [
|
|
2014
|
+
/* @__PURE__ */ t.jsx("path", { d: "M18.5 10.5v-6a2 2 0 0 0-2-2h-6a2 2 0 0 0-2 2v6a2 2 0 0 0 2 2h6a2 2 0 0 0 2-2" }),
|
|
2015
|
+
/* @__PURE__ */ t.jsx("path", { d: "M6.5 8.503h-2a2 2 0 0 0-2 2v6a2 2 0 0 0 2 2h.003l6-.01a2 2 0 0 0 1.997-2V14.5" }),
|
|
2016
|
+
/* @__PURE__ */ t.jsx("path", { d: "M7.5 12.503h-3M9 14l-1 1q-.5.5-2.5 1.5" }),
|
|
2017
|
+
/* @__PURE__ */ t.jsx("path", { d: "M5.5 12.503q.501 1.75 1.5 2.499c1 .749 1.5.999 2.5 1.498m4-12-3 6m3-6 3 6m-1-2h-4" })
|
|
2018
|
+
]
|
|
2019
|
+
}
|
|
2020
|
+
)
|
|
2021
|
+
}
|
|
2022
|
+
) })
|
|
2023
|
+
}
|
|
2024
|
+
] : []
|
|
2025
|
+
]
|
|
2026
|
+
},
|
|
2027
|
+
...Ee
|
|
2028
|
+
}
|
|
2029
|
+
),
|
|
2030
|
+
/* @__PURE__ */ t.jsx(
|
|
2031
|
+
za,
|
|
2032
|
+
{
|
|
2033
|
+
activePage: o || "",
|
|
2034
|
+
canClose: !!o && !z(a),
|
|
2035
|
+
open: !o || !s && z(a) || Se,
|
|
2036
|
+
close: () => oe(!1)
|
|
2037
|
+
}
|
|
2038
|
+
)
|
|
2039
|
+
] });
|
|
2040
|
+
}, ft = new fa({
|
|
2041
|
+
defaultOptions: { queries: { refetchOnWindowFocus: !1 } }
|
|
2042
|
+
}), an = (r) => (ft.setQueryData(["builder_props"], r), /* @__PURE__ */ t.jsx(pa, { client: ft, children: /* @__PURE__ */ t.jsx(Ja, { ...r }) }));
|
|
2043
|
+
export {
|
|
2044
|
+
an as default
|
|
2045
|
+
};
|