♻️ Remove @typebot.io/schemas from @typebot.io/lib

This commit is contained in:
Baptiste Arnaud
2024-03-15 16:32:29 +01:00
parent b53242ce6a
commit 5073be2439
186 changed files with 809 additions and 581 deletions

View File

@@ -3,8 +3,8 @@ import { createId } from '@paralleldrive/cuid2'
import {
createTypebots,
importTypebotInDatabase,
} from '@typebot.io/lib/playwright/databaseActions'
import { parseDefaultGroupWithBlock } from '@typebot.io/lib/playwright/databaseHelpers'
} from '@typebot.io/playwright/databaseActions'
import { parseDefaultGroupWithBlock } from '@typebot.io/playwright/databaseHelpers'
import { getTestAsset } from '@/test/utils/playwright'
import { InputBlockType } from '@typebot.io/schemas/features/blocks/inputs/constants'
@@ -113,46 +113,6 @@ test('Drag and drop blocks and items should work', async ({ page }) => {
'Name=John'
)
})
test('Undo / Redo and Zoom buttons should work', async ({ page }) => {
const typebotId = createId()
await createTypebots([
{
id: typebotId,
...parseDefaultGroupWithBlock({
type: InputBlockType.TEXT,
}),
},
])
await page.goto(`/typebots/${typebotId}/edit`)
await page.click('text=Group #1', { button: 'right' })
await page.click('text=Duplicate')
await expect(page.locator('text="Group #1"')).toBeVisible()
await expect(page.locator('text="Group #1 (1)"')).toBeVisible()
await page.click('text="Group #1"', { button: 'right' })
await page.click('text=Delete')
await expect(page.locator('text="Group #1"')).toBeHidden()
await page.click('button[aria-label="Undo"]')
await expect(page.locator('text="Group #1"')).toBeVisible()
await page.click('button[aria-label="Redo"]')
await expect(page.locator('text="Group #1"')).toBeHidden()
await page.getByRole('button', { name: 'Zoom in' }).click()
await expect(page.getByTestId('graph')).toHaveAttribute(
'style',
/scale\(1\.2\)/
)
await page.getByRole('button', { name: 'Zoom in' }).click()
await expect(page.getByTestId('graph')).toHaveAttribute(
'style',
/scale\(1\.4\)/
)
await page.getByRole('button', { name: 'Zoom out' }).dblclick()
await page.getByRole('button', { name: 'Zoom out' }).dblclick()
await expect(page.getByTestId('graph')).toHaveAttribute(
'style',
/scale\(0\.6\)/
)
})
test('Rename and icon change should work', async ({ page }) => {
const typebotId = createId()

View File

@@ -10,7 +10,8 @@ import { SetTypebot } from '../TypebotProvider'
import { produce, Draft } from 'immer'
import { deleteConnectedEdgesDraft, deleteEdgeDraft } from './edges'
import { createId } from '@paralleldrive/cuid2'
import { byId, blockHasItems } from '@typebot.io/lib'
import { byId } from '@typebot.io/lib'
import { blockHasItems } from '@typebot.io/schemas/helpers'
import { duplicateItemDraft } from './items'
import { parseNewBlock } from '@/features/typebot/helpers/parseNewBlock'

View File

@@ -9,7 +9,8 @@ import {
} from '@typebot.io/schemas'
import { SetTypebot } from '../TypebotProvider'
import { Draft, produce } from 'immer'
import { byId, isDefined, blockHasItems } from '@typebot.io/lib'
import { byId, isDefined } from '@typebot.io/lib'
import { blockHasItems } from '@typebot.io/schemas/helpers'
import { createId } from '@paralleldrive/cuid2'
export type EdgesActions = {

View File

@@ -14,7 +14,8 @@ import {
createBlockDraft,
duplicateBlockDraft,
} from './blocks'
import { blockHasItems, byId, isEmpty } from '@typebot.io/lib'
import { byId, isEmpty } from '@typebot.io/lib'
import { blockHasItems } from '@typebot.io/schemas/helpers'
import { Coordinates, CoordinatesMap } from '@/features/graph/types'
import { parseUniqueKey } from '@typebot.io/lib/parseUniqueKey'

View File

@@ -9,7 +9,8 @@ import {
import { SetTypebot } from '../TypebotProvider'
import { Draft, produce } from 'immer'
import { deleteConnectedEdgesDraft } from './edges'
import { byId, blockHasItems } from '@typebot.io/lib'
import { byId } from '@typebot.io/lib'
import { blockHasItems } from '@typebot.io/schemas/helpers'
import { createId } from '@paralleldrive/cuid2'
import {
BlockWithCreatableItems,