2
0

(audio) Add autoplay switch in settings

This commit is contained in:
Baptiste Arnaud
2023-08-07 12:20:38 +02:00
parent bd9c8eac4c
commit 037d4ce345
9 changed files with 52 additions and 37 deletions

View File

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

View File

@@ -74,7 +74,10 @@ export const Bot = (props: BotProps & { class?: string }) => {
return setError(new Error("The bot you're looking for doesn't exist."))
}
if (!data) return setError(new Error("Error! Couldn't initiate the chat."))
if (!data) {
if (error) console.error(error)
return setError(new Error("Error! Couldn't initiate the chat."))
}
if (data.resultId && typebotIdFromProps)
setResultInStorage(data.typebot.settings.general.rememberUser?.storage)(

View File

@@ -55,7 +55,7 @@ export const HostBubble = (props: Props) => {
</Match>
<Match when={props.message.type === BubbleBlockType.AUDIO}>
<AudioBubble
url={(props.message.content as AudioBubbleContent).url}
content={props.message.content as AudioBubbleContent}
onTransitionEnd={onTransitionEnd}
/>
</Match>

View File

@@ -4,7 +4,7 @@ import type { AudioBubbleContent } from '@typebot.io/schemas'
import { createSignal, onCleanup, onMount } from 'solid-js'
type Props = {
url: AudioBubbleContent['url']
content: AudioBubbleContent
onTransitionEnd: (offsetTop?: number) => void
}
@@ -50,8 +50,8 @@ export const AudioBubble = (props: Props) => {
</div>
<audio
ref={audioElement}
src={props.url}
autoplay
src={props.content.url}
autoplay={props.content.isAutoplayEnabled ?? true}
class={
'z-10 text-fade-in ' +
(isTyping() ? 'opacity-0' : 'opacity-100 m-2')

View File

@@ -1,6 +1,6 @@
{
"name": "@typebot.io/nextjs",
"version": "0.1.14",
"version": "0.1.15",
"description": "Convenient library to display typebots on your Next.js website",
"main": "dist/index.js",
"types": "dist/index.d.ts",

View File

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