Skip to content

Commit

Permalink
🚸 Show toast for non-uploaded file in preview mode
Browse files Browse the repository at this point in the history
Closes #278
  • Loading branch information
baptisteArno committed May 5, 2023
1 parent c469912 commit be009a2
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ export const WebPreview = () => {
logs?.forEach((log) => {
showToast({
icon: <WebhookIcon />,
status: log.status === 'error' ? 'error' : 'success',
status: log.status as 'success' | 'error' | 'info',
title: log.status === 'error' ? 'An error occured' : undefined,
description: log.description,
details: log.details
Expand Down
2 changes: 1 addition & 1 deletion packages/embeds/js/package.json
Original file line number Diff line number Diff line change
@@ -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",
Expand Down
Original file line number Diff line number Diff line change
@@ -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'
Expand Down Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion packages/embeds/react/package.json
Original file line number Diff line number Diff line change
@@ -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",
Expand Down

0 comments on commit be009a2

Please sign in to comment.