@chaibuilder/sdk 1.2.10 → 1.2.12
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/README.md +10 -12
- package/dist/AddBlocks-ByeMUUzE.js +218 -0
- package/dist/AddBlocks-nMUkm4og.cjs +1 -0
- package/dist/{BrandingOptions-10jJO8mG.js → BrandingOptions--poS5shs.js} +18 -21
- package/dist/BrandingOptions-eeDfvB0R.cjs +1 -0
- package/dist/{CanvasArea-jgBDM5Qd.js → CanvasArea--TKubnIM.js} +184 -185
- package/dist/{CanvasArea-6O8dMPug.cjs → CanvasArea-h4lA4oqP.cjs} +4 -4
- package/dist/{utils-AvyFzbPC.js → Class-17XFhL48.js} +15 -16
- package/dist/Class-5ARpH_Tu.cjs +1 -0
- package/dist/CurrentPage-B3YumhrX.cjs +1 -0
- package/dist/{CurrentPage-lakeZviD.js → CurrentPage-Gw9LJ40j.js} +24 -25
- package/dist/Layers-4r_4F6ST.cjs +1 -0
- package/dist/{Layers-R7TfREUd.js → Layers-d-xge4On.js} +77 -78
- package/dist/{PagesPanel-4mqxCFHq.js → PagesPanel-E4wSgVcE.js} +14 -15
- package/dist/PagesPanel-iZLDBwXQ.cjs +1 -0
- package/dist/ProjectPanel-2TcqGnfN.cjs +1 -0
- package/dist/{ProjectPanel-Wy2nw-1w.js → ProjectPanel-q7upaf7h.js} +17 -18
- package/dist/Settings-NuDNH2dR.cjs +1 -0
- package/dist/{Settings-_K28Ontt.js → Settings-y3DHsT88.js} +163 -164
- package/dist/SidePanels-91l1CjYv.cjs +1 -0
- package/dist/{SidePanels-6slnxdSj.js → SidePanels-BK_QnEh9.js} +40 -41
- package/dist/{Topbar-bwt6HjlL.js → Topbar-b7jnOD57.js} +16 -17
- package/dist/Topbar-rEO5z57t.cjs +1 -0
- package/dist/{UnsplashImages-V29UE-57.js → UnsplashImages-Lb78FYx7.js} +27 -28
- package/dist/UnsplashImages-p-WdKs3b.cjs +1 -0
- package/dist/{UploadImages-E0mi_qn8.js → UploadImages-aWG_1r7N.js} +23 -24
- package/dist/UploadImages-zk-IYDx8.cjs +1 -0
- package/dist/{add-page-modal-FJEAqfD3.js → add-page-modal-7djj9GZj.js} +28 -29
- package/dist/add-page-modal-iUffBbAe.cjs +1 -0
- package/dist/{confirm-alert-5hfE116f.js → confirm-alert-QuqMrpWn.js} +12 -13
- package/dist/confirm-alert-i3FRAgP4.cjs +1 -0
- package/dist/core.cjs +1 -1
- package/dist/core.d.ts +9 -50
- package/dist/core.js +47 -56
- package/dist/defaultTheme-IH19g4fv.cjs +1 -0
- package/dist/defaultTheme-YY8mlQS3.js +1055 -0
- package/dist/{delete-page-modal-wH0yLiQI.js → delete-page-modal-DEBiprds.js} +14 -15
- package/dist/delete-page-modal-RllDrgxs.cjs +1 -0
- package/dist/email-blocks.cjs +1 -1
- package/dist/email-blocks.js +100 -81
- package/dist/email.cjs +1 -0
- package/dist/email.d.ts +116 -0
- package/dist/email.js +79 -0
- package/dist/{controls-XPXGHKht.js → empty-slot-MWycClTb.js} +61 -50
- package/dist/empty-slot-TF2kd-0X.cjs +1 -0
- package/dist/{form-UVHCD9N3.js → form-94xR0NG8.js} +1 -1
- package/dist/{form-1j01gADS.cjs → form-yz7h2msc.cjs} +1 -1
- package/dist/{index-B4sL0YTN.js → index-0m8Zuv5X.js} +1434 -1552
- package/dist/{index-c2VLKuhY.js → index-19nTm_cE.js} +2069 -2059
- package/dist/index-TEfD-2ti.cjs +1 -0
- package/dist/{index-xbQL0wpz.cjs → index-XVud0HL8.cjs} +33 -33
- package/dist/lib.cjs +3 -3
- package/dist/lib.js +95 -1125
- package/dist/page-viewer-_ktv1pgX.cjs +1 -0
- package/dist/{page-viewer-TcK0I240.js → page-viewer-xPLhXv6k.js} +16 -17
- package/dist/{project-general-setting-4ruKl033.js → project-general-setting-XlORLtqJ.js} +15 -16
- package/dist/project-general-setting-nULU3Tzw.cjs +1 -0
- package/dist/project-seo-setting-9QkARPhg.cjs +1 -0
- package/dist/{project-seo-setting-d1EZlacB.js → project-seo-setting-KQkeHwny.js} +14 -15
- package/dist/render.cjs +1 -1
- package/dist/render.d.ts +2 -0
- package/dist/render.js +111 -70
- package/dist/single-page-detail-Gb6O3Yyw.cjs +1 -0
- package/dist/{single-page-detail-PihQi-dP.js → single-page-detail-gtVN9hxR.js} +44 -45
- package/dist/studio.cjs +1 -1
- package/dist/studio.js +13 -14
- package/dist/ui.cjs +1 -1
- package/dist/ui.d.ts +3 -3
- package/dist/ui.js +138 -139
- package/dist/{useAddBlockByDrop-nLzs79He.cjs → useAddBlockByDrop-GU5QLPtz.cjs} +1 -1
- package/dist/{useAddBlockByDrop-rcDR-z9_.js → useAddBlockByDrop-b5KJh_7w.js} +1 -1
- package/dist/web-blocks.cjs +1 -1
- package/dist/web-blocks.js +313 -322
- package/package.json +8 -2
- package/dist/AddBlocks-GiMnBMeQ.js +0 -224
- package/dist/AddBlocks-SzURo9Bj.cjs +0 -1
- package/dist/BrandingOptions-yK-54R-c.cjs +0 -1
- package/dist/CurrentPage-1y62Ne77.cjs +0 -1
- package/dist/Layers-Z4nmm9xK.cjs +0 -1
- package/dist/PagesPanel-ouHdxyOH.cjs +0 -1
- package/dist/ProjectPanel-hHolYZjt.cjs +0 -1
- package/dist/Settings-EYOw02iE.cjs +0 -1
- package/dist/SidePanels-U-_O1QN8.cjs +0 -1
- package/dist/Topbar-dQEoY2P8.cjs +0 -1
- package/dist/UnsplashImages-pGgaUPQy.cjs +0 -1
- package/dist/UploadImages-7oLycdSh.cjs +0 -1
- package/dist/add-page-modal-In6XI-vZ.cjs +0 -1
- package/dist/confirm-alert-Vwd3OzL9.cjs +0 -1
- package/dist/controls-Dy1qa8Dc.cjs +0 -1
- package/dist/delete-page-modal-tl7FLK9J.cjs +0 -1
- package/dist/functions-Ox_svtKm.cjs +0 -1
- package/dist/functions-xIebp8Aw.js +0 -23
- package/dist/index-7ogwGh39.cjs +0 -1
- package/dist/page-viewer-SfQUe0SI.cjs +0 -1
- package/dist/project-general-setting-t7E2Y_w9.cjs +0 -1
- package/dist/project-seo-setting-4b_BJZDF.cjs +0 -1
- package/dist/single-page-detail-KuXd9Mur.cjs +0 -1
- package/dist/utils-PTxFk6qT.cjs +0 -1
|
@@ -0,0 +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-TEfD-2ti.cjs"),x=require("./index-XVud0HL8.cjs");require("./_commonjsHelpers-wDK0ZLPo.cjs");require("lodash-es");require("./Functions-N3yhPYKY.cjs");require("clsx");require("tailwind-merge");require("@chaibuilder/runtime");require("jotai");require("flat-to-nested");require("./MODIFIERS-2FeVfZQ9.cjs");require("@react-hookz/web");require("@radix-ui/react-toggle");require("class-variance-authority");require("./Class-5ARpH_Tu.cjs");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("react-i18next");require("i18next");require("@floating-ui/react-dom");require("react-textarea-autosize");require("flagged");require("react-dnd");require("@minoru/react-dnd-treeview");require("react-hotkeys-hook");require("sonner");require("./html-to-json-2PeOCVey.cjs");require("himalaya");require("lucide-react");require("./web-blocks.cjs");require("./empty-slot-TF2kd-0X.cjs");const m=u.lazy(()=>Promise.resolve().then(()=>require("./single-page-detail-Gb6O3Yyw.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})})})]})},q=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},p=({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(q,{...i})))});exports.default=p;
|
|
@@ -1,16 +1,21 @@
|
|
|
1
1
|
import { j as e } from "./jsx-runtime-WbnYoNE9.js";
|
|
2
2
|
import s, { useState as n, 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 {
|
|
5
|
-
import { e as j, b, d as
|
|
4
|
+
import { aT as g, aU as h, aV as f } from "./index-0m8Zuv5X.js";
|
|
5
|
+
import { e as j, b as N, d as b } from "./index-19nTm_cE.js";
|
|
6
6
|
import "./_commonjsHelpers-UyOWmZb0.js";
|
|
7
|
-
import "@radix-ui/react-toggle";
|
|
8
|
-
import "class-variance-authority";
|
|
9
|
-
import "./utils-AvyFzbPC.js";
|
|
10
7
|
import "lodash-es";
|
|
11
|
-
import "./
|
|
8
|
+
import "./Functions-7jnEwJyw.js";
|
|
12
9
|
import "clsx";
|
|
13
10
|
import "tailwind-merge";
|
|
11
|
+
import "@chaibuilder/runtime";
|
|
12
|
+
import "jotai";
|
|
13
|
+
import "flat-to-nested";
|
|
14
|
+
import "./MODIFIERS-RiXS5Mn1.js";
|
|
15
|
+
import "@react-hookz/web";
|
|
16
|
+
import "@radix-ui/react-toggle";
|
|
17
|
+
import "class-variance-authority";
|
|
18
|
+
import "./Class-17XFhL48.js";
|
|
14
19
|
import "@radix-ui/react-switch";
|
|
15
20
|
import "@radix-ui/react-slot";
|
|
16
21
|
import "@radix-ui/react-accordion";
|
|
@@ -32,12 +37,6 @@ import "@radix-ui/react-context-menu";
|
|
|
32
37
|
import "react-icons-picker";
|
|
33
38
|
import "react-dom";
|
|
34
39
|
import "react-quill";
|
|
35
|
-
import "jotai";
|
|
36
|
-
import "flat-to-nested";
|
|
37
|
-
import "./Functions-7jnEwJyw.js";
|
|
38
|
-
import "redux-undo";
|
|
39
|
-
import "@chaibuilder/runtime";
|
|
40
|
-
import "@react-hookz/web";
|
|
41
40
|
import "react-i18next";
|
|
42
41
|
import "i18next";
|
|
43
42
|
import "@floating-ui/react-dom";
|
|
@@ -51,8 +50,8 @@ import "./html-to-json-57841sEK.js";
|
|
|
51
50
|
import "himalaya";
|
|
52
51
|
import "lucide-react";
|
|
53
52
|
import "./web-blocks.js";
|
|
54
|
-
import "./
|
|
55
|
-
const v = s.lazy(() => import("./single-page-detail-
|
|
53
|
+
import "./empty-slot-MWycClTb.js";
|
|
54
|
+
const v = s.lazy(() => import("./single-page-detail-gtVN9hxR.js")), P = ({ pageData: r }) => {
|
|
56
55
|
const [t, i] = n("CLOSE");
|
|
57
56
|
return /* @__PURE__ */ e.jsxs(
|
|
58
57
|
g,
|
|
@@ -87,7 +86,7 @@ const v = s.lazy(() => import("./single-page-detail-PihQi-dP.js")), P = ({ pageD
|
|
|
87
86
|
}
|
|
88
87
|
);
|
|
89
88
|
}, E = (r) => {
|
|
90
|
-
const [t] = j(), { data: i } =
|
|
89
|
+
const [t] = j(), { data: i } = N(), o = b(), m = (i == null ? void 0 : i.homepage) === r.uuid, a = t === r.uuid, p = () => o(r);
|
|
91
90
|
return i ? /* @__PURE__ */ e.jsxs(
|
|
92
91
|
"button",
|
|
93
92
|
{
|
|
@@ -104,11 +103,11 @@ const v = s.lazy(() => import("./single-page-detail-PihQi-dP.js")), P = ({ pageD
|
|
|
104
103
|
]
|
|
105
104
|
}
|
|
106
105
|
) : null;
|
|
107
|
-
},
|
|
106
|
+
}, Ee = ({ pages: r, isLoading: t }) => t ? /* @__PURE__ */ e.jsxs("div", { className: "flex animate-pulse flex-col gap-y-1 px-2.5 pt-2", children: [
|
|
108
107
|
/* @__PURE__ */ e.jsx("div", { className: "bg-background-200 h-7 w-full" }),
|
|
109
108
|
/* @__PURE__ */ e.jsx("div", { className: "bg-background-200 h-7 w-full" }),
|
|
110
109
|
/* @__PURE__ */ e.jsx("div", { className: "bg-background-200 h-7 w-full" })
|
|
111
110
|
] }) : r.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: s.Children.toArray(r.map((i) => /* @__PURE__ */ e.jsx(E, { ...i }))) });
|
|
112
111
|
export {
|
|
113
|
-
|
|
112
|
+
Ee as default
|
|
114
113
|
};
|
|
@@ -1,17 +1,22 @@
|
|
|
1
1
|
import { j as i } from "./jsx-runtime-WbnYoNE9.js";
|
|
2
2
|
import * as l from "react";
|
|
3
|
-
import {
|
|
4
|
-
import { u as c, o as u } from "./
|
|
5
|
-
import { F as d } from "./form-
|
|
6
|
-
import { b as x } from "./index-
|
|
3
|
+
import { bf as n } from "./index-0m8Zuv5X.js";
|
|
4
|
+
import { u as c, o as u } from "./empty-slot-MWycClTb.js";
|
|
5
|
+
import { F as d } from "./form-94xR0NG8.js";
|
|
6
|
+
import { b as x } from "./index-19nTm_cE.js";
|
|
7
7
|
import "./_commonjsHelpers-UyOWmZb0.js";
|
|
8
|
-
import "@radix-ui/react-toggle";
|
|
9
|
-
import "class-variance-authority";
|
|
10
|
-
import "./utils-AvyFzbPC.js";
|
|
11
8
|
import "lodash-es";
|
|
12
|
-
import "./
|
|
9
|
+
import "./Functions-7jnEwJyw.js";
|
|
13
10
|
import "clsx";
|
|
14
11
|
import "tailwind-merge";
|
|
12
|
+
import "@chaibuilder/runtime";
|
|
13
|
+
import "jotai";
|
|
14
|
+
import "flat-to-nested";
|
|
15
|
+
import "./MODIFIERS-RiXS5Mn1.js";
|
|
16
|
+
import "@react-hookz/web";
|
|
17
|
+
import "@radix-ui/react-toggle";
|
|
18
|
+
import "class-variance-authority";
|
|
19
|
+
import "./Class-17XFhL48.js";
|
|
15
20
|
import "@radix-ui/react-switch";
|
|
16
21
|
import "@radix-ui/react-slot";
|
|
17
22
|
import "@radix-ui/react-accordion";
|
|
@@ -34,12 +39,6 @@ import "@radix-ui/react-context-menu";
|
|
|
34
39
|
import "react-icons-picker";
|
|
35
40
|
import "react-dom";
|
|
36
41
|
import "react-quill";
|
|
37
|
-
import "jotai";
|
|
38
|
-
import "flat-to-nested";
|
|
39
|
-
import "./Functions-7jnEwJyw.js";
|
|
40
|
-
import "redux-undo";
|
|
41
|
-
import "@chaibuilder/runtime";
|
|
42
|
-
import "@react-hookz/web";
|
|
43
42
|
import "react-i18next";
|
|
44
43
|
import "@rjsf/core";
|
|
45
44
|
import "@rjsf/validator-ajv8";
|
|
@@ -55,7 +54,7 @@ import "./html-to-json-57841sEK.js";
|
|
|
55
54
|
import "himalaya";
|
|
56
55
|
import "lucide-react";
|
|
57
56
|
import "./web-blocks.js";
|
|
58
|
-
const
|
|
57
|
+
const bo = ({
|
|
59
58
|
_projectData: m,
|
|
60
59
|
seany: t
|
|
61
60
|
}) => {
|
|
@@ -78,5 +77,5 @@ const go = ({
|
|
|
78
77
|
return /* @__PURE__ */ i.jsx(n, { className: "flex h-full select-none flex-col", children: /* @__PURE__ */ i.jsx(d, { properties: a, disabled: p, formData: m, onChange: e }) });
|
|
79
78
|
};
|
|
80
79
|
export {
|
|
81
|
-
|
|
80
|
+
bo as default
|
|
82
81
|
};
|
|
@@ -0,0 +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-TEfD-2ti.cjs"),o=require("./empty-slot-TF2kd-0X.cjs"),d=require("./form-yz7h2msc.cjs"),m=require("./index-XVud0HL8.cjs");require("./_commonjsHelpers-wDK0ZLPo.cjs");require("lodash-es");require("./Functions-N3yhPYKY.cjs");require("clsx");require("tailwind-merge");require("@chaibuilder/runtime");require("jotai");require("flat-to-nested");require("./MODIFIERS-2FeVfZQ9.cjs");require("@react-hookz/web");require("@radix-ui/react-toggle");require("class-variance-authority");require("./Class-5ARpH_Tu.cjs");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("react-i18next");require("@rjsf/core");require("@rjsf/validator-ajv8");require("i18next");require("@floating-ui/react-dom");require("react-textarea-autosize");require("flagged");require("react-dnd");require("@minoru/react-dnd-treeview");require("react-hotkeys-hook");require("sonner");require("./html-to-json-2PeOCVey.cjs");require("himalaya");require("lucide-react");require("./web-blocks.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),p=({_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=p;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const l=require("./jsx-runtime-Z_BpKhVy.cjs"),i=require("./empty-slot-TF2kd-0X.cjs"),g=require("./form-yz7h2msc.cjs");require("./_commonjsHelpers-wDK0ZLPo.cjs");require("react");require("lodash-es");require("./Functions-N3yhPYKY.cjs");require("clsx");require("tailwind-merge");require("@rjsf/core");require("@rjsf/validator-ajv8");require("./index-TEfD-2ti.cjs");require("@chaibuilder/runtime");require("jotai");require("flat-to-nested");require("./MODIFIERS-2FeVfZQ9.cjs");require("@react-hookz/web");require("@radix-ui/react-toggle");require("class-variance-authority");require("./Class-5ARpH_Tu.cjs");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("react-i18next");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(c=>({...c,...r}))},m={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:m,formData:e,onChange:d})})};exports.default=D;
|
|
@@ -1,18 +1,23 @@
|
|
|
1
1
|
import { j as s } from "./jsx-runtime-WbnYoNE9.js";
|
|
2
|
-
import { b as D, u as c, g, o as x } from "./
|
|
3
|
-
import { F as v } from "./form-
|
|
2
|
+
import { b as D, u as c, g, o as x } from "./empty-slot-MWycClTb.js";
|
|
3
|
+
import { F as v } from "./form-94xR0NG8.js";
|
|
4
4
|
import "./_commonjsHelpers-UyOWmZb0.js";
|
|
5
5
|
import "react";
|
|
6
6
|
import "lodash-es";
|
|
7
|
+
import "./Functions-7jnEwJyw.js";
|
|
8
|
+
import "clsx";
|
|
9
|
+
import "tailwind-merge";
|
|
7
10
|
import "@rjsf/core";
|
|
8
11
|
import "@rjsf/validator-ajv8";
|
|
9
|
-
import "./index-
|
|
12
|
+
import "./index-0m8Zuv5X.js";
|
|
13
|
+
import "@chaibuilder/runtime";
|
|
14
|
+
import "jotai";
|
|
15
|
+
import "flat-to-nested";
|
|
16
|
+
import "./MODIFIERS-RiXS5Mn1.js";
|
|
17
|
+
import "@react-hookz/web";
|
|
10
18
|
import "@radix-ui/react-toggle";
|
|
11
19
|
import "class-variance-authority";
|
|
12
|
-
import "./
|
|
13
|
-
import "./MODIFIERS-RiXS5Mn1.js";
|
|
14
|
-
import "clsx";
|
|
15
|
-
import "tailwind-merge";
|
|
20
|
+
import "./Class-17XFhL48.js";
|
|
16
21
|
import "@radix-ui/react-switch";
|
|
17
22
|
import "@radix-ui/react-slot";
|
|
18
23
|
import "@radix-ui/react-accordion";
|
|
@@ -35,14 +40,8 @@ import "@radix-ui/react-context-menu";
|
|
|
35
40
|
import "react-icons-picker";
|
|
36
41
|
import "react-dom";
|
|
37
42
|
import "react-quill";
|
|
38
|
-
import "jotai";
|
|
39
|
-
import "flat-to-nested";
|
|
40
|
-
import "./Functions-7jnEwJyw.js";
|
|
41
|
-
import "redux-undo";
|
|
42
|
-
import "@chaibuilder/runtime";
|
|
43
|
-
import "@react-hookz/web";
|
|
44
43
|
import "react-i18next";
|
|
45
|
-
const
|
|
44
|
+
const st = ({
|
|
46
45
|
_projectData: t,
|
|
47
46
|
seany: l
|
|
48
47
|
}) => {
|
|
@@ -80,5 +79,5 @@ const lt = ({
|
|
|
80
79
|
return /* @__PURE__ */ s.jsx("div", { className: "flex h-full select-none flex-col", children: /* @__PURE__ */ s.jsx(v, { properties: d, formData: t, onChange: n }) });
|
|
81
80
|
};
|
|
82
81
|
export {
|
|
83
|
-
|
|
82
|
+
st as default
|
|
84
83
|
};
|
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 i=require("./jsx-runtime-Z_BpKhVy.cjs"),f=require("react"),n=require("lodash-es"),S=require("tailwind-merge"),d=require("./MODIFIERS-2FeVfZQ9.cjs"),T=require("@chaibuilder/runtime"),y=require("./defaultTheme-IH19g4fv.cjs"),F=require("react-wrap-balancer"),_=require("@react-email/render"),p=require("@react-email/components"),C=require("@bobthered/tailwindcss-palette-generator");require("./_commonjsHelpers-wDK0ZLPo.cjs");const q=t=>{const r={};return Object.keys(t).forEach(e=>{n.isString(t[e])&&t[e].startsWith(d.SLOT_KEY)&&(r[e]=t[e].replace(d.SLOT_KEY,"").split(","))}),r},B=n.memoize((t,r)=>{const e=t.replace(d.STYLES_KEY,"").split(","),s=S.twMerge(e[0],e[1]);return y.addPrefixToClasses(s,r).replace(d.STYLES_KEY,"").trim()});function w(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(d.STYLES_KEY)){const o=B(t[s],r);e[s]={className:o,...w(t,s)}}}),e}function A(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 m({blocks:t,parent:r,classPrefix:e="c-",externalData:s={}}){const o=t,l=a=>O(a,e),u=r?n.filter(t,{_parent:r}):n.filter(t,a=>n.isEmpty(a._parent));return i.jsxRuntimeExports.jsx(i.jsxRuntimeExports.Fragment,{children:f.Children.toArray(u.map((a,h)=>{const g=q(a),x={};n.isEmpty(g)||Object.keys(g).forEach(c=>{x[c]=f.Children.toArray(g[c].map(j=>i.jsxRuntimeExports.jsx(m,{externalData:s,classPrefix:e,blocks:o,parent:j})))});const R=n.filter(o,{_parent:a._id});x.children=R.length>0?i.jsxRuntimeExports.jsx(m,{externalData:s,classPrefix:e,parent:a._id,blocks:o}):null;const E=T.getBlockComponent(a._type);if(E!==null){let c=a;const j=E.component;return c={...E.defaults,...a},f.createElement(j,n.omit({blockProps:{},inBuilder:!1,...c,index:h,...A(a,s),...l(c),...x},["_parent"]))}return i.jsxRuntimeExports.jsxs("noscript",{children:[a._type," not found"]})}))})}const L=({pageData:t,externalData:r={},before:e=null,after:s=null,classPrefix:o="c-"})=>{const l=n.get(t.project,"brandingOptions",d.BRANDING_OPTIONS_DEFAULTS);return i.jsxRuntimeExports.jsxs(i.jsxRuntimeExports.Fragment,{children:[e,i.jsxRuntimeExports.jsx("div",{className:o.replace("-","")+" "+y.getBrandingClasses(l,o)+" min-h-screen",children:i.jsxRuntimeExports.jsx(F.Provider,{children:i.jsxRuntimeExports.jsx(m,{externalData:r,blocks:t.page.blocks||[],classPrefix:o})})}),s]})},Y=(t,r="c-")=>{const e=n.get(t,"primaryColor","#000"),s=n.get(t,"secondaryColor","#ccc"),o=n.get(t,"bodyFont","Inter"),l=n.get(t,"roundedCorners","0"),u=C.tailwindcssPaletteGenerator({colors:[e,s],names:["primary","secondary"]});return n.set(u,"primary.DEFAULT",e),n.set(u,"secondary.DEFAULT",s),{theme:{fontFamily:{body:[o,...y.defaultTheme.fontFamily.sans]},extend:{borderRadius:{global:`${l||"0"}px`},colors:u}},...r?{prefix:r}:{}}},b=t=>({fontFamily:t,fallbackFontFamily:"Verdana",webFont:{url:`https://fonts.googleapis.com/css2?family=${t}&display=swap`,format:"woff"},fontWeight:400,fontStyle:"normal"}),N=(t,r,e="html")=>{const s=Y(r);return _.render(i.jsxRuntimeExports.jsx(p.Tailwind,{config:s,children:i.jsxRuntimeExports.jsxs(p.Html,{lang:"en",dir:"ltr",children:[i.jsxRuntimeExports.jsx(p.Head,{children:i.jsxRuntimeExports.jsx(p.Font,{...b(n.get(r,"bodyFont","Verdana"))})}),i.jsxRuntimeExports.jsx("body",{children:i.jsxRuntimeExports.jsx(m,{blocks:t})})]})}),e==="html"?{pretty:!0}:{plainText:!0})};exports.RenderChaiBlocks=m;exports.RenderChaiPage=L;exports.generateEmailTemplate=N;
|
package/dist/render.d.ts
CHANGED
|
@@ -47,6 +47,8 @@ declare type ChaiPageProps = {
|
|
|
47
47
|
externalData?: Record<string, any>;
|
|
48
48
|
};
|
|
49
49
|
|
|
50
|
+
export declare const generateEmailTemplate: (blocks: ChaiBlock[], brandingOptions: Record<string, any>, output?: "plain" | "html") => string;
|
|
51
|
+
|
|
50
52
|
export declare function RenderChaiBlocks({ blocks, parent, classPrefix, externalData, }: {
|
|
51
53
|
blocks: ChaiBlock[];
|
|
52
54
|
parent?: string;
|
package/dist/render.js
CHANGED
|
@@ -1,123 +1,164 @@
|
|
|
1
|
-
import { j as
|
|
2
|
-
import
|
|
3
|
-
import { isString as
|
|
4
|
-
import { twMerge as
|
|
5
|
-
import { S as
|
|
6
|
-
import { getBlockComponent as
|
|
7
|
-
import { a as
|
|
8
|
-
import { Provider as
|
|
1
|
+
import { j as s } from "./jsx-runtime-WbnYoNE9.js";
|
|
2
|
+
import y from "react";
|
|
3
|
+
import { isString as _, memoize as S, get as a, isEmpty as j, each as B, filter as h, omit as A, set as x } from "lodash-es";
|
|
4
|
+
import { twMerge as w } from "tailwind-merge";
|
|
5
|
+
import { S as C, a as F, B as O } from "./MODIFIERS-RiXS5Mn1.js";
|
|
6
|
+
import { getBlockComponent as R } from "@chaibuilder/runtime";
|
|
7
|
+
import { a as N, g as L, d as b } from "./defaultTheme-YY8mlQS3.js";
|
|
8
|
+
import { Provider as I } from "react-wrap-balancer";
|
|
9
|
+
import { render as U } from "@react-email/render";
|
|
10
|
+
import { Tailwind as W, Html as Y, Head as $, Font as G } from "@react-email/components";
|
|
11
|
+
import { tailwindcssPaletteGenerator as H } from "@bobthered/tailwindcss-palette-generator";
|
|
9
12
|
import "./_commonjsHelpers-UyOWmZb0.js";
|
|
10
|
-
const
|
|
13
|
+
const K = (t) => {
|
|
11
14
|
const r = {};
|
|
12
15
|
return Object.keys(t).forEach((n) => {
|
|
13
|
-
|
|
16
|
+
_(t[n]) && t[n].startsWith(C) && (r[n] = t[n].replace(C, "").split(","));
|
|
14
17
|
}), r;
|
|
15
|
-
},
|
|
16
|
-
const n = t.replace(
|
|
17
|
-
return
|
|
18
|
+
}, P = S((t, r) => {
|
|
19
|
+
const n = t.replace(F, "").split(","), e = w(n[0], n[1]);
|
|
20
|
+
return N(e, r).replace(F, "").trim();
|
|
18
21
|
});
|
|
19
|
-
function
|
|
20
|
-
return
|
|
22
|
+
function V(t, r) {
|
|
23
|
+
return a(t, `${r}_attrs`, {});
|
|
21
24
|
}
|
|
22
|
-
function
|
|
25
|
+
function z(t, r) {
|
|
23
26
|
const n = {};
|
|
24
|
-
return Object.keys(t).forEach((
|
|
25
|
-
if (
|
|
26
|
-
const
|
|
27
|
-
n[
|
|
28
|
-
className:
|
|
29
|
-
...
|
|
27
|
+
return Object.keys(t).forEach((e) => {
|
|
28
|
+
if (_(t[e]) && t[e].startsWith(F)) {
|
|
29
|
+
const o = P(t[e], r);
|
|
30
|
+
n[e] = {
|
|
31
|
+
className: o,
|
|
32
|
+
...V(t, e)
|
|
30
33
|
};
|
|
31
34
|
}
|
|
32
35
|
}), n;
|
|
33
36
|
}
|
|
34
|
-
function
|
|
35
|
-
const n =
|
|
36
|
-
return
|
|
37
|
-
|
|
37
|
+
function D(t, r) {
|
|
38
|
+
const n = a(t, "_bindings", {});
|
|
39
|
+
return j(n) ? { ...t } : (B(n, (e, o) => {
|
|
40
|
+
_(e) && a(r, e, null) && (t[o] = a(r, e, null));
|
|
38
41
|
}), t);
|
|
39
42
|
}
|
|
40
|
-
function
|
|
43
|
+
function d({
|
|
41
44
|
blocks: t,
|
|
42
45
|
parent: r,
|
|
43
46
|
classPrefix: n = "c-",
|
|
44
|
-
externalData:
|
|
47
|
+
externalData: e = {}
|
|
45
48
|
}) {
|
|
46
|
-
const
|
|
47
|
-
return /* @__PURE__ */
|
|
48
|
-
|
|
49
|
-
const p =
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
p[
|
|
53
|
-
|
|
49
|
+
const o = t, l = (i) => z(i, n), m = r ? h(t, { _parent: r }) : h(t, (i) => j(i._parent));
|
|
50
|
+
return /* @__PURE__ */ s.jsx(s.Fragment, { children: y.Children.toArray(
|
|
51
|
+
m.map((i, E) => {
|
|
52
|
+
const p = K(i), f = {};
|
|
53
|
+
j(p) || Object.keys(p).forEach((c) => {
|
|
54
|
+
f[c] = y.Children.toArray(
|
|
55
|
+
p[c].map((g) => /* @__PURE__ */ s.jsx(
|
|
56
|
+
d,
|
|
54
57
|
{
|
|
55
|
-
externalData:
|
|
58
|
+
externalData: e,
|
|
56
59
|
classPrefix: n,
|
|
57
|
-
blocks:
|
|
58
|
-
parent:
|
|
60
|
+
blocks: o,
|
|
61
|
+
parent: g
|
|
59
62
|
}
|
|
60
63
|
))
|
|
61
64
|
);
|
|
62
65
|
});
|
|
63
|
-
const
|
|
64
|
-
|
|
65
|
-
|
|
66
|
+
const T = h(o, { _parent: i._id });
|
|
67
|
+
f.children = T.length > 0 ? /* @__PURE__ */ s.jsx(
|
|
68
|
+
d,
|
|
66
69
|
{
|
|
67
|
-
externalData:
|
|
70
|
+
externalData: e,
|
|
68
71
|
classPrefix: n,
|
|
69
|
-
parent:
|
|
70
|
-
blocks:
|
|
72
|
+
parent: i._id,
|
|
73
|
+
blocks: o
|
|
71
74
|
}
|
|
72
75
|
) : null;
|
|
73
|
-
const
|
|
74
|
-
if (
|
|
75
|
-
let
|
|
76
|
-
const
|
|
77
|
-
return
|
|
78
|
-
|
|
79
|
-
|
|
76
|
+
const u = R(i._type);
|
|
77
|
+
if (u !== null) {
|
|
78
|
+
let c = i;
|
|
79
|
+
const g = u.component;
|
|
80
|
+
return c = { ...u.defaults, ...i }, y.createElement(
|
|
81
|
+
g,
|
|
82
|
+
A(
|
|
80
83
|
{
|
|
81
84
|
blockProps: {},
|
|
82
85
|
inBuilder: !1,
|
|
83
|
-
...
|
|
84
|
-
index:
|
|
85
|
-
...
|
|
86
|
-
...l(
|
|
87
|
-
...
|
|
86
|
+
...c,
|
|
87
|
+
index: E,
|
|
88
|
+
...D(i, e),
|
|
89
|
+
...l(c),
|
|
90
|
+
...f
|
|
88
91
|
},
|
|
89
92
|
["_parent"]
|
|
90
93
|
)
|
|
91
94
|
);
|
|
92
95
|
}
|
|
93
|
-
return /* @__PURE__ */
|
|
94
|
-
|
|
96
|
+
return /* @__PURE__ */ s.jsxs("noscript", { children: [
|
|
97
|
+
i._type,
|
|
95
98
|
" not found"
|
|
96
99
|
] });
|
|
97
100
|
})
|
|
98
101
|
) });
|
|
99
102
|
}
|
|
100
|
-
const
|
|
103
|
+
const it = ({
|
|
101
104
|
pageData: t,
|
|
102
105
|
externalData: r = {},
|
|
103
106
|
before: n = null,
|
|
104
|
-
after:
|
|
105
|
-
classPrefix:
|
|
107
|
+
after: e = null,
|
|
108
|
+
classPrefix: o = "c-"
|
|
106
109
|
}) => {
|
|
107
|
-
const l =
|
|
108
|
-
return /* @__PURE__ */
|
|
110
|
+
const l = a(t.project, "brandingOptions", O);
|
|
111
|
+
return /* @__PURE__ */ s.jsxs(s.Fragment, { children: [
|
|
109
112
|
n,
|
|
110
|
-
/* @__PURE__ */
|
|
113
|
+
/* @__PURE__ */ s.jsx(
|
|
111
114
|
"div",
|
|
112
115
|
{
|
|
113
|
-
className:
|
|
114
|
-
children: /* @__PURE__ */
|
|
116
|
+
className: o.replace("-", "") + " " + L(l, o) + " min-h-screen",
|
|
117
|
+
children: /* @__PURE__ */ s.jsx(I, { children: /* @__PURE__ */ s.jsx(d, { externalData: r, blocks: t.page.blocks || [], classPrefix: o }) })
|
|
115
118
|
}
|
|
116
119
|
),
|
|
117
|
-
|
|
120
|
+
e
|
|
118
121
|
] });
|
|
122
|
+
}, M = (t, r = "c-") => {
|
|
123
|
+
const n = a(t, "primaryColor", "#000"), e = a(t, "secondaryColor", "#ccc"), o = a(t, "bodyFont", "Inter"), l = a(t, "roundedCorners", "0"), m = H({
|
|
124
|
+
colors: [n, e],
|
|
125
|
+
names: ["primary", "secondary"]
|
|
126
|
+
});
|
|
127
|
+
return x(m, "primary.DEFAULT", n), x(m, "secondary.DEFAULT", e), {
|
|
128
|
+
theme: {
|
|
129
|
+
fontFamily: {
|
|
130
|
+
body: [o, ...b.fontFamily.sans]
|
|
131
|
+
},
|
|
132
|
+
extend: {
|
|
133
|
+
borderRadius: {
|
|
134
|
+
global: `${l || "0"}px`
|
|
135
|
+
},
|
|
136
|
+
colors: m
|
|
137
|
+
}
|
|
138
|
+
},
|
|
139
|
+
...r ? { prefix: r } : {}
|
|
140
|
+
};
|
|
141
|
+
}, q = (t) => ({
|
|
142
|
+
fontFamily: t,
|
|
143
|
+
fallbackFontFamily: "Verdana",
|
|
144
|
+
webFont: {
|
|
145
|
+
url: `https://fonts.googleapis.com/css2?family=${t}&display=swap`,
|
|
146
|
+
format: "woff"
|
|
147
|
+
},
|
|
148
|
+
fontWeight: 400,
|
|
149
|
+
fontStyle: "normal"
|
|
150
|
+
}), at = (t, r, n = "html") => {
|
|
151
|
+
const e = M(r);
|
|
152
|
+
return U(
|
|
153
|
+
/* @__PURE__ */ s.jsx(W, { config: e, children: /* @__PURE__ */ s.jsxs(Y, { lang: "en", dir: "ltr", children: [
|
|
154
|
+
/* @__PURE__ */ s.jsx($, { children: /* @__PURE__ */ s.jsx(G, { ...q(a(r, "bodyFont", "Verdana")) }) }),
|
|
155
|
+
/* @__PURE__ */ s.jsx("body", { children: /* @__PURE__ */ s.jsx(d, { blocks: t }) })
|
|
156
|
+
] }) }),
|
|
157
|
+
n === "html" ? { pretty: !0 } : { plainText: !0 }
|
|
158
|
+
);
|
|
119
159
|
};
|
|
120
160
|
export {
|
|
121
|
-
|
|
122
|
-
|
|
161
|
+
d as RenderChaiBlocks,
|
|
162
|
+
it as RenderChaiPage,
|
|
163
|
+
at as generateEmailTemplate
|
|
123
164
|
};
|
|
@@ -0,0 +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-TEfD-2ti.cjs"),d=require("./empty-slot-TF2kd-0X.cjs"),w=require("sonner"),p=require("./form-yz7h2msc.cjs"),P=require("./index-XVud0HL8.cjs");require("./_commonjsHelpers-wDK0ZLPo.cjs");require("./Functions-N3yhPYKY.cjs");require("clsx");require("tailwind-merge");require("@chaibuilder/runtime");require("jotai");require("flat-to-nested");require("./MODIFIERS-2FeVfZQ9.cjs");require("@react-hookz/web");require("@radix-ui/react-toggle");require("class-variance-authority");require("./Class-5ARpH_Tu.cjs");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("react-i18next");require("@rjsf/core");require("@rjsf/validator-ajv8");require("i18next");require("@floating-ui/react-dom");require("react-textarea-autosize");require("flagged");require("react-dnd");require("@minoru/react-dnd-treeview");require("react-hotkeys-hook");require("./html-to-json-2PeOCVey.cjs");require("himalaya");require("lucide-react");require("./web-blocks.cjs");const z=f.lazy(()=>Promise.resolve().then(()=>require("./delete-page-modal-RllDrgxs.cjs"))),L=f.lazy(()=>Promise.resolve().then(()=>require("./confirm-alert-i3FRAgP4.cjs"))),E=u=>{if(!c.isString(u)||!(u.includes("/[")&&u.includes("]")))return!1;const s=/^\[((?:\.{3})?[a-zA-Z0-9_-]+)\]$/,q=/^[a-zA-Z0-9_-]+$/;let e=!0;return u.split("/").forEach(n=>{e&&(n.includes("[[")&&n.includes("]]")?e=/^\[\[\.{3}[a-zA-Z0-9_-]+\]\]$/.test(n):n.includes("[")&&n.includes("]")?e=s.test(n):e=q.test(n))}),e},h=u=>u&&c.isEmpty(u.seoData)?{...u,seoData:{title:"",description:"",image:""}}:u,G=(u,o)=>{const s=!c.isEqual(c.omit(u,["seoData"]),c.omit(o,["seoData"])),q=!c.isEqual(h(o).seoData,h(u).seoData);return s||q},Y=({open:u,setOpen:o,pageData:s})=>{const q=P.useQueryClient(),{data:e}=P.useProject(),n=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)||"")){u==="ALERT"&&o("PENDING");return}n.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")})},S=({formData:l},t)=>{b(g=>{var R,N;if(!t)return g;const x={[t]:l[t]};return t==="name"?x.slug=c.kebabCase((R=l[t])==null?void 0:R.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:u==="ALERT",title:"Do yo want to save changes?",onCancel:()=>o("CLOSE"),onConfirm:C,disabled:m.isPending||n.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:S,disabled:n.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:S,disabled:n.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:n.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||n.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;
|