@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@typebot.io/js",
|
"name": "@typebot.io/js",
|
||||||
"version": "0.0.58",
|
"version": "0.0.59",
|
||||||
"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",
|
||||||
|
|||||||
@@ -21,13 +21,16 @@ type Props = Pick<ChatReply, 'messages' | 'input'> & {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export const ChatChunk = (props: Props) => {
|
export const ChatChunk = (props: Props) => {
|
||||||
|
let inputRef: HTMLDivElement | undefined
|
||||||
const [displayedMessageIndex, setDisplayedMessageIndex] = createSignal(0)
|
const [displayedMessageIndex, setDisplayedMessageIndex] = createSignal(0)
|
||||||
|
|
||||||
onMount(() => {
|
onMount(() => {
|
||||||
if (props.messages.length === 0) {
|
if (props.messages.length === 0) {
|
||||||
props.onAllBubblesDisplayed()
|
props.onAllBubblesDisplayed()
|
||||||
}
|
}
|
||||||
props.onScrollToBottom()
|
props.onScrollToBottom(
|
||||||
|
inputRef?.offsetTop ? inputRef?.offsetTop - 50 : undefined
|
||||||
|
)
|
||||||
})
|
})
|
||||||
|
|
||||||
const displayNextMessage = async (bubbleOffsetTop?: number) => {
|
const displayNextMessage = async (bubbleOffsetTop?: number) => {
|
||||||
@@ -84,6 +87,7 @@ export const ChatChunk = (props: Props) => {
|
|||||||
</Show>
|
</Show>
|
||||||
{props.input && displayedMessageIndex() === props.messages.length && (
|
{props.input && displayedMessageIndex() === props.messages.length && (
|
||||||
<InputChatBlock
|
<InputChatBlock
|
||||||
|
ref={inputRef}
|
||||||
block={props.input}
|
block={props.input}
|
||||||
inputIndex={props.inputIndex}
|
inputIndex={props.inputIndex}
|
||||||
onSubmit={props.onSubmit}
|
onSubmit={props.onSubmit}
|
||||||
|
|||||||
@@ -35,6 +35,7 @@ import { SinglePictureChoice } from '@/features/blocks/inputs/pictureChoice/Sing
|
|||||||
import { MultiplePictureChoice } from '@/features/blocks/inputs/pictureChoice/MultiplePictureChoice'
|
import { MultiplePictureChoice } from '@/features/blocks/inputs/pictureChoice/MultiplePictureChoice'
|
||||||
|
|
||||||
type Props = {
|
type Props = {
|
||||||
|
ref: HTMLDivElement | undefined
|
||||||
block: NonNullable<ChatReply['input']>
|
block: NonNullable<ChatReply['input']>
|
||||||
hasHostAvatar: boolean
|
hasHostAvatar: boolean
|
||||||
guestAvatar?: Theme['chat']['guestAvatar']
|
guestAvatar?: Theme['chat']['guestAvatar']
|
||||||
@@ -72,6 +73,7 @@ export const InputChatBlock = (props: Props) => {
|
|||||||
<div
|
<div
|
||||||
class="flex justify-end animate-fade-in gap-2"
|
class="flex justify-end animate-fade-in gap-2"
|
||||||
data-blockid={props.block.id}
|
data-blockid={props.block.id}
|
||||||
|
ref={props.ref}
|
||||||
>
|
>
|
||||||
{props.hasHostAvatar && (
|
{props.hasHostAvatar && (
|
||||||
<div
|
<div
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@typebot.io/react",
|
"name": "@typebot.io/react",
|
||||||
"version": "0.0.58",
|
"version": "0.0.59",
|
||||||
"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