2
0

🐛 Fix bot not proceeding when embedded

This commit is contained in:
Baptiste Arnaud
2023-02-22 07:46:30 +01:00
parent 4efe2c48bb
commit bdf088bd95
11 changed files with 24 additions and 19 deletions

View File

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

View File

@ -1,5 +1,6 @@
import { guessApiHost } from '@/utils/guessApiHost'
import type { ChatReply, SendMessageInput } from 'models'
import { getViewerUrl, isEmpty, sendRequest } from 'utils'
import { isNotEmpty, sendRequest } from 'utils'
export async function sendMessageQuery({
apiHost,
@ -7,7 +8,7 @@ export async function sendMessageQuery({
}: SendMessageInput & { apiHost?: string }) {
const response = await sendRequest<ChatReply>({
method: 'POST',
url: `${isEmpty(apiHost) ? getViewerUrl() : apiHost}/api/v1/sendMessage`,
url: `${isNotEmpty(apiHost) ? apiHost : guessApiHost()}/api/v1/sendMessage`,
body,
})