-
-
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.
♻️ (editor) Improve webhook creation
Remove terrible useEffects
- Loading branch information
1 parent
6e066c4
commit ac464ea
Showing
23 changed files
with
481 additions
and
528 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
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 |
---|---|---|
@@ -1,4 +1,4 @@ | ||
export { duplicateWebhookQueries } from './queries/duplicateWebhookQuery' | ||
export { duplicateWebhookQuery } from './queries/duplicateWebhookQuery' | ||
export { WebhookSettings } from './components/WebhookSettings' | ||
export { WebhookContent } from './components/WebhookContent' | ||
export { WebhookIcon } from './components/WebhookIcon' |
14 changes: 14 additions & 0 deletions
14
apps/builder/src/features/blocks/integrations/webhook/queries/createWebhookQuery.ts
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,14 @@ | ||
import { Webhook } from 'models' | ||
import { sendRequest } from 'utils' | ||
|
||
type Props = { | ||
typebotId: string | ||
data: Partial<Omit<Webhook, 'typebotId'>> | ||
} | ||
|
||
export const createWebhookQuery = ({ typebotId, data }: Props) => | ||
sendRequest<{ webhook: Webhook }>({ | ||
method: 'POST', | ||
url: `/api/typebots/${typebotId}/webhooks`, | ||
body: { data }, | ||
}) |
28 changes: 19 additions & 9 deletions
28
apps/builder/src/features/blocks/integrations/webhook/queries/duplicateWebhookQuery.ts
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 |
---|---|---|
@@ -1,17 +1,27 @@ | ||
import { Webhook } from 'models' | ||
import { sendRequest } from 'utils' | ||
import { saveWebhookQuery } from './saveWebhookQuery' | ||
import { createWebhookQuery } from './createWebhookQuery' | ||
|
||
export const duplicateWebhookQueries = async ( | ||
typebotId: string, | ||
existingWebhookId: string, | ||
newWebhookId: string | ||
): Promise<Webhook | undefined> => { | ||
type Props = { | ||
existingIds: { typebotId: string; webhookId: string } | ||
newIds: { typebotId: string; webhookId: string } | ||
} | ||
export const duplicateWebhookQuery = async ({ | ||
existingIds, | ||
newIds, | ||
}: Props): Promise<Webhook | undefined> => { | ||
const { data } = await sendRequest<{ webhook: Webhook }>( | ||
`/api/webhooks/${existingWebhookId}` | ||
`/api/typebots/${existingIds.typebotId}/webhooks/${existingIds.webhookId}` | ||
) | ||
if (!data) return | ||
const newWebhook = { ...data.webhook, id: newWebhookId, typebotId } | ||
await saveWebhookQuery(newWebhook.id, newWebhook) | ||
const newWebhook = { | ||
...data.webhook, | ||
id: newIds.webhookId, | ||
typebotId: newIds.typebotId, | ||
} | ||
await createWebhookQuery({ | ||
typebotId: newIds.typebotId, | ||
data: { ...data.webhook, id: newIds.webhookId }, | ||
}) | ||
return newWebhook | ||
} |
12 changes: 0 additions & 12 deletions
12
apps/builder/src/features/blocks/integrations/webhook/queries/saveWebhookQuery.ts
This file was deleted.
Oops, something went wrong.
15 changes: 15 additions & 0 deletions
15
apps/builder/src/features/blocks/integrations/webhook/queries/updateWebhookQuery.ts
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,15 @@ | ||
import { Webhook } from 'models' | ||
import { sendRequest } from 'utils' | ||
|
||
type Props = { | ||
typebotId: string | ||
webhookId: string | ||
data: Partial<Omit<Webhook, 'id' | 'typebotId'>> | ||
} | ||
|
||
export const updateWebhookQuery = ({ typebotId, webhookId, data }: Props) => | ||
sendRequest<{ webhook: Webhook }>({ | ||
method: 'PATCH', | ||
url: `/api/typebots/${typebotId}/webhooks/${webhookId}`, | ||
body: { data }, | ||
}) |
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
Oops, something went wrong.
ac464ea
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
typebot.io
www.get-typebot.com
landing-page-v2-git-main-typebot-io.vercel.app
www.typebot.io
get-typebot.com
ac464ea
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
app.yvon.earth
ar.nigerias.io
bot.enreso.org
bot.rslabs.pro
bots.bridge.ai
chat.hayuri.id
chicken.cr8.ai
gollum.riku.ai
gsbulletin.com
panther.cr7.ai
panther.cr8.ai
penguin.cr8.ai
talk.gocare.io
test.bot.gives
ticketfute.com
unicorn.cr8.ai
apo.nigerias.io
apr.nigerias.io
aso.nigerias.io
bot.ageenda.com
bot.artiweb.app
bot.devitus.com
bot.jesopizz.it
bot.reeplai.com
bot.scayver.com
bot.tc-mail.com
chat.lalmon.com
chat.sureb4.com
eventhub.com.au
fitness.riku.ai
games.klujo.com
help.taxtree.io
sakuranembro.it
typebot.aloe.do
bot.contakit.com
bot.piccinato.co
bot.sv-energy.it
botc.ceox.com.br
clo.closeer.work
cockroach.cr8.ai
faqs.nigerias.io
feedback.ofx.one
form.syncwin.com
haymanevents.com
kw.wpwakanda.com
myrentalhost.com
bots.baptiste-arnaud.fr
help.comebackreward.com
link.venturasuceder.com
mainmenu.diddancing.com
manualhandlingcourse.ie
register.kandabrand.com
signup.hypemarketing.in
subfooter.wpwakanda.com
survey.hypemarketing.in
testbot.afterorigin.com
typebot.influencer.love
91181264.your-access.one
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
ac464ea
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
ac464ea
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-git-main-typebot-io.vercel.app
app.typebot.io
builder-v2-typebot-io.vercel.app