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.
TypeScript accessibilityalternativecloudflarecloudflare-workersdesignfreefrontendopen-sourceradix-uireactremixweb-developmentwebflowwebsite-builderwebsite-developmentwebsiteswebstudio
feat: allow customizing default contact email (#3293)
Bogdan Chadkina54f2a457459
diff --git a/apps/builder/app/builder/features/project-settings/section-general.tsx b/apps/builder/app/builder/features/project-settings/section-general.tsxindex f489cdb84f..104adebda7 100644--- a/apps/builder/app/builder/features/project-settings/section-general.tsx+++ b/apps/builder/app/builder/features/project-settings/section-general.tsx@@ -1,3 +1,5 @@+import { z } from "zod";+import { useId, useState } from "react";import { useStore } from "@nanostores/react";import {Grid,@@ -10,13 +12,16 @@ import {CheckboxAndLabel,Checkbox,css,+ Flex,+ Tooltip,+ InputErrorsTooltip,} from "@webstudio-is/design-system";+import { InfoCircleIcon } from "@webstudio-is/icons";import { ImageControl } from "./image-control";-import { $assets, $imageLoader, $pages } from "~/shared/nano-states";import { Image } from "@webstudio-is/image";-import { useIds } from "~/shared/form-utils";import type { ProjectMeta, CompilerSettings } from "@webstudio-is/sdk";-import { useState } from "react";+import { $assets, $imageLoader, $pages } from "~/shared/nano-states";+import { useIds } from "~/shared/form-utils";import { serverSyncStore } from "~/shared/sync";import { sectionSpacing } from "./utils";import { CodeEditor } from "~/builder/shared/code-editor";@@ -32,15 +37,24 @@ const imgStyle = css({const defaultMetaSettings: ProjectMeta = {siteName: "",+ contactEmail: "",faviconAssetId: "",code: "",};+const Email = z.string().email();+export const SectionGeneral = () => {const [meta, setMeta] = useState(() => $pages.get()?.meta ?? defaultMetaSettings);- const ids = useIds(["siteName"]);+ const siteNameId = useId();+ const contactEmailId = useId();+ const contactEmailError =+ (meta.contactEmail ?? "").trim().length === 0 ||+ Email.safeParse(meta.contactEmail).success+ ? undefined+ : "Contact email is invalid.";const assets = useStore($assets);const asset = assets.get(meta.faviconAssetId ?? "");const favIconUrl = asset ? `${asset.name}` : undefined;@@ -65,21 +79,57 @@ export const SectionGeneral = () => {};return (- <>+ <Grid gap={2}>+ <Text variant="titles" css={sectionSpacing}>+ General+ </Text>+<Grid gap={1} css={sectionSpacing}>- <Text variant="titles">General</Text>- <Label htmlFor={ids.siteName}>Site Name</Label>+ <Flex gap={1} align="center">+ <Label htmlFor={siteNameId}>Site Name</Label>+ <Tooltip+ variant="wrapped"+ content="Used in search results and social previews."+ >+ <InfoCircleIcon tabIndex={0} />+ </Tooltip>+ </Flex><InputField- id={ids.siteName}+ id={siteNameId}+ placeholder="Current Site Name"+ autoFocus={true}value={meta.siteName ?? ""}onChange={(event) => {handleSave("siteName")(event.target.value);}}- placeholder="Current Site Name"- autoFocus/></Grid>+ <Grid gap={1} css={sectionSpacing}>+ <Flex gap={1} align="center">+ <Label htmlFor={contactEmailId}>Contact Email</Label>+ <Tooltip+ variant="wrapped"+ content="Used as the email recipient when submitting a webhook form without an action."+ >+ <InfoCircleIcon tabIndex={0} />+ </Tooltip>+ </Flex>+ <InputErrorsTooltip+ errors={contactEmailError ? [contactEmailError] : undefined}+ >+ <InputField+ id={contactEmailId}+ color={contactEmailError ? "error" : undefined}+ placeholder="[email protected]"+ value={meta.contactEmail ?? ""}+ onChange={(event) => {+ handleSave("contactEmail")(event.target.value);+ }}+ />+ </InputErrorsTooltip>+ </Grid>+<Separator /><Grid gap={2} css={sectionSpacing}>@@ -118,7 +168,7 @@ export const SectionGeneral = () => {<Separator /><CompilerSection />- </>+ </Grid>);};diff --git a/apps/builder/app/builder/features/project-settings/section-marketplace.tsx b/apps/builder/app/builder/features/project-settings/section-marketplace.tsxindex 617c972fa1..50016b975d 100644--- a/apps/builder/app/builder/features/project-settings/section-marketplace.tsx+++ b/apps/builder/app/builder/features/project-settings/section-marketplace.tsx@@ -167,9 +167,11 @@ export const SectionMarketplace = () => {};return (- <>+ <Grid gap={2}>+ <Text variant="titles" css={sectionSpacing}>+ Marketplace+ </Text><Grid gap={1} css={sectionSpacing}>- <Text variant="titles">Marketplace</Text><Label htmlFor={ids.name}>Product Name</Label><InputErrorsTooltip errors={errors?.name}><InputField@@ -350,6 +352,6 @@ export const SectionMarketplace = () => {</Button>)}</Flex>- </>+ </Grid>);};diff --git a/fixtures/webstudio-cloudflare-template/app/__generated__/_index.server.tsx b/fixtures/webstudio-cloudflare-template/app/__generated__/_index.server.tsxindex 4470a4f427..8add12c869 100644--- a/fixtures/webstudio-cloudflare-template/app/__generated__/_index.server.tsx+++ b/fixtures/webstudio-cloudflare-template/app/__generated__/_index.server.tsx@@ -37,8 +37,6 @@ export const getRemixParams = ({ ...params }: Params): Params => {export const projectId = "d845c167-ea07-4875-b08d-83e97c09dcce";-export const user: { email: string | null } | undefined = {- email: "[email protected]",-};+export const contactEmail = "[email protected]";export const customCode = "";diff --git a/fixtures/webstudio-cloudflare-template/app/routes/_index.tsx b/fixtures/webstudio-cloudflare-template/app/routes/_index.tsxindex 7e3ddebbeb..5ed3bcbb16 100644--- a/fixtures/webstudio-cloudflare-template/app/routes/_index.tsx+++ b/fixtures/webstudio-cloudflare-template/app/routes/_index.tsx@@ -26,7 +26,7 @@ import {getPageMeta,getRemixParams,projectId,- user,+ contactEmail,} from "../__generated__/_index.server";import css from "../__generated__/index.css?url";@@ -255,9 +255,7 @@ export const action = async ({ request, context }: ActionFunctionArgs) => {// form properties are not defined when defaults are usedconst { action, method } = formProperties ?? {};- const email = user?.email;-- if (email == null) {+ if (contactEmail === undefined) {return { success: false };}@@ -292,7 +290,7 @@ export const action = async ({ request, context }: ActionFunctionArgs) => {action: action ?? null,method: getMethod(method),pageUrl: pageUrl.toString(),- toEmail: email,+ toEmail: contactEmail,fromEmail: pageUrl.hostname + "@webstudio.email",} as const;diff --git a/fixtures/webstudio-custom-template/app/__generated__/[script-test]._index.server.tsx b/fixtures/webstudio-custom-template/app/__generated__/[script-test]._index.server.tsxindex 431ccaff7d..a0ef6e6c51 100644--- a/fixtures/webstudio-custom-template/app/__generated__/[script-test]._index.server.tsx+++ b/fixtures/webstudio-custom-template/app/__generated__/[script-test]._index.server.tsx@@ -37,9 +37,7 @@ export const getRemixParams = ({ ...params }: Params): Params => {export const projectId = "0d856812-61d8-4014-a20a-82e01c0eb8ee";-export const user: { email: string | null } | undefined = {- email: "[email protected]",-};+export const contactEmail = "[email protected]";export const customCode ='<script>console.log(\'HELLO\')</script>\n<meta property="saas:test" content="test">';diff --git a/fixtures/webstudio-custom-template/app/__generated__/[sitemap-html]._index.server.tsx b/fixtures/webstudio-custom-template/app/__generated__/[sitemap-html]._index.server.tsxindex fe8f6737c7..065bf11aa7 100644--- a/fixtures/webstudio-custom-template/app/__generated__/[sitemap-html]._index.server.tsx+++ b/fixtures/webstudio-custom-template/app/__generated__/[sitemap-html]._index.server.tsx@@ -63,9 +63,7 @@ export const getRemixParams = ({ ...params }: Params): Params => {export const projectId = "0d856812-61d8-4014-a20a-82e01c0eb8ee";-export const user: { email: string | null } | undefined = {- email: "[email protected]",-};+export const contactEmail = "[email protected]";export const customCode ='<script>console.log(\'HELLO\')</script>\n<meta property="saas:test" content="test">';diff --git a/fixtures/webstudio-custom-template/app/__generated__/[world]._index.server.tsx b/fixtures/webstudio-custom-template/app/__generated__/[world]._index.server.tsxindex 8eb96562d9..1d4ce43b9c 100644--- a/fixtures/webstudio-custom-template/app/__generated__/[world]._index.server.tsx+++ b/fixtures/webstudio-custom-template/app/__generated__/[world]._index.server.tsx@@ -37,9 +37,7 @@ export const getRemixParams = ({ ...params }: Params): Params => {export const projectId = "0d856812-61d8-4014-a20a-82e01c0eb8ee";-export const user: { email: string | null } | undefined = {- email: "[email protected]",-};+export const contactEmail = "[email protected]";export const customCode ='<script>console.log(\'HELLO\')</script>\n<meta property="saas:test" content="test">';diff --git a/fixtures/webstudio-custom-template/app/__generated__/_index.server.tsx b/fixtures/webstudio-custom-template/app/__generated__/_index.server.tsxindex 4422864176..8d4a3ceb0a 100644--- a/fixtures/webstudio-custom-template/app/__generated__/_index.server.tsx+++ b/fixtures/webstudio-custom-template/app/__generated__/_index.server.tsx@@ -37,9 +37,7 @@ export const getRemixParams = ({ ...params }: Params): Params => {export const projectId = "0d856812-61d8-4014-a20a-82e01c0eb8ee";-export const user: { email: string | null } | undefined = {- email: "[email protected]",-};+export const contactEmail = "[email protected]";export const customCode ='<script>console.log(\'HELLO\')</script>\n<meta property="saas:test" content="test">';diff --git a/fixtures/webstudio-custom-template/app/routes/[script-test]._index.tsx b/fixtures/webstudio-custom-template/app/routes/[script-test]._index.tsxindex 178b053d8b..05ee991c11 100644--- a/fixtures/webstudio-custom-template/app/routes/[script-test]._index.tsx+++ b/fixtures/webstudio-custom-template/app/routes/[script-test]._index.tsx@@ -26,7 +26,7 @@ import {getPageMeta,getRemixParams,projectId,- user,+ contactEmail,} from "../__generated__/[script-test]._index.server";import css from "../__generated__/index.css?url";@@ -255,9 +255,7 @@ export const action = async ({ request, context }: ActionFunctionArgs) => {// form properties are not defined when defaults are usedconst { action, method } = formProperties ?? {};- const email = user?.email;-- if (email == null) {+ if (contactEmail === undefined) {return { success: false };}@@ -292,7 +290,7 @@ export const action = async ({ request, context }: ActionFunctionArgs) => {action: action ?? null,method: getMethod(method),pageUrl: pageUrl.toString(),- toEmail: email,+ toEmail: contactEmail,fromEmail: pageUrl.hostname + "@webstudio.email",} as const;diff --git a/fixtures/webstudio-custom-template/app/routes/[sitemap-html]._index.tsx b/fixtures/webstudio-custom-template/app/routes/[sitemap-html]._index.tsxindex 36f6c6f55a..1bc27c25b7 100644--- a/fixtures/webstudio-custom-template/app/routes/[sitemap-html]._index.tsx+++ b/fixtures/webstudio-custom-template/app/routes/[sitemap-html]._index.tsx@@ -26,7 +26,7 @@ import {getPageMeta,getRemixParams,projectId,- user,+ contactEmail,} from "../__generated__/[sitemap-html]._index.server";import css from "../__generated__/index.css?url";@@ -255,9 +255,7 @@ export const action = async ({ request, context }: ActionFunctionArgs) => {// form properties are not defined when defaults are usedconst { action, method } = formProperties ?? {};- const email = user?.email;-- if (email == null) {+ if (contactEmail === undefined) {return { success: false };}@@ -292,7 +290,7 @@ export const action = async ({ request, context }: ActionFunctionArgs) => {action: action ?? null,method: getMethod(method),pageUrl: pageUrl.toString(),- toEmail: email,+ toEmail: contactEmail,fromEmail: pageUrl.hostname + "@webstudio.email",} as const;diff --git a/fixtures/webstudio-custom-template/app/routes/[world]._index.tsx b/fixtures/webstudio-custom-template/app/routes/[world]._index.tsxindex bf0574fa48..0894462f43 100644--- a/fixtures/webstudio-custom-template/app/routes/[world]._index.tsx+++ b/fixtures/webstudio-custom-template/app/routes/[world]._index.tsx@@ -26,7 +26,7 @@ import {getPageMeta,getRemixParams,projectId,- user,+ contactEmail,} from "../__generated__/[world]._index.server";import css from "../__generated__/index.css?url";@@ -255,9 +255,7 @@ export const action = async ({ request, context }: ActionFunctionArgs) => {// form properties are not defined when defaults are usedconst { action, method } = formProperties ?? {};- const email = user?.email;-- if (email == null) {+ if (contactEmail === undefined) {return { success: false };}@@ -292,7 +290,7 @@ export const action = async ({ request, context }: ActionFunctionArgs) => {action: action ?? null,method: getMethod(method),pageUrl: pageUrl.toString(),- toEmail: email,+ toEmail: contactEmail,fromEmail: pageUrl.hostname + "@webstudio.email",} as const;diff --git a/fixtures/webstudio-custom-template/app/routes/_index.tsx b/fixtures/webstudio-custom-template/app/routes/_index.tsxindex 7e3ddebbeb..5ed3bcbb16 100644--- a/fixtures/webstudio-custom-template/app/routes/_index.tsx+++ b/fixtures/webstudio-custom-template/app/routes/_index.tsx@@ -26,7 +26,7 @@ import {getPageMeta,getRemixParams,projectId,- user,+ contactEmail,} from "../__generated__/_index.server";import css from "../__generated__/index.css?url";@@ -255,9 +255,7 @@ export const action = async ({ request, context }: ActionFunctionArgs) => {// form properties are not defined when defaults are usedconst { action, method } = formProperties ?? {};- const email = user?.email;-- if (email == null) {+ if (contactEmail === undefined) {return { success: false };}@@ -292,7 +290,7 @@ export const action = async ({ request, context }: ActionFunctionArgs) => {action: action ?? null,method: getMethod(method),pageUrl: pageUrl.toString(),- toEmail: email,+ toEmail: contactEmail,fromEmail: pageUrl.hostname + "@webstudio.email",} as const;diff --git a/fixtures/webstudio-remix-netlify-edge-functions/app/__generated__/_index.server.tsx b/fixtures/webstudio-remix-netlify-edge-functions/app/__generated__/_index.server.tsxindex 4470a4f427..8add12c869 100644--- a/fixtures/webstudio-remix-netlify-edge-functions/app/__generated__/_index.server.tsx+++ b/fixtures/webstudio-remix-netlify-edge-functions/app/__generated__/_index.server.tsx@@ -37,8 +37,6 @@ export const getRemixParams = ({ ...params }: Params): Params => {export const projectId = "d845c167-ea07-4875-b08d-83e97c09dcce";-export const user: { email: string | null } | undefined = {- email: "[email protected]",-};+export const contactEmail = "[email protected]";export const customCode = "";diff --git a/fixtures/webstudio-remix-netlify-edge-functions/app/routes/_index.tsx b/fixtures/webstudio-remix-netlify-edge-functions/app/routes/_index.tsxindex 7e3ddebbeb..5ed3bcbb16 100644--- a/fixtures/webstudio-remix-netlify-edge-functions/app/routes/_index.tsx+++ b/fixtures/webstudio-remix-netlify-edge-functions/app/routes/_index.tsx@@ -26,7 +26,7 @@ import {getPageMeta,getRemixParams,projectId,- user,+ contactEmail,} from "../__generated__/_index.server";import css from "../__generated__/index.css?url";@@ -255,9 +255,7 @@ export const action = async ({ request, context }: ActionFunctionArgs) => {// form properties are not defined when defaults are usedconst { action, method } = formProperties ?? {};- const email = user?.email;-- if (email == null) {+ if (contactEmail === undefined) {return { success: false };}@@ -292,7 +290,7 @@ export const action = async ({ request, context }: ActionFunctionArgs) => {action: action ?? null,method: getMethod(method),pageUrl: pageUrl.toString(),- toEmail: email,+ toEmail: contactEmail,fromEmail: pageUrl.hostname + "@webstudio.email",} as const;diff --git a/fixtures/webstudio-remix-netlify-functions/app/__generated__/_index.server.tsx b/fixtures/webstudio-remix-netlify-functions/app/__generated__/_index.server.tsxindex 4470a4f427..8add12c869 100644--- a/fixtures/webstudio-remix-netlify-functions/app/__generated__/_index.server.tsx+++ b/fixtures/webstudio-remix-netlify-functions/app/__generated__/_index.server.tsx@@ -37,8 +37,6 @@ export const getRemixParams = ({ ...params }: Params): Params => {export const projectId = "d845c167-ea07-4875-b08d-83e97c09dcce";-export const user: { email: string | null } | undefined = {- email: "[email protected]",-};+export const contactEmail = "[email protected]";export const customCode = "";diff --git a/fixtures/webstudio-remix-netlify-functions/app/routes/_index.tsx b/fixtures/webstudio-remix-netlify-functions/app/routes/_index.tsxindex 7e3ddebbeb..5ed3bcbb16 100644--- a/fixtures/webstudio-remix-netlify-functions/app/routes/_index.tsx+++ b/fixtures/webstudio-remix-netlify-functions/app/routes/_index.tsx@@ -26,7 +26,7 @@ import {getPageMeta,getRemixParams,projectId,- user,+ contactEmail,} from "../__generated__/_index.server";import css from "../__generated__/index.css?url";@@ -255,9 +255,7 @@ export const action = async ({ request, context }: ActionFunctionArgs) => {// form properties are not defined when defaults are usedconst { action, method } = formProperties ?? {};- const email = user?.email;-- if (email == null) {+ if (contactEmail === undefined) {return { success: false };}@@ -292,7 +290,7 @@ export const action = async ({ request, context }: ActionFunctionArgs) => {action: action ?? null,method: getMethod(method),pageUrl: pageUrl.toString(),- toEmail: email,+ toEmail: contactEmail,fromEmail: pageUrl.hostname + "@webstudio.email",} as const;diff --git a/fixtures/webstudio-remix-vercel/app/__generated__/[_route_with_symbols_]._index.server.tsx b/fixtures/webstudio-remix-vercel/app/__generated__/[_route_with_symbols_]._index.server.tsxindex 2cb9318f31..e424b9eda4 100644--- a/fixtures/webstudio-remix-vercel/app/__generated__/[_route_with_symbols_]._index.server.tsx+++ b/fixtures/webstudio-remix-vercel/app/__generated__/[_route_with_symbols_]._index.server.tsx@@ -37,8 +37,6 @@ export const getRemixParams = ({ ...params }: Params): Params => {export const projectId = "cddc1d44-af37-4cb6-a430-d300cf6f932d";-export const user: { email: string | null } | undefined = {- email: "[email protected]",-};+export const contactEmail = "[email protected]";export const customCode = "<script>console.log('KittyGuardedZone')</script>";diff --git a/fixtures/webstudio-remix-vercel/app/__generated__/[form]._index.server.tsx b/fixtures/webstudio-remix-vercel/app/__generated__/[form]._index.server.tsxindex b9cb201bb3..bff101d531 100644--- a/fixtures/webstudio-remix-vercel/app/__generated__/[form]._index.server.tsx+++ b/fixtures/webstudio-remix-vercel/app/__generated__/[form]._index.server.tsx@@ -39,8 +39,6 @@ export const getRemixParams = ({ ...params }: Params): Params => {export const projectId = "cddc1d44-af37-4cb6-a430-d300cf6f932d";-export const user: { email: string | null } | undefined = {- email: "[email protected]",-};+export const contactEmail = "[email protected]";export const customCode = "<script>console.log('KittyGuardedZone')</script>";diff --git a/fixtures/webstudio-remix-vercel/app/__generated__/[heading-with-id]._index.server.tsx b/fixtures/webstudio-remix-vercel/app/__generated__/[heading-with-id]._index.server.tsxindex d8e308e4da..7f36e291ad 100644--- a/fixtures/webstudio-remix-vercel/app/__generated__/[heading-with-id]._index.server.tsx+++ b/fixtures/webstudio-remix-vercel/app/__generated__/[heading-with-id]._index.server.tsx@@ -37,8 +37,6 @@ export const getRemixParams = ({ ...params }: Params): Params => {export const projectId = "cddc1d44-af37-4cb6-a430-d300cf6f932d";-export const user: { email: string | null } | undefined = {- email: "[email protected]",-};+export const contactEmail = "[email protected]";export const customCode = "<script>console.log('KittyGuardedZone')</script>";diff --git a/fixtures/webstudio-remix-vercel/app/__generated__/[nested].[nested-page]._index.server.tsx b/fixtures/webstudio-remix-vercel/app/__generated__/[nested].[nested-page]._index.server.tsxindex ba310340b1..9ae50e09a5 100644--- a/fixtures/webstudio-remix-vercel/app/__generated__/[nested].[nested-page]._index.server.tsx+++ b/fixtures/webstudio-remix-vercel/app/__generated__/[nested].[nested-page]._index.server.tsx@@ -37,8 +37,6 @@ export const getRemixParams = ({ ...params }: Params): Params => {export const projectId = "cddc1d44-af37-4cb6-a430-d300cf6f932d";-export const user: { email: string | null } | undefined = {- email: "[email protected]",-};+export const contactEmail = "[email protected]";export const customCode = "<script>console.log('KittyGuardedZone')</script>";diff --git a/fixtures/webstudio-remix-vercel/app/__generated__/[radix]._index.server.tsx b/fixtures/webstudio-remix-vercel/app/__generated__/[radix]._index.server.tsxindex 5e1e108ad1..46f649235e 100644--- a/fixtures/webstudio-remix-vercel/app/__generated__/[radix]._index.server.tsx+++ b/fixtures/webstudio-remix-vercel/app/__generated__/[radix]._index.server.tsx@@ -38,8 +38,6 @@ export const getRemixParams = ({ ...params }: Params): Params => {export const projectId = "cddc1d44-af37-4cb6-a430-d300cf6f932d";-export const user: { email: string | null } | undefined = {- email: "[email protected]",-};+export const contactEmail = "[email protected]";export const customCode = "<script>console.log('KittyGuardedZone')</script>";diff --git a/fixtures/webstudio-remix-vercel/app/__generated__/[resources]._index.server.tsx b/fixtures/webstudio-remix-vercel/app/__generated__/[resources]._index.server.tsxindex f5fe8a7e83..2e54f03c1f 100644--- a/fixtures/webstudio-remix-vercel/app/__generated__/[resources]._index.server.tsx+++ b/fixtures/webstudio-remix-vercel/app/__generated__/[resources]._index.server.tsx@@ -63,8 +63,6 @@ export const getRemixParams = ({ ...params }: Params): Params => {export const projectId = "cddc1d44-af37-4cb6-a430-d300cf6f932d";-export const user: { email: string | null } | undefined = {- email: "[email protected]",-};+export const contactEmail = "[email protected]";export const customCode = "<script>console.log('KittyGuardedZone')</script>";diff --git a/fixtures/webstudio-remix-vercel/app/__generated__/_index.server.tsx b/fixtures/webstudio-remix-vercel/app/__generated__/_index.server.tsxindex dd0baef2b7..f8c92b5fa9 100644--- a/fixtures/webstudio-remix-vercel/app/__generated__/_index.server.tsx+++ b/fixtures/webstudio-remix-vercel/app/__generated__/_index.server.tsx@@ -43,8 +43,6 @@ export const getRemixParams = ({ ...params }: Params): Params => {export const projectId = "cddc1d44-af37-4cb6-a430-d300cf6f932d";-export const user: { email: string | null } | undefined = {- email: "[email protected]",-};+export const contactEmail = "[email protected]";export const customCode = "<script>console.log('KittyGuardedZone')</script>";diff --git a/fixtures/webstudio-remix-vercel/app/routes/[_route_with_symbols_]._index.tsx b/fixtures/webstudio-remix-vercel/app/routes/[_route_with_symbols_]._index.tsxindex 41e5f96f42..000e76941c 100644--- a/fixtures/webstudio-remix-vercel/app/routes/[_route_with_symbols_]._index.tsx+++ b/fixtures/webstudio-remix-vercel/app/routes/[_route_with_symbols_]._index.tsx@@ -26,7 +26,7 @@ import {getPageMeta,getRemixParams,projectId,- user,+ contactEmail,} from "../__generated__/[_route_with_symbols_]._index.server";import css from "../__generated__/index.css?url";@@ -255,9 +255,7 @@ export const action = async ({ request, context }: ActionFunctionArgs) => {// form properties are not defined when defaults are usedconst { action, method } = formProperties ?? {};- const email = user?.email;-- if (email == null) {+ if (contactEmail === undefined) {return { success: false };}@@ -292,7 +290,7 @@ export const action = async ({ request, context }: ActionFunctionArgs) => {action: action ?? null,method: getMethod(method),pageUrl: pageUrl.toString(),- toEmail: email,+ toEmail: contactEmail,fromEmail: pageUrl.hostname + "@webstudio.email",} as const;diff --git a/fixtures/webstudio-remix-vercel/app/routes/[form]._index.tsx b/fixtures/webstudio-remix-vercel/app/routes/[form]._index.tsxindex 41410de1cf..e9f7107686 100644--- a/fixtures/webstudio-remix-vercel/app/routes/[form]._index.tsx+++ b/fixtures/webstudio-remix-vercel/app/routes/[form]._index.tsx@@ -26,7 +26,7 @@ import {getPageMeta,getRemixParams,projectId,- user,+ contactEmail,} from "../__generated__/[form]._index.server";import css from "../__generated__/index.css?url";@@ -255,9 +255,7 @@ export const action = async ({ request, context }: ActionFunctionArgs) => {// form properties are not defined when defaults are usedconst { action, method } = formProperties ?? {};- const email = user?.email;-- if (email == null) {+ if (contactEmail === undefined) {return { success: false };}@@ -292,7 +290,7 @@ export const action = async ({ request, context }: ActionFunctionArgs) => {action: action ?? null,method: getMethod(method),pageUrl: pageUrl.toString(),- toEmail: email,+ toEmail: contactEmail,fromEmail: pageUrl.hostname + "@webstudio.email",} as const;diff --git a/fixtures/webstudio-remix-vercel/app/routes/[heading-with-id]._index.tsx b/fixtures/webstudio-remix-vercel/app/routes/[heading-with-id]._index.tsxindex af30d5a775..184b0966d3 100644--- a/fixtures/webstudio-remix-vercel/app/routes/[heading-with-id]._index.tsx+++ b/fixtures/webstudio-remix-vercel/app/routes/[heading-with-id]._index.tsx@@ -26,7 +26,7 @@ import {getPageMeta,getRemixParams,projectId,- user,+ contactEmail,} from "../__generated__/[heading-with-id]._index.server";import css from "../__generated__/index.css?url";@@ -255,9 +255,7 @@ export const action = async ({ request, context }: ActionFunctionArgs) => {// form properties are not defined when defaults are usedconst { action, method } = formProperties ?? {};- const email = user?.email;-- if (email == null) {+ if (contactEmail === undefined) {return { success: false };}@@ -292,7 +290,7 @@ export const action = async ({ request, context }: ActionFunctionArgs) => {action: action ?? null,method: getMethod(method),pageUrl: pageUrl.toString(),- toEmail: email,+ toEmail: contactEmail,fromEmail: pageUrl.hostname + "@webstudio.email",} as const;diff --git a/fixtures/webstudio-remix-vercel/app/routes/[nested].[nested-page]._index.tsx b/fixtures/webstudio-remix-vercel/app/routes/[nested].[nested-page]._index.tsxindex baa48c53f0..ba9909169c 100644--- a/fixtures/webstudio-remix-vercel/app/routes/[nested].[nested-page]._index.tsx+++ b/fixtures/webstudio-remix-vercel/app/routes/[nested].[nested-page]._index.tsx@@ -26,7 +26,7 @@ import {getPageMeta,getRemixParams,projectId,- user,+ contactEmail,} from "../__generated__/[nested].[nested-page]._index.server";import css from "../__generated__/index.css?url";@@ -255,9 +255,7 @@ export const action = async ({ request, context }: ActionFunctionArgs) => {// form properties are not defined when defaults are usedconst { action, method } = formProperties ?? {};- const email = user?.email;-- if (email == null) {+ if (contactEmail === undefined) {return { success: false };}@@ -292,7 +290,7 @@ export const action = async ({ request, context }: ActionFunctionArgs) => {action: action ?? null,method: getMethod(method),pageUrl: pageUrl.toString(),- toEmail: email,+ toEmail: contactEmail,fromEmail: pageUrl.hostname + "@webstudio.email",} as const;diff --git a/fixtures/webstudio-remix-vercel/app/routes/[radix]._index.tsx b/fixtures/webstudio-remix-vercel/app/routes/[radix]._index.tsxindex a39cb5d5c3..ec310daad4 100644--- a/fixtures/webstudio-remix-vercel/app/routes/[radix]._index.tsx+++ b/fixtures/webstudio-remix-vercel/app/routes/[radix]._index.tsx@@ -26,7 +26,7 @@ import {getPageMeta,getRemixParams,projectId,- user,+ contactEmail,} from "../__generated__/[radix]._index.server";import css from "../__generated__/index.css?url";@@ -255,9 +255,7 @@ export const action = async ({ request, context }: ActionFunctionArgs) => {// form properties are not defined when defaults are usedconst { action, method } = formProperties ?? {};- const email = user?.email;-- if (email == null) {+ if (contactEmail === undefined) {return { success: false };}@@ -292,7 +290,7 @@ export const action = async ({ request, context }: ActionFunctionArgs) => {action: action ?? null,method: getMethod(method),pageUrl: pageUrl.toString(),- toEmail: email,+ toEmail: contactEmail,fromEmail: pageUrl.hostname + "@webstudio.email",} as const;diff --git a/fixtures/webstudio-remix-vercel/app/routes/[resources]._index.tsx b/fixtures/webstudio-remix-vercel/app/routes/[resources]._index.tsxindex 6628ee354d..b7289a4c83 100644--- a/fixtures/webstudio-remix-vercel/app/routes/[resources]._index.tsx+++ b/fixtures/webstudio-remix-vercel/app/routes/[resources]._index.tsx@@ -26,7 +26,7 @@ import {getPageMeta,getRemixParams,projectId,- user,+ contactEmail,} from "../__generated__/[resources]._index.server";import css from "../__generated__/index.css?url";@@ -255,9 +255,7 @@ export const action = async ({ request, context }: ActionFunctionArgs) => {// form properties are not defined when defaults are usedconst { action, method } = formProperties ?? {};- const email = user?.email;-- if (email == null) {+ if (contactEmail === undefined) {return { success: false };}@@ -292,7 +290,7 @@ export const action = async ({ request, context }: ActionFunctionArgs) => {action: action ?? null,method: getMethod(method),pageUrl: pageUrl.toString(),- toEmail: email,+ toEmail: contactEmail,fromEmail: pageUrl.hostname + "@webstudio.email",} as const;diff --git a/fixtures/webstudio-remix-vercel/app/routes/_index.tsx b/fixtures/webstudio-remix-vercel/app/routes/_index.tsxindex 7e3ddebbeb..5ed3bcbb16 100644--- a/fixtures/webstudio-remix-vercel/app/routes/_index.tsx+++ b/fixtures/webstudio-remix-vercel/app/routes/_index.tsx@@ -26,7 +26,7 @@ import {getPageMeta,getRemixParams,projectId,- user,+ contactEmail,} from "../__generated__/_index.server";import css from "../__generated__/index.css?url";@@ -255,9 +255,7 @@ export const action = async ({ request, context }: ActionFunctionArgs) => {// form properties are not defined when defaults are usedconst { action, method } = formProperties ?? {};- const email = user?.email;-- if (email == null) {+ if (contactEmail === undefined) {return { success: false };}@@ -292,7 +290,7 @@ export const action = async ({ request, context }: ActionFunctionArgs) => {action: action ?? null,method: getMethod(method),pageUrl: pageUrl.toString(),- toEmail: email,+ toEmail: contactEmail,fromEmail: pageUrl.hostname + "@webstudio.email",} as const;diff --git a/packages/cli/__generated__/_index.server.tsx b/packages/cli/__generated__/_index.server.tsxindex 1dc40fd9b8..9a6907ed0c 100644--- a/packages/cli/__generated__/_index.server.tsx+++ b/packages/cli/__generated__/_index.server.tsx@@ -30,8 +30,6 @@ export const getRemixParams = ({ ...params }: Params): Params => {export const projectId = "project-id";-export const user: { email: string | null } | undefined = {- email: "email@domain",-};+export const contactEmail: undefined | string = undefined;export const customCode = "";diff --git a/packages/cli/src/prebuild.ts b/packages/cli/src/prebuild.tsindex a0fe3be5cd..22f88654cb 100644--- a/packages/cli/src/prebuild.ts+++ b/packages/cli/src/prebuild.ts@@ -581,6 +581,9 @@ export const prebuild = async (options: {});const projectMeta = siteData.build.pages.meta;+ const contactEmail: undefined | string =+ // fallback to user email when contact email is empty string+ projectMeta?.contactEmail || siteData.user?.email || undefined;const pageMeta = pageData.page.meta;const favIconAsset = assets.get(projectMeta?.faviconAssetId ?? "");const socialImageAsset = assets.get(pageMeta.socialImageAssetId ?? "");@@ -636,8 +639,7 @@ ${generateRemixParams(pageData.page.path)}export const projectId = "${siteData.build.projectId}";-export const user: { email: string | null } | undefined =- ${JSON.stringify(siteData.user)};+export const contactEmail = ${JSON.stringify(contactEmail)};export const customCode = ${JSON.stringify(projectMeta?.code?.trim() ?? "")};`;diff --git a/packages/cli/templates/defaults/app/routes/template.tsx b/packages/cli/templates/defaults/app/routes/template.tsxindex 0dce0c2ea9..2a32792599 100644--- a/packages/cli/templates/defaults/app/routes/template.tsx+++ b/packages/cli/templates/defaults/app/routes/template.tsx@@ -26,7 +26,7 @@ import {getPageMeta,getRemixParams,projectId,- user,+ contactEmail,} from "../../../../__generated__/_index.server";import css from "../__generated__/index.css?url";@@ -255,9 +255,7 @@ export const action = async ({ request, context }: ActionFunctionArgs) => {// form properties are not defined when defaults are usedconst { action, method } = formProperties ?? {};- const email = user?.email;-- if (email == null) {+ if (contactEmail === undefined) {return { success: false };}@@ -292,7 +290,7 @@ export const action = async ({ request, context }: ActionFunctionArgs) => {action: action ?? null,method: getMethod(method),pageUrl: pageUrl.toString(),- toEmail: email,+ toEmail: contactEmail,fromEmail: pageUrl.hostname + "@webstudio.email",} as const;diff --git a/packages/sdk/src/schema/pages.ts b/packages/sdk/src/schema/pages.tsindex 29fa3e5e6f..6e86756d7f 100644--- a/packages/sdk/src/schema/pages.ts+++ b/packages/sdk/src/schema/pages.ts@@ -108,6 +108,7 @@ const Page = z.object({const ProjectMeta = z.object({// All fields are optional to ensure consistency and allow for the addition of new fields without requiring migrationsiteName: z.string().optional(),+ contactEmail: z.string().optional(),faviconAssetId: z.string().optional(),code: z.string().optional(),});