Skip to content

Commit

Permalink
fix(engine): 🐛 Embed bubble variable
Browse files Browse the repository at this point in the history
  • Loading branch information
baptisteArno committed Apr 28, 2022
1 parent 20c402a commit 4d98de2
Showing 1 changed file with 10 additions and 2 deletions.
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
import React, { useEffect, useRef, useState } from 'react'
import React, { useEffect, useMemo, useRef, useState } from 'react'
import { EmbedBubbleStep } from 'models'
import { TypingContent } from './TypingContent'
import { parseVariables } from 'services/variable'
import { useTypebot } from 'contexts/TypebotContext'

type Props = {
step: EmbedBubbleStep
Expand All @@ -10,9 +12,15 @@ type Props = {
export const showAnimationDuration = 400

export const EmbedBubble = ({ step, onTransitionEnd }: Props) => {
const { typebot } = useTypebot()
const messageContainer = useRef<HTMLDivElement | null>(null)
const [isTyping, setIsTyping] = useState(true)

const url = useMemo(
() => parseVariables(typebot.variables)(step.content?.url),
[step.content?.url, typebot.variables]
)

useEffect(() => {
showContentAfterMediaLoad()
// eslint-disable-next-line react-hooks/exhaustive-deps
Expand Down Expand Up @@ -51,7 +59,7 @@ export const EmbedBubble = ({ step, onTransitionEnd }: Props) => {
</div>
<iframe
id="embed-bubble-content"
src={step.content.url}
src={url}
className={
'w-full z-20 p-4 content-opacity ' +
(isTyping ? 'opacity-0' : 'opacity-100')
Expand Down

4 comments on commit 4d98de2

@vercel
Copy link

@vercel vercel bot commented on 4d98de2 Apr 28, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@vercel
Copy link

@vercel vercel bot commented on 4d98de2 Apr 28, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@vercel
Copy link

@vercel vercel bot commented on 4d98de2 Apr 28, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Successfully deployed to the following URLs:

builder-v2 – ./apps/builder

builder-v2-git-main-typebot-io.vercel.app
builder-v2-typebot-io.vercel.app
app.typebot.io

Please sign in to comment.