Skip to content

Commit

Permalink
🩹 (share) Fix undefined apiHost under API instructions
Browse files Browse the repository at this point in the history
  • Loading branch information
baptisteArno committed Apr 17, 2023
1 parent 9345b33 commit 7c2ce2f
Show file tree
Hide file tree
Showing 9 changed files with 24 additions and 19 deletions.
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import prettier from 'prettier/standalone'
import parserHtml from 'prettier/parser-html'
import {
parseApiHost,
parseApiHostValue,
parseInitBubbleCode,
typebotImportCode,
} from '../../snippetParsers'
Expand All @@ -19,7 +19,7 @@ export const JavascriptBubbleSnippet = ({ theme, previewMessage }: Props) => {
${parseInitBubbleCode({
typebot: typebot?.publicId ?? '',
apiHost: parseApiHost(typebot?.customDomain),
apiHost: parseApiHostValue(typebot?.customDomain),
theme: {
...theme,
chatWindow: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { useTypebot } from '@/features/editor/providers/TypebotProvider'
import parserHtml from 'prettier/parser-html'
import prettier from 'prettier/standalone'
import {
parseApiHost,
parseApiHostValue,
parseInitPopupCode,
typebotImportCode,
} from '../../snippetParsers'
Expand All @@ -16,7 +16,7 @@ export const JavascriptPopupSnippet = ({ autoShowDelay }: Props) => {
const snippet = prettier.format(
createSnippet({
typebot: typebot?.publicId ?? '',
apiHost: parseApiHost(typebot?.customDomain),
apiHost: parseApiHostValue(typebot?.customDomain),
autoShowDelay,
}),
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import parserHtml from 'prettier/parser-html'
import prettier from 'prettier/standalone'
import {
parseApiHost,
parseApiHostValue,
parseInitStandardCode,
typebotImportCode,
} from '../../snippetParsers'
Expand Down Expand Up @@ -40,7 +40,7 @@ export const parseStandardHeadCode = (
${parseInitStandardCode({
typebot: publicId ?? '',
apiHost: parseApiHost(customDomain),
apiHost: parseApiHostValue(customDomain),
})}</script>`,
{ parser: 'html', plugins: [parserHtml] }
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import {
parseInlineScript,
parseInitBubbleCode,
typebotImportCode,
parseApiHost,
parseApiHostValue,
} from '../../../snippetParsers'

export const parseDefaultBubbleTheme = (typebot?: Typebot) => ({
Expand All @@ -36,7 +36,7 @@ export const ScriptBubbleInstructions = () => {
${parseInitBubbleCode({
typebot: typebot?.publicId ?? '',
apiHost: parseApiHost(typebot?.customDomain),
apiHost: parseApiHostValue(typebot?.customDomain),
theme,
previewMessage,
})}`
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { useState } from 'react'
import { PopupSettings } from '../../../settings/PopupSettings'
import { parseInitPopupCode } from '../../../snippetParsers'
import {
parseApiHost,
parseApiHostValue,
parseInlineScript,
typebotImportCode,
} from '../../../snippetParsers/shared'
Expand All @@ -19,7 +19,7 @@ export const ScriptPopupInstructions = () => {
${parseInitPopupCode({
typebot: typebot?.publicId ?? '',
apiHost: parseApiHost(typebot?.customDomain),
apiHost: parseApiHostValue(typebot?.customDomain),
autoShowDelay: inputValue,
})}`
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import { StandardSettings } from '../../../settings/StandardSettings'
import { parseInitStandardCode } from '../../../snippetParsers/standard'
import { parseStandardElementCode } from '../../Javascript/JavascriptStandardSnippet'
import {
parseApiHost,
parseApiHostValue,
parseInlineScript,
typebotImportCode,
} from '../../../snippetParsers/shared'
Expand All @@ -30,7 +30,7 @@ export const ScriptStandardInstructions = () => {
${parseInitStandardCode({
typebot: typebot?.publicId ?? '',
apiHost: parseApiHost(typebot?.customDomain),
apiHost: parseApiHostValue(typebot?.customDomain),
})}`)

return (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import {
import { BubbleProps } from '@typebot.io/js'
import { useState } from 'react'
import { BubbleSettings } from '../../../settings/BubbleSettings/BubbleSettings'
import { parseApiHost, parseInitBubbleCode } from '../../../snippetParsers'
import { parseApiHostValue, parseInitBubbleCode } from '../../../snippetParsers'
import { parseDefaultBubbleTheme } from '../../Javascript/instructions/JavascriptBubbleInstructions'

type Props = {
Expand All @@ -29,7 +29,7 @@ export const WordpressBubbleInstructions = ({ publicId }: Props) => {

const initCode = parseInitBubbleCode({
typebot: publicId,
apiHost: parseApiHost(typebot?.customDomain),
apiHost: parseApiHostValue(typebot?.customDomain),
theme: {
...theme,
chatWindow: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import {
import { useState } from 'react'
import { PopupSettings } from '../../../settings/PopupSettings'
import { parseInitPopupCode } from '../../../snippetParsers/popup'
import { parseApiHost } from '../../../snippetParsers'
import { parseApiHostValue } from '../../../snippetParsers'

type Props = {
publicId: string
Expand All @@ -25,7 +25,7 @@ export const WordpressPopupInstructions = ({

const initCode = parseInitPopupCode({
typebot: publicId,
apiHost: parseApiHost(customDomain),
apiHost: parseApiHostValue(customDomain),
autoShowDelay,
})

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,12 @@ export const parseApiHost = (
customDomain: Typebot['customDomain'] | undefined
) => {
if (customDomain) return new URL(`https://${customDomain}`).origin
return isCloudProdInstance
? undefined
: env('VIEWER_INTERNAL_URL') ?? getViewerUrl()
return env('VIEWER_INTERNAL_URL') ?? getViewerUrl()
}

export const parseApiHostValue = (
customDomain: Typebot['customDomain'] | undefined
) => {
if (isCloudProdInstance) return
return parseApiHost(customDomain)
}

4 comments on commit 7c2ce2f

@vercel
Copy link

@vercel vercel bot commented on 7c2ce2f Apr 17, 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
docs-git-main-typebot-io.vercel.app
docs-typebot-io.vercel.app

@vercel
Copy link

@vercel vercel bot commented on 7c2ce2f Apr 17, 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

bii.bj
1stop.au
yobot.me
klujo.com
me.cr8.ai
wachat.io
wassep.io
247987.com
8jours.top
aginap.com
ai.mprs.in
bee.cr8.ai
bot.aws.bj
bot.bbc.bj
cat.cr8.ai
finplex.be
nepkit.com
pig.cr8.ai
sat.cr8.ai
wachap.app
wachats.me
wsapio.com
bot.aipr.kr
bot.joof.it
bull.cr8.ai
docs.cr8.ai
minipost.uk
mole.cr8.ai
team.cr8.ai
wolf.cr8.ai
ai.meant.com
bot.grace.bj
cinecorn.com
help.taxt.co
kusamint.com
rhino.cr8.ai
sheep.cr8.ai
snake.cr8.ai
svhm.mprs.in
tiger.cr8.ai
video.cr8.ai
yoda.riku.ai
zebra.cr8.ai
bergamo.store
bot.krdfy.com
bot.tvbeat.it
cgcassets.com
cnvhub.com.br
testbot.afterorigin.com
typebot.influencer.love
www.chatgpt-biliran.com
91181264.your-access.one
abg-assistent.m-vogel.de
newsletter.itshcormeos.com
rsvp.virtuesocialmedia.com
tarian.theiofoundation.org
ted.meujalecobrasil.com.br
type.dericsoncalari.com.br
bot.pinpointinteractive.com
bot.polychromes-project.com
bot.seidinembroseanchetu.it
chat.semanalimpanome.com.br
designguide.techyscouts.com
liveconvert2.kandalearn.com
presente.empresarias.com.mx
register.algorithmpress.com
sell.sellthemotorhome.co.uk
anamnese.odontopavani.com.br
austin.channelautomation.com
bot.marketingplusmindset.com
bot.seidibergamoseanchetu.it
desabafe.sergiolimajr.com.br
download.venturemarketing.in
piazzatorre.barrettamario.it
type.cookieacademyonline.com
upload.atlasoutfittersk9.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
bot.cabin-rentals-of-georgia.net
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
chrome-os-inquiry-system.itschromeos.com
viewer-v2-git-main-typebot-io.vercel.app
main-menu-for-itschromeos.itschromeos.com

@vercel
Copy link

@vercel vercel bot commented on 7c2ce2f Apr 17, 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 7c2ce2f Apr 17, 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
builder-v2-typebot-io.vercel.app
app.typebot.io

Please sign in to comment.