🚸 (share) Hide custom domain dropdown when env isn't configured
Related to #269
This commit is contained in:
@ -21,7 +21,7 @@ import {
|
|||||||
Text,
|
Text,
|
||||||
} from '@chakra-ui/react'
|
} from '@chakra-ui/react'
|
||||||
import { Plan } from 'db'
|
import { Plan } from 'db'
|
||||||
import { isDefined, getViewerUrl, isNotDefined } from 'utils'
|
import { isDefined, getViewerUrl, isNotDefined, env } from 'utils'
|
||||||
import { isPublicDomainAvailableQuery } from '../queries/isPublicDomainAvailableQuery'
|
import { isPublicDomainAvailableQuery } from '../queries/isPublicDomainAvailableQuery'
|
||||||
import { parseDefaultPublicId } from '../utils'
|
import { parseDefaultPublicId } from '../utils'
|
||||||
import { EditableUrl } from './EditableUrl'
|
import { EditableUrl } from './EditableUrl'
|
||||||
@ -122,7 +122,8 @@ export const SharePage = () => {
|
|||||||
/>
|
/>
|
||||||
</HStack>
|
</HStack>
|
||||||
)}
|
)}
|
||||||
{isNotDefined(typebot?.customDomain) ? (
|
{isNotDefined(typebot?.customDomain) &&
|
||||||
|
env('VERCEL_VIEWER_PROJECT_NAME') ? (
|
||||||
<>
|
<>
|
||||||
{isProPlan(workspace) ? (
|
{isProPlan(workspace) ? (
|
||||||
<CustomDomainsDropdown
|
<CustomDomainsDropdown
|
||||||
|
@ -52,7 +52,7 @@ const handler = async (req: NextApiRequest, res: NextApiResponse) => {
|
|||||||
|
|
||||||
const createDomainOnVercel = (name: string) =>
|
const createDomainOnVercel = (name: string) =>
|
||||||
got.post({
|
got.post({
|
||||||
url: `https://api.vercel.com/v8/projects/${process.env.VERCEL_VIEWER_PROJECT_NAME}/domains?teamId=${process.env.VERCEL_TEAM_ID}`,
|
url: `https://api.vercel.com/v8/projects/${process.env.NEXT_PUBLIC_VERCEL_VIEWER_PROJECT_NAME}/domains?teamId=${process.env.VERCEL_TEAM_ID}`,
|
||||||
headers: { Authorization: `Bearer ${process.env.VERCEL_TOKEN}` },
|
headers: { Authorization: `Bearer ${process.env.VERCEL_TOKEN}` },
|
||||||
json: { name },
|
json: { name },
|
||||||
})
|
})
|
||||||
|
@ -27,7 +27,7 @@ const handler = async (req: NextApiRequest, res: NextApiResponse) => {
|
|||||||
|
|
||||||
const deleteDomainOnVercel = (name: string) =>
|
const deleteDomainOnVercel = (name: string) =>
|
||||||
got.delete({
|
got.delete({
|
||||||
url: `https://api.vercel.com/v8/projects/${process.env.VERCEL_VIEWER_PROJECT_NAME}/domains/${name}?teamId=${process.env.VERCEL_TEAM_ID}`,
|
url: `https://api.vercel.com/v8/projects/${process.env.NEXT_PUBLIC_VERCEL_VIEWER_PROJECT_NAME}/domains/${name}?teamId=${process.env.VERCEL_TEAM_ID}`,
|
||||||
headers: { Authorization: `Bearer ${process.env.VERCEL_TOKEN}` },
|
headers: { Authorization: `Bearer ${process.env.VERCEL_TOKEN}` },
|
||||||
})
|
})
|
||||||
|
|
||||||
|
@ -214,11 +214,11 @@ These can also be added to the `viewer` environment
|
|||||||
<details><summary><h4>Vercel (custom domains)</h4></summary>
|
<details><summary><h4>Vercel (custom domains)</h4></summary>
|
||||||
<p>
|
<p>
|
||||||
|
|
||||||
| Parameter | Default | Description |
|
| Parameter | Default | Description |
|
||||||
| -------------------------- | ------- | ----------------------------------------------- |
|
| -------------------------------------- | ------- | ----------------------------------------------- |
|
||||||
| VERCEL_TOKEN | | Vercel API token |
|
| VERCEL_TOKEN | | Vercel API token |
|
||||||
| VERCEL_VIEWER_PROJECT_NAME | | The name of the viewer project in Vercel |
|
| NEXT_PUBLIC_VERCEL_VIEWER_PROJECT_NAME | | The name of the viewer project in Vercel |
|
||||||
| VERCEL_TEAM_ID | | Vercel team ID that contains the viewer project |
|
| VERCEL_TEAM_ID | | Vercel team ID that contains the viewer project |
|
||||||
|
|
||||||
</p></details>
|
</p></details>
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user