2
0

🐛 (share) Fix bubble button default background in embed modals

Closes #1165
This commit is contained in:
Baptiste Arnaud
2024-01-25 12:59:40 +01:00
parent b668ac15f1
commit f9e0cef6fe
3 changed files with 6 additions and 13 deletions

View File

@ -15,7 +15,7 @@ export const IframeSnippet = ({ widthLabel, heightLabel }: Props) => {
const { typebot } = useTypebot() const { typebot } = useTypebot()
const src = `${env.NEXT_PUBLIC_VIEWER_URL[0]}/${typebot?.publicId}` const src = `${env.NEXT_PUBLIC_VIEWER_URL[0]}/${typebot?.publicId}`
const code = prettier.format( const code = prettier.format(
`<iframe src="${src}" style="border: none; width=${widthLabel}; height=${heightLabel}"></iframe>`, `<iframe src="${src}" style="border: none; width: ${widthLabel}; height: ${heightLabel}"></iframe>`,
{ parser: 'html', plugins: [parserHtml] } { parser: 'html', plugins: [parserHtml] }
) )

View File

@ -5,10 +5,13 @@ import { Typebot } from '@typebot.io/schemas'
import { useState } from 'react' import { useState } from 'react'
import { BubbleSettings } from '../../../settings/BubbleSettings/BubbleSettings' import { BubbleSettings } from '../../../settings/BubbleSettings/BubbleSettings'
import { JavascriptBubbleSnippet } from '../JavascriptBubbleSnippet' import { JavascriptBubbleSnippet } from '../JavascriptBubbleSnippet'
import { defaultTheme } from '@typebot.io/schemas/features/typebot/theme/constants'
export const parseDefaultBubbleTheme = (typebot?: Typebot) => ({ export const parseDefaultBubbleTheme = (typebot?: Typebot) => ({
button: { button: {
backgroundColor: typebot?.theme.chat?.buttons?.backgroundColor, backgroundColor:
typebot?.theme.chat?.buttons?.backgroundColor ??
defaultTheme.chat.buttons.backgroundColor,
}, },
}) })

View File

@ -2,7 +2,6 @@ import { CodeEditor } from '@/components/inputs/CodeEditor'
import { useTypebot } from '@/features/editor/providers/TypebotProvider' import { useTypebot } from '@/features/editor/providers/TypebotProvider'
import { Stack, Text } from '@chakra-ui/react' import { Stack, Text } from '@chakra-ui/react'
import { BubbleProps } from '@typebot.io/nextjs' import { BubbleProps } from '@typebot.io/nextjs'
import { Typebot } from '@typebot.io/schemas'
import { useState } from 'react' import { useState } from 'react'
import { BubbleSettings } from '../../../settings/BubbleSettings/BubbleSettings' import { BubbleSettings } from '../../../settings/BubbleSettings/BubbleSettings'
import { import {
@ -11,16 +10,7 @@ import {
typebotImportCode, typebotImportCode,
parseApiHostValue, parseApiHostValue,
} from '../../../snippetParsers' } from '../../../snippetParsers'
import { parseDefaultBubbleTheme } from '../../Javascript/instructions/JavascriptBubbleInstructions'
export const parseDefaultBubbleTheme = (typebot?: Typebot) => ({
button: {
backgroundColor: typebot?.theme.chat?.buttons?.backgroundColor,
iconColor: typebot?.theme.chat?.buttons?.color,
},
previewMessage: {
backgroundColor: typebot?.theme.general?.background?.content,
},
})
export const ScriptBubbleInstructions = () => { export const ScriptBubbleInstructions = () => {
const { typebot } = useTypebot() const { typebot } = useTypebot()