webim-adapter 0.3.0 → 0.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/webim-adapter.js +377 -120
- package/build/webim-embed.js +2 -2
- package/build/webim-ssr.js +529 -272
- package/package.json +1 -1
package/build/webim-adapter.js
CHANGED
|
@@ -48,20 +48,20 @@ function p(e) {
|
|
|
48
48
|
color: j,
|
|
49
49
|
inset: M
|
|
50
50
|
})), N.length && (t.boxShadow = N.join(", "));
|
|
51
|
-
let
|
|
51
|
+
let P = (e) => e.type === "blur" ? `blur(${d(e.v ?? 0)})` : e.type === "hue-rotate" ? `hue-rotate(${h(e.v ?? 0)})` : `${e.type}(${e.v ?? 100}%)`, F = (e) => (Array.isArray(e) ? e : []).filter((e) => e && e.on !== !1 && e.type).map(P), { filters: I, backdropFilters: L, filterBlur: R, filterGrayscale: z, filterBrightness: ee, filterContrast: te, filterSaturate: ne } = t;
|
|
52
52
|
delete t.filters, delete t.backdropFilters, delete t.filterBlur, delete t.filterGrayscale, delete t.filterBrightness, delete t.filterContrast, delete t.filterSaturate;
|
|
53
|
-
let
|
|
54
|
-
|
|
55
|
-
let
|
|
56
|
-
|
|
57
|
-
let { textStrokeWidth:
|
|
58
|
-
delete t.textStrokeWidth, delete t.textStrokeColor, (
|
|
59
|
-
let { clipText:
|
|
60
|
-
delete t.clipText,
|
|
61
|
-
let { transitions:
|
|
53
|
+
let B = F(I);
|
|
54
|
+
R !== void 0 && B.push(`blur(${d(R)})`), z !== void 0 && B.push(`grayscale(${z}%)`), ee !== void 0 && B.push(`brightness(${ee}%)`), te !== void 0 && B.push(`contrast(${te}%)`), ne !== void 0 && B.push(`saturate(${ne}%)`), B.length && (t.filter = B.join(" "));
|
|
55
|
+
let V = F(L);
|
|
56
|
+
V.length && (t.backdropFilter = V.join(" "), t.WebkitBackdropFilter = t.backdropFilter);
|
|
57
|
+
let { textStrokeWidth: H, textStrokeColor: U } = t;
|
|
58
|
+
delete t.textStrokeWidth, delete t.textStrokeColor, (H !== void 0 || U !== void 0) && (t.WebkitTextStroke = `${d(H ?? 1)} ${U || "currentColor"}`);
|
|
59
|
+
let { clipText: re } = t;
|
|
60
|
+
delete t.clipText, re && (t.WebkitBackgroundClip = "text", t.backgroundClip = "text", t.WebkitTextFillColor = "transparent");
|
|
61
|
+
let { transitions: W, transitionDuration: ie, transitionEasing: G, transitionProperty: ae } = t, K = (e) => typeof e == "number" || !Number.isNaN(Number(e)) ? `${Number(e)}ms` : e;
|
|
62
62
|
delete t.transitions, delete t.transitionDuration, delete t.transitionEasing, delete t.transitionProperty;
|
|
63
|
-
let q = (Array.isArray(
|
|
64
|
-
if (
|
|
63
|
+
let q = (Array.isArray(W) ? W : []).filter((e) => e && e.on !== !1).map((e) => `${e.property || "all"} ${K(e.duration ?? 200)} ${e.easing || "ease"}`);
|
|
64
|
+
if (ie !== void 0 && q.push(`${ae || "all"} ${K(ie)} ${G || "ease"}`), q.length && (t.transition = q.join(", ")), t.backgroundImage && !String(t.backgroundImage).includes("(") && (t.backgroundImage = `url("${t.backgroundImage}")`), n) {
|
|
65
65
|
let e = `${i || "rgba(0,0,0,0.5)"}, ${a || "transparent"}`, o = n === "radial" ? `radial-gradient(circle, ${e})` : `linear-gradient(${r ?? 180}deg, ${e})`;
|
|
66
66
|
t.backgroundImage = t.backgroundImage ? `${o}, ${t.backgroundImage}` : o;
|
|
67
67
|
}
|
|
@@ -263,7 +263,7 @@ function N(e) {
|
|
|
263
263
|
"--page-secondary-contrast": e.secondary.contrastText
|
|
264
264
|
};
|
|
265
265
|
}
|
|
266
|
-
function
|
|
266
|
+
function P(e) {
|
|
267
267
|
let t = M(e);
|
|
268
268
|
return {
|
|
269
269
|
backgroundColor: "var(--page-bg)",
|
|
@@ -272,19 +272,19 @@ function ee(e) {
|
|
|
272
272
|
"--page-heading-font": t.headingFont === "inherit" ? "inherit" : A(t.headingFont, "inherit")
|
|
273
273
|
};
|
|
274
274
|
}
|
|
275
|
-
function
|
|
275
|
+
function F(e, t = "light") {
|
|
276
276
|
let n = M(e);
|
|
277
277
|
return {
|
|
278
|
-
...
|
|
278
|
+
...P(e),
|
|
279
279
|
...N(n[t] ?? n.light)
|
|
280
280
|
};
|
|
281
281
|
}
|
|
282
|
-
function
|
|
282
|
+
function I(e, t) {
|
|
283
283
|
return e?.themeRef && t?.[e.themeRef] || e?.theme;
|
|
284
284
|
}
|
|
285
285
|
//#endregion
|
|
286
286
|
//#region src/bundle.js
|
|
287
|
-
function
|
|
287
|
+
function L({ page: e, settings: t, tenant: n, apiUrl: r, locale: i }) {
|
|
288
288
|
let a = {
|
|
289
289
|
...t?.global ?? {},
|
|
290
290
|
...t?.tenant ?? {}
|
|
@@ -294,7 +294,7 @@ function te({ page: e, settings: t, tenant: n, apiUrl: r, locale: i }) {
|
|
|
294
294
|
title: e.title,
|
|
295
295
|
slug: e.slug,
|
|
296
296
|
blocks: i && o.i18n?.[i]?.blocks || e.blocks,
|
|
297
|
-
theme:
|
|
297
|
+
theme: I(o, a.builder_themes?.themes),
|
|
298
298
|
components: a.builder_components?.components ?? {},
|
|
299
299
|
custom: o.custom,
|
|
300
300
|
seo: o.seo,
|
|
@@ -305,23 +305,23 @@ function te({ page: e, settings: t, tenant: n, apiUrl: r, locale: i }) {
|
|
|
305
305
|
}
|
|
306
306
|
//#endregion
|
|
307
307
|
//#region src/fetchPage.js
|
|
308
|
-
var
|
|
308
|
+
var R = async (e) => {
|
|
309
309
|
let t = await e.json().catch(() => null);
|
|
310
310
|
if (!e.ok || t?.success === !1) throw Error(t?.error?.message || `Request failed (${e.status})`);
|
|
311
311
|
return t?.payload ?? t;
|
|
312
312
|
};
|
|
313
|
-
async function
|
|
313
|
+
async function z({ apiUrl: e, tenant: t, slug: n, locale: r, preview: i, fetch: a }) {
|
|
314
314
|
if (!e) throw Error("fetchPage: apiUrl is required");
|
|
315
315
|
if (!n) throw Error("fetchPage: slug is required");
|
|
316
|
-
let o = a ?? fetch, s = e.replace(/\/$/, ""), c = t ? { "x-tenant": t } : {}, [l, u] = await Promise.all([o(`${s}/render/${encodeURIComponent(n)}${i ? `?preview=${encodeURIComponent(i)}` : ""}`, { headers: c }).then(
|
|
316
|
+
let o = a ?? fetch, s = e.replace(/\/$/, ""), c = t ? { "x-tenant": t } : {}, [l, u] = await Promise.all([o(`${s}/render/${encodeURIComponent(n)}${i ? `?preview=${encodeURIComponent(i)}` : ""}`, { headers: c }).then(R), o(`${s}/settings/public`, { headers: c }).then(R)]), d = L({
|
|
317
317
|
page: l,
|
|
318
318
|
settings: u,
|
|
319
319
|
tenant: t,
|
|
320
320
|
apiUrl: s,
|
|
321
321
|
locale: r
|
|
322
|
-
}), f = [...new Set(Object.values(d.blocks ?? {}).
|
|
322
|
+
}), f = [...new Set(Object.values(d.blocks ?? {}).map((e) => e?.type?.resolvedName === "CollectionList" ? e.props?.collection : e?.type?.resolvedName === "TableBlock" ? e.props?.source : null).filter(Boolean))];
|
|
323
323
|
if (f.length) {
|
|
324
|
-
let e = (e) => e.startsWith("api:") ? `${s}/data/${encodeURIComponent(e.slice(4))}` : `${s}/dynamic/${encodeURIComponent(e)}${r ? `?locale=${encodeURIComponent(r)}` : ""}`, t = await Promise.all(f.map((t) => o(e(t), { headers: c }).then(
|
|
324
|
+
let e = (e) => e.startsWith("api:") ? `${s}/data/${encodeURIComponent(e.slice(4))}` : `${s}/dynamic/${encodeURIComponent(e)}${r ? `?locale=${encodeURIComponent(r)}` : ""}`, t = await Promise.all(f.map((t) => o(e(t), { headers: c }).then(R).then((e) => [t, Array.isArray(e) ? e : []]).catch(() => [t, []])));
|
|
325
325
|
d.datasets = Object.fromEntries(t);
|
|
326
326
|
}
|
|
327
327
|
return d;
|
|
@@ -432,14 +432,14 @@ new Map([
|
|
|
432
432
|
fallback: "sans-serif"
|
|
433
433
|
}
|
|
434
434
|
].map((e) => [e.family, e]));
|
|
435
|
-
function
|
|
435
|
+
function ee(e) {
|
|
436
436
|
return e.length ? `https://fonts.googleapis.com/css2?${e.map((e) => `family=${e.replace(/ /g, "+")}:wght@100..900`).join("&")}&display=swap` : null;
|
|
437
437
|
}
|
|
438
|
-
var
|
|
438
|
+
var te = (e) => ee([e]), ne = (e) => {
|
|
439
439
|
let t = typeof e == "string" && e.match(/^"([^"]+)"/);
|
|
440
440
|
return t ? t[1] : null;
|
|
441
441
|
};
|
|
442
|
-
function
|
|
442
|
+
function B(e, t) {
|
|
443
443
|
let n = /* @__PURE__ */ new Set(), r = (e) => {
|
|
444
444
|
for (let t of Object.values(e || {})) for (let e of [
|
|
445
445
|
"style",
|
|
@@ -447,7 +447,7 @@ function z(e, t) {
|
|
|
447
447
|
"pressed",
|
|
448
448
|
"focused"
|
|
449
449
|
]) {
|
|
450
|
-
let r =
|
|
450
|
+
let r = ne(t.props?.[e]?.fontFamily);
|
|
451
451
|
r && n.add(r);
|
|
452
452
|
}
|
|
453
453
|
};
|
|
@@ -457,14 +457,14 @@ function z(e, t) {
|
|
|
457
457
|
}
|
|
458
458
|
//#endregion
|
|
459
459
|
//#region ../ui/src/components/builder/views.jsx
|
|
460
|
-
var
|
|
460
|
+
var V = t({
|
|
461
461
|
tenant: "",
|
|
462
462
|
apiUrl: "/api"
|
|
463
|
-
}),
|
|
464
|
-
function
|
|
463
|
+
}), H = t(null), U = t(null), re = (e) => e.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
464
|
+
function W(e, t) {
|
|
465
465
|
if (t) return t.includes(".") ? t.split(".").reduce((e, t) => e && typeof e == "object" ? e[t] : void 0, e) : e?.[t];
|
|
466
466
|
}
|
|
467
|
-
var
|
|
467
|
+
var ie = (e) => {
|
|
468
468
|
let t = [];
|
|
469
469
|
for (let [n, r] of Object.entries(e ?? {})) {
|
|
470
470
|
if (!/^[\w-]+$/.test(n)) continue;
|
|
@@ -478,9 +478,9 @@ function G(e) {
|
|
|
478
478
|
return e == null ? "" : typeof e == "string" || typeof e == "number" || typeof e == "boolean" ? String(e) : Array.isArray(e) ? e.map((e) => typeof e == "string" ? e : Array.isArray(e?.parts) ? e.parts.map((e) => e?.text ?? "").join("") : Array.isArray(e?.items) ? e.items.map((e) => e?.text ?? "").join(" ") : "").filter(Boolean).join(" ") : "";
|
|
479
479
|
}
|
|
480
480
|
function ae(e, t) {
|
|
481
|
-
let n = t?.data ?? {}, r =
|
|
481
|
+
let n = t?.data ?? {}, r = ie(n);
|
|
482
482
|
if (!r.length) return e;
|
|
483
|
-
let i = RegExp(`:(${r.map(
|
|
483
|
+
let i = RegExp(`:(${r.map(re).sort((e, t) => t.length - e.length).join("|")})`, "g"), a = (e) => typeof e == "string" ? e.replace(i, (e, t) => G(W(n, t))) : Array.isArray(e) ? e.map(a) : e && typeof e == "object" ? Object.fromEntries(Object.entries(e).map(([e, t]) => [e, a(t)])) : e;
|
|
484
484
|
return a(e);
|
|
485
485
|
}
|
|
486
486
|
var K = {
|
|
@@ -1452,73 +1452,318 @@ var Ke = {
|
|
|
1452
1452
|
tabIndex: -1,
|
|
1453
1453
|
onMouseDown: (e) => e.preventDefault()
|
|
1454
1454
|
} : {};
|
|
1455
|
-
function Xe(
|
|
1456
|
-
|
|
1455
|
+
function Xe(e, t) {
|
|
1456
|
+
if (!e) return !0;
|
|
1457
|
+
let n = t[e.field], r = n == null || n === "" ? "" : String(n), i = e.value ?? "";
|
|
1458
|
+
switch (e.op) {
|
|
1459
|
+
case "eq": return r === i;
|
|
1460
|
+
case "neq": return r !== i;
|
|
1461
|
+
case "contains": return r.toLowerCase().includes(i.toLowerCase());
|
|
1462
|
+
case "gt": return Number(r) > Number(i);
|
|
1463
|
+
case "lt": return Number(r) < Number(i);
|
|
1464
|
+
case "empty": return r === "";
|
|
1465
|
+
case "notEmpty": return r !== "";
|
|
1466
|
+
default: return !1;
|
|
1467
|
+
}
|
|
1468
|
+
}
|
|
1469
|
+
var Ze = {
|
|
1470
|
+
display: "flex",
|
|
1471
|
+
flexDirection: "column",
|
|
1472
|
+
gap: 6
|
|
1473
|
+
}, Qe = {
|
|
1474
|
+
font: "inherit",
|
|
1475
|
+
fontSize: 15,
|
|
1476
|
+
padding: "10px 12px",
|
|
1477
|
+
borderRadius: 8,
|
|
1478
|
+
border: "1px solid rgba(148, 163, 184, 0.55)",
|
|
1479
|
+
background: "transparent",
|
|
1480
|
+
color: "inherit",
|
|
1481
|
+
width: "100%",
|
|
1482
|
+
boxSizing: "border-box"
|
|
1483
|
+
};
|
|
1484
|
+
function $e({ field: e, value: t, onChange: n, inert: r }) {
|
|
1485
|
+
let i = /* @__PURE__ */ l("span", {
|
|
1486
|
+
style: {
|
|
1487
|
+
...qe,
|
|
1488
|
+
fontSize: 14
|
|
1489
|
+
},
|
|
1490
|
+
children: [e.label, e.required ? " *" : ""]
|
|
1491
|
+
}), a = {
|
|
1492
|
+
name: e.name,
|
|
1493
|
+
required: e.required || void 0,
|
|
1494
|
+
placeholder: e.placeholder || void 0,
|
|
1495
|
+
disabled: r || void 0,
|
|
1496
|
+
style: Qe,
|
|
1497
|
+
value: t ?? "",
|
|
1498
|
+
onChange: (t) => n(e.name, t.target.value)
|
|
1499
|
+
};
|
|
1500
|
+
return e.type === "display" ? /* @__PURE__ */ c(e.variant && e.variant !== "p" ? e.variant : "p", {
|
|
1501
|
+
style: {
|
|
1502
|
+
margin: 0,
|
|
1503
|
+
color: e.color || "inherit",
|
|
1504
|
+
fontSize: {
|
|
1505
|
+
h1: 32,
|
|
1506
|
+
h2: 26,
|
|
1507
|
+
h3: 21,
|
|
1508
|
+
h4: 18,
|
|
1509
|
+
h5: 16,
|
|
1510
|
+
h6: 14,
|
|
1511
|
+
p: 15
|
|
1512
|
+
}[e.variant] ?? 16,
|
|
1513
|
+
fontWeight: e.variant === "p" ? 400 : 700,
|
|
1514
|
+
lineHeight: 1.35
|
|
1515
|
+
},
|
|
1516
|
+
children: e.label
|
|
1517
|
+
}) : e.type === "image" ? e.src ? /* @__PURE__ */ c("img", {
|
|
1518
|
+
src: e.src,
|
|
1519
|
+
alt: e.label ?? "",
|
|
1520
|
+
style: {
|
|
1521
|
+
width: "100%",
|
|
1522
|
+
borderRadius: 8,
|
|
1523
|
+
display: "block"
|
|
1524
|
+
}
|
|
1525
|
+
}) : null : e.type === "video" ? e.src ? /youtube\.com|youtu\.be|vimeo\.com/i.test(e.src) ? /* @__PURE__ */ c(Ae, {
|
|
1526
|
+
url: e.src,
|
|
1527
|
+
style: { width: "100%" }
|
|
1528
|
+
}) : /* @__PURE__ */ c("video", {
|
|
1529
|
+
src: e.src,
|
|
1530
|
+
controls: !0,
|
|
1531
|
+
style: {
|
|
1532
|
+
width: "100%",
|
|
1533
|
+
borderRadius: 8,
|
|
1534
|
+
display: "block"
|
|
1535
|
+
}
|
|
1536
|
+
}) : null : /* @__PURE__ */ l("label", {
|
|
1537
|
+
style: Ze,
|
|
1538
|
+
children: [
|
|
1539
|
+
i,
|
|
1540
|
+
e.type === "textarea" || e.multiline ? /* @__PURE__ */ c("textarea", {
|
|
1541
|
+
...a,
|
|
1542
|
+
rows: 4,
|
|
1543
|
+
style: {
|
|
1544
|
+
...Qe,
|
|
1545
|
+
resize: "vertical"
|
|
1546
|
+
}
|
|
1547
|
+
}) : e.type === "select" ? /* @__PURE__ */ l("select", {
|
|
1548
|
+
...a,
|
|
1549
|
+
children: [/* @__PURE__ */ c("option", {
|
|
1550
|
+
value: "",
|
|
1551
|
+
children: e.placeholder || "—"
|
|
1552
|
+
}), (e.options ?? []).map((e, t) => /* @__PURE__ */ c("option", {
|
|
1553
|
+
value: typeof e == "string" ? e : e.value,
|
|
1554
|
+
children: typeof e == "string" ? e : e.label ?? e.value
|
|
1555
|
+
}, t))]
|
|
1556
|
+
}) : e.type === "checkbox" ? /* @__PURE__ */ c("input", {
|
|
1557
|
+
type: "checkbox",
|
|
1558
|
+
name: e.name,
|
|
1559
|
+
required: e.required || void 0,
|
|
1560
|
+
disabled: r || void 0,
|
|
1561
|
+
checked: !!t,
|
|
1562
|
+
onChange: (t) => n(e.name, t.target.checked),
|
|
1563
|
+
style: {
|
|
1564
|
+
width: 18,
|
|
1565
|
+
height: 18
|
|
1566
|
+
}
|
|
1567
|
+
}) : e.type === "upload" ? /* @__PURE__ */ c("input", {
|
|
1568
|
+
type: "file",
|
|
1569
|
+
name: e.name,
|
|
1570
|
+
accept: e.accept || void 0,
|
|
1571
|
+
required: e.required || void 0,
|
|
1572
|
+
disabled: r || void 0,
|
|
1573
|
+
onChange: (t) => n(e.name, t.target.files?.[0]?.name ?? ""),
|
|
1574
|
+
style: {
|
|
1575
|
+
font: "inherit",
|
|
1576
|
+
fontSize: 14
|
|
1577
|
+
}
|
|
1578
|
+
}) : /* @__PURE__ */ c("input", {
|
|
1579
|
+
...a,
|
|
1580
|
+
type: {
|
|
1581
|
+
email: "email",
|
|
1582
|
+
number: "number",
|
|
1583
|
+
date: "date",
|
|
1584
|
+
datetime: "datetime-local",
|
|
1585
|
+
phone: "tel",
|
|
1586
|
+
link: "url"
|
|
1587
|
+
}[e.type] ?? "text"
|
|
1588
|
+
}),
|
|
1589
|
+
e.help && /* @__PURE__ */ c("span", {
|
|
1590
|
+
style: {
|
|
1591
|
+
fontSize: 12,
|
|
1592
|
+
opacity: .65
|
|
1593
|
+
},
|
|
1594
|
+
children: e.help
|
|
1595
|
+
})
|
|
1596
|
+
]
|
|
1597
|
+
});
|
|
1598
|
+
}
|
|
1599
|
+
function et({ style: e, action: t, method: i, name: a, enctype: u, formSlug: d, auto: f, submitLabel: m, nodeRef: h, inert: g, children: _, linked: v, show: y }) {
|
|
1600
|
+
let { tenant: b, apiUrl: x } = n(V), [S, C] = o("form"), [w, T] = o(null), [E, D] = o({}), [O, k] = o(0), A = g ? y || "form" : S;
|
|
1601
|
+
r(() => {
|
|
1602
|
+
if (!f || !d) return;
|
|
1603
|
+
let e = !0;
|
|
1604
|
+
return fetch(`${x || "/api"}/forms/${encodeURIComponent(d)}`, { headers: b ? { "x-tenant": b } : {} }).then((e) => e.json()).then((t) => e && T(t?.payload ?? null)).catch(() => e && T(null)), () => {
|
|
1605
|
+
e = !1;
|
|
1606
|
+
};
|
|
1607
|
+
}, [
|
|
1608
|
+
f,
|
|
1609
|
+
d,
|
|
1610
|
+
b,
|
|
1611
|
+
x
|
|
1612
|
+
]);
|
|
1613
|
+
let j = [{
|
|
1614
|
+
section: null,
|
|
1615
|
+
fields: []
|
|
1616
|
+
}];
|
|
1617
|
+
for (let e of w?.fields ?? []) e.type === "section" ? j.push({
|
|
1618
|
+
section: e,
|
|
1619
|
+
fields: []
|
|
1620
|
+
}) : j[j.length - 1].fields.push(e);
|
|
1621
|
+
let M = j.filter((e) => e.section || e.fields.length), N = M.filter((e) => !e.section || Xe(e.section.condition, E)).map((e) => ({
|
|
1622
|
+
...e,
|
|
1623
|
+
fields: e.fields.filter((e) => Xe(e.condition, E))
|
|
1624
|
+
})), P = M.length > 1, F = Math.min(O, Math.max(0, N.length - 1)), I = P ? N[F]?.fields ?? [] : N.flatMap((e) => e.fields), L = I.filter((e) => {
|
|
1625
|
+
let t = E[e.name];
|
|
1626
|
+
return e.required && (t == null || t === "" || t === !1);
|
|
1627
|
+
}), R = F >= N.length - 1, z = (e, t) => D((n) => ({
|
|
1628
|
+
...n,
|
|
1629
|
+
[e]: t
|
|
1630
|
+
}));
|
|
1457
1631
|
return /* @__PURE__ */ l("div", {
|
|
1458
|
-
ref:
|
|
1632
|
+
ref: h,
|
|
1459
1633
|
style: p(e),
|
|
1460
1634
|
children: [
|
|
1461
1635
|
/* @__PURE__ */ c("form", {
|
|
1462
1636
|
action: t || void 0,
|
|
1463
|
-
method:
|
|
1464
|
-
name:
|
|
1465
|
-
encType:
|
|
1637
|
+
method: i || "post",
|
|
1638
|
+
name: a || void 0,
|
|
1639
|
+
encType: u || void 0,
|
|
1466
1640
|
onSubmit: async (e) => {
|
|
1467
|
-
if (e.preventDefault(), !
|
|
1468
|
-
if (
|
|
1641
|
+
if (e.preventDefault(), !g) {
|
|
1642
|
+
if (d) {
|
|
1469
1643
|
let t = {};
|
|
1470
|
-
for (let [
|
|
1644
|
+
if (f) for (let [e, n] of Object.entries(E)) n != null && n !== "" && (t[e] = n);
|
|
1645
|
+
else for (let [n, r] of new FormData(e.currentTarget).entries()) typeof r == "string" && (t[n] = r === "on" || r);
|
|
1471
1646
|
try {
|
|
1472
|
-
let e = await fetch(`${
|
|
1647
|
+
let e = await fetch(`${x || "/api"}/forms/${d}/submit`, {
|
|
1473
1648
|
method: "post",
|
|
1474
1649
|
headers: {
|
|
1475
1650
|
"content-type": "application/json",
|
|
1476
|
-
...
|
|
1651
|
+
...b ? { "x-tenant": b } : {}
|
|
1477
1652
|
},
|
|
1478
1653
|
body: JSON.stringify(t)
|
|
1479
1654
|
}), n = await e.json().catch(() => null);
|
|
1480
|
-
|
|
1655
|
+
C(e.ok && n?.success !== !1 ? "success" : "error");
|
|
1481
1656
|
} catch {
|
|
1482
|
-
|
|
1657
|
+
C("error");
|
|
1483
1658
|
}
|
|
1484
1659
|
return;
|
|
1485
1660
|
}
|
|
1486
1661
|
if (!t) {
|
|
1487
|
-
|
|
1662
|
+
C("success");
|
|
1488
1663
|
return;
|
|
1489
1664
|
}
|
|
1490
1665
|
try {
|
|
1491
1666
|
let n = await fetch(t, {
|
|
1492
|
-
method:
|
|
1667
|
+
method: i || "post",
|
|
1493
1668
|
body: new FormData(e.currentTarget)
|
|
1494
1669
|
});
|
|
1495
|
-
|
|
1670
|
+
C(n.ok ? "success" : "error");
|
|
1496
1671
|
} catch {
|
|
1497
|
-
|
|
1672
|
+
C("error");
|
|
1498
1673
|
}
|
|
1499
1674
|
}
|
|
1500
1675
|
},
|
|
1501
1676
|
style: {
|
|
1502
1677
|
...Ke,
|
|
1503
|
-
display:
|
|
1678
|
+
display: A === "success" ? "none" : "flex"
|
|
1504
1679
|
},
|
|
1505
|
-
children: f
|
|
1680
|
+
children: f && d ? /* @__PURE__ */ l(s, { children: [
|
|
1681
|
+
P && /* @__PURE__ */ c(ft, {
|
|
1682
|
+
steps: N.map((e) => ({ label: e.section?.label ?? "Start" })),
|
|
1683
|
+
active: F + 1,
|
|
1684
|
+
style: { marginBottom: 8 }
|
|
1685
|
+
}),
|
|
1686
|
+
P && N[F]?.section?.help && /* @__PURE__ */ c("p", {
|
|
1687
|
+
style: {
|
|
1688
|
+
margin: 0,
|
|
1689
|
+
fontSize: 14,
|
|
1690
|
+
opacity: .7
|
|
1691
|
+
},
|
|
1692
|
+
children: N[F].section.help
|
|
1693
|
+
}),
|
|
1694
|
+
I.map((e) => /* @__PURE__ */ c($e, {
|
|
1695
|
+
field: e,
|
|
1696
|
+
value: E[e.name],
|
|
1697
|
+
onChange: z,
|
|
1698
|
+
inert: g
|
|
1699
|
+
}, e.name)),
|
|
1700
|
+
/* @__PURE__ */ l("div", {
|
|
1701
|
+
style: {
|
|
1702
|
+
display: "flex",
|
|
1703
|
+
gap: 10,
|
|
1704
|
+
alignItems: "center",
|
|
1705
|
+
marginTop: 4
|
|
1706
|
+
},
|
|
1707
|
+
children: [P && F > 0 && /* @__PURE__ */ c("button", {
|
|
1708
|
+
type: "button",
|
|
1709
|
+
disabled: g || void 0,
|
|
1710
|
+
onClick: () => k(F - 1),
|
|
1711
|
+
style: {
|
|
1712
|
+
...J,
|
|
1713
|
+
background: "transparent",
|
|
1714
|
+
color: "inherit",
|
|
1715
|
+
border: 0,
|
|
1716
|
+
padding: "10px 16px",
|
|
1717
|
+
cursor: "pointer"
|
|
1718
|
+
},
|
|
1719
|
+
children: "Back"
|
|
1720
|
+
}), P && !R ? /* @__PURE__ */ c("button", {
|
|
1721
|
+
type: "button",
|
|
1722
|
+
disabled: g || L.length > 0,
|
|
1723
|
+
onClick: () => k(F + 1),
|
|
1724
|
+
style: {
|
|
1725
|
+
...J,
|
|
1726
|
+
border: 0,
|
|
1727
|
+
padding: "10px 22px",
|
|
1728
|
+
borderRadius: 8,
|
|
1729
|
+
fontSize: 15,
|
|
1730
|
+
fontWeight: 600,
|
|
1731
|
+
cursor: "pointer",
|
|
1732
|
+
opacity: L.length ? .5 : 1
|
|
1733
|
+
},
|
|
1734
|
+
children: "Next"
|
|
1735
|
+
}) : /* @__PURE__ */ c("button", {
|
|
1736
|
+
type: "submit",
|
|
1737
|
+
disabled: g || void 0,
|
|
1738
|
+
style: {
|
|
1739
|
+
...J,
|
|
1740
|
+
border: 0,
|
|
1741
|
+
padding: "10px 22px",
|
|
1742
|
+
borderRadius: 8,
|
|
1743
|
+
fontSize: 15,
|
|
1744
|
+
fontWeight: 600,
|
|
1745
|
+
cursor: "pointer"
|
|
1746
|
+
},
|
|
1747
|
+
children: m || "Submit"
|
|
1748
|
+
})]
|
|
1749
|
+
})
|
|
1750
|
+
] }) : _
|
|
1506
1751
|
}),
|
|
1507
1752
|
/* @__PURE__ */ c("div", {
|
|
1508
|
-
style: { display:
|
|
1509
|
-
children:
|
|
1753
|
+
style: { display: A === "success" ? "block" : "none" },
|
|
1754
|
+
children: v?.success ?? null
|
|
1510
1755
|
}),
|
|
1511
1756
|
/* @__PURE__ */ c("div", {
|
|
1512
1757
|
style: {
|
|
1513
|
-
display:
|
|
1758
|
+
display: A === "error" ? "block" : "none",
|
|
1514
1759
|
marginTop: 12
|
|
1515
1760
|
},
|
|
1516
|
-
children:
|
|
1761
|
+
children: v?.error ?? null
|
|
1517
1762
|
})
|
|
1518
1763
|
]
|
|
1519
1764
|
});
|
|
1520
1765
|
}
|
|
1521
|
-
function
|
|
1766
|
+
function tt({ text: e, parts: t, style: n, nodeRef: r, linked: i }) {
|
|
1522
1767
|
return /* @__PURE__ */ c("label", {
|
|
1523
1768
|
ref: r,
|
|
1524
1769
|
style: {
|
|
@@ -1528,7 +1773,7 @@ function Ze({ text: e, parts: t, style: n, nodeRef: r, linked: i }) {
|
|
|
1528
1773
|
children: X(t, e, i)
|
|
1529
1774
|
});
|
|
1530
1775
|
}
|
|
1531
|
-
function
|
|
1776
|
+
function nt({ type: e = "text", name: t, placeholder: n, required: r, style: i, nodeRef: a, inert: o }) {
|
|
1532
1777
|
return /* @__PURE__ */ c("input", {
|
|
1533
1778
|
ref: a,
|
|
1534
1779
|
type: e,
|
|
@@ -1542,7 +1787,7 @@ function Qe({ type: e = "text", name: t, placeholder: n, required: r, style: i,
|
|
|
1542
1787
|
...Ye(o)
|
|
1543
1788
|
});
|
|
1544
1789
|
}
|
|
1545
|
-
function
|
|
1790
|
+
function rt({ name: e, placeholder: t, rows: n = 4, required: r, style: i, nodeRef: a, inert: o }) {
|
|
1546
1791
|
return /* @__PURE__ */ c("textarea", {
|
|
1547
1792
|
ref: a,
|
|
1548
1793
|
name: e || void 0,
|
|
@@ -1557,7 +1802,7 @@ function $e({ name: e, placeholder: t, rows: n = 4, required: r, style: i, nodeR
|
|
|
1557
1802
|
...Ye(o)
|
|
1558
1803
|
});
|
|
1559
1804
|
}
|
|
1560
|
-
function
|
|
1805
|
+
function it({ kind: e = "checkbox", label: t, name: n, value: r, required: i, style: a, nodeRef: o, inert: s }) {
|
|
1561
1806
|
return /* @__PURE__ */ l("label", {
|
|
1562
1807
|
ref: o,
|
|
1563
1808
|
style: {
|
|
@@ -1578,7 +1823,7 @@ function et({ kind: e = "checkbox", label: t, name: n, value: r, required: i, st
|
|
|
1578
1823
|
}), t]
|
|
1579
1824
|
});
|
|
1580
1825
|
}
|
|
1581
|
-
function
|
|
1826
|
+
function at({ name: e, placeholder: t, options: n = [], required: r, style: i, nodeRef: a, inert: o }) {
|
|
1582
1827
|
return /* @__PURE__ */ l("select", {
|
|
1583
1828
|
ref: a,
|
|
1584
1829
|
name: e || void 0,
|
|
@@ -1601,7 +1846,7 @@ function tt({ name: e, placeholder: t, options: n = [], required: r, style: i, n
|
|
|
1601
1846
|
}, t))]
|
|
1602
1847
|
});
|
|
1603
1848
|
}
|
|
1604
|
-
function
|
|
1849
|
+
function ot({ name: e, accept: t, required: n, text: r = "Choose a file…", style: i, nodeRef: a, inert: s }) {
|
|
1605
1850
|
let [u, d] = o(null);
|
|
1606
1851
|
return /* @__PURE__ */ l("label", {
|
|
1607
1852
|
ref: a,
|
|
@@ -1633,7 +1878,7 @@ function nt({ name: e, accept: t, required: n, text: r = "Choose a file…", sty
|
|
|
1633
1878
|
]
|
|
1634
1879
|
});
|
|
1635
1880
|
}
|
|
1636
|
-
function
|
|
1881
|
+
function st({ text: e = "Submit", style: t, nodeRef: n, inert: r }) {
|
|
1637
1882
|
return /* @__PURE__ */ c("button", {
|
|
1638
1883
|
ref: n,
|
|
1639
1884
|
type: r ? "button" : "submit",
|
|
@@ -1653,7 +1898,7 @@ function rt({ text: e = "Submit", style: t, nodeRef: n, inert: r }) {
|
|
|
1653
1898
|
children: e
|
|
1654
1899
|
});
|
|
1655
1900
|
}
|
|
1656
|
-
function
|
|
1901
|
+
function ct({ cols: e = 2, rows: t = 1, style: n, nodeRef: r, linked: i }) {
|
|
1657
1902
|
let a = Math.max(1, (Number(e) || 1) * (Number(t) || 1));
|
|
1658
1903
|
return /* @__PURE__ */ c("div", {
|
|
1659
1904
|
ref: r,
|
|
@@ -1670,8 +1915,8 @@ function it({ cols: e = 2, rows: t = 1, style: n, nodeRef: r, linked: i }) {
|
|
|
1670
1915
|
}, t))
|
|
1671
1916
|
});
|
|
1672
1917
|
}
|
|
1673
|
-
function
|
|
1674
|
-
let { tenant: _, apiUrl: v } = n(
|
|
1918
|
+
function lt({ collection: e, limit: t = 6, layout: i = "grid", columns: a = 3, imageField: s, titleField: u = "name", textField: d, custom: f, templateId: m, style: h, nodeRef: g }) {
|
|
1919
|
+
let { tenant: _, apiUrl: v } = n(V), y = n(U), b = n(H)?.[e], [x, S] = o(null);
|
|
1675
1920
|
if (r(() => {
|
|
1676
1921
|
if (!e || b) return;
|
|
1677
1922
|
let t = !0, n = e.startsWith("api:") ? `${v}/data/${encodeURIComponent(e.slice(4))}` : `${v}/dynamic/${encodeURIComponent(e)}`;
|
|
@@ -1712,7 +1957,7 @@ function at({ collection: e, limit: t = 6, layout: i = "grid", columns: a = 3, i
|
|
|
1712
1957
|
...p(h)
|
|
1713
1958
|
},
|
|
1714
1959
|
children: C.map((e) => {
|
|
1715
|
-
let t = s ?
|
|
1960
|
+
let t = s ? W(e?.data, s) : null, n = u ? G(W(e?.data, u)) : null, r = d ? W(e?.data, d) : null, a = Array.isArray(r) ? r : null, o = a || r == null ? null : G(r), f = i === "list";
|
|
1716
1961
|
return /* @__PURE__ */ l("div", {
|
|
1717
1962
|
style: {
|
|
1718
1963
|
display: "flex",
|
|
@@ -1767,7 +2012,7 @@ function at({ collection: e, limit: t = 6, layout: i = "grid", columns: a = 3, i
|
|
|
1767
2012
|
})
|
|
1768
2013
|
});
|
|
1769
2014
|
}
|
|
1770
|
-
function
|
|
2015
|
+
function ut({ items: e = [], separator: t = "/", style: n, nodeRef: r }) {
|
|
1771
2016
|
return e.length ? /* @__PURE__ */ c("nav", {
|
|
1772
2017
|
ref: r,
|
|
1773
2018
|
"aria-label": "Breadcrumb",
|
|
@@ -1817,7 +2062,7 @@ function ot({ items: e = [], separator: t = "/", style: n, nodeRef: r }) {
|
|
|
1817
2062
|
})
|
|
1818
2063
|
}) : null;
|
|
1819
2064
|
}
|
|
1820
|
-
function
|
|
2065
|
+
function dt({ pages: e = 5, current: t = 1, prevNext: n = !0, href: r = "#", style: i, nodeRef: a }) {
|
|
1821
2066
|
let o = Math.min(Math.max(Number(e) || 1, 1), 50), s = Math.min(Math.max(Number(t) || 1, 1), o), u = (e) => r && r !== "#" ? r.replace("{page}", String(e)) : "#", d = (e) => ({
|
|
1822
2067
|
display: "inline-flex",
|
|
1823
2068
|
alignItems: "center",
|
|
@@ -1870,7 +2115,7 @@ function st({ pages: e = 5, current: t = 1, prevNext: n = !0, href: r = "#", sty
|
|
|
1870
2115
|
]
|
|
1871
2116
|
});
|
|
1872
2117
|
}
|
|
1873
|
-
function
|
|
2118
|
+
function ft({ steps: t = [], active: n = 1, vertical: r = !1, style: i, nodeRef: a }) {
|
|
1874
2119
|
if (!t.length) return null;
|
|
1875
2120
|
let o = Math.min(Math.max(Number(n) || 1, 1), t.length), s = (e) => ({
|
|
1876
2121
|
width: 32,
|
|
@@ -1948,46 +2193,58 @@ function ct({ steps: t = [], active: n = 1, vertical: r = !1, style: i, nodeRef:
|
|
|
1948
2193
|
})
|
|
1949
2194
|
});
|
|
1950
2195
|
}
|
|
1951
|
-
function
|
|
1952
|
-
|
|
1953
|
-
|
|
2196
|
+
function pt({ columns: e = [], rows: t = [], source: i, limit: a = 10, striped: s = !0, bordered: u = !1, compact: d = !1, style: f, nodeRef: m }) {
|
|
2197
|
+
let { tenant: h, apiUrl: g } = n(V), _ = n(H)?.[i], [v, y] = o(null);
|
|
2198
|
+
if (r(() => {
|
|
2199
|
+
if (!i || _) return;
|
|
2200
|
+
let e = !0, t = i.startsWith("api:") ? `${g}/data/${encodeURIComponent(i.slice(4))}` : `${g}/dynamic/${encodeURIComponent(i)}`;
|
|
2201
|
+
return fetch(t, { headers: h ? { "x-tenant": h } : {} }).then((e) => e.json()).then((t) => e && y(Array.isArray(t?.payload) ? t.payload : [])).catch(() => e && y([])), () => {
|
|
2202
|
+
e = !1;
|
|
2203
|
+
};
|
|
2204
|
+
}, [
|
|
2205
|
+
i,
|
|
2206
|
+
h,
|
|
2207
|
+
g,
|
|
2208
|
+
_
|
|
2209
|
+
]), !e.length) return null;
|
|
2210
|
+
let b = i ? (_ ?? v ?? []).slice(0, Math.max(1, Number(a) || 10)) : null, x = b ? b.map((t) => e.map((e) => G(W(t?.data, e.field)))) : t, S = d ? "6px 10px" : "10px 14px", C = "1px solid rgba(148, 163, 184, 0.35)", w = u ? { border: C } : { borderBottom: C };
|
|
1954
2211
|
return /* @__PURE__ */ c("div", {
|
|
1955
|
-
ref:
|
|
2212
|
+
ref: m,
|
|
1956
2213
|
style: {
|
|
1957
2214
|
width: "100%",
|
|
1958
2215
|
overflowX: "auto",
|
|
1959
|
-
...p(
|
|
2216
|
+
...p(f)
|
|
1960
2217
|
},
|
|
1961
2218
|
children: /* @__PURE__ */ l("table", {
|
|
1962
2219
|
style: {
|
|
1963
2220
|
width: "100%",
|
|
1964
2221
|
borderCollapse: "collapse",
|
|
1965
2222
|
fontSize: 14,
|
|
1966
|
-
...
|
|
2223
|
+
...u ? { border: C } : {}
|
|
1967
2224
|
},
|
|
1968
2225
|
children: [/* @__PURE__ */ c("thead", { children: /* @__PURE__ */ c("tr", { children: e.map((e, t) => /* @__PURE__ */ c("th", {
|
|
1969
2226
|
style: {
|
|
1970
2227
|
textAlign: "left",
|
|
1971
2228
|
fontWeight: 600,
|
|
1972
|
-
padding:
|
|
2229
|
+
padding: S,
|
|
1973
2230
|
background: "rgba(148, 163, 184, 0.12)",
|
|
1974
|
-
...
|
|
2231
|
+
...w
|
|
1975
2232
|
},
|
|
1976
2233
|
children: e.label ?? e
|
|
1977
|
-
}, t)) }) }), /* @__PURE__ */ c("tbody", { children:
|
|
1978
|
-
style:
|
|
2234
|
+
}, t)) }) }), /* @__PURE__ */ c("tbody", { children: x.map((t, n) => /* @__PURE__ */ c("tr", {
|
|
2235
|
+
style: s && n % 2 == 1 ? { background: "rgba(148, 163, 184, 0.07)" } : void 0,
|
|
1979
2236
|
children: e.map((e, n) => /* @__PURE__ */ c("td", {
|
|
1980
2237
|
style: {
|
|
1981
|
-
padding:
|
|
1982
|
-
...
|
|
2238
|
+
padding: S,
|
|
2239
|
+
...w
|
|
1983
2240
|
},
|
|
1984
2241
|
children: t?.[n] ?? ""
|
|
1985
2242
|
}, n))
|
|
1986
|
-
},
|
|
2243
|
+
}, n)) })]
|
|
1987
2244
|
})
|
|
1988
2245
|
});
|
|
1989
2246
|
}
|
|
1990
|
-
var
|
|
2247
|
+
var mt = {
|
|
1991
2248
|
PageRoot: le,
|
|
1992
2249
|
Section: ue,
|
|
1993
2250
|
Container: de,
|
|
@@ -2000,12 +2257,12 @@ var ut = {
|
|
|
2000
2257
|
SliderBlock: Be,
|
|
2001
2258
|
CanvasSlider: Ve,
|
|
2002
2259
|
TabsBlock: We,
|
|
2003
|
-
QuickStack:
|
|
2004
|
-
CollectionList:
|
|
2005
|
-
BreadcrumbsBlock:
|
|
2006
|
-
PaginationBlock:
|
|
2007
|
-
StepperBlock:
|
|
2008
|
-
TableBlock:
|
|
2260
|
+
QuickStack: ct,
|
|
2261
|
+
CollectionList: lt,
|
|
2262
|
+
BreadcrumbsBlock: ut,
|
|
2263
|
+
PaginationBlock: dt,
|
|
2264
|
+
StepperBlock: ft,
|
|
2265
|
+
TableBlock: pt,
|
|
2009
2266
|
AccordionBlock: Ge,
|
|
2010
2267
|
NavbarBlock: Ue,
|
|
2011
2268
|
ListBlock: Se,
|
|
@@ -2018,21 +2275,21 @@ var ut = {
|
|
|
2018
2275
|
YouTubeBlock: Ae,
|
|
2019
2276
|
IframeBlock: je,
|
|
2020
2277
|
EmbedBlock: Me,
|
|
2021
|
-
FormBlock:
|
|
2022
|
-
FormLabel:
|
|
2023
|
-
FormInput:
|
|
2024
|
-
FormTextarea:
|
|
2025
|
-
FormCheckbox: (e) => /* @__PURE__ */ c(
|
|
2278
|
+
FormBlock: et,
|
|
2279
|
+
FormLabel: tt,
|
|
2280
|
+
FormInput: nt,
|
|
2281
|
+
FormTextarea: rt,
|
|
2282
|
+
FormCheckbox: (e) => /* @__PURE__ */ c(it, {
|
|
2026
2283
|
kind: "checkbox",
|
|
2027
2284
|
...e
|
|
2028
2285
|
}),
|
|
2029
|
-
FormRadio: (e) => /* @__PURE__ */ c(
|
|
2286
|
+
FormRadio: (e) => /* @__PURE__ */ c(it, {
|
|
2030
2287
|
kind: "radio",
|
|
2031
2288
|
...e
|
|
2032
2289
|
}),
|
|
2033
|
-
FormSelect:
|
|
2034
|
-
FormFile:
|
|
2035
|
-
FormSubmit:
|
|
2290
|
+
FormSelect: at,
|
|
2291
|
+
FormFile: ot,
|
|
2292
|
+
FormSubmit: st
|
|
2036
2293
|
};
|
|
2037
2294
|
//#endregion
|
|
2038
2295
|
//#region ../ui/src/components/builder/render.jsx
|
|
@@ -2046,7 +2303,7 @@ function $(t, n, r, i = /* @__PURE__ */ new Set(), a = void 0) {
|
|
|
2046
2303
|
let l = new Set(i).add(n);
|
|
2047
2304
|
return /* @__PURE__ */ c(e, { children: $(s.template.rootId, s.template.nodes, r, l, a) }, t);
|
|
2048
2305
|
}
|
|
2049
|
-
let u =
|
|
2306
|
+
let u = mt[s];
|
|
2050
2307
|
if (!u) return null;
|
|
2051
2308
|
let d = (o.nodes ?? []).map((e) => $(e, n, r, i, a)).filter(Boolean), f = Object.entries(o.linkedNodes ?? {}), p = f.length ? Object.fromEntries(f.map(([e, t]) => [e, $(t, n, r, i)])) : void 0;
|
|
2052
2309
|
return /* @__PURE__ */ c(u, {
|
|
@@ -2061,8 +2318,8 @@ function $(t, n, r, i = /* @__PURE__ */ new Set(), a = void 0) {
|
|
|
2061
2318
|
}
|
|
2062
2319
|
//#endregion
|
|
2063
2320
|
//#region ../ui/src/components/builder/PageRenderer.jsx
|
|
2064
|
-
var
|
|
2065
|
-
function
|
|
2321
|
+
var ht = (e) => Object.entries(e).map(([e, t]) => `${e}: ${t};`).join(" ");
|
|
2322
|
+
function gt({ blocks: e, theme: t, components: n, mode: a = "auto", style: o, custom: s, tenant: u, apiUrl: d, datasets: f }) {
|
|
2066
2323
|
let p = s?.js?.trim();
|
|
2067
2324
|
if (r(() => {
|
|
2068
2325
|
if (!p) return;
|
|
@@ -2073,24 +2330,24 @@ function ft({ blocks: e, theme: t, components: n, mode: a = "auto", style: o, cu
|
|
|
2073
2330
|
minHeight: "100%",
|
|
2074
2331
|
display: "flex",
|
|
2075
2332
|
flexDirection: "column"
|
|
2076
|
-
}, h = $("ROOT", e, n), g = i(() => ({ render: (t, r) => $(t, e, n, void 0, { mapProps: r }) }), [e, n]), _ = T(e, n), v = w(e, n), y = s?.css?.trim(), b =
|
|
2333
|
+
}, h = $("ROOT", e, n), g = i(() => ({ render: (t, r) => $(t, e, n, void 0, { mapProps: r }) }), [e, n]), _ = T(e, n), v = w(e, n), y = s?.css?.trim(), b = B(e, n).map((e) => /* @__PURE__ */ c("link", {
|
|
2077
2334
|
rel: "stylesheet",
|
|
2078
2335
|
precedence: "default",
|
|
2079
|
-
href:
|
|
2336
|
+
href: te(e)
|
|
2080
2337
|
}, e));
|
|
2081
|
-
if (a !== "auto") return /* @__PURE__ */ c(
|
|
2338
|
+
if (a !== "auto") return /* @__PURE__ */ c(V.Provider, {
|
|
2082
2339
|
value: {
|
|
2083
2340
|
tenant: u || "",
|
|
2084
2341
|
apiUrl: d || "/api"
|
|
2085
2342
|
},
|
|
2086
|
-
children: /* @__PURE__ */ c(
|
|
2343
|
+
children: /* @__PURE__ */ c(H.Provider, {
|
|
2087
2344
|
value: f ?? null,
|
|
2088
|
-
children: /* @__PURE__ */ c(
|
|
2345
|
+
children: /* @__PURE__ */ c(U.Provider, {
|
|
2089
2346
|
value: g,
|
|
2090
2347
|
children: /* @__PURE__ */ l("div", {
|
|
2091
2348
|
style: {
|
|
2092
2349
|
...m,
|
|
2093
|
-
...
|
|
2350
|
+
...F(t, a),
|
|
2094
2351
|
...o
|
|
2095
2352
|
},
|
|
2096
2353
|
children: [
|
|
@@ -2105,25 +2362,25 @@ function ft({ blocks: e, theme: t, components: n, mode: a = "auto", style: o, cu
|
|
|
2105
2362
|
})
|
|
2106
2363
|
});
|
|
2107
2364
|
let x = M(t);
|
|
2108
|
-
return /* @__PURE__ */ c(
|
|
2365
|
+
return /* @__PURE__ */ c(V.Provider, {
|
|
2109
2366
|
value: {
|
|
2110
2367
|
tenant: u || "",
|
|
2111
2368
|
apiUrl: d || "/api"
|
|
2112
2369
|
},
|
|
2113
|
-
children: /* @__PURE__ */ c(
|
|
2370
|
+
children: /* @__PURE__ */ c(H.Provider, {
|
|
2114
2371
|
value: f ?? null,
|
|
2115
|
-
children: /* @__PURE__ */ c(
|
|
2372
|
+
children: /* @__PURE__ */ c(U.Provider, {
|
|
2116
2373
|
value: g,
|
|
2117
2374
|
children: /* @__PURE__ */ l("div", {
|
|
2118
2375
|
className: "webim-page",
|
|
2119
2376
|
style: {
|
|
2120
2377
|
...m,
|
|
2121
|
-
...
|
|
2378
|
+
...P(t),
|
|
2122
2379
|
...o
|
|
2123
2380
|
},
|
|
2124
2381
|
children: [
|
|
2125
|
-
/* @__PURE__ */ c("style", { children: `.webim-page { ${
|
|
2126
|
-
@media (prefers-color-scheme: dark) { .webim-page { ${
|
|
2382
|
+
/* @__PURE__ */ c("style", { children: `.webim-page { ${ht(N(x.light))} }
|
|
2383
|
+
@media (prefers-color-scheme: dark) { .webim-page { ${ht(N(x.dark))} } }` }),
|
|
2127
2384
|
b,
|
|
2128
2385
|
_ && /* @__PURE__ */ c("style", { children: _ }),
|
|
2129
2386
|
v && /* @__PURE__ */ c("style", { children: v }),
|
|
@@ -2137,8 +2394,8 @@ function ft({ blocks: e, theme: t, components: n, mode: a = "auto", style: o, cu
|
|
|
2137
2394
|
}
|
|
2138
2395
|
//#endregion
|
|
2139
2396
|
//#region src/WebimContent.jsx
|
|
2140
|
-
function
|
|
2141
|
-
return e?.blocks?.ROOT ? /* @__PURE__ */ c(
|
|
2397
|
+
function _t({ bundle: e, mode: t = "auto", style: n }) {
|
|
2398
|
+
return e?.blocks?.ROOT ? /* @__PURE__ */ c(gt, {
|
|
2142
2399
|
blocks: e.blocks,
|
|
2143
2400
|
theme: e.theme,
|
|
2144
2401
|
components: e.components,
|
|
@@ -2152,7 +2409,7 @@ function pt({ bundle: e, mode: t = "auto", style: n }) {
|
|
|
2152
2409
|
}
|
|
2153
2410
|
//#endregion
|
|
2154
2411
|
//#region src/WebimPage.jsx
|
|
2155
|
-
function
|
|
2412
|
+
function vt({ apiUrl: e, tenant: t, slug: n, locale: i, preview: s, mode: l = "auto", style: u, fallback: d = null, errorFallback: f = null, onLoad: p, onError: m }) {
|
|
2156
2413
|
let [h, g] = o({ status: "loading" }), _ = a({
|
|
2157
2414
|
onLoad: p,
|
|
2158
2415
|
onError: m
|
|
@@ -2162,7 +2419,7 @@ function mt({ apiUrl: e, tenant: t, slug: n, locale: i, preview: s, mode: l = "a
|
|
|
2162
2419
|
onError: m
|
|
2163
2420
|
}, r(() => {
|
|
2164
2421
|
let r = !0;
|
|
2165
|
-
return g({ status: "loading" }),
|
|
2422
|
+
return g({ status: "loading" }), z({
|
|
2166
2423
|
apiUrl: e,
|
|
2167
2424
|
tenant: t,
|
|
2168
2425
|
slug: n,
|
|
@@ -2187,11 +2444,11 @@ function mt({ apiUrl: e, tenant: t, slug: n, locale: i, preview: s, mode: l = "a
|
|
|
2187
2444
|
n,
|
|
2188
2445
|
i,
|
|
2189
2446
|
s
|
|
2190
|
-
]), h.status === "loading" ? d : h.status === "error" ? typeof f == "function" ? f(h.error) : f : /* @__PURE__ */ c(
|
|
2447
|
+
]), h.status === "loading" ? d : h.status === "error" ? typeof f == "function" ? f(h.error) : f : /* @__PURE__ */ c(_t, {
|
|
2191
2448
|
bundle: h.bundle,
|
|
2192
2449
|
mode: l,
|
|
2193
2450
|
style: u
|
|
2194
2451
|
});
|
|
2195
2452
|
}
|
|
2196
2453
|
//#endregion
|
|
2197
|
-
export {
|
|
2454
|
+
export { gt as PageRenderer, _t as WebimContent, vt as WebimPage, z as fetchPage, ve as renderRichContent, I as resolveTheme };
|