2
0

📦 Update cuid to cuid2

This commit is contained in:
Baptiste Arnaud
2023-02-10 15:06:02 +01:00
parent 2dbf0fb848
commit 51f76700b2
77 changed files with 254 additions and 250 deletions

View File

@ -57,7 +57,7 @@
"canvas-confetti": "1.6.0",
"chakra-react-select": "^4.4.3",
"codemirror": "6.0.1",
"cuid": "3.0.0",
"@paralleldrive/cuid2": "2.0.1",
"deep-object-diff": "1.1.9",
"dequal": "2.0.3",
"emails": "workspace:*",

View File

@ -1,6 +1,6 @@
import { Box, Button, Fade, Flex, IconButton, Stack } from '@chakra-ui/react'
import { TrashIcon, PlusIcon } from '@/components/icons'
import cuid from 'cuid'
import { createId } from '@paralleldrive/cuid2'
import React, { useState } from 'react'
type ItemWithId<T> = T & { id: string }
@ -32,7 +32,7 @@ export const TableList = <T,>({
const [showDeleteIndex, setShowDeleteIndex] = useState<number | null>(null)
const createItem = () => {
const id = cuid()
const id = createId()
const newItem = { id } as ItemWithId<T>
setItems([...items, newItem])
onItemsChange([...items, newItem])

View File

@ -15,7 +15,7 @@ import {
} from '@chakra-ui/react'
import { EditIcon, PlusIcon, TrashIcon } from '@/components/icons'
import { useTypebot } from '@/features/editor/providers/TypebotProvider/TypebotProvider'
import cuid from 'cuid'
import { createId } from '@paralleldrive/cuid2'
import { Variable } from 'models'
import React, { useState, useRef, ChangeEvent, useEffect } from 'react'
import { byId, isDefined, isNotDefined } from 'utils'
@ -90,7 +90,7 @@ export const VariableSearchInput = ({
const handleCreateNewVariableClick = () => {
if (!inputValue || inputValue === '') return
const id = 'v' + cuid()
const id = 'v' + createId()
onSelectVariable({ id, name: inputValue })
createVariable({ id, name: inputValue })
inputRef.current?.blur()

View File

@ -1,6 +1,6 @@
import { getTestAsset } from '@/test/utils/playwright'
import test, { expect } from '@playwright/test'
import cuid from 'cuid'
import { createId } from '@paralleldrive/cuid2'
import {
importTypebotInDatabase,
injectFakeResults,
@ -8,7 +8,7 @@ import {
import { starterWorkspaceId } from 'utils/playwright/databaseSetup'
test('analytics are not available for non-pro workspaces', async ({ page }) => {
const typebotId = cuid()
const typebotId = createId()
await importTypebotInDatabase(
getTestAsset('typebots/results/submissionHeader.json'),
{

View File

@ -3,7 +3,7 @@ import {
createClaimableCustomPlan,
} from '@/test/utils/databaseActions'
import test, { expect } from '@playwright/test'
import cuid from 'cuid'
import { createId } from '@paralleldrive/cuid2'
import { Plan } from 'db'
import {
createTypebots,
@ -12,10 +12,10 @@ import {
injectFakeResults,
} from 'utils/playwright/databaseActions'
const usageWorkspaceId = cuid()
const usageTypebotId = cuid()
const planChangeWorkspaceId = cuid()
const enterpriseWorkspaceId = cuid()
const usageWorkspaceId = createId()
const usageTypebotId = createId()
const planChangeWorkspaceId = createId()
const enterpriseWorkspaceId = createId()
test.beforeAll(async () => {
await createWorkspaces([

View File

@ -2,7 +2,7 @@ import test, { expect } from '@playwright/test'
import { createTypebots } from 'utils/playwright/databaseActions'
import { parseDefaultGroupWithBlock } from 'utils/playwright/databaseHelpers'
import { BubbleBlockType, defaultAudioBubbleContent } from 'models'
import cuid from 'cuid'
import { createId } from '@paralleldrive/cuid2'
import { getTestAsset } from '@/test/utils/playwright'
import { typebotViewer } from 'utils/playwright/testHelpers'
@ -10,7 +10,7 @@ const audioSampleUrl =
'https://www.soundhelix.com/examples/mp3/SoundHelix-Song-1.mp3'
test('should work as expected', async ({ page }) => {
const typebotId = cuid()
const typebotId = createId()
await createTypebots([
{
id: typebotId,

View File

@ -1,6 +1,6 @@
import test, { expect } from '@playwright/test'
import { BubbleBlockType, defaultEmbedBubbleContent } from 'models'
import cuid from 'cuid'
import { createId } from '@paralleldrive/cuid2'
import { createTypebots } from 'utils/playwright/databaseActions'
import { parseDefaultGroupWithBlock } from 'utils/playwright/databaseHelpers'
import { typebotViewer } from 'utils/playwright/testHelpers'
@ -11,7 +11,7 @@ const siteSrc = 'https://app.cal.com/baptistearno/15min'
test.describe.parallel('Embed bubble block', () => {
test.describe('Content settings', () => {
test('should import and parse embed correctly', async ({ page }) => {
const typebotId = cuid()
const typebotId = createId()
await createTypebots([
{
id: typebotId,
@ -31,7 +31,7 @@ test.describe.parallel('Embed bubble block', () => {
test.describe('Preview', () => {
test('should display embed correctly', async ({ page }) => {
const typebotId = cuid()
const typebotId = createId()
await createTypebots([
{
id: typebotId,

View File

@ -2,7 +2,7 @@ import test, { expect } from '@playwright/test'
import { createTypebots } from 'utils/playwright/databaseActions'
import { parseDefaultGroupWithBlock } from 'utils/playwright/databaseHelpers'
import { BubbleBlockType, defaultImageBubbleContent } from 'models'
import cuid from 'cuid'
import { createId } from '@paralleldrive/cuid2'
import { typebotViewer } from 'utils/playwright/testHelpers'
import { getTestAsset } from '@/test/utils/playwright'
@ -12,7 +12,7 @@ const unsplashImageSrc =
test.describe.parallel('Image bubble block', () => {
test.describe('Content settings', () => {
test('should upload image file correctly', async ({ page }) => {
const typebotId = cuid()
const typebotId = createId()
await createTypebots([
{
id: typebotId,
@ -34,7 +34,7 @@ test.describe.parallel('Image bubble block', () => {
})
test('should import image link correctly', async ({ page }) => {
const typebotId = cuid()
const typebotId = createId()
await createTypebots([
{
id: typebotId,
@ -57,7 +57,7 @@ test.describe.parallel('Image bubble block', () => {
})
test('should import gifs correctly', async ({ page }) => {
const typebotId = cuid()
const typebotId = createId()
await createTypebots([
{
id: typebotId,
@ -102,7 +102,7 @@ test.describe.parallel('Image bubble block', () => {
test.describe('Preview', () => {
test('should display correctly', async ({ page }) => {
const typebotId = cuid()
const typebotId = createId()
await createTypebots([
{
id: typebotId,

View File

@ -2,12 +2,12 @@ import test, { expect } from '@playwright/test'
import { createTypebots } from 'utils/playwright/databaseActions'
import { parseDefaultGroupWithBlock } from 'utils/playwright/databaseHelpers'
import { BubbleBlockType, defaultTextBubbleContent } from 'models'
import cuid from 'cuid'
import { createId } from '@paralleldrive/cuid2'
import { typebotViewer } from 'utils/playwright/testHelpers'
test.describe('Text bubble block', () => {
test('rich text features should work', async ({ page }) => {
const typebotId = cuid()
const typebotId = createId()
await createTypebots([
{
id: typebotId,

View File

@ -6,7 +6,7 @@ import {
defaultVideoBubbleContent,
VideoBubbleContentType,
} from 'models'
import cuid from 'cuid'
import { createId } from '@paralleldrive/cuid2'
import { typebotViewer } from 'utils/playwright/testHelpers'
const videoSrc =
@ -17,7 +17,7 @@ const vimeoVideoSrc = 'https://vimeo.com/649301125'
test.describe.parallel('Video bubble block', () => {
test.describe('Content settings', () => {
test('should import video url correctly', async ({ page }) => {
const typebotId = cuid()
const typebotId = createId()
await createTypebots([
{
id: typebotId,
@ -41,7 +41,7 @@ test.describe.parallel('Video bubble block', () => {
test.describe('Preview', () => {
test('should display video correctly', async ({ page }) => {
const typebotId = cuid()
const typebotId = createId()
await createTypebots([
{
id: typebotId,
@ -63,7 +63,7 @@ test.describe.parallel('Video bubble block', () => {
})
test('should display youtube video correctly', async ({ page }) => {
const typebotId = cuid()
const typebotId = createId()
await createTypebots([
{
id: typebotId,
@ -87,7 +87,7 @@ test.describe.parallel('Video bubble block', () => {
})
test('should display vimeo video correctly', async ({ page }) => {
const typebotId = cuid()
const typebotId = createId()
await createTypebots([
{
id: typebotId,

View File

@ -5,13 +5,13 @@ import {
} from 'utils/playwright/databaseActions'
import { parseDefaultGroupWithBlock } from 'utils/playwright/databaseHelpers'
import { defaultChoiceInputOptions, InputBlockType, ItemType } from 'models'
import cuid from 'cuid'
import { createId } from '@paralleldrive/cuid2'
import { typebotViewer } from 'utils/playwright/testHelpers'
import { getTestAsset } from '@/test/utils/playwright'
test.describe.parallel('Buttons input block', () => {
test('can edit button items', async ({ page }) => {
const typebotId = cuid()
const typebotId = createId()
await createTypebots([
{
id: typebotId,
@ -75,7 +75,7 @@ test.describe.parallel('Buttons input block', () => {
})
test('Variable buttons should work', async ({ page }) => {
const typebotId = cuid()
const typebotId = createId()
await importTypebotInDatabase(
getTestAsset('typebots/inputs/variableButton.json'),
{

View File

@ -3,11 +3,11 @@ import { createTypebots } from 'utils/playwright/databaseActions'
import { parseDefaultGroupWithBlock } from 'utils/playwright/databaseHelpers'
import { defaultDateInputOptions, InputBlockType } from 'models'
import { typebotViewer } from 'utils/playwright/testHelpers'
import cuid from 'cuid'
import { createId } from '@paralleldrive/cuid2'
test.describe('Date input block', () => {
test('options should work', async ({ page }) => {
const typebotId = cuid()
const typebotId = createId()
await createTypebots([
{
id: typebotId,

View File

@ -3,11 +3,11 @@ import { createTypebots } from 'utils/playwright/databaseActions'
import { parseDefaultGroupWithBlock } from 'utils/playwright/databaseHelpers'
import { defaultEmailInputOptions, InputBlockType } from 'models'
import { typebotViewer } from 'utils/playwright/testHelpers'
import cuid from 'cuid'
import { createId } from '@paralleldrive/cuid2'
test.describe('Email input block', () => {
test('options should work', async ({ page }) => {
const typebotId = cuid()
const typebotId = createId()
await createTypebots([
{
id: typebotId,

View File

@ -3,14 +3,14 @@ import { createTypebots } from 'utils/playwright/databaseActions'
import { parseDefaultGroupWithBlock } from 'utils/playwright/databaseHelpers'
import { defaultFileInputOptions, InputBlockType } from 'models'
import { typebotViewer } from 'utils/playwright/testHelpers'
import cuid from 'cuid'
import { createId } from '@paralleldrive/cuid2'
import { freeWorkspaceId } from 'utils/playwright/databaseSetup'
import { getTestAsset } from '@/test/utils/playwright'
test.describe.configure({ mode: 'parallel' })
test('options should work', async ({ page }) => {
const typebotId = cuid()
const typebotId = createId()
await createTypebots([
{
id: typebotId,
@ -59,7 +59,7 @@ test('options should work', async ({ page }) => {
test.describe('Free workspace', () => {
test("shouldn't be able to publish typebot", async ({ page }) => {
const typebotId = cuid()
const typebotId = createId()
await createTypebots([
{
id: typebotId,

View File

@ -3,11 +3,11 @@ import { createTypebots } from 'utils/playwright/databaseActions'
import { parseDefaultGroupWithBlock } from 'utils/playwright/databaseHelpers'
import { defaultNumberInputOptions, InputBlockType } from 'models'
import { typebotViewer } from 'utils/playwright/testHelpers'
import cuid from 'cuid'
import { createId } from '@paralleldrive/cuid2'
test.describe('Number input block', () => {
test('options should work', async ({ page }) => {
const typebotId = cuid()
const typebotId = createId()
await createTypebots([
{
id: typebotId,

View File

@ -2,13 +2,13 @@ import test, { expect } from '@playwright/test'
import { createTypebots } from 'utils/playwright/databaseActions'
import { parseDefaultGroupWithBlock } from 'utils/playwright/databaseHelpers'
import { defaultPaymentInputOptions, InputBlockType } from 'models'
import cuid from 'cuid'
import { createId } from '@paralleldrive/cuid2'
import { typebotViewer } from 'utils/playwright/testHelpers'
import { stripePaymentForm } from '@/test/utils/selectorUtils'
test.describe('Payment input block', () => {
test('Can configure Stripe account', async ({ page }) => {
const typebotId = cuid()
const typebotId = createId()
await createTypebots([
{
id: typebotId,

View File

@ -3,11 +3,11 @@ import { createTypebots } from 'utils/playwright/databaseActions'
import { parseDefaultGroupWithBlock } from 'utils/playwright/databaseHelpers'
import { defaultPhoneInputOptions, InputBlockType } from 'models'
import { typebotViewer } from 'utils/playwright/testHelpers'
import cuid from 'cuid'
import { createId } from '@paralleldrive/cuid2'
test.describe('Phone input block', () => {
test('options should work', async ({ page }) => {
const typebotId = cuid()
const typebotId = createId()
await createTypebots([
{
id: typebotId,

View File

@ -3,7 +3,7 @@ import { createTypebots } from 'utils/playwright/databaseActions'
import { parseDefaultGroupWithBlock } from 'utils/playwright/databaseHelpers'
import { defaultRatingInputOptions, InputBlockType } from 'models'
import { typebotViewer } from 'utils/playwright/testHelpers'
import cuid from 'cuid'
import { createId } from '@paralleldrive/cuid2'
const boxSvg = `<svg
xmlns="http://www.w3.org/2000/svg"
@ -19,7 +19,7 @@ const boxSvg = `<svg
</svg>`
test('options should work', async ({ page }) => {
const typebotId = cuid()
const typebotId = createId()
await createTypebots([
{
id: typebotId,

View File

@ -3,11 +3,11 @@ import { createTypebots } from 'utils/playwright/databaseActions'
import { parseDefaultGroupWithBlock } from 'utils/playwright/databaseHelpers'
import { defaultTextInputOptions, InputBlockType } from 'models'
import { typebotViewer } from 'utils/playwright/testHelpers'
import cuid from 'cuid'
import { createId } from '@paralleldrive/cuid2'
test.describe.parallel('Text input block', () => {
test('options should work', async ({ page }) => {
const typebotId = cuid()
const typebotId = createId()
await createTypebots([
{
id: typebotId,

View File

@ -3,11 +3,11 @@ import { createTypebots } from 'utils/playwright/databaseActions'
import { parseDefaultGroupWithBlock } from 'utils/playwright/databaseHelpers'
import { defaultUrlInputOptions, InputBlockType } from 'models'
import { typebotViewer } from 'utils/playwright/testHelpers'
import cuid from 'cuid'
import { createId } from '@paralleldrive/cuid2'
test.describe('Url input block', () => {
test('options should work', async ({ page }) => {
const typebotId = cuid()
const typebotId = createId()
await createTypebots([
{
id: typebotId,

View File

@ -1,10 +1,10 @@
import test, { expect } from '@playwright/test'
import { createTypebots } from 'utils/playwright/databaseActions'
import { parseDefaultGroupWithBlock } from 'utils/playwright/databaseHelpers'
import cuid from 'cuid'
import { createId } from '@paralleldrive/cuid2'
import { defaultChatwootOptions, IntegrationBlockType } from 'models'
const typebotId = cuid()
const typebotId = createId()
const chatwootTestWebsiteToken = 'tueXiiqEmrWUCZ4NUyoR7nhE'

View File

@ -2,11 +2,11 @@ import test from '@playwright/test'
import { createTypebots } from 'utils/playwright/databaseActions'
import { parseDefaultGroupWithBlock } from 'utils/playwright/databaseHelpers'
import { defaultGoogleAnalyticsOptions, IntegrationBlockType } from 'models'
import cuid from 'cuid'
import { createId } from '@paralleldrive/cuid2'
test.describe('Google Analytics block', () => {
test('its configuration should work', async ({ page }) => {
const typebotId = cuid()
const typebotId = createId()
await createTypebots([
{
id: typebotId,

View File

@ -1,12 +1,12 @@
import test, { expect, Page } from '@playwright/test'
import { importTypebotInDatabase } from 'utils/playwright/databaseActions'
import { typebotViewer } from 'utils/playwright/testHelpers'
import cuid from 'cuid'
import { createId } from '@paralleldrive/cuid2'
import { getTestAsset } from '@/test/utils/playwright'
test.describe.parallel('Google sheets integration', () => {
test('Insert row should work', async ({ page }) => {
const typebotId = cuid()
const typebotId = createId()
await importTypebotInDatabase(
getTestAsset('typebots/integrations/googleSheets.json'),
{
@ -55,7 +55,7 @@ test.describe.parallel('Google sheets integration', () => {
})
test('Update row should work', async ({ page }) => {
const typebotId = cuid()
const typebotId = createId()
await importTypebotInDatabase(
getTestAsset('typebots/integrations/googleSheets.json'),
{
@ -104,7 +104,7 @@ test.describe.parallel('Google sheets integration', () => {
})
test('Get row should work', async ({ page }) => {
const typebotId = cuid()
const typebotId = createId()
await importTypebotInDatabase(
getTestAsset('typebots/integrations/googleSheetsGet.json'),
{

View File

@ -1,10 +1,10 @@
import test, { expect } from '@playwright/test'
import { importTypebotInDatabase } from 'utils/playwright/databaseActions'
import { typebotViewer } from 'utils/playwright/testHelpers'
import cuid from 'cuid'
import { createId } from '@paralleldrive/cuid2'
import { getTestAsset } from '@/test/utils/playwright'
const typebotId = cuid()
const typebotId = createId()
test.describe('Send email block', () => {
test('its configuration should work', async ({ page }) => {

View File

@ -4,13 +4,13 @@ import {
importTypebotInDatabase,
} from 'utils/playwright/databaseActions'
import { HttpMethod } from 'models'
import cuid from 'cuid'
import { createId } from '@paralleldrive/cuid2'
import { getTestAsset } from '@/test/utils/playwright'
import { apiToken } from 'utils/playwright/databaseSetup'
test.describe('Builder', () => {
test('easy configuration should work', async ({ page }) => {
const typebotId = cuid()
const typebotId = createId()
await importTypebotInDatabase(
getTestAsset('typebots/integrations/easyConfigWebhook.json'),
{
@ -31,7 +31,7 @@ test.describe('Builder', () => {
})
test('its configuration should work', async ({ page }) => {
const typebotId = cuid()
const typebotId = createId()
await importTypebotInDatabase(
getTestAsset('typebots/integrations/webhook.json'),
{

View File

@ -28,7 +28,7 @@ import { byId, isNotDefined } from 'utils'
import { PlusIcon } from '@/components/icons'
import { ConditionItemForm } from './ConditionItemForm'
import { useGraph } from '@/features/graph'
import cuid from 'cuid'
import { createId } from '@paralleldrive/cuid2'
type Props = {
item: ConditionItem
@ -55,7 +55,7 @@ export const ConditionItemNode = ({ item, isMouseOver, indices }: Props) => {
const handlePlusClick = (event: React.MouseEvent) => {
event.stopPropagation()
const itemIndex = indices.itemIndex + 1
const newItemId = cuid()
const newItemId = createId()
createItem(
{
blockId: item.blockId,

View File

@ -1,10 +1,10 @@
import test, { expect } from '@playwright/test'
import { typebotViewer } from 'utils/playwright/testHelpers'
import { importTypebotInDatabase } from 'utils/playwright/databaseActions'
import cuid from 'cuid'
import { createId } from '@paralleldrive/cuid2'
import { getTestAsset } from '@/test/utils/playwright'
const typebotId = cuid()
const typebotId = createId()
test.describe('Condition block', () => {
test('its configuration should work', async ({ page }) => {

View File

@ -1,10 +1,10 @@
import test, { expect } from '@playwright/test'
import { typebotViewer } from 'utils/playwright/testHelpers'
import { importTypebotInDatabase } from 'utils/playwright/databaseActions'
import cuid from 'cuid'
import { createId } from '@paralleldrive/cuid2'
import { getTestAsset } from '@/test/utils/playwright'
const typebotId = cuid()
const typebotId = createId()
test.describe('Redirect block', () => {
test('its configuration should work', async ({ page, context }) => {

View File

@ -1,10 +1,10 @@
import test, { expect } from '@playwright/test'
import { typebotViewer } from 'utils/playwright/testHelpers'
import { importTypebotInDatabase } from 'utils/playwright/databaseActions'
import cuid from 'cuid'
import { createId } from '@paralleldrive/cuid2'
import { getTestAsset } from '@/test/utils/playwright'
const typebotId = cuid()
const typebotId = createId()
test.describe('Script block', () => {
test('script should trigger', async ({ page }) => {

View File

@ -1,10 +1,10 @@
import test, { expect } from '@playwright/test'
import { typebotViewer } from 'utils/playwright/testHelpers'
import { importTypebotInDatabase } from 'utils/playwright/databaseActions'
import cuid from 'cuid'
import { createId } from '@paralleldrive/cuid2'
import { getTestAsset } from '@/test/utils/playwright'
const typebotId = cuid()
const typebotId = createId()
test.describe('Set variable block', () => {
test('its configuration should work', async ({ page }) => {

View File

@ -1,12 +1,12 @@
import test, { expect } from '@playwright/test'
import { typebotViewer } from 'utils/playwright/testHelpers'
import { importTypebotInDatabase } from 'utils/playwright/databaseActions'
import cuid from 'cuid'
import { createId } from '@paralleldrive/cuid2'
import { getTestAsset } from '@/test/utils/playwright'
test('should be configurable', async ({ page }) => {
const typebotId = cuid()
const linkedTypebotId = cuid()
const typebotId = createId()
const linkedTypebotId = createId()
await importTypebotInDatabase(
getTestAsset('typebots/logic/linkTypebots/1.json'),
{ id: typebotId, name: 'My link typebot 1' }

View File

@ -1,10 +1,10 @@
import test, { expect } from '@playwright/test'
import { typebotViewer } from 'utils/playwright/testHelpers'
import { importTypebotInDatabase } from 'utils/playwright/databaseActions'
import cuid from 'cuid'
import { createId } from '@paralleldrive/cuid2'
import { getTestAsset } from '@/test/utils/playwright'
const typebotId = cuid()
const typebotId = createId()
test.describe('Wait block', () => {
test('wait should trigger', async ({ page }) => {

View File

@ -1,5 +1,5 @@
import test, { expect } from '@playwright/test'
import cuid from 'cuid'
import { createId } from '@paralleldrive/cuid2'
import { CollaborationType, Plan, WorkspaceRole } from 'db'
import prisma from '@/lib/prisma'
import { InputBlockType, defaultTextInputOptions } from 'models'
@ -13,8 +13,8 @@ import { createFolder } from '@/test/utils/databaseActions'
test.describe('Typebot owner', () => {
test('Can invite collaborators', async ({ page }) => {
const typebotId = cuid()
const guestWorkspaceId = cuid()
const typebotId = createId()
const guestWorkspaceId = createId()
await prisma.workspace.create({
data: {
id: guestWorkspaceId,
@ -66,8 +66,8 @@ test.describe('Typebot owner', () => {
test.describe('Guest with read access', () => {
test('should have shared typebots displayed', async ({ page }) => {
const typebotId = cuid()
const guestWorkspaceId = cuid()
const typebotId = createId()
const guestWorkspaceId = createId()
await prisma.workspace.create({
data: {
id: guestWorkspaceId,
@ -124,8 +124,8 @@ test.describe('Guest with read access', () => {
test.describe('Guest with write access', () => {
test('should have shared typebots displayed', async ({ page }) => {
const typebotId = cuid()
const guestWorkspaceId = cuid()
const typebotId = createId()
const guestWorkspaceId = createId()
await prisma.workspace.create({
data: {
id: guestWorkspaceId,

View File

@ -1,12 +1,12 @@
import test, { expect } from '@playwright/test'
import { InputBlockType, defaultTextInputOptions } from 'models'
import cuid from 'cuid'
import { createId } from '@paralleldrive/cuid2'
import { createTypebots } from 'utils/playwright/databaseActions'
import { parseDefaultGroupWithBlock } from 'utils/playwright/databaseHelpers'
import { starterWorkspaceId } from 'utils/playwright/databaseSetup'
test('should be able to connect custom domain', async ({ page }) => {
const typebotId = cuid()
const typebotId = createId()
await createTypebots([
{
id: typebotId,
@ -43,7 +43,7 @@ test('should be able to connect custom domain', async ({ page }) => {
test.describe('Starter workspace', () => {
test("Add my domain shouldn't be available", async ({ page }) => {
const typebotId = cuid()
const typebotId = createId()
await createTypebots([
{
id: typebotId,

View File

@ -1,4 +1,4 @@
import cuid from 'cuid'
import { createId } from '@paralleldrive/cuid2'
import {
defaultSettings,
defaultTheme,
@ -33,8 +33,8 @@ export const parseNewTypebot = ({
ownerAvatarUrl?: string
isBrandingEnabled?: boolean
}): NewTypebotProps => {
const startGroupId = cuid()
const startBlockId = cuid()
const startGroupId = createId()
const startBlockId = createId()
const startBlock: StartBlock = {
groupId: startGroupId,
id: startBlockId,

View File

@ -1,7 +1,7 @@
import { createFolders } from '@/test/utils/databaseActions'
import { deleteButtonInConfirmDialog } from '@/test/utils/selectorUtils'
import test, { expect } from '@playwright/test'
import cuid from 'cuid'
import { createId } from '@paralleldrive/cuid2'
import { createTypebots } from 'utils/playwright/databaseActions'
test('folders navigation should work', async ({ page }) => {
@ -47,7 +47,7 @@ test('folders and typebots should be deletable', async ({ page }) => {
})
test('folders and typebots should be movable', async ({ page }) => {
const droppableFolderId = cuid()
const droppableFolderId = createId()
await createFolders([{ id: droppableFolderId, name: 'Droppable folder' }])
await createTypebots([{ name: 'Draggable typebot' }])
await page.goto('/typebots')

View File

@ -1,5 +1,5 @@
import { duplicateWebhookQueries } from '@/features/blocks/integrations/webhook'
import cuid from 'cuid'
import { createId } from '@paralleldrive/cuid2'
import { Plan, Prisma } from 'db'
import {
ChoiceInputBlock,
@ -50,7 +50,7 @@ const duplicateTypebot = (
.filter(isWebhookBlock)
.map((s) => ({ id: s.webhookId }))
)
const id = cuid()
const id = createId()
return {
typebot: {
...typebot,
@ -131,6 +131,6 @@ const duplicateTypebot = (
const generateOldNewIdsMapping = (itemWithId: { id: string }[]) => {
const idsMapping: Map<string, string> = new Map()
itemWithId.forEach((item) => idsMapping.set(item.id, cuid()))
itemWithId.forEach((item) => idsMapping.set(item.id, createId()))
return idsMapping
}

View File

@ -1,6 +1,6 @@
import test, { expect } from '@playwright/test'
import { defaultTextInputOptions, InputBlockType } from 'models'
import cuid from 'cuid'
import { createId } from '@paralleldrive/cuid2'
import {
createTypebots,
importTypebotInDatabase,
@ -17,7 +17,7 @@ import { getTestAsset } from '@/test/utils/playwright'
test.describe.configure({ mode: 'parallel' })
test('Edges connection should work', async ({ page }) => {
const typebotId = cuid()
const typebotId = createId()
await createTypebots([
{
id: typebotId,
@ -68,7 +68,7 @@ test('Edges connection should work', async ({ page }) => {
expect(total).toBe(1)
})
test('Drag and drop blocks and items should work', async ({ page }) => {
const typebotId = cuid()
const typebotId = createId()
await importTypebotInDatabase(
getTestAsset('typebots/editor/buttonsDnd.json'),
{
@ -120,7 +120,7 @@ test('Drag and drop blocks and items should work', async ({ page }) => {
)
})
test('Undo / Redo and Zoom buttons should work', async ({ page }) => {
const typebotId = cuid()
const typebotId = createId()
await createTypebots([
{
id: typebotId,
@ -162,7 +162,7 @@ test('Undo / Redo and Zoom buttons should work', async ({ page }) => {
})
test('Rename and icon change should work', async ({ page }) => {
const typebotId = cuid()
const typebotId = createId()
await createTypebots([
{
id: typebotId,
@ -189,7 +189,7 @@ test('Rename and icon change should work', async ({ page }) => {
})
test('Preview from group should work', async ({ page }) => {
const typebotId = cuid()
const typebotId = createId()
await importTypebotInDatabase(
getTestAsset('typebots/editor/previewFromGroup.json'),
{
@ -214,7 +214,7 @@ test('Preview from group should work', async ({ page }) => {
})
test('Published typebot menu should work', async ({ page }) => {
const typebotId = cuid()
const typebotId = createId()
await createTypebots([
{
id: typebotId,

View File

@ -9,7 +9,7 @@ import { WritableDraft } from 'immer/dist/types/types-external'
import { SetTypebot } from '../TypebotProvider'
import produce from 'immer'
import { cleanUpEdgeDraft, deleteEdgeDraft } from './edges'
import cuid from 'cuid'
import { createId } from '@paralleldrive/cuid2'
import { byId, isWebhookBlock, blockHasItems } from 'utils'
import { duplicateItemDraft } from './items'
import { parseNewBlock } from '@/features/graph/utils'
@ -141,7 +141,7 @@ const moveBlockToGroup = (
export const duplicateBlockDraft =
(groupId: string) =>
(block: Block): Block => {
const blockId = cuid()
const blockId = createId()
if (blockHasItems(block))
return {
...block,
@ -155,7 +155,7 @@ export const duplicateBlockDraft =
...block,
groupId,
id: blockId,
webhookId: cuid(),
webhookId: createId(),
outgoingEdgeId: undefined,
}
return {

View File

@ -10,7 +10,7 @@ import { WritableDraft } from 'immer/dist/types/types-external'
import { SetTypebot } from '../TypebotProvider'
import { produce } from 'immer'
import { byId, isDefined, blockHasItems } from 'utils'
import cuid from 'cuid'
import { createId } from '@paralleldrive/cuid2'
export type EdgesActions = {
createEdge: (edge: Omit<Edge, 'id'>) => void
@ -24,7 +24,7 @@ export const edgesAction = (setTypebot: SetTypebot): EdgesActions => ({
produce(typebot, (typebot) => {
const newEdge = {
...edge,
id: cuid(),
id: createId(),
}
removeExistingEdge(typebot, edge)
typebot.edges.push(newEdge)

View File

@ -1,4 +1,4 @@
import cuid from 'cuid'
import { createId } from '@paralleldrive/cuid2'
import { produce } from 'immer'
import { Group, DraggableBlock, DraggableBlockType, BlockIndices } from 'models'
import { SetTypebot } from '../TypebotProvider'
@ -56,7 +56,7 @@ const groupsActions = (setTypebot: SetTypebot): GroupsActions => ({
setTypebot((typebot) =>
produce(typebot, (typebot) => {
const group = typebot.groups[groupIndex]
const id = cuid()
const id = createId()
const newGroup: Group = {
...group,
title: `${group.title} copy`,

View File

@ -12,7 +12,7 @@ import { SetTypebot } from '../TypebotProvider'
import produce from 'immer'
import { cleanUpEdgeDraft } from './edges'
import { byId, blockHasItems } from 'utils'
import cuid from 'cuid'
import { createId } from '@paralleldrive/cuid2'
import { WritableDraft } from 'immer/dist/types/types-external'
type NewItem = Pick<Item, 'blockId' | 'outgoingEdgeId' | 'type'> & Partial<Item>
@ -34,7 +34,7 @@ const createItem = (
if (item.type === ItemType.CONDITION) {
const newItem = {
...item,
id: 'id' in item && item.id ? item.id : cuid(),
id: 'id' in item && item.id ? item.id : createId(),
content: item.content ?? defaultConditionContent,
}
block.items.splice(itemIndex, 0, newItem)
@ -46,7 +46,7 @@ const createItem = (
if (item.type === ItemType.BUTTON) {
const newItem = {
...item,
id: 'id' in item && item.id ? item.id : cuid(),
id: 'id' in item && item.id ? item.id : createId(),
content: item.content,
}
block.items.splice(itemIndex, 0, newItem)
@ -122,7 +122,7 @@ const itemsAction = (setTypebot: SetTypebot): ItemsActions => ({
const duplicateItemDraft = (blockId: string) => (item: Item) => ({
...item,
id: cuid(),
id: createId(),
blockId,
outgoingEdgeId: undefined,
})

View File

@ -12,7 +12,7 @@ import { useTypebot } from '@/features/editor'
import { DraggableBlockType, PublicTypebot, Typebot } from 'models'
import { useDebounce } from 'use-debounce'
import GraphElements from './GraphElements'
import cuid from 'cuid'
import { createId } from '@paralleldrive/cuid2'
import { useUser } from '@/features/account'
import { ZoomButtons } from './ZoomButtons'
import { AnswersCount } from '@/features/analytics'
@ -96,7 +96,7 @@ export const Graph = ({
{ x: e.clientX, y: e.clientY },
graphPosition
)
const id = cuid()
const id = createId()
updateGroupCoordinates(id, coordinates)
createGroup({
id,

View File

@ -48,7 +48,7 @@ import {
} from './providers'
import { roundCorners } from 'svg-round-corners'
import { AnchorsPositionProps } from './components/Edges/Edge'
import cuid from 'cuid'
import { createId } from '@paralleldrive/cuid2'
import {
isBubbleBlockType,
blockTypeHasOption,
@ -359,7 +359,7 @@ export const parseNewBlock = (
type: DraggableBlockType,
groupId: string
): DraggableBlock => {
const id = cuid()
const id = createId()
return {
id,
groupId,
@ -368,7 +368,7 @@ export const parseNewBlock = (
options: blockTypeHasOption(type)
? parseDefaultBlockOptions(type)
: undefined,
webhookId: blockTypeHasWebhook(type) ? cuid() : undefined,
webhookId: blockTypeHasWebhook(type) ? createId() : undefined,
items: blockTypeHasItems(type) ? parseDefaultItems(type, id) : undefined,
} as DraggableBlock
}
@ -379,11 +379,11 @@ const parseDefaultItems = (
): Item[] => {
switch (type) {
case InputBlockType.CHOICE:
return [{ id: cuid(), blockId, type: ItemType.BUTTON }]
return [{ id: createId(), blockId, type: ItemType.BUTTON }]
case LogicBlockType.CONDITION:
return [
{
id: cuid(),
id: createId(),
blockId,
type: ItemType.CONDITION,
content: defaultConditionContent,

View File

@ -1,12 +1,12 @@
import test, { expect } from '@playwright/test'
import cuid from 'cuid'
import { createId } from '@paralleldrive/cuid2'
import { defaultTextInputOptions, InputBlockType } from 'models'
import { createTypebots } from 'utils/playwright/databaseActions'
import { parseDefaultGroupWithBlock } from 'utils/playwright/databaseHelpers'
test('should not be able to submit taken url ID', async ({ page }) => {
const takenTypebotId = cuid()
const typebotId = cuid()
const takenTypebotId = createId()
const typebotId = createId()
await createTypebots([
{
id: takenTypebotId,

View File

@ -1,4 +1,4 @@
import cuid from 'cuid'
import { createId } from '@paralleldrive/cuid2'
import { PublicTypebot, Typebot } from 'models'
import { dequal } from 'dequal'
import { omit } from 'utils'
@ -31,7 +31,7 @@ export const parsePublicTypebotToTypebot = (
export const parseTypebotToPublicTypebot = (
typebot: Typebot
): PublicTypebot => ({
id: cuid(),
id: createId(),
typebotId: typebot.id,
groups: typebot.groups,
edges: typebot.edges,

View File

@ -1,7 +1,7 @@
import { getTestAsset } from '@/test/utils/playwright'
import { deleteButtonInConfirmDialog } from '@/test/utils/selectorUtils'
import test, { expect, Page } from '@playwright/test'
import cuid from 'cuid'
import { createId } from '@paralleldrive/cuid2'
import { readFileSync } from 'fs'
import { parse } from 'papaparse'
import {
@ -9,7 +9,7 @@ import {
injectFakeResults,
} from 'utils/playwright/databaseActions'
const typebotId = cuid()
const typebotId = createId()
test.beforeEach(async () => {
await importTypebotInDatabase(

View File

@ -1,6 +1,6 @@
import { getTestAsset } from '@/test/utils/playwright'
import test, { expect } from '@playwright/test'
import cuid from 'cuid'
import { createId } from '@paralleldrive/cuid2'
import { defaultTextInputOptions } from 'models'
import { importTypebotInDatabase } from 'utils/playwright/databaseActions'
import { freeWorkspaceId } from 'utils/playwright/databaseSetup'
@ -9,7 +9,7 @@ import { typebotViewer } from 'utils/playwright/testHelpers'
test.describe.parallel('Settings page', () => {
test.describe('General', () => {
test('should reflect change in real-time', async ({ page }) => {
const typebotId = cuid()
const typebotId = createId()
await importTypebotInDatabase(getTestAsset('typebots/settings.json'), {
id: typebotId,
})
@ -47,7 +47,7 @@ test.describe.parallel('Settings page', () => {
test.describe('Typing emulation', () => {
test('should be fillable', async ({ page }) => {
const typebotId = cuid()
const typebotId = createId()
await importTypebotInDatabase(getTestAsset('typebots/settings.json'), {
id: typebotId,
})
@ -68,7 +68,7 @@ test.describe.parallel('Settings page', () => {
test('should be fillable', async ({ page }) => {
const favIconUrl = 'https://www.baptistearno.com/favicon.png'
const imageUrl = 'https://www.baptistearno.com/images/site-preview.png'
const typebotId = cuid()
const typebotId = createId()
await importTypebotInDatabase(getTestAsset('typebots/settings.json'), {
id: typebotId,
})
@ -114,7 +114,7 @@ test.describe.parallel('Settings page', () => {
test.describe('Free workspace', () => {
test("can't remove branding", async ({ page }) => {
const typebotId = cuid()
const typebotId = createId()
await importTypebotInDatabase(getTestAsset('typebots/settings.json'), {
id: typebotId,
workspaceId: freeWorkspaceId,

View File

@ -1,6 +1,6 @@
import { getTestAsset } from '@/test/utils/playwright'
import test, { expect } from '@playwright/test'
import cuid from 'cuid'
import { createId } from '@paralleldrive/cuid2'
import { importTypebotInDatabase } from 'utils/playwright/databaseActions'
import { typebotViewer } from 'utils/playwright/testHelpers'
@ -12,7 +12,7 @@ const guestAvatarUrl =
test.describe.parallel('Theme page', () => {
test.describe('General', () => {
test('should reflect change in real-time', async ({ page }) => {
const typebotId = cuid()
const typebotId = createId()
const chatContainer = typebotViewer(page).locator(
'[data-testid="container"]'
)
@ -165,7 +165,7 @@ test.describe.parallel('Theme page', () => {
test.describe('Custom CSS', () => {
test('should reflect change in real-time', async ({ page }) => {
const typebotId = cuid()
const typebotId = createId()
await importTypebotInDatabase(getTestAsset('typebots/theme.json'), {
id: typebotId,
})

View File

@ -1,5 +1,5 @@
import test, { expect } from '@playwright/test'
import cuid from 'cuid'
import { createId } from '@paralleldrive/cuid2'
import { defaultTextInputOptions, InputBlockType } from 'models'
import { createTypebots } from 'utils/playwright/databaseActions'
import {
@ -9,8 +9,8 @@ import {
import { parseDefaultGroupWithBlock } from 'utils/playwright/databaseHelpers'
import { mockSessionResponsesToOtherUser } from 'utils/playwright/testHelpers'
const proTypebotId = cuid()
const starterTypebotId = cuid()
const proTypebotId = createId()
const starterTypebotId = createId()
test.beforeAll(async () => {
await createTypebots([

View File

@ -1,7 +1,7 @@
// Forked from https://github.com/nextauthjs/adapters/blob/main/packages/prisma/src/index.ts
import { PrismaClient, Prisma, WorkspaceRole, Session } from 'db'
import type { Adapter, AdapterUser } from 'next-auth/adapters'
import cuid from 'cuid'
import { createId } from '@paralleldrive/cuid2'
import { got } from 'got'
import { generateId } from 'utils'
import { parseWorkspaceDefaultPlan } from '@/features/workspace'
@ -14,7 +14,7 @@ import {
export function CustomAdapter(p: PrismaClient): Adapter {
return {
createUser: async (data: Omit<AdapterUser, 'id'>) => {
const user = { id: cuid(), email: data.email as string }
const user = { id: createId(), email: data.email as string }
const { invitations, workspaceInvitations } = await getNewUserInvitations(
p,
user.email

View File

@ -20,7 +20,7 @@
"aws-sdk": "2.1304.0",
"bot-engine": "workspace:*",
"cors": "2.8.5",
"cuid": "3.0.0",
"@paralleldrive/cuid2": "2.0.1",
"db": "workspace:*",
"google-spreadsheet": "3.3.0",
"got": "12.5.3",

View File

@ -1,5 +1,5 @@
import test, { expect } from '@playwright/test'
import cuid from 'cuid'
import { createId } from '@paralleldrive/cuid2'
import { parse } from 'papaparse'
import { readFileSync } from 'fs'
import { isDefined } from 'utils'
@ -15,7 +15,7 @@ import { Plan } from 'db'
const THREE_GIGABYTES = 3 * 1024 * 1024 * 1024
test('should work as expected', async ({ page, browser }) => {
const typebotId = cuid()
const typebotId = createId()
await importTypebotInDatabase(getTestAsset('typebots/fileUpload.json'), {
id: typebotId,
publicId: `${typebotId}-public`,
@ -79,8 +79,8 @@ test('should work as expected', async ({ page, browser }) => {
})
test.describe('Storage limit is reached', () => {
const typebotId = cuid()
const workspaceId = cuid()
const typebotId = createId()
const workspaceId = createId()
test.beforeAll(async () => {
await createWorkspaces([{ id: workspaceId, plan: Plan.STARTER }])

View File

@ -1,5 +1,5 @@
import test, { expect } from '@playwright/test'
import cuid from 'cuid'
import { createId } from '@paralleldrive/cuid2'
import { parse } from 'papaparse'
import { readFileSync } from 'fs'
import { isDefined } from 'utils'
@ -14,7 +14,7 @@ import { Plan } from 'db'
const THREE_GIGABYTES = 3 * 1024 * 1024 * 1024
test('should work as expected', async ({ page, browser }) => {
const typebotId = cuid()
const typebotId = createId()
await importTypebotInDatabase(getTestAsset('typebots/fileUpload.json'), {
id: typebotId,
publicId: `${typebotId}-public`,
@ -76,8 +76,8 @@ test('should work as expected', async ({ page, browser }) => {
})
test.describe('Storage limit is reached', () => {
const typebotId = cuid()
const workspaceId = cuid()
const typebotId = createId()
const workspaceId = createId()
test.beforeAll(async () => {
await createWorkspaces([{ id: workspaceId, plan: Plan.STARTER }])

View File

@ -1,11 +1,11 @@
import test, { expect } from '@playwright/test'
import cuid from 'cuid'
import { createId } from '@paralleldrive/cuid2'
import { createTypebots } from 'utils/playwright/databaseActions'
import { parseDefaultGroupWithBlock } from 'utils/playwright/databaseHelpers'
import { defaultChatwootOptions, IntegrationBlockType } from 'models'
import { typebotViewer } from 'utils/playwright/testHelpers'
const typebotId = cuid()
const typebotId = createId()
const chatwootTestWebsiteToken = 'tueXiiqEmrWUCZ4NUyoR7nhE'

View File

@ -1,10 +1,10 @@
import test, { expect } from '@playwright/test'
import cuid from 'cuid'
import { createId } from '@paralleldrive/cuid2'
import { createTypebots } from 'utils/playwright/databaseActions'
import { parseDefaultGroupWithBlock } from 'utils/playwright/databaseHelpers'
import { defaultChatwootOptions, IntegrationBlockType } from 'models'
const typebotId = cuid()
const typebotId = createId()
const chatwootTestWebsiteToken = 'tueXiiqEmrWUCZ4NUyoR7nhE'

View File

@ -1,6 +1,6 @@
import test, { expect } from '@playwright/test'
import { createSmtpCredentials } from '../../../../test/utils/databaseActions'
import cuid from 'cuid'
import { createId } from '@paralleldrive/cuid2'
import { SmtpCredentialsData } from 'models'
import { importTypebotInDatabase } from 'utils/playwright/databaseActions'
import { typebotViewer } from 'utils/playwright/testHelpers'
@ -27,7 +27,7 @@ test.beforeAll(async () => {
})
test('should send an email', async ({ page }) => {
const typebotId = cuid()
const typebotId = createId()
await importTypebotInDatabase(getTestAsset('typebots/sendEmail.json'), {
id: typebotId,
publicId: `${typebotId}-public`,

View File

@ -1,6 +1,6 @@
import test, { expect } from '@playwright/test'
import { createSmtpCredentials } from '../../../../test/utils/databaseActions'
import cuid from 'cuid'
import { createId } from '@paralleldrive/cuid2'
import { SmtpCredentialsData } from 'models'
import { importTypebotInDatabase } from 'utils/playwright/databaseActions'
import { getTestAsset } from '@/test/utils/playwright'
@ -26,7 +26,7 @@ test.beforeAll(async () => {
})
test('should send an email', async ({ page }) => {
const typebotId = cuid()
const typebotId = createId()
await importTypebotInDatabase(getTestAsset('typebots/sendEmail.json'), {
id: typebotId,
publicId: `${typebotId}-public`,

View File

@ -1,5 +1,5 @@
import test, { expect } from '@playwright/test'
import cuid from 'cuid'
import { createId } from '@paralleldrive/cuid2'
import { HttpMethod, Typebot } from 'models'
import {
createWebhook,
@ -12,7 +12,7 @@ import { apiToken } from 'utils/playwright/databaseSetup'
import { getTestAsset } from '@/test/utils/playwright'
test.describe('Bot', () => {
const typebotId = cuid()
const typebotId = createId()
test.beforeEach(async () => {
await importTypebotInDatabase(getTestAsset('typebots/webhook.json'), {

View File

@ -1,5 +1,5 @@
import test, { expect } from '@playwright/test'
import cuid from 'cuid'
import { createId } from '@paralleldrive/cuid2'
import { HttpMethod } from 'models'
import {
createWebhook,
@ -9,7 +9,7 @@ import {
} from 'utils/playwright/databaseActions'
import { getTestAsset } from '@/test/utils/playwright'
const typebotId = cuid()
const typebotId = createId()
test.beforeEach(async () => {
await importTypebotInDatabase(getTestAsset('typebots/webhook.json'), {

View File

@ -1,6 +1,6 @@
import { getTestAsset } from '@/test/utils/playwright'
import test, { expect } from '@playwright/test'
import cuid from 'cuid'
import { createId } from '@paralleldrive/cuid2'
import prisma from '@/lib/prisma'
import { HttpMethod, SendMessageInput } from 'models'
import {
@ -16,7 +16,7 @@ test.afterEach(async () => {
})
test('API chat execution should work on preview bot', async ({ request }) => {
const typebotId = cuid()
const typebotId = createId()
const publicId = `${typebotId}-public`
await importTypebotInDatabase(getTestAsset('typebots/chat/main.json'), {
id: typebotId,
@ -52,7 +52,7 @@ test('API chat execution should work on preview bot', async ({ request }) => {
})
test('API chat execution should work on published bot', async ({ request }) => {
const typebotId = cuid()
const typebotId = createId()
const publicId = `${typebotId}-public`
await importTypebotInDatabase(getTestAsset('typebots/chat/main.json'), {
id: typebotId,

View File

@ -1,6 +1,6 @@
import { getTestAsset } from '@/test/utils/playwright'
import test, { expect } from '@playwright/test'
import cuid from 'cuid'
import { createId } from '@paralleldrive/cuid2'
import {
importTypebotInDatabase,
injectFakeResults,
@ -9,7 +9,7 @@ import { apiToken } from 'utils/playwright/databaseSetup'
import { typebotViewer } from 'utils/playwright/testHelpers'
test('Big groups should work as expected', async ({ page }) => {
const typebotId = cuid()
const typebotId = createId()
await importTypebotInDatabase(getTestAsset('typebots/hugeGroup.json'), {
id: typebotId,
publicId: `${typebotId}-public`,
@ -32,7 +32,7 @@ test('Big groups should work as expected', async ({ page }) => {
})
test('can list results with API', async ({ request }) => {
const typebotId = cuid()
const typebotId = createId()
await importTypebotInDatabase(getTestAsset('typebots/api.json'), {
id: typebotId,
})

View File

@ -1,10 +1,10 @@
import { getTestAsset } from '@/test/utils/playwright'
import test, { expect } from '@playwright/test'
import cuid from 'cuid'
import { createId } from '@paralleldrive/cuid2'
import { importTypebotInDatabase } from 'utils/playwright/databaseActions'
test('Big groups should work as expected', async ({ page }) => {
const typebotId = cuid()
const typebotId = createId()
await importTypebotInDatabase(getTestAsset('typebots/hugeGroup.json'), {
id: typebotId,
publicId: `${typebotId}-public`,

View File

@ -1,5 +1,5 @@
import test, { expect } from '@playwright/test'
import cuid from 'cuid'
import { createId } from '@paralleldrive/cuid2'
import {
defaultSettings,
defaultTextInputOptions,
@ -11,7 +11,7 @@ import { parseDefaultGroupWithBlock } from 'utils/playwright/databaseHelpers'
import { typebotViewer } from 'utils/playwright/testHelpers'
test('Result should be in storage by default', async ({ page }) => {
const typebotId = cuid()
const typebotId = createId()
await createTypebots([
{
id: typebotId,
@ -37,7 +37,7 @@ test('Result should be in storage by default', async ({ page }) => {
test.describe('Create result on page refresh enabled', () => {
test('should work', async ({ page }) => {
const typebotId = cuid()
const typebotId = createId()
await createTypebots([
{
id: typebotId,
@ -80,7 +80,7 @@ test.describe('Create result on page refresh enabled', () => {
})
test('Hide query params', async ({ page }) => {
const typebotId = cuid()
const typebotId = createId()
await createTypebots([
{
id: typebotId,
@ -108,7 +108,7 @@ test('Hide query params', async ({ page }) => {
})
test('Show close message', async ({ page }) => {
const typebotId = cuid()
const typebotId = createId()
await createTypebots([
{
id: typebotId,
@ -124,7 +124,7 @@ test('Show close message', async ({ page }) => {
})
test('Should correctly parse metadata', async ({ page }) => {
const typebotId = cuid()
const typebotId = createId()
const googleTagManagerId = 'GTM-M72NXKB'
const customMetadata: Metadata = {
description: 'My custom description',

View File

@ -1,5 +1,5 @@
import test, { expect } from '@playwright/test'
import cuid from 'cuid'
import { createId } from '@paralleldrive/cuid2'
import {
defaultSettings,
defaultTextInputOptions,
@ -10,7 +10,7 @@ import { createTypebots, updateTypebot } from 'utils/playwright/databaseActions'
import { parseDefaultGroupWithBlock } from 'utils/playwright/databaseHelpers'
test('Result should be overwritten on page refresh', async ({ page }) => {
const typebotId = cuid()
const typebotId = createId()
await createTypebots([
{
id: typebotId,
@ -39,7 +39,7 @@ test('Result should be overwritten on page refresh', async ({ page }) => {
test.describe('Create result on page refresh enabled', () => {
test('should work', async ({ page }) => {
const typebotId = cuid()
const typebotId = createId()
await createTypebots([
{
id: typebotId,
@ -74,7 +74,7 @@ test.describe('Create result on page refresh enabled', () => {
})
test('Hide query params', async ({ page }) => {
const typebotId = cuid()
const typebotId = createId()
await createTypebots([
{
id: typebotId,
@ -102,7 +102,7 @@ test('Hide query params', async ({ page }) => {
})
test('Show close message', async ({ page }) => {
const typebotId = cuid()
const typebotId = createId()
await createTypebots([
{
id: typebotId,
@ -118,7 +118,7 @@ test('Show close message', async ({ page }) => {
})
test('Should correctly parse metadata', async ({ page }) => {
const typebotId = cuid()
const typebotId = createId()
const customMetadata: Metadata = {
description: 'My custom description',
title: 'Custom title',

View File

@ -1,6 +1,6 @@
import { getTestAsset } from '@/test/utils/playwright'
import test, { expect } from '@playwright/test'
import cuid from 'cuid'
import { createId } from '@paralleldrive/cuid2'
import { Plan } from 'db'
import { defaultSettings } from 'models'
import {
@ -12,8 +12,8 @@ import { typebotViewer } from 'utils/playwright/testHelpers'
test('should not start if chat limit is reached', async ({ page, context }) => {
await test.step('Free plan', async () => {
const workspaceId = cuid()
const typebotId = cuid()
const workspaceId = createId()
const typebotId = createId()
await createWorkspaces([{ id: workspaceId, plan: Plan.FREE }])
await importTypebotInDatabase(getTestAsset('typebots/fileUpload.json'), {
id: typebotId,
@ -28,8 +28,8 @@ test('should not start if chat limit is reached', async ({ page, context }) => {
})
await test.step('Lifetime plan', async () => {
const workspaceId = cuid()
const typebotId = cuid()
const workspaceId = createId()
const typebotId = createId()
await createWorkspaces([{ id: workspaceId, plan: Plan.LIFETIME }])
await importTypebotInDatabase(getTestAsset('typebots/fileUpload.json'), {
id: typebotId,
@ -44,8 +44,8 @@ test('should not start if chat limit is reached', async ({ page, context }) => {
})
await test.step('Custom plan', async () => {
const workspaceId = cuid()
const typebotId = cuid()
const workspaceId = createId()
const typebotId = createId()
await createWorkspaces([
{ id: workspaceId, plan: Plan.CUSTOM, customChatsLimit: 1000 },
])

View File

@ -1,6 +1,6 @@
import { getTestAsset } from '@/test/utils/playwright'
import test, { expect } from '@playwright/test'
import cuid from 'cuid'
import { createId } from '@paralleldrive/cuid2'
import { Plan } from 'db'
import { defaultSettings } from 'models'
import {
@ -11,8 +11,8 @@ import {
test('should not start if chat limit is reached', async ({ page, context }) => {
await test.step('Free plan', async () => {
const workspaceId = cuid()
const typebotId = cuid()
const workspaceId = createId()
const typebotId = createId()
await createWorkspaces([{ id: workspaceId, plan: Plan.FREE }])
await importTypebotInDatabase(getTestAsset('typebots/fileUpload.json'), {
id: typebotId,
@ -27,8 +27,8 @@ test('should not start if chat limit is reached', async ({ page, context }) => {
})
await test.step('Lifetime plan', async () => {
const workspaceId = cuid()
const typebotId = cuid()
const workspaceId = createId()
const typebotId = createId()
await createWorkspaces([{ id: workspaceId, plan: Plan.LIFETIME }])
await importTypebotInDatabase(getTestAsset('typebots/fileUpload.json'), {
id: typebotId,
@ -41,8 +41,8 @@ test('should not start if chat limit is reached', async ({ page, context }) => {
})
await test.step('Custom plan', async () => {
const workspaceId = cuid()
const typebotId = cuid()
const workspaceId = createId()
const typebotId = createId()
await createWorkspaces([
{ id: workspaceId, plan: Plan.CUSTOM, customChatsLimit: 1000 },
])

View File

@ -1,11 +1,11 @@
import { getTestAsset } from '@/test/utils/playwright'
import test, { expect } from '@playwright/test'
import cuid from 'cuid'
import { createId } from '@paralleldrive/cuid2'
import { importTypebotInDatabase } from 'utils/playwright/databaseActions'
import { typebotViewer } from 'utils/playwright/testHelpers'
test('should correctly be injected', async ({ page }) => {
const typebotId = cuid()
const typebotId = createId()
await importTypebotInDatabase(
getTestAsset('typebots/predefinedVariables.json'),
{ id: typebotId, publicId: `${typebotId}-public` }

View File

@ -1,10 +1,10 @@
import { getTestAsset } from '@/test/utils/playwright'
import test, { expect } from '@playwright/test'
import cuid from 'cuid'
import { createId } from '@paralleldrive/cuid2'
import { importTypebotInDatabase } from 'utils/playwright/databaseActions'
test('should correctly be injected', async ({ page }) => {
const typebotId = cuid()
const typebotId = createId()
await importTypebotInDatabase(
getTestAsset('typebots/predefinedVariables.json'),
{ id: typebotId, publicId: `${typebotId}-public` }