@chaibuilder/sdk 0.1.16 → 0.1.17
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-59a68fc9.cjs → AddBlocks-3d30d446.cjs} +1 -1
- package/dist/{AddBlocks-6f4db22d.js → AddBlocks-7b723045.js} +1 -1
- package/dist/{BrandingOptions-d6351932.js → BrandingOptions-b0624d8f.js} +1 -1
- package/dist/{BrandingOptions-8e7a159f.cjs → BrandingOptions-daafdabf.cjs} +1 -1
- package/dist/{CanvasArea-08537c6e.cjs → CanvasArea-93be7e7b.cjs} +8 -8
- package/dist/{CanvasArea-a585620d.js → CanvasArea-d301c4ef.js} +311 -311
- package/dist/{CurrentPage-cbbfdbf4.cjs → CurrentPage-478eb8a0.cjs} +1 -1
- package/dist/{CurrentPage-e8f8ff05.js → CurrentPage-e0c8b063.js} +1 -1
- package/dist/{Layers-6fc21e86.js → Layers-20ce5cb3.js} +2 -2
- package/dist/{Layers-636e0bc6.cjs → Layers-85854772.cjs} +1 -1
- package/dist/{MarkAsGlobalBlock-23dd24b9.cjs → MarkAsGlobalBlock-5a36e8ad.cjs} +1 -1
- package/dist/{MarkAsGlobalBlock-cf7e8b31.js → MarkAsGlobalBlock-96dd248c.js} +1 -1
- package/dist/{PagesPanel-bf13d0a5.cjs → PagesPanel-39cc0156.cjs} +1 -1
- package/dist/{PagesPanel-7db807df.js → PagesPanel-6f5393e8.js} +2 -2
- package/dist/{ProjectPanel-d98d3585.cjs → ProjectPanel-027fb151.cjs} +1 -1
- package/dist/{ProjectPanel-a7c78e1f.js → ProjectPanel-b027fc0d.js} +2 -2
- package/dist/{Settings-1e6e0534.js → Settings-5bae2bdf.js} +1 -1
- package/dist/{Settings-1b76c006.cjs → Settings-d9dc47d7.cjs} +1 -1
- package/dist/{SidePanels-af4f2c45.js → SidePanels-9ac03c5d.js} +2 -2
- package/dist/{SidePanels-55124e18.cjs → SidePanels-fe464a57.cjs} +1 -1
- package/dist/{Topbar-4f1aca98.js → Topbar-ba10ddd1.js} +1 -1
- package/dist/{Topbar-5df341d7.cjs → Topbar-e00f11e0.cjs} +1 -1
- package/dist/{add-page-modal-b685709e.cjs → add-page-modal-b267650f.cjs} +1 -1
- package/dist/{add-page-modal-d4f5ba20.js → add-page-modal-b5f3aeab.js} +1 -1
- package/dist/core.cjs +1 -1
- package/dist/core.js +1 -1
- package/dist/delete-page-modal-04b3677b.cjs +1 -0
- package/dist/{delete-page-modal-00d5fbab.js → delete-page-modal-b1d253ae.js} +8 -8
- package/dist/{index-bf44bc93.cjs → index-1e878777.cjs} +2 -2
- package/dist/{index-8a7a37ce.js → index-95757b80.js} +3 -3
- package/dist/{page-viewer-c494031b.js → page-viewer-11b81948.js} +14 -14
- package/dist/{page-viewer-f0a54a92.cjs → page-viewer-f41c53e3.cjs} +1 -1
- package/dist/{project-general-setting-a3e99d1e.cjs → project-general-setting-51da3f18.cjs} +1 -1
- package/dist/{project-general-setting-fca12629.js → project-general-setting-9f37b1ac.js} +1 -1
- package/dist/{single-page-detail-ff7fceb1.js → single-page-detail-085b82ca.js} +2 -2
- package/dist/{single-page-detail-84c67e67.cjs → single-page-detail-a251b327.cjs} +1 -1
- package/package.json +1 -1
- package/dist/delete-page-modal-bbd3ffa2.cjs +0 -1
|
@@ -1456,7 +1456,7 @@ const zd = () => {
|
|
|
1456
1456
|
const r = Me(e);
|
|
1457
1457
|
$s(r) && (s = [r, ...Xc(t, r)]), n(s);
|
|
1458
1458
|
}, [e, t, n]);
|
|
1459
|
-
}, bf = () => ne(Hi), eu = Pt(() => import("./SidePanels-
|
|
1459
|
+
}, bf = () => ne(Hi), eu = Pt(() => import("./SidePanels-9ac03c5d.js")), tu = Pt(() => import("./Topbar-ba10ddd1.js")), nu = Pt(() => import("./CanvasArea-d301c4ef.js")), su = Pt(() => import("./Settings-5bae2bdf.js")), ru = () => {
|
|
1460
1460
|
const [e] = Ua(ss), t = (n) => {
|
|
1461
1461
|
n.preventDefault();
|
|
1462
1462
|
};
|
|
@@ -2711,7 +2711,7 @@ function el() {
|
|
|
2711
2711
|
};
|
|
2712
2712
|
return Qu(Kr(Kr({}, t), e));
|
|
2713
2713
|
}
|
|
2714
|
-
const tl = "@chaibuilder/sdk", nl = "0.1.
|
|
2714
|
+
const tl = "@chaibuilder/sdk", nl = "0.1.17", sl = "module", rl = [
|
|
2715
2715
|
"dist"
|
|
2716
2716
|
], il = "dist/core.js", ol = !1, al = {
|
|
2717
2717
|
".": {
|
|
@@ -4787,7 +4787,7 @@ const In = () => {
|
|
|
4787
4787
|
})).json();
|
|
4788
4788
|
}
|
|
4789
4789
|
});
|
|
4790
|
-
}, rd = Pt(() => import("./PagesPanel-
|
|
4790
|
+
}, rd = Pt(() => import("./PagesPanel-6f5393e8.js")), id = Pt(() => import("./ProjectPanel-b027fc0d.js")), od = Pt(() => import("./CurrentPage-e0c8b063.js")), ad = () => /* @__PURE__ */ _.jsx("h2", { children: "Your Logo" }), cd = () => {
|
|
4791
4791
|
const e = qe();
|
|
4792
4792
|
return /* @__PURE__ */ _.jsx("div", { className: "border-gray-200 rounded-md p-2 mb-2 border", children: /* @__PURE__ */ _.jsx(
|
|
4793
4793
|
oa,
|
|
@@ -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 { R as j, O as N, Q as b } from "./index-
|
|
5
|
+
import { R as j, O as N, Q as b } from "./index-95757b80.js";
|
|
6
6
|
import "@radix-ui/react-popover";
|
|
7
7
|
import "./utils-ac68b2c8.js";
|
|
8
8
|
import "clsx";
|
|
@@ -29,14 +29,14 @@ import "@react-hookz/web";
|
|
|
29
29
|
import "@chaibuilder/blocks";
|
|
30
30
|
import "lucide-react";
|
|
31
31
|
import "sonner";
|
|
32
|
-
const P = o.lazy(() => import("./single-page-detail-
|
|
33
|
-
const [s,
|
|
32
|
+
const P = o.lazy(() => import("./single-page-detail-085b82ca.js")), v = ({ pageData: t }) => {
|
|
33
|
+
const [s, r] = m("CLOSE");
|
|
34
34
|
return /* @__PURE__ */ e.jsxs(
|
|
35
35
|
g,
|
|
36
36
|
{
|
|
37
37
|
open: s === "OPEN" || s === "ALERT" || s === "PENDING",
|
|
38
38
|
onOpenChange: (i) => {
|
|
39
|
-
|
|
39
|
+
r(s === "PENDING" ? "ALERT" : i ? "OPEN" : "CLOSE");
|
|
40
40
|
},
|
|
41
41
|
children: [
|
|
42
42
|
/* @__PURE__ */ e.jsx(
|
|
@@ -44,7 +44,7 @@ const P = o.lazy(() => import("./single-page-detail-ff7fceb1.js")), v = ({ pageD
|
|
|
44
44
|
{
|
|
45
45
|
asChild: !0,
|
|
46
46
|
onClick: (i) => {
|
|
47
|
-
i.stopPropagation(),
|
|
47
|
+
i.stopPropagation(), r("OPEN");
|
|
48
48
|
},
|
|
49
49
|
children: /* @__PURE__ */ e.jsx("div", { className: "flex items-center justify-between", children: s === "OPEN" || s === "ALERT" || s === "PENDING" ? /* @__PURE__ */ e.jsx(d, {}) : /* @__PURE__ */ e.jsx("div", { className: "hidden hover:text-blue-600 group-hover:flex", children: /* @__PURE__ */ e.jsx(x, {}) }) })
|
|
50
50
|
}
|
|
@@ -57,35 +57,35 @@ const P = o.lazy(() => import("./single-page-detail-ff7fceb1.js")), v = ({ pageD
|
|
|
57
57
|
/* @__PURE__ */ e.jsx("div", { className: "bg-background-300 h-20 w-full" }),
|
|
58
58
|
/* @__PURE__ */ e.jsx("div", { className: "bg-background-300 h-20 w-full" })
|
|
59
59
|
] }),
|
|
60
|
-
children: /* @__PURE__ */ e.jsx(P, { pageData:
|
|
60
|
+
children: /* @__PURE__ */ e.jsx(P, { pageData: t, open: s, setOpen: r })
|
|
61
61
|
}
|
|
62
62
|
) })
|
|
63
63
|
]
|
|
64
64
|
}
|
|
65
65
|
);
|
|
66
|
-
}, E = (
|
|
67
|
-
const [s] = j(), { data:
|
|
68
|
-
return
|
|
66
|
+
}, E = (t) => {
|
|
67
|
+
const [s] = j(), { data: r } = N(), i = b(), a = (r == null ? void 0 : r.homepage) === t.uuid, n = s === t.uuid, l = () => i(t);
|
|
68
|
+
return r ? /* @__PURE__ */ e.jsxs(
|
|
69
69
|
"button",
|
|
70
70
|
{
|
|
71
71
|
className: `group relative flex w-full cursor-pointer items-center justify-between px-2.5 py-2 ${n ? "bg-blue-200 " : ""}`,
|
|
72
72
|
onClick: l,
|
|
73
73
|
type: "button",
|
|
74
74
|
children: [
|
|
75
|
-
/* @__PURE__ */ e.jsxs("div", { className: "flex items-center gap-x-1.5", children: [
|
|
75
|
+
/* @__PURE__ */ e.jsxs("div", { className: "flex text-sm items-center gap-x-1.5", children: [
|
|
76
76
|
a ? /* @__PURE__ */ e.jsx(p, {}) : /* @__PURE__ */ e.jsx(u, {}),
|
|
77
77
|
" ",
|
|
78
|
-
|
|
78
|
+
t.name
|
|
79
79
|
] }),
|
|
80
|
-
/* @__PURE__ */ e.jsx(v, { pageData:
|
|
80
|
+
/* @__PURE__ */ e.jsx(v, { pageData: t })
|
|
81
81
|
]
|
|
82
82
|
}
|
|
83
83
|
) : null;
|
|
84
|
-
}, se = ({ pages:
|
|
84
|
+
}, se = ({ pages: t, isLoading: s }) => s ? /* @__PURE__ */ e.jsxs("div", { className: "flex animate-pulse flex-col gap-y-1 px-2.5 pt-2", children: [
|
|
85
85
|
/* @__PURE__ */ e.jsx("div", { className: "bg-background-200 h-7 w-full" }),
|
|
86
86
|
/* @__PURE__ */ e.jsx("div", { className: "bg-background-200 h-7 w-full" }),
|
|
87
87
|
/* @__PURE__ */ e.jsx("div", { className: "bg-background-200 h-7 w-full" })
|
|
88
|
-
] }) :
|
|
88
|
+
] }) : t.length === 0 ? /* @__PURE__ */ e.jsx("div", { className: "px-2.5 pb-2 pt-4", children: "No pages" }) : /* @__PURE__ */ e.jsx("div", { className: "-mb-2", children: o.Children.toArray(t.map((r) => /* @__PURE__ */ e.jsx(E, { ...r }))) });
|
|
89
89
|
export {
|
|
90
90
|
se as default
|
|
91
91
|
};
|
|
@@ -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-1e878777.cjs");require("@radix-ui/react-popover");require("./utils-3c452dd0.cjs");require("clsx");require("tailwind-merge");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("jotai");require("react-hotkeys-hook");require("flat-to-nested");require("./html-to-json-78bfa1f3.cjs");require("./MODIFIERS-70fef873.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-a251b327.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-088530b9.cjs"),o=require("@chaibuilder/blocks"),m=require("./form-5d04c9b3.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-088530b9.cjs"),o=require("@chaibuilder/blocks"),m=require("./form-5d04c9b3.cjs"),d=require("./index-1e878777.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-4585b2d6.cjs");require("react-icons-picker");require("react-dom");require("./dialog-170eaad9.cjs");require("@radix-ui/react-dialog");require("@radix-ui/react-icons");require("./ImagesPanel-68a11293.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("i18next");require("flagged");require("react-dnd");require("@minoru/react-dnd-treeview");require("react-hotkeys-hook");require("flat-to-nested");require("./html-to-json-78bfa1f3.cjs");require("./MODIFIERS-70fef873.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-9f64a082.js";
|
|
4
4
|
import { SingleLineText as c, Image as d } from "@chaibuilder/blocks";
|
|
5
5
|
import { F as u } from "./form-bf09d392.js";
|
|
6
|
-
import { O as x } from "./index-
|
|
6
|
+
import { O as x } from "./index-95757b80.js";
|
|
7
7
|
import "@radix-ui/react-scroll-area";
|
|
8
8
|
import "./utils-ac68b2c8.js";
|
|
9
9
|
import "clsx";
|
|
@@ -7,7 +7,7 @@ import { S as $ } from "./scroll-area-9f64a082.js";
|
|
|
7
7
|
import { SingleLineText as g, Model as q, MultilineText as Z, Image as F, Checkbox as O } from "@chaibuilder/blocks";
|
|
8
8
|
import { toast as Q } from "sonner";
|
|
9
9
|
import { F as P } from "./form-bf09d392.js";
|
|
10
|
-
import { $ as U, O as V, a0 as X, P as _ } from "./index-
|
|
10
|
+
import { $ as U, O as V, a0 as X, P as _ } from "./index-95757b80.js";
|
|
11
11
|
import "@radix-ui/react-slot";
|
|
12
12
|
import "class-variance-authority";
|
|
13
13
|
import "./utils-ac68b2c8.js";
|
|
@@ -41,7 +41,7 @@ import "himalaya";
|
|
|
41
41
|
import "redux-undo";
|
|
42
42
|
import "@react-hookz/web";
|
|
43
43
|
import "lucide-react";
|
|
44
|
-
const K = y.lazy(() => import("./delete-page-modal-
|
|
44
|
+
const K = y.lazy(() => import("./delete-page-modal-b1d253ae.js")), J = y.lazy(() => import("./confirm-alert-f2a47cc7.js")), h = (n) => {
|
|
45
45
|
if (!z(n) || !(n.includes("/[") && n.includes("]")))
|
|
46
46
|
return !1;
|
|
47
47
|
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"),q=require("react"),c=require("lodash"),M=require("@radix-ui/react-icons"),H=require("./useBuilderProp-5e57d0c8.cjs"),w=require("./scroll-area-088530b9.cjs"),d=require("@chaibuilder/blocks"),L=require("sonner"),p=require("./form-5d04c9b3.cjs"),P=require("./index-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("./jsx-runtime-5c3ac4f7.cjs"),q=require("react"),c=require("lodash"),M=require("@radix-ui/react-icons"),H=require("./useBuilderProp-5e57d0c8.cjs"),w=require("./scroll-area-088530b9.cjs"),d=require("@chaibuilder/blocks"),L=require("sonner"),p=require("./form-5d04c9b3.cjs"),P=require("./index-1e878777.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-4585b2d6.cjs");require("react-icons-picker");require("react-dom");require("./dialog-170eaad9.cjs");require("@radix-ui/react-dialog");require("./ImagesPanel-68a11293.cjs");require("./tabs-860e37aa.cjs");require("@radix-ui/react-tabs");require("react-quill");require("react-i18next");require("i18next");require("flagged");require("react-dnd");require("@minoru/react-dnd-treeview");require("react-hotkeys-hook");require("flat-to-nested");require("./html-to-json-78bfa1f3.cjs");require("./MODIFIERS-70fef873.cjs");require("himalaya");require("redux-undo");require("@react-hookz/web");require("lucide-react");const z=q.lazy(()=>Promise.resolve().then(()=>require("./delete-page-modal-04b3677b.cjs"))),B=q.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_-]+)\]$/,g=/^[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=g.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"])),g=!c.isEqual(h(o).seoData,h(n).seoData);return s||g},Y=({open:n,setOpen:o,pageData:s})=>{const g=P.useQueryClient(),{data:e}=P.useProject(),u=P.useUpdatePage(),m=P.useUpdateProject("Homepage updated successfully."),[i,b]=q.useState(h(s)),[a,y]=q.useState({isHomePage:(e==null?void 0:e.homepage)===s.uuid}),j=G(i,s);q.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:()=>{g.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;
|
package/package.json
CHANGED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./jsx-runtime-5c3ac4f7.cjs"),l=require("./useBuilderProp-5e57d0c8.cjs"),r=require("./alert-dialog-4ce6ed22.cjs"),d=require("./index-bf44bc93.cjs");require("react");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-icons");require("@radix-ui/react-toast");require("jotai");require("lodash");require("@radix-ui/react-alert-dialog");require("i18next");require("react-i18next");require("flagged");require("react-dnd");require("@minoru/react-dnd-treeview");require("react-hotkeys-hook");require("flat-to-nested");require("./html-to-json-78bfa1f3.cjs");require("./MODIFIERS-70fef873.cjs");require("himalaya");require("redux-undo");require("@react-hookz/web");require("@chaibuilder/blocks");require("lucide-react");require("sonner");const x=({pageData:i,projectData:s})=>{const n={},t=d.useDeletePage(),u=i.uuid===s.homepage,o=()=>{t.mutate(i,{onSuccess:()=>{n({uuid:s.homepage,slug:"/home"})}})};return e.jsxRuntimeExports.jsxs(r.AlertDialog,{children:[e.jsxRuntimeExports.jsx(r.AlertDialogTrigger,{disabled:u,children:e.jsxRuntimeExports.jsx("div",{className:`flex h-full items-center justify-center rounded-md border px-2 py-2 font-medium hover:bg-red-400 hover:text-white ${u?"cursor-not-allowed border-red-200 text-red-200":"cursor-pointer border-red-400 text-red-400"}`,children:e.jsxRuntimeExports.jsx("div",{children:"Del"})})}),e.jsxRuntimeExports.jsxs(r.AlertDialogContent,{children:[e.jsxRuntimeExports.jsxs(r.AlertDialogTitle,{children:["Are you sure you want to delete ",e.jsxRuntimeExports.jsx("i",{className:"text-red-500",children:i.name})," page?"]}),e.jsxRuntimeExports.jsx(r.AlertDialogDescription,{children:"This action cannot be undone. This will permanently delete your page."}),e.jsxRuntimeExports.jsxs("div",{className:"flex items-center justify-end gap-x-3",children:[e.jsxRuntimeExports.jsx(r.AlertDialogCancel,{disabled:t.isPending,children:"Cancel"}),e.jsxRuntimeExports.jsx(l.Button,{variant:"destructive",onClick:o,disabled:t.isPending,children:"Yes, Delete"})]})]})]})};exports.default=x;
|