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` }

View File

@@ -26,7 +26,7 @@
"cross-env": "7.0.3",
"cz-emoji": "1.3.2-canary.2",
"husky": "^8.0.3",
"turbo": "1.7.0"
"turbo": "1.7.4"
},
"config": {
"commitizen": {

View File

@@ -9,5 +9,5 @@ export default defineConfig((options) => ({
loader: {
'.css': 'text',
},
external: ['cuid'],
external: ['@paralleldrive/cuid2'],
}))

View File

@@ -1,6 +1,6 @@
import { z } from 'zod'
import { ComparisonOperators, LogicalOperator } from '../../logic/condition'
import cuid from 'cuid'
import { createId } from '@paralleldrive/cuid2'
import { IntegrationBlockType } from '../enums'
import { GoogleSheetsAction } from './enums'
import { blockBaseSchema } from '../../baseSchemas'
@@ -76,13 +76,13 @@ export const defaultGoogleSheetsGetOptions: GoogleSheetsGetOptions = {
action: GoogleSheetsAction.GET,
cellsToExtract: [
{
id: cuid(),
id: createId(),
},
],
filter: {
comparisons: [
{
id: cuid(),
id: createId(),
},
],
logicalOperator: LogicalOperator.AND,
@@ -93,7 +93,7 @@ export const defaultGoogleSheetsInsertOptions: GoogleSheetsInsertRowOptions = {
action: GoogleSheetsAction.INSERT_ROW,
cellsToInsert: [
{
id: cuid(),
id: createId(),
},
],
}
@@ -102,7 +102,7 @@ export const defaultGoogleSheetsUpdateOptions: GoogleSheetsUpdateRowOptions = {
action: GoogleSheetsAction.UPDATE_ROW,
cellsToUpsert: [
{
id: cuid(),
id: createId(),
},
],
}

View File

@@ -9,7 +9,7 @@
"zod": "3.20.2"
},
"devDependencies": {
"cuid": "3.0.0",
"@paralleldrive/cuid2": "2.0.1",
"db": "workspace:*",
"next": "13.1.6",
"tsconfig": "workspace:*",

View File

@@ -9,7 +9,7 @@
"@playwright/test": "1.30.0",
"@types/nodemailer": "6.4.7",
"aws-sdk": "2.1304.0",
"cuid": "3.0.0",
"@paralleldrive/cuid2": "2.0.1",
"db": "workspace:*",
"dotenv": "16.0.3",
"models": "workspace:*",

View File

@@ -1,5 +1,5 @@
import { Plan, Prisma, PrismaClient, User, Workspace, WorkspaceRole } from 'db'
import cuid from 'cuid'
import { createId } from '@paralleldrive/cuid2'
import { Typebot, Webhook } from 'models'
import { readFileSync } from 'fs'
import { proWorkspaceId, userId } from './databaseSetup'
@@ -25,7 +25,7 @@ export const injectFakeResults = async ({
isChronological,
fakeStorage,
}: CreateFakeResultsProps) => {
const resultIdPrefix = customResultIdPrefix ?? cuid()
const resultIdPrefix = customResultIdPrefix ?? createId()
await prisma.result.createMany({
data: [
...Array.from(Array(count)).map((_, idx) => {
@@ -115,7 +115,7 @@ export const deleteWebhooks = async (webhookIds: string[]) => {
}
export const createWorkspaces = async (workspaces: Partial<Workspace>[]) => {
const workspaceIds = workspaces.map((workspace) => workspace.id ?? cuid())
const workspaceIds = workspaces.map((workspace) => workspace.id ?? createId())
await prisma.workspace.createMany({
data: workspaces.map((workspace, index) => ({
id: workspaceIds[index],
@@ -166,7 +166,7 @@ export const createWebhook = async (
export const createTypebots = async (partialTypebots: Partial<Typebot>[]) => {
const typebotsWithId = partialTypebots.map((typebot) => {
const typebotId = typebot.id ?? cuid()
const typebotId = typebot.id ?? createId()
return {
...typebot,
id: typebotId,

View File

@@ -1,4 +1,4 @@
import cuid from 'cuid'
import { createId } from '@paralleldrive/cuid2'
import {
Block,
defaultChoiceInputOptions,
@@ -15,7 +15,7 @@ import { proWorkspaceId } from './databaseSetup'
export const parseTestTypebot = (
partialTypebot: Partial<Typebot>
): Typebot => ({
id: cuid(),
id: createId(),
workspaceId: proWorkspaceId,
folderId: null,
name: 'My typebot',

72
pnpm-lock.yaml generated
View File

@@ -7,12 +7,12 @@ importers:
cross-env: 7.0.3
cz-emoji: 1.3.2-canary.2
husky: ^8.0.3
turbo: 1.7.0
turbo: 1.7.4
devDependencies:
cross-env: 7.0.3
cz-emoji: 1.3.2-canary.2
husky: 8.0.3
turbo: 1.7.0
turbo: 1.7.4
apps/builder:
specifiers:
@@ -40,6 +40,7 @@ importers:
'@giphy/react-components': 6.5.2
'@googleapis/drive': 4.0.1
'@lezer/css': ^1.1.1
'@paralleldrive/cuid2': 2.0.1
'@playwright/test': 1.30.0
'@sentry/nextjs': 7.36.0
'@stripe/stripe-js': 1.46.0
@@ -76,7 +77,6 @@ importers:
canvas-confetti: 1.6.0
chakra-react-select: ^4.4.3
codemirror: 6.0.1
cuid: 3.0.0
db: workspace:*
deep-object-diff: 1.1.9
dequal: 2.0.3
@@ -149,6 +149,7 @@ importers:
'@giphy/react-components': 6.5.2_57czaiyk6rdr5iy5tfs5pior4u
'@googleapis/drive': 4.0.1
'@lezer/css': 1.1.1
'@paralleldrive/cuid2': 2.0.1
'@sentry/nextjs': 7.36.0_next@13.1.6+react@18.2.0
'@stripe/stripe-js': 1.46.0
'@tanstack/react-query': 4.24.4_biqbaboplfbrettd7655fr4n2y
@@ -171,7 +172,6 @@ importers:
canvas-confetti: 1.6.0
chakra-react-select: 4.4.3_alpyulvd3cwjobv54jo7ctrw7u
codemirror: 6.0.1_@lezer+common@1.0.2
cuid: 3.0.0
deep-object-diff: 1.1.9
dequal: 2.0.3
emails: link:../../packages/emails
@@ -353,6 +353,7 @@ importers:
specifiers:
'@babel/preset-env': 7.20.2
'@faire/mjml-react': 3.1.0
'@paralleldrive/cuid2': 2.0.1
'@playwright/test': 1.30.0
'@sentry/nextjs': 7.36.0
'@trpc/server': 10.9.0
@@ -369,7 +370,6 @@ importers:
aws-sdk: 2.1304.0
bot-engine: workspace:*
cors: 2.8.5
cuid: 3.0.0
db: workspace:*
dotenv: 16.0.3
emails: workspace:*
@@ -397,6 +397,7 @@ importers:
utils: workspace:*
zod: 3.20.2
dependencies:
'@paralleldrive/cuid2': 2.0.1
'@sentry/nextjs': 7.36.0_next@13.1.6+react@18.2.0
'@trpc/server': 10.9.0
'@typebot.io/js': link:../../packages/js
@@ -404,7 +405,6 @@ importers:
aws-sdk: 2.1304.0
bot-engine: link:../../packages/bot-engine
cors: 2.8.5
cuid: 3.0.0
db: link:../../packages/db
google-spreadsheet: 3.3.0
got: 12.5.3
@@ -630,7 +630,7 @@ importers:
packages/models:
specifiers:
cuid: 3.0.0
'@paralleldrive/cuid2': 2.0.1
db: workspace:*
next: 13.1.6
tsconfig: workspace:*
@@ -639,7 +639,7 @@ importers:
dependencies:
zod: 3.20.2
devDependencies:
cuid: 3.0.0
'@paralleldrive/cuid2': 2.0.1
db: link:../db
next: 13.1.6_biqbaboplfbrettd7655fr4n2y
tsconfig: link:../tsconfig
@@ -751,10 +751,10 @@ importers:
packages/utils:
specifiers:
'@paralleldrive/cuid2': 2.0.1
'@playwright/test': 1.30.0
'@types/nodemailer': 6.4.7
aws-sdk: 2.1304.0
cuid: 3.0.0
db: workspace:*
dotenv: 16.0.3
models: workspace:*
@@ -763,10 +763,10 @@ importers:
tsconfig: workspace:*
typescript: 4.9.4
devDependencies:
'@paralleldrive/cuid2': 2.0.1
'@playwright/test': 1.30.0
'@types/nodemailer': 6.4.7
aws-sdk: 2.1304.0
cuid: 3.0.0
db: link:../db
dotenv: 16.0.3
models: link:../models
@@ -6034,6 +6034,9 @@ packages:
requiresBuild: true
optional: true
/@noble/hashes/1.2.0:
resolution: {integrity: sha512-FZfhjEDbT5GRswV3C6uvLPHMiVD6lQBmpoX5+eSiPaMTXte/IKqI5dykDxzZB/WBeK/CDuQRBWarPdi3FNY2zQ==}
/@nodelib/fs.scandir/2.1.5:
resolution: {integrity: sha512-vq24Bq3ym5HEQm2NKCr3yXDwjc7vTsEThRDnkp2DK9p1uqLR+DHurm/NOTo0KG7HYHU7eppKZj3MyqYuMBf62g==}
engines: {node: '>= 8'}
@@ -6056,6 +6059,11 @@ packages:
resolution: {integrity: sha512-MSAs9t3Go7GUkMhpKC44T58DJ5KGk2vBo+h1cqQeqlMfdGkxaVB78ZWpv9gYi/g2fa4sopag9gJsNvS8XGgWJA==}
dev: false
/@paralleldrive/cuid2/2.0.1:
resolution: {integrity: sha512-fi9nN5kCPGv9pcKQjk9g3riSTVcwR5TCFAGPUStbR61b1nXZ07GvxeoyStELKsJDCji1lwuUiUwLtagNTBllQA==}
dependencies:
'@noble/hashes': 1.2.0
/@pkgr/utils/2.3.1:
resolution: {integrity: sha512-wfzX8kc1PMyUILA+1Z/EqoE4UCXGy0iRGMhPwdfae1+f0OXlLqCk+By+aMzgJBzR9AzS4CDizioG6Ss1gvAFJw==}
engines: {node: ^12.20.0 || ^14.18.0 || >=16.0.0}
@@ -10129,10 +10137,6 @@ packages:
/csstype/3.1.1:
resolution: {integrity: sha512-DJR/VvkAvSZW9bTouZue2sSxDwdTN92uHjqeKVm+0dAqdfNykRzQ95tay8aXMBAAPpUiq4Qcug2L7neoRh2Egw==}
/cuid/3.0.0:
resolution: {integrity: sha512-WZYYkHdIDnaxdeP8Misq3Lah5vFjJwGuItJuV+tvMafosMzw0nF297T7mrm8IOWiPJkV6gc7sa8pzx27+w25Zg==}
deprecated: Cuid and other k-sortable and non-cryptographic ids (Ulid, ObjectId, KSUID, all UUIDs) are all insecure. Use @paralleldrive/cuid2 instead.
/cz-emoji/1.3.2-canary.2:
resolution: {integrity: sha512-XVH9N3P5sepyCRZGVqXJcEkVHT9dPcgBipTmZgkeQUhOJEtaGy0hakMcNdaq1d7N0ZwWVEnsCIs2m/NgLT+SaA==}
engines: {node: '>=4'}
@@ -19448,65 +19452,65 @@ packages:
fsevents: 2.3.2
dev: true
/turbo-darwin-64/1.7.0:
resolution: {integrity: sha512-hSGAueSf5Ko8J67mpqjpt9FsP6ePn1nMcl7IVPoJq5dHsgX3anCP/BPlexJ502bNK+87DDyhQhJ/LPSJXKrSYQ==}
/turbo-darwin-64/1.7.4:
resolution: {integrity: sha512-ZyYrQlUl8K/mYN1e6R7bEhPPYjMakz0DYMaexkyD7TAijQtWmTSd4a+I7VknOYNEssnUZ/v41GU3gPV1JAzxxQ==}
cpu: [x64]
os: [darwin]
requiresBuild: true
dev: true
optional: true
/turbo-darwin-arm64/1.7.0:
resolution: {integrity: sha512-BLLOW5W6VZxk5+0ZOj5AO1qjM0P5isIgjbEuyAl8lHZ4s9antUbY4CtFrspT32XxPTYoDl4UjviPMcSsbcl3WQ==}
/turbo-darwin-arm64/1.7.4:
resolution: {integrity: sha512-CKIXg9uqp1a+Yeq/c4U0alPOqvwLUq5SBZf1PGYhGqJsfG0fRBtJfkUjHuBsuJIOGXg8rCmcGSWGIsIF6fqYuw==}
cpu: [arm64]
os: [darwin]
requiresBuild: true
dev: true
optional: true
/turbo-linux-64/1.7.0:
resolution: {integrity: sha512-aw2qxmfZa+kT87SB3GNUoFimqEPzTlzlRqhPgHuAAT6Uf0JHnmebPt4K+ZPtDNl5yfVmtB05bhHPqw+5QV97Yg==}
/turbo-linux-64/1.7.4:
resolution: {integrity: sha512-RIUl4RUFFyzD2T024vL7509Ygwcw+SEa8NOwPfaN6TtJHK7RZV/SBP3fLNVOptG9WRLnOWX3OvsLMbiOqDLLyA==}
cpu: [x64]
os: [linux]
requiresBuild: true
dev: true
optional: true
/turbo-linux-arm64/1.7.0:
resolution: {integrity: sha512-AJEx2jX+zO5fQtJpO3r6uhTabj4oSA5ZhB7zTs/rwu/XqoydsvStA4X8NDW4poTbOjF7DcSHizqwi04tSMzpJw==}
/turbo-linux-arm64/1.7.4:
resolution: {integrity: sha512-Bg65F0AjYYYxqE6RPf2H5TIGuA/EyWMeGOATHVSZOWAbYcnG3Ly03GZii8AHnUi7ntWBdjwvXf/QbOS1ayNB6A==}
cpu: [arm64]
os: [linux]
requiresBuild: true
dev: true
optional: true
/turbo-windows-64/1.7.0:
resolution: {integrity: sha512-ewj7PPv2uxqv0r31hgnBa3E5qwUu7eyVRP5M1gB/TJXfSHduU79gbxpKCyxIZv2fL/N2/3U7EPOQPSZxBAoljA==}
/turbo-windows-64/1.7.4:
resolution: {integrity: sha512-rTaV50XZ2BRxRHOHqt1UsWfeDmYLbn8UKE6g2D2ED+uW+kmnTvR9s01nmlGWd2sAuWcRYQyQ2V+O09VfKPKcQw==}
cpu: [x64]
os: [win32]
requiresBuild: true
dev: true
optional: true
/turbo-windows-arm64/1.7.0:
resolution: {integrity: sha512-LzjOUzveWkvTD0jP8DBMYiAnYemmydsvqxdSmsUapHHJkl6wKZIOQNSO7pxsy+9XM/1/+0f9Y9F9ZNl5lePTEA==}
/turbo-windows-arm64/1.7.4:
resolution: {integrity: sha512-h8sxdKPvHTnWUPtwnYszFMmSO0P/iUUwmYY9n7iYThA71zSao28UeZ0H0Gw75cY3MPjvkjn2C4EBAUGPjuZJLw==}
cpu: [arm64]
os: [win32]
requiresBuild: true
dev: true
optional: true
/turbo/1.7.0:
resolution: {integrity: sha512-cwympNwQNnQZ/TffBd8yT0i0O10Cf/hlxccCYgUcwhcGEb9rDjE5thDbHoHw1hlJQUF/5ua7ERJe7Zr0lNE/ww==}
/turbo/1.7.4:
resolution: {integrity: sha512-8RLedDoUL0kkVKWEZ/RMM70BvKLyDFen06QuKKhYC2XNOfNKqFDqzIdcY/vGick869bNIWalChoy4O07k0HLsA==}
hasBin: true
requiresBuild: true
optionalDependencies:
turbo-darwin-64: 1.7.0
turbo-darwin-arm64: 1.7.0
turbo-linux-64: 1.7.0
turbo-linux-arm64: 1.7.0
turbo-windows-64: 1.7.0
turbo-windows-arm64: 1.7.0
turbo-darwin-64: 1.7.4
turbo-darwin-arm64: 1.7.4
turbo-linux-64: 1.7.4
turbo-linux-arm64: 1.7.4
turbo-windows-64: 1.7.4
turbo-windows-arm64: 1.7.4
dev: true
/type-check/0.3.2: