Skip to content

Commit

Permalink
✨ (buttons) Add searchable choices
Browse files Browse the repository at this point in the history
Closes #473
  • Loading branch information
baptisteArno committed Apr 26, 2023
1 parent 124f350 commit 5b4a6c5
Show file tree
Hide file tree
Showing 14 changed files with 687 additions and 77 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -12,40 +12,47 @@ type Props = {
}

export const ButtonsBlockSettings = ({ options, onOptionsChange }: Props) => {
const handleIsMultipleChange = (isMultipleChoice: boolean) =>
const updateIsMultiple = (isMultipleChoice: boolean) =>
options && onOptionsChange({ ...options, isMultipleChoice })
const handleButtonLabelChange = (buttonLabel: string) =>
const updateIsSearchable = (isSearchable: boolean) =>
options && onOptionsChange({ ...options, isSearchable })
const updateButtonLabel = (buttonLabel: string) =>
options && onOptionsChange({ ...options, buttonLabel })
const handleVariableChange = (variable?: Variable) =>
const updateSaveVariable = (variable?: Variable) =>
options && onOptionsChange({ ...options, variableId: variable?.id })
const handleDynamicVariableChange = (variable?: Variable) =>
const updateDynamicDataVariable = (variable?: Variable) =>
options && onOptionsChange({ ...options, dynamicVariableId: variable?.id })

return (
<Stack spacing={4}>
<SwitchWithLabel
label="Multiple choice?"
initialValue={options?.isMultipleChoice ?? false}
onCheckChange={handleIsMultipleChange}
onCheckChange={updateIsMultiple}
/>
<SwitchWithLabel
label="Is searchable?"
initialValue={options?.isSearchable ?? false}
onCheckChange={updateIsSearchable}
/>
{options?.isMultipleChoice && (
<TextInput
label="Button label:"
defaultValue={options?.buttonLabel ?? 'Send'}
onChange={handleButtonLabelChange}
onChange={updateButtonLabel}
/>
)}
<FormControl>
<FormLabel>
Dynamic items from variable:{' '}
Dynamic data:{' '}
<MoreInfoTooltip>
If defined, buttons will be dynamically displayed based on what the
variable contains.
</MoreInfoTooltip>
</FormLabel>
<VariableSearchInput
initialVariableId={options?.dynamicVariableId}
onSelectVariable={handleDynamicVariableChange}
onSelectVariable={updateDynamicDataVariable}
/>
</FormControl>
<Stack>
Expand All @@ -54,7 +61,7 @@ export const ButtonsBlockSettings = ({ options, onOptionsChange }: Props) => {
</FormLabel>
<VariableSearchInput
initialVariableId={options?.variableId}
onSelectVariable={handleVariableChange}
onSelectVariable={updateSaveVariable}
/>
</Stack>
</Stack>
Expand Down
190 changes: 186 additions & 4 deletions apps/docs/openapi/builder/_spec_.json
Original file line number Diff line number Diff line change
Expand Up @@ -295,6 +295,54 @@
"data"
],
"additionalProperties": false
},
{
"type": "object",
"properties": {
"userId": {
"type": "string"
},
"workspaceId": {
"type": "string"
},
"name": {
"type": "string",
"enum": [
"Workspace limit reached"
]
},
"data": {
"type": "object",
"properties": {
"chatsLimit": {
"type": "number"
},
"storageLimit": {
"type": "number"
},
"totalChatsUsed": {
"type": "number"
},
"totalStorageUsed": {
"type": "number"
}
},
"required": [
"chatsLimit",
"storageLimit",
"totalChatsUsed",
"totalStorageUsed"
],
"additionalProperties": false
}
},
"required": [
"userId",
"workspaceId",
"name",
"data"
],
"additionalProperties": false
}
]
}
Expand Down Expand Up @@ -798,6 +846,9 @@
},
"dynamicVariableId": {
"type": "string"
},
"isSearchable": {
"type": "boolean"
}
},
"required": [
Expand Down Expand Up @@ -1743,6 +1794,121 @@
"options"
],
"additionalProperties": false
},
{
"type": "object",
"properties": {
"id": {
"type": "string"
},
"groupId": {
"type": "string"
},
"outgoingEdgeId": {
"type": "string"
},
"type": {
"type": "string",
"enum": [
"AB test"
]
},
"items": {
"type": "array",
"minItems": 2,
"maxItems": 2,
"items": [
{
"type": "object",
"properties": {
"id": {
"type": "string"
},
"blockId": {
"type": "string"
},
"outgoingEdgeId": {
"type": "string"
},
"type": {
"type": "number",
"enum": [
2
]
},
"path": {
"type": "string",
"enum": [
"a"
]
}
},
"required": [
"id",
"blockId",
"type",
"path"
],
"additionalProperties": false
},
{
"type": "object",
"properties": {
"id": {
"type": "string"
},
"blockId": {
"type": "string"
},
"outgoingEdgeId": {
"type": "string"
},
"type": {
"type": "number",
"enum": [
2
]
},
"path": {
"type": "string",
"enum": [
"b"
]
}
},
"required": [
"id",
"blockId",
"type",
"path"
],
"additionalProperties": false
}
]
},
"options": {
"type": "object",
"properties": {
"aPercent": {
"type": "number",
"minimum": 0,
"maximum": 100
}
},
"required": [
"aPercent"
],
"additionalProperties": false
}
},
"required": [
"id",
"groupId",
"type",
"items",
"options"
],
"additionalProperties": false
}
]
},
Expand Down Expand Up @@ -3075,6 +3241,9 @@
"customSeatsLimit": {
"type": "number",
"nullable": true
},
"isQuarantined": {
"type": "boolean"
}
},
"required": [
Expand All @@ -3093,7 +3262,8 @@
"storageLimitSecondEmailSentAt",
"customChatsLimit",
"customStorageLimit",
"customSeatsLimit"
"customSeatsLimit",
"isQuarantined"
],
"additionalProperties": false
}
Expand Down Expand Up @@ -3216,6 +3386,9 @@
"customSeatsLimit": {
"type": "number",
"nullable": true
},
"isQuarantined": {
"type": "boolean"
}
},
"required": [
Expand All @@ -3234,7 +3407,8 @@
"storageLimitSecondEmailSentAt",
"customChatsLimit",
"customStorageLimit",
"customSeatsLimit"
"customSeatsLimit",
"isQuarantined"
],
"additionalProperties": false
}
Expand Down Expand Up @@ -3374,6 +3548,9 @@
"customSeatsLimit": {
"type": "number",
"nullable": true
},
"isQuarantined": {
"type": "boolean"
}
},
"required": [
Expand All @@ -3392,7 +3569,8 @@
"storageLimitSecondEmailSentAt",
"customChatsLimit",
"customStorageLimit",
"customSeatsLimit"
"customSeatsLimit",
"isQuarantined"
],
"additionalProperties": false
}
Expand Down Expand Up @@ -4642,6 +4820,9 @@
"customSeatsLimit": {
"type": "number",
"nullable": true
},
"isQuarantined": {
"type": "boolean"
}
},
"required": [
Expand All @@ -4660,7 +4841,8 @@
"storageLimitSecondEmailSentAt",
"customChatsLimit",
"customStorageLimit",
"customSeatsLimit"
"customSeatsLimit",
"isQuarantined"
],
"additionalProperties": false
}
Expand Down
Loading

4 comments on commit 5b4a6c5

@vercel
Copy link

@vercel vercel bot commented on 5b4a6c5 Apr 26, 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 5b4a6c5 Apr 26, 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
builder-v2-typebot-io.vercel.app
app.typebot.io

@vercel
Copy link

@vercel vercel bot commented on 5b4a6c5 Apr 26, 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

filmylogy.com
goldorayo.com
rabbit.cr8.ai
signup.cr8.ai
start.taxt.co
turkey.cr8.ai
vhpage.cr8.ai
vitamyway.com
am.nigerias.io
an.nigerias.io
app.yvon.earth
ar.nigerias.io
bot.enreso.org
bot.rslabs.pro
bots.bridge.ai
chat.hayuri.id
chat.uprize.hu
chatgpt.lam.ee
chicken.cr8.ai
gollum.riku.ai
gsbulletin.com
journey.cr8.ai
panther.cr7.ai
panther.cr8.ai
pay.sifuim.com
penguin.cr8.ai
talk.gocare.io
test.bot.gives
ticketfute.com
unicorn.cr8.ai
apo.nigerias.io
apr.nigerias.io
aso.nigerias.io
blackcan.cr8.ai
bot.4display.nl
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
sellmycarbr.com
chat.webisharp.com
dicanatural.online
digitalhelp.com.au
goalsettingbot.com
pant.maxbot.com.br
pantherview.cr8.ai
positivobra.com.br
rollingball.cr8.ai
type.dericsoncalari.com.br
bot.pinpointinteractive.com
bot.polychromes-project.com
bot.seidinembroseanchetu.it
chat.semanalimpanome.com.br
designguide.techyscouts.com
liveconvert2.kandalearn.com
presente.empresarias.com.mx
register.algorithmpress.com
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
upload.atlasoutfittersk9.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
bot.cabin-rentals-of-georgia.net
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

@vercel
Copy link

@vercel vercel bot commented on 5b4a6c5 Apr 26, 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.vercel.app
docs.typebot.io

Please sign in to comment.