🔥 Remove VIEWER_URL_INTERNAL variable

BREAKING CHANGE: NEXT_PUBLIC_VIEWER_INTERNAL does not exist anymore as typebot.io now directly points to the viewer project
This commit is contained in:
Baptiste Arnaud
2023-11-23 15:21:07 +01:00
parent 542e632472
commit 73d2e165bf
22 changed files with 51 additions and 48 deletions

View File

@@ -18,8 +18,8 @@ import {
Text,
Stack,
} from '@chakra-ui/react'
import { getViewerUrl } from '@typebot.io/lib/getViewerUrl'
import { ModalProps } from '../EmbedButton'
import { env } from '@typebot.io/env'
export const FlutterFlowModal = ({
isPublished,
@@ -51,12 +51,12 @@ export const FlutterFlowModal = ({
<InputGroup size="sm">
<Input
type={'text'}
defaultValue={`${getViewerUrl()}/${publicId}`}
defaultValue={`${env.NEXT_PUBLIC_VIEWER_URL[0]}/${publicId}`}
/>
<InputRightElement width="60px">
<CopyButton
size="sm"
textToCopy={`${getViewerUrl()}/${publicId}`}
textToCopy={`${env.NEXT_PUBLIC_VIEWER_URL[0]}/${publicId}`}
/>
</InputRightElement>
</InputGroup>

View File

@@ -1,9 +1,9 @@
import { FlexProps } from '@chakra-ui/react'
import { useTypebot } from '@/features/editor/providers/TypebotProvider'
import { getViewerUrl } from '@typebot.io/lib/getViewerUrl'
import { CodeEditor } from '@/components/inputs/CodeEditor'
import prettier from 'prettier/standalone'
import parserHtml from 'prettier/parser-html'
import { env } from '@typebot.io/env'
type Props = {
widthLabel: string
@@ -13,7 +13,7 @@ type Props = {
export const IframeSnippet = ({ widthLabel, heightLabel }: Props) => {
const { typebot } = useTypebot()
const src = `${getViewerUrl()}/${typebot?.publicId}`
const src = `${env.NEXT_PUBLIC_VIEWER_URL[0]}/${typebot?.publicId}`
const code = prettier.format(
`<iframe src="${src}" style="border: none; width=${widthLabel}; height=${heightLabel}"></iframe>`,
{ parser: 'html', plugins: [parserHtml] }

View File

@@ -18,8 +18,8 @@ import {
Text,
Stack,
} from '@chakra-ui/react'
import { getViewerUrl } from '@typebot.io/lib/getViewerUrl'
import { ModalProps } from '../EmbedButton'
import { env } from '@typebot.io/env'
export const NotionModal = ({
isPublished,
@@ -49,12 +49,12 @@ export const NotionModal = ({
<InputGroup size="sm">
<Input
type={'text'}
defaultValue={`${getViewerUrl()}/${publicId}`}
defaultValue={`${env.NEXT_PUBLIC_VIEWER_URL[0]}/${publicId}`}
/>
<InputRightElement width="60px">
<CopyButton
size="sm"
textToCopy={`${getViewerUrl()}/${publicId}`}
textToCopy={`${env.NEXT_PUBLIC_VIEWER_URL[0]}/${publicId}`}
/>
</InputRightElement>
</InputGroup>

View File

@@ -41,7 +41,6 @@ import {
} from '@chakra-ui/react'
import { env } from '@typebot.io/env'
import { isEmpty, isNotEmpty } from '@typebot.io/lib/utils'
import { getViewerUrl } from '@typebot.io/lib/getViewerUrl'
import React, { useState } from 'react'
import { createId } from '@paralleldrive/cuid2'
@@ -449,9 +448,7 @@ const Webhook = ({
credentialsId: string
}) => {
const { workspace } = useWorkspace()
const webhookUrl = `${
env.NEXT_PUBLIC_VIEWER_INTERNAL_URL ?? getViewerUrl()
}/api/v1/workspaces/${workspace?.id}/whatsapp/${credentialsId}/webhook`
const webhookUrl = `${env.NEXT_PUBLIC_VIEWER_URL[0]}/api/v1/workspaces/${workspace?.id}/whatsapp/${credentialsId}/webhook`
return (
<Stack spacing={6}>

View File

@@ -12,7 +12,7 @@ import {
import { useState } from 'react'
import { StandardSettings } from '../../../settings/StandardSettings'
import { isCloudProdInstance } from '@/helpers/isCloudProdInstance'
import { getViewerUrl } from '@typebot.io/lib/getViewerUrl'
import { env } from '@typebot.io/env'
type Props = {
publicId: string
@@ -76,7 +76,7 @@ const parseWordpressShortcode = ({
publicId: string
}) => {
return `[typebot typebot="${publicId}"${
isCloudProdInstance() ? '' : ` host="${getViewerUrl()}"`
isCloudProdInstance() ? '' : ` host="${env.NEXT_PUBLIC_VIEWER_URL[0]}"`
}${width ? ` width="${width}"` : ''}${height ? ` height="${height}"` : ''}]
`
}

View File

@@ -2,10 +2,10 @@ import { BotProps } from '@typebot.io/nextjs'
import parserBabel from 'prettier/parser-babel'
import prettier from 'prettier/standalone'
import { isDefined } from '@typebot.io/lib'
import { getViewerUrl } from '@typebot.io/lib/getViewerUrl'
import { Typebot } from '@typebot.io/schemas'
import { isCloudProdInstance } from '@/helpers/isCloudProdInstance'
import packageJson from '../../../../../../../../packages/embeds/js/package.json'
import { env } from '@typebot.io/env'
export const parseStringParam = (
fieldName: string,
@@ -59,7 +59,7 @@ export const parseApiHost = (
customDomain: Typebot['customDomain'] | undefined
) => {
if (customDomain) return new URL(`https://${customDomain}`).origin
return getViewerUrl()
return env.NEXT_PUBLIC_VIEWER_URL[0]
}
export const parseApiHostValue = (