2
0

Add Bubble and Popup in embed lib v2

Closes #214
This commit is contained in:
Baptiste Arnaud
2023-01-09 14:51:36 +01:00
parent 4bf93b4872
commit 21f1c7a17e
38 changed files with 1586 additions and 96 deletions

View File

@ -195,7 +195,7 @@ export const updateWorkspace = async (
})
}
const parseCreateTypebot = (typebot: Typebot) => ({
export const parseCreateTypebot = (typebot: Typebot) => ({
...typebot,
resultsTablePreferences:
typebot.resultsTablePreferences === null

View File

@ -245,15 +245,14 @@ export const uploadFiles = async ({
declare const window: any
const isBrowser = () => Boolean(typeof window !== 'undefined')
export const env = (key = ''): string | undefined => {
if (isBrowser() && window.__env)
return isEmpty(window.__env[key]) ? undefined : window.__env[key]
if (typeof window === 'undefined')
return isEmpty(process.env['NEXT_PUBLIC_' + key])
? undefined
: (process.env['NEXT_PUBLIC_' + key] as string)
return isEmpty(process.env['NEXT_PUBLIC_' + key])
? undefined
: (process.env['NEXT_PUBLIC_' + key] as string)
if (typeof window !== 'undefined' && window.__env)
return isEmpty(window.__env[key]) ? undefined : window.__env[key]
}
export const hasValue = (
@ -276,8 +275,8 @@ export const getViewerUrl = (props?: {
return (
'https://' +
(props?.isBuilder
? process.env.NEXT_PUBLIC_VERCEL_URL?.replace('builder-v2', 'viewer-v2')
: process.env.NEXT_PUBLIC_VERCEL_URL)
? env('VERCEL_URL')?.replace('builder-v2', 'viewer-v2')
: env('VERCEL_URL'))
)
}