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

@ -3,7 +3,7 @@ import {
getExistingResultFromSession,
setResultInSession,
} from '@/utils/sessionStorage'
import Bot from '@typebot.io/react'
import { Standard } from '@typebot.io/react'
import { BackgroundType, InitialChatReply, Typebot } from 'models'
import { useRouter } from 'next/router'
import { useCallback, useEffect, useState } from 'react'
@ -38,6 +38,7 @@ export const TypebotPageV2 = ({ url, typebot }: TypebotPageV2Props) => {
}, [asPath, push, typebot.settings.general.isHideQueryParamsEnabled])
useEffect(() => {
console.log(open)
clearQueryParamsIfNecessary()
}, [clearQueryParamsIfNecessary])
@ -89,10 +90,7 @@ export const TypebotPageV2 = ({ url, typebot }: TypebotPageV2Props) => {
metadata={typebot.settings.metadata}
/>
{initialChatReply && (
<Bot.Standard
typebotId={typebot.id}
initialChatReply={initialChatReply}
/>
<Standard typebotId={typebot.id} initialChatReply={initialChatReply} />
)}
</div>
)

View File

@ -6,7 +6,11 @@ import { NextApiRequest, NextApiResponse } from 'next'
const handler = async (req: NextApiRequest, res: NextApiResponse) => {
await cors(req, res, {
origin: ['https://docs.typebot.io', 'http://localhost:3005'],
origin: [
'https://docs.typebot.io',
'http://localhost:3005',
'http://localhost:3006',
],
})
return createOpenApiNextHandler({