Skip to content

Open source website builder and Webflow alternative. Webstudio is an advanced visual builder that connects to any headless CMS, supports all CSS properties, and can be hosted anywhere, including with us.

fix: export type BuildParams

Andras Bacsai07e81efeef46
diff --git a/apps/designer/app/shared/router-utils/build-params.ts b/apps/designer/app/shared/router-utils/build-params.ts
index 8ea2e18969..276c85d682 100644
--- a/apps/designer/app/shared/router-utils/build-params.ts
+++ b/apps/designer/app/shared/router-utils/build-params.ts
@@ -2,6 +2,27 @@
// "Build" means user generated content — what user builds.
export type BuildMode = "edit" | "preview" | "published";
+export type BuildParams =
+ | {
+ projectId: string;
+ mode: BuildMode;
+ pathname: string;
+ pageId?: string;
+ }
+ | {
+ projectDomain: string;
+ mode: BuildMode;
+ pathname: string;
+ pageId?: string;
+ }
+ | undefined;
+
+// A subtype of Request. To make testing easier.
+type MinimalRequest = {
+ url: string;
+ headers: { get: (name: string) => string | null };
+};
+
const modes = ["edit", "preview", "published"] as BuildMode[];
const getMode = (url: URL): BuildMode => {
const modeParam = url.searchParams.get("mode");
@@ -13,12 +34,6 @@ const getMode = (url: URL): BuildMode => {
return mode;
};
-// A subtype of Request. To make testing easier.
-type MinimalRequest = {
- url: string;
- headers: { get: (name: string) => string | null };
-};
-
const getRequestHost = (request: MinimalRequest): string =>
request.headers.get("x-forwarded-host") || request.headers.get("host") || "";