2
0

🔥 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

@@ -41,7 +41,8 @@
"tsup": "6.5.0",
"typebot-js": "workspace:*",
"typescript": "5.3.2",
"@typebot.io/lib": "workspace:*"
"@typebot.io/lib": "workspace:*",
"@typebot.io/env": "workspace:*"
},
"peerDependencies": {
"@typebot.io/prisma": "workspace:*",

View File

@@ -1,4 +1,4 @@
import { CSSProperties, useMemo } from 'react'
import { useMemo } from 'react'
import { TypebotProvider } from '../providers/TypebotProvider'
import styles from '../assets/style.css'
import importantStyles from '../assets/importantStyles.css'
@@ -14,8 +14,8 @@ import {
import { Log } from '@typebot.io/prisma'
import { LiteBadge } from './LiteBadge'
import { isNotEmpty } from '@typebot.io/lib'
import { getViewerUrl } from '@typebot.io/lib/getViewerUrl'
import { BackgroundType } from '@typebot.io/schemas/features/typebot/theme/constants'
import { env } from '@typebot.io/env'
export type TypebotViewerProps = {
typebot: Omit<PublicTypebot, 'updatedAt' | 'createdAt'>
@@ -36,7 +36,7 @@ export type TypebotViewerProps = {
export const TypebotViewer = ({
typebot,
apiHost = getViewerUrl(),
apiHost = env.NEXT_PUBLIC_VIEWER_URL[0],
isPreview = false,
isLoading = false,
resultId,

View File

@@ -1,6 +1,6 @@
{
"name": "@typebot.io/js",
"version": "0.2.22",
"version": "0.2.23",
"description": "Javascript library to display typebots on your website",
"type": "module",
"main": "dist/index.js",

View File

@@ -1,8 +1,6 @@
import { getRuntimeVariable } from '@typebot.io/env/getRuntimeVariable'
const cloudViewerUrl = 'https://viewer.typebot.io'
const cloudViewerUrl = 'https://typebot.io'
export const guessApiHost = () =>
getRuntimeVariable('NEXT_PUBLIC_VIEWER_INTERNAL_URL') ??
getRuntimeVariable('NEXT_PUBLIC_VIEWER_URL')?.split(',')[0] ??
cloudViewerUrl
getRuntimeVariable('NEXT_PUBLIC_VIEWER_URL')?.split(',')[0] ?? cloudViewerUrl

View File

@@ -1,6 +1,6 @@
{
"name": "@typebot.io/nextjs",
"version": "0.2.22",
"version": "0.2.23",
"description": "Convenient library to display typebots on your Next.js website",
"main": "dist/index.js",
"types": "dist/index.d.ts",

View File

@@ -1,6 +1,6 @@
{
"name": "@typebot.io/react",
"version": "0.2.22",
"version": "0.2.23",
"description": "Convenient library to display typebots on your React app",
"main": "dist/index.js",
"types": "dist/index.d.ts",

View File

@@ -94,7 +94,7 @@ class Typebot_Public
$lib_url = "https://cdn.jsdelivr.net/npm/@typebot.io/js@0.2.15/dist/web.js";
$width = '100%';
$height = '500px';
$api_host = 'https://viewer.typebot.io';
$api_host = 'https://typebot.io';
if (array_key_exists('width', $attributes)) {
$width = sanitize_text_field($attributes['width']);
}

4
packages/env/env.ts vendored
View File

@@ -33,16 +33,12 @@ const baseEnv = {
.string()
.min(1)
.transform((string) => string.split(',')),
NEXT_PUBLIC_VIEWER_INTERNAL_URL: z.string().url().optional(),
NEXT_PUBLIC_ONBOARDING_TYPEBOT_ID: z.string().min(1).optional(),
NEXT_PUBLIC_BOT_FILE_UPLOAD_MAX_SIZE: z.coerce.number().optional(),
},
runtimeEnv: {
NEXT_PUBLIC_E2E_TEST: getRuntimeVariable('NEXT_PUBLIC_E2E_TEST'),
NEXT_PUBLIC_VIEWER_URL: getRuntimeVariable('NEXT_PUBLIC_VIEWER_URL'),
NEXT_PUBLIC_VIEWER_INTERNAL_URL: getRuntimeVariable(
'NEXT_PUBLIC_VIEWER_INTERNAL_URL'
),
NEXT_PUBLIC_ONBOARDING_TYPEBOT_ID: getRuntimeVariable(
'NEXT_PUBLIC_ONBOARDING_TYPEBOT_ID'
),

View File

@@ -1,4 +0,0 @@
import { env } from '@typebot.io/env'
export const getViewerUrl = () =>
env.NEXT_PUBLIC_VIEWER_INTERNAL_URL ?? env.NEXT_PUBLIC_VIEWER_URL[0]