♻️ Export bot-engine code into its own package
This commit is contained in:
1
.gitignore
vendored
1
.gitignore
vendored
@ -29,6 +29,7 @@ dump.sql
|
|||||||
dump.tar
|
dump.tar
|
||||||
|
|
||||||
__env.js
|
__env.js
|
||||||
|
__ENV.js
|
||||||
|
|
||||||
typebotsToFix.json
|
typebotsToFix.json
|
||||||
**/scripts/logs
|
**/scripts/logs
|
||||||
|
@ -27,8 +27,6 @@
|
|||||||
"@googleapis/drive": "8.0.0",
|
"@googleapis/drive": "8.0.0",
|
||||||
"@paralleldrive/cuid2": "2.2.1",
|
"@paralleldrive/cuid2": "2.2.1",
|
||||||
"@sentry/nextjs": "7.66.0",
|
"@sentry/nextjs": "7.66.0",
|
||||||
"@stripe/stripe-js": "1.54.1",
|
|
||||||
"@t3-oss/env-nextjs": "^0.6.0",
|
|
||||||
"@tanstack/react-query": "^4.29.19",
|
"@tanstack/react-query": "^4.29.19",
|
||||||
"@tanstack/react-table": "8.9.3",
|
"@tanstack/react-table": "8.9.3",
|
||||||
"@trpc/client": "10.34.0",
|
"@trpc/client": "10.34.0",
|
||||||
@ -42,7 +40,6 @@
|
|||||||
"@udecode/plate-common": "^21.1.5",
|
"@udecode/plate-common": "^21.1.5",
|
||||||
"@udecode/plate-core": "21.1.5",
|
"@udecode/plate-core": "21.1.5",
|
||||||
"@udecode/plate-link": "21.2.0",
|
"@udecode/plate-link": "21.2.0",
|
||||||
"@udecode/plate-serializer-html": "21.1.5",
|
|
||||||
"@udecode/plate-ui-link": "21.2.0",
|
"@udecode/plate-ui-link": "21.2.0",
|
||||||
"@udecode/plate-ui-toolbar": "21.1.5",
|
"@udecode/plate-ui-toolbar": "21.1.5",
|
||||||
"@uiw/codemirror-extensions-langs": "^4.21.7",
|
"@uiw/codemirror-extensions-langs": "^4.21.7",
|
||||||
@ -85,7 +82,6 @@
|
|||||||
"sharp": "^0.32.4",
|
"sharp": "^0.32.4",
|
||||||
"slate": "0.94.1",
|
"slate": "0.94.1",
|
||||||
"slate-history": "0.93.0",
|
"slate-history": "0.93.0",
|
||||||
"slate-hyperscript": "0.77.0",
|
|
||||||
"slate-react": "0.94.2",
|
"slate-react": "0.94.2",
|
||||||
"stripe": "12.13.0",
|
"stripe": "12.13.0",
|
||||||
"svg-round-corners": "0.4.1",
|
"svg-round-corners": "0.4.1",
|
||||||
@ -94,7 +90,7 @@
|
|||||||
"trpc-openapi": "1.2.0",
|
"trpc-openapi": "1.2.0",
|
||||||
"unsplash-js": "^7.0.18",
|
"unsplash-js": "^7.0.18",
|
||||||
"use-debounce": "9.0.4",
|
"use-debounce": "9.0.4",
|
||||||
"@typebot.io/viewer": "workspace:*"
|
"@typebot.io/bot-engine": "workspace:*"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@chakra-ui/styled-system": "2.9.1",
|
"@chakra-ui/styled-system": "2.9.1",
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
import prisma from '@/lib/prisma'
|
import prisma from '@typebot.io/lib/prisma'
|
||||||
import { authenticatedProcedure } from '@/helpers/server/trpc'
|
import { authenticatedProcedure } from '@/helpers/server/trpc'
|
||||||
import { TRPCError } from '@trpc/server'
|
import { TRPCError } from '@trpc/server'
|
||||||
import { PublicTypebot } from '@typebot.io/schemas'
|
import { PublicTypebot } from '@typebot.io/schemas'
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
import prisma from '@/lib/prisma'
|
import prisma from '@typebot.io/lib/prisma'
|
||||||
import { authOptions } from '@/pages/api/auth/[...nextauth]'
|
import { authOptions } from '@/pages/api/auth/[...nextauth]'
|
||||||
import { setUser } from '@sentry/nextjs'
|
import { setUser } from '@sentry/nextjs'
|
||||||
import { User } from '@typebot.io/prisma'
|
import { User } from '@typebot.io/prisma'
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
import prisma from '@/lib/prisma'
|
import prisma from '@typebot.io/lib/prisma'
|
||||||
import { authenticatedProcedure } from '@/helpers/server/trpc'
|
import { authenticatedProcedure } from '@/helpers/server/trpc'
|
||||||
import { TRPCError } from '@trpc/server'
|
import { TRPCError } from '@trpc/server'
|
||||||
import { Plan } from '@typebot.io/prisma'
|
import { Plan } from '@typebot.io/prisma'
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
import prisma from '@/lib/prisma'
|
import prisma from '@typebot.io/lib/prisma'
|
||||||
import { authenticatedProcedure } from '@/helpers/server/trpc'
|
import { authenticatedProcedure } from '@/helpers/server/trpc'
|
||||||
import { TRPCError } from '@trpc/server'
|
import { TRPCError } from '@trpc/server'
|
||||||
import { Plan } from '@typebot.io/prisma'
|
import { Plan } from '@typebot.io/prisma'
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
import prisma from '@/lib/prisma'
|
import prisma from '@typebot.io/lib/prisma'
|
||||||
import { authenticatedProcedure } from '@/helpers/server/trpc'
|
import { authenticatedProcedure } from '@/helpers/server/trpc'
|
||||||
import { TRPCError } from '@trpc/server'
|
import { TRPCError } from '@trpc/server'
|
||||||
import Stripe from 'stripe'
|
import Stripe from 'stripe'
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
import prisma from '@/lib/prisma'
|
import prisma from '@typebot.io/lib/prisma'
|
||||||
import { authenticatedProcedure } from '@/helpers/server/trpc'
|
import { authenticatedProcedure } from '@/helpers/server/trpc'
|
||||||
import { TRPCError } from '@trpc/server'
|
import { TRPCError } from '@trpc/server'
|
||||||
import Stripe from 'stripe'
|
import Stripe from 'stripe'
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
import prisma from '@/lib/prisma'
|
import prisma from '@typebot.io/lib/prisma'
|
||||||
import { authenticatedProcedure } from '@/helpers/server/trpc'
|
import { authenticatedProcedure } from '@/helpers/server/trpc'
|
||||||
import { TRPCError } from '@trpc/server'
|
import { TRPCError } from '@trpc/server'
|
||||||
import { z } from 'zod'
|
import { z } from 'zod'
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
import prisma from '@/lib/prisma'
|
import prisma from '@typebot.io/lib/prisma'
|
||||||
import { authenticatedProcedure } from '@/helpers/server/trpc'
|
import { authenticatedProcedure } from '@/helpers/server/trpc'
|
||||||
import { TRPCError } from '@trpc/server'
|
import { TRPCError } from '@trpc/server'
|
||||||
import Stripe from 'stripe'
|
import Stripe from 'stripe'
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
import { sendTelemetryEvents } from '@typebot.io/lib/telemetry/sendTelemetryEvent'
|
import { sendTelemetryEvents } from '@typebot.io/lib/telemetry/sendTelemetryEvent'
|
||||||
import prisma from '@/lib/prisma'
|
import prisma from '@typebot.io/lib/prisma'
|
||||||
import { authenticatedProcedure } from '@/helpers/server/trpc'
|
import { authenticatedProcedure } from '@/helpers/server/trpc'
|
||||||
import { TRPCError } from '@trpc/server'
|
import { TRPCError } from '@trpc/server'
|
||||||
import { Plan } from '@typebot.io/prisma'
|
import { Plan } from '@typebot.io/prisma'
|
||||||
|
@ -51,7 +51,6 @@ test('should display valid usage', async ({ page }) => {
|
|||||||
await page.click('text=Settings & Members')
|
await page.click('text=Settings & Members')
|
||||||
await page.click('text=Billing & Usage')
|
await page.click('text=Billing & Usage')
|
||||||
await expect(page.locator('text="/ 10,000"')).toBeVisible()
|
await expect(page.locator('text="/ 10,000"')).toBeVisible()
|
||||||
await expect(page.locator('text="/ 10 GB"')).toBeVisible()
|
|
||||||
await page.getByText('Members', { exact: true }).click()
|
await page.getByText('Members', { exact: true }).click()
|
||||||
await expect(
|
await expect(
|
||||||
page.getByRole('heading', { name: 'Members (1/5)' })
|
page.getByRole('heading', { name: 'Members (1/5)' })
|
||||||
@ -63,7 +62,6 @@ test('should display valid usage', async ({ page }) => {
|
|||||||
await page.click('text=Settings & Members')
|
await page.click('text=Settings & Members')
|
||||||
await page.click('text=Billing & Usage')
|
await page.click('text=Billing & Usage')
|
||||||
await expect(page.locator('text="/ 100,000"')).toBeVisible()
|
await expect(page.locator('text="/ 100,000"')).toBeVisible()
|
||||||
await expect(page.locator('text="/ 50 GB"')).toBeVisible()
|
|
||||||
await expect(page.getByText('Upgrade to Starter')).toBeHidden()
|
await expect(page.getByText('Upgrade to Starter')).toBeHidden()
|
||||||
await expect(page.getByText('Upgrade to Pro')).toBeHidden()
|
await expect(page.getByText('Upgrade to Pro')).toBeHidden()
|
||||||
await expect(page.getByText('Need custom limits?')).toBeHidden()
|
await expect(page.getByText('Need custom limits?')).toBeHidden()
|
||||||
@ -78,7 +76,6 @@ test('should display valid usage', async ({ page }) => {
|
|||||||
await page.click('text=Settings & Members')
|
await page.click('text=Settings & Members')
|
||||||
await page.click('text=Billing & Usage')
|
await page.click('text=Billing & Usage')
|
||||||
await expect(page.locator('text="/ 200"')).toBeVisible()
|
await expect(page.locator('text="/ 200"')).toBeVisible()
|
||||||
await expect(page.locator('text="Storage"')).toBeHidden()
|
|
||||||
await page.getByText('Members', { exact: true }).click()
|
await page.getByText('Members', { exact: true }).click()
|
||||||
await expect(
|
await expect(
|
||||||
page.getByRole('heading', { name: 'Members (1/1)' })
|
page.getByRole('heading', { name: 'Members (1/1)' })
|
||||||
@ -95,17 +92,11 @@ test('should display valid usage', async ({ page }) => {
|
|||||||
await page.click('text=Settings & Members')
|
await page.click('text=Settings & Members')
|
||||||
await page.click('text=Billing & Usage')
|
await page.click('text=Billing & Usage')
|
||||||
await expect(page.locator('text="/ 2,000"')).toBeVisible()
|
await expect(page.locator('text="/ 2,000"')).toBeVisible()
|
||||||
await expect(page.locator('text="/ 2 GB"')).toBeVisible()
|
|
||||||
await expect(page.locator('text="10" >> nth=0')).toBeVisible()
|
await expect(page.locator('text="10" >> nth=0')).toBeVisible()
|
||||||
await expect(page.locator('[role="progressbar"] >> nth=0')).toHaveAttribute(
|
await expect(page.locator('[role="progressbar"] >> nth=0')).toHaveAttribute(
|
||||||
'aria-valuenow',
|
'aria-valuenow',
|
||||||
'1'
|
'1'
|
||||||
)
|
)
|
||||||
await expect(page.locator('text="1.07 GB"')).toBeVisible()
|
|
||||||
await expect(page.locator('[role="progressbar"] >> nth=1')).toHaveAttribute(
|
|
||||||
'aria-valuenow',
|
|
||||||
'54'
|
|
||||||
)
|
|
||||||
|
|
||||||
await injectFakeResults({
|
await injectFakeResults({
|
||||||
typebotId: usageTypebotId,
|
typebotId: usageTypebotId,
|
||||||
@ -116,10 +107,7 @@ test('should display valid usage', async ({ page }) => {
|
|||||||
await page.click('text="Billing & Usage"')
|
await page.click('text="Billing & Usage"')
|
||||||
await expect(page.locator('text="/ 2,000"')).toBeVisible()
|
await expect(page.locator('text="/ 2,000"')).toBeVisible()
|
||||||
await expect(page.locator('text="1,100"')).toBeVisible()
|
await expect(page.locator('text="1,100"')).toBeVisible()
|
||||||
await expect(page.locator('text="/ 2 GB"')).toBeVisible()
|
|
||||||
await expect(page.locator('text="2.25 GB"')).toBeVisible()
|
|
||||||
await expect(page.locator('[aria-valuenow="55"]')).toBeVisible()
|
await expect(page.locator('[aria-valuenow="55"]')).toBeVisible()
|
||||||
await expect(page.locator('[aria-valuenow="112"]')).toBeVisible()
|
|
||||||
})
|
})
|
||||||
|
|
||||||
test('plan changes should work', async ({ page }) => {
|
test('plan changes should work', async ({ page }) => {
|
||||||
@ -160,9 +148,7 @@ test('plan changes should work', async ({ page }) => {
|
|||||||
await page.click('text=Settings & Members')
|
await page.click('text=Settings & Members')
|
||||||
await page.click('text=Billing & Usage')
|
await page.click('text=Billing & Usage')
|
||||||
await expect(page.locator('text="/ 2,000"')).toBeVisible()
|
await expect(page.locator('text="/ 2,000"')).toBeVisible()
|
||||||
await expect(page.locator('text="/ 2 GB"')).toBeVisible()
|
|
||||||
await expect(page.getByText('/ 2,000')).toBeVisible()
|
await expect(page.getByText('/ 2,000')).toBeVisible()
|
||||||
await expect(page.getByText('/ 2 GB')).toBeVisible()
|
|
||||||
await page.click('button >> text="2,000"')
|
await page.click('button >> text="2,000"')
|
||||||
await page.click('button >> text="3,500"')
|
await page.click('button >> text="3,500"')
|
||||||
await page.click('button >> text="2"')
|
await page.click('button >> text="2"')
|
||||||
@ -178,7 +164,6 @@ test('plan changes should work', async ({ page }) => {
|
|||||||
await page.click('text="Billing & Usage"')
|
await page.click('text="Billing & Usage"')
|
||||||
await expect(page.locator('text="$73"')).toBeVisible()
|
await expect(page.locator('text="$73"')).toBeVisible()
|
||||||
await expect(page.locator('text="/ 3,500"')).toBeVisible()
|
await expect(page.locator('text="/ 3,500"')).toBeVisible()
|
||||||
await expect(page.locator('text="/ 4 GB"')).toBeVisible()
|
|
||||||
await expect(page.getByRole('button', { name: '3,500' })).toBeVisible()
|
await expect(page.getByRole('button', { name: '3,500' })).toBeVisible()
|
||||||
await expect(page.getByRole('button', { name: '4' })).toBeVisible()
|
await expect(page.getByRole('button', { name: '4' })).toBeVisible()
|
||||||
|
|
||||||
|
@ -36,7 +36,6 @@ test('options should work', async ({ page }) => {
|
|||||||
await page.fill('[value="Upload"]', 'Go')
|
await page.fill('[value="Upload"]', 'Go')
|
||||||
await page.fill('[value="Clear"]', 'Reset')
|
await page.fill('[value="Clear"]', 'Reset')
|
||||||
await page.fill('[value="Skip"]', 'Pass')
|
await page.fill('[value="Skip"]', 'Pass')
|
||||||
await page.fill('input[value="10"]', '20')
|
|
||||||
await page.click('text="Restart"')
|
await page.click('text="Restart"')
|
||||||
await expect(page.locator(`text="Pass"`)).toBeVisible()
|
await expect(page.locator(`text="Pass"`)).toBeVisible()
|
||||||
await expect(page.locator(`text="Upload now!!"`)).toBeVisible()
|
await expect(page.locator(`text="Upload now!!"`)).toBeVisible()
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
import prisma from '@/lib/prisma'
|
import prisma from '@typebot.io/lib/prisma'
|
||||||
import { authenticatedProcedure } from '@/helpers/server/trpc'
|
import { authenticatedProcedure } from '@/helpers/server/trpc'
|
||||||
import { TRPCError } from '@trpc/server'
|
import { TRPCError } from '@trpc/server'
|
||||||
import { z } from 'zod'
|
import { z } from 'zod'
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
import prisma from '@/lib/prisma'
|
import prisma from '@typebot.io/lib/prisma'
|
||||||
import { canReadTypebots } from '@/helpers/databaseRules'
|
import { canReadTypebots } from '@/helpers/databaseRules'
|
||||||
import { authenticatedProcedure } from '@/helpers/server/trpc'
|
import { authenticatedProcedure } from '@/helpers/server/trpc'
|
||||||
import { TRPCError } from '@trpc/server'
|
import { TRPCError } from '@trpc/server'
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
import prisma from '@/lib/prisma'
|
import prisma from '@typebot.io/lib/prisma'
|
||||||
import { canReadTypebots } from '@/helpers/databaseRules'
|
import { canReadTypebots } from '@/helpers/databaseRules'
|
||||||
import { authenticatedProcedure } from '@/helpers/server/trpc'
|
import { authenticatedProcedure } from '@/helpers/server/trpc'
|
||||||
import { TRPCError } from '@trpc/server'
|
import { TRPCError } from '@trpc/server'
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
import prisma from '@/lib/prisma'
|
import prisma from '@typebot.io/lib/prisma'
|
||||||
import { canWriteTypebots } from '@/helpers/databaseRules'
|
import { canWriteTypebots } from '@/helpers/databaseRules'
|
||||||
import { authenticatedProcedure } from '@/helpers/server/trpc'
|
import { authenticatedProcedure } from '@/helpers/server/trpc'
|
||||||
import { TRPCError } from '@trpc/server'
|
import { TRPCError } from '@trpc/server'
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
import prisma from '@/lib/prisma'
|
import prisma from '@typebot.io/lib/prisma'
|
||||||
import { canWriteTypebots } from '@/helpers/databaseRules'
|
import { canWriteTypebots } from '@/helpers/databaseRules'
|
||||||
import { authenticatedProcedure } from '@/helpers/server/trpc'
|
import { authenticatedProcedure } from '@/helpers/server/trpc'
|
||||||
import { TRPCError } from '@trpc/server'
|
import { TRPCError } from '@trpc/server'
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
import prisma from '@/lib/prisma'
|
import prisma from '@typebot.io/lib/prisma'
|
||||||
import { authenticatedProcedure } from '@/helpers/server/trpc'
|
import { authenticatedProcedure } from '@/helpers/server/trpc'
|
||||||
import { TRPCError } from '@trpc/server'
|
import { TRPCError } from '@trpc/server'
|
||||||
import { z } from 'zod'
|
import { z } from 'zod'
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
import prisma from '@/lib/prisma'
|
import prisma from '@typebot.io/lib/prisma'
|
||||||
import { authenticatedProcedure } from '@/helpers/server/trpc'
|
import { authenticatedProcedure } from '@/helpers/server/trpc'
|
||||||
import { TRPCError } from '@trpc/server'
|
import { TRPCError } from '@trpc/server'
|
||||||
import { LogicBlockType, typebotSchema } from '@typebot.io/schemas'
|
import { LogicBlockType, typebotSchema } from '@typebot.io/schemas'
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
import prisma from '@/lib/prisma'
|
import prisma from '@typebot.io/lib/prisma'
|
||||||
import { canReadTypebots } from '@/helpers/databaseRules'
|
import { canReadTypebots } from '@/helpers/databaseRules'
|
||||||
import { User } from '@typebot.io/prisma'
|
import { User } from '@typebot.io/prisma'
|
||||||
import { LogicBlockType, PublicTypebot, Typebot } from '@typebot.io/schemas'
|
import { LogicBlockType, PublicTypebot, Typebot } from '@typebot.io/schemas'
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
import prisma from '@/lib/prisma'
|
import prisma from '@typebot.io/lib/prisma'
|
||||||
import { authenticatedProcedure } from '@/helpers/server/trpc'
|
import { authenticatedProcedure } from '@/helpers/server/trpc'
|
||||||
import { TRPCError } from '@trpc/server'
|
import { TRPCError } from '@trpc/server'
|
||||||
import { z } from 'zod'
|
import { z } from 'zod'
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
import test, { expect } from '@playwright/test'
|
import test, { expect } from '@playwright/test'
|
||||||
import { createId } from '@paralleldrive/cuid2'
|
import { createId } from '@paralleldrive/cuid2'
|
||||||
import { CollaborationType, Plan, WorkspaceRole } from '@typebot.io/prisma'
|
import { CollaborationType, Plan, WorkspaceRole } from '@typebot.io/prisma'
|
||||||
import prisma from '@/lib/prisma'
|
import prisma from '@typebot.io/lib/prisma'
|
||||||
import { InputBlockType, defaultTextInputOptions } from '@typebot.io/schemas'
|
import { InputBlockType, defaultTextInputOptions } from '@typebot.io/schemas'
|
||||||
import {
|
import {
|
||||||
createTypebots,
|
createTypebots,
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
import prisma from '@/lib/prisma'
|
import prisma from '@typebot.io/lib/prisma'
|
||||||
import { authenticatedProcedure } from '@/helpers/server/trpc'
|
import { authenticatedProcedure } from '@/helpers/server/trpc'
|
||||||
import { TRPCError } from '@trpc/server'
|
import { TRPCError } from '@trpc/server'
|
||||||
import { stripeCredentialsSchema } from '@typebot.io/schemas/features/blocks/inputs/payment/schemas'
|
import { stripeCredentialsSchema } from '@typebot.io/schemas/features/blocks/inputs/payment/schemas'
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
import prisma from '@/lib/prisma'
|
import prisma from '@typebot.io/lib/prisma'
|
||||||
import { authenticatedProcedure } from '@/helpers/server/trpc'
|
import { authenticatedProcedure } from '@/helpers/server/trpc'
|
||||||
import { TRPCError } from '@trpc/server'
|
import { TRPCError } from '@trpc/server'
|
||||||
import { z } from 'zod'
|
import { z } from 'zod'
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
import prisma from '@/lib/prisma'
|
import prisma from '@typebot.io/lib/prisma'
|
||||||
import { authenticatedProcedure } from '@/helpers/server/trpc'
|
import { authenticatedProcedure } from '@/helpers/server/trpc'
|
||||||
import { TRPCError } from '@trpc/server'
|
import { TRPCError } from '@trpc/server'
|
||||||
import { stripeCredentialsSchema } from '@typebot.io/schemas/features/blocks/inputs/payment/schemas'
|
import { stripeCredentialsSchema } from '@typebot.io/schemas/features/blocks/inputs/payment/schemas'
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
import prisma from '@/lib/prisma'
|
import prisma from '@typebot.io/lib/prisma'
|
||||||
import { authenticatedProcedure } from '@/helpers/server/trpc'
|
import { authenticatedProcedure } from '@/helpers/server/trpc'
|
||||||
import { TRPCError } from '@trpc/server'
|
import { TRPCError } from '@trpc/server'
|
||||||
import { z } from 'zod'
|
import { z } from 'zod'
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
import prisma from '@/lib/prisma'
|
import prisma from '@typebot.io/lib/prisma'
|
||||||
import { authenticatedProcedure } from '@/helpers/server/trpc'
|
import { authenticatedProcedure } from '@/helpers/server/trpc'
|
||||||
import { TRPCError } from '@trpc/server'
|
import { TRPCError } from '@trpc/server'
|
||||||
import { z } from 'zod'
|
import { z } from 'zod'
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
import prisma from '@/lib/prisma'
|
import prisma from '@typebot.io/lib/prisma'
|
||||||
import { authenticatedProcedure } from '@/helpers/server/trpc'
|
import { authenticatedProcedure } from '@/helpers/server/trpc'
|
||||||
import { TRPCError } from '@trpc/server'
|
import { TRPCError } from '@trpc/server'
|
||||||
import { z } from 'zod'
|
import { z } from 'zod'
|
||||||
|
@ -7,7 +7,7 @@ import {
|
|||||||
domainResponseSchema,
|
domainResponseSchema,
|
||||||
domainVerificationStatusSchema,
|
domainVerificationStatusSchema,
|
||||||
} from '@typebot.io/schemas/features/customDomains'
|
} from '@typebot.io/schemas/features/customDomains'
|
||||||
import prisma from '@/lib/prisma'
|
import prisma from '@typebot.io/lib/prisma'
|
||||||
import { isWriteWorkspaceForbidden } from '@/features/workspace/helpers/isWriteWorkspaceForbidden'
|
import { isWriteWorkspaceForbidden } from '@/features/workspace/helpers/isWriteWorkspaceForbidden'
|
||||||
import { TRPCError } from '@trpc/server'
|
import { TRPCError } from '@trpc/server'
|
||||||
import { env } from '@typebot.io/env'
|
import { env } from '@typebot.io/env'
|
||||||
|
@ -3,7 +3,7 @@ import { TRPCError } from '@trpc/server'
|
|||||||
import { Group } from '@typebot.io/schemas'
|
import { Group } from '@typebot.io/schemas'
|
||||||
import { z } from 'zod'
|
import { z } from 'zod'
|
||||||
import { archiveResults } from '@typebot.io/lib/api/helpers/archiveResults'
|
import { archiveResults } from '@typebot.io/lib/api/helpers/archiveResults'
|
||||||
import prisma from '@/lib/prisma'
|
import prisma from '@typebot.io/lib/prisma'
|
||||||
import { isWriteTypebotForbidden } from '@/features/typebot/helpers/isWriteTypebotForbidden'
|
import { isWriteTypebotForbidden } from '@/features/typebot/helpers/isWriteTypebotForbidden'
|
||||||
|
|
||||||
export const deleteResults = authenticatedProcedure
|
export const deleteResults = authenticatedProcedure
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
import prisma from '@/lib/prisma'
|
import prisma from '@typebot.io/lib/prisma'
|
||||||
import { authenticatedProcedure } from '@/helpers/server/trpc'
|
import { authenticatedProcedure } from '@/helpers/server/trpc'
|
||||||
import { TRPCError } from '@trpc/server'
|
import { TRPCError } from '@trpc/server'
|
||||||
import { ResultWithAnswers, resultWithAnswersSchema } from '@typebot.io/schemas'
|
import { ResultWithAnswers, resultWithAnswersSchema } from '@typebot.io/schemas'
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
import prisma from '@/lib/prisma'
|
import prisma from '@typebot.io/lib/prisma'
|
||||||
import { authenticatedProcedure } from '@/helpers/server/trpc'
|
import { authenticatedProcedure } from '@/helpers/server/trpc'
|
||||||
import { logSchema } from '@typebot.io/schemas'
|
import { logSchema } from '@typebot.io/schemas'
|
||||||
import { z } from 'zod'
|
import { z } from 'zod'
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
import prisma from '@/lib/prisma'
|
import prisma from '@typebot.io/lib/prisma'
|
||||||
import { authenticatedProcedure } from '@/helpers/server/trpc'
|
import { authenticatedProcedure } from '@/helpers/server/trpc'
|
||||||
import { TRPCError } from '@trpc/server'
|
import { TRPCError } from '@trpc/server'
|
||||||
import { ResultWithAnswers, resultWithAnswersSchema } from '@typebot.io/schemas'
|
import { ResultWithAnswers, resultWithAnswersSchema } from '@typebot.io/schemas'
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
import prisma from '@/lib/prisma'
|
import prisma from '@typebot.io/lib/prisma'
|
||||||
import { authenticatedProcedure } from '@/helpers/server/trpc'
|
import { authenticatedProcedure } from '@/helpers/server/trpc'
|
||||||
import { TRPCError } from '@trpc/server'
|
import { TRPCError } from '@trpc/server'
|
||||||
import { ThemeTemplate, themeTemplateSchema } from '@typebot.io/schemas'
|
import { ThemeTemplate, themeTemplateSchema } from '@typebot.io/schemas'
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
import prisma from '@/lib/prisma'
|
import prisma from '@typebot.io/lib/prisma'
|
||||||
import { authenticatedProcedure } from '@/helpers/server/trpc'
|
import { authenticatedProcedure } from '@/helpers/server/trpc'
|
||||||
import { TRPCError } from '@trpc/server'
|
import { TRPCError } from '@trpc/server'
|
||||||
import { ThemeTemplate, themeTemplateSchema } from '@typebot.io/schemas'
|
import { ThemeTemplate, themeTemplateSchema } from '@typebot.io/schemas'
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
import prisma from '@/lib/prisma'
|
import prisma from '@typebot.io/lib/prisma'
|
||||||
import { authenticatedProcedure } from '@/helpers/server/trpc'
|
import { authenticatedProcedure } from '@/helpers/server/trpc'
|
||||||
import { TRPCError } from '@trpc/server'
|
import { TRPCError } from '@trpc/server'
|
||||||
import { ThemeTemplate, themeTemplateSchema } from '@typebot.io/schemas'
|
import { ThemeTemplate, themeTemplateSchema } from '@typebot.io/schemas'
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
import prisma from '@/lib/prisma'
|
import prisma from '@typebot.io/lib/prisma'
|
||||||
import { authenticatedProcedure } from '@/helpers/server/trpc'
|
import { authenticatedProcedure } from '@/helpers/server/trpc'
|
||||||
import { TRPCError } from '@trpc/server'
|
import { TRPCError } from '@trpc/server'
|
||||||
import { Plan, WorkspaceRole } from '@typebot.io/prisma'
|
import { Plan, WorkspaceRole } from '@typebot.io/prisma'
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
import prisma from '@/lib/prisma'
|
import prisma from '@typebot.io/lib/prisma'
|
||||||
import { authenticatedProcedure } from '@/helpers/server/trpc'
|
import { authenticatedProcedure } from '@/helpers/server/trpc'
|
||||||
import { TRPCError } from '@trpc/server'
|
import { TRPCError } from '@trpc/server'
|
||||||
import { Group } from '@typebot.io/schemas'
|
import { Group } from '@typebot.io/schemas'
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
import prisma from '@/lib/prisma'
|
import prisma from '@typebot.io/lib/prisma'
|
||||||
import { authenticatedProcedure } from '@/helpers/server/trpc'
|
import { authenticatedProcedure } from '@/helpers/server/trpc'
|
||||||
import { TRPCError } from '@trpc/server'
|
import { TRPCError } from '@trpc/server'
|
||||||
import { publicTypebotSchema } from '@typebot.io/schemas'
|
import { publicTypebotSchema } from '@typebot.io/schemas'
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
import prisma from '@/lib/prisma'
|
import prisma from '@typebot.io/lib/prisma'
|
||||||
import { authenticatedProcedure } from '@/helpers/server/trpc'
|
import { authenticatedProcedure } from '@/helpers/server/trpc'
|
||||||
import { TRPCError } from '@trpc/server'
|
import { TRPCError } from '@trpc/server'
|
||||||
import { Typebot, typebotSchema } from '@typebot.io/schemas'
|
import { Typebot, typebotSchema } from '@typebot.io/schemas'
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
import prisma from '@/lib/prisma'
|
import prisma from '@typebot.io/lib/prisma'
|
||||||
import { authenticatedProcedure } from '@/helpers/server/trpc'
|
import { authenticatedProcedure } from '@/helpers/server/trpc'
|
||||||
import { TRPCError } from '@trpc/server'
|
import { TRPCError } from '@trpc/server'
|
||||||
import { WorkspaceRole } from '@typebot.io/prisma'
|
import { WorkspaceRole } from '@typebot.io/prisma'
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
import prisma from '@/lib/prisma'
|
import prisma from '@typebot.io/lib/prisma'
|
||||||
import { authenticatedProcedure } from '@/helpers/server/trpc'
|
import { authenticatedProcedure } from '@/helpers/server/trpc'
|
||||||
import { TRPCError } from '@trpc/server'
|
import { TRPCError } from '@trpc/server'
|
||||||
import { InputBlockType, typebotSchema } from '@typebot.io/schemas'
|
import { InputBlockType, typebotSchema } from '@typebot.io/schemas'
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
import prisma from '@/lib/prisma'
|
import prisma from '@typebot.io/lib/prisma'
|
||||||
import { authenticatedProcedure } from '@/helpers/server/trpc'
|
import { authenticatedProcedure } from '@/helpers/server/trpc'
|
||||||
import { TRPCError } from '@trpc/server'
|
import { TRPCError } from '@trpc/server'
|
||||||
import { z } from 'zod'
|
import { z } from 'zod'
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
import prisma from '@/lib/prisma'
|
import prisma from '@typebot.io/lib/prisma'
|
||||||
import { authenticatedProcedure } from '@/helpers/server/trpc'
|
import { authenticatedProcedure } from '@/helpers/server/trpc'
|
||||||
import { TRPCError } from '@trpc/server'
|
import { TRPCError } from '@trpc/server'
|
||||||
import { typebotCreateSchema, typebotSchema } from '@typebot.io/schemas'
|
import { typebotCreateSchema, typebotSchema } from '@typebot.io/schemas'
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
import prisma from '@/lib/prisma'
|
import prisma from '@typebot.io/lib/prisma'
|
||||||
import { env } from '@typebot.io/env'
|
import { env } from '@typebot.io/env'
|
||||||
import { CollaboratorsOnTypebots, User } from '@typebot.io/prisma'
|
import { CollaboratorsOnTypebots, User } from '@typebot.io/prisma'
|
||||||
import { Typebot } from '@typebot.io/schemas'
|
import { Typebot } from '@typebot.io/schemas'
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
import prisma from '@/lib/prisma'
|
import prisma from '@typebot.io/lib/prisma'
|
||||||
import {
|
import {
|
||||||
CollaborationType,
|
CollaborationType,
|
||||||
CollaboratorsOnTypebots,
|
CollaboratorsOnTypebots,
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
import prisma from '@/lib/prisma'
|
import prisma from '@typebot.io/lib/prisma'
|
||||||
import { Plan } from '@typebot.io/prisma'
|
import { Plan } from '@typebot.io/prisma'
|
||||||
import {
|
import {
|
||||||
Block,
|
Block,
|
||||||
|
@ -3,7 +3,7 @@ import { z } from 'zod'
|
|||||||
import { env } from '@typebot.io/env'
|
import { env } from '@typebot.io/env'
|
||||||
import { TRPCError } from '@trpc/server'
|
import { TRPCError } from '@trpc/server'
|
||||||
import { generatePresignedPostPolicy } from '@typebot.io/lib/s3/generatePresignedPostPolicy'
|
import { generatePresignedPostPolicy } from '@typebot.io/lib/s3/generatePresignedPostPolicy'
|
||||||
import prisma from '@/lib/prisma'
|
import prisma from '@typebot.io/lib/prisma'
|
||||||
import { isWriteWorkspaceForbidden } from '@/features/workspace/helpers/isWriteWorkspaceForbidden'
|
import { isWriteWorkspaceForbidden } from '@/features/workspace/helpers/isWriteWorkspaceForbidden'
|
||||||
import { isWriteTypebotForbidden } from '@/features/typebot/helpers/isWriteTypebotForbidden'
|
import { isWriteTypebotForbidden } from '@/features/typebot/helpers/isWriteTypebotForbidden'
|
||||||
|
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
import { authenticatedProcedure } from '@/helpers/server/trpc'
|
import { authenticatedProcedure } from '@/helpers/server/trpc'
|
||||||
import { z } from 'zod'
|
import { z } from 'zod'
|
||||||
import prisma from '@/lib/prisma'
|
import prisma from '@typebot.io/lib/prisma'
|
||||||
import { createId } from '@paralleldrive/cuid2'
|
import { createId } from '@paralleldrive/cuid2'
|
||||||
|
|
||||||
export const generateVerificationToken = authenticatedProcedure
|
export const generateVerificationToken = authenticatedProcedure
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
import { authenticatedProcedure } from '@/helpers/server/trpc'
|
import { authenticatedProcedure } from '@/helpers/server/trpc'
|
||||||
import { z } from 'zod'
|
import { z } from 'zod'
|
||||||
import got from 'got'
|
import got from 'got'
|
||||||
import prisma from '@/lib/prisma'
|
import prisma from '@typebot.io/lib/prisma'
|
||||||
import { decrypt } from '@typebot.io/lib/api'
|
import { decrypt } from '@typebot.io/lib/api'
|
||||||
import { TRPCError } from '@trpc/server'
|
import { TRPCError } from '@trpc/server'
|
||||||
import { WhatsAppCredentials } from '@typebot.io/schemas/features/whatsapp'
|
import { WhatsAppCredentials } from '@typebot.io/schemas/features/whatsapp'
|
||||||
|
@ -3,7 +3,7 @@ import { z } from 'zod'
|
|||||||
import got from 'got'
|
import got from 'got'
|
||||||
import { TRPCError } from '@trpc/server'
|
import { TRPCError } from '@trpc/server'
|
||||||
import { WhatsAppCredentials } from '@typebot.io/schemas/features/whatsapp'
|
import { WhatsAppCredentials } from '@typebot.io/schemas/features/whatsapp'
|
||||||
import prisma from '@/lib/prisma'
|
import prisma from '@typebot.io/lib/prisma'
|
||||||
import { decrypt } from '@typebot.io/lib/api/encryption'
|
import { decrypt } from '@typebot.io/lib/api/encryption'
|
||||||
|
|
||||||
const inputSchema = z.object({
|
const inputSchema = z.object({
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
import { publicProcedure } from '@/helpers/server/trpc'
|
import { publicProcedure } from '@/helpers/server/trpc'
|
||||||
import { whatsAppWebhookRequestBodySchema } from '@typebot.io/schemas/features/whatsapp'
|
import { whatsAppWebhookRequestBodySchema } from '@typebot.io/schemas/features/whatsapp'
|
||||||
import { z } from 'zod'
|
import { z } from 'zod'
|
||||||
import { resumeWhatsAppFlow } from '@typebot.io/viewer/src/features/whatsApp/helpers/resumeWhatsAppFlow'
|
import { resumeWhatsAppFlow } from '@typebot.io/bot-engine/whatsapp/resumeWhatsAppFlow'
|
||||||
import { isNotDefined } from '@typebot.io/lib'
|
import { isNotDefined } from '@typebot.io/lib'
|
||||||
import { TRPCError } from '@trpc/server'
|
import { TRPCError } from '@trpc/server'
|
||||||
import { env } from '@typebot.io/env'
|
import { env } from '@typebot.io/env'
|
||||||
|
@ -1,14 +1,14 @@
|
|||||||
import { authenticatedProcedure } from '@/helpers/server/trpc'
|
import { authenticatedProcedure } from '@/helpers/server/trpc'
|
||||||
import { z } from 'zod'
|
import { z } from 'zod'
|
||||||
import { TRPCError } from '@trpc/server'
|
import { TRPCError } from '@trpc/server'
|
||||||
import { sendWhatsAppMessage } from '@typebot.io/lib/whatsApp/sendWhatsAppMessage'
|
import { startSession } from '@typebot.io/bot-engine/startSession'
|
||||||
import { startSession } from '@typebot.io/viewer/src/features/chat/helpers/startSession'
|
|
||||||
import { env } from '@typebot.io/env'
|
import { env } from '@typebot.io/env'
|
||||||
import { HTTPError } from 'got'
|
import { HTTPError } from 'got'
|
||||||
import prisma from '@/lib/prisma'
|
import prisma from '@typebot.io/lib/prisma'
|
||||||
import { sendChatReplyToWhatsApp } from '@typebot.io/lib/whatsApp/sendChatReplyToWhatsApp'
|
import { saveStateToDatabase } from '@typebot.io/bot-engine/saveStateToDatabase'
|
||||||
import { saveStateToDatabase } from '@typebot.io/viewer/src/features/chat/helpers/saveStateToDatabase'
|
import { restartSession } from '@typebot.io/bot-engine/queries/restartSession'
|
||||||
import { restartSession } from '@typebot.io/viewer/src/features/chat/queries/restartSession'
|
import { sendChatReplyToWhatsApp } from '@typebot.io/bot-engine/whatsapp/sendChatReplyToWhatsApp'
|
||||||
|
import { sendWhatsAppMessage } from '@typebot.io/bot-engine/whatsapp/sendWhatsAppMessage'
|
||||||
import { isReadTypebotForbidden } from '../typebot/helpers/isReadTypebotForbidden'
|
import { isReadTypebotForbidden } from '../typebot/helpers/isReadTypebotForbidden'
|
||||||
import { SessionState } from '@typebot.io/schemas'
|
import { SessionState } from '@typebot.io/schemas'
|
||||||
|
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
import { authenticatedProcedure } from '@/helpers/server/trpc'
|
import { authenticatedProcedure } from '@/helpers/server/trpc'
|
||||||
import { z } from 'zod'
|
import { z } from 'zod'
|
||||||
import prisma from '@/lib/prisma'
|
import prisma from '@typebot.io/lib/prisma'
|
||||||
|
|
||||||
export const verifyIfPhoneNumberAvailable = authenticatedProcedure
|
export const verifyIfPhoneNumberAvailable = authenticatedProcedure
|
||||||
.meta({
|
.meta({
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
import { sendTelemetryEvents } from '@typebot.io/lib/telemetry/sendTelemetryEvent'
|
import { sendTelemetryEvents } from '@typebot.io/lib/telemetry/sendTelemetryEvent'
|
||||||
import prisma from '@/lib/prisma'
|
import prisma from '@typebot.io/lib/prisma'
|
||||||
import { authenticatedProcedure } from '@/helpers/server/trpc'
|
import { authenticatedProcedure } from '@/helpers/server/trpc'
|
||||||
import { TRPCError } from '@trpc/server'
|
import { TRPCError } from '@trpc/server'
|
||||||
import { Workspace, workspaceSchema } from '@typebot.io/schemas'
|
import { Workspace, workspaceSchema } from '@typebot.io/schemas'
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
import prisma from '@/lib/prisma'
|
import prisma from '@typebot.io/lib/prisma'
|
||||||
import { authenticatedProcedure } from '@/helpers/server/trpc'
|
import { authenticatedProcedure } from '@/helpers/server/trpc'
|
||||||
import { z } from 'zod'
|
import { z } from 'zod'
|
||||||
import { isAdminWriteWorkspaceForbidden } from '../helpers/isAdminWriteWorkspaceForbidden'
|
import { isAdminWriteWorkspaceForbidden } from '../helpers/isAdminWriteWorkspaceForbidden'
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
import prisma from '@/lib/prisma'
|
import prisma from '@typebot.io/lib/prisma'
|
||||||
import { authenticatedProcedure } from '@/helpers/server/trpc'
|
import { authenticatedProcedure } from '@/helpers/server/trpc'
|
||||||
import { TRPCError } from '@trpc/server'
|
import { TRPCError } from '@trpc/server'
|
||||||
import { workspaceSchema } from '@typebot.io/schemas'
|
import { workspaceSchema } from '@typebot.io/schemas'
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
import prisma from '@/lib/prisma'
|
import prisma from '@typebot.io/lib/prisma'
|
||||||
import { authenticatedProcedure } from '@/helpers/server/trpc'
|
import { authenticatedProcedure } from '@/helpers/server/trpc'
|
||||||
import { TRPCError } from '@trpc/server'
|
import { TRPCError } from '@trpc/server'
|
||||||
import { workspaceInvitationSchema } from '@typebot.io/schemas'
|
import { workspaceInvitationSchema } from '@typebot.io/schemas'
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
import prisma from '@/lib/prisma'
|
import prisma from '@typebot.io/lib/prisma'
|
||||||
import { authenticatedProcedure } from '@/helpers/server/trpc'
|
import { authenticatedProcedure } from '@/helpers/server/trpc'
|
||||||
import { TRPCError } from '@trpc/server'
|
import { TRPCError } from '@trpc/server'
|
||||||
import { workspaceMemberSchema } from '@typebot.io/schemas'
|
import { workspaceMemberSchema } from '@typebot.io/schemas'
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
import prisma from '@/lib/prisma'
|
import prisma from '@typebot.io/lib/prisma'
|
||||||
import { authenticatedProcedure } from '@/helpers/server/trpc'
|
import { authenticatedProcedure } from '@/helpers/server/trpc'
|
||||||
import { TRPCError } from '@trpc/server'
|
import { TRPCError } from '@trpc/server'
|
||||||
import { workspaceSchema } from '@typebot.io/schemas'
|
import { workspaceSchema } from '@typebot.io/schemas'
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
import prisma from '@/lib/prisma'
|
import prisma from '@typebot.io/lib/prisma'
|
||||||
import { authenticatedProcedure } from '@/helpers/server/trpc'
|
import { authenticatedProcedure } from '@/helpers/server/trpc'
|
||||||
import { TRPCError } from '@trpc/server'
|
import { TRPCError } from '@trpc/server'
|
||||||
import { workspaceSchema } from '@typebot.io/schemas'
|
import { workspaceSchema } from '@typebot.io/schemas'
|
||||||
|
@ -5,7 +5,7 @@ import {
|
|||||||
User,
|
User,
|
||||||
WorkspaceRole,
|
WorkspaceRole,
|
||||||
} from '@typebot.io/prisma'
|
} from '@typebot.io/prisma'
|
||||||
import prisma from '@/lib/prisma'
|
import prisma from '@typebot.io/lib/prisma'
|
||||||
import { NextApiResponse } from 'next'
|
import { NextApiResponse } from 'next'
|
||||||
import { forbidden } from '@typebot.io/lib/api'
|
import { forbidden } from '@typebot.io/lib/api'
|
||||||
import { env } from '@typebot.io/env'
|
import { env } from '@typebot.io/env'
|
||||||
|
@ -3,8 +3,8 @@ import { OAuth2Client, Credentials } from 'google-auth-library'
|
|||||||
import { GoogleSheetsCredentials } from '@typebot.io/schemas'
|
import { GoogleSheetsCredentials } from '@typebot.io/schemas'
|
||||||
import { isDefined } from '@typebot.io/lib'
|
import { isDefined } from '@typebot.io/lib'
|
||||||
import { decrypt, encrypt } from '@typebot.io/lib/api'
|
import { decrypt, encrypt } from '@typebot.io/lib/api'
|
||||||
import prisma from './prisma'
|
|
||||||
import { env } from '@typebot.io/env'
|
import { env } from '@typebot.io/env'
|
||||||
|
import prisma from '@typebot.io/lib/prisma'
|
||||||
|
|
||||||
export const oauth2Client = new OAuth2Client(
|
export const oauth2Client = new OAuth2Client(
|
||||||
env.GOOGLE_CLIENT_ID,
|
env.GOOGLE_CLIENT_ID,
|
||||||
|
@ -1,22 +0,0 @@
|
|||||||
/**
|
|
||||||
* Instantiates a single instance PrismaClient and save it on the global object.
|
|
||||||
* @link https://www.prisma.io/docs/support/help-articles/nextjs-prisma-client-dev-practices
|
|
||||||
*/
|
|
||||||
import { env } from '@typebot.io/env'
|
|
||||||
import { PrismaClient } from '@typebot.io/prisma'
|
|
||||||
|
|
||||||
const prismaGlobal = global as typeof global & {
|
|
||||||
prisma?: PrismaClient
|
|
||||||
}
|
|
||||||
|
|
||||||
const prisma: PrismaClient =
|
|
||||||
prismaGlobal.prisma ||
|
|
||||||
new PrismaClient({
|
|
||||||
log: env.NODE_ENV === 'development' ? ['error', 'warn'] : ['error'],
|
|
||||||
})
|
|
||||||
|
|
||||||
if (env.NODE_ENV !== 'production') {
|
|
||||||
prismaGlobal.prisma = prisma
|
|
||||||
}
|
|
||||||
|
|
||||||
export default prisma
|
|
@ -5,7 +5,7 @@ import GitlabProvider from 'next-auth/providers/gitlab'
|
|||||||
import GoogleProvider from 'next-auth/providers/google'
|
import GoogleProvider from 'next-auth/providers/google'
|
||||||
import FacebookProvider from 'next-auth/providers/facebook'
|
import FacebookProvider from 'next-auth/providers/facebook'
|
||||||
import AzureADProvider from 'next-auth/providers/azure-ad'
|
import AzureADProvider from 'next-auth/providers/azure-ad'
|
||||||
import prisma from '@/lib/prisma'
|
import prisma from '@typebot.io/lib/prisma'
|
||||||
import { Provider } from 'next-auth/providers'
|
import { Provider } from 'next-auth/providers'
|
||||||
import { NextApiRequest, NextApiResponse } from 'next'
|
import { NextApiRequest, NextApiResponse } from 'next'
|
||||||
import { customAdapter } from '../../../features/auth/api/customAdapter'
|
import { customAdapter } from '../../../features/auth/api/customAdapter'
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
import prisma from '@/lib/prisma'
|
import prisma from '@typebot.io/lib/prisma'
|
||||||
import { Credentials } from '@typebot.io/schemas'
|
import { Credentials } from '@typebot.io/schemas'
|
||||||
import { NextApiRequest, NextApiResponse } from 'next'
|
import { NextApiRequest, NextApiResponse } from 'next'
|
||||||
import { getAuthenticatedUser } from '@/features/auth/helpers/getAuthenticatedUser'
|
import { getAuthenticatedUser } from '@/features/auth/helpers/getAuthenticatedUser'
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
import prisma from '@/lib/prisma'
|
import prisma from '@typebot.io/lib/prisma'
|
||||||
import { NextApiRequest, NextApiResponse } from 'next'
|
import { NextApiRequest, NextApiResponse } from 'next'
|
||||||
import {
|
import {
|
||||||
badRequest,
|
badRequest,
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
import { NextApiRequest, NextApiResponse } from 'next'
|
import { NextApiRequest, NextApiResponse } from 'next'
|
||||||
import { Prisma } from '@typebot.io/prisma'
|
import { Prisma } from '@typebot.io/prisma'
|
||||||
import prisma from '@/lib/prisma'
|
import prisma from '@typebot.io/lib/prisma'
|
||||||
import { googleSheetsScopes } from './consent-url'
|
import { googleSheetsScopes } from './consent-url'
|
||||||
import { stringify } from 'querystring'
|
import { stringify } from 'querystring'
|
||||||
import { badRequest, encrypt, notAuthenticated } from '@typebot.io/lib/api'
|
import { badRequest, encrypt, notAuthenticated } from '@typebot.io/lib/api'
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
import prisma from '@/lib/prisma'
|
import prisma from '@typebot.io/lib/prisma'
|
||||||
import { NextApiRequest, NextApiResponse } from 'next'
|
import { NextApiRequest, NextApiResponse } from 'next'
|
||||||
import {
|
import {
|
||||||
badRequest,
|
badRequest,
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
import { DashboardFolder, WorkspaceRole } from '@typebot.io/prisma'
|
import { DashboardFolder, WorkspaceRole } from '@typebot.io/prisma'
|
||||||
import prisma from '@/lib/prisma'
|
import prisma from '@typebot.io/lib/prisma'
|
||||||
import { NextApiRequest, NextApiResponse } from 'next'
|
import { NextApiRequest, NextApiResponse } from 'next'
|
||||||
import {
|
import {
|
||||||
badRequest,
|
badRequest,
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
import { DashboardFolder } from '@typebot.io/prisma'
|
import { DashboardFolder } from '@typebot.io/prisma'
|
||||||
import prisma from '@/lib/prisma'
|
import prisma from '@typebot.io/lib/prisma'
|
||||||
import { NextApiRequest, NextApiResponse } from 'next'
|
import { NextApiRequest, NextApiResponse } from 'next'
|
||||||
import { methodNotAllowed, notAuthenticated } from '@typebot.io/lib/api'
|
import { methodNotAllowed, notAuthenticated } from '@typebot.io/lib/api'
|
||||||
import { getAuthenticatedUser } from '@/features/auth/helpers/getAuthenticatedUser'
|
import { getAuthenticatedUser } from '@/features/auth/helpers/getAuthenticatedUser'
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
import prisma from '@/lib/prisma'
|
import prisma from '@typebot.io/lib/prisma'
|
||||||
import { NextApiRequest, NextApiResponse } from 'next'
|
import { NextApiRequest, NextApiResponse } from 'next'
|
||||||
import { methodNotAllowed, notAuthenticated } from '@typebot.io/lib/api'
|
import { methodNotAllowed, notAuthenticated } from '@typebot.io/lib/api'
|
||||||
import { getAuthenticatedUser } from '@/features/auth/helpers/getAuthenticatedUser'
|
import { getAuthenticatedUser } from '@/features/auth/helpers/getAuthenticatedUser'
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
import prisma from '@/lib/prisma'
|
import prisma from '@typebot.io/lib/prisma'
|
||||||
import { InputBlockType, PublicTypebot } from '@typebot.io/schemas'
|
import { InputBlockType, PublicTypebot } from '@typebot.io/schemas'
|
||||||
import { NextApiRequest, NextApiResponse } from 'next'
|
import { NextApiRequest, NextApiResponse } from 'next'
|
||||||
import { canPublishFileInput } from '@/helpers/databaseRules'
|
import { canPublishFileInput } from '@/helpers/databaseRules'
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
import prisma from '@/lib/prisma'
|
import prisma from '@typebot.io/lib/prisma'
|
||||||
import { InputBlockType, PublicTypebot } from '@typebot.io/schemas'
|
import { InputBlockType, PublicTypebot } from '@typebot.io/schemas'
|
||||||
import { NextApiRequest, NextApiResponse } from 'next'
|
import { NextApiRequest, NextApiResponse } from 'next'
|
||||||
import { canPublishFileInput, canWriteTypebots } from '@/helpers/databaseRules'
|
import { canPublishFileInput, canWriteTypebots } from '@/helpers/databaseRules'
|
||||||
|
@ -3,7 +3,7 @@ import { methodNotAllowed } from '@typebot.io/lib/api'
|
|||||||
import Stripe from 'stripe'
|
import Stripe from 'stripe'
|
||||||
import Cors from 'micro-cors'
|
import Cors from 'micro-cors'
|
||||||
import { buffer } from 'micro'
|
import { buffer } from 'micro'
|
||||||
import prisma from '@/lib/prisma'
|
import prisma from '@typebot.io/lib/prisma'
|
||||||
import { Plan, WorkspaceRole } from '@typebot.io/prisma'
|
import { Plan, WorkspaceRole } from '@typebot.io/prisma'
|
||||||
import { RequestHandler } from 'next/dist/server/next'
|
import { RequestHandler } from 'next/dist/server/next'
|
||||||
import { sendTelemetryEvents } from '@typebot.io/lib/telemetry/sendTelemetryEvent'
|
import { sendTelemetryEvents } from '@typebot.io/lib/telemetry/sendTelemetryEvent'
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
import prisma from '@/lib/prisma'
|
import prisma from '@typebot.io/lib/prisma'
|
||||||
import { Stats } from '@typebot.io/schemas'
|
import { Stats } from '@typebot.io/schemas'
|
||||||
import { NextApiRequest, NextApiResponse } from 'next'
|
import { NextApiRequest, NextApiResponse } from 'next'
|
||||||
import { canReadTypebots } from '@/helpers/databaseRules'
|
import { canReadTypebots } from '@/helpers/databaseRules'
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
import prisma from '@/lib/prisma'
|
import prisma from '@typebot.io/lib/prisma'
|
||||||
import { NextApiRequest, NextApiResponse } from 'next'
|
import { NextApiRequest, NextApiResponse } from 'next'
|
||||||
import { canReadTypebots } from '@/helpers/databaseRules'
|
import { canReadTypebots } from '@/helpers/databaseRules'
|
||||||
import { getAuthenticatedUser } from '@/features/auth/helpers/getAuthenticatedUser'
|
import { getAuthenticatedUser } from '@/features/auth/helpers/getAuthenticatedUser'
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
import prisma from '@/lib/prisma'
|
import prisma from '@typebot.io/lib/prisma'
|
||||||
import { NextApiRequest, NextApiResponse } from 'next'
|
import { NextApiRequest, NextApiResponse } from 'next'
|
||||||
import { canReadTypebots } from '@/helpers/databaseRules'
|
import { canReadTypebots } from '@/helpers/databaseRules'
|
||||||
import { getAuthenticatedUser } from '@/features/auth/helpers/getAuthenticatedUser'
|
import { getAuthenticatedUser } from '@/features/auth/helpers/getAuthenticatedUser'
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
import prisma from '@/lib/prisma'
|
import prisma from '@typebot.io/lib/prisma'
|
||||||
import { NextApiRequest, NextApiResponse } from 'next'
|
import { NextApiRequest, NextApiResponse } from 'next'
|
||||||
import { canEditGuests } from '@/helpers/databaseRules'
|
import { canEditGuests } from '@/helpers/databaseRules'
|
||||||
import { getAuthenticatedUser } from '@/features/auth/helpers/getAuthenticatedUser'
|
import { getAuthenticatedUser } from '@/features/auth/helpers/getAuthenticatedUser'
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
import { CollaborationType, WorkspaceRole } from '@typebot.io/prisma'
|
import { CollaborationType, WorkspaceRole } from '@typebot.io/prisma'
|
||||||
import prisma from '@/lib/prisma'
|
import prisma from '@typebot.io/lib/prisma'
|
||||||
import { NextApiRequest, NextApiResponse } from 'next'
|
import { NextApiRequest, NextApiResponse } from 'next'
|
||||||
import {
|
import {
|
||||||
canReadTypebots,
|
canReadTypebots,
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
import { Invitation } from '@typebot.io/prisma'
|
import { Invitation } from '@typebot.io/prisma'
|
||||||
import prisma from '@/lib/prisma'
|
import prisma from '@typebot.io/lib/prisma'
|
||||||
import { NextApiRequest, NextApiResponse } from 'next'
|
import { NextApiRequest, NextApiResponse } from 'next'
|
||||||
import { canEditGuests } from '@/helpers/databaseRules'
|
import { canEditGuests } from '@/helpers/databaseRules'
|
||||||
import { getAuthenticatedUser } from '@/features/auth/helpers/getAuthenticatedUser'
|
import { getAuthenticatedUser } from '@/features/auth/helpers/getAuthenticatedUser'
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
import prisma from '@/lib/prisma'
|
import prisma from '@typebot.io/lib/prisma'
|
||||||
import { NextApiRequest, NextApiResponse } from 'next'
|
import { NextApiRequest, NextApiResponse } from 'next'
|
||||||
import { getAuthenticatedUser } from '@/features/auth/helpers/getAuthenticatedUser'
|
import { getAuthenticatedUser } from '@/features/auth/helpers/getAuthenticatedUser'
|
||||||
import { methodNotAllowed, notAuthenticated } from '@typebot.io/lib/api'
|
import { methodNotAllowed, notAuthenticated } from '@typebot.io/lib/api'
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
import prisma from '@/lib/prisma'
|
import prisma from '@typebot.io/lib/prisma'
|
||||||
import { NextApiRequest, NextApiResponse } from 'next'
|
import { NextApiRequest, NextApiResponse } from 'next'
|
||||||
import { getAuthenticatedUser } from '@/features/auth/helpers/getAuthenticatedUser'
|
import { getAuthenticatedUser } from '@/features/auth/helpers/getAuthenticatedUser'
|
||||||
import { generateId } from '@typebot.io/lib'
|
import { generateId } from '@typebot.io/lib'
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
import prisma from '@/lib/prisma'
|
import prisma from '@typebot.io/lib/prisma'
|
||||||
import { NextApiRequest, NextApiResponse } from 'next'
|
import { NextApiRequest, NextApiResponse } from 'next'
|
||||||
import { getAuthenticatedUser } from '@/features/auth/helpers/getAuthenticatedUser'
|
import { getAuthenticatedUser } from '@/features/auth/helpers/getAuthenticatedUser'
|
||||||
import { methodNotAllowed, notAuthenticated } from '@typebot.io/lib/api'
|
import { methodNotAllowed, notAuthenticated } from '@typebot.io/lib/api'
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
import { WorkspaceInvitation, WorkspaceRole } from '@typebot.io/prisma'
|
import { WorkspaceInvitation, WorkspaceRole } from '@typebot.io/prisma'
|
||||||
import prisma from '@/lib/prisma'
|
import prisma from '@typebot.io/lib/prisma'
|
||||||
import { NextApiRequest, NextApiResponse } from 'next'
|
import { NextApiRequest, NextApiResponse } from 'next'
|
||||||
import {
|
import {
|
||||||
forbidden,
|
forbidden,
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
import { WorkspaceInvitation, WorkspaceRole } from '@typebot.io/prisma'
|
import { WorkspaceInvitation, WorkspaceRole } from '@typebot.io/prisma'
|
||||||
import prisma from '@/lib/prisma'
|
import prisma from '@typebot.io/lib/prisma'
|
||||||
import { NextApiRequest, NextApiResponse } from 'next'
|
import { NextApiRequest, NextApiResponse } from 'next'
|
||||||
import { getAuthenticatedUser } from '@/features/auth/helpers/getAuthenticatedUser'
|
import { getAuthenticatedUser } from '@/features/auth/helpers/getAuthenticatedUser'
|
||||||
import { methodNotAllowed, notAuthenticated } from '@typebot.io/lib/api'
|
import { methodNotAllowed, notAuthenticated } from '@typebot.io/lib/api'
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
import prisma from '@/lib/prisma'
|
import prisma from '@typebot.io/lib/prisma'
|
||||||
import { NextApiRequest, NextApiResponse } from 'next'
|
import { NextApiRequest, NextApiResponse } from 'next'
|
||||||
import { getAuthenticatedUser } from '@/features/auth/helpers/getAuthenticatedUser'
|
import { getAuthenticatedUser } from '@/features/auth/helpers/getAuthenticatedUser'
|
||||||
import {
|
import {
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
import { MemberInWorkspace, WorkspaceRole } from '@typebot.io/prisma'
|
import { MemberInWorkspace, WorkspaceRole } from '@typebot.io/prisma'
|
||||||
import prisma from '@/lib/prisma'
|
import prisma from '@typebot.io/lib/prisma'
|
||||||
import { NextApiRequest, NextApiResponse } from 'next'
|
import { NextApiRequest, NextApiResponse } from 'next'
|
||||||
import { getAuthenticatedUser } from '@/features/auth/helpers/getAuthenticatedUser'
|
import { getAuthenticatedUser } from '@/features/auth/helpers/getAuthenticatedUser'
|
||||||
import { methodNotAllowed, notAuthenticated } from '@typebot.io/lib/api'
|
import { methodNotAllowed, notAuthenticated } from '@typebot.io/lib/api'
|
||||||
|
@ -3,7 +3,7 @@
|
|||||||
"compilerOptions": {
|
"compilerOptions": {
|
||||||
"baseUrl": ".",
|
"baseUrl": ".",
|
||||||
"paths": {
|
"paths": {
|
||||||
"@/*": ["src/*", "../viewer/src/*"]
|
"@/*": ["src/*"]
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"include": ["next-env.d.ts", "**/*.ts", "**/*.tsx"]
|
"include": ["next-env.d.ts", "**/*.ts", "**/*.tsx"]
|
||||||
|
@ -1565,7 +1565,8 @@
|
|||||||
"additionalProperties": false
|
"additionalProperties": false
|
||||||
},
|
},
|
||||||
"sizeLimit": {
|
"sizeLimit": {
|
||||||
"type": "number"
|
"type": "number",
|
||||||
|
"description": "Deprecated"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"required": [
|
"required": [
|
||||||
@ -5952,7 +5953,8 @@
|
|||||||
"additionalProperties": false
|
"additionalProperties": false
|
||||||
},
|
},
|
||||||
"sizeLimit": {
|
"sizeLimit": {
|
||||||
"type": "number"
|
"type": "number",
|
||||||
|
"description": "Deprecated"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"required": [
|
"required": [
|
||||||
@ -9974,7 +9976,8 @@
|
|||||||
"additionalProperties": false
|
"additionalProperties": false
|
||||||
},
|
},
|
||||||
"sizeLimit": {
|
"sizeLimit": {
|
||||||
"type": "number"
|
"type": "number",
|
||||||
|
"description": "Deprecated"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"required": [
|
"required": [
|
||||||
@ -14136,7 +14139,8 @@
|
|||||||
"additionalProperties": false
|
"additionalProperties": false
|
||||||
},
|
},
|
||||||
"sizeLimit": {
|
"sizeLimit": {
|
||||||
"type": "number"
|
"type": "number",
|
||||||
|
"description": "Deprecated"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"required": [
|
"required": [
|
||||||
@ -18178,7 +18182,8 @@
|
|||||||
"additionalProperties": false
|
"additionalProperties": false
|
||||||
},
|
},
|
||||||
"sizeLimit": {
|
"sizeLimit": {
|
||||||
"type": "number"
|
"type": "number",
|
||||||
|
"description": "Deprecated"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"required": [
|
"required": [
|
||||||
@ -22275,7 +22280,8 @@
|
|||||||
"additionalProperties": false
|
"additionalProperties": false
|
||||||
},
|
},
|
||||||
"sizeLimit": {
|
"sizeLimit": {
|
||||||
"type": "number"
|
"type": "number",
|
||||||
|
"description": "Deprecated"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"required": [
|
"required": [
|
||||||
@ -26435,7 +26441,8 @@
|
|||||||
"additionalProperties": false
|
"additionalProperties": false
|
||||||
},
|
},
|
||||||
"sizeLimit": {
|
"sizeLimit": {
|
||||||
"type": "number"
|
"type": "number",
|
||||||
|
"description": "Deprecated"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"required": [
|
"required": [
|
||||||
@ -33600,12 +33607,17 @@
|
|||||||
"presignedUrl": {
|
"presignedUrl": {
|
||||||
"type": "string"
|
"type": "string"
|
||||||
},
|
},
|
||||||
|
"formData": {
|
||||||
|
"type": "object",
|
||||||
|
"additionalProperties": {}
|
||||||
|
},
|
||||||
"fileUrl": {
|
"fileUrl": {
|
||||||
"type": "string"
|
"type": "string"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"required": [
|
"required": [
|
||||||
"presignedUrl",
|
"presignedUrl",
|
||||||
|
"formData",
|
||||||
"fileUrl"
|
"fileUrl"
|
||||||
],
|
],
|
||||||
"additionalProperties": false
|
"additionalProperties": false
|
||||||
|
@ -1148,7 +1148,8 @@
|
|||||||
"additionalProperties": false
|
"additionalProperties": false
|
||||||
},
|
},
|
||||||
"sizeLimit": {
|
"sizeLimit": {
|
||||||
"type": "number"
|
"type": "number",
|
||||||
|
"description": "Deprecated"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"required": [
|
"required": [
|
||||||
@ -5075,7 +5076,8 @@
|
|||||||
"additionalProperties": false
|
"additionalProperties": false
|
||||||
},
|
},
|
||||||
"sizeLimit": {
|
"sizeLimit": {
|
||||||
"type": "number"
|
"type": "number",
|
||||||
|
"description": "Deprecated"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"required": [
|
"required": [
|
||||||
@ -6348,12 +6350,17 @@
|
|||||||
"presignedUrl": {
|
"presignedUrl": {
|
||||||
"type": "string"
|
"type": "string"
|
||||||
},
|
},
|
||||||
|
"formData": {
|
||||||
|
"type": "object",
|
||||||
|
"additionalProperties": {}
|
||||||
|
},
|
||||||
"hasReachedStorageLimit": {
|
"hasReachedStorageLimit": {
|
||||||
"type": "boolean"
|
"type": "boolean"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"required": [
|
"required": [
|
||||||
"presignedUrl",
|
"presignedUrl",
|
||||||
|
"formData",
|
||||||
"hasReachedStorageLimit"
|
"hasReachedStorageLimit"
|
||||||
],
|
],
|
||||||
"additionalProperties": false
|
"additionalProperties": false
|
||||||
@ -6428,12 +6435,17 @@
|
|||||||
"presignedUrl": {
|
"presignedUrl": {
|
||||||
"type": "string"
|
"type": "string"
|
||||||
},
|
},
|
||||||
|
"formData": {
|
||||||
|
"type": "object",
|
||||||
|
"additionalProperties": {}
|
||||||
|
},
|
||||||
"fileUrl": {
|
"fileUrl": {
|
||||||
"type": "string"
|
"type": "string"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"required": [
|
"required": [
|
||||||
"presignedUrl",
|
"presignedUrl",
|
||||||
|
"formData",
|
||||||
"fileUrl"
|
"fileUrl"
|
||||||
],
|
],
|
||||||
"additionalProperties": false
|
"additionalProperties": false
|
||||||
@ -6499,7 +6511,10 @@
|
|||||||
"/workspaces/{workspaceId}/whatsapp/phoneNumbers/{phoneNumberId}/webhook": {
|
"/workspaces/{workspaceId}/whatsapp/phoneNumbers/{phoneNumberId}/webhook": {
|
||||||
"get": {
|
"get": {
|
||||||
"operationId": "whatsAppRouter-subscribeWebhook",
|
"operationId": "whatsAppRouter-subscribeWebhook",
|
||||||
"summary": "Subscribe WhatsApp webhook",
|
"summary": "Subscribe webhook",
|
||||||
|
"tags": [
|
||||||
|
"WhatsApp"
|
||||||
|
],
|
||||||
"security": [
|
"security": [
|
||||||
{
|
{
|
||||||
"Authorization": []
|
"Authorization": []
|
||||||
@ -6557,7 +6572,10 @@
|
|||||||
},
|
},
|
||||||
"post": {
|
"post": {
|
||||||
"operationId": "whatsAppRouter-receiveMessage",
|
"operationId": "whatsAppRouter-receiveMessage",
|
||||||
"summary": "Receive WhatsApp Message",
|
"summary": "Message webhook",
|
||||||
|
"tags": [
|
||||||
|
"WhatsApp"
|
||||||
|
],
|
||||||
"requestBody": {
|
"requestBody": {
|
||||||
"required": true,
|
"required": true,
|
||||||
"content": {
|
"content": {
|
||||||
|
@ -16,27 +16,21 @@
|
|||||||
"@trpc/server": "10.34.0",
|
"@trpc/server": "10.34.0",
|
||||||
"@typebot.io/nextjs": "workspace:*",
|
"@typebot.io/nextjs": "workspace:*",
|
||||||
"@typebot.io/prisma": "workspace:*",
|
"@typebot.io/prisma": "workspace:*",
|
||||||
"@udecode/plate-common": "^21.1.5",
|
|
||||||
"ai": "2.1.32",
|
"ai": "2.1.32",
|
||||||
"bot-engine": "workspace:*",
|
"bot-engine": "workspace:*",
|
||||||
"chrono-node": "2.6.6",
|
|
||||||
"cors": "2.8.5",
|
"cors": "2.8.5",
|
||||||
"date-fns": "^2.30.0",
|
|
||||||
"eventsource-parser": "^1.0.0",
|
|
||||||
"google-spreadsheet": "4.0.2",
|
"google-spreadsheet": "4.0.2",
|
||||||
"got": "12.6.0",
|
"got": "12.6.0",
|
||||||
"libphonenumber-js": "1.10.37",
|
|
||||||
"next": "13.4.3",
|
"next": "13.4.3",
|
||||||
"nextjs-cors": "2.1.2",
|
"nextjs-cors": "2.1.2",
|
||||||
"node-html-parser": "^6.1.5",
|
|
||||||
"nodemailer": "6.9.3",
|
"nodemailer": "6.9.3",
|
||||||
"openai-edge": "1.2.2",
|
"openai-edge": "1.2.2",
|
||||||
"qs": "6.11.2",
|
"qs": "6.11.2",
|
||||||
"react": "18.2.0",
|
"react": "18.2.0",
|
||||||
"react-dom": "18.2.0",
|
"react-dom": "18.2.0",
|
||||||
"remark-slate": "^1.8.6",
|
|
||||||
"stripe": "12.13.0",
|
"stripe": "12.13.0",
|
||||||
"trpc-openapi": "1.2.0"
|
"trpc-openapi": "1.2.0",
|
||||||
|
"@typebot.io/bot-engine": "workspace:*"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@faire/mjml-react": "3.3.0",
|
"@faire/mjml-react": "3.3.0",
|
||||||
@ -53,13 +47,11 @@
|
|||||||
"@types/papaparse": "5.3.7",
|
"@types/papaparse": "5.3.7",
|
||||||
"@types/qs": "6.9.7",
|
"@types/qs": "6.9.7",
|
||||||
"@types/react": "18.2.15",
|
"@types/react": "18.2.15",
|
||||||
"@types/sanitize-html": "2.9.0",
|
|
||||||
"dotenv-cli": "^7.2.1",
|
"dotenv-cli": "^7.2.1",
|
||||||
"eslint": "8.44.0",
|
"eslint": "8.44.0",
|
||||||
"eslint-config-custom": "workspace:*",
|
"eslint-config-custom": "workspace:*",
|
||||||
"google-auth-library": "8.9.0",
|
"google-auth-library": "8.9.0",
|
||||||
"next-runtime-env": "^1.6.2",
|
"next-runtime-env": "^1.6.2",
|
||||||
"node-fetch": "3.3.1",
|
|
||||||
"papaparse": "5.4.1",
|
"papaparse": "5.4.1",
|
||||||
"superjson": "1.12.4",
|
"superjson": "1.12.4",
|
||||||
"typescript": "5.1.6",
|
"typescript": "5.1.6",
|
||||||
|
@ -1,24 +0,0 @@
|
|||||||
import { getAuthenticatedGoogleClient } from '@/lib/google-sheets'
|
|
||||||
import { TRPCError } from '@trpc/server'
|
|
||||||
import { GoogleSpreadsheet } from 'google-spreadsheet'
|
|
||||||
|
|
||||||
export const getAuthenticatedGoogleDoc = async ({
|
|
||||||
credentialsId,
|
|
||||||
spreadsheetId,
|
|
||||||
}: {
|
|
||||||
credentialsId?: string
|
|
||||||
spreadsheetId?: string
|
|
||||||
}) => {
|
|
||||||
if (!credentialsId || !spreadsheetId)
|
|
||||||
throw new TRPCError({
|
|
||||||
code: 'BAD_REQUEST',
|
|
||||||
message: 'Missing credentialsId or spreadsheetId',
|
|
||||||
})
|
|
||||||
const auth = await getAuthenticatedGoogleClient(credentialsId)
|
|
||||||
if (!auth)
|
|
||||||
throw new TRPCError({
|
|
||||||
code: 'NOT_FOUND',
|
|
||||||
message: "Couldn't find credentials in database",
|
|
||||||
})
|
|
||||||
return new GoogleSpreadsheet(spreadsheetId, auth)
|
|
||||||
}
|
|
@ -1,34 +0,0 @@
|
|||||||
import { canReadTypebots } from '@/helpers/api/dbRules'
|
|
||||||
import prisma from '@/lib/prisma'
|
|
||||||
import { User } from '@typebot.io/prisma'
|
|
||||||
import { PublicTypebot, Typebot } from '@typebot.io/schemas'
|
|
||||||
|
|
||||||
type Props = {
|
|
||||||
isPreview?: boolean
|
|
||||||
typebotIds: string[]
|
|
||||||
user?: User
|
|
||||||
}
|
|
||||||
|
|
||||||
export const fetchLinkedTypebots = async ({
|
|
||||||
user,
|
|
||||||
isPreview,
|
|
||||||
typebotIds,
|
|
||||||
}: Props) => {
|
|
||||||
const linkedTypebots = (
|
|
||||||
isPreview
|
|
||||||
? await prisma.typebot.findMany({
|
|
||||||
where: user
|
|
||||||
? {
|
|
||||||
AND: [
|
|
||||||
{ id: { in: typebotIds } },
|
|
||||||
canReadTypebots(typebotIds, user as User),
|
|
||||||
],
|
|
||||||
}
|
|
||||||
: { id: { in: typebotIds } },
|
|
||||||
})
|
|
||||||
: await prisma.publicTypebot.findMany({
|
|
||||||
where: { id: { in: typebotIds } },
|
|
||||||
})
|
|
||||||
) as (Typebot | PublicTypebot)[]
|
|
||||||
return linkedTypebots
|
|
||||||
}
|
|
@ -1,15 +1,15 @@
|
|||||||
import { publicProcedure } from '@/helpers/server/trpc'
|
import { publicProcedure } from '@/helpers/server/trpc'
|
||||||
import { saveStateToDatabase } from '../helpers/saveStateToDatabase'
|
|
||||||
import { getSession } from '../queries/getSession'
|
|
||||||
import { continueBotFlow } from '../helpers/continueBotFlow'
|
|
||||||
import { parseDynamicTheme } from '../helpers/parseDynamicTheme'
|
|
||||||
import { startSession } from '../helpers/startSession'
|
|
||||||
import { restartSession } from '../queries/restartSession'
|
|
||||||
import {
|
import {
|
||||||
chatReplySchema,
|
chatReplySchema,
|
||||||
sendMessageInputSchema,
|
sendMessageInputSchema,
|
||||||
} from '@typebot.io/schemas/features/chat/schema'
|
} from '@typebot.io/schemas/features/chat/schema'
|
||||||
import { TRPCError } from '@trpc/server'
|
import { TRPCError } from '@trpc/server'
|
||||||
|
import { getSession } from '@typebot.io/bot-engine/queries/getSession'
|
||||||
|
import { startSession } from '@typebot.io/bot-engine/startSession'
|
||||||
|
import { saveStateToDatabase } from '@typebot.io/bot-engine/saveStateToDatabase'
|
||||||
|
import { restartSession } from '@typebot.io/bot-engine/queries/restartSession'
|
||||||
|
import { continueBotFlow } from '@typebot.io/bot-engine/continueBotFlow'
|
||||||
|
import { parseDynamicTheme } from '@typebot.io/bot-engine/parseDynamicTheme'
|
||||||
|
|
||||||
export const sendMessage = publicProcedure
|
export const sendMessage = publicProcedure
|
||||||
.meta({
|
.meta({
|
||||||
|
@ -1,14 +1,14 @@
|
|||||||
import { publicProcedure } from '@/helpers/server/trpc'
|
import { publicProcedure } from '@/helpers/server/trpc'
|
||||||
import { TRPCError } from '@trpc/server'
|
import { TRPCError } from '@trpc/server'
|
||||||
import { z } from 'zod'
|
import { z } from 'zod'
|
||||||
import { getSession } from '../queries/getSession'
|
import { getSession } from '@typebot.io/bot-engine/queries/getSession'
|
||||||
import prisma from '@/lib/prisma'
|
|
||||||
import {
|
import {
|
||||||
PublicTypebot,
|
PublicTypebot,
|
||||||
SessionState,
|
SessionState,
|
||||||
Typebot,
|
Typebot,
|
||||||
Variable,
|
Variable,
|
||||||
} from '@typebot.io/schemas'
|
} from '@typebot.io/schemas'
|
||||||
|
import prisma from '@typebot.io/lib/prisma'
|
||||||
|
|
||||||
export const updateTypebotInSession = publicProcedure
|
export const updateTypebotInSession = publicProcedure
|
||||||
.meta({
|
.meta({
|
||||||
|
@ -1,5 +1,4 @@
|
|||||||
import { publicProcedure } from '@/helpers/server/trpc'
|
import { publicProcedure } from '@/helpers/server/trpc'
|
||||||
import prisma from '@/lib/prisma'
|
|
||||||
import { TRPCError } from '@trpc/server'
|
import { TRPCError } from '@trpc/server'
|
||||||
import {
|
import {
|
||||||
FileInputBlock,
|
FileInputBlock,
|
||||||
@ -12,6 +11,7 @@ import { byId, isDefined } from '@typebot.io/lib'
|
|||||||
import { z } from 'zod'
|
import { z } from 'zod'
|
||||||
import { generatePresignedPostPolicy } from '@typebot.io/lib/s3/generatePresignedPostPolicy'
|
import { generatePresignedPostPolicy } from '@typebot.io/lib/s3/generatePresignedPostPolicy'
|
||||||
import { env } from '@typebot.io/env'
|
import { env } from '@typebot.io/env'
|
||||||
|
import prisma from '@typebot.io/lib/prisma'
|
||||||
|
|
||||||
export const getUploadUrl = publicProcedure
|
export const getUploadUrl = publicProcedure
|
||||||
.meta({
|
.meta({
|
@ -1,10 +1,10 @@
|
|||||||
import { publicProcedure } from '@/helpers/server/trpc'
|
import { publicProcedure } from '@/helpers/server/trpc'
|
||||||
import prisma from '@/lib/prisma'
|
|
||||||
import { TRPCError } from '@trpc/server'
|
import { TRPCError } from '@trpc/server'
|
||||||
import { z } from 'zod'
|
import { z } from 'zod'
|
||||||
import { generatePresignedPostPolicy } from '@typebot.io/lib/s3/generatePresignedPostPolicy'
|
import { generatePresignedPostPolicy } from '@typebot.io/lib/s3/generatePresignedPostPolicy'
|
||||||
import { env } from '@typebot.io/env'
|
import { env } from '@typebot.io/env'
|
||||||
import { InputBlockType, publicTypebotSchema } from '@typebot.io/schemas'
|
import { InputBlockType, publicTypebotSchema } from '@typebot.io/schemas'
|
||||||
|
import prisma from '@typebot.io/lib/prisma'
|
||||||
|
|
||||||
export const generateUploadUrl = publicProcedure
|
export const generateUploadUrl = publicProcedure
|
||||||
.meta({
|
.meta({
|
@ -1,8 +1,8 @@
|
|||||||
import { publicProcedure } from '@/helpers/server/trpc'
|
import { publicProcedure } from '@/helpers/server/trpc'
|
||||||
import { whatsAppWebhookRequestBodySchema } from '@typebot.io/schemas/features/whatsapp'
|
import { whatsAppWebhookRequestBodySchema } from '@typebot.io/schemas/features/whatsapp'
|
||||||
import { resumeWhatsAppFlow } from '../helpers/resumeWhatsAppFlow'
|
|
||||||
import { z } from 'zod'
|
import { z } from 'zod'
|
||||||
import { isNotDefined } from '@typebot.io/lib'
|
import { isNotDefined } from '@typebot.io/lib'
|
||||||
|
import { resumeWhatsAppFlow } from '@typebot.io/bot-engine/whatsapp/resumeWhatsAppFlow'
|
||||||
|
|
||||||
export const receiveMessage = publicProcedure
|
export const receiveMessage = publicProcedure
|
||||||
.meta({
|
.meta({
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user