2
0

♻️ 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

@ -122,6 +122,11 @@
"next-runtime-env": "1.6.2", "next-runtime-env": "1.6.2",
"superjson": "1.12.4", "superjson": "1.12.4",
"typescript": "5.3.2", "typescript": "5.3.2",
"zod": "3.22.4" "zod": "3.22.4",
"@typebot.io/playwright": "workspace:*",
"@typebot.io/billing": "workspace:*",
"@typebot.io/results": "workspace:*",
"@typebot.io/migrations": "workspace:*",
"@typebot.io/telemetry": "workspace:*"
} }
} }

View File

@ -1,20 +1,45 @@
import { PlaywrightTestConfig } from '@playwright/test' import { defineConfig, devices } from '@playwright/test'
import path from 'path'
import { playwrightBaseConfig } from '@typebot.io/lib/playwright/baseConfig'
const config: PlaywrightTestConfig = { export default defineConfig({
...playwrightBaseConfig, timeout: process.env.CI ? 50 * 1000 : 40 * 1000,
expect: {
timeout: process.env.CI ? 10 * 1000 : 5 * 1000,
},
forbidOnly: !!process.env.CI,
workers: process.env.CI ? 1 : 3,
retries: process.env.CI ? 2 : 0,
reporter: [
[process.env.CI ? 'github' : 'list'],
['html', { outputFolder: 'src/test/reporters' }],
],
maxFailures: process.env.CI ? 10 : undefined,
webServer: process.env.CI webServer: process.env.CI
? { ? {
...(playwrightBaseConfig.webServer as { command: string }), command: 'pnpm run start',
timeout: 60_000,
reuseExistingServer: true,
port: 3000, port: 3000,
} }
: undefined, : undefined,
outputDir: './src/test/results',
use: { use: {
...playwrightBaseConfig.use, trace: 'on-first-retry',
locale: 'en-US',
baseURL: process.env.NEXTAUTH_URL, baseURL: process.env.NEXTAUTH_URL,
storageState: path.join(__dirname, 'src/test/storageState.json'), storageState: './src/test/storageState.json',
}, },
} projects: [
{
export default config name: 'setup db',
testMatch: /global\.setup\.ts/,
},
{
name: 'chromium',
use: {
...devices['Desktop Chrome'],
viewport: { width: 1400, height: 1000 },
},
dependencies: ['setup db'],
},
],
})

View File

@ -17,7 +17,7 @@ import {
import { isDefined } from '@typebot.io/lib' import { isDefined } from '@typebot.io/lib'
import { useCallback, useEffect, useRef, useState } from 'react' import { useCallback, useEffect, useRef, useState } from 'react'
import { createApi } from 'unsplash-js' import { createApi } from 'unsplash-js'
import { Basic as UnsplashImage } from 'unsplash-js/dist/methods/photos/types' import { Basic as UnsplashImageType } from 'unsplash-js/dist/methods/photos/types'
import { TextInput } from '../inputs' import { TextInput } from '../inputs'
import { UnsplashLogo } from '../logos/UnsplashLogo' import { UnsplashLogo } from '../logos/UnsplashLogo'
import { TextLink } from '../TextLink' import { TextLink } from '../TextLink'
@ -35,7 +35,7 @@ type Props = {
export const UnsplashPicker = ({ imageSize, onImageSelect }: Props) => { export const UnsplashPicker = ({ imageSize, onImageSelect }: Props) => {
const unsplashLogoFillColor = useColorModeValue('black', 'white') const unsplashLogoFillColor = useColorModeValue('black', 'white')
const [isFetching, setIsFetching] = useState(false) const [isFetching, setIsFetching] = useState(false)
const [images, setImages] = useState<UnsplashImage[]>([]) const [images, setImages] = useState<UnsplashImageType[]>([])
const [error, setError] = useState<string | null>(null) const [error, setError] = useState<string | null>(null)
const [searchQuery, setSearchQuery] = useState('') const [searchQuery, setSearchQuery] = useState('')
const scrollContainer = useRef<HTMLDivElement>(null) const scrollContainer = useRef<HTMLDivElement>(null)
@ -113,7 +113,7 @@ export const UnsplashPicker = ({ imageSize, onImageSelect }: Props) => {
setIsFetching(false) setIsFetching(false)
} }
const selectImage = (image: UnsplashImage) => { const selectImage = (image: UnsplashImageType) => {
const url = image.urls[imageSize] const url = image.urls[imageSize]
api.photos.trackDownload({ api.photos.trackDownload({
downloadLocation: image.links.download_location, downloadLocation: image.links.download_location,
@ -185,7 +185,7 @@ export const UnsplashPicker = ({ imageSize, onImageSelect }: Props) => {
} }
type UnsplashImageProps = { type UnsplashImageProps = {
image: UnsplashImage image: UnsplashImageType
onClick: () => void onClick: () => void
} }

View File

@ -1,7 +1,7 @@
import { getTestAsset } from '@/test/utils/playwright' import { getTestAsset } from '@/test/utils/playwright'
import test, { expect } from '@playwright/test' import test, { expect } from '@playwright/test'
import { env } from '@typebot.io/env' import { env } from '@typebot.io/env'
import { userId } from '@typebot.io/lib/playwright/databaseSetup' import { userId } from '@typebot.io/playwright/databaseSetup'
test.describe.configure({ mode: 'parallel' }) test.describe.configure({ mode: 'parallel' })

View File

@ -4,8 +4,8 @@ import { createId } from '@paralleldrive/cuid2'
import { import {
importTypebotInDatabase, importTypebotInDatabase,
injectFakeResults, injectFakeResults,
} from '@typebot.io/lib/playwright/databaseActions' } from '@typebot.io/playwright/databaseActions'
import { starterWorkspaceId } from '@typebot.io/lib/playwright/databaseSetup' import { starterWorkspaceId } from '@typebot.io/playwright/databaseSetup'
test('analytics are not available for non-pro workspaces', async ({ page }) => { test('analytics are not available for non-pro workspaces', async ({ page }) => {
const typebotId = createId() const typebotId = createId()

View File

@ -5,7 +5,7 @@ import { z } from 'zod'
import { canReadTypebots } from '@/helpers/databaseRules' import { canReadTypebots } from '@/helpers/databaseRules'
import { totalAnswersSchema } from '@typebot.io/schemas/features/analytics' import { totalAnswersSchema } from '@typebot.io/schemas/features/analytics'
import { parseGroups } from '@typebot.io/schemas' import { parseGroups } from '@typebot.io/schemas'
import { isInputBlock } from '@typebot.io/lib' import { isInputBlock } from '@typebot.io/schemas/helpers'
import { defaultTimeFilter, timeFilterValues } from '../constants' import { defaultTimeFilter, timeFilterValues } from '../constants'
import { import {
parseFromDateFromTimeFilter, parseFromDateFromTimeFilter,

View File

@ -1,5 +1,6 @@
import { isInputBlock, isNotDefined } from '@typebot.io/lib' import { isNotDefined } from '@typebot.io/lib'
import { PublicTypebotV6 } from '@typebot.io/schemas' import { PublicTypebotV6 } from '@typebot.io/schemas'
import { isInputBlock } from '@typebot.io/schemas/helpers'
import { import {
TotalAnswers, TotalAnswers,
TotalVisitedEdges, TotalVisitedEdges,

View File

@ -14,7 +14,7 @@ import { getNewUserInvitations } from '@/features/auth/helpers/getNewUserInvitat
import { joinWorkspaces } from '@/features/auth/helpers/joinWorkspaces' import { joinWorkspaces } from '@/features/auth/helpers/joinWorkspaces'
import { parseWorkspaceDefaultPlan } from '@/features/workspace/helpers/parseWorkspaceDefaultPlan' import { parseWorkspaceDefaultPlan } from '@/features/workspace/helpers/parseWorkspaceDefaultPlan'
import { env } from '@typebot.io/env' import { env } from '@typebot.io/env'
import { trackEvents } from '@typebot.io/lib/telemetry/trackEvents' import { trackEvents } from '@typebot.io/telemetry/trackEvents'
export function customAdapter(p: PrismaClient): Adapter { export function customAdapter(p: PrismaClient): Adapter {
return { return {

View File

@ -8,7 +8,7 @@ import { z } from 'zod'
import { createCheckoutSessionUrl } from './createCheckoutSession' import { createCheckoutSessionUrl } from './createCheckoutSession'
import { isAdminWriteWorkspaceForbidden } from '@/features/workspace/helpers/isAdminWriteWorkspaceForbidden' import { isAdminWriteWorkspaceForbidden } from '@/features/workspace/helpers/isAdminWriteWorkspaceForbidden'
import { env } from '@typebot.io/env' import { env } from '@typebot.io/env'
import { trackEvents } from '@typebot.io/lib/telemetry/trackEvents' import { trackEvents } from '@typebot.io/telemetry/trackEvents'
export const updateSubscription = authenticatedProcedure export const updateSubscription = authenticatedProcedure
.meta({ .meta({

View File

@ -11,7 +11,7 @@ import {
createWorkspaces, createWorkspaces,
deleteWorkspaces, deleteWorkspaces,
injectFakeResults, injectFakeResults,
} from '@typebot.io/lib/playwright/databaseActions' } from '@typebot.io/playwright/databaseActions'
import { env } from '@typebot.io/env' import { env } from '@typebot.io/env'
const usageWorkspaceId = createId() const usageWorkspaceId = createId()
@ -148,7 +148,7 @@ test('plan changes should work', async ({ page }) => {
await expect(page.locator('text="$89"')).toBeVisible() await expect(page.locator('text="$89"')).toBeVisible()
await page.click('button >> text=Upgrade') await page.click('button >> text=Upgrade')
await expect( await expect(
page.locator('text="Workspace PRO plan successfully updated 🎉" >> nth=0') page.locator('text="Workspace PRO plan successfully updated" >> nth=0')
).toBeVisible() ).toBeVisible()
// Go to customer portal // Go to customer portal

View File

@ -11,7 +11,7 @@ import { StarterPlanPricingCard } from './StarterPlanPricingCard'
import { ProPlanPricingCard } from './ProPlanPricingCard' import { ProPlanPricingCard } from './ProPlanPricingCard'
import { useTranslate } from '@tolgee/react' import { useTranslate } from '@tolgee/react'
import { StripeClimateLogo } from './StripeClimateLogo' import { StripeClimateLogo } from './StripeClimateLogo'
import { guessIfUserIsEuropean } from '@typebot.io/lib/billing/guessIfUserIsEuropean' import { guessIfUserIsEuropean } from '@typebot.io/billing/guessIfUserIsEuropean'
import { WorkspaceInApp } from '@/features/workspace/WorkspaceProvider' import { WorkspaceInApp } from '@/features/workspace/WorkspaceProvider'
type Props = { type Props = {

View File

@ -17,8 +17,8 @@ import {
Tr, Tr,
} from '@chakra-ui/react' } from '@chakra-ui/react'
import { useTranslate } from '@tolgee/react' import { useTranslate } from '@tolgee/react'
import { proChatTiers } from '@typebot.io/lib/billing/constants' import { proChatTiers } from '@typebot.io/billing/constants'
import { formatPrice } from '@typebot.io/lib/billing/formatPrice' import { formatPrice } from '@typebot.io/billing/formatPrice'
type Props = { type Props = {
isOpen: boolean isOpen: boolean

View File

@ -14,9 +14,9 @@ import {
import { Plan } from '@typebot.io/prisma' import { Plan } from '@typebot.io/prisma'
import { FeaturesList } from './FeaturesList' import { FeaturesList } from './FeaturesList'
import { MoreInfoTooltip } from '@/components/MoreInfoTooltip' import { MoreInfoTooltip } from '@/components/MoreInfoTooltip'
import { formatPrice } from '@typebot.io/lib/billing/formatPrice' import { formatPrice } from '@typebot.io/billing/formatPrice'
import { ChatsProTiersModal } from './ChatsProTiersModal' import { ChatsProTiersModal } from './ChatsProTiersModal'
import { prices } from '@typebot.io/lib/billing/constants' import { prices } from '@typebot.io/billing/constants'
import { T, useTranslate } from '@tolgee/react' import { T, useTranslate } from '@tolgee/react'
type Props = { type Props = {

View File

@ -10,8 +10,8 @@ import {
import { Plan } from '@typebot.io/prisma' import { Plan } from '@typebot.io/prisma'
import { FeaturesList } from './FeaturesList' import { FeaturesList } from './FeaturesList'
import { MoreInfoTooltip } from '@/components/MoreInfoTooltip' import { MoreInfoTooltip } from '@/components/MoreInfoTooltip'
import { formatPrice } from '@typebot.io/lib/billing/formatPrice' import { formatPrice } from '@typebot.io/billing/formatPrice'
import { prices } from '@typebot.io/lib/billing/constants' import { prices } from '@typebot.io/billing/constants'
import { T, useTranslate } from '@tolgee/react' import { T, useTranslate } from '@tolgee/react'
type Props = { type Props = {

View File

@ -12,7 +12,7 @@ import { AlertIcon } from '@/components/icons'
import { WorkspaceInApp } from '@/features/workspace/WorkspaceProvider' import { WorkspaceInApp } from '@/features/workspace/WorkspaceProvider'
import { parseNumberWithCommas } from '@typebot.io/lib' import { parseNumberWithCommas } from '@typebot.io/lib'
import { defaultQueryOptions, trpc } from '@/lib/trpc' import { defaultQueryOptions, trpc } from '@/lib/trpc'
import { getChatsLimit } from '@typebot.io/lib/billing/getChatsLimit' import { getChatsLimit } from '@typebot.io/billing/getChatsLimit'
import { useTranslate } from '@tolgee/react' import { useTranslate } from '@tolgee/react'
type Props = { type Props = {

View File

@ -1,9 +1,9 @@
import test, { expect } from '@playwright/test' import test, { expect } from '@playwright/test'
import { createTypebots } from '@typebot.io/lib/playwright/databaseActions' import { createTypebots } from '@typebot.io/playwright/databaseActions'
import { parseDefaultGroupWithBlock } from '@typebot.io/lib/playwright/databaseHelpers' import { parseDefaultGroupWithBlock } from '@typebot.io/playwright/databaseHelpers'
import { createId } from '@paralleldrive/cuid2' import { createId } from '@paralleldrive/cuid2'
import { getTestAsset } from '@/test/utils/playwright' import { getTestAsset } from '@/test/utils/playwright'
import { proWorkspaceId } from '@typebot.io/lib/playwright/databaseSetup' import { proWorkspaceId } from '@typebot.io/playwright/databaseSetup'
import { BubbleBlockType } from '@typebot.io/schemas/features/blocks/bubbles/constants' import { BubbleBlockType } from '@typebot.io/schemas/features/blocks/bubbles/constants'
const audioSampleUrl = const audioSampleUrl =

View File

@ -1,7 +1,7 @@
import test, { expect } from '@playwright/test' import test, { expect } from '@playwright/test'
import { createId } from '@paralleldrive/cuid2' import { createId } from '@paralleldrive/cuid2'
import { createTypebots } from '@typebot.io/lib/playwright/databaseActions' import { createTypebots } from '@typebot.io/playwright/databaseActions'
import { parseDefaultGroupWithBlock } from '@typebot.io/lib/playwright/databaseHelpers' import { parseDefaultGroupWithBlock } from '@typebot.io/playwright/databaseHelpers'
import { BubbleBlockType } from '@typebot.io/schemas/features/blocks/bubbles/constants' import { BubbleBlockType } from '@typebot.io/schemas/features/blocks/bubbles/constants'
const pdfSrc = 'https://www.orimi.com/pdf-test.pdf' const pdfSrc = 'https://www.orimi.com/pdf-test.pdf'

View File

@ -1,9 +1,9 @@
import test, { expect } from '@playwright/test' import test, { expect } from '@playwright/test'
import { createTypebots } from '@typebot.io/lib/playwright/databaseActions' import { createTypebots } from '@typebot.io/playwright/databaseActions'
import { parseDefaultGroupWithBlock } from '@typebot.io/lib/playwright/databaseHelpers' import { parseDefaultGroupWithBlock } from '@typebot.io/playwright/databaseHelpers'
import { createId } from '@paralleldrive/cuid2' import { createId } from '@paralleldrive/cuid2'
import { getTestAsset } from '@/test/utils/playwright' import { getTestAsset } from '@/test/utils/playwright'
import { proWorkspaceId } from '@typebot.io/lib/playwright/databaseSetup' import { proWorkspaceId } from '@typebot.io/playwright/databaseSetup'
import { BubbleBlockType } from '@typebot.io/schemas/features/blocks/bubbles/constants' import { BubbleBlockType } from '@typebot.io/schemas/features/blocks/bubbles/constants'
const unsplashImageSrc = const unsplashImageSrc =

View File

@ -1,6 +1,6 @@
import test, { expect } from '@playwright/test' import test, { expect } from '@playwright/test'
import { createTypebots } from '@typebot.io/lib/playwright/databaseActions' import { createTypebots } from '@typebot.io/playwright/databaseActions'
import { parseDefaultGroupWithBlock } from '@typebot.io/lib/playwright/databaseHelpers' import { parseDefaultGroupWithBlock } from '@typebot.io/playwright/databaseHelpers'
import { createId } from '@paralleldrive/cuid2' import { createId } from '@paralleldrive/cuid2'
import { BubbleBlockType } from '@typebot.io/schemas/features/blocks/bubbles/constants' import { BubbleBlockType } from '@typebot.io/schemas/features/blocks/bubbles/constants'
@ -18,6 +18,7 @@ test.describe('Text bubble block', () => {
await page.goto(`/typebots/${typebotId}/edit`) await page.goto(`/typebots/${typebotId}/edit`)
await page.getByTestId('block block2').locator('div').first().click()
await page.click('[data-testid="bold-button"]') await page.click('[data-testid="bold-button"]')
await page.type('div[role="textbox"]', 'Bold text') await page.type('div[role="textbox"]', 'Bold text')
await page.press('div[role="textbox"]', 'Shift+Enter') await page.press('div[role="textbox"]', 'Shift+Enter')

View File

@ -2,7 +2,7 @@ import { Stack, Text } from '@chakra-ui/react'
import { VideoBubbleBlock } from '@typebot.io/schemas' import { VideoBubbleBlock } from '@typebot.io/schemas'
import { TextInput } from '@/components/inputs' import { TextInput } from '@/components/inputs'
import { useTranslate } from '@tolgee/react' import { useTranslate } from '@tolgee/react'
import { parseVideoUrl } from '@typebot.io/lib/parseVideoUrl' import { parseVideoUrl } from '@typebot.io/schemas/features/blocks/bubbles/video/helpers'
import { defaultVideoBubbleContent } from '@typebot.io/schemas/features/blocks/bubbles/video/constants' import { defaultVideoBubbleContent } from '@typebot.io/schemas/features/blocks/bubbles/video/constants'
type Props = { type Props = {

View File

@ -1,6 +1,6 @@
import test, { expect } from '@playwright/test' import test, { expect } from '@playwright/test'
import { createTypebots } from '@typebot.io/lib/playwright/databaseActions' import { createTypebots } from '@typebot.io/playwright/databaseActions'
import { parseDefaultGroupWithBlock } from '@typebot.io/lib/playwright/databaseHelpers' import { parseDefaultGroupWithBlock } from '@typebot.io/playwright/databaseHelpers'
import { createId } from '@paralleldrive/cuid2' import { createId } from '@paralleldrive/cuid2'
import { BubbleBlockType } from '@typebot.io/schemas/features/blocks/bubbles/constants' import { BubbleBlockType } from '@typebot.io/schemas/features/blocks/bubbles/constants'
import { VideoBubbleContentType } from '@typebot.io/schemas/features/blocks/bubbles/video/constants' import { VideoBubbleContentType } from '@typebot.io/schemas/features/blocks/bubbles/video/constants'

View File

@ -2,8 +2,8 @@ import test, { expect } from '@playwright/test'
import { import {
createTypebots, createTypebots,
importTypebotInDatabase, importTypebotInDatabase,
} from '@typebot.io/lib/playwright/databaseActions' } from '@typebot.io/playwright/databaseActions'
import { parseDefaultGroupWithBlock } from '@typebot.io/lib/playwright/databaseHelpers' import { parseDefaultGroupWithBlock } from '@typebot.io/playwright/databaseHelpers'
import { createId } from '@paralleldrive/cuid2' import { createId } from '@paralleldrive/cuid2'
import { getTestAsset } from '@/test/utils/playwright' import { getTestAsset } from '@/test/utils/playwright'
import { InputBlockType } from '@typebot.io/schemas/features/blocks/inputs/constants' import { InputBlockType } from '@typebot.io/schemas/features/blocks/inputs/constants'
@ -26,13 +26,13 @@ test.describe.parallel('Buttons input block', () => {
]) ])
await page.goto(`/typebots/${typebotId}/edit`) await page.goto(`/typebots/${typebotId}/edit`)
await page.fill('input[value="Click to edit"]', 'Item 1') await page.getByRole('textbox').fill('Item 1')
await page.press('input[value="Item 1"]', 'Enter') await page.getByRole('textbox').press('Enter')
await page.fill('input[value="Click to edit"]', 'Item 2') await page.getByRole('textbox').fill('Item 2')
await page.press('input[value="Item 2"]', 'Enter') await page.getByRole('textbox').press('Enter')
await page.fill('input[value="Click to edit"]', 'Item 3') await page.getByRole('textbox').fill('Item 3')
await page.press('input[value="Item 3"]', 'Enter') await page.getByRole('textbox').press('Enter')
await page.press('input[value="Click to edit"]', 'Escape') await page.getByRole('textbox').press('Escape')
await page.click('text=Item 2', { button: 'right' }) await page.click('text=Item 2', { button: 'right' })
await page.click('text=Delete') await page.click('text=Delete')
await expect(page.locator('text=Item 2')).toBeHidden() await expect(page.locator('text=Item 2')).toBeHidden()
@ -51,11 +51,11 @@ test.describe.parallel('Buttons input block', () => {
await expect(page.getByText('Setvar1')).toBeVisible() await expect(page.getByText('Setvar1')).toBeVisible()
await page.getByTestId('block block2').click({ position: { x: 0, y: 0 } }) await page.getByTestId('block block2').click({ position: { x: 0, y: 0 } })
await page.locator('text=Item 1').hover() await page.locator('span').filter({ hasText: 'Item 1' }).hover()
await page.waitForTimeout(1000) await page.waitForTimeout(1000)
await page.click('[aria-label="Add item"]') await page.click('[aria-label="Add item"]')
await page.fill('input[value="Click to edit"]', 'Item 2') await page.getByTestId('block block2').getByRole('textbox').fill('Item 2')
await page.press('input[value="Item 2"]', 'Enter') await page.getByTestId('block block2').getByRole('textbox').press('Enter')
await page.click('text=Test') await page.click('text=Test')
@ -82,7 +82,7 @@ test('Variable buttons should work', async ({ page }) => {
await expect(page.getByTestId('guest-bubble')).toHaveText('Variable item') await expect(page.getByTestId('guest-bubble')).toHaveText('Variable item')
await expect(page.locator('text=Ok great!')).toBeVisible() await expect(page.locator('text=Ok great!')).toBeVisible()
await page.click('text="Item 1"') await page.click('text="Item 1"')
await page.fill('input[value="Item 1"]', '{{Item 2}}') await page.getByRole('textbox').fill('{{Item 2}}')
await page.getByTestId('block block1').click({ position: { x: 0, y: 0 } }) await page.getByTestId('block block1').click({ position: { x: 0, y: 0 } })
await page.click('text=Multiple choice?') await page.click('text=Multiple choice?')
await page.click('text="Restart"') await page.click('text="Restart"')

View File

@ -1,6 +1,6 @@
import test, { expect } from '@playwright/test' import test, { expect } from '@playwright/test'
import { createTypebots } from '@typebot.io/lib/playwright/databaseActions' import { createTypebots } from '@typebot.io/playwright/databaseActions'
import { parseDefaultGroupWithBlock } from '@typebot.io/lib/playwright/databaseHelpers' import { parseDefaultGroupWithBlock } from '@typebot.io/playwright/databaseHelpers'
import { createId } from '@paralleldrive/cuid2' import { createId } from '@paralleldrive/cuid2'
import { InputBlockType } from '@typebot.io/schemas/features/blocks/inputs/constants' import { InputBlockType } from '@typebot.io/schemas/features/blocks/inputs/constants'
@ -23,12 +23,11 @@ test.describe('Date input block', () => {
'type', 'type',
'date' 'date'
) )
await expect(page.getByRole('button', { name: 'Send' })).toBeDisabled()
await page.locator('[data-testid="from-date"]').fill('2021-01-01') await page.locator('[data-testid="from-date"]').fill('2021-01-01')
await page.getByRole('button', { name: 'Send' }).click() await page.getByRole('button', { name: 'Send' }).click()
await expect(page.locator('text="01/01/2021"')).toBeVisible() await expect(page.locator('text="01/01/2021"')).toBeVisible()
await page.click(`text=Pick a date...`) await page.click(`text=Pick a date`)
await page.click('text=Is range?') await page.click('text=Is range?')
await page.click('text=With time?') await page.click('text=With time?')
await page.getByLabel('From label:').fill('Previous:') await page.getByLabel('From label:').fill('Previous:')
@ -51,7 +50,7 @@ test.describe('Date input block', () => {
page.locator('text="01/01/2021 11:00 to 01/01/2022 09:00"') page.locator('text="01/01/2021 11:00 to 01/01/2022 09:00"')
).toBeVisible() ).toBeVisible()
await page.click(`text=Pick a date...`) await page.click(`text=Pick a date`)
await page.getByPlaceholder('dd/MM/yyyy HH:mm').fill('dd.MM HH:mm') await page.getByPlaceholder('dd/MM/yyyy HH:mm').fill('dd.MM HH:mm')
await page.click('text=Restart') await page.click('text=Restart')
await page.locator('[data-testid="from-date"]').fill('2023-01-01T11:00') await page.locator('[data-testid="from-date"]').fill('2023-01-01T11:00')

View File

@ -1,6 +1,6 @@
import test, { expect } from '@playwright/test' import test, { expect } from '@playwright/test'
import { createTypebots } from '@typebot.io/lib/playwright/databaseActions' import { createTypebots } from '@typebot.io/playwright/databaseActions'
import { parseDefaultGroupWithBlock } from '@typebot.io/lib/playwright/databaseHelpers' import { parseDefaultGroupWithBlock } from '@typebot.io/playwright/databaseHelpers'
import { createId } from '@paralleldrive/cuid2' import { createId } from '@paralleldrive/cuid2'
import { InputBlockType } from '@typebot.io/schemas/features/blocks/inputs/constants' import { InputBlockType } from '@typebot.io/schemas/features/blocks/inputs/constants'
import { defaultEmailInputOptions } from '@typebot.io/schemas/features/blocks/inputs/email/constants' import { defaultEmailInputOptions } from '@typebot.io/schemas/features/blocks/inputs/email/constants'
@ -25,7 +25,6 @@ test.describe('Email input block', () => {
`input[placeholder="${defaultEmailInputOptions.labels.placeholder}"]` `input[placeholder="${defaultEmailInputOptions.labels.placeholder}"]`
) )
).toHaveAttribute('type', 'email') ).toHaveAttribute('type', 'email')
await expect(page.getByRole('button', { name: 'Send' })).toBeDisabled()
await page.click(`text=${defaultEmailInputOptions.labels.placeholder}`) await page.click(`text=${defaultEmailInputOptions.labels.placeholder}`)
await page.fill( await page.fill(

View File

@ -1,8 +1,8 @@
import test, { expect } from '@playwright/test' import test, { expect } from '@playwright/test'
import { createTypebots } from '@typebot.io/lib/playwright/databaseActions' import { createTypebots } from '@typebot.io/playwright/databaseActions'
import { parseDefaultGroupWithBlock } from '@typebot.io/lib/playwright/databaseHelpers' import { parseDefaultGroupWithBlock } from '@typebot.io/playwright/databaseHelpers'
import { createId } from '@paralleldrive/cuid2' import { createId } from '@paralleldrive/cuid2'
import { freeWorkspaceId } from '@typebot.io/lib/playwright/databaseSetup' import { freeWorkspaceId } from '@typebot.io/playwright/databaseSetup'
import { getTestAsset } from '@/test/utils/playwright' import { getTestAsset } from '@/test/utils/playwright'
import { InputBlockType } from '@typebot.io/schemas/features/blocks/inputs/constants' import { InputBlockType } from '@typebot.io/schemas/features/blocks/inputs/constants'
@ -32,6 +32,7 @@ test('options should work', async ({ page }) => {
await page.click('text="Required?"') await page.click('text="Required?"')
await page.click('text="Allow multiple files?"') await page.click('text="Allow multiple files?"')
await page.fill('div[contenteditable=true]', '<strong>Upload now!!</strong>') await page.fill('div[contenteditable=true]', '<strong>Upload now!!</strong>')
await page.click('text="Labels"')
await page.fill('[value="Upload"]', 'Go') await page.fill('[value="Upload"]', 'Go')
await page.fill('[value="Clear"]', 'Reset') await page.fill('[value="Clear"]', 'Reset')
await page.fill('[value="Skip"]', 'Pass') await page.fill('[value="Skip"]', 'Pass')

View File

@ -1,6 +1,6 @@
import test, { expect } from '@playwright/test' import test, { expect } from '@playwright/test'
import { createTypebots } from '@typebot.io/lib/playwright/databaseActions' import { createTypebots } from '@typebot.io/playwright/databaseActions'
import { parseDefaultGroupWithBlock } from '@typebot.io/lib/playwright/databaseHelpers' import { parseDefaultGroupWithBlock } from '@typebot.io/playwright/databaseHelpers'
import { createId } from '@paralleldrive/cuid2' import { createId } from '@paralleldrive/cuid2'
import { InputBlockType } from '@typebot.io/schemas/features/blocks/inputs/constants' import { InputBlockType } from '@typebot.io/schemas/features/blocks/inputs/constants'
import { defaultNumberInputOptions } from '@typebot.io/schemas/features/blocks/inputs/number/constants' import { defaultNumberInputOptions } from '@typebot.io/schemas/features/blocks/inputs/number/constants'
@ -25,7 +25,6 @@ test.describe('Number input block', () => {
`input[placeholder="${defaultNumberInputOptions.labels.placeholder}"]` `input[placeholder="${defaultNumberInputOptions.labels.placeholder}"]`
) )
).toHaveAttribute('type', 'number') ).toHaveAttribute('type', 'number')
await expect(page.getByRole('button', { name: 'Send' })).toBeDisabled()
await page.click(`text=${defaultNumberInputOptions.labels.placeholder}`) await page.click(`text=${defaultNumberInputOptions.labels.placeholder}`)
await page.getByLabel('Placeholder:').fill('Your number...') await page.getByLabel('Placeholder:').fill('Your number...')

View File

@ -1,6 +1,6 @@
import test, { expect } from '@playwright/test' import test, { expect } from '@playwright/test'
import { createTypebots } from '@typebot.io/lib/playwright/databaseActions' import { createTypebots } from '@typebot.io/playwright/databaseActions'
import { parseDefaultGroupWithBlock } from '@typebot.io/lib/playwright/databaseHelpers' import { parseDefaultGroupWithBlock } from '@typebot.io/playwright/databaseHelpers'
import { createId } from '@paralleldrive/cuid2' import { createId } from '@paralleldrive/cuid2'
import { stripePaymentForm } from '@/test/utils/selectorUtils' import { stripePaymentForm } from '@/test/utils/selectorUtils'
import { env } from '@typebot.io/env' import { env } from '@typebot.io/env'

View File

@ -1,6 +1,6 @@
import test, { expect } from '@playwright/test' import test, { expect } from '@playwright/test'
import { createTypebots } from '@typebot.io/lib/playwright/databaseActions' import { createTypebots } from '@typebot.io/playwright/databaseActions'
import { parseDefaultGroupWithBlock } from '@typebot.io/lib/playwright/databaseHelpers' import { parseDefaultGroupWithBlock } from '@typebot.io/playwright/databaseHelpers'
import { createId } from '@paralleldrive/cuid2' import { createId } from '@paralleldrive/cuid2'
import { InputBlockType } from '@typebot.io/schemas/features/blocks/inputs/constants' import { InputBlockType } from '@typebot.io/schemas/features/blocks/inputs/constants'
import { defaultPhoneInputOptions } from '@typebot.io/schemas/features/blocks/inputs/phone/constants' import { defaultPhoneInputOptions } from '@typebot.io/schemas/features/blocks/inputs/phone/constants'
@ -25,7 +25,6 @@ test.describe('Phone input block', () => {
`input[placeholder="${defaultPhoneInputOptions.labels.placeholder}"]` `input[placeholder="${defaultPhoneInputOptions.labels.placeholder}"]`
) )
).toHaveAttribute('type', 'tel') ).toHaveAttribute('type', 'tel')
await expect(page.getByRole('button', { name: 'Send' })).toBeDisabled()
await page.click(`text=${defaultPhoneInputOptions.labels.placeholder}`) await page.click(`text=${defaultPhoneInputOptions.labels.placeholder}`)
await page.getByLabel('Placeholder:').fill('+33 XX XX XX XX') await page.getByLabel('Placeholder:').fill('+33 XX XX XX XX')

View File

@ -1,6 +1,6 @@
import test, { expect } from '@playwright/test' import test, { expect } from '@playwright/test'
import { createTypebots } from '@typebot.io/lib/playwright/databaseActions' import { createTypebots } from '@typebot.io/playwright/databaseActions'
import { parseDefaultGroupWithBlock } from '@typebot.io/lib/playwright/databaseHelpers' import { parseDefaultGroupWithBlock } from '@typebot.io/playwright/databaseHelpers'
import { createId } from '@paralleldrive/cuid2' import { createId } from '@paralleldrive/cuid2'
import { InputBlockType } from '@typebot.io/schemas/features/blocks/inputs/constants' import { InputBlockType } from '@typebot.io/schemas/features/blocks/inputs/constants'

View File

@ -1,6 +1,6 @@
import test, { expect } from '@playwright/test' import test, { expect } from '@playwright/test'
import { createTypebots } from '@typebot.io/lib/playwright/databaseActions' import { createTypebots } from '@typebot.io/playwright/databaseActions'
import { parseDefaultGroupWithBlock } from '@typebot.io/lib/playwright/databaseHelpers' import { parseDefaultGroupWithBlock } from '@typebot.io/playwright/databaseHelpers'
import { createId } from '@paralleldrive/cuid2' import { createId } from '@paralleldrive/cuid2'
import { InputBlockType } from '@typebot.io/schemas/features/blocks/inputs/constants' import { InputBlockType } from '@typebot.io/schemas/features/blocks/inputs/constants'

View File

@ -1,6 +1,6 @@
import test, { expect } from '@playwright/test' import test, { expect } from '@playwright/test'
import { createTypebots } from '@typebot.io/lib/playwright/databaseActions' import { createTypebots } from '@typebot.io/playwright/databaseActions'
import { parseDefaultGroupWithBlock } from '@typebot.io/lib/playwright/databaseHelpers' import { parseDefaultGroupWithBlock } from '@typebot.io/playwright/databaseHelpers'
import { createId } from '@paralleldrive/cuid2' import { createId } from '@paralleldrive/cuid2'
import { InputBlockType } from '@typebot.io/schemas/features/blocks/inputs/constants' import { InputBlockType } from '@typebot.io/schemas/features/blocks/inputs/constants'
import { defaultTextInputOptions } from '@typebot.io/schemas/features/blocks/inputs/text/constants' import { defaultTextInputOptions } from '@typebot.io/schemas/features/blocks/inputs/text/constants'
@ -25,7 +25,6 @@ test.describe.parallel('Text input block', () => {
`input[placeholder="${defaultTextInputOptions.labels.placeholder}"]` `input[placeholder="${defaultTextInputOptions.labels.placeholder}"]`
) )
).toHaveAttribute('type', 'text') ).toHaveAttribute('type', 'text')
await expect(page.getByRole('button', { name: 'Send' })).toBeDisabled()
await page.click(`text=${defaultTextInputOptions.labels.placeholder}`) await page.click(`text=${defaultTextInputOptions.labels.placeholder}`)
await page.getByLabel('Placeholder:').fill('Your name...') await page.getByLabel('Placeholder:').fill('Your name...')

View File

@ -1,6 +1,6 @@
import test, { expect } from '@playwright/test' import test, { expect } from '@playwright/test'
import { createTypebots } from '@typebot.io/lib/playwright/databaseActions' import { createTypebots } from '@typebot.io/playwright/databaseActions'
import { parseDefaultGroupWithBlock } from '@typebot.io/lib/playwright/databaseHelpers' import { parseDefaultGroupWithBlock } from '@typebot.io/playwright/databaseHelpers'
import { createId } from '@paralleldrive/cuid2' import { createId } from '@paralleldrive/cuid2'
import { InputBlockType } from '@typebot.io/schemas/features/blocks/inputs/constants' import { InputBlockType } from '@typebot.io/schemas/features/blocks/inputs/constants'
import { defaultUrlInputOptions } from '@typebot.io/schemas/features/blocks/inputs/url/constants' import { defaultUrlInputOptions } from '@typebot.io/schemas/features/blocks/inputs/url/constants'
@ -25,9 +25,6 @@ test.describe('Url input block', () => {
`input[placeholder="${defaultUrlInputOptions.labels.placeholder}"]` `input[placeholder="${defaultUrlInputOptions.labels.placeholder}"]`
) )
).toHaveAttribute('type', 'url') ).toHaveAttribute('type', 'url')
await expect(
page.locator('typebot-standard').locator(`button`)
).toBeDisabled()
await page.click(`text=${defaultUrlInputOptions.labels.placeholder}`) await page.click(`text=${defaultUrlInputOptions.labels.placeholder}`)
await page.getByLabel('Placeholder:').fill('Your URL...') await page.getByLabel('Placeholder:').fill('Your URL...')

View File

@ -1,6 +1,6 @@
import test, { expect } from '@playwright/test' import test, { expect } from '@playwright/test'
import { createTypebots } from '@typebot.io/lib/playwright/databaseActions' import { createTypebots } from '@typebot.io/playwright/databaseActions'
import { parseDefaultGroupWithBlock } from '@typebot.io/lib/playwright/databaseHelpers' import { parseDefaultGroupWithBlock } from '@typebot.io/playwright/databaseHelpers'
import { createId } from '@paralleldrive/cuid2' import { createId } from '@paralleldrive/cuid2'
import { IntegrationBlockType } from '@typebot.io/schemas/features/blocks/integrations/constants' import { IntegrationBlockType } from '@typebot.io/schemas/features/blocks/integrations/constants'
import { defaultChatwootOptions } from '@typebot.io/schemas/features/blocks/integrations/chatwoot/constants' import { defaultChatwootOptions } from '@typebot.io/schemas/features/blocks/integrations/chatwoot/constants'

View File

@ -1,6 +1,6 @@
import test from '@playwright/test' import test from '@playwright/test'
import { createTypebots } from '@typebot.io/lib/playwright/databaseActions' import { createTypebots } from '@typebot.io/playwright/databaseActions'
import { parseDefaultGroupWithBlock } from '@typebot.io/lib/playwright/databaseHelpers' import { parseDefaultGroupWithBlock } from '@typebot.io/playwright/databaseHelpers'
import { createId } from '@paralleldrive/cuid2' import { createId } from '@paralleldrive/cuid2'
import { IntegrationBlockType } from '@typebot.io/schemas/features/blocks/integrations/constants' import { IntegrationBlockType } from '@typebot.io/schemas/features/blocks/integrations/constants'

View File

@ -1,5 +1,5 @@
import test, { expect, Page } from '@playwright/test' import test, { expect, Page } from '@playwright/test'
import { importTypebotInDatabase } from '@typebot.io/lib/playwright/databaseActions' import { importTypebotInDatabase } from '@typebot.io/playwright/databaseActions'
import { createId } from '@paralleldrive/cuid2' import { createId } from '@paralleldrive/cuid2'
import { getTestAsset } from '@/test/utils/playwright' import { getTestAsset } from '@/test/utils/playwright'
@ -153,15 +153,6 @@ const fillInSpreadsheetInfo = async (page: Page) => {
await page.click('text=pro-user@email.com') await page.click('text=pro-user@email.com')
await page.waitForTimeout(1000) await page.waitForTimeout(1000)
await page.getByRole('button', { name: 'Pick a spreadsheet' }).click()
await page
.frameLocator('.picker-frame')
.getByLabel('CRM Google Sheets Not selected')
.click()
await page
.frameLocator('.picker-frame')
.getByRole('button', { name: 'Select' })
.click()
await page.fill('input[placeholder="Select the sheet"]', 'Sh') await page.fill('input[placeholder="Select the sheet"]', 'Sh')
await page.click('text=Sheet1') await page.click('text=Sheet1')

View File

@ -1,37 +0,0 @@
import test, { expect } from '@playwright/test'
import { createTypebots } from '@typebot.io/lib/playwright/databaseActions'
import { createId } from '@paralleldrive/cuid2'
import { parseDefaultGroupWithBlock } from '@typebot.io/lib/playwright/databaseHelpers'
import { IntegrationBlockType } from '@typebot.io/schemas/features/blocks/integrations/constants'
const typebotId = createId()
test('should be configurable', async ({ page }) => {
await createTypebots([
{
id: typebotId,
...parseDefaultGroupWithBlock({
type: IntegrationBlockType.OPEN_AI,
}),
},
])
await page.goto(`/typebots/${typebotId}/edit`)
await page.getByText('Configure...').click()
await page.getByRole('button', { name: 'Add OpenAI account' }).click()
await expect(page.getByRole('button', { name: 'Create' })).toBeDisabled()
await page.getByPlaceholder('My account').fill('My account')
await page.getByPlaceholder('sk-...').fill('sk-test')
await page.getByRole('button', { name: 'Create' }).click()
await page.getByRole('button', { name: 'Select task' }).click()
await page.getByRole('menuitem', { name: 'Create chat completion' }).click()
await page.getByRole('button', { name: 'Messages' }).click()
await page.getByRole('button', { name: 'Select type' }).click()
await page.getByRole('menuitem', { name: 'system' }).click()
await page.getByPlaceholder('Content').first().fill('You are a helpful bot')
await page.getByRole('button', { name: 'Add message' }).nth(1).click()
await page.getByRole('button', { name: 'Select type' }).click()
await page.getByRole('menuitem', { name: 'assistant' }).click()
await page.getByPlaceholder('Content').nth(1).fill('Hi there!')
await page.getByRole('button', { name: 'Save answer' }).click()
await page.getByTestId('variables-input').click()
})

View File

@ -1,6 +1,6 @@
import test, { expect } from '@playwright/test' import test, { expect } from '@playwright/test'
import { createTypebots } from '@typebot.io/lib/playwright/databaseActions' import { createTypebots } from '@typebot.io/playwright/databaseActions'
import { parseDefaultGroupWithBlock } from '@typebot.io/lib/playwright/databaseHelpers' import { parseDefaultGroupWithBlock } from '@typebot.io/playwright/databaseHelpers'
import { createId } from '@paralleldrive/cuid2' import { createId } from '@paralleldrive/cuid2'
import { IntegrationBlockType } from '@typebot.io/schemas/features/blocks/integrations/constants' import { IntegrationBlockType } from '@typebot.io/schemas/features/blocks/integrations/constants'

View File

@ -1,5 +1,5 @@
import test, { expect } from '@playwright/test' import test, { expect } from '@playwright/test'
import { importTypebotInDatabase } from '@typebot.io/lib/playwright/databaseActions' import { importTypebotInDatabase } from '@typebot.io/playwright/databaseActions'
import { createId } from '@paralleldrive/cuid2' import { createId } from '@paralleldrive/cuid2'
import { getTestAsset } from '@/test/utils/playwright' import { getTestAsset } from '@/test/utils/playwright'
import { env } from '@typebot.io/env' import { env } from '@typebot.io/env'
@ -57,7 +57,7 @@ test.describe('Send email block', () => {
) )
await page.getByLabel('Subject:').fill('Email subject') await page.getByLabel('Subject:').fill('Email subject')
await page.click('text="Custom content?"') await page.click('text="Custom content?"')
await page.locator('textarea').fill('Here is my email') await page.locator('textarea').last().fill('Here is my email')
await page.click('text=Test') await page.click('text=Test')
await page.locator('typebot-standard').locator('text=Go').click() await page.locator('typebot-standard').locator('text=Go').click()

View File

@ -6,7 +6,7 @@ import { Typebot } from '@typebot.io/schemas'
import { z } from 'zod' import { z } from 'zod'
import { fetchLinkedTypebots } from '@/features/blocks/logic/typebotLink/helpers/fetchLinkedTypebots' import { fetchLinkedTypebots } from '@/features/blocks/logic/typebotLink/helpers/fetchLinkedTypebots'
import { parseSampleResult } from '@typebot.io/bot-engine/blocks/integrations/webhook/parseSampleResult' import { parseSampleResult } from '@typebot.io/bot-engine/blocks/integrations/webhook/parseSampleResult'
import { getBlockById } from '@typebot.io/lib/getBlockById' import { getBlockById } from '@typebot.io/schemas/helpers'
export const getResultExample = authenticatedProcedure export const getResultExample = authenticatedProcedure
.meta({ .meta({
@ -32,6 +32,7 @@ export const getResultExample = authenticatedProcedure
}) })
) )
.query(async ({ input: { typebotId, blockId }, ctx: { user } }) => { .query(async ({ input: { typebotId, blockId }, ctx: { user } }) => {
console.log('user', user)
const typebot = (await prisma.typebot.findFirst({ const typebot = (await prisma.typebot.findFirst({
where: canReadTypebots(typebotId, user), where: canReadTypebots(typebotId, user),
select: { select: {
@ -53,9 +54,10 @@ export const getResultExample = authenticatedProcedure
const linkedTypebots = await fetchLinkedTypebots(typebot, user) const linkedTypebots = await fetchLinkedTypebots(typebot, user)
return { return {
resultExample: await parseSampleResult(typebot, linkedTypebots)( resultExample: await parseSampleResult(
group.id, typebot,
typebot.variables linkedTypebots,
), user.email ?? undefined
)(group.id, typebot.variables),
} }
}) })

View File

@ -6,7 +6,8 @@ import { z } from 'zod'
import { parseGroups } from '@typebot.io/schemas/features/typebot/group' import { parseGroups } from '@typebot.io/schemas/features/typebot/group'
import { IntegrationBlockType } from '@typebot.io/schemas/features/blocks/integrations/constants' import { IntegrationBlockType } from '@typebot.io/schemas/features/blocks/integrations/constants'
import { Block } from '@typebot.io/schemas' import { Block } from '@typebot.io/schemas'
import { byId, isWebhookBlock } from '@typebot.io/lib' import { isWebhookBlock } from '@typebot.io/schemas/helpers'
import { byId } from '@typebot.io/lib'
export const listWebhookBlocks = authenticatedProcedure export const listWebhookBlocks = authenticatedProcedure
.meta({ .meta({

View File

@ -3,7 +3,8 @@ import { canWriteTypebots } from '@/helpers/databaseRules'
import { authenticatedProcedure } from '@/helpers/server/trpc' import { authenticatedProcedure } from '@/helpers/server/trpc'
import { TRPCError } from '@trpc/server' import { TRPCError } from '@trpc/server'
import { Block, HttpRequestBlock, parseGroups } from '@typebot.io/schemas' import { Block, HttpRequestBlock, parseGroups } from '@typebot.io/schemas'
import { byId, isWebhookBlock } from '@typebot.io/lib' import { byId } from '@typebot.io/lib'
import { isWebhookBlock } from '@typebot.io/schemas/helpers'
import { z } from 'zod' import { z } from 'zod'
export const subscribeWebhook = authenticatedProcedure export const subscribeWebhook = authenticatedProcedure

View File

@ -3,7 +3,8 @@ import { canWriteTypebots } from '@/helpers/databaseRules'
import { authenticatedProcedure } from '@/helpers/server/trpc' import { authenticatedProcedure } from '@/helpers/server/trpc'
import { TRPCError } from '@trpc/server' import { TRPCError } from '@trpc/server'
import { Block, HttpRequestBlock, parseGroups } from '@typebot.io/schemas' import { Block, HttpRequestBlock, parseGroups } from '@typebot.io/schemas'
import { byId, isWebhookBlock } from '@typebot.io/lib' import { byId } from '@typebot.io/lib'
import { isWebhookBlock } from '@typebot.io/schemas/helpers'
import { z } from 'zod' import { z } from 'zod'
export const unsubscribeWebhook = authenticatedProcedure export const unsubscribeWebhook = authenticatedProcedure

View File

@ -2,10 +2,10 @@ import test, { expect, Page } from '@playwright/test'
import { import {
createWebhook, createWebhook,
importTypebotInDatabase, importTypebotInDatabase,
} from '@typebot.io/lib/playwright/databaseActions' } from '@typebot.io/playwright/databaseActions'
import { createId } from '@paralleldrive/cuid2' import { createId } from '@paralleldrive/cuid2'
import { getTestAsset } from '@/test/utils/playwright' import { getTestAsset } from '@/test/utils/playwright'
import { apiToken } from '@typebot.io/lib/playwright/databaseSetup' import { apiToken } from '@typebot.io/playwright/databaseSetup'
import { env } from '@typebot.io/env' import { env } from '@typebot.io/env'
import { HttpMethod } from '@typebot.io/schemas/features/blocks/integrations/webhook/constants' import { HttpMethod } from '@typebot.io/schemas/features/blocks/integrations/webhook/constants'
@ -22,7 +22,7 @@ test.describe('Builder', () => {
await page.goto(`/typebots/${typebotId}/edit`) await page.goto(`/typebots/${typebotId}/edit`)
await page.click('text=Configure...') await page.click('text=Configure...')
await page.fill( await page.fill(
'input[placeholder="Paste webhook URL..."]', 'input[placeholder="Paste URL..."]',
`${env.NEXTAUTH_URL}/api/mock/webhook-easy-config` `${env.NEXTAUTH_URL}/api/mock/webhook-easy-config`
) )
await page.click('text=Test the request') await page.click('text=Test the request')
@ -45,7 +45,7 @@ test.describe('Builder', () => {
await page.goto(`/typebots/${typebotId}/edit`) await page.goto(`/typebots/${typebotId}/edit`)
await page.click('text=Configure...') await page.click('text=Configure...')
await page.fill( await page.fill(
'input[placeholder="Paste webhook URL..."]', 'input[placeholder="Paste URL..."]',
`${env.NEXTAUTH_URL}/api/mock/webhook` `${env.NEXTAUTH_URL}/api/mock/webhook`
) )
await page.click('text=Advanced configuration') await page.click('text=Advanced configuration')

View File

@ -1,5 +1,5 @@
import test, { expect } from '@playwright/test' import test, { expect } from '@playwright/test'
import { importTypebotInDatabase } from '@typebot.io/lib/playwright/databaseActions' import { importTypebotInDatabase } from '@typebot.io/playwright/databaseActions'
import { createId } from '@paralleldrive/cuid2' import { createId } from '@paralleldrive/cuid2'
import { getTestAsset } from '@/test/utils/playwright' import { getTestAsset } from '@/test/utils/playwright'

View File

@ -1,5 +1,5 @@
import test, { expect } from '@playwright/test' import test, { expect } from '@playwright/test'
import { importTypebotInDatabase } from '@typebot.io/lib/playwright/databaseActions' import { importTypebotInDatabase } from '@typebot.io/playwright/databaseActions'
import { createId } from '@paralleldrive/cuid2' import { createId } from '@paralleldrive/cuid2'
import { getTestAsset } from '@/test/utils/playwright' import { getTestAsset } from '@/test/utils/playwright'

View File

@ -1,5 +1,5 @@
import test, { expect } from '@playwright/test' import test, { expect } from '@playwright/test'
import { importTypebotInDatabase } from '@typebot.io/lib/playwright/databaseActions' import { importTypebotInDatabase } from '@typebot.io/playwright/databaseActions'
import { createId } from '@paralleldrive/cuid2' import { createId } from '@paralleldrive/cuid2'
import { getTestAsset } from '@/test/utils/playwright' import { getTestAsset } from '@/test/utils/playwright'

View File

@ -1,5 +1,5 @@
import test, { expect } from '@playwright/test' import test, { expect } from '@playwright/test'
import { importTypebotInDatabase } from '@typebot.io/lib/playwright/databaseActions' import { importTypebotInDatabase } from '@typebot.io/playwright/databaseActions'
import { createId } from '@paralleldrive/cuid2' import { createId } from '@paralleldrive/cuid2'
import { getTestAsset } from '@/test/utils/playwright' import { getTestAsset } from '@/test/utils/playwright'

View File

@ -1,5 +1,5 @@
import test, { expect } from '@playwright/test' import test, { expect } from '@playwright/test'
import { importTypebotInDatabase } from '@typebot.io/lib/playwright/databaseActions' import { importTypebotInDatabase } from '@typebot.io/playwright/databaseActions'
import { createId } from '@paralleldrive/cuid2' import { createId } from '@paralleldrive/cuid2'
import { getTestAsset } from '@/test/utils/playwright' import { getTestAsset } from '@/test/utils/playwright'

View File

@ -1,5 +1,5 @@
import test, { expect } from '@playwright/test' import test, { expect } from '@playwright/test'
import { importTypebotInDatabase } from '@typebot.io/lib/playwright/databaseActions' import { importTypebotInDatabase } from '@typebot.io/playwright/databaseActions'
import { createId } from '@paralleldrive/cuid2' import { createId } from '@paralleldrive/cuid2'
import { getTestAsset } from '@/test/utils/playwright' import { getTestAsset } from '@/test/utils/playwright'

View File

@ -1,5 +1,5 @@
import test, { expect } from '@playwright/test' import test, { expect } from '@playwright/test'
import { importTypebotInDatabase } from '@typebot.io/lib/playwright/databaseActions' import { importTypebotInDatabase } from '@typebot.io/playwright/databaseActions'
import { createId } from '@paralleldrive/cuid2' import { createId } from '@paralleldrive/cuid2'
import { getTestAsset } from '@/test/utils/playwright' import { getTestAsset } from '@/test/utils/playwright'

View File

@ -1,5 +1,5 @@
import test, { expect } from '@playwright/test' import test, { expect } from '@playwright/test'
import { importTypebotInDatabase } from '@typebot.io/lib/playwright/databaseActions' import { importTypebotInDatabase } from '@typebot.io/playwright/databaseActions'
import { createId } from '@paralleldrive/cuid2' import { createId } from '@paralleldrive/cuid2'
import { getTestAsset } from '@/test/utils/playwright' import { getTestAsset } from '@/test/utils/playwright'

View File

@ -5,9 +5,9 @@ import prisma from '@typebot.io/lib/prisma'
import { import {
createTypebots, createTypebots,
injectFakeResults, injectFakeResults,
} from '@typebot.io/lib/playwright/databaseActions' } from '@typebot.io/playwright/databaseActions'
import { parseDefaultGroupWithBlock } from '@typebot.io/lib/playwright/databaseHelpers' import { parseDefaultGroupWithBlock } from '@typebot.io/playwright/databaseHelpers'
import { userId } from '@typebot.io/lib/playwright/databaseSetup' import { userId } from '@typebot.io/playwright/databaseSetup'
import { createFolder } from '@/test/utils/databaseActions' import { createFolder } from '@/test/utils/databaseActions'
import { InputBlockType } from '@typebot.io/schemas/features/blocks/inputs/constants' import { InputBlockType } from '@typebot.io/schemas/features/blocks/inputs/constants'

View File

@ -14,7 +14,7 @@ import {
} from '@typebot.io/schemas' } from '@typebot.io/schemas'
import { isDefined } from '@typebot.io/lib/utils' import { isDefined } from '@typebot.io/lib/utils'
import { isWriteWorkspaceForbidden } from '@/features/workspace/helpers/isWriteWorkspaceForbidden' import { isWriteWorkspaceForbidden } from '@/features/workspace/helpers/isWriteWorkspaceForbidden'
import { trackEvents } from '@typebot.io/lib/telemetry/trackEvents' import { trackEvents } from '@typebot.io/telemetry/trackEvents'
const inputShape = { const inputShape = {
data: true, data: true,

View File

@ -6,7 +6,7 @@ import { customDomainSchema } from '@typebot.io/schemas/features/customDomains'
import got, { HTTPError } from 'got' import got, { HTTPError } from 'got'
import { env } from '@typebot.io/env' import { env } from '@typebot.io/env'
import { isWriteWorkspaceForbidden } from '@/features/workspace/helpers/isWriteWorkspaceForbidden' import { isWriteWorkspaceForbidden } from '@/features/workspace/helpers/isWriteWorkspaceForbidden'
import { trackEvents } from '@typebot.io/lib/telemetry/trackEvents' import { trackEvents } from '@typebot.io/telemetry/trackEvents'
export const createCustomDomain = authenticatedProcedure export const createCustomDomain = authenticatedProcedure
.meta({ .meta({

View File

@ -1,8 +1,8 @@
import test, { expect } from '@playwright/test' import test, { expect } from '@playwright/test'
import { createId } from '@paralleldrive/cuid2' import { createId } from '@paralleldrive/cuid2'
import { createTypebots } from '@typebot.io/lib/playwright/databaseActions' import { createTypebots } from '@typebot.io/playwright/databaseActions'
import { parseDefaultGroupWithBlock } from '@typebot.io/lib/playwright/databaseHelpers' import { parseDefaultGroupWithBlock } from '@typebot.io/playwright/databaseHelpers'
import { starterWorkspaceId } from '@typebot.io/lib/playwright/databaseSetup' import { starterWorkspaceId } from '@typebot.io/playwright/databaseSetup'
import { InputBlockType } from '@typebot.io/schemas/features/blocks/inputs/constants' import { InputBlockType } from '@typebot.io/schemas/features/blocks/inputs/constants'
test('should be able to connect custom domain', async ({ page }) => { test('should be able to connect custom domain', async ({ page }) => {
@ -26,7 +26,7 @@ test('should be able to connect custom domain', async ({ page }) => {
await expect(page.locator('text="CNAME"')).toBeVisible() await expect(page.locator('text="CNAME"')).toBeVisible()
await page.click('text=Save') await page.click('text=Save')
await expect(page.locator('text="https://sub.yolozeeer.com/"')).toBeVisible() await expect(page.locator('text="https://sub.yolozeeer.com/"')).toBeVisible()
await page.click('text="Edit" >> nth=1') await page.click('text="Edit"')
await page.fill('text=https://sub.yolozeeer.com/Copy >> input', 'custom-path') await page.fill('text=https://sub.yolozeeer.com/Copy >> input', 'custom-path')
await page.press( await page.press(
'text=https://sub.yolozeeer.com/custom-path >> input', 'text=https://sub.yolozeeer.com/custom-path >> input',

View File

@ -14,7 +14,7 @@ import { FolderContent } from '@/features/folders/components/FolderContent'
import { TypebotDndProvider } from '@/features/folders/TypebotDndProvider' import { TypebotDndProvider } from '@/features/folders/TypebotDndProvider'
import { ParentModalProvider } from '@/features/graph/providers/ParentModalProvider' import { ParentModalProvider } from '@/features/graph/providers/ParentModalProvider'
import { trpc } from '@/lib/trpc' import { trpc } from '@/lib/trpc'
import { guessIfUserIsEuropean } from '@typebot.io/lib/billing/guessIfUserIsEuropean' import { guessIfUserIsEuropean } from '@typebot.io/billing/guessIfUserIsEuropean'
import { useTranslate } from '@tolgee/react' import { useTranslate } from '@tolgee/react'
export const DashboardPage = () => { export const DashboardPage = () => {

View File

@ -2,20 +2,18 @@ import { createFolders } from '@/test/utils/databaseActions'
import { deleteButtonInConfirmDialog } from '@/test/utils/selectorUtils' import { deleteButtonInConfirmDialog } from '@/test/utils/selectorUtils'
import test, { expect } from '@playwright/test' import test, { expect } from '@playwright/test'
import { createId } from '@paralleldrive/cuid2' import { createId } from '@paralleldrive/cuid2'
import { createTypebots } from '@typebot.io/lib/playwright/databaseActions' import { createTypebots } from '@typebot.io/playwright/databaseActions'
test('folders navigation should work', async ({ page }) => { test('folders navigation should work', async ({ page }) => {
await page.goto('/typebots') await page.goto('/typebots')
const createFolderButton = page.locator('button:has-text("Create a folder")') const createFolderButton = page.locator('button:has-text("Create a folder")')
await expect(createFolderButton).not.toBeDisabled() await expect(createFolderButton).not.toBeDisabled()
await createFolderButton.click() await createFolderButton.click()
await page.click('text="New folder"')
await page.fill('input[value="New folder"]', 'My folder #1') await page.fill('input[value="New folder"]', 'My folder #1')
await page.press('input[value="My folder #1"]', 'Enter') await page.press('input[value="My folder #1"]', 'Enter')
await page.click('li:has-text("My folder #1")') await page.click('li:has-text("My folder #1")')
await expect(page.locator('h1:has-text("My folder #1")')).toBeVisible() await expect(page.locator('h1:has-text("My folder #1")')).toBeVisible()
await createFolderButton.click() await createFolderButton.click()
await page.click('text="New folder"')
await page.fill('input', 'My folder #2') await page.fill('input', 'My folder #2')
await page.press('input', 'Enter') await page.press('input', 'Enter')

View File

@ -3,8 +3,8 @@ import { createId } from '@paralleldrive/cuid2'
import { import {
createTypebots, createTypebots,
importTypebotInDatabase, importTypebotInDatabase,
} from '@typebot.io/lib/playwright/databaseActions' } from '@typebot.io/playwright/databaseActions'
import { parseDefaultGroupWithBlock } from '@typebot.io/lib/playwright/databaseHelpers' import { parseDefaultGroupWithBlock } from '@typebot.io/playwright/databaseHelpers'
import { getTestAsset } from '@/test/utils/playwright' import { getTestAsset } from '@/test/utils/playwright'
import { InputBlockType } from '@typebot.io/schemas/features/blocks/inputs/constants' 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' '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 }) => { test('Rename and icon change should work', async ({ page }) => {
const typebotId = createId() const typebotId = createId()

View File

@ -10,7 +10,8 @@ import { SetTypebot } from '../TypebotProvider'
import { produce, Draft } from 'immer' import { produce, Draft } from 'immer'
import { deleteConnectedEdgesDraft, deleteEdgeDraft } from './edges' import { deleteConnectedEdgesDraft, deleteEdgeDraft } from './edges'
import { createId } from '@paralleldrive/cuid2' 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 { duplicateItemDraft } from './items'
import { parseNewBlock } from '@/features/typebot/helpers/parseNewBlock' import { parseNewBlock } from '@/features/typebot/helpers/parseNewBlock'

View File

@ -9,7 +9,8 @@ import {
} from '@typebot.io/schemas' } from '@typebot.io/schemas'
import { SetTypebot } from '../TypebotProvider' import { SetTypebot } from '../TypebotProvider'
import { Draft, produce } from 'immer' 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' import { createId } from '@paralleldrive/cuid2'
export type EdgesActions = { export type EdgesActions = {

View File

@ -14,7 +14,8 @@ import {
createBlockDraft, createBlockDraft,
duplicateBlockDraft, duplicateBlockDraft,
} from './blocks' } 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 { Coordinates, CoordinatesMap } from '@/features/graph/types'
import { parseUniqueKey } from '@typebot.io/lib/parseUniqueKey' import { parseUniqueKey } from '@typebot.io/lib/parseUniqueKey'

View File

@ -9,7 +9,8 @@ import {
import { SetTypebot } from '../TypebotProvider' import { SetTypebot } from '../TypebotProvider'
import { Draft, produce } from 'immer' import { Draft, produce } from 'immer'
import { deleteConnectedEdgesDraft } from './edges' 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 { createId } from '@paralleldrive/cuid2'
import { import {
BlockWithCreatableItems, BlockWithCreatableItems,

View File

@ -5,7 +5,7 @@ import { DashboardFolder, Plan, WorkspaceRole } from '@typebot.io/prisma'
import { folderSchema } from '@typebot.io/schemas' import { folderSchema } from '@typebot.io/schemas'
import { z } from 'zod' import { z } from 'zod'
import { getUserRoleInWorkspace } from '@/features/workspace/helpers/getUserRoleInWorkspace' import { getUserRoleInWorkspace } from '@/features/workspace/helpers/getUserRoleInWorkspace'
import { trackEvents } from '@typebot.io/lib/telemetry/trackEvents' import { trackEvents } from '@typebot.io/telemetry/trackEvents'
export const createFolder = authenticatedProcedure export const createFolder = authenticatedProcedure
.meta({ .meta({

View File

@ -7,7 +7,7 @@ import React, { memo } from 'react'
import { EndpointsProvider } from '../providers/EndpointsProvider' import { EndpointsProvider } from '../providers/EndpointsProvider'
import { Edges } from './edges/Edges' import { Edges } from './edges/Edges'
import { GroupNode } from './nodes/group/GroupNode' import { GroupNode } from './nodes/group/GroupNode'
import { isInputBlock } from '@typebot.io/lib' import { isInputBlock } from '@typebot.io/schemas/helpers'
import { EventNode } from './nodes/event' import { EventNode } from './nodes/event'
type Props = { type Props = {

View File

@ -18,7 +18,8 @@ import {
TotalVisitedEdges, TotalVisitedEdges,
} from '@typebot.io/schemas/features/analytics' } from '@typebot.io/schemas/features/analytics'
import { computeTotalUsersAtBlock } from '@/features/analytics/helpers/computeTotalUsersAtBlock' import { computeTotalUsersAtBlock } from '@/features/analytics/helpers/computeTotalUsersAtBlock'
import { blockHasItems, byId } from '@typebot.io/lib' import { byId } from '@typebot.io/lib'
import { blockHasItems } from '@typebot.io/schemas/helpers'
import { groupWidth } from '../../constants' import { groupWidth } from '../../constants'
import { getTotalAnswersAtBlock } from '@/features/analytics/helpers/getTotalAnswersAtBlock' import { getTotalAnswersAtBlock } from '@/features/analytics/helpers/getTotalAnswersAtBlock'
import { useGroupsStore } from '../../hooks/useGroupsStore' import { useGroupsStore } from '../../hooks/useGroupsStore'

View File

@ -15,12 +15,12 @@ import {
TextBubbleBlock, TextBubbleBlock,
BlockV6, BlockV6,
} from '@typebot.io/schemas' } from '@typebot.io/schemas'
import { isDefined } from '@typebot.io/lib'
import { import {
isBubbleBlock,
isDefined,
isInputBlock, isInputBlock,
isBubbleBlock,
isTextBubbleBlock, isTextBubbleBlock,
} from '@typebot.io/lib' } from '@typebot.io/schemas/helpers'
import { BlockNodeContent } from './BlockNodeContent' import { BlockNodeContent } from './BlockNodeContent'
import { BlockSettings, SettingsPopoverContent } from './SettingsPopoverContent' import { BlockSettings, SettingsPopoverContent } from './SettingsPopoverContent'
import { BlockNodeContextMenu } from './BlockNodeContextMenu' import { BlockNodeContextMenu } from './BlockNodeContextMenu'

View File

@ -1,7 +1,7 @@
import test, { expect } from '@playwright/test' import test, { expect } from '@playwright/test'
import { createId } from '@paralleldrive/cuid2' import { createId } from '@paralleldrive/cuid2'
import { createTypebots } from '@typebot.io/lib/playwright/databaseActions' import { createTypebots } from '@typebot.io/playwright/databaseActions'
import { parseDefaultGroupWithBlock } from '@typebot.io/lib/playwright/databaseHelpers' import { parseDefaultGroupWithBlock } from '@typebot.io/playwright/databaseHelpers'
import { InputBlockType } from '@typebot.io/schemas/features/blocks/inputs/constants' import { InputBlockType } from '@typebot.io/schemas/features/blocks/inputs/constants'
test('should not be able to submit taken url ID', async ({ page }) => { test('should not be able to submit taken url ID', async ({ page }) => {

View File

@ -11,8 +11,8 @@ import { useResultsQuery } from './hooks/useResultsQuery'
import { trpc } from '@/lib/trpc' import { trpc } from '@/lib/trpc'
import { isDefined } from '@typebot.io/lib/utils' import { isDefined } from '@typebot.io/lib/utils'
import { LogicBlockType } from '@typebot.io/schemas/features/blocks/logic/constants' import { LogicBlockType } from '@typebot.io/schemas/features/blocks/logic/constants'
import { parseResultHeader } from '@typebot.io/lib/results/parseResultHeader' import { parseResultHeader } from '@typebot.io/results/parseResultHeader'
import { convertResultsToTableData } from '@typebot.io/lib/results/convertResultsToTableData' import { convertResultsToTableData } from '@typebot.io/results/convertResultsToTableData'
import { parseCellContent } from './helpers/parseCellContent' import { parseCellContent } from './helpers/parseCellContent'
import { timeFilterValues } from '../analytics/constants' import { timeFilterValues } from '../analytics/constants'

View File

@ -1,7 +1,7 @@
import { authenticatedProcedure } from '@/helpers/server/trpc' import { authenticatedProcedure } from '@/helpers/server/trpc'
import { TRPCError } from '@trpc/server' import { TRPCError } from '@trpc/server'
import { z } from 'zod' import { z } from 'zod'
import { archiveResults } from '@typebot.io/lib/api/helpers/archiveResults' import { archiveResults } from '@typebot.io/results/archiveResults'
import prisma from '@typebot.io/lib/prisma' import prisma from '@typebot.io/lib/prisma'
import { isWriteTypebotForbidden } from '@/features/typebot/helpers/isWriteTypebotForbidden' import { isWriteTypebotForbidden } from '@/features/typebot/helpers/isWriteTypebotForbidden'
import { Typebot } from '@typebot.io/schemas' import { Typebot } from '@typebot.io/schemas'

View File

@ -14,7 +14,7 @@ import React from 'react'
import { byId, isDefined } from '@typebot.io/lib' import { byId, isDefined } from '@typebot.io/lib'
import { HeaderIcon } from './HeaderIcon' import { HeaderIcon } from './HeaderIcon'
import { useTypebot } from '@/features/editor/providers/TypebotProvider' import { useTypebot } from '@/features/editor/providers/TypebotProvider'
import { parseColumnsOrder } from '@typebot.io/lib/results/parseColumnsOrder' import { parseColumnsOrder } from '@typebot.io/results/parseColumnsOrder'
type Props = { type Props = {
resultId: string | null resultId: string | null

View File

@ -20,9 +20,9 @@ import {
import { TRPCError } from '@trpc/server' import { TRPCError } from '@trpc/server'
import { unparse } from 'papaparse' import { unparse } from 'papaparse'
import { useState } from 'react' import { useState } from 'react'
import { parseResultHeader } from '@typebot.io/lib/results/parseResultHeader' import { parseResultHeader } from '@typebot.io/results/parseResultHeader'
import { convertResultsToTableData } from '@typebot.io/lib/results/convertResultsToTableData' import { convertResultsToTableData } from '@typebot.io/results/convertResultsToTableData'
import { parseColumnsOrder } from '@typebot.io/lib/results/parseColumnsOrder' import { parseColumnsOrder } from '@typebot.io/results/parseColumnsOrder'
import { parseUniqueKey } from '@typebot.io/lib/parseUniqueKey' import { parseUniqueKey } from '@typebot.io/lib/parseUniqueKey'
import { useResults } from '../../ResultsProvider' import { useResults } from '../../ResultsProvider'
import { byId, isDefined } from '@typebot.io/lib' import { byId, isDefined } from '@typebot.io/lib'

View File

@ -30,7 +30,7 @@ import { HeaderRow } from './HeaderRow'
import { IndeterminateCheckbox } from './IndeterminateCheckbox' import { IndeterminateCheckbox } from './IndeterminateCheckbox'
import { colors } from '@/lib/theme' import { colors } from '@/lib/theme'
import { HeaderIcon } from '../HeaderIcon' import { HeaderIcon } from '../HeaderIcon'
import { parseColumnsOrder } from '@typebot.io/lib/results/parseColumnsOrder' import { parseColumnsOrder } from '@typebot.io/results/parseColumnsOrder'
import { TimeFilterDropdown } from '@/features/analytics/components/TimeFilterDropdown' import { TimeFilterDropdown } from '@/features/analytics/components/TimeFilterDropdown'
import { timeFilterValues } from '@/features/analytics/constants' import { timeFilterValues } from '@/features/analytics/constants'

View File

@ -15,7 +15,7 @@ import { useToast } from '@/hooks/useToast'
import { useResults } from '../../ResultsProvider' import { useResults } from '../../ResultsProvider'
import { trpc } from '@/lib/trpc' import { trpc } from '@/lib/trpc'
import { byId } from '@typebot.io/lib/utils' import { byId } from '@typebot.io/lib/utils'
import { parseColumnsOrder } from '@typebot.io/lib/results/parseColumnsOrder' import { parseColumnsOrder } from '@typebot.io/results/parseColumnsOrder'
import { parseUniqueKey } from '@typebot.io/lib/parseUniqueKey' import { parseUniqueKey } from '@typebot.io/lib/parseUniqueKey'
type Props = { type Props = {

View File

@ -7,7 +7,7 @@ import { parse } from 'papaparse'
import { import {
importTypebotInDatabase, importTypebotInDatabase,
injectFakeResults, injectFakeResults,
} from '@typebot.io/lib/playwright/databaseActions' } from '@typebot.io/playwright/databaseActions'
const typebotId = createId() const typebotId = createId()

View File

@ -1,7 +1,7 @@
import { getTestAsset } from '@/test/utils/playwright' import { getTestAsset } from '@/test/utils/playwright'
import test, { expect } from '@playwright/test' import test, { expect } from '@playwright/test'
import { createId } from '@paralleldrive/cuid2' import { createId } from '@paralleldrive/cuid2'
import { importTypebotInDatabase } from '@typebot.io/lib/playwright/databaseActions' import { importTypebotInDatabase } from '@typebot.io/playwright/databaseActions'
import { defaultTextInputOptions } from '@typebot.io/schemas/features/blocks/inputs/text/constants' import { defaultTextInputOptions } from '@typebot.io/schemas/features/blocks/inputs/text/constants'
test.describe.parallel('Settings page', () => { test.describe.parallel('Settings page', () => {
@ -38,7 +38,7 @@ test.describe.parallel('Settings page', () => {
await expect( await expect(
page.locator('a:has-text("Made with Typebot")') page.locator('a:has-text("Made with Typebot")')
).toHaveAttribute('href', 'https://www.typebot.io/?utm_source=litebadge') ).toHaveAttribute('href', 'https://www.typebot.io/?utm_source=litebadge')
await page.click('button:has-text("Typing emulation")') await page.click('button:has-text("Typing")')
await page.fill('[data-testid="speed"] input', '350') await page.fill('[data-testid="speed"] input', '350')
await page.fill('[data-testid="max-delay"] input', '1.5') await page.fill('[data-testid="max-delay"] input', '1.5')
await page.click('text="Typing emulation" >> nth=-1') await page.click('text="Typing emulation" >> nth=-1')

View File

@ -5,7 +5,7 @@ import prisma from '@typebot.io/lib/prisma'
import { getUserRoleInWorkspace } from '@/features/workspace/helpers/getUserRoleInWorkspace' import { getUserRoleInWorkspace } from '@/features/workspace/helpers/getUserRoleInWorkspace'
import { WorkspaceRole } from '@typebot.io/prisma' import { WorkspaceRole } from '@typebot.io/prisma'
import { isWriteTypebotForbidden } from '@/features/typebot/helpers/isWriteTypebotForbidden' import { isWriteTypebotForbidden } from '@/features/typebot/helpers/isWriteTypebotForbidden'
import { trackEvents } from '@typebot.io/lib/telemetry/trackEvents' import { trackEvents } from '@typebot.io/telemetry/trackEvents'
import { clientSideCreateEventSchema } from '@typebot.io/schemas' import { clientSideCreateEventSchema } from '@typebot.io/schemas'
export const trackClientEvents = authenticatedProcedure export const trackClientEvents = authenticatedProcedure

View File

@ -1,6 +1,6 @@
import { getAuthOptions } from '@/pages/api/auth/[...nextauth]' import { getAuthOptions } from '@/pages/api/auth/[...nextauth]'
import prisma from '@typebot.io/lib/prisma' import prisma from '@typebot.io/lib/prisma'
import { trackEvents } from '@typebot.io/lib/telemetry/trackEvents' import { trackEvents } from '@typebot.io/telemetry/trackEvents'
import { User } from '@typebot.io/schemas' import { User } from '@typebot.io/schemas'
import { GetServerSidePropsContext } from 'next' import { GetServerSidePropsContext } from 'next'
import { getServerSession } from 'next-auth' import { getServerSession } from 'next-auth'

View File

@ -1,8 +1,8 @@
import { getTestAsset } from '@/test/utils/playwright' import { getTestAsset } from '@/test/utils/playwright'
import test, { expect } from '@playwright/test' import test, { expect } from '@playwright/test'
import { createId } from '@paralleldrive/cuid2' import { createId } from '@paralleldrive/cuid2'
import { importTypebotInDatabase } from '@typebot.io/lib/playwright/databaseActions' import { importTypebotInDatabase } from '@typebot.io/playwright/databaseActions'
import { freeWorkspaceId } from '@typebot.io/lib/playwright/databaseSetup' import { freeWorkspaceId } from '@typebot.io/playwright/databaseSetup'
const hostAvatarUrl = const hostAvatarUrl =
'https://images.unsplash.com/photo-1535713875002-d1d0cf377fde?ixlib=rb-1.2.1&ixid=MnwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8&auto=format&fit=crop&w=1760&q=80' 'https://images.unsplash.com/photo-1535713875002-d1d0cf377fde?ixlib=rb-1.2.1&ixid=MnwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8&auto=format&fit=crop&w=1760&q=80'
@ -31,9 +31,10 @@ test.describe.parallel('Theme page', () => {
// Font // Font
await page.getByRole('textbox').fill('Roboto Slab') await page.getByRole('textbox').fill('Roboto Slab')
await page.getByRole('menuitem', { name: 'Roboto Slab' }).click()
await expect(page.locator('.typebot-container')).toHaveCSS( await expect(page.locator('.typebot-container')).toHaveCSS(
'font-family', 'font-family',
/"Roboto Slab"/ /Roboto Slab/
) )
// BG color // BG color
@ -184,10 +185,9 @@ test.describe.parallel('Theme page', () => {
.locator('input[placeholder="Paste the image link..."]') .locator('input[placeholder="Paste the image link..."]')
.fill(guestAvatarUrl) .fill(guestAvatarUrl)
await page.getByRole('button', { name: 'Go' }).click() await page.getByRole('button', { name: 'Go' }).click()
await expect(page.locator('.typebot-container img')).toHaveAttribute( await expect(
'src', page.getByRole('img', { name: 'Bot avatar' }).nth(2)
guestAvatarUrl ).toHaveAttribute('src', guestAvatarUrl)
)
await page.waitForTimeout(1000) await page.waitForTimeout(1000)
// Input // Input

View File

@ -13,7 +13,7 @@ import {
} from '../helpers/sanitizers' } from '../helpers/sanitizers'
import { createId } from '@paralleldrive/cuid2' import { createId } from '@paralleldrive/cuid2'
import { EventType } from '@typebot.io/schemas/features/events/constants' import { EventType } from '@typebot.io/schemas/features/events/constants'
import { trackEvents } from '@typebot.io/lib/telemetry/trackEvents' import { trackEvents } from '@typebot.io/telemetry/trackEvents'
const typebotCreateSchemaPick = { const typebotCreateSchemaPick = {
name: true, name: true,

View File

@ -4,7 +4,7 @@ import { TRPCError } from '@trpc/server'
import { Typebot } from '@typebot.io/schemas' import { Typebot } from '@typebot.io/schemas'
import { z } from 'zod' import { z } from 'zod'
import { isWriteTypebotForbidden } from '../helpers/isWriteTypebotForbidden' import { isWriteTypebotForbidden } from '../helpers/isWriteTypebotForbidden'
import { archiveResults } from '@typebot.io/lib/api/helpers/archiveResults' import { archiveResults } from '@typebot.io/results/archiveResults'
export const deleteTypebot = authenticatedProcedure export const deleteTypebot = authenticatedProcedure
.meta({ .meta({

View File

@ -9,7 +9,7 @@ import {
} from '@typebot.io/schemas' } from '@typebot.io/schemas'
import { z } from 'zod' import { z } from 'zod'
import { isReadTypebotForbidden } from '../helpers/isReadTypebotForbidden' import { isReadTypebotForbidden } from '../helpers/isReadTypebotForbidden'
import { migratePublicTypebot } from '@typebot.io/lib/migrations/migrateTypebot' import { migratePublicTypebot } from '@typebot.io/migrations/migrateTypebot'
export const getPublishedTypebot = authenticatedProcedure export const getPublishedTypebot = authenticatedProcedure
.meta({ .meta({

View File

@ -4,7 +4,7 @@ import { TRPCError } from '@trpc/server'
import { typebotSchema } from '@typebot.io/schemas' import { typebotSchema } from '@typebot.io/schemas'
import { z } from 'zod' import { z } from 'zod'
import { isReadTypebotForbidden } from '../helpers/isReadTypebotForbidden' import { isReadTypebotForbidden } from '../helpers/isReadTypebotForbidden'
import { migrateTypebot } from '@typebot.io/lib/migrations/migrateTypebot' import { migrateTypebot } from '@typebot.io/migrations/migrateTypebot'
import { CollaborationType } from '@typebot.io/prisma' import { CollaborationType } from '@typebot.io/prisma'
import { env } from '@typebot.io/env' import { env } from '@typebot.io/env'

View File

@ -17,8 +17,8 @@ import {
sanitizeSettings, sanitizeSettings,
} from '../helpers/sanitizers' } from '../helpers/sanitizers'
import { preprocessTypebot } from '@typebot.io/schemas/features/typebot/helpers/preprocessTypebot' import { preprocessTypebot } from '@typebot.io/schemas/features/typebot/helpers/preprocessTypebot'
import { migrateTypebot } from '@typebot.io/lib/migrations/migrateTypebot' import { migrateTypebot } from '@typebot.io/migrations/migrateTypebot'
import { trackEvents } from '@typebot.io/lib/telemetry/trackEvents' import { trackEvents } from '@typebot.io/telemetry/trackEvents'
const omittedProps = { const omittedProps = {
id: true, id: true,

View File

@ -15,7 +15,7 @@ import { Plan } from '@typebot.io/prisma'
import { InputBlockType } from '@typebot.io/schemas/features/blocks/inputs/constants' import { InputBlockType } from '@typebot.io/schemas/features/blocks/inputs/constants'
import { computeRiskLevel } from '@typebot.io/radar' import { computeRiskLevel } from '@typebot.io/radar'
import { env } from '@typebot.io/env' import { env } from '@typebot.io/env'
import { trackEvents } from '@typebot.io/lib/telemetry/trackEvents' import { trackEvents } from '@typebot.io/telemetry/trackEvents'
import { parseTypebotPublishEvents } from '@/features/telemetry/helpers/parseTypebotPublishEvents' import { parseTypebotPublishEvents } from '@/features/telemetry/helpers/parseTypebotPublishEvents'
export const publishTypebot = authenticatedProcedure export const publishTypebot = authenticatedProcedure

View File

@ -18,7 +18,7 @@ import { isWriteTypebotForbidden } from '../helpers/isWriteTypebotForbidden'
import { isCloudProdInstance } from '@/helpers/isCloudProdInstance' import { isCloudProdInstance } from '@/helpers/isCloudProdInstance'
import { Prisma } from '@typebot.io/prisma' import { Prisma } from '@typebot.io/prisma'
import { hasProPerks } from '@/features/billing/helpers/hasProPerks' import { hasProPerks } from '@/features/billing/helpers/hasProPerks'
import { migrateTypebot } from '@typebot.io/lib/migrations/migrateTypebot' import { migrateTypebot } from '@typebot.io/migrations/migrateTypebot'
const typebotUpdateSchemaPick = { const typebotUpdateSchemaPick = {
version: true, version: true,

View File

@ -1,9 +1,9 @@
import { isDefined } from '@typebot.io/lib'
import { import {
isChoiceInput, isChoiceInput,
isConditionBlock, isConditionBlock,
isDefined,
isPictureChoiceInput, isPictureChoiceInput,
} from '@typebot.io/lib' } from '@typebot.io/schemas/helpers'
import { BlockV6 } from '@typebot.io/schemas' import { BlockV6 } from '@typebot.io/schemas'
import { InputBlockType } from '@typebot.io/schemas/features/blocks/inputs/constants' import { InputBlockType } from '@typebot.io/schemas/features/blocks/inputs/constants'
import { LogicBlockType } from '@typebot.io/schemas/features/blocks/logic/constants' import { LogicBlockType } from '@typebot.io/schemas/features/blocks/logic/constants'

View File

@ -1,5 +1,5 @@
import { createId } from '@paralleldrive/cuid2' import { createId } from '@paralleldrive/cuid2'
import { blockTypeHasItems } from '@typebot.io/lib' import { blockTypeHasItems } from '@typebot.io/schemas/helpers'
import { BlockV6, BlockWithItems, ItemV6 } from '@typebot.io/schemas' import { BlockV6, BlockWithItems, ItemV6 } from '@typebot.io/schemas'
import { InputBlockType } from '@typebot.io/schemas/features/blocks/inputs/constants' import { InputBlockType } from '@typebot.io/schemas/features/blocks/inputs/constants'
import { LogicBlockType } from '@typebot.io/schemas/features/blocks/logic/constants' import { LogicBlockType } from '@typebot.io/schemas/features/blocks/logic/constants'

View File

@ -4,7 +4,7 @@ import { TRPCError } from '@trpc/server'
import { Workspace, workspaceSchema } from '@typebot.io/schemas' import { Workspace, workspaceSchema } from '@typebot.io/schemas'
import { z } from 'zod' import { z } from 'zod'
import { parseWorkspaceDefaultPlan } from '../helpers/parseWorkspaceDefaultPlan' import { parseWorkspaceDefaultPlan } from '../helpers/parseWorkspaceDefaultPlan'
import { trackEvents } from '@typebot.io/lib/telemetry/trackEvents' import { trackEvents } from '@typebot.io/telemetry/trackEvents'
export const createWorkspace = authenticatedProcedure export const createWorkspace = authenticatedProcedure
.meta({ .meta({

View File

@ -19,7 +19,7 @@ import { updateInvitationQuery } from '../queries/updateInvitationQuery'
import { updateMemberQuery } from '../queries/updateMemberQuery' import { updateMemberQuery } from '../queries/updateMemberQuery'
import { Member } from '../types' import { Member } from '../types'
import { useWorkspace } from '../WorkspaceProvider' import { useWorkspace } from '../WorkspaceProvider'
import { getSeatsLimit } from '@typebot.io/lib/billing/getSeatsLimit' import { getSeatsLimit } from '@typebot.io/billing/getSeatsLimit'
import { useTranslate } from '@tolgee/react' import { useTranslate } from '@tolgee/react'
export const MembersList = () => { export const MembersList = () => {

View File

@ -1,12 +1,12 @@
import test, { expect } from '@playwright/test' import test, { expect } from '@playwright/test'
import { createId } from '@paralleldrive/cuid2' import { createId } from '@paralleldrive/cuid2'
import { createTypebots } from '@typebot.io/lib/playwright/databaseActions' import { createTypebots } from '@typebot.io/playwright/databaseActions'
import { import {
proWorkspaceId, proWorkspaceId,
starterWorkspaceId, starterWorkspaceId,
} from '@typebot.io/lib/playwright/databaseSetup' } from '@typebot.io/playwright/databaseSetup'
import { parseDefaultGroupWithBlock } from '@typebot.io/lib/playwright/databaseHelpers' import { parseDefaultGroupWithBlock } from '@typebot.io/playwright/databaseHelpers'
import { mockSessionResponsesToOtherUser } from '@typebot.io/lib/playwright/testHelpers' import { mockSessionResponsesToOtherUser } from '@typebot.io/playwright/testHelpers'
import { InputBlockType } from '@typebot.io/schemas/features/blocks/inputs/constants' import { InputBlockType } from '@typebot.io/schemas/features/blocks/inputs/constants'
const proTypebotId = createId() const proTypebotId = createId()
@ -162,7 +162,7 @@ test("can't add new members when limit is reached", async ({ page }) => {
await expect(page.locator('button >> text="Invite"')).toBeDisabled() await expect(page.locator('button >> text="Invite"')).toBeDisabled()
await expect( await expect(
page.locator( page.locator(
'text="Upgrade your plan to work with more team members, and unlock awesome power features 🚀"' 'text="Upgrade your plan to work with more team members, and unlock awesome power features"'
) )
).toBeVisible() ).toBeVisible()
await page.click('text="Free workspace"', { force: true }) await page.click('text="Free workspace"', { force: true })

View File

@ -20,7 +20,7 @@ import got from 'got'
import { env } from '@typebot.io/env' import { env } from '@typebot.io/env'
import * as Sentry from '@sentry/nextjs' import * as Sentry from '@sentry/nextjs'
import { getIp } from '@typebot.io/lib/getIp' import { getIp } from '@typebot.io/lib/getIp'
import { trackEvents } from '@typebot.io/lib/telemetry/trackEvents' import { trackEvents } from '@typebot.io/telemetry/trackEvents'
const providers: Provider[] = [] const providers: Provider[] = []

View File

@ -8,8 +8,8 @@ import { Plan, WorkspaceRole } from '@typebot.io/prisma'
import { RequestHandler } from 'next/dist/server/next' import { RequestHandler } from 'next/dist/server/next'
import { Settings } from '@typebot.io/schemas' import { Settings } from '@typebot.io/schemas'
import { env } from '@typebot.io/env' import { env } from '@typebot.io/env'
import { prices } from '@typebot.io/lib/billing/constants' import { prices } from '@typebot.io/billing/constants'
import { trackEvents } from '@typebot.io/lib/telemetry/trackEvents' import { trackEvents } from '@typebot.io/telemetry/trackEvents'
if (!env.STRIPE_SECRET_KEY || !env.STRIPE_WEBHOOK_SECRET) if (!env.STRIPE_SECRET_KEY || !env.STRIPE_WEBHOOK_SECRET)
throw new Error('STRIPE_SECRET_KEY or STRIPE_WEBHOOK_SECRET missing') throw new Error('STRIPE_SECRET_KEY or STRIPE_WEBHOOK_SECRET missing')

View File

@ -3,7 +3,7 @@ import { NextApiRequest, NextApiResponse } from 'next'
import { getAuthenticatedUser } from '@/features/auth/helpers/getAuthenticatedUser' import { getAuthenticatedUser } from '@/features/auth/helpers/getAuthenticatedUser'
import { methodNotAllowed, notAuthenticated } from '@typebot.io/lib/api' import { methodNotAllowed, notAuthenticated } from '@typebot.io/lib/api'
import { User } from '@typebot.io/schemas' import { User } from '@typebot.io/schemas'
import { trackEvents } from '@typebot.io/lib/telemetry/trackEvents' import { trackEvents } from '@typebot.io/telemetry/trackEvents'
import { Prisma } from '@typebot.io/prisma' import { Prisma } from '@typebot.io/prisma'
const handler = async (req: NextApiRequest, res: NextApiResponse) => { const handler = async (req: NextApiRequest, res: NextApiResponse) => {

View File

@ -8,7 +8,7 @@ import {
} from '@typebot.io/lib/api' } from '@typebot.io/lib/api'
import { getAuthenticatedUser } from '@/features/auth/helpers/getAuthenticatedUser' import { getAuthenticatedUser } from '@/features/auth/helpers/getAuthenticatedUser'
import { sendWorkspaceMemberInvitationEmail } from '@typebot.io/emails' import { sendWorkspaceMemberInvitationEmail } from '@typebot.io/emails'
import { getSeatsLimit } from '@typebot.io/lib/billing/getSeatsLimit' import { getSeatsLimit } from '@typebot.io/billing/getSeatsLimit'
import { env } from '@typebot.io/env' import { env } from '@typebot.io/env'
const handler = async (req: NextApiRequest, res: NextApiResponse) => { const handler = async (req: NextApiRequest, res: NextApiResponse) => {

View File

@ -46,7 +46,9 @@
"id": "s1ZvUqWxV6b8UgFGYWh39pV", "id": "s1ZvUqWxV6b8UgFGYWh39pV",
"groupId": "jd4S6BQsUQ2RuKieHXYKs9", "groupId": "jd4S6BQsUQ2RuKieHXYKs9",
"type": "Google Sheets", "type": "Google Sheets",
"options": {} "options": {
"spreadsheetId": "1k_pIDw3YHl9tlZusbBVSBRY0PeRPd2H6t4Nj7rwnOtM"
}
} }
] ]
} }

View File

@ -46,7 +46,9 @@
"id": "s1ZvUqWxV6b8UgFGYWh39pV", "id": "s1ZvUqWxV6b8UgFGYWh39pV",
"groupId": "jd4S6BQsUQ2RuKieHXYKs9", "groupId": "jd4S6BQsUQ2RuKieHXYKs9",
"type": "Google Sheets", "type": "Google Sheets",
"options": {}, "options": {
"spreadsheetId": "1k_pIDw3YHl9tlZusbBVSBRY0PeRPd2H6t4Nj7rwnOtM"
},
"outgoingEdgeId": "tBsPNYzMW1mMSvFMHZpmx8" "outgoingEdgeId": "tBsPNYzMW1mMSvFMHZpmx8"
} }
] ]

View File

@ -0,0 +1,6 @@
import { test as setup } from '@playwright/test'
import { globalSetup } from '@typebot.io/playwright/globalSetup'
setup('setup db', async () => {
await globalSetup()
})

View File

@ -6,7 +6,7 @@ import {
Workspace, Workspace,
} from '@typebot.io/prisma' } from '@typebot.io/prisma'
import Stripe from 'stripe' import Stripe from 'stripe'
import { proWorkspaceId } from '@typebot.io/lib/playwright/databaseSetup' import { proWorkspaceId } from '@typebot.io/playwright/databaseSetup'
import { env } from '@typebot.io/env' import { env } from '@typebot.io/env'
const prisma = new PrismaClient() const prisma = new PrismaClient()

View File

@ -16,8 +16,8 @@ import {
Thead, Thead,
Tr, Tr,
} from '@chakra-ui/react' } from '@chakra-ui/react'
import { proChatTiers } from '@typebot.io/lib/billing/constants' import { proChatTiers } from '@typebot.io/billing/constants'
import { formatPrice } from '@typebot.io/lib/billing/formatPrice' import { formatPrice } from '@typebot.io/billing/formatPrice'
type Props = { type Props = {
isOpen: boolean isOpen: boolean

View File

@ -3,7 +3,7 @@ import { HelpCircleIcon } from 'assets/icons/HelpCircleIcon'
import Link from 'next/link' import Link from 'next/link'
import React from 'react' import React from 'react'
import { PricingCard } from './PricingCard' import { PricingCard } from './PricingCard'
import { chatsLimits } from '@typebot.io/lib/billing/constants' import { chatsLimits } from '@typebot.io/billing/constants'
export const FreePlanCard = () => ( export const FreePlanCard = () => (
<PricingCard <PricingCard

Some files were not shown because too many files have changed in this diff Show More