@chaibuilder/sdk 1.2.8 → 1.2.10-7.beta.1
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 +26 -21
- package/dist/CodeEditor-3Vp79cuE.cjs +1 -0
- package/dist/CodeEditor-bUqM7eCa.js +129 -0
- package/dist/STRINGS-Xxstm-7I.js +7 -0
- package/dist/STRINGS-Yl7cSWDc.cjs +1 -0
- package/dist/Topbar-P7-9Rps1.js +124 -0
- package/dist/Topbar-xwQ4JUZD.cjs +1 -0
- package/dist/UnsplashImages-BxgbXGB6.cjs +1 -0
- package/dist/UnsplashImages-nQSvWPU0.js +244 -0
- package/dist/UploadImages-L9LlI-jl.cjs +1 -0
- package/dist/UploadImages-SVnIHigg.js +153 -0
- package/dist/context-menu-YGd09SE1.js +979 -0
- package/dist/context-menu-sQn7ryJ6.cjs +1 -0
- package/dist/{controls-XPXGHKht.js → controls-lEwMTdPQ.js} +96 -44
- package/dist/controls-p9IwFnPx.cjs +1 -0
- package/dist/core.cjs +1 -1
- package/dist/core.d.ts +344 -119
- package/dist/core.js +111 -88
- package/dist/iconBase-Ief2hJUZ.js +130 -0
- package/dist/iconBase-aZzpqff_.cjs +1 -0
- package/dist/index-3NV_rst1.js +9051 -0
- package/dist/index-qTKBamQ6.cjs +63 -0
- package/dist/jsx-runtime-JYMCiFoE.cjs +27 -0
- package/dist/{jsx-runtime-WbnYoNE9.js → jsx-runtime-Sp0orL4X.js} +106 -109
- package/dist/mockServiceWorker.js +18 -10
- package/dist/plugin-UiUFs2fK.js +44 -0
- package/dist/plugin-f6SDZ_Or.js +108 -0
- package/dist/plugin-jum1MjXp.cjs +1 -0
- package/dist/plugin-xOpS-UNV.cjs +1 -0
- package/dist/render.cjs +3 -1
- package/dist/render.d.ts +21 -40
- package/dist/render.js +129 -85
- package/dist/runtime.cjs +1 -0
- package/dist/runtime.d.ts +5 -0
- package/dist/runtime.js +21 -0
- package/dist/style.css +2 -2
- package/dist/tailwind.cjs +1 -1
- package/dist/tailwind.d.ts +49 -8
- package/dist/tailwind.js +16 -20
- package/dist/ui.cjs +1 -1
- package/dist/ui.d.ts +3 -13
- package/dist/ui.js +363 -163
- package/dist/web-blocks.cjs +3 -9
- package/dist/web-blocks.d.ts +1 -1
- package/dist/web-blocks.js +725 -766
- package/package.json +66 -83
- package/dist/AddBlocks-tMxKPoen.js +0 -225
- package/dist/AddBlocks-x2LkOHSj.cjs +0 -1
- package/dist/BrandingOptions-EzT9UYd6.cjs +0 -1
- package/dist/BrandingOptions-QJJ1y5ez.js +0 -194
- package/dist/CanvasArea-EfZgx-gN.js +0 -1425
- package/dist/CanvasArea-rIDwPHl5.cjs +0 -60
- package/dist/CurrentPage-QNFPD078.cjs +0 -1
- package/dist/CurrentPage-ulHTz4MD.js +0 -111
- package/dist/Functions-7jnEwJyw.js +0 -15
- package/dist/Functions-N3yhPYKY.cjs +0 -1
- package/dist/Layers-rehZkz78.js +0 -404
- package/dist/Layers-v-7k3W2I.cjs +0 -1
- package/dist/MODIFIERS-2FeVfZQ9.cjs +0 -1
- package/dist/MODIFIERS-RiXS5Mn1.js +0 -67
- package/dist/MarkAsGlobalBlock-BjP-Rqlf.js +0 -88
- package/dist/MarkAsGlobalBlock-X5dNmZcb.cjs +0 -1
- package/dist/PagesPanel-acGVGJf-.js +0 -69
- package/dist/PagesPanel-x5ms_LOD.cjs +0 -1
- package/dist/ProjectPanel-5BHQ5ANP.cjs +0 -1
- package/dist/ProjectPanel-aLFJq49M.js +0 -90
- package/dist/Settings-iOjfw5NQ.cjs +0 -1
- package/dist/Settings-v-txwlII.js +0 -2193
- package/dist/SidePanels-Vdc-J5wK.js +0 -349
- package/dist/SidePanels-t0g9ZQFT.cjs +0 -1
- package/dist/Topbar-V8xCetWF.cjs +0 -1
- package/dist/Topbar-j4t4AgCq.js +0 -116
- package/dist/UnsplashImages-41Y3q5_Q.js +0 -200
- package/dist/UnsplashImages-DbHky6cj.cjs +0 -1
- package/dist/UploadImages-DnQ95_NW.cjs +0 -1
- package/dist/UploadImages-xBg-kbKv.js +0 -138
- package/dist/_commonjsHelpers-UyOWmZb0.js +0 -8
- package/dist/_commonjsHelpers-wDK0ZLPo.cjs +0 -1
- package/dist/add-page-modal-0YAI9dXr.cjs +0 -1
- package/dist/add-page-modal-6DlGzdA4.js +0 -108
- package/dist/confirm-alert-U7-NcG7G.cjs +0 -1
- package/dist/confirm-alert-i4pM3mOt.js +0 -62
- package/dist/controls-Dy1qa8Dc.cjs +0 -1
- package/dist/delete-page-modal-T_rlQfNd.js +0 -88
- package/dist/delete-page-modal-qXpi_2xR.cjs +0 -1
- package/dist/email-blocks.cjs +0 -1
- package/dist/email-blocks.d.ts +0 -3
- package/dist/email-blocks.js +0 -274
- package/dist/form-OVmsLOrc.js +0 -125
- package/dist/form-VbouZlAW.cjs +0 -1
- package/dist/functions-Ox_svtKm.cjs +0 -1
- package/dist/functions-xIebp8Aw.js +0 -23
- package/dist/html-to-json-2PeOCVey.cjs +0 -1
- package/dist/html-to-json-57841sEK.js +0 -183
- package/dist/index-EGUphg4R.js +0 -41620
- package/dist/index-H6vIwGfD.cjs +0 -1
- package/dist/index-e0c8PmRQ.js +0 -205
- package/dist/index-gi1LIOCw.cjs +0 -1
- package/dist/index-jw8RxsTv.cjs +0 -206
- package/dist/index-niHREMmR.js +0 -2938
- package/dist/jsx-runtime-Z_BpKhVy.cjs +0 -27
- package/dist/lib.cjs +0 -4
- package/dist/lib.d.ts +0 -78
- package/dist/lib.js +0 -1322
- package/dist/page-viewer-EoYYnA56.js +0 -115
- package/dist/page-viewer-Ou8vDXGV.cjs +0 -1
- package/dist/project-general-setting-92q4oEYv.cjs +0 -1
- package/dist/project-general-setting-DC_nADG-.js +0 -83
- package/dist/project-seo-setting-Snn2nZgS.cjs +0 -1
- package/dist/project-seo-setting-wxAGEkd_.js +0 -85
- package/dist/server.cjs +0 -1
- package/dist/server.d.ts +0 -299
- package/dist/server.js +0 -216
- package/dist/single-page-detail-QmmhR_h2.cjs +0 -1
- package/dist/single-page-detail-xtNZ9YxX.js +0 -222
- package/dist/studio.cjs +0 -1
- package/dist/studio.d.ts +0 -13
- package/dist/studio.js +0 -58
- package/dist/useAddBlockByDrop-_nwI4W3q.js +0 -20
- package/dist/useAddBlockByDrop-inkD7Lck.cjs +0 -1
- package/dist/utils-AvyFzbPC.js +0 -1075
- package/dist/utils-PTxFk6qT.cjs +0 -1
package/dist/server.js
DELETED
|
@@ -1,216 +0,0 @@
|
|
|
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-es";
|
|
5
|
-
import { getChaiDataProviders as m } from "@chaibuilder/runtime";
|
|
6
|
-
const d = "https://api.chaibuilder.com";
|
|
7
|
-
class A {
|
|
8
|
-
constructor(t, e) {
|
|
9
|
-
h(this, "_authSecret");
|
|
10
|
-
h(this, "_accessToken", null);
|
|
11
|
-
h(this, "_appKey");
|
|
12
|
-
if (!t)
|
|
13
|
-
throw "Please provide valid auth secret.";
|
|
14
|
-
if (!e)
|
|
15
|
-
throw "Please provide valid project key.";
|
|
16
|
-
this._authSecret = t, this._appKey = e;
|
|
17
|
-
}
|
|
18
|
-
setAccessToken(t) {
|
|
19
|
-
this._accessToken = t;
|
|
20
|
-
}
|
|
21
|
-
async getPageData(t) {
|
|
22
|
-
const e = this.getHeaders(), s = this.getURL("page-data", i(t) ? {} : { slug: t }), r = {
|
|
23
|
-
method: "GET",
|
|
24
|
-
headers: e,
|
|
25
|
-
next: { tags: ["everything", i(t) ? "_homepage" : t] }
|
|
26
|
-
};
|
|
27
|
-
return this.fetchAPI(s, r);
|
|
28
|
-
}
|
|
29
|
-
async unlockPage(t) {
|
|
30
|
-
if (!t)
|
|
31
|
-
return Promise.reject({
|
|
32
|
-
data: null,
|
|
33
|
-
error: { message: "Invalid page uuid" },
|
|
34
|
-
result: "error"
|
|
35
|
-
});
|
|
36
|
-
const e = this.getHeaders(), s = this.getURL("page/unlock"), r = { method: "POST", headers: e, body: JSON.stringify({ uuid: t }) };
|
|
37
|
-
return this.fetchAPI(s, r);
|
|
38
|
-
}
|
|
39
|
-
/**
|
|
40
|
-
*
|
|
41
|
-
* @param uuid
|
|
42
|
-
* @returns Detail Single Page Information
|
|
43
|
-
*/
|
|
44
|
-
async getPage(t) {
|
|
45
|
-
if (!t)
|
|
46
|
-
return Promise.reject({
|
|
47
|
-
data: null,
|
|
48
|
-
error: { message: "Invalid page uuid" },
|
|
49
|
-
result: "error"
|
|
50
|
-
});
|
|
51
|
-
const e = this.getHeaders(), s = this.getURL("page", { uuid: t }), r = { method: "GET", headers: e };
|
|
52
|
-
return this.fetchAPI(s, r);
|
|
53
|
-
}
|
|
54
|
-
/**
|
|
55
|
-
*
|
|
56
|
-
* @returns List of all pages
|
|
57
|
-
*/
|
|
58
|
-
// @ts-ignore
|
|
59
|
-
async getPages() {
|
|
60
|
-
const t = this.getHeaders(), e = this.getURL("pages"), o = { method: "GET", headers: t };
|
|
61
|
-
return this.fetchAPI(e, o);
|
|
62
|
-
}
|
|
63
|
-
/**
|
|
64
|
-
*
|
|
65
|
-
* @param page
|
|
66
|
-
* @returns Detail of new page
|
|
67
|
-
*/
|
|
68
|
-
async addPage(t) {
|
|
69
|
-
const e = JSON.stringify(t), s = this.getHeaders(), o = this.getURL("page"), n = { method: "POST", headers: s, body: e };
|
|
70
|
-
return this.fetchAPI(o, n);
|
|
71
|
-
}
|
|
72
|
-
/**
|
|
73
|
-
*
|
|
74
|
-
* @param uuid
|
|
75
|
-
* @returns Success | Error Message
|
|
76
|
-
*/
|
|
77
|
-
async deletePage(t) {
|
|
78
|
-
if (!t)
|
|
79
|
-
return Promise.reject({
|
|
80
|
-
data: null,
|
|
81
|
-
error: { message: "Invalid page uuid" },
|
|
82
|
-
result: "error"
|
|
83
|
-
});
|
|
84
|
-
const e = this.getHeaders(), s = this.getURL("page", { uuid: t }), r = { method: "DELETE", headers: e };
|
|
85
|
-
return this.fetchAPI(s, r);
|
|
86
|
-
}
|
|
87
|
-
/**
|
|
88
|
-
*
|
|
89
|
-
* @param page
|
|
90
|
-
* @returns Update page information or Error response
|
|
91
|
-
*/
|
|
92
|
-
async updatePage(t) {
|
|
93
|
-
const e = JSON.stringify(t), s = this.getHeaders(), o = this.getURL("page"), n = { method: "PUT", headers: s, body: e };
|
|
94
|
-
return this.fetchAPI(o, n);
|
|
95
|
-
}
|
|
96
|
-
/**
|
|
97
|
-
*
|
|
98
|
-
* @returns Project detail
|
|
99
|
-
*/
|
|
100
|
-
async getProject() {
|
|
101
|
-
const t = this.getHeaders(), e = this.getURL("project"), o = { method: "GET", headers: t };
|
|
102
|
-
return this.fetchAPI(e, o);
|
|
103
|
-
}
|
|
104
|
-
/**
|
|
105
|
-
*
|
|
106
|
-
* @param project
|
|
107
|
-
* @returns Updated project detail
|
|
108
|
-
*/
|
|
109
|
-
async updateProject(t) {
|
|
110
|
-
const e = JSON.stringify(t), s = this.getHeaders(), o = this.getURL("project"), n = { method: "PUT", headers: s, body: e };
|
|
111
|
-
return this.fetchAPI(o, n);
|
|
112
|
-
}
|
|
113
|
-
/**
|
|
114
|
-
*
|
|
115
|
-
* @returns Upload asset
|
|
116
|
-
* @param formData
|
|
117
|
-
*/
|
|
118
|
-
async uploadAsset(t) {
|
|
119
|
-
const e = this.getHeaders(), s = this.getURL("asset"), o = "POST", r = await t.get("file"), n = new FormData();
|
|
120
|
-
n.append("file", r);
|
|
121
|
-
const a = { method: o, headers: e, body: n };
|
|
122
|
-
return this.fetchAPI(s, a);
|
|
123
|
-
}
|
|
124
|
-
/**
|
|
125
|
-
*
|
|
126
|
-
* @returns Get assets
|
|
127
|
-
* @param limit
|
|
128
|
-
* @param offset
|
|
129
|
-
*/
|
|
130
|
-
async getAssets(t, e) {
|
|
131
|
-
const s = this.getHeaders(), o = this.getURL("asset");
|
|
132
|
-
t && o.concat(`?limit=${t}`), e && o.concat(`&offset=${e}`);
|
|
133
|
-
const n = { method: "GET", headers: s };
|
|
134
|
-
return this.fetchAPI(o, n);
|
|
135
|
-
}
|
|
136
|
-
/**
|
|
137
|
-
*
|
|
138
|
-
* @param { password }
|
|
139
|
-
* @returns { token }
|
|
140
|
-
*/
|
|
141
|
-
async authenticate({ password: t }) {
|
|
142
|
-
const e = JSON.stringify({ password: t }), s = this.getHeaders(), o = this.getURL("authenticate"), n = { method: "POST", headers: s, body: e };
|
|
143
|
-
return this.fetchAPI(o, n);
|
|
144
|
-
}
|
|
145
|
-
/**
|
|
146
|
-
*
|
|
147
|
-
* @param { password }
|
|
148
|
-
* @returns { token }
|
|
149
|
-
*/
|
|
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);
|
|
153
|
-
}
|
|
154
|
-
/**
|
|
155
|
-
*
|
|
156
|
-
* @returns { token }
|
|
157
|
-
*/
|
|
158
|
-
async logout() {
|
|
159
|
-
const t = this.getHeaders(), e = this.getURL("logout"), o = { method: "POST", headers: t };
|
|
160
|
-
return this.fetchAPI(e, o);
|
|
161
|
-
}
|
|
162
|
-
/**
|
|
163
|
-
*
|
|
164
|
-
* @returns { result: 'success' | 'error' }
|
|
165
|
-
*/
|
|
166
|
-
async verify() {
|
|
167
|
-
const t = this.getHeaders(), e = this.getURL("verify"), o = { method: "POST", headers: t };
|
|
168
|
-
return this.fetchAPI(e, o);
|
|
169
|
-
}
|
|
170
|
-
/**
|
|
171
|
-
*
|
|
172
|
-
* @param endpoint
|
|
173
|
-
* @param queryParam
|
|
174
|
-
* @returns api endpoint with query param
|
|
175
|
-
*/
|
|
176
|
-
getURL(t, e) {
|
|
177
|
-
const s = new URLSearchParams(e).toString();
|
|
178
|
-
return i(e) ? `${d}/v1/${t}` : `${d}/v1/${t}?${s}`;
|
|
179
|
-
}
|
|
180
|
-
/**
|
|
181
|
-
*
|
|
182
|
-
* @returns headers for api
|
|
183
|
-
*/
|
|
184
|
-
getHeaders() {
|
|
185
|
-
const t = new Headers();
|
|
186
|
-
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;
|
|
187
|
-
}
|
|
188
|
-
/**
|
|
189
|
-
*
|
|
190
|
-
* @returns Fetch API
|
|
191
|
-
*/
|
|
192
|
-
async fetchAPI(t, e) {
|
|
193
|
-
try {
|
|
194
|
-
const s = await fetch(t, e).then((o) => o.json());
|
|
195
|
-
if ((s == null ? void 0 : s.result) === "success")
|
|
196
|
-
return { data: s == null ? void 0 : s.data, error: null, result: "success" };
|
|
197
|
-
throw s == null ? void 0 : s.error;
|
|
198
|
-
} catch (s) {
|
|
199
|
-
return { data: null, error: s, result: "error" };
|
|
200
|
-
}
|
|
201
|
-
}
|
|
202
|
-
}
|
|
203
|
-
const T = async (c, t) => {
|
|
204
|
-
const e = m(), s = l(e, (n) => p(c, "providerKey").includes(n.providerKey)), o = {}, r = [];
|
|
205
|
-
for (const n of s)
|
|
206
|
-
try {
|
|
207
|
-
o[n.providerKey] = await n.dataFn({}, t);
|
|
208
|
-
} catch (a) {
|
|
209
|
-
r.push(a);
|
|
210
|
-
}
|
|
211
|
-
return { data: o, errors: r };
|
|
212
|
-
};
|
|
213
|
-
export {
|
|
214
|
-
A as ChaibuilderBackend,
|
|
215
|
-
T as prepareExternalData
|
|
216
|
-
};
|
|
@@ -1 +0,0 @@
|
|
|
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-H6vIwGfD.cjs"),d=require("./controls-Dy1qa8Dc.cjs"),w=require("sonner"),p=require("./form-VbouZlAW.cjs"),P=require("./index-jw8RxsTv.cjs");require("./_commonjsHelpers-wDK0ZLPo.cjs");require("@radix-ui/react-toggle");require("class-variance-authority");require("./utils-PTxFk6qT.cjs");require("./MODIFIERS-2FeVfZQ9.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("./Functions-N3yhPYKY.cjs");require("redux-undo");require("@chaibuilder/runtime");require("lodash");require("@react-hookz/web");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-qXpi_2xR.cjs"))),L=f.lazy(()=>Promise.resolve().then(()=>require("./confirm-alert-U7-NcG7G.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,222 +0,0 @@
|
|
|
1
|
-
import { j as s } from "./jsx-runtime-WbnYoNE9.js";
|
|
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-es";
|
|
4
|
-
import { HomeIcon as G } from "@radix-ui/react-icons";
|
|
5
|
-
import { bn as Y, B as q } from "./index-niHREMmR.js";
|
|
6
|
-
import { u as g, b as Z, g as $, o as F, r as Q } from "./controls-XPXGHKht.js";
|
|
7
|
-
import { toast as U } from "sonner";
|
|
8
|
-
import { F as h } from "./form-OVmsLOrc.js";
|
|
9
|
-
import { h as V, b as X, i as _, c as K } from "./index-EGUphg4R.js";
|
|
10
|
-
import "./_commonjsHelpers-UyOWmZb0.js";
|
|
11
|
-
import "@radix-ui/react-toggle";
|
|
12
|
-
import "class-variance-authority";
|
|
13
|
-
import "./utils-AvyFzbPC.js";
|
|
14
|
-
import "./MODIFIERS-RiXS5Mn1.js";
|
|
15
|
-
import "clsx";
|
|
16
|
-
import "tailwind-merge";
|
|
17
|
-
import "@radix-ui/react-switch";
|
|
18
|
-
import "@radix-ui/react-slot";
|
|
19
|
-
import "@radix-ui/react-accordion";
|
|
20
|
-
import "@radix-ui/react-alert-dialog";
|
|
21
|
-
import "@radix-ui/react-dialog";
|
|
22
|
-
import "@radix-ui/react-label";
|
|
23
|
-
import "@radix-ui/react-scroll-area";
|
|
24
|
-
import "@radix-ui/react-tabs";
|
|
25
|
-
import "@radix-ui/react-tooltip";
|
|
26
|
-
import "@radix-ui/react-popover";
|
|
27
|
-
import "@radix-ui/react-menubar";
|
|
28
|
-
import "@radix-ui/react-hover-card";
|
|
29
|
-
import "@radix-ui/react-select";
|
|
30
|
-
import "@radix-ui/react-dropdown-menu";
|
|
31
|
-
import "@radix-ui/react-separator";
|
|
32
|
-
import "@radix-ui/react-toast";
|
|
33
|
-
import "cmdk";
|
|
34
|
-
import "@radix-ui/react-context-menu";
|
|
35
|
-
import "react-icons-picker";
|
|
36
|
-
import "react-dom";
|
|
37
|
-
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 "lodash";
|
|
44
|
-
import "@react-hookz/web";
|
|
45
|
-
import "react-i18next";
|
|
46
|
-
import "@rjsf/core";
|
|
47
|
-
import "@rjsf/validator-ajv8";
|
|
48
|
-
import "i18next";
|
|
49
|
-
import "@floating-ui/react-dom";
|
|
50
|
-
import "react-textarea-autosize";
|
|
51
|
-
import "flagged";
|
|
52
|
-
import "react-dnd";
|
|
53
|
-
import "@minoru/react-dnd-treeview";
|
|
54
|
-
import "react-hotkeys-hook";
|
|
55
|
-
import "./html-to-json-57841sEK.js";
|
|
56
|
-
import "himalaya";
|
|
57
|
-
import "lucide-react";
|
|
58
|
-
import "./web-blocks.js";
|
|
59
|
-
const O = I.lazy(() => import("./delete-page-modal-T_rlQfNd.js")), J = I.lazy(() => import("./confirm-alert-i4pM3mOt.js")), P = (r) => {
|
|
60
|
-
if (!L(r) || !(r.includes("/[") && r.includes("]")))
|
|
61
|
-
return !1;
|
|
62
|
-
const t = /^\[((?:\.{3})?[a-zA-Z0-9_-]+)\]$/, u = /^[a-zA-Z0-9_-]+$/;
|
|
63
|
-
let e = !0;
|
|
64
|
-
return r.split("/").forEach((n) => {
|
|
65
|
-
e && (n.includes("[[") && n.includes("]]") ? e = /^\[\[\.{3}[a-zA-Z0-9_-]+\]\]$/.test(n) : n.includes("[") && n.includes("]") ? e = t.test(n) : e = u.test(n));
|
|
66
|
-
}), e;
|
|
67
|
-
}, f = (r) => r && x(r.seoData) ? {
|
|
68
|
-
...r,
|
|
69
|
-
seoData: { title: "", description: "", image: "" }
|
|
70
|
-
} : r, W = (r, m) => {
|
|
71
|
-
const t = !C(y(r, ["seoData"]), y(m, ["seoData"])), u = !C(f(m).seoData, f(r).seoData);
|
|
72
|
-
return t || u;
|
|
73
|
-
}, ti = ({ open: r, setOpen: m, pageData: t }) => {
|
|
74
|
-
const u = V(), { data: e } = X(), n = _(), c = K("Homepage updated successfully."), [i, T] = j(f(t)), [d, v] = j({
|
|
75
|
-
isHomePage: (e == null ? void 0 : e.homepage) === t.uuid
|
|
76
|
-
}), N = W(i, t);
|
|
77
|
-
z(() => {
|
|
78
|
-
const l = !C(f(t), i), o = (e == null ? void 0 : e.homepage) !== t.uuid && d.isHomePage;
|
|
79
|
-
m(l || o ? "PENDING" : "OPEN");
|
|
80
|
-
}, [e, t, i, d, m]);
|
|
81
|
-
const S = () => {
|
|
82
|
-
if (N) {
|
|
83
|
-
if (t.type === "DYNAMIC" && !P((i == null ? void 0 : i.slug) || "")) {
|
|
84
|
-
r === "ALERT" && m("PENDING");
|
|
85
|
-
return;
|
|
86
|
-
}
|
|
87
|
-
n.mutate(i, {
|
|
88
|
-
onSuccess: () => {
|
|
89
|
-
u.invalidateQueries({
|
|
90
|
-
refetchType: "active",
|
|
91
|
-
queryKey: ["pages", e == null ? void 0 : e.uuid]
|
|
92
|
-
}), m("CLOSE"), U.success("Page updated successfully.");
|
|
93
|
-
}
|
|
94
|
-
});
|
|
95
|
-
}
|
|
96
|
-
d.isHomePage && (e == null ? void 0 : e.homepage) !== t.uuid && c.mutate({ ...e, homepage: t == null ? void 0 : t.uuid }, { onSuccess: () => m("CLOSE") });
|
|
97
|
-
}, b = ({ formData: l }, o) => {
|
|
98
|
-
T((p) => {
|
|
99
|
-
var E, A;
|
|
100
|
-
if (!o)
|
|
101
|
-
return p;
|
|
102
|
-
const a = { [o]: l[o] };
|
|
103
|
-
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 = {
|
|
104
|
-
title: l[o].title || "",
|
|
105
|
-
description: l[o].description || "",
|
|
106
|
-
image: l[o].image || ""
|
|
107
|
-
}), {
|
|
108
|
-
...p,
|
|
109
|
-
...a
|
|
110
|
-
};
|
|
111
|
-
});
|
|
112
|
-
}, H = ({ formData: l }, o) => {
|
|
113
|
-
v((p) => {
|
|
114
|
-
const a = { [o]: l[o] };
|
|
115
|
-
return {
|
|
116
|
-
...p,
|
|
117
|
-
...a
|
|
118
|
-
};
|
|
119
|
-
});
|
|
120
|
-
}, M = {
|
|
121
|
-
name: g({
|
|
122
|
-
title: "Page Name",
|
|
123
|
-
default: i.name
|
|
124
|
-
}),
|
|
125
|
-
slug: g({ title: "Page Slug", default: i.slug })
|
|
126
|
-
}, w = {
|
|
127
|
-
seoData: Z({
|
|
128
|
-
title: "",
|
|
129
|
-
description: "",
|
|
130
|
-
default: {
|
|
131
|
-
title: "",
|
|
132
|
-
description: "",
|
|
133
|
-
image: ""
|
|
134
|
-
},
|
|
135
|
-
properties: {
|
|
136
|
-
title: g({
|
|
137
|
-
title: "Meta Title",
|
|
138
|
-
default: i.name
|
|
139
|
-
}),
|
|
140
|
-
description: $({
|
|
141
|
-
title: "Meta Description",
|
|
142
|
-
default: i.slug
|
|
143
|
-
}),
|
|
144
|
-
image: F({ title: "Social Media Image", default: "" })
|
|
145
|
-
}
|
|
146
|
-
})
|
|
147
|
-
}, R = {
|
|
148
|
-
isHomePage: Q({
|
|
149
|
-
title: "Set as homepage",
|
|
150
|
-
default: d.isHomePage
|
|
151
|
-
})
|
|
152
|
-
};
|
|
153
|
-
return /* @__PURE__ */ s.jsxs(Y, { className: "flex h-full select-none flex-col", children: [
|
|
154
|
-
/* @__PURE__ */ s.jsx(
|
|
155
|
-
J,
|
|
156
|
-
{
|
|
157
|
-
open: r === "ALERT",
|
|
158
|
-
title: "Do yo want to save changes?",
|
|
159
|
-
onCancel: () => m("CLOSE"),
|
|
160
|
-
onConfirm: S,
|
|
161
|
-
disabled: c.isPending || n.isPending
|
|
162
|
-
}
|
|
163
|
-
),
|
|
164
|
-
/* @__PURE__ */ s.jsx("div", { className: "rounded-md bg-background/30 px-2.5 py-1", children: /* @__PURE__ */ s.jsx("h1", { className: "px-1 font-semibold", children: "Page Details" }) }),
|
|
165
|
-
/* @__PURE__ */ s.jsx("div", { className: "px-2.5 pt-2", children: /* @__PURE__ */ s.jsxs("div", { className: "flex flex-col space-y-2", children: [
|
|
166
|
-
/* @__PURE__ */ s.jsx(
|
|
167
|
-
h,
|
|
168
|
-
{
|
|
169
|
-
title: "Basic Details",
|
|
170
|
-
formData: i,
|
|
171
|
-
properties: M,
|
|
172
|
-
onChange: b,
|
|
173
|
-
disabled: n.isPending || c.isPending
|
|
174
|
-
}
|
|
175
|
-
),
|
|
176
|
-
/* @__PURE__ */ s.jsx("div", { className: "h-2 w-full" }),
|
|
177
|
-
/* @__PURE__ */ s.jsx(
|
|
178
|
-
h,
|
|
179
|
-
{
|
|
180
|
-
title: "SEO Details",
|
|
181
|
-
formData: i,
|
|
182
|
-
properties: w,
|
|
183
|
-
onChange: b,
|
|
184
|
-
disabled: n.isPending || c.isPending
|
|
185
|
-
}
|
|
186
|
-
),
|
|
187
|
-
(e == null ? void 0 : e.homepage) !== t.uuid && t.type === "STATIC" ? /* @__PURE__ */ s.jsx(
|
|
188
|
-
h,
|
|
189
|
-
{
|
|
190
|
-
formData: d,
|
|
191
|
-
properties: R,
|
|
192
|
-
onChange: H,
|
|
193
|
-
disabled: n.isPending || c.isPending
|
|
194
|
-
}
|
|
195
|
-
) : t.type === "STATIC" && /* @__PURE__ */ s.jsxs("div", { className: "flex items-center gap-x-1 px-1 pt-2 text-xs font-medium text-gray-500", children: [
|
|
196
|
-
/* @__PURE__ */ s.jsx(G, {}),
|
|
197
|
-
" This is homepage",
|
|
198
|
-
" "
|
|
199
|
-
] }),
|
|
200
|
-
i.type === "DYNAMIC" && !P((i == null ? void 0 : i.slug) || "") && /* @__PURE__ */ s.jsxs("small", { className: "px-1 text-red-400", children: [
|
|
201
|
-
"Add dynamic ID in page slug Eg: ",
|
|
202
|
-
/* @__PURE__ */ s.jsx("i", { className: "underline", children: "some-url/[some-id]" })
|
|
203
|
-
] }),
|
|
204
|
-
/* @__PURE__ */ s.jsxs("div", { className: "my-2 flex w-full items-center justify-between gap-x-2 px-1", children: [
|
|
205
|
-
/* @__PURE__ */ s.jsx(
|
|
206
|
-
q,
|
|
207
|
-
{
|
|
208
|
-
className: "w-full",
|
|
209
|
-
type: "submit",
|
|
210
|
-
onClick: S,
|
|
211
|
-
disabled: (e == null ? void 0 : e.homepage) !== t.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) || ""),
|
|
212
|
-
children: "Save"
|
|
213
|
-
}
|
|
214
|
-
),
|
|
215
|
-
/* @__PURE__ */ s.jsx(O, { pageData: t, projectData: e })
|
|
216
|
-
] })
|
|
217
|
-
] }) })
|
|
218
|
-
] });
|
|
219
|
-
};
|
|
220
|
-
export {
|
|
221
|
-
ti as default
|
|
222
|
-
};
|
package/dist/studio.cjs
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});require("./jsx-runtime-Z_BpKhVy.cjs");const e=require("./index-jw8RxsTv.cjs");require("react");require("sonner");require("./_commonjsHelpers-wDK0ZLPo.cjs");require("i18next");require("react-i18next");require("./index-H6vIwGfD.cjs");require("@radix-ui/react-toggle");require("class-variance-authority");require("./utils-PTxFk6qT.cjs");require("lodash-es");require("./MODIFIERS-2FeVfZQ9.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("./Functions-N3yhPYKY.cjs");require("redux-undo");require("@chaibuilder/runtime");require("lodash");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-2PeOCVey.cjs");require("himalaya");require("lucide-react");require("./web-blocks.cjs");require("./controls-Dy1qa8Dc.cjs");exports.ChaiBuilderStudio=e.ChaiBuilderStudio;
|
package/dist/studio.d.ts
DELETED
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import { JSX as JSX_2 } from 'react/jsx-runtime';
|
|
2
|
-
import { default as React_2 } from 'react';
|
|
3
|
-
|
|
4
|
-
export declare const ChaiBuilderStudio: (props: ChaiBuilderStudioProps) => JSX_2.Element;
|
|
5
|
-
|
|
6
|
-
export declare type ChaiBuilderStudioProps = {
|
|
7
|
-
apiBaseUrl?: string;
|
|
8
|
-
logo?: React_2.FC<any> | React_2.LazyExoticComponent<any>;
|
|
9
|
-
darkMode?: boolean;
|
|
10
|
-
unsplashAccessKey?: string;
|
|
11
|
-
};
|
|
12
|
-
|
|
13
|
-
export { }
|
package/dist/studio.js
DELETED
|
@@ -1,58 +0,0 @@
|
|
|
1
|
-
import "./jsx-runtime-WbnYoNE9.js";
|
|
2
|
-
import { C as ri } from "./index-EGUphg4R.js";
|
|
3
|
-
import "react";
|
|
4
|
-
import "sonner";
|
|
5
|
-
import "./_commonjsHelpers-UyOWmZb0.js";
|
|
6
|
-
import "i18next";
|
|
7
|
-
import "react-i18next";
|
|
8
|
-
import "./index-niHREMmR.js";
|
|
9
|
-
import "@radix-ui/react-toggle";
|
|
10
|
-
import "class-variance-authority";
|
|
11
|
-
import "./utils-AvyFzbPC.js";
|
|
12
|
-
import "lodash-es";
|
|
13
|
-
import "./MODIFIERS-RiXS5Mn1.js";
|
|
14
|
-
import "clsx";
|
|
15
|
-
import "tailwind-merge";
|
|
16
|
-
import "@radix-ui/react-switch";
|
|
17
|
-
import "@radix-ui/react-slot";
|
|
18
|
-
import "@radix-ui/react-accordion";
|
|
19
|
-
import "@radix-ui/react-icons";
|
|
20
|
-
import "@radix-ui/react-alert-dialog";
|
|
21
|
-
import "@radix-ui/react-dialog";
|
|
22
|
-
import "@radix-ui/react-label";
|
|
23
|
-
import "@radix-ui/react-scroll-area";
|
|
24
|
-
import "@radix-ui/react-tabs";
|
|
25
|
-
import "@radix-ui/react-tooltip";
|
|
26
|
-
import "@radix-ui/react-popover";
|
|
27
|
-
import "@radix-ui/react-menubar";
|
|
28
|
-
import "@radix-ui/react-hover-card";
|
|
29
|
-
import "@radix-ui/react-select";
|
|
30
|
-
import "@radix-ui/react-dropdown-menu";
|
|
31
|
-
import "@radix-ui/react-separator";
|
|
32
|
-
import "@radix-ui/react-toast";
|
|
33
|
-
import "cmdk";
|
|
34
|
-
import "@radix-ui/react-context-menu";
|
|
35
|
-
import "react-icons-picker";
|
|
36
|
-
import "react-dom";
|
|
37
|
-
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 "lodash";
|
|
44
|
-
import "@react-hookz/web";
|
|
45
|
-
import "@floating-ui/react-dom";
|
|
46
|
-
import "react-textarea-autosize";
|
|
47
|
-
import "flagged";
|
|
48
|
-
import "react-dnd";
|
|
49
|
-
import "@minoru/react-dnd-treeview";
|
|
50
|
-
import "react-hotkeys-hook";
|
|
51
|
-
import "./html-to-json-57841sEK.js";
|
|
52
|
-
import "himalaya";
|
|
53
|
-
import "lucide-react";
|
|
54
|
-
import "./web-blocks.js";
|
|
55
|
-
import "./controls-XPXGHKht.js";
|
|
56
|
-
export {
|
|
57
|
-
ri as ChaiBuilderStudio
|
|
58
|
-
};
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
import { useCallback as n } from "react";
|
|
2
|
-
import { has as s } from "lodash-es";
|
|
3
|
-
import { P as a, i as u } from "./index-niHREMmR.js";
|
|
4
|
-
const B = () => {
|
|
5
|
-
const { addCoreBlock: r } = a(), l = u("getExternalPredefinedBlock");
|
|
6
|
-
return n(
|
|
7
|
-
async (c) => {
|
|
8
|
-
const { block: e, dropTargetId: o, relativeIndex: t } = c;
|
|
9
|
-
if (s(e, "format")) {
|
|
10
|
-
const d = await l(e);
|
|
11
|
-
return r({ blocks: d }, o === 0 ? null : o, t);
|
|
12
|
-
}
|
|
13
|
-
return r(e, o === 0 ? null : o, t);
|
|
14
|
-
},
|
|
15
|
-
[r]
|
|
16
|
-
);
|
|
17
|
-
};
|
|
18
|
-
export {
|
|
19
|
-
B as u
|
|
20
|
-
};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";const n=require("react"),u=require("lodash-es"),t=require("./index-H6vIwGfD.cjs"),a=()=>{const{addCoreBlock:r}=t.useAddBlock(),l=t.useBuilderProp("getExternalPredefinedBlock");return n.useCallback(async s=>{const{block:o,dropTargetId:e,relativeIndex:c}=s;if(u.has(o,"format")){const d=await l(o);return r({blocks:d},e===0?null:e,c)}return r(o,e===0?null:e,c)},[r])};exports.useAddBlockByDrop=a;
|