2
0

⚗️ Implement bot v2 MVP (#194)

Closes #190
This commit is contained in:
Baptiste Arnaud
2022-12-22 17:02:34 +01:00
committed by GitHub
parent e55823e011
commit 1a3869ae6d
202 changed files with 8060 additions and 1152 deletions

View File

@ -8,7 +8,7 @@
"scripts": {
"build": "pnpm tsc --noEmit && tsup",
"dev": "tsup --watch",
"lint": "eslint \"src/**/*.ts*\""
"lint": "eslint --fix \"src/**/*.ts*\""
},
"dependencies": {
"@stripe/react-stripe-js": "1.16.1",

View File

@ -1,4 +1,4 @@
import React, { useEffect, useRef, useState } from 'react'
import { useEffect, useRef, useState } from 'react'
import { TransitionGroup, CSSTransition } from 'react-transition-group'
import { AvatarSideContainer } from './AvatarSideContainer'
import { LinkedTypebot, useTypebot } from '../../providers/TypebotProvider'
@ -250,7 +250,7 @@ const ChatChunks = ({
}: Props) => {
const [isSkipped, setIsSkipped] = useState(false)
const avatarSideContainerRef = useRef<any>()
const avatarSideContainerRef = useRef<{ refreshTopOffset: () => void }>()
useEffect(() => {
refreshTopOffset()

View File

@ -1,4 +1,4 @@
import React, { CSSProperties, useMemo } from 'react'
import { CSSProperties, useMemo } from 'react'
import { TypebotProvider } from '../providers/TypebotProvider'
import Frame from 'react-frame-component'
import styles from '../assets/style.css'
@ -7,7 +7,6 @@ import phoneSyle from '../assets/phone.css'
import { ConversationContainer } from './ConversationContainer'
import { AnswersProvider } from '../providers/AnswersProvider'
import {
Answer,
AnswerInput,
BackgroundType,
Edge,

View File

@ -83,7 +83,7 @@ const VideoContent = ({
)
if (!content?.type) return <></>
switch (content.type) {
case VideoBubbleContentType.URL:
case VideoBubbleContentType.URL: {
const isSafariBrowser = window.navigator.vendor.match(/apple/i)
return (
<video
@ -102,6 +102,7 @@ const VideoContent = ({
Sorry, your browser doesn&apos;t support embedded videos.
</video>
)
}
case VideoBubbleContentType.VIMEO:
case VideoBubbleContentType.YOUTUBE: {
const baseUrl =

View File

@ -1,4 +1,4 @@
const emailRegex =
/^(([^<>()\[\]\\.,;:\s@"]+(\.[^<>()\[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/
/^(([^<>()[\]\\.,;:\s@"]+(\.[^<>()[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/
export const validateEmail = (email: string) => emailRegex.test(email)

View File

@ -19,6 +19,7 @@ export const PhoneInput = ({
hasGuestAvatar,
}: PhoneInputProps) => {
const [inputValue, setInputValue] = useState(defaultValue ?? '')
// eslint-disable-next-line @typescript-eslint/no-explicit-any
const inputRef = useRef<any>(null)
const handleChange = (inputValue: Value | undefined) =>

View File

@ -1,7 +1,6 @@
import { LinkedTypebot } from '@/providers/TypebotProvider'
import { EdgeId, LogicState } from '@/types'
import { TypebotLinkBlock, Edge, PublicTypebot } from 'models'
import { byId } from 'utils'
import { fetchAndInjectTypebot } from '../queries/fetchAndInjectTypebotQuery'
export const executeTypebotLink = async (

View File

@ -15,6 +15,7 @@ const answersContext = createContext<{
answer: AnswerInput & { uploadedFiles: boolean }
) => Promise<void> | undefined
updateVariables: (variables: VariableWithUnknowValue[]) => void
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
//@ts-ignore
}>({})

View File

@ -2,6 +2,7 @@ import React, { createContext, ReactNode, useContext } from 'react'
const chatContext = createContext<{
scroll: () => void
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
//@ts-ignore
}>({})

View File

@ -42,6 +42,7 @@ const typebotContext = createContext<{
edgeId: string
}) => void
onNewLog: (log: Omit<Log, 'id' | 'createdAt' | 'resultId'>) => void
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
//@ts-ignore
}>({})