2
0

🐛 (pictureChoice) Fix dynamic image only variable saving

This commit is contained in:
Baptiste Arnaud
2024-03-19 14:02:53 +01:00
parent f0172198b9
commit 9c86c5e76f
6 changed files with 14 additions and 9 deletions

View File

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

View File

@ -3,7 +3,7 @@ import { PictureChoiceBlock } from '@typebot.io/schemas/features/blocks/inputs/p
import { For, Show, createEffect, createSignal, onMount } from 'solid-js'
import { Checkbox } from '../buttons/components/Checkbox'
import { SendButton } from '@/components'
import { isDefined, isEmpty, isSvgSrc } from '@typebot.io/lib'
import { isDefined, isEmpty, isNotEmpty, isSvgSrc } from '@typebot.io/lib'
import { SearchInput } from '@/components/inputs/SearchInput'
import { isMobile } from '@/utils/isMobileSignal'
import { defaultPictureChoiceOptions } from '@typebot.io/schemas/features/blocks/inputs/pictureChoice/constants'
@ -47,7 +47,7 @@ export const MultiplePictureChoice = (props: Props) => {
const item = props.defaultItems.find(
(item) => item.id === selectedItemId
)
return item?.title ?? item?.pictureSrc
return isNotEmpty(item?.title) ? item.title : item?.pictureSrc
})
.join(', '),
})

View File

@ -1,7 +1,7 @@
import { SearchInput } from '@/components/inputs/SearchInput'
import { InputSubmitContent } from '@/types'
import { isMobile } from '@/utils/isMobileSignal'
import { isDefined, isSvgSrc } from '@typebot.io/lib/utils'
import { isDefined, isNotEmpty, isSvgSrc } from '@typebot.io/lib/utils'
import { PictureChoiceBlock } from '@typebot.io/schemas/features/blocks/inputs/pictureChoice'
import { For, Show, createEffect, createSignal, onMount } from 'solid-js'
@ -24,7 +24,7 @@ export const SinglePictureChoice = (props: Props) => {
const handleClick = (itemIndex: number) => {
const item = filteredItems()[itemIndex]
return props.onSubmit({
label: item.title ?? item.pictureSrc ?? item.id,
label: isNotEmpty(item.title) ? item.title : item.pictureSrc ?? item.id,
value: item.id,
})
}

View File

@ -1,6 +1,6 @@
{
"name": "@typebot.io/nextjs",
"version": "0.2.52",
"version": "0.2.53",
"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.2.52",
"version": "0.2.53",
"description": "Convenient library to display typebots on your React app",
"main": "dist/index.js",
"types": "dist/index.d.ts",