🧑‍💻 Add configurable ToS URLs

This commit is contained in:
Baptiste Arnaud 2025-02-24 17:20:42 +01:00
parent 481a338c7b
commit 8ad53debef
No known key found for this signature in database
3 changed files with 16 additions and 9 deletions

View File

@ -8,6 +8,7 @@ import {
useColorModeValue,
} from "@chakra-ui/react";
import { T, useTranslate } from "@tolgee/react";
import { env } from "@typebot.io/env";
import { useRouter } from "next/router";
import { SignInForm } from "./SignInForm";
@ -59,17 +60,15 @@ export const SignInPage = ({ type }: Props) => {
</Stack>
<SignInForm defaultEmail={query.g?.toString()} />
{type === "signup" ? (
{type === "signup" &&
env.NEXT_PUBLIC_TERMS_OF_SERVICE_URL &&
env.NEXT_PUBLIC_PRIVACY_POLICY_URL ? (
<Text fontSize="sm" maxW="330px" textAlign="center">
<T
keyName="auth.register.aggreeToTerms"
params={{
terms: (
<TextLink href={"https://typebot.io/terms-of-service"} />
),
privacy: (
<TextLink href={"https://typebot.io/privacy-policy"} />
),
terms: <TextLink href={env.NEXT_PUBLIC_TERMS_OF_SERVICE_URL} />,
privacy: <TextLink href={env.NEXT_PUBLIC_PRIVACY_POLICY_URL} />,
}}
/>
</Text>

View File

@ -13,7 +13,7 @@
],
"scripts": {
"prepare": "husky",
"pre-commit": "bun format-and-lint && bun lint-repo",
"pre-commit": "bun format-and-lint && bun lint-repo && turbo check-broken-links",
"format-and-lint": "biome check .",
"format-and-lint:fix": "biome check . --write",
"lint-repo": "sherif -r unordered-dependencies -r packages-without-package-json --ignore-package @typebot.io/legacy",

View File

@ -118,7 +118,7 @@ const baseEnv = {
NEXT_PUBLIC_ONBOARDING_TYPEBOT_ID: z.string().min(1).optional(),
NEXT_PUBLIC_BOT_FILE_UPLOAD_MAX_SIZE: z.coerce.number().optional(),
NEXT_PUBLIC_CHAT_API_URL: z.string().url().optional(),
// To remove to deploy chat API for all typebots
// TODO: To remove to deploy chat API for all typebots
NEXT_PUBLIC_USE_EXPERIMENTAL_CHAT_API_ON: z
.string()
.min(1)
@ -131,6 +131,8 @@ const baseEnv = {
.string()
.optional()
.default("The bot you're looking for doesn't exist"),
NEXT_PUBLIC_TERMS_OF_SERVICE_URL: z.string().url().optional(),
NEXT_PUBLIC_PRIVACY_POLICY_URL: z.string().url().optional(),
},
runtimeEnv: {
NEXT_PUBLIC_E2E_TEST: getRuntimeVariable("NEXT_PUBLIC_E2E_TEST"),
@ -151,6 +153,12 @@ const baseEnv = {
NEXT_PUBLIC_VIEWER_404_SUBTITLE: getRuntimeVariable(
"NEXT_PUBLIC_VIEWER_404_SUBTITLE",
),
NEXT_PUBLIC_TERMS_OF_SERVICE_URL: getRuntimeVariable(
"NEXT_PUBLIC_TERMS_OF_SERVICE_URL",
),
NEXT_PUBLIC_PRIVACY_POLICY_URL: getRuntimeVariable(
"NEXT_PUBLIC_PRIVACY_POLICY_URL",
),
},
};
const githubEnv = {