2
0
Files
bot/packages/react/src/Bubble.tsx
Baptiste Arnaud 21f1c7a17e Add Bubble and Popup in embed lib v2
Closes #214
2023-01-09 14:51:36 +01:00

25 lines
539 B
TypeScript

import { useEffect } from 'react'
import type { BubbleProps } from '@typebot.io/js'
declare global {
namespace JSX {
interface IntrinsicElements {
'typebot-bubble': React.DetailedHTMLProps<
React.HTMLAttributes<HTMLElement>,
HTMLElement
>
}
}
}
export const Bubble = (props: BubbleProps) => {
useEffect(() => {
;(async () => {
const { registerBubbleComponent } = await import('@typebot.io/js')
registerBubbleComponent(props)
})()
}, [props])
return <typebot-bubble />
}