2
0

⬆️ Upgrade dependencies

This commit is contained in:
Baptiste Arnaud
2022-12-25 09:13:33 +01:00
parent 431ad7c78c
commit b0075fd374
17 changed files with 1088 additions and 1169 deletions

View File

@ -1,3 +1,4 @@
/* eslint-disable @typescript-eslint/no-empty-function */
import {
BubbleActions,
BubbleParams,
@ -21,8 +22,7 @@ export const initBubble = (params: BubbleParams): BubbleActions => {
| HTMLDivElement
| undefined
if (existingBubble) existingBubble.remove()
const { bubbleElement, proactiveMessageElement, iframeElement } =
createBubble(params)
const { bubbleElement, proactiveMessageElement } = createBubble(params)
if (
(params.autoOpenDelay || params.autoOpenDelay === 0) &&
!hasBeenClosed()
@ -33,7 +33,7 @@ export const initBubble = (params: BubbleParams): BubbleActions => {
!document.body
? (window.onload = () => document.body.appendChild(bubbleElement))
: document.body.appendChild(bubbleElement)
return getBubbleActions(bubbleElement, iframeElement, proactiveMessageElement)
return getBubbleActions(bubbleElement, proactiveMessageElement)
}
const createBubble = (
@ -75,18 +75,12 @@ const onProactiveMessageClick = (
export const getBubbleActions = (
bubbleElement?: HTMLDivElement,
iframeElement?: HTMLIFrameElement,
proactiveMessageElement?: HTMLDivElement
): BubbleActions => {
const existingBubbleElement =
bubbleElement ??
(document.querySelector('#typebot-bubble') as HTMLDivElement | undefined)
if (!existingBubbleElement) return { close: () => {}, open: () => {} }
const existingIframeElement =
iframeElement ??
(existingBubbleElement.querySelector(
'.typebot-iframe'
) as HTMLIFrameElement)
const existingProactiveMessage =
proactiveMessageElement ??
document.querySelector('#typebot-bubble .proactive-message')

View File

@ -1,3 +1,4 @@
/* eslint-disable @typescript-eslint/no-empty-function */
import { createIframe } from '../../iframe'
import { PopupActions, PopupParams } from '../../types'
import './style.css'