Skip to content

Commit

Permalink
🚸 (share) Hide custom domain dropdown when env isn't configured
Browse files Browse the repository at this point in the history
Related to #269
  • Loading branch information
baptisteArno committed Jan 21, 2023
1 parent 3d2d401 commit 393f5f2
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 9 deletions.
5 changes: 3 additions & 2 deletions apps/builder/src/features/publish/components/SharePage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ import {
Text,
} from '@chakra-ui/react'
import { Plan } from 'db'
import { isDefined, getViewerUrl, isNotDefined } from 'utils'
import { isDefined, getViewerUrl, isNotDefined, env } from 'utils'
import { isPublicDomainAvailableQuery } from '../queries/isPublicDomainAvailableQuery'
import { parseDefaultPublicId } from '../utils'
import { EditableUrl } from './EditableUrl'
Expand Down Expand Up @@ -122,7 +122,8 @@ export const SharePage = () => {
/>
</HStack>
)}
{isNotDefined(typebot?.customDomain) ? (
{isNotDefined(typebot?.customDomain) &&
env('VERCEL_VIEWER_PROJECT_NAME') ? (
<>
{isProPlan(workspace) ? (
<CustomDomainsDropdown
Expand Down
2 changes: 1 addition & 1 deletion apps/builder/src/pages/api/customDomains.ts
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ const handler = async (req: NextApiRequest, res: NextApiResponse) => {

const createDomainOnVercel = (name: string) =>
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}` },
json: { name },
})
Expand Down
2 changes: 1 addition & 1 deletion apps/builder/src/pages/api/customDomains/[domain].ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ const handler = async (req: NextApiRequest, res: NextApiResponse) => {

const deleteDomainOnVercel = (name: string) =>
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}` },
})

Expand Down
10 changes: 5 additions & 5 deletions apps/docs/docs/self-hosting/configuration/builder.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -214,11 +214,11 @@ These can also be added to the `viewer` environment
<details><summary><h4>Vercel (custom domains)</h4></summary>
<p>

| Parameter | Default | Description |
| -------------------------- | ------- | ----------------------------------------------- |
| VERCEL_TOKEN | | Vercel API token |
| VERCEL_VIEWER_PROJECT_NAME | | The name of the viewer project in Vercel |
| VERCEL_TEAM_ID | | Vercel team ID that contains the viewer project |
| Parameter | Default | Description |
| -------------------------------------- | ------- | ----------------------------------------------- |
| VERCEL_TOKEN | | Vercel API token |
| 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 |

</p></details>

Expand Down

4 comments on commit 393f5f2

@vercel
Copy link

@vercel vercel bot commented on 393f5f2 Jan 21, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@vercel
Copy link

@vercel vercel bot commented on 393f5f2 Jan 21, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Successfully deployed to the following URLs:

viewer-v2 – ./apps/viewer

ns8.vn
1stop.au
yobot.me
247987.com
8jours.top
aginap.com
bee.cr8.ai
bot.aws.bj
bot.bbc.bj
cat.cr8.ai
finplex.be
nepkit.com
pig.cr8.ai
sat.cr8.ai
bot.aipr.kr
bot.joof.it
bull.cr8.ai
docs.cr8.ai
start.taxtree.io
typebot.aloe.bot
voicehelp.cr8.ai
zap.fundviser.in
app.chatforms.net
bot.hostnation.de
bot.maitempah.com
bot.phuonghub.com
bot.reviewzer.com
bot.rihabilita.it
cares.urlabout.me
fmm.wpwakanda.com
gentleman-shop.fr
k1.kandabrand.com
lb.ticketfute.com
ov1.wpwakanda.com
ov2.wpwakanda.com
ov3.wpwakanda.com
viewer.typebot.io
1988.bouclidom.com
andreimayer.com.br
bot.danyservice.it
bot.iconicbrows.it
bot.megafox.com.br
bot.neferlopez.com
bots.robomotion.io
cadu.uninta.edu.br
dicanatural.online
digitalhelp.com.au
goalsettingbot.com
pant.maxbot.com.br
positivobra.com.br
survey.digienge.io
this-is-a-test.com
zap.techadviser.in
bot.boston-voip.com
bot.cabinpromos.com
bot.digitalbled.com
bot.dsignagency.com
bot.eventhub.com.au
bot.jepierre.com.br
bot.viralsangat.com
bot.winglabs.com.br
carsalesenquiry.com
ted.meujalecobrasil.com.br
type.dericsoncalari.com.br
bot.pinpointinteractive.com
bot.polychromes-project.com
bot.seidinembroseanchetu.it
chatbot.berbelanjabiz.trade
designguide.techyscouts.com
liveconvert2.kandalearn.com
presente.empresarias.com.mx
sell.sellthemotorhome.co.uk
anamnese.odontopavani.com.br
austin.channelautomation.com
bot.marketingplusmindset.com
bot.seidibergamoseanchetu.it
desabafe.sergiolimajr.com.br
piazzatorre.barrettamario.it
type.cookieacademyonline.com
bot.brigadeirosemdrama.com.br
forms.escoladeautomacao.com.br
onboarding.libertydreamcare.ie
type.talitasouzamarques.com.br
agendamento.sergiolimajr.com.br
anamnese.clinicamegasjdr.com.br
bookings.littlepartymonkeys.com
bot.comercializadoraomicron.com
elevateyourmind.groovepages.com
viewer-v2-typebot-io.vercel.app
yourfeedback.comebackreward.com
gerador.verificadordehospedes.com
personal-trainer.barrettamario.it
preagendamento.sergiolimajr.com.br
studiotecnicoimmobiliaremerelli.it
download.thailandmicespecialist.com
register.thailandmicespecialist.com
bot.studiotecnicoimmobiliaremerelli.it
pesquisa.escolamodacomproposito.com.br
anamnese.clinicaramosodontologia.com.br
viewer-v2-git-main-typebot-io.vercel.app

@vercel
Copy link

@vercel vercel bot commented on 393f5f2 Jan 21, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Successfully deployed to the following URLs:

builder-v2 – ./apps/builder

builder-v2-git-main-typebot-io.vercel.app
app.typebot.io
builder-v2-typebot-io.vercel.app

@vercel
Copy link

@vercel vercel bot commented on 393f5f2 Jan 21, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Successfully deployed to the following URLs:

docs – ./apps/docs

docs-typebot-io.vercel.app
docs.typebot.io
docs-git-main-typebot-io.vercel.app

Please sign in to comment.