@chaibuilder/sdk 1.2.31 → 1.2.32
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-u1FkSHNj.js → AddBlocks-0eVRNr1d.js} +1 -1
- package/dist/{AddBlocks-UxJOFB9M.cjs → AddBlocks-t0hKDSud.cjs} +1 -1
- package/dist/{BrandingOptions-RDn_Nhcq.cjs → BrandingOptions-NVmCxZfD.cjs} +1 -1
- package/dist/{BrandingOptions-A3_c_sd7.js → BrandingOptions-yYAznnw2.js} +1 -1
- package/dist/{CanvasArea-AgZG60eK.js → CanvasArea-2b4oSjRx.js} +11 -13
- package/dist/{CanvasArea-AP2VxTme.cjs → CanvasArea-OzyCq6UU.cjs} +2 -2
- package/dist/{CurrentPage-urEDcMfR.js → CurrentPage-1v40uk8K.js} +3 -3
- package/dist/{CurrentPage-lBwqlXua.cjs → CurrentPage-YBMhEBZG.cjs} +1 -1
- package/dist/{ListTree-c9Z0kWbN.js → ListTree-0ZrRreCs.js} +1 -1
- package/dist/{ListTree-pdQ14QJC.cjs → ListTree-jPwxgI6R.cjs} +1 -1
- package/dist/{PagesPanel-C3yfpE0O.js → PagesPanel-AxQX-BX2.js} +4 -4
- package/dist/{PagesPanel-QAb3JjVO.cjs → PagesPanel-ivEL9tIQ.cjs} +1 -1
- package/dist/{ProjectPanel--8xzmpgT.js → ProjectPanel-GYdge5v9.js} +4 -4
- package/dist/{ProjectPanel-DJHfHFni.cjs → ProjectPanel-shgvg_yT.cjs} +1 -1
- package/dist/{Settings-oMxnykls.js → Settings-9JAzGHau.js} +5 -5
- package/dist/Settings-MMwEBADN.cjs +1 -0
- package/dist/{SidePanels-TuKVMKxP.js → SidePanels-bLwsW29O.js} +3 -3
- package/dist/{SidePanels-znlH133C.cjs → SidePanels-iaaRCUeQ.cjs} +1 -1
- package/dist/{Topbar-VCFW9uNI.js → Topbar-0Ql8pHVc.js} +1 -1
- package/dist/{Topbar-J2tb4SA1.cjs → Topbar-CkUhCnSW.cjs} +1 -1
- package/dist/{UnsplashImages-N9h0avWO.js → UnsplashImages-NYwOOgYa.js} +1 -1
- package/dist/{UnsplashImages-XwjKheek.cjs → UnsplashImages-juwtWvXe.cjs} +1 -1
- package/dist/{UploadImages-y7LAQVrT.cjs → UploadImages-4_jmnoVi.cjs} +1 -1
- package/dist/{UploadImages-e70AeNGX.js → UploadImages-vpZeW-YW.js} +1 -1
- package/dist/{add-page-modal-PhWtC-ZY.cjs → add-page-modal-2ZPjc54F.cjs} +1 -1
- package/dist/{add-page-modal-Q3c1EOw1.js → add-page-modal-hDyzsEU7.js} +4 -4
- package/dist/{confirm-alert-EDOFRmH8.js → confirm-alert-FGQKKQJU.js} +1 -1
- package/dist/{confirm-alert-4OQlXZTJ.cjs → confirm-alert-QRxOc76t.cjs} +1 -1
- package/dist/core.cjs +1 -1
- package/dist/core.js +2 -2
- package/dist/{delete-page-modal-eh0Afqbu.cjs → delete-page-modal--N1nPPIL.cjs} +1 -1
- package/dist/{delete-page-modal-9B7603s-.js → delete-page-modal-KxeyBri2.js} +3 -3
- package/dist/email.cjs +1 -1
- package/dist/email.js +2 -2
- package/dist/{form-yw3Uuk6v.js → form-77dY98bF.js} +1 -1
- package/dist/{form-jQj7E-hS.cjs → form-hT5dGoJH.cjs} +1 -1
- package/dist/functions-I6BoMqqb.js +21 -0
- package/dist/functions-r3ExvGGf.cjs +1 -0
- package/dist/{index-TXu6kBv9.js → index-5zkCTSAM.js} +3 -3
- package/dist/{index-FVtnWx9d.js → index-AJalHhkO.js} +2 -2
- package/dist/index-FPBudsRF.cjs +1 -0
- package/dist/{index-B1EMostm.cjs → index-JIcsKKoG.cjs} +1 -1
- package/dist/{index-HiiWSXkE.js → index-hH5SIZ29.js} +358 -358
- package/dist/{index-tFX6mX_R.cjs → index-sJ9Uc9UY.cjs} +2 -2
- package/dist/lib.cjs +3 -3
- package/dist/lib.d.ts +0 -2
- package/dist/lib.js +1125 -97
- package/dist/{page-viewer-wVQGkDJd.cjs → page-viewer-k-g15j8B.cjs} +1 -1
- package/dist/{page-viewer-3UIfb9p1.js → page-viewer-umQaut1j.js} +4 -4
- package/dist/{project-general-setting-LrABWutT.cjs → project-general-setting-1leAiCJQ.cjs} +1 -1
- package/dist/{project-general-setting-8vqXfr75.js → project-general-setting-uuCemMCU.js} +4 -4
- package/dist/{project-seo-setting-x3peNgla.js → project-seo-setting-asvbPQiI.js} +2 -2
- package/dist/{project-seo-setting-q2953ybQ.cjs → project-seo-setting-kDBSOzgX.cjs} +1 -1
- package/dist/render.cjs +1 -1
- package/dist/render.d.ts +0 -4
- package/dist/render.js +125 -168
- package/dist/{single-page-detail-py5_WxGu.js → single-page-detail-F6pKWyq1.js} +5 -5
- package/dist/{single-page-detail-76C_iDiS.cjs → single-page-detail-IFtVxwl5.cjs} +1 -1
- package/dist/studio.cjs +1 -1
- package/dist/studio.js +3 -3
- package/dist/tailwind.cjs +1 -1
- package/dist/tailwind.d.ts +0 -37
- package/dist/tailwind.js +11 -102
- package/dist/ui.cjs +1 -1
- package/dist/ui.js +1 -1
- package/dist/useCanvasSettings-Am2o80hW.cjs +1 -0
- package/dist/{useCanvasSettings-unTQUdlP.js → useCanvasSettings-ikt217kv.js} +1 -1
- package/package.json +1 -1
- package/dist/Settings-alHeC0FS.cjs +0 -1
- package/dist/defaultTheme-9e2np_iI.cjs +0 -1
- package/dist/defaultTheme-ocvEtKQ3.js +0 -1062
- package/dist/index-12HbDLon.cjs +0 -1
- package/dist/useCanvasSettings-MR0Glu1b.cjs +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./jsx-runtime-Z_BpKhVy.cjs"),u=require("react"),n=require("@radix-ui/react-icons"),o=require("./index-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./jsx-runtime-Z_BpKhVy.cjs"),u=require("react"),n=require("@radix-ui/react-icons"),o=require("./index-FPBudsRF.cjs"),x=require("./index-JIcsKKoG.cjs");require("./_commonjsHelpers-wDK0ZLPo.cjs");require("lodash-es");require("./Functions-N3yhPYKY.cjs");require("clsx");require("tailwind-merge");require("@chaibuilder/runtime");require("jotai");require("./STRINGS-gPz7CUOk.cjs");require("@react-hookz/web");require("./MODIFIERS-YPHRtwrM.cjs");require("./Class-Zc8hpE7f.cjs");require("react-i18next");require("@radix-ui/react-toggle");require("class-variance-authority");require("@radix-ui/react-switch");require("@radix-ui/react-slot");require("@radix-ui/react-accordion");require("@radix-ui/react-alert-dialog");require("@radix-ui/react-dialog");require("@radix-ui/react-label");require("@radix-ui/react-scroll-area");require("@radix-ui/react-tabs");require("@radix-ui/react-tooltip");require("@radix-ui/react-popover");require("@radix-ui/react-menubar");require("@radix-ui/react-hover-card");require("@radix-ui/react-select");require("@radix-ui/react-dropdown-menu");require("@radix-ui/react-separator");require("@radix-ui/react-toast");require("cmdk");require("@radix-ui/react-context-menu");require("react-icons-picker");require("react-dom");require("react-quill");require("./index-sJ9Uc9UY.cjs");require("i18next");require("@floating-ui/react-dom");require("flagged");require("react-hotkeys-hook");require("sonner");require("./html-to-json-Xhu27KFD.cjs");require("himalaya");require("lucide-react");require("./index-ecnGWzh9.cjs");const m=u.lazy(()=>Promise.resolve().then(()=>require("./single-page-detail-IFtVxwl5.cjs"))),j=({pageData:s})=>{const[r,i]=u.useState("CLOSE");return e.jsxRuntimeExports.jsxs(o.Popover,{open:r==="OPEN"||r==="ALERT"||r==="PENDING",onOpenChange:t=>{i(r==="PENDING"?"ALERT":t?"OPEN":"CLOSE")},children:[e.jsxRuntimeExports.jsx(o.PopoverTrigger,{asChild:!0,onClick:t=>{t.stopPropagation(),i("OPEN")},children:e.jsxRuntimeExports.jsx("div",{className:"flex items-center justify-between",children:r==="OPEN"||r==="ALERT"||r==="PENDING"?e.jsxRuntimeExports.jsx(n.ChevronRightIcon,{}):e.jsxRuntimeExports.jsx("div",{className:"hidden hover:text-blue-600 group-hover:flex",children:e.jsxRuntimeExports.jsx(n.GearIcon,{})})})}),e.jsxRuntimeExports.jsx(o.PopoverContent,{side:"right",align:"start",alignOffset:-35,className:"h-screen w-96",children:e.jsxRuntimeExports.jsx(u.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:i})})})]})},p=s=>{const[r]=x.useCurrentPage(),{data:i}=x.useProject(),t=x.useChangePage(),l=(i==null?void 0:i.homepage)===s.uuid,a=r===s.uuid,c=()=>t(s);return i?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(n.HomeIcon,{}):e.jsxRuntimeExports.jsx(n.FileTextIcon,{})," ",s.name]}),e.jsxRuntimeExports.jsx(j,{pageData:s})]}):null},q=({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:u.Children.toArray(s.map(i=>e.jsxRuntimeExports.jsx(p,{...i})))});exports.default=q;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { j as e } from "./jsx-runtime-WbnYoNE9.js";
|
|
2
2
|
import s, { useState as p, Suspense as l } from "react";
|
|
3
3
|
import { ChevronRightIcon as c, GearIcon as u, HomeIcon as d, FileTextIcon as x } from "@radix-ui/react-icons";
|
|
4
|
-
import { aW as g, aX as h, aY as f } from "./index-
|
|
5
|
-
import { d as j, a as N, c as b } from "./index-
|
|
4
|
+
import { aW as g, aX as h, aY as f } from "./index-hH5SIZ29.js";
|
|
5
|
+
import { d as j, a as N, c as b } from "./index-5zkCTSAM.js";
|
|
6
6
|
import "./_commonjsHelpers-UyOWmZb0.js";
|
|
7
7
|
import "lodash-es";
|
|
8
8
|
import "./Functions-7jnEwJyw.js";
|
|
@@ -38,7 +38,7 @@ import "@radix-ui/react-context-menu";
|
|
|
38
38
|
import "react-icons-picker";
|
|
39
39
|
import "react-dom";
|
|
40
40
|
import "react-quill";
|
|
41
|
-
import "./index-
|
|
41
|
+
import "./index-AJalHhkO.js";
|
|
42
42
|
import "i18next";
|
|
43
43
|
import "@floating-ui/react-dom";
|
|
44
44
|
import "flagged";
|
|
@@ -48,7 +48,7 @@ import "./html-to-json-ZV4QjSww.js";
|
|
|
48
48
|
import "himalaya";
|
|
49
49
|
import "lucide-react";
|
|
50
50
|
import "./index-YpnaudSM.js";
|
|
51
|
-
const v = s.lazy(() => import("./single-page-detail-
|
|
51
|
+
const v = s.lazy(() => import("./single-page-detail-F6pKWyq1.js")), P = ({ pageData: r }) => {
|
|
52
52
|
const [t, i] = p("CLOSE");
|
|
53
53
|
return /* @__PURE__ */ e.jsxs(
|
|
54
54
|
g,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const q=require("./jsx-runtime-Z_BpKhVy.cjs"),a=require("react"),f=require("./index-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const q=require("./jsx-runtime-Z_BpKhVy.cjs"),a=require("react"),f=require("./index-FPBudsRF.cjs"),o=require("./controls-KK2oLIa8.cjs"),d=require("./form-hT5dGoJH.cjs"),m=require("./index-JIcsKKoG.cjs");require("./_commonjsHelpers-wDK0ZLPo.cjs");require("lodash-es");require("./Functions-N3yhPYKY.cjs");require("clsx");require("tailwind-merge");require("@chaibuilder/runtime");require("jotai");require("./STRINGS-gPz7CUOk.cjs");require("@react-hookz/web");require("./MODIFIERS-YPHRtwrM.cjs");require("./Class-Zc8hpE7f.cjs");require("react-i18next");require("@radix-ui/react-toggle");require("class-variance-authority");require("@radix-ui/react-switch");require("@radix-ui/react-slot");require("@radix-ui/react-accordion");require("@radix-ui/react-icons");require("@radix-ui/react-alert-dialog");require("@radix-ui/react-dialog");require("@radix-ui/react-label");require("@radix-ui/react-scroll-area");require("@radix-ui/react-tabs");require("@radix-ui/react-tooltip");require("@radix-ui/react-popover");require("@radix-ui/react-menubar");require("@radix-ui/react-hover-card");require("@radix-ui/react-select");require("@radix-ui/react-dropdown-menu");require("@radix-ui/react-separator");require("@radix-ui/react-toast");require("cmdk");require("@radix-ui/react-context-menu");require("react-icons-picker");require("react-dom");require("react-quill");require("@rjsf/core");require("@rjsf/validator-ajv8");require("./index-sJ9Uc9UY.cjs");require("i18next");require("@floating-ui/react-dom");require("flagged");require("react-hotkeys-hook");require("sonner");require("./html-to-json-Xhu27KFD.cjs");require("himalaya");require("lucide-react");require("./index-ecnGWzh9.cjs");function j(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 g=j(a),b=({_projectData:r,seany:i})=>{const{data:e,isLoading:u}=m.useProject();g.useEffect(()=>{e&&i(e)},[e,i]);const n=({formData:s},t)=>{i(l=>({...l,[t]:s[t]}))},c={name:o.u({title:"Project Name",default:e==null?void 0:e.name}),favicon:o.o({title:"Favicon",default:e==null?void 0:e.favicon})};return q.jsxRuntimeExports.jsx(f.ScrollArea,{className:"flex h-full select-none flex-col",children:q.jsxRuntimeExports.jsx(d.Form,{properties:c,disabled:u,formData:r,onChange:n})})};exports.default=b;
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { j as i } from "./jsx-runtime-WbnYoNE9.js";
|
|
2
2
|
import * as l from "react";
|
|
3
|
-
import { bi as n } from "./index-
|
|
3
|
+
import { bi as n } from "./index-hH5SIZ29.js";
|
|
4
4
|
import { u as c, o as u } from "./controls-OfJWSEqC.js";
|
|
5
|
-
import { F as d } from "./form-
|
|
6
|
-
import { a as x } from "./index-
|
|
5
|
+
import { F as d } from "./form-77dY98bF.js";
|
|
6
|
+
import { a as x } from "./index-5zkCTSAM.js";
|
|
7
7
|
import "./_commonjsHelpers-UyOWmZb0.js";
|
|
8
8
|
import "lodash-es";
|
|
9
9
|
import "./Functions-7jnEwJyw.js";
|
|
@@ -42,7 +42,7 @@ import "react-dom";
|
|
|
42
42
|
import "react-quill";
|
|
43
43
|
import "@rjsf/core";
|
|
44
44
|
import "@rjsf/validator-ajv8";
|
|
45
|
-
import "./index-
|
|
45
|
+
import "./index-AJalHhkO.js";
|
|
46
46
|
import "i18next";
|
|
47
47
|
import "@floating-ui/react-dom";
|
|
48
48
|
import "flagged";
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import { j as s } from "./jsx-runtime-WbnYoNE9.js";
|
|
2
2
|
import { b as D, u as c, g, o as x } from "./controls-OfJWSEqC.js";
|
|
3
|
-
import { F as v } from "./form-
|
|
3
|
+
import { F as v } from "./form-77dY98bF.js";
|
|
4
4
|
import "./_commonjsHelpers-UyOWmZb0.js";
|
|
5
5
|
import "react";
|
|
6
6
|
import "lodash-es";
|
|
7
7
|
import "@rjsf/core";
|
|
8
8
|
import "@rjsf/validator-ajv8";
|
|
9
|
-
import "./index-
|
|
9
|
+
import "./index-hH5SIZ29.js";
|
|
10
10
|
import "./Functions-7jnEwJyw.js";
|
|
11
11
|
import "clsx";
|
|
12
12
|
import "tailwind-merge";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const l=require("./jsx-runtime-Z_BpKhVy.cjs"),i=require("./controls-KK2oLIa8.cjs"),g=require("./form-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const l=require("./jsx-runtime-Z_BpKhVy.cjs"),i=require("./controls-KK2oLIa8.cjs"),g=require("./form-hT5dGoJH.cjs");require("./_commonjsHelpers-wDK0ZLPo.cjs");require("react");require("lodash-es");require("@rjsf/core");require("@rjsf/validator-ajv8");require("./index-FPBudsRF.cjs");require("./Functions-N3yhPYKY.cjs");require("clsx");require("tailwind-merge");require("@chaibuilder/runtime");require("jotai");require("./STRINGS-gPz7CUOk.cjs");require("@react-hookz/web");require("./MODIFIERS-YPHRtwrM.cjs");require("./Class-Zc8hpE7f.cjs");require("react-i18next");require("@radix-ui/react-toggle");require("class-variance-authority");require("@radix-ui/react-switch");require("@radix-ui/react-slot");require("@radix-ui/react-accordion");require("@radix-ui/react-icons");require("@radix-ui/react-alert-dialog");require("@radix-ui/react-dialog");require("@radix-ui/react-label");require("@radix-ui/react-scroll-area");require("@radix-ui/react-tabs");require("@radix-ui/react-tooltip");require("@radix-ui/react-popover");require("@radix-ui/react-menubar");require("@radix-ui/react-hover-card");require("@radix-ui/react-select");require("@radix-ui/react-dropdown-menu");require("@radix-ui/react-separator");require("@radix-ui/react-toast");require("cmdk");require("@radix-ui/react-context-menu");require("react-icons-picker");require("react-dom");require("react-quill");const D=({_projectData:e,seany:n})=>{var t,u,o,q,s,a;const d=({formData:f})=>{const r={...f};r.seoData.title===void 0&&(r.seoData.title=""),r.seoData.description===void 0&&(r.seoData.description=""),r.seoData.image===void 0&&(r.seoData.image=""),n(m=>({...m,...r}))},c={seoData:i.b({title:"",default:{title:((t=e.seoData)==null?void 0:t.title)||"",description:((u=e.seoData)==null?void 0:u.description)||"",image:((o=e.seoData)==null?void 0:o.image)||""},properties:{title:i.u({title:"Default Title",default:((q=e.seoData)==null?void 0:q.title)||""}),description:i.g({title:"Default Description",default:((s=e.seoData)==null?void 0:s.description)||""}),image:i.o({title:"Social Media Image",default:((a=e.seoData)==null?void 0:a.image)||""})}})};return l.jsxRuntimeExports.jsx("div",{className:"flex h-full select-none flex-col",children:l.jsxRuntimeExports.jsx(g.Form,{properties:c,formData:e,onChange:d})})};exports.default=D;
|
package/dist/render.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const c=require("./jsx-runtime-Z_BpKhVy.cjs"),d=require("react"),r=require("lodash-es"),Y=require("tailwind-merge"),a=require("./STRINGS-gPz7CUOk.cjs"),y=require("./functions-r3ExvGGf.cjs"),C=require("@chaibuilder/runtime"),T=require("react-wrap-balancer"),O=require("./MODIFIERS-YPHRtwrM.cjs");require("./_commonjsHelpers-wDK0ZLPo.cjs");const B=t=>{const n={};return Object.keys(t).forEach(e=>{r.isString(t[e])&&t[e].startsWith(a.SLOT_KEY)&&(n[e]=t[e].replace(a.SLOT_KEY,"").split(","))}),n},L=r.memoize((t,n)=>{const e=t.replace(a.STYLES_KEY,"").split(","),s=Y.twMerge(e[0],e[1]);return n?y.addPrefixToClasses(s,n).replace(a.STYLES_KEY,"").trim():s.replace(a.STYLES_KEY,"").trim()});function A(t,n){return r.get(t,`${n}_attrs`,{})}function K(t,n){const e={};return Object.keys(t).forEach(s=>{if(r.isString(t[s])&&t[s].startsWith(a.STYLES_KEY)){const i=L(t[s],n);e[s]={className:i,...A(t,s)}}}),e}function q(t,n){const e=r.get(t,"_bindings",{});return r.isEmpty(e)?{...t}:(r.each(e,(s,i)=>{r.isString(s)&&r.get(n,s,null)&&(t[i]=r.get(n,s,null))}),t)}function R(t){const{components:n,blocks:e,parent:s,classPrefix:i="",externalData:u={}}=t,g=e,l=o=>K(o,i),_=s?r.filter(e,{_parent:s}):r.filter(e,o=>r.isEmpty(o._parent));return c.jsxRuntimeExports.jsx(c.jsxRuntimeExports.Fragment,{children:d.Children.toArray(_.map((o,f)=>{const x=B(o),m={};r.isEmpty(x)||Object.keys(x).forEach(S=>{m[S]=d.Children.toArray(x[S].map(h=>c.jsxRuntimeExports.jsx(R,{externalData:u,classPrefix:i,blocks:g,parent:h,components:n})))});const p=r.filter(g,{_parent:o._id});m.children=p.length>0?c.jsxRuntimeExports.jsx(R,{externalData:u,classPrefix:i,parent:o._id,blocks:g,components:n}):null;const E=r.get(n,o._type,null);if(E!==null){let S=o;const h=E;return d.createElement(h,r.omit({...S,index:f,...q(o,u),...l(S),...m},["_parent"]))}return c.jsxRuntimeExports.jsxs("noscript",{children:[o._type," not found"]})}))})}const N=t=>{const n={};return Object.keys(t).forEach(e=>{r.isString(t[e])&&t[e].startsWith(a.SLOT_KEY)&&(n[e]=t[e].replace(a.SLOT_KEY,"").split(","))}),n},$=r.memoize((t,n)=>{const e=t.replace(a.STYLES_KEY,"").split(","),s=Y.twMerge(e[0],e[1]);return n===""?s.replace(a.STYLES_KEY,"").trim():y.addPrefixToClasses(s,n).replace(a.STYLES_KEY,"").trim()});function F(t,n){return r.get(t,`${n}_attrs`,{})}function I(t,n){const e={};return Object.keys(t).forEach(s=>{if(r.isString(t[s])&&t[s].startsWith(a.STYLES_KEY)){const i=$(t[s],n);e[s]={className:i,...F(t,s)}}}),e}function M(t,n){const e=r.get(t,"_bindings",{});return r.isEmpty(e)?{...t}:(r.each(e,(s,i)=>{r.isString(s)&&r.get(n,s,null)&&(t[i]=r.get(n,s,null))}),t)}function j({blocks:t,parent:n,classPrefix:e="",externalData:s={}}){const i=t,u=l=>I(l,e),g=n?r.filter(t,{_parent:n}):r.filter(t,l=>r.isEmpty(l._parent));return c.jsxRuntimeExports.jsx(c.jsxRuntimeExports.Fragment,{children:d.Children.toArray(g.map((l,_)=>{const o=N(l),f={};r.isEmpty(o)||Object.keys(o).forEach(p=>{f[p]=d.Children.toArray(o[p].map(E=>c.jsxRuntimeExports.jsx(j,{externalData:s,classPrefix:e,blocks:i,parent:E})))});const x=r.filter(i,{_parent:l._id});f.children=x.length>0?c.jsxRuntimeExports.jsx(j,{externalData:s,classPrefix:e,parent:l._id,blocks:i}):null;const m=C.getBlockComponent(l._type);if(m!==null){let p=l;const E=m.component;return p={...m.defaults,...l},d.createElement(E,r.omit({blockProps:{},inBuilder:!1,...p,index:_,...M(l,s),...u(p),...f},["_parent"]))}return c.jsxRuntimeExports.jsxs("noscript",{children:[l._type," not found"]})}))})}const W=({pageData:t,externalData:n={},before:e=null,after:s=null,classPrefix:i="c-"})=>{const u=r.get(t.project,"brandingOptions",O.BRANDING_OPTIONS_DEFAULTS);return c.jsxRuntimeExports.jsxs(c.jsxRuntimeExports.Fragment,{children:[e,c.jsxRuntimeExports.jsx("div",{className:i.replace("-","")+" "+y.getBrandingClasses(u,i)+" min-h-screen",children:c.jsxRuntimeExports.jsx(T.Provider,{children:c.jsxRuntimeExports.jsx(j,{externalData:n,blocks:t.page.blocks||[],classPrefix:i})})}),s]})};exports.RenderChaiBlocks=j;exports.RenderChaiPage=W;exports.RenderUnregisteredComponents=R;
|
package/dist/render.d.ts
CHANGED
|
@@ -47,10 +47,6 @@ declare type ChaiPageProps = {
|
|
|
47
47
|
externalData?: Record<string, any>;
|
|
48
48
|
};
|
|
49
49
|
|
|
50
|
-
export declare const convertToBlocks: (jsonString: string) => ChaiBlock[];
|
|
51
|
-
|
|
52
|
-
export declare const generateEmailTemplate: (blocks: ChaiBlock[], brandingOptions: Record<string, any>, output?: "plain" | "html") => string;
|
|
53
|
-
|
|
54
50
|
export declare function RenderChaiBlocks({ blocks, parent, classPrefix, externalData, }: {
|
|
55
51
|
blocks: ChaiBlock[];
|
|
56
52
|
parent?: string;
|
package/dist/render.js
CHANGED
|
@@ -1,90 +1,86 @@
|
|
|
1
1
|
import { j as o } from "./jsx-runtime-WbnYoNE9.js";
|
|
2
|
-
import
|
|
3
|
-
import { isString as
|
|
4
|
-
import { twMerge as
|
|
5
|
-
import { S as
|
|
6
|
-
import { a as
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import { B as Y } from "./MODIFIERS-cBT31iqE.js";
|
|
11
|
-
import { render as H } from "@react-email/render";
|
|
12
|
-
import { Tailwind as K, Html as U, Head as V, Font as z } from "@react-email/components";
|
|
13
|
-
import G from "tailwindcss-palette-generator";
|
|
2
|
+
import u from "react";
|
|
3
|
+
import { isString as _, memoize as N, get as c, isEmpty as h, each as $, filter as g, omit as R } from "lodash-es";
|
|
4
|
+
import { twMerge as T } from "tailwind-merge";
|
|
5
|
+
import { S as y, a as p } from "./STRINGS--j49GZJP.js";
|
|
6
|
+
import { a as F, g as W } from "./functions-I6BoMqqb.js";
|
|
7
|
+
import { getBlockComponent as L } from "@chaibuilder/runtime";
|
|
8
|
+
import { Provider as Y } from "react-wrap-balancer";
|
|
9
|
+
import { B as I } from "./MODIFIERS-cBT31iqE.js";
|
|
14
10
|
import "./_commonjsHelpers-UyOWmZb0.js";
|
|
15
|
-
const
|
|
16
|
-
const
|
|
11
|
+
const K = (t) => {
|
|
12
|
+
const s = {};
|
|
17
13
|
return Object.keys(t).forEach((n) => {
|
|
18
|
-
|
|
19
|
-
}),
|
|
20
|
-
},
|
|
21
|
-
const n = t.replace(p, "").split(","),
|
|
22
|
-
return
|
|
14
|
+
_(t[n]) && t[n].startsWith(y) && (s[n] = t[n].replace(y, "").split(","));
|
|
15
|
+
}), s;
|
|
16
|
+
}, U = N((t, s) => {
|
|
17
|
+
const n = t.replace(p, "").split(","), r = T(n[0], n[1]);
|
|
18
|
+
return s ? F(r, s).replace(p, "").trim() : r.replace(p, "").trim();
|
|
23
19
|
});
|
|
24
|
-
function
|
|
25
|
-
return
|
|
20
|
+
function w(t, s) {
|
|
21
|
+
return c(t, `${s}_attrs`, {});
|
|
26
22
|
}
|
|
27
|
-
function
|
|
23
|
+
function z(t, s) {
|
|
28
24
|
const n = {};
|
|
29
|
-
return Object.keys(t).forEach((
|
|
30
|
-
if (
|
|
31
|
-
const
|
|
32
|
-
n[
|
|
33
|
-
className:
|
|
34
|
-
...
|
|
25
|
+
return Object.keys(t).forEach((r) => {
|
|
26
|
+
if (_(t[r]) && t[r].startsWith(p)) {
|
|
27
|
+
const e = U(t[r], s);
|
|
28
|
+
n[r] = {
|
|
29
|
+
className: e,
|
|
30
|
+
...w(t, r)
|
|
35
31
|
};
|
|
36
32
|
}
|
|
37
33
|
}), n;
|
|
38
34
|
}
|
|
39
|
-
function
|
|
40
|
-
const n =
|
|
41
|
-
return
|
|
42
|
-
|
|
35
|
+
function G(t, s) {
|
|
36
|
+
const n = c(t, "_bindings", {});
|
|
37
|
+
return h(n) ? { ...t } : ($(n, (r, e) => {
|
|
38
|
+
_(r) && c(s, r, null) && (t[e] = c(s, r, null));
|
|
43
39
|
}), t);
|
|
44
40
|
}
|
|
45
|
-
function
|
|
46
|
-
const { components:
|
|
47
|
-
return /* @__PURE__ */ o.jsx(o.Fragment, { children:
|
|
48
|
-
|
|
49
|
-
const C =
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
C[
|
|
53
|
-
|
|
41
|
+
function x(t) {
|
|
42
|
+
const { components: s, blocks: n, parent: r, classPrefix: e = "", externalData: m = {} } = t, j = n, a = (i) => z(i, e), S = r ? g(n, { _parent: r }) : g(n, (i) => h(i._parent));
|
|
43
|
+
return /* @__PURE__ */ o.jsx(o.Fragment, { children: u.Children.toArray(
|
|
44
|
+
S.map((i, E) => {
|
|
45
|
+
const C = K(i), d = {};
|
|
46
|
+
h(C) || Object.keys(C).forEach((B) => {
|
|
47
|
+
d[B] = u.Children.toArray(
|
|
48
|
+
C[B].map((A) => /* @__PURE__ */ o.jsx(
|
|
49
|
+
x,
|
|
54
50
|
{
|
|
55
|
-
externalData:
|
|
56
|
-
classPrefix:
|
|
57
|
-
blocks:
|
|
58
|
-
parent:
|
|
59
|
-
components:
|
|
51
|
+
externalData: m,
|
|
52
|
+
classPrefix: e,
|
|
53
|
+
blocks: j,
|
|
54
|
+
parent: A,
|
|
55
|
+
components: s
|
|
60
56
|
}
|
|
61
57
|
))
|
|
62
58
|
);
|
|
63
59
|
});
|
|
64
|
-
const
|
|
65
|
-
|
|
66
|
-
|
|
60
|
+
const l = g(j, { _parent: i._id });
|
|
61
|
+
d.children = l.length > 0 ? /* @__PURE__ */ o.jsx(
|
|
62
|
+
x,
|
|
67
63
|
{
|
|
68
|
-
externalData:
|
|
69
|
-
classPrefix:
|
|
64
|
+
externalData: m,
|
|
65
|
+
classPrefix: e,
|
|
70
66
|
parent: i._id,
|
|
71
|
-
blocks:
|
|
72
|
-
components:
|
|
67
|
+
blocks: j,
|
|
68
|
+
components: s
|
|
73
69
|
}
|
|
74
70
|
) : null;
|
|
75
|
-
const
|
|
76
|
-
if (
|
|
77
|
-
let
|
|
78
|
-
const
|
|
79
|
-
return
|
|
80
|
-
|
|
81
|
-
|
|
71
|
+
const f = c(s, i._type, null);
|
|
72
|
+
if (f !== null) {
|
|
73
|
+
let B = i;
|
|
74
|
+
const A = f;
|
|
75
|
+
return u.createElement(
|
|
76
|
+
A,
|
|
77
|
+
R(
|
|
82
78
|
{
|
|
83
|
-
...
|
|
84
|
-
index:
|
|
85
|
-
...
|
|
86
|
-
...
|
|
87
|
-
...
|
|
79
|
+
...B,
|
|
80
|
+
index: E,
|
|
81
|
+
...G(i, m),
|
|
82
|
+
...a(B),
|
|
83
|
+
...d
|
|
88
84
|
},
|
|
89
85
|
["_parent"]
|
|
90
86
|
)
|
|
@@ -97,157 +93,118 @@ function A(t) {
|
|
|
97
93
|
})
|
|
98
94
|
) });
|
|
99
95
|
}
|
|
100
|
-
const
|
|
101
|
-
const
|
|
96
|
+
const M = (t) => {
|
|
97
|
+
const s = {};
|
|
102
98
|
return Object.keys(t).forEach((n) => {
|
|
103
|
-
|
|
104
|
-
}),
|
|
105
|
-
},
|
|
106
|
-
const n = t.replace(p, "").split(","),
|
|
107
|
-
return
|
|
99
|
+
_(t[n]) && t[n].startsWith(y) && (s[n] = t[n].replace(y, "").split(","));
|
|
100
|
+
}), s;
|
|
101
|
+
}, q = N((t, s) => {
|
|
102
|
+
const n = t.replace(p, "").split(","), r = T(n[0], n[1]);
|
|
103
|
+
return s === "" ? r.replace(p, "").trim() : F(r, s).replace(p, "").trim();
|
|
108
104
|
});
|
|
109
|
-
function
|
|
110
|
-
return
|
|
105
|
+
function H(t, s) {
|
|
106
|
+
return c(t, `${s}_attrs`, {});
|
|
111
107
|
}
|
|
112
|
-
function
|
|
108
|
+
function J(t, s) {
|
|
113
109
|
const n = {};
|
|
114
|
-
return Object.keys(t).forEach((
|
|
115
|
-
if (
|
|
116
|
-
const
|
|
117
|
-
n[
|
|
118
|
-
className:
|
|
119
|
-
...
|
|
110
|
+
return Object.keys(t).forEach((r) => {
|
|
111
|
+
if (_(t[r]) && t[r].startsWith(p)) {
|
|
112
|
+
const e = q(t[r], s);
|
|
113
|
+
n[r] = {
|
|
114
|
+
className: e,
|
|
115
|
+
...H(t, r)
|
|
120
116
|
};
|
|
121
117
|
}
|
|
122
118
|
}), n;
|
|
123
119
|
}
|
|
124
|
-
function
|
|
125
|
-
const n =
|
|
126
|
-
return
|
|
127
|
-
|
|
120
|
+
function P(t, s) {
|
|
121
|
+
const n = c(t, "_bindings", {});
|
|
122
|
+
return h(n) ? { ...t } : ($(n, (r, e) => {
|
|
123
|
+
_(r) && c(s, r, null) && (t[e] = c(s, r, null));
|
|
128
124
|
}), t);
|
|
129
125
|
}
|
|
130
|
-
function
|
|
126
|
+
function O({
|
|
131
127
|
blocks: t,
|
|
132
|
-
parent:
|
|
128
|
+
parent: s,
|
|
133
129
|
classPrefix: n = "",
|
|
134
|
-
externalData:
|
|
130
|
+
externalData: r = {}
|
|
135
131
|
}) {
|
|
136
|
-
const
|
|
137
|
-
return /* @__PURE__ */ o.jsx(o.Fragment, { children:
|
|
138
|
-
|
|
139
|
-
const i =
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
i[
|
|
143
|
-
|
|
132
|
+
const e = t, m = (a) => J(a, n), j = s ? g(t, { _parent: s }) : g(t, (a) => h(a._parent));
|
|
133
|
+
return /* @__PURE__ */ o.jsx(o.Fragment, { children: u.Children.toArray(
|
|
134
|
+
j.map((a, S) => {
|
|
135
|
+
const i = M(a), E = {};
|
|
136
|
+
h(i) || Object.keys(i).forEach((l) => {
|
|
137
|
+
E[l] = u.Children.toArray(
|
|
138
|
+
i[l].map((f) => /* @__PURE__ */ o.jsx(
|
|
139
|
+
O,
|
|
144
140
|
{
|
|
145
|
-
externalData:
|
|
141
|
+
externalData: r,
|
|
146
142
|
classPrefix: n,
|
|
147
|
-
blocks:
|
|
148
|
-
parent:
|
|
143
|
+
blocks: e,
|
|
144
|
+
parent: f
|
|
149
145
|
}
|
|
150
146
|
))
|
|
151
147
|
);
|
|
152
148
|
});
|
|
153
|
-
const C =
|
|
154
|
-
|
|
155
|
-
|
|
149
|
+
const C = g(e, { _parent: a._id });
|
|
150
|
+
E.children = C.length > 0 ? /* @__PURE__ */ o.jsx(
|
|
151
|
+
O,
|
|
156
152
|
{
|
|
157
|
-
externalData:
|
|
153
|
+
externalData: r,
|
|
158
154
|
classPrefix: n,
|
|
159
|
-
parent:
|
|
160
|
-
blocks:
|
|
155
|
+
parent: a._id,
|
|
156
|
+
blocks: e
|
|
161
157
|
}
|
|
162
158
|
) : null;
|
|
163
|
-
const
|
|
164
|
-
if (
|
|
165
|
-
let
|
|
166
|
-
const
|
|
167
|
-
return
|
|
168
|
-
|
|
169
|
-
|
|
159
|
+
const d = L(a._type);
|
|
160
|
+
if (d !== null) {
|
|
161
|
+
let l = a;
|
|
162
|
+
const f = d.component;
|
|
163
|
+
return l = { ...d.defaults, ...a }, u.createElement(
|
|
164
|
+
f,
|
|
165
|
+
R(
|
|
170
166
|
{
|
|
171
167
|
blockProps: {},
|
|
172
168
|
inBuilder: !1,
|
|
173
|
-
...
|
|
174
|
-
index:
|
|
175
|
-
...
|
|
176
|
-
...
|
|
177
|
-
...
|
|
169
|
+
...l,
|
|
170
|
+
index: S,
|
|
171
|
+
...P(a, r),
|
|
172
|
+
...m(l),
|
|
173
|
+
...E
|
|
178
174
|
},
|
|
179
175
|
["_parent"]
|
|
180
176
|
)
|
|
181
177
|
);
|
|
182
178
|
}
|
|
183
179
|
return /* @__PURE__ */ o.jsxs("noscript", { children: [
|
|
184
|
-
|
|
180
|
+
a._type,
|
|
185
181
|
" not found"
|
|
186
182
|
] });
|
|
187
183
|
})
|
|
188
184
|
) });
|
|
189
185
|
}
|
|
190
|
-
const
|
|
186
|
+
const st = ({
|
|
191
187
|
pageData: t,
|
|
192
|
-
externalData:
|
|
188
|
+
externalData: s = {},
|
|
193
189
|
before: n = null,
|
|
194
|
-
after:
|
|
195
|
-
classPrefix:
|
|
190
|
+
after: r = null,
|
|
191
|
+
classPrefix: e = "c-"
|
|
196
192
|
}) => {
|
|
197
|
-
const
|
|
193
|
+
const m = c(t.project, "brandingOptions", I);
|
|
198
194
|
return /* @__PURE__ */ o.jsxs(o.Fragment, { children: [
|
|
199
195
|
n,
|
|
200
196
|
/* @__PURE__ */ o.jsx(
|
|
201
197
|
"div",
|
|
202
198
|
{
|
|
203
|
-
className:
|
|
204
|
-
children: /* @__PURE__ */ o.jsx(
|
|
199
|
+
className: e.replace("-", "") + " " + W(m, e) + " min-h-screen",
|
|
200
|
+
children: /* @__PURE__ */ o.jsx(Y, { children: /* @__PURE__ */ o.jsx(O, { externalData: s, blocks: t.page.blocks || [], classPrefix: e }) })
|
|
205
201
|
}
|
|
206
202
|
),
|
|
207
|
-
|
|
203
|
+
r
|
|
208
204
|
] });
|
|
209
|
-
}, k = (t, r = "c-") => {
|
|
210
|
-
const n = a(t, "primaryColor", "#000"), e = a(t, "secondaryColor", "#ccc"), s = a(t, "bodyFont", "Inter"), c = a(t, "roundedCorners", "0"), d = G([
|
|
211
|
-
{ color: n, name: "primary" },
|
|
212
|
-
{ color: e, name: "secondary" }
|
|
213
|
-
]);
|
|
214
|
-
return {
|
|
215
|
-
theme: {
|
|
216
|
-
fontFamily: {
|
|
217
|
-
body: [s, ...W.fontFamily.sans]
|
|
218
|
-
},
|
|
219
|
-
extend: {
|
|
220
|
-
borderRadius: {
|
|
221
|
-
global: `${c || "0"}px`
|
|
222
|
-
},
|
|
223
|
-
colors: d
|
|
224
|
-
}
|
|
225
|
-
},
|
|
226
|
-
...r ? { prefix: r } : {}
|
|
227
|
-
};
|
|
228
|
-
}, tt = (t) => ({
|
|
229
|
-
fontFamily: t,
|
|
230
|
-
fallbackFontFamily: "Verdana",
|
|
231
|
-
webFont: {
|
|
232
|
-
url: `https://fonts.googleapis.com/css2?family=${t}&display=swap`,
|
|
233
|
-
format: "woff"
|
|
234
|
-
},
|
|
235
|
-
fontWeight: 400,
|
|
236
|
-
fontStyle: "normal"
|
|
237
|
-
}), gt = (t, r, n = "html") => {
|
|
238
|
-
const e = k(r);
|
|
239
|
-
return H(
|
|
240
|
-
/* @__PURE__ */ o.jsx(K, { config: e, children: /* @__PURE__ */ o.jsxs(U, { lang: "en", dir: "ltr", children: [
|
|
241
|
-
/* @__PURE__ */ o.jsx(V, { children: /* @__PURE__ */ o.jsx(z, { ...tt(a(r, "bodyFont", "Verdana")) }) }),
|
|
242
|
-
/* @__PURE__ */ o.jsx("body", { children: /* @__PURE__ */ o.jsx(B, { blocks: t }) })
|
|
243
|
-
] }) }),
|
|
244
|
-
n === "html" ? { pretty: !0 } : { plainText: !0 }
|
|
245
|
-
);
|
|
246
205
|
};
|
|
247
206
|
export {
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
jt as convertToBlocks,
|
|
252
|
-
gt as generateEmailTemplate
|
|
207
|
+
O as RenderChaiBlocks,
|
|
208
|
+
st as RenderChaiPage,
|
|
209
|
+
x as RenderUnregisteredComponents
|
|
253
210
|
};
|
|
@@ -2,11 +2,11 @@ import { j as t } from "./jsx-runtime-WbnYoNE9.js";
|
|
|
2
2
|
import I, { useState as j, useEffect as z } from "react";
|
|
3
3
|
import { isString as L, isEmpty as x, isEqual as C, omit as y, kebabCase as B } from "lodash-es";
|
|
4
4
|
import { HomeIcon as G } from "@radix-ui/react-icons";
|
|
5
|
-
import { bi as Y, B as q } from "./index-
|
|
5
|
+
import { bi as Y, B as q } from "./index-hH5SIZ29.js";
|
|
6
6
|
import { u as g, b as Z, g as $, o as F, r as Q } from "./controls-OfJWSEqC.js";
|
|
7
7
|
import { toast as U } from "sonner";
|
|
8
|
-
import { F as P } from "./form-
|
|
9
|
-
import { f as V, a as X, g as _, b as K } from "./index-
|
|
8
|
+
import { F as P } from "./form-77dY98bF.js";
|
|
9
|
+
import { f as V, a as X, g as _, b as K } from "./index-5zkCTSAM.js";
|
|
10
10
|
import "./_commonjsHelpers-UyOWmZb0.js";
|
|
11
11
|
import "./Functions-7jnEwJyw.js";
|
|
12
12
|
import "clsx";
|
|
@@ -43,7 +43,7 @@ import "react-dom";
|
|
|
43
43
|
import "react-quill";
|
|
44
44
|
import "@rjsf/core";
|
|
45
45
|
import "@rjsf/validator-ajv8";
|
|
46
|
-
import "./index-
|
|
46
|
+
import "./index-AJalHhkO.js";
|
|
47
47
|
import "i18next";
|
|
48
48
|
import "@floating-ui/react-dom";
|
|
49
49
|
import "flagged";
|
|
@@ -52,7 +52,7 @@ import "./html-to-json-ZV4QjSww.js";
|
|
|
52
52
|
import "himalaya";
|
|
53
53
|
import "lucide-react";
|
|
54
54
|
import "./index-YpnaudSM.js";
|
|
55
|
-
const O = I.lazy(() => import("./delete-page-modal-
|
|
55
|
+
const O = I.lazy(() => import("./delete-page-modal-KxeyBri2.js")), J = I.lazy(() => import("./confirm-alert-FGQKKQJU.js")), h = (r) => {
|
|
56
56
|
if (!L(r) || !(r.includes("/[") && r.includes("]")))
|
|
57
57
|
return !1;
|
|
58
58
|
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 r=require("./jsx-runtime-Z_BpKhVy.cjs"),f=require("react"),c=require("lodash-es"),H=require("@radix-ui/react-icons"),y=require("./index-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=require("./jsx-runtime-Z_BpKhVy.cjs"),f=require("react"),c=require("lodash-es"),H=require("@radix-ui/react-icons"),y=require("./index-FPBudsRF.cjs"),d=require("./controls-KK2oLIa8.cjs"),w=require("sonner"),p=require("./form-hT5dGoJH.cjs"),P=require("./index-JIcsKKoG.cjs");require("./_commonjsHelpers-wDK0ZLPo.cjs");require("./Functions-N3yhPYKY.cjs");require("clsx");require("tailwind-merge");require("@chaibuilder/runtime");require("jotai");require("./STRINGS-gPz7CUOk.cjs");require("@react-hookz/web");require("./MODIFIERS-YPHRtwrM.cjs");require("./Class-Zc8hpE7f.cjs");require("react-i18next");require("@radix-ui/react-toggle");require("class-variance-authority");require("@radix-ui/react-switch");require("@radix-ui/react-slot");require("@radix-ui/react-accordion");require("@radix-ui/react-alert-dialog");require("@radix-ui/react-dialog");require("@radix-ui/react-label");require("@radix-ui/react-scroll-area");require("@radix-ui/react-tabs");require("@radix-ui/react-tooltip");require("@radix-ui/react-popover");require("@radix-ui/react-menubar");require("@radix-ui/react-hover-card");require("@radix-ui/react-select");require("@radix-ui/react-dropdown-menu");require("@radix-ui/react-separator");require("@radix-ui/react-toast");require("cmdk");require("@radix-ui/react-context-menu");require("react-icons-picker");require("react-dom");require("react-quill");require("@rjsf/core");require("@rjsf/validator-ajv8");require("./index-sJ9Uc9UY.cjs");require("i18next");require("@floating-ui/react-dom");require("flagged");require("react-hotkeys-hook");require("./html-to-json-Xhu27KFD.cjs");require("himalaya");require("lucide-react");require("./index-ecnGWzh9.cjs");const z=f.lazy(()=>Promise.resolve().then(()=>require("./delete-page-modal--N1nPPIL.cjs"))),L=f.lazy(()=>Promise.resolve().then(()=>require("./confirm-alert-QRxOc76t.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]=f.useState(h(s)),[a,A]=f.useState({isHomePage:(e==null?void 0:e.homepage)===s.uuid}),j=G(i,s);f.useEffect(()=>{const l=!c.isEqual(h(s),i),t=(e==null?void 0:e.homepage)!==s.uuid&&a.isHomePage;o(l||t?"PENDING":"OPEN")},[e,s,i,a,o]);const C=()=>{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"),w.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")})},R=({formData:l},t)=>{b(g=>{var S,N;if(!t)return g;const x={[t]:l[t]};return t==="name"?x.slug=c.kebabCase((S=l[t])==null?void 0:S.replace(/\d/g,"")):t==="slug"?x.slug=(N=l[t])==null?void 0:N.replace(/\d/g,"").replace(/\s+/g,"").replace("--","-").replace("__","_"):t==="seoData"&&(x.seoData={title:l[t].title||"",description:l[t].description||"",image:l[t].image||""}),{...g,...x}})},I=({formData:l},t)=>{A(g=>{const x={[t]:l[t]};return{...g,...x}})},v={name:d.u({title:"Page Name",default:i.name}),slug:d.u({title:"Page Slug",default:i.slug})},T={seoData:d.b({title:"",description:"",default:{title:"",description:"",image:""},properties:{title:d.u({title:"Meta Title",default:i.name}),description:d.g({title:"Meta Description",default:i.slug}),image:d.o({title:"Social Media Image",default:""})}})},M={isHomePage:d.r({title:"Set as homepage",default:a.isHomePage})};return r.jsxRuntimeExports.jsxs(y.ScrollArea,{className:"flex h-full select-none flex-col",children:[r.jsxRuntimeExports.jsx(L,{open:n==="ALERT",title:"Do yo want to save changes?",onCancel:()=>o("CLOSE"),onConfirm:C,disabled:m.isPending||u.isPending}),r.jsxRuntimeExports.jsx("div",{className:"rounded-md bg-background/30 px-2.5 py-1",children:r.jsxRuntimeExports.jsx("h1",{className:"px-1 font-semibold",children:"Page Details"})}),r.jsxRuntimeExports.jsx("div",{className:"px-2.5 pt-2",children:r.jsxRuntimeExports.jsxs("div",{className:"flex flex-col space-y-2",children:[r.jsxRuntimeExports.jsx(p.Form,{title:"Basic Details",formData:i,properties:v,onChange:R,disabled:u.isPending||m.isPending}),r.jsxRuntimeExports.jsx("div",{className:"h-2 w-full"}),r.jsxRuntimeExports.jsx(p.Form,{title:"SEO Details",formData:i,properties:T,onChange:R,disabled:u.isPending||m.isPending}),(e==null?void 0:e.homepage)!==s.uuid&&s.type==="STATIC"?r.jsxRuntimeExports.jsx(p.Form,{formData:a,properties:M,onChange:I,disabled:u.isPending||m.isPending}):s.type==="STATIC"&&r.jsxRuntimeExports.jsxs("div",{className:"flex items-center gap-x-1 px-1 pt-2 text-xs font-medium text-gray-500",children:[r.jsxRuntimeExports.jsx(H.HomeIcon,{})," This is homepage"," "]}),i.type==="DYNAMIC"&&!E((i==null?void 0:i.slug)||"")&&r.jsxRuntimeExports.jsxs("small",{className:"px-1 text-red-400",children:["Add dynamic ID in page slug Eg: ",r.jsxRuntimeExports.jsx("i",{className:"underline",children:"some-url/[some-id]"})]}),r.jsxRuntimeExports.jsxs("div",{className:"my-2 flex w-full items-center justify-between gap-x-2 px-1",children:[r.jsxRuntimeExports.jsx(y.Button,{className:"w-full",type:"submit",onClick:C,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"}),r.jsxRuntimeExports.jsx(z,{pageData:s,projectData:e})]})]})})]})};exports.default=Y;
|