webim-adapter 0.26.0 → 0.27.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 +630 -364
- package/build/webim-embed.js +3 -3
- package/build/webim-ssr.js +382 -116
- package/package.json +1 -1
package/build/webim-ssr.js
CHANGED
|
@@ -1993,7 +1993,7 @@ function mt({ style: e, action: t, method: n, name: r, enctype: o, formSlug: s,
|
|
|
1993
1993
|
display: A === "success" ? "none" : "flex"
|
|
1994
1994
|
},
|
|
1995
1995
|
children: c && s ? /* @__PURE__ */ f(u, { children: [
|
|
1996
|
-
P && /* @__PURE__ */ d(
|
|
1996
|
+
P && /* @__PURE__ */ d(Vt, {
|
|
1997
1997
|
steps: N.map((e) => ({ label: e.section?.label ?? "Start" })),
|
|
1998
1998
|
active: F + 1,
|
|
1999
1999
|
style: { marginBottom: 8 }
|
|
@@ -2736,12 +2736,12 @@ var At = "webim.page_mode", jt = () => {
|
|
|
2736
2736
|
rx: "2"
|
|
2737
2737
|
}), /* @__PURE__ */ d("path", { d: "M8 21h8M12 17v4" })]
|
|
2738
2738
|
});
|
|
2739
|
-
},
|
|
2739
|
+
}, Nt = {
|
|
2740
2740
|
light: "Light theme",
|
|
2741
2741
|
dark: "Dark theme",
|
|
2742
2742
|
auto: "Follow the device theme"
|
|
2743
2743
|
};
|
|
2744
|
-
function
|
|
2744
|
+
function Pt({ variant: e, showSystem: t, style: n, nodeRef: r, inert: i }) {
|
|
2745
2745
|
let [o, s] = l(i ? "auto" : jt), u = c(null), f = (e) => {
|
|
2746
2746
|
u.current = e, typeof r == "function" && r(e);
|
|
2747
2747
|
};
|
|
@@ -2785,8 +2785,8 @@ function Nt({ variant: e, showSystem: t, style: n, nodeRef: r, inert: i }) {
|
|
|
2785
2785
|
},
|
|
2786
2786
|
children: p.map((e) => /* @__PURE__ */ d("button", {
|
|
2787
2787
|
type: "button",
|
|
2788
|
-
title:
|
|
2789
|
-
"aria-label":
|
|
2788
|
+
title: Nt[e],
|
|
2789
|
+
"aria-label": Nt[e],
|
|
2790
2790
|
"aria-pressed": e === m,
|
|
2791
2791
|
onClick: i ? void 0 : () => s(e),
|
|
2792
2792
|
style: {
|
|
@@ -2804,8 +2804,8 @@ function Nt({ variant: e, showSystem: t, style: n, nodeRef: r, inert: i }) {
|
|
|
2804
2804
|
return /* @__PURE__ */ d("button", {
|
|
2805
2805
|
ref: f,
|
|
2806
2806
|
type: "button",
|
|
2807
|
-
title:
|
|
2808
|
-
"aria-label": `Theme: ${
|
|
2807
|
+
title: Nt[m],
|
|
2808
|
+
"aria-label": `Theme: ${Nt[m]} — switch to ${Nt[g]}`,
|
|
2809
2809
|
onClick: i ? void 0 : () => s(g),
|
|
2810
2810
|
style: {
|
|
2811
2811
|
...h,
|
|
@@ -2817,7 +2817,118 @@ function Nt({ variant: e, showSystem: t, style: n, nodeRef: r, inert: i }) {
|
|
|
2817
2817
|
children: Mt(m)
|
|
2818
2818
|
});
|
|
2819
2819
|
}
|
|
2820
|
-
|
|
2820
|
+
function Ft(e) {
|
|
2821
|
+
let t = e?.parentElement;
|
|
2822
|
+
for (; t && t !== document.body;) {
|
|
2823
|
+
let e = getComputedStyle(t).overflowY;
|
|
2824
|
+
if ((e === "auto" || e === "scroll") && t.scrollHeight > t.clientHeight) return t;
|
|
2825
|
+
t = t.parentElement;
|
|
2826
|
+
}
|
|
2827
|
+
return window;
|
|
2828
|
+
}
|
|
2829
|
+
var It = (e) => e === window ? window.scrollY : e.scrollTop, Lt = {
|
|
2830
|
+
"bottom-right": (e) => ({
|
|
2831
|
+
right: e,
|
|
2832
|
+
bottom: e
|
|
2833
|
+
}),
|
|
2834
|
+
"bottom-left": (e) => ({
|
|
2835
|
+
left: e,
|
|
2836
|
+
bottom: e
|
|
2837
|
+
}),
|
|
2838
|
+
"bottom-center": (e) => ({
|
|
2839
|
+
left: "50%",
|
|
2840
|
+
bottom: e,
|
|
2841
|
+
transform: "translateX(-50%)"
|
|
2842
|
+
})
|
|
2843
|
+
};
|
|
2844
|
+
function Rt({ variant: e, label: t, position: n, offset: r, showAfter: i, smooth: o, bg: s, fg: c, style: u, nodeRef: p, inert: m, frame: h }) {
|
|
2845
|
+
let [g, _] = l(!!m), [v, y] = l(null), b = (e) => {
|
|
2846
|
+
y(e), typeof p == "function" && p(e);
|
|
2847
|
+
};
|
|
2848
|
+
a(() => {
|
|
2849
|
+
if (m || !v) return;
|
|
2850
|
+
let e = Ft(v), t = Number(i) >= 0 ? Number(i) : 300, n = () => _(It(e) > t);
|
|
2851
|
+
return n(), e.addEventListener("scroll", n, { passive: !0 }), () => e.removeEventListener("scroll", n);
|
|
2852
|
+
}, [
|
|
2853
|
+
m,
|
|
2854
|
+
v,
|
|
2855
|
+
i
|
|
2856
|
+
]);
|
|
2857
|
+
let x = () => {
|
|
2858
|
+
if (m) return;
|
|
2859
|
+
let e = Ft(v), t = window.matchMedia?.("(prefers-reduced-motion: reduce)").matches, n = o === !1 || t ? "auto" : "smooth";
|
|
2860
|
+
e === window ? window.scrollTo({
|
|
2861
|
+
top: 0,
|
|
2862
|
+
behavior: n
|
|
2863
|
+
}) : e.scrollTo({
|
|
2864
|
+
top: 0,
|
|
2865
|
+
behavior: n
|
|
2866
|
+
});
|
|
2867
|
+
}, S = Number(r) >= 0 ? Number(r) : 24, C = e === "pill", w = t || "Top", T = Lt[n] ? n : "bottom-right", E = h ? {
|
|
2868
|
+
position: "fixed",
|
|
2869
|
+
zIndex: 5,
|
|
2870
|
+
bottom: (h.bottom ?? 0) + S,
|
|
2871
|
+
...T === "bottom-left" ? { left: (h.left ?? 0) + S } : null,
|
|
2872
|
+
...T === "bottom-right" ? { right: (h.right ?? 0) + S } : null,
|
|
2873
|
+
...T === "bottom-center" ? {
|
|
2874
|
+
left: (h.left ?? 0) + (h.width ?? 0) / 2,
|
|
2875
|
+
transform: "translateX(-50%)"
|
|
2876
|
+
} : null
|
|
2877
|
+
} : {
|
|
2878
|
+
position: "fixed",
|
|
2879
|
+
zIndex: 2147482e3,
|
|
2880
|
+
...Lt[T](S)
|
|
2881
|
+
};
|
|
2882
|
+
return /* @__PURE__ */ f("button", {
|
|
2883
|
+
ref: b,
|
|
2884
|
+
type: "button",
|
|
2885
|
+
title: w,
|
|
2886
|
+
"aria-label": w,
|
|
2887
|
+
"aria-hidden": !g,
|
|
2888
|
+
tabIndex: g ? 0 : -1,
|
|
2889
|
+
onClick: x,
|
|
2890
|
+
style: {
|
|
2891
|
+
display: "inline-flex",
|
|
2892
|
+
alignItems: "center",
|
|
2893
|
+
justifyContent: "center",
|
|
2894
|
+
gap: C ? 8 : 0,
|
|
2895
|
+
appearance: "none",
|
|
2896
|
+
font: "inherit",
|
|
2897
|
+
fontSize: 14,
|
|
2898
|
+
fontWeight: 600,
|
|
2899
|
+
width: C ? "auto" : 44,
|
|
2900
|
+
height: 44,
|
|
2901
|
+
padding: C ? "0 18px" : 0,
|
|
2902
|
+
borderRadius: 999,
|
|
2903
|
+
border: "1px solid transparent",
|
|
2904
|
+
background: s || "var(--page-accent, #111827)",
|
|
2905
|
+
color: c || "var(--page-accent-text, #ffffff)",
|
|
2906
|
+
boxShadow: "0 6px 20px rgba(15, 23, 42, 0.25)",
|
|
2907
|
+
cursor: m ? "default" : "pointer",
|
|
2908
|
+
opacity: +!!g,
|
|
2909
|
+
pointerEvents: g ? "auto" : "none",
|
|
2910
|
+
transition: "opacity 160ms ease, transform 160ms ease",
|
|
2911
|
+
...E,
|
|
2912
|
+
...D(u),
|
|
2913
|
+
...E.transform ? { transform: E.transform } : null
|
|
2914
|
+
},
|
|
2915
|
+
children: [/* @__PURE__ */ d("svg", {
|
|
2916
|
+
width: "18",
|
|
2917
|
+
height: "18",
|
|
2918
|
+
viewBox: "0 0 24 24",
|
|
2919
|
+
fill: "none",
|
|
2920
|
+
"aria-hidden": "true",
|
|
2921
|
+
children: /* @__PURE__ */ d("path", {
|
|
2922
|
+
d: "M12 19V5M12 5l-7 7M12 5l7 7",
|
|
2923
|
+
stroke: "currentColor",
|
|
2924
|
+
strokeWidth: "2",
|
|
2925
|
+
strokeLinecap: "round",
|
|
2926
|
+
strokeLinejoin: "round"
|
|
2927
|
+
})
|
|
2928
|
+
}), C ? /* @__PURE__ */ d("span", { children: w }) : null]
|
|
2929
|
+
});
|
|
2930
|
+
}
|
|
2931
|
+
var zt = {
|
|
2821
2932
|
facebook: {
|
|
2822
2933
|
label: "Facebook",
|
|
2823
2934
|
color: "#1877f2",
|
|
@@ -2884,8 +2995,8 @@ var Pt = {
|
|
|
2884
2995
|
d: "M11.99 2C6.47 2 2 6.48 2 12s4.47 10 9.99 10C17.52 22 22 17.52 22 12S17.52 2 11.99 2zm6.93 6h-2.95c-.32-1.25-.78-2.45-1.38-3.56 1.84.63 3.37 1.91 4.33 3.56zM12 4.04c.83 1.2 1.48 2.53 1.91 3.96h-3.82c.43-1.43 1.08-2.76 1.91-3.96zM4.26 14C4.1 13.36 4 12.69 4 12s.1-1.36.26-2h3.38c-.08.66-.14 1.32-.14 2 0 .68.06 1.34.14 2H4.26zm.82 2h2.95c.32 1.25.78 2.45 1.38 3.56-1.84-.63-3.37-1.9-4.33-3.56zm2.95-8H5.08c.96-1.66 2.49-2.93 4.33-3.56C8.81 5.55 8.35 6.75 8.03 8zM12 19.96c-.83-1.2-1.48-2.53-1.91-3.96h3.82c-.43 1.43-1.08 2.76-1.91 3.96zM14.34 14H9.66c-.09-.66-.16-1.32-.16-2 0-.68.07-1.35.16-2h4.68c.09.65.16 1.32.16 2 0 .68-.07 1.34-.16 2zm.25 5.56c.6-1.11 1.06-2.31 1.38-3.56h2.95c-.96 1.65-2.49 2.93-4.33 3.56zM16.36 14c.08-.66.14-1.32.14-2 0-.68-.06-1.34-.14-2h3.38c.16.64.26 1.31.26 2s-.1 1.36-.26 2h-3.38z"
|
|
2885
2996
|
}
|
|
2886
2997
|
};
|
|
2887
|
-
function
|
|
2888
|
-
let l = Array.isArray(e) ? e.filter((e) => e &&
|
|
2998
|
+
function Bt({ links: e = [], variant: t, color: n, size: r, gap: i, newTab: a, style: o, nodeRef: s, inert: c }) {
|
|
2999
|
+
let l = Array.isArray(e) ? e.filter((e) => e && zt[e.network]) : [];
|
|
2889
3000
|
if (!l.length) return null;
|
|
2890
3001
|
let u = Math.min(Math.max(Number(r) || 18, 10), 64), f = Math.round(u * 1.9), p = Number.isFinite(Number(i)) ? Number(i) : 10, m = (e) => n === "accent" ? "var(--page-accent, #111827)" : n === "inherit" ? "currentColor" : e.color, h = c ? (e) => e.preventDefault() : void 0;
|
|
2891
3002
|
return /* @__PURE__ */ d("div", {
|
|
@@ -2898,7 +3009,7 @@ function Ft({ links: e = [], variant: t, color: n, size: r, gap: i, newTab: a, s
|
|
|
2898
3009
|
...D(o)
|
|
2899
3010
|
},
|
|
2900
3011
|
children: l.map((e, r) => {
|
|
2901
|
-
let i =
|
|
3012
|
+
let i = zt[e.network], o = t !== "outline" && t !== "plain", s = o ? n === "accent" ? "var(--page-accent-text, #ffffff)" : n === "inherit" ? "var(--page-bg, #ffffff)" : "#ffffff" : m(i);
|
|
2902
3013
|
return /* @__PURE__ */ d("a", {
|
|
2903
3014
|
href: e.url || "#",
|
|
2904
3015
|
onClick: h,
|
|
@@ -2932,7 +3043,7 @@ function Ft({ links: e = [], variant: t, color: n, size: r, gap: i, newTab: a, s
|
|
|
2932
3043
|
})
|
|
2933
3044
|
});
|
|
2934
3045
|
}
|
|
2935
|
-
function
|
|
3046
|
+
function Vt({ steps: e = [], active: n = 1, vertical: r = !1, style: i, nodeRef: a }) {
|
|
2936
3047
|
if (!e.length) return null;
|
|
2937
3048
|
let o = Math.min(Math.max(Number(n) || 1, 1), e.length), s = (e) => ({
|
|
2938
3049
|
width: 32,
|
|
@@ -3010,7 +3121,7 @@ function It({ steps: e = [], active: n = 1, vertical: r = !1, style: i, nodeRef:
|
|
|
3010
3121
|
})
|
|
3011
3122
|
});
|
|
3012
3123
|
}
|
|
3013
|
-
var
|
|
3124
|
+
var Ht = {
|
|
3014
3125
|
small: {
|
|
3015
3126
|
w: 132,
|
|
3016
3127
|
h: 46,
|
|
@@ -3032,10 +3143,10 @@ var Lt = {
|
|
|
3032
3143
|
title: 12.5,
|
|
3033
3144
|
avatar: 46
|
|
3034
3145
|
}
|
|
3035
|
-
},
|
|
3036
|
-
|
|
3037
|
-
function
|
|
3038
|
-
let r =
|
|
3146
|
+
}, Ut = (e) => Ht[e] ?? Ht.medium;
|
|
3147
|
+
Ht.medium.w, Ht.medium.h;
|
|
3148
|
+
function Wt(e, { size: t = "medium", horizontal: n = !1 } = {}) {
|
|
3149
|
+
let r = Ut(t), i = n ? r.h : r.w, a = n ? 16 : 20, o = (n ? r.w : r.h) + (n ? 56 : 48), s = Array.isArray(e) ? e.filter((e) => e && e.id) : [], c = new Set(s.map((e) => e.id)), l = /* @__PURE__ */ new Map(), u = [];
|
|
3039
3150
|
for (let e of s) e.parent && c.has(e.parent) && e.parent !== e.id ? (l.has(e.parent) || l.set(e.parent, []), l.get(e.parent).push(e)) : u.push(e);
|
|
3040
3151
|
let d = /* @__PURE__ */ new Map(), f = (e, t) => {
|
|
3041
3152
|
if (t.has(e.id)) return 0;
|
|
@@ -3087,18 +3198,18 @@ function zt(e, { size: t = "medium", horizontal: n = !1 } = {}) {
|
|
|
3087
3198
|
horizontal: n
|
|
3088
3199
|
};
|
|
3089
3200
|
}
|
|
3090
|
-
var
|
|
3201
|
+
var Gt = (e, t) => {
|
|
3091
3202
|
let n = String(e ?? "");
|
|
3092
3203
|
return n.length > t ? `${n.slice(0, t - 1)}…` : n;
|
|
3093
|
-
},
|
|
3204
|
+
}, Kt = (e) => {
|
|
3094
3205
|
let t = /^#([0-9a-f]{6}|[0-9a-f]{3})$/i.exec(String(e ?? "").trim());
|
|
3095
3206
|
if (!t) return "#ffffff";
|
|
3096
3207
|
let n = t[1];
|
|
3097
3208
|
n.length === 3 && (n = [...n].map((e) => e + e).join(""));
|
|
3098
3209
|
let r = parseInt(n, 16);
|
|
3099
3210
|
return .299 * (r >> 16 & 255) + .587 * (r >> 8 & 255) + .114 * (r & 255) > 150 ? "#111827" : "#ffffff";
|
|
3100
|
-
},
|
|
3101
|
-
function
|
|
3211
|
+
}, qt = (e) => !!(e?.cv?.trim?.() || e?.photo);
|
|
3212
|
+
function Jt(e, t = {}) {
|
|
3102
3213
|
let n = Array.isArray(e) ? e.filter((e) => e && typeof e == "object" && e.id) : [], r = (e) => Array.isArray(e) ? e[0] : e, i = (e) => e == null ? "" : K(e);
|
|
3103
3214
|
return n.map((e) => {
|
|
3104
3215
|
let n = e.data ?? {}, a = r(n[t.parentField]), o = a && typeof a == "object" ? a.id ?? null : a || null;
|
|
@@ -3113,11 +3224,11 @@ function Ut(e, t = {}) {
|
|
|
3113
3224
|
};
|
|
3114
3225
|
});
|
|
3115
3226
|
}
|
|
3116
|
-
var
|
|
3227
|
+
var Yt = {
|
|
3117
3228
|
size: 36,
|
|
3118
3229
|
pad: 10
|
|
3119
3230
|
};
|
|
3120
|
-
function
|
|
3231
|
+
function Xt({ node: e, onClose: t }) {
|
|
3121
3232
|
return a(() => {
|
|
3122
3233
|
let e = (e) => e.key === "Escape" && t();
|
|
3123
3234
|
return window.addEventListener("keydown", e), () => window.removeEventListener("keydown", e);
|
|
@@ -3238,7 +3349,7 @@ function Gt({ node: e, onClose: t }) {
|
|
|
3238
3349
|
})
|
|
3239
3350
|
});
|
|
3240
3351
|
}
|
|
3241
|
-
function
|
|
3352
|
+
function Zt({ nodes: e = [], source: t, nameField: n, titleField: r, photoField: s, parentField: c, cvField: p, hrefField: m, size: h = "medium", horizontal: g = !1, style: _, nodeRef: v, interactive: y = !0 }) {
|
|
3242
3353
|
let b = o(), [x, S] = l(null), { tenant: C, apiUrl: w } = i(V), T = i(H)?.[t], [E, O] = l(null);
|
|
3243
3354
|
a(() => {
|
|
3244
3355
|
if (!t || T) return;
|
|
@@ -3255,14 +3366,14 @@ function Kt({ nodes: e = [], source: t, nameField: n, titleField: r, photoField:
|
|
|
3255
3366
|
w,
|
|
3256
3367
|
T
|
|
3257
3368
|
]);
|
|
3258
|
-
let k = t ?
|
|
3369
|
+
let k = t ? Jt(T ?? E ?? [], {
|
|
3259
3370
|
nameField: n,
|
|
3260
3371
|
titleField: r,
|
|
3261
3372
|
photoField: s,
|
|
3262
3373
|
parentField: c,
|
|
3263
3374
|
cvField: p,
|
|
3264
3375
|
hrefField: m
|
|
3265
|
-
}) : e, A =
|
|
3376
|
+
}) : e, A = Ut(h), { boxes: j, links: M, width: N, height: P } = Wt(k, {
|
|
3266
3377
|
size: h,
|
|
3267
3378
|
horizontal: g
|
|
3268
3379
|
});
|
|
@@ -3308,7 +3419,7 @@ function Kt({ nodes: e = [], source: t, nameField: n, titleField: r, photoField:
|
|
|
3308
3419
|
stroke: "rgba(148, 163, 184, 0.7)",
|
|
3309
3420
|
strokeWidth: "1.5"
|
|
3310
3421
|
}, t)), j.map(({ node: e, x: t, y: n }) => {
|
|
3311
|
-
let r = F.has(e.id), i = !!e.color2, a = !!e.color || r || i, o = e.color || (r ? "var(--page-accent, #4f46e5)" : "var(--page-bg, #ffffff)"), s = e.color ?
|
|
3422
|
+
let r = F.has(e.id), i = !!e.color2, a = !!e.color || r || i, o = e.color || (r ? "var(--page-accent, #4f46e5)" : "var(--page-bg, #ffffff)"), s = e.color ? Kt(e.color) : r ? "var(--page-accent-text, #ffffff)" : "var(--page-text, #111827)", c = i ? Kt(e.color2) : s, l = y && (qt(e) || e.href), p = () => qt(e) ? S(e) : window.open(e.href, "_blank", "noreferrer"), m = e.photo ? t + Yt.pad + A.avatar + 8 : t + A.w / 2, h = e.photo ? "start" : "middle", g = e.photo ? Math.floor((A.w - A.avatar - 26) / 7) : Math.floor(A.w / 7.6), _ = A.h / 2, v = [e.name, e.title].map((e) => String(e ?? "").trim()).filter(Boolean);
|
|
3312
3423
|
return /* @__PURE__ */ f("g", {
|
|
3313
3424
|
onClick: l ? p : void 0,
|
|
3314
3425
|
style: l ? { cursor: "pointer" } : void 0,
|
|
@@ -3372,13 +3483,13 @@ function Kt({ nodes: e = [], source: t, nameField: n, titleField: r, photoField:
|
|
|
3372
3483
|
e.photo && /* @__PURE__ */ f(u, { children: [/* @__PURE__ */ d("clipPath", {
|
|
3373
3484
|
id: `${b}-${e.id}`,
|
|
3374
3485
|
children: /* @__PURE__ */ d("circle", {
|
|
3375
|
-
cx: t +
|
|
3486
|
+
cx: t + Yt.pad + A.avatar / 2,
|
|
3376
3487
|
cy: n + A.h / 2,
|
|
3377
3488
|
r: A.avatar / 2
|
|
3378
3489
|
})
|
|
3379
3490
|
}), /* @__PURE__ */ d("image", {
|
|
3380
3491
|
href: e.photo,
|
|
3381
|
-
x: t +
|
|
3492
|
+
x: t + Yt.pad,
|
|
3382
3493
|
y: n + (A.h - A.avatar) / 2,
|
|
3383
3494
|
width: A.avatar,
|
|
3384
3495
|
height: A.avatar,
|
|
@@ -3392,7 +3503,7 @@ function Kt({ nodes: e = [], source: t, nameField: n, titleField: r, photoField:
|
|
|
3392
3503
|
fontSize: A.title,
|
|
3393
3504
|
fontWeight: "600",
|
|
3394
3505
|
fill: s,
|
|
3395
|
-
children:
|
|
3506
|
+
children: Gt(e.title, g + 4)
|
|
3396
3507
|
}), e.name && /* @__PURE__ */ d("text", {
|
|
3397
3508
|
x: m,
|
|
3398
3509
|
y: n + _ + _ / 2 + A.name * .35,
|
|
@@ -3400,7 +3511,7 @@ function Kt({ nodes: e = [], source: t, nameField: n, titleField: r, photoField:
|
|
|
3400
3511
|
fontSize: A.name,
|
|
3401
3512
|
fontWeight: "600",
|
|
3402
3513
|
fill: c,
|
|
3403
|
-
children:
|
|
3514
|
+
children: Gt(e.name, g)
|
|
3404
3515
|
})] }) : /* @__PURE__ */ f(u, { children: [v[0] && /* @__PURE__ */ d("text", {
|
|
3405
3516
|
x: m,
|
|
3406
3517
|
y: n + (v[1] ? A.h * .43 : A.h * .57),
|
|
@@ -3408,7 +3519,7 @@ function Kt({ nodes: e = [], source: t, nameField: n, titleField: r, photoField:
|
|
|
3408
3519
|
fontSize: A.name,
|
|
3409
3520
|
fontWeight: "600",
|
|
3410
3521
|
fill: s,
|
|
3411
|
-
children:
|
|
3522
|
+
children: Gt(v[0], g)
|
|
3412
3523
|
}), v[1] && /* @__PURE__ */ d("text", {
|
|
3413
3524
|
x: m,
|
|
3414
3525
|
y: n + A.h * .73,
|
|
@@ -3416,18 +3527,18 @@ function Kt({ nodes: e = [], source: t, nameField: n, titleField: r, photoField:
|
|
|
3416
3527
|
fontSize: A.title,
|
|
3417
3528
|
opacity: "0.7",
|
|
3418
3529
|
fill: s,
|
|
3419
|
-
children:
|
|
3530
|
+
children: Gt(v[1], g + 4)
|
|
3420
3531
|
})] })
|
|
3421
3532
|
]
|
|
3422
3533
|
}, e.id);
|
|
3423
3534
|
})]
|
|
3424
|
-
}), x && /* @__PURE__ */ d(
|
|
3535
|
+
}), x && /* @__PURE__ */ d(Xt, {
|
|
3425
3536
|
node: x,
|
|
3426
3537
|
onClose: () => S(null)
|
|
3427
3538
|
})]
|
|
3428
3539
|
});
|
|
3429
3540
|
}
|
|
3430
|
-
function
|
|
3541
|
+
function Qt({ columns: e = [], rows: t = [], source: n, limit: r = 10, striped: o = !0, bordered: s = !1, compact: c = !1, paged: u, emptyText: p, style: m, nodeRef: h }) {
|
|
3431
3542
|
let { tenant: g, apiUrl: _ } = i(V), v = i(H), y = v?.[n], b = u ? U(v) : 1, [x, S] = l(null);
|
|
3432
3543
|
if (a(() => {
|
|
3433
3544
|
if (!n || y) return;
|
|
@@ -3493,7 +3604,7 @@ function qt({ columns: e = [], rows: t = [], source: n, limit: r = 10, striped:
|
|
|
3493
3604
|
})
|
|
3494
3605
|
});
|
|
3495
3606
|
}
|
|
3496
|
-
var
|
|
3607
|
+
var $t = {
|
|
3497
3608
|
PageRoot: Se,
|
|
3498
3609
|
Section: Ce,
|
|
3499
3610
|
Container: we,
|
|
@@ -3511,11 +3622,12 @@ var Jt = {
|
|
|
3511
3622
|
CollectionSearch: Dt,
|
|
3512
3623
|
BreadcrumbsBlock: Ot,
|
|
3513
3624
|
PaginationBlock: kt,
|
|
3514
|
-
StepperBlock:
|
|
3515
|
-
SocialLinksBlock:
|
|
3516
|
-
ThemeModeBlock:
|
|
3517
|
-
|
|
3518
|
-
|
|
3625
|
+
StepperBlock: Vt,
|
|
3626
|
+
SocialLinksBlock: Bt,
|
|
3627
|
+
ThemeModeBlock: Pt,
|
|
3628
|
+
ScrollTopBlock: Rt,
|
|
3629
|
+
OrgChartBlock: Zt,
|
|
3630
|
+
TableBlock: Qt,
|
|
3519
3631
|
MasonryBlock: tt,
|
|
3520
3632
|
AccordionBlock: ot,
|
|
3521
3633
|
NavbarBlock: it,
|
|
@@ -3545,26 +3657,26 @@ var Jt = {
|
|
|
3545
3657
|
FormFile: Ct,
|
|
3546
3658
|
FormRecaptcha: _t,
|
|
3547
3659
|
FormSubmit: wt
|
|
3548
|
-
},
|
|
3660
|
+
}, en = {
|
|
3549
3661
|
id: "auth",
|
|
3550
3662
|
label: "Accounts",
|
|
3551
3663
|
category: "Apps",
|
|
3552
3664
|
keys: ["SiteLoginForm", "SiteAccountMenu"],
|
|
3553
3665
|
ssr: "shell",
|
|
3554
3666
|
settings: ["site.authRedirect"]
|
|
3555
|
-
},
|
|
3667
|
+
}, tn = n({
|
|
3556
3668
|
user: null,
|
|
3557
3669
|
status: "idle",
|
|
3558
3670
|
ensure: () => {},
|
|
3559
3671
|
refresh: () => {},
|
|
3560
3672
|
signOut: () => {}
|
|
3561
|
-
}),
|
|
3562
|
-
let e = i(
|
|
3673
|
+
}), nn = () => {
|
|
3674
|
+
let e = i(tn);
|
|
3563
3675
|
return a(() => {
|
|
3564
3676
|
e.ensure();
|
|
3565
3677
|
}, [e]), e;
|
|
3566
3678
|
};
|
|
3567
|
-
function
|
|
3679
|
+
function rn({ children: e, initialUser: t, disabled: n, apiUrl: a, tenant: o }) {
|
|
3568
3680
|
let u = i(V), f = a || u?.apiUrl || "/api", p = o || u?.tenant || "", [m, h] = l(t ?? null), [g, _] = l(t ? "user" : n ? "guest" : "idle"), v = c(!1), y = r((e, t) => fetch(`${f}${e}`, {
|
|
3569
3681
|
...t,
|
|
3570
3682
|
credentials: "include",
|
|
@@ -3597,18 +3709,18 @@ function Qt({ children: e, initialUser: t, disabled: n, apiUrl: a, tenant: o })
|
|
|
3597
3709
|
b,
|
|
3598
3710
|
x
|
|
3599
3711
|
]);
|
|
3600
|
-
return /* @__PURE__ */ d(
|
|
3712
|
+
return /* @__PURE__ */ d(tn.Provider, {
|
|
3601
3713
|
value: C,
|
|
3602
3714
|
children: e
|
|
3603
3715
|
});
|
|
3604
3716
|
}
|
|
3605
|
-
function
|
|
3606
|
-
let { status: n } =
|
|
3717
|
+
function an({ when: e, children: t }) {
|
|
3718
|
+
let { status: n } = nn();
|
|
3607
3719
|
return !e || e === "always" ? t : n === "idle" || n === "loading" ? null : e === "user" == (n === "user") ? t : null;
|
|
3608
3720
|
}
|
|
3609
3721
|
//#endregion
|
|
3610
3722
|
//#region ../ui/src/components/builder/apps/auth/views.jsx
|
|
3611
|
-
function
|
|
3723
|
+
function on({ mode: e = "login", redirect: t, emailLabel: n = "Email", passwordLabel: r = "Password", nameLabel: a = "Name", submitLabel: o, style: s, nodeRef: c, inert: u, linked: p, show: m }) {
|
|
3612
3724
|
let { tenant: h, apiUrl: g, settings: _ } = i(V), [v, y] = l("form"), [b, x] = l(""), [S, C] = l(!1), w = e === "register", T = u ? m || "form" : v, E = (e) => typeof e == "string" && e.startsWith("/") && !e.startsWith("//") ? e : "", O = async (e) => {
|
|
3613
3725
|
if (e.preventDefault(), u) return;
|
|
3614
3726
|
let n = new FormData(e.currentTarget);
|
|
@@ -3732,8 +3844,8 @@ function en({ mode: e = "login", redirect: t, emailLabel: n = "Email", passwordL
|
|
|
3732
3844
|
]
|
|
3733
3845
|
});
|
|
3734
3846
|
}
|
|
3735
|
-
function
|
|
3736
|
-
let { user: c, status: l, signOut: u } =
|
|
3847
|
+
function sn({ greeting: e = "Hi", signOutLabel: t = "Sign out", showEmail: n = !1, style: r, nodeRef: i, inert: a, linked: o, show: s }) {
|
|
3848
|
+
let { user: c, status: l, signOut: u } = nn(), p = a ? s || "user" : l, m = a ? {
|
|
3737
3849
|
name: "Ada Lovelace",
|
|
3738
3850
|
email: "ada@example.com"
|
|
3739
3851
|
} : c;
|
|
@@ -3797,8 +3909,157 @@ function tn({ greeting: e = "Hi", signOutLabel: t = "Sign out", showEmail: n = !
|
|
|
3797
3909
|
});
|
|
3798
3910
|
}
|
|
3799
3911
|
//#endregion
|
|
3912
|
+
//#region ../ui/src/components/builder/apps/consent/manifest.js
|
|
3913
|
+
var cn = {
|
|
3914
|
+
id: "consent",
|
|
3915
|
+
label: "Cookie consent",
|
|
3916
|
+
category: "Apps",
|
|
3917
|
+
keys: ["CookieConsent"],
|
|
3918
|
+
ssr: "shell",
|
|
3919
|
+
settings: []
|
|
3920
|
+
}, ln = "webim.cookie_consent";
|
|
3921
|
+
function un() {
|
|
3922
|
+
try {
|
|
3923
|
+
let e = window.localStorage.getItem(ln), t = e ? JSON.parse(e) : null;
|
|
3924
|
+
return t?.choice === "accepted" || t?.choice === "declined" ? t.choice : "";
|
|
3925
|
+
} catch {
|
|
3926
|
+
return "";
|
|
3927
|
+
}
|
|
3928
|
+
}
|
|
3929
|
+
function dn(e) {
|
|
3930
|
+
try {
|
|
3931
|
+
document.querySelectorAll(".webim-page").forEach((t) => t.setAttribute("data-webim-consent", e));
|
|
3932
|
+
} catch {}
|
|
3933
|
+
}
|
|
3934
|
+
function fn(e) {
|
|
3935
|
+
try {
|
|
3936
|
+
window.localStorage.setItem(ln, JSON.stringify({
|
|
3937
|
+
choice: e,
|
|
3938
|
+
at: (/* @__PURE__ */ new Date()).toISOString()
|
|
3939
|
+
}));
|
|
3940
|
+
} catch {}
|
|
3941
|
+
dn(e);
|
|
3942
|
+
try {
|
|
3943
|
+
window.dispatchEvent(new CustomEvent("webim:consent", { detail: { choice: e } }));
|
|
3944
|
+
} catch {}
|
|
3945
|
+
}
|
|
3946
|
+
var pn = {
|
|
3947
|
+
bottom: {
|
|
3948
|
+
left: 0,
|
|
3949
|
+
right: 0,
|
|
3950
|
+
bottom: 0
|
|
3951
|
+
},
|
|
3952
|
+
top: {
|
|
3953
|
+
left: 0,
|
|
3954
|
+
right: 0,
|
|
3955
|
+
top: 0
|
|
3956
|
+
},
|
|
3957
|
+
"bottom-left": {
|
|
3958
|
+
left: 16,
|
|
3959
|
+
bottom: 16,
|
|
3960
|
+
maxWidth: 400
|
|
3961
|
+
},
|
|
3962
|
+
"bottom-right": {
|
|
3963
|
+
right: 16,
|
|
3964
|
+
bottom: 16,
|
|
3965
|
+
maxWidth: 400
|
|
3966
|
+
}
|
|
3967
|
+
};
|
|
3968
|
+
function mn({ message: e, acceptLabel: t, rejectLabel: n, showReject: r, linkLabel: i, linkHref: o, position: s, linked: c, style: p, nodeRef: m, inert: h }) {
|
|
3969
|
+
let [g, _] = l(!!h), [v, y] = l(null), b = (e) => {
|
|
3970
|
+
y(e), typeof m == "function" && m(e);
|
|
3971
|
+
};
|
|
3972
|
+
if (a(() => {
|
|
3973
|
+
if (h) return;
|
|
3974
|
+
let e = un();
|
|
3975
|
+
if (e) {
|
|
3976
|
+
let t = v?.closest?.(".webim-page");
|
|
3977
|
+
t && t.setAttribute("data-webim-consent", e);
|
|
3978
|
+
} else _(!0);
|
|
3979
|
+
}, [h, v]), !g) return null;
|
|
3980
|
+
let x = (e) => () => {
|
|
3981
|
+
h || (fn(e, v), _(!1));
|
|
3982
|
+
}, S = pn[s] ?? pn.bottom, C = {
|
|
3983
|
+
appearance: "none",
|
|
3984
|
+
font: "inherit",
|
|
3985
|
+
fontSize: 14,
|
|
3986
|
+
fontWeight: 600,
|
|
3987
|
+
padding: "8px 16px",
|
|
3988
|
+
borderRadius: 8,
|
|
3989
|
+
cursor: h ? "default" : "pointer",
|
|
3990
|
+
whiteSpace: "nowrap"
|
|
3991
|
+
};
|
|
3992
|
+
return /* @__PURE__ */ f("div", {
|
|
3993
|
+
ref: b,
|
|
3994
|
+
role: "region",
|
|
3995
|
+
"aria-label": "Cookie consent",
|
|
3996
|
+
style: {
|
|
3997
|
+
...h ? { position: "relative" } : {
|
|
3998
|
+
position: "fixed",
|
|
3999
|
+
zIndex: 2147483e3,
|
|
4000
|
+
...S
|
|
4001
|
+
},
|
|
4002
|
+
display: "flex",
|
|
4003
|
+
flexWrap: "wrap",
|
|
4004
|
+
alignItems: "center",
|
|
4005
|
+
gap: 12,
|
|
4006
|
+
padding: 16,
|
|
4007
|
+
background: "var(--page-surface, #f2f2f2)",
|
|
4008
|
+
color: "var(--page-text, #111827)",
|
|
4009
|
+
border: "1px solid var(--page-border, rgba(148, 163, 184, 0.4))",
|
|
4010
|
+
borderRadius: s === "bottom" || s === "top" ? 0 : 12,
|
|
4011
|
+
boxShadow: "0 8px 30px rgba(15, 23, 42, 0.18)",
|
|
4012
|
+
fontSize: 14,
|
|
4013
|
+
lineHeight: 1.5,
|
|
4014
|
+
...D(p)
|
|
4015
|
+
},
|
|
4016
|
+
children: [/* @__PURE__ */ f("div", {
|
|
4017
|
+
style: {
|
|
4018
|
+
flex: "1 1 260px",
|
|
4019
|
+
minWidth: 0
|
|
4020
|
+
},
|
|
4021
|
+
children: [c?.content ?? (e || "We use cookies to run this site and to understand how it is used."), i && o ? /* @__PURE__ */ f(u, { children: [" ", /* @__PURE__ */ d("a", {
|
|
4022
|
+
href: o,
|
|
4023
|
+
onClick: h ? (e) => e.preventDefault() : void 0,
|
|
4024
|
+
style: {
|
|
4025
|
+
color: "var(--page-accent, inherit)",
|
|
4026
|
+
textDecoration: "underline"
|
|
4027
|
+
},
|
|
4028
|
+
children: i
|
|
4029
|
+
})] }) : null]
|
|
4030
|
+
}), /* @__PURE__ */ f("div", {
|
|
4031
|
+
style: {
|
|
4032
|
+
display: "flex",
|
|
4033
|
+
gap: 8,
|
|
4034
|
+
flexShrink: 0
|
|
4035
|
+
},
|
|
4036
|
+
children: [r === !1 ? null : /* @__PURE__ */ d("button", {
|
|
4037
|
+
type: "button",
|
|
4038
|
+
onClick: x("declined"),
|
|
4039
|
+
style: {
|
|
4040
|
+
...C,
|
|
4041
|
+
background: "transparent",
|
|
4042
|
+
color: "inherit",
|
|
4043
|
+
border: "1px solid var(--page-border, rgba(148, 163, 184, 0.6))"
|
|
4044
|
+
},
|
|
4045
|
+
children: n || "Decline"
|
|
4046
|
+
}), /* @__PURE__ */ d("button", {
|
|
4047
|
+
type: "button",
|
|
4048
|
+
onClick: x("accepted"),
|
|
4049
|
+
style: {
|
|
4050
|
+
...C,
|
|
4051
|
+
background: "var(--page-accent, #111827)",
|
|
4052
|
+
color: "var(--page-accent-text, #ffffff)",
|
|
4053
|
+
border: "1px solid transparent"
|
|
4054
|
+
},
|
|
4055
|
+
children: t || "Accept"
|
|
4056
|
+
})]
|
|
4057
|
+
})]
|
|
4058
|
+
});
|
|
4059
|
+
}
|
|
4060
|
+
//#endregion
|
|
3800
4061
|
//#region ../ui/src/components/builder/apps/language/manifest.js
|
|
3801
|
-
var
|
|
4062
|
+
var hn = {
|
|
3802
4063
|
id: "language",
|
|
3803
4064
|
label: "Language",
|
|
3804
4065
|
category: "Apps",
|
|
@@ -3808,21 +4069,21 @@ var nn = {
|
|
|
3808
4069
|
};
|
|
3809
4070
|
//#endregion
|
|
3810
4071
|
//#region ../ui/src/components/builder/apps/language/views.jsx
|
|
3811
|
-
function
|
|
4072
|
+
function gn(e) {
|
|
3812
4073
|
let t = e?.locales, n = [typeof t?.default == "string" && t.default.trim() ? t.default.trim() : "", ...Array.isArray(t?.enabled) ? t.enabled : []].filter((e) => typeof e == "string" && e.trim());
|
|
3813
4074
|
return [...new Set(n.map((e) => e.trim()))];
|
|
3814
4075
|
}
|
|
3815
|
-
var
|
|
3816
|
-
function
|
|
4076
|
+
var _n = (e) => e && e.charAt(0).toUpperCase() + e.slice(1);
|
|
4077
|
+
function vn(e, t) {
|
|
3817
4078
|
let n = String(e ?? "").toUpperCase();
|
|
3818
4079
|
if (t === "code") return n;
|
|
3819
4080
|
let r = "";
|
|
3820
4081
|
try {
|
|
3821
|
-
r =
|
|
4082
|
+
r = _n(new Intl.DisplayNames([e], { type: "language" }).of(e) ?? "");
|
|
3822
4083
|
} catch {}
|
|
3823
4084
|
return !r || r.toUpperCase() === n ? n : t === "both" ? `${n} — ${r}` : r;
|
|
3824
4085
|
}
|
|
3825
|
-
function
|
|
4086
|
+
function yn(e, t) {
|
|
3826
4087
|
let n = t ? "" : `?locale=${encodeURIComponent(e)}`;
|
|
3827
4088
|
if (typeof window > "u") return n || "?";
|
|
3828
4089
|
try {
|
|
@@ -3832,8 +4093,8 @@ function sn(e, t) {
|
|
|
3832
4093
|
return n || "/";
|
|
3833
4094
|
}
|
|
3834
4095
|
}
|
|
3835
|
-
function
|
|
3836
|
-
let c = i(V), l =
|
|
4096
|
+
function bn({ variant: e, display: t, separator: n, label: r, style: a, nodeRef: o, inert: s }) {
|
|
4097
|
+
let c = i(V), l = gn(c?.settings), u = l[0] ?? "", p = l.includes(c?.locale) ? c.locale : u, m = {
|
|
3837
4098
|
display: "inline-flex",
|
|
3838
4099
|
alignItems: "center",
|
|
3839
4100
|
gap: 8,
|
|
@@ -3868,7 +4129,7 @@ function cn({ variant: e, display: t, separator: n, label: r, style: a, nodeRef:
|
|
|
3868
4129
|
style: { opacity: .4 },
|
|
3869
4130
|
children: n ?? "·"
|
|
3870
4131
|
}), /* @__PURE__ */ d("a", {
|
|
3871
|
-
href:
|
|
4132
|
+
href: yn(e, e === u),
|
|
3872
4133
|
hrefLang: e,
|
|
3873
4134
|
"aria-current": e === p ? "true" : void 0,
|
|
3874
4135
|
onClick: s ? (e) => e.preventDefault() : void 0,
|
|
@@ -3878,7 +4139,7 @@ function cn({ variant: e, display: t, separator: n, label: r, style: a, nodeRef:
|
|
|
3878
4139
|
textDecoration: "none",
|
|
3879
4140
|
cursor: s ? "default" : "pointer"
|
|
3880
4141
|
},
|
|
3881
|
-
children:
|
|
4142
|
+
children: vn(e, t)
|
|
3882
4143
|
})]
|
|
3883
4144
|
}, e))]
|
|
3884
4145
|
}) : /* @__PURE__ */ f("div", {
|
|
@@ -3889,7 +4150,7 @@ function cn({ variant: e, display: t, separator: n, label: r, style: a, nodeRef:
|
|
|
3889
4150
|
value: p,
|
|
3890
4151
|
onChange: s ? void 0 : (e) => {
|
|
3891
4152
|
let t = e.target.value;
|
|
3892
|
-
window.location.assign(
|
|
4153
|
+
window.location.assign(yn(t, t === u));
|
|
3893
4154
|
},
|
|
3894
4155
|
onKeyDown: s ? (e) => e.preventDefault() : void 0,
|
|
3895
4156
|
style: {
|
|
@@ -3903,50 +4164,55 @@ function cn({ variant: e, display: t, separator: n, label: r, style: a, nodeRef:
|
|
|
3903
4164
|
},
|
|
3904
4165
|
children: l.map((e) => /* @__PURE__ */ d("option", {
|
|
3905
4166
|
value: e,
|
|
3906
|
-
children:
|
|
4167
|
+
children: vn(e, t)
|
|
3907
4168
|
}, e))
|
|
3908
4169
|
})]
|
|
3909
4170
|
});
|
|
3910
4171
|
}
|
|
3911
4172
|
//#endregion
|
|
3912
4173
|
//#region ../ui/src/components/builder/apps/index.js
|
|
3913
|
-
var
|
|
3914
|
-
|
|
3915
|
-
|
|
3916
|
-
|
|
4174
|
+
var xn = [
|
|
4175
|
+
en,
|
|
4176
|
+
hn,
|
|
4177
|
+
cn
|
|
4178
|
+
], Sn = {
|
|
4179
|
+
SiteLoginForm: on,
|
|
4180
|
+
SiteAccountMenu: sn,
|
|
4181
|
+
SiteLanguagePicker: bn,
|
|
4182
|
+
CookieConsent: mn
|
|
3917
4183
|
};
|
|
3918
|
-
new Set(
|
|
4184
|
+
new Set(xn.filter((e) => e.ssr === "shell").flatMap((e) => e.keys));
|
|
3919
4185
|
//#endregion
|
|
3920
4186
|
//#region ../ui/src/components/builder/plugins/runtime.js
|
|
3921
|
-
var
|
|
3922
|
-
function
|
|
3923
|
-
if (
|
|
4187
|
+
var Cn = /* @__PURE__ */ new Map();
|
|
4188
|
+
function wn(e) {
|
|
4189
|
+
if (Cn.has(e)) return Cn.get(e);
|
|
3924
4190
|
let t = URL.createObjectURL(new Blob([e], { type: "text/javascript" })), n = import(
|
|
3925
4191
|
/* @vite-ignore */
|
|
3926
4192
|
/* webpackIgnore: true */
|
|
3927
4193
|
t
|
|
3928
4194
|
).finally(() => URL.revokeObjectURL(t));
|
|
3929
|
-
return
|
|
4195
|
+
return Cn.set(e, n), n;
|
|
3930
4196
|
}
|
|
3931
|
-
function
|
|
4197
|
+
function Tn(e) {
|
|
3932
4198
|
let t = e && typeof e == "object" ? e.builder_plugins : null, n = t && typeof t == "object" ? t.plugins : null;
|
|
3933
4199
|
return n && typeof n == "object" ? n : {};
|
|
3934
4200
|
}
|
|
3935
4201
|
//#endregion
|
|
3936
4202
|
//#region ../ui/src/components/builder/plugins/view.jsx
|
|
3937
|
-
async function
|
|
3938
|
-
let n = await
|
|
4203
|
+
async function En(e, t) {
|
|
4204
|
+
let n = await wn(e);
|
|
3939
4205
|
return (Array.isArray(n?.default?.blocks) ? n.default.blocks : []).find((e) => e?.id === t && typeof e.mount == "function") ?? null;
|
|
3940
4206
|
}
|
|
3941
|
-
var
|
|
4207
|
+
var Dn = {
|
|
3942
4208
|
padding: "10px 12px",
|
|
3943
4209
|
border: "1px dashed rgba(148, 163, 184, 0.5)",
|
|
3944
4210
|
borderRadius: 8,
|
|
3945
4211
|
fontSize: 12,
|
|
3946
4212
|
opacity: .6
|
|
3947
4213
|
};
|
|
3948
|
-
function
|
|
3949
|
-
let s = i(V), l =
|
|
4214
|
+
function On({ pluginId: e, blockId: t, props: n, style: r, nodeRef: o }) {
|
|
4215
|
+
let s = i(V), l = Tn(s?.settings)[e], u = c(null), p = c(null), m = {
|
|
3950
4216
|
tenant: s?.tenant ?? "",
|
|
3951
4217
|
apiUrl: s?.apiUrl ?? "/api",
|
|
3952
4218
|
locale: s?.locale ?? "",
|
|
@@ -3958,7 +4224,7 @@ function gn({ pluginId: e, blockId: t, props: n, style: r, nodeRef: o }) {
|
|
|
3958
4224
|
let e = u.current;
|
|
3959
4225
|
if (!l?.code || !e) return;
|
|
3960
4226
|
let n = !0;
|
|
3961
|
-
return
|
|
4227
|
+
return En(l.code, t).then((e) => {
|
|
3962
4228
|
if (!(!n || !e || !u.current)) {
|
|
3963
4229
|
p.current = e;
|
|
3964
4230
|
try {
|
|
@@ -3988,7 +4254,7 @@ function gn({ pluginId: e, blockId: t, props: n, style: r, nodeRef: o }) {
|
|
|
3988
4254
|
}) : /* @__PURE__ */ f("div", {
|
|
3989
4255
|
ref: o,
|
|
3990
4256
|
style: {
|
|
3991
|
-
...
|
|
4257
|
+
...Dn,
|
|
3992
4258
|
...D(r)
|
|
3993
4259
|
},
|
|
3994
4260
|
children: [
|
|
@@ -4000,12 +4266,12 @@ function gn({ pluginId: e, blockId: t, props: n, style: r, nodeRef: o }) {
|
|
|
4000
4266
|
}
|
|
4001
4267
|
//#endregion
|
|
4002
4268
|
//#region ../ui/src/components/builder/render.jsx
|
|
4003
|
-
var
|
|
4004
|
-
|
|
4005
|
-
...
|
|
4006
|
-
PluginBlock:
|
|
4269
|
+
var kn = {
|
|
4270
|
+
...$t,
|
|
4271
|
+
...Sn,
|
|
4272
|
+
PluginBlock: On
|
|
4007
4273
|
};
|
|
4008
|
-
function
|
|
4274
|
+
function An(e, n, r, i = /* @__PURE__ */ new Set(), a = void 0) {
|
|
4009
4275
|
let o = n[e];
|
|
4010
4276
|
if (!o || o.hidden) return null;
|
|
4011
4277
|
let s = o.type?.resolvedName, c = a?.mapProps ? a.mapProps(o.props ?? {}, s) : o.props ?? {};
|
|
@@ -4013,11 +4279,11 @@ function vn(e, n, r, i = /* @__PURE__ */ new Set(), a = void 0) {
|
|
|
4013
4279
|
let n = o.props?.componentId, s = r?.[n];
|
|
4014
4280
|
if (!s?.template || i.has(n)) return null;
|
|
4015
4281
|
let c = new Set(i).add(n);
|
|
4016
|
-
return /* @__PURE__ */ d(t, { children:
|
|
4282
|
+
return /* @__PURE__ */ d(t, { children: An(s.template.rootId, s.template.nodes, r, c, a) }, e);
|
|
4017
4283
|
}
|
|
4018
|
-
let l =
|
|
4284
|
+
let l = kn[s];
|
|
4019
4285
|
if (!l) return null;
|
|
4020
|
-
let u = (o.nodes ?? []).map((e) =>
|
|
4286
|
+
let u = (o.nodes ?? []).map((e) => An(e, n, r, i, a)).filter(Boolean), f = Object.entries(o.linkedNodes ?? {}), p = f.length ? Object.fromEntries(f.map(([e, t]) => [e, An(t, n, r, i)])) : void 0, m = /* @__PURE__ */ d(l, {
|
|
4021
4287
|
...c,
|
|
4022
4288
|
...s === "CollectionList" ? { templateId: o.linkedNodes?.card } : null,
|
|
4023
4289
|
linked: p,
|
|
@@ -4026,16 +4292,16 @@ function vn(e, n, r, i = /* @__PURE__ */ new Set(), a = void 0) {
|
|
|
4026
4292
|
},
|
|
4027
4293
|
children: u.length ? u : void 0
|
|
4028
4294
|
}, e);
|
|
4029
|
-
return c.when && c.when !== "always" ? /* @__PURE__ */ d(
|
|
4295
|
+
return c.when && c.when !== "always" ? /* @__PURE__ */ d(an, {
|
|
4030
4296
|
when: c.when,
|
|
4031
4297
|
children: m
|
|
4032
4298
|
}, e) : m;
|
|
4033
4299
|
}
|
|
4034
4300
|
//#endregion
|
|
4035
4301
|
//#region ../ui/src/components/builder/PageRenderer.jsx
|
|
4036
|
-
var
|
|
4302
|
+
var jn = (e) => Object.entries(e).map(([e, t]) => `${e}: ${t};`).join(" "), Mn = (e) => `.webim-page[data-webim-mode="light"] { ${Object.entries(B(e.light)).map(([e, t]) => `${e}: ${t} !important;`).join(" ")} }
|
|
4037
4303
|
.webim-page[data-webim-mode="dark"] { ${Object.entries(B(e.dark)).map(([e, t]) => `${e}: ${t} !important;`).join(" ")} }`;
|
|
4038
|
-
function
|
|
4304
|
+
function Nn({ blocks: e, theme: t, components: n, mode: r = "auto", style: i, custom: o, tenant: c, apiUrl: l, datasets: u, locale: p, direction: m, settings: g, siteUser: _ }) {
|
|
4039
4305
|
let v = o?.js?.trim();
|
|
4040
4306
|
if (a(() => {
|
|
4041
4307
|
if (!v) return;
|
|
@@ -4049,11 +4315,11 @@ function xn({ blocks: e, theme: t, components: n, mode: r = "auto", style: i, cu
|
|
|
4049
4315
|
minHeight: "100%",
|
|
4050
4316
|
display: "flex",
|
|
4051
4317
|
flexDirection: "column"
|
|
4052
|
-
}, w =
|
|
4318
|
+
}, w = An("ROOT", e, n), T = s(() => ({ render: (t, r) => An(t, e, n, void 0, { mapProps: r }) }), [e, n]), E = re(e, n), D = ne(e, n), O = o?.css?.trim(), k = z(t), A = [k.font, k.headingFont].filter((e) => typeof e == "string" && e.trim() && e !== "inherit" && !R[e]), j = [.../* @__PURE__ */ new Set([...C(e, n), ...A])].map((e) => /* @__PURE__ */ d("link", {
|
|
4053
4319
|
rel: "stylesheet",
|
|
4054
4320
|
precedence: "default",
|
|
4055
4321
|
href: b(e)
|
|
4056
|
-
}, e)), M =
|
|
4322
|
+
}, e)), M = Mn(k);
|
|
4057
4323
|
return r === "auto" ? /* @__PURE__ */ d(V.Provider, {
|
|
4058
4324
|
value: {
|
|
4059
4325
|
tenant: c || "",
|
|
@@ -4061,7 +4327,7 @@ function xn({ blocks: e, theme: t, components: n, mode: r = "auto", style: i, cu
|
|
|
4061
4327
|
locale: p || "",
|
|
4062
4328
|
settings: g ?? null
|
|
4063
4329
|
},
|
|
4064
|
-
children: /* @__PURE__ */ d(
|
|
4330
|
+
children: /* @__PURE__ */ d(rn, {
|
|
4065
4331
|
initialUser: _,
|
|
4066
4332
|
children: /* @__PURE__ */ d(H.Provider, {
|
|
4067
4333
|
value: u ?? null,
|
|
@@ -4076,8 +4342,8 @@ function xn({ blocks: e, theme: t, components: n, mode: r = "auto", style: i, cu
|
|
|
4076
4342
|
...i
|
|
4077
4343
|
},
|
|
4078
4344
|
children: [
|
|
4079
|
-
/* @__PURE__ */ d("style", { children: `.webim-page { ${
|
|
4080
|
-
@media (prefers-color-scheme: dark) { .webim-page { ${
|
|
4345
|
+
/* @__PURE__ */ d("style", { children: `.webim-page { ${jn(B(k.light))} }
|
|
4346
|
+
@media (prefers-color-scheme: dark) { .webim-page { ${jn(B(k.dark))} } }` }),
|
|
4081
4347
|
/* @__PURE__ */ d("style", { children: M }),
|
|
4082
4348
|
j,
|
|
4083
4349
|
/* @__PURE__ */ d("style", { children: x }),
|
|
@@ -4097,7 +4363,7 @@ function xn({ blocks: e, theme: t, components: n, mode: r = "auto", style: i, cu
|
|
|
4097
4363
|
locale: p || "",
|
|
4098
4364
|
settings: g ?? null
|
|
4099
4365
|
},
|
|
4100
|
-
children: /* @__PURE__ */ d(
|
|
4366
|
+
children: /* @__PURE__ */ d(rn, {
|
|
4101
4367
|
initialUser: _,
|
|
4102
4368
|
children: /* @__PURE__ */ d(H.Provider, {
|
|
4103
4369
|
value: u ?? null,
|
|
@@ -4128,8 +4394,8 @@ function xn({ blocks: e, theme: t, components: n, mode: r = "auto", style: i, cu
|
|
|
4128
4394
|
}
|
|
4129
4395
|
//#endregion
|
|
4130
4396
|
//#region src/WebimContent.jsx
|
|
4131
|
-
function
|
|
4132
|
-
return e?.blocks?.ROOT ? /* @__PURE__ */ d(
|
|
4397
|
+
function Pn({ bundle: e, mode: t = "auto", style: n }) {
|
|
4398
|
+
return e?.blocks?.ROOT ? /* @__PURE__ */ d(Nn, {
|
|
4133
4399
|
blocks: e.blocks,
|
|
4134
4400
|
theme: e.theme,
|
|
4135
4401
|
components: e.components,
|
|
@@ -4146,7 +4412,7 @@ function Sn({ bundle: e, mode: t = "auto", style: n }) {
|
|
|
4146
4412
|
}
|
|
4147
4413
|
//#endregion
|
|
4148
4414
|
//#region src/bundle.js
|
|
4149
|
-
function
|
|
4415
|
+
function Fn({ page: e, settings: t, tenant: n, apiUrl: r, locale: i }) {
|
|
4150
4416
|
let a = {
|
|
4151
4417
|
...t?.global ?? {},
|
|
4152
4418
|
...t?.tenant ?? {}
|
|
@@ -4171,18 +4437,18 @@ function Cn({ page: e, settings: t, tenant: n, apiUrl: r, locale: i }) {
|
|
|
4171
4437
|
}
|
|
4172
4438
|
//#endregion
|
|
4173
4439
|
//#region src/fetchPage.js
|
|
4174
|
-
var
|
|
4440
|
+
var In = async (e) => {
|
|
4175
4441
|
let t = await e.json().catch(() => null);
|
|
4176
4442
|
if (!e.ok || t?.success === !1) throw Error(t?.error?.message || `Request failed (${e.status})`);
|
|
4177
4443
|
return t?.payload ?? t;
|
|
4178
4444
|
};
|
|
4179
|
-
async function
|
|
4445
|
+
async function Ln({ apiUrl: e, tenant: t, slug: n, locale: r, preview: i, token: a, page: o, fetch: s }) {
|
|
4180
4446
|
if (!e) throw Error("fetchPage: apiUrl is required");
|
|
4181
4447
|
if (!n) throw Error("fetchPage: slug is required");
|
|
4182
4448
|
let c = s ?? fetch, l = e.replace(/\/$/, ""), u = {
|
|
4183
4449
|
...t ? { "x-tenant": t } : {},
|
|
4184
4450
|
...a ? { authorization: `Bearer ${a}` } : {}
|
|
4185
|
-
}, [d, f] = await Promise.all([c(`${l}/render/${encodeURIComponent(n)}${i ? `?preview=${encodeURIComponent(i)}` : ""}`, { headers: u }).then(
|
|
4451
|
+
}, [d, f] = await Promise.all([c(`${l}/render/${encodeURIComponent(n)}${i ? `?preview=${encodeURIComponent(i)}` : ""}`, { headers: u }).then(In), c(`${l}/settings/public`, { headers: u }).then(In)]), p = Fn({
|
|
4186
4452
|
page: d,
|
|
4187
4453
|
settings: f,
|
|
4188
4454
|
tenant: t,
|
|
@@ -4190,7 +4456,7 @@ async function Tn({ apiUrl: e, tenant: t, slug: n, locale: r, preview: i, token:
|
|
|
4190
4456
|
locale: r
|
|
4191
4457
|
}), m = [...new Set(Object.values(p.blocks ?? {}).map((e) => e?.type?.resolvedName === "CollectionList" ? e.props?.collection : e?.type?.resolvedName === "TableBlock" || e?.type?.resolvedName === "OrgChartBlock" ? e.props?.source : null).filter(Boolean))];
|
|
4192
4458
|
if (m.length) {
|
|
4193
|
-
let e = (e) => e.startsWith("api:") ? `${l}/data/${encodeURIComponent(e.slice(4))}` : `${l}/dynamic/${encodeURIComponent(e)}?all=1${r ? `&locale=${encodeURIComponent(r)}` : ""}`, t = await Promise.all(m.map((t) => c(e(t), { headers: u }).then(
|
|
4459
|
+
let e = (e) => e.startsWith("api:") ? `${l}/data/${encodeURIComponent(e.slice(4))}` : `${l}/dynamic/${encodeURIComponent(e)}?all=1${r ? `&locale=${encodeURIComponent(r)}` : ""}`, t = await Promise.all(m.map((t) => c(e(t), { headers: u }).then(In).then((e) => {
|
|
4194
4460
|
let n = Array.isArray(e) ? e : Array.isArray(e?.data) ? e.data : [], r = Number(e?.total?.filtered ?? e?.total?.all ?? n.length);
|
|
4195
4461
|
return [[t, n], [`${t}:total`, Number.isFinite(r) ? r : n.length]];
|
|
4196
4462
|
}).catch(() => [[t, []]])));
|
|
@@ -4204,40 +4470,40 @@ async function Tn({ apiUrl: e, tenant: t, slug: n, locale: r, preview: i, token:
|
|
|
4204
4470
|
}
|
|
4205
4471
|
//#endregion
|
|
4206
4472
|
//#region src/ssr.jsx
|
|
4207
|
-
var
|
|
4473
|
+
var $ = (e) => String(e ?? "").replace(/[&<>"]/g, (e) => ({
|
|
4208
4474
|
"&": "&",
|
|
4209
4475
|
"<": "<",
|
|
4210
4476
|
">": ">",
|
|
4211
4477
|
"\"": """
|
|
4212
4478
|
})[e]);
|
|
4213
|
-
function
|
|
4214
|
-
return e(/* @__PURE__ */ d(
|
|
4479
|
+
function Rn(t, { mode: n = "auto", style: r } = {}) {
|
|
4480
|
+
return e(/* @__PURE__ */ d(Pn, {
|
|
4215
4481
|
bundle: t,
|
|
4216
4482
|
mode: n,
|
|
4217
4483
|
style: r
|
|
4218
4484
|
}));
|
|
4219
4485
|
}
|
|
4220
|
-
function
|
|
4486
|
+
function zn(e, { mode: t = "auto", lang: n } = {}) {
|
|
4221
4487
|
let r = e.seo ?? {}, i = n || e.locale || "en", a = h(e.direction, i), o = r.title || e.title || e.slug || "Page", s = e.custom?.js?.trim(), c = [
|
|
4222
4488
|
"<meta charset=\"utf-8\"/>",
|
|
4223
4489
|
"<meta name=\"viewport\" content=\"width=device-width, initial-scale=1\"/>",
|
|
4224
|
-
`<title>${
|
|
4225
|
-
r.description && `<meta name="description" content="${
|
|
4226
|
-
`<meta property="og:title" content="${
|
|
4227
|
-
r.image && `<meta property="og:image" content="${
|
|
4490
|
+
`<title>${$(o)}</title>`,
|
|
4491
|
+
r.description && `<meta name="description" content="${$(r.description)}"/>`,
|
|
4492
|
+
`<meta property="og:title" content="${$(o)}"/>`,
|
|
4493
|
+
r.image && `<meta property="og:image" content="${$(r.image)}"/>`,
|
|
4228
4494
|
r.noindex && "<meta name=\"robots\" content=\"noindex\"/>",
|
|
4229
4495
|
"<style>html,body{margin:0;height:100%}</style>"
|
|
4230
4496
|
].filter(Boolean).join("\n");
|
|
4231
4497
|
return `<!doctype html>
|
|
4232
|
-
<html lang="${
|
|
4498
|
+
<html lang="${$(i)}"${a ? ` dir="${a}"` : ""}>
|
|
4233
4499
|
<head>
|
|
4234
4500
|
${c}
|
|
4235
4501
|
</head>
|
|
4236
4502
|
<body>
|
|
4237
|
-
${
|
|
4503
|
+
${Rn(e, { mode: t })}
|
|
4238
4504
|
${s ? `<script>${s.replaceAll("<\/script", "<\\/script")}<\/script>` : ""}
|
|
4239
4505
|
</body>
|
|
4240
4506
|
</html>`;
|
|
4241
4507
|
}
|
|
4242
4508
|
//#endregion
|
|
4243
|
-
export {
|
|
4509
|
+
export { Fn as assembleBundle, Ln as fetchPage, Rn as renderBundleHtml, zn as renderPageDocument };
|