2
0

♻️ Re-organize workspace folders

This commit is contained in:
Baptiste Arnaud
2023-03-15 08:35:16 +01:00
parent 25c367901f
commit cbc8194f19
987 changed files with 2716 additions and 2770 deletions

View File

@ -32,14 +32,14 @@ RUN apt-get -qy update \
&& apt-get autoremove -yq \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/*
COPY ./packages/db ./packages/db
COPY ./packages/prisma ./packages/prisma
COPY ./apps/${SCOPE}/.env.docker ./apps/${SCOPE}/.env.production
COPY --from=builder /app/node_modules ./node_modules
COPY --from=builder /app/apps/${SCOPE}/public ./apps/${SCOPE}/public
COPY --from=builder --chown=node:node /app/apps/${SCOPE}/.next/standalone ./
COPY --from=builder --chown=node:node /app/apps/${SCOPE}/.next/static ./apps/${SCOPE}/.next/static
COPY env.sh ${SCOPE}-entrypoint.sh ./
COPY scripts/env.sh scripts/${SCOPE}-entrypoint.sh ./
RUN chmod +x ./${SCOPE}-entrypoint.sh \
&& chmod +x ./env.sh
ENTRYPOINT ./${SCOPE}-entrypoint.sh

View File

@ -1,12 +1,16 @@
/* eslint-disable @typescript-eslint/no-var-requires */
const { withSentryConfig } = require('@sentry/nextjs')
const path = require('path')
const withTM = require('next-transpile-modules')(['utils', 'models', 'emails'])
/** @type {import('next').NextConfig} */
const nextConfig = withTM({
const nextConfig = {
reactStrictMode: true,
output: 'standalone',
transpilePackages: [
'@typebot.io/lib',
'@typebot.io/schemas',
'@typebot.io/emails',
],
i18n: {
defaultLocale: 'en',
locales: ['en', 'fr', 'pr'],
@ -27,7 +31,7 @@ const nextConfig = withTM({
},
]
},
})
}
const sentryWebpackPluginOptions = {
silent: true,

View File

@ -3,10 +3,10 @@
"version": "0.1.0",
"license": "AGPL-3.0-or-later",
"scripts": {
"dev": "cross-env ENVSH_ENV=.env.local bash ../../env.sh next dev -p 3000",
"build": "cross-env ENVSH_ENV=.env.local bash ../../env.sh next build",
"dev": "cross-env ENVSH_ENV=.env.local bash ../../scripts/env.sh next dev -p 3000",
"build": "cross-env ENVSH_ENV=.env.local bash ../../scripts/env.sh next build",
"build:docker": "next build",
"build:env": "cd ../.. && cross-env ENVSH_ENV=./apps/builder/.env.docker ENVSH_OUTPUT=./apps/builder/public/__env.js bash env.sh",
"build:env": "cd ../.. && cross-env ENVSH_ENV=./apps/builder/.env.docker ENVSH_OUTPUT=./apps/builder/public/__env.js bash scripts/env.sh",
"start": "next start",
"lint": "next lint",
"test": "pnpm playwright test",
@ -57,7 +57,7 @@
"codemirror": "6.0.1",
"deep-object-diff": "1.1.9",
"dequal": "2.0.3",
"emails": "workspace:*",
"@typebot.io/emails": "workspace:*",
"emojilib": "3.0.8",
"focus-visible": "5.2.0",
"framer-motion": "10.3.0",
@ -112,16 +112,15 @@
"@types/qs": "6.9.7",
"@types/react": "18.0.28",
"@types/tinycolor2": "1.4.3",
"db": "workspace:*",
"@typebot.io/prisma": "workspace:*",
"dotenv": "16.0.3",
"eslint": "8.36.0",
"eslint-config-custom": "workspace:*",
"models": "workspace:*",
"next-transpile-modules": "10.0.0",
"@typebot.io/schemas": "workspace:*",
"superjson": "^1.12.2",
"tsconfig": "workspace:*",
"@typebot.io/tsconfig": "workspace:*",
"typescript": "4.9.5",
"utils": "workspace:*",
"@typebot.io/lib": "workspace:*",
"zod": "3.21.4"
}
}

View File

@ -1,6 +1,6 @@
import { PlaywrightTestConfig } from '@playwright/test'
import path from 'path'
import { playwrightBaseConfig } from 'utils/playwright/baseConfig'
import { playwrightBaseConfig } from '@typebot.io/lib/playwright/baseConfig'
const config: PlaywrightTestConfig = {
...playwrightBaseConfig,

View File

@ -3,7 +3,7 @@ import { GiphyFetch } from '@giphy/js-fetch-api'
import { Grid } from '@giphy/react-components'
import { GiphyLogo } from './GiphyLogo'
import React, { useState } from 'react'
import { env, isEmpty } from 'utils'
import { env, isEmpty } from '@typebot.io/lib'
import { TextInput } from '../inputs'
type GiphySearchFormProps = {

View File

@ -2,7 +2,7 @@ import { useToast } from '@/hooks/useToast'
import { compressFile } from '@/utils/helpers'
import { Button, ButtonProps, chakra } from '@chakra-ui/react'
import { ChangeEvent, useState } from 'react'
import { uploadFiles } from 'utils'
import { uploadFiles } from '@typebot.io/lib'
type UploadButtonProps = {
fileType: 'image' | 'audio'

View File

@ -1,5 +1,5 @@
import { useColorModeValue, HStack, Tag, Text } from '@chakra-ui/react'
import { Variable } from 'models'
import { Variable } from '@typebot.io/schemas'
export const SetVariableLabel = ({
variableId,

View File

@ -13,11 +13,11 @@ import {
} from '@chakra-ui/react'
import { useState, useRef, useEffect, ReactNode } from 'react'
import { useDebouncedCallback } from 'use-debounce'
import { env, isDefined } from 'utils'
import { env, isDefined } from '@typebot.io/lib'
import { useOutsideClick } from '@/hooks/useOutsideClick'
import { useParentModal } from '@/features/graph/providers/ParentModalProvider'
import { VariablesButton } from '@/features/variables'
import { Variable } from 'models'
import { Variable } from '@typebot.io/schemas'
import { injectVariableInText } from '@/features/variables/utils/injectVariableInTextInput'
import { focusInput } from '@/utils/focusInput'
import { MoreInfoTooltip } from '../MoreInfoTooltip'

View File

@ -8,8 +8,8 @@ import {
import { useEffect, useRef, useState } from 'react'
import { useDebouncedCallback } from 'use-debounce'
import { VariablesButton } from '@/features/variables'
import { Variable } from 'models'
import { env } from 'utils'
import { Variable } from '@typebot.io/schemas'
import { env } from '@typebot.io/lib'
import CodeMirror, { ReactCodeMirrorRef } from '@uiw/react-codemirror'
import { tokyoNight } from '@uiw/codemirror-theme-tokyo-night'
import { githubLight } from '@uiw/codemirror-theme-github'

View File

@ -10,10 +10,10 @@ import {
FormControl,
FormLabel,
} from '@chakra-ui/react'
import { Variable, VariableString } from 'models'
import { Variable, VariableString } from '@typebot.io/schemas'
import { useEffect, useState } from 'react'
import { useDebouncedCallback } from 'use-debounce'
import { env } from 'utils'
import { env } from '@typebot.io/lib'
import { MoreInfoTooltip } from '../MoreInfoTooltip'
type Value<HasVariable> = HasVariable extends true | undefined

View File

@ -16,7 +16,7 @@ import {
HStack,
} from '@chakra-ui/react'
import { useState, useRef, ChangeEvent } from 'react'
import { isDefined } from 'utils'
import { isDefined } from '@typebot.io/lib'
import { useOutsideClick } from '@/hooks/useOutsideClick'
import { useParentModal } from '@/features/graph/providers/ParentModalProvider'
import { ChevronDownIcon, CloseIcon } from '../icons'

View File

@ -9,7 +9,7 @@ import {
Input as ChakraInput,
InputProps,
} from '@chakra-ui/react'
import { Variable } from 'models'
import { Variable } from '@typebot.io/schemas'
import React, {
forwardRef,
ReactNode,
@ -19,7 +19,7 @@ import React, {
useState,
} from 'react'
import { useDebouncedCallback } from 'use-debounce'
import { env } from 'utils'
import { env } from '@typebot.io/lib'
import { MoreInfoTooltip } from '../MoreInfoTooltip'
export type TextInputProps = {

View File

@ -8,10 +8,10 @@ import {
Textarea as ChakraTextarea,
TextareaProps,
} from '@chakra-ui/react'
import { Variable } from 'models'
import { Variable } from '@typebot.io/schemas'
import React, { useEffect, useRef, useState } from 'react'
import { useDebouncedCallback } from 'use-debounce'
import { env } from 'utils'
import { env } from '@typebot.io/lib'
import { MoreInfoTooltip } from '../MoreInfoTooltip'
type Props = {

View File

@ -17,9 +17,9 @@ import {
import { EditIcon, PlusIcon, TrashIcon } from '@/components/icons'
import { useTypebot } from '@/features/editor/providers/TypebotProvider/TypebotProvider'
import { createId } from '@paralleldrive/cuid2'
import { Variable } from 'models'
import { Variable } from '@typebot.io/schemas'
import React, { useState, useRef, ChangeEvent, useEffect } from 'react'
import { byId, isDefined, isNotDefined } from 'utils'
import { byId, isDefined, isNotDefined } from '@typebot.io/lib'
import { useOutsideClick } from '@/hooks/useOutsideClick'
import { useParentModal } from '@/features/graph/providers/ParentModalProvider'

View File

@ -7,8 +7,8 @@ import {
useEffect,
useState,
} from 'react'
import { env, isDefined, isNotDefined } from 'utils'
import { User } from 'db'
import { env, isDefined, isNotDefined } from '@typebot.io/lib'
import { User } from '@typebot.io/prisma'
import { setUser as setSentryUser } from '@sentry/nextjs'
import { useToast } from '@/hooks/useToast'
import { updateUserQuery } from './queries/updateUserQuery'

View File

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

View File

@ -17,9 +17,9 @@ import {
} from '@chakra-ui/react'
import { ConfirmModal } from '@/components/ConfirmModal'
import { useToast } from '@/hooks/useToast'
import { User } from 'db'
import { User } from '@typebot.io/prisma'
import React, { useState } from 'react'
import { byId, isDefined } from 'utils'
import { byId, isDefined } from '@typebot.io/lib'
import { CreateTokenModal } from './CreateTokenModal'
import { useApiTokens } from '../../../hooks/useApiTokens'
import { ApiTokenFromServer } from '../../../types'

View File

@ -7,7 +7,7 @@ import {
VStack,
Text,
} from '@chakra-ui/react'
import { GraphNavigation } from 'db'
import { GraphNavigation } from '@typebot.io/prisma'
const graphNavigationData = [
{

View File

@ -1,6 +1,6 @@
import { Stack, Heading, useColorMode } from '@chakra-ui/react'
import { useUser } from '@/features/account'
import { GraphNavigation } from 'db'
import { GraphNavigation } from '@typebot.io/prisma'
import React, { useEffect } from 'react'
import { GraphNavigationRadioGroup } from './GraphNavigationRadioGroup'
import { AppearanceRadioGroup } from './AppearanceRadioGroup'

View File

@ -1,6 +1,6 @@
import { fetcher } from '@/utils/helpers'
import useSWR from 'swr'
import { env } from 'utils'
import { env } from '@typebot.io/lib'
import { ApiTokenFromServer } from '../types'
type ServerResponse = {

View File

@ -1,4 +1,4 @@
import { sendRequest } from 'utils'
import { sendRequest } from '@typebot.io/lib'
import { ApiTokenFromServer } from '../types'
export const createApiTokenQuery = (

View File

@ -1,5 +1,5 @@
import { ApiToken } from 'db'
import { sendRequest } from 'utils'
import { ApiToken } from '@typebot.io/prisma'
import { sendRequest } from '@typebot.io/lib'
export const deleteApiTokenQuery = ({
userId,

View File

@ -1,5 +1,5 @@
import { User } from 'db'
import { sendRequest } from 'utils'
import { User } from '@typebot.io/prisma'
import { sendRequest } from '@typebot.io/lib'
export const updateUserQuery = async (id: string, user: User) =>
sendRequest({

View File

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

View File

@ -6,7 +6,7 @@ import {
} from '@chakra-ui/react'
import { useToast } from '@/hooks/useToast'
import { useTypebot } from '@/features/editor'
import { Stats } from 'models'
import { Stats } from '@typebot.io/schemas'
import React from 'react'
import { useAnswersCount } from '../hooks/useAnswersCount'
import {

View File

@ -7,10 +7,10 @@ import {
StatNumber,
useColorModeValue,
} from '@chakra-ui/react'
import { Stats } from 'models'
import { Stats } from '@typebot.io/schemas'
import React from 'react'
const computeCompletionRate = (
const computeCompletionRate = (
totalCompleted: number,
totalStarts: number
): string => {

View File

@ -1,4 +1,4 @@
import { Invitation, PrismaClient, WorkspaceRole } from 'db'
import { Invitation, PrismaClient, WorkspaceRole } from '@typebot.io/prisma'
export type InvitationWithWorkspaceId = Invitation & {
typebot: {

View File

@ -1,6 +1,6 @@
import prisma from '@/lib/prisma'
import { setUser } from '@sentry/nextjs'
import { User } from 'db'
import { User } from '@typebot.io/prisma'
import { NextApiRequest } from 'next'
import { getSession } from 'next-auth/react'

View File

@ -1,4 +1,4 @@
import { PrismaClient, WorkspaceInvitation } from 'db'
import { PrismaClient, WorkspaceInvitation } from '@typebot.io/prisma'
import { InvitationWithWorkspaceId } from './convertInvitationsToCollaborations'
export const getNewUserInvitations = async (

View File

@ -1,4 +1,4 @@
import { PrismaClient, WorkspaceInvitation } from 'db'
import { PrismaClient, WorkspaceInvitation } from '@typebot.io/prisma'
export const joinWorkspaces = async (
p: PrismaClient,

View File

@ -12,7 +12,7 @@ import { stringify } from 'qs'
import { BuiltInProviderType } from 'next-auth/providers'
import { GoogleLogo } from '@/components/GoogleLogo'
import { AzureAdLogo, FacebookLogo, GitlabLogo } from './logos'
import { omit } from 'utils'
import { omit } from '@typebot.io/lib'
type Props = {
providers:

View File

@ -1,4 +1,4 @@
import { User } from 'db'
import { User } from '@typebot.io/prisma'
export const mockedUser: User = {
id: 'userId',

View File

@ -1,7 +1,7 @@
import prisma from '@/lib/prisma'
import { authenticatedProcedure } from '@/utils/server/trpc'
import { TRPCError } from '@trpc/server'
import { Plan, WorkspaceRole } from 'db'
import { Plan, WorkspaceRole } from '@typebot.io/prisma'
import Stripe from 'stripe'
import { z } from 'zod'

View File

@ -1,7 +1,7 @@
import prisma from '@/lib/prisma'
import { authenticatedProcedure } from '@/utils/server/trpc'
import { TRPCError } from '@trpc/server'
import { Plan, WorkspaceRole } from 'db'
import { Plan, WorkspaceRole } from '@typebot.io/prisma'
import Stripe from 'stripe'
import { z } from 'zod'
import { parseSubscriptionItems } from '../utils/parseSubscriptionItems'

View File

@ -1,7 +1,7 @@
import prisma from '@/lib/prisma'
import { authenticatedProcedure } from '@/utils/server/trpc'
import { TRPCError } from '@trpc/server'
import { WorkspaceRole } from 'db'
import { WorkspaceRole } from '@typebot.io/prisma'
import Stripe from 'stripe'
import { z } from 'zod'

View File

@ -1,10 +1,10 @@
import prisma from '@/lib/prisma'
import { authenticatedProcedure } from '@/utils/server/trpc'
import { TRPCError } from '@trpc/server'
import { WorkspaceRole } from 'db'
import { WorkspaceRole } from '@typebot.io/prisma'
import Stripe from 'stripe'
import { z } from 'zod'
import { subscriptionSchema } from 'models/features/billing/subscription'
import { subscriptionSchema } from '@typebot.io/schemas/features/billing/subscription'
export const getSubscription = authenticatedProcedure
.meta({

View File

@ -1,11 +1,11 @@
import prisma from '@/lib/prisma'
import { authenticatedProcedure } from '@/utils/server/trpc'
import { TRPCError } from '@trpc/server'
import { WorkspaceRole } from 'db'
import { WorkspaceRole } from '@typebot.io/prisma'
import Stripe from 'stripe'
import { isDefined } from 'utils'
import { isDefined } from '@typebot.io/lib'
import { z } from 'zod'
import { invoiceSchema } from 'models/features/billing/invoice'
import { invoiceSchema } from '@typebot.io/schemas/features/billing/invoice'
export const listInvoices = authenticatedProcedure
.meta({

View File

@ -1,11 +1,11 @@
import { sendTelemetryEvents } from 'utils/telemetry/sendTelemetryEvent'
import { sendTelemetryEvents } from '@typebot.io/lib/telemetry/sendTelemetryEvent'
import prisma from '@/lib/prisma'
import { authenticatedProcedure } from '@/utils/server/trpc'
import { TRPCError } from '@trpc/server'
import { Plan, WorkspaceRole } from 'db'
import { workspaceSchema } from 'models'
import { Plan, WorkspaceRole } from '@typebot.io/prisma'
import { workspaceSchema } from '@typebot.io/schemas'
import Stripe from 'stripe'
import { isDefined } from 'utils'
import { isDefined } from '@typebot.io/lib'
import { z } from 'zod'
export const updateSubscription = authenticatedProcedure

View File

@ -1,4 +1,4 @@
import { Plan } from 'db'
import { Plan } from '@typebot.io/prisma'
export const parseSubscriptionItems = (
plan: Plan,

View File

@ -4,13 +4,13 @@ import {
} from '@/test/utils/databaseActions'
import test, { expect } from '@playwright/test'
import { createId } from '@paralleldrive/cuid2'
import { Plan } from 'db'
import { Plan } from '@typebot.io/prisma'
import {
createTypebots,
createWorkspaces,
deleteWorkspaces,
injectFakeResults,
} from 'utils/playwright/databaseActions'
} from '@typebot.io/lib/playwright/databaseActions'
const usageWorkspaceId = createId()
const usageTypebotId = createId()

View File

@ -1,6 +1,6 @@
import { HStack, Stack, Text } from '@chakra-ui/react'
import { useWorkspace } from '@/features/workspace'
import { Plan } from 'db'
import { Plan } from '@typebot.io/prisma'
import React from 'react'
import { CurrentSubscriptionContent } from './CurrentSubscriptionContent'
import { InvoicesList } from './InvoicesList'

View File

@ -1,11 +1,11 @@
import { Text, HStack, Link, Spinner, Stack, Heading } from '@chakra-ui/react'
import { useToast } from '@/hooks/useToast'
import { Plan } from 'db'
import { Plan } from '@typebot.io/prisma'
import React from 'react'
import { PlanTag } from '../PlanTag'
import { BillingPortalButton } from './BillingPortalButton'
import { trpc } from '@/lib/trpc'
import { Workspace } from 'models'
import { Workspace } from '@typebot.io/schemas'
type CurrentSubscriptionContentProps = {
workspace: Pick<Workspace, 'id' | 'plan' | 'stripeId'>

View File

@ -9,10 +9,10 @@ import {
Tooltip,
} from '@chakra-ui/react'
import { AlertIcon } from '@/components/icons'
import { Plan, Workspace } from 'db'
import { Plan, Workspace } from '@typebot.io/prisma'
import React from 'react'
import { parseNumberWithCommas } from 'utils'
import { getChatsLimit, getStorageLimit } from 'utils/pricing'
import { parseNumberWithCommas } from '@typebot.io/lib'
import { getChatsLimit, getStorageLimit } from '@typebot.io/lib/pricing'
import { storageToReadable } from './helpers'
import { trpc } from '@/lib/trpc'

View File

@ -1,4 +1,4 @@
import { sendRequest } from 'utils'
import { sendRequest } from '@typebot.io/lib'
export const cancelSubscriptionQuery = (stripeId: string) =>
sendRequest({

View File

@ -1,13 +1,13 @@
import { Stack, HStack, Text } from '@chakra-ui/react'
import { useUser } from '@/features/account'
import { Plan } from 'db'
import { Plan } from '@typebot.io/prisma'
import { ProPlanContent } from './ProPlanContent'
import { StarterPlanContent } from './StarterPlanContent'
import { TextLink } from '@/components/TextLink'
import { useToast } from '@/hooks/useToast'
import { trpc } from '@/lib/trpc'
import { guessIfUserIsEuropean } from 'utils/pricing'
import { Workspace } from 'models'
import { guessIfUserIsEuropean } from '@typebot.io/lib/pricing'
import { Workspace } from '@typebot.io/schemas'
import { PreCheckoutModal, PreCheckoutModalProps } from '../PreCheckoutModal'
import { useState } from 'react'
import { ParentModalProvider } from '@/features/graph/providers/ParentModalProvider'

View File

@ -16,9 +16,9 @@ import {
} from '@chakra-ui/react'
import { ChevronLeftIcon } from '@/components/icons'
import { useWorkspace } from '@/features/workspace'
import { Plan } from 'db'
import { Plan } from '@typebot.io/prisma'
import { useEffect, useState } from 'react'
import { parseNumberWithCommas } from 'utils'
import { parseNumberWithCommas } from '@typebot.io/lib'
import {
chatsLimit,
computePrice,
@ -26,7 +26,7 @@ import {
getChatsLimit,
getStorageLimit,
storageLimit,
} from 'utils/pricing'
} from '@typebot.io/lib/pricing'
import { FeaturesList } from './components/FeaturesList'
import { MoreInfoTooltip } from '@/components/MoreInfoTooltip'

View File

@ -12,9 +12,9 @@ import {
} from '@chakra-ui/react'
import { ChevronLeftIcon } from '@/components/icons'
import { useWorkspace } from '@/features/workspace'
import { Plan } from 'db'
import { Plan } from '@typebot.io/prisma'
import { useEffect, useState } from 'react'
import { parseNumberWithCommas } from 'utils'
import { parseNumberWithCommas } from '@typebot.io/lib'
import {
chatsLimit,
computePrice,
@ -22,7 +22,7 @@ import {
getChatsLimit,
getStorageLimit,
storageLimit,
} from 'utils/pricing'
} from '@typebot.io/lib/pricing'
import { FeaturesList } from './components/FeaturesList'
import { MoreInfoTooltip } from '@/components/MoreInfoTooltip'

View File

@ -1,6 +1,6 @@
import { Tag, TagProps } from '@chakra-ui/react'
import { LockedIcon } from '@/components/icons'
import { Plan } from 'db'
import { Plan } from '@typebot.io/prisma'
import { planColorSchemes } from './PlanTag'
export const LockTag = ({ plan, ...props }: { plan?: Plan } & TagProps) => (

View File

@ -1,5 +1,5 @@
import { Tag, TagProps, ThemeTypings } from '@chakra-ui/react'
import { Plan } from 'db'
import { Plan } from '@typebot.io/prisma'
export const planColorSchemes: Record<Plan, ThemeTypings['colorSchemes']> = {
[Plan.LIFETIME]: 'purple',

View File

@ -16,7 +16,7 @@ import {
} from '@chakra-ui/react'
import { useRouter } from 'next/router'
import React, { FormEvent, useState } from 'react'
import { isDefined } from 'utils'
import { isDefined } from '@typebot.io/lib'
import { taxIdTypes } from '../taxIdTypes'
export type PreCheckoutModalProps = {

View File

@ -1,7 +1,7 @@
import { Button, ButtonProps, useDisclosure } from '@chakra-ui/react'
import { useWorkspace } from '@/features/workspace'
import React from 'react'
import { isNotDefined } from 'utils'
import { isNotDefined } from '@typebot.io/lib'
import { ChangePlanModal } from './ChangePlanModal'
import { LimitReached } from './ChangePlanModal'

View File

@ -1,5 +1,5 @@
import { Plan, Workspace } from 'db'
import { isDefined, isNotDefined } from 'utils'
import { Plan, Workspace } from '@typebot.io/prisma'
import { isDefined, isNotDefined } from '@typebot.io/lib'
export const planToReadable = (plan?: Plan) => {
if (!plan) return

View File

@ -1,7 +1,7 @@
import test, { expect } from '@playwright/test'
import { createTypebots } from 'utils/playwright/databaseActions'
import { parseDefaultGroupWithBlock } from 'utils/playwright/databaseHelpers'
import { BubbleBlockType, defaultAudioBubbleContent } from 'models'
import { createTypebots } from '@typebot.io/lib/playwright/databaseActions'
import { parseDefaultGroupWithBlock } from '@typebot.io/lib/playwright/databaseHelpers'
import { BubbleBlockType, defaultAudioBubbleContent } from '@typebot.io/schemas'
import { createId } from '@paralleldrive/cuid2'
import { getTestAsset } from '@/test/utils/playwright'

View File

@ -1,5 +1,5 @@
import { Button, Flex, HStack, Stack, Text } from '@chakra-ui/react'
import { AudioBubbleContent } from 'models'
import { AudioBubbleContent } from '@typebot.io/schemas'
import { TextInput } from '@/components/inputs'
import { useState } from 'react'
import { UploadButton } from '@/components/ImageUploadContent/UploadButton'

View File

@ -1,6 +1,6 @@
import { Text } from '@chakra-ui/react'
import { AudioBubbleContent } from 'models'
import { isDefined } from 'utils'
import { AudioBubbleContent } from '@typebot.io/schemas'
import { isDefined } from '@typebot.io/lib'
type Props = {
url: AudioBubbleContent['url']

View File

@ -1,5 +1,5 @@
import { Text } from '@chakra-ui/react'
import { EmbedBubbleBlock } from 'models'
import { EmbedBubbleBlock } from '@typebot.io/schemas'
export const EmbedBubbleContent = ({ block }: { block: EmbedBubbleBlock }) => {
if (!block.content?.url) return <Text color="gray.500">Click to edit...</Text>

View File

@ -1,7 +1,7 @@
import { TextInput, NumberInput } from '@/components/inputs'
import { HStack, Stack, Text } from '@chakra-ui/react'
import { EmbedBubbleContent } from 'models'
import { sanitizeUrl } from 'utils'
import { EmbedBubbleContent } from '@typebot.io/schemas'
import { sanitizeUrl } from '@typebot.io/lib'
type Props = {
content: EmbedBubbleContent

View File

@ -1,8 +1,8 @@
import test, { expect } from '@playwright/test'
import { BubbleBlockType, defaultEmbedBubbleContent } from 'models'
import { BubbleBlockType, defaultEmbedBubbleContent } from '@typebot.io/schemas'
import { createId } from '@paralleldrive/cuid2'
import { createTypebots } from 'utils/playwright/databaseActions'
import { parseDefaultGroupWithBlock } from 'utils/playwright/databaseHelpers'
import { createTypebots } from '@typebot.io/lib/playwright/databaseActions'
import { parseDefaultGroupWithBlock } from '@typebot.io/lib/playwright/databaseHelpers'
const pdfSrc = 'https://www.orimi.com/pdf-test.pdf'
const siteSrc = 'https://app.cal.com/baptistearno/15min'

View File

@ -1,5 +1,5 @@
import { Box, Text, Image } from '@chakra-ui/react'
import { ImageBubbleBlock } from 'models'
import { ImageBubbleBlock } from '@typebot.io/schemas'
export const ImageBubbleContent = ({ block }: { block: ImageBubbleBlock }) => {
const containsVariables =

View File

@ -1,7 +1,7 @@
import test, { expect } from '@playwright/test'
import { createTypebots } from 'utils/playwright/databaseActions'
import { parseDefaultGroupWithBlock } from 'utils/playwright/databaseHelpers'
import { BubbleBlockType, defaultImageBubbleContent } from 'models'
import { createTypebots } from '@typebot.io/lib/playwright/databaseActions'
import { parseDefaultGroupWithBlock } from '@typebot.io/lib/playwright/databaseHelpers'
import { BubbleBlockType, defaultImageBubbleContent } from '@typebot.io/schemas'
import { createId } from '@paralleldrive/cuid2'
import { getTestAsset } from '@/test/utils/playwright'

View File

@ -1,9 +1,9 @@
import { Flex } from '@chakra-ui/react'
import { useTypebot } from '@/features/editor'
import { TextBubbleBlock } from 'models'
import { TextBubbleBlock } from '@typebot.io/schemas'
import React from 'react'
import { parseVariableHighlight } from '@/utils/helpers'
import { isEmpty } from 'utils'
import { isEmpty } from '@typebot.io/lib'
type Props = {
block: TextBubbleBlock

View File

@ -9,7 +9,11 @@ import { Plate, PlateProvider, usePlateEditorRef } from '@udecode/plate-core'
import { editorStyle, platePlugins } from '@/lib/plate'
import { BaseEditor, BaseSelection, Transforms } from 'slate'
import { ToolBar } from './ToolBar'
import { defaultTextBubbleContent, TextBubbleContent, Variable } from 'models'
import {
defaultTextBubbleContent,
TextBubbleContent,
Variable,
} from '@typebot.io/schemas'
import { ReactEditor } from 'slate-react'
import { serializeHtml } from '@udecode/plate-serializer-html'
import { parseHtmlStringToPlainText } from '../../utils'

View File

@ -1,7 +1,7 @@
import test, { expect } from '@playwright/test'
import { createTypebots } from 'utils/playwright/databaseActions'
import { parseDefaultGroupWithBlock } from 'utils/playwright/databaseHelpers'
import { BubbleBlockType, defaultTextBubbleContent } from 'models'
import { createTypebots } from '@typebot.io/lib/playwright/databaseActions'
import { parseDefaultGroupWithBlock } from '@typebot.io/lib/playwright/databaseHelpers'
import { BubbleBlockType, defaultTextBubbleContent } from '@typebot.io/schemas'
import { createId } from '@paralleldrive/cuid2'
test.describe('Text bubble block', () => {

View File

@ -1,5 +1,5 @@
import { Parser } from 'htmlparser2'
import { isNotEmpty } from 'utils'
import { isNotEmpty } from '@typebot.io/lib'
export const parseHtmlStringToPlainText = (html: string): string => {
let plainText = ''

View File

@ -1,5 +1,5 @@
import { Box, Text } from '@chakra-ui/react'
import { VideoBubbleBlock, VideoBubbleContentType } from 'models'
import { VideoBubbleBlock, VideoBubbleContentType } from '@typebot.io/schemas'
export const VideoBubbleContent = ({ block }: { block: VideoBubbleBlock }) => {
if (!block.content?.url || !block.content.type)

View File

@ -1,9 +1,9 @@
import { Stack, Text } from '@chakra-ui/react'
import { VideoBubbleContent, VideoBubbleContentType } from 'models'
import { VideoBubbleContent, VideoBubbleContentType } from '@typebot.io/schemas'
import urlParser from 'js-video-url-parser/lib/base'
import 'js-video-url-parser/lib/provider/vimeo'
import 'js-video-url-parser/lib/provider/youtube'
import { isDefined } from 'utils'
import { isDefined } from '@typebot.io/lib'
import { TextInput } from '@/components/inputs'
type Props = {

View File

@ -1,11 +1,11 @@
import test, { expect } from '@playwright/test'
import { createTypebots } from 'utils/playwright/databaseActions'
import { parseDefaultGroupWithBlock } from 'utils/playwright/databaseHelpers'
import { createTypebots } from '@typebot.io/lib/playwright/databaseActions'
import { parseDefaultGroupWithBlock } from '@typebot.io/lib/playwright/databaseHelpers'
import {
BubbleBlockType,
defaultVideoBubbleContent,
VideoBubbleContentType,
} from 'models'
} from '@typebot.io/schemas'
import { createId } from '@paralleldrive/cuid2'
const videoSrc =

View File

@ -2,9 +2,13 @@ import test, { expect } from '@playwright/test'
import {
createTypebots,
importTypebotInDatabase,
} from 'utils/playwright/databaseActions'
import { parseDefaultGroupWithBlock } from 'utils/playwright/databaseHelpers'
import { defaultChoiceInputOptions, InputBlockType, ItemType } from 'models'
} from '@typebot.io/lib/playwright/databaseActions'
import { parseDefaultGroupWithBlock } from '@typebot.io/lib/playwright/databaseHelpers'
import {
defaultChoiceInputOptions,
InputBlockType,
ItemType,
} from '@typebot.io/schemas'
import { createId } from '@paralleldrive/cuid2'
import { getTestAsset } from '@/test/utils/playwright'

View File

@ -1,4 +1,4 @@
import { BlockIndices, ChoiceInputBlock } from 'models'
import { BlockIndices, ChoiceInputBlock } from '@typebot.io/schemas'
import React from 'react'
import { ItemNodesList } from '@/features/graph/components/Nodes/ItemNode'
import { Stack, Tag, Text, Wrap } from '@chakra-ui/react'

View File

@ -3,7 +3,7 @@ import { MoreInfoTooltip } from '@/components/MoreInfoTooltip'
import { SwitchWithLabel } from '@/components/inputs/SwitchWithLabel'
import { VariableSearchInput } from '@/components/inputs/VariableSearchInput'
import { FormControl, FormLabel, Stack } from '@chakra-ui/react'
import { ChoiceInputOptions, Variable } from 'models'
import { ChoiceInputOptions, Variable } from '@typebot.io/schemas'
import React from 'react'
type Props = {

View File

@ -8,9 +8,9 @@ import {
} from '@chakra-ui/react'
import { PlusIcon } from '@/components/icons'
import { useTypebot } from '@/features/editor'
import { ButtonItem, ItemIndices, ItemType } from 'models'
import { ButtonItem, ItemIndices, ItemType } from '@typebot.io/schemas'
import React, { useRef, useState } from 'react'
import { isNotDefined } from 'utils'
import { isNotDefined } from '@typebot.io/lib'
type Props = {
item: ButtonItem

View File

@ -2,7 +2,7 @@ import { TextInput } from '@/components/inputs'
import { SwitchWithLabel } from '@/components/inputs/SwitchWithLabel'
import { VariableSearchInput } from '@/components/inputs/VariableSearchInput'
import { FormLabel, Stack } from '@chakra-ui/react'
import { DateInputOptions, Variable } from 'models'
import { DateInputOptions, Variable } from '@typebot.io/schemas'
import React from 'react'
type DateInputSettingsBodyProps = {

View File

@ -1,7 +1,7 @@
import test, { expect } from '@playwright/test'
import { createTypebots } from 'utils/playwright/databaseActions'
import { parseDefaultGroupWithBlock } from 'utils/playwright/databaseHelpers'
import { defaultDateInputOptions, InputBlockType } from 'models'
import { createTypebots } from '@typebot.io/lib/playwright/databaseActions'
import { parseDefaultGroupWithBlock } from '@typebot.io/lib/playwright/databaseHelpers'
import { defaultDateInputOptions, InputBlockType } from '@typebot.io/schemas'
import { createId } from '@paralleldrive/cuid2'
test.describe('Date input block', () => {

View File

@ -1,6 +1,6 @@
import React from 'react'
import { Text } from '@chakra-ui/react'
import { EmailInputBlock } from 'models'
import { EmailInputBlock } from '@typebot.io/schemas'
import { WithVariableContent } from '@/features/graph/components/Nodes/BlockNode/BlockNodeContent/WithVariableContent'
type Props = {

View File

@ -1,7 +1,7 @@
import { TextInput } from '@/components/inputs'
import { VariableSearchInput } from '@/components/inputs/VariableSearchInput'
import { FormLabel, Stack } from '@chakra-ui/react'
import { EmailInputOptions, Variable } from 'models'
import { EmailInputOptions, Variable } from '@typebot.io/schemas'
import React from 'react'
type EmailInputSettingsBodyProps = {

View File

@ -1,7 +1,7 @@
import test, { expect } from '@playwright/test'
import { createTypebots } from 'utils/playwright/databaseActions'
import { parseDefaultGroupWithBlock } from 'utils/playwright/databaseHelpers'
import { defaultEmailInputOptions, InputBlockType } from 'models'
import { createTypebots } from '@typebot.io/lib/playwright/databaseActions'
import { parseDefaultGroupWithBlock } from '@typebot.io/lib/playwright/databaseHelpers'
import { defaultEmailInputOptions, InputBlockType } from '@typebot.io/schemas'
import { createId } from '@paralleldrive/cuid2'
test.describe('Email input block', () => {

View File

@ -1,6 +1,6 @@
import { WithVariableContent } from '@/features/graph/components/Nodes/BlockNode/BlockNodeContent/WithVariableContent'
import { Text } from '@chakra-ui/react'
import { FileInputOptions } from 'models'
import { FileInputOptions } from '@typebot.io/schemas'
type Props = {
options: FileInputOptions

View File

@ -1,6 +1,6 @@
import { FormLabel, HStack, Stack, Text } from '@chakra-ui/react'
import { CodeEditor } from '@/components/inputs/CodeEditor'
import { FileInputOptions, Variable } from 'models'
import { FileInputOptions, Variable } from '@typebot.io/schemas'
import React from 'react'
import { TextInput, NumberInput } from '@/components/inputs'
import { SwitchWithLabel } from '@/components/inputs/SwitchWithLabel'

View File

@ -1,9 +1,9 @@
import test, { expect } from '@playwright/test'
import { createTypebots } from 'utils/playwright/databaseActions'
import { parseDefaultGroupWithBlock } from 'utils/playwright/databaseHelpers'
import { defaultFileInputOptions, InputBlockType } from 'models'
import { createTypebots } from '@typebot.io/lib/playwright/databaseActions'
import { parseDefaultGroupWithBlock } from '@typebot.io/lib/playwright/databaseHelpers'
import { defaultFileInputOptions, InputBlockType } from '@typebot.io/schemas'
import { createId } from '@paralleldrive/cuid2'
import { freeWorkspaceId } from 'utils/playwright/databaseSetup'
import { freeWorkspaceId } from '@typebot.io/lib/playwright/databaseSetup'
import { getTestAsset } from '@/test/utils/playwright'
test.describe.configure({ mode: 'parallel' })

View File

@ -2,7 +2,7 @@ import { TextInput, NumberInput } from '@/components/inputs'
import { VariableSearchInput } from '@/components/inputs/VariableSearchInput'
import { removeUndefinedFields } from '@/utils/helpers'
import { FormLabel, Stack } from '@chakra-ui/react'
import { NumberInputOptions, Variable } from 'models'
import { NumberInputOptions, Variable } from '@typebot.io/schemas'
import React from 'react'
type NumberInputSettingsBodyProps = {

View File

@ -1,6 +1,6 @@
import React from 'react'
import { Text } from '@chakra-ui/react'
import { NumberInputBlock } from 'models'
import { NumberInputBlock } from '@typebot.io/schemas'
import { WithVariableContent } from '@/features/graph/components/Nodes/BlockNode/BlockNodeContent/WithVariableContent'
type Props = {

View File

@ -1,7 +1,7 @@
import test, { expect } from '@playwright/test'
import { createTypebots } from 'utils/playwright/databaseActions'
import { parseDefaultGroupWithBlock } from 'utils/playwright/databaseHelpers'
import { defaultNumberInputOptions, InputBlockType } from 'models'
import { createTypebots } from '@typebot.io/lib/playwright/databaseActions'
import { parseDefaultGroupWithBlock } from '@typebot.io/lib/playwright/databaseHelpers'
import { defaultNumberInputOptions, InputBlockType } from '@typebot.io/schemas'
import { createId } from '@paralleldrive/cuid2'
test.describe('Number input block', () => {

View File

@ -1,5 +1,5 @@
import { Text } from '@chakra-ui/react'
import { PaymentInputBlock } from 'models'
import { PaymentInputBlock } from '@typebot.io/schemas'
type Props = {
block: PaymentInputBlock

View File

@ -11,7 +11,7 @@ import {
AccordionPanel,
} from '@chakra-ui/react'
import { DropdownList } from '@/components/DropdownList'
import { PaymentInputOptions, PaymentProvider } from 'models'
import { PaymentInputOptions, PaymentProvider } from '@typebot.io/schemas'
import React, { ChangeEvent } from 'react'
import { currencies } from './currencies'
import { StripeConfigModal } from './StripeConfigModal'

View File

@ -20,9 +20,9 @@ import { useToast } from '@/hooks/useToast'
import { TextInput } from '@/components/inputs'
import { MoreInfoTooltip } from '@/components/MoreInfoTooltip'
import { TextLink } from '@/components/TextLink'
import { StripeCredentials } from 'models'
import { StripeCredentials } from '@typebot.io/schemas'
import { trpc } from '@/lib/trpc'
import { isNotEmpty } from 'utils'
import { isNotEmpty } from '@typebot.io/lib'
type Props = {
isOpen: boolean

View File

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

View File

@ -1,6 +1,6 @@
import React from 'react'
import { Text } from '@chakra-ui/react'
import { PhoneNumberInputOptions } from 'models'
import { PhoneNumberInputOptions } from '@typebot.io/schemas'
import { WithVariableContent } from '@/features/graph/components/Nodes/BlockNode/BlockNodeContent/WithVariableContent'
type Props = {

View File

@ -1,7 +1,7 @@
import { TextInput } from '@/components/inputs'
import { VariableSearchInput } from '@/components/inputs/VariableSearchInput'
import { FormLabel, Stack } from '@chakra-ui/react'
import { PhoneNumberInputOptions, Variable } from 'models'
import { PhoneNumberInputOptions, Variable } from '@typebot.io/schemas'
import React from 'react'
import { CountryCodeSelect } from './CountryCodeSelect'

View File

@ -1,7 +1,7 @@
import test, { expect } from '@playwright/test'
import { createTypebots } from 'utils/playwright/databaseActions'
import { parseDefaultGroupWithBlock } from 'utils/playwright/databaseHelpers'
import { defaultPhoneInputOptions, InputBlockType } from 'models'
import { createTypebots } from '@typebot.io/lib/playwright/databaseActions'
import { parseDefaultGroupWithBlock } from '@typebot.io/lib/playwright/databaseHelpers'
import { defaultPhoneInputOptions, InputBlockType } from '@typebot.io/schemas'
import { createId } from '@paralleldrive/cuid2'
test.describe('Phone input block', () => {

View File

@ -1,6 +1,6 @@
import { WithVariableContent } from '@/features/graph/components/Nodes/BlockNode/BlockNodeContent/WithVariableContent'
import { Text } from '@chakra-ui/react'
import { RatingInputBlock } from 'models'
import { RatingInputBlock } from '@typebot.io/schemas'
type Props = {
variableId?: string

View File

@ -1,6 +1,6 @@
import { FormLabel, Stack } from '@chakra-ui/react'
import { DropdownList } from '@/components/DropdownList'
import { RatingInputOptions, Variable } from 'models'
import { RatingInputOptions, Variable } from '@typebot.io/schemas'
import React from 'react'
import { SwitchWithLabel } from '@/components/inputs/SwitchWithLabel'
import { TextInput } from '@/components/inputs'

View File

@ -1,7 +1,7 @@
import test, { expect } from '@playwright/test'
import { createTypebots } from 'utils/playwright/databaseActions'
import { parseDefaultGroupWithBlock } from 'utils/playwright/databaseHelpers'
import { defaultRatingInputOptions, InputBlockType } from 'models'
import { createTypebots } from '@typebot.io/lib/playwright/databaseActions'
import { parseDefaultGroupWithBlock } from '@typebot.io/lib/playwright/databaseHelpers'
import { defaultRatingInputOptions, InputBlockType } from '@typebot.io/schemas'
import { createId } from '@paralleldrive/cuid2'
const boxSvg = `<svg

View File

@ -1,6 +1,6 @@
import React from 'react'
import { Text } from '@chakra-ui/react'
import { TextInputOptions } from 'models'
import { TextInputOptions } from '@typebot.io/schemas'
import { WithVariableContent } from '@/features/graph/components/Nodes/BlockNode/BlockNodeContent/WithVariableContent'
type Props = {

View File

@ -2,7 +2,7 @@ import { TextInput } from '@/components/inputs'
import { SwitchWithLabel } from '@/components/inputs/SwitchWithLabel'
import { VariableSearchInput } from '@/components/inputs/VariableSearchInput'
import { FormLabel, Stack } from '@chakra-ui/react'
import { TextInputOptions, Variable } from 'models'
import { TextInputOptions, Variable } from '@typebot.io/schemas'
import React from 'react'
type TextInputSettingsBodyProps = {

View File

@ -1,7 +1,7 @@
import test, { expect } from '@playwright/test'
import { createTypebots } from 'utils/playwright/databaseActions'
import { parseDefaultGroupWithBlock } from 'utils/playwright/databaseHelpers'
import { defaultTextInputOptions, InputBlockType } from 'models'
import { createTypebots } from '@typebot.io/lib/playwright/databaseActions'
import { parseDefaultGroupWithBlock } from '@typebot.io/lib/playwright/databaseHelpers'
import { defaultTextInputOptions, InputBlockType } from '@typebot.io/schemas'
import { createId } from '@paralleldrive/cuid2'
test.describe.parallel('Text input block', () => {

View File

@ -1,7 +1,7 @@
import { TextInput } from '@/components/inputs'
import { VariableSearchInput } from '@/components/inputs/VariableSearchInput'
import { FormLabel, Stack } from '@chakra-ui/react'
import { UrlInputOptions, Variable } from 'models'
import { UrlInputOptions, Variable } from '@typebot.io/schemas'
import React from 'react'
type UrlInputSettingsBodyProps = {

View File

@ -1,6 +1,6 @@
import React from 'react'
import { Text } from '@chakra-ui/react'
import { UrlInputOptions } from 'models'
import { UrlInputOptions } from '@typebot.io/schemas'
import { WithVariableContent } from '@/features/graph/components/Nodes/BlockNode/BlockNodeContent/WithVariableContent'
type Props = {

View File

@ -1,7 +1,7 @@
import test, { expect } from '@playwright/test'
import { createTypebots } from 'utils/playwright/databaseActions'
import { parseDefaultGroupWithBlock } from 'utils/playwright/databaseHelpers'
import { defaultUrlInputOptions, InputBlockType } from 'models'
import { createTypebots } from '@typebot.io/lib/playwright/databaseActions'
import { parseDefaultGroupWithBlock } from '@typebot.io/lib/playwright/databaseHelpers'
import { defaultUrlInputOptions, InputBlockType } from '@typebot.io/schemas'
import { createId } from '@paralleldrive/cuid2'
test.describe('Url input block', () => {

View File

@ -1,8 +1,11 @@
import test, { expect } from '@playwright/test'
import { createTypebots } from 'utils/playwright/databaseActions'
import { parseDefaultGroupWithBlock } from 'utils/playwright/databaseHelpers'
import { createTypebots } from '@typebot.io/lib/playwright/databaseActions'
import { parseDefaultGroupWithBlock } from '@typebot.io/lib/playwright/databaseHelpers'
import { createId } from '@paralleldrive/cuid2'
import { defaultChatwootOptions, IntegrationBlockType } from 'models'
import {
defaultChatwootOptions,
IntegrationBlockType,
} from '@typebot.io/schemas'
const typebotId = createId()

View File

@ -1,5 +1,5 @@
import { Text } from '@chakra-ui/react'
import { ChatwootBlock } from 'models'
import { ChatwootBlock } from '@typebot.io/schemas'
type Props = {
block: ChatwootBlock

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