✨ Add Next.js embed library
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
import { useEffect, useRef } from 'react'
|
||||
import React, { useEffect, useRef } from 'react'
|
||||
import type { BotProps } from '@typebot.io/js'
|
||||
import '@typebot.io/js/dist/web'
|
||||
|
||||
type Props = BotProps & {
|
||||
style?: React.CSSProperties
|
||||
@@ -22,12 +23,6 @@ type StandardElement = HTMLElement & Props
|
||||
export const Standard = ({ style, className, ...assignableProps }: Props) => {
|
||||
const ref = useRef<StandardElement | null>(null)
|
||||
|
||||
useEffect(() => {
|
||||
;(async () => {
|
||||
await import('@typebot.io/js/dist/web')
|
||||
})()
|
||||
}, [])
|
||||
|
||||
useEffect(() => {
|
||||
if (!ref.current) return
|
||||
Object.assign(ref.current, assignableProps)
|
||||
@@ -35,3 +30,5 @@ export const Standard = ({ style, className, ...assignableProps }: Props) => {
|
||||
|
||||
return <typebot-standard ref={ref} style={style} class={className} />
|
||||
}
|
||||
|
||||
export default Standard
|
||||
|
||||
Reference in New Issue
Block a user