♻️ 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

@@ -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

View File

@@ -8,7 +8,7 @@ import {
AccordionPanel,
Stack,
} from '@chakra-ui/react'
import { ChatwootOptions, chatwootTasks } from 'models'
import { ChatwootOptions, chatwootTasks } from '@typebot.io/schemas'
import React from 'react'
type Props = {

View File

@@ -1,6 +1,6 @@
import React from 'react'
import { Text } from '@chakra-ui/react'
import { GoogleAnalyticsOptions } from 'models'
import { GoogleAnalyticsOptions } from '@typebot.io/schemas'
type Props = {
action: GoogleAnalyticsOptions['action']

View File

@@ -10,7 +10,7 @@ import {
Stack,
Tag,
} from '@chakra-ui/react'
import { GoogleAnalyticsOptions } from 'models'
import { GoogleAnalyticsOptions } from '@typebot.io/schemas'
import React from 'react'
type Props = {

View File

@@ -1,7 +1,10 @@
import test from '@playwright/test'
import { createTypebots } from 'utils/playwright/databaseActions'
import { parseDefaultGroupWithBlock } from 'utils/playwright/databaseHelpers'
import { defaultGoogleAnalyticsOptions, IntegrationBlockType } from 'models'
import { createTypebots } from '@typebot.io/lib/playwright/databaseActions'
import { parseDefaultGroupWithBlock } from '@typebot.io/lib/playwright/databaseHelpers'
import {
defaultGoogleAnalyticsOptions,
IntegrationBlockType,
} from '@typebot.io/schemas'
import { createId } from '@paralleldrive/cuid2'
test.describe('Google Analytics block', () => {

View File

@@ -1,6 +1,6 @@
import React from 'react'
import { Text } from '@chakra-ui/react'
import { GoogleSheetsAction } from 'models'
import { GoogleSheetsAction } from '@typebot.io/schemas'
type Props = {
action?: GoogleSheetsAction

View File

@@ -1,6 +1,6 @@
import { Stack } from '@chakra-ui/react'
import { DropdownList } from '@/components/DropdownList'
import { Cell } from 'models'
import { Cell } from '@typebot.io/schemas'
import { TableListItemProps } from '@/components/TableList'
import { TextInput } from '@/components/inputs'

View File

@@ -1,6 +1,6 @@
import { Stack } from '@chakra-ui/react'
import { DropdownList } from '@/components/DropdownList'
import { ExtractingCell, Variable } from 'models'
import { ExtractingCell, Variable } from '@typebot.io/schemas'
import { TableListItemProps } from '@/components/TableList'
import { VariableSearchInput } from '@/components/inputs/VariableSearchInput'

View File

@@ -12,9 +12,9 @@ import {
GoogleSheetsInsertRowOptions,
GoogleSheetsOptions,
GoogleSheetsUpdateRowOptions,
} from 'models'
} from '@typebot.io/schemas'
import React, { useMemo } from 'react'
import { isDefined } from 'utils'
import { isDefined } from '@typebot.io/lib'
import { SheetsDropdown } from './SheetsDropdown'
import { SpreadsheetsDropdown } from './SpreadsheetDropdown'
import { CellWithValueStack } from './CellWithValueStack'

View File

@@ -2,7 +2,7 @@ import { DropdownList } from '@/components/DropdownList'
import { TextInput } from '@/components/inputs'
import { TableListItemProps } from '@/components/TableList'
import { Stack } from '@chakra-ui/react'
import { ComparisonOperators, RowsFilterComparison } from 'models'
import { ComparisonOperators, RowsFilterComparison } from '@typebot.io/schemas'
import React from 'react'
export const RowsFilterComparisonItem = ({

View File

@@ -5,7 +5,7 @@ import {
GoogleSheetsGetOptions,
LogicalOperator,
RowsFilterComparison,
} from 'models'
} from '@typebot.io/schemas'
import React, { useCallback } from 'react'
import { RowsFilterComparisonItem } from './RowsFilterComparisonItem'

View File

@@ -1,5 +1,5 @@
import test, { expect, Page } from '@playwright/test'
import { importTypebotInDatabase } from 'utils/playwright/databaseActions'
import { importTypebotInDatabase } from '@typebot.io/lib/playwright/databaseActions'
import { createId } from '@paralleldrive/cuid2'
import { getTestAsset } from '@/test/utils/playwright'

View File

@@ -1,5 +1,5 @@
import { stringify } from 'qs'
import { sendRequest } from 'utils'
import { sendRequest } from '@typebot.io/lib'
export const createSheetsCredentialQuery = async (code: string) => {
const queryParams = stringify({ code })

View File

@@ -1,7 +1,7 @@
import { Text } from '@chakra-ui/react'
import { useTypebot } from '@/features/editor'
import { MakeComBlock } from 'models'
import { byId, isNotDefined } from 'utils'
import { MakeComBlock } from '@typebot.io/schemas'
import { byId, isNotDefined } from '@typebot.io/lib'
type Props = {
block: MakeComBlock

View File

@@ -1,9 +1,9 @@
import { Alert, AlertIcon, Button, Link, Stack, Text } from '@chakra-ui/react'
import { ExternalLinkIcon } from '@/components/icons'
import { useTypebot } from '@/features/editor'
import { MakeComBlock, Webhook, WebhookOptions } from 'models'
import { MakeComBlock, Webhook, WebhookOptions } from '@typebot.io/schemas'
import React, { useCallback, useEffect, useState } from 'react'
import { byId } from 'utils'
import { byId } from '@typebot.io/lib'
import { WebhookAdvancedConfigForm } from '../../webhook/components/WebhookAdvancedConfigForm'
type Props = {

View File

@@ -5,7 +5,7 @@ import {
ChatCompletionOpenAIOptions,
CreateImageOpenAIOptions,
OpenAIBlock,
} from 'models/features/blocks/integrations/openai'
} from '@typebot.io/schemas/features/blocks/integrations/openai'
type Props = {
task: OpenAIBlock['options']['task']

View File

@@ -7,7 +7,7 @@ import {
defaultChatCompletionOptions,
OpenAIBlock,
openAITasks,
} from 'models/features/blocks/integrations/openai'
} from '@typebot.io/schemas/features/blocks/integrations/openai'
import { OpenAICredentialsModal } from './OpenAICredentialsModal'
import { useWorkspace } from '@/features/workspace/WorkspaceProvider'
import { DropdownList } from '@/components/DropdownList'

View File

@@ -3,12 +3,12 @@ import { TextInput } from '@/components/inputs'
import { VariableSearchInput } from '@/components/inputs/VariableSearchInput'
import { TableListItemProps } from '@/components/TableList'
import { Stack } from '@chakra-ui/react'
import { Variable } from 'models'
import { Variable } from '@typebot.io/schemas'
import {
chatCompletionMessageCustomRoles,
chatCompletionMessageRoles,
ChatCompletionOpenAIOptions,
} from 'models/features/blocks/integrations/openai'
} from '@typebot.io/schemas/features/blocks/integrations/openai'
type Props = TableListItemProps<ChatCompletionOpenAIOptions['messages'][number]>

View File

@@ -2,11 +2,11 @@ import { DropdownList } from '@/components/DropdownList'
import { VariableSearchInput } from '@/components/inputs/VariableSearchInput'
import { TableListItemProps } from '@/components/TableList'
import { Stack } from '@chakra-ui/react'
import { Variable } from 'models'
import { Variable } from '@typebot.io/schemas'
import {
ChatCompletionOpenAIOptions,
chatCompletionResponseValues,
} from 'models/features/blocks/integrations/openai'
} from '@typebot.io/schemas/features/blocks/integrations/openai'
type Props = TableListItemProps<
ChatCompletionOpenAIOptions['responseMapping'][number]

View File

@@ -3,7 +3,7 @@ import { TableList } from '@/components/TableList'
import {
chatCompletionModels,
ChatCompletionOpenAIOptions,
} from 'models/features/blocks/integrations/openai'
} from '@typebot.io/schemas/features/blocks/integrations/openai'
import { ChatCompletionMessageItem } from './ChatCompletionMessageItem'
import {
Accordion,

View File

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

View File

@@ -1,7 +1,7 @@
import { Text } from '@chakra-ui/react'
import { useTypebot } from '@/features/editor'
import { PabblyConnectBlock } from 'models'
import { byId, isNotDefined } from 'utils'
import { PabblyConnectBlock } from '@typebot.io/schemas'
import { byId, isNotDefined } from '@typebot.io/lib'
type Props = {
block: PabblyConnectBlock

View File

@@ -1,9 +1,13 @@
import { Alert, AlertIcon, Button, Link, Stack, Text } from '@chakra-ui/react'
import { ExternalLinkIcon } from '@/components/icons'
import { useTypebot } from '@/features/editor'
import { PabblyConnectBlock, Webhook, WebhookOptions } from 'models'
import {
PabblyConnectBlock,
Webhook,
WebhookOptions,
} from '@typebot.io/schemas'
import React, { useState } from 'react'
import { byId } from 'utils'
import { byId } from '@typebot.io/lib'
import { WebhookAdvancedConfigForm } from '../../webhook/components/WebhookAdvancedConfigForm'
import { TextInput } from '@/components/inputs'

View File

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

View File

@@ -8,9 +8,9 @@ import {
FormLabel,
} from '@chakra-ui/react'
import { CodeEditor } from '@/components/inputs/CodeEditor'
import { SendEmailOptions, Variable } from 'models'
import { SendEmailOptions, Variable } from '@typebot.io/schemas'
import React from 'react'
import { env, isNotEmpty } from 'utils'
import { env, isNotEmpty } from '@typebot.io/lib'
import { SmtpConfigModal } from './SmtpConfigModal'
import { SwitchWithLabel } from '@/components/inputs/SwitchWithLabel'
import { VariableSearchInput } from '@/components/inputs/VariableSearchInput'

View File

@@ -2,7 +2,7 @@ import { TextInput, NumberInput } from '@/components/inputs'
import { SwitchWithLabel } from '@/components/inputs/SwitchWithLabel'
import { Stack } from '@chakra-ui/react'
import { isDefined } from '@udecode/plate-common'
import { SmtpCredentials } from 'models'
import { SmtpCredentials } from '@typebot.io/schemas'
import React from 'react'
type Props = {

View File

@@ -10,12 +10,12 @@ import {
} from '@chakra-ui/react'
import { useUser } from '@/features/account'
import React, { useState } from 'react'
import { isNotDefined } from 'utils'
import { isNotDefined } from '@typebot.io/lib'
import { SmtpConfigForm } from './SmtpConfigForm'
import { useWorkspace } from '@/features/workspace'
import { useToast } from '@/hooks/useToast'
import { testSmtpConfig } from '../../queries/testSmtpConfigQuery'
import { SmtpCredentials } from 'models'
import { SmtpCredentials } from '@typebot.io/schemas'
import { trpc } from '@/lib/trpc'
type Props = {

View File

@@ -1,5 +1,5 @@
import test, { expect } from '@playwright/test'
import { importTypebotInDatabase } from 'utils/playwright/databaseActions'
import { importTypebotInDatabase } from '@typebot.io/lib/playwright/databaseActions'
import { createId } from '@paralleldrive/cuid2'
import { getTestAsset } from '@/test/utils/playwright'

View File

@@ -1,5 +1,5 @@
import { SmtpCredentials } from 'models'
import { sendRequest } from 'utils'
import { SmtpCredentials } from '@typebot.io/schemas'
import { sendRequest } from '@typebot.io/lib'
export const testSmtpConfig = (smtpData: SmtpCredentials['data'], to: string) =>
sendRequest({

View File

@@ -3,7 +3,7 @@ import prisma from '@/lib/prisma'
import { canReadTypebots } from '@/utils/api/dbRules'
import { authenticatedProcedure } from '@/utils/server/trpc'
import { TRPCError } from '@trpc/server'
import { Typebot, Webhook } from 'models'
import { Typebot, Webhook } from '@typebot.io/schemas'
import { z } from 'zod'
import { parseResultExample } from '../utils'

View File

@@ -2,8 +2,8 @@ import prisma from '@/lib/prisma'
import { canReadTypebots } from '@/utils/api/dbRules'
import { authenticatedProcedure } from '@/utils/server/trpc'
import { TRPCError } from '@trpc/server'
import { Group, Typebot, Webhook, WebhookBlock } from 'models'
import { byId, isWebhookBlock, parseGroupTitle } from 'utils'
import { Group, Typebot, Webhook, WebhookBlock } from '@typebot.io/schemas'
import { byId, isWebhookBlock, parseGroupTitle } from '@typebot.io/lib'
import { z } from 'zod'
export const listWebhookBlocksProcedure = authenticatedProcedure

View File

@@ -2,8 +2,8 @@ import prisma from '@/lib/prisma'
import { canWriteTypebots } from '@/utils/api/dbRules'
import { authenticatedProcedure } from '@/utils/server/trpc'
import { TRPCError } from '@trpc/server'
import { Typebot, Webhook, WebhookBlock } from 'models'
import { byId, isWebhookBlock } from 'utils'
import { Typebot, Webhook, WebhookBlock } from '@typebot.io/schemas'
import { byId, isWebhookBlock } from '@typebot.io/lib'
import { z } from 'zod'
export const subscribeWebhookProcedure = authenticatedProcedure

View File

@@ -2,8 +2,8 @@ import prisma from '@/lib/prisma'
import { canWriteTypebots } from '@/utils/api/dbRules'
import { authenticatedProcedure } from '@/utils/server/trpc'
import { TRPCError } from '@trpc/server'
import { Typebot, Webhook, WebhookBlock } from 'models'
import { byId, isWebhookBlock } from 'utils'
import { Typebot, Webhook, WebhookBlock } from '@typebot.io/schemas'
import { byId, isWebhookBlock } from '@typebot.io/lib'
import { z } from 'zod'
export const unsubscribeWebhookProcedure = authenticatedProcedure

View File

@@ -7,9 +7,9 @@ import {
Block,
Typebot,
TypebotLinkBlock,
} from 'models'
import { isInputBlock, byId, isNotDefined } from 'utils'
import { parseResultHeader } from 'utils/results'
} from '@typebot.io/schemas'
import { isInputBlock, byId, isNotDefined } from '@typebot.io/lib'
import { parseResultHeader } from '@typebot.io/lib/results'
export const parseResultExample =
(

View File

@@ -22,7 +22,7 @@ import {
ResponseVariableMapping,
WebhookOptions,
Webhook,
} from 'models'
} from '@typebot.io/schemas'
import { useState, useMemo } from 'react'
import { executeWebhook } from '../queries/executeWebhookQuery'
import { convertVariablesForTestToVariables } from '../utils/convertVariablesForTestToVariables'

View File

@@ -1,7 +1,7 @@
import { Stack, Text } from '@chakra-ui/react'
import { useTypebot } from '@/features/editor'
import { WebhookBlock } from 'models'
import { byId } from 'utils'
import { WebhookBlock } from '@typebot.io/schemas'
import { byId } from '@typebot.io/lib'
import { SetVariableLabel } from '@/components/SetVariableLabel'
type Props = {

View File

@@ -1,7 +1,7 @@
import { TextInput } from '@/components/inputs'
import { TableListItemProps } from '@/components/TableList'
import { Stack } from '@chakra-ui/react'
import { KeyValue } from 'models'
import { KeyValue } from '@typebot.io/schemas'
export const QueryParamsInputs = (props: TableListItemProps<KeyValue>) => (
<KeyValueInputs

View File

@@ -2,7 +2,7 @@ import { AutocompleteInput } from '@/components/inputs/AutocompleteInput'
import { TableListItemProps } from '@/components/TableList'
import { VariableSearchInput } from '@/components/inputs/VariableSearchInput'
import { Stack, FormControl, FormLabel } from '@chakra-ui/react'
import { Variable, ResponseVariableMapping } from 'models'
import { Variable, ResponseVariableMapping } from '@typebot.io/schemas'
export const DataVariableInputs = ({
item,

View File

@@ -2,7 +2,7 @@ import { TextInput } from '@/components/inputs'
import { TableListItemProps } from '@/components/TableList'
import { VariableSearchInput } from '@/components/inputs/VariableSearchInput'
import { Stack, FormControl, FormLabel } from '@chakra-ui/react'
import { VariableForTest, Variable } from 'models'
import { VariableForTest, Variable } from '@typebot.io/schemas'
export const VariableForTestInputs = ({
item,

View File

@@ -1,8 +1,8 @@
import React, { useState } from 'react'
import { Spinner, Stack } from '@chakra-ui/react'
import { useTypebot } from '@/features/editor'
import { WebhookOptions, Webhook, WebhookBlock } from 'models'
import { byId } from 'utils'
import { WebhookOptions, Webhook, WebhookBlock } from '@typebot.io/schemas'
import { byId } from '@typebot.io/lib'
import { TextInput } from '@/components/inputs'
import { WebhookAdvancedConfigForm } from '../WebhookAdvancedConfigForm'

View File

@@ -1,5 +1,5 @@
import { Webhook } from 'models'
import { sendRequest } from 'utils'
import { Webhook } from '@typebot.io/schemas'
import { sendRequest } from '@typebot.io/lib'
type Props = {
typebotId: string

View File

@@ -1,5 +1,5 @@
import { Webhook } from 'models'
import { sendRequest } from 'utils'
import { Webhook } from '@typebot.io/schemas'
import { sendRequest } from '@typebot.io/lib'
import { createWebhookQuery } from './createWebhookQuery'
type Props = {

View File

@@ -1,5 +1,5 @@
import { Variable, WebhookResponse } from 'models'
import { getViewerUrl, sendRequest } from 'utils'
import { Variable, WebhookResponse } from '@typebot.io/schemas'
import { getViewerUrl, sendRequest } from '@typebot.io/lib'
export const executeWebhook = (
typebotId: string,

View File

@@ -1,5 +1,5 @@
import { Webhook } from 'models'
import { sendRequest } from 'utils'
import { Webhook } from '@typebot.io/schemas'
import { sendRequest } from '@typebot.io/lib'
type Props = {
typebotId: string

View File

@@ -1,4 +1,4 @@
import { Variable, VariableForTest } from 'models'
import { Variable, VariableForTest } from '@typebot.io/schemas'
export const convertVariablesForTestToVariables = (
variablesForTest: VariableForTest[],

View File

@@ -2,11 +2,11 @@ import test, { expect, Page } from '@playwright/test'
import {
createWebhook,
importTypebotInDatabase,
} from 'utils/playwright/databaseActions'
import { HttpMethod } from 'models'
} from '@typebot.io/lib/playwright/databaseActions'
import { HttpMethod } from '@typebot.io/schemas'
import { createId } from '@paralleldrive/cuid2'
import { getTestAsset } from '@/test/utils/playwright'
import { apiToken } from 'utils/playwright/databaseSetup'
import { apiToken } from '@typebot.io/lib/playwright/databaseSetup'
test.describe('Builder', () => {
test('easy configuration should work', async ({ page }) => {

View File

@@ -1,7 +1,7 @@
import { Text } from '@chakra-ui/react'
import { useTypebot } from '@/features/editor'
import { ZapierBlock } from 'models'
import { byId, isNotDefined } from 'utils'
import { ZapierBlock } from '@typebot.io/schemas'
import { byId, isNotDefined } from '@typebot.io/lib'
type Props = {
block: ZapierBlock

View File

@@ -1,9 +1,9 @@
import { Alert, AlertIcon, Button, Link, Stack, Text } from '@chakra-ui/react'
import { ExternalLinkIcon } from '@/components/icons'
import { useTypebot } from '@/features/editor'
import { Webhook, WebhookOptions, ZapierBlock } from 'models'
import { Webhook, WebhookOptions, ZapierBlock } from '@typebot.io/schemas'
import React, { useCallback, useEffect, useState } from 'react'
import { byId } from 'utils'
import { byId } from '@typebot.io/lib'
import { WebhookAdvancedConfigForm } from '../../webhook/components/WebhookAdvancedConfigForm'
type Props = {