2
0

feat(editor): Restore published version button

Had to migrate webhooks into a standalone table
This commit is contained in:
Baptiste Arnaud
2022-03-01 07:13:09 +01:00
parent 0df719d531
commit e17a1a0869
46 changed files with 578 additions and 348 deletions

View File

@ -63,12 +63,7 @@
"blockId": "8XnDM1QsqPms4LQHh8q3Jo",
"type": "Webhook",
"options": { "responseVariableMapping": [], "variablesForTest": [] },
"webhook": {
"id": "2L9mPYsLAXdXwcnGVK6pv9",
"method": "GET",
"headers": [],
"queryParams": []
}
"webhookId": "webhook1"
}
]
}

View File

@ -1,9 +1,7 @@
import {
Block,
CredentialsType,
defaultSettings,
defaultTheme,
PublicBlock,
PublicTypebot,
Step,
Typebot,
@ -39,6 +37,9 @@ export const createUsers = () =>
],
})
export const createWebhook = (typebotId: string) =>
prisma.webhook.create({ data: { method: 'GET', typebotId, id: 'webhook1' } })
export const createCollaboration = (
userId: string,
typebotId: string,
@ -139,7 +140,7 @@ const parseTypebotToPublicTypebot = (
): Omit<PublicTypebot, 'createdAt' | 'updatedAt'> => ({
id,
name: typebot.name,
blocks: parseBlocksToPublicBlocks(typebot.blocks),
blocks: typebot.blocks,
typebotId: typebot.id,
theme: typebot.theme,
settings: typebot.settings,
@ -149,14 +150,6 @@ const parseTypebotToPublicTypebot = (
customDomain: null,
})
const parseBlocksToPublicBlocks = (blocks: Block[]): PublicBlock[] =>
blocks.map((b) => ({
...b,
steps: b.steps.map((s) =>
'webhook' in s ? { ...s, webhook: s.webhook.id } : s
),
}))
const parseTestTypebot = (partialTypebot: Partial<Typebot>): Typebot => ({
id: partialTypebot.id ?? 'typebot',
folderId: null,
@ -232,6 +225,6 @@ export const importTypebotInDatabase = async (
data: parseTypebotToPublicTypebot(
updates?.id ? `${updates?.id}-public` : 'publicBot',
typebot
),
) as any,
})
}

View File

@ -1,5 +1,5 @@
import test, { expect, Page } from '@playwright/test'
import { importTypebotInDatabase } from '../../services/database'
import { createWebhook, importTypebotInDatabase } from '../../services/database'
import path from 'path'
import { generate } from 'short-uuid'
@ -13,6 +13,7 @@ test.describe('Webhook step', () => {
id: typebotId,
}
)
await createWebhook(typebotId)
await page.goto(`/typebots/${typebotId}/edit`)
await page.click('text=Configure...')