@@ -17,7 +17,7 @@ export const WebPreview = () => {
|
|||||||
logs?.forEach((log) => {
|
logs?.forEach((log) => {
|
||||||
showToast({
|
showToast({
|
||||||
icon: <WebhookIcon />,
|
icon: <WebhookIcon />,
|
||||||
status: log.status === 'error' ? 'error' : 'success',
|
status: log.status as 'success' | 'error' | 'info',
|
||||||
title: log.status === 'error' ? 'An error occured' : undefined,
|
title: log.status === 'error' ? 'An error occured' : undefined,
|
||||||
description: log.description,
|
description: log.description,
|
||||||
details: log.details
|
details: log.details
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@typebot.io/js",
|
"name": "@typebot.io/js",
|
||||||
"version": "0.0.46",
|
"version": "0.0.47",
|
||||||
"description": "Javascript library to display typebots on your website",
|
"description": "Javascript library to display typebots on your website",
|
||||||
"type": "module",
|
"type": "module",
|
||||||
"main": "dist/index.js",
|
"main": "dist/index.js",
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
import type { ChatReply, Theme } from '@typebot.io/schemas'
|
import { ChatReply, Theme } from '@typebot.io/schemas'
|
||||||
|
import { InputBlockType } from '@typebot.io/schemas/features/blocks/inputs/enums'
|
||||||
import { createEffect, createSignal, For, onMount, Show } from 'solid-js'
|
import { createEffect, createSignal, For, onMount, Show } from 'solid-js'
|
||||||
import { sendMessageQuery } from '@/queries/sendMessageQuery'
|
import { sendMessageQuery } from '@/queries/sendMessageQuery'
|
||||||
import { ChatChunk } from './ChatChunk'
|
import { ChatChunk } from './ChatChunk'
|
||||||
@@ -89,9 +90,16 @@ export const ConversationContainer = (props: Props) => {
|
|||||||
|
|
||||||
const sendMessage = async (message: string | undefined) => {
|
const sendMessage = async (message: string | undefined) => {
|
||||||
setHasError(false)
|
setHasError(false)
|
||||||
const currentBlockId = [...chatChunks()].pop()?.input?.id
|
const currentInputBlock = [...chatChunks()].pop()?.input
|
||||||
if (currentBlockId && props.onAnswer && message)
|
if (currentInputBlock?.id && props.onAnswer && message)
|
||||||
props.onAnswer({ message, blockId: currentBlockId })
|
props.onAnswer({ message, blockId: currentInputBlock.id })
|
||||||
|
if (currentInputBlock?.type === InputBlockType.FILE)
|
||||||
|
props.onNewLogs?.([
|
||||||
|
{
|
||||||
|
description: 'Files are not uploaded in preview mode',
|
||||||
|
status: 'info',
|
||||||
|
},
|
||||||
|
])
|
||||||
const longRequest = setTimeout(() => {
|
const longRequest = setTimeout(() => {
|
||||||
setIsSending(true)
|
setIsSending(true)
|
||||||
}, 1000)
|
}, 1000)
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@typebot.io/react",
|
"name": "@typebot.io/react",
|
||||||
"version": "0.0.46",
|
"version": "0.0.47",
|
||||||
"description": "React library to display typebots on your website",
|
"description": "React library to display typebots on your website",
|
||||||
"main": "dist/index.js",
|
"main": "dist/index.js",
|
||||||
"types": "dist/index.d.ts",
|
"types": "dist/index.d.ts",
|
||||||
|
|||||||
Reference in New Issue
Block a user