Skip to content

Commit

Permalink
🐛 Deprecate blockId field in items
Browse files Browse the repository at this point in the history
  • Loading branch information
baptisteArno committed Aug 16, 2023
1 parent f508c97 commit 019f72a
Show file tree
Hide file tree
Showing 9 changed files with 34 additions and 37 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -54,10 +54,7 @@ export const ButtonsItemNode = ({ item, indices, isMouseOver }: Props) => {

const handlePlusClick = () => {
const itemIndex = indices.itemIndex + 1
createItem(
{ blockId: item.blockId, type: ItemType.BUTTON },
{ ...indices, itemIndex }
)
createItem({ type: ItemType.BUTTON }, { ...indices, itemIndex })
}

const updateItemSettings = (settings: Omit<ButtonItem, 'content'>) => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,10 +40,7 @@ export const PictureChoiceItemNode = ({
const handlePlusClick = (e: React.MouseEvent) => {
e.stopPropagation()
const itemIndex = indices.itemIndex + 1
createItem(
{ blockId: item.blockId, type: ItemType.PICTURE_CHOICE },
{ ...indices, itemIndex }
)
createItem({ type: ItemType.PICTURE_CHOICE }, { ...indices, itemIndex })
}

const handleMouseDown = (e: React.MouseEvent) => e.stopPropagation()
Expand Down Expand Up @@ -139,6 +136,10 @@ export const PictureChoiceItemNode = ({
<PictureChoiceItemSettings
typebotId={typebot.id}
item={item}
blockId={
typebot.groups[indices.groupIndex].blocks[indices.blockIndex]
.id
}
onItemChange={handleItemChange}
/>
)}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,14 @@ import { Condition, LogicalOperator } from '@typebot.io/schemas'

type Props = {
typebotId: string
blockId: string
item: PictureChoiceItem
onItemChange: (updates: Partial<PictureChoiceItem>) => void
}

export const PictureChoiceItemSettings = ({
typebotId,
blockId,
item,
onItemChange,
}: Props) => {
Expand Down Expand Up @@ -67,7 +69,7 @@ export const PictureChoiceItemSettings = ({
</PopoverTrigger>
<PopoverContent p="4" w="500px">
<ImageUploadContent
filePath={`typebots/${typebotId}/blocks/${item.blockId}/items/${item.id}`}
filePath={`typebots/${typebotId}/blocks/${blockId}/items/${item.id}`}
defaultUrl={item.pictureSrc}
onSubmit={(url) => {
updateImage(url)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ test.describe.parallel('Picture choice input block', () => {
items: [
{
id: 'choice1',
blockId: 'block1',
type: ItemType.PICTURE_CHOICE,
},
],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,6 @@ export const ConditionItemNode = ({ item, isMouseOver, indices }: Props) => {
const newItemId = createId()
createItem(
{
blockId: item.blockId,
type: ItemType.CONDITION,
id: newItemId,
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,6 @@ const duplicateTypebot = (
...newIds,
items: block.items.map((item) => ({
...item,
blockId: blockIdsMapping.get(item.blockId) as string,
outgoingEdgeId: item.outgoingEdgeId
? (edgeIdsMapping.get(item.outgoingEdgeId) as string)
: undefined,
Expand Down
20 changes: 10 additions & 10 deletions apps/docs/openapi/builder/_spec_.json
Original file line number Diff line number Diff line change
Expand Up @@ -846,7 +846,8 @@
"type": "string"
},
"blockId": {
"type": "string"
"type": "string",
"description": "Deprecated"
},
"outgoingEdgeId": {
"type": "string"
Expand Down Expand Up @@ -927,7 +928,6 @@
},
"required": [
"id",
"blockId",
"type"
],
"additionalProperties": false
Expand Down Expand Up @@ -1608,7 +1608,8 @@
"type": "string"
},
"blockId": {
"type": "string"
"type": "string",
"description": "Deprecated"
},
"outgoingEdgeId": {
"type": "string"
Expand Down Expand Up @@ -1695,7 +1696,6 @@
},
"required": [
"id",
"blockId",
"type"
],
"additionalProperties": false
Expand Down Expand Up @@ -1826,7 +1826,8 @@
"type": "string"
},
"blockId": {
"type": "string"
"type": "string",
"description": "Deprecated"
},
"outgoingEdgeId": {
"type": "string"
Expand Down Expand Up @@ -1895,7 +1896,6 @@
},
"required": [
"id",
"blockId",
"type",
"content"
],
Expand Down Expand Up @@ -2172,7 +2172,8 @@
"type": "string"
},
"blockId": {
"type": "string"
"type": "string",
"description": "Deprecated"
},
"outgoingEdgeId": {
"type": "string"
Expand All @@ -2192,7 +2193,6 @@
},
"required": [
"id",
"blockId",
"type",
"path"
],
Expand All @@ -2205,7 +2205,8 @@
"type": "string"
},
"blockId": {
"type": "string"
"type": "string",
"description": "Deprecated"
},
"outgoingEdgeId": {
"type": "string"
Expand All @@ -2225,7 +2226,6 @@
},
"required": [
"id",
"blockId",
"type",
"path"
],
Expand Down
28 changes: 14 additions & 14 deletions apps/docs/openapi/chat/_spec_.json
Original file line number Diff line number Diff line change
Expand Up @@ -414,7 +414,8 @@
"type": "string"
},
"blockId": {
"type": "string"
"type": "string",
"description": "Deprecated"
},
"outgoingEdgeId": {
"type": "string"
Expand Down Expand Up @@ -495,7 +496,6 @@
},
"required": [
"id",
"blockId",
"type"
],
"additionalProperties": false
Expand Down Expand Up @@ -1176,7 +1176,8 @@
"type": "string"
},
"blockId": {
"type": "string"
"type": "string",
"description": "Deprecated"
},
"outgoingEdgeId": {
"type": "string"
Expand Down Expand Up @@ -1263,7 +1264,6 @@
},
"required": [
"id",
"blockId",
"type"
],
"additionalProperties": false
Expand Down Expand Up @@ -1394,7 +1394,8 @@
"type": "string"
},
"blockId": {
"type": "string"
"type": "string",
"description": "Deprecated"
},
"outgoingEdgeId": {
"type": "string"
Expand Down Expand Up @@ -1463,7 +1464,6 @@
},
"required": [
"id",
"blockId",
"type",
"content"
],
Expand Down Expand Up @@ -1740,7 +1740,8 @@
"type": "string"
},
"blockId": {
"type": "string"
"type": "string",
"description": "Deprecated"
},
"outgoingEdgeId": {
"type": "string"
Expand All @@ -1760,7 +1761,6 @@
},
"required": [
"id",
"blockId",
"type",
"path"
],
Expand All @@ -1773,7 +1773,8 @@
"type": "string"
},
"blockId": {
"type": "string"
"type": "string",
"description": "Deprecated"
},
"outgoingEdgeId": {
"type": "string"
Expand All @@ -1793,7 +1794,6 @@
},
"required": [
"id",
"blockId",
"type",
"path"
],
Expand Down Expand Up @@ -4172,7 +4172,8 @@
"type": "string"
},
"blockId": {
"type": "string"
"type": "string",
"description": "Deprecated"
},
"outgoingEdgeId": {
"type": "string"
Expand Down Expand Up @@ -4253,7 +4254,6 @@
},
"required": [
"id",
"blockId",
"type"
],
"additionalProperties": false
Expand Down Expand Up @@ -4934,7 +4934,8 @@
"type": "string"
},
"blockId": {
"type": "string"
"type": "string",
"description": "Deprecated"
},
"outgoingEdgeId": {
"type": "string"
Expand Down Expand Up @@ -5021,7 +5022,6 @@
},
"required": [
"id",
"blockId",
"type"
],
"additionalProperties": false
Expand Down
2 changes: 1 addition & 1 deletion packages/schemas/features/items/baseSchemas.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { z } from 'zod'

export const itemBaseSchema = z.object({
id: z.string(),
blockId: z.string(),
blockId: z.string().optional().describe('Deprecated'),
outgoingEdgeId: z.string().optional(),
})

Expand Down

4 comments on commit 019f72a

@vercel
Copy link

@vercel vercel bot commented on 019f72a Aug 16, 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 019f72a Aug 16, 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

@vercel
Copy link

@vercel vercel bot commented on 019f72a Aug 16, 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

psmix.online
receita.info
rhino.cr8.ai
sheep.cr8.ai
snake.cr8.ai
svhm.mprs.in
tiger.cr8.ai
video.cr8.ai
webwhats.pro
yoda.riku.ai
zebra.cr8.ai
alvodelas.com
bemestar.club
bot.krdfy.com
cat.hidden.sg
cgcassets.com
cnvhub.com.br
drapamela.com
facelabko.com
filmylogy.com
goldorayo.com
rabbit.cr8.ai
shop.mexwa.my
signup.cr8.ai
start.taxt.co
theusm.com.br
turkey.cr8.ai
vhpage.cr8.ai
vitamyway.com
whatchat.site
www.wiccom.it
am.nigerias.io
an.nigerias.io
app.yvon.earth
ar.nigerias.io
bot.enreso.org
bot.mail2wa.me
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
panther.cr7.ai
panther.cr8.ai
pay.sifuim.com
penguin.cr8.ai
segredomeu.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.artiweb.app
bot.devitus.com
bot.reeplai.com
bot.scayver.com
bot.tc-mail.com
carspecs.lam.ee
chat.lalmon.com
chat.sureb4.com
conversawpp.com
eventhub.com.au
feiraododia.com
fitness.riku.ai
games.klujo.com
localove.online
proscale.com.br
sellmycarbr.com
svhmapp.mprs.in
typebot.aloe.do
app-liberado.pro
ask.pemantau.org
batepapo.digital
bot.contakit.com
bot.imovfast.com
bot.piccinato.co
botc.ceox.com.br
chat.sifucrm.com
chat.syncwin.com
chatonlineja.com
clo.closeer.work
cockroach.cr8.ai
zap.techadviser.in
ai.digitaldaftar.in
app.danielnalex.com
ask.realversity.org

@vercel
Copy link

@vercel vercel bot commented on 019f72a Aug 16, 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

app.typebot.io
builder-v2-typebot-io.vercel.app
builder-v2-git-main-typebot-io.vercel.app

Please sign in to comment.