@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@typebot.io/js",
|
"name": "@typebot.io/js",
|
||||||
"version": "0.2.56",
|
"version": "0.2.57",
|
||||||
"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",
|
||||||
|
@ -20,6 +20,27 @@ const defaultTextColor = '#303235'
|
|||||||
export const PreviewMessage = (props: PreviewMessageProps) => {
|
export const PreviewMessage = (props: PreviewMessageProps) => {
|
||||||
const [isPreviewMessageHovered, setIsPreviewMessageHovered] =
|
const [isPreviewMessageHovered, setIsPreviewMessageHovered] =
|
||||||
createSignal(false)
|
createSignal(false)
|
||||||
|
const [touchStartPosition, setTouchStartPosition] = createSignal({
|
||||||
|
x: 0,
|
||||||
|
y: 0,
|
||||||
|
})
|
||||||
|
|
||||||
|
const handleTouchStart = (e: TouchEvent) => {
|
||||||
|
setTouchStartPosition({ x: e.touches[0].clientX, y: e.touches[0].clientY })
|
||||||
|
}
|
||||||
|
|
||||||
|
const handleTouchEnd = (e: TouchEvent) => {
|
||||||
|
const x = e.changedTouches[0].clientX
|
||||||
|
const y = e.changedTouches[0].clientY
|
||||||
|
|
||||||
|
if (
|
||||||
|
Math.abs(x - touchStartPosition().x) > 10 ||
|
||||||
|
y - touchStartPosition().y > 10
|
||||||
|
)
|
||||||
|
props.onCloseClick()
|
||||||
|
|
||||||
|
setTouchStartPosition({ x: 0, y: 0 })
|
||||||
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div
|
<div
|
||||||
@ -38,6 +59,8 @@ export const PreviewMessage = (props: PreviewMessageProps) => {
|
|||||||
}}
|
}}
|
||||||
onMouseEnter={() => setIsPreviewMessageHovered(true)}
|
onMouseEnter={() => setIsPreviewMessageHovered(true)}
|
||||||
onMouseLeave={() => setIsPreviewMessageHovered(false)}
|
onMouseLeave={() => setIsPreviewMessageHovered(false)}
|
||||||
|
onTouchStart={handleTouchStart}
|
||||||
|
onTouchEnd={handleTouchEnd}
|
||||||
>
|
>
|
||||||
<CloseButton
|
<CloseButton
|
||||||
isHovered={isPreviewMessageHovered()}
|
isHovered={isPreviewMessageHovered()}
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@typebot.io/nextjs",
|
"name": "@typebot.io/nextjs",
|
||||||
"version": "0.2.56",
|
"version": "0.2.57",
|
||||||
"description": "Convenient library to display typebots on your Next.js website",
|
"description": "Convenient library to display typebots on your Next.js website",
|
||||||
"main": "dist/index.js",
|
"main": "dist/index.js",
|
||||||
"types": "dist/index.d.ts",
|
"types": "dist/index.d.ts",
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@typebot.io/react",
|
"name": "@typebot.io/react",
|
||||||
"version": "0.2.56",
|
"version": "0.2.57",
|
||||||
"description": "Convenient library to display typebots on your React app",
|
"description": "Convenient library to display typebots on your React app",
|
||||||
"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