-
-
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.
Appears when a new version of Typebot is available Closes #312
- Loading branch information
1 parent
435edd0
commit 8ac3784
Showing
5 changed files
with
111 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
import { forwardRef, Stack, StackProps } from '@chakra-ui/react' | ||
import { motion, MotionProps, isValidMotionProp } from 'framer-motion' | ||
|
||
export const MotionStack = motion( | ||
forwardRef<MotionProps & StackProps, 'div'>((props, ref) => { | ||
const chakraProps = Object.fromEntries( | ||
Object.entries(props).filter(([key]) => !isValidMotionProp(key)) | ||
) | ||
|
||
return <Stack ref={ref} {...chakraProps} /> | ||
}) | ||
) |
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,80 @@ | ||
import { useTypebot } from '@/features/editor' | ||
import { HStack, Stack, Text } from '@chakra-ui/react' | ||
import { useEffect, useState } from 'react' | ||
import { sendRequest } from 'utils' | ||
import { PackageIcon } from './icons' | ||
import { MotionStack } from './MotionStack' | ||
|
||
const intervalDuration = 1000 * 30 // 30 seconds | ||
|
||
export const NewVersionPopup = () => { | ||
const { save } = useTypebot() | ||
const [currentVersion, setCurrentVersion] = useState<string>() | ||
const [isNewVersionAvailable, setIsNewVersionAvailable] = useState(false) | ||
const [isReloading, setIsReloading] = useState(false) | ||
|
||
useEffect(() => { | ||
if (isNewVersionAvailable) return | ||
let cancelRequest = false | ||
const interval = setInterval(async () => { | ||
const { data } = await sendRequest<{ | ||
commitSha: string | undefined | ||
}>('/api/version') | ||
if (!data || cancelRequest) return | ||
if (!currentVersion) { | ||
setCurrentVersion(data.commitSha) | ||
return | ||
} | ||
if (currentVersion !== data.commitSha) { | ||
setIsNewVersionAvailable(true) | ||
} | ||
}, intervalDuration) | ||
|
||
return () => { | ||
cancelRequest = true | ||
clearInterval(interval) | ||
} | ||
}, [currentVersion, isNewVersionAvailable]) | ||
|
||
const saveAndReload = async () => { | ||
if (isReloading) return | ||
setIsReloading(true) | ||
if (save) await save() | ||
window.location.reload() | ||
} | ||
|
||
if (!isNewVersionAvailable) return null | ||
|
||
return ( | ||
<MotionStack | ||
pos="fixed" | ||
bottom="20px" | ||
left="20px" | ||
bgColor="blue.400" | ||
color="white" | ||
cursor="pointer" | ||
p="4" | ||
px="4" | ||
rounded="xl" | ||
shadow="lg" | ||
onClick={saveAndReload} | ||
zIndex={10} | ||
initial={{ opacity: 0, scale: 0.5 }} | ||
animate={{ opacity: 1, scale: 1 }} | ||
whileHover={{ scale: 1.02 }} | ||
whileTap={{ scale: 0.98 }} | ||
borderWidth="2px" | ||
borderColor="blue.300" | ||
> | ||
<HStack spacing={3}> | ||
<PackageIcon boxSize="32px" /> | ||
<Stack spacing={0}> | ||
<Text fontWeight="bold">Typebot is ready to update!</Text> | ||
<Text fontSize="sm" color="gray.200"> | ||
Click to restart | ||
</Text> | ||
</Stack> | ||
</HStack> | ||
</MotionStack> | ||
) | ||
} |
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,7 @@ | ||
import { NextApiRequest, NextApiResponse } from 'next' | ||
|
||
const handler = async (_req: NextApiRequest, res: NextApiResponse) => { | ||
return res.send({ commitSha: process.env.VERCEL_GIT_COMMIT_SHA }) | ||
} | ||
|
||
export default handler |
8ac3784
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
landing-page-v2-typebot-io.vercel.app
get-typebot.com
typebot.io
landing-page-v2-git-main-typebot-io.vercel.app
www.get-typebot.com
www.typebot.io
8ac3784
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:
docs – ./apps/docs
docs-typebot-io.vercel.app
docs-git-main-typebot-io.vercel.app
docs.typebot.io
8ac3784
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
app.typebot.io
builder-v2-typebot-io.vercel.app
builder-v2-git-main-typebot-io.vercel.app
8ac3784
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
ns8.vn
1stop.au
yobot.me
klujo.com
247987.com
8jours.top
aginap.com
bee.cr8.ai
bot.aws.bj
bot.bbc.bj
cat.cr8.ai
finplex.be
stan.vselise.com
start.taxtree.io
typebot.aloe.bot
voicehelp.cr8.ai
zap.fundviser.in
app.chatforms.net
bot.hostnation.de
bot.maitempah.com
bot.phuonghub.com
bot.reviewzer.com
bot.rihabilita.it
cares.urlabout.me
chat.gaswadern.de
fmm.wpwakanda.com
gentleman-shop.fr
k1.kandabrand.com
lb.ticketfute.com
ov1.wpwakanda.com
ov2.wpwakanda.com
ov3.wpwakanda.com
support.triplo.ai
viewer.typebot.io
1988.bouclidom.com
andreimayer.com.br
bot.danyservice.it
bot.iconicbrows.it
bot.megafox.com.br
bot.neferlopez.com
bots.robomotion.io
cadu.uninta.edu.br
dicanatural.online
digitalhelp.com.au
goalsettingbot.com
pant.maxbot.com.br
positivobra.com.br
survey.digienge.io
this-is-a-test.com
zap.techadviser.in
bot.boston-voip.com
bot.cabinpromos.com
bot.digitalbled.com
bot.dsignagency.com
bot.eventhub.com.au
bot.jepierre.com.br
bot.ltmidias.com.br
bot.viralsangat.com
liveconvert.kandalearn.com
mainmenu1one.wpwakanda.com
tarian.theiofoundation.org
ted.meujalecobrasil.com.br
type.dericsoncalari.com.br
bot.pinpointinteractive.com
bot.polychromes-project.com
bot.seidinembroseanchetu.it
chatbot.berbelanjabiz.trade
designguide.techyscouts.com
liveconvert2.kandalearn.com
presente.empresarias.com.mx
sell.sellthemotorhome.co.uk
anamnese.odontopavani.com.br
austin.channelautomation.com
bot.marketingplusmindset.com
bot.seidibergamoseanchetu.it
desabafe.sergiolimajr.com.br
download.venturemarketing.in
piazzatorre.barrettamario.it
type.cookieacademyonline.com
bot.brigadeirosemdrama.com.br
forms.escoladeautomacao.com.br
onboarding.libertydreamcare.ie
type.talitasouzamarques.com.br
agendamento.sergiolimajr.com.br
anamnese.clinicamegasjdr.com.br
bookings.littlepartymonkeys.com
bot.comercializadoraomicron.com
elevateyourmind.groovepages.com
viewer-v2-typebot-io.vercel.app
yourfeedback.comebackreward.com
gerador.verificadordehospedes.com
personal-trainer.barrettamario.it
preagendamento.sergiolimajr.com.br
studiotecnicoimmobiliaremerelli.it
download.thailandmicespecialist.com
register.thailandmicespecialist.com
bot.studiotecnicoimmobiliaremerelli.it
pesquisa.escolamodacomproposito.com.br
anamnese.clinicaramosodontologia.com.br
viewer-v2-git-main-typebot-io.vercel.app