@chaibuilder/sdk 0.1.25 → 0.1.26
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{AddBlocks-340542cc.js → AddBlocks-161cb307.js} +1 -1
- package/dist/{AddBlocks-2e763e41.cjs → AddBlocks-27cf978a.cjs} +1 -1
- package/dist/{BrandingOptions-da602397.js → BrandingOptions-97a2a079.js} +1 -1
- package/dist/{BrandingOptions-93298418.cjs → BrandingOptions-e0f6e657.cjs} +1 -1
- package/dist/{CanvasArea-0ba49a92.js → CanvasArea-03429375.js} +2 -2
- package/dist/{CanvasArea-20982a8b.cjs → CanvasArea-8b976012.cjs} +2 -2
- package/dist/{CurrentPage-41e66713.js → CurrentPage-144a9895.js} +1 -1
- package/dist/{CurrentPage-7c0e986b.cjs → CurrentPage-d0c34230.cjs} +1 -1
- package/dist/{Layers-15b9cf48.js → Layers-e85a5d48.js} +2 -2
- package/dist/{Layers-cc22fb98.cjs → Layers-e8fce30a.cjs} +1 -1
- package/dist/{MarkAsGlobalBlock-143a204d.js → MarkAsGlobalBlock-8f9c2527.js} +1 -1
- package/dist/{MarkAsGlobalBlock-4f9dad50.cjs → MarkAsGlobalBlock-be8472ad.cjs} +1 -1
- package/dist/{PagesPanel-6dbcc705.cjs → PagesPanel-30564220.cjs} +1 -1
- package/dist/{PagesPanel-29e8ff05.js → PagesPanel-c2aafd16.js} +2 -2
- package/dist/{ProjectPanel-0cf59dff.js → ProjectPanel-60721d3e.js} +2 -2
- package/dist/{ProjectPanel-e3ecad42.cjs → ProjectPanel-dc4a2415.cjs} +1 -1
- package/dist/{Settings-5df6bc31.js → Settings-c58fc45b.js} +1 -1
- package/dist/{Settings-ae8b67c5.cjs → Settings-f12123c4.cjs} +1 -1
- package/dist/{SidePanels-7c31e973.js → SidePanels-180ca368.js} +2 -2
- package/dist/{SidePanels-fbf3d99d.cjs → SidePanels-9f5fe660.cjs} +1 -1
- package/dist/{Topbar-f6d0676d.js → Topbar-51478e94.js} +1 -1
- package/dist/{Topbar-506281be.cjs → Topbar-554f4f23.cjs} +1 -1
- package/dist/{add-page-modal-f7b31884.js → add-page-modal-1d77b545.js} +1 -1
- package/dist/{add-page-modal-87e921d2.cjs → add-page-modal-f0e85f12.cjs} +1 -1
- package/dist/core.cjs +1 -1
- package/dist/core.js +1 -1
- package/dist/{delete-page-modal-8cfafe5d.cjs → delete-page-modal-5b050396.cjs} +1 -1
- package/dist/{delete-page-modal-afc5ac26.js → delete-page-modal-7c83e048.js} +1 -1
- package/dist/{index-cbeea3bc.cjs → index-1bf563c1.cjs} +2 -2
- package/dist/{index-d1a25967.js → index-2ff849f6.js} +3 -3
- package/dist/{page-viewer-f651f579.js → page-viewer-5e3e11cd.js} +2 -2
- package/dist/{page-viewer-9b33c8bb.cjs → page-viewer-bd09dc9d.cjs} +1 -1
- package/dist/{project-general-setting-0ceca7f5.cjs → project-general-setting-46c17b7b.cjs} +1 -1
- package/dist/{project-general-setting-15cad783.js → project-general-setting-77d36c23.js} +1 -1
- package/dist/render.cjs +1 -1
- package/dist/render.d.ts +1 -1
- package/dist/render.js +55 -39
- package/dist/{single-page-detail-8d4fb1c8.js → single-page-detail-39a07929.js} +2 -2
- package/dist/{single-page-detail-ae2a5b54.cjs → single-page-detail-fcacbb82.cjs} +1 -1
- package/package.json +1 -1
|
@@ -27488,7 +27488,7 @@ const uZ = () => {
|
|
|
27488
27488
|
const a = pr(e);
|
|
27489
27489
|
Cf(a) && (n = [a, ...pL(t, a)]), r(n);
|
|
27490
27490
|
}, [e, t, r]);
|
|
27491
|
-
}, FZ = () => Ge(fA), bL = Fn(() => import("./SidePanels-
|
|
27491
|
+
}, FZ = () => Ge(fA), bL = Fn(() => import("./SidePanels-180ca368.js")), gL = Fn(() => import("./Topbar-51478e94.js")), mL = Fn(() => import("./CanvasArea-03429375.js")), vL = Fn(() => import("./Settings-c58fc45b.js")), yL = () => {
|
|
27492
27492
|
const [e] = Me(Oc), t = (r) => {
|
|
27493
27493
|
r.preventDefault();
|
|
27494
27494
|
};
|
|
@@ -28743,7 +28743,7 @@ function hW() {
|
|
|
28743
28743
|
};
|
|
28744
28744
|
return nW(om(om({}, t), e));
|
|
28745
28745
|
}
|
|
28746
|
-
const bW = "@chaibuilder/sdk", gW = "0.1.
|
|
28746
|
+
const bW = "@chaibuilder/sdk", gW = "0.1.26", mW = "module", vW = [
|
|
28747
28747
|
"dist"
|
|
28748
28748
|
], yW = "dist/core.js", wW = !1, SW = {
|
|
28749
28749
|
".": {
|
|
@@ -30826,7 +30826,7 @@ const ls = () => {
|
|
|
30826
30826
|
})).json();
|
|
30827
30827
|
}
|
|
30828
30828
|
});
|
|
30829
|
-
}, vK = Fn(() => import("./PagesPanel-
|
|
30829
|
+
}, vK = Fn(() => import("./PagesPanel-c2aafd16.js")), yK = Fn(() => import("./ProjectPanel-60721d3e.js")), wK = Fn(() => import("./CurrentPage-144a9895.js")), SK = () => /* @__PURE__ */ oe.jsx("h2", { children: "Your Logo" }), AK = () => {
|
|
30830
30830
|
const e = Pr();
|
|
30831
30831
|
return /* @__PURE__ */ oe.jsx("div", { className: "border-gray-200 rounded-md p-2 mb-2 border", children: /* @__PURE__ */ oe.jsx(
|
|
30832
30832
|
kE,
|
|
@@ -2,7 +2,7 @@ import { j as e } from "./jsx-runtime-944c88e2.js";
|
|
|
2
2
|
import o, { useState as m, Suspense as c } from "react";
|
|
3
3
|
import { HomeIcon as p, FileTextIcon as u, ChevronRightIcon as d, GearIcon as x } from "@radix-ui/react-icons";
|
|
4
4
|
import { P as g, a as h, b as f } from "./popover-f7addcf4.js";
|
|
5
|
-
import { U as j, R as N, T as b } from "./index-
|
|
5
|
+
import { U as j, R as N, T as b } from "./index-2ff849f6.js";
|
|
6
6
|
import "@radix-ui/react-popover";
|
|
7
7
|
import "./utils-ac68b2c8.js";
|
|
8
8
|
import "clsx";
|
|
@@ -32,7 +32,7 @@ import "@react-hookz/web";
|
|
|
32
32
|
import "@chaibuilder/blocks";
|
|
33
33
|
import "lucide-react";
|
|
34
34
|
import "sonner";
|
|
35
|
-
const P = o.lazy(() => import("./single-page-detail-
|
|
35
|
+
const P = o.lazy(() => import("./single-page-detail-39a07929.js")), v = ({ pageData: t }) => {
|
|
36
36
|
const [s, r] = m("CLOSE");
|
|
37
37
|
return /* @__PURE__ */ e.jsxs(
|
|
38
38
|
g,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./jsx-runtime-5c3ac4f7.cjs"),n=require("react"),u=require("@radix-ui/react-icons"),o=require("./popover-7cb9079b.cjs"),x=require("./index-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./jsx-runtime-5c3ac4f7.cjs"),n=require("react"),u=require("@radix-ui/react-icons"),o=require("./popover-7cb9079b.cjs"),x=require("./index-1bf563c1.cjs");require("@radix-ui/react-popover");require("./utils-3c452dd0.cjs");require("clsx");require("tailwind-merge");require("./MODIFIERS-4716c669.cjs");require("@radix-ui/react-scroll-area");require("react-dom");require("@floating-ui/react-dom");require("jotai");require("i18next");require("react-i18next");require("flagged");require("react-dnd");require("lodash");require("@minoru/react-dnd-treeview");require("./useBuilderProp-5e57d0c8.cjs");require("@radix-ui/react-slot");require("class-variance-authority");require("@radix-ui/react-tooltip");require("@radix-ui/react-toast");require("react-hotkeys-hook");require("flat-to-nested");require("./html-to-json-aadcbf66.cjs");require("himalaya");require("redux-undo");require("@react-hookz/web");require("@chaibuilder/blocks");require("lucide-react");require("sonner");const m=n.lazy(()=>Promise.resolve().then(()=>require("./single-page-detail-fcacbb82.cjs"))),j=({pageData:s})=>{const[r,t]=n.useState("CLOSE");return e.jsxRuntimeExports.jsxs(o.Popover,{open:r==="OPEN"||r==="ALERT"||r==="PENDING",onOpenChange:i=>{t(r==="PENDING"?"ALERT":i?"OPEN":"CLOSE")},children:[e.jsxRuntimeExports.jsx(o.PopoverTrigger,{asChild:!0,onClick:i=>{i.stopPropagation(),t("OPEN")},children:e.jsxRuntimeExports.jsx("div",{className:"flex items-center justify-between",children:r==="OPEN"||r==="ALERT"||r==="PENDING"?e.jsxRuntimeExports.jsx(u.ChevronRightIcon,{}):e.jsxRuntimeExports.jsx("div",{className:"hidden hover:text-blue-600 group-hover:flex",children:e.jsxRuntimeExports.jsx(u.GearIcon,{})})})}),e.jsxRuntimeExports.jsx(o.PopoverContent,{side:"right",align:"start",alignOffset:-35,className:"h-screen w-96",children:e.jsxRuntimeExports.jsx(n.Suspense,{fallback:e.jsxRuntimeExports.jsxs("div",{className:"flex w-full animate-pulse flex-col gap-y-3",children:[e.jsxRuntimeExports.jsx("div",{className:"bg-background-300 h-6 w-1/2"}),e.jsxRuntimeExports.jsx("div",{className:"bg-background-300 h-20 w-full"}),e.jsxRuntimeExports.jsx("div",{className:"bg-background-300 h-20 w-full"})]}),children:e.jsxRuntimeExports.jsx(m,{pageData:s,open:r,setOpen:t})})})]})},p=s=>{const[r]=x.useCurrentPage(),{data:t}=x.useProject(),i=x.useChangePage(),l=(t==null?void 0:t.homepage)===s.uuid,a=r===s.uuid,c=()=>i(s);return t?e.jsxRuntimeExports.jsxs("button",{className:`group relative flex w-full cursor-pointer items-center justify-between px-2.5 py-2 ${a?"bg-blue-200 ":""}`,onClick:c,type:"button",children:[e.jsxRuntimeExports.jsxs("div",{className:"flex text-sm items-center gap-x-1.5",children:[l?e.jsxRuntimeExports.jsx(u.HomeIcon,{}):e.jsxRuntimeExports.jsx(u.FileTextIcon,{})," ",s.name]}),e.jsxRuntimeExports.jsx(j,{pageData:s})]}):null},d=({pages:s,isLoading:r})=>r?e.jsxRuntimeExports.jsxs("div",{className:"flex animate-pulse flex-col gap-y-1 px-2.5 pt-2",children:[e.jsxRuntimeExports.jsx("div",{className:"bg-background-200 h-7 w-full"}),e.jsxRuntimeExports.jsx("div",{className:"bg-background-200 h-7 w-full"}),e.jsxRuntimeExports.jsx("div",{className:"bg-background-200 h-7 w-full"})]}):s.length===0?e.jsxRuntimeExports.jsx("div",{className:"px-2.5 pb-2 pt-4",children:"No pages"}):e.jsxRuntimeExports.jsx("div",{className:"-mb-2",children:n.Children.toArray(s.map(t=>e.jsxRuntimeExports.jsx(p,{...t})))});exports.default=d;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const n=require("./jsx-runtime-5c3ac4f7.cjs"),a=require("react"),f=require("./scroll-area-bb343b86.cjs"),o=require("@chaibuilder/blocks"),m=require("./form-99b51245.cjs"),d=require("./index-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const n=require("./jsx-runtime-5c3ac4f7.cjs"),a=require("react"),f=require("./scroll-area-bb343b86.cjs"),o=require("@chaibuilder/blocks"),m=require("./form-99b51245.cjs"),d=require("./index-1bf563c1.cjs");require("@radix-ui/react-scroll-area");require("./utils-3c452dd0.cjs");require("clsx");require("tailwind-merge");require("@rjsf/core");require("@rjsf/validator-ajv8");require("lodash");require("./link-86ac8848.cjs");require("react-icons-picker");require("react-dom");require("./dialog-170eaad9.cjs");require("@radix-ui/react-dialog");require("@radix-ui/react-icons");require("./ImagesPanel-0db5c72f.cjs");require("./tabs-860e37aa.cjs");require("@radix-ui/react-tabs");require("react-quill");require("react-i18next");require("./useBuilderProp-5e57d0c8.cjs");require("@radix-ui/react-slot");require("class-variance-authority");require("@radix-ui/react-tooltip");require("@radix-ui/react-toast");require("jotai");require("./MODIFIERS-4716c669.cjs");require("@floating-ui/react-dom");require("i18next");require("flagged");require("react-dnd");require("@minoru/react-dnd-treeview");require("react-hotkeys-hook");require("flat-to-nested");require("./html-to-json-aadcbf66.cjs");require("himalaya");require("redux-undo");require("@react-hookz/web");require("lucide-react");require("sonner");function g(r){const i=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(r){for(const e in r)if(e!=="default"){const u=Object.getOwnPropertyDescriptor(r,e);Object.defineProperty(i,e,u.get?u:{enumerable:!0,get:()=>r[e]})}}return i.default=r,Object.freeze(i)}const j=g(a),b=({_projectData:r,seany:i})=>{const{data:e,isLoading:u}=d.useProject();j.useEffect(()=>{e&&i(e)},[e,i]);const q=({formData:l},t)=>{i(s=>({...s,[t]:l[t]}))},c={name:o.SingleLineText({title:"Project Name",default:e==null?void 0:e.name}),favicon:o.Image({title:"Favicon",default:e==null?void 0:e.favicon})};return n.jsxRuntimeExports.jsx(f.ScrollArea,{className:"flex h-full select-none flex-col",children:n.jsxRuntimeExports.jsx(m.Form,{properties:c,disabled:u,formData:r,onChange:q})})};exports.default=b;
|
|
@@ -3,7 +3,7 @@ import * as n from "react";
|
|
|
3
3
|
import { S as f } from "./scroll-area-83bd9e8f.js";
|
|
4
4
|
import { SingleLineText as c, Image as d } from "@chaibuilder/blocks";
|
|
5
5
|
import { F as u } from "./form-725e3191.js";
|
|
6
|
-
import { R as x } from "./index-
|
|
6
|
+
import { R as x } from "./index-2ff849f6.js";
|
|
7
7
|
import "@radix-ui/react-scroll-area";
|
|
8
8
|
import "./utils-ac68b2c8.js";
|
|
9
9
|
import "clsx";
|
package/dist/render.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const c=require("./jsx-runtime-5c3ac4f7.cjs"),
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const c=require("./jsx-runtime-5c3ac4f7.cjs"),j=require("react"),n=require("lodash"),R=require("tailwind-merge"),l=require("./MODIFIERS-4716c669.cjs"),_=require("@chaibuilder/blocks"),x=require("./functions-f84d5e2a.cjs"),q=require("react-wrap-balancer");require("@mhsdesign/jit-browser-tailwindcss");require("@bobthered/tailwindcss-palette-generator");require("@tailwindcss/forms");require("@tailwindcss/typography");require("@tailwindcss/aspect-ratio");require("@tailwindcss/line-clamp");const y=t=>{const r={};return Object.keys(t).forEach(e=>{n.isString(t[e])&&t[e].startsWith(l.SLOT_KEY)&&(r[e]=t[e].replace(l.SLOT_KEY,"").split(","))}),r},B=n.memoize((t,r)=>{const e=t.replace(l.STYLES_KEY,"").split(","),s=R.twMerge(e[0],e[1]);return x.addPrefixToClasses(s,r).replace(l.STYLES_KEY,"").trim()});function C(t,r){return n.get(t,`${r}_attrs`,{})}function O(t,r){const e={};return Object.keys(t).forEach(s=>{if(n.isString(t[s])&&t[s].startsWith(l.STYLES_KEY)){const o=B(t[s],r);e[s]={className:o,...C(t,s)}}}),e}function T(t,r){const e=n.get(t,"_bindings",{});return n.isEmpty(e)?{...t}:(n.each(e,(s,o)=>{n.isString(s)&&n.get(r,s,null)&&(t[o]=n.get(r,s,null))}),t)}function a({blocks:t,parent:r,classPrefix:e="c-",externalData:s={}}){const o=t,p=i=>O(i,e),f=r?n.filter(t,{_parent:r}):n.filter(t,i=>n.isEmpty(i._parent));return c.jsxRuntimeExports.jsx(c.jsxRuntimeExports.Fragment,{children:j.Children.toArray(f.map((i,h)=>{const d=y(i),m={};n.isEmpty(d)||Object.keys(d).forEach(u=>{m[u]=j.Children.toArray(d[u].map(E=>c.jsxRuntimeExports.jsx(a,{externalData:s,classPrefix:e,blocks:o,parent:E})))});const S=n.filter(o,{_parent:i._id});m.children=S.length>0?c.jsxRuntimeExports.jsx(a,{externalData:s,classPrefix:e,parent:i._id,blocks:o}):null;const g=_.getBlockComponent(i._type);if(g!==null){let u=i;const E=g.component;return u={...g.defaults,...i},j.createElement(E,n.omit({blockProps:{},inBuilder:!1,...u,index:h,...T(i,s),...p(u),...m},["_parent"]))}return c.jsxRuntimeExports.jsxs("noscript",{children:[i._type," not found"]})}))})}const Y=({pageData:t,externalData:r={},before:e=null,after:s=null,classPrefix:o="c-"})=>{const p=n.get(t.project,"brandingOptions",l.BRANDING_OPTIONS_DEFAULTS);return c.jsxRuntimeExports.jsxs(c.jsxRuntimeExports.Fragment,{children:[e,c.jsxRuntimeExports.jsx("div",{className:o.replace("-","")+" "+x.getBrandingClasses(p,o)+" min-h-screen",children:c.jsxRuntimeExports.jsx(q.Provider,{children:c.jsxRuntimeExports.jsx(a,{externalData:r,blocks:t.page.blocks||[],classPrefix:o})})}),s]})};exports.RenderChaiBlocks=a;exports.RenderChaiPage=Y;
|
package/dist/render.d.ts
CHANGED
|
@@ -51,7 +51,7 @@ export declare function RenderChaiBlocks({ blocks, parent, classPrefix, external
|
|
|
51
51
|
blocks: ChaiBlock[];
|
|
52
52
|
parent?: string;
|
|
53
53
|
classPrefix?: string;
|
|
54
|
-
externalData
|
|
54
|
+
externalData: Record<string, any>;
|
|
55
55
|
}): JSX_2.Element;
|
|
56
56
|
|
|
57
57
|
export declare const RenderChaiPage: ({ pageData, externalData, before, after, classPrefix, }: ChaiPageProps) => JSX_2.Element;
|
package/dist/render.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { j as o } from "./jsx-runtime-944c88e2.js";
|
|
2
2
|
import u from "react";
|
|
3
|
-
import { memoize as
|
|
3
|
+
import { memoize as y, filter as g, isEmpty as h, omit as A, isString as E, get as m, each as x } from "lodash";
|
|
4
4
|
import { twMerge as N } from "tailwind-merge";
|
|
5
5
|
import { S as _, a as B, B as R } from "./MODIFIERS-2f19c314.js";
|
|
6
6
|
import { getBlockComponent as T } from "@chaibuilder/blocks";
|
|
@@ -13,66 +13,82 @@ import "@tailwindcss/typography";
|
|
|
13
13
|
import "@tailwindcss/aspect-ratio";
|
|
14
14
|
import "@tailwindcss/line-clamp";
|
|
15
15
|
const I = (t) => {
|
|
16
|
-
const
|
|
16
|
+
const s = {};
|
|
17
17
|
return Object.keys(t).forEach((n) => {
|
|
18
|
-
E(t[n]) && t[n].startsWith(B) && (
|
|
19
|
-
}),
|
|
20
|
-
}, K =
|
|
21
|
-
const n = t.replace(_, "").split(","),
|
|
22
|
-
return F(
|
|
18
|
+
E(t[n]) && t[n].startsWith(B) && (s[n] = t[n].replace(B, "").split(","));
|
|
19
|
+
}), s;
|
|
20
|
+
}, K = y((t, s) => {
|
|
21
|
+
const n = t.replace(_, "").split(","), r = N(n[0], n[1]);
|
|
22
|
+
return F(r, s).replace(_, "").trim();
|
|
23
23
|
});
|
|
24
|
-
function W(t,
|
|
25
|
-
return
|
|
24
|
+
function W(t, s) {
|
|
25
|
+
return m(t, `${s}_attrs`, {});
|
|
26
26
|
}
|
|
27
|
-
function w(t,
|
|
27
|
+
function w(t, s) {
|
|
28
28
|
const n = {};
|
|
29
|
-
return Object.keys(t).forEach((
|
|
30
|
-
if (E(t[
|
|
31
|
-
const i = K(t[
|
|
32
|
-
n[
|
|
29
|
+
return Object.keys(t).forEach((r) => {
|
|
30
|
+
if (E(t[r]) && t[r].startsWith(_)) {
|
|
31
|
+
const i = K(t[r], s);
|
|
32
|
+
n[r] = {
|
|
33
33
|
className: i,
|
|
34
|
-
...W(t,
|
|
34
|
+
...W(t, r)
|
|
35
35
|
};
|
|
36
36
|
}
|
|
37
37
|
}), n;
|
|
38
38
|
}
|
|
39
|
-
function z(t,
|
|
40
|
-
const n =
|
|
41
|
-
return h(n) ? { ...t } : (
|
|
42
|
-
E(
|
|
39
|
+
function z(t, s) {
|
|
40
|
+
const n = m(t, "_bindings", {});
|
|
41
|
+
return h(n) ? { ...t } : (x(n, (r, i) => {
|
|
42
|
+
E(r) && m(s, r, null) && (t[i] = m(s, r, null));
|
|
43
43
|
}), t);
|
|
44
44
|
}
|
|
45
45
|
function j({
|
|
46
46
|
blocks: t,
|
|
47
|
-
parent:
|
|
47
|
+
parent: s,
|
|
48
48
|
classPrefix: n = "c-",
|
|
49
|
-
externalData:
|
|
49
|
+
externalData: r = {}
|
|
50
50
|
}) {
|
|
51
|
-
const i = t,
|
|
51
|
+
const i = t, a = (e) => w(e, n), S = s ? g(t, { _parent: s }) : g(t, (e) => h(e._parent));
|
|
52
52
|
return /* @__PURE__ */ o.jsx(o.Fragment, { children: u.Children.toArray(
|
|
53
53
|
S.map((e, C) => {
|
|
54
54
|
const c = I(e), l = {};
|
|
55
|
-
h(c) || Object.keys(c).forEach((
|
|
56
|
-
l[
|
|
57
|
-
c[
|
|
55
|
+
h(c) || Object.keys(c).forEach((p) => {
|
|
56
|
+
l[p] = u.Children.toArray(
|
|
57
|
+
c[p].map((f) => /* @__PURE__ */ o.jsx(
|
|
58
|
+
j,
|
|
59
|
+
{
|
|
60
|
+
externalData: r,
|
|
61
|
+
classPrefix: n,
|
|
62
|
+
blocks: i,
|
|
63
|
+
parent: f
|
|
64
|
+
}
|
|
65
|
+
))
|
|
58
66
|
);
|
|
59
67
|
});
|
|
60
|
-
const
|
|
61
|
-
l.children =
|
|
68
|
+
const O = g(i, { _parent: e._id });
|
|
69
|
+
l.children = O.length > 0 ? /* @__PURE__ */ o.jsx(
|
|
70
|
+
j,
|
|
71
|
+
{
|
|
72
|
+
externalData: r,
|
|
73
|
+
classPrefix: n,
|
|
74
|
+
parent: e._id,
|
|
75
|
+
blocks: i
|
|
76
|
+
}
|
|
77
|
+
) : null;
|
|
62
78
|
const d = T(e._type);
|
|
63
79
|
if (d !== null) {
|
|
64
|
-
let
|
|
80
|
+
let p = e;
|
|
65
81
|
const f = d.component;
|
|
66
|
-
return
|
|
82
|
+
return p = { ...d.defaults, ...e }, u.createElement(
|
|
67
83
|
f,
|
|
68
|
-
|
|
84
|
+
A(
|
|
69
85
|
{
|
|
70
86
|
blockProps: {},
|
|
71
87
|
inBuilder: !1,
|
|
72
|
-
...
|
|
88
|
+
...p,
|
|
73
89
|
index: C,
|
|
74
|
-
...z(e,
|
|
75
|
-
...
|
|
90
|
+
...z(e, r),
|
|
91
|
+
...a(p),
|
|
76
92
|
...l
|
|
77
93
|
},
|
|
78
94
|
["_parent"]
|
|
@@ -88,22 +104,22 @@ function j({
|
|
|
88
104
|
}
|
|
89
105
|
const b = ({
|
|
90
106
|
pageData: t,
|
|
91
|
-
externalData:
|
|
107
|
+
externalData: s = {},
|
|
92
108
|
before: n = null,
|
|
93
|
-
after:
|
|
109
|
+
after: r = null,
|
|
94
110
|
classPrefix: i = "c-"
|
|
95
111
|
}) => {
|
|
96
|
-
const
|
|
112
|
+
const a = m(t.project, "brandingOptions", R);
|
|
97
113
|
return /* @__PURE__ */ o.jsxs(o.Fragment, { children: [
|
|
98
114
|
n,
|
|
99
115
|
/* @__PURE__ */ o.jsx(
|
|
100
116
|
"div",
|
|
101
117
|
{
|
|
102
|
-
className: i.replace("-", "") + " " + L(
|
|
103
|
-
children: /* @__PURE__ */ o.jsx(Y, { children: /* @__PURE__ */ o.jsx(j, { externalData:
|
|
118
|
+
className: i.replace("-", "") + " " + L(a, i) + " min-h-screen",
|
|
119
|
+
children: /* @__PURE__ */ o.jsx(Y, { children: /* @__PURE__ */ o.jsx(j, { externalData: s, blocks: t.page.blocks || [], classPrefix: i }) })
|
|
104
120
|
}
|
|
105
121
|
),
|
|
106
|
-
|
|
122
|
+
r
|
|
107
123
|
] });
|
|
108
124
|
};
|
|
109
125
|
export {
|
|
@@ -7,7 +7,7 @@ import { S as q } from "./scroll-area-83bd9e8f.js";
|
|
|
7
7
|
import { SingleLineText as g, Model as Z, MultilineText as $, Image as F, Checkbox as Q } from "@chaibuilder/blocks";
|
|
8
8
|
import { toast as U } from "sonner";
|
|
9
9
|
import { F as h } from "./form-725e3191.js";
|
|
10
|
-
import { a2 as V, R as X, a3 as _, S as K } from "./index-
|
|
10
|
+
import { a2 as V, R as X, a3 as _, S as K } from "./index-2ff849f6.js";
|
|
11
11
|
import "@radix-ui/react-slot";
|
|
12
12
|
import "class-variance-authority";
|
|
13
13
|
import "./utils-ac68b2c8.js";
|
|
@@ -42,7 +42,7 @@ import "himalaya";
|
|
|
42
42
|
import "redux-undo";
|
|
43
43
|
import "@react-hookz/web";
|
|
44
44
|
import "lucide-react";
|
|
45
|
-
const O = y.lazy(() => import("./delete-page-modal-
|
|
45
|
+
const O = y.lazy(() => import("./delete-page-modal-7c83e048.js")), J = y.lazy(() => import("./confirm-alert-f2a47cc7.js")), x = (n) => {
|
|
46
46
|
if (!z(n) || !(n.includes("/[") && n.includes("]")))
|
|
47
47
|
return !1;
|
|
48
48
|
const s = /^\[((?:\.{3})?[a-zA-Z0-9_-]+)\]$/, u = /^[a-zA-Z0-9_-]+$/;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("./jsx-runtime-5c3ac4f7.cjs"),g=require("react"),c=require("lodash"),M=require("@radix-ui/react-icons"),H=require("./useBuilderProp-5e57d0c8.cjs"),w=require("./scroll-area-bb343b86.cjs"),d=require("@chaibuilder/blocks"),L=require("sonner"),p=require("./form-99b51245.cjs"),P=require("./index-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("./jsx-runtime-5c3ac4f7.cjs"),g=require("react"),c=require("lodash"),M=require("@radix-ui/react-icons"),H=require("./useBuilderProp-5e57d0c8.cjs"),w=require("./scroll-area-bb343b86.cjs"),d=require("@chaibuilder/blocks"),L=require("sonner"),p=require("./form-99b51245.cjs"),P=require("./index-1bf563c1.cjs");require("@radix-ui/react-slot");require("class-variance-authority");require("./utils-3c452dd0.cjs");require("clsx");require("tailwind-merge");require("@radix-ui/react-tooltip");require("@radix-ui/react-toast");require("jotai");require("@radix-ui/react-scroll-area");require("@rjsf/core");require("@rjsf/validator-ajv8");require("./link-86ac8848.cjs");require("react-icons-picker");require("react-dom");require("./dialog-170eaad9.cjs");require("@radix-ui/react-dialog");require("./ImagesPanel-0db5c72f.cjs");require("./tabs-860e37aa.cjs");require("@radix-ui/react-tabs");require("react-quill");require("react-i18next");require("./MODIFIERS-4716c669.cjs");require("@floating-ui/react-dom");require("i18next");require("flagged");require("react-dnd");require("@minoru/react-dnd-treeview");require("react-hotkeys-hook");require("flat-to-nested");require("./html-to-json-aadcbf66.cjs");require("himalaya");require("redux-undo");require("@react-hookz/web");require("lucide-react");const z=g.lazy(()=>Promise.resolve().then(()=>require("./delete-page-modal-5b050396.cjs"))),B=g.lazy(()=>Promise.resolve().then(()=>require("./confirm-alert-4f50caa7.cjs"))),E=n=>{if(!c.isString(n)||!(n.includes("/[")&&n.includes("]")))return!1;const s=/^\[((?:\.{3})?[a-zA-Z0-9_-]+)\]$/,q=/^[a-zA-Z0-9_-]+$/;let e=!0;return n.split("/").forEach(u=>{e&&(u.includes("[[")&&u.includes("]]")?e=/^\[\[\.{3}[a-zA-Z0-9_-]+\]\]$/.test(u):u.includes("[")&&u.includes("]")?e=s.test(u):e=q.test(u))}),e},h=n=>n&&c.isEmpty(n.seoData)?{...n,seoData:{title:"",description:"",image:""}}:n,G=(n,o)=>{const s=!c.isEqual(c.omit(n,["seoData"]),c.omit(o,["seoData"])),q=!c.isEqual(h(o).seoData,h(n).seoData);return s||q},Y=({open:n,setOpen:o,pageData:s})=>{const q=P.useQueryClient(),{data:e}=P.useProject(),u=P.useUpdatePage(),m=P.useUpdateProject("Homepage updated successfully."),[i,b]=g.useState(h(s)),[a,y]=g.useState({isHomePage:(e==null?void 0:e.homepage)===s.uuid}),j=G(i,s);g.useEffect(()=>{const l=!c.isEqual(h(s),i),r=(e==null?void 0:e.homepage)!==s.uuid&&a.isHomePage;o(l||r?"PENDING":"OPEN")},[e,s,i,a,o]);const S=()=>{if(j){if(s.type==="DYNAMIC"&&!E((i==null?void 0:i.slug)||"")){n==="ALERT"&&o("PENDING");return}u.mutate(i,{onSuccess:()=>{q.invalidateQueries({refetchType:"active",queryKey:["pages",e==null?void 0:e.uuid]}),o("CLOSE"),L.toast.success("Page updated successfully.")}})}a.isHomePage&&(e==null?void 0:e.homepage)!==s.uuid&&m.mutate({...e,homepage:s==null?void 0:s.uuid},{onSuccess:()=>o("CLOSE")})},C=({formData:l},r)=>{b(f=>{var R,N;if(!r)return f;const x={[r]:l[r]};return r==="name"?x.slug=c.kebabCase((R=l[r])==null?void 0:R.replace(/\d/g,"")):r==="slug"?x.slug=(N=l[r])==null?void 0:N.replace(/\d/g,"").replace(/\s+/g,"").replace("--","-").replace("__","_"):r==="seoData"&&(x.seoData={title:l[r].title||"",description:l[r].description||"",image:l[r].image||""}),{...f,...x}})},A=({formData:l},r)=>{y(f=>{const x={[r]:l[r]};return{...f,...x}})},I={name:d.SingleLineText({title:"Page Name",default:i.name}),slug:d.SingleLineText({title:"Page Slug",default:i.slug})},T={seoData:d.Model({title:"",description:"",default:{title:"",description:"",image:""},properties:{title:d.SingleLineText({title:"Meta Title",default:i.name}),description:d.MultilineText({title:"Meta Description",default:i.slug}),image:d.Image({title:"Social Media Image",default:""})}})},v={isHomePage:d.Checkbox({title:"Set as homepage",default:a.isHomePage})};return t.jsxRuntimeExports.jsxs(w.ScrollArea,{className:"flex h-full select-none flex-col",children:[t.jsxRuntimeExports.jsx(B,{open:n==="ALERT",title:"Do yo want to save changes?",onCancel:()=>o("CLOSE"),onConfirm:S,disabled:m.isPending||u.isPending}),t.jsxRuntimeExports.jsx("div",{className:"rounded-md bg-background/30 px-2.5 py-1",children:t.jsxRuntimeExports.jsx("h1",{className:"px-1 font-semibold",children:"Page Details"})}),t.jsxRuntimeExports.jsx("div",{className:"px-2.5 pt-2",children:t.jsxRuntimeExports.jsxs("div",{className:"flex flex-col space-y-2",children:[t.jsxRuntimeExports.jsx(p.Form,{title:"Basic Details",formData:i,properties:I,onChange:C,disabled:u.isPending||m.isPending}),t.jsxRuntimeExports.jsx("div",{className:"h-2 w-full"}),t.jsxRuntimeExports.jsx(p.Form,{title:"SEO Details",formData:i,properties:T,onChange:C,disabled:u.isPending||m.isPending}),(e==null?void 0:e.homepage)!==s.uuid&&s.type==="STATIC"?t.jsxRuntimeExports.jsx(p.Form,{formData:a,properties:v,onChange:A,disabled:u.isPending||m.isPending}):s.type==="STATIC"&&t.jsxRuntimeExports.jsxs("div",{className:"flex items-center gap-x-1 px-1 pt-2 text-xs font-medium text-gray-500",children:[t.jsxRuntimeExports.jsx(M.HomeIcon,{})," This is homepage"," "]}),i.type==="DYNAMIC"&&!E((i==null?void 0:i.slug)||"")&&t.jsxRuntimeExports.jsxs("small",{className:"px-1 text-red-400",children:["Add dynamic ID in page slug Eg: ",t.jsxRuntimeExports.jsx("i",{className:"underline",children:"some-url/[some-id]"})]}),t.jsxRuntimeExports.jsxs("div",{className:"my-2 flex w-full items-center justify-between gap-x-2 px-1",children:[t.jsxRuntimeExports.jsx(H.Button,{className:"w-full",type:"submit",onClick:S,disabled:(e==null?void 0:e.homepage)!==s.uuid&&a.isHomePage?!1:c.isEmpty(i.name)||c.isEmpty(i.slug)||!j||u.isPending||m.isPending||i.type==="DYNAMIC"&&!E((i==null?void 0:i.slug)||""),children:"Save"}),t.jsxRuntimeExports.jsx(z,{pageData:s,projectData:e})]})]})})]})};exports.default=Y;
|