build: add pnpm
This commit is contained in:
@ -6,53 +6,59 @@
|
||||
"module": "dist/esm/index.js",
|
||||
"types": "dist/index.d.ts",
|
||||
"dependencies": {
|
||||
"@stripe/react-stripe-js": "^1.8.0",
|
||||
"db": "*",
|
||||
"models": "*",
|
||||
"qs": "^6.10.3",
|
||||
"@stripe/react-stripe-js": "1.10.0",
|
||||
"@stripe/stripe-js": "1.35.0",
|
||||
"prop-types": "^15.8.1",
|
||||
"qs": "^6.11.0",
|
||||
"react-frame-component": "5.2.3",
|
||||
"react-phone-number-input": "^3.1.52",
|
||||
"react-phone-number-input": "3.2.6",
|
||||
"react-scroll": "^1.8.7",
|
||||
"react-transition-group": "^4.4.2",
|
||||
"resize-observer": "^1.0.4",
|
||||
"utils": "*"
|
||||
"react-transition-group": "4.4.5",
|
||||
"resize-observer": "^1.0.4"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@rollup/plugin-commonjs": "^22.0.0",
|
||||
"@rollup/plugin-commonjs": "22.0.2",
|
||||
"@rollup/plugin-json": "^4.1.0",
|
||||
"@rollup/plugin-node-resolve": "^13.3.0",
|
||||
"@rollup/plugin-typescript": "^8.3.2",
|
||||
"@rollup/plugin-typescript": "8.3.4",
|
||||
"@types/qs": "^6.9.7",
|
||||
"@types/react": "^18.0.9",
|
||||
"@types/react-phone-number-input": "^3.0.13",
|
||||
"@types/react-scroll": "^1.8.3",
|
||||
"@types/react-transition-group": "^4.4.4",
|
||||
"@typescript-eslint/eslint-plugin": "^5.23.0",
|
||||
"autoprefixer": "^10.4.7",
|
||||
"eslint": "<8.0.0",
|
||||
"eslint-config-next": "12.1.6",
|
||||
"@types/react": "18.0.17",
|
||||
"@types/react-phone-number-input": "^3.0.14",
|
||||
"@types/react-scroll": "^1.8.4",
|
||||
"@types/react-transition-group": "^4.4.5",
|
||||
"@typescript-eslint/eslint-plugin": "5.33.0",
|
||||
"@typescript-eslint/parser": "5.33.0",
|
||||
"autoprefixer": "10.4.8",
|
||||
"db": "workspace:*",
|
||||
"eslint": "8.21.0",
|
||||
"eslint-config-next": "12.2.4",
|
||||
"eslint-config-prettier": "^8.5.0",
|
||||
"eslint-plugin-prettier": "^4.0.0",
|
||||
"npm-run-all": "^4.1.5",
|
||||
"postcss": "^8.4.13",
|
||||
"rollup": "^2.72.1",
|
||||
"rollup-plugin-dts": "^4.2.1",
|
||||
"eslint-plugin-prettier": "^4.2.1",
|
||||
"models": "workspace:*",
|
||||
"postcss": "8.4.16",
|
||||
"prettier": "2.7.1",
|
||||
"react": "^18.2.0",
|
||||
"react-dom": "^18.2.0",
|
||||
"rollup": "2.77.2",
|
||||
"rollup-plugin-dts": "^4.2.2",
|
||||
"rollup-plugin-peer-deps-external": "^2.2.4",
|
||||
"rollup-plugin-postcss": "^4.0.2",
|
||||
"rollup-plugin-terser": "^7.0.2",
|
||||
"tailwindcss": "^3.0.24",
|
||||
"tailwindcss": "3.1.8",
|
||||
"tslib": "^2.4.0",
|
||||
"typescript": "^4.6.4"
|
||||
"typescript": "^4.7.4",
|
||||
"utils": "workspace:*"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"react": "^18.1.0",
|
||||
"utils": "*",
|
||||
"db": "*",
|
||||
"models": "*"
|
||||
"db": "workspace:*",
|
||||
"models": "workspace:*",
|
||||
"react": "^18.0.0",
|
||||
"react-dom": "^18.0.0",
|
||||
"utils": "workspace:*"
|
||||
},
|
||||
"scripts": {
|
||||
"build": "yarn rollup -c",
|
||||
"dx": "yarn rollup -c --watch",
|
||||
"build": "pnpm rollup -c",
|
||||
"dx": "pnpm rollup -c --watch",
|
||||
"lint": "eslint --fix -c ./.eslintrc.js \"./src/**/*.ts*\""
|
||||
}
|
||||
}
|
||||
|
@ -44,7 +44,7 @@ export default [
|
||||
],
|
||||
},
|
||||
{
|
||||
input: 'dist/esm/types/src/index.d.ts',
|
||||
input: 'dist/esm/src/index.d.ts',
|
||||
output: [{ file: 'dist/index.d.ts', format: 'esm' }],
|
||||
plugins: [dts()],
|
||||
external: [/\.css$/],
|
||||
|
@ -13,10 +13,8 @@ export const LiteBadge = () => {
|
||||
const observer = new MutationObserver(function (mutations_list) {
|
||||
mutations_list.forEach(function (mutation) {
|
||||
mutation.removedNodes.forEach(function (removed_node) {
|
||||
if ((removed_node as HTMLElement).id == 'lite-badge') {
|
||||
console.log('litebadge has been removed')
|
||||
if ((removed_node as HTMLElement).id == 'lite-badge')
|
||||
container.append(liteBadge.current as Node)
|
||||
}
|
||||
})
|
||||
})
|
||||
})
|
||||
|
@ -21,7 +21,7 @@ import {
|
||||
} from 'models'
|
||||
import { Log } from 'db'
|
||||
import { LiteBadge } from './LiteBadge'
|
||||
import { env, isEmpty } from 'utils'
|
||||
import { getViewerUrl, isEmpty } from 'utils'
|
||||
|
||||
export type TypebotViewerProps = {
|
||||
typebot: PublicTypebot
|
||||
@ -41,7 +41,7 @@ export type TypebotViewerProps = {
|
||||
|
||||
export const TypebotViewer = ({
|
||||
typebot,
|
||||
apiHost = env('VIEWER_URL')?.split(',')[0],
|
||||
apiHost = getViewerUrl(),
|
||||
isPreview = false,
|
||||
isLoading = false,
|
||||
style,
|
||||
|
@ -1,5 +1,6 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"lib": ["ES2015", "DOM"],
|
||||
"target": "es5",
|
||||
"esModuleInterop": true,
|
||||
"forceConsistentCasingInFileNames": true,
|
||||
|
@ -5,18 +5,19 @@
|
||||
"main": "./index.ts",
|
||||
"types": "./index.ts",
|
||||
"devDependencies": {
|
||||
"prisma": "^3.15.2",
|
||||
"typescript": "^4.6.4",
|
||||
"dotenv-cli": "5.1.0"
|
||||
"prisma": "4.1.1",
|
||||
"typescript": "^4.7.4",
|
||||
"dotenv-cli": "6.0.0"
|
||||
},
|
||||
"dependencies": {
|
||||
"@prisma/client": "^3.15.2"
|
||||
"@prisma/client": "4.1.1"
|
||||
},
|
||||
"scripts": {
|
||||
"dx": "dotenv -e ../../apps/builder/.env.local prisma db push && yarn generate:schema && yarn start:sutdio ",
|
||||
"build": "yarn generate:schema",
|
||||
"dx": "dotenv -e ../../apps/builder/.env.local prisma db push && pnpm generate:schema && pnpm start:sutdio ",
|
||||
"build": "pnpm generate:schema",
|
||||
"start:sutdio": "dotenv -e ../../apps/builder/.env.local -v BROWSER=none prisma studio",
|
||||
"generate:schema": "dotenv -e ../../apps/builder/.env.local prisma generate",
|
||||
"prisma": "dotenv -e ../../apps/builder/.env.local prisma",
|
||||
"migration:push": "dotenv -e ../../apps/builder/.env.local prisma db push",
|
||||
"migration:create": "dotenv -e ../../apps/builder/.env.local prisma migrate dev",
|
||||
"migration:reset": "dotenv -e ../../apps/builder/.env.local prisma migrate reset",
|
||||
|
@ -1,12 +1,12 @@
|
||||
generator client {
|
||||
provider = "prisma-client-js"
|
||||
}
|
||||
|
||||
datasource db {
|
||||
provider = "postgresql"
|
||||
url = env("DATABASE_URL")
|
||||
}
|
||||
|
||||
generator client {
|
||||
provider = "prisma-client-js"
|
||||
}
|
||||
|
||||
model Account {
|
||||
id String @id @default(cuid())
|
||||
userId String
|
||||
@ -23,8 +23,7 @@ model Account {
|
||||
oauth_token_secret String?
|
||||
oauth_token String?
|
||||
refresh_token_expires_in Int?
|
||||
|
||||
user User @relation(fields: [userId], references: [id], onDelete: Cascade)
|
||||
user User @relation(fields: [userId], references: [id], onDelete: Cascade)
|
||||
|
||||
@@unique([provider, providerAccountId])
|
||||
}
|
||||
@ -46,14 +45,14 @@ model User {
|
||||
email String? @unique
|
||||
emailVerified DateTime?
|
||||
image String?
|
||||
accounts Account[]
|
||||
sessions Session[]
|
||||
apiTokens ApiToken[]
|
||||
CollaboratorsOnTypebots CollaboratorsOnTypebots[]
|
||||
company String?
|
||||
onboardingCategories String[]
|
||||
graphNavigation GraphNavigation?
|
||||
accounts Account[]
|
||||
apiTokens ApiToken[]
|
||||
CollaboratorsOnTypebots CollaboratorsOnTypebots[]
|
||||
workspaces MemberInWorkspace[]
|
||||
sessions Session[]
|
||||
}
|
||||
|
||||
model ApiToken {
|
||||
@ -61,54 +60,43 @@ model ApiToken {
|
||||
token String @unique
|
||||
name String
|
||||
ownerId String
|
||||
owner User @relation(fields: [ownerId], references: [id], onDelete: Cascade)
|
||||
lastUsedAt DateTime @default(now())
|
||||
createdAt DateTime @default(now())
|
||||
owner User @relation(fields: [ownerId], references: [id], onDelete: Cascade)
|
||||
}
|
||||
|
||||
model Workspace {
|
||||
id String @id @default(cuid())
|
||||
name String
|
||||
icon String?
|
||||
members MemberInWorkspace[]
|
||||
folders DashboardFolder[]
|
||||
typebots Typebot[]
|
||||
createdAt DateTime @default(now())
|
||||
plan Plan @default(FREE)
|
||||
stripeId String? @unique
|
||||
customDomains CustomDomain[]
|
||||
credentials Credentials[]
|
||||
customDomains CustomDomain[]
|
||||
folders DashboardFolder[]
|
||||
members MemberInWorkspace[]
|
||||
typebots Typebot[]
|
||||
invitations WorkspaceInvitation[]
|
||||
}
|
||||
|
||||
model MemberInWorkspace {
|
||||
userId String
|
||||
user User @relation(fields: [userId], references: [id], onDelete: Cascade)
|
||||
workspaceId String
|
||||
workspace Workspace @relation(fields: [workspaceId], references: [id], onDelete: Cascade)
|
||||
role WorkspaceRole
|
||||
user User @relation(fields: [userId], references: [id], onDelete: Cascade)
|
||||
workspace Workspace @relation(fields: [workspaceId], references: [id], onDelete: Cascade)
|
||||
|
||||
@@unique([userId, workspaceId])
|
||||
}
|
||||
|
||||
enum WorkspaceRole {
|
||||
ADMIN
|
||||
MEMBER
|
||||
GUEST
|
||||
}
|
||||
|
||||
model WorkspaceInvitation {
|
||||
id String @id @default(cuid())
|
||||
createdAt DateTime @default(now())
|
||||
email String
|
||||
workspaceId String
|
||||
workspace Workspace @relation(fields: [workspaceId], references: [id], onDelete: Cascade)
|
||||
type WorkspaceRole
|
||||
}
|
||||
|
||||
enum GraphNavigation {
|
||||
MOUSE
|
||||
TRACKPAD
|
||||
workspace Workspace @relation(fields: [workspaceId], references: [id], onDelete: Cascade)
|
||||
}
|
||||
|
||||
model CustomDomain {
|
||||
@ -122,19 +110,11 @@ model Credentials {
|
||||
id String @id @default(cuid())
|
||||
createdAt DateTime @default(now())
|
||||
workspaceId String
|
||||
workspace Workspace @relation(fields: [workspaceId], references: [id], onDelete: Cascade)
|
||||
data String // Encrypted data
|
||||
data String
|
||||
name String
|
||||
type String
|
||||
iv String
|
||||
}
|
||||
|
||||
enum Plan {
|
||||
FREE
|
||||
PRO
|
||||
TEAM
|
||||
LIFETIME
|
||||
OFFERED
|
||||
workspace Workspace @relation(fields: [workspaceId], references: [id], onDelete: Cascade)
|
||||
}
|
||||
|
||||
model VerificationToken {
|
||||
@ -151,11 +131,11 @@ model DashboardFolder {
|
||||
updatedAt DateTime @default(now()) @updatedAt
|
||||
name String
|
||||
parentFolderId String?
|
||||
workspaceId String
|
||||
parentFolder DashboardFolder? @relation("ParentChild", fields: [parentFolderId], references: [id])
|
||||
workspace Workspace @relation(fields: [workspaceId], references: [id], onDelete: Cascade)
|
||||
childrenFolder DashboardFolder[] @relation("ParentChild")
|
||||
typebots Typebot[]
|
||||
workspaceId String
|
||||
workspace Workspace @relation(fields: [workspaceId], references: [id], onDelete: Cascade)
|
||||
}
|
||||
|
||||
model Typebot {
|
||||
@ -165,10 +145,7 @@ model Typebot {
|
||||
icon String?
|
||||
name String
|
||||
publishedTypebotId String?
|
||||
publishedTypebot PublicTypebot?
|
||||
results Result[]
|
||||
folderId String?
|
||||
folder DashboardFolder? @relation(fields: [folderId], references: [id])
|
||||
groups Json
|
||||
variables Json[]
|
||||
edges Json
|
||||
@ -176,51 +153,48 @@ model Typebot {
|
||||
settings Json
|
||||
publicId String? @unique
|
||||
customDomain String? @unique
|
||||
workspaceId String
|
||||
resultsTablePreferences Json?
|
||||
folder DashboardFolder? @relation(fields: [folderId], references: [id])
|
||||
workspace Workspace @relation(fields: [workspaceId], references: [id], onDelete: Cascade)
|
||||
collaborators CollaboratorsOnTypebots[]
|
||||
invitations Invitation[]
|
||||
publishedTypebot PublicTypebot?
|
||||
results Result[]
|
||||
webhooks Webhook[]
|
||||
workspaceId String
|
||||
workspace Workspace @relation(fields: [workspaceId], references: [id], onDelete: Cascade)
|
||||
resultsTablePreferences Json?
|
||||
}
|
||||
|
||||
model Invitation {
|
||||
createdAt DateTime @default(now())
|
||||
email String
|
||||
typebotId String
|
||||
typebot Typebot @relation(fields: [typebotId], references: [id], onDelete: Cascade)
|
||||
type CollaborationType
|
||||
typebot Typebot @relation(fields: [typebotId], references: [id], onDelete: Cascade)
|
||||
|
||||
@@unique([email, typebotId])
|
||||
}
|
||||
|
||||
model CollaboratorsOnTypebots {
|
||||
userId String
|
||||
user User @relation(fields: [userId], references: [id], onDelete: Cascade)
|
||||
typebotId String
|
||||
typebot Typebot @relation(fields: [typebotId], references: [id], onDelete: Cascade)
|
||||
type CollaborationType
|
||||
typebot Typebot @relation(fields: [typebotId], references: [id], onDelete: Cascade)
|
||||
user User @relation(fields: [userId], references: [id], onDelete: Cascade)
|
||||
|
||||
@@unique([userId, typebotId])
|
||||
}
|
||||
|
||||
enum CollaborationType {
|
||||
READ
|
||||
WRITE
|
||||
FULL_ACCESS
|
||||
}
|
||||
|
||||
model PublicTypebot {
|
||||
id String @id @default(cuid())
|
||||
createdAt DateTime @default(now())
|
||||
updatedAt DateTime @default(now()) @updatedAt
|
||||
typebotId String @unique
|
||||
typebot Typebot @relation(fields: [typebotId], references: [id], onDelete: Cascade)
|
||||
groups Json
|
||||
variables Json[]
|
||||
edges Json
|
||||
theme Json
|
||||
settings Json
|
||||
typebot Typebot @relation(fields: [typebotId], references: [id], onDelete: Cascade)
|
||||
}
|
||||
|
||||
model Result {
|
||||
@ -228,12 +202,12 @@ model Result {
|
||||
createdAt DateTime @default(now())
|
||||
updatedAt DateTime @default(now()) @updatedAt
|
||||
typebotId String
|
||||
typebot Typebot @relation(fields: [typebotId], references: [id], onDelete: Cascade)
|
||||
answers Answer[]
|
||||
variables Json[]
|
||||
isCompleted Boolean
|
||||
hasStarted Boolean?
|
||||
isArchived Boolean?
|
||||
typebot Typebot @relation(fields: [typebotId], references: [id], onDelete: Cascade)
|
||||
answers Answer[]
|
||||
logs Log[]
|
||||
}
|
||||
|
||||
@ -241,10 +215,10 @@ model Log {
|
||||
id String @id @default(cuid())
|
||||
createdAt DateTime @default(now())
|
||||
resultId String
|
||||
result Result @relation(fields: [resultId], references: [id], onDelete: Cascade)
|
||||
status String
|
||||
description String
|
||||
details String?
|
||||
result Result @relation(fields: [resultId], references: [id], onDelete: Cascade)
|
||||
|
||||
@@index([resultId])
|
||||
}
|
||||
@ -252,12 +226,12 @@ model Log {
|
||||
model Answer {
|
||||
createdAt DateTime @default(now())
|
||||
resultId String
|
||||
result Result @relation(fields: [resultId], references: [id], onDelete: Cascade)
|
||||
blockId String
|
||||
groupId String
|
||||
variableId String?
|
||||
content String
|
||||
storageUsed Int?
|
||||
result Result @relation(fields: [resultId], references: [id], onDelete: Cascade)
|
||||
|
||||
@@unique([resultId, blockId, groupId])
|
||||
@@index([resultId])
|
||||
@ -279,3 +253,28 @@ model Webhook {
|
||||
typebotId String
|
||||
typebot Typebot @relation(fields: [typebotId], references: [id], onDelete: Cascade)
|
||||
}
|
||||
|
||||
enum WorkspaceRole {
|
||||
ADMIN
|
||||
MEMBER
|
||||
GUEST
|
||||
}
|
||||
|
||||
enum GraphNavigation {
|
||||
MOUSE
|
||||
TRACKPAD
|
||||
}
|
||||
|
||||
enum Plan {
|
||||
FREE
|
||||
PRO
|
||||
TEAM
|
||||
LIFETIME
|
||||
OFFERED
|
||||
}
|
||||
|
||||
enum CollaborationType {
|
||||
READ
|
||||
WRITE
|
||||
FULL_ACCESS
|
||||
}
|
||||
|
@ -7,25 +7,25 @@
|
||||
"license": "AGPL-3.0-or-later",
|
||||
"private": true,
|
||||
"devDependencies": {
|
||||
"typescript": "^4.6.4",
|
||||
"@rollup/plugin-commonjs": "^22.0.0",
|
||||
"typescript": "^4.7.4",
|
||||
"@rollup/plugin-commonjs": "22.0.2",
|
||||
"@rollup/plugin-node-resolve": "^13.3.0",
|
||||
"@rollup/plugin-typescript": "^8.3.2",
|
||||
"rollup": "^2.72.1",
|
||||
"rollup-plugin-dts": "^4.2.1",
|
||||
"rollup-plugin-peer-deps-external": "^2.2.4"
|
||||
"@rollup/plugin-typescript": "8.3.4",
|
||||
"rollup": "2.77.2",
|
||||
"rollup-plugin-dts": "^4.2.2",
|
||||
"rollup-plugin-peer-deps-external": "^2.2.4",
|
||||
"next": "12.2.4",
|
||||
"db": "workspace:*"
|
||||
},
|
||||
"dependencies": {
|
||||
"db": "*",
|
||||
"next": "^12.1.6",
|
||||
"zod": "^3.17.3"
|
||||
"zod": "^3.17.10"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"next": "^12.1.6",
|
||||
"db": "*"
|
||||
"next": "^12.0.0",
|
||||
"db": "workspace:*"
|
||||
},
|
||||
"scripts": {
|
||||
"build": "yarn rollup -c",
|
||||
"dx": "yarn rollup -c --watch"
|
||||
"build": "pnpm rollup -c",
|
||||
"dx": "pnpm rollup -c --watch"
|
||||
}
|
||||
}
|
||||
|
@ -31,7 +31,7 @@ export default [
|
||||
],
|
||||
},
|
||||
{
|
||||
input: 'dist/esm/types/index.d.ts',
|
||||
input: 'dist/esm/index.d.ts',
|
||||
output: [{ file: 'dist/index.d.ts', format: 'esm' }],
|
||||
plugins: [dts()],
|
||||
},
|
||||
|
@ -1,25 +1,6 @@
|
||||
import { PrismaClient } from 'db'
|
||||
import path from 'path'
|
||||
const prisma = new PrismaClient({
|
||||
log: [
|
||||
{
|
||||
emit: 'event',
|
||||
level: 'query',
|
||||
},
|
||||
{
|
||||
emit: 'stdout',
|
||||
level: 'error',
|
||||
},
|
||||
{
|
||||
emit: 'stdout',
|
||||
level: 'info',
|
||||
},
|
||||
{
|
||||
emit: 'stdout',
|
||||
level: 'warn',
|
||||
},
|
||||
],
|
||||
})
|
||||
import fs from 'fs'
|
||||
|
||||
require('dotenv').config({
|
||||
path: path.join(
|
||||
@ -32,18 +13,6 @@ require('dotenv').config({
|
||||
),
|
||||
})
|
||||
|
||||
const main = async () => {
|
||||
prisma.$on('query', (e) => {
|
||||
console.log('Query: ' + e.query)
|
||||
console.log('Params: ' + e.params)
|
||||
console.log('Duration: ' + e.duration + 'ms')
|
||||
})
|
||||
const date = new Date()
|
||||
const lastMonth = new Date(date.getFullYear(), date.getMonth() - 1, 10)
|
||||
const answers = await prisma.answer.findMany({
|
||||
where: { createdAt: { lt: lastMonth } },
|
||||
take: 100,
|
||||
})
|
||||
}
|
||||
const main = async () => {}
|
||||
|
||||
main().then()
|
||||
|
@ -12,9 +12,11 @@
|
||||
"start:workspaces:migration:recover": "ts-node workspaceMigrationRecover.ts"
|
||||
},
|
||||
"devDependencies": {
|
||||
"db": "*",
|
||||
"models": "*",
|
||||
"utils": "*",
|
||||
"ts-node": "^10.7.0"
|
||||
"@types/node": "18.6.4",
|
||||
"db": "workspace:*",
|
||||
"models": "workspace:*",
|
||||
"ts-node": "^10.9.1",
|
||||
"typescript": "^4.7.4",
|
||||
"utils": "*"
|
||||
}
|
||||
}
|
||||
|
33
packages/scripts/prepareEmojis.ts
Normal file
33
packages/scripts/prepareEmojis.ts
Normal file
@ -0,0 +1,33 @@
|
||||
import fs from 'fs'
|
||||
|
||||
export const prepareEmojis = () => {
|
||||
const emojiData = JSON.parse(fs.readFileSync('./emojiData.json', 'utf8'))
|
||||
const strippedEmojiData = {
|
||||
'Smileys & Emotion': emojiData['Smileys & Emotion'].map(
|
||||
(emoji: { emoji: any }) => emoji.emoji
|
||||
),
|
||||
'People & Body': emojiData['People & Body'].map(
|
||||
(emoji: { emoji: any }) => emoji.emoji
|
||||
),
|
||||
'Animals & Nature': emojiData['Animals & Nature'].map(
|
||||
(emoji: { emoji: any }) => emoji.emoji
|
||||
),
|
||||
'Food & Drink': emojiData['Food & Drink'].map(
|
||||
(emoji: { emoji: any }) => emoji.emoji
|
||||
),
|
||||
'Travel & Places': emojiData['Travel & Places'].map(
|
||||
(emoji: { emoji: any }) => emoji.emoji
|
||||
),
|
||||
Activities: emojiData['Activities'].map(
|
||||
(emoji: { emoji: any }) => emoji.emoji
|
||||
),
|
||||
Objects: emojiData['Objects'].map((emoji: { emoji: any }) => emoji.emoji),
|
||||
Symbols: emojiData['Symbols'].map((emoji: { emoji: any }) => emoji.emoji),
|
||||
Flags: emojiData['Flags'].map((emoji: { emoji: any }) => emoji.emoji),
|
||||
}
|
||||
fs.writeFileSync(
|
||||
'strippedEmojis.json',
|
||||
JSON.stringify(strippedEmojiData),
|
||||
'utf8'
|
||||
)
|
||||
}
|
@ -1,86 +0,0 @@
|
||||
import { Plan, PrismaClient, WorkspaceRole } from 'db'
|
||||
import path from 'path'
|
||||
|
||||
const prisma = new PrismaClient()
|
||||
|
||||
export const migrateWorkspace = async () => {
|
||||
const users = await prisma.user.findMany({
|
||||
where: { workspaces: { none: {} } },
|
||||
include: {
|
||||
folders: true,
|
||||
typebots: true,
|
||||
credentials: true,
|
||||
customDomains: true,
|
||||
CollaboratorsOnTypebots: {
|
||||
include: { typebot: { select: { workspaceId: true } } },
|
||||
},
|
||||
},
|
||||
orderBy: { lastActivityAt: 'desc' },
|
||||
})
|
||||
let i = 1
|
||||
for (const user of users) {
|
||||
console.log('Updating', user.email, `(${i}/${users.length})`)
|
||||
i += 1
|
||||
const newWorkspace = await prisma.workspace.create({
|
||||
data: {
|
||||
name: user.name ? `${user.name}'s workspace` : 'My workspace',
|
||||
members: { create: { userId: user.id, role: WorkspaceRole.ADMIN } },
|
||||
stripeId: user.stripeId,
|
||||
plan: user.plan ?? Plan.FREE,
|
||||
},
|
||||
})
|
||||
await prisma.credentials.updateMany({
|
||||
where: { id: { in: user.credentials.map((c) => c.id) } },
|
||||
data: { workspaceId: newWorkspace.id, ownerId: null },
|
||||
})
|
||||
await prisma.customDomain.updateMany({
|
||||
where: {
|
||||
name: { in: user.customDomains.map((c) => c.name) },
|
||||
ownerId: user.id,
|
||||
},
|
||||
data: { workspaceId: newWorkspace.id, ownerId: null },
|
||||
})
|
||||
await prisma.dashboardFolder.updateMany({
|
||||
where: {
|
||||
id: { in: user.folders.map((c) => c.id) },
|
||||
},
|
||||
data: { workspaceId: newWorkspace.id, ownerId: null },
|
||||
})
|
||||
await prisma.typebot.updateMany({
|
||||
where: {
|
||||
id: { in: user.typebots.map((c) => c.id) },
|
||||
},
|
||||
data: { workspaceId: newWorkspace.id, ownerId: null },
|
||||
})
|
||||
for (const collab of user.CollaboratorsOnTypebots) {
|
||||
if (!collab.typebot.workspaceId) continue
|
||||
await prisma.memberInWorkspace.upsert({
|
||||
where: {
|
||||
userId_workspaceId: {
|
||||
userId: user.id,
|
||||
workspaceId: collab.typebot.workspaceId,
|
||||
},
|
||||
},
|
||||
create: {
|
||||
role: WorkspaceRole.GUEST,
|
||||
userId: user.id,
|
||||
workspaceId: collab.typebot.workspaceId,
|
||||
},
|
||||
update: {},
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
require('dotenv').config({
|
||||
path: path.join(
|
||||
__dirname,
|
||||
process.env.NODE_ENV === 'production' ? '.env.production' : '.env.local'
|
||||
),
|
||||
})
|
||||
|
||||
const main = async () => {
|
||||
await migrateWorkspace()
|
||||
}
|
||||
|
||||
main().then()
|
@ -1,44 +0,0 @@
|
||||
// See https://github.com/baptisteArno/typebot.io/issues/37
|
||||
|
||||
import { Plan, PrismaClient, WorkspaceRole } from 'db'
|
||||
import path from 'path'
|
||||
|
||||
const prisma = new PrismaClient()
|
||||
|
||||
export const migrateWorkspace = async () => {
|
||||
const user = await prisma.user.findFirst()
|
||||
if (!user) return
|
||||
console.log('Updating', user.email)
|
||||
const newWorkspace = await prisma.workspace.create({
|
||||
data: {
|
||||
name: user.name ? `${user.name}'s workspace` : 'My workspace',
|
||||
members: { create: { userId: user.id, role: WorkspaceRole.ADMIN } },
|
||||
plan: Plan.TEAM,
|
||||
},
|
||||
})
|
||||
await prisma.credentials.updateMany({
|
||||
data: { workspaceId: newWorkspace.id },
|
||||
})
|
||||
await prisma.customDomain.updateMany({
|
||||
data: { workspaceId: newWorkspace.id },
|
||||
})
|
||||
await prisma.dashboardFolder.updateMany({
|
||||
data: { workspaceId: newWorkspace.id },
|
||||
})
|
||||
await prisma.typebot.updateMany({
|
||||
data: { workspaceId: newWorkspace.id },
|
||||
})
|
||||
}
|
||||
|
||||
require('dotenv').config({
|
||||
path: path.join(
|
||||
__dirname,
|
||||
process.env.NODE_ENV === 'production' ? '.env.production' : '.env.local'
|
||||
),
|
||||
})
|
||||
|
||||
const main = async () => {
|
||||
await migrateWorkspace()
|
||||
}
|
||||
|
||||
main().then()
|
@ -8,8 +8,6 @@ To install, simply run:
|
||||
|
||||
```bash
|
||||
npm install typebot-js
|
||||
|
||||
yarn add typebot-js
|
||||
```
|
||||
|
||||
## Usage
|
||||
|
@ -5,28 +5,29 @@
|
||||
"unpkg": "dist/index.umd.min.js",
|
||||
"license": "AGPL-3.0-or-later",
|
||||
"scripts": {
|
||||
"build": "yarn lint && rollup -c",
|
||||
"build": "pnpm lint && rollup -c",
|
||||
"lint": "eslint src --ext .ts && eslint tests --ext .ts",
|
||||
"test": "yarn jest"
|
||||
"test": "pnpm jest"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@rollup/plugin-typescript": "^8.3.2",
|
||||
"@types/jest": "^27.5.1",
|
||||
"@typescript-eslint/eslint-plugin": "^5.23.0",
|
||||
"@typescript-eslint/parser": "^5.23.0",
|
||||
"eslint": "<8.0.0",
|
||||
"eslint-plugin-functional": "^4.2.1",
|
||||
"eslint-plugin-jest": "^26.1.5",
|
||||
"eslint-plugin-prettier": "^4.0.0",
|
||||
"jest": "^28.1.0",
|
||||
"rollup": "^2.72.1",
|
||||
"@rollup/plugin-typescript": "8.3.4",
|
||||
"@types/jest": "^28.1.6",
|
||||
"@typescript-eslint/eslint-plugin": "5.32.0",
|
||||
"@typescript-eslint/parser": "5.32.0",
|
||||
"eslint": "8.21.0",
|
||||
"eslint-plugin-functional": "^4.2.2",
|
||||
"eslint-plugin-jest": "26.7.0",
|
||||
"eslint-plugin-prettier": "^4.2.1",
|
||||
"jest": "^28.1.3",
|
||||
"prettier": "2.7.1",
|
||||
"rollup": "2.77.2",
|
||||
"rollup-plugin-styles": "^4.0.0",
|
||||
"rollup-plugin-terser": "^7.0.2",
|
||||
"ts-jest": "^28.0.2",
|
||||
"ts-loader": "^9.3.0",
|
||||
"typescript": "^4.6.4"
|
||||
"ts-jest": "^28.0.7",
|
||||
"tslib": "^2.4.0",
|
||||
"typescript": "^4.7.4"
|
||||
},
|
||||
"dependencies": {
|
||||
"jest-environment-jsdom": "^28.1.0"
|
||||
"jest-environment-jsdom": "^28.1.3"
|
||||
}
|
||||
}
|
||||
|
@ -7,29 +7,25 @@
|
||||
"module": "dist/esm/index.js",
|
||||
"types": "dist/index.d.ts",
|
||||
"devDependencies": {
|
||||
"@rollup/plugin-commonjs": "^22.0.0",
|
||||
"@rollup/plugin-commonjs": "22.0.2",
|
||||
"@rollup/plugin-node-resolve": "^13.3.0",
|
||||
"@rollup/plugin-typescript": "^8.3.2",
|
||||
"@types/aws-sdk": "^2.7.0",
|
||||
"rollup": "^2.72.1",
|
||||
"rollup-plugin-dts": "^4.2.1",
|
||||
"@rollup/plugin-typescript": "8.3.4",
|
||||
"rollup": "2.77.2",
|
||||
"rollup-plugin-dts": "^4.2.2",
|
||||
"rollup-plugin-peer-deps-external": "^2.2.4",
|
||||
"tslib": "^2.4.0",
|
||||
"typescript": "^4.6.4"
|
||||
},
|
||||
"dependencies": {
|
||||
"aws-sdk": "^2.1152.0",
|
||||
"models": "*",
|
||||
"next": "^12.1.6"
|
||||
"typescript": "^4.7.4",
|
||||
"aws-sdk": "2.1190.0",
|
||||
"models": "workspace:*",
|
||||
"next": "12.2.4"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"aws-sdk": "^2.1152.0",
|
||||
"@types/aws-sdk": "^2.7.0",
|
||||
"models": "*",
|
||||
"next": "^12.1.6"
|
||||
"models": "workspace:*",
|
||||
"next": "^12.0.0"
|
||||
},
|
||||
"scripts": {
|
||||
"build": "yarn rollup -c",
|
||||
"dx": "yarn rollup -c --watch"
|
||||
"build": "pnpm rollup -c",
|
||||
"dx": "pnpm rollup -c --watch"
|
||||
}
|
||||
}
|
||||
|
@ -31,7 +31,7 @@ export default [
|
||||
],
|
||||
},
|
||||
{
|
||||
input: 'dist/esm/types/index.d.ts',
|
||||
input: 'dist/esm/index.d.ts',
|
||||
output: [{ file: 'dist/index.d.ts', format: 'esm' }],
|
||||
plugins: [dts()],
|
||||
},
|
||||
|
@ -241,16 +241,13 @@ export const uploadFiles = async ({
|
||||
|
||||
declare const window: any
|
||||
|
||||
const isBrowser = () => {
|
||||
return Boolean(typeof window !== 'undefined' && window.__env)
|
||||
}
|
||||
const isBrowser = () => Boolean(typeof window !== 'undefined')
|
||||
|
||||
export const env = (key = ''): string | undefined => {
|
||||
if (isBrowser() && window.__env) {
|
||||
return window.__env[key] === "''" ? undefined : window.__env[key]
|
||||
}
|
||||
if (isBrowser() && window.__env)
|
||||
return isEmpty(window.__env[key]) ? undefined : window.__env[key]
|
||||
|
||||
return process.env['NEXT_PUBLIC_' + key] === "''"
|
||||
return isEmpty(process.env['NEXT_PUBLIC_' + key])
|
||||
? undefined
|
||||
: (process.env['NEXT_PUBLIC_' + key] as string)
|
||||
}
|
||||
@ -263,3 +260,19 @@ export const hasValue = (
|
||||
value !== '' &&
|
||||
value !== 'undefined' &&
|
||||
value !== 'null'
|
||||
|
||||
export const getViewerUrl = (props?: {
|
||||
isBuilder?: boolean
|
||||
returnAll?: boolean
|
||||
}): string | undefined => {
|
||||
if (env('VIEWER_URL'))
|
||||
return props?.returnAll
|
||||
? env('VIEWER_URL')
|
||||
: env('VIEWER_URL')?.split(',')[0]
|
||||
return (
|
||||
'https://' +
|
||||
(props?.isBuilder
|
||||
? process.env.NEXT_PUBLIC_VERCEL_URL?.replace('builder-v2', 'viewer-v2')
|
||||
: process.env.NEXT_PUBLIC_VERCEL_URL)
|
||||
)
|
||||
}
|
||||
|
@ -6,10 +6,11 @@
|
||||
"author": "baptisteArno",
|
||||
"license": "AGPL-3.0-or-later",
|
||||
"devDependencies": {
|
||||
"@prettier/plugin-php": "^0.18.4"
|
||||
"@prettier/plugin-php": "^0.18.9",
|
||||
"prettier": "2.7.1"
|
||||
},
|
||||
"scripts": {
|
||||
"deploy": "yarn copy && yarn commit",
|
||||
"deploy": "pnpm copy && pnpm commit",
|
||||
"copy": "svn copy ./trunk ./tags/2.1.9",
|
||||
"commit": "svn ci -m 'Fix standard embed when window loaded'"
|
||||
}
|
||||
|
Reference in New Issue
Block a user