🚸 (dashboard) Add unpublish menu item in dashboard
Also remove the useless publishedTypebotId field in Typebot Closes #232
This commit is contained in:
@ -3,7 +3,6 @@
|
|||||||
"createdAt": "2022-03-22T14:33:05.037Z",
|
"createdAt": "2022-03-22T14:33:05.037Z",
|
||||||
"updatedAt": "2022-03-22T16:33:37.928Z",
|
"updatedAt": "2022-03-22T16:33:37.928Z",
|
||||||
"name": "Onboarding",
|
"name": "Onboarding",
|
||||||
"publishedTypebotId": "cl128n64i00092e69wenv1dlx",
|
|
||||||
"folderId": null,
|
"folderId": null,
|
||||||
"groups": [
|
"groups": [
|
||||||
{
|
{
|
||||||
|
@ -3,7 +3,6 @@
|
|||||||
"createdAt": "2022-03-22T14:33:05.037Z",
|
"createdAt": "2022-03-22T14:33:05.037Z",
|
||||||
"updatedAt": "2022-03-22T16:33:37.928Z",
|
"updatedAt": "2022-03-22T16:33:37.928Z",
|
||||||
"name": "Onboarding",
|
"name": "Onboarding",
|
||||||
"publishedTypebotId": "cl128n64i00092e69wenv1dlx",
|
|
||||||
"folderId": null,
|
"folderId": null,
|
||||||
"groups": [
|
"groups": [
|
||||||
{
|
{
|
||||||
|
@ -4,7 +4,6 @@
|
|||||||
"updatedAt": "2022-03-25T15:42:12.544Z",
|
"updatedAt": "2022-03-25T15:42:12.544Z",
|
||||||
"name": "Customer Support",
|
"name": "Customer Support",
|
||||||
"icon": "😍",
|
"icon": "😍",
|
||||||
"publishedTypebotId": null,
|
|
||||||
"folderId": null,
|
"folderId": null,
|
||||||
"groups": [
|
"groups": [
|
||||||
{
|
{
|
||||||
|
@ -4,7 +4,6 @@
|
|||||||
"updatedAt": "2022-05-31T12:31:12.867Z",
|
"updatedAt": "2022-05-31T12:31:12.867Z",
|
||||||
"icon": "🖼️",
|
"icon": "🖼️",
|
||||||
"name": "Digital Product Payment",
|
"name": "Digital Product Payment",
|
||||||
"publishedTypebotId": null,
|
|
||||||
"folderId": null,
|
"folderId": null,
|
||||||
"groups": [
|
"groups": [
|
||||||
{
|
{
|
||||||
|
@ -4,7 +4,6 @@
|
|||||||
"updatedAt": "2022-10-13T06:27:31.951Z",
|
"updatedAt": "2022-10-13T06:27:31.951Z",
|
||||||
"icon": "💬",
|
"icon": "💬",
|
||||||
"name": "FAQ",
|
"name": "FAQ",
|
||||||
"publishedTypebotId": null,
|
|
||||||
"folderId": null,
|
"folderId": null,
|
||||||
"groups": [
|
"groups": [
|
||||||
{
|
{
|
||||||
|
@ -4,7 +4,6 @@
|
|||||||
"updatedAt": "2022-02-05T06:21:16.522Z",
|
"updatedAt": "2022-02-05T06:21:16.522Z",
|
||||||
"name": "Lead Generation",
|
"name": "Lead Generation",
|
||||||
"icon": "🤝",
|
"icon": "🤝",
|
||||||
"publishedTypebotId": null,
|
|
||||||
"folderId": null,
|
"folderId": null,
|
||||||
"groups": [
|
"groups": [
|
||||||
{
|
{
|
||||||
|
@ -4,7 +4,6 @@
|
|||||||
"updatedAt": "2022-04-09T22:35:22.449Z",
|
"updatedAt": "2022-04-09T22:35:22.449Z",
|
||||||
"icon": "🏆",
|
"icon": "🏆",
|
||||||
"name": "Lead Scoring",
|
"name": "Lead Scoring",
|
||||||
"publishedTypebotId": null,
|
|
||||||
"folderId": null,
|
"folderId": null,
|
||||||
"groups": [
|
"groups": [
|
||||||
{
|
{
|
||||||
|
@ -4,7 +4,6 @@
|
|||||||
"updatedAt": "2022-04-08T23:03:34.726Z",
|
"updatedAt": "2022-04-08T23:03:34.726Z",
|
||||||
"icon": "🕹️",
|
"icon": "🕹️",
|
||||||
"name": "Digital Marketing Quiz",
|
"name": "Digital Marketing Quiz",
|
||||||
"publishedTypebotId": null,
|
|
||||||
"folderId": null,
|
"folderId": null,
|
||||||
"groups": [
|
"groups": [
|
||||||
{
|
{
|
||||||
|
@ -12,7 +12,6 @@ export type NewTypebotProps = Omit<
|
|||||||
| 'createdAt'
|
| 'createdAt'
|
||||||
| 'updatedAt'
|
| 'updatedAt'
|
||||||
| 'id'
|
| 'id'
|
||||||
| 'publishedTypebotId'
|
|
||||||
| 'publicId'
|
| 'publicId'
|
||||||
| 'customDomain'
|
| 'customDomain'
|
||||||
| 'icon'
|
| 'icon'
|
||||||
|
@ -56,7 +56,6 @@ const duplicateTypebot = (
|
|||||||
...typebot,
|
...typebot,
|
||||||
id,
|
id,
|
||||||
name: `${typebot.name} copy`,
|
name: `${typebot.name} copy`,
|
||||||
publishedTypebotId: null,
|
|
||||||
publicId: null,
|
publicId: null,
|
||||||
customDomain: null,
|
customDomain: null,
|
||||||
groups: typebot.groups.map((b) => ({
|
groups: typebot.groups.map((b) => ({
|
||||||
|
@ -1,6 +1,5 @@
|
|||||||
import { Typebot } from 'models'
|
import { Typebot } from 'models'
|
||||||
|
|
||||||
export type TypebotInDashboard = Pick<
|
export type TypebotInDashboard = Pick<Typebot, 'id' | 'name' | 'icon'> & {
|
||||||
Typebot,
|
publishedTypebotId?: string
|
||||||
'id' | 'name' | 'publishedTypebotId' | 'icon'
|
}
|
||||||
>
|
|
||||||
|
@ -18,7 +18,7 @@ import { RightPanel, useEditor } from '../../providers/EditorProvider'
|
|||||||
import { useTypebot } from '../../providers/TypebotProvider'
|
import { useTypebot } from '../../providers/TypebotProvider'
|
||||||
import { useRouter } from 'next/router'
|
import { useRouter } from 'next/router'
|
||||||
import React, { useState } from 'react'
|
import React, { useState } from 'react'
|
||||||
import { isNotDefined } from 'utils'
|
import { isDefined, isNotDefined } from 'utils'
|
||||||
import { EditableTypebotName } from './EditableTypebotName'
|
import { EditableTypebotName } from './EditableTypebotName'
|
||||||
import { getBubbleActions } from 'typebot-js'
|
import { getBubbleActions } from 'typebot-js'
|
||||||
import Link from 'next/link'
|
import Link from 'next/link'
|
||||||
@ -34,6 +34,7 @@ export const TypebotHeader = () => {
|
|||||||
const router = useRouter()
|
const router = useRouter()
|
||||||
const {
|
const {
|
||||||
typebot,
|
typebot,
|
||||||
|
publishedTypebot,
|
||||||
updateTypebot,
|
updateTypebot,
|
||||||
save,
|
save,
|
||||||
undo,
|
undo,
|
||||||
@ -126,7 +127,7 @@ export const TypebotHeader = () => {
|
|||||||
>
|
>
|
||||||
Share
|
Share
|
||||||
</Button>
|
</Button>
|
||||||
{typebot?.publishedTypebotId && (
|
{isDefined(publishedTypebot) && (
|
||||||
<Button
|
<Button
|
||||||
as={Link}
|
as={Link}
|
||||||
href={`/typebots/${typebot?.id}/results`}
|
href={`/typebots/${typebot?.id}/results`}
|
||||||
|
@ -16,14 +16,13 @@ import {
|
|||||||
useMemo,
|
useMemo,
|
||||||
useState,
|
useState,
|
||||||
} from 'react'
|
} from 'react'
|
||||||
import { isDefined, isNotDefined, omit } from 'utils'
|
import { isDefined, omit } from 'utils'
|
||||||
import { edgesAction, EdgesActions } from './actions/edges'
|
import { edgesAction, EdgesActions } from './actions/edges'
|
||||||
import { itemsAction, ItemsActions } from './actions/items'
|
import { itemsAction, ItemsActions } from './actions/items'
|
||||||
import { GroupsActions, groupsActions } from './actions/groups'
|
import { GroupsActions, groupsActions } from './actions/groups'
|
||||||
import { blocksAction, BlocksActions } from './actions/blocks'
|
import { blocksAction, BlocksActions } from './actions/blocks'
|
||||||
import { variablesAction, VariablesActions } from './actions/variables'
|
import { variablesAction, VariablesActions } from './actions/variables'
|
||||||
import { dequal } from 'dequal'
|
import { dequal } from 'dequal'
|
||||||
import cuid from 'cuid'
|
|
||||||
import { useToast } from '@/hooks/useToast'
|
import { useToast } from '@/hooks/useToast'
|
||||||
import { useTypebotQuery } from '@/hooks/useTypebotQuery'
|
import { useTypebotQuery } from '@/hooks/useTypebotQuery'
|
||||||
import useUndo from '../../hooks/useUndo'
|
import useUndo from '../../hooks/useUndo'
|
||||||
@ -52,7 +51,6 @@ type UpdateTypebotPayload = Partial<{
|
|||||||
settings: Settings
|
settings: Settings
|
||||||
publicId: string
|
publicId: string
|
||||||
name: string
|
name: string
|
||||||
publishedTypebotId: string
|
|
||||||
icon: string
|
icon: string
|
||||||
customDomain: string
|
customDomain: string
|
||||||
resultsTablePreferences: ResultsTablePreferences
|
resultsTablePreferences: ResultsTablePreferences
|
||||||
@ -254,17 +252,12 @@ export const TypebotProvider = ({
|
|||||||
|
|
||||||
const publishTypebot = async () => {
|
const publishTypebot = async () => {
|
||||||
if (!localTypebot) return
|
if (!localTypebot) return
|
||||||
const publishedTypebotId = cuid()
|
|
||||||
const newLocalTypebot = { ...localTypebot }
|
const newLocalTypebot = { ...localTypebot }
|
||||||
if (publishedTypebot && isNotDefined(localTypebot.publishedTypebotId)) {
|
|
||||||
updateLocalTypebot({ publishedTypebotId: publishedTypebot.id })
|
|
||||||
await saveTypebot()
|
|
||||||
}
|
|
||||||
if (!publishedTypebot) {
|
if (!publishedTypebot) {
|
||||||
const newPublicId =
|
const newPublicId =
|
||||||
localTypebot.publicId ??
|
localTypebot.publicId ??
|
||||||
parseDefaultPublicId(localTypebot.name, localTypebot.id)
|
parseDefaultPublicId(localTypebot.name, localTypebot.id)
|
||||||
updateLocalTypebot({ publicId: newPublicId, publishedTypebotId })
|
updateLocalTypebot({ publicId: newPublicId })
|
||||||
newLocalTypebot.publicId = newPublicId
|
newLocalTypebot.publicId = newPublicId
|
||||||
await saveTypebot()
|
await saveTypebot()
|
||||||
}
|
}
|
||||||
@ -277,8 +270,7 @@ export const TypebotProvider = ({
|
|||||||
setIsPublishing(true)
|
setIsPublishing(true)
|
||||||
const { data, error } = await createPublishedTypebotQuery(
|
const { data, error } = await createPublishedTypebotQuery(
|
||||||
{
|
{
|
||||||
...parseTypebotToPublicTypebot(newLocalTypebot),
|
...omit(parseTypebotToPublicTypebot(newLocalTypebot), 'id'),
|
||||||
id: publishedTypebotId,
|
|
||||||
},
|
},
|
||||||
localTypebot.workspaceId
|
localTypebot.workspaceId
|
||||||
)
|
)
|
||||||
|
@ -104,7 +104,7 @@ export const FolderContent = ({ folder }: Props) => {
|
|||||||
if (newFolder) mutateFolders({ folders: [...folders, newFolder] })
|
if (newFolder) mutateFolders({ folders: [...folders, newFolder] })
|
||||||
}
|
}
|
||||||
|
|
||||||
const handleTypebotDeleted = () => {
|
const handleTypebotUpdated = () => {
|
||||||
if (!typebots) return
|
if (!typebots) return
|
||||||
refetchTypebots()
|
refetchTypebots()
|
||||||
}
|
}
|
||||||
@ -208,7 +208,7 @@ export const FolderContent = ({ folder }: Props) => {
|
|||||||
<TypebotButton
|
<TypebotButton
|
||||||
key={typebot.id.toString()}
|
key={typebot.id.toString()}
|
||||||
typebot={typebot}
|
typebot={typebot}
|
||||||
onTypebotDeleted={handleTypebotDeleted}
|
onTypebotUpdated={handleTypebotUpdated}
|
||||||
onMouseDown={handleMouseDown(typebot)}
|
onMouseDown={handleMouseDown(typebot)}
|
||||||
/>
|
/>
|
||||||
))}
|
))}
|
||||||
|
@ -13,7 +13,6 @@ import {
|
|||||||
import { useRouter } from 'next/router'
|
import { useRouter } from 'next/router'
|
||||||
import { ConfirmModal } from '@/components/ConfirmModal'
|
import { ConfirmModal } from '@/components/ConfirmModal'
|
||||||
import { GripIcon } from '@/components/icons'
|
import { GripIcon } from '@/components/icons'
|
||||||
import { Typebot } from 'models'
|
|
||||||
import { useTypebotDnd } from '../TypebotDndProvider'
|
import { useTypebotDnd } from '../TypebotDndProvider'
|
||||||
import { useDebounce } from 'use-debounce'
|
import { useDebounce } from 'use-debounce'
|
||||||
import { Plan } from 'db'
|
import { Plan } from 'db'
|
||||||
@ -24,23 +23,25 @@ import {
|
|||||||
getTypebotQuery,
|
getTypebotQuery,
|
||||||
deleteTypebotQuery,
|
deleteTypebotQuery,
|
||||||
importTypebotQuery,
|
importTypebotQuery,
|
||||||
|
TypebotInDashboard,
|
||||||
} from '@/features/dashboard'
|
} from '@/features/dashboard'
|
||||||
import { MoreButton } from './MoreButton'
|
import { MoreButton } from './MoreButton'
|
||||||
import { EmojiOrImageIcon } from '@/components/EmojiOrImageIcon'
|
import { EmojiOrImageIcon } from '@/components/EmojiOrImageIcon'
|
||||||
|
import { deletePublishedTypebotQuery } from '@/features/publish/queries/deletePublishedTypebotQuery'
|
||||||
|
|
||||||
type ChatbotCardProps = {
|
type Props = {
|
||||||
typebot: Pick<Typebot, 'id' | 'publishedTypebotId' | 'name' | 'icon'>
|
typebot: TypebotInDashboard
|
||||||
isReadOnly?: boolean
|
isReadOnly?: boolean
|
||||||
onTypebotDeleted?: () => void
|
onTypebotUpdated: () => void
|
||||||
onMouseDown?: (e: React.MouseEvent<HTMLButtonElement>) => void
|
onMouseDown?: (e: React.MouseEvent<HTMLButtonElement>) => void
|
||||||
}
|
}
|
||||||
|
|
||||||
export const TypebotButton = ({
|
export const TypebotButton = ({
|
||||||
typebot,
|
typebot,
|
||||||
onTypebotDeleted,
|
|
||||||
isReadOnly = false,
|
isReadOnly = false,
|
||||||
|
onTypebotUpdated,
|
||||||
onMouseDown,
|
onMouseDown,
|
||||||
}: ChatbotCardProps) => {
|
}: Props) => {
|
||||||
const router = useRouter()
|
const router = useRouter()
|
||||||
const { workspace } = useWorkspace()
|
const { workspace } = useWorkspace()
|
||||||
const { draggedTypebot } = useTypebotDnd()
|
const { draggedTypebot } = useTypebotDnd()
|
||||||
@ -70,7 +71,7 @@ export const TypebotButton = ({
|
|||||||
title: "Couldn't delete typebot",
|
title: "Couldn't delete typebot",
|
||||||
description: error.message,
|
description: error.message,
|
||||||
})
|
})
|
||||||
if (onTypebotDeleted) onTypebotDeleted()
|
onTypebotUpdated()
|
||||||
}
|
}
|
||||||
|
|
||||||
const handleDuplicateClick = async (e: React.MouseEvent) => {
|
const handleDuplicateClick = async (e: React.MouseEvent) => {
|
||||||
@ -95,6 +96,17 @@ export const TypebotButton = ({
|
|||||||
onDeleteOpen()
|
onDeleteOpen()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const handleUnpublishClick = async (e: React.MouseEvent) => {
|
||||||
|
e.stopPropagation()
|
||||||
|
if (!typebot.publishedTypebotId) return
|
||||||
|
const { error } = await deletePublishedTypebotQuery({
|
||||||
|
publishedTypebotId: typebot.publishedTypebotId,
|
||||||
|
typebotId: typebot.id,
|
||||||
|
})
|
||||||
|
if (error) showToast({ description: error.message })
|
||||||
|
else onTypebotUpdated()
|
||||||
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Button
|
<Button
|
||||||
as={WrapItem}
|
as={WrapItem}
|
||||||
@ -143,6 +155,9 @@ export const TypebotButton = ({
|
|||||||
right="20px"
|
right="20px"
|
||||||
aria-label={`Show ${typebot.name} menu`}
|
aria-label={`Show ${typebot.name} menu`}
|
||||||
>
|
>
|
||||||
|
{typebot.publishedTypebotId && (
|
||||||
|
<MenuItem onClick={handleUnpublishClick}>Unpublish</MenuItem>
|
||||||
|
)}
|
||||||
<MenuItem onClick={handleDuplicateClick}>Duplicate</MenuItem>
|
<MenuItem onClick={handleDuplicateClick}>Duplicate</MenuItem>
|
||||||
<MenuItem color="red" onClick={handleDeleteClick}>
|
<MenuItem color="red" onClick={handleDeleteClick}>
|
||||||
Delete
|
Delete
|
||||||
|
@ -29,7 +29,7 @@ import { integrationsList } from './embeds/EmbedButton'
|
|||||||
|
|
||||||
export const SharePage = () => {
|
export const SharePage = () => {
|
||||||
const { workspace } = useWorkspace()
|
const { workspace } = useWorkspace()
|
||||||
const { typebot, updateTypebot } = useTypebot()
|
const { typebot, updateTypebot, publishedTypebot } = useTypebot()
|
||||||
const { showToast } = useToast()
|
const { showToast } = useToast()
|
||||||
|
|
||||||
const handlePublicIdChange = async (publicId: string) => {
|
const handlePublicIdChange = async (publicId: string) => {
|
||||||
@ -39,7 +39,7 @@ export const SharePage = () => {
|
|||||||
const publicId = typebot
|
const publicId = typebot
|
||||||
? typebot?.publicId ?? parseDefaultPublicId(typebot.name, typebot.id)
|
? typebot?.publicId ?? parseDefaultPublicId(typebot.name, typebot.id)
|
||||||
: ''
|
: ''
|
||||||
const isPublished = isDefined(typebot?.publishedTypebotId)
|
const isPublished = isDefined(publishedTypebot)
|
||||||
|
|
||||||
const handlePathnameChange = (pathname: string) => {
|
const handlePathnameChange = (pathname: string) => {
|
||||||
if (!typebot?.customDomain) return
|
if (!typebot?.customDomain) return
|
||||||
|
@ -2,7 +2,7 @@ import { PublicTypebot } from 'models'
|
|||||||
import { sendRequest } from 'utils'
|
import { sendRequest } from 'utils'
|
||||||
|
|
||||||
export const createPublishedTypebotQuery = async (
|
export const createPublishedTypebotQuery = async (
|
||||||
typebot: PublicTypebot,
|
typebot: Omit<PublicTypebot, 'id'>,
|
||||||
workspaceId: string
|
workspaceId: string
|
||||||
) =>
|
) =>
|
||||||
sendRequest<PublicTypebot>({
|
sendRequest<PublicTypebot>({
|
||||||
|
@ -20,7 +20,6 @@ export const parsePublicTypebotToTypebot = (
|
|||||||
customDomain: existingTypebot.customDomain,
|
customDomain: existingTypebot.customDomain,
|
||||||
createdAt: existingTypebot.createdAt,
|
createdAt: existingTypebot.createdAt,
|
||||||
updatedAt: existingTypebot.updatedAt,
|
updatedAt: existingTypebot.updatedAt,
|
||||||
publishedTypebotId: typebot.id,
|
|
||||||
folderId: existingTypebot.folderId,
|
folderId: existingTypebot.folderId,
|
||||||
icon: existingTypebot.icon,
|
icon: existingTypebot.icon,
|
||||||
workspaceId: existingTypebot.workspaceId,
|
workspaceId: existingTypebot.workspaceId,
|
||||||
|
@ -2,7 +2,8 @@ import prisma from '@/lib/prisma'
|
|||||||
import { authenticatedProcedure } from '@/utils/server/trpc'
|
import { authenticatedProcedure } from '@/utils/server/trpc'
|
||||||
import { TRPCError } from '@trpc/server'
|
import { TRPCError } from '@trpc/server'
|
||||||
import { WorkspaceRole } from 'db'
|
import { WorkspaceRole } from 'db'
|
||||||
import { Typebot, typebotSchema } from 'models'
|
import { PublicTypebot, Typebot, typebotSchema } from 'models'
|
||||||
|
import { omit } from 'utils'
|
||||||
import { z } from 'zod'
|
import { z } from 'zod'
|
||||||
|
|
||||||
export const listTypebotsProcedure = authenticatedProcedure
|
export const listTypebotsProcedure = authenticatedProcedure
|
||||||
@ -19,12 +20,13 @@ export const listTypebotsProcedure = authenticatedProcedure
|
|||||||
.output(
|
.output(
|
||||||
z.object({
|
z.object({
|
||||||
typebots: z.array(
|
typebots: z.array(
|
||||||
typebotSchema.pick({
|
typebotSchema
|
||||||
name: true,
|
.pick({
|
||||||
icon: true,
|
name: true,
|
||||||
id: true,
|
icon: true,
|
||||||
publishedTypebotId: true,
|
id: true,
|
||||||
})
|
})
|
||||||
|
.and(z.object({ publishedTypebotId: z.string().optional() }))
|
||||||
),
|
),
|
||||||
})
|
})
|
||||||
)
|
)
|
||||||
@ -58,11 +60,23 @@ export const listTypebotsProcedure = authenticatedProcedure
|
|||||||
],
|
],
|
||||||
},
|
},
|
||||||
orderBy: { createdAt: 'desc' },
|
orderBy: { createdAt: 'desc' },
|
||||||
select: { name: true, publishedTypebotId: true, id: true, icon: true },
|
select: {
|
||||||
})) as Pick<Typebot, 'name' | 'id' | 'icon' | 'publishedTypebotId'>[]
|
name: true,
|
||||||
|
publishedTypebot: { select: { id: true } },
|
||||||
|
id: true,
|
||||||
|
icon: true,
|
||||||
|
},
|
||||||
|
})) as (Pick<Typebot, 'name' | 'id' | 'icon'> & {
|
||||||
|
publishedTypebot: Pick<PublicTypebot, 'id'>
|
||||||
|
})[]
|
||||||
|
|
||||||
if (!typebots)
|
if (!typebots)
|
||||||
throw new TRPCError({ code: 'NOT_FOUND', message: 'No typebots found' })
|
throw new TRPCError({ code: 'NOT_FOUND', message: 'No typebots found' })
|
||||||
|
|
||||||
return { typebots }
|
return {
|
||||||
|
typebots: typebots.map((typebot) => ({
|
||||||
|
publishedTypebotId: typebot.publishedTypebot?.id,
|
||||||
|
...omit(typebot, 'publishedTypebot'),
|
||||||
|
})),
|
||||||
|
}
|
||||||
})
|
})
|
||||||
|
@ -80,7 +80,7 @@ test('can update workspace info', async ({ page }) => {
|
|||||||
await page.fill('input[value="Pro workspace"]', 'My awesome workspace')
|
await page.fill('input[value="Pro workspace"]', 'My awesome workspace')
|
||||||
await page.getByTestId('typebot-logo').click({ force: true })
|
await page.getByTestId('typebot-logo').click({ force: true })
|
||||||
await expect(
|
await expect(
|
||||||
page.getByRole('button', { name: '🏦 My awesome workspace Pro' })
|
page.getByRole('button', { name: 'My awesome workspace Pro' })
|
||||||
).toBeVisible()
|
).toBeVisible()
|
||||||
})
|
})
|
||||||
|
|
||||||
|
@ -14,7 +14,7 @@ const handler = async (req: NextApiRequest, res: NextApiResponse) => {
|
|||||||
if (!workspaceId) return badRequest(res, 'workspaceId is required')
|
if (!workspaceId) return badRequest(res, 'workspaceId is required')
|
||||||
const data = (
|
const data = (
|
||||||
typeof req.body === 'string' ? JSON.parse(req.body) : req.body
|
typeof req.body === 'string' ? JSON.parse(req.body) : req.body
|
||||||
) as PublicTypebot
|
) as Omit<PublicTypebot, 'id'>
|
||||||
const typebotContainsFileInput = data.groups
|
const typebotContainsFileInput = data.groups
|
||||||
.flatMap((g) => g.blocks)
|
.flatMap((g) => g.blocks)
|
||||||
.some((b) => b.type === InputBlockType.FILE)
|
.some((b) => b.type === InputBlockType.FILE)
|
||||||
|
@ -77,7 +77,7 @@ const handler = async (req: NextApiRequest, res: NextApiResponse) => {
|
|||||||
],
|
],
|
||||||
},
|
},
|
||||||
orderBy: { createdAt: 'desc' },
|
orderBy: { createdAt: 'desc' },
|
||||||
select: { name: true, publishedTypebotId: true, id: true, icon: true },
|
select: { name: true, id: true, icon: true },
|
||||||
})
|
})
|
||||||
return res.send({ typebots })
|
return res.send({ typebots })
|
||||||
}
|
}
|
||||||
|
@ -3,7 +3,6 @@
|
|||||||
"createdAt": "2022-02-05T06:21:16.522Z",
|
"createdAt": "2022-02-05T06:21:16.522Z",
|
||||||
"updatedAt": "2022-02-05T06:21:16.522Z",
|
"updatedAt": "2022-02-05T06:21:16.522Z",
|
||||||
"name": "My typebot",
|
"name": "My typebot",
|
||||||
"publishedTypebotId": null,
|
|
||||||
"folderId": null,
|
"folderId": null,
|
||||||
"groups": [
|
"groups": [
|
||||||
{
|
{
|
||||||
|
@ -4,7 +4,6 @@
|
|||||||
"updatedAt": "2022-12-23T09:04:36.750Z",
|
"updatedAt": "2022-12-23T09:04:36.750Z",
|
||||||
"icon": null,
|
"icon": null,
|
||||||
"name": "My typebot copy",
|
"name": "My typebot copy",
|
||||||
"publishedTypebotId": null,
|
|
||||||
"folderId": null,
|
"folderId": null,
|
||||||
"groups": [
|
"groups": [
|
||||||
{
|
{
|
||||||
|
@ -4,7 +4,6 @@
|
|||||||
"updatedAt": "2022-06-02T07:34:02.336Z",
|
"updatedAt": "2022-06-02T07:34:02.336Z",
|
||||||
"icon": null,
|
"icon": null,
|
||||||
"name": "My typebot",
|
"name": "My typebot",
|
||||||
"publishedTypebotId": null,
|
|
||||||
"folderId": null,
|
"folderId": null,
|
||||||
"groups": [
|
"groups": [
|
||||||
{
|
{
|
||||||
|
@ -4,7 +4,6 @@
|
|||||||
"updatedAt": "2022-06-15T15:36:44.821Z",
|
"updatedAt": "2022-06-15T15:36:44.821Z",
|
||||||
"icon": null,
|
"icon": null,
|
||||||
"name": "My typebot",
|
"name": "My typebot",
|
||||||
"publishedTypebotId": null,
|
|
||||||
"folderId": null,
|
"folderId": null,
|
||||||
"groups": [
|
"groups": [
|
||||||
{
|
{
|
||||||
|
@ -3,7 +3,6 @@
|
|||||||
"createdAt": "2022-03-21T15:01:46.107Z",
|
"createdAt": "2022-03-21T15:01:46.107Z",
|
||||||
"updatedAt": "2022-03-21T15:03:07.312Z",
|
"updatedAt": "2022-03-21T15:03:07.312Z",
|
||||||
"name": "My typebot",
|
"name": "My typebot",
|
||||||
"publishedTypebotId": null,
|
|
||||||
"folderId": null,
|
"folderId": null,
|
||||||
"groups": [
|
"groups": [
|
||||||
{
|
{
|
||||||
|
@ -3,7 +3,6 @@
|
|||||||
"createdAt": "2022-02-04T13:40:19.455Z",
|
"createdAt": "2022-02-04T13:40:19.455Z",
|
||||||
"updatedAt": "2022-02-04T13:40:19.455Z",
|
"updatedAt": "2022-02-04T13:40:19.455Z",
|
||||||
"name": "My typebot",
|
"name": "My typebot",
|
||||||
"publishedTypebotId": null,
|
|
||||||
"folderId": null,
|
"folderId": null,
|
||||||
"groups": [
|
"groups": [
|
||||||
{
|
{
|
||||||
|
@ -3,7 +3,6 @@
|
|||||||
"createdAt": "2022-02-04T13:40:19.455Z",
|
"createdAt": "2022-02-04T13:40:19.455Z",
|
||||||
"updatedAt": "2022-02-04T13:40:19.455Z",
|
"updatedAt": "2022-02-04T13:40:19.455Z",
|
||||||
"name": "My typebot",
|
"name": "My typebot",
|
||||||
"publishedTypebotId": null,
|
|
||||||
"folderId": null,
|
"folderId": null,
|
||||||
"groups": [
|
"groups": [
|
||||||
{
|
{
|
||||||
|
@ -3,7 +3,6 @@
|
|||||||
"createdAt": "2022-02-07T10:06:35.274Z",
|
"createdAt": "2022-02-07T10:06:35.274Z",
|
||||||
"updatedAt": "2022-02-07T10:06:35.274Z",
|
"updatedAt": "2022-02-07T10:06:35.274Z",
|
||||||
"name": "My typebot",
|
"name": "My typebot",
|
||||||
"publishedTypebotId": null,
|
|
||||||
"folderId": null,
|
"folderId": null,
|
||||||
"groups": [
|
"groups": [
|
||||||
{
|
{
|
||||||
|
@ -3,7 +3,6 @@
|
|||||||
"createdAt": "2022-02-04T13:44:30.386Z",
|
"createdAt": "2022-02-04T13:44:30.386Z",
|
||||||
"updatedAt": "2022-02-04T13:44:30.386Z",
|
"updatedAt": "2022-02-04T13:44:30.386Z",
|
||||||
"name": "My typebot",
|
"name": "My typebot",
|
||||||
"publishedTypebotId": null,
|
|
||||||
"folderId": null,
|
"folderId": null,
|
||||||
"groups": [
|
"groups": [
|
||||||
{
|
{
|
||||||
|
@ -3,7 +3,6 @@
|
|||||||
"createdAt": "2022-02-04T13:47:42.459Z",
|
"createdAt": "2022-02-04T13:47:42.459Z",
|
||||||
"updatedAt": "2022-02-04T13:47:42.459Z",
|
"updatedAt": "2022-02-04T13:47:42.459Z",
|
||||||
"name": "My typebot",
|
"name": "My typebot",
|
||||||
"publishedTypebotId": null,
|
|
||||||
"folderId": null,
|
"folderId": null,
|
||||||
"groups": [
|
"groups": [
|
||||||
{
|
{
|
||||||
|
@ -3,7 +3,6 @@
|
|||||||
"createdAt": "2022-03-09T07:01:25.917Z",
|
"createdAt": "2022-03-09T07:01:25.917Z",
|
||||||
"updatedAt": "2022-03-09T07:01:25.917Z",
|
"updatedAt": "2022-03-09T07:01:25.917Z",
|
||||||
"name": "My typebot",
|
"name": "My typebot",
|
||||||
"publishedTypebotId": null,
|
|
||||||
"folderId": null,
|
"folderId": null,
|
||||||
"groups": [
|
"groups": [
|
||||||
{
|
{
|
||||||
|
@ -3,7 +3,6 @@
|
|||||||
"createdAt": "2022-03-08T17:18:50.337Z",
|
"createdAt": "2022-03-08T17:18:50.337Z",
|
||||||
"updatedAt": "2022-03-08T21:05:28.825Z",
|
"updatedAt": "2022-03-08T21:05:28.825Z",
|
||||||
"name": "Another typebot",
|
"name": "Another typebot",
|
||||||
"publishedTypebotId": null,
|
|
||||||
"folderId": null,
|
"folderId": null,
|
||||||
"groups": [
|
"groups": [
|
||||||
{
|
{
|
||||||
|
@ -3,7 +3,6 @@
|
|||||||
"createdAt": "2022-02-04T14:14:21.394Z",
|
"createdAt": "2022-02-04T14:14:21.394Z",
|
||||||
"updatedAt": "2022-02-04T14:14:21.394Z",
|
"updatedAt": "2022-02-04T14:14:21.394Z",
|
||||||
"name": "My typebot",
|
"name": "My typebot",
|
||||||
"publishedTypebotId": null,
|
|
||||||
"folderId": null,
|
"folderId": null,
|
||||||
"groups": [
|
"groups": [
|
||||||
{
|
{
|
||||||
|
@ -3,7 +3,6 @@
|
|||||||
"createdAt": "2022-02-04T14:14:21.394Z",
|
"createdAt": "2022-02-04T14:14:21.394Z",
|
||||||
"updatedAt": "2022-02-04T14:14:21.394Z",
|
"updatedAt": "2022-02-04T14:14:21.394Z",
|
||||||
"name": "My typebot",
|
"name": "My typebot",
|
||||||
"publishedTypebotId": null,
|
|
||||||
"folderId": null,
|
"folderId": null,
|
||||||
"groups": [
|
"groups": [
|
||||||
{
|
{
|
||||||
|
@ -4,7 +4,6 @@
|
|||||||
"updatedAt": "2022-10-17T20:14:48.231Z",
|
"updatedAt": "2022-10-17T20:14:48.231Z",
|
||||||
"icon": null,
|
"icon": null,
|
||||||
"name": "My typebot copy",
|
"name": "My typebot copy",
|
||||||
"publishedTypebotId": null,
|
|
||||||
"folderId": null,
|
"folderId": null,
|
||||||
"groups": [
|
"groups": [
|
||||||
{
|
{
|
||||||
|
@ -1 +1,129 @@
|
|||||||
{"id":"clddbpdus00011asqclyl0vlw","createdAt":"2023-01-26T16:42:16.803Z","updatedAt":"2023-01-26T16:48:53.712Z","icon":null,"name":"My typebot","publishedTypebotId":null,"folderId":null,"groups":[{"id":"clddbpduq002ssq1a2h622bw0","title":"Start","blocks":[{"id":"clddbpduq002tsq1aghl4dh31","type":"start","label":"Start","groupId":"clddbpduq002ssq1a2h622bw0","outgoingEdgeId":"clddbq3yp000l3b6ss15lu48v"}],"graphCoordinates":{"x":0,"y":0}},{"id":"clddbpito000e3b6spz6qqipa","title":"Group #1","blocks":[{"id":"clddbpito000f3b6srs0cizys","type":"choice input","items":[{"id":"clddbpito000g3b6snvioor95","type":0,"blockId":"clddbpito000f3b6srs0cizys","content":"Wait now"}],"groupId":"clddbpito000e3b6spz6qqipa","options":{"buttonLabel":"Send","isMultipleChoice":false}},{"id":"clddbw55x000m3b6svz34enqq","groupId":"clddbpito000e3b6spz6qqipa","type":"Wait","options":{"secondsToWaitFor":""},"outgoingEdgeId":"clddbw6l4000n3b6st6le0hu9"}],"graphCoordinates":{"x":357.49609375,"y":148.40625}},{"id":"clddbpwh9000i3b6s9e1vdjrd","title":"Group #2","blocks":[{"id":"clddbpwh9000j3b6srnzdpbcx","type":"text","content":{"html":"<div>Hi there!</div>","richText":[{"type":"p","children":[{"text":"Hi there!"}]}],"plainText":"Hi there!"},"groupId":"clddbpwh9000i3b6s9e1vdjrd"}],"graphCoordinates":{"x":545.25,"y":447.36328125}}],"variables":[],"edges":[{"id":"clddbq3yp000l3b6ss15lu48v","to":{"groupId":"clddbpito000e3b6spz6qqipa"},"from":{"blockId":"clddbpduq002tsq1aghl4dh31","groupId":"clddbpduq002ssq1a2h622bw0"}},{"from":{"groupId":"clddbpito000e3b6spz6qqipa","blockId":"clddbw55x000m3b6svz34enqq"},"to":{"groupId":"clddbpwh9000i3b6s9e1vdjrd"},"id":"clddbw6l4000n3b6st6le0hu9"}],"theme":{"chat":{"inputs":{"color":"#303235","backgroundColor":"#FFFFFF","placeholderColor":"#9095A0"},"buttons":{"color":"#FFFFFF","backgroundColor":"#0042DA"},"hostAvatar":{"url":"https://avatars.githubusercontent.com/u/16015833?v=4","isEnabled":true},"hostBubbles":{"color":"#303235","backgroundColor":"#F7F8FF"},"guestBubbles":{"color":"#FFFFFF","backgroundColor":"#FF8E21"}},"general":{"font":"Open Sans","background":{"type":"Color","content":"#ffffff"}}},"settings":{"general":{"isBrandingEnabled":false,"isInputPrefillEnabled":true,"isResultSavingEnabled":true,"isHideQueryParamsEnabled":true,"isNewResultOnRefreshEnabled":false},"metadata":{"description":"Build beautiful conversational forms and embed them directly in your applications without a line of code. Triple your response rate and collect answers that has more value compared to a traditional form."},"typingEmulation":{"speed":300,"enabled":true,"maxDelay":1.5}},"publicId":null,"customDomain":null,"workspaceId":"proWorkspace","resultsTablePreferences":null,"isArchived":false,"isClosed":false}
|
{
|
||||||
|
"id": "clddbpdus00011asqclyl0vlw",
|
||||||
|
"createdAt": "2023-01-26T16:42:16.803Z",
|
||||||
|
"updatedAt": "2023-01-26T16:48:53.712Z",
|
||||||
|
"icon": null,
|
||||||
|
"name": "My typebot",
|
||||||
|
"folderId": null,
|
||||||
|
"groups": [
|
||||||
|
{
|
||||||
|
"id": "clddbpduq002ssq1a2h622bw0",
|
||||||
|
"title": "Start",
|
||||||
|
"blocks": [
|
||||||
|
{
|
||||||
|
"id": "clddbpduq002tsq1aghl4dh31",
|
||||||
|
"type": "start",
|
||||||
|
"label": "Start",
|
||||||
|
"groupId": "clddbpduq002ssq1a2h622bw0",
|
||||||
|
"outgoingEdgeId": "clddbq3yp000l3b6ss15lu48v"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"graphCoordinates": { "x": 0, "y": 0 }
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": "clddbpito000e3b6spz6qqipa",
|
||||||
|
"title": "Group #1",
|
||||||
|
"blocks": [
|
||||||
|
{
|
||||||
|
"id": "clddbpito000f3b6srs0cizys",
|
||||||
|
"type": "choice input",
|
||||||
|
"items": [
|
||||||
|
{
|
||||||
|
"id": "clddbpito000g3b6snvioor95",
|
||||||
|
"type": 0,
|
||||||
|
"blockId": "clddbpito000f3b6srs0cizys",
|
||||||
|
"content": "Wait now"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"groupId": "clddbpito000e3b6spz6qqipa",
|
||||||
|
"options": { "buttonLabel": "Send", "isMultipleChoice": false }
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": "clddbw55x000m3b6svz34enqq",
|
||||||
|
"groupId": "clddbpito000e3b6spz6qqipa",
|
||||||
|
"type": "Wait",
|
||||||
|
"options": { "secondsToWaitFor": "" },
|
||||||
|
"outgoingEdgeId": "clddbw6l4000n3b6st6le0hu9"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"graphCoordinates": { "x": 357.49609375, "y": 148.40625 }
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": "clddbpwh9000i3b6s9e1vdjrd",
|
||||||
|
"title": "Group #2",
|
||||||
|
"blocks": [
|
||||||
|
{
|
||||||
|
"id": "clddbpwh9000j3b6srnzdpbcx",
|
||||||
|
"type": "text",
|
||||||
|
"content": {
|
||||||
|
"html": "<div>Hi there!</div>",
|
||||||
|
"richText": [
|
||||||
|
{ "type": "p", "children": [{ "text": "Hi there!" }] }
|
||||||
|
],
|
||||||
|
"plainText": "Hi there!"
|
||||||
|
},
|
||||||
|
"groupId": "clddbpwh9000i3b6s9e1vdjrd"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"graphCoordinates": { "x": 545.25, "y": 447.36328125 }
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"variables": [],
|
||||||
|
"edges": [
|
||||||
|
{
|
||||||
|
"id": "clddbq3yp000l3b6ss15lu48v",
|
||||||
|
"to": { "groupId": "clddbpito000e3b6spz6qqipa" },
|
||||||
|
"from": {
|
||||||
|
"blockId": "clddbpduq002tsq1aghl4dh31",
|
||||||
|
"groupId": "clddbpduq002ssq1a2h622bw0"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"from": {
|
||||||
|
"groupId": "clddbpito000e3b6spz6qqipa",
|
||||||
|
"blockId": "clddbw55x000m3b6svz34enqq"
|
||||||
|
},
|
||||||
|
"to": { "groupId": "clddbpwh9000i3b6s9e1vdjrd" },
|
||||||
|
"id": "clddbw6l4000n3b6st6le0hu9"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"theme": {
|
||||||
|
"chat": {
|
||||||
|
"inputs": {
|
||||||
|
"color": "#303235",
|
||||||
|
"backgroundColor": "#FFFFFF",
|
||||||
|
"placeholderColor": "#9095A0"
|
||||||
|
},
|
||||||
|
"buttons": { "color": "#FFFFFF", "backgroundColor": "#0042DA" },
|
||||||
|
"hostAvatar": {
|
||||||
|
"url": "https://avatars.githubusercontent.com/u/16015833?v=4",
|
||||||
|
"isEnabled": true
|
||||||
|
},
|
||||||
|
"hostBubbles": { "color": "#303235", "backgroundColor": "#F7F8FF" },
|
||||||
|
"guestBubbles": { "color": "#FFFFFF", "backgroundColor": "#FF8E21" }
|
||||||
|
},
|
||||||
|
"general": {
|
||||||
|
"font": "Open Sans",
|
||||||
|
"background": { "type": "Color", "content": "#ffffff" }
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"settings": {
|
||||||
|
"general": {
|
||||||
|
"isBrandingEnabled": false,
|
||||||
|
"isInputPrefillEnabled": true,
|
||||||
|
"isResultSavingEnabled": true,
|
||||||
|
"isHideQueryParamsEnabled": true,
|
||||||
|
"isNewResultOnRefreshEnabled": false
|
||||||
|
},
|
||||||
|
"metadata": {
|
||||||
|
"description": "Build beautiful conversational forms and embed them directly in your applications without a line of code. Triple your response rate and collect answers that has more value compared to a traditional form."
|
||||||
|
},
|
||||||
|
"typingEmulation": { "speed": 300, "enabled": true, "maxDelay": 1.5 }
|
||||||
|
},
|
||||||
|
"publicId": null,
|
||||||
|
"customDomain": null,
|
||||||
|
"workspaceId": "proWorkspace",
|
||||||
|
"resultsTablePreferences": null,
|
||||||
|
"isArchived": false,
|
||||||
|
"isClosed": false
|
||||||
|
}
|
||||||
|
@ -3,7 +3,6 @@
|
|||||||
"createdAt": "2022-02-05T06:21:16.522Z",
|
"createdAt": "2022-02-05T06:21:16.522Z",
|
||||||
"updatedAt": "2022-02-05T06:21:16.522Z",
|
"updatedAt": "2022-02-05T06:21:16.522Z",
|
||||||
"name": "My typebot",
|
"name": "My typebot",
|
||||||
"publishedTypebotId": null,
|
|
||||||
"folderId": null,
|
"folderId": null,
|
||||||
"groups": [
|
"groups": [
|
||||||
{
|
{
|
||||||
|
@ -3,7 +3,6 @@
|
|||||||
"createdAt": "2022-03-10T10:50:23.912Z",
|
"createdAt": "2022-03-10T10:50:23.912Z",
|
||||||
"updatedAt": "2022-03-10T10:50:23.912Z",
|
"updatedAt": "2022-03-10T10:50:23.912Z",
|
||||||
"name": "My typebot",
|
"name": "My typebot",
|
||||||
"publishedTypebotId": null,
|
|
||||||
"folderId": null,
|
"folderId": null,
|
||||||
"groups": [
|
"groups": [
|
||||||
{
|
{
|
||||||
|
@ -3,7 +3,6 @@
|
|||||||
"createdAt": "2022-02-04T14:17:20.022Z",
|
"createdAt": "2022-02-04T14:17:20.022Z",
|
||||||
"updatedAt": "2022-02-04T14:17:20.022Z",
|
"updatedAt": "2022-02-04T14:17:20.022Z",
|
||||||
"name": "My typebot",
|
"name": "My typebot",
|
||||||
"publishedTypebotId": null,
|
|
||||||
"folderId": null,
|
"folderId": null,
|
||||||
"groups": [
|
"groups": [
|
||||||
{
|
{
|
||||||
|
@ -4,7 +4,6 @@
|
|||||||
"updatedAt": "2022-06-26T14:07:19.077Z",
|
"updatedAt": "2022-06-26T14:07:19.077Z",
|
||||||
"icon": null,
|
"icon": null,
|
||||||
"name": "My typebot",
|
"name": "My typebot",
|
||||||
"publishedTypebotId": null,
|
|
||||||
"folderId": null,
|
"folderId": null,
|
||||||
"groups": [
|
"groups": [
|
||||||
{
|
{
|
||||||
|
@ -3,7 +3,6 @@
|
|||||||
"createdAt": "2022-03-15T12:54:54.778Z",
|
"createdAt": "2022-03-15T12:54:54.778Z",
|
||||||
"updatedAt": "2022-03-15T13:13:54.482Z",
|
"updatedAt": "2022-03-15T13:13:54.482Z",
|
||||||
"name": "My typebot",
|
"name": "My typebot",
|
||||||
"publishedTypebotId": null,
|
|
||||||
"folderId": null,
|
"folderId": null,
|
||||||
"groups": [
|
"groups": [
|
||||||
{
|
{
|
||||||
|
@ -108,7 +108,6 @@ test.describe('API', () => {
|
|||||||
expect(typebots.length).toBeGreaterThanOrEqual(1)
|
expect(typebots.length).toBeGreaterThanOrEqual(1)
|
||||||
expect(typebots.find((typebot) => typebot.id === typebotId)).toMatchObject({
|
expect(typebots.find((typebot) => typebot.id === typebotId)).toMatchObject({
|
||||||
id: typebotId,
|
id: typebotId,
|
||||||
publishedTypebotId: null,
|
|
||||||
name: 'My typebot',
|
name: 'My typebot',
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
@ -9,9 +9,19 @@ const handler = async (req: NextApiRequest, res: NextApiResponse) => {
|
|||||||
if (!user) return res.status(401).json({ message: 'Not authenticated' })
|
if (!user) return res.status(401).json({ message: 'Not authenticated' })
|
||||||
const typebots = await prisma.typebot.findMany({
|
const typebots = await prisma.typebot.findMany({
|
||||||
where: { workspace: { members: { some: { userId: user.id } } } },
|
where: { workspace: { members: { some: { userId: user.id } } } },
|
||||||
select: { name: true, publishedTypebotId: true, id: true },
|
select: {
|
||||||
|
name: true,
|
||||||
|
publishedTypebot: { select: { id: true } },
|
||||||
|
id: true,
|
||||||
|
},
|
||||||
|
})
|
||||||
|
return res.send({
|
||||||
|
typebots: typebots.map((typebot) => ({
|
||||||
|
id: typebot.id,
|
||||||
|
name: typebot.name,
|
||||||
|
publishedTypebotId: typebot.publishedTypebot?.id,
|
||||||
|
})),
|
||||||
})
|
})
|
||||||
return res.send({ typebots })
|
|
||||||
}
|
}
|
||||||
return methodNotAllowed(res)
|
return methodNotAllowed(res)
|
||||||
}
|
}
|
||||||
|
@ -3,7 +3,6 @@
|
|||||||
"createdAt": "2022-02-05T06:21:16.522Z",
|
"createdAt": "2022-02-05T06:21:16.522Z",
|
||||||
"updatedAt": "2022-02-05T06:21:16.522Z",
|
"updatedAt": "2022-02-05T06:21:16.522Z",
|
||||||
"name": "My typebot",
|
"name": "My typebot",
|
||||||
"publishedTypebotId": null,
|
|
||||||
"folderId": null,
|
"folderId": null,
|
||||||
"groups": [
|
"groups": [
|
||||||
{
|
{
|
||||||
|
@ -4,7 +4,6 @@
|
|||||||
"updatedAt": "2022-11-24T09:13:16.782Z",
|
"updatedAt": "2022-11-24T09:13:16.782Z",
|
||||||
"icon": "👶",
|
"icon": "👶",
|
||||||
"name": "Sub bot",
|
"name": "Sub bot",
|
||||||
"publishedTypebotId": null,
|
|
||||||
"folderId": null,
|
"folderId": null,
|
||||||
"groups": [
|
"groups": [
|
||||||
{
|
{
|
||||||
|
@ -4,7 +4,6 @@
|
|||||||
"updatedAt": "2022-11-24T09:12:57.036Z",
|
"updatedAt": "2022-11-24T09:12:57.036Z",
|
||||||
"icon": "🤖",
|
"icon": "🤖",
|
||||||
"name": "Complete bot",
|
"name": "Complete bot",
|
||||||
"publishedTypebotId": null,
|
|
||||||
"folderId": null,
|
"folderId": null,
|
||||||
"groups": [
|
"groups": [
|
||||||
{
|
{
|
||||||
|
@ -4,7 +4,6 @@
|
|||||||
"updatedAt": "2022-06-08T16:19:32.893Z",
|
"updatedAt": "2022-06-08T16:19:32.893Z",
|
||||||
"icon": null,
|
"icon": null,
|
||||||
"name": "My typebot",
|
"name": "My typebot",
|
||||||
"publishedTypebotId": "cl45ol3j8000f2e6gcifqf21t",
|
|
||||||
"folderId": null,
|
"folderId": null,
|
||||||
"groups": [
|
"groups": [
|
||||||
{
|
{
|
||||||
|
@ -3,7 +3,6 @@
|
|||||||
"createdAt": "2022-03-09T16:17:51.321Z",
|
"createdAt": "2022-03-09T16:17:51.321Z",
|
||||||
"updatedAt": "2022-03-09T16:19:07.037Z",
|
"updatedAt": "2022-03-09T16:19:07.037Z",
|
||||||
"name": "My typebot",
|
"name": "My typebot",
|
||||||
"publishedTypebotId": "dm12bh6hmEQemywn86osJD",
|
|
||||||
"folderId": null,
|
"folderId": null,
|
||||||
"groups": [
|
"groups": [
|
||||||
{
|
{
|
||||||
|
@ -3,7 +3,6 @@
|
|||||||
"createdAt": "2022-03-08T15:58:49.720Z",
|
"createdAt": "2022-03-08T15:58:49.720Z",
|
||||||
"updatedAt": "2022-03-08T16:07:18.899Z",
|
"updatedAt": "2022-03-08T16:07:18.899Z",
|
||||||
"name": "My typebot",
|
"name": "My typebot",
|
||||||
"publishedTypebotId": null,
|
|
||||||
"folderId": null,
|
"folderId": null,
|
||||||
"groups": [
|
"groups": [
|
||||||
{
|
{
|
||||||
|
@ -4,7 +4,6 @@
|
|||||||
"updatedAt": "2022-12-15T09:17:15.366Z",
|
"updatedAt": "2022-12-15T09:17:15.366Z",
|
||||||
"icon": null,
|
"icon": null,
|
||||||
"name": "Another typebot copy",
|
"name": "Another typebot copy",
|
||||||
"publishedTypebotId": null,
|
|
||||||
"folderId": null,
|
"folderId": null,
|
||||||
"groups": [
|
"groups": [
|
||||||
{
|
{
|
||||||
|
@ -3,7 +3,6 @@
|
|||||||
"createdAt": "2022-03-23T08:41:30.106Z",
|
"createdAt": "2022-03-23T08:41:30.106Z",
|
||||||
"updatedAt": "2022-03-23T08:41:30.106Z",
|
"updatedAt": "2022-03-23T08:41:30.106Z",
|
||||||
"name": "My typebot",
|
"name": "My typebot",
|
||||||
"publishedTypebotId": null,
|
|
||||||
"folderId": null,
|
"folderId": null,
|
||||||
"groups": [
|
"groups": [
|
||||||
{
|
{
|
||||||
|
@ -4,7 +4,6 @@
|
|||||||
"updatedAt": "2022-12-14T14:48:19.086Z",
|
"updatedAt": "2022-12-14T14:48:19.086Z",
|
||||||
"icon": null,
|
"icon": null,
|
||||||
"name": "My typebot copy",
|
"name": "My typebot copy",
|
||||||
"publishedTypebotId": null,
|
|
||||||
"folderId": null,
|
"folderId": null,
|
||||||
"groups": [
|
"groups": [
|
||||||
{
|
{
|
||||||
|
@ -4,7 +4,6 @@
|
|||||||
"updatedAt": "2022-10-21T16:30:57.642Z",
|
"updatedAt": "2022-10-21T16:30:57.642Z",
|
||||||
"icon": null,
|
"icon": null,
|
||||||
"name": "My typebot",
|
"name": "My typebot",
|
||||||
"publishedTypebotId": null,
|
|
||||||
"folderId": null,
|
"folderId": null,
|
||||||
"groups": [
|
"groups": [
|
||||||
{
|
{
|
||||||
|
@ -0,0 +1,8 @@
|
|||||||
|
/*
|
||||||
|
Warnings:
|
||||||
|
|
||||||
|
- You are about to drop the column `publishedTypebotId` on the `Typebot` table. All the data in the column will be lost.
|
||||||
|
|
||||||
|
*/
|
||||||
|
-- AlterTable
|
||||||
|
ALTER TABLE "Typebot" DROP COLUMN "publishedTypebotId";
|
@ -155,7 +155,6 @@ model Typebot {
|
|||||||
updatedAt DateTime @default(now()) @updatedAt
|
updatedAt DateTime @default(now()) @updatedAt
|
||||||
icon String?
|
icon String?
|
||||||
name String
|
name String
|
||||||
publishedTypebotId String?
|
|
||||||
folderId String?
|
folderId String?
|
||||||
groups Json
|
groups Json
|
||||||
variables Json[]
|
variables Json[]
|
||||||
|
@ -52,7 +52,6 @@ export const typebotSchema = schemaForType<TypebotPrisma>()(
|
|||||||
createdAt: z.date(),
|
createdAt: z.date(),
|
||||||
updatedAt: z.date(),
|
updatedAt: z.date(),
|
||||||
icon: z.string().nullable(),
|
icon: z.string().nullable(),
|
||||||
publishedTypebotId: z.string().nullable(),
|
|
||||||
folderId: z.string().nullable(),
|
folderId: z.string().nullable(),
|
||||||
publicId: z.string().nullable(),
|
publicId: z.string().nullable(),
|
||||||
customDomain: z.string().nullable(),
|
customDomain: z.string().nullable(),
|
||||||
|
@ -24,7 +24,6 @@ export const parseTestTypebot = (
|
|||||||
publicId: null,
|
publicId: null,
|
||||||
updatedAt: new Date(),
|
updatedAt: new Date(),
|
||||||
createdAt: new Date(),
|
createdAt: new Date(),
|
||||||
publishedTypebotId: null,
|
|
||||||
customDomain: null,
|
customDomain: null,
|
||||||
icon: null,
|
icon: null,
|
||||||
isArchived: false,
|
isArchived: false,
|
||||||
|
Reference in New Issue
Block a user