build: add pnpm
This commit is contained in:
@@ -1,2 +1,3 @@
|
||||
# Don't edit this file
|
||||
NEXT_PUBLIC_VIEWER_URL=
|
||||
NEXT_PUBLIC_E2E_TEST=
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import React from 'react'
|
||||
import { env, isEmpty } from 'utils'
|
||||
import { getViewerUrl, isEmpty } from 'utils'
|
||||
|
||||
export const ErrorPage = ({ error }: { error: Error }) => {
|
||||
return (
|
||||
@@ -12,7 +12,7 @@ export const ErrorPage = ({ error }: { error: Error }) => {
|
||||
flexDirection: 'column',
|
||||
}}
|
||||
>
|
||||
{isEmpty(env('VIEWER_URL')) ? (
|
||||
{isEmpty(getViewerUrl()) ? (
|
||||
<>
|
||||
<h1 style={{ fontWeight: 'bold', fontSize: '30px' }}>
|
||||
NEXT_PUBLIC_VIEWER_URL is missing
|
||||
|
||||
@@ -1,29 +1,20 @@
|
||||
// This file sets a custom webpack configuration to use your Next.js app
|
||||
// with Sentry.
|
||||
// https://nextjs.org/docs/api-reference/next.config.js/introduction
|
||||
// https://docs.sentry.io/platforms/javascript/guides/nextjs/
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/no-var-requires
|
||||
/* eslint-disable @typescript-eslint/no-var-requires */
|
||||
const { withSentryConfig } = require('@sentry/nextjs')
|
||||
const path = require('path')
|
||||
|
||||
const moduleExports = {
|
||||
/** @type {import('next').NextConfig} */
|
||||
const nextConfig = {
|
||||
reactStrictMode: true,
|
||||
output: 'standalone',
|
||||
experimental: {
|
||||
outputStandalone: true,
|
||||
outputFileTracingRoot: path.join(__dirname, '../../'),
|
||||
},
|
||||
}
|
||||
|
||||
const sentryWebpackPluginOptions = {
|
||||
// Additional config options for the Sentry Webpack plugin. Keep in mind that
|
||||
// the following options are set automatically, and overriding them is not
|
||||
// recommended:
|
||||
// release, url, org, project, authToken, configFile, stripPrefix,
|
||||
// urlPrefix, include, ignore
|
||||
|
||||
silent: true, // Suppresses all logs
|
||||
// For all available options, see:
|
||||
// https://github.com/getsentry/sentry-webpack-plugin#options.
|
||||
silent: true,
|
||||
}
|
||||
|
||||
module.exports = process.env.SENTRY_AUTH_TOKEN
|
||||
? withSentryConfig(moduleExports, sentryWebpackPluginOptions)
|
||||
: moduleExports
|
||||
? withSentryConfig(nextConfig, sentryWebpackPluginOptions)
|
||||
: nextConfig
|
||||
|
||||
@@ -3,48 +3,51 @@
|
||||
"license": "AGPL-3.0-or-later",
|
||||
"version": "0.1.0",
|
||||
"scripts": {
|
||||
"dx": "yarn dev",
|
||||
"dx": "pnpm dev",
|
||||
"dev": "ENVSH_ENV=.env.local bash ../../env.sh next dev -p 3001",
|
||||
"build": "next build",
|
||||
"start": "next start",
|
||||
"lint": "next lint",
|
||||
"test": "yarn playwright test",
|
||||
"test:open": "PWDEBUG=1 yarn playwright test"
|
||||
"test": "pnpm playwright test",
|
||||
"test:open": "PWDEBUG=1 pnpm playwright test"
|
||||
},
|
||||
"dependencies": {
|
||||
"@sentry/nextjs": "^6.19.7",
|
||||
"aws-sdk": "^2.1152.0",
|
||||
"@sentry/nextjs": "7.9.0",
|
||||
"aws-sdk": "2.1190.0",
|
||||
"bot-engine": "*",
|
||||
"cors": "^2.8.5",
|
||||
"cuid": "^2.1.8",
|
||||
"db": "*",
|
||||
"google-spreadsheet": "^3.2.0",
|
||||
"got": "^12.0.4",
|
||||
"models": "*",
|
||||
"next": "^12.1.6",
|
||||
"nodemailer": "^6.7.5",
|
||||
"qs": "^6.10.3",
|
||||
"react": "^18.1.0",
|
||||
"react-dom": "^18.1.0",
|
||||
"sanitize-html": "^2.7.0",
|
||||
"stripe": "^9.1.0",
|
||||
"utils": "*"
|
||||
"db": "workspace:*",
|
||||
"google-spreadsheet": "^3.3.0",
|
||||
"got": "12.3.1",
|
||||
"next": "12.2.4",
|
||||
"nodemailer": "^6.7.7",
|
||||
"qs": "^6.11.0",
|
||||
"react": "^18.2.0",
|
||||
"react-dom": "^18.2.0",
|
||||
"sanitize-html": "^2.7.1",
|
||||
"stripe": "10.0.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@playwright/test": "^1.22.0",
|
||||
"@types/aws-sdk": "^2.7.0",
|
||||
"@types/papaparse": "5.3.3",
|
||||
"@playwright/test": "1.24.2",
|
||||
"eslint-plugin-react": "^7.30.1",
|
||||
"@types/cors": "^2.8.12",
|
||||
"@types/google-spreadsheet": "^3.2.1",
|
||||
"@types/node": "^17.0.33",
|
||||
"@types/nodemailer": "^6.4.4",
|
||||
"@types/google-spreadsheet": "^3.3.0",
|
||||
"@types/node": "18.6.5",
|
||||
"@types/nodemailer": "6.4.5",
|
||||
"@types/qs": "^6.9.7",
|
||||
"@types/react": "^18.0.9",
|
||||
"@types/sanitize-html": "^2.6.2",
|
||||
"@types/stripe": "^8.0.417",
|
||||
"@typescript-eslint/eslint-plugin": "^5.23.0",
|
||||
"eslint": "<8.0.0",
|
||||
"eslint-config-next": "12.1.6",
|
||||
"@types/react": "^18.0.17",
|
||||
"@types/sanitize-html": "2.6.2",
|
||||
"@typescript-eslint/eslint-plugin": "5.33.0",
|
||||
"@typescript-eslint/parser": "5.33.0",
|
||||
"eslint": "8.21.0",
|
||||
"eslint-config-next": "12.2.4",
|
||||
"google-auth-library": "^8.1.1",
|
||||
"models": "workspace:*",
|
||||
"next-transpile-modules": "^9.0.0",
|
||||
"typescript": "^4.6.4"
|
||||
"papaparse": "^5.3.2",
|
||||
"typescript": "^4.7.4",
|
||||
"utils": "workspace:*"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,7 +3,7 @@ import { NotFoundPage } from 'layouts/NotFoundPage'
|
||||
import { PublicTypebot } from 'models'
|
||||
import { GetServerSideProps, GetServerSidePropsContext } from 'next'
|
||||
import sanitizeHtml from 'sanitize-html'
|
||||
import { env, isDefined, isNotDefined, omit } from 'utils'
|
||||
import { env, getViewerUrl, isDefined, isNotDefined, omit } from 'utils'
|
||||
import { TypebotPage, TypebotPageProps } from '../layouts/TypebotPage'
|
||||
import prisma from '../libs/prisma'
|
||||
|
||||
@@ -16,9 +16,9 @@ export const getServerSideProps: GetServerSideProps = async (
|
||||
const { host, forwardedHost } = getHost(context.req)
|
||||
try {
|
||||
if (!host) return { props: {} }
|
||||
const viewerUrls = (env('VIEWER_URL') ?? '').split(',')
|
||||
const viewerUrls = (getViewerUrl({ returnAll: true }) ?? '').split(',')
|
||||
const isMatchingViewerUrl =
|
||||
env('E2E_TEST') === 'enabled'
|
||||
env('E2E_TEST') === 'true'
|
||||
? true
|
||||
: viewerUrls.some(
|
||||
(url) =>
|
||||
|
||||
@@ -51,7 +51,7 @@ const handler = async (req: NextApiRequest, res: NextApiResponse) => {
|
||||
isPreview && stripeKeys?.test?.secretKey
|
||||
? stripeKeys.test.secretKey
|
||||
: stripeKeys.live.secretKey,
|
||||
{ apiVersion: '2020-08-27' }
|
||||
{ apiVersion: '2022-08-01' }
|
||||
)
|
||||
const amount =
|
||||
Number(parseVariables(variables)(inputOptions.amount)) *
|
||||
@@ -84,6 +84,7 @@ const handler = async (req: NextApiRequest, res: NextApiResponse) => {
|
||||
}`,
|
||||
})
|
||||
} catch (err) {
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
const error = err as any
|
||||
return 'raw' in error
|
||||
? res.status(error.raw.statusCode).send({
|
||||
|
||||
@@ -37,8 +37,8 @@ const cors = initMiddleware(Cors())
|
||||
const handler = async (req: NextApiRequest, res: NextApiResponse) => {
|
||||
await cors(req, res)
|
||||
if (req.method === 'POST') {
|
||||
const typebotId = req.query.typebotId.toString()
|
||||
const blockId = req.query.blockId.toString()
|
||||
const typebotId = req.query.typebotId as string
|
||||
const blockId = req.query.blockId as string
|
||||
const resultId = req.query.resultId as string | undefined
|
||||
const { resultValues, variables } = (
|
||||
typeof req.body === 'string' ? JSON.parse(req.body) : req.body
|
||||
@@ -250,6 +250,7 @@ const convertKeyValueTableToObject = (
|
||||
}, {})
|
||||
}
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
const safeJsonParse = (json: string): any => {
|
||||
try {
|
||||
return JSON.parse(json)
|
||||
|
||||
@@ -9,8 +9,8 @@ const handler = async (req: NextApiRequest, res: NextApiResponse) => {
|
||||
const user = await authenticateUser(req)
|
||||
if (!user) return res.status(401).json({ message: 'Not authenticated' })
|
||||
if (req.method === 'GET') {
|
||||
const typebotId = req.query.typebotId.toString()
|
||||
const blockId = req.query.blockId.toString()
|
||||
const typebotId = req.query.typebotId as string
|
||||
const blockId = req.query.blockId as string
|
||||
const typebot = (await prisma.typebot.findFirst({
|
||||
where: {
|
||||
id: typebotId,
|
||||
|
||||
@@ -18,9 +18,9 @@ const cors = initMiddleware(Cors())
|
||||
const handler = async (req: NextApiRequest, res: NextApiResponse) => {
|
||||
await cors(req, res)
|
||||
if (req.method === 'POST') {
|
||||
const typebotId = req.query.typebotId.toString()
|
||||
const groupId = req.query.groupId.toString()
|
||||
const blockId = req.query.blockId.toString()
|
||||
const typebotId = req.query.typebotId as string
|
||||
const groupId = req.query.groupId as string
|
||||
const blockId = req.query.blockId as string
|
||||
const resultId = req.query.resultId as string | undefined
|
||||
const { resultValues, variables } = (
|
||||
typeof req.body === 'string' ? JSON.parse(req.body) : req.body
|
||||
|
||||
@@ -9,8 +9,8 @@ const handler = async (req: NextApiRequest, res: NextApiResponse) => {
|
||||
const user = await authenticateUser(req)
|
||||
if (!user) return res.status(401).json({ message: 'Not authenticated' })
|
||||
if (req.method === 'GET') {
|
||||
const typebotId = req.query.typebotId.toString()
|
||||
const groupId = req.query.groupId.toString()
|
||||
const typebotId = req.query.typebotId as string
|
||||
const groupId = req.query.groupId as string
|
||||
const typebot = (await prisma.typebot.findFirst({
|
||||
where: {
|
||||
id: typebotId,
|
||||
|
||||
@@ -13,9 +13,9 @@ const handler = async (req: NextApiRequest, res: NextApiResponse) => {
|
||||
if (!('url' in body))
|
||||
return res.status(403).send({ message: 'url is missing in body' })
|
||||
const { url } = body
|
||||
const typebotId = req.query.typebotId.toString()
|
||||
const groupId = req.query.groupId.toString()
|
||||
const blockId = req.query.blockId.toString()
|
||||
const typebotId = req.query.typebotId as string
|
||||
const groupId = req.query.groupId as string
|
||||
const blockId = req.query.blockId as string
|
||||
const typebot = (await prisma.typebot.findFirst({
|
||||
where: {
|
||||
id: typebotId,
|
||||
|
||||
@@ -9,9 +9,9 @@ const handler = async (req: NextApiRequest, res: NextApiResponse) => {
|
||||
const user = await authenticateUser(req)
|
||||
if (!user) return res.status(401).json({ message: 'Not authenticated' })
|
||||
if (req.method === 'POST') {
|
||||
const typebotId = req.query.typebotId.toString()
|
||||
const groupId = req.query.groupId.toString()
|
||||
const blockId = req.query.blockId.toString()
|
||||
const typebotId = req.query.typebotId as string
|
||||
const groupId = req.query.groupId as string
|
||||
const blockId = req.query.blockId as string
|
||||
const typebot = (await prisma.typebot.findFirst({
|
||||
where: {
|
||||
id: typebotId,
|
||||
|
||||
@@ -13,8 +13,8 @@ const handler = async (req: NextApiRequest, res: NextApiResponse) => {
|
||||
if (!('url' in body))
|
||||
return res.status(403).send({ message: 'url is missing in body' })
|
||||
const { url } = body
|
||||
const typebotId = req.query.typebotId.toString()
|
||||
const blockId = req.query.blockId.toString()
|
||||
const typebotId = req.query.typebotId as string
|
||||
const blockId = req.query.blockId as string
|
||||
const typebot = (await prisma.typebot.findFirst({
|
||||
where: {
|
||||
id: typebotId,
|
||||
|
||||
@@ -9,8 +9,8 @@ const handler = async (req: NextApiRequest, res: NextApiResponse) => {
|
||||
const user = await authenticateUser(req)
|
||||
if (!user) return res.status(401).json({ message: 'Not authenticated' })
|
||||
if (req.method === 'POST') {
|
||||
const typebotId = req.query.typebotId.toString()
|
||||
const blockId = req.query.blockId.toString()
|
||||
const typebotId = req.query.typebotId as string
|
||||
const blockId = req.query.blockId as string
|
||||
const typebot = (await prisma.typebot.findFirst({
|
||||
where: {
|
||||
id: typebotId,
|
||||
|
||||
@@ -8,7 +8,7 @@ const handler = async (req: NextApiRequest, res: NextApiResponse) => {
|
||||
if (req.method === 'GET') {
|
||||
const user = await authenticateUser(req)
|
||||
if (!user) return res.status(401).json({ message: 'Not authenticated' })
|
||||
const typebotId = req.query.typebotId.toString()
|
||||
const typebotId = req.query.typebotId as string
|
||||
const limit = Number(req.query.limit)
|
||||
const results = (await prisma.result.findMany({
|
||||
where: {
|
||||
|
||||
@@ -9,7 +9,7 @@ const handler = async (req: NextApiRequest, res: NextApiResponse) => {
|
||||
if (req.method === 'GET') {
|
||||
const user = await authenticateUser(req)
|
||||
if (!user) return res.status(401).json({ message: 'Not authenticated' })
|
||||
const typebotId = req.query.typebotId.toString()
|
||||
const typebotId = req.query.typebotId as string
|
||||
const typebot = await prisma.typebot.findFirst({
|
||||
where: {
|
||||
id: typebotId,
|
||||
|
||||
@@ -9,7 +9,7 @@ const handler = async (req: NextApiRequest, res: NextApiResponse) => {
|
||||
if (req.method === 'GET') {
|
||||
const user = await authenticateUser(req)
|
||||
if (!user) return res.status(401).json({ message: 'Not authenticated' })
|
||||
const typebotId = req.query.typebotId.toString()
|
||||
const typebotId = req.query.typebotId as string
|
||||
const typebot = await prisma.typebot.findFirst({
|
||||
where: {
|
||||
id: typebotId,
|
||||
|
||||
@@ -20,7 +20,7 @@ const parseWhereFilter = (
|
||||
id: typeof typebotIds === 'string' ? typebotIds : { in: typebotIds },
|
||||
workspace:
|
||||
(type === 'read' && user.email === process.env.ADMIN_EMAIL) ||
|
||||
env('E2E_TEST') === 'enabled'
|
||||
env('E2E_TEST') === 'true'
|
||||
? undefined
|
||||
: {
|
||||
members: {
|
||||
|
||||
Reference in New Issue
Block a user