Skip to content

Commit

Permalink
🚸 (typebotLink) Make sure variables from child bots are merged if nec…
Browse files Browse the repository at this point in the history
…essary
  • Loading branch information
baptisteArno committed Sep 18, 2023
1 parent 0ccc2ef commit 21ad061
Showing 1 changed file with 17 additions and 6 deletions.
23 changes: 17 additions & 6 deletions apps/viewer/src/features/chat/helpers/getNextGroup.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { byId } from '@typebot.io/lib'
import { Group, SessionState } from '@typebot.io/schemas'
import { byId, isNotDefined } from '@typebot.io/lib'
import { Group, SessionState, VariableWithValue } from '@typebot.io/schemas'
import { upsertResult } from '../queries/upsertResult'
import { isDefined } from '@udecode/plate-common'

export type NextGroup = {
group?: Group
Expand Down Expand Up @@ -31,15 +32,25 @@ export const getNextGroup =
typebot: isMergingWithParent
? {
...state.typebotsQueue[1].typebot,
variables: state.typebotsQueue[1].typebot.variables.map(
(variable) => ({
variables: state.typebotsQueue[1].typebot.variables
.map((variable) => ({
...variable,
value:
state.typebotsQueue[0].answers.find(
(answer) => answer.key === variable.name
)?.value ?? variable.value,
})
),
}))
.concat(
state.typebotsQueue[0].typebot.variables.filter(
(variable) =>
isDefined(variable.value) &&
isNotDefined(
state.typebotsQueue[1].typebot.variables.find(
(v) => v.name === variable.name
)
)
) as VariableWithValue[]
),
}
: state.typebotsQueue[1].typebot,
answers: isMergingWithParent
Expand Down

4 comments on commit 21ad061

@vercel
Copy link

@vercel vercel bot commented on 21ad061 Sep 18, 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 21ad061 Sep 18, 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-git-main-typebot-io.vercel.app
docs.typebot.io
docs-typebot-io.vercel.app

@vercel
Copy link

@vercel vercel bot commented on 21ad061 Sep 18, 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

bot.rslabs.pro
bots.bng.tools
bots.bridge.ai
chad.gocto.com
chat.hayuri.id
chat.uprize.hu
chatgpt.lam.ee
chicken.cr8.ai
drayumi.social
gollum.riku.ai
gsbulletin.com
journey.cr8.ai
kopibayane.com
panther.cr7.ai
panther.cr8.ai
pay.sifuim.com
penguin.cr8.ai
segredomeu.com
semaknilai.com
talk.gocare.io
test.bot.gives
ticketfute.com
unicorn.cr8.ai
whats-app.chat
apo.nigerias.io
app.blogely.com
apr.nigerias.io
aso.nigerias.io
blackcan.cr8.ai
blackvip.online
bot.4display.nl
bot.a6t-you.com
bot.artiweb.app
bot.devitus.com
bot.reeplai.com
bot.scayver.com
bot.tc-mail.com
carspecs.lam.ee
chat.borang.net
chat.lalmon.com
chat.sureb4.com
conversawpp.com
eventhub.com.au
feiraododia.com
fitness.riku.ai
games.klujo.com
localove.online
projektelco.com
proscale.com.br
sellmycarbr.com
svhmapp.mprs.in
typebot.aloe.do
acordo-certo.com
app-liberado.pro
ask.pemantau.org
batepapo.digital
bot.contakit.com
bot.imovfast.com
bot.piccinato.co
chat.sifucrm.com
chat.syncwin.com
chatonlineja.com
clo.closeer.work
cockroach.cr8.ai
desafioem21d.com
digitando.online
faqs.nigerias.io
feiraodehoje.com
georgemarttt.com
go.chatbotcv.com
haymanevents.com
kw.wpwakanda.com
localamor.online
lojamundobox.com
my.skillbrow.com
myrentalhost.com
silvercop.com.br
silvercop.online
stan.vselise.com
typebot.aloe.bot
vidalimentar.com
voicehelp.cr8.ai
web.bjogador.com
webwhatsapp.work
whatisappweb.com
www.pantaflow.ai
zap.fundviser.in
analistamines.com
app.bouclidom.com
app.chatforms.net
appbotcontato.com
appmillion.online
averdadehoje.site
bot.cerograsa.com
bot.chatbotcv.com
bot.hostnation.de
bot.ketoolife.com
bot.maitempah.com
agendaestrategica.com
atendimento.vrauu.com

@vercel
Copy link

@vercel vercel bot commented on 21ad061 Sep 18, 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-git-main-typebot-io.vercel.app
app.typebot.io
builder-v2-typebot-io.vercel.app

Please sign in to comment.