@chaibuilder/sdk 0.1.24 → 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-5818ee33.js → AddBlocks-161cb307.js} +1 -1
- package/dist/{AddBlocks-97c464e1.cjs → AddBlocks-27cf978a.cjs} +1 -1
- package/dist/{BrandingOptions-3095a1ac.js → BrandingOptions-97a2a079.js} +1 -1
- package/dist/{BrandingOptions-a4de85eb.cjs → BrandingOptions-e0f6e657.cjs} +1 -1
- package/dist/{CanvasArea-a6706381.js → CanvasArea-03429375.js} +2 -2
- package/dist/{CanvasArea-45062968.cjs → CanvasArea-8b976012.cjs} +2 -2
- package/dist/{CurrentPage-36e1f888.js → CurrentPage-144a9895.js} +1 -1
- package/dist/{CurrentPage-181bbdc0.cjs → CurrentPage-d0c34230.cjs} +1 -1
- package/dist/{Layers-066e5450.js → Layers-e85a5d48.js} +2 -2
- package/dist/{Layers-884713c8.cjs → Layers-e8fce30a.cjs} +1 -1
- package/dist/{MarkAsGlobalBlock-dc93e527.js → MarkAsGlobalBlock-8f9c2527.js} +1 -1
- package/dist/{MarkAsGlobalBlock-3336e964.cjs → MarkAsGlobalBlock-be8472ad.cjs} +1 -1
- package/dist/{PagesPanel-574a0a87.cjs → PagesPanel-30564220.cjs} +1 -1
- package/dist/{PagesPanel-dba3d5fa.js → PagesPanel-c2aafd16.js} +2 -2
- package/dist/{ProjectPanel-b7c44110.js → ProjectPanel-60721d3e.js} +2 -2
- package/dist/{ProjectPanel-a737a211.cjs → ProjectPanel-dc4a2415.cjs} +1 -1
- package/dist/{Settings-a3117310.js → Settings-c58fc45b.js} +1 -1
- package/dist/{Settings-7d129d30.cjs → Settings-f12123c4.cjs} +1 -1
- package/dist/{SidePanels-ffe30d1c.js → SidePanels-180ca368.js} +2 -2
- package/dist/{SidePanels-b4ba0640.cjs → SidePanels-9f5fe660.cjs} +1 -1
- package/dist/{Topbar-4e04e218.js → Topbar-51478e94.js} +1 -1
- package/dist/{Topbar-836552a6.cjs → Topbar-554f4f23.cjs} +1 -1
- package/dist/{add-page-modal-41831178.js → add-page-modal-1d77b545.js} +1 -1
- package/dist/{add-page-modal-217f08a5.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-a58fb14e.cjs → delete-page-modal-5b050396.cjs} +1 -1
- package/dist/{delete-page-modal-9c81fd1f.js → delete-page-modal-7c83e048.js} +1 -1
- package/dist/{index-e2dad9ec.cjs → index-1bf563c1.cjs} +2 -2
- package/dist/{index-088a9534.js → index-2ff849f6.js} +4 -4
- package/dist/{page-viewer-6a9db9cc.js → page-viewer-5e3e11cd.js} +2 -2
- package/dist/{page-viewer-ff2173dd.cjs → page-viewer-bd09dc9d.cjs} +1 -1
- package/dist/{project-general-setting-695a14fa.cjs → project-general-setting-46c17b7b.cjs} +1 -1
- package/dist/{project-general-setting-d0cb6eca.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/server.cjs +1 -1
- package/dist/server.d.ts +1 -1
- package/dist/server.js +36 -36
- package/dist/{single-page-detail-ac77d6d0.js → single-page-detail-39a07929.js} +2 -2
- package/dist/{single-page-detail-f54b60af.cjs → single-page-detail-fcacbb82.cjs} +1 -1
- package/package.json +2 -2
|
@@ -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
|
".": {
|
|
@@ -28789,7 +28789,7 @@ const bW = "@chaibuilder/sdk", gW = "0.1.24", mW = "module", vW = [
|
|
|
28789
28789
|
docs: "jsdoc -c jsdoc.conf.json"
|
|
28790
28790
|
}, EW = {
|
|
28791
28791
|
"@bobthered/tailwindcss-palette-generator": "3.1.1",
|
|
28792
|
-
"@chaibuilder/blocks": "0.1.
|
|
28792
|
+
"@chaibuilder/blocks": "0.1.22",
|
|
28793
28793
|
"@floating-ui/dom": "1.4.5",
|
|
28794
28794
|
"@floating-ui/react-dom": "2.0.1",
|
|
28795
28795
|
"@mhsdesign/jit-browser-tailwindcss": "0.3.0",
|
|
@@ -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 {
|
package/dist/server.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var u=Object.defineProperty;var g=(n,t,e)=>t in n?u(n,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):n[t]=e;var
|
|
1
|
+
"use strict";var u=Object.defineProperty;var g=(n,t,e)=>t in n?u(n,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):n[t]=e;var h=(n,t,e)=>(g(n,typeof t!="symbol"?t+"":t,e),e);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const c=require("lodash"),p=require("@chaibuilder/blocks"),d="https://api.chaibuilder.com";class l{constructor(t,e){h(this,"authSecret");h(this,"appKey");if(!t)throw"Please provide valid auth secret.";if(!e)throw"Please provide valid project key.";this.authSecret=t,this.appKey=e}async getPageData(t){const e=this.getHeaders(),s=this.getURL("page-data",c.isEmpty(t)?{}:{slug:t}),a={method:"GET",headers:e,next:{tags:["everything",c.isEmpty(t)?"_homepage":t]}};return this.fetchAPI(s,a)}async getPage(t){if(!t)return Promise.reject({data:null,error:{message:"Invalid page uuid"},result:"error"});const e=this.getHeaders(),s=this.getURL("page",{uuid:t}),a={method:"GET",headers:e};return this.fetchAPI(s,a)}async getPages(){const t=this.getHeaders(),e=this.getURL("pages"),r={method:"GET",headers:t};return this.fetchAPI(e,r)}async addPage(t){const e=JSON.stringify(t),s=this.getHeaders(),r=this.getURL("page"),o={method:"POST",headers:s,body:e};return this.fetchAPI(r,o)}async deletePage(t){if(!t)return Promise.reject({data:null,error:{message:"Invalid page uuid"},result:"error"});const e=this.getHeaders(),s=this.getURL("page",{uuid:t}),a={method:"DELETE",headers:e};return this.fetchAPI(s,a)}async updatePage(t){const e=JSON.stringify(t),s=this.getHeaders(),r=this.getURL("page"),o={method:"PUT",headers:s,body:e};return this.fetchAPI(r,o)}async getProject(){const t=this.getHeaders(),e=this.getURL("project"),r={method:"GET",headers:t};return this.fetchAPI(e,r)}async updateProject(t){const e=JSON.stringify(t),s=this.getHeaders(),r=this.getURL("project"),o={method:"PUT",headers:s,body:e};return this.fetchAPI(r,o)}async uploadAsset(t){const e=this.getHeaders(),s=this.getURL("asset"),r="POST",a=await t.get("file"),o=new FormData;o.append("file",a);const i={method:r,headers:e,body:o};return this.fetchAPI(s,i)}async getAssets(t,e){const s=this.getHeaders(),r=this.getURL("asset");t&&r.concat(`?limit=${t}`),e&&r.concat(`&offset=${e}`);const o={method:"GET",headers:s};return this.fetchAPI(r,o)}async authenticate({password:t}){const e=JSON.stringify({password:t}),s=this.getHeaders(),r=this.getURL("authenticate"),o={method:"POST",headers:s,body:e};return this.fetchAPI(r,o)}async verify(t){const e=JSON.stringify({token:t}),s=this.getHeaders(),r=this.getURL("verify"),o={method:"POST",headers:s,body:e};return this.fetchAPI(r,o)}getURL(t,e){const s=new URLSearchParams(e).toString();return c.isEmpty(e)?`${d}/v1/${t}`:`${d}/v1/${t}?${s}`}getHeaders(){const t=new Headers;return t.append("x-chai-app-key",this.appKey),t.append("x-chai-auth-secret",this.authSecret),t}async fetchAPI(t,e){try{const s=await fetch(t,e).then(r=>r.json());if((s==null?void 0:s.result)==="success")return{data:s==null?void 0:s.data,error:null,result:"success"};throw s==null?void 0:s.error}catch(s){return{data:null,error:s,result:"error"}}}}const y=async(n,t)=>{const e=p.getChaiDataProviders(),s=c.filter(e,o=>c.map(n,"providerKey").includes(o.providerKey)),r={},a=[];for(const o of s)try{r[o.providerKey]=await o.dataFn({},t)}catch(i){a.push(i)}return{data:r,errors:a}};exports.ChaibuilderBackend=l;exports.prepareExternalData=y;
|
package/dist/server.d.ts
CHANGED
|
@@ -245,7 +245,7 @@ export declare class ChaibuilderBackend implements ChaibuilderBackendInterface {
|
|
|
245
245
|
export declare const prepareExternalData: (providers: {
|
|
246
246
|
providerKey: string;
|
|
247
247
|
args: Record<string, unknown>;
|
|
248
|
-
}[]) => Promise<{
|
|
248
|
+
}[], currentPageUrl: string) => Promise<{
|
|
249
249
|
data: {};
|
|
250
250
|
errors: any[];
|
|
251
251
|
}>;
|
package/dist/server.js
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
var g = Object.defineProperty;
|
|
2
2
|
var u = (n, t, e) => t in n ? g(n, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : n[t] = e;
|
|
3
|
-
var
|
|
4
|
-
import { isEmpty as
|
|
3
|
+
var h = (n, t, e) => (u(n, typeof t != "symbol" ? t + "" : t, e), e);
|
|
4
|
+
import { isEmpty as i, filter as p, map as l } from "lodash";
|
|
5
5
|
import { getChaiDataProviders as y } from "@chaibuilder/blocks";
|
|
6
|
-
const
|
|
6
|
+
const d = "https://api.chaibuilder.com";
|
|
7
7
|
class v {
|
|
8
8
|
constructor(t, e) {
|
|
9
|
-
|
|
10
|
-
|
|
9
|
+
h(this, "authSecret");
|
|
10
|
+
h(this, "appKey");
|
|
11
11
|
if (!t)
|
|
12
12
|
throw "Please provide valid auth secret.";
|
|
13
13
|
if (!e)
|
|
@@ -15,12 +15,12 @@ class v {
|
|
|
15
15
|
this.authSecret = t, this.appKey = e;
|
|
16
16
|
}
|
|
17
17
|
async getPageData(t) {
|
|
18
|
-
const e = this.getHeaders(), s = this.getURL("page-data",
|
|
18
|
+
const e = this.getHeaders(), s = this.getURL("page-data", i(t) ? {} : { slug: t }), a = {
|
|
19
19
|
method: "GET",
|
|
20
20
|
headers: e,
|
|
21
|
-
next: { tags: ["everything",
|
|
21
|
+
next: { tags: ["everything", i(t) ? "_homepage" : t] }
|
|
22
22
|
};
|
|
23
|
-
return this.fetchAPI(s,
|
|
23
|
+
return this.fetchAPI(s, a);
|
|
24
24
|
}
|
|
25
25
|
/**
|
|
26
26
|
*
|
|
@@ -34,8 +34,8 @@ class v {
|
|
|
34
34
|
error: { message: "Invalid page uuid" },
|
|
35
35
|
result: "error"
|
|
36
36
|
});
|
|
37
|
-
const e = this.getHeaders(), s = this.getURL("page", { uuid: t }),
|
|
38
|
-
return this.fetchAPI(s,
|
|
37
|
+
const e = this.getHeaders(), s = this.getURL("page", { uuid: t }), a = { method: "GET", headers: e };
|
|
38
|
+
return this.fetchAPI(s, a);
|
|
39
39
|
}
|
|
40
40
|
/**
|
|
41
41
|
*
|
|
@@ -52,8 +52,8 @@ class v {
|
|
|
52
52
|
* @returns Detail of new page
|
|
53
53
|
*/
|
|
54
54
|
async addPage(t) {
|
|
55
|
-
const e = JSON.stringify(t), s = this.getHeaders(), r = this.getURL("page"),
|
|
56
|
-
return this.fetchAPI(r,
|
|
55
|
+
const e = JSON.stringify(t), s = this.getHeaders(), r = this.getURL("page"), o = { method: "POST", headers: s, body: e };
|
|
56
|
+
return this.fetchAPI(r, o);
|
|
57
57
|
}
|
|
58
58
|
/**
|
|
59
59
|
*
|
|
@@ -67,8 +67,8 @@ class v {
|
|
|
67
67
|
error: { message: "Invalid page uuid" },
|
|
68
68
|
result: "error"
|
|
69
69
|
});
|
|
70
|
-
const e = this.getHeaders(), s = this.getURL("page", { uuid: t }),
|
|
71
|
-
return this.fetchAPI(s,
|
|
70
|
+
const e = this.getHeaders(), s = this.getURL("page", { uuid: t }), a = { method: "DELETE", headers: e };
|
|
71
|
+
return this.fetchAPI(s, a);
|
|
72
72
|
}
|
|
73
73
|
/**
|
|
74
74
|
*
|
|
@@ -76,8 +76,8 @@ class v {
|
|
|
76
76
|
* @returns Update page information or Error response
|
|
77
77
|
*/
|
|
78
78
|
async updatePage(t) {
|
|
79
|
-
const e = JSON.stringify(t), s = this.getHeaders(), r = this.getURL("page"),
|
|
80
|
-
return this.fetchAPI(r,
|
|
79
|
+
const e = JSON.stringify(t), s = this.getHeaders(), r = this.getURL("page"), o = { method: "PUT", headers: s, body: e };
|
|
80
|
+
return this.fetchAPI(r, o);
|
|
81
81
|
}
|
|
82
82
|
/**
|
|
83
83
|
*
|
|
@@ -93,8 +93,8 @@ class v {
|
|
|
93
93
|
* @returns Updated project detail
|
|
94
94
|
*/
|
|
95
95
|
async updateProject(t) {
|
|
96
|
-
const e = JSON.stringify(t), s = this.getHeaders(), r = this.getURL("project"),
|
|
97
|
-
return this.fetchAPI(r,
|
|
96
|
+
const e = JSON.stringify(t), s = this.getHeaders(), r = this.getURL("project"), o = { method: "PUT", headers: s, body: e };
|
|
97
|
+
return this.fetchAPI(r, o);
|
|
98
98
|
}
|
|
99
99
|
/**
|
|
100
100
|
*
|
|
@@ -103,10 +103,10 @@ class v {
|
|
|
103
103
|
* @param req
|
|
104
104
|
*/
|
|
105
105
|
async uploadAsset(t) {
|
|
106
|
-
const e = this.getHeaders(), s = this.getURL("asset"), r = "POST",
|
|
107
|
-
|
|
108
|
-
const
|
|
109
|
-
return this.fetchAPI(s,
|
|
106
|
+
const e = this.getHeaders(), s = this.getURL("asset"), r = "POST", a = await t.get("file"), o = new FormData();
|
|
107
|
+
o.append("file", a);
|
|
108
|
+
const c = { method: r, headers: e, body: o };
|
|
109
|
+
return this.fetchAPI(s, c);
|
|
110
110
|
}
|
|
111
111
|
/**
|
|
112
112
|
*
|
|
@@ -117,8 +117,8 @@ class v {
|
|
|
117
117
|
async getAssets(t, e) {
|
|
118
118
|
const s = this.getHeaders(), r = this.getURL("asset");
|
|
119
119
|
t && r.concat(`?limit=${t}`), e && r.concat(`&offset=${e}`);
|
|
120
|
-
const
|
|
121
|
-
return this.fetchAPI(r,
|
|
120
|
+
const o = { method: "GET", headers: s };
|
|
121
|
+
return this.fetchAPI(r, o);
|
|
122
122
|
}
|
|
123
123
|
/**
|
|
124
124
|
*
|
|
@@ -126,8 +126,8 @@ class v {
|
|
|
126
126
|
* @returns { token }
|
|
127
127
|
*/
|
|
128
128
|
async authenticate({ password: t }) {
|
|
129
|
-
const e = JSON.stringify({ password: t }), s = this.getHeaders(), r = this.getURL("authenticate"),
|
|
130
|
-
return this.fetchAPI(r,
|
|
129
|
+
const e = JSON.stringify({ password: t }), s = this.getHeaders(), r = this.getURL("authenticate"), o = { method: "POST", headers: s, body: e };
|
|
130
|
+
return this.fetchAPI(r, o);
|
|
131
131
|
}
|
|
132
132
|
/**
|
|
133
133
|
*
|
|
@@ -135,8 +135,8 @@ class v {
|
|
|
135
135
|
* @returns { result: 'success' | 'error' }
|
|
136
136
|
*/
|
|
137
137
|
async verify(t) {
|
|
138
|
-
const e = JSON.stringify({ token: t }), s = this.getHeaders(), r = this.getURL("verify"),
|
|
139
|
-
return this.fetchAPI(r,
|
|
138
|
+
const e = JSON.stringify({ token: t }), s = this.getHeaders(), r = this.getURL("verify"), o = { method: "POST", headers: s, body: e };
|
|
139
|
+
return this.fetchAPI(r, o);
|
|
140
140
|
}
|
|
141
141
|
/**
|
|
142
142
|
*
|
|
@@ -146,7 +146,7 @@ class v {
|
|
|
146
146
|
*/
|
|
147
147
|
getURL(t, e) {
|
|
148
148
|
const s = new URLSearchParams(e).toString();
|
|
149
|
-
return
|
|
149
|
+
return i(e) ? `${d}/v1/${t}` : `${d}/v1/${t}?${s}`;
|
|
150
150
|
}
|
|
151
151
|
/**
|
|
152
152
|
*
|
|
@@ -171,15 +171,15 @@ class v {
|
|
|
171
171
|
}
|
|
172
172
|
}
|
|
173
173
|
}
|
|
174
|
-
const U = async (n) => {
|
|
175
|
-
const
|
|
176
|
-
for (const o of
|
|
174
|
+
const U = async (n, t) => {
|
|
175
|
+
const e = y(), s = p(e, (o) => l(n, "providerKey").includes(o.providerKey)), r = {}, a = [];
|
|
176
|
+
for (const o of s)
|
|
177
177
|
try {
|
|
178
|
-
|
|
179
|
-
} catch (
|
|
180
|
-
|
|
178
|
+
r[o.providerKey] = await o.dataFn({}, t);
|
|
179
|
+
} catch (c) {
|
|
180
|
+
a.push(c);
|
|
181
181
|
}
|
|
182
|
-
return { data:
|
|
182
|
+
return { data: r, errors: a };
|
|
183
183
|
};
|
|
184
184
|
export {
|
|
185
185
|
v as ChaibuilderBackend,
|
|
@@ -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;
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@chaibuilder/sdk",
|
|
3
3
|
"private": false,
|
|
4
|
-
"version": "0.1.
|
|
4
|
+
"version": "0.1.26",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"files": [
|
|
7
7
|
"dist"
|
|
@@ -54,7 +54,7 @@
|
|
|
54
54
|
},
|
|
55
55
|
"dependencies": {
|
|
56
56
|
"@bobthered/tailwindcss-palette-generator": "3.1.1",
|
|
57
|
-
"@chaibuilder/blocks": "0.1.
|
|
57
|
+
"@chaibuilder/blocks": "0.1.22",
|
|
58
58
|
"@floating-ui/dom": "1.4.5",
|
|
59
59
|
"@floating-ui/react-dom": "2.0.1",
|
|
60
60
|
"@mhsdesign/jit-browser-tailwindcss": "0.3.0",
|