Skip to content

Commit

Permalink
🐛 (stream) Fix target attribute being trimmed on message stream
Browse files Browse the repository at this point in the history
  • Loading branch information
baptisteArno committed Dec 13, 2023
1 parent fbddddc commit bf626bb
Show file tree
Hide file tree
Showing 7 changed files with 14 additions and 9 deletions.
2 changes: 1 addition & 1 deletion packages/embeds/js/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@typebot.io/js",
"version": "0.2.27",
"version": "0.2.28",
"description": "Javascript library to display typebots on your website",
"type": "module",
"main": "dist/index.js",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,9 @@ export const StreamingBubble = (props: Props) => {
createEffect(() => {
if (streamingMessage()?.id === props.streamingMessageId)
setContent(
domPurify.sanitize(marked.parse(streamingMessage()?.content ?? ''))
domPurify.sanitize(marked.parse(streamingMessage()?.content ?? ''), {
ADD_ATTR: ['target'],
})
)
})

Expand Down
7 changes: 5 additions & 2 deletions packages/embeds/js/src/features/bubble/components/Bubble.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,10 @@ export const Bubble = (props: BubbleProps) => {
<div
part="bot"
style={{
height: 'calc(100% - 80px)',
height:
props.theme?.button?.size === 'large'
? 'calc(100% - 95px)'
: 'calc(100% - 80px)',
'max-height': props.theme?.chatWindow?.maxHeight ?? '704px',
'max-width': props.theme?.chatWindow?.maxWidth ?? '400px',
transition:
Expand All @@ -177,7 +180,7 @@ export const Bubble = (props: BubbleProps) => {
(props.theme?.button?.size === 'large'
? ' bottom-24'
: ' bottom-20') +
(props.theme?.placement === 'left' ? ' sm:left-5' : ' sm:right-5')
(props.theme?.placement === 'left' ? ' left-5' : ' right-5')
}
>
<Show when={isBotStarted()}>
Expand Down
4 changes: 2 additions & 2 deletions packages/embeds/js/src/window.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,13 +24,13 @@ export const initStandard = (props: BotProps & { id?: string }) => {
export const initPopup = (props: PopupProps) => {
const popupElement = document.createElement('typebot-popup')
Object.assign(popupElement, props)
document.body.appendChild(popupElement)
document.body.prepend(popupElement)
}

export const initBubble = (props: BubbleProps) => {
const bubbleElement = document.createElement('typebot-bubble')
Object.assign(bubbleElement, props)
document.body.appendChild(bubbleElement)
document.body.prepend(bubbleElement)
}

type Typebot = {
Expand Down
2 changes: 1 addition & 1 deletion packages/embeds/nextjs/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@typebot.io/nextjs",
"version": "0.2.27",
"version": "0.2.28",
"description": "Convenient library to display typebots on your Next.js website",
"main": "dist/index.js",
"types": "dist/index.d.ts",
Expand Down
2 changes: 1 addition & 1 deletion packages/embeds/react/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@typebot.io/react",
"version": "0.2.27",
"version": "0.2.28",
"description": "Convenient library to display typebots on your React app",
"main": "dist/index.js",
"types": "dist/index.d.ts",
Expand Down
2 changes: 1 addition & 1 deletion packages/embeds/react/src/Bubble.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ export const Bubble = (props: Props) => {
) as BubbleElement
bubbleElement.current = newBubbleElement
injectPropsToElement(bubbleElement.current, props)
document.body.append(bubbleElement.current)
document.body.prepend(bubbleElement.current)
}, [])

useEffect(() => {
Expand Down

3 comments on commit bf626bb

@vercel
Copy link

@vercel vercel bot commented on bf626bb Dec 13, 2023

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:

viewer-v2 – ./apps/viewer

chat.marius.digital
chat.mosdent.com.tr
chat.rahsiakami.com
chat.sr7digital.com
chatbot.matthesv.de
chatbot.repplai.com
chatwebandreia.site
co.onewebcenter.com
cr.onewebcenter.com
www.techmate.africa
88584434.therpm.club
92109660.therpm.club
app.horadelucrar.com
app.whatisappweb.com
aprendendojuntos.app
assistent.m-vogel.de
ativandograna.online
bium.gratirabbit.com
bot.ansuraniphone.my
bot.barrettamario.it
bot.buenanoticia.fun
bot.conhecaojogo.com
bot.cotemeuplano.com
bot.doispontozero.co
bot.ejenhartanah.xyz
bot.gameincrivel.com
bot.gamesimples.club
bot.grupodojo.com.br
bot.jogodofuturo.com
bot.jogoquelucra.com
bot.lucro-diario.fun
bot.mycompay.reviews
bot.saude-diaria.fun
bot.socialcliques.me
bt.49educacao.com.br
cha.onewebcenter.com
chat.febredojogo.com
chat.gnipharmahq.com
chat.hayurihijab.com
chat.jottagreens.com
chat.nexttoll.online
chatbee.agfunnel.com
click.sevenoways.com
compleat.jetdigi.com
connect.growthguy.in
consultalimpa.online
consulte-gratis.info
consulte-gratis.site
detetivepatricia.com
drapamela.gikpro.com
drgisellegarcia.site
eljogadoroficial.com
encodebot.share5.net
feiraolimpa-nome.com
forms.bonanza.design
govbr-receber.online
govbrconsulta.online
hello.advergreen.com
infomakeracademy.com
viewer-v2-typebot-io.vercel.app
register.thailandmicespecialist.com
mdb.assessoria.desideri.progenbr.com
mdb.assessoria.fernanda.progenbr.com
mdb.assessoria.jbatista.progenbr.com
mdb.assessoria.mauricio.progenbr.com
mdb.evento.autocadastro.progenbr.com
form.shopmercedesbenzsouthorlando.com
mdb.evento.equipeinterna.progenbr.com
bot.studiotecnicoimmobiliaremerelli.it
mdb.assessoria.boaventura.progenbr.com
mdb.assessoria.jtrebesqui.progenbr.com
pesquisa.escolamodacomproposito.com.br
anamnese.clinicaramosodontologia.com.br
gabinete.baleia.formulario.progenbr.com
mdb.assessoria.carreirinha.progenbr.com
chrome-os-inquiry-system.itschromeos.com
mdb.assessoria.paulomarques.progenbr.com
viewer-v2-git-main-typebot-io.vercel.app
main-menu-for-itschromeos.itschromeos.com
mdb.assessoria.qrcode.ademir.progenbr.com
mdb.assessoria.qrcode.arthur.progenbr.com
mdb.assessoria.qrcode.danilo.progenbr.com
mdb.assessoria.qrcode.marcao.progenbr.com
mdb.assessoria.qrcode.marcio.progenbr.com
mdb.assessoria.qrcode.aloisio.progenbr.com
mdb.assessoria.qrcode.girotto.progenbr.com
mdb.assessoria.qrcode.marinho.progenbr.com
mdb.assessoria.qrcode.rodrigo.progenbr.com
mdb.assessoria.carlosalexandre.progenbr.com
mdb.assessoria.qrcode.desideri.progenbr.com
mdb.assessoria.qrcode.fernanda.progenbr.com
mdb.assessoria.qrcode.jbatista.progenbr.com
mdb.assessoria.qrcode.mauricio.progenbr.com
mdb.assessoria.fernanda.regional.progenbr.com
mdb.assessoria.qrcode.boaventura.progenbr.com
mdb.assessoria.qrcode.jtrebesqui.progenbr.com
mdb.assessoria.qrcode.carreirinha.progenbr.com
mdb.assessoria.qrcode.paulomarques.progenbr.com
mdb.assessoria.qrcode.carlosalexandre.progenbr.com
mdb.assessoria.qrcode.fernanda.regional.progenbr.com

@vercel
Copy link

@vercel vercel bot commented on bf626bb Dec 13, 2023

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

@vercel
Copy link

@vercel vercel bot commented on bf626bb Dec 13, 2023

Choose a reason for hiding this comment

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

Please sign in to comment.