🐛 Correctly update prefilled variables
This commit is contained in:
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@typebot.io/js",
|
"name": "@typebot.io/js",
|
||||||
"version": "0.0.11",
|
"version": "0.0.12",
|
||||||
"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",
|
||||||
|
@ -1,4 +1,11 @@
|
|||||||
import { createSignal, onMount, Show, splitProps, onCleanup } from 'solid-js'
|
import {
|
||||||
|
createSignal,
|
||||||
|
onMount,
|
||||||
|
Show,
|
||||||
|
splitProps,
|
||||||
|
onCleanup,
|
||||||
|
createEffect,
|
||||||
|
} from 'solid-js'
|
||||||
import styles from '../../../assets/index.css'
|
import styles from '../../../assets/index.css'
|
||||||
import { CommandData } from '../../commands'
|
import { CommandData } from '../../commands'
|
||||||
import { BubbleButton } from './BubbleButton'
|
import { BubbleButton } from './BubbleButton'
|
||||||
@ -52,6 +59,14 @@ export const Bubble = (props: BubbleProps) => {
|
|||||||
window.removeEventListener('message', processIncomingEvent)
|
window.removeEventListener('message', processIncomingEvent)
|
||||||
})
|
})
|
||||||
|
|
||||||
|
createEffect(() => {
|
||||||
|
if (!props.prefilledVariables) return
|
||||||
|
setPrefilledVariables((existingPrefilledVariables) => ({
|
||||||
|
...existingPrefilledVariables,
|
||||||
|
...props.prefilledVariables,
|
||||||
|
}))
|
||||||
|
})
|
||||||
|
|
||||||
const processIncomingEvent = (event: MessageEvent<CommandData>) => {
|
const processIncomingEvent = (event: MessageEvent<CommandData>) => {
|
||||||
const { data } = event
|
const { data } = event
|
||||||
if (!data.isFromTypebot) return
|
if (!data.isFromTypebot) return
|
||||||
|
@ -62,6 +62,14 @@ export const Popup = (props: PopupProps) => {
|
|||||||
toggleBot()
|
toggleBot()
|
||||||
})
|
})
|
||||||
|
|
||||||
|
createEffect(() => {
|
||||||
|
if (!props.prefilledVariables) return
|
||||||
|
setPrefilledVariables((existingPrefilledVariables) => ({
|
||||||
|
...existingPrefilledVariables,
|
||||||
|
...props.prefilledVariables,
|
||||||
|
}))
|
||||||
|
})
|
||||||
|
|
||||||
const stopPropagation = (event: MouseEvent) => {
|
const stopPropagation = (event: MouseEvent) => {
|
||||||
event.stopPropagation()
|
event.stopPropagation()
|
||||||
}
|
}
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@typebot.io/react",
|
"name": "@typebot.io/react",
|
||||||
"version": "0.0.11",
|
"version": "0.0.12",
|
||||||
"description": "React library to display typebots on your website",
|
"description": "React library to display typebots on your website",
|
||||||
"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