-
-
Notifications
You must be signed in to change notification settings - Fork 2.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
ceedb05
commit 1fdf7e7
Showing
29 changed files
with
512 additions
and
790 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
119 changes: 119 additions & 0 deletions
119
apps/builder/components/templates/CreateNewTypebotButtons.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,119 @@ | ||
import { | ||
VStack, | ||
Heading, | ||
Stack, | ||
Tooltip, | ||
Button, | ||
useDisclosure, | ||
useToast, | ||
} from '@chakra-ui/react' | ||
import { ToolIcon, TemplateIcon, DownloadIcon } from 'assets/icons' | ||
import { useUser } from 'contexts/UserContext' | ||
import { Typebot } from 'models' | ||
import { useRouter } from 'next/router' | ||
import React, { useEffect, useState } from 'react' | ||
import { importTypebot, createTypebot } from 'services/typebots' | ||
import { ImportTypebotFromFileButton } from './ImportTypebotFromFileButton' | ||
import { TemplatesModal } from './TemplatesModal' | ||
|
||
export const CreateNewTypebotButtons = () => { | ||
const { user } = useUser() | ||
const router = useRouter() | ||
const { isOpen, onOpen, onClose } = useDisclosure() | ||
const [isFromScratchTooltipOpened, setIsFromScratchTooltipOpened] = | ||
useState(false) | ||
|
||
const [isLoading, setIsLoading] = useState(false) | ||
|
||
const toast = useToast({ | ||
position: 'top-right', | ||
status: 'error', | ||
title: 'An error occured', | ||
}) | ||
|
||
useEffect(() => { | ||
if (!router.isReady) return | ||
const isFirstBot = router.query.isFirstBot as string | undefined | ||
if (isFirstBot) setIsFromScratchTooltipOpened(true) | ||
// eslint-disable-next-line react-hooks/exhaustive-deps | ||
}, [router.isReady]) | ||
|
||
const handleCreateSubmit = async (typebot?: Typebot) => { | ||
if (!user) return | ||
setIsLoading(true) | ||
const folderId = router.query.folderId?.toString() ?? null | ||
const { error, data } = typebot | ||
? await importTypebot( | ||
{ | ||
...typebot, | ||
ownerId: user.id, | ||
folderId, | ||
theme: { | ||
...typebot.theme, | ||
chat: { | ||
...typebot.theme.chat, | ||
hostAvatar: { isEnabled: true, url: user.image ?? undefined }, | ||
}, | ||
}, | ||
}, | ||
user | ||
) | ||
: await createTypebot({ | ||
folderId, | ||
}) | ||
if (error) toast({ description: error.message }) | ||
if (data) router.push(`/typebots/${data.id}/edit`) | ||
setIsLoading(false) | ||
} | ||
|
||
return ( | ||
<VStack maxW="600px" w="full" flex="1" pt="20" spacing={10}> | ||
<Heading>Create a new typebot</Heading> | ||
<Stack w="full" spacing={6}> | ||
<Tooltip | ||
isOpen={isFromScratchTooltipOpened} | ||
label="Strongly suggested if you're new to Typebot." | ||
maxW="200px" | ||
hasArrow | ||
placement="right" | ||
rounded="md" | ||
> | ||
<Button | ||
variant="outline" | ||
w="full" | ||
py="8" | ||
fontSize="lg" | ||
leftIcon={<ToolIcon color="blue.500" boxSize="25px" mr="2" />} | ||
onClick={() => handleCreateSubmit()} | ||
isLoading={isLoading} | ||
> | ||
Start from scratch | ||
</Button> | ||
</Tooltip> | ||
<Button | ||
variant="outline" | ||
w="full" | ||
py="8" | ||
fontSize="lg" | ||
leftIcon={<TemplateIcon color="orange.500" boxSize="25px" mr="2" />} | ||
onClick={onOpen} | ||
isLoading={isLoading} | ||
> | ||
Start from a template | ||
</Button> | ||
<ImportTypebotFromFileButton | ||
variant="outline" | ||
w="full" | ||
py="8" | ||
fontSize="lg" | ||
leftIcon={<DownloadIcon color="purple.500" boxSize="25px" mr="2" />} | ||
isLoading={isLoading} | ||
onNewTypebot={handleCreateSubmit} | ||
> | ||
Import a file | ||
</ImportTypebotFromFileButton> | ||
</Stack> | ||
<TemplatesModal isOpen={isOpen} onClose={onClose} /> | ||
</VStack> | ||
) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
import { | ||
Button, | ||
Heading, | ||
HStack, | ||
Modal, | ||
ModalBody, | ||
ModalContent, | ||
ModalFooter, | ||
ModalHeader, | ||
ModalOverlay, | ||
Stack, | ||
useToast, | ||
} from '@chakra-ui/react' | ||
import { TypebotViewer } from 'bot-engine' | ||
import { Typebot } from 'models' | ||
import React, { useEffect, useState } from 'react' | ||
import { parseTypebotToPublicTypebot } from 'services/publicTypebot' | ||
import { sendRequest } from 'utils' | ||
import { TemplateProps, templates } from './data' | ||
|
||
type Props = { isOpen: boolean; onClose: () => void } | ||
|
||
export const TemplatesModal = ({ isOpen, onClose }: Props) => { | ||
const [typebot, setTypebot] = useState<Typebot>() | ||
|
||
const toast = useToast({ | ||
position: 'top-right', | ||
status: 'error', | ||
}) | ||
|
||
useEffect(() => { | ||
fetchTemplate(templates[0]) | ||
// eslint-disable-next-line react-hooks/exhaustive-deps | ||
}, []) | ||
|
||
const fetchTemplate = async (template: TemplateProps) => { | ||
const { data, error } = await sendRequest(`/templates/${template.fileName}`) | ||
if (error) return toast({ title: error.name, description: error.message }) | ||
setTypebot(data as Typebot) | ||
} | ||
|
||
return ( | ||
<Modal isOpen={isOpen} onClose={onClose} size="6xl"> | ||
<ModalOverlay /> | ||
<ModalContent> | ||
<ModalHeader as={HStack} justifyContent="space-between" w="full"> | ||
<Heading fontSize="xl">Lead generation</Heading> | ||
</ModalHeader> | ||
<ModalBody as={HStack}> | ||
{typebot && ( | ||
<TypebotViewer typebot={parseTypebotToPublicTypebot(typebot)} /> | ||
)} | ||
<Stack> | ||
<Button colorScheme="blue">Use this template</Button> | ||
</Stack> | ||
</ModalBody> | ||
|
||
<ModalFooter /> | ||
</ModalContent> | ||
</Modal> | ||
) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
export type TemplateProps = { name: string; emoji: string; fileName: string } | ||
|
||
export const templates: TemplateProps[] = [ | ||
{ name: 'Lead Generation', emoji: '🤝', fileName: 'lead-gen.json' }, | ||
{ name: 'Customer Support', emoji: '😍', fileName: 'customer-support.json' }, | ||
] |
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.
1fdf7e7
There was a problem hiding this comment.
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-alpha – ./apps/viewer
forms.webisharp.com
viewer-v2-alpha-typebot-io.vercel.app
bot.upfunnel.art
stan.vselise.com
personal-trainer.barrettamario.it
gcase.barrettamario.it
viewer-v2-alpha-git-main-typebot-io.vercel.app
chat.hayurihijab.com
onboarding.libertydreamcare.ie
aibot.angrybranding.co.uk
1fdf7e7
There was a problem hiding this comment.
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
bergamo.store
app.yvon.earth
bot.joof.it
chat.hayuri.id
talk.gocare.io
yoda.riku.ai
bot.tvbeat.it
gollum.riku.ai
bots.bridge.ai
bot.jesopizz.it
fitness.riku.ai
viewer.typebot.io
bot.contakit.com
zap.fundviser.in
bot.dsignagency.com
bot.rihabilita.it
chatbot.matthesv.de
bot.danyservice.it
demo.wemakebots.xyz
88584434.therpm.club
92109660.therpm.club
bot.barrettamario.it
hello.advergreen.com
bot.eikju.photography
bot.digitalpointer.id
bot.coachayongzul.com
bot.robertohairlab.it
bot.outstandbrand.com
bot.ilmuseoaiborghi.it
criar.somaperuzzo.com
bot.pratikmandalia.com
form.bridesquadapp.com
michaeljackson.riku.ai
91375310.actualizar.xyz
bot.hotelplayarimini.it
arrivalx2.wpwakanda.com
87656003.actualizar.xyz
88152257.actualizar.xyz
link.venturasuceder.com
invite.bridesquadapp.com
chat.thehomebuyersusa.com
forms.hiabhaykulkarni.com
bot.amicidisanfaustino.it
typebot-viewer.vercel.app
casestudyemb.wpwakanda.com
herbalife.barrettamario.it
chat.atlasoutfittersk9.com
homepageonly.wpwakanda.com
bot.adventureconsulting.hu
liveconvert.kandalearn.com
mainmenu1one.wpwakanda.com
bot.pinpointinteractive.com
bot.seidibergamoseanchetu.it
bot.polychromes-project.com
tarian.theiofoundation.org
bot.seidinembroseanchetu.it
liveconvert2.kandalearn.com
bot.studiotecnicoimmobiliaremerelli.it
forms.escoladeautomacao.com.br
viewer-v2-typebot-io.vercel.app
viewer-v2-git-main-typebot-io.vercel.app
1fdf7e7
There was a problem hiding this comment.
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:
landing-page-v2 – ./apps/landing-page
get-typebot.com
landing-page-v2-git-main-typebot-io.vercel.app
landing-page-v2-typebot-io.vercel.app
www.get-typebot.com
www.typebot.io
typebot.io
1fdf7e7
There was a problem hiding this comment.
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-typebot-io.vercel.app
app.typebot.io
builder-v2-git-main-typebot-io.vercel.app