Skip to content

Commit

Permalink
🚸 (webhook) Also add atomic deep keys selection
Browse files Browse the repository at this point in the history
  • Loading branch information
baptisteArno committed Mar 2, 2023
1 parent 506fe00 commit 73f4846
Show file tree
Hide file tree
Showing 2 changed files with 39 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,39 @@ export const WebhookSettings = ({
if (error)
return showToast({ title: error.name, description: error.message })
setTestResponse(JSON.stringify(data, undefined, 2))
setResponseKeys(getDeepKeys(data))
setResponseKeys(
getDeepKeys({
employees: [
{
name: 'Shyam',
email: 'shyamjaiswal@gmail.com',
employees: [
{ name: 'Shyam', email: 'shyamjaiswal@gmail.com' },
{ name: 'Bob', email: 'bob32@gmail.com' },
{ name: 'Jai', email: 'jai87@gmail.com' },
],
},
{
name: 'Bob',
email: 'bob32@gmail.com',
employees: [
{ name: 'Shyam', email: 'shyamjaiswal@gmail.com' },
{ name: 'Bob', email: 'bob32@gmail.com' },
{ name: 'Jai', email: 'jai87@gmail.com' },
],
},
{
name: 'Jai',
email: 'jai87@gmail.com',
employees: [
{ name: 'Shyam', email: 'shyamjaiswal@gmail.com' },
{ name: 'Bob', email: 'bob32@gmail.com' },
{ name: 'Jai', email: 'jai87@gmail.com' },
],
},
],
})
)
setIsTestResponseLoading(false)
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,19 +11,18 @@ export const getDeepKeys = (obj: any): string[] => {
)
} else if (Array.isArray(obj[key])) {
if (obj[key].length === 0) continue
if (obj[key].length === 1) {
const subkeys = getDeepKeys(obj[key][0])

const subkeys = getDeepKeys(obj[key][0])
if (obj[key].length > 1) {
keys = keys.concat(
subkeys.map(function (subkey) {
return `${key}[0]${parseKey(subkey)}`
return `${key}.flatMap(item => item${parseKey(subkey)})`
})
)
continue
}
const subkeys = getDeepKeys(obj[key][0])
keys = keys.concat(
subkeys.map(function (subkey) {
return `${key}.flatMap(item => item${parseKey(subkey)})`
subkeys.map(function (subkey, idx) {
return `${key}[${idx}]${parseKey(subkey)}`
})
)
} else {
Expand Down

4 comments on commit 73f4846

@vercel
Copy link

@vercel vercel bot commented on 73f4846 Mar 2, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@vercel
Copy link

@vercel vercel bot commented on 73f4846 Mar 2, 2023

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
builder-v2-git-main-typebot-io.vercel.app
app.typebot.io

@vercel
Copy link

@vercel vercel bot commented on 73f4846 Mar 2, 2023

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

@vercel
Copy link

@vercel vercel bot commented on 73f4846 Mar 2, 2023

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

am.nigerias.io
an.nigerias.io
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
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
stan.vselise.com
carsalesenquiry.com
chat.marius.digital
chatbot.matthesv.de
chatbot.repplai.com
demo.botscientis.us
demo.wemakebots.xyz
forms.webisharp.com
kbsub.wpwakanda.com
nutrisamirbayde.com
ted.meujalecobrasil.com.br
type.dericsoncalari.com.br
bot.pinpointinteractive.com
bot.polychromes-project.com
bot.seidinembroseanchetu.it
chatbot.berbelanjabiz.trade
designguide.techyscouts.com
jcapp.virtuesocialmedia.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
jc-app.virtuesocialmedia.com
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
chrome-os-inquiry-system.itschromeos.com
viewer-v2-git-main-typebot-io.vercel.app
main-menu-for-itschromeos.itschromeos.com

Please sign in to comment.