@chaibuilder/sdk 1.1.13 → 1.1.14

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.
Files changed (97) hide show
  1. package/dist/AddBlocks-AG_J7s2Z.cjs +1 -0
  2. package/dist/{AddBlocks-A7WofxHV.js → AddBlocks-FsdsASNp.js} +51 -51
  3. package/dist/{BrandingOptions-wkFrLFI_.js → BrandingOptions-4qzTYdj5.js} +6 -5
  4. package/dist/BrandingOptions-xBuqDpj0.cjs +1 -0
  5. package/dist/{CanvasArea-kF46NWZK.cjs → CanvasArea-4m1-c1yq.cjs} +7 -7
  6. package/dist/{CanvasArea-chEYQhH8.js → CanvasArea-U3egqewu.js} +7 -7
  7. package/dist/{CurrentPage-Wd7F9Egg.js → CurrentPage-spjJpQSM.js} +10 -10
  8. package/dist/CurrentPage-zxrdTVsG.cjs +1 -0
  9. package/dist/{Layers-qMOMP2Mi.js → Layers-QNAlCI4j.js} +81 -81
  10. package/dist/Layers-YyBChBtg.cjs +1 -0
  11. package/dist/MarkAsGlobalBlock-LXDkmFUr.cjs +1 -0
  12. package/dist/{MarkAsGlobalBlock-Czq45Amf.js → MarkAsGlobalBlock-xOHhiMDl.js} +3 -3
  13. package/dist/{PagesPanel-ay4uk4mg.js → PagesPanel--LI-BoSj.js} +6 -6
  14. package/dist/PagesPanel-BeJrveus.cjs +1 -0
  15. package/dist/ProjectPanel-MjcAymKT.cjs +1 -0
  16. package/dist/{ProjectPanel-eLlbfAtj.js → ProjectPanel-VNj0jXca.js} +10 -10
  17. package/dist/Settings-BrYkhn3H.cjs +1 -0
  18. package/dist/{Settings-lpoxaMDu.js → Settings-LZJwbkO6.js} +433 -432
  19. package/dist/{SidePanels-iRXV69vh.js → SidePanels-4lvmnnlw.js} +36 -36
  20. package/dist/SidePanels-_5oUp-eI.cjs +1 -0
  21. package/dist/{Topbar-dQYhW4iv.js → Topbar-_-1HX-EE.js} +3 -3
  22. package/dist/Topbar-gQxbcPtG.cjs +1 -0
  23. package/dist/UnsplashImages-PNp5fYCc.cjs +1 -0
  24. package/dist/{UnsplashImages-AL1ASAoD.js → UnsplashImages-mqK09h8E.js} +6 -6
  25. package/dist/UploadImages-BoSSsLtD.cjs +1 -0
  26. package/dist/{UploadImages-09wuhk2O.js → UploadImages-IDkkRuhx.js} +3 -3
  27. package/dist/{add-page-modal-TXREEFPZ.js → add-page-modal-fZnKopNf.js} +14 -13
  28. package/dist/add-page-modal-rWhPuGd9.cjs +1 -0
  29. package/dist/confirm-alert-dHRDZrA1.cjs +1 -0
  30. package/dist/{confirm-alert-GkfW9chS.js → confirm-alert-ea5xpncD.js} +3 -3
  31. package/dist/core.cjs +1 -1
  32. package/dist/core.d.ts +5 -15
  33. package/dist/core.js +5 -5
  34. package/dist/delete-page-modal-P_KKu12n.cjs +1 -0
  35. package/dist/{delete-page-modal-LNME2FwD.js → delete-page-modal-fRoXPfhG.js} +5 -5
  36. package/dist/form-6qGAOYI3.cjs +1 -0
  37. package/dist/{form-Fk4CaX1A.js → form-irY39wvJ.js} +29 -29
  38. package/dist/functions-86L6n983.js +23 -0
  39. package/dist/functions-Jr7gX_RX.cjs +1 -0
  40. package/dist/{html-to-json-kGgp07Hv.js → html-to-json-Y5M0N8PH.js} +33 -33
  41. package/dist/html-to-json-aAZkA0f5.cjs +1 -0
  42. package/dist/{index-89A3jPHh.js → index-0OqmBgqo.js} +3 -3
  43. package/dist/{index-61c5wSJn.cjs → index-1Dr-VtaT.cjs} +2 -2
  44. package/dist/{index-Q5q5Y_8a.js → index-CQz6j3ex.js} +6 -6
  45. package/dist/index-d55M5MRz.cjs +1 -0
  46. package/dist/lib.cjs +1 -1
  47. package/dist/lib.js +27 -27
  48. package/dist/lodash-2us0VT8I.cjs +36 -0
  49. package/dist/lodash-3gkdNK5u.js +4538 -0
  50. package/dist/{page-viewer-LPx-OTCC.js → page-viewer-39ZtxLzx.js} +6 -6
  51. package/dist/page-viewer-_lc8vqU4.cjs +1 -0
  52. package/dist/{project-general-setting-sSpFUD_Y.js → project-general-setting-CCVuGyHh.js} +9 -8
  53. package/dist/project-general-setting-LEzDhwoq.cjs +1 -0
  54. package/dist/{project-seo-setting-CGVegBtM.js → project-seo-setting-Wo7E46w7.js} +6 -5
  55. package/dist/project-seo-setting-orwH-Ufg.cjs +1 -0
  56. package/dist/render.cjs +1 -1
  57. package/dist/render.js +46 -46
  58. package/dist/server.cjs +1 -1
  59. package/dist/server.js +11 -11
  60. package/dist/single-page-detail-jkDYF7lW.cjs +1 -0
  61. package/dist/{single-page-detail-32H1_IG4.js → single-page-detail-r1GJF00l.js} +29 -28
  62. package/dist/studio.cjs +1 -1
  63. package/dist/studio.js +5 -5
  64. package/dist/ui.cjs +1 -1
  65. package/dist/ui.js +3 -3
  66. package/dist/useAddBlockByDrop-5QW86HjG.js +20 -0
  67. package/dist/useAddBlockByDrop-Ckzuvu-s.cjs +1 -0
  68. package/dist/utils-37UXq2O5.cjs +1 -0
  69. package/dist/{utils-zWMk4dB2.js → utils-XsPKXMVo.js} +5 -5
  70. package/package.json +2 -2
  71. package/dist/AddBlocks-Yuc4t0Z_.cjs +0 -1
  72. package/dist/BrandingOptions-KkPF1OGn.cjs +0 -1
  73. package/dist/CurrentPage-p9MaXTOB.cjs +0 -1
  74. package/dist/Layers-wQ0Fv9Xc.cjs +0 -1
  75. package/dist/MarkAsGlobalBlock-sb3hMXLq.cjs +0 -1
  76. package/dist/PagesPanel--maZxwX5.cjs +0 -1
  77. package/dist/ProjectPanel-KhIpO7m3.cjs +0 -1
  78. package/dist/Settings-n2DpS5Ta.cjs +0 -1
  79. package/dist/SidePanels-Dud5Xh9L.cjs +0 -1
  80. package/dist/Topbar-vqzjB75a.cjs +0 -1
  81. package/dist/UnsplashImages-3Sh4UZ-7.cjs +0 -1
  82. package/dist/UploadImages-mPzLhMiH.cjs +0 -1
  83. package/dist/add-page-modal-FPnIWwqA.cjs +0 -1
  84. package/dist/confirm-alert-YNyc3WEo.cjs +0 -1
  85. package/dist/delete-page-modal-sTbqZPvk.cjs +0 -1
  86. package/dist/form-OhgCJlVA.cjs +0 -1
  87. package/dist/functions-ZWGlwlQY.cjs +0 -1
  88. package/dist/functions-slns6ONz.js +0 -23
  89. package/dist/html-to-json-po8on2ju.cjs +0 -1
  90. package/dist/index-GNmGzavZ.cjs +0 -1
  91. package/dist/page-viewer-wQO9oV9h.cjs +0 -1
  92. package/dist/project-general-setting-8EwuN5lN.cjs +0 -1
  93. package/dist/project-seo-setting-R77SKM1I.cjs +0 -1
  94. package/dist/single-page-detail-nyBEHLtT.cjs +0 -1
  95. package/dist/useAddBlockByDrop-4VH-SMj7.cjs +0 -1
  96. package/dist/useAddBlockByDrop-_kyR0iI4.js +0 -20
  97. package/dist/utils-tx6hqsHY.cjs +0 -1
@@ -1,13 +1,13 @@
1
1
  import { j as e } from "./jsx-runtime-NV737rRe.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 { b0 as g, b1 as h, b2 as f } from "./index-89A3jPHh.js";
5
- import { e as j, b, d as N } from "./index-Q5q5Y_8a.js";
4
+ import { b0 as g, b1 as h, b2 as f } from "./index-0OqmBgqo.js";
5
+ import { e as j, b, d as N } from "./index-CQz6j3ex.js";
6
6
  import "./MODIFIERS-MLfpKQY1.js";
7
7
  import "@radix-ui/react-toggle";
8
8
  import "class-variance-authority";
9
- import "./utils-zWMk4dB2.js";
10
- import "lodash";
9
+ import "./utils-XsPKXMVo.js";
10
+ import "./lodash-3gkdNK5u.js";
11
11
  import "clsx";
12
12
  import "tailwind-merge";
13
13
  import "@radix-ui/react-switch";
@@ -45,10 +45,10 @@ import "react-dnd";
45
45
  import "@minoru/react-dnd-treeview";
46
46
  import "react-hotkeys-hook";
47
47
  import "sonner";
48
- import "./html-to-json-kGgp07Hv.js";
48
+ import "./html-to-json-Y5M0N8PH.js";
49
49
  import "himalaya";
50
50
  import "lucide-react";
51
- const v = s.lazy(() => import("./single-page-detail-32H1_IG4.js")), P = ({ pageData: r }) => {
51
+ const v = s.lazy(() => import("./single-page-detail-r1GJF00l.js")), P = ({ pageData: r }) => {
52
52
  const [t, i] = p("CLOSE");
53
53
  return /* @__PURE__ */ e.jsxs(
54
54
  g,
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./jsx-runtime-WUGKV8jN.cjs"),u=require("react"),n=require("@radix-ui/react-icons"),o=require("./index-d55M5MRz.cjs"),x=require("./index-1Dr-VtaT.cjs");require("./MODIFIERS-WFzDQfiT.cjs");require("@radix-ui/react-toggle");require("class-variance-authority");require("./utils-37UXq2O5.cjs");require("./lodash-2us0VT8I.cjs");require("clsx");require("tailwind-merge");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("jotai");require("flat-to-nested");require("redux-undo");require("@chaibuilder/runtime");require("@react-hookz/web");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-aAZkA0f5.cjs");require("himalaya");require("lucide-react");const m=u.lazy(()=>Promise.resolve().then(()=>require("./single-page-detail-jkDYF7lW.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,14 +1,14 @@
1
1
  import { j as i } from "./jsx-runtime-NV737rRe.js";
2
2
  import * as l from "react";
3
- import { bo as n } from "./index-89A3jPHh.js";
3
+ import { bo as n } from "./index-0OqmBgqo.js";
4
4
  import { u as c, o as u } from "./controls-G0puEH71.js";
5
- import { F as d } from "./form-Fk4CaX1A.js";
6
- import { b as x } from "./index-Q5q5Y_8a.js";
5
+ import { F as d } from "./form-irY39wvJ.js";
6
+ import { b as x } from "./index-CQz6j3ex.js";
7
7
  import "./MODIFIERS-MLfpKQY1.js";
8
8
  import "@radix-ui/react-toggle";
9
9
  import "class-variance-authority";
10
- import "./utils-zWMk4dB2.js";
11
- import "lodash";
10
+ import "./utils-XsPKXMVo.js";
11
+ import "./lodash-3gkdNK5u.js";
12
12
  import "clsx";
13
13
  import "tailwind-merge";
14
14
  import "@radix-ui/react-switch";
@@ -39,6 +39,7 @@ import "redux-undo";
39
39
  import "@chaibuilder/runtime";
40
40
  import "@react-hookz/web";
41
41
  import "react-i18next";
42
+ import "lodash";
42
43
  import "@rjsf/core";
43
44
  import "@rjsf/validator-ajv8";
44
45
  import "i18next";
@@ -49,10 +50,10 @@ import "react-dnd";
49
50
  import "@minoru/react-dnd-treeview";
50
51
  import "react-hotkeys-hook";
51
52
  import "sonner";
52
- import "./html-to-json-kGgp07Hv.js";
53
+ import "./html-to-json-Y5M0N8PH.js";
53
54
  import "himalaya";
54
55
  import "lucide-react";
55
- const jo = ({
56
+ const Po = ({
56
57
  _projectData: m,
57
58
  seany: t
58
59
  }) => {
@@ -75,5 +76,5 @@ const jo = ({
75
76
  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 }) });
76
77
  };
77
78
  export {
78
- jo as default
79
+ Po as default
79
80
  };
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const q=require("./jsx-runtime-WUGKV8jN.cjs"),a=require("react"),f=require("./index-d55M5MRz.cjs"),o=require("./controls-aHZq-q4b.cjs"),d=require("./form-6qGAOYI3.cjs"),m=require("./index-1Dr-VtaT.cjs");require("./MODIFIERS-WFzDQfiT.cjs");require("@radix-ui/react-toggle");require("class-variance-authority");require("./utils-37UXq2O5.cjs");require("./lodash-2us0VT8I.cjs");require("clsx");require("tailwind-merge");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("jotai");require("flat-to-nested");require("redux-undo");require("@chaibuilder/runtime");require("@react-hookz/web");require("react-i18next");require("lodash");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-aAZkA0f5.cjs");require("himalaya");require("lucide-react");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,15 +1,16 @@
1
1
  import { j as s } from "./jsx-runtime-NV737rRe.js";
2
2
  import { b as D, u as c, g, o as x } from "./controls-G0puEH71.js";
3
- import { F as v } from "./form-Fk4CaX1A.js";
3
+ import { F as v } from "./form-irY39wvJ.js";
4
4
  import "./MODIFIERS-MLfpKQY1.js";
5
5
  import "react";
6
6
  import "lodash";
7
7
  import "@rjsf/core";
8
8
  import "@rjsf/validator-ajv8";
9
- import "./index-89A3jPHh.js";
9
+ import "./lodash-3gkdNK5u.js";
10
+ import "./index-0OqmBgqo.js";
10
11
  import "@radix-ui/react-toggle";
11
12
  import "class-variance-authority";
12
- import "./utils-zWMk4dB2.js";
13
+ import "./utils-XsPKXMVo.js";
13
14
  import "clsx";
14
15
  import "tailwind-merge";
15
16
  import "@radix-ui/react-switch";
@@ -40,7 +41,7 @@ import "redux-undo";
40
41
  import "@chaibuilder/runtime";
41
42
  import "@react-hookz/web";
42
43
  import "react-i18next";
43
- const at = ({
44
+ const st = ({
44
45
  _projectData: t,
45
46
  seany: l
46
47
  }) => {
@@ -78,5 +79,5 @@ const at = ({
78
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 }) });
79
80
  };
80
81
  export {
81
- at as default
82
+ st as default
82
83
  };
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const l=require("./jsx-runtime-WUGKV8jN.cjs"),i=require("./controls-aHZq-q4b.cjs"),g=require("./form-6qGAOYI3.cjs");require("./MODIFIERS-WFzDQfiT.cjs");require("react");require("lodash");require("@rjsf/core");require("@rjsf/validator-ajv8");require("./lodash-2us0VT8I.cjs");require("./index-d55M5MRz.cjs");require("@radix-ui/react-toggle");require("class-variance-authority");require("./utils-37UXq2O5.cjs");require("clsx");require("tailwind-merge");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("jotai");require("flat-to-nested");require("redux-undo");require("@chaibuilder/runtime");require("@react-hookz/web");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(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 c=require("./jsx-runtime-WUGKV8jN.cjs"),j=require("react"),s=require("lodash"),R=require("tailwind-merge"),u=require("./MODIFIERS-WFzDQfiT.cjs"),_=require("@chaibuilder/runtime"),x=require("./functions-ZWGlwlQY.cjs"),y=require("react-wrap-balancer"),B=t=>{const r={};return Object.keys(t).forEach(e=>{s.isString(t[e])&&t[e].startsWith(u.SLOT_KEY)&&(r[e]=t[e].replace(u.SLOT_KEY,"").split(","))}),r},C=s.memoize((t,r)=>{const e=t.replace(u.STYLES_KEY,"").split(","),n=R.twMerge(e[0],e[1]);return x.addPrefixToClasses(n,r).replace(u.STYLES_KEY,"").trim()});function O(t,r){return s.get(t,`${r}_attrs`,{})}function T(t,r){const e={};return Object.keys(t).forEach(n=>{if(s.isString(t[n])&&t[n].startsWith(u.STYLES_KEY)){const o=C(t[n],r);e[n]={className:o,...O(t,n)}}}),e}function q(t,r){const e=s.get(t,"_bindings",{});return s.isEmpty(e)?{...t}:(s.each(e,(n,o)=>{s.isString(n)&&s.get(r,n,null)&&(t[o]=s.get(r,n,null))}),t)}function a({blocks:t,parent:r,classPrefix:e="c-",externalData:n={}}){const o=t,p=i=>T(i,e),f=r?s.filter(t,{_parent:r}):s.filter(t,i=>s.isEmpty(i._parent));return c.jsxRuntimeExports.jsx(c.jsxRuntimeExports.Fragment,{children:j.Children.toArray(f.map((i,h)=>{const d=B(i),m={};s.isEmpty(d)||Object.keys(d).forEach(l=>{m[l]=j.Children.toArray(d[l].map(E=>c.jsxRuntimeExports.jsx(a,{externalData:n,classPrefix:e,blocks:o,parent:E})))});const S=s.filter(o,{_parent:i._id});m.children=S.length>0?c.jsxRuntimeExports.jsx(a,{externalData:n,classPrefix:e,parent:i._id,blocks:o}):null;const g=_.getBlockComponent(i._type);if(g!==null){let l=i;const E=g.component;return l={...g.defaults,...i},j.createElement(E,s.omit({blockProps:{},inBuilder:!1,...l,index:h,...q(i,n),...p(l),...m},["_parent"]))}return c.jsxRuntimeExports.jsxs("noscript",{children:[i._type," not found"]})}))})}const Y=({pageData:t,externalData:r={},before:e=null,after:n=null,classPrefix:o="c-"})=>{const p=s.get(t.project,"brandingOptions",u.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(y.Provider,{children:c.jsxRuntimeExports.jsx(a,{externalData:r,blocks:t.page.blocks||[],classPrefix:o})})}),n]})};exports.RenderChaiBlocks=a;exports.RenderChaiPage=Y;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const c=require("./jsx-runtime-WUGKV8jN.cjs"),j=require("react"),s=require("./lodash-2us0VT8I.cjs"),R=require("tailwind-merge"),u=require("./MODIFIERS-WFzDQfiT.cjs"),_=require("@chaibuilder/runtime"),x=require("./functions-Jr7gX_RX.cjs"),y=require("react-wrap-balancer"),B=t=>{const r={};return Object.keys(t).forEach(e=>{s.isString(t[e])&&t[e].startsWith(u.SLOT_KEY)&&(r[e]=t[e].replace(u.SLOT_KEY,"").split(","))}),r},C=s.memoize((t,r)=>{const e=t.replace(u.STYLES_KEY,"").split(","),n=R.twMerge(e[0],e[1]);return x.addPrefixToClasses(n,r).replace(u.STYLES_KEY,"").trim()});function O(t,r){return s.get(t,`${r}_attrs`,{})}function T(t,r){const e={};return Object.keys(t).forEach(n=>{if(s.isString(t[n])&&t[n].startsWith(u.STYLES_KEY)){const o=C(t[n],r);e[n]={className:o,...O(t,n)}}}),e}function q(t,r){const e=s.get(t,"_bindings",{});return s.isEmpty(e)?{...t}:(s.forEach(e,(n,o)=>{s.isString(n)&&s.get(r,n,null)&&(t[o]=s.get(r,n,null))}),t)}function a({blocks:t,parent:r,classPrefix:e="c-",externalData:n={}}){const o=t,p=i=>T(i,e),f=r?s.filter(t,{_parent:r}):s.filter(t,i=>s.isEmpty(i._parent));return c.jsxRuntimeExports.jsx(c.jsxRuntimeExports.Fragment,{children:j.Children.toArray(f.map((i,h)=>{const d=B(i),m={};s.isEmpty(d)||Object.keys(d).forEach(l=>{m[l]=j.Children.toArray(d[l].map(E=>c.jsxRuntimeExports.jsx(a,{externalData:n,classPrefix:e,blocks:o,parent:E})))});const S=s.filter(o,{_parent:i._id});m.children=S.length>0?c.jsxRuntimeExports.jsx(a,{externalData:n,classPrefix:e,parent:i._id,blocks:o}):null;const g=_.getBlockComponent(i._type);if(g!==null){let l=i;const E=g.component;return l={...g.defaults,...i},j.createElement(E,s.omit({blockProps:{},inBuilder:!1,...l,index:h,...q(i,n),...p(l),...m},["_parent"]))}return c.jsxRuntimeExports.jsxs("noscript",{children:[i._type," not found"]})}))})}const Y=({pageData:t,externalData:r={},before:e=null,after:n=null,classPrefix:o="c-"})=>{const p=s.get(t.project,"brandingOptions",u.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(y.Provider,{children:c.jsxRuntimeExports.jsx(a,{externalData:r,blocks:t.page.blocks||[],classPrefix:o})})}),n]})};exports.RenderChaiBlocks=a;exports.RenderChaiPage=Y;
package/dist/render.js CHANGED
@@ -1,72 +1,72 @@
1
- import { j as o } from "./jsx-runtime-NV737rRe.js";
1
+ import { j as i } from "./jsx-runtime-NV737rRe.js";
2
2
  import u from "react";
3
- import { isString as E, memoize as y, get as c, isEmpty as h, each as A, filter as g, omit as x } from "lodash";
3
+ import { i as E, m as y, g as c, a as h, f as A, b as g, o as x } from "./lodash-3gkdNK5u.js";
4
4
  import { twMerge as N } from "tailwind-merge";
5
5
  import { S as B, a as _, B as R } from "./MODIFIERS-MLfpKQY1.js";
6
6
  import { getBlockComponent as T } from "@chaibuilder/runtime";
7
- import { a as F, g as L } from "./functions-slns6ONz.js";
7
+ import { a as F, g as L } from "./functions-86L6n983.js";
8
8
  import { Provider as Y } from "react-wrap-balancer";
9
9
  const I = (t) => {
10
10
  const r = {};
11
- return Object.keys(t).forEach((n) => {
12
- E(t[n]) && t[n].startsWith(B) && (r[n] = t[n].replace(B, "").split(","));
11
+ return Object.keys(t).forEach((s) => {
12
+ E(t[s]) && t[s].startsWith(B) && (r[s] = t[s].replace(B, "").split(","));
13
13
  }), r;
14
14
  }, K = y((t, r) => {
15
- const n = t.replace(_, "").split(","), s = N(n[0], n[1]);
16
- return F(s, r).replace(_, "").trim();
15
+ const s = t.replace(_, "").split(","), n = N(s[0], s[1]);
16
+ return F(n, r).replace(_, "").trim();
17
17
  });
18
18
  function W(t, r) {
19
19
  return c(t, `${r}_attrs`, {});
20
20
  }
21
21
  function w(t, r) {
22
- const n = {};
23
- return Object.keys(t).forEach((s) => {
24
- if (E(t[s]) && t[s].startsWith(_)) {
25
- const i = K(t[s], r);
26
- n[s] = {
27
- className: i,
28
- ...W(t, s)
22
+ const s = {};
23
+ return Object.keys(t).forEach((n) => {
24
+ if (E(t[n]) && t[n].startsWith(_)) {
25
+ const o = K(t[n], r);
26
+ s[n] = {
27
+ className: o,
28
+ ...W(t, n)
29
29
  };
30
30
  }
31
- }), n;
31
+ }), s;
32
32
  }
33
33
  function z(t, r) {
34
- const n = c(t, "_bindings", {});
35
- return h(n) ? { ...t } : (A(n, (s, i) => {
36
- E(s) && c(r, s, null) && (t[i] = c(r, s, null));
34
+ const s = c(t, "_bindings", {});
35
+ return h(s) ? { ...t } : (A(s, (n, o) => {
36
+ E(n) && c(r, n, null) && (t[o] = c(r, n, null));
37
37
  }), t);
38
38
  }
39
39
  function j({
40
40
  blocks: t,
41
41
  parent: r,
42
- classPrefix: n = "c-",
43
- externalData: s = {}
42
+ classPrefix: s = "c-",
43
+ externalData: n = {}
44
44
  }) {
45
- const i = t, l = (e) => w(e, n), S = r ? g(t, { _parent: r }) : g(t, (e) => h(e._parent));
46
- return /* @__PURE__ */ o.jsx(o.Fragment, { children: u.Children.toArray(
45
+ const o = t, l = (e) => w(e, s), S = r ? g(t, { _parent: r }) : g(t, (e) => h(e._parent));
46
+ return /* @__PURE__ */ i.jsx(i.Fragment, { children: u.Children.toArray(
47
47
  S.map((e, C) => {
48
- const p = I(e), m = {};
49
- h(p) || Object.keys(p).forEach((a) => {
50
- m[a] = u.Children.toArray(
51
- p[a].map((f) => /* @__PURE__ */ o.jsx(
48
+ const m = I(e), p = {};
49
+ h(m) || Object.keys(m).forEach((a) => {
50
+ p[a] = u.Children.toArray(
51
+ m[a].map((f) => /* @__PURE__ */ i.jsx(
52
52
  j,
53
53
  {
54
- externalData: s,
55
- classPrefix: n,
56
- blocks: i,
54
+ externalData: n,
55
+ classPrefix: s,
56
+ blocks: o,
57
57
  parent: f
58
58
  }
59
59
  ))
60
60
  );
61
61
  });
62
- const O = g(i, { _parent: e._id });
63
- m.children = O.length > 0 ? /* @__PURE__ */ o.jsx(
62
+ const O = g(o, { _parent: e._id });
63
+ p.children = O.length > 0 ? /* @__PURE__ */ i.jsx(
64
64
  j,
65
65
  {
66
- externalData: s,
67
- classPrefix: n,
66
+ externalData: n,
67
+ classPrefix: s,
68
68
  parent: e._id,
69
- blocks: i
69
+ blocks: o
70
70
  }
71
71
  ) : null;
72
72
  const d = T(e._type);
@@ -81,15 +81,15 @@ function j({
81
81
  inBuilder: !1,
82
82
  ...a,
83
83
  index: C,
84
- ...z(e, s),
84
+ ...z(e, n),
85
85
  ...l(a),
86
- ...m
86
+ ...p
87
87
  },
88
88
  ["_parent"]
89
89
  )
90
90
  );
91
91
  }
92
- return /* @__PURE__ */ o.jsxs("noscript", { children: [
92
+ return /* @__PURE__ */ i.jsxs("noscript", { children: [
93
93
  e._type,
94
94
  " not found"
95
95
  ] });
@@ -99,21 +99,21 @@ function j({
99
99
  const J = ({
100
100
  pageData: t,
101
101
  externalData: r = {},
102
- before: n = null,
103
- after: s = null,
104
- classPrefix: i = "c-"
102
+ before: s = null,
103
+ after: n = null,
104
+ classPrefix: o = "c-"
105
105
  }) => {
106
106
  const l = c(t.project, "brandingOptions", R);
107
- return /* @__PURE__ */ o.jsxs(o.Fragment, { children: [
108
- n,
109
- /* @__PURE__ */ o.jsx(
107
+ return /* @__PURE__ */ i.jsxs(i.Fragment, { children: [
108
+ s,
109
+ /* @__PURE__ */ i.jsx(
110
110
  "div",
111
111
  {
112
- className: i.replace("-", "") + " " + L(l, i) + " min-h-screen",
113
- children: /* @__PURE__ */ o.jsx(Y, { children: /* @__PURE__ */ o.jsx(j, { externalData: r, blocks: t.page.blocks || [], classPrefix: i }) })
112
+ className: o.replace("-", "") + " " + L(l, o) + " min-h-screen",
113
+ children: /* @__PURE__ */ i.jsx(Y, { children: /* @__PURE__ */ i.jsx(j, { externalData: r, blocks: t.page.blocks || [], classPrefix: o }) })
114
114
  }
115
115
  ),
116
- s
116
+ n
117
117
  ] });
118
118
  };
119
119
  export {
package/dist/server.cjs CHANGED
@@ -1 +1 @@
1
- "use strict";var u=Object.defineProperty;var g=(a,t,e)=>t in a?u(a,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):a[t]=e;var h=(a,t,e)=>(g(a,typeof t!="symbol"?t+"":t,e),e);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const i=require("lodash"),l=require("@chaibuilder/runtime"),d="https://api.chaibuilder.com";class p{constructor(t,e){h(this,"_authSecret");h(this,"_accessToken",null);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}setAccessToken(t){this._accessToken=t}async getPageData(t){const e=this.getHeaders(),s=this.getURL("page-data",i.isEmpty(t)?{}:{slug:t}),o={method:"GET",headers:e,next:{tags:["everything",i.isEmpty(t)?"_homepage":t]}};return this.fetchAPI(s,o)}async unlockPage(t){if(!t)return Promise.reject({data:null,error:{message:"Invalid page uuid"},result:"error"});const e=this.getHeaders(),s=this.getURL("page/unlock"),o={method:"POST",headers:e,body:JSON.stringify({uuid:t})};return this.fetchAPI(s,o)}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}),o={method:"GET",headers:e};return this.fetchAPI(s,o)}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"),n={method:"POST",headers:s,body:e};return this.fetchAPI(r,n)}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}),o={method:"DELETE",headers:e};return this.fetchAPI(s,o)}async updatePage(t){const e=JSON.stringify(t),s=this.getHeaders(),r=this.getURL("page"),n={method:"PUT",headers:s,body:e};return this.fetchAPI(r,n)}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"),n={method:"PUT",headers:s,body:e};return this.fetchAPI(r,n)}async uploadAsset(t){const e=this.getHeaders(),s=this.getURL("asset"),r="POST",o=await t.get("file"),n=new FormData;n.append("file",o);const c={method:r,headers:e,body:n};return this.fetchAPI(s,c)}async getAssets(t,e){const s=this.getHeaders(),r=this.getURL("asset");t&&r.concat(`?limit=${t}`),e&&r.concat(`&offset=${e}`);const n={method:"GET",headers:s};return this.fetchAPI(r,n)}async authenticate({password:t}){const e=JSON.stringify({password:t}),s=this.getHeaders(),r=this.getURL("authenticate"),n={method:"POST",headers:s,body:e};return this.fetchAPI(r,n)}async login({password:t,email:e}){const s=JSON.stringify({password:t,email:e}),r=this.getHeaders(),o=this.getURL("login"),c={method:"POST",headers:r,body:s};return this.fetchAPI(o,c)}async logout(){const t=this.getHeaders(),e=this.getURL("logout"),r={method:"POST",headers:t};return this.fetchAPI(e,r)}async verify(){const t=this.getHeaders(),e=this.getURL("verify"),r={method:"POST",headers:t};return this.fetchAPI(e,r)}getURL(t,e){const s=new URLSearchParams(e).toString();return i.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),this._accessToken&&t.append("x-chai-access-token",this._accessToken),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(a,t)=>{const e=l.getChaiDataProviders(),s=i.filter(e,n=>i.map(a,"providerKey").includes(n.providerKey)),r={},o=[];for(const n of s)try{r[n.providerKey]=await n.dataFn({},t)}catch(c){o.push(c)}return{data:r,errors:o}};exports.ChaibuilderBackend=p;exports.prepareExternalData=y;
1
+ "use strict";var u=Object.defineProperty;var g=(a,t,e)=>t in a?u(a,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):a[t]=e;var h=(a,t,e)=>(g(a,typeof t!="symbol"?t+"":t,e),e);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const i=require("./lodash-2us0VT8I.cjs"),l=require("@chaibuilder/runtime"),d="https://api.chaibuilder.com";class p{constructor(t,e){h(this,"_authSecret");h(this,"_accessToken",null);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}setAccessToken(t){this._accessToken=t}async getPageData(t){const e=this.getHeaders(),s=this.getURL("page-data",i.isEmpty(t)?{}:{slug:t}),o={method:"GET",headers:e,next:{tags:["everything",i.isEmpty(t)?"_homepage":t]}};return this.fetchAPI(s,o)}async unlockPage(t){if(!t)return Promise.reject({data:null,error:{message:"Invalid page uuid"},result:"error"});const e=this.getHeaders(),s=this.getURL("page/unlock"),o={method:"POST",headers:e,body:JSON.stringify({uuid:t})};return this.fetchAPI(s,o)}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}),o={method:"GET",headers:e};return this.fetchAPI(s,o)}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"),n={method:"POST",headers:s,body:e};return this.fetchAPI(r,n)}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}),o={method:"DELETE",headers:e};return this.fetchAPI(s,o)}async updatePage(t){const e=JSON.stringify(t),s=this.getHeaders(),r=this.getURL("page"),n={method:"PUT",headers:s,body:e};return this.fetchAPI(r,n)}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"),n={method:"PUT",headers:s,body:e};return this.fetchAPI(r,n)}async uploadAsset(t){const e=this.getHeaders(),s=this.getURL("asset"),r="POST",o=await t.get("file"),n=new FormData;n.append("file",o);const c={method:r,headers:e,body:n};return this.fetchAPI(s,c)}async getAssets(t,e){const s=this.getHeaders(),r=this.getURL("asset");t&&r.concat(`?limit=${t}`),e&&r.concat(`&offset=${e}`);const n={method:"GET",headers:s};return this.fetchAPI(r,n)}async authenticate({password:t}){const e=JSON.stringify({password:t}),s=this.getHeaders(),r=this.getURL("authenticate"),n={method:"POST",headers:s,body:e};return this.fetchAPI(r,n)}async login({password:t,email:e}){const s=JSON.stringify({password:t,email:e}),r=this.getHeaders(),o=this.getURL("login"),c={method:"POST",headers:r,body:s};return this.fetchAPI(o,c)}async logout(){const t=this.getHeaders(),e=this.getURL("logout"),r={method:"POST",headers:t};return this.fetchAPI(e,r)}async verify(){const t=this.getHeaders(),e=this.getURL("verify"),r={method:"POST",headers:t};return this.fetchAPI(e,r)}getURL(t,e){const s=new URLSearchParams(e).toString();return i.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),this._accessToken&&t.append("x-chai-access-token",this._accessToken),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(a,t)=>{const e=l.getChaiDataProviders(),s=i.filter(e,n=>i.map(a,"providerKey").includes(n.providerKey)),r={},o=[];for(const n of s)try{r[n.providerKey]=await n.dataFn({},t)}catch(c){o.push(c)}return{data:r,errors:o}};exports.ChaibuilderBackend=p;exports.prepareExternalData=y;
package/dist/server.js CHANGED
@@ -1,7 +1,7 @@
1
1
  var g = Object.defineProperty;
2
- var u = (c, t, e) => t in c ? g(c, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : c[t] = e;
3
- var h = (c, t, e) => (u(c, typeof t != "symbol" ? t + "" : t, e), e);
4
- import { isEmpty as i, filter as l, map as p } from "lodash";
2
+ var u = (a, t, e) => t in a ? g(a, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : a[t] = e;
3
+ var h = (a, t, e) => (u(a, typeof t != "symbol" ? t + "" : t, e), e);
4
+ import { a as i, b as l, d as p } from "./lodash-3gkdNK5u.js";
5
5
  import { getChaiDataProviders as m } from "@chaibuilder/runtime";
6
6
  const d = "https://api.chaibuilder.com";
7
7
  class A {
@@ -118,8 +118,8 @@ class A {
118
118
  async uploadAsset(t) {
119
119
  const e = this.getHeaders(), s = this.getURL("asset"), o = "POST", r = await t.get("file"), n = new FormData();
120
120
  n.append("file", r);
121
- const a = { method: o, headers: e, body: n };
122
- return this.fetchAPI(s, a);
121
+ const c = { method: o, headers: e, body: n };
122
+ return this.fetchAPI(s, c);
123
123
  }
124
124
  /**
125
125
  *
@@ -148,8 +148,8 @@ class A {
148
148
  * @returns { token }
149
149
  */
150
150
  async login({ password: t, email: e }) {
151
- const s = JSON.stringify({ password: t, email: e }), o = this.getHeaders(), r = this.getURL("login"), a = { method: "POST", headers: o, body: s };
152
- return this.fetchAPI(r, a);
151
+ const s = JSON.stringify({ password: t, email: e }), o = this.getHeaders(), r = this.getURL("login"), c = { method: "POST", headers: o, body: s };
152
+ return this.fetchAPI(r, c);
153
153
  }
154
154
  /**
155
155
  *
@@ -200,13 +200,13 @@ class A {
200
200
  }
201
201
  }
202
202
  }
203
- const T = async (c, t) => {
204
- const e = m(), s = l(e, (n) => p(c, "providerKey").includes(n.providerKey)), o = {}, r = [];
203
+ const T = async (a, t) => {
204
+ const e = m(), s = l(e, (n) => p(a, "providerKey").includes(n.providerKey)), o = {}, r = [];
205
205
  for (const n of s)
206
206
  try {
207
207
  o[n.providerKey] = await n.dataFn({}, t);
208
- } catch (a) {
209
- r.push(a);
208
+ } catch (c) {
209
+ r.push(c);
210
210
  }
211
211
  return { data: o, errors: r };
212
212
  };
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=require("./jsx-runtime-WUGKV8jN.cjs"),f=require("react"),c=require("./lodash-2us0VT8I.cjs"),H=require("@radix-ui/react-icons"),y=require("./index-d55M5MRz.cjs"),d=require("./controls-aHZq-q4b.cjs"),w=require("sonner"),p=require("./form-6qGAOYI3.cjs"),P=require("./index-1Dr-VtaT.cjs");require("./MODIFIERS-WFzDQfiT.cjs");require("@radix-ui/react-toggle");require("class-variance-authority");require("./utils-37UXq2O5.cjs");require("clsx");require("tailwind-merge");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("jotai");require("flat-to-nested");require("redux-undo");require("@chaibuilder/runtime");require("@react-hookz/web");require("react-i18next");require("lodash");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-aAZkA0f5.cjs");require("himalaya");require("lucide-react");const z=f.lazy(()=>Promise.resolve().then(()=>require("./delete-page-modal-P_KKu12n.cjs"))),L=f.lazy(()=>Promise.resolve().then(()=>require("./confirm-alert-dHRDZrA1.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")})},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: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:R,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:R,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;
@@ -1,16 +1,16 @@
1
1
  import { j as t } from "./jsx-runtime-NV737rRe.js";
2
2
  import I, { useState as j, useEffect as z } from "react";
3
- import { isString as L, isEmpty as x, isEqual as C, omit as y, kebabCase as B } from "lodash";
3
+ import { i as L, a as x, X as C, o as y, a0 as B } from "./lodash-3gkdNK5u.js";
4
4
  import { HomeIcon as G } from "@radix-ui/react-icons";
5
- import { bo as Y, B as q } from "./index-89A3jPHh.js";
6
- import { u as g, b as Z, g as $, o as F, r as Q } from "./controls-G0puEH71.js";
7
- import { toast as U } from "sonner";
8
- import { F as h } from "./form-Fk4CaX1A.js";
9
- import { h as V, b as X, i as _, c as K } from "./index-Q5q5Y_8a.js";
5
+ import { bo as Y, B as q } from "./index-0OqmBgqo.js";
6
+ import { u as g, b as X, g as Z, o as $, r as F } from "./controls-G0puEH71.js";
7
+ import { toast as Q } from "sonner";
8
+ import { F as h } from "./form-irY39wvJ.js";
9
+ import { h as U, b as V, i as _, c as K } from "./index-CQz6j3ex.js";
10
10
  import "./MODIFIERS-MLfpKQY1.js";
11
11
  import "@radix-ui/react-toggle";
12
12
  import "class-variance-authority";
13
- import "./utils-zWMk4dB2.js";
13
+ import "./utils-XsPKXMVo.js";
14
14
  import "clsx";
15
15
  import "tailwind-merge";
16
16
  import "@radix-ui/react-switch";
@@ -40,6 +40,7 @@ import "redux-undo";
40
40
  import "@chaibuilder/runtime";
41
41
  import "@react-hookz/web";
42
42
  import "react-i18next";
43
+ import "lodash";
43
44
  import "@rjsf/core";
44
45
  import "@rjsf/validator-ajv8";
45
46
  import "i18next";
@@ -49,10 +50,10 @@ import "flagged";
49
50
  import "react-dnd";
50
51
  import "@minoru/react-dnd-treeview";
51
52
  import "react-hotkeys-hook";
52
- import "./html-to-json-kGgp07Hv.js";
53
+ import "./html-to-json-Y5M0N8PH.js";
53
54
  import "himalaya";
54
55
  import "lucide-react";
55
- const O = I.lazy(() => import("./delete-page-modal-LNME2FwD.js")), J = I.lazy(() => import("./confirm-alert-GkfW9chS.js")), P = (r) => {
56
+ const O = I.lazy(() => import("./delete-page-modal-fRoXPfhG.js")), J = I.lazy(() => import("./confirm-alert-ea5xpncD.js")), P = (r) => {
56
57
  if (!L(r) || !(r.includes("/[") && r.includes("]")))
57
58
  return !1;
58
59
  const s = /^\[((?:\.{3})?[a-zA-Z0-9_-]+)\]$/, u = /^[a-zA-Z0-9_-]+$/;
@@ -66,14 +67,14 @@ const O = I.lazy(() => import("./delete-page-modal-LNME2FwD.js")), J = I.lazy(()
66
67
  } : r, W = (r, m) => {
67
68
  const s = !C(y(r, ["seoData"]), y(m, ["seoData"])), u = !C(f(m).seoData, f(r).seoData);
68
69
  return s || u;
69
- }, ke = ({ open: r, setOpen: m, pageData: s }) => {
70
- const u = V(), { data: e } = X(), n = _(), c = K("Homepage updated successfully."), [i, T] = j(f(s)), [d, v] = j({
70
+ }, De = ({ open: r, setOpen: m, pageData: s }) => {
71
+ const u = U(), { data: e } = V(), n = _(), c = K("Homepage updated successfully."), [i, T] = j(f(s)), [a, v] = j({
71
72
  isHomePage: (e == null ? void 0 : e.homepage) === s.uuid
72
73
  }), N = W(i, s);
73
74
  z(() => {
74
- const l = !C(f(s), i), o = (e == null ? void 0 : e.homepage) !== s.uuid && d.isHomePage;
75
+ const l = !C(f(s), i), o = (e == null ? void 0 : e.homepage) !== s.uuid && a.isHomePage;
75
76
  m(l || o ? "PENDING" : "OPEN");
76
- }, [e, s, i, d, m]);
77
+ }, [e, s, i, a, m]);
77
78
  const S = () => {
78
79
  if (N) {
79
80
  if (s.type === "DYNAMIC" && !P((i == null ? void 0 : i.slug) || "")) {
@@ -85,32 +86,32 @@ const O = I.lazy(() => import("./delete-page-modal-LNME2FwD.js")), J = I.lazy(()
85
86
  u.invalidateQueries({
86
87
  refetchType: "active",
87
88
  queryKey: ["pages", e == null ? void 0 : e.uuid]
88
- }), m("CLOSE"), U.success("Page updated successfully.");
89
+ }), m("CLOSE"), Q.success("Page updated successfully.");
89
90
  }
90
91
  });
91
92
  }
92
- d.isHomePage && (e == null ? void 0 : e.homepage) !== s.uuid && c.mutate({ ...e, homepage: s == null ? void 0 : s.uuid }, { onSuccess: () => m("CLOSE") });
93
+ a.isHomePage && (e == null ? void 0 : e.homepage) !== s.uuid && c.mutate({ ...e, homepage: s == null ? void 0 : s.uuid }, { onSuccess: () => m("CLOSE") });
93
94
  }, b = ({ formData: l }, o) => {
94
95
  T((p) => {
95
96
  var E, A;
96
97
  if (!o)
97
98
  return p;
98
- const a = { [o]: l[o] };
99
- return o === "name" ? a.slug = B((E = l[o]) == null ? void 0 : E.replace(/\d/g, "")) : o === "slug" ? a.slug = (A = l[o]) == null ? void 0 : A.replace(/\d/g, "").replace(/\s+/g, "").replace("--", "-").replace("__", "_") : o === "seoData" && (a.seoData = {
99
+ const d = { [o]: l[o] };
100
+ return o === "name" ? d.slug = B((E = l[o]) == null ? void 0 : E.replace(/\d/g, "")) : o === "slug" ? d.slug = (A = l[o]) == null ? void 0 : A.replace(/\d/g, "").replace(/\s+/g, "").replace("--", "-").replace("__", "_") : o === "seoData" && (d.seoData = {
100
101
  title: l[o].title || "",
101
102
  description: l[o].description || "",
102
103
  image: l[o].image || ""
103
104
  }), {
104
105
  ...p,
105
- ...a
106
+ ...d
106
107
  };
107
108
  });
108
109
  }, H = ({ formData: l }, o) => {
109
110
  v((p) => {
110
- const a = { [o]: l[o] };
111
+ const d = { [o]: l[o] };
111
112
  return {
112
113
  ...p,
113
- ...a
114
+ ...d
114
115
  };
115
116
  });
116
117
  }, M = {
@@ -120,7 +121,7 @@ const O = I.lazy(() => import("./delete-page-modal-LNME2FwD.js")), J = I.lazy(()
120
121
  }),
121
122
  slug: g({ title: "Page Slug", default: i.slug })
122
123
  }, w = {
123
- seoData: Z({
124
+ seoData: X({
124
125
  title: "",
125
126
  description: "",
126
127
  default: {
@@ -133,17 +134,17 @@ const O = I.lazy(() => import("./delete-page-modal-LNME2FwD.js")), J = I.lazy(()
133
134
  title: "Meta Title",
134
135
  default: i.name
135
136
  }),
136
- description: $({
137
+ description: Z({
137
138
  title: "Meta Description",
138
139
  default: i.slug
139
140
  }),
140
- image: F({ title: "Social Media Image", default: "" })
141
+ image: $({ title: "Social Media Image", default: "" })
141
142
  }
142
143
  })
143
144
  }, R = {
144
- isHomePage: Q({
145
+ isHomePage: F({
145
146
  title: "Set as homepage",
146
- default: d.isHomePage
147
+ default: a.isHomePage
147
148
  })
148
149
  };
149
150
  return /* @__PURE__ */ t.jsxs(Y, { className: "flex h-full select-none flex-col", children: [
@@ -183,7 +184,7 @@ const O = I.lazy(() => import("./delete-page-modal-LNME2FwD.js")), J = I.lazy(()
183
184
  (e == null ? void 0 : e.homepage) !== s.uuid && s.type === "STATIC" ? /* @__PURE__ */ t.jsx(
184
185
  h,
185
186
  {
186
- formData: d,
187
+ formData: a,
187
188
  properties: R,
188
189
  onChange: H,
189
190
  disabled: n.isPending || c.isPending
@@ -204,7 +205,7 @@ const O = I.lazy(() => import("./delete-page-modal-LNME2FwD.js")), J = I.lazy(()
204
205
  className: "w-full",
205
206
  type: "submit",
206
207
  onClick: S,
207
- disabled: (e == null ? void 0 : e.homepage) !== s.uuid && d.isHomePage ? !1 : x(i.name) || x(i.slug) || !N || n.isPending || c.isPending || i.type === "DYNAMIC" && !P((i == null ? void 0 : i.slug) || ""),
208
+ disabled: (e == null ? void 0 : e.homepage) !== s.uuid && a.isHomePage ? !1 : x(i.name) || x(i.slug) || !N || n.isPending || c.isPending || i.type === "DYNAMIC" && !P((i == null ? void 0 : i.slug) || ""),
208
209
  children: "Save"
209
210
  }
210
211
  ),
@@ -214,5 +215,5 @@ const O = I.lazy(() => import("./delete-page-modal-LNME2FwD.js")), J = I.lazy(()
214
215
  ] });
215
216
  };
216
217
  export {
217
- ke as default
218
+ De as default
218
219
  };
package/dist/studio.cjs CHANGED
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});require("./jsx-runtime-WUGKV8jN.cjs");const e=require("./index-61c5wSJn.cjs");require("react");require("sonner");require("./MODIFIERS-WFzDQfiT.cjs");require("i18next");require("react-i18next");require("./index-GNmGzavZ.cjs");require("@radix-ui/react-toggle");require("class-variance-authority");require("./utils-tx6hqsHY.cjs");require("lodash");require("clsx");require("tailwind-merge");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("jotai");require("flat-to-nested");require("redux-undo");require("@chaibuilder/runtime");require("@react-hookz/web");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-po8on2ju.cjs");require("himalaya");require("lucide-react");exports.ChaiBuilderStudio=e.ChaiBuilderStudio;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});require("./jsx-runtime-WUGKV8jN.cjs");const e=require("./index-1Dr-VtaT.cjs");require("react");require("sonner");require("./MODIFIERS-WFzDQfiT.cjs");require("i18next");require("react-i18next");require("./index-d55M5MRz.cjs");require("@radix-ui/react-toggle");require("class-variance-authority");require("./utils-37UXq2O5.cjs");require("./lodash-2us0VT8I.cjs");require("clsx");require("tailwind-merge");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("jotai");require("flat-to-nested");require("redux-undo");require("@chaibuilder/runtime");require("@react-hookz/web");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-aAZkA0f5.cjs");require("himalaya");require("lucide-react");exports.ChaiBuilderStudio=e.ChaiBuilderStudio;
package/dist/studio.js CHANGED
@@ -1,15 +1,15 @@
1
1
  import "./jsx-runtime-NV737rRe.js";
2
- import { C as Z } from "./index-Q5q5Y_8a.js";
2
+ import { C as Z } from "./index-CQz6j3ex.js";
3
3
  import "react";
4
4
  import "sonner";
5
5
  import "./MODIFIERS-MLfpKQY1.js";
6
6
  import "i18next";
7
7
  import "react-i18next";
8
- import "./index-89A3jPHh.js";
8
+ import "./index-0OqmBgqo.js";
9
9
  import "@radix-ui/react-toggle";
10
10
  import "class-variance-authority";
11
- import "./utils-zWMk4dB2.js";
12
- import "lodash";
11
+ import "./utils-XsPKXMVo.js";
12
+ import "./lodash-3gkdNK5u.js";
13
13
  import "clsx";
14
14
  import "tailwind-merge";
15
15
  import "@radix-ui/react-switch";
@@ -45,7 +45,7 @@ import "flagged";
45
45
  import "react-dnd";
46
46
  import "@minoru/react-dnd-treeview";
47
47
  import "react-hotkeys-hook";
48
- import "./html-to-json-kGgp07Hv.js";
48
+ import "./html-to-json-Y5M0N8PH.js";
49
49
  import "himalaya";
50
50
  import "lucide-react";
51
51
  export {