2
0

⚗️ Implement bot v2 MVP (#194)

Closes #190
This commit is contained in:
Baptiste Arnaud
2022-12-22 17:02:34 +01:00
committed by GitHub
parent e55823e011
commit 1a3869ae6d
202 changed files with 8060 additions and 1152 deletions

View File

@ -0,0 +1,8 @@
module.exports = {
root: true,
extends: ['custom'],
rules: {
'@next/next/no-img-element': 'off',
'@next/next/no-html-link-for-pages': 'off',
},
}

View File

@ -0,0 +1,30 @@
{
"name": "@typebot.io/react",
"version": "1.0.0",
"description": "",
"main": "dist/index.mjs",
"types": "dist/index.d.ts",
"scripts": {
"build": "pnpm tsc --noEmit && tsup",
"dev": "tsup --watch",
"lint": "eslint --fix \"src/**/*.ts*\""
},
"keywords": [],
"author": "Baptiste Arnaud",
"license": "ISC",
"dependencies": {
"@typebot.io/js": "workspace:*"
},
"devDependencies": {
"@types/react": "^18.0.26",
"eslint": "^8.30.0",
"eslint-config-custom": "workspace:*",
"react": "^18.2.0",
"tsconfig": "workspace:*",
"tsup": "6.5.0",
"typescript": "^4.9.4"
},
"peerDependencies": {
"react": "18.0.0"
}
}

View File

@ -0,0 +1,27 @@
import { useEffect } from 'react'
import type { BotProps } from '@typebot.io/js'
type Props = BotProps
declare global {
namespace JSX {
interface IntrinsicElements {
'typebot-standard': React.DetailedHTMLProps<
React.HTMLAttributes<HTMLElement>,
HTMLElement
>
}
}
}
export const Standard = (props: Props) => {
useEffect(() => {
;(async () => {
const { registerWebComponents } = await import('@typebot.io/js')
registerWebComponents(props)
})()
// eslint-disable-next-line react-hooks/exhaustive-deps
}, [])
return <typebot-standard />
}

View File

@ -0,0 +1,6 @@
/* eslint-disable import/no-anonymous-default-export */
import { Standard } from './Standard'
export { Standard }
export default { Standard }

View File

@ -0,0 +1,10 @@
{
"extends": "tsconfig/react-library.json",
"include": ["src/**/*"],
"compilerOptions": {
"baseUrl": ".",
"paths": {
"@/*": ["src/*"]
}
}
}

View File

@ -0,0 +1,9 @@
import { defineConfig } from 'tsup'
export default defineConfig((options) => ({
entry: ['src/index.ts'],
sourcemap: options.watch,
minify: !options.watch,
dts: true,
format: ['esm'],
}))