2
0

(api) Add CRUD typebot endpoints

Closes #320, closes #696
This commit is contained in:
Baptiste Arnaud
2023-08-17 09:39:11 +02:00
parent 019f72ac7e
commit 454d320c6b
78 changed files with 25014 additions and 1073 deletions

View File

@@ -13,6 +13,7 @@ import {
SetVariableBlock,
WebhookBlock,
defaultPaymentInputOptions,
invalidEmailDefaultRetryMessage,
} from '@typebot.io/schemas'
import { isInputBlock, byId } from '@typebot.io/lib'
import { executeGroup } from './executeGroup'
@@ -207,6 +208,8 @@ const parseRetryMessage = (
const parseDefaultRetryMessage = (block: InputBlock): string => {
switch (block.type) {
case InputBlockType.EMAIL:
return invalidEmailDefaultRetryMessage
case InputBlockType.PAYMENT:
return defaultPaymentInputOptions.retryMessageContent as string
default:

View File

@@ -12,15 +12,17 @@ import {
} from '@typebot.io/lib/playwright/databaseActions'
import { parseDefaultGroupWithBlock } from '@typebot.io/lib/playwright/databaseHelpers'
const settings = defaultSettings({ isBrandingEnabled: true })
test('Result should be overwritten on page refresh', async ({ page }) => {
const typebotId = createId()
await createTypebots([
{
id: typebotId,
settings: {
...defaultSettings,
...settings,
general: {
...defaultSettings.general,
...settings.general,
rememberUser: {
isEnabled: true,
storage: 'session',
@@ -96,8 +98,8 @@ test('Hide query params', async ({ page }) => {
await updateTypebot({
id: typebotId,
settings: {
...defaultSettings,
general: { ...defaultSettings.general, isHideQueryParamsEnabled: false },
...settings,
general: { ...settings.general, isHideQueryParamsEnabled: false },
},
})
await page.goto(`/${typebotId}-public?Name=John`)
@@ -136,7 +138,7 @@ test('Should correctly parse metadata', async ({ page }) => {
{
id: typebotId,
settings: {
...defaultSettings,
...settings,
metadata: customMetadata,
},
...parseDefaultGroupWithBlock({