♻️ Re-organize workspace folders
This commit is contained in:
@@ -1,20 +1,20 @@
|
||||
const { withSentryConfig } = require('@sentry/nextjs')
|
||||
const path = require('path')
|
||||
const withTM = require('next-transpile-modules')([
|
||||
'utils',
|
||||
'models',
|
||||
'emails',
|
||||
'bot-engine',
|
||||
])
|
||||
|
||||
/** @type {import('next').NextConfig} */
|
||||
const nextConfig = withTM({
|
||||
const nextConfig = {
|
||||
reactStrictMode: true,
|
||||
transpilePackages: [
|
||||
'@typebot.io/lib',
|
||||
'@typebot.io/schemas',
|
||||
'@typebot.io/emails',
|
||||
'bot-engine',
|
||||
],
|
||||
output: 'standalone',
|
||||
experimental: {
|
||||
outputFileTracingRoot: path.join(__dirname, '../../'),
|
||||
},
|
||||
})
|
||||
}
|
||||
|
||||
const sentryWebpackPluginOptions = {
|
||||
silent: true,
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
{
|
||||
"extends": "tsconfig/nextjs.json",
|
||||
"extends": "@typebot.io/tsconfig/nextjs.json",
|
||||
"compilerOptions": {
|
||||
"jsx": "react-jsx",
|
||||
"baseUrl": ".",
|
||||
|
||||
@@ -3,10 +3,10 @@
|
||||
"license": "AGPL-3.0-or-later",
|
||||
"version": "0.1.0",
|
||||
"scripts": {
|
||||
"dev": "cross-env ENVSH_ENV=.env.local bash ../../env.sh next dev -p 3001",
|
||||
"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 3001",
|
||||
"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/viewer/.env.docker ENVSH_OUTPUT=./apps/viewer/public/__env.js bash env.sh",
|
||||
"build:env": "cd ../.. && cross-env ENVSH_ENV=./apps/viewer/.env.docker ENVSH_OUTPUT=./apps/viewer/public/__env.js bash scripts/env.sh",
|
||||
"start": "next start -p 3001",
|
||||
"lint": "next lint",
|
||||
"test": "pnpm playwright test",
|
||||
@@ -20,7 +20,7 @@
|
||||
"aws-sdk": "2.1334.0",
|
||||
"bot-engine": "workspace:*",
|
||||
"cors": "2.8.5",
|
||||
"db": "workspace:*",
|
||||
"@typebot.io/prisma": "workspace:*",
|
||||
"google-spreadsheet": "3.3.0",
|
||||
"got": "12.6.0",
|
||||
"libphonenumber-js": "1.10.21",
|
||||
@@ -48,18 +48,17 @@
|
||||
"@types/react": "18.0.28",
|
||||
"@types/sanitize-html": "2.8.1",
|
||||
"dotenv": "16.0.3",
|
||||
"emails": "workspace:*",
|
||||
"@typebot.io/emails": "workspace:*",
|
||||
"eslint": "8.36.0",
|
||||
"eslint-config-custom": "workspace:*",
|
||||
"google-auth-library": "8.7.0",
|
||||
"models": "workspace:*",
|
||||
"next-transpile-modules": "10.0.0",
|
||||
"@typebot.io/schemas": "workspace:*",
|
||||
"node-fetch": "3.3.1",
|
||||
"papaparse": "5.4.0",
|
||||
"superjson": "1.12.2",
|
||||
"tsconfig": "workspace:*",
|
||||
"@typebot.io/tsconfig": "workspace:*",
|
||||
"typescript": "4.9.5",
|
||||
"utils": "workspace:*",
|
||||
"@typebot.io/lib": "workspace:*",
|
||||
"zod": "3.21.4"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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,
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import React from 'react'
|
||||
import { getViewerUrl, isEmpty } from 'utils'
|
||||
import { getViewerUrl, isEmpty } from '@typebot.io/lib'
|
||||
|
||||
export const ErrorPage = ({ error }: { error: Error }) => {
|
||||
return (
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
import { gtmHeadSnippet } from '@/lib/google-tag-manager'
|
||||
import { Metadata } from 'models'
|
||||
import { Metadata } from '@typebot.io/schemas'
|
||||
import Head from 'next/head'
|
||||
import Script from 'next/script'
|
||||
import React from 'react'
|
||||
import { isNotEmpty } from 'utils'
|
||||
import { isNotEmpty } from '@typebot.io/lib'
|
||||
|
||||
type SEOProps = {
|
||||
url: string
|
||||
|
||||
@@ -1,5 +1,10 @@
|
||||
import { TypebotViewer } from 'bot-engine'
|
||||
import { AnswerInput, PublicTypebot, Typebot, VariableWithValue } from 'models'
|
||||
import {
|
||||
AnswerInput,
|
||||
PublicTypebot,
|
||||
Typebot,
|
||||
VariableWithValue,
|
||||
} from '@typebot.io/schemas'
|
||||
import { useRouter } from 'next/router'
|
||||
import React, { useEffect, useState } from 'react'
|
||||
import {
|
||||
@@ -7,7 +12,7 @@ import {
|
||||
isDefined,
|
||||
isNotDefined,
|
||||
isNotEmpty,
|
||||
} from 'utils'
|
||||
} from '@typebot.io/lib'
|
||||
import { SEO } from './Seo'
|
||||
import { ErrorPage } from './ErrorPage'
|
||||
import { createResultQuery, updateResultQuery } from '@/features/results'
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { Standard } from '@typebot.io/react'
|
||||
import { BackgroundType, Typebot } from 'models'
|
||||
import { BackgroundType, Typebot } from '@typebot.io/schemas'
|
||||
import { useRouter } from 'next/router'
|
||||
import { SEO } from './Seo'
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { Answer, AnswerInput } from 'models'
|
||||
import { sendRequest } from 'utils'
|
||||
import { Answer, AnswerInput } from '@typebot.io/schemas'
|
||||
import { sendRequest } from '@typebot.io/lib'
|
||||
|
||||
export const upsertAnswerQuery = async (
|
||||
answer: AnswerInput & { resultId: string } & { uploadedFiles?: boolean }
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { User } from 'db'
|
||||
import { User } from '@typebot.io/prisma'
|
||||
import { NextApiRequest } from 'next'
|
||||
import prisma from '@/lib/prisma'
|
||||
|
||||
|
||||
@@ -4,8 +4,8 @@ import {
|
||||
VariableWithValue,
|
||||
ChoiceInputBlock,
|
||||
ItemType,
|
||||
} from 'models'
|
||||
import { isDefined } from 'utils'
|
||||
} from '@typebot.io/schemas'
|
||||
import { isDefined } from '@typebot.io/lib'
|
||||
|
||||
export const injectVariableValuesInButtonsInputBlock =
|
||||
(variables: SessionState['typebot']['variables']) =>
|
||||
|
||||
@@ -2,14 +2,14 @@ import test, { expect } from '@playwright/test'
|
||||
import { createId } from '@paralleldrive/cuid2'
|
||||
import { parse } from 'papaparse'
|
||||
import { readFileSync } from 'fs'
|
||||
import { isDefined } from 'utils'
|
||||
import { isDefined } from '@typebot.io/lib'
|
||||
import {
|
||||
createWorkspaces,
|
||||
importTypebotInDatabase,
|
||||
injectFakeResults,
|
||||
} from 'utils/playwright/databaseActions'
|
||||
} from '@typebot.io/lib/playwright/databaseActions'
|
||||
import { getTestAsset } from '@/test/utils/playwright'
|
||||
import { Plan } from 'db'
|
||||
import { Plan } from '@typebot.io/prisma'
|
||||
|
||||
const THREE_GIGABYTES = 3 * 1024 * 1024 * 1024
|
||||
|
||||
|
||||
@@ -6,9 +6,9 @@ import {
|
||||
PaymentInputRuntimeOptions,
|
||||
SessionState,
|
||||
StripeCredentials,
|
||||
} from 'models'
|
||||
} from '@typebot.io/schemas'
|
||||
import Stripe from 'stripe'
|
||||
import { decrypt } from 'utils/api/encryption'
|
||||
import { decrypt } from '@typebot.io/lib/api/encryption'
|
||||
|
||||
export const computePaymentInputRuntimeOptions =
|
||||
(state: Pick<SessionState, 'result' | 'typebot'>) =>
|
||||
|
||||
@@ -4,7 +4,11 @@ import {
|
||||
parseCorrectValueType,
|
||||
extractVariablesFromText,
|
||||
} from '@/features/variables'
|
||||
import { ChatwootBlock, ChatwootOptions, SessionState } from 'models'
|
||||
import {
|
||||
ChatwootBlock,
|
||||
ChatwootOptions,
|
||||
SessionState,
|
||||
} from '@typebot.io/schemas'
|
||||
|
||||
const parseSetUserCode = (user: ChatwootOptions['user']) => `
|
||||
window.$chatwoot.setUser("${user?.id ?? ''}", {
|
||||
|
||||
@@ -1,8 +1,11 @@
|
||||
import test, { expect } from '@playwright/test'
|
||||
import { createId } from '@paralleldrive/cuid2'
|
||||
import { createTypebots } from 'utils/playwright/databaseActions'
|
||||
import { parseDefaultGroupWithBlock } from 'utils/playwright/databaseHelpers'
|
||||
import { defaultChatwootOptions, IntegrationBlockType } from 'models'
|
||||
import { createTypebots } from '@typebot.io/lib/playwright/databaseActions'
|
||||
import { parseDefaultGroupWithBlock } from '@typebot.io/lib/playwright/databaseHelpers'
|
||||
import {
|
||||
defaultChatwootOptions,
|
||||
IntegrationBlockType,
|
||||
} from '@typebot.io/schemas'
|
||||
|
||||
const typebotId = createId()
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { ExecuteIntegrationResponse } from '@/features/chat'
|
||||
import { deepParseVariable } from '@/features/variables'
|
||||
import { GoogleAnalyticsBlock, SessionState } from 'models'
|
||||
import { GoogleAnalyticsBlock, SessionState } from '@typebot.io/schemas'
|
||||
|
||||
export const executeGoogleAnalyticsBlock = (
|
||||
{ typebot: { variables } }: SessionState,
|
||||
|
||||
@@ -1,5 +1,9 @@
|
||||
import { ExecuteIntegrationResponse } from '@/features/chat'
|
||||
import { GoogleSheetsBlock, GoogleSheetsAction, SessionState } from 'models'
|
||||
import {
|
||||
GoogleSheetsBlock,
|
||||
GoogleSheetsAction,
|
||||
SessionState,
|
||||
} from '@typebot.io/schemas'
|
||||
import { getRow } from './getRow'
|
||||
import { insertRow } from './insertRow'
|
||||
import { updateRow } from './updateRow'
|
||||
|
||||
@@ -5,11 +5,11 @@ import {
|
||||
ComparisonOperators,
|
||||
LogicalOperator,
|
||||
ReplyLog,
|
||||
} from 'models'
|
||||
} from '@typebot.io/schemas'
|
||||
import { saveErrorLog } from '@/features/logs/api'
|
||||
import { getAuthenticatedGoogleDoc } from './helpers'
|
||||
import { deepParseVariable, updateVariables } from '@/features/variables'
|
||||
import { isNotEmpty, byId, isDefined } from 'utils'
|
||||
import { isNotEmpty, byId, isDefined } from '@typebot.io/lib'
|
||||
import { ExecuteIntegrationResponse } from '@/features/chat'
|
||||
import type { GoogleSpreadsheetRow } from 'google-spreadsheet'
|
||||
|
||||
|
||||
@@ -2,7 +2,7 @@ import { parseVariables } from '@/features/variables'
|
||||
import { getAuthenticatedGoogleClient } from '@/lib/google-sheets'
|
||||
import { TRPCError } from '@trpc/server'
|
||||
import { GoogleSpreadsheet } from 'google-spreadsheet'
|
||||
import { Variable, Cell } from 'models'
|
||||
import { Variable, Cell } from '@typebot.io/schemas'
|
||||
|
||||
export const parseCellValues =
|
||||
(variables: Variable[]) =>
|
||||
|
||||
@@ -1,4 +1,8 @@
|
||||
import { SessionState, GoogleSheetsInsertRowOptions, ReplyLog } from 'models'
|
||||
import {
|
||||
SessionState,
|
||||
GoogleSheetsInsertRowOptions,
|
||||
ReplyLog,
|
||||
} from '@typebot.io/schemas'
|
||||
import { saveErrorLog, saveSuccessLog } from '@/features/logs/api'
|
||||
import { getAuthenticatedGoogleDoc, parseCellValues } from './helpers'
|
||||
import { ExecuteIntegrationResponse } from '@/features/chat'
|
||||
|
||||
@@ -1,4 +1,8 @@
|
||||
import { SessionState, GoogleSheetsUpdateRowOptions, ReplyLog } from 'models'
|
||||
import {
|
||||
SessionState,
|
||||
GoogleSheetsUpdateRowOptions,
|
||||
ReplyLog,
|
||||
} from '@typebot.io/schemas'
|
||||
import { saveErrorLog, saveSuccessLog } from '@/features/logs/api'
|
||||
import { getAuthenticatedGoogleDoc, parseCellValues } from './helpers'
|
||||
import { TRPCError } from '@trpc/server'
|
||||
|
||||
@@ -8,14 +8,14 @@ import {
|
||||
Variable,
|
||||
VariableWithUnknowValue,
|
||||
VariableWithValue,
|
||||
} from 'models'
|
||||
} from '@typebot.io/schemas'
|
||||
import {
|
||||
ChatCompletionOpenAIOptions,
|
||||
OpenAICredentials,
|
||||
} from 'models/features/blocks/integrations/openai'
|
||||
} from '@typebot.io/schemas/features/blocks/integrations/openai'
|
||||
import { OpenAIApi, Configuration, ChatCompletionRequestMessage } from 'openai'
|
||||
import { isDefined, byId, isNotEmpty } from 'utils'
|
||||
import { decrypt } from 'utils/api/encryption'
|
||||
import { isDefined, byId, isNotEmpty } from '@typebot.io/lib'
|
||||
import { decrypt } from '@typebot.io/lib/api/encryption'
|
||||
|
||||
export const createChatCompletionOpenAI = async (
|
||||
state: SessionState,
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { ExecuteIntegrationResponse } from '@/features/chat/types'
|
||||
import { SessionState } from 'models'
|
||||
import { OpenAIBlock } from 'models/features/blocks/integrations/openai'
|
||||
import { SessionState } from '@typebot.io/schemas'
|
||||
import { OpenAIBlock } from '@typebot.io/schemas/features/blocks/integrations/openai'
|
||||
import { createChatCompletionOpenAI } from './createChatCompletionOpenAI'
|
||||
|
||||
export const executeOpenAIBlock = async (
|
||||
|
||||
@@ -3,7 +3,7 @@ import { saveErrorLog, saveSuccessLog } from '@/features/logs/api'
|
||||
import { parseVariables } from '@/features/variables'
|
||||
import prisma from '@/lib/prisma'
|
||||
import { render } from '@faire/mjml-react/utils/render'
|
||||
import { DefaultBotNotificationEmail } from 'emails'
|
||||
import { DefaultBotNotificationEmail } from '@typebot.io/emails'
|
||||
import {
|
||||
PublicTypebot,
|
||||
ResultInSession,
|
||||
@@ -11,12 +11,12 @@ import {
|
||||
SendEmailOptions,
|
||||
SessionState,
|
||||
SmtpCredentials,
|
||||
} from 'models'
|
||||
} from '@typebot.io/schemas'
|
||||
import { createTransport } from 'nodemailer'
|
||||
import Mail from 'nodemailer/lib/mailer'
|
||||
import { byId, isEmpty, isNotDefined, omit } from 'utils'
|
||||
import { parseAnswers } from 'utils/results'
|
||||
import { decrypt } from 'utils/api'
|
||||
import { byId, isEmpty, isNotDefined, omit } from '@typebot.io/lib'
|
||||
import { parseAnswers } from '@typebot.io/lib/results'
|
||||
import { decrypt } from '@typebot.io/lib/api'
|
||||
import { defaultFrom, defaultTransportOptions } from '../constants'
|
||||
|
||||
export const executeSendEmailBlock = async (
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
import test, { expect } from '@playwright/test'
|
||||
import { createSmtpCredentials } from '../../../../test/utils/databaseActions'
|
||||
import { createId } from '@paralleldrive/cuid2'
|
||||
import { importTypebotInDatabase } from 'utils/playwright/databaseActions'
|
||||
import { importTypebotInDatabase } from '@typebot.io/lib/playwright/databaseActions'
|
||||
import { getTestAsset } from '@/test/utils/playwright'
|
||||
import { SmtpCredentials } from 'models'
|
||||
import { SmtpCredentials } from '@typebot.io/schemas'
|
||||
|
||||
export const mockSmtpCredentials: SmtpCredentials['data'] = {
|
||||
from: {
|
||||
|
||||
@@ -20,10 +20,10 @@ import {
|
||||
KeyValue,
|
||||
ReplyLog,
|
||||
ResultInSession,
|
||||
} from 'models'
|
||||
} from '@typebot.io/schemas'
|
||||
import { stringify } from 'qs'
|
||||
import { byId, omit } from 'utils'
|
||||
import { parseAnswers } from 'utils/results'
|
||||
import { byId, omit } from '@typebot.io/lib'
|
||||
import { parseAnswers } from '@typebot.io/lib/results'
|
||||
import got, { Method, Headers, HTTPError } from 'got'
|
||||
import { parseSampleResult } from './parseSampleResult'
|
||||
|
||||
|
||||
@@ -8,9 +8,9 @@ import {
|
||||
Typebot,
|
||||
TypebotLinkBlock,
|
||||
Variable,
|
||||
} 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 parseSampleResult =
|
||||
(
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
import test, { expect } from '@playwright/test'
|
||||
import { createId } from '@paralleldrive/cuid2'
|
||||
import { HttpMethod } from 'models'
|
||||
import { HttpMethod } from '@typebot.io/schemas'
|
||||
import {
|
||||
createWebhook,
|
||||
importTypebotInDatabase,
|
||||
} from 'utils/playwright/databaseActions'
|
||||
} from '@typebot.io/lib/playwright/databaseActions'
|
||||
import { getTestAsset } from '@/test/utils/playwright'
|
||||
|
||||
const typebotId = createId()
|
||||
|
||||
@@ -7,8 +7,8 @@ import {
|
||||
LogicalOperator,
|
||||
SessionState,
|
||||
Variable,
|
||||
} from 'models'
|
||||
import { isNotDefined, isDefined } from 'utils'
|
||||
} from '@typebot.io/schemas'
|
||||
import { isNotDefined, isDefined } from '@typebot.io/lib'
|
||||
|
||||
export const executeCondition = (
|
||||
{ typebot: { variables } }: SessionState,
|
||||
|
||||
@@ -4,8 +4,8 @@ import {
|
||||
createPortalEdge,
|
||||
} from '@/features/chat/api/utils/addEdgeToTypebot'
|
||||
import { TRPCError } from '@trpc/server'
|
||||
import { SessionState } from 'models'
|
||||
import { JumpBlock } from 'models/features/blocks/logic/jump'
|
||||
import { SessionState } from '@typebot.io/schemas'
|
||||
import { JumpBlock } from '@typebot.io/schemas/features/blocks/logic/jump'
|
||||
|
||||
export const executeJumpBlock = (
|
||||
state: SessionState,
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import { ExecuteLogicResponse } from '@/features/chat'
|
||||
import { parseVariables } from '@/features/variables'
|
||||
import { RedirectBlock, SessionState } from 'models'
|
||||
import { sanitizeUrl } from 'utils'
|
||||
import { RedirectBlock, SessionState } from '@typebot.io/schemas'
|
||||
import { sanitizeUrl } from '@typebot.io/lib'
|
||||
|
||||
export const executeRedirect = (
|
||||
{ typebot: { variables } }: SessionState,
|
||||
|
||||
@@ -4,7 +4,7 @@ import {
|
||||
parseCorrectValueType,
|
||||
extractVariablesFromText,
|
||||
} from '@/features/variables'
|
||||
import { ScriptBlock, SessionState } from 'models'
|
||||
import { ScriptBlock, SessionState } from '@typebot.io/schemas'
|
||||
|
||||
export const executeScript = (
|
||||
{ typebot: { variables } }: SessionState,
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { SessionState, SetVariableBlock, Variable } from 'models'
|
||||
import { byId } from 'utils'
|
||||
import { SessionState, SetVariableBlock, Variable } from '@typebot.io/schemas'
|
||||
import { byId } from '@typebot.io/lib'
|
||||
import {
|
||||
parseVariables,
|
||||
parseCorrectValueType,
|
||||
|
||||
@@ -10,8 +10,8 @@ import {
|
||||
SessionState,
|
||||
TypebotInSession,
|
||||
Variable,
|
||||
} from 'models'
|
||||
import { byId } from 'utils'
|
||||
} from '@typebot.io/schemas'
|
||||
import { byId } from '@typebot.io/lib'
|
||||
|
||||
export const executeTypebotLink = async (
|
||||
state: SessionState,
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import prisma from '@/lib/prisma'
|
||||
import { PublicTypebot, Typebot } from 'models'
|
||||
import { PublicTypebot, Typebot } from '@typebot.io/schemas'
|
||||
|
||||
type Props = {
|
||||
isPreview: boolean
|
||||
|
||||
@@ -1,13 +1,13 @@
|
||||
import prisma from '@/lib/prisma'
|
||||
import { canReadTypebots } from '@/utils/api/dbRules'
|
||||
import { User } from 'db'
|
||||
import { User } from '@typebot.io/prisma'
|
||||
import {
|
||||
LogicBlockType,
|
||||
PublicTypebot,
|
||||
Typebot,
|
||||
TypebotLinkBlock,
|
||||
} from 'models'
|
||||
import { isDefined } from 'utils'
|
||||
} from '@typebot.io/schemas'
|
||||
import { isDefined } from '@typebot.io/lib'
|
||||
|
||||
type Props = {
|
||||
typebots: Pick<PublicTypebot, 'groups'>[]
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { getTestAsset } from '@/test/utils/playwright'
|
||||
import test, { expect } from '@playwright/test'
|
||||
import { importTypebotInDatabase } from 'utils/playwright/databaseActions'
|
||||
import { importTypebotInDatabase } from '@typebot.io/lib/playwright/databaseActions'
|
||||
|
||||
const typebotId = 'cl0ibhi7s0018n21aarlmg0cm'
|
||||
const linkedTypebotId = 'cl0ibhv8d0130n21aw8doxhj5'
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { ExecuteLogicResponse } from '@/features/chat'
|
||||
import { parseVariables } from '@/features/variables'
|
||||
import { SessionState, WaitBlock } from 'models'
|
||||
import { SessionState, WaitBlock } from '@typebot.io/schemas'
|
||||
|
||||
export const executeWait = async (
|
||||
{ typebot: { variables } }: SessionState,
|
||||
|
||||
@@ -8,7 +8,7 @@ import {
|
||||
import prisma from '@/lib/prisma'
|
||||
import { publicProcedure } from '@/utils/server/trpc'
|
||||
import { TRPCError } from '@trpc/server'
|
||||
import { Prisma } from 'db'
|
||||
import { Prisma } from '@typebot.io/prisma'
|
||||
import {
|
||||
ChatReply,
|
||||
chatReplySchema,
|
||||
@@ -22,14 +22,14 @@ import {
|
||||
Typebot,
|
||||
Variable,
|
||||
VariableWithValue,
|
||||
} from 'models'
|
||||
} from '@typebot.io/schemas'
|
||||
import {
|
||||
continueBotFlow,
|
||||
getSession,
|
||||
setResultAsCompleted,
|
||||
startBotFlow,
|
||||
} from '../utils'
|
||||
import { env, isDefined, omit } from 'utils'
|
||||
import { env, isDefined, omit } from '@typebot.io/lib'
|
||||
|
||||
export const sendMessageProcedure = publicProcedure
|
||||
.meta({
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { createId } from '@paralleldrive/cuid2'
|
||||
import { SessionState, Edge } from 'models'
|
||||
import { SessionState, Edge } from '@typebot.io/schemas'
|
||||
|
||||
export const addEdgeToTypebot = (
|
||||
state: SessionState,
|
||||
|
||||
@@ -7,7 +7,7 @@ import { validateUrl } from '@/features/blocks/inputs/url/api'
|
||||
import { parseVariables, updateVariables } from '@/features/variables'
|
||||
import prisma from '@/lib/prisma'
|
||||
import { TRPCError } from '@trpc/server'
|
||||
import { Prisma } from 'db'
|
||||
import { Prisma } from '@typebot.io/prisma'
|
||||
import got from 'got'
|
||||
import {
|
||||
Block,
|
||||
@@ -18,8 +18,8 @@ import {
|
||||
InputBlockType,
|
||||
ResultInSession,
|
||||
SessionState,
|
||||
} from 'models'
|
||||
import { isInputBlock, isNotDefined } from 'utils'
|
||||
} from '@typebot.io/schemas'
|
||||
import { isInputBlock, isNotDefined } from '@typebot.io/lib'
|
||||
import { executeGroup } from './executeGroup'
|
||||
import { getNextGroup } from './getNextGroup'
|
||||
|
||||
|
||||
@@ -8,14 +8,14 @@ import {
|
||||
InputBlockType,
|
||||
RuntimeOptions,
|
||||
SessionState,
|
||||
} from 'models'
|
||||
} from '@typebot.io/schemas'
|
||||
import {
|
||||
isBubbleBlock,
|
||||
isDefined,
|
||||
isInputBlock,
|
||||
isIntegrationBlock,
|
||||
isLogicBlock,
|
||||
} from 'utils'
|
||||
} from '@typebot.io/lib'
|
||||
import { executeLogic } from './executeLogic'
|
||||
import { getNextGroup } from './getNextGroup'
|
||||
import { executeIntegration } from './executeIntegration'
|
||||
|
||||
@@ -4,7 +4,11 @@ import { executeGoogleSheetBlock } from '@/features/blocks/integrations/googleSh
|
||||
import { executeOpenAIBlock } from '@/features/blocks/integrations/openai/executeOpenAIBlock'
|
||||
import { executeSendEmailBlock } from '@/features/blocks/integrations/sendEmail/api'
|
||||
import { executeWebhookBlock } from '@/features/blocks/integrations/webhook/api'
|
||||
import { IntegrationBlock, IntegrationBlockType, SessionState } from 'models'
|
||||
import {
|
||||
IntegrationBlock,
|
||||
IntegrationBlockType,
|
||||
SessionState,
|
||||
} from '@typebot.io/schemas'
|
||||
import { ExecuteIntegrationResponse } from '../../types'
|
||||
|
||||
export const executeIntegration =
|
||||
|
||||
@@ -3,7 +3,7 @@ import { executeRedirect } from '@/features/blocks/logic/redirect/api'
|
||||
import { executeSetVariable } from '@/features/blocks/logic/setVariable/api'
|
||||
import { executeTypebotLink } from '@/features/blocks/logic/typebotLink/api'
|
||||
import { executeWait } from '@/features/blocks/logic/wait/api/utils/executeWait'
|
||||
import { LogicBlock, LogicBlockType, SessionState } from 'models'
|
||||
import { LogicBlock, LogicBlockType, SessionState } from '@typebot.io/schemas'
|
||||
import { ExecuteLogicResponse } from '../../types'
|
||||
import { executeScript } from '@/features/blocks/logic/script/executeScript'
|
||||
import { executeJumpBlock } from '@/features/blocks/logic/jump/executeJumpBlock'
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { byId } from 'utils'
|
||||
import { Group, SessionState } from 'models'
|
||||
import { byId } from '@typebot.io/lib'
|
||||
import { Group, SessionState } from '@typebot.io/schemas'
|
||||
|
||||
export type NextGroup = {
|
||||
group: Group
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import prisma from '@/lib/prisma'
|
||||
import { ChatSession } from 'models'
|
||||
import { ChatSession } from '@typebot.io/schemas'
|
||||
|
||||
export const getSession = async (
|
||||
sessionId: string
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { TRPCError } from '@trpc/server'
|
||||
import { ChatReply, SessionState } from 'models'
|
||||
import { ChatReply, SessionState } from '@typebot.io/schemas'
|
||||
import { executeGroup } from './executeGroup'
|
||||
import { getNextGroup } from './getNextGroup'
|
||||
|
||||
|
||||
@@ -2,13 +2,13 @@ import { getTestAsset } from '@/test/utils/playwright'
|
||||
import test, { expect } from '@playwright/test'
|
||||
import { createId } from '@paralleldrive/cuid2'
|
||||
import prisma from '@/lib/prisma'
|
||||
import { HttpMethod, SendMessageInput } from 'models'
|
||||
import { HttpMethod, SendMessageInput } from '@typebot.io/schemas'
|
||||
import {
|
||||
createWebhook,
|
||||
deleteTypebots,
|
||||
deleteWebhooks,
|
||||
importTypebotInDatabase,
|
||||
} from 'utils/playwright/databaseActions'
|
||||
} from '@typebot.io/lib/playwright/databaseActions'
|
||||
|
||||
test.afterEach(async () => {
|
||||
await deleteWebhooks(['chat-webhook-id'])
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { ChatReply, SessionState } from 'models'
|
||||
import { ChatReply, SessionState } from '@typebot.io/schemas'
|
||||
|
||||
export type EdgeId = string
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import prisma from '@/lib/prisma'
|
||||
import { isNotDefined } from 'utils'
|
||||
import { isNotDefined } from '@typebot.io/lib'
|
||||
|
||||
export const saveLog = (
|
||||
status: 'error' | 'success',
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { Result } from 'models'
|
||||
import { sendRequest } from 'utils'
|
||||
import { Result } from '@typebot.io/schemas'
|
||||
import { sendRequest } from '@typebot.io/lib'
|
||||
|
||||
export const createResultQuery = async (typebotId: string) => {
|
||||
return sendRequest<{ result: Result; hasReachedLimit: boolean }>({
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { Result } from 'models'
|
||||
import { sendRequest } from 'utils'
|
||||
import { Result } from '@typebot.io/schemas'
|
||||
import { sendRequest } from '@typebot.io/lib'
|
||||
|
||||
export const updateResultQuery = async (
|
||||
resultId: string,
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import { getTestAsset } from '@/test/utils/playwright'
|
||||
import test, { expect } from '@playwright/test'
|
||||
import { createId } from '@paralleldrive/cuid2'
|
||||
import { importTypebotInDatabase } from 'utils/playwright/databaseActions'
|
||||
import { importTypebotInDatabase } from '@typebot.io/lib/playwright/databaseActions'
|
||||
|
||||
test('Big groups should work as expected', async ({ page }) => {
|
||||
const typebotId = createId()
|
||||
|
||||
@@ -5,9 +5,12 @@ import {
|
||||
defaultTextInputOptions,
|
||||
InputBlockType,
|
||||
Metadata,
|
||||
} from 'models'
|
||||
import { createTypebots, updateTypebot } from 'utils/playwright/databaseActions'
|
||||
import { parseDefaultGroupWithBlock } from 'utils/playwright/databaseHelpers'
|
||||
} from '@typebot.io/schemas'
|
||||
import {
|
||||
createTypebots,
|
||||
updateTypebot,
|
||||
} from '@typebot.io/lib/playwright/databaseActions'
|
||||
import { parseDefaultGroupWithBlock } from '@typebot.io/lib/playwright/databaseHelpers'
|
||||
|
||||
test('Result should be overwritten on page refresh', async ({ page }) => {
|
||||
const typebotId = createId()
|
||||
|
||||
@@ -1,13 +1,13 @@
|
||||
import { getTestAsset } from '@/test/utils/playwright'
|
||||
import test, { expect } from '@playwright/test'
|
||||
import { createId } from '@paralleldrive/cuid2'
|
||||
import { Plan } from 'db'
|
||||
import { defaultSettings } from 'models'
|
||||
import { Plan } from '@typebot.io/prisma'
|
||||
import { defaultSettings } from '@typebot.io/schemas'
|
||||
import {
|
||||
createWorkspaces,
|
||||
importTypebotInDatabase,
|
||||
injectFakeResults,
|
||||
} from 'utils/playwright/databaseActions'
|
||||
} from '@typebot.io/lib/playwright/databaseActions'
|
||||
|
||||
test('should not start if chat limit is reached', async ({ page, context }) => {
|
||||
await test.step('Free plan', async () => {
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
import prisma from '@/lib/prisma'
|
||||
import { WorkspaceRole } from 'db'
|
||||
import { WorkspaceRole } from '@typebot.io/prisma'
|
||||
import {
|
||||
sendAlmostReachedChatsLimitEmail,
|
||||
sendReachedChatsLimitEmail,
|
||||
} from 'emails'
|
||||
import { Workspace } from 'models'
|
||||
import { env, isDefined } from 'utils'
|
||||
import { getChatsLimit } from 'utils/pricing'
|
||||
} from '@typebot.io/emails'
|
||||
import { Workspace } from '@typebot.io/schemas'
|
||||
import { env, isDefined } from '@typebot.io/lib'
|
||||
import { getChatsLimit } from '@typebot.io/lib/pricing'
|
||||
|
||||
const LIMIT_EMAIL_TRIGGER_PERCENT = 0.8
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { Variable, VariableWithValue } from 'models'
|
||||
import { isNotDefined } from 'utils'
|
||||
import { Variable, VariableWithValue } from '@typebot.io/schemas'
|
||||
import { isNotDefined } from '@typebot.io/lib'
|
||||
|
||||
export const transformStringVariablesToList =
|
||||
(variables: Variable[]) =>
|
||||
|
||||
@@ -7,8 +7,8 @@ import {
|
||||
Variable,
|
||||
VariableWithUnknowValue,
|
||||
VariableWithValue,
|
||||
} from 'models'
|
||||
import { isDefined, isNotDefined } from 'utils'
|
||||
} from '@typebot.io/schemas'
|
||||
import { isDefined, isNotDefined } from '@typebot.io/lib'
|
||||
|
||||
export const stringContainsVariable = (str: string): boolean =>
|
||||
/\{\{(.*?)\}\}/g.test(str)
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import { getTestAsset } from '@/test/utils/playwright'
|
||||
import test, { expect } from '@playwright/test'
|
||||
import { createId } from '@paralleldrive/cuid2'
|
||||
import { importTypebotInDatabase } from 'utils/playwright/databaseActions'
|
||||
import { importTypebotInDatabase } from '@typebot.io/lib/playwright/databaseActions'
|
||||
|
||||
test('should correctly be injected', async ({ page }) => {
|
||||
const typebotId = createId()
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
import { Credentials as CredentialsFromDb } from 'db'
|
||||
import { Credentials as CredentialsFromDb } from '@typebot.io/prisma'
|
||||
import { OAuth2Client, Credentials } from 'google-auth-library'
|
||||
import { GoogleSheetsCredentials } from 'models'
|
||||
import { isDefined } from 'utils'
|
||||
import { decrypt, encrypt } from 'utils/api'
|
||||
import { GoogleSheetsCredentials } from '@typebot.io/schemas'
|
||||
import { isDefined } from '@typebot.io/lib'
|
||||
import { decrypt, encrypt } from '@typebot.io/lib/api'
|
||||
import prisma from './prisma'
|
||||
|
||||
export const getAuthenticatedGoogleClient = async (
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { PrismaClient } from 'db'
|
||||
import { PrismaClient } from '@typebot.io/prisma'
|
||||
|
||||
declare const global: { prisma: PrismaClient }
|
||||
let prisma: PrismaClient
|
||||
|
||||
@@ -2,7 +2,13 @@ import { IncomingMessage } from 'http'
|
||||
import { ErrorPage } from '@/components/ErrorPage'
|
||||
import { NotFoundPage } from '@/components/NotFoundPage'
|
||||
import { GetServerSideProps, GetServerSidePropsContext } from 'next'
|
||||
import { env, getViewerUrl, isDefined, isNotDefined, omit } from 'utils'
|
||||
import {
|
||||
env,
|
||||
getViewerUrl,
|
||||
isDefined,
|
||||
isNotDefined,
|
||||
omit,
|
||||
} from '@typebot.io/lib'
|
||||
import prisma from '../lib/prisma'
|
||||
import { TypebotPageProps, TypebotPageV2 } from '@/components/TypebotPageV2'
|
||||
import { TypebotPageV3 } from '@/components/TypebotPageV3'
|
||||
|
||||
@@ -4,8 +4,8 @@ import {
|
||||
initMiddleware,
|
||||
methodNotAllowed,
|
||||
notFound,
|
||||
} from 'utils/api'
|
||||
import { hasValue, isDefined } from 'utils'
|
||||
} from '@typebot.io/lib/api'
|
||||
import { hasValue, isDefined } from '@typebot.io/lib'
|
||||
import { GoogleSpreadsheet, GoogleSpreadsheetRow } from 'google-spreadsheet'
|
||||
import {
|
||||
ComparisonOperators,
|
||||
@@ -14,7 +14,7 @@ import {
|
||||
GoogleSheetsInsertRowOptions,
|
||||
GoogleSheetsUpdateRowOptions,
|
||||
LogicalOperator,
|
||||
} from 'models'
|
||||
} from '@typebot.io/schemas'
|
||||
import Cors from 'cors'
|
||||
import { getAuthenticatedGoogleClient } from '@/lib/google-sheets'
|
||||
import { saveErrorLog, saveSuccessLog } from '@/features/logs/api'
|
||||
|
||||
@@ -5,11 +5,15 @@ import {
|
||||
forbidden,
|
||||
initMiddleware,
|
||||
methodNotAllowed,
|
||||
} from 'utils/api'
|
||||
} from '@typebot.io/lib/api'
|
||||
import Stripe from 'stripe'
|
||||
|
||||
import Cors from 'cors'
|
||||
import { PaymentInputOptions, StripeCredentials, Variable } from 'models'
|
||||
import {
|
||||
PaymentInputOptions,
|
||||
StripeCredentials,
|
||||
Variable,
|
||||
} from '@typebot.io/schemas'
|
||||
import prisma from '@/lib/prisma'
|
||||
import { parseVariables } from '@/features/variables'
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { NextApiRequest, NextApiResponse } from 'next'
|
||||
import { methodNotAllowed } from 'utils/api'
|
||||
import { methodNotAllowed } from '@typebot.io/lib/api'
|
||||
|
||||
const handler = (req: NextApiRequest, res: NextApiResponse) => {
|
||||
if (req.method === 'POST') {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { NextApiRequest, NextApiResponse } from 'next'
|
||||
import { methodNotAllowed } from 'utils/api'
|
||||
import { methodNotAllowed } from '@typebot.io/lib/api'
|
||||
|
||||
const handler = (req: NextApiRequest, res: NextApiResponse) => {
|
||||
if (req.method === 'POST') {
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import prisma from '@/lib/prisma'
|
||||
import { NextApiRequest, NextApiResponse } from 'next'
|
||||
import Cors from 'cors'
|
||||
import { initMiddleware, methodNotAllowed, notFound } from 'utils/api'
|
||||
import { initMiddleware, methodNotAllowed, notFound } from '@typebot.io/lib/api'
|
||||
|
||||
const cors = initMiddleware(Cors())
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import { authenticateUser } from '@/features/auth/api'
|
||||
import prisma from '@/lib/prisma'
|
||||
import { NextApiRequest, NextApiResponse } from 'next'
|
||||
import { methodNotAllowed } from 'utils/api'
|
||||
import { methodNotAllowed } from '@typebot.io/lib/api'
|
||||
|
||||
const handler = async (req: NextApiRequest, res: NextApiResponse) => {
|
||||
if (req.method === 'GET') {
|
||||
|
||||
@@ -10,12 +10,12 @@ import {
|
||||
WebhookResponse,
|
||||
WebhookBlock,
|
||||
HttpMethod,
|
||||
} from 'models'
|
||||
} from '@typebot.io/schemas'
|
||||
import { NextApiRequest, NextApiResponse } from 'next'
|
||||
import got, { Method, Headers, HTTPError } from 'got'
|
||||
import { byId, omit } from 'utils'
|
||||
import { parseAnswers } from 'utils/results'
|
||||
import { initMiddleware, methodNotAllowed, notFound } from 'utils/api'
|
||||
import { byId, omit } from '@typebot.io/lib'
|
||||
import { parseAnswers } from '@typebot.io/lib/results'
|
||||
import { initMiddleware, methodNotAllowed, notFound } from '@typebot.io/lib/api'
|
||||
import { stringify } from 'qs'
|
||||
import Cors from 'cors'
|
||||
import prisma from '@/lib/prisma'
|
||||
|
||||
@@ -2,9 +2,9 @@ import { authenticateUser } from '@/features/auth/api'
|
||||
import { getLinkedTypebotsChildren } from '@/features/blocks/logic/typebotLink/api'
|
||||
import { parseSampleResult } from '@/features/blocks/integrations/webhook/api'
|
||||
import prisma from '@/lib/prisma'
|
||||
import { Typebot } from 'models'
|
||||
import { Typebot } from '@typebot.io/schemas'
|
||||
import { NextApiRequest, NextApiResponse } from 'next'
|
||||
import { methodNotAllowed } from 'utils/api'
|
||||
import { methodNotAllowed } from '@typebot.io/lib/api'
|
||||
|
||||
const handler = async (req: NextApiRequest, res: NextApiResponse) => {
|
||||
const user = await authenticateUser(req)
|
||||
|
||||
@@ -7,10 +7,10 @@ import {
|
||||
Webhook,
|
||||
WebhookOptions,
|
||||
WebhookBlock,
|
||||
} from 'models'
|
||||
} from '@typebot.io/schemas'
|
||||
import { NextApiRequest, NextApiResponse } from 'next'
|
||||
import { initMiddleware, methodNotAllowed, notFound } from 'utils/api'
|
||||
import { byId } from 'utils'
|
||||
import { initMiddleware, methodNotAllowed, notFound } from '@typebot.io/lib/api'
|
||||
import { byId } from '@typebot.io/lib'
|
||||
import Cors from 'cors'
|
||||
import { executeWebhook } from '../../executeWebhook'
|
||||
|
||||
|
||||
@@ -2,9 +2,9 @@ import { authenticateUser } from '@/features/auth/api'
|
||||
import { getLinkedTypebotsChildren } from '@/features/blocks/logic/typebotLink/api'
|
||||
import { parseSampleResult } from '@/features/blocks/integrations/webhook/api'
|
||||
import prisma from '@/lib/prisma'
|
||||
import { Typebot } from 'models'
|
||||
import { Typebot } from '@typebot.io/schemas'
|
||||
import { NextApiRequest, NextApiResponse } from 'next'
|
||||
import { methodNotAllowed } from 'utils/api'
|
||||
import { methodNotAllowed } from '@typebot.io/lib/api'
|
||||
|
||||
const handler = async (req: NextApiRequest, res: NextApiResponse) => {
|
||||
const user = await authenticateUser(req)
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import { Typebot, WebhookBlock } from 'models'
|
||||
import { Typebot, WebhookBlock } from '@typebot.io/schemas'
|
||||
import { NextApiRequest, NextApiResponse } from 'next'
|
||||
import { methodNotAllowed } from 'utils/api'
|
||||
import { byId } from 'utils'
|
||||
import { methodNotAllowed } from '@typebot.io/lib/api'
|
||||
import { byId } from '@typebot.io/lib'
|
||||
import { authenticateUser } from '@/features/auth/api'
|
||||
import prisma from '@/lib/prisma'
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import { Typebot, WebhookBlock } from 'models'
|
||||
import { Typebot, WebhookBlock } from '@typebot.io/schemas'
|
||||
import { NextApiRequest, NextApiResponse } from 'next'
|
||||
import { methodNotAllowed } from 'utils/api'
|
||||
import { byId } from 'utils'
|
||||
import { methodNotAllowed } from '@typebot.io/lib/api'
|
||||
import { byId } from '@typebot.io/lib'
|
||||
import { authenticateUser } from '@/features/auth/api'
|
||||
import prisma from '@/lib/prisma'
|
||||
|
||||
|
||||
@@ -1,14 +1,18 @@
|
||||
import prisma from '@/lib/prisma'
|
||||
import { InputBlockType, PublicTypebot } from 'models'
|
||||
import { InputBlockType, PublicTypebot } from '@typebot.io/schemas'
|
||||
import { NextApiRequest, NextApiResponse } from 'next'
|
||||
import { badRequest, generatePresignedUrl, methodNotAllowed } from 'utils/api'
|
||||
import { byId, env, isDefined } from 'utils'
|
||||
import { getStorageLimit } from 'utils/pricing'
|
||||
import {
|
||||
badRequest,
|
||||
generatePresignedUrl,
|
||||
methodNotAllowed,
|
||||
} from '@typebot.io/lib/api'
|
||||
import { byId, env, isDefined } from '@typebot.io/lib'
|
||||
import { getStorageLimit } from '@typebot.io/lib/pricing'
|
||||
import {
|
||||
sendAlmostReachedStorageLimitEmail,
|
||||
sendReachedStorageLimitEmail,
|
||||
} from 'emails'
|
||||
import { WorkspaceRole } from 'db'
|
||||
} from '@typebot.io/emails'
|
||||
import { WorkspaceRole } from '@typebot.io/prisma'
|
||||
|
||||
const LIMIT_EMAIL_TRIGGER_PERCENT = 0.8
|
||||
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
import { authenticateUser } from '@/features/auth/api'
|
||||
import prisma from '@/lib/prisma'
|
||||
import { Typebot, WebhookBlock } from 'models'
|
||||
import { Typebot, WebhookBlock } from '@typebot.io/schemas'
|
||||
import { NextApiRequest, NextApiResponse } from 'next'
|
||||
import { byId } from 'utils'
|
||||
import { methodNotAllowed } from 'utils/api'
|
||||
import { byId } from '@typebot.io/lib'
|
||||
import { methodNotAllowed } from '@typebot.io/lib/api'
|
||||
|
||||
const handler = async (req: NextApiRequest, res: NextApiResponse) => {
|
||||
const user = await authenticateUser(req)
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
import { authenticateUser } from '@/features/auth/api'
|
||||
import prisma from '@/lib/prisma'
|
||||
import { Typebot, WebhookBlock } from 'models'
|
||||
import { Typebot, WebhookBlock } from '@typebot.io/schemas'
|
||||
import { NextApiRequest, NextApiResponse } from 'next'
|
||||
import { byId } from 'utils'
|
||||
import { methodNotAllowed } from 'utils/api'
|
||||
import { byId } from '@typebot.io/lib'
|
||||
import { methodNotAllowed } from '@typebot.io/lib/api'
|
||||
|
||||
const handler = async (req: NextApiRequest, res: NextApiResponse) => {
|
||||
const user = await authenticateUser(req)
|
||||
|
||||
@@ -3,17 +3,17 @@ import {
|
||||
ResultValues,
|
||||
SendEmailOptions,
|
||||
SmtpCredentials,
|
||||
} from 'models'
|
||||
} from '@typebot.io/schemas'
|
||||
import { NextApiRequest, NextApiResponse } from 'next'
|
||||
import { createTransport, getTestMessageUrl } from 'nodemailer'
|
||||
import { isDefined, isEmpty, isNotDefined, omit } from 'utils'
|
||||
import { parseAnswers } from 'utils/results'
|
||||
import { methodNotAllowed, initMiddleware, decrypt } from 'utils/api'
|
||||
import { isDefined, isEmpty, isNotDefined, omit } from '@typebot.io/lib'
|
||||
import { parseAnswers } from '@typebot.io/lib/results'
|
||||
import { methodNotAllowed, initMiddleware, decrypt } from '@typebot.io/lib/api'
|
||||
import { saveErrorLog, saveSuccessLog } from '@/features/logs/api'
|
||||
|
||||
import Cors from 'cors'
|
||||
import Mail from 'nodemailer/lib/mailer'
|
||||
import { DefaultBotNotificationEmail } from 'emails'
|
||||
import { DefaultBotNotificationEmail } from '@typebot.io/emails'
|
||||
import { render } from '@faire/mjml-react/utils/render'
|
||||
import prisma from '@/lib/prisma'
|
||||
import { getLinkedTypebotsChildren } from '@/features/blocks/logic/typebotLink/api'
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
import { authenticateUser } from '@/features/auth/api'
|
||||
import { checkChatsUsage } from '@/features/usage'
|
||||
import prisma from '@/lib/prisma'
|
||||
import { ResultWithAnswers } from 'models'
|
||||
import { ResultWithAnswers } from '@typebot.io/schemas'
|
||||
import { NextApiRequest, NextApiResponse } from 'next'
|
||||
import { methodNotAllowed } from 'utils/api'
|
||||
import { methodNotAllowed } from '@typebot.io/lib/api'
|
||||
|
||||
const handler = async (req: NextApiRequest, res: NextApiResponse) => {
|
||||
if (req.method === 'GET') {
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import prisma from '@/lib/prisma'
|
||||
import { Result } from 'models'
|
||||
import { Result } from '@typebot.io/schemas'
|
||||
import { NextApiRequest, NextApiResponse } from 'next'
|
||||
import { methodNotAllowed } from 'utils/api'
|
||||
import { methodNotAllowed } from '@typebot.io/lib/api'
|
||||
|
||||
const handler = async (req: NextApiRequest, res: NextApiResponse) => {
|
||||
if (req.method === 'PATCH') {
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
import prisma from '@/lib/prisma'
|
||||
import { Answer } from 'db'
|
||||
import { Answer } from '@typebot.io/prisma'
|
||||
import { got } from 'got'
|
||||
import { NextApiRequest, NextApiResponse } from 'next'
|
||||
import { isNotDefined } from 'utils'
|
||||
import { methodNotAllowed } from 'utils/api'
|
||||
import { isNotDefined } from '@typebot.io/lib'
|
||||
import { methodNotAllowed } from '@typebot.io/lib/api'
|
||||
|
||||
const handler = async (req: NextApiRequest, res: NextApiResponse) => {
|
||||
if (req.method === 'PUT') {
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
import { authenticateUser } from '@/features/auth/api'
|
||||
import prisma from '@/lib/prisma'
|
||||
import { Group, WebhookBlock } from 'models'
|
||||
import { Group, WebhookBlock } from '@typebot.io/schemas'
|
||||
import { NextApiRequest, NextApiResponse } from 'next'
|
||||
import { byId, isWebhookBlock, parseGroupTitle } from 'utils'
|
||||
import { methodNotAllowed } from 'utils/api'
|
||||
import { byId, isWebhookBlock, parseGroupTitle } from '@typebot.io/lib'
|
||||
import { methodNotAllowed } from '@typebot.io/lib/api'
|
||||
|
||||
const handler = async (req: NextApiRequest, res: NextApiResponse) => {
|
||||
if (req.method === 'GET') {
|
||||
|
||||
@@ -1,9 +1,14 @@
|
||||
import { authenticateUser } from '@/features/auth/api'
|
||||
import prisma from '@/lib/prisma'
|
||||
import { Group, WebhookBlock } from 'models'
|
||||
import { Group, WebhookBlock } from '@typebot.io/schemas'
|
||||
import { NextApiRequest, NextApiResponse } from 'next'
|
||||
import { byId, isNotDefined, isWebhookBlock, parseGroupTitle } from 'utils'
|
||||
import { methodNotAllowed } from 'utils/api'
|
||||
import {
|
||||
byId,
|
||||
isNotDefined,
|
||||
isWebhookBlock,
|
||||
parseGroupTitle,
|
||||
} from '@typebot.io/lib'
|
||||
import { methodNotAllowed } from '@typebot.io/lib/api'
|
||||
|
||||
const handler = async (req: NextApiRequest, res: NextApiResponse) => {
|
||||
if (req.method === 'GET') {
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import { authenticateUser } from '@/features/auth/api'
|
||||
import { NextApiRequest, NextApiResponse } from 'next'
|
||||
import { isNotDefined } from 'utils'
|
||||
import { methodNotAllowed } from 'utils/api'
|
||||
import { isNotDefined } from '@typebot.io/lib'
|
||||
import { methodNotAllowed } from '@typebot.io/lib/api'
|
||||
|
||||
const handler = async (req: NextApiRequest, res: NextApiResponse) => {
|
||||
if (req.method === 'GET') {
|
||||
|
||||
@@ -2,7 +2,7 @@ import { IncomingMessage } from 'http'
|
||||
import { ErrorPage } from '@/components/ErrorPage'
|
||||
import { NotFoundPage } from '@/components/NotFoundPage'
|
||||
import { GetServerSideProps, GetServerSidePropsContext } from 'next'
|
||||
import { isDefined, isNotDefined, omit } from 'utils'
|
||||
import { isDefined, isNotDefined, omit } from '@typebot.io/lib'
|
||||
import prisma from '../../lib/prisma'
|
||||
import { TypebotPageProps, TypebotPageV2 } from '@/components/TypebotPageV2'
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import { PrismaClient } from 'db'
|
||||
import { SmtpCredentials } from 'models'
|
||||
import { encrypt } from 'utils/api'
|
||||
import { proWorkspaceId } from 'utils/playwright/databaseSetup'
|
||||
import { PrismaClient } from '@typebot.io/prisma'
|
||||
import { SmtpCredentials } from '@typebot.io/schemas'
|
||||
import { encrypt } from '@typebot.io/lib/api'
|
||||
import { proWorkspaceId } from '@typebot.io/lib/playwright/databaseSetup'
|
||||
|
||||
const prisma = new PrismaClient()
|
||||
|
||||
|
||||
@@ -1,5 +1,10 @@
|
||||
import { CollaborationType, Prisma, User, WorkspaceRole } from 'db'
|
||||
import { env } from 'utils'
|
||||
import {
|
||||
CollaborationType,
|
||||
Prisma,
|
||||
User,
|
||||
WorkspaceRole,
|
||||
} from '@typebot.io/prisma'
|
||||
import { env } from '@typebot.io/lib'
|
||||
|
||||
const parseWhereFilter = (
|
||||
typebotIds: string[] | string,
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import prisma from '@/lib/prisma'
|
||||
import { inferAsyncReturnType } from '@trpc/server'
|
||||
import * as trpcNext from '@trpc/server/adapters/next'
|
||||
import { User } from 'db'
|
||||
import { User } from '@typebot.io/prisma'
|
||||
import { NextApiRequest } from 'next'
|
||||
|
||||
export async function createContext(opts: trpcNext.CreateNextContextOptions) {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
{
|
||||
"extends": "tsconfig/nextjs.json",
|
||||
"extends": "@typebot.io/tsconfig/nextjs.json",
|
||||
"compilerOptions": {
|
||||
"baseUrl": ".",
|
||||
"paths": {
|
||||
|
||||
Reference in New Issue
Block a user