@chaibuilder/pages 0.3.0 → 0.3.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/server.cjs +1 -1
- package/dist/server.d.ts +6 -2
- package/dist/server.js +49 -43
- package/package.json +4 -4
package/dist/server.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var
|
|
1
|
+
"use strict";var E=Object.defineProperty;var A=(i,a,t)=>a in i?E(i,a,{enumerable:!0,configurable:!0,writable:!0,value:t}):i[a]=t;var l=(i,a,t)=>A(i,typeof a!="symbol"?a+"":a,t);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const c=require("lodash-es"),u={},k=(i,a)=>{u[i]={key:i,...a,hasSlug:!0}},f=(i,a)=>{u[i]={key:i,...a,hasSlug:!1}},g=()=>Object.values(u),s=i=>u[i];let b=async i=>({...i});const C=i=>b=i,d=async i=>{try{return await b(i)}catch(a){return console.error(a),{}}};class w{async verifyTokenAndGetUser(a){return{id:"mock-chai-user",name:"Mock Chai User",email:"mock-chai-user@chaibuilder.com"}}async isUserActive(a){return!0}async getUserRoleAndPermissions(a){return{role:"admin",permissions:null}}async getUserInfo(a){return{id:"mock-chai-users",email:"mock-chai-user@chaibuilder.com",name:"Mock Chai User",avatar:"https://i.pravatar.cc/300"}}}const P={ab:"Abkhazian",aa:"Afar",af:"Afrikaans",ak:"Akan",sq:"Albanian",am:"Amharic",ar:"Arabic",an:"Aragonese",hy:"Armenian",as:"Assamese",av:"Avaric",ae:"Avestan",ay:"Aymara",az:"Azerbaijani",bm:"Bambara",ba:"Bashkir",eu:"Basque",be:"Belarusian",bn:"Bengali",bh:"Bihari",bi:"Bislama",bs:"Bosnian",br:"Breton",bg:"Bulgarian",my:"Burmese",ca:"Catalan",ch:"Chamorro",ce:"Chechen",ny:"Chichewa",zh:"Chinese","zh-Hans":"Chinese (Simplified)","zh-Hant":"Chinese (Traditional)",cv:"Chuvash",kw:"Cornish",co:"Corsican",cr:"Cree",hr:"Croatian",cs:"Czech",da:"Danish",dv:"Maldivian",nl:"Dutch",dz:"Dzongkha",en:"English",eo:"Esperanto",et:"Estonian",ee:"Ewe",fo:"Faroese",fj:"Fijian",fi:"Finnish",fr:"French",ff:"Fula, Pular",gl:"Galician",gd:"Gaelic (Scottish)",gv:"Manx",ka:"Georgian",de:"German",el:"Greek",kl:"Kalaallisut",gn:"Guarani",gu:"Gujarati",ht:"Haitian Creole",ha:"Hausa",he:"Hebrew",hz:"Herero",hi:"Hindi",ho:"Hiri Motu",hu:"Hungarian",is:"Icelandic",io:"Ido",ig:"Igbo",id:"Indonesian",ia:"Interlingua",ie:"Interlingue",iu:"Inuktitut",ik:"Inupiak",ga:"Irish",it:"Italian",ja:"Japanese",jv:"Javanese",kn:"Kannada",kr:"Kanuri",ks:"Kashmiri",kk:"Kazakh",km:"Khmer",ki:"Kikuyu",rw:"Kinyarwanda",rn:"Kirundi",ky:"Kyrgyz",kv:"Komi",kg:"Kongo",ko:"Korean",ku:"Kurdish",kj:"Kwanyama",lo:"Lao",la:"Latin",lv:"Latvian",li:"Limburgish",ln:"Lingala",lt:"Lithuanian",lu:"Luga-Katanga",lg:"Luganda, Ganda",lb:"Luxembourgish",mk:"Macedonian",mg:"Malagasy",ms:"Malay",ml:"Malayalam",mt:"Maltese",mi:"Maori",mr:"Marathi",mh:"Marshallese",mo:"Moldavian",mn:"Mongolian",na:"Nauru",nv:"Navajo",ng:"Ndonga",nd:"Northern Ndebele",ne:"Nepali",no:"Norwegian",nb:"Norwegian bokmål",nn:"Norwegian nynorsk",ii:"Sichuan Yi",oc:"Occitan",oj:"Ojibwe",cu:"Old Church Slavonic",or:"Oriya",om:"Oromo",os:"Ossetian",pi:"Pāli",ps:"Pashto, Pushto",fa:"Persian (Farsi)",pl:"Polish",pt:"Portuguese",pa:"Punjabi (Eastern)",qu:"Quechua",rm:"Romansh",ro:"Romanian",ru:"Russian",se:"Sami",sm:"Samoan",sg:"Sango",sa:"Sanskrit",sr:"Serbian",sh:"Serbo-Croatian",st:"Sesotho",tn:"Setswana",sn:"Shona",sd:"Sindhi",si:"Sinhalese",ss:"Swati",sk:"Slovak",sl:"Slovenian",so:"Somali",nr:"Southern Ndebele",es:"Spanish",su:"Sundanese",sw:"Swahili (Kiswahili)",sv:"Swedish",tl:"Tagalog",ty:"Tahitian",tg:"Tajik",ta:"Tamil",tt:"Tatar",te:"Telugu",th:"Thai",bo:"Tibetan",ti:"Tigrinya",to:"Tonga",ts:"Tsonga",tr:"Turkish",tk:"Turkmen",tw:"Twi",ug:"Uyghur",uk:"Ukrainian",ur:"Urdu",uz:"Uzbek",ve:"Venda",vi:"Vietnamese",vo:"Volapük",wa:"Wallon",cy:"Welsh",wo:"Wolof",fy:"Western Frisian",xh:"Xhosa",yi:"Yiddish",yo:"Yoruba",za:"Zhuang, Chuang",zu:"Zulu"};class y{constructor(a){l(this,"fallbackLang","");l(this,"currentLang","");l(this,"draftMode",!1);l(this,"userMgmt",new w);this.backend=a,this._registerDefaultPageTypes()}_registerDefaultPageTypes(){k("page",{name:"Static Page",icon:'<svg stroke="currentColor" fill="currentColor" stroke-width="0" viewBox="0 0 24 24" height="1em" width="1em" xmlns="http://www.w3.org/2000/svg"><path d="M5 8V20H19V8H5ZM5 6H19V4H5V6ZM20 22H4C3.44772 22 3 21.5523 3 21V3C3 2.44772 3.44772 2 4 2H20C20.5523 2 21 2.44772 21 3V21C21 21.5523 20.5523 22 20 22ZM7 10H11V14H7V10ZM7 16H17V18H7V16ZM13 11H17V13H13V11Z"></path></svg>'}),f("global",{name:"Global Block",helpText:"A global block can be reused in multiple pages.",icon:'<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-globe w-4 h-4 text-slate-500 stroke-[1]"><circle cx="12" cy="12" r="10"></circle><path d="M12 2a14.5 14.5 0 0 0 0 20 14.5 14.5 0 0 0 0-20"></path><path d="M2 12h20"></path></svg>'})}setUserManagement(a){this.userMgmt=a}setFallbackLang(a){if(c.isEmpty(a))throw new Error("Fallback language cannot be empty");this.fallbackLang=a}getFallbackLang(){return this.fallbackLang}setCurrentLang(a){if(c.isEmpty(a))throw new Error("Current language cannot be empty");this.currentLang=a}getCurrentLang(){return this.currentLang}setDraftMode(a){this.draftMode=a}isDraftMode(){return this.draftMode}async handleUpload(a,t=""){return await this.backend.handleUpload(a,t)}async handle(a,t){switch(a.action){case"CHECK_USER_STATUS":return this.userMgmt.isUserActive(t);case"GET_ROLE_AND_PERMISSIONS":return this.userMgmt.getUserRoleAndPermissions(t);case"GET_CHAI_USER":return this.userMgmt.getUserInfo(t)}if(a.action==="GET_BUILDER_PAGE_DATA"){const e=await d({lang:a.data.lang,draft:!0,inBuilder:!0}),r=s(a.data.pageType);return r?{...r.dataProvider?await r.dataProvider({lang:a.data.lang,draft:!0,inBuilder:!0,pageProps:a.data.pageProps??{}}):{},global:e}:{global:e}}if(a.action==="GET_PAGE_TYPES")return Promise.all(g().map(async e=>({key:e.key,helpText:e.helpText??"",icon:e.icon??"",dynamicSegments:e.dynamicSegments??"",dynamicSlug:e.dynamicSlug??"",hasSlug:e.hasSlug??!0,name:typeof e.name=="function"?await e.name():e.name})));if(a.action==="SEARCH_PAGE_TYPE_ITEMS"){const e=s(a.data.pageType);return e?e.search?await e.search(a.data.query):this.backend.handleAction(a):{error:"Page type not found"}}const n=await this.backend.handleAction(a,t);return this.emit(a.action,n),n}emit(a,t){var r,o,h;if(!["CREATE_PAGE","UPDATE_PAGE","DELETE_PAGE"].includes(a))return;const n=c.get(t,"page");if(!n)return;const e=s(n.pageType);if(e)switch(a){case"CREATE_PAGE":return(r=e.onCreate)==null?void 0:r.call(e,n);case"UPDATE_PAGE":return(o=e.onUpdate)==null?void 0:o.call(e,n);case"DELETE_PAGE":return(h=e.onDelete)==null?void 0:h.call(e,n)}}setLanguageFromSlug(a){if(!this.getFallbackLang())throw new Error("Please set a fallback language using setFallbackLang(lang: string)");const t=c.first(a||[""]);Object.keys(P).includes(t)?this.setCurrentLang(t):this.setCurrentLang(this.getFallbackLang())}async resolveLink(a,t){const n=s(a);if(!n)return"/not-found";const e=this.isDraftMode(),r=this.getCurrentLang();return n.resolveLink?await n.resolveLink(t,e,r):await this.backend.handleAction({action:"GET_LINK",data:{pageType:a,id:t,draft:e,lang:r}})}async getPageBySlug(a){const t=this.isDraftMode(),n={};return g().forEach(e=>{c.has(e,"dynamicSegments")&&e.dynamicSegments&&(n[e.key]=e.dynamicSegments)}),await this.backend.handleAction({action:"GET_PAGE_META",data:{slug:a,draft:t,dynamicSegments:n}})}async getFullPage(a){const t=this.isDraftMode(),n=this.getCurrentLang(),e=this.getFallbackLang();return await this.backend.handleAction({action:"GET_PAGE",data:{id:a,lang:e===n?void 0:n,draft:t,mergePartials:!0}})}async getSiteSettings(){const a=this.isDraftMode();return await this.backend.handleAction({action:"GET_WEBSITE_SETTINGS",data:{draft:a}})}async getPageData(a,t){var m;const n=this.isDraftMode(),e=this.getCurrentLang(),r=s(a),[o,h]=await Promise.all([this.getGlobalData(),((m=r==null?void 0:r.dataProvider)==null?void 0:m.call(r,{lang:e,draft:n,inBuilder:!1,pageProps:t}))||Promise.resolve({})]);return r?{...h,global:o}:{global:o}}async getGlobalData(){const a=this.getCurrentLang();return await d({lang:a,draft:this.isDraftMode(),inBuilder:!1})}async request(a){return await this.backend.handleAction(a)}}class p{constructor(a="",t=S){this.apiKey=a,this.apiUrl=t}async handleAction(a,t=""){return await(await fetch(`${this.apiUrl}/v1/api/chai`,{cache:"no-store",method:"POST",body:JSON.stringify(a),headers:{"x-chai-api-key":this.apiKey,...t?{"x-chai-user":t}:{}}})).json()}async handleUpload(a,t=""){return console.log("handleUpload",typeof a.get("file")),await(await fetch(`${this.apiUrl}/v1/api/chai`,{method:"POST",body:a,headers:{"x-chai-api-key":this.apiKey,"x-chai-upload":"true",...t?{"x-chai-user":t}:{}}})).json()}}const S="https://api.chaibuilder.com";exports.API_URL=S;exports.ChaiBuilderPages=y;exports.ChaiBuilderPagesBackend=p;exports.ChaiBuilderPagesUserManagement=w;exports.LANGUAGES=P;exports.getChaiGlobalData=d;exports.getChaiPageType=s;exports.getChaiPageTypes=g;exports.registerChaiGlobalDataProvider=C;exports.registerChaiPageType=k;exports.registerChaiPartialType=f;
|
package/dist/server.d.ts
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import { ChaiPageProps } from '@chaibuilder/runtime';
|
|
2
|
+
|
|
1
3
|
export declare const API_URL = "https://api.chaibuilder.com";
|
|
2
4
|
|
|
3
5
|
export declare type ChaiBuilderPage = {
|
|
@@ -35,7 +37,7 @@ export declare class ChaiBuilderPages implements ChaiBuilderPagesInterface {
|
|
|
35
37
|
getPageBySlug(slug: string): Promise<any>;
|
|
36
38
|
getFullPage(id: string): Promise<any>;
|
|
37
39
|
getSiteSettings(): Promise<any>;
|
|
38
|
-
getPageData(pageType: string,
|
|
40
|
+
getPageData(pageType: string, pageProps: ChaiPageProps): Promise<{
|
|
39
41
|
global: any;
|
|
40
42
|
}>;
|
|
41
43
|
getGlobalData(): Promise<any>;
|
|
@@ -124,7 +126,7 @@ export declare type ChaiBuilderPageType = {
|
|
|
124
126
|
lang: string;
|
|
125
127
|
draft: boolean;
|
|
126
128
|
inBuilder: boolean;
|
|
127
|
-
|
|
129
|
+
pageProps: ChaiPageProps;
|
|
128
130
|
}) => Promise<Record<string, any>>;
|
|
129
131
|
};
|
|
130
132
|
|
|
@@ -135,6 +137,8 @@ export declare type ChaiBuilderUserInfo = {
|
|
|
135
137
|
avatar?: string;
|
|
136
138
|
};
|
|
137
139
|
|
|
140
|
+
export { ChaiPageProps }
|
|
141
|
+
|
|
138
142
|
export declare type ChaiWebsiteSetting = {
|
|
139
143
|
fallbackLang: string;
|
|
140
144
|
languages: string[];
|
package/dist/server.js
CHANGED
|
@@ -1,23 +1,23 @@
|
|
|
1
1
|
var f = Object.defineProperty;
|
|
2
|
-
var b = (
|
|
3
|
-
var o = (
|
|
2
|
+
var b = (i, a, n) => a in i ? f(i, a, { enumerable: !0, configurable: !0, writable: !0, value: n }) : i[a] = n;
|
|
3
|
+
var o = (i, a, n) => b(i, typeof a != "symbol" ? a + "" : a, n);
|
|
4
4
|
import { isEmpty as g, get as w, first as S, has as E } from "lodash-es";
|
|
5
|
-
const h = {}, A = (
|
|
6
|
-
h[
|
|
7
|
-
},
|
|
8
|
-
h[
|
|
9
|
-
}, d = () => Object.values(h), l = (
|
|
10
|
-
let k = async (
|
|
11
|
-
...
|
|
5
|
+
const h = {}, A = (i, a) => {
|
|
6
|
+
h[i] = { key: i, ...a, hasSlug: !0 };
|
|
7
|
+
}, P = (i, a) => {
|
|
8
|
+
h[i] = { key: i, ...a, hasSlug: !1 };
|
|
9
|
+
}, d = () => Object.values(h), l = (i) => h[i];
|
|
10
|
+
let k = async (i) => ({
|
|
11
|
+
...i
|
|
12
12
|
});
|
|
13
|
-
const L = (
|
|
13
|
+
const L = (i) => k = i, m = async (i) => {
|
|
14
14
|
try {
|
|
15
|
-
return await k(
|
|
15
|
+
return await k(i);
|
|
16
16
|
} catch (a) {
|
|
17
17
|
return console.error(a), {};
|
|
18
18
|
}
|
|
19
19
|
};
|
|
20
|
-
class
|
|
20
|
+
class C {
|
|
21
21
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
22
22
|
async verifyTokenAndGetUser(a) {
|
|
23
23
|
return {
|
|
@@ -47,7 +47,7 @@ class P {
|
|
|
47
47
|
};
|
|
48
48
|
}
|
|
49
49
|
}
|
|
50
|
-
const
|
|
50
|
+
const p = {
|
|
51
51
|
ab: "Abkhazian",
|
|
52
52
|
aa: "Afar",
|
|
53
53
|
af: "Afrikaans",
|
|
@@ -241,14 +241,14 @@ class T {
|
|
|
241
241
|
o(this, "fallbackLang", "");
|
|
242
242
|
o(this, "currentLang", "");
|
|
243
243
|
o(this, "draftMode", !1);
|
|
244
|
-
o(this, "userMgmt", new
|
|
244
|
+
o(this, "userMgmt", new C());
|
|
245
245
|
this.backend = a, this._registerDefaultPageTypes();
|
|
246
246
|
}
|
|
247
247
|
_registerDefaultPageTypes() {
|
|
248
248
|
A("page", {
|
|
249
249
|
name: "Static Page",
|
|
250
250
|
icon: '<svg stroke="currentColor" fill="currentColor" stroke-width="0" viewBox="0 0 24 24" height="1em" width="1em" xmlns="http://www.w3.org/2000/svg"><path d="M5 8V20H19V8H5ZM5 6H19V4H5V6ZM20 22H4C3.44772 22 3 21.5523 3 21V3C3 2.44772 3.44772 2 4 2H20C20.5523 2 21 2.44772 21 3V21C21 21.5523 20.5523 22 20 22ZM7 10H11V14H7V10ZM7 16H17V18H7V16ZM13 11H17V13H13V11Z"></path></svg>'
|
|
251
|
-
}),
|
|
251
|
+
}), P("global", {
|
|
252
252
|
name: "Global Block",
|
|
253
253
|
helpText: "A global block can be reused in multiple pages.",
|
|
254
254
|
icon: '<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-globe w-4 h-4 text-slate-500 stroke-[1]"><circle cx="12" cy="12" r="10"></circle><path d="M12 2a14.5 14.5 0 0 0 0 20 14.5 14.5 0 0 0 0-20"></path><path d="M2 12h20"></path></svg>'
|
|
@@ -303,7 +303,8 @@ class T {
|
|
|
303
303
|
...r.dataProvider ? await r.dataProvider({
|
|
304
304
|
lang: a.data.lang,
|
|
305
305
|
draft: !0,
|
|
306
|
-
inBuilder: !0
|
|
306
|
+
inBuilder: !0,
|
|
307
|
+
pageProps: a.data.pageProps ?? {}
|
|
307
308
|
}) : {},
|
|
308
309
|
global: e
|
|
309
310
|
} : { global: e };
|
|
@@ -326,23 +327,23 @@ class T {
|
|
|
326
327
|
);
|
|
327
328
|
return e ? e.search ? await e.search(a.data.query) : this.backend.handleAction(a) : { error: "Page type not found" };
|
|
328
329
|
}
|
|
329
|
-
const
|
|
330
|
-
return this.emit(a.action,
|
|
330
|
+
const t = await this.backend.handleAction(a, n);
|
|
331
|
+
return this.emit(a.action, t), t;
|
|
331
332
|
}
|
|
332
333
|
emit(a, n) {
|
|
333
334
|
var r, s, c;
|
|
334
335
|
if (!["CREATE_PAGE", "UPDATE_PAGE", "DELETE_PAGE"].includes(a)) return;
|
|
335
|
-
const
|
|
336
|
-
if (!
|
|
337
|
-
const e = l(
|
|
336
|
+
const t = w(n, "page");
|
|
337
|
+
if (!t) return;
|
|
338
|
+
const e = l(t.pageType);
|
|
338
339
|
if (e)
|
|
339
340
|
switch (a) {
|
|
340
341
|
case "CREATE_PAGE":
|
|
341
|
-
return (r = e.onCreate) == null ? void 0 : r.call(e,
|
|
342
|
+
return (r = e.onCreate) == null ? void 0 : r.call(e, t);
|
|
342
343
|
case "UPDATE_PAGE":
|
|
343
|
-
return (s = e.onUpdate) == null ? void 0 : s.call(e,
|
|
344
|
+
return (s = e.onUpdate) == null ? void 0 : s.call(e, t);
|
|
344
345
|
case "DELETE_PAGE":
|
|
345
|
-
return (c = e.onDelete) == null ? void 0 : c.call(e,
|
|
346
|
+
return (c = e.onDelete) == null ? void 0 : c.call(e, t);
|
|
346
347
|
}
|
|
347
348
|
}
|
|
348
349
|
// APIS
|
|
@@ -352,14 +353,14 @@ class T {
|
|
|
352
353
|
"Please set a fallback language using setFallbackLang(lang: string)"
|
|
353
354
|
);
|
|
354
355
|
const n = S(a || [""]);
|
|
355
|
-
Object.keys(
|
|
356
|
+
Object.keys(p).includes(n) ? this.setCurrentLang(n) : this.setCurrentLang(this.getFallbackLang());
|
|
356
357
|
}
|
|
357
358
|
async resolveLink(a, n) {
|
|
358
|
-
const
|
|
359
|
-
if (!
|
|
359
|
+
const t = l(a);
|
|
360
|
+
if (!t)
|
|
360
361
|
return "/not-found";
|
|
361
362
|
const e = this.isDraftMode(), r = this.getCurrentLang();
|
|
362
|
-
return
|
|
363
|
+
return t.resolveLink ? await t.resolveLink(n, e, r) : await this.backend.handleAction({
|
|
363
364
|
action: "GET_LINK",
|
|
364
365
|
data: {
|
|
365
366
|
pageType: a,
|
|
@@ -370,19 +371,24 @@ class T {
|
|
|
370
371
|
});
|
|
371
372
|
}
|
|
372
373
|
async getPageBySlug(a) {
|
|
373
|
-
const n = this.isDraftMode(),
|
|
374
|
+
const n = this.isDraftMode(), t = {};
|
|
374
375
|
return d().forEach((e) => {
|
|
375
|
-
E(e, "dynamicSegments") && e.dynamicSegments && (
|
|
376
|
+
E(e, "dynamicSegments") && e.dynamicSegments && (t[e.key] = e.dynamicSegments);
|
|
376
377
|
}), await this.backend.handleAction({
|
|
377
378
|
action: "GET_PAGE_META",
|
|
378
|
-
data: { slug: a, draft: n, dynamicSegments:
|
|
379
|
+
data: { slug: a, draft: n, dynamicSegments: t }
|
|
379
380
|
});
|
|
380
381
|
}
|
|
381
382
|
async getFullPage(a) {
|
|
382
|
-
const n = this.isDraftMode(),
|
|
383
|
+
const n = this.isDraftMode(), t = this.getCurrentLang(), e = this.getFallbackLang();
|
|
383
384
|
return await this.backend.handleAction({
|
|
384
385
|
action: "GET_PAGE",
|
|
385
|
-
data: {
|
|
386
|
+
data: {
|
|
387
|
+
id: a,
|
|
388
|
+
lang: e === t ? void 0 : t,
|
|
389
|
+
draft: n,
|
|
390
|
+
mergePartials: !0
|
|
391
|
+
}
|
|
386
392
|
});
|
|
387
393
|
}
|
|
388
394
|
async getSiteSettings() {
|
|
@@ -392,15 +398,15 @@ class T {
|
|
|
392
398
|
data: { draft: a }
|
|
393
399
|
});
|
|
394
400
|
}
|
|
395
|
-
async getPageData(a, n
|
|
401
|
+
async getPageData(a, n) {
|
|
396
402
|
var u;
|
|
397
|
-
const
|
|
403
|
+
const t = this.isDraftMode(), e = this.getCurrentLang(), r = l(a), [s, c] = await Promise.all([
|
|
398
404
|
this.getGlobalData(),
|
|
399
405
|
((u = r == null ? void 0 : r.dataProvider) == null ? void 0 : u.call(r, {
|
|
400
406
|
lang: e,
|
|
401
|
-
draft:
|
|
407
|
+
draft: t,
|
|
402
408
|
inBuilder: !1,
|
|
403
|
-
|
|
409
|
+
pageProps: n
|
|
404
410
|
})) || Promise.resolve({})
|
|
405
411
|
]);
|
|
406
412
|
return r ? {
|
|
@@ -421,7 +427,7 @@ class T {
|
|
|
421
427
|
}
|
|
422
428
|
}
|
|
423
429
|
class G {
|
|
424
|
-
constructor(a = "", n =
|
|
430
|
+
constructor(a = "", n = y) {
|
|
425
431
|
this.apiKey = a, this.apiUrl = n;
|
|
426
432
|
}
|
|
427
433
|
async handleAction(a, n = "") {
|
|
@@ -448,17 +454,17 @@ class G {
|
|
|
448
454
|
})).json();
|
|
449
455
|
}
|
|
450
456
|
}
|
|
451
|
-
const
|
|
457
|
+
const y = "https://api.chaibuilder.com";
|
|
452
458
|
export {
|
|
453
|
-
|
|
459
|
+
y as API_URL,
|
|
454
460
|
T as ChaiBuilderPages,
|
|
455
461
|
G as ChaiBuilderPagesBackend,
|
|
456
|
-
|
|
457
|
-
|
|
462
|
+
C as ChaiBuilderPagesUserManagement,
|
|
463
|
+
p as LANGUAGES,
|
|
458
464
|
m as getChaiGlobalData,
|
|
459
465
|
l as getChaiPageType,
|
|
460
466
|
d as getChaiPageTypes,
|
|
461
467
|
L as registerChaiGlobalDataProvider,
|
|
462
468
|
A as registerChaiPageType,
|
|
463
|
-
|
|
469
|
+
P as registerChaiPartialType
|
|
464
470
|
};
|
package/package.json
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
"author": "Suraj Air",
|
|
4
4
|
"license": "Private",
|
|
5
5
|
"homepage": "https://chaibuilder.com",
|
|
6
|
-
"version": "0.3.
|
|
6
|
+
"version": "0.3.2",
|
|
7
7
|
"type": "module",
|
|
8
8
|
"files": [
|
|
9
9
|
"dist"
|
|
@@ -59,7 +59,7 @@
|
|
|
59
59
|
"test": "vitest"
|
|
60
60
|
},
|
|
61
61
|
"peerDependencies": {
|
|
62
|
-
"@chaibuilder/sdk": "2.2.
|
|
62
|
+
"@chaibuilder/sdk": "2.2.1",
|
|
63
63
|
"@types/react": "*",
|
|
64
64
|
"@types/react-dom": "*",
|
|
65
65
|
"react": "^18.0 || ^19.0",
|
|
@@ -77,8 +77,8 @@
|
|
|
77
77
|
}
|
|
78
78
|
},
|
|
79
79
|
"dependencies": {
|
|
80
|
-
"@chaibuilder/runtime": "2.0
|
|
81
|
-
"@chaibuilder/sdk": "2.2.
|
|
80
|
+
"@chaibuilder/runtime": "2.1.0",
|
|
81
|
+
"@chaibuilder/sdk": "2.2.1",
|
|
82
82
|
"@mhsdesign/jit-browser-tailwindcss": "^0.4.2",
|
|
83
83
|
"@tailwindcss/aspect-ratio": "^0.4.2",
|
|
84
84
|
"@tailwindcss/forms": "^0.5.10",
|