@duke333/builder-ui 0.1.5 → 0.2.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 +20 -39
- package/dist/admin/index.js +2 -0
- package/dist/admin/index.js.map +1 -1
- package/dist/api/index.d.ts +5 -2
- package/dist/api/index.js +9 -1
- package/dist/api/index.js.map +1 -1
- package/dist/components/index.js +2 -0
- package/dist/components/index.js.map +1 -1
- package/dist/hooks/index.js +2 -0
- package/dist/hooks/index.js.map +1 -1
- package/dist/index.d.ts +2211 -6
- package/dist/index.js +3501 -2793
- package/dist/index.js.map +1 -1
- package/dist/integration/index.d.ts +2 -0
- package/dist/integration/index.js +17 -2
- package/dist/integration/index.js.map +1 -1
- package/dist/styles.css +405 -0
- package/dist/styles.css.map +1 -0
- package/dist/styles.d.ts +2 -0
- package/package.json +10 -2
|
@@ -20,6 +20,7 @@ type BuilderIntegrationConfig = {
|
|
|
20
20
|
transport: BuilderApiTransport;
|
|
21
21
|
adminBasePath?: string;
|
|
22
22
|
runtimeBasePath?: string;
|
|
23
|
+
apiBasePath?: string;
|
|
23
24
|
adminPages?: Omit<BuilderAdminPagesOptions<BuilderAdminPageContracts>, "hooks" | "routes">;
|
|
24
25
|
permissions?: unknown;
|
|
25
26
|
triggers?: unknown;
|
|
@@ -46,6 +47,7 @@ declare function createBuilderPortalIntegration<C extends BuilderApiContracts>(c
|
|
|
46
47
|
declare function validateBuilderFrontendSetup(config: {
|
|
47
48
|
adminBasePath?: string;
|
|
48
49
|
runtimeBasePath?: string;
|
|
50
|
+
apiBasePath?: string;
|
|
49
51
|
transport?: unknown;
|
|
50
52
|
}): BuilderFrontendSetupValidation;
|
|
51
53
|
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
|
|
1
3
|
// src/api/createBuilderApiClient.ts
|
|
2
4
|
function queryParams(query) {
|
|
3
5
|
return { ...query };
|
|
@@ -9,7 +11,15 @@ function fieldOptionsQueryParams(query) {
|
|
|
9
11
|
}
|
|
10
12
|
return flatQuery;
|
|
11
13
|
}
|
|
12
|
-
function createBuilderApiClient(
|
|
14
|
+
function createBuilderApiClient(rootTransport, options = {}) {
|
|
15
|
+
const basePath = options.apiBasePath?.trim().replace(/\/+$/g, "") ?? "";
|
|
16
|
+
const path = (value) => `${basePath}${value}`;
|
|
17
|
+
const transport = {
|
|
18
|
+
get: (value, requestOptions) => rootTransport.get(path(value), requestOptions),
|
|
19
|
+
post: (value, body, requestOptions) => rootTransport.post(path(value), body, requestOptions),
|
|
20
|
+
patch: (value, body, requestOptions) => rootTransport.patch(path(value), body, requestOptions),
|
|
21
|
+
delete: (value, requestOptions) => rootTransport.delete(path(value), requestOptions)
|
|
22
|
+
};
|
|
13
23
|
return {
|
|
14
24
|
listBuilderForms: (query) => transport.get("/builder/forms", {
|
|
15
25
|
query: queryParams(query)
|
|
@@ -2232,7 +2242,7 @@ function withQuery(path, query) {
|
|
|
2232
2242
|
function createBuilderIntegration(config) {
|
|
2233
2243
|
const adminBasePath = normalizeBasePath(config.adminBasePath ?? "/admin/dev/builder");
|
|
2234
2244
|
const runtimeBasePath = normalizeBasePath(config.runtimeBasePath ?? "/admin/winu");
|
|
2235
|
-
const api = createBuilderApiClient(config.transport);
|
|
2245
|
+
const api = createBuilderApiClient(config.transport, { apiBasePath: config.apiBasePath });
|
|
2236
2246
|
const hooks = createBuilderHooks(api);
|
|
2237
2247
|
const formsPath = `${adminBasePath}/forms`;
|
|
2238
2248
|
const listsPath = `${adminBasePath}/lists`;
|
|
@@ -2282,6 +2292,11 @@ function validateBuilderFrontendSetup(config) {
|
|
|
2282
2292
|
name: "transport",
|
|
2283
2293
|
ok: Boolean(config.transport),
|
|
2284
2294
|
message: "API transport is required."
|
|
2295
|
+
},
|
|
2296
|
+
{
|
|
2297
|
+
name: "apiBasePath",
|
|
2298
|
+
ok: config.apiBasePath === void 0 || normalizeBasePath(config.apiBasePath).startsWith("/"),
|
|
2299
|
+
message: "apiBasePath must be an absolute API path."
|
|
2285
2300
|
}
|
|
2286
2301
|
].map((check) => check.ok ? { name: check.name, ok: true } : check);
|
|
2287
2302
|
return { ok: checks.every((check) => check.ok), checks };
|