2
0

🚸 Show toast for non-uploaded file in preview mode

Closes #278
This commit is contained in:
Baptiste Arnaud
2023-05-05 15:33:49 -04:00
parent c469912979
commit be009a216d
4 changed files with 15 additions and 7 deletions

View File

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

View File

@ -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 { sendMessageQuery } from '@/queries/sendMessageQuery'
import { ChatChunk } from './ChatChunk'
@ -89,9 +90,16 @@ export const ConversationContainer = (props: Props) => {
const sendMessage = async (message: string | undefined) => {
setHasError(false)
const currentBlockId = [...chatChunks()].pop()?.input?.id
if (currentBlockId && props.onAnswer && message)
props.onAnswer({ message, blockId: currentBlockId })
const currentInputBlock = [...chatChunks()].pop()?.input
if (currentInputBlock?.id && props.onAnswer && message)
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(() => {
setIsSending(true)
}, 1000)

View File

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