♻️ (builder) Remove barrel export and flatten folder arch

This commit is contained in:
Baptiste Arnaud
2023-03-15 11:51:30 +01:00
parent cbc8194f19
commit 44d7a0bcb8
498 changed files with 1542 additions and 1786 deletions

View File

@@ -5,7 +5,7 @@ type Props = {
block: ChatwootBlock
}
export const ChatwootBlockNodeLabel = ({ block }: Props) =>
export const ChatwootNodeBody = ({ block }: Props) =>
block.options.task === 'Close widget' ? (
<Text>Close Chatwoot</Text>
) : block.options.websiteToken.length === 0 ? (

View File

@@ -16,7 +16,7 @@ type Props = {
onOptionsChange: (options: ChatwootOptions) => void
}
export const ChatwootSettingsForm = ({ options, onOptionsChange }: Props) => {
export const ChatwootSettings = ({ options, onOptionsChange }: Props) => {
const updateTask = (task: (typeof chatwootTasks)[number]) => {
onOptionsChange({ ...options, task })
}

View File

@@ -1,3 +0,0 @@
export { ChatwootLogo } from './components/ChatwootLogo'
export { ChatwootBlockNodeLabel } from './components/ChatwootBlockNodeLabel'
export { ChatwootSettingsForm } from './components/ChatwootSettingsForm'

View File

@@ -6,7 +6,7 @@ type Props = {
action: GoogleAnalyticsOptions['action']
}
export const GoogleAnalyticsNodeContent = ({ action }: Props) => (
export const GoogleAnalyticsNodeBody = ({ action }: Props) => (
<Text color={action ? 'currentcolor' : 'gray.500'} noOfLines={1}>
{action ? `Track "${action}"` : 'Configure...'}
</Text>

View File

@@ -1,2 +0,0 @@
export { GoogleAnalyticsSettings } from './components/GoogleAnalyticsSettings'
export { GoogleAnalyticsLogo } from './components/GoogleAnalyticsLogo'

View File

@@ -12,12 +12,12 @@ import {
ModalFooter,
Flex,
} from '@chakra-ui/react'
import { useWorkspace } from '@/features/workspace'
import { useWorkspace } from '@/features/workspace/WorkspaceProvider'
import Link from 'next/link'
import React from 'react'
import { AlertInfo } from '@/components/AlertInfo'
import { GoogleLogo } from '@/components/GoogleLogo'
import { getGoogleSheetsConsentScreenUrlQuery } from '../../queries/getGoogleSheetsConsentScreenUrlQuery'
import { getGoogleSheetsConsentScreenUrlQuery } from '../queries/getGoogleSheetsConsentScreenUrlQuery'
type Props = {
isOpen: boolean

View File

@@ -1,6 +1,6 @@
import { Divider, Stack, Text, useDisclosure } from '@chakra-ui/react'
import { DropdownList } from '@/components/DropdownList'
import { useTypebot } from '@/features/editor'
import { useTypebot } from '@/features/editor/providers/TypebotProvider'
import {
Cell,
defaultGoogleSheetsGetOptions,
@@ -21,12 +21,12 @@ import { CellWithValueStack } from './CellWithValueStack'
import { CellWithVariableIdStack } from './CellWithVariableIdStack'
import { GoogleSheetConnectModal } from './GoogleSheetsConnectModal'
import { TableListItemProps, TableList } from '@/components/TableList'
import { CredentialsDropdown } from '@/features/credentials'
import { useSheets } from '../../hooks/useSheets'
import { Sheet } from '../../types'
import { CredentialsDropdown } from '@/features/credentials/components/CredentialsDropdown'
import { RowsFilterTableList } from './RowsFilterTableList'
import { createId } from '@paralleldrive/cuid2'
import { useWorkspace } from '@/features/workspace'
import { useWorkspace } from '@/features/workspace/WorkspaceProvider'
import { useSheets } from '../hooks/useSheets'
import { Sheet } from '../types'
type Props = {
options: GoogleSheetsOptions
@@ -34,7 +34,7 @@ type Props = {
blockId: string
}
export const GoogleSheetsSettingsBody = ({
export const GoogleSheetsSettings = ({
options,
onOptionsChange,
blockId,

View File

@@ -1,2 +0,0 @@
export * from './RowsFilterComparisonItem'
export * from './RowsFilterTableList'

View File

@@ -1 +0,0 @@
export { GoogleSheetsSettingsBody } from './GoogleSheetsSettingsBody'

View File

@@ -1,7 +1,7 @@
import { MoreInfoTooltip } from '@/components/MoreInfoTooltip'
import { Select } from '@/components/inputs/Select'
import { HStack, Input } from '@chakra-ui/react'
import { Sheet } from '../../types'
import { Sheet } from '../types'
type Props = {
sheets: Sheet[]

View File

@@ -1,6 +1,6 @@
import { Select } from '@/components/inputs/Select'
import { Input, Tooltip } from '@chakra-ui/react'
import { useSpreadsheets } from '../../hooks/useSpreadsheets'
import { useSpreadsheets } from '../hooks/useSpreadsheets'
type Props = {
credentialsId: string

View File

@@ -1,5 +1,5 @@
import { stringify } from 'qs'
import { fetcher } from '@/utils/helpers'
import { fetcher } from '@/helpers/fetcher'
import useSWR from 'swr'
import { Sheet } from '../types'

View File

@@ -1,5 +1,5 @@
import { stringify } from 'qs'
import { fetcher } from '@/utils/helpers'
import { fetcher } from '@/helpers/fetcher'
import useSWR from 'swr'
import { Spreadsheet } from '../types'

View File

@@ -1,3 +0,0 @@
export { GoogleSheetsSettingsBody } from './components/GoogleSheetsSettingsBody'
export { GoogleSheetsNodeContent } from './components/GoogleSheetsNodeContent'
export { GoogleSheetsLogo } from './components/GoogleSheetsLogo'

View File

@@ -1,5 +1,5 @@
import { Text } from '@chakra-ui/react'
import { useTypebot } from '@/features/editor'
import { useTypebot } from '@/features/editor/providers/TypebotProvider'
import { MakeComBlock } from '@typebot.io/schemas'
import { byId, isNotDefined } from '@typebot.io/lib'

View File

@@ -1,6 +1,6 @@
import { Alert, AlertIcon, Button, Link, Stack, Text } from '@chakra-ui/react'
import { ExternalLinkIcon } from '@/components/icons'
import { useTypebot } from '@/features/editor'
import { useTypebot } from '@/features/editor/providers/TypebotProvider'
import { MakeComBlock, Webhook, WebhookOptions } from '@typebot.io/schemas'
import React, { useCallback, useEffect, useState } from 'react'
import { byId } from '@typebot.io/lib'

View File

@@ -1,3 +0,0 @@
export * from './MakeComLogo'
export * from './MakeComContent'
export * from './MakeComSettings'

View File

@@ -1 +0,0 @@
export * from './components'

View File

@@ -1,6 +1,6 @@
import { TextInput } from '@/components/inputs/TextInput'
import { TextLink } from '@/components/TextLink'
import { useWorkspace } from '@/features/workspace'
import { useWorkspace } from '@/features/workspace/WorkspaceProvider'
import { useToast } from '@/hooks/useToast'
import { trpc } from '@/lib/trpc'
import {

View File

@@ -1,5 +1,5 @@
import { SetVariableLabel } from '@/components/SetVariableLabel'
import { useTypebot } from '@/features/editor'
import { useTypebot } from '@/features/editor/providers/TypebotProvider'
import { Stack, Text } from '@chakra-ui/react'
import {
ChatCompletionOpenAIOptions,

View File

@@ -1,6 +1,6 @@
import { Stack, useDisclosure } from '@chakra-ui/react'
import React from 'react'
import { CredentialsDropdown } from '@/features/credentials'
import { CredentialsDropdown } from '@/features/credentials/components/CredentialsDropdown'
import {
ChatCompletionOpenAIOptions,
CreateImageOpenAIOptions,

View File

@@ -1,5 +1,5 @@
import { Text } from '@chakra-ui/react'
import { useTypebot } from '@/features/editor'
import { useTypebot } from '@/features/editor/providers/TypebotProvider'
import { PabblyConnectBlock } from '@typebot.io/schemas'
import { byId, isNotDefined } from '@typebot.io/lib'

View File

@@ -1,6 +1,6 @@
import { Alert, AlertIcon, Button, Link, Stack, Text } from '@chakra-ui/react'
import { ExternalLinkIcon } from '@/components/icons'
import { useTypebot } from '@/features/editor'
import { useTypebot } from '@/features/editor/providers/TypebotProvider'
import {
PabblyConnectBlock,
Webhook,

View File

@@ -1,2 +0,0 @@
export * from './PabblyConnectContent'
export * from './PabblyConnectLogo'

View File

@@ -1 +0,0 @@
export * from './components'

View File

@@ -14,7 +14,7 @@ import { env, isNotEmpty } from '@typebot.io/lib'
import { SmtpConfigModal } from './SmtpConfigModal'
import { SwitchWithLabel } from '@/components/inputs/SwitchWithLabel'
import { VariableSearchInput } from '@/components/inputs/VariableSearchInput'
import { CredentialsDropdown } from '@/features/credentials'
import { CredentialsDropdown } from '@/features/credentials/components/CredentialsDropdown'
import { TextInput, Textarea } from '@/components/inputs'
import { useWorkspace } from '@/features/workspace/WorkspaceProvider'

View File

@@ -1 +0,0 @@
export { SendEmailSettings } from './SendEmailSettings'

View File

@@ -8,13 +8,13 @@ import {
ModalFooter,
Button,
} from '@chakra-ui/react'
import { useUser } from '@/features/account'
import { useUser } from '@/features/account/hooks/useUser'
import React, { useState } from 'react'
import { isNotDefined } from '@typebot.io/lib'
import { SmtpConfigForm } from './SmtpConfigForm'
import { useWorkspace } from '@/features/workspace'
import { useWorkspace } from '@/features/workspace/WorkspaceProvider'
import { useToast } from '@/hooks/useToast'
import { testSmtpConfig } from '../../queries/testSmtpConfigQuery'
import { testSmtpConfig } from '../queries/testSmtpConfigQuery'
import { SmtpCredentials } from '@typebot.io/schemas'
import { trpc } from '@/lib/trpc'

View File

@@ -1,3 +0,0 @@
export { SendEmailSettings } from './components/SendEmailSettings'
export { SendEmailContent } from './components/SendEmailContent'
export { SendEmailIcon } from './components/SendEmailIcon'

View File

@@ -1,13 +1,13 @@
import { getLinkedTypebots } from '@/features/blocks/logic/typebotLink/api'
import prisma from '@/lib/prisma'
import { canReadTypebots } from '@/utils/api/dbRules'
import { authenticatedProcedure } from '@/utils/server/trpc'
import { canReadTypebots } from '@/helpers/databaseRules'
import { authenticatedProcedure } from '@/helpers/server/trpc'
import { TRPCError } from '@trpc/server'
import { Typebot, Webhook } from '@typebot.io/schemas'
import { z } from 'zod'
import { parseResultExample } from '../utils'
import { getLinkedTypebots } from '@/features/blocks/logic/typebotLink/helpers/getLinkedTypebots'
import { parseResultExample } from '../helpers/parseResultExample'
export const getResultExampleProcedure = authenticatedProcedure
export const getResultExample = authenticatedProcedure
.meta({
openapi: {
method: 'GET',

View File

@@ -1 +0,0 @@
export * from './router'

View File

@@ -1,12 +1,12 @@
import prisma from '@/lib/prisma'
import { canReadTypebots } from '@/utils/api/dbRules'
import { authenticatedProcedure } from '@/utils/server/trpc'
import { canReadTypebots } from '@/helpers/databaseRules'
import { authenticatedProcedure } from '@/helpers/server/trpc'
import { TRPCError } from '@trpc/server'
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
export const listWebhookBlocks = authenticatedProcedure
.meta({
openapi: {
method: 'GET',

View File

@@ -1,4 +0,0 @@
export * from './getResultExampleProcedure'
export * from './listWebhookBlocksProcedure'
export * from './subscribeWebhookProcedure'
export * from './unsubscribeWebhookProcedure'

View File

@@ -1,14 +1,12 @@
import { router } from '@/utils/server/trpc'
import {
listWebhookBlocksProcedure,
subscribeWebhookProcedure,
unsubscribeWebhookProcedure,
getResultExampleProcedure,
} from './procedures'
import { router } from '@/helpers/server/trpc'
import { getResultExample } from './getResultExample'
import { listWebhookBlocks } from './listWebhookBlocks'
import { subscribeWebhook } from './subscribeWebhook'
import { unsubscribeWebhook } from './unsubscribeWebhook'
export const webhookRouter = router({
listWebhookBlocks: listWebhookBlocksProcedure,
getResultExample: getResultExampleProcedure,
subscribeWebhook: subscribeWebhookProcedure,
unsubscribeWebhook: unsubscribeWebhookProcedure,
listWebhookBlocks,
getResultExample,
subscribeWebhook,
unsubscribeWebhook,
})

View File

@@ -1,12 +1,12 @@
import prisma from '@/lib/prisma'
import { canWriteTypebots } from '@/utils/api/dbRules'
import { authenticatedProcedure } from '@/utils/server/trpc'
import { canWriteTypebots } from '@/helpers/databaseRules'
import { authenticatedProcedure } from '@/helpers/server/trpc'
import { TRPCError } from '@trpc/server'
import { Typebot, Webhook, WebhookBlock } from '@typebot.io/schemas'
import { byId, isWebhookBlock } from '@typebot.io/lib'
import { z } from 'zod'
export const subscribeWebhookProcedure = authenticatedProcedure
export const subscribeWebhook = authenticatedProcedure
.meta({
openapi: {
method: 'POST',

View File

@@ -1,12 +1,12 @@
import prisma from '@/lib/prisma'
import { canWriteTypebots } from '@/utils/api/dbRules'
import { authenticatedProcedure } from '@/utils/server/trpc'
import { canWriteTypebots } from '@/helpers/databaseRules'
import { authenticatedProcedure } from '@/helpers/server/trpc'
import { TRPCError } from '@trpc/server'
import { Typebot, Webhook, WebhookBlock } from '@typebot.io/schemas'
import { byId, isWebhookBlock } from '@typebot.io/lib'
import { z } from 'zod'
export const unsubscribeWebhookProcedure = authenticatedProcedure
export const unsubscribeWebhook = authenticatedProcedure
.meta({
openapi: {
method: 'POST',

View File

@@ -1 +0,0 @@
export * from './parseResultExample'

View File

@@ -2,7 +2,7 @@ import { DropdownList } from '@/components/DropdownList'
import { CodeEditor } from '@/components/inputs/CodeEditor'
import { SwitchWithLabel } from '@/components/inputs/SwitchWithLabel'
import { TableList, TableListItemProps } from '@/components/TableList'
import { useTypebot } from '@/features/editor'
import { useTypebot } from '@/features/editor/providers/TypebotProvider'
import { useToast } from '@/hooks/useToast'
import {
Stack,
@@ -25,14 +25,11 @@ import {
} from '@typebot.io/schemas'
import { useState, useMemo } from 'react'
import { executeWebhook } from '../queries/executeWebhookQuery'
import { convertVariablesForTestToVariables } from '../utils/convertVariablesForTestToVariables'
import { getDeepKeys } from '../utils/getDeepKeys'
import {
QueryParamsInputs,
HeadersInputs,
} from './WebhookSettings/KeyValueInputs'
import { DataVariableInputs } from './WebhookSettings/ResponseMappingInputs'
import { VariableForTestInputs } from './WebhookSettings/VariableForTestInputs'
import { convertVariablesForTestToVariables } from '../helpers/convertVariablesForTestToVariables'
import { getDeepKeys } from '../helpers/getDeepKeys'
import { QueryParamsInputs, HeadersInputs } from './KeyValueInputs'
import { DataVariableInputs } from './ResponseMappingInputs'
import { VariableForTestInputs } from './VariableForTestInputs'
type Props = {
blockId: string

View File

@@ -1,5 +1,5 @@
import { Stack, Text } from '@chakra-ui/react'
import { useTypebot } from '@/features/editor'
import { useTypebot } from '@/features/editor/providers/TypebotProvider'
import { WebhookBlock } from '@typebot.io/schemas'
import { byId } from '@typebot.io/lib'
import { SetVariableLabel } from '@/components/SetVariableLabel'

View File

@@ -1,10 +1,10 @@
import React, { useState } from 'react'
import { Spinner, Stack } from '@chakra-ui/react'
import { useTypebot } from '@/features/editor'
import { useTypebot } from '@/features/editor/providers/TypebotProvider'
import { WebhookOptions, Webhook, WebhookBlock } from '@typebot.io/schemas'
import { byId } from '@typebot.io/lib'
import { TextInput } from '@/components/inputs'
import { WebhookAdvancedConfigForm } from '../WebhookAdvancedConfigForm'
import { WebhookAdvancedConfigForm } from './WebhookAdvancedConfigForm'
type Props = {
block: WebhookBlock

View File

@@ -1 +0,0 @@
export { WebhookSettings } from './WebhookSettings'

View File

@@ -1,4 +0,0 @@
export { duplicateWebhookQuery } from './queries/duplicateWebhookQuery'
export { WebhookSettings } from './components/WebhookSettings'
export { WebhookContent } from './components/WebhookContent'
export { WebhookIcon } from './components/WebhookIcon'

View File

@@ -1,5 +1,5 @@
import { Text } from '@chakra-ui/react'
import { useTypebot } from '@/features/editor'
import { useTypebot } from '@/features/editor/providers/TypebotProvider'
import { ZapierBlock } from '@typebot.io/schemas'
import { byId, isNotDefined } from '@typebot.io/lib'

View File

@@ -1,6 +1,6 @@
import { Alert, AlertIcon, Button, Link, Stack, Text } from '@chakra-ui/react'
import { ExternalLinkIcon } from '@/components/icons'
import { useTypebot } from '@/features/editor'
import { useTypebot } from '@/features/editor/providers/TypebotProvider'
import { Webhook, WebhookOptions, ZapierBlock } from '@typebot.io/schemas'
import React, { useCallback, useEffect, useState } from 'react'
import { byId } from '@typebot.io/lib'

View File

@@ -1,3 +0,0 @@
export { ZapierSettings } from './components/ZapierSettings'
export { ZapierContent } from './components/ZapierContent'
export { ZapierLogo } from './components/ZapierLogo'