refactor: ♻️ Migrate from short-uuid to cuid lib
This commit is contained in:
@@ -1,4 +1,4 @@
|
|||||||
DATABASE_URL=postgresql://postgres:@localhost:5432/typebot
|
DATABASE_URL=postgresql://postgres:typebot@localhost:5432/typebot
|
||||||
ENCRYPTION_SECRET=SgVkYp2s5v8y/B?E(H+MbQeThWmZq4t6 #256-bits secret (can be generated here: https://www.allkeysgenerator.com/Random/Security-Encryption-Key-Generator.aspx)
|
ENCRYPTION_SECRET=SgVkYp2s5v8y/B?E(H+MbQeThWmZq4t6 #256-bits secret (can be generated here: https://www.allkeysgenerator.com/Random/Security-Encryption-Key-Generator.aspx)
|
||||||
NEXTAUTH_URL=http://localhost:3000
|
NEXTAUTH_URL=http://localhost:3000
|
||||||
NEXT_PUBLIC_VIEWER_URL=http://localhost:3001
|
NEXT_PUBLIC_VIEWER_URL=http://localhost:3001
|
||||||
@@ -10,5 +10,8 @@ S3_PORT=9000
|
|||||||
S3_ENDPOINT=localhost
|
S3_ENDPOINT=localhost
|
||||||
S3_SSL=false
|
S3_SSL=false
|
||||||
|
|
||||||
|
# Used for Google Fonts dropdown
|
||||||
|
NEXT_PUBLIC_GOOGLE_API_KEY=AIzaSyAWuhjY55xbR-J9Yb1nkAQ13r6A7GDCx2k
|
||||||
|
|
||||||
# For more configuration options check out:
|
# For more configuration options check out:
|
||||||
https://docs.typebot.io/self-hosting/configuration
|
https://docs.typebot.io/self-hosting/configuration
|
||||||
@@ -9,11 +9,11 @@ import { useStepDnd } from 'contexts/GraphDndContext'
|
|||||||
import { useTypebot } from 'contexts/TypebotContext/TypebotContext'
|
import { useTypebot } from 'contexts/TypebotContext/TypebotContext'
|
||||||
import { headerHeight } from 'components/shared/TypebotHeader/TypebotHeader'
|
import { headerHeight } from 'components/shared/TypebotHeader/TypebotHeader'
|
||||||
import { DraggableStepType, PublicTypebot, Typebot } from 'models'
|
import { DraggableStepType, PublicTypebot, Typebot } from 'models'
|
||||||
import { generate } from 'short-uuid'
|
|
||||||
import { AnswersCount } from 'services/analytics'
|
import { AnswersCount } from 'services/analytics'
|
||||||
import { useDebounce } from 'use-debounce'
|
import { useDebounce } from 'use-debounce'
|
||||||
import { DraggableCore, DraggableData, DraggableEvent } from 'react-draggable'
|
import { DraggableCore, DraggableData, DraggableEvent } from 'react-draggable'
|
||||||
import GraphContent from './GraphContent'
|
import GraphContent from './GraphContent'
|
||||||
|
import cuid from 'cuid'
|
||||||
|
|
||||||
declare const window: { chrome: unknown | undefined }
|
declare const window: { chrome: unknown | undefined }
|
||||||
|
|
||||||
@@ -81,7 +81,7 @@ export const Graph = ({
|
|||||||
x: e.clientX - graphPosition.x - blockWidth / 3,
|
x: e.clientX - graphPosition.x - blockWidth / 3,
|
||||||
y: e.clientY - graphPosition.y - 20 - headerHeight,
|
y: e.clientY - graphPosition.y - 20 - headerHeight,
|
||||||
}
|
}
|
||||||
const id = generate()
|
const id = cuid()
|
||||||
updateBlockCoordinates(id, coordinates)
|
updateBlockCoordinates(id, coordinates)
|
||||||
createBlock({
|
createBlock({
|
||||||
id,
|
id,
|
||||||
|
|||||||
@@ -1,9 +1,9 @@
|
|||||||
import { Box, Button, Fade, Flex, IconButton, Stack } from '@chakra-ui/react'
|
import { Box, Button, Fade, Flex, IconButton, Stack } from '@chakra-ui/react'
|
||||||
import { TrashIcon, PlusIcon } from 'assets/icons'
|
import { TrashIcon, PlusIcon } from 'assets/icons'
|
||||||
|
import cuid from 'cuid'
|
||||||
import { dequal } from 'dequal'
|
import { dequal } from 'dequal'
|
||||||
import { Draft } from 'immer'
|
import { Draft } from 'immer'
|
||||||
import React, { useEffect, useState } from 'react'
|
import React, { useEffect, useState } from 'react'
|
||||||
import { generate } from 'short-uuid'
|
|
||||||
import { useImmer } from 'use-immer'
|
import { useImmer } from 'use-immer'
|
||||||
|
|
||||||
type ItemWithId<T> = T & { id: string }
|
type ItemWithId<T> = T & { id: string }
|
||||||
@@ -42,7 +42,7 @@ export const TableList = <T,>({
|
|||||||
|
|
||||||
const createItem = () => {
|
const createItem = () => {
|
||||||
setItems((items) => {
|
setItems((items) => {
|
||||||
const id = generate()
|
const id = cuid()
|
||||||
const newItem = { id } as Draft<ItemWithId<T>>
|
const newItem = { id } as Draft<ItemWithId<T>>
|
||||||
items.push(newItem)
|
items.push(newItem)
|
||||||
})
|
})
|
||||||
|
|||||||
@@ -12,9 +12,9 @@ import {
|
|||||||
} from '@chakra-ui/react'
|
} from '@chakra-ui/react'
|
||||||
import { PlusIcon, TrashIcon } from 'assets/icons'
|
import { PlusIcon, TrashIcon } from 'assets/icons'
|
||||||
import { useTypebot } from 'contexts/TypebotContext'
|
import { useTypebot } from 'contexts/TypebotContext'
|
||||||
|
import cuid from 'cuid'
|
||||||
import { Variable } from 'models'
|
import { Variable } from 'models'
|
||||||
import React, { useState, useRef, ChangeEvent, useEffect } from 'react'
|
import React, { useState, useRef, ChangeEvent, useEffect } from 'react'
|
||||||
import { generate } from 'short-uuid'
|
|
||||||
import { useDebounce } from 'use-debounce'
|
import { useDebounce } from 'use-debounce'
|
||||||
import { byId, isNotDefined } from 'utils'
|
import { byId, isNotDefined } from 'utils'
|
||||||
|
|
||||||
@@ -89,7 +89,7 @@ export const VariableSearchInput = ({
|
|||||||
|
|
||||||
const handleCreateNewVariableClick = () => {
|
const handleCreateNewVariableClick = () => {
|
||||||
if (!inputValue || inputValue === '') return
|
if (!inputValue || inputValue === '') return
|
||||||
const id = generate()
|
const id = cuid()
|
||||||
onSelectVariable({ id, name: inputValue })
|
onSelectVariable({ id, name: inputValue })
|
||||||
createVariable({ id, name: inputValue })
|
createVariable({ id, name: inputValue })
|
||||||
onClose()
|
onClose()
|
||||||
|
|||||||
@@ -39,11 +39,11 @@ import { useRegisterActions } from 'kbar'
|
|||||||
import useUndo from 'services/utils/useUndo'
|
import useUndo from 'services/utils/useUndo'
|
||||||
import { useDebounce } from 'use-debounce'
|
import { useDebounce } from 'use-debounce'
|
||||||
import { itemsAction, ItemsActions } from './actions/items'
|
import { itemsAction, ItemsActions } from './actions/items'
|
||||||
import { generate } from 'short-uuid'
|
|
||||||
import { dequal } from 'dequal'
|
import { dequal } from 'dequal'
|
||||||
import { User } from 'db'
|
import { User } from 'db'
|
||||||
import { saveWebhook } from 'services/webhook'
|
import { saveWebhook } from 'services/webhook'
|
||||||
import { stringify } from 'qs'
|
import { stringify } from 'qs'
|
||||||
|
import cuid from 'cuid'
|
||||||
const autoSaveTimeout = 10000
|
const autoSaveTimeout = 10000
|
||||||
|
|
||||||
type UpdateTypebotPayload = Partial<{
|
type UpdateTypebotPayload = Partial<{
|
||||||
@@ -291,7 +291,7 @@ export const TypebotContext = ({
|
|||||||
|
|
||||||
const publishTypebot = async () => {
|
const publishTypebot = async () => {
|
||||||
if (!localTypebot) return
|
if (!localTypebot) return
|
||||||
const publishedTypebotId = generate()
|
const publishedTypebotId = cuid()
|
||||||
const newLocalTypebot = { ...localTypebot }
|
const newLocalTypebot = { ...localTypebot }
|
||||||
if (publishedTypebot && isNotDefined(localTypebot.publishedTypebotId)) {
|
if (publishedTypebot && isNotDefined(localTypebot.publishedTypebotId)) {
|
||||||
updateLocalTypebot({ publishedTypebotId: publishedTypebot.id })
|
updateLocalTypebot({ publishedTypebotId: publishedTypebot.id })
|
||||||
|
|||||||
@@ -1,9 +1,9 @@
|
|||||||
import { Typebot, Edge, StepWithItems, StepIndices, ItemIndices } from 'models'
|
import { Typebot, Edge, StepWithItems, StepIndices, ItemIndices } from 'models'
|
||||||
import { WritableDraft } from 'immer/dist/types/types-external'
|
import { WritableDraft } from 'immer/dist/types/types-external'
|
||||||
import { generate } from 'short-uuid'
|
|
||||||
import { SetTypebot } from '../TypebotContext'
|
import { SetTypebot } from '../TypebotContext'
|
||||||
import { produce } from 'immer'
|
import { produce } from 'immer'
|
||||||
import { byId, isDefined, stepHasItems } from 'utils'
|
import { byId, isDefined, stepHasItems } from 'utils'
|
||||||
|
import cuid from 'cuid'
|
||||||
|
|
||||||
export type EdgesActions = {
|
export type EdgesActions = {
|
||||||
createEdge: (edge: Omit<Edge, 'id'>) => void
|
createEdge: (edge: Omit<Edge, 'id'>) => void
|
||||||
@@ -17,7 +17,7 @@ export const edgesAction = (setTypebot: SetTypebot): EdgesActions => ({
|
|||||||
produce(typebot, (typebot) => {
|
produce(typebot, (typebot) => {
|
||||||
const newEdge = {
|
const newEdge = {
|
||||||
...edge,
|
...edge,
|
||||||
id: generate(),
|
id: cuid(),
|
||||||
}
|
}
|
||||||
removeExistingEdge(typebot, edge)
|
removeExistingEdge(typebot, edge)
|
||||||
typebot.edges.push(newEdge)
|
typebot.edges.push(newEdge)
|
||||||
@@ -73,11 +73,10 @@ const addEdgeIdToItem = (
|
|||||||
typebot: WritableDraft<Typebot>,
|
typebot: WritableDraft<Typebot>,
|
||||||
edgeId: string,
|
edgeId: string,
|
||||||
{ blockIndex, stepIndex, itemIndex }: ItemIndices
|
{ blockIndex, stepIndex, itemIndex }: ItemIndices
|
||||||
) => {
|
) =>
|
||||||
;(typebot.blocks[blockIndex].steps[stepIndex] as StepWithItems).items[
|
((typebot.blocks[blockIndex].steps[stepIndex] as StepWithItems).items[
|
||||||
itemIndex
|
itemIndex
|
||||||
].outgoingEdgeId = edgeId
|
].outgoingEdgeId = edgeId)
|
||||||
}
|
|
||||||
|
|
||||||
export const deleteEdgeDraft = (
|
export const deleteEdgeDraft = (
|
||||||
typebot: WritableDraft<Typebot>,
|
typebot: WritableDraft<Typebot>,
|
||||||
@@ -107,11 +106,10 @@ const deleteOutgoingEdgeIdProps = (
|
|||||||
if (fromStepIndex !== -1)
|
if (fromStepIndex !== -1)
|
||||||
typebot.blocks[fromBlockIndex].steps[fromStepIndex].outgoingEdgeId =
|
typebot.blocks[fromBlockIndex].steps[fromStepIndex].outgoingEdgeId =
|
||||||
undefined
|
undefined
|
||||||
if (fromItemIndex !== -1) {
|
if (fromItemIndex !== -1)
|
||||||
;(
|
(
|
||||||
typebot.blocks[fromBlockIndex].steps[fromStepIndex] as StepWithItems
|
typebot.blocks[fromBlockIndex].steps[fromStepIndex] as StepWithItems
|
||||||
).items[fromItemIndex].outgoingEdgeId = undefined
|
).items[fromItemIndex].outgoingEdgeId = undefined
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export const cleanUpEdgeDraft = (
|
export const cleanUpEdgeDraft = (
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ import { SetTypebot } from '../TypebotContext'
|
|||||||
import produce from 'immer'
|
import produce from 'immer'
|
||||||
import { cleanUpEdgeDraft } from './edges'
|
import { cleanUpEdgeDraft } from './edges'
|
||||||
import { stepHasItems } from 'utils'
|
import { stepHasItems } from 'utils'
|
||||||
import { generate } from 'short-uuid'
|
import cuid from 'cuid'
|
||||||
|
|
||||||
export type ItemsActions = {
|
export type ItemsActions = {
|
||||||
createItem: (item: Omit<ButtonItem, 'id'>, indices: ItemIndices) => void
|
createItem: (item: Omit<ButtonItem, 'id'>, indices: ItemIndices) => void
|
||||||
@@ -29,7 +29,7 @@ const itemsAction = (setTypebot: SetTypebot): ItemsActions => ({
|
|||||||
step.items.splice(itemIndex, 0, {
|
step.items.splice(itemIndex, 0, {
|
||||||
...item,
|
...item,
|
||||||
stepId: step.id,
|
stepId: step.id,
|
||||||
id: generate(),
|
id: cuid(),
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
),
|
),
|
||||||
|
|||||||
@@ -14,7 +14,6 @@ import { Typebot } from 'models'
|
|||||||
import { useRouter } from 'next/router'
|
import { useRouter } from 'next/router'
|
||||||
import React, { useState } from 'react'
|
import React, { useState } from 'react'
|
||||||
import { createTypebot, importTypebot } from 'services/typebots/typebots'
|
import { createTypebot, importTypebot } from 'services/typebots/typebots'
|
||||||
import { generate } from 'short-uuid'
|
|
||||||
|
|
||||||
export type TemplateProps = { name: string; emoji: string; fileName: string }
|
export type TemplateProps = { name: string; emoji: string; fileName: string }
|
||||||
const templates: TemplateProps[] = [
|
const templates: TemplateProps[] = [
|
||||||
|
|||||||
@@ -64,12 +64,12 @@
|
|||||||
"nodemailer": "^6.7.2",
|
"nodemailer": "^6.7.2",
|
||||||
"nprogress": "^0.2.0",
|
"nprogress": "^0.2.0",
|
||||||
"papaparse": "^5.3.1",
|
"papaparse": "^5.3.1",
|
||||||
|
"prettier": "^2.5.1",
|
||||||
"qs": "^6.10.3",
|
"qs": "^6.10.3",
|
||||||
"react": "^17.0.2",
|
"react": "^17.0.2",
|
||||||
"react-dom": "^17.0.2",
|
"react-dom": "^17.0.2",
|
||||||
"react-draggable": "^4.4.4",
|
"react-draggable": "^4.4.4",
|
||||||
"react-table": "^7.7.0",
|
"react-table": "^7.7.0",
|
||||||
"short-uuid": "^4.2.0",
|
|
||||||
"slate": "^0.73.1",
|
"slate": "^0.73.1",
|
||||||
"slate-history": "^0.66.0",
|
"slate-history": "^0.66.0",
|
||||||
"slate-hyperscript": "^0.67.0",
|
"slate-hyperscript": "^0.67.0",
|
||||||
@@ -81,11 +81,9 @@
|
|||||||
"typebot-js": "*",
|
"typebot-js": "*",
|
||||||
"use-debounce": "^7.0.1",
|
"use-debounce": "^7.0.1",
|
||||||
"use-immer": "^0.6.0",
|
"use-immer": "^0.6.0",
|
||||||
"utils": "*",
|
"utils": "*"
|
||||||
"prettier": "^2.5.1"
|
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@types/prettier": "^2.4.4",
|
|
||||||
"@playwright/test": "^1.19.2",
|
"@playwright/test": "^1.19.2",
|
||||||
"@types/google-spreadsheet": "^3.1.5",
|
"@types/google-spreadsheet": "^3.1.5",
|
||||||
"@types/jsonwebtoken": "8.5.8",
|
"@types/jsonwebtoken": "8.5.8",
|
||||||
@@ -95,6 +93,7 @@
|
|||||||
"@types/nodemailer": "^6.4.4",
|
"@types/nodemailer": "^6.4.4",
|
||||||
"@types/nprogress": "^0.2.0",
|
"@types/nprogress": "^0.2.0",
|
||||||
"@types/papaparse": "^5.3.2",
|
"@types/papaparse": "^5.3.2",
|
||||||
|
"@types/prettier": "^2.4.4",
|
||||||
"@types/qs": "^6.9.7",
|
"@types/qs": "^6.9.7",
|
||||||
"@types/react": "^17.0.40",
|
"@types/react": "^17.0.40",
|
||||||
"@types/react-table": "^7.7.9",
|
"@types/react-table": "^7.7.9",
|
||||||
|
|||||||
@@ -6,7 +6,7 @@ import {
|
|||||||
import { BubbleStepType, defaultImageBubbleContent } from 'models'
|
import { BubbleStepType, defaultImageBubbleContent } from 'models'
|
||||||
import { typebotViewer } from '../../services/selectorUtils'
|
import { typebotViewer } from '../../services/selectorUtils'
|
||||||
import path from 'path'
|
import path from 'path'
|
||||||
import { generate } from 'short-uuid'
|
import cuid from 'cuid'
|
||||||
|
|
||||||
const unsplashImageSrc =
|
const unsplashImageSrc =
|
||||||
'https://images.unsplash.com/photo-1504297050568-910d24c426d3?ixlib=rb-1.2.1&ixid=MnwxMjA3fDF8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8&auto=format&fit=crop&w=1287&q=80'
|
'https://images.unsplash.com/photo-1504297050568-910d24c426d3?ixlib=rb-1.2.1&ixid=MnwxMjA3fDF8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8&auto=format&fit=crop&w=1287&q=80'
|
||||||
@@ -14,7 +14,7 @@ const unsplashImageSrc =
|
|||||||
test.describe.parallel('Image bubble step', () => {
|
test.describe.parallel('Image bubble step', () => {
|
||||||
test.describe('Content settings', () => {
|
test.describe('Content settings', () => {
|
||||||
test('should upload image file correctly', async ({ page }) => {
|
test('should upload image file correctly', async ({ page }) => {
|
||||||
const typebotId = generate()
|
const typebotId = cuid()
|
||||||
await createTypebots([
|
await createTypebots([
|
||||||
{
|
{
|
||||||
id: typebotId,
|
id: typebotId,
|
||||||
@@ -42,7 +42,7 @@ test.describe.parallel('Image bubble step', () => {
|
|||||||
})
|
})
|
||||||
|
|
||||||
test('should import image link correctly', async ({ page }) => {
|
test('should import image link correctly', async ({ page }) => {
|
||||||
const typebotId = generate()
|
const typebotId = cuid()
|
||||||
await createTypebots([
|
await createTypebots([
|
||||||
{
|
{
|
||||||
id: typebotId,
|
id: typebotId,
|
||||||
@@ -65,7 +65,7 @@ test.describe.parallel('Image bubble step', () => {
|
|||||||
})
|
})
|
||||||
|
|
||||||
test('should import gifs correctly', async ({ page }) => {
|
test('should import gifs correctly', async ({ page }) => {
|
||||||
const typebotId = generate()
|
const typebotId = cuid()
|
||||||
await createTypebots([
|
await createTypebots([
|
||||||
{
|
{
|
||||||
id: typebotId,
|
id: typebotId,
|
||||||
@@ -90,7 +90,7 @@ test.describe.parallel('Image bubble step', () => {
|
|||||||
|
|
||||||
test.describe('Preview', () => {
|
test.describe('Preview', () => {
|
||||||
test('should display correctly', async ({ page }) => {
|
test('should display correctly', async ({ page }) => {
|
||||||
const typebotId = generate()
|
const typebotId = cuid()
|
||||||
await createTypebots([
|
await createTypebots([
|
||||||
{
|
{
|
||||||
id: typebotId,
|
id: typebotId,
|
||||||
|
|||||||
@@ -5,11 +5,11 @@ import {
|
|||||||
} from '../../services/database'
|
} from '../../services/database'
|
||||||
import { BubbleStepType, defaultTextBubbleContent } from 'models'
|
import { BubbleStepType, defaultTextBubbleContent } from 'models'
|
||||||
import { typebotViewer } from '../../services/selectorUtils'
|
import { typebotViewer } from '../../services/selectorUtils'
|
||||||
import { generate } from 'short-uuid'
|
import cuid from 'cuid'
|
||||||
|
|
||||||
test.describe('Text bubble step', () => {
|
test.describe('Text bubble step', () => {
|
||||||
test('rich text features should work', async ({ page }) => {
|
test('rich text features should work', async ({ page }) => {
|
||||||
const typebotId = generate()
|
const typebotId = cuid()
|
||||||
await createTypebots([
|
await createTypebots([
|
||||||
{
|
{
|
||||||
id: typebotId,
|
id: typebotId,
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ import {
|
|||||||
VideoBubbleContentType,
|
VideoBubbleContentType,
|
||||||
} from 'models'
|
} from 'models'
|
||||||
import { typebotViewer } from '../../services/selectorUtils'
|
import { typebotViewer } from '../../services/selectorUtils'
|
||||||
import { generate } from 'short-uuid'
|
import cuid from 'cuid'
|
||||||
|
|
||||||
const videoSrc =
|
const videoSrc =
|
||||||
'http://commondatastorage.googleapis.com/gtv-videos-bucket/sample/ForBiggerEscapes.mp4'
|
'http://commondatastorage.googleapis.com/gtv-videos-bucket/sample/ForBiggerEscapes.mp4'
|
||||||
@@ -19,7 +19,7 @@ const vimeoVideoSrc = 'https://vimeo.com/649301125'
|
|||||||
test.describe.parallel('Video bubble step', () => {
|
test.describe.parallel('Video bubble step', () => {
|
||||||
test.describe('Content settings', () => {
|
test.describe('Content settings', () => {
|
||||||
test('should import video url correctly', async ({ page }) => {
|
test('should import video url correctly', async ({ page }) => {
|
||||||
const typebotId = generate()
|
const typebotId = cuid()
|
||||||
await createTypebots([
|
await createTypebots([
|
||||||
{
|
{
|
||||||
id: typebotId,
|
id: typebotId,
|
||||||
@@ -43,7 +43,7 @@ test.describe.parallel('Video bubble step', () => {
|
|||||||
|
|
||||||
test.describe('Preview', () => {
|
test.describe('Preview', () => {
|
||||||
test('should display video correctly', async ({ page }) => {
|
test('should display video correctly', async ({ page }) => {
|
||||||
const typebotId = generate()
|
const typebotId = cuid()
|
||||||
await createTypebots([
|
await createTypebots([
|
||||||
{
|
{
|
||||||
id: typebotId,
|
id: typebotId,
|
||||||
@@ -65,7 +65,7 @@ test.describe.parallel('Video bubble step', () => {
|
|||||||
})
|
})
|
||||||
|
|
||||||
test('should display youtube video correctly', async ({ page }) => {
|
test('should display youtube video correctly', async ({ page }) => {
|
||||||
const typebotId = generate()
|
const typebotId = cuid()
|
||||||
await createTypebots([
|
await createTypebots([
|
||||||
{
|
{
|
||||||
id: typebotId,
|
id: typebotId,
|
||||||
@@ -89,7 +89,7 @@ test.describe.parallel('Video bubble step', () => {
|
|||||||
})
|
})
|
||||||
|
|
||||||
test('should display vimeo video correctly', async ({ page }) => {
|
test('should display vimeo video correctly', async ({ page }) => {
|
||||||
const typebotId = generate()
|
const typebotId = cuid()
|
||||||
await createTypebots([
|
await createTypebots([
|
||||||
{
|
{
|
||||||
id: typebotId,
|
id: typebotId,
|
||||||
|
|||||||
@@ -1,10 +1,10 @@
|
|||||||
import test, { expect } from '@playwright/test'
|
import test, { expect } from '@playwright/test'
|
||||||
|
import cuid from 'cuid'
|
||||||
import { InputStepType, defaultTextInputOptions } from 'models'
|
import { InputStepType, defaultTextInputOptions } from 'models'
|
||||||
import path from 'path'
|
import path from 'path'
|
||||||
import { generate } from 'short-uuid'
|
|
||||||
import { createTypebots, parseDefaultBlockWithStep } from '../services/database'
|
import { createTypebots, parseDefaultBlockWithStep } from '../services/database'
|
||||||
|
|
||||||
const typebotId = generate()
|
const typebotId = cuid()
|
||||||
|
|
||||||
test.beforeAll(async () => {
|
test.beforeAll(async () => {
|
||||||
await createTypebots([
|
await createTypebots([
|
||||||
|
|||||||
@@ -1,10 +1,10 @@
|
|||||||
import test, { expect } from '@playwright/test'
|
import test, { expect } from '@playwright/test'
|
||||||
import { InputStepType, defaultTextInputOptions } from 'models'
|
import { InputStepType, defaultTextInputOptions } from 'models'
|
||||||
import { createTypebots, parseDefaultBlockWithStep } from '../services/database'
|
import { createTypebots, parseDefaultBlockWithStep } from '../services/database'
|
||||||
import { generate } from 'short-uuid'
|
|
||||||
import path from 'path'
|
import path from 'path'
|
||||||
|
import cuid from 'cuid'
|
||||||
|
|
||||||
const typebotId = generate()
|
const typebotId = cuid()
|
||||||
test.describe('Dashboard page', () => {
|
test.describe('Dashboard page', () => {
|
||||||
test('should be able to connect custom domain', async ({ page }) => {
|
test('should be able to connect custom domain', async ({ page }) => {
|
||||||
await createTypebots([
|
await createTypebots([
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
import test, { expect, Page } from '@playwright/test'
|
import test, { expect, Page } from '@playwright/test'
|
||||||
|
import cuid from 'cuid'
|
||||||
import path from 'path'
|
import path from 'path'
|
||||||
import { generate } from 'short-uuid'
|
|
||||||
import { createFolders, createTypebots } from '../services/database'
|
import { createFolders, createTypebots } from '../services/database'
|
||||||
import { deleteButtonInConfirmDialog } from '../services/selectorUtils'
|
import { deleteButtonInConfirmDialog } from '../services/selectorUtils'
|
||||||
|
|
||||||
@@ -49,7 +49,7 @@ test.describe('Dashboard page', () => {
|
|||||||
})
|
})
|
||||||
|
|
||||||
test('folders and typebots should be movable', async ({ page }) => {
|
test('folders and typebots should be movable', async ({ page }) => {
|
||||||
const droppableFolderId = generate()
|
const droppableFolderId = cuid()
|
||||||
await createFolders([{ id: droppableFolderId, name: 'Droppable folder' }])
|
await createFolders([{ id: droppableFolderId, name: 'Droppable folder' }])
|
||||||
await createTypebots([{ name: 'Draggable typebot' }])
|
await createTypebots([{ name: 'Draggable typebot' }])
|
||||||
await page.goto('/typebots')
|
await page.goto('/typebots')
|
||||||
|
|||||||
@@ -5,12 +5,12 @@ import {
|
|||||||
parseDefaultBlockWithStep,
|
parseDefaultBlockWithStep,
|
||||||
} from '../services/database'
|
} from '../services/database'
|
||||||
import { defaultTextInputOptions, InputStepType } from 'models'
|
import { defaultTextInputOptions, InputStepType } from 'models'
|
||||||
import { generate } from 'short-uuid'
|
|
||||||
import path from 'path'
|
import path from 'path'
|
||||||
|
import cuid from 'cuid'
|
||||||
|
|
||||||
test.describe.parallel('Editor', () => {
|
test.describe.parallel('Editor', () => {
|
||||||
test('Edges connection should work', async ({ page }) => {
|
test('Edges connection should work', async ({ page }) => {
|
||||||
const typebotId = generate()
|
const typebotId = cuid()
|
||||||
await createTypebots([
|
await createTypebots([
|
||||||
{
|
{
|
||||||
id: typebotId,
|
id: typebotId,
|
||||||
@@ -57,7 +57,7 @@ test.describe.parallel('Editor', () => {
|
|||||||
expect(total).toBe(1)
|
expect(total).toBe(1)
|
||||||
})
|
})
|
||||||
test('Drag and drop steps and items should work', async ({ page }) => {
|
test('Drag and drop steps and items should work', async ({ page }) => {
|
||||||
const typebotId = generate()
|
const typebotId = cuid()
|
||||||
await importTypebotInDatabase(
|
await importTypebotInDatabase(
|
||||||
path.join(__dirname, '../fixtures/typebots/editor/buttonsDnd.json'),
|
path.join(__dirname, '../fixtures/typebots/editor/buttonsDnd.json'),
|
||||||
{
|
{
|
||||||
@@ -98,7 +98,7 @@ test.describe.parallel('Editor', () => {
|
|||||||
)
|
)
|
||||||
})
|
})
|
||||||
test('Undo / Redo buttons should work', async ({ page }) => {
|
test('Undo / Redo buttons should work', async ({ page }) => {
|
||||||
const typebotId = generate()
|
const typebotId = cuid()
|
||||||
await createTypebots([
|
await createTypebots([
|
||||||
{
|
{
|
||||||
id: typebotId,
|
id: typebotId,
|
||||||
|
|||||||
@@ -5,11 +5,11 @@ import {
|
|||||||
} from '../../services/database'
|
} from '../../services/database'
|
||||||
import { defaultChoiceInputOptions, InputStepType, ItemType } from 'models'
|
import { defaultChoiceInputOptions, InputStepType, ItemType } from 'models'
|
||||||
import { typebotViewer } from '../../services/selectorUtils'
|
import { typebotViewer } from '../../services/selectorUtils'
|
||||||
import { generate } from 'short-uuid'
|
import cuid from 'cuid'
|
||||||
|
|
||||||
test.describe.parallel('Buttons input step', () => {
|
test.describe.parallel('Buttons input step', () => {
|
||||||
test('can edit button items', async ({ page }) => {
|
test('can edit button items', async ({ page }) => {
|
||||||
const typebotId = generate()
|
const typebotId = cuid()
|
||||||
await createTypebots([
|
await createTypebots([
|
||||||
{
|
{
|
||||||
id: typebotId,
|
id: typebotId,
|
||||||
|
|||||||
@@ -5,11 +5,11 @@ import {
|
|||||||
} from '../../services/database'
|
} from '../../services/database'
|
||||||
import { defaultDateInputOptions, InputStepType } from 'models'
|
import { defaultDateInputOptions, InputStepType } from 'models'
|
||||||
import { typebotViewer } from '../../services/selectorUtils'
|
import { typebotViewer } from '../../services/selectorUtils'
|
||||||
import { generate } from 'short-uuid'
|
import cuid from 'cuid'
|
||||||
|
|
||||||
test.describe('Date input step', () => {
|
test.describe('Date input step', () => {
|
||||||
test('options should work', async ({ page }) => {
|
test('options should work', async ({ page }) => {
|
||||||
const typebotId = generate()
|
const typebotId = cuid()
|
||||||
await createTypebots([
|
await createTypebots([
|
||||||
{
|
{
|
||||||
id: typebotId,
|
id: typebotId,
|
||||||
|
|||||||
@@ -5,11 +5,11 @@ import {
|
|||||||
} from '../../services/database'
|
} from '../../services/database'
|
||||||
import { defaultEmailInputOptions, InputStepType } from 'models'
|
import { defaultEmailInputOptions, InputStepType } from 'models'
|
||||||
import { typebotViewer } from '../../services/selectorUtils'
|
import { typebotViewer } from '../../services/selectorUtils'
|
||||||
import { generate } from 'short-uuid'
|
import cuid from 'cuid'
|
||||||
|
|
||||||
test.describe('Email input step', () => {
|
test.describe('Email input step', () => {
|
||||||
test('options should work', async ({ page }) => {
|
test('options should work', async ({ page }) => {
|
||||||
const typebotId = generate()
|
const typebotId = cuid()
|
||||||
await createTypebots([
|
await createTypebots([
|
||||||
{
|
{
|
||||||
id: typebotId,
|
id: typebotId,
|
||||||
|
|||||||
@@ -5,11 +5,11 @@ import {
|
|||||||
} from '../../services/database'
|
} from '../../services/database'
|
||||||
import { defaultNumberInputOptions, InputStepType } from 'models'
|
import { defaultNumberInputOptions, InputStepType } from 'models'
|
||||||
import { typebotViewer } from '../../services/selectorUtils'
|
import { typebotViewer } from '../../services/selectorUtils'
|
||||||
import { generate } from 'short-uuid'
|
import cuid from 'cuid'
|
||||||
|
|
||||||
test.describe('Number input step', () => {
|
test.describe('Number input step', () => {
|
||||||
test('options should work', async ({ page }) => {
|
test('options should work', async ({ page }) => {
|
||||||
const typebotId = generate()
|
const typebotId = cuid()
|
||||||
await createTypebots([
|
await createTypebots([
|
||||||
{
|
{
|
||||||
id: typebotId,
|
id: typebotId,
|
||||||
|
|||||||
@@ -5,11 +5,11 @@ import {
|
|||||||
} from '../../services/database'
|
} from '../../services/database'
|
||||||
import { defaultPhoneInputOptions, InputStepType } from 'models'
|
import { defaultPhoneInputOptions, InputStepType } from 'models'
|
||||||
import { typebotViewer } from '../../services/selectorUtils'
|
import { typebotViewer } from '../../services/selectorUtils'
|
||||||
import { generate } from 'short-uuid'
|
import cuid from 'cuid'
|
||||||
|
|
||||||
test.describe('Phone input step', () => {
|
test.describe('Phone input step', () => {
|
||||||
test('options should work', async ({ page }) => {
|
test('options should work', async ({ page }) => {
|
||||||
const typebotId = generate()
|
const typebotId = cuid()
|
||||||
await createTypebots([
|
await createTypebots([
|
||||||
{
|
{
|
||||||
id: typebotId,
|
id: typebotId,
|
||||||
|
|||||||
@@ -5,11 +5,11 @@ import {
|
|||||||
} from '../../services/database'
|
} from '../../services/database'
|
||||||
import { defaultTextInputOptions, InputStepType } from 'models'
|
import { defaultTextInputOptions, InputStepType } from 'models'
|
||||||
import { typebotViewer } from '../../services/selectorUtils'
|
import { typebotViewer } from '../../services/selectorUtils'
|
||||||
import { generate } from 'short-uuid'
|
import cuid from 'cuid'
|
||||||
|
|
||||||
test.describe.parallel('Text input step', () => {
|
test.describe.parallel('Text input step', () => {
|
||||||
test('options should work', async ({ page }) => {
|
test('options should work', async ({ page }) => {
|
||||||
const typebotId = generate()
|
const typebotId = cuid()
|
||||||
await createTypebots([
|
await createTypebots([
|
||||||
{
|
{
|
||||||
id: typebotId,
|
id: typebotId,
|
||||||
@@ -43,7 +43,7 @@ test.describe.parallel('Text input step', () => {
|
|||||||
})
|
})
|
||||||
|
|
||||||
test('variable in URL should prefill the input', async ({ page }) => {
|
test('variable in URL should prefill the input', async ({ page }) => {
|
||||||
const typebotId = generate()
|
const typebotId = cuid()
|
||||||
await createTypebots([
|
await createTypebots([
|
||||||
{
|
{
|
||||||
id: typebotId,
|
id: typebotId,
|
||||||
|
|||||||
@@ -5,11 +5,11 @@ import {
|
|||||||
} from '../../services/database'
|
} from '../../services/database'
|
||||||
import { defaultUrlInputOptions, InputStepType } from 'models'
|
import { defaultUrlInputOptions, InputStepType } from 'models'
|
||||||
import { typebotViewer } from '../../services/selectorUtils'
|
import { typebotViewer } from '../../services/selectorUtils'
|
||||||
import { generate } from 'short-uuid'
|
import cuid from 'cuid'
|
||||||
|
|
||||||
test.describe('Url input step', () => {
|
test.describe('Url input step', () => {
|
||||||
test('options should work', async ({ page }) => {
|
test('options should work', async ({ page }) => {
|
||||||
const typebotId = generate()
|
const typebotId = cuid()
|
||||||
await createTypebots([
|
await createTypebots([
|
||||||
{
|
{
|
||||||
id: typebotId,
|
id: typebotId,
|
||||||
|
|||||||
@@ -4,11 +4,11 @@ import {
|
|||||||
parseDefaultBlockWithStep,
|
parseDefaultBlockWithStep,
|
||||||
} from '../../services/database'
|
} from '../../services/database'
|
||||||
import { defaultGoogleAnalyticsOptions, IntegrationStepType } from 'models'
|
import { defaultGoogleAnalyticsOptions, IntegrationStepType } from 'models'
|
||||||
import { generate } from 'short-uuid'
|
import cuid from 'cuid'
|
||||||
|
|
||||||
test.describe('Google Analytics step', () => {
|
test.describe('Google Analytics step', () => {
|
||||||
test('its configuration should work', async ({ page }) => {
|
test('its configuration should work', async ({ page }) => {
|
||||||
const typebotId = generate()
|
const typebotId = cuid()
|
||||||
await createTypebots([
|
await createTypebots([
|
||||||
{
|
{
|
||||||
id: typebotId,
|
id: typebotId,
|
||||||
|
|||||||
@@ -2,11 +2,11 @@ import test, { expect, Page } from '@playwright/test'
|
|||||||
import { importTypebotInDatabase } from '../../services/database'
|
import { importTypebotInDatabase } from '../../services/database'
|
||||||
import path from 'path'
|
import path from 'path'
|
||||||
import { typebotViewer } from '../../services/selectorUtils'
|
import { typebotViewer } from '../../services/selectorUtils'
|
||||||
import { generate } from 'short-uuid'
|
import cuid from 'cuid'
|
||||||
|
|
||||||
test.describe.parallel('Google sheets integration', () => {
|
test.describe.parallel('Google sheets integration', () => {
|
||||||
test('Insert row should work', async ({ page }) => {
|
test('Insert row should work', async ({ page }) => {
|
||||||
const typebotId = generate()
|
const typebotId = cuid()
|
||||||
await importTypebotInDatabase(
|
await importTypebotInDatabase(
|
||||||
path.join(
|
path.join(
|
||||||
__dirname,
|
__dirname,
|
||||||
@@ -56,7 +56,7 @@ test.describe.parallel('Google sheets integration', () => {
|
|||||||
})
|
})
|
||||||
|
|
||||||
test('Update row should work', async ({ page }) => {
|
test('Update row should work', async ({ page }) => {
|
||||||
const typebotId = generate()
|
const typebotId = cuid()
|
||||||
await importTypebotInDatabase(
|
await importTypebotInDatabase(
|
||||||
path.join(
|
path.join(
|
||||||
__dirname,
|
__dirname,
|
||||||
@@ -106,7 +106,7 @@ test.describe.parallel('Google sheets integration', () => {
|
|||||||
})
|
})
|
||||||
|
|
||||||
test('Get row should work', async ({ page }) => {
|
test('Get row should work', async ({ page }) => {
|
||||||
const typebotId = generate()
|
const typebotId = cuid()
|
||||||
await importTypebotInDatabase(
|
await importTypebotInDatabase(
|
||||||
path.join(
|
path.join(
|
||||||
__dirname,
|
__dirname,
|
||||||
|
|||||||
@@ -1,10 +1,10 @@
|
|||||||
import test, { expect } from '@playwright/test'
|
import test, { expect } from '@playwright/test'
|
||||||
import { importTypebotInDatabase } from '../../services/database'
|
import { importTypebotInDatabase } from '../../services/database'
|
||||||
import path from 'path'
|
import path from 'path'
|
||||||
import { generate } from 'short-uuid'
|
|
||||||
import { typebotViewer } from '../../services/selectorUtils'
|
import { typebotViewer } from '../../services/selectorUtils'
|
||||||
|
import cuid from 'cuid'
|
||||||
|
|
||||||
const typebotId = generate()
|
const typebotId = cuid()
|
||||||
|
|
||||||
test.describe('Send email step', () => {
|
test.describe('Send email step', () => {
|
||||||
test('its configuration should work', async ({ page }) => {
|
test('its configuration should work', async ({ page }) => {
|
||||||
|
|||||||
@@ -1,12 +1,12 @@
|
|||||||
import test, { expect, Page } from '@playwright/test'
|
import test, { expect, Page } from '@playwright/test'
|
||||||
import { createWebhook, importTypebotInDatabase } from '../../services/database'
|
import { createWebhook, importTypebotInDatabase } from '../../services/database'
|
||||||
import path from 'path'
|
import path from 'path'
|
||||||
import { generate } from 'short-uuid'
|
|
||||||
import { HttpMethod } from 'models'
|
import { HttpMethod } from 'models'
|
||||||
|
import cuid from 'cuid'
|
||||||
|
|
||||||
test.describe('Webhook step', () => {
|
test.describe('Webhook step', () => {
|
||||||
test('easy configuration should work', async ({ page }) => {
|
test('easy configuration should work', async ({ page }) => {
|
||||||
const typebotId = generate()
|
const typebotId = cuid()
|
||||||
await importTypebotInDatabase(
|
await importTypebotInDatabase(
|
||||||
path.join(__dirname, '../../fixtures/typebots/integrations/webhook.json'),
|
path.join(__dirname, '../../fixtures/typebots/integrations/webhook.json'),
|
||||||
{
|
{
|
||||||
@@ -26,7 +26,7 @@ test.describe('Webhook step', () => {
|
|||||||
)
|
)
|
||||||
})
|
})
|
||||||
test('Generated body should work', async ({ page }) => {
|
test('Generated body should work', async ({ page }) => {
|
||||||
const typebotId = generate()
|
const typebotId = cuid()
|
||||||
await importTypebotInDatabase(
|
await importTypebotInDatabase(
|
||||||
path.join(__dirname, '../../fixtures/typebots/integrations/webhook.json'),
|
path.join(__dirname, '../../fixtures/typebots/integrations/webhook.json'),
|
||||||
{
|
{
|
||||||
@@ -51,7 +51,7 @@ test.describe('Webhook step', () => {
|
|||||||
)
|
)
|
||||||
})
|
})
|
||||||
test('its configuration should work', async ({ page }) => {
|
test('its configuration should work', async ({ page }) => {
|
||||||
const typebotId = generate()
|
const typebotId = cuid()
|
||||||
await importTypebotInDatabase(
|
await importTypebotInDatabase(
|
||||||
path.join(__dirname, '../../fixtures/typebots/integrations/webhook.json'),
|
path.join(__dirname, '../../fixtures/typebots/integrations/webhook.json'),
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -2,9 +2,9 @@ import test, { expect } from '@playwright/test'
|
|||||||
import path from 'path'
|
import path from 'path'
|
||||||
import { typebotViewer } from '../../services/selectorUtils'
|
import { typebotViewer } from '../../services/selectorUtils'
|
||||||
import { importTypebotInDatabase } from '../../services/database'
|
import { importTypebotInDatabase } from '../../services/database'
|
||||||
import { generate } from 'short-uuid'
|
import cuid from 'cuid'
|
||||||
|
|
||||||
const typebotId = generate()
|
const typebotId = cuid()
|
||||||
|
|
||||||
test.describe('Code step', () => {
|
test.describe('Code step', () => {
|
||||||
test('code should trigger', async ({ page }) => {
|
test('code should trigger', async ({ page }) => {
|
||||||
|
|||||||
@@ -2,9 +2,9 @@ import test, { expect } from '@playwright/test'
|
|||||||
import path from 'path'
|
import path from 'path'
|
||||||
import { typebotViewer } from '../../services/selectorUtils'
|
import { typebotViewer } from '../../services/selectorUtils'
|
||||||
import { importTypebotInDatabase } from '../../services/database'
|
import { importTypebotInDatabase } from '../../services/database'
|
||||||
import { generate } from 'short-uuid'
|
import cuid from 'cuid'
|
||||||
|
|
||||||
const typebotId = generate()
|
const typebotId = cuid()
|
||||||
|
|
||||||
test.describe('Condition step', () => {
|
test.describe('Condition step', () => {
|
||||||
test('its configuration should work', async ({ page }) => {
|
test('its configuration should work', async ({ page }) => {
|
||||||
|
|||||||
@@ -2,9 +2,9 @@ import test, { expect } from '@playwright/test'
|
|||||||
import path from 'path'
|
import path from 'path'
|
||||||
import { typebotViewer } from '../../services/selectorUtils'
|
import { typebotViewer } from '../../services/selectorUtils'
|
||||||
import { importTypebotInDatabase } from '../../services/database'
|
import { importTypebotInDatabase } from '../../services/database'
|
||||||
import { generate } from 'short-uuid'
|
import cuid from 'cuid'
|
||||||
|
|
||||||
const typebotId = generate()
|
const typebotId = cuid()
|
||||||
|
|
||||||
test.describe('Redirect step', () => {
|
test.describe('Redirect step', () => {
|
||||||
test('its configuration should work', async ({ page, context }) => {
|
test('its configuration should work', async ({ page, context }) => {
|
||||||
|
|||||||
@@ -2,9 +2,9 @@ import test, { expect } from '@playwright/test'
|
|||||||
import path from 'path'
|
import path from 'path'
|
||||||
import { typebotViewer } from '../../services/selectorUtils'
|
import { typebotViewer } from '../../services/selectorUtils'
|
||||||
import { importTypebotInDatabase } from '../../services/database'
|
import { importTypebotInDatabase } from '../../services/database'
|
||||||
import { generate } from 'short-uuid'
|
import cuid from 'cuid'
|
||||||
|
|
||||||
const typebotId = generate()
|
const typebotId = cuid()
|
||||||
|
|
||||||
test.describe('Set variable step', () => {
|
test.describe('Set variable step', () => {
|
||||||
test('its configuration should work', async ({ page }) => {
|
test('its configuration should work', async ({ page }) => {
|
||||||
|
|||||||
@@ -1,12 +1,12 @@
|
|||||||
import test, { expect } from '@playwright/test'
|
import test, { expect } from '@playwright/test'
|
||||||
import { typebotViewer } from '../../services/selectorUtils'
|
import { typebotViewer } from '../../services/selectorUtils'
|
||||||
import { generate } from 'short-uuid'
|
|
||||||
import { importTypebotInDatabase } from '../../services/database'
|
import { importTypebotInDatabase } from '../../services/database'
|
||||||
import path from 'path'
|
import path from 'path'
|
||||||
|
import cuid from 'cuid'
|
||||||
|
|
||||||
test('should be configurable', async ({ page }) => {
|
test('should be configurable', async ({ page }) => {
|
||||||
const typebotId = generate()
|
const typebotId = cuid()
|
||||||
const linkedTypebotId = generate()
|
const linkedTypebotId = cuid()
|
||||||
await importTypebotInDatabase(
|
await importTypebotInDatabase(
|
||||||
path.join(__dirname, '../../fixtures/typebots/logic/linkTypebots/1.json'),
|
path.join(__dirname, '../../fixtures/typebots/logic/linkTypebots/1.json'),
|
||||||
{ id: typebotId }
|
{ id: typebotId }
|
||||||
|
|||||||
@@ -1,9 +1,9 @@
|
|||||||
import test, { expect, Page } from '@playwright/test'
|
import test, { expect, Page } from '@playwright/test'
|
||||||
|
import cuid from 'cuid'
|
||||||
import { readFileSync } from 'fs'
|
import { readFileSync } from 'fs'
|
||||||
import { defaultTextInputOptions, InputStepType } from 'models'
|
import { defaultTextInputOptions, InputStepType } from 'models'
|
||||||
import { parse } from 'papaparse'
|
import { parse } from 'papaparse'
|
||||||
import path from 'path'
|
import path from 'path'
|
||||||
import { generate } from 'short-uuid'
|
|
||||||
import {
|
import {
|
||||||
createResults,
|
createResults,
|
||||||
createTypebots,
|
createTypebots,
|
||||||
@@ -12,13 +12,13 @@ import {
|
|||||||
} from '../services/database'
|
} from '../services/database'
|
||||||
import { deleteButtonInConfirmDialog } from '../services/selectorUtils'
|
import { deleteButtonInConfirmDialog } from '../services/selectorUtils'
|
||||||
|
|
||||||
const typebotId = generate()
|
const typebotId = cuid()
|
||||||
|
|
||||||
test.describe('Results page', () => {
|
test.describe('Results page', () => {
|
||||||
test('Submission table header should be parsed correctly', async ({
|
test('Submission table header should be parsed correctly', async ({
|
||||||
page,
|
page,
|
||||||
}) => {
|
}) => {
|
||||||
const typebotId = generate()
|
const typebotId = cuid()
|
||||||
await importTypebotInDatabase(
|
await importTypebotInDatabase(
|
||||||
path.join(
|
path.join(
|
||||||
__dirname,
|
__dirname,
|
||||||
|
|||||||
@@ -1,14 +1,14 @@
|
|||||||
import test, { expect } from '@playwright/test'
|
import test, { expect } from '@playwright/test'
|
||||||
|
import cuid from 'cuid'
|
||||||
import { defaultTextInputOptions } from 'models'
|
import { defaultTextInputOptions } from 'models'
|
||||||
import path from 'path'
|
import path from 'path'
|
||||||
import { generate } from 'short-uuid'
|
|
||||||
import { importTypebotInDatabase } from '../services/database'
|
import { importTypebotInDatabase } from '../services/database'
|
||||||
import { typebotViewer } from '../services/selectorUtils'
|
import { typebotViewer } from '../services/selectorUtils'
|
||||||
|
|
||||||
test.describe.parallel('Settings page', () => {
|
test.describe.parallel('Settings page', () => {
|
||||||
test.describe('General', () => {
|
test.describe('General', () => {
|
||||||
test('should reflect change in real-time', async ({ page }) => {
|
test('should reflect change in real-time', async ({ page }) => {
|
||||||
const typebotId = generate()
|
const typebotId = cuid()
|
||||||
await importTypebotInDatabase(
|
await importTypebotInDatabase(
|
||||||
path.join(__dirname, '../fixtures/typebots/settings.json'),
|
path.join(__dirname, '../fixtures/typebots/settings.json'),
|
||||||
{
|
{
|
||||||
@@ -48,7 +48,7 @@ test.describe.parallel('Settings page', () => {
|
|||||||
|
|
||||||
test.describe('Typing emulation', () => {
|
test.describe('Typing emulation', () => {
|
||||||
test('should be fillable', async ({ page }) => {
|
test('should be fillable', async ({ page }) => {
|
||||||
const typebotId = generate()
|
const typebotId = cuid()
|
||||||
await importTypebotInDatabase(
|
await importTypebotInDatabase(
|
||||||
path.join(__dirname, '../fixtures/typebots/settings.json'),
|
path.join(__dirname, '../fixtures/typebots/settings.json'),
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
import test, { expect } from '@playwright/test'
|
import test, { expect } from '@playwright/test'
|
||||||
|
import cuid from 'cuid'
|
||||||
import path from 'path'
|
import path from 'path'
|
||||||
import { generate } from 'short-uuid'
|
|
||||||
import { importTypebotInDatabase } from '../services/database'
|
import { importTypebotInDatabase } from '../services/database'
|
||||||
import { typebotViewer } from '../services/selectorUtils'
|
import { typebotViewer } from '../services/selectorUtils'
|
||||||
|
|
||||||
@@ -12,7 +12,7 @@ const guestAvatarUrl =
|
|||||||
test.describe.parallel('Theme page', () => {
|
test.describe.parallel('Theme page', () => {
|
||||||
test.describe('General', () => {
|
test.describe('General', () => {
|
||||||
test('should reflect change in real-time', async ({ page }) => {
|
test('should reflect change in real-time', async ({ page }) => {
|
||||||
const typebotId = generate()
|
const typebotId = cuid()
|
||||||
const chatContainer = typebotViewer(page).locator(
|
const chatContainer = typebotViewer(page).locator(
|
||||||
'[data-testid="container"]'
|
'[data-testid="container"]'
|
||||||
)
|
)
|
||||||
@@ -160,7 +160,7 @@ test.describe.parallel('Theme page', () => {
|
|||||||
|
|
||||||
test.describe('Custom CSS', () => {
|
test.describe('Custom CSS', () => {
|
||||||
test('should reflect change in real-time', async ({ page }) => {
|
test('should reflect change in real-time', async ({ page }) => {
|
||||||
const typebotId = generate()
|
const typebotId = cuid()
|
||||||
await importTypebotInDatabase(
|
await importTypebotInDatabase(
|
||||||
path.join(__dirname, '../fixtures/typebots/theme.json'),
|
path.join(__dirname, '../fixtures/typebots/theme.json'),
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -1,11 +1,11 @@
|
|||||||
|
import cuid from 'cuid'
|
||||||
import { PublicTypebot, Typebot } from 'models'
|
import { PublicTypebot, Typebot } from 'models'
|
||||||
import shortId from 'short-uuid'
|
|
||||||
import { sendRequest } from 'utils'
|
import { sendRequest } from 'utils'
|
||||||
|
|
||||||
export const parseTypebotToPublicTypebot = (
|
export const parseTypebotToPublicTypebot = (
|
||||||
typebot: Typebot
|
typebot: Typebot
|
||||||
): PublicTypebot => ({
|
): PublicTypebot => ({
|
||||||
id: shortId.generate(),
|
id: cuid(),
|
||||||
typebotId: typebot.id,
|
typebotId: typebot.id,
|
||||||
blocks: typebot.blocks,
|
blocks: typebot.blocks,
|
||||||
edges: typebot.edges,
|
edges: typebot.edges,
|
||||||
|
|||||||
@@ -35,7 +35,6 @@ import {
|
|||||||
defaultConditionContent,
|
defaultConditionContent,
|
||||||
defaultSendEmailOptions,
|
defaultSendEmailOptions,
|
||||||
} from 'models'
|
} from 'models'
|
||||||
import shortId, { generate } from 'short-uuid'
|
|
||||||
import { Typebot } from 'models'
|
import { Typebot } from 'models'
|
||||||
import useSWR from 'swr'
|
import useSWR from 'swr'
|
||||||
import { fetcher, toKebabCase } from '../utils'
|
import { fetcher, toKebabCase } from '../utils'
|
||||||
@@ -179,7 +178,7 @@ export const parseNewStep = (
|
|||||||
type: DraggableStepType,
|
type: DraggableStepType,
|
||||||
blockId: string
|
blockId: string
|
||||||
): DraggableStep => {
|
): DraggableStep => {
|
||||||
const id = `s${shortId.generate()}`
|
const id = cuid()
|
||||||
return {
|
return {
|
||||||
id,
|
id,
|
||||||
blockId,
|
blockId,
|
||||||
@@ -199,11 +198,11 @@ const parseDefaultItems = (
|
|||||||
): Item[] => {
|
): Item[] => {
|
||||||
switch (type) {
|
switch (type) {
|
||||||
case InputStepType.CHOICE:
|
case InputStepType.CHOICE:
|
||||||
return [{ id: generate(), stepId, type: ItemType.BUTTON }]
|
return [{ id: cuid(), stepId, type: ItemType.BUTTON }]
|
||||||
case LogicStepType.CONDITION:
|
case LogicStepType.CONDITION:
|
||||||
return [
|
return [
|
||||||
{
|
{
|
||||||
id: generate(),
|
id: cuid(),
|
||||||
stepId,
|
stepId,
|
||||||
type: ItemType.CONDITION,
|
type: ItemType.CONDITION,
|
||||||
content: defaultConditionContent,
|
content: defaultConditionContent,
|
||||||
@@ -317,8 +316,8 @@ export const parseNewTypebot = ({
|
|||||||
| 'publicId'
|
| 'publicId'
|
||||||
| 'customDomain'
|
| 'customDomain'
|
||||||
> => {
|
> => {
|
||||||
const startBlockId = shortId.generate()
|
const startBlockId = cuid()
|
||||||
const startStepId = shortId.generate()
|
const startStepId = cuid()
|
||||||
const startStep: StartStep = {
|
const startStep: StartStep = {
|
||||||
blockId: startBlockId,
|
blockId: startBlockId,
|
||||||
id: startStepId,
|
id: startStepId,
|
||||||
|
|||||||
@@ -48,9 +48,10 @@ Used authentication in the builder and for the Google Sheets integration step. M
|
|||||||
| GOOGLE_CLIENT_SECRET | -- | The Client secret from the Google API Console |
|
| GOOGLE_CLIENT_SECRET | -- | The Client secret from the Google API Console |
|
||||||
|
|
||||||
Used for Google Fonts:
|
Used for Google Fonts:
|
||||||
| Parameter | Default | Description |
|
|
||||||
| ---------------------------- | ------- | --------------------------------------------- |
|
| Parameter | Default | Description |
|
||||||
| NEXT_PUBLIC_GOOGLE_API_KEY | -- | The API Key from the Google API Console |
|
| -------------------------- | ------- | --------------------------------------- |
|
||||||
|
| NEXT_PUBLIC_GOOGLE_API_KEY | -- | The API Key from the Google API Console |
|
||||||
|
|
||||||
## Builder
|
## Builder
|
||||||
|
|
||||||
|
|||||||
@@ -109,7 +109,6 @@ export const RealTimeResults = () => {
|
|||||||
borderRadius: '0.5rem',
|
borderRadius: '0.5rem',
|
||||||
border: 'none',
|
border: 'none',
|
||||||
backgroundColor: 'white',
|
backgroundColor: 'white',
|
||||||
pointerEvents: 'none',
|
|
||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
</Stack>
|
</Stack>
|
||||||
|
|||||||
@@ -346,7 +346,8 @@
|
|||||||
"general": {
|
"general": {
|
||||||
"font": "Open Sans",
|
"font": "Open Sans",
|
||||||
"background": { "type": "Color", "content": "#171923" }
|
"background": { "type": "Color", "content": "#171923" }
|
||||||
}
|
},
|
||||||
|
"customCss": ".typebot-button {box-shadow: inset 0 1px 0 0 rgb(255 255 255/0.2)}"
|
||||||
},
|
},
|
||||||
"settings": {
|
"settings": {
|
||||||
"general": { "isBrandingEnabled": false },
|
"general": { "isBrandingEnabled": false },
|
||||||
|
|||||||
@@ -300,7 +300,7 @@
|
|||||||
"backgroundColor": "#1e293b",
|
"backgroundColor": "#1e293b",
|
||||||
"placeholderColor": "#9095A0"
|
"placeholderColor": "#9095A0"
|
||||||
},
|
},
|
||||||
"buttons": { "color": "#303235", "backgroundColor": "#7ea6ff" },
|
"buttons": { "color": "#ffffff", "backgroundColor": "#1a5fff" },
|
||||||
"hostBubbles": { "color": "#ffffff", "backgroundColor": "#1e293b" },
|
"hostBubbles": { "color": "#ffffff", "backgroundColor": "#1e293b" },
|
||||||
"guestBubbles": { "color": "#FFFFFF", "backgroundColor": "#FF8E21" },
|
"guestBubbles": { "color": "#FFFFFF", "backgroundColor": "#FF8E21" },
|
||||||
"hostAvatar": {
|
"hostAvatar": {
|
||||||
@@ -311,7 +311,8 @@
|
|||||||
"general": {
|
"general": {
|
||||||
"font": "Open Sans",
|
"font": "Open Sans",
|
||||||
"background": { "type": "Color", "content": "#171923" }
|
"background": { "type": "Color", "content": "#171923" }
|
||||||
}
|
},
|
||||||
|
"customCss": ".typebot-button {box-shadow: inset 0 1px 0 0 rgb(255 255 255/0.2)}"
|
||||||
},
|
},
|
||||||
"settings": {
|
"settings": {
|
||||||
"general": {
|
"general": {
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
ENCRYPTION_SECRET=SgVkYp2s5v8y/B?E(H+MbQeThWmZq4t6 #256-bits secret (can be generated here: https://www.allkeysgenerator.com/Random/Security-Encryption-Key-Generator.aspx)
|
ENCRYPTION_SECRET=SgVkYp2s5v8y/B?E(H+MbQeThWmZq4t6 #256-bits secret (can be generated here: https://www.allkeysgenerator.com/Random/Security-Encryption-Key-Generator.aspx)
|
||||||
NEXT_PUBLIC_VIEWER_URL=http://localhost:3001
|
NEXT_PUBLIC_VIEWER_URL=http://localhost:3001
|
||||||
DATABASE_URL=postgresql://postgres:@localhost:5432/typebot
|
DATABASE_URL=postgresql://postgres:typebot@localhost:5432/typebot
|
||||||
|
|
||||||
# For more configuration options check out:
|
# For more configuration options check out:
|
||||||
https://docs.typebot.io/self-hosting/configuration
|
https://docs.typebot.io/self-hosting/configuration
|
||||||
@@ -15,13 +15,14 @@
|
|||||||
"@sentry/nextjs": "^6.18.2",
|
"@sentry/nextjs": "^6.18.2",
|
||||||
"bot-engine": "*",
|
"bot-engine": "*",
|
||||||
"cors": "^2.8.5",
|
"cors": "^2.8.5",
|
||||||
|
"cuid": "^2.1.8",
|
||||||
"db": "*",
|
"db": "*",
|
||||||
"google-spreadsheet": "^3.2.0",
|
"google-spreadsheet": "^3.2.0",
|
||||||
"got": "^12.0.1",
|
"got": "^12.0.1",
|
||||||
"qs": "^6.10.3",
|
|
||||||
"models": "*",
|
"models": "*",
|
||||||
"next": "^12.1.0",
|
"next": "^12.1.0",
|
||||||
"nodemailer": "^6.7.2",
|
"nodemailer": "^6.7.2",
|
||||||
|
"qs": "^6.10.3",
|
||||||
"react": "^17.0.2",
|
"react": "^17.0.2",
|
||||||
"react-dom": "^17.0.2",
|
"react-dom": "^17.0.2",
|
||||||
"utils": "*"
|
"utils": "*"
|
||||||
@@ -32,8 +33,8 @@
|
|||||||
"@types/google-spreadsheet": "^3.1.5",
|
"@types/google-spreadsheet": "^3.1.5",
|
||||||
"@types/node": "^17.0.21",
|
"@types/node": "^17.0.21",
|
||||||
"@types/nodemailer": "^6.4.4",
|
"@types/nodemailer": "^6.4.4",
|
||||||
"@types/react": "^17.0.40",
|
|
||||||
"@types/qs": "^6.9.7",
|
"@types/qs": "^6.9.7",
|
||||||
|
"@types/react": "^17.0.40",
|
||||||
"@typescript-eslint/eslint-plugin": "^5.14.0",
|
"@typescript-eslint/eslint-plugin": "^5.14.0",
|
||||||
"eslint": "<8.0.0",
|
"eslint": "<8.0.0",
|
||||||
"eslint-config-next": "12.1.0",
|
"eslint-config-next": "12.1.0",
|
||||||
|
|||||||
@@ -2,10 +2,10 @@ import test, { expect } from '@playwright/test'
|
|||||||
import path from 'path'
|
import path from 'path'
|
||||||
import { importTypebotInDatabase } from '../services/database'
|
import { importTypebotInDatabase } from '../services/database'
|
||||||
import { typebotViewer } from '../services/selectorUtils'
|
import { typebotViewer } from '../services/selectorUtils'
|
||||||
import { generate } from 'short-uuid'
|
import cuid from 'cuid'
|
||||||
|
|
||||||
test('should work as expected', async ({ page }) => {
|
test('should work as expected', async ({ page }) => {
|
||||||
const typebotId = generate()
|
const typebotId = cuid()
|
||||||
await importTypebotInDatabase(
|
await importTypebotInDatabase(
|
||||||
path.join(__dirname, '../fixtures/typebots/hugeBlock.json'),
|
path.join(__dirname, '../fixtures/typebots/hugeBlock.json'),
|
||||||
{ id: typebotId, publicId: `${typebotId}-public` }
|
{ id: typebotId, publicId: `${typebotId}-public` }
|
||||||
|
|||||||
@@ -1,6 +1,5 @@
|
|||||||
import test, { expect } from '@playwright/test'
|
import test, { expect } from '@playwright/test'
|
||||||
import { createTypebots, parseDefaultBlockWithStep } from '../services/database'
|
import { createTypebots, parseDefaultBlockWithStep } from '../services/database'
|
||||||
import { generate } from 'short-uuid'
|
|
||||||
import {
|
import {
|
||||||
defaultSettings,
|
defaultSettings,
|
||||||
defaultTextInputOptions,
|
defaultTextInputOptions,
|
||||||
@@ -8,9 +7,10 @@ import {
|
|||||||
Metadata,
|
Metadata,
|
||||||
} from 'models'
|
} from 'models'
|
||||||
import { typebotViewer } from '../services/selectorUtils'
|
import { typebotViewer } from '../services/selectorUtils'
|
||||||
|
import cuid from 'cuid'
|
||||||
|
|
||||||
test('Should correctly parse metadata', async ({ page }) => {
|
test('Should correctly parse metadata', async ({ page }) => {
|
||||||
const typebotId = generate()
|
const typebotId = cuid()
|
||||||
const customMetadata: Metadata = {
|
const customMetadata: Metadata = {
|
||||||
description: 'My custom description',
|
description: 'My custom description',
|
||||||
title: 'Custom title',
|
title: 'Custom title',
|
||||||
|
|||||||
@@ -1,10 +1,10 @@
|
|||||||
import test, { expect } from '@playwright/test'
|
import test, { expect } from '@playwright/test'
|
||||||
import { createTypebots, parseDefaultBlockWithStep } from '../services/database'
|
import { createTypebots, parseDefaultBlockWithStep } from '../services/database'
|
||||||
import { generate } from 'short-uuid'
|
import cuid from 'cuid'
|
||||||
import { defaultSettings, defaultTextInputOptions, InputStepType } from 'models'
|
import { defaultSettings, defaultTextInputOptions, InputStepType } from 'models'
|
||||||
|
|
||||||
test('Result should be in storage by default', async ({ page }) => {
|
test('Result should be in storage by default', async ({ page }) => {
|
||||||
const typebotId = generate()
|
const typebotId = cuid()
|
||||||
await createTypebots([
|
await createTypebots([
|
||||||
{
|
{
|
||||||
id: typebotId,
|
id: typebotId,
|
||||||
@@ -28,7 +28,7 @@ test('Result should be in storage by default', async ({ page }) => {
|
|||||||
|
|
||||||
test.describe('Create result on page refresh enabled', () => {
|
test.describe('Create result on page refresh enabled', () => {
|
||||||
test('should work', async ({ page }) => {
|
test('should work', async ({ page }) => {
|
||||||
const typebotId = generate()
|
const typebotId = cuid()
|
||||||
await createTypebots([
|
await createTypebots([
|
||||||
{
|
{
|
||||||
id: typebotId,
|
id: typebotId,
|
||||||
|
|||||||
13
yarn.lock
13
yarn.lock
@@ -5108,11 +5108,6 @@ ansi-styles@^6.1.0:
|
|||||||
resolved "https://registry.yarnpkg.com/ansi-styles/-/ansi-styles-6.1.0.tgz#87313c102b8118abd57371afab34618bf7350ed3"
|
resolved "https://registry.yarnpkg.com/ansi-styles/-/ansi-styles-6.1.0.tgz#87313c102b8118abd57371afab34618bf7350ed3"
|
||||||
integrity sha512-VbqNsoz55SYGczauuup0MFUyXNQviSpFTj1RQtFzmQLk18qbVSpTFFGMT293rmDaQuKCT6InmbuEyUne4mTuxQ==
|
integrity sha512-VbqNsoz55SYGczauuup0MFUyXNQviSpFTj1RQtFzmQLk18qbVSpTFFGMT293rmDaQuKCT6InmbuEyUne4mTuxQ==
|
||||||
|
|
||||||
any-base@^1.1.0:
|
|
||||||
version "1.1.0"
|
|
||||||
resolved "https://registry.yarnpkg.com/any-base/-/any-base-1.1.0.tgz#ae101a62bc08a597b4c9ab5b7089d456630549fe"
|
|
||||||
integrity sha512-uMgjozySS8adZZYePpaWs8cxB9/kdzmpX6SgJZ+wbz1K5eYk5QMYDVJaZKhxyIHUdnnJkfR7SVgStgH7LkGUyg==
|
|
||||||
|
|
||||||
anymatch@^3.0.3, anymatch@~3.1.2:
|
anymatch@^3.0.3, anymatch@~3.1.2:
|
||||||
version "3.1.2"
|
version "3.1.2"
|
||||||
resolved "https://registry.yarnpkg.com/anymatch/-/anymatch-3.1.2.tgz#c0557c096af32f106198f4f4e2a383537e378716"
|
resolved "https://registry.yarnpkg.com/anymatch/-/anymatch-3.1.2.tgz#c0557c096af32f106198f4f4e2a383537e378716"
|
||||||
@@ -13832,14 +13827,6 @@ shelljs@^0.8.5:
|
|||||||
interpret "^1.0.0"
|
interpret "^1.0.0"
|
||||||
rechoir "^0.6.2"
|
rechoir "^0.6.2"
|
||||||
|
|
||||||
short-uuid@^4.2.0:
|
|
||||||
version "4.2.0"
|
|
||||||
resolved "https://registry.yarnpkg.com/short-uuid/-/short-uuid-4.2.0.tgz#3706d9e7287ac589dc5ffe324d3e34817a07540b"
|
|
||||||
integrity sha512-r3cxuPPZSuF0QkKsK9bBR7u+7cwuCRzWzgjPh07F5N2iIUNgblnMHepBY16xgj5t1lG9iOP9k/TEafY1qhRzaw==
|
|
||||||
dependencies:
|
|
||||||
any-base "^1.1.0"
|
|
||||||
uuid "^8.3.2"
|
|
||||||
|
|
||||||
side-channel@^1.0.4:
|
side-channel@^1.0.4:
|
||||||
version "1.0.4"
|
version "1.0.4"
|
||||||
resolved "https://registry.yarnpkg.com/side-channel/-/side-channel-1.0.4.tgz#efce5c8fdc104ee751b25c58d4290011fa5ea2cf"
|
resolved "https://registry.yarnpkg.com/side-channel/-/side-channel-1.0.4.tgz#efce5c8fdc104ee751b25c58d4290011fa5ea2cf"
|
||||||
|
|||||||
Reference in New Issue
Block a user